import { S as Setter } from './use-BBBnQAPp.js'; export { C as Context, R as ResourceControl, U as UseContext, a as UseOptions, b as Useable, g as getContextValue, i as isUseable, c as popContext, p as pushContext, r as releaseGlobalKey, d as resetContext, u as use } from './use-BBBnQAPp.js'; interface RefObject { current: T | null; } type RefCallback = (instance: T | null) => void; type Ref = RefObject | RefCallback | null; type ForwardedRef = RefCallback | RefObject | null; /** * Unified sync API * - sync(): Force refresh (flush pending effects) * - sync(fn): Batch updates (run fn then flush) */ declare function sync(fn?: () => void): void; /** * Creates a mutable ref object that persists across renders * * @example * ```tsx * function InputWithFocus() { * const inputRef = useRef() * * const focusInput = () => { * inputRef.current?.focus() * } * * return ( *
* * *
* ) * } * ``` */ declare function useRef(initialValue: T): RefObject; declare function useRef(initialValue: T | null): RefObject; declare function useRef(): RefObject; declare function isReactive(value: unknown): boolean; /** * Low-level reactivity primitives — additive escape hatch alongside `use()`. * * These bypass the hook system and the component-mount overhead (~14 μs per * `use(0)` call in Phase 0 measurements). Use them for framework-level state, * detached effects, or hot loops that mount/teardown signals at high frequency. * * Component-scoped state should still use `use()` — it integrates with hooks, * the global registry, devtools, and component-lifecycle cleanup. * * @example * import { createSignal, createEffect } from 'flexium/core' * * const [count, setCount] = createSignal(0) * createEffect(() => console.log('count is', count())) * setCount(c => c + 1) // → logs "count is 1" on next microtask */ type Signal = readonly [() => T, Setter]; /** * Create a reactive signal with a stable [getter, setter] tuple. * * Unlike `use(value)`, this is NOT tied to a component — it can be created at * module scope or inside arbitrary functions. The signal lives until all of * its subscribers are stopped and the tuple is garbage-collected. */ declare function createSignal(initialValue: T): Signal; /** * Create an effect that runs immediately and re-runs when any signal it reads * changes. Unlike `unsafeEffect()`, this is not auto-registered with a * component instance — it lives until `.stop()` is called on the returned * handle. * * @returns a handle with `.stop()` to permanently dispose the effect */ declare function createEffect(fn: () => void): { stop: () => void; }; /** * Create a lazy computed signal — a derived getter that re-evaluates only * when one of its deps changes AND the value is actually read. * * @returns a `() => T` getter; call `.stop` on the returned handle to dispose */ declare function createComputed(fn: () => T): { get: () => T; stop: () => void; }; export { type ForwardedRef, type Ref, type RefCallback, type RefObject, Setter, createComputed, createEffect, createSignal, isReactive, sync, useRef };