import { Component } from "./component.js"; //#region src/runtime.d.ts /** * Per-adapter interpretation manifest. Each adapter augments this interface to * declare how it renders; the first member is `node` - the element type produced * by `Component.render` (surfaced as `Component.Node`) - alongside `intrinsics`, * the host's tag map (surfaced as `JSX.IntrinsicElements`). * * ```ts * declare module '@expressive/mvc/runtime' { * interface Host { * node: React.ReactNode; * intrinsics: React.JSX.IntrinsicElements; * } * } * ``` * * Only one adapter is expected per compilation; two augmenting the same member * with different types in the same build would conflict - by design. */ interface Host {} /** * Host runtime, registered by an adapter (e.g. `@expressive/react`) as an * import side effect. One host per build - a second registration with a * different runtime throws. * * Members are ambient host capabilities: plain functions the host uniquely * owns, callable outside render - element mechanics always, plus optional * extras that fall back sanely when absent. Hook-shaped (render-resident) * capabilities do not belong here; those live with the adapter. */ interface HostRuntime { childrenOf(children: unknown): Component.Node[]; isElement(node: unknown): boolean; jsx(type: unknown, props: object, key?: unknown): Component.Node; jsxDEV?(type: unknown, props: object, key?: unknown, isStatic?: boolean, source?: object, self?: unknown): Component.Node; jsxs(type: unknown, props: object, key?: unknown): Component.Node; propsOf(node: unknown): Record; typeOf(node: unknown): unknown; Fragment: unknown; } /** * Agnostic Fragment sentinel. The runtime entries translate it to the host's * Fragment on element creation; `typeOf` translates back, so identity checks * against this value hold for fragments from either pragma. */ declare const Fragment: unique symbol; /** * Register the host runtime. Idempotent for the same runtime - re-registering * picks up members added since (e.g. an optional dev seam). Element mechanics * the host leaves unset keep defaults that throw a setup-pointing error; * `jsxDEV` is routed around at the call site instead. */ declare function host(runtime: HostRuntime): void; declare function jsx(type: unknown, props: object, key?: unknown): Component.Node; declare function jsxs(type: unknown, props: object, key?: unknown): Component.Node; /** Dev-transpiled element creation. Hosts without a `jsxDEV` of their own fall * back to the production entries (prod-only host under a dev build). */ declare function jsxDEV(type: unknown, props: object, key?: unknown, isStatic?: boolean, source?: object, self?: unknown): Component.Node; /** Flatten `children` to an array of nodes, per the host's semantics. */ declare function childrenOf(children: unknown): Component.Node[]; /** Is `node` a host element? */ declare function isElement(node: unknown): boolean; /** Element type of `node`; host Fragments surface as the agnostic `Fragment`. */ declare function typeOf(node: unknown): unknown; /** Props carried by element `node`. */ declare function propsOf(node: unknown): Record; //#endregion export { Fragment, Host, HostRuntime, childrenOf, host, isElement, jsx, jsxDEV, jsxs, propsOf, typeOf }; //# sourceMappingURL=runtime.d.ts.map