@sometic/preact
v0.1.8
Published
Preact external-store foundation adapters for Sometic (store bind; component kit expands later).
Maintainers
Readme
@sometic/preact
Preact external-store foundation adapters for Sometic (store bind; component kit expands later).
@sometic/preact is a Wave B foundation package. It provides createPreactStoreBind, shaped for Preact’s external-store pattern (getSnapshot + subscribe) over @sometic/store. It does not re-export a Preact component kit: there is no @sometic/preact/button or @sometic/preact/structure. Phase 20 structure components (Tabs, Accordion, Breadcrumb, Command palette, Tree) ship on @sometic/react/structure and @sometic/vue/structure, or via @sometic/dom / Elements. Keep this package for store bridging.
Sometic’s adapters stay thin. Preact should not fork store or auth engines. This bind keeps the same store semantics as other frameworks, asserts no import-time window access through @sometic/adapter-contract, and exposes dispose() for cleanup when the host unmounts.
Standout exports: createPreactStoreBind (getSnapshot, subscribe, set, store, dispose) and preactAdapterCapabilities (["storeBind"]). Pair getSnapshot / subscribe with Preact’s useSyncExternalStore (or equivalent) in your own components.
Ecosystem: Wave B with Angular, Svelte, and Solid. Contracts: @sometic/adapter-contract. Foundation: @sometic/core. Product overview: Introduction. Capability notes: Preact.
Install
Peer (optional meta): preact ^10.
pnpm add @sometic/preact preactnpm install @sometic/preact preactyarn add @sometic/preact preactUsage
External-store shaped bind:
import { createPreactStoreBind } from "@sometic/preact";
const counter = createPreactStoreBind({ count: 0 });
const unsubscribe = counter.subscribe(() => {
console.log(counter.getSnapshot().count);
});
counter.set({ count: 1 });
unsubscribe();
counter.dispose();Capability flag:
import { preactAdapterCapabilities } from "@sometic/preact";
console.log(preactAdapterCapabilities); // ["storeBind"]Peers / when not to use
- Optional peer
preact. Install it in Preact apps; the bind does not require Preact at import time. - No Preact Button/Form/Dialog kit here yet. Prefer
@sometic/reactwhen you need the full Wave A React surface (Preact compat may work for some apps, but this package is store-bind only). - Use
@sometic/storedirectly if you do not need the Preact snapshot/subscribe wrapper.
Docs
License
MIT
