stable

svelte

Zero-dependency Svelte stores — collectionStore, queryStore, syncStore — implementing the store contract inline for Svelte 4 and 5.

@noy-db/in-svelte · pnpm add @noy-db/hub @noy-db/in-svelte Svelte stores for noy-db — no svelte peer dependency.

What it does

Three store factories conforming to Svelte's standard store contract (subscribe(fn) → unsubscribe), re-implemented inline rather than depending on svelte: collectionStore gives a reactive { records, loading, error }; queryStore re-runs a query builder on every change event; syncStore exposes the hub's last change event for status indicators. Works with Svelte 4's $store auto-subscription and Svelte 5 runes, and with any other consumer of the store contract (e.g. SvelteKit load functions).

Usage

<script>
  import { collectionStore } from '@noy-db/in-svelte'
  const invoices = collectionStore(vault, 'invoices')
</script>

{#each $invoices.records as invoice}
  {invoice.id}
{/each}

See also