export type Component> = (props: T) => void; declare const RIPPLE_ELEMENT: unique symbol; export type RippleElement = { readonly render: Function; readonly [RIPPLE_ELEMENT]: true; }; /** Type for implicit children fragments rendered with `{children}`. */ export type Children = RippleElement; export type CompatApi = { createRoot: () => void; createComponent: (node: any, children_fn: () => any) => void; jsx: (type: any, props: any) => any; }; export type CompatOptions = { [key: string]: CompatApi; }; export function mount( component: Component, options: { target: HTMLElement; props?: Record; compat?: CompatOptions }, ): () => void; export function hydrate( component: Component, options: { target: HTMLElement; props?: Record; compat?: CompatOptions }, ): () => void; export function tick(): Promise; export function untrack(fn: () => T): T; export function flushSync(fn?: () => T): T; export function effect(fn: (() => void) | (() => () => void)): void; export interface RippleArrayStatics { from: { (array_like: ArrayLike): RippleArray; ( array_like: ArrayLike, mapfn: (value: T, index: number) => U, this_arg?: any, ): RippleArray; (iterable: Iterable): RippleArray; ( iterable: Iterable, mapfn: (value: T, index: number) => U, this_arg?: any, ): RippleArray; }; of: { (...items: T[]): RippleArray; }; fromAsync: { ( iterable_or_array_like: AsyncIterable | Iterable | ArrayLike, ): Promise>>; ( iterable_or_array_like: AsyncIterable | Iterable | ArrayLike, mapfn: (value: Awaited, index: number) => U | PromiseLike, this_arg?: any, ): Promise>>; }; } export interface RippleArrayCallable extends RippleArrayStatics { (...elements: T[]): RippleArray; } export interface RippleArrayConstructor extends RippleArrayStatics { new (...elements: T[]): RippleArray; } export interface RippleArray extends Array {} export const RippleArray: RippleArrayConstructor; export interface ContextCallable { (initial_value?: T): Context; } export interface ContextConstructor { new (initial_value?: T): Context; } declare const CONTEXT_BRAND: unique symbol; export interface Context { get(): T; set(value: T): void; [CONTEXT_BRAND]: void; } export declare const Context: ContextConstructor; export interface RippleSetCallable { (values?: readonly T[] | null): RippleSet; } export interface RippleSetConstructor { new (values?: readonly T[] | null): RippleSet; } declare const RIPPLE_SET_BRAND: unique symbol; export interface RippleSet extends Set { isDisjointFrom(other: ReadonlySetLike | RippleSet): boolean; isSubsetOf(other: ReadonlySetLike | RippleSet): boolean; isSupersetOf(other: ReadonlySetLike | RippleSet): boolean; difference(other: ReadonlySetLike | RippleSet): RippleSet; intersection(other: ReadonlySetLike | RippleSet): RippleSet; symmetricDifference(other: ReadonlySetLike | RippleSet): RippleSet; union(other: ReadonlySetLike | RippleSet): RippleSet; toJSON(): T[]; [RIPPLE_SET_BRAND]: void; } export const RippleSet: RippleSetConstructor; export interface RippleMapCallable { (entries?: readonly (readonly [K, V])[] | null): RippleMap; } export interface RippleMapConstructor { new (entries?: readonly (readonly [K, V])[] | null): RippleMap; } declare const RIPPLE_MAP_BRAND: unique symbol; export interface RippleMap extends Map { toJSON(): [K, V][]; [RIPPLE_MAP_BRAND]: void; } export const RippleMap: RippleMapConstructor; // Compiler-injected runtime symbols (for Ripple component development) declare global { /** * Runtime block context injected by the Ripple compiler. * This is automatically available in component scopes and passed to runtime functions. */ var __block: any; /** * Ripple runtime namespace - injected by the compiler * These functions are available in compiled Ripple components for TypeScript analysis */ var _$_: { tracked(value: T, block?: any): T; computed(fn: () => T, block?: any): T; scope(): any; get_tracked(node: any): any; get_derived(node: any): any; set(node: any, value: any): any; document: Document; // Add other runtime functions as needed for TypeScript analysis }; } export function createRefKey(): symbol; // Base Tracked interface - all tracked values have a '#v' property containing the actual value interface TrackedBase { '#v': V; value: V; } // Augment Tracked to be callable when V is a Component // This allows <@Something /> to work in JSX when Something is Tracked interface TrackedCallable { (props: V extends Component ? P : never): V extends Component ? void : never; } // Supports indexed access: track(0)[0] → value, track(0)[1] → Tracked // And destructuring `const [one, two] = track(0);` export type Tracked = [V, Tracked] & TrackedBase & TrackedCallable; // Helper type to infer component type from a function that returns a component // If T is a function returning a Component, extract the Component type itself, not the return type (void) export type InferComponent = T extends () => infer R ? (R extends Component ? R : T) : T; export type Props = Record; export type PropsWithExtras = Props & T & Record; export type PropsWithChildren = Expand< Omit & { children: Children } >; export type PropsWithChildrenOptional = Expand< Omit & { children?: Children } >; export type PropsNoChildren = Expand; type Expand = T extends infer O ? { [K in keyof O]: O[K] } : never; export function get(tracked: Tracked): V; export function set(tracked: Tracked, value: V): void; // Overload for tracked values - returns the original tracked value type export function track(value: Tracked): Tracked; // Overload for function values - infers the return type of the function export function track( value: () => V, get?: (v: InferComponent) => InferComponent, set?: (next: InferComponent, prev: InferComponent) => InferComponent, ): Tracked>; // Overload for non-function values export function track(value?: V, get?: (v: V) => V, set?: (next: V, prev: V) => V): Tracked; export interface AddEventOptions extends ExtendedEventOptions { customName?: string; } export interface AddEventObject extends AddEventOptions, EventListenerObject {} export interface ExtendedEventOptions extends AddEventListenerOptions, EventListenerOptions { delegated?: boolean; } export type OnEventListenerRemover = () => void; export function on( window: Window, type: Type, handler: (this: Window, event: WindowEventMap[Type]) => any, options?: ExtendedEventOptions | undefined, ): OnEventListenerRemover; export function on( document: Document, type: Type, handler: (this: Document, event: DocumentEventMap[Type]) => any, options?: ExtendedEventOptions | undefined, ): OnEventListenerRemover; export function on( element: Element, type: Type, handler: (this: Element, event: HTMLElementEventMap[Type]) => any, options?: ExtendedEventOptions | undefined, ): OnEventListenerRemover; export function on( element: Element, type: Type, handler: (this: Element, event: MediaQueryListEventMap[Type]) => any, options?: ExtendedEventOptions | undefined, ): OnEventListenerRemover; export function on( element: EventTarget, type: string, handler: EventListener, options?: ExtendedEventOptions | undefined, ): OnEventListenerRemover; export type RippleObjectShallow = { [K in keyof T]: T[K] | Tracked; }; export type RippleObjectDeep = T extends | string | number | boolean | null | undefined | symbol | bigint ? T | Tracked : T extends RippleArray ? RippleArray | Tracked> : T extends RippleSet ? RippleSet | Tracked> : T extends RippleMap ? RippleMap | Tracked> : T extends Array ? Array> | Tracked>> : T extends Set ? Set> | Tracked>> : T extends Map ? | Map, RippleObjectDeep> | Tracked, RippleObjectDeep>> : T extends object ? { [K in keyof T]: RippleObjectDeep | Tracked> } : T | Tracked; export interface RippleObjectCallable { (obj: T): RippleObject; } export interface RippleObjectConstructor { new (obj: T): RippleObject; } export interface RippleObject extends Object {} export const RippleObject: RippleObjectConstructor; export interface RippleDateCallable { (): RippleDate; (value: number | string): RippleDate; ( year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number, ): RippleDate; } export interface RippleDateConstructor { new (): RippleDate; new (value: number | string): RippleDate; new ( year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number, ): RippleDate; } declare const RIPPLE_DATE_BRAND: unique symbol; export interface RippleDate extends Date { [RIPPLE_DATE_BRAND]: void; } export const RippleDate: RippleDateConstructor; export interface RippleURLSearchParamsCallable { ( init?: | string | readonly (readonly [string, string])[] | Record | URLSearchParams | RippleURLSearchParams, ): RippleURLSearchParams; } export interface RippleURLSearchParamsConstructor { new ( init?: | string | readonly (readonly [string, string])[] | Record | URLSearchParams | RippleURLSearchParams, ): RippleURLSearchParams; } declare const REPLACE: unique symbol; declare const RIPPLE_URL_SEARCH_PARAMS_BRAND: unique symbol; export interface RippleURLSearchParams extends URLSearchParams { [REPLACE](params: URLSearchParams): void; [RIPPLE_URL_SEARCH_PARAMS_BRAND]: void; } export const RippleURLSearchParams: RippleURLSearchParamsConstructor; export interface RippleURLCallable { (url: string | URL, base?: string | URL | RippleURL): RippleURL; } export interface RippleURLConstructor { new (url: string | URL, base?: string | URL | RippleURL): RippleURL; } declare const RIPPLE_URL_BRAND: unique symbol; export interface RippleURL extends URL { get searchParams(): RippleURLSearchParams; [RIPPLE_URL_BRAND]: void; } export const RippleURL: RippleURLConstructor; export function createSubscriber(start: () => void | (() => void)): () => void; declare const REACTIVE_VALUE_BRAND: unique symbol; interface ReactiveValue extends Tracked { new (fn: () => Tracked, start: () => void | (() => void)): Tracked; [REACTIVE_VALUE_BRAND]: void; } export interface MediaQueryCallable { (query: string, fallback?: boolean | undefined): Tracked; } export interface MediaQueryConstructor { new (query: string, fallback?: boolean | undefined): Tracked; } declare const MEDIA_QUERY_BRAND: unique symbol; export interface MediaQuery extends Tracked { [MEDIA_QUERY_BRAND]: void; } export const MediaQuery: MediaQueryConstructor; export function Portal({ target, children, }: { target: V; children?: Children; }): void; export type GetFunction = () => V; export type SetFunction = (v: V) => void; export function bindValue( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement | HTMLSelectElement) => void; export function bindValue( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLInputElement | HTMLSelectElement) => void; export function bindChecked( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement) => void; export function bindChecked( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLInputElement) => void; export function bindClientWidth( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindClientWidth( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindClientHeight( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindClientHeight( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindContentRect( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindContentRect( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindContentBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindContentBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindBorderBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindBorderBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindDevicePixelContentBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindDevicePixelContentBoxSize( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindInnerHTML( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindInnerHTML( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindInnerText( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindInnerText( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindTextContent( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindTextContent( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindNode( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindNode( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindGroup( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement) => void; export function bindGroup( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLInputElement) => void; export function bindOffsetHeight( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindOffsetHeight( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindOffsetWidth( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLElement) => void; export function bindOffsetWidth( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLElement) => void; export function bindIndeterminate( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement) => void; export function bindIndeterminate( tracked: Tracked | GetFunction, setter?: SetFunction>, ): (node: HTMLInputElement) => void; export function bindFiles( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement) => void; export function bindFiles( tracked: Tracked | GetFunction, setter?: SetFunction, ): (node: HTMLInputElement) => void; type ServerBlock = {}; export interface RippleNamespace { array: RippleArrayCallable; object: RippleObjectCallable; context: ContextCallable; date: RippleDateCallable; effect: typeof effect; map: RippleMapCallable; mediaQuery: MediaQueryCallable; set: RippleSetCallable; url: RippleURLCallable; urlSearchParams: RippleURLSearchParamsCallable; untrack: typeof untrack; track: typeof track; style: Record; server: ServerBlock; } export declare const ripple_namespace: RippleNamespace;