export declare const componentRunningStatus: { /** * Set to true while a scope's setup() method is running. * * NOTE: setup() is called during scope creation, which can only happen inside * a component's outer function. The outer function is an unrestricted context, * so setup() inherits the same permissions — reactive primitives (atoms, events, * channels, actions, setters, on(), effect(), …) CAN be created freely here, * exactly as they can be in the outer function itself. * * This flag is kept for informational / tooling purposes (e.g. CSS-in-JS * assertModuleLevel checks) and is NOT used by assertNotInRestrictedContext. */ setupInProgress: boolean; /** * Set to true while the template function (inner render function) is running. * * During template execution reactive primitives CANNOT be created because the * template reruns on every update — creating atoms/events/etc. here would * produce a new instance on every render, causing memory leaks and broken * reactivity. Only `scope()` / `useScope()` lookups are permitted. */ templateInProgress: boolean; /** * Set to true while a component's outer function is running. * Tracked for debugging / devtools purposes only — does NOT restrict anything. * Reactive primitives CAN be created freely in the outer function. */ viewOuterInProgress: boolean; /** * Set to true while an `eleHook()` or `htmlHook()` mount or lifecycle * callback is executing. Indicates that a hook is in progress and allows * certain operations that would otherwise be restricted. */ isHookRunning: boolean; }; /** * Returns true when the current execution context forbids the creation of new * reactive primitives. * * Restricted contexts * ─────────────────── * • Template function — reruns every render; primitives created here leak * • effect() / memo() — should only read state, never create new primitives * * Unrestricted contexts * ───────────────────── * • ES module scope — top of file, safe to create global primitives * • Component outer fn — runs once on mount; the canonical place for locals * • Scope setup() — called from the outer fn, inherits its permissions * • Hook callbacks — eleHook / htmlHook mount and lifecycle methods run * with isHookRunning = true. Subscriptions and atom * creation are permitted because the hook author owns * teardown via the onCleanup return value. */ export declare function isInRestrictedContext(): boolean; /** * Throws a descriptive error when called from a restricted execution context. * * Allowed * ─────── * ✅ ES module scope (top-level, outside any component) * ✅ Component outer function (runs once on mount) * ✅ Scope setup() (runs inside the outer function — same rules) * ✅ Hook callbacks (isHookRunning === true) * eleHook / htmlHook mount and lifecycle methods * may freely subscribe and create atoms. The hook * author is responsible for unsubscribing inside * the onCleanup return — this is NOT automatic. * * Forbidden * ───────── * ❌ Template / render function (templateInProgress === true) * ❌ effect() or memo() callback (isEffectRunning() === true) */ export declare function assertNotInRestrictedContext(operationName: string): void; /** * Throws unless the current execution context is a component's outer function * (i.e. `viewOuterInProgress === true`). * * Use this for APIs — such as `ws()` — that register cleanup handlers via * `registerCleanup` and therefore require an active component host. Calling * them at module level or inside inner functions (event handlers, timers, etc.) * would silently skip cleanup, leaving timers and sockets running after the * component unmounts. * * Allowed * ─────── * ✅ Component outer function (viewOuterInProgress === true) * ✅ Scope setup() (sets viewOuterInProgress = true, same rules) * * Forbidden * ───────── * ❌ Module / file scope (no active host, no cleanup) * ❌ Inner functions / event handlers (outer fn has already returned) * ❌ Template / render function (templateInProgress === true) * ❌ effect() or memo() callback (isEffectRunning() === true) */ export declare function assertComponentOuterContext(operationName: string): void; //# sourceMappingURL=componentStatus.d.ts.map