import { f as Computed, m as Signal } from "../children-s3nFjpLA.mjs"; //#region src/utilities/event-driven.d.ts /** * A subscribe function: registers a `notify` callback and returns an * unsubscribe cleanup. Same contract as `useSyncExternalStore`. */ type Subscribe = (notify: () => void) => () => void; /** * Returns a `Subscribe` for one or more DOM events on a target. * * @example * ```ts * const [playing, stop] = sync(fromEvent(el, ["play", "pause"]), () => !el.paused); * ``` */ declare function fromEvent(target: EventTarget, events: string | string[]): Subscribe; /** * Keeps a reactive value in sync with an external source by re-reading * `getter` whenever `subscribe` notifies of a change. * * Returns a `[value, cleanup]` tuple. * * Without `setter` → value is `Computed` (read-only). * With `setter` → value is `Signal` (writable). * * @example * ```ts * const [playing, stop] = sync(fromEvent(el, ["play", "pause"]), () => !el.paused); * * const [volume, stopVolume] = sync( * fromEvent(el, "volumechange"), * () => el.volume, * (v) => { el.volume = v; }, * ); * * // Any external store * const [data, unsub] = sync( * (notify) => { store.on("change", notify); return () => store.off("change", notify); }, * () => store.getSnapshot(), * ); * ``` */ declare function sync(subscribe: Subscribe, getter: () => T): [Computed, () => void]; declare function sync(subscribe: Subscribe, getter: () => T, setter: (value: T) => void): [Signal, () => void]; //#endregion export { Subscribe, fromEvent, sync };