interface ArrowTemplate { (parent: ParentNode): ParentNode; (): DocumentFragment; isT: boolean; key: (key: ArrowTemplateKey) => ArrowTemplate; id: (id: ArrowTemplateId) => ArrowTemplate; _c: () => Chunk; _k: ArrowTemplateKey; _i?: ArrowTemplateId; } type ArrowTemplateKey = string | number | undefined; type ArrowTemplateId = string | number | undefined; type ArrowRenderable = string | number | boolean | null | undefined | ComponentCall | ArrowTemplate | Array; type ParentNode = Node | DocumentFragment; type ArrowFunction = (...args: unknown[]) => ArrowRenderable; type ArrowExpression = ArrowRenderable | ArrowFunction | EventListener | ((evt: InputEvent) => void); interface Chunk { paths: [number[], string[]]; dom: DocumentFragment; ref: DOMRef; _t: ArrowTemplate; k?: ArrowTemplateKey; i?: ArrowTemplateId; e: number; g: string; b: boolean; r: boolean; st: boolean; bkn?: Chunk; v?: Array<[Element, string]> | null; u?: Array<() => void> | null; s?: ReturnType[2]; mk?: number; next?: Chunk; } interface DOMRef { f: ChildNode | null; l: ChildNode | null; } declare function html(strings: TemplateStringsArray | string[], ...expSlots: ArrowExpression[]): ArrowTemplate; declare function svg(strings: TemplateStringsArray | string[], ...expSlots: ArrowExpression[]): ArrowTemplate; /** * The target of a reactive object. */ type ReactiveTarget = Record | unknown[]; interface ReactiveAPI { /** * Adds an observer to a given property. * @param p - The property to watch. * @param c - The callback to call when the property changes. * @returns */ $on:

(p: P, c: PropertyObserver) => void; /** * Removes an observer from a given property. * @param p - The property to stop watching. * @param c - The callback to stop calling when the property changes. * @returns */ $off:

(p: P, c: PropertyObserver) => void; } /** * A reactive object is a proxy of an original object. */ interface Computed extends Readonly> { } type ReactiveValue = T extends Computed ? TValue : T extends ReactiveTarget ? Reactive | T : T; type Reactive = { [P in keyof T]: ReactiveValue; } & ReactiveAPI; /** * A callback used to observe a property changes on a reactive object. */ interface PropertyObserver { (newValue?: T, oldValue?: T): void; } /** * A reactive object is a proxy of the original object that allows for * reactive dependency watching. It is created by calling `reactive()` and * should be used to store reactive data in your app and components. * * @param data - The data to make reactive, typically a plain object. * @returns A reactive proxy of the original data. */ declare function reactive(effect: () => T): Computed; declare function reactive(data: T): Reactive; /** * Calls a function and watches it for changes. * @param fn - A function to watch. * @param after - A function to call after the watched function with the result. */ declare function watch unknown>(pointer: number, afterEffect: A): [returnValue: ReturnType, stop: () => void]; declare function watch unknown>(effect: F): [returnValue: ReturnType, stop: () => void]; declare function watch unknown, A extends (arg: ReturnType) => unknown>(effect: F, afterEffect: A): [returnValue: ReturnType, stop: () => void]; type Props = { [P in keyof T]: T[P] extends ReactiveTarget ? Props | T[P] : T[P]; }; type EventMap = Record; type Events = { [K in keyof T]?: (payload: T[K]) => void; }; type Emit = (event: K, payload: T[K]) => void; type ComponentFactory = (props?: Props, emit?: Emit) => ArrowTemplate; interface AsyncComponentOptions { fallback?: unknown; onError?: (error: unknown, props: Props, emit: Emit) => unknown; render?: (value: TValue, props: Props, emit: Emit) => unknown; serialize?: (value: TValue, props: Props, emit: Emit) => TSnapshot; deserialize?: (snapshot: TSnapshot, props: Props) => TValue; idPrefix?: string; } interface ComponentCall { h: ComponentFactory; p: Props | undefined; e: Events | undefined; k: ArrowTemplateKey; key: (key: ArrowTemplateKey) => ComponentCall; } interface Component { (props?: undefined, events?: Events): ComponentCall; } interface ComponentWithProps { (props: S, events?: Events): ComponentCall; } type SourceBox = Reactive<{ 0: Props | undefined; 1: ComponentFactory; 2: Events | undefined; }>; declare function pick(source: T, ...keys: K[]): Pick; declare function pick(source: T): T; declare function component(factory: () => ArrowTemplate): Component; declare function component(factory: (props: undefined, emit: Emit) => ArrowTemplate): Component; declare function component(factory: (props: Props) => ArrowTemplate): ComponentWithProps; declare function component(factory: (props: Props, emit: Emit) => ArrowTemplate): ComponentWithProps; declare function component(factory: (() => Promise | TValue) | ((props: undefined, emit: Emit) => Promise | TValue), options?: AsyncComponentOptions): Component; declare function component(factory: ((props: Props) => Promise | TValue) | ((props: Props, emit: Emit) => Promise | TValue), options?: AsyncComponentOptions): ComponentWithProps; declare function createPropsProxy(source: Props | undefined, factory: ComponentFactory, events?: Events): [Props, Emit, SourceBox]; /** * Adds the ability to listen to the next tick. * @param {CallableFunction} fn? * @returns Promise */ declare function nextTick(fn?: CallableFunction): Promise; declare function onCleanup(fn: () => void): () => void | 0; export { component as c, component, html, nextTick, onCleanup, pick, pick as props, reactive as r, reactive, svg, html as t, watch as w, watch }; export type { ArrowExpression, ArrowRenderable, ArrowTemplate, ArrowTemplateKey, AsyncComponentOptions, Component, ComponentCall, ComponentWithProps, Computed, Emit, EventMap, Events, ParentNode, PropertyObserver, Props, Reactive, ReactiveTarget };