UNPKG

trellis

Version:

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

45 lines 1.8 kB
/** * Combobox Svelte — `createComboboxStore` store-contract bindings (ADR 0034). * * Import from `trellis/combobox/svelte`: * * const combobox = createComboboxStore({ items, onSelect }); * {#if $combobox.state.open}…{/if} * <input bind:value={$combobox.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/combobox/svelte */ import type { ComboboxConfig, ComboboxState, UseComboboxReturn } from '../core/index.js'; /** Accept either a config (fresh core) or an existing core (shared mount). */ export type ComboboxInput = ComboboxConfig | UseComboboxReturn; export interface ComboboxStore { /** Full combobox state (auto-subscribable). */ state: { subscribe(run: (value: ComboboxState) => 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: ComboboxState['results']) => void): () => void; }; /** Per-result highlight ranges (auto-subscribable). */ highlight: { subscribe(run: (value: ComboboxState['highlight']) => void): () => void; }; actions: UseComboboxReturn['actions']; /** Raw core (framework-free) for advanced use. */ core: UseComboboxReturn; } /** * Create a store-contract combobox from a config or an existing core; * actions mutate the shared core. */ export declare function createComboboxStore(input: ComboboxInput): ComboboxStore; //# sourceMappingURL=index.d.ts.map