UNPKG

trellis

Version:

Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications

41 lines 1.63 kB
/** * Palette Svelte — `createPaletteStore` store-contract bindings (ADR 0034). * * Import from `trellis/palette/svelte`: * * const palette = createPaletteStore({ items, onSelect }); * // In markup: {#if $palette.state.open}…{/if} * <input bind:value={$palette.query} /> * * No dependency on the svelte package — only the store contract * (`subscribe(run) => unsubscribe`, `run` invoked immediately), so it works * across Svelte 4/5 (see `src/svelte/stores.ts`, `trellis/forms/svelte`). * * @module trellis/palette/svelte */ import type { PaletteConfig, PaletteState, UsePaletteReturn } from '../core/index.js'; /** Accept either a config (fresh core) or an existing core (shared mount). */ export type PaletteInput = PaletteConfig | UsePaletteReturn; export interface PaletteStore { /** Full palette state (auto-subscribable). */ state: { subscribe(run: (value: PaletteState) => void): () => void; }; /** Just the query string (auto-subscribable, for `bind:value`). */ query: { subscribe(run: (value: string) => void): () => void; }; /** Just the filtered results (auto-subscribable, for `{#each}`). */ results: { subscribe(run: (value: PaletteState['results']) => void): () => void; }; actions: UsePaletteReturn['actions']; /** Raw core (framework-free) for advanced use. */ core: UsePaletteReturn; } /** * Create a store-contract palette from a config or an existing core; * actions mutate the shared core. */ export declare function createPaletteStore(input: PaletteInput): PaletteStore; //# sourceMappingURL=index.d.ts.map