import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-DILeh3-s.mjs"; import { i as PropertiesOf, n as CustomElementRegistry, r as EventsOf } from "./custom-elements-CdpilMDu.mjs"; import * as CSS from "csstype"; import { JSX } from "dom-expressions/src/jsx"; //#region src/signals/lib.d.ts declare const SIGNAL: unique symbol; declare const COMPUTED: unique symbol; declare const EFFECT: unique symbol; declare const EFFECT_SCOPE: unique symbol; /** * Returns `true` if `fn` is a signal handle created by {@link signal}. * * Relies on the SIGNAL symbol. */ declare function isSignal(fn: unknown): boolean; /** * Returns `true` if `fn` is a computed handle created by {@link computed}. * * Relies on the COMPUTED symbol. */ declare function isComputed(fn: unknown): boolean; /** * Returns `true` if `fn` is an effect cleanup handle created by {@link effect}. * * Relies on the EFFECT symbol. */ declare function isEffect(fn: unknown): boolean; /** * Returns `true` if `fn` is an effectScope cleanup handle created by * {@link effectScope}. * * Relies on `Function.name` matching the internal `effectScopeOper` function name. */ declare function isEffectScope(fn: () => void): boolean; /** * Creates a mutable reactive signal. * * - **Read**: call with no arguments → returns the current value and * subscribes the active tracking context. * - **Write**: call with a value → updates the signal and schedules * downstream effects if the value changed. * * @example * ```ts * const count = signal(0); * count(); // → 0 (read) * count(1); // write – effects depending on count will re-run * count(); // → 1 * ``` */ declare function signal(): Updater & Computed; declare function signal(initialValue: T): Updater & Computed; /** * Creates a lazily-evaluated computed value. * * The `getter` is only called when the computed value is read **and** one of * its dependencies has changed since the last evaluation. If nothing has * changed the cached `value` is returned without re-running `getter`. * * Computed values are read-only; they cannot be set directly. * * @param getter - Pure function deriving a value from other reactive sources. * Receives the previous value as an optional optimisation hint. * * @example * ```ts * const a = signal(1); * const b = signal(2); * const sum = computed(() => a() + b()); * * sum(); // → 3 * a(10); * sum(); // → 12 (re-evaluated lazily) * ``` */ declare function computed(getter: (previousValue?: T) => T): () => T; /** * Creates a reactive side-effect that runs immediately and re-runs whenever * any signal or computed it read during its last execution changes. * * Use {@link onCleanup} inside `fn` to register teardown logic that runs * before each re-execution and on final disposal. * * If `effect` is called inside an `effectScope` or another `effect`, the * new effect is automatically owned by the outer scope and will be disposed * when the scope is disposed. * * @param fn - The side-effect body. Reactive reads inside this function * establish dependency links. * @returns A disposal function. Call it to stop the effect and run any * registered cleanup. * * @example * ```ts * const url = signal('/api/data'); * * const stop = effect(() => { * const controller = new AbortController(); * fetch(url(), { signal: controller.signal }); * onCleanup(() => controller.abort()); * }); * * url('/api/other'); // previous fetch is aborted, new one starts * stop(); // final cleanup: abort the last fetch * ``` */ /** * @internal Method key for settling a reactive async wrapper from a * serialized server snapshot (hydration seeding). Lives here so * `utilities/promise`, `utilities/async` and `hydrate` can share it without * a utility-to-utility dependency. */ declare const SEED: unique symbol; /** * @internal Method key for the hydrate claim protocol: the claim walk hands * each async wrapper its ek-data record (or undefined). The wrapper decides — * seed and discard any deferred run, or execute the deferred run now. */ declare const CLAIM: unique symbol; declare function effect(fn: () => void): () => void; /** * Creates an ownership scope that groups reactive effects so they can all be * disposed at once. * * Effects and nested scopes created inside `fn` are linked to this scope. * When the returned disposal function is called, all owned effects are stopped * in cascade – triggering their registered {@link onCleanup} callbacks – and * the scope itself is removed from any parent scope that owns it. * * @param fn - Synchronous setup function. Create effects and nested scopes * here. * @returns A disposal function that tears down all owned effects and the scope * itself. * * @example * ```ts * const stopAll = effectScope(() => { * effect(() => console.log('a:', a())); * effect(() => console.log('b:', b())); * }); * * stopAll(); // both effects stopped simultaneously * ``` */ declare function effectScope(fn: () => void): () => void; /** * Registers a cleanup callback for the currently executing effect or scope. * * The callback will be called: * 1. **Before the next re-run** of the enclosing effect (so resources from * the previous run are released before the new run sets them up again). * 2. **On final disposal** of the effect, whether triggered explicitly by * calling the effect's cleanup handle or implicitly by an owning * `effectScope` being disposed. * * Calling `onCleanup` outside of a tracking context (no active effect) is a * no-op; it does **not** throw. * * Only one cleanup function per effect run is supported. Calling `onCleanup` * multiple times within the same run overwrites the previous registration. * * @param fn - The teardown callback. * * @example * ```ts * effect(() => { * const id = setInterval(() => tick(), 1000); * onCleanup(() => clearInterval(id)); * }); * ``` * * @example Composable helper – no prop-drilling needed: * ```ts * function useEventListener(target: EventTarget, type: string, handler: EventListener) { * target.addEventListener(type, handler); * onCleanup(() => target.removeEventListener(type, handler)); * } * * effect(() => { * useEventListener(window, 'resize', onResize); * }); * ``` */ declare function onCleanup(fn: () => void): void; /** * Runs `fn` as a single atomic update: all signal writes inside `fn` are * collected and effects are flushed only once after `fn` returns, rather than * after each individual write. * * Batches can be nested; the flush only occurs when the outermost batch * completes. * * @example * ```ts * batch(() => { * x(1); * y(2); * z(3); * }); // effects that depend on x, y, or z run once here * ``` */ declare function batch(fn: () => void): void; /** * Executes `fn` in a non-tracking context: any signals read inside `fn` do * **not** create dependency links on the currently active subscriber. * * Useful when you need to read a signal's current value without subscribing to * future changes. * * @returns The value returned by `fn`. * * @example * ```ts * const logCount = effect(() => { * console.log('triggered by a:', a()); * // read b without subscribing – effect won't re-run when b changes * console.log('current b:', untracked(b)); * }); * ``` */ declare function untracked(fn: Computed): T; /** * Manually triggers all subscribers of every signal read inside `fn`. * * Unlike writing to a signal, `trigger` does not change the signal's value; it * only forces downstream effects and computeds to re-evaluate. * * @param fn - Function whose reactive reads identify the signals to trigger. * * @example * ```ts * const items = signal([1, 2, 3]); * * // Mutate in place (referential equality won't detect the change): * items().push(4); * trigger(items); // manually notify subscribers * ``` */ declare function trigger(fn: Computed): void; //#endregion //#region src/signals/index.d.ts /** * Type-guard: `true` when `value` is a reactive source (`signal` or `computed`), * `false` when it is a plain value. * * Use this when you accept {@link MaybeReactive} and need to branch on whether * the caller passed a live source or a static value. * * @example * ```ts * import { signal, isReactive } from "elements-kit/signals"; * * const a: MaybeReactive = 5; * const b: MaybeReactive = signal(0); * const c: () => number = () => 5; * * isReactive(a); // false * isReactive(b); // true * isReactive(c); // false * ``` */ declare function isReactive(value: MaybeReactive): value is () => T; /** Writer half of a {@link Signal}: `sig(next)` assigns a new value. */ type Updater = (value: T) => void; /** Zero-arg getter that subscribes the current tracking scope on call. */ type Computed = () => T; /** * A reactive read/write cell — callable as both a getter (no args) and a * setter (one arg). * * @example * ```ts * import { signal } from "elements-kit/signals"; * * const count: Signal = signal(0); * count(); // read → 0 (subscribes the active scope) * count(5); // write → notifies subscribers * ``` */ type Signal = Updater & Computed; /** * A decorator that makes a class field reactive by automatically wrapping its value in a signal. * * The field behaves like a normal property (get/set) but reactivity is tracked under the hood. * Any reads will subscribe to the signal and any writes will trigger updates. * * @example * ```ts * class Counter { * \@reactive() count: number = 0; * } * * const counter = new Counter(); * counter.count++; // Triggers reactivity * console.log(counter.count); // Subscribes to changes * ``` * * @remarks * Equivalent to manually creating a private signal and getter/setter: * ```ts * class Counter { * #count = signal(0); * get count() { return this.#count(); } * set count(value) { this.#count(value); } * } * ``` */ declare function reactive(source?: (self: This) => Signal): (_target: unknown, context: ClassFieldDecoratorContext) => (this: This, initialValue: Value) => Value; /** * A value that may be static or reactive. Accepts a plain `T` or a * zero-arg getter (`() => T`) — typically a `signal` or `computed`. * * Used across the library anywhere a prop or attribute may be bound to * reactive state. Resolve with {@link resolve}, detect with {@link isReactive}. * * @template T — the value type. * * @example * ```ts * import { signal, computed } from "elements-kit/signals"; * * const count = signal(0); * const double = computed(() => count() * 2); * * const a: MaybeReactive = 5; // static * const b: MaybeReactive = count; // signal (getter) * const c: MaybeReactive = double; // computed (getter) * ``` */ type MaybeReactive = T | Computed; /** * Resolve a {@link MaybeReactive} to its current value. Calls the getter * when reactive; returns the value as-is when static. * * @example * ```ts * resolve(5); // 5 * resolve(() => count()); // current count value * ``` */ declare function resolve(value: MaybeReactive): T; declare function resolveProps

(raw: { [K in keyof P]: MaybeReactive }): Props

; //#endregion //#region src/jsx-runtime/infer.d.ts /** * Promote keys `K` of `P` to required; leave the rest unchanged. * * @template P — the prop object type. * @template K — the keys to make required. * * @example * ```ts * type Optional = { a?: number; b?: string; c?: boolean }; * type AB = Require; * // { a: number; b: string; c?: boolean } * ``` */ type Require = { [X in K]-?: P[X] } & Omit; declare const RAW_PROPS: unique symbol; type Props

= { readonly [K in keyof P]: Computed } & { readonly [RAW_PROPS]?: P; }; /** Recover the raw prop shape `P` from a `Props

`. */ type RawProps = R extends { readonly [RAW_PROPS]?: infer P; } ? P : R; /** * Caller-facing wrap: each key accepts a plain value OR a reactive getter. * The JSX checker applies it automatically to component props; name it * directly when typing a call-site shape by hand (e.g. a class component's * constructor param, like `For`'s). Function-typed props are wrapped too * (`Computed` is zero-arg, so TS still picks the handler signature by * arity for inline arrows). `Signal` must never be added explicitly — its * one-arg `Updater` half would collapse inline arrow params to implicit any. */ type MaybeReactiveProps

= { [K in keyof P]: undefined extends P[K] ? MaybeReactive> | undefined : MaybeReactive }; /** * @internal Call-site prop resolution for `JSX.LibraryManagedAttributes`: * - empty param (instance-field classes, no ctor) → wrap `PropsOf` * - branded `Props

` param (function components) → wrap the raw `P` * - non-empty constructor param → pass through (preserves `For` inference) * * Emptiness is checked FIRST: `{}` structurally matches the optional brand * (`{} extends { [RAW_PROPS]?: infer Raw }` with `Raw = unknown`), which * would silently type every no-ctor class as `MaybeReactiveProps` * (= `{}`, accepting anything). A real `Props

` is never empty — its * `keyof` always contains the brand symbol. */ type ResolveProps> = [keyof NN] extends [never] ? C extends JSX$1.ElementType | JSX$1.ElementClass ? MaybeReactiveProps> : {} : NN extends { readonly [RAW_PROPS]?: infer Raw; } ? MaybeReactiveProps : NN; type PropKeysOf = keyof PropertiesOf & string; type AttrMap = C extends { [ATTRIBUTES]: infer M; } ? M : {}; type HandlerValue = H extends AttrChangeHandler ? string | null : H; type AttrsOf = AttrMap extends infer M ? M extends Record ? string extends keyof M ? {} : { [K in Exclude>]?: HandlerValue } : {} : {}; type PropNamespacedOf = { [K in PropKeysOf as `prop:${K}`]?: NonNullable[K]> }; type JsxEventsOf = { [K in keyof EventsOf & string as `on:${K}`]?: (ev: EventsOf[K]) => void }; type ChildrenOf = C extends { children: never; } ? {} : { children?: Children; }; type BaseDOMAttrs = JSX.DOMAttributes; /** * Full JSX prop type for a custom-element class (extends `HTMLElement`). * * Composes every surface the element can receive from JSX: * - **Attributes** — keys from `static [ATTRIBUTES]` (typed `MaybeReactive`). * Keys also present on the instance are dropped here so the flat key carries the property type. * - **Flat properties** — public instance fields, wrapped in `MaybeReactive`. * - **`prop:*`** — explicit property assignment for every field. * - **Events** — keys from `declare static events: { ... }` produce * `on:${K}` typed handlers (the only event syntax the runtime attaches). * - **Children** — `children?: Child` unless `static children: never`. * - **DOM attrs** — the standard dom-expressions surface (`class`, `style`, `ref`, …). * * @template C — the custom-element class (constructor type). * * @example * ```ts * \@attributes * class XRange extends HTMLElement { * static [ATTRIBUTES]: Attributes = { min(v) { this.min = +v! } }; * declare static events: { commit: CustomEvent }; * #slot = new Slot(); * get label() { return this.#slot.get(); } * set label(value: Node) { this.#slot.set(value) } * \@reactive() min = 0; * } * * type Props = ElementProps; * // { * // min?: MaybeReactive; * // "prop:min"?: number; * // "on:commit"?: (e: CustomEvent) => void; * // label?: Node * // children?: Node; * // // …plus ref, class, class:*, style, style:*, standard DOM events * // } * ``` * * @see {@link PropsOf} for class-components / function components (no attr/event synthesis). */ type ElementProps = BaseDOMAttrs & AttrsOf & PropertiesOf & PropNamespacedOf & JsxEventsOf & ChildrenOf; /** * Props for any component — class or function. * * The combination of the two specialised helpers: * - **Custom-element constructor** (`typeof Cls`, `Cls extends HTMLElement`) * → `ElementProps` — the full JSX surface (attrs, `prop:*`, `on:*`,children). * - **Everything else** (function component, class component ctor or * instance) → `ComponentProps` — the raw prop shape. * * @template T — constructor, function, or instance. * * @example * ```ts * // 1. Class instance (lets a generic flow) * class For { each: T[] = []; render() { return null } } * type ForProps = PropsOf>; * // ↑ { each?: T[] } * * // 2. Function component * const Greeting = (_p: { name: string; excited?: boolean }) => null; * type GreetingProps = PropsOf; * // ↑ { name: string; excited?: boolean } * * // 3. Class constructor * class Counter { count = 0; render() { return null } } * type CounterProps = PropsOf; * // ↑ { count?: number } * ``` */ type PropsOf = T extends AnyElementCtor ? ElementProps : T extends JSX$1.ElementType | JSX$1.ElementClass ? ComponentProps : never; /** * Raw props of a function or class COMPONENT (not a custom element): * function components use the first parameter (`RawProps` unwraps a branded * `Props

`); classes use their public instance fields. The custom-element half of `PropsOf` is `ElementProps`. */ type ComponentProps = T extends ((props: infer P, ...rest: any[]) => any) ? P extends object ? RawProps

: {} : PropertiesOf; type AnyElementCtor = abstract new (...args: any[]) => HTMLElement; //#endregion //#region src/jsx-runtime/element.d.ts type UnsupportedDomKeys = "ref" | "children" | "classList" | "$ServerOnly" | keyof JSX.CustomEventHandlersCamelCase | keyof JSX.CustomEventHandlersLowerCase | keyof JSX.DirectiveAttributes | keyof JSX.DirectiveFunctionAttributes | keyof JSX.AttrAttributes | keyof JSX.BoolAttributes | keyof JSX.OnCaptureAttributes; type DOMIntrinsicElements = { [K in keyof JSX.IntrinsicElements]: Omit }; type DOMElements = { [K in keyof JSX.IntrinsicElements]: JSX.IntrinsicElements[K] extends { ref?: infer R | undefined; } ? Extract any> extends ((el: infer E) => any) ? E : Element : Element }; declare function createElement(type: JSX$1.ElementType, allProps?: { ref?: (el: Element) => void; } & Record): JSX$1.Element | null; //#endregion //#region src/jsx-runtime/fragment.d.ts /** * Used by the JSX transform for `<>...` fragments. * * Each child is routed through `mountChild`, which handles Nodes, strings, * numbers, arrays, and reactive getters — matching the behavior of any other * JSX container. `mountChild` also wires each child's cleanup via its own * `effectScope`, which links to the enclosing `effectScope` created by * `createElement(Fragment, ...)` for disposal propagation. * * **Raw HTML mode** — `{markup}`: the child is a * `MaybeReactive` rendered as markup inside a Slot region (comment * markers), so the server renderer and the hydration claim pass share the * region boundary. Reactive sources re-render the region on change. This is * the library's only raw-HTML sink: the string is NOT escaped — sanitize * untrusted input at the call site. `