import { W as PersistenceProviderType, V as PersistenceProviderOptions, U as PersistenceProviderImpl, aj as VNode, ak as VNodeAttributes, Q as NodeType, a3 as RenderInput, H as Globals, a7 as Store, _ as Ref, F as FC, t as ElementProps, Y as Props, i as DOMElement, al as VNodeChild, ac as TransitionConfig, b as AsyncDefussChild } from './index-CeFAHwJi.js'; export { $, A as AllHTMLElements, a as AnyEventHandler, c as AsyncFC, d as AsyncFunctionComponent, C as CLASS_ATTRIBUTE_NAME, e as CSSProperties, f as CallChainImpl, g as Children, D as DANGEROUSLY_SET_INNER_HTML_ATTRIBUTE, h as DEFAULT_TRANSITION_CONFIG, j as DOMPropValue, k as DefussChild, l as DefussChildren, m as DefussClassValue, n as DefussKey, o as Dequery, p as DequeryOptions, q as DequerySyncMethodReturnType, r as Dimensions, s as DomAbstractionImpl, E as ElementCreationOptions, u as EqualsFn, v as EventMapFor, w as EventMapForAny, x as FontFaceProperties, y as FormFieldValue, z as FormKeyValues, B as Fragment, G as FunctionComponent, J as JsxRuntimeHookFn, I as JsxSourceInfo, K as KeyFrameProperties, L as Listener, M as Maybe, N as MemoryStorage, O as MiddlewareFn, P as MountHandler, R as OneOrMany, S as ParentElementInput, T as ParentElementInputAsync, X as Position, Z as REF_ATTRIBUTE_NAME, a0 as RefUpdateFn, a1 as RefUpdateRenderFn, a2 as RefUpdateRenderFnInput, a4 as RenderNodeInput, a5 as RenderResult, a6 as RenderResultNode, a8 as StoreOptions, a9 as SyncRenderInput, aa as SyncRenderResult, ab as TargetOf, ad as TransitionStyles, ae as TransitionType, af as TransitionsEasing, ag as UnionToIntersection, ah as UnmountHandler, ai as VAttributes, am as VNodeChildren, an as VNodeKey, ao as VNodeRef, ap as VNodeRefCallback, aq as VNodeRefObject, ar as VNodeType, as as WebStorage, at as XLINK_ATTRIBUTE_NAME, au as XMLNS_ATTRIBUTE_NAME, av as applyStyles, aw as createInPlaceErrorMessageVNode, ax as createRef, ay as createStore, az as deepEquals, aA as dequery, aB as emptyImpl, aC as getAllFormValues, aD as getDefaultDequeryOptions, aE as getRenderer, aF as getTransitionStyles, aG as globalScopeDomApis, aH as handleLifecycleEventsForOnMount, aI as isDequery, aJ as isDequeryOptionsObject, aK as isJSX, aL as isRef, aM as jsx, aN as jsxDEV, aO as jsxs, aP as nsMap, aQ as observeUnmount, aR as performTransition, aS as render, aT as renderInto, aU as renderIsomorphicAsync, aV as renderIsomorphicSync, aW as scrollHelper, aX as shallowEquals, aY as updateDom } from './index-CeFAHwJi.js'; export { CAPTURE_ONLY_EVENTS, ComponentInstance, DelegatedEventOptions, DelegatedPhase, ParsedEventProp, clearDelegatedEvents, clearDelegatedEventsDeep, getComponentInstance, getRegisteredEventKeys, getRegisteredEventTypes, isComponentRoot, mount, parseEventPropName, registerComponent, registerDelegatedEvent, removeDelegatedEvent, removeDelegatedEventByKey, unmount, unregisterComponent } from './render/index.js'; import 'csstype'; /** * Detect development mode for dev-only warnings and logs. * In production builds, bundlers can dead-code eliminate based on this. */ declare const inDevMode: boolean; /** returns the persistence provider (isomorphic) */ declare const webstorage: (provider?: PersistenceProviderType, options?: PersistenceProviderOptions) => PersistenceProviderImpl; /** * Compares two DOM nodes for equality with performance optimizations. * 1. Checks for reference equality. * 2. Compares node types. * 3. For Element nodes, compares tag names and attributes. * 4. For Text nodes, compares text content. */ declare const areDomNodesEqual: (oldNode: Node, newNode: Node) => boolean; /******************************************************** * 1) Define a "valid" child type & utilities ********************************************************/ type ValidChild = string | number | boolean | null | undefined | VNode; /** * Guarded entry point for DOM morphing. * * If the target element (or an ancestor) is already being morphed, * the render is queued (latest-wins) and replayed after the active * morph finishes. Morphs on unrelated subtrees proceed immediately * without blocking - conflict-free parallel rendering. */ declare function updateDomWithVdom(parentElement: Element, newVDOM: RenderInput, globals: Globals): void; /** * Directly blow away all children in `parentElement` and create new DOM * from `newVDOM`. This never skips or leaves behind stale nodes, * at the cost of losing partial update performance. */ declare function replaceDomWithVdom(parentElement: Element, newVDOM: RenderInput, globals: Globals): void; declare function waitForDOM(check: () => Array, timeout: number, document?: Document): Promise>; declare function parseDOM(input: string, type: DOMParserSupportedType, Parser: typeof DOMParser): Document; declare function isSVG(input: string, Parser: typeof DOMParser): boolean; declare function isHTML(input: string, Parser: typeof DOMParser): boolean; declare const isMarkup: (input: string, Parser: typeof DOMParser) => boolean; declare function renderMarkup(markup: string, Parser: typeof DOMParser, doc?: Document): ChildNode[]; declare function getMimeType(input: string, Parser: typeof DOMParser): DOMParserSupportedType; /** * Enhanced version of processFormElements that handles all form control types * including multiple select elements and radio button groups */ declare function processAllFormElements(node: NodeType, callback: (input: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement, key: string) => void): void; declare function checkElementVisibility(element: HTMLElement, window: Window, document: Document): boolean; declare function getEventMap(element: HTMLElement): Map>; declare function addElementEvent(target: EventTarget, eventType: string, handler: EventListener): void; declare function removeElementEvent(target: EventTarget, eventType: string, handler?: EventListener): void; declare function clearElementEvents(target: EventTarget): void; /** * Converts a DOM node to a VNode structure for use with updateDomWithVdom. * This allows us to leverage the sophisticated partial update system even for Node inputs. */ declare function domNodeToVNode(node: Node): VNode | string; /** * Converts an HTML string to VNode structure for use with updateDomWithVdom. * This allows markup strings to benefit from the intelligent partial update system. */ declare function htmlStringToVNodes(html: string, Parser: typeof DOMParser): Array | string>; declare const queueCallback: (cb: (...args: T) => void) => (...args: T) => void; /** * Creates a computed (derived) store from other stores. * The computed value is recalculated when any dependency store changes. * * @example * ```ts * const countStore = createStore({ count: 0 }); * const doubled = computed(countStore, (v) => v.count * 2); * * // Or with multiple stores: * const a = createStore({ value: 1 }); * const b = createStore({ value: 2 }); * const sum = computed([a, b], (av, bv) => av.value + bv.value); * ``` */ declare function computed(stores: Store | Store[], fn: (...values: any[]) => T): Store; /** * Configuration for reactive rendering. */ interface ReactiveConfig { /** One or more stores to subscribe to. */ store: Store | Store[]; /** Render function that returns JSX to render into the target. */ render: () => JSX.Element; /** Optional cleanup function called on unmount. */ cleanup?: () => void; } /** * Core reactive utility - subscribes to store(s) and re-renders JSX on changes. * Returns a cleanup function to unsubscribe all stores and call optional cleanup. * * @example * ```ts * const store = createStore({ count: 0 }); * const ref = createRef(); * * // In onMount: * const cleanup = reactive({ * store, * render: () =>
Count: {store.value.count}
, * cleanup: () => console.log("unmounted") * }, ref); * * // Later, to clean up: * cleanup(); * ``` */ declare function reactive(config: ReactiveConfig, target: Ref | HTMLElement): () => void; /** * Props for the Reactive component. */ interface ReactiveProps extends ElementProps { /** One or more stores to subscribe to. */ store: ReactiveConfig["store"]; /** Render function that returns JSX to render into the component. */ render: ReactiveConfig["render"]; /** Optional cleanup function called on unmount. */ cleanup?: ReactiveConfig["cleanup"]; /** Wrapper element tag name. Default: "div". */ tag?: string; } /** * A component that automatically re-renders when its store(s) change. * Handles subscription setup on mount and cleanup on unmount. * * @example * ```tsx * import { Reactive, createStore } from "defuss"; * * const store = createStore({ count: 0 }); * * ( *
*

Count: {store.value.count}

* *
* )}/> * ``` */ declare const Reactive: FC; type Resolve = T extends infer U ? U : never; type TranslationKeys = Resolve<{ [K in keyof T]: T[K] extends Record ? TranslationKeys : `${Prefix}${K & string}`; }[keyof T]>; type TranslationObject = { [key: string]: string | VNode | TranslationObject; }; type Translations = { [language: string]: TranslationObject; }; type OnLanguageChangeListener = (newLanguage: string) => void; type Replacements = Record; interface I18nStore { language: string; changeLanguage: (language: string) => void; t: (path: K, options?: Record) => string; loadLanguage: (language: string, translations: TranslationObject) => void; subscribe: (onLanguageChange: OnLanguageChangeListener) => () => void; unsubscribe: (onLanguageChange: OnLanguageChangeListener) => void; } declare const createI18n: () => I18nStore; /** * @deprecated Use `createI18n` instances with typed keys instead of the default singleton. */ declare const i18n: I18nStore; /** * @deprecated Use `createI18n` instances with typed keys instead of the default singleton. */ declare const t: (path: string, options?: Record) => string; /** * @deprecated Use `createI18n` instances with typed keys instead of the default singleton. */ declare const changeLanguage: (language: string) => void; /** * @deprecated Use `createI18n` instances with typed keys instead of the default singleton. */ declare const loadLanguage: (language: string, translations: TranslationObject) => void; /** * @deprecated Use `createI18n` instances with typed keys instead of the default singleton. */ declare const getLanguage: () => string; interface TransRef extends Ref { updateValues: (values: Replacements) => void; } interface TransProps extends Props { key: K; ref?: TransRef; tag?: string; values?: Replacements; class?: string; className?: string; style?: string; [propName: string]: any; } declare const createTrans: (i18n: I18nStore) => ({ key, values, tag, ref, ...attrs }: TransProps) => VNodeChild; /** * @deprecated Use `createTrans` instances with typed i18n keys instead of the default singleton. */ declare const Trans: ({ key, values, tag, ref, ...attrs }: TransProps) => VNodeChild; /** * @deprecated Use `createTrans` instances with typed i18n keys instead of the default singleton. * */ declare const T: ({ key, values, tag, ref, ...attrs }: TransProps) => VNodeChild; type OnHandleRouteChangeFn = (newRoute: string, oldRoute: string) => void; type OnRouteChangeFn = (cb: OnHandleRouteChangeFn) => void; type RouterStrategy = "page-refresh" | "slot-refresh"; type BeforeLeaveHookFn = () => boolean | void | Promise; type LeaveHookFn = () => void; /** * Context object passed to components rendered via Route's `component` prop. * Provides access to the current route request and lifecycle hooks. * * @example * ```tsx * const MyScreen = ({ route }: { route: RouteContext }) => { * route.onBeforeLeave(() => { * // Return false to block navigation (e.g. unsaved changes) * return confirm("Leave page?"); * }); * route.onLeave(() => { * console.log("Route was left"); * }); * return
Current path: {route.request.path}
; * }; * ``` */ interface RouteContext { /** The matched RouteRequest for the current route */ request: RouteRequest; /** * Register a hook that fires before the route is unmounted. * Returning `false` (or a Promise resolving to `false`) blocks navigation, * allowing implementation of confirmation dialogs. */ onBeforeLeave(fn: BeforeLeaveHookFn): void; /** * Register a hook that fires after the route has been unmounted * (navigation completed, new route is rendered). */ onLeave(fn: LeaveHookFn): void; } /** * Props interface for components rendered via Route's `component` prop. * Extend your component's props with this to receive the `route` context. * * @example * ```tsx * import { type Props, type RouteProps } from "defuss"; * * interface MyScreenProps extends Props, RouteProps {} * * function MyScreen({ route }: MyScreenProps) { * const { userId } = route.request.params; * return

User #{userId}

; * } * ``` */ interface RouteProps { route: RouteContext; } interface RouterConfig { strategy?: RouterStrategy; } interface RouteMatchGroups { [matchName: string]: number; } /** * Key-value map for URL parameters. * Used for route params, query params, and hash params. */ interface RouteParams { [name: string]: string; } interface RouteRegistration { path: string; exact?: boolean; tokenizedPath?: TokenizedPath; handler?: RouteHandler; } /** * Represents the current routing state and URL information. * * This object is **always returned** by `Router.getRequest()`, `Router.match()`, * and `Router.resolve()`. Unlike returning `false` on no match, this provides * a deterministic API where you can always access URL information. * * @example * ```tsx * const req = Router.getRequest(); * * // Check if a registered route matched * if (req.match) { * console.log(`Matched route: ${req.matchedRoute}`); * console.log(`Component name: ${req.params.name}`); * } else { * console.log('No matching route'); * } * * // URL components are always available regardless of match * console.log(`Current path: ${req.path}`); * console.log(`Base URL: ${req.baseUrl}`); * ``` * * @example * ```tsx * // Dynamic route like "/components/:name" * const req = Router.getRequest(); * const title = req.match ? req.params.name : 'Unknown'; * ``` */ interface RouteRequest { /** * Whether a registered route pattern matched the current path. * Always check this before accessing route-specific params. */ match: boolean; /** * The route pattern that matched, e.g., "/components/:name". * `null` if no route matched (`match === false`). */ matchedRoute: string | null; /** * URL protocol without the colon, e.g., "http" or "https". */ protocol: string; /** * Domain/hostname, e.g., "localhost" or "example.com". */ domain: string; /** * Port number as string, e.g., "5173". * Empty string if using default port (80 for http, 443 for https). */ port: string; /** * Base URL combining protocol, domain, and port. * E.g., "http://localhost:5173" or "https://example.com". * Does not include path, query, or hash. */ baseUrl: string; /** * Path portion of the URL, e.g., "/components/accordion". * Does not include query string or hash. */ path: string; /** * Full URL including path, query, and hash. * E.g., "http://localhost:5173/components/accordion?tab=code#section" */ url: string; /** * Route parameters extracted from dynamic segments. * E.g., for route "/components/:name" and path "/components/accordion", * params would be `{ name: "accordion" }`. * Empty object if no route matched or route has no params. */ params: RouteParams; /** * Query string parameters parsed from the URL. * E.g., for "?q=test&page=1", queryParams would be `{ q: "test", page: "1" }`. */ queryParams: RouteParams; /** * Hash fragment parameters parsed as key-value pairs. * E.g., for "#sort=desc&view=grid", hashParams would be `{ sort: "desc", view: "grid" }`. * Note: Only works if hash uses query-string format. */ hashParams: RouteParams; } interface TokenizedPath { regexp: RegExp; groups: RouteMatchGroups; } type RouteHandler = (request: RouteRequest) => void; declare const tokenizePath: (path: string) => TokenizedPath; interface MatchRouteRegistrationsOpts { invokeHandler?: boolean; } /** * Match registered routes against the current pathname. * Always returns a RouteRequest object with match: true/false. */ declare const matchRouteRegistrations: (routeRegistrations: Array, actualPathName: string, haystackPathName?: string, opts?: MatchRouteRegistrationsOpts, windowImpl?: Window) => RouteRequest; declare const setupRouter: (config?: RouterConfig, windowImpl?: Window) => Router; interface RouterState { routeRegistrations: Array; currentRequest: RouteRequest | null; isReady: boolean; pendingResolvers: Array<() => void>; currentPath: string; popAttached: boolean; lifecycleHooks: { beforeLeave: Array; leave: Array; }; } declare global { var __defuss_router__: Router | undefined; var __defuss_router_state__: RouterState | undefined; } declare const getRouterState: () => RouterState; interface Router { listeners: Array; strategy: RouterStrategy; add(registration: RouteRegistration): Router; match(path?: string): RouteRequest; resolve(pathname?: string): RouteRequest; getRequest(): RouteRequest; getRoutes(): Array; tokenizePath(path: string): TokenizedPath; navigate(path: string): void; onRouteChange: OnRouteChangeFn; destroy(): void; attachPopStateHandler(): void; /** * Returns a promise that resolves when the router is ready (routes are registered). * Call this before using getRequest() in components that render inside Route. * * @example * ```tsx * const MyComponent = async () => { * await Router.ready(); * const req = Router.getRequest(); * // params are now available * } * ``` */ ready(): Promise; /** * Create a RouteContext object for a matched route request. * The context provides lifecycle hooks (onBeforeLeave, onLeave) * and is passed to components rendered via Route's `component` prop. */ createRouteContext(request: RouteRequest): RouteContext; } declare const Router: Router; interface RouteComponentProps extends Props { path: string; router?: Router; exact?: boolean; /** * A component function to render when this route matches. * Unlike children (which are eagerly evaluated by the JSX runtime), * the component function is called **lazily** — only after the route * has been registered and matched. This ensures `Router.getRequest()` * returns the correct params inside the component. * * The component receives a `route` prop (RouteContext) with: * - `route.request` — the matched RouteRequest with params, query, etc. * - `route.onBeforeUnmount(fn)` — register a hook before route leaves; return `false` to block * - `route.onUnmount(fn)` — register a hook after route has been left * * When the component is async and Route has children, the children are * shown as a loading fallback until the async component resolves. * * @example * ```tsx * * * // With loading fallback for async components: * * * * ``` */ component?: FC; } declare const Route: FC; interface RedirectProps extends RouteComponentProps { to: string; } declare const Redirect: FC; declare const RouterSlotId = "router-slot"; interface RouterSlotProps extends Props { /** to override the tag name used for the router slot */ tag?: string; /** to override the default id 'router-slot' */ id?: string; /** to identify/select the root DOM element or style it, W3C naming */ class?: string; /** to identify/select the root DOM element or style it, React naming */ className?: string; /** to override the default global router */ router?: Router; /** A component reference that returns many , etc. components */ RouterOutlet?: any; /** Transition configuration for route changes; default: { type: 'fade', duration: 50 } */ transitionConfig?: TransitionConfig; } /** * RouterSlot registers a slot refresh handler with the global router configuration * and renders its default children (RouterOutlet). Whenever the route changes, it re-renders dynamically. * This decouples the slot refresh logic from route registration. */ declare const RouterSlot: FC; type AsyncState = "loading" | "loaded" | "error"; interface AsyncStateRef extends Ref { /** The state of the async content */ state?: AsyncState; /** Error details are available here in case the state changes to "error" */ error?: unknown; } interface AsyncProps extends Omit { /** to uniquely identify the root DOM element without using a ref */ id?: string; /** to identify/select the root DOM element or style it, W3C naming */ class?: string; /** to identify/select the root DOM element or style it, React naming */ className?: string; /** The fallback content to display while the async content is loading */ fallback?: VNode | JSX.Element; /** Store this with createRef() to update() the Suspense state */ ref?: AsyncStateRef; /** to override the name of the .suspense-loading transition CSS class name */ loadingClassName?: string; /** to override the name of the .suspense-loaded transition CSS class name */ loadedClassName?: string; /** to override the name of the .suspense-error transition CSS class name */ errorClassName?: string; /** * Children of Async can include async components (Promise-returning). * These are resolved automatically before rendering. */ children?: AsyncDefussChild | AsyncDefussChild[]; } declare const Async: ({ fallback, ref, children, class: _class, className, id, loadingClassName, loadedClassName, errorClassName, onError, }: AsyncProps) => { type: string; attributes: { id: string | undefined; class: string | undefined; className: string | undefined; ref: AsyncStateRef; onMount: () => void; "data-defuss-keep": boolean; }; children: (VNode | VNode | Promise | null>)[]; }; declare const Suspense: ({ fallback, ref, children, class: _class, className, id, loadingClassName, loadedClassName, errorClassName, onError, }: AsyncProps) => { type: string; attributes: { id: string | undefined; class: string | undefined; className: string | undefined; ref: AsyncStateRef; onMount: () => void; "data-defuss-keep": boolean; }; children: (VNode | VNode | Promise | null>)[]; }; export { Async, AsyncDefussChild, DOMElement, ElementProps, FC, Globals, NodeType, PersistenceProviderImpl, PersistenceProviderOptions, PersistenceProviderType, Props, Reactive, Redirect, Ref, RenderInput, Route, Router, RouterSlot, RouterSlotId, Store, Suspense, T, Trans, TransitionConfig, VNode, VNodeAttributes, VNodeChild, addElementEvent, areDomNodesEqual, changeLanguage, checkElementVisibility, clearElementEvents, computed, createI18n, createTrans, domNodeToVNode, getEventMap, getLanguage, getMimeType, getRouterState, htmlStringToVNodes, i18n, inDevMode, isHTML, isMarkup, isSVG, loadLanguage, matchRouteRegistrations, parseDOM, processAllFormElements, queueCallback, reactive, removeElementEvent, renderMarkup, replaceDomWithVdom, setupRouter, t, tokenizePath, updateDomWithVdom, waitForDOM, webstorage }; export type { AsyncProps, AsyncState, AsyncStateRef, BeforeLeaveHookFn, I18nStore, LeaveHookFn, MatchRouteRegistrationsOpts, OnHandleRouteChangeFn, OnLanguageChangeListener, OnRouteChangeFn, ReactiveConfig, ReactiveProps, RedirectProps, Replacements, Resolve, RouteComponentProps, RouteContext, RouteHandler, RouteParams, RouteProps, RouteRegistration, RouteRequest, RouterConfig, RouterSlotProps, RouterStrategy, TokenizedPath, TransProps, TransRef, TranslationKeys, TranslationObject, Translations, ValidChild };