/** * Action-builder sugar — ergonomic wrappers that accept Signal / Collection * instead of raw state keys, preserving encapsulation. * * @example * ```ts * const count = signal('count', 0) * const items = collection('items', rows, { key: 'id' }) * * set(count, 42) // → new SetState('count', 42) * toggle(count) // → new ToggleState('count') * append(items, newRow) // → new AppendState('items', newRow) * pop(items, 0) // → new PopState('items', 0) * pop(items) // → new PopState('items', -1) (last element) * ``` */ import type { Signal } from '../rx/signal.js'; import type { Collection } from '../rx/collection.js'; import { SetState, ToggleState, AppendState, PopState } from './client.js'; import type { SetStateOpts } from './client.js'; /** Anything that resolves to a state key: Signal, Collection, or raw string. */ export type StateTarget = Signal | Collection | string; /** Set a state value. `set(signal, value)` → `new SetState(signal.key, value)` */ export declare function set(target: StateTarget, value: unknown, opts?: SetStateOpts): SetState; /** Toggle a boolean state value. `toggle(signal)` → `new ToggleState(signal.key)` */ export declare function toggle(target: StateTarget): ToggleState; /** Append an item to an array state value. Optionally specify insertion index. */ export declare function append(target: StateTarget, item: unknown, index?: number): AppendState; /** Remove an element from an array by index or value. Defaults to last element (-1). */ export declare function pop(target: StateTarget, indexOrValue?: number | string): PopState; //# sourceMappingURL=sugar.d.ts.map