UNPKG

@histoire/plugin-svelte

Version:

Histoire plugin for Svelte 4/5 and SvelteKit 2/3 support

14 lines (13 loc) • 592 B
/** * Keeps a variant's state and a Svelte component's state in sync, in both * directions, without echoing an update back to the side it came from. * * The echo is broken by comparing against the last value that crossed, NOT by * a "currently syncing" flag: the component is polled every frame and mounting * seeds the state several times, so a flag gets out of phase and then swallows * the next *genuine* change instead of the echo. */ export declare function syncState(variantState: any, onChange: (state: any) => unknown): { apply: (value: any) => void; stop(): void; };