Tag: typescript

  • pocketbase-schema

    Type-safe PocketBase development — automatically.

    pocketbase-schema is a utility that generates TypeScript types from your PocketBase collections. It’s built for developers who want safety, clarity, and DX improvements when building apps on top of PocketBase.


    Features

    • Automatic Type Generation: Pull your PocketBase schema and generate complete TypeScript definitions for collections and records.
    • Collections Enum: Access collection names as constants instead of raw strings.
    • Field Type Enums: Automatically generate enums for select field options.
    • Flexible CLI & API: Run it as a script or import it into your toolchain. It supports both approaches cleanly.
    • Local-First Config: Uses cosmiconfig so you can configure it with pocketbase-schema.config.js, package.json, or a custom location.

    Installation

    npm install @sparkstone/pocketbase-schema --save-dev

    or

    pnpm add @sparkstone/pocketbase-schema --save-dev

    Usage

    Once installed, run the CLI to generate types from your schema export:

    pocketbase-schema generate --input=pb_schema.json --output=src/lib/pb-types.ts

    You can also run it programmatically in a Node script:

    import { generate } from '@sparkstone/pocketbase-schema';
    
    generate({
      input: './pb_schema.json',
      output: './src/lib/pb-types.ts',
    });
    

    “We built pocketbase-schema because we love PocketBase — and we wanted full type safety without manual copy-pasting.”
    — The Sparkstone Team

    View source

  • id-order-spacing

    Fast, precise ordering for sortable lists.

    id-order-spacing is a small utility for maintaining a stable order field in databases — built for apps where items need to be manually sorted, rearranged, or ranked. Loosely inspired by Jira’s LexoRank system, it lets you insert items between others without reindexing the entire list.


    What It Does

    • Stable Ordering via Spaced Values: Instead of using integers (1, 2, 3...), id-order-spacing generates order values like 100, 200, 150, etc. — making it easy to insert new items between existing ones without shifting everything.
    • Drop-In Reordering Logic: Handles edge cases like items moving to the start or end, gaps that are too tight, and optional re-spacing when needed.
    • Designed for Real-World UIs: Perfect for drag-and-drop lists, kanban boards, ranked queues, and any interface where users need to control the position of items.
    • Works with Any Backend: Store order as a number or string in your database. Use it in SQL, NoSQL, Firebase, or wherever your data lives.

    “We built this because we wanted simple, robust ordering logic that just works — without needing to constantly reshuffle rows in the database.”
    — The Sparkstone Team

    View source

  • solid-validation

    solid-validation

    Lightweight, flexible form validation for Solid.js.

    solid-validation is a validation library built for Solid.js. It offers a clean, reactive API for handling form input validation, submission state, and error messaging — with support for custom logic and backend integration. It’s fast, ergonomic, and integrates seamlessly with real-world workflows.


    Installation

    npm install @sparkstone/solid-validation

    or

    pnpm add @sparkstone/solid-validation

    Features

    • Simple form handling: Hook into form submission and manage input-level and global errors with built-in helpers.
    • Reactive state: Track isSubmitting, isSubmitted, and live validation errors as part of your UI.
    • Custom validators: Use your own validation functions alongside native input validation.
    • PocketBase support: Includes helpers to integrate with PocketBase forms and handle server-side validation errors cleanly.

    “We made solid-validation to give Solid.js devs a simple, ergonomic way to handle forms — no dependencies, no fuss.”
    — The Sparkstone Team


    View source

  • Dawei

    Minimal, flexible state management for React.

    dawei is a tiny but powerful state management library for React. Inspired by Zustand and Recoil, it offers a simple API that works without context — with support for deeply nested values, subscriptions, and scoped stores. It’s built for projects that want fine-grained control without boilerplate.


    Features

    • Minimal API: No providers, no reducers, no boilerplate. Just a clean createStore() and store.use() pattern.
    • Deep State Access: Subscribe to and modify deeply nested keys like 'company.name' — even if they don’t exist yet.
    • Global Reactivity: All components stay in sync with the store automatically. No selectors or memo worries.
    • Direct Control: Update the store from anywhere in your app with store.set() or listen for changes with store.subscribe().

    Installation

    npm install dawei

    or

    yarn add dawei

    Usage Example

    import { createStore } from 'dawei';
    
    const formStore = createStore({});
    
    const Input = () => {
      const [name, setName] = formStore.use('name');
      const [email, setEmail] = formStore.use('email');
      const [companyName, setCompanyName] = formStore.use('company.name');
    
      return (
        
           setName(e.target.value)} />
           setEmail(e.target.value)} />
           setCompanyName(e.target.value)} />
        
      );
    };
    
    function randomBitOfApi() {
      formStore.set({ saved: true });
    }
    
    let unsubscribe = formStore.subscribe(state => {
      console.log('formStore changed', state);
    });
        

    “Dawei gives us the store behavior we want — without the noise.”
    — The Sparkstone Team

    View source