import { ReadonlySignal, Signal } from '@preact/signals-core';
export { ReadonlySignal, Signal, batch, computed, effect, signal, untracked } from '@preact/signals-core';
/**
* Copyright (c) 2026 hangtiancheng
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Component HMR: alias + in-place instance swap.
*
* Runtime-guarded: non-function arguments and functions with no live
* instances no-op safely, so the broad injection gate (any `.tsx`/`.jsx`
* default export) cannot break non-component modules.
*
* @returns whether any live instance was swapped
*/
declare function hotSwapByComponent(oldFn: unknown, newFn: unknown): boolean;
/**
* Copyright (c) 2026 hangtiancheng
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* JSX VNode model — the pure data layer of Lark's JSX support.
*
* This module has ZERO runtime framework imports so it can be bundled into
* the `jsx-runtime` / `jsx-dev-runtime` entries without dragging the
* framework in (the `ReadonlySignal` import below is type-only — erased at
* compile time).
*
* tsup bundles this module into more than one dist entry (the runtime
* entries may share a chunk, while `index` carries its own copy), so module
* instances are NOT shared across entries. All brand markers therefore use
* `Symbol.for` (the global symbol registry) so that VNodes created by one
* bundle instance are recognized by another — plain module-level symbols or
* `instanceof` checks would fail across copies.
*/
/**
* Fragment component — groups children without a wrapper element.
*
* `<>...>` compiles to `jsx(Fragment, { children })`. The reconciler emits
* the children directly; multi-root component output is supported, so a
* Fragment is valid at the component root.
*/
declare const Fragment: symbol;
/**
* A function component: receives the reactive props proxy (children included
* under `props.children`) and returns renderable JSX content.
*
* Every function tag mounts a component INSTANCE (React semantics, hostless —
* no wrapper element). The function re-runs on every render pass inside the
* instance's render effect; state lives in hooks (`useSignal`, `useEffect`,
* ...). Reading `props.x` in the body subscribes the instance to that key.
*/
type Component
= (props: P) => JSXNode;
/** A JSX element produced by `jsx()` / `jsxs()` / `jsxDEV()`. */
interface VNode {
/** Brand marker — `Symbol.for("lark.mvc.vnode")`. */
$$: symbol;
/** Tag name, functional component, or `Fragment`. */
type: string | Component | symbol;
/** Props object including `children`. */
props: Record;
/** Normalized `key` (from the jsx() third argument) — sibling compare key for the keyed diff. */
key: string | undefined;
}
/** Wrapper marking a string as trusted raw HTML (created via `raw()`). */
interface RawHTML {
/** Brand marker — `Symbol.for("lark.mvc.raw")`. */
$$: symbol;
/** The raw HTML string (rendered without escaping). */
html: string;
}
/**
* Anything renderable as JSX content: elements, raw HTML, text-ish primitives
* (`string` / `number`), readable signals (auto-unwrapped via a tracked
* `.value` read — detected with `instanceof Signal` by the reconciler),
* skipped values (`boolean` / `null` / `undefined` — enables
* `{cond && }`), or arrays thereof.
*/
type JSXNode = VNode | RawHTML | ReadonlySignal | string | number | boolean | null | undefined | JSXNode[];
/**
* Mark a string as trusted raw HTML. The content is rendered WITHOUT
* escaping; never pass untrusted input.
*
* @example
* {raw(renderedMarkdown)}
*/
declare function raw(html: unknown): RawHTML;
/**
* Copyright (c) 2026 hangtiancheng
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Render a JSX tree into a container element (React-DOM style).
*
* The first call takes ownership of the container (existing content is
* cleared). Subsequent calls with the same container diff against the
* previous tree — component instances matched by function identity (and
* `key`) keep their state; changed props are pushed through per-key signals.
*
* Signal children/attributes in the tree are tracked by the root's render
* effect (or the owning component's), so the DOM stays live without
* re-calling `render`.
*/
declare function render(node: JSXNode, container: Element): void;
/**
* Unmount the tree rendered into a container: dispose the root effect,
* destroy every instance (effect cleanups, `onCleanup`, refs → null,
* children before parents), and clear the container.
*
* @returns `true` if a tree was mounted on the container.
*/
declare function unmount(container: Element): boolean;
/**
* Copyright (c) 2026 hangtiancheng
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Typed DOM attribute layer for Lark JSX — per-tag intrinsic element types,
* native-event handler types, aria/svg/mathml attributes.
*
* Ported from Preact v10's type definitions (dom.d.ts / jsx.d.ts,
* https://github.com/preactjs/preact — MIT License, Copyright (c)
* 2015-present Jason Miller) and adapted to Lark runtime semantics:
*
* - `Signalish` is `T | ReadonlySignal` — the reconciler unwraps
* ONLY `@preact/signals-core` signals in attribute position (top level,
* not inside arrays/objects).
* - Event props: NO capture-phase variants (`onClickCapture`) — the runtime
* derives the native event type via `name.slice(2).toLowerCase()`, so only
* camelCase spellings of real native event types are typed. Handlers
* receive the NATIVE event (no synthetic wrapper).
* - `children` is Lark's `JSXNode`; there is NO `dangerouslySetInnerHTML`
* (`raw()` is the only trusted-HTML path).
* - `class`/`className` accept string | nestable array | truthy-key map;
* `style` accepts string | camelCase object (no implicit `px`).
* - `ref` is a callback (called with null on unmount) or a `{ current }`
* cell (`useRef()` return shape).
* - `data-*` attributes are typed via a template-literal index signature.
*
* This module is 100% type-only — it contributes ZERO runtime code and is
* safe to reference from the framework-free `jsx-runtime` entry.
*/
/**
* The complete DOM type layer, wrapped in a single `declare namespace`
* (Preact's `JSXInternal` architecture). The wrapper is REQUIRED for
* correct d.ts bundling: the `JSX` namespace in jsx-runtime.ts references
* these types through the QUALIFIED name `JSXInternal.X`, which dts
* flatteners preserve verbatim — plain import aliases get rewritten to their
* canonical top-level names, and a namespace member named `IntrinsicElements`
* extending a top-level `IntrinsicElements` collapses into an invalid
* self-reference (empty interface under skipLibCheck → every tag "missing").
*/
declare namespace JSXInternal {
/**
* Attribute value that may be a readable signal. Signal-valued attributes
* are unwrapped with a tracked read, so the owning component re-renders
* when the signal changes.
*/
type Signalish = T | ReadonlySignal;
/**
* `class` / `className` value: string, nestable array (falsy entries
* dropped), or object whose truthy-valued keys become class names.
*/
type ClassValue = string | false | null | undefined | Record | ClassValue[];
/** Callback ref — called with the element after mount and `null` on unmount. */
type RefCallback = (instance: T | null) => void;
/** Object ref cell — the `useRef()` return shape. */
interface RefObject {
current: T | null;
}
/** Element ref: callback or `{ current }` cell (`useRef()` return shape). */
type Ref = RefCallback | RefObject;
/** Attributes valid on every JSX element (vnode-level, never written to the DOM). */
interface ClassAttributes {
/** Sibling compare key for the keyed diff (never written to the DOM). */
key?: string | number;
/** Element ref: callback (null on unmount) or a `{ current }` cell. */
ref?: Ref;
}
interface ToggleEvent extends Event {
readonly newState: string;
readonly oldState: string;
}
interface CommandEvent extends Event {
readonly source: Element | null;
readonly command: string;
}
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/SnapEvent) */
interface SnapEvent extends Event {
readonly snapTargetBlock: Element | null;
readonly snapTargetInline: Element | null;
}
type Booleanish = boolean | "true" | "false";
type DOMCSSProperties = {
[key in keyof Omit]?: string | number | null | undefined;
};
type AllCSSProperties = {
[key: string]: string | number | null | undefined;
};
interface CSSProperties extends AllCSSProperties, DOMCSSProperties {
cssText?: string | null;
}
interface SVGAttributes extends HTMLAttributes {
accentHeight?: Signalish;
accumulate?: Signalish<"none" | "sum" | undefined>;
additive?: Signalish<"replace" | "sum" | undefined>;
alignmentBaseline?: Signalish<"auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined>;
"alignment-baseline"?: Signalish<"auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined>;
allowReorder?: Signalish<"no" | "yes" | undefined>;
"allow-reorder"?: Signalish<"no" | "yes" | undefined>;
alphabetic?: Signalish;
amplitude?: Signalish;
/** @deprecated See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/arabic-form */
arabicForm?: Signalish<"initial" | "medial" | "terminal" | "isolated" | undefined>;
/** @deprecated See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/arabic-form */
"arabic-form"?: Signalish<"initial" | "medial" | "terminal" | "isolated" | undefined>;
ascent?: Signalish;
attributeName?: Signalish;
attributeType?: Signalish;
azimuth?: Signalish;
baseFrequency?: Signalish;
baselineShift?: Signalish;
"baseline-shift"?: Signalish;
baseProfile?: Signalish;
bbox?: Signalish;
begin?: Signalish;
bias?: Signalish;
by?: Signalish;
calcMode?: Signalish;
capHeight?: Signalish;
"cap-height"?: Signalish;
clip?: Signalish;
clipPath?: Signalish;
"clip-path"?: Signalish;
clipPathUnits?: Signalish;
clipRule?: Signalish;
"clip-rule"?: Signalish;
colorInterpolation?: Signalish;
"color-interpolation"?: Signalish;
colorInterpolationFilters?: Signalish<"auto" | "sRGB" | "linearRGB" | "inherit" | undefined>;
"color-interpolation-filters"?: Signalish<"auto" | "sRGB" | "linearRGB" | "inherit" | undefined>;
colorProfile?: Signalish;
"color-profile"?: Signalish;
colorRendering?: Signalish;
"color-rendering"?: Signalish;
contentScriptType?: Signalish;
"content-script-type"?: Signalish;
contentStyleType?: Signalish;
"content-style-type"?: Signalish;
cursor?: Signalish;
cx?: Signalish;
cy?: Signalish;
d?: Signalish;
decelerate?: Signalish;
descent?: Signalish;
diffuseConstant?: Signalish;
direction?: Signalish;
display?: Signalish;
divisor?: Signalish;
dominantBaseline?: Signalish;
"dominant-baseline"?: Signalish;
dur?: Signalish;
dx?: Signalish;
dy?: Signalish;
edgeMode?: Signalish;
elevation?: Signalish;
enableBackground?: Signalish;
"enable-background"?: Signalish;
end?: Signalish;
exponent?: Signalish;
externalResourcesRequired?: Signalish;
fill?: Signalish;
fillOpacity?: Signalish;
"fill-opacity"?: Signalish;
fillRule?: Signalish<"nonzero" | "evenodd" | "inherit" | undefined>;
"fill-rule"?: Signalish<"nonzero" | "evenodd" | "inherit" | undefined>;
filter?: Signalish;
filterRes?: Signalish;
filterUnits?: Signalish;
floodColor?: Signalish;
"flood-color"?: Signalish;
floodOpacity?: Signalish;
"flood-opacity"?: Signalish;
focusable?: Signalish;
fontFamily?: Signalish;
"font-family"?: Signalish;
fontSize?: Signalish;
"font-size"?: Signalish;
fontSizeAdjust?: Signalish;
"font-size-adjust"?: Signalish;
fontStretch?: Signalish;
"font-stretch"?: Signalish;
fontStyle?: Signalish;
"font-style"?: Signalish;
fontVariant?: Signalish;
"font-variant"?: Signalish;
fontWeight?: Signalish;
"font-weight"?: Signalish;
format?: Signalish;
from?: Signalish;
fx?: Signalish;
fy?: Signalish;
g1?: Signalish;
g2?: Signalish;
glyphName?: Signalish;
"glyph-name"?: Signalish;
glyphOrientationHorizontal?: Signalish;
"glyph-orientation-horizontal"?: Signalish;
glyphOrientationVertical?: Signalish;
"glyph-orientation-vertical"?: Signalish;
glyphRef?: Signalish;
gradientTransform?: Signalish;
gradientUnits?: Signalish;
hanging?: Signalish;
height?: Signalish;
horizAdvX?: Signalish;
"horiz-adv-x"?: Signalish;
horizOriginX?: Signalish;
"horiz-origin-x"?: Signalish;
href?: Signalish;
hreflang?: Signalish;
hrefLang?: Signalish;
ideographic?: Signalish;
imageRendering?: Signalish;
"image-rendering"?: Signalish;
in2?: Signalish;
in?: Signalish;
intercept?: Signalish;
k1?: Signalish;
k2?: Signalish;
k3?: Signalish;
k4?: Signalish;
k?: Signalish;
kernelMatrix?: Signalish;
kernelUnitLength?: Signalish;
kerning?: Signalish;
keyPoints?: Signalish;
keySplines?: Signalish;
keyTimes?: Signalish;
lengthAdjust?: Signalish;
letterSpacing?: Signalish;
"letter-spacing"?: Signalish;
lightingColor?: Signalish;
"lighting-color"?: Signalish;
limitingConeAngle?: Signalish;
local?: Signalish;
markerEnd?: Signalish;
"marker-end"?: Signalish;
markerHeight?: Signalish;
markerMid?: Signalish;
"marker-mid"?: Signalish;
markerStart?: Signalish;
"marker-start"?: Signalish;
markerUnits?: Signalish;
markerWidth?: Signalish;
mask?: Signalish;
maskContentUnits?: Signalish;
maskUnits?: Signalish;
mathematical?: Signalish;
mode?: Signalish;
numOctaves?: Signalish;
offset?: Signalish;
opacity?: Signalish;
operator?: Signalish;
order?: Signalish;
orient?: Signalish;
orientation?: Signalish;
origin?: Signalish;
overflow?: Signalish;
overlinePosition?: Signalish;
"overline-position"?: Signalish;
overlineThickness?: Signalish;
"overline-thickness"?: Signalish;
paintOrder?: Signalish;
"paint-order"?: Signalish;
panose1?: Signalish;
"panose-1"?: Signalish;
pathLength?: Signalish;
patternContentUnits?: Signalish;
patternTransform?: Signalish;
patternUnits?: Signalish;
pointerEvents?: Signalish;
"pointer-events"?: Signalish;
points?: Signalish;
pointsAtX?: Signalish;
pointsAtY?: Signalish;
pointsAtZ?: Signalish;
preserveAlpha?: Signalish;
preserveAspectRatio?: Signalish;
primitiveUnits?: Signalish;
r?: Signalish;
radius?: Signalish;
refX?: Signalish;
refY?: Signalish;
renderingIntent?: Signalish;
"rendering-intent"?: Signalish;
repeatCount?: Signalish;
"repeat-count"?: Signalish;
repeatDur?: Signalish;
"repeat-dur"?: Signalish;
requiredExtensions?: Signalish;
requiredFeatures?: Signalish;
restart?: Signalish;
result?: Signalish;
rotate?: Signalish;
rx?: Signalish;
ry?: Signalish;
scale?: Signalish;
seed?: Signalish;
shapeRendering?: Signalish;
"shape-rendering"?: Signalish;
slope?: Signalish;
spacing?: Signalish;
specularConstant?: Signalish;
specularExponent?: Signalish;
speed?: Signalish;
spreadMethod?: Signalish;
startOffset?: Signalish;
stdDeviation?: Signalish;
stemh?: Signalish;
stemv?: Signalish;
stitchTiles?: Signalish;
stopColor?: Signalish;
"stop-color"?: Signalish;
stopOpacity?: Signalish;
"stop-opacity"?: Signalish;
strikethroughPosition?: Signalish;
"strikethrough-position"?: Signalish;
strikethroughThickness?: Signalish;
"strikethrough-thickness"?: Signalish;
string?: Signalish;
stroke?: Signalish;
strokeDasharray?: Signalish;
"stroke-dasharray"?: Signalish;
strokeDashoffset?: Signalish;
"stroke-dashoffset"?: Signalish;
strokeLinecap?: Signalish<"butt" | "round" | "square" | "inherit" | undefined>;
"stroke-linecap"?: Signalish<"butt" | "round" | "square" | "inherit" | undefined>;
strokeLinejoin?: Signalish<"miter" | "round" | "bevel" | "inherit" | undefined>;
"stroke-linejoin"?: Signalish<"miter" | "round" | "bevel" | "inherit" | undefined>;
strokeMiterlimit?: Signalish;
"stroke-miterlimit"?: Signalish;
strokeOpacity?: Signalish;
"stroke-opacity"?: Signalish;
strokeWidth?: Signalish;
"stroke-width"?: Signalish;
surfaceScale?: Signalish;
systemLanguage?: Signalish;
tableValues?: Signalish;
targetX?: Signalish;
targetY?: Signalish;
textAnchor?: Signalish;
"text-anchor"?: Signalish;
textDecoration?: Signalish