@sometic/svelte
v0.1.8
Published
Svelte store-oriented foundation adapters for Sometic (store bind; component kit expands later).
Maintainers
Readme
@sometic/svelte
Svelte store-oriented foundation adapters for Sometic (store bind; component kit expands later).
@sometic/svelte is a Wave B foundation package. It ships createSvelteStoreBind, a disposable wrapper around @sometic/store with a Svelte-friendly subscribe / set / update shape. It does not yet provide a full Svelte component library like @sometic/react or @sometic/vue. Treat it as an experimental store bridge while the broader catalog expands.
Portable behavior is the point of Sometic. Store logic stays in @sometic/store; this adapter only adapts subscription and lifecycle to Svelte-style consumers. Imports stay free of window (checked through @sometic/adapter-contract), and dispose() tears down the underlying store when your component or module ends.
Standout exports: createSvelteStoreBind (readable-style subscribe that emits the current value immediately, plus set, update, store, dispose) and svelteAdapterCapabilities (["storeBind"]). You can wrap the bind with Svelte 5 runes or $-store patterns in your own code without forking store internals.
In the ecosystem this pairs with Angular, Solid, and Preact Wave B packages. Contracts and fixtures: @sometic/adapter-contract. Foundation: @sometic/core. Product overview: Introduction. Capability notes: Svelte.
Install
Peer (optional meta): svelte ^5.
pnpm add @sometic/svelte sveltenpm install @sometic/svelte svelteyarn add @sometic/svelte svelteUsage
Svelte-shaped store bind:
import { createSvelteStoreBind } from "@sometic/svelte";
const counter = createSvelteStoreBind({ count: 0 });
const unsubscribe = counter.subscribe((value) => {
console.log(value.count);
});
counter.update((state) => ({ count: state.count + 1 }));
unsubscribe();
counter.dispose();Capability list:
import { svelteAdapterCapabilities } from "@sometic/svelte";
console.log(svelteAdapterCapabilities.includes("storeBind")); // truePeers / when not to use
- Optional peer
svelte. Install it in Svelte apps; the bind API does not touch Svelte globals at import time. - No Sometic Svelte Button/Form/Dialog components yet. Prefer
@sometic/react,@sometic/vue, or@sometic/elementsfor full UI adapters, or bind engines from@sometic/domyourself. - If you only need the core store without a Svelte subscribe shape, depend on
@sometic/storedirectly.
Docs
License
MIT
