/** Symbol for disposal (using standard Symbol.dispose if available) */ export const _dispose: any; /** Symbol for accessing element's reactive state */ export const _state: unique symbol; /** Symbol for enabling element effects */ export const _on: unique symbol; /** Symbol for disabling element effects */ export const _off: unique symbol; /** Symbol for adding child to element */ export const _add: unique symbol; /** Directive prefix (default: ':') */ export let prefix: string; export function isCE(el: any): any; /** * A reactive signal containing a value. * @template T * @typedef {Object} Signal * @property {T} value - Current value (reading subscribes, writing notifies) * @property {() => T} peek - Read without subscribing * @property {() => T} valueOf - Get value for coercion * @property {() => T} toJSON - Get value for JSON serialization * @property {() => string} toString - Get value as string */ /** * Internal effect function type. * @typedef {Object} EffectFn * @property {Set>} deps - Dependency sets * @property {() => void} fn - Original function */ /** * Creates a reactive signal. * @template T * @type {(value: T) => Signal} */ export let signal: (value: T_1) => Signal; /** * Creates a reactive effect that re-runs when dependencies change. * @type {(fn: () => void | (() => void)) => () => void} */ export let effect: (fn: () => void | (() => void)) => () => void; /** * Creates a computed signal derived from other signals. * @template T * @type {(fn: () => T) => Signal} */ export let computed: (fn: () => T_1) => Signal; /** * Batches multiple signal updates into a single notification. * @template T * @type {(fn: () => T) => T} */ export let batch: (fn: () => T_1) => T_1; /** * Runs a function without tracking signal dependencies. * @template T * @type {(fn: () => T) => T} */ export let untracked: (fn: () => T_1) => T_1; /** * Registry of directive handlers. * @type {Record} */ export let directive: Record; /** * Registry of modifier functions. * @type {Record} */ export let modifier: Record; /** @type {(el: Element, name: string, expr: string, state: Object) => () => (() => void) | void} */ export let dir: (el: Element, name: string, expr: string, state: any) => () => (() => void) | void; /** * Compiles an expression string into an evaluator function. * @type {(expr: string) => (state: Object) => any} */ export let compile: (expr: string) => (state: any) => any; export function parse(expr: string): (state: any, cb?: (value: any) => any) => any; export function use(config: SpraeConfig): void; export function decorate(fn: Function & { target?: Element; }, mods: string[]): Function; /** MutationObserver reference, set by sprae.start() */ export let mo: any; export function mutate(fn: any): void; export function start(root?: Element, values?: any): any; export function frag(tpl: HTMLTemplateElement | FragmentLike): FragmentLike; export function dashcase(str: string): string; export function attr(el: any, name: any, v: any): any; export function clsx(c: string | string[] | Record | null | undefined): string; export function throttle(fn: T_1, ms?: number | Function): T_1; export function debounce(fn: T_1, ms?: number | Function, immediate?: boolean): T_1; export * from "./store.js"; export default sprae; /** * A reactive signal containing a value. */ export type Signal = { /** * - Current value (reading subscribes, writing notifies) */ value: T_1; /** * - Read without subscribing */ peek: () => T_1; /** * - Get value for coercion */ valueOf: () => T_1; /** * - Get value for JSON serialization */ toJSON: () => T_1; /** * - Get value as string */ toString: () => string; }; /** * Internal effect function type. */ export type EffectFn = { /** * - Dependency sets */ deps: Set>; /** * - Original function */ fn: () => void; }; export type DirectiveHandler = (el: Element, state: any, expr: string, name?: string) => ((value: any) => void | (() => void)) | { [Symbol.dispose]: () => void; } | void; export type ModifierHandler = (fn: Function, ...args: string[]) => Function; export type SpraeState = { /** * - Internal signals map */ _signals?: Record; }; export type SpraeConfig = { /** * - Custom expression compiler */ compile?: (expr: string) => (state: any) => any; /** * - Directive prefix (default: ':') */ prefix?: string; /** * - Signal factory */ signal?: (value: T_1) => Signal; /** * - Effect factory */ effect?: (fn: () => void | (() => void)) => () => void; /** * - Computed factory */ computed?: (fn: () => T_1) => Signal; /** * - Batch function */ batch?: (fn: () => T_1) => T_1; /** * - Untracked function */ untracked?: (fn: () => T_1) => T_1; /** * - Directive initializer */ dir?: (el: Element, name: string, expr: string, state: any) => () => (() => void) | void; }; export type FragmentLike = { /** * - The owner document */ ownerDocument: Document; /** * - Child nodes of the fragment */ childNodes: Node[]; /** * - The document fragment content */ content: DocumentFragment; /** * - Remove the fragment from DOM */ remove: () => void; /** * - Replace the fragment with an element */ replaceWith: (el: Node) => void; /** * - Attributes from the original template */ attributes: Attr[]; /** * - Remove an attribute */ removeAttribute: (name: string) => void; }; /** * @callback DirectiveHandler * @param {Element} el - Target element * @param {Object} state - Reactive state object * @param {string} expr - Expression string * @param {string} [name] - Directive name with modifiers * @returns {((value: any) => void | (() => void)) | { [Symbol.dispose]: () => void } | void} */ /** * @callback ModifierHandler * @param {Function} fn - Function to modify * @param {...string} args - Modifier arguments (from dash-separated values) * @returns {Function} */ /** * @typedef {Object} SpraeState * @property {Record} [_signals] - Internal signals map */ /** * Applies directives to an HTML element and manages its reactive state. * * @param {Element} [el=document.body] - The target HTML element to apply directives to. * @param {Object} [state] - Initial state values to populate the element's reactive state. * @returns {SpraeState & Object} The reactive state object associated with the element. */ declare function sprae(root?: HTMLElement, state?: any): SpraeState & any; declare namespace sprae { let version: any; } //# sourceMappingURL=core.d.ts.map