/** * Component factory and runtime. * * This module contains the component() factory function, component registry, * and createPropsProxy utility. Type definitions live in component-types.ts, * lifecycle hooks live in component-lifecycle.ts. */ import type { ComponentSetupContext, PlatformElement, ViewFn, SetupFn, ComponentFactory, ComponentOptions } from './component-types.js'; export type { ComponentAttributeExtensions, ComponentAttributes, Define, ModelBinding, EventDefinition, SlotsObject, EmitFn, PlatformTypes, PlatformElement, MountContext, SetupContext, PropsWithDefaults, PropsAccessor, ComponentSetupContext, ViewFn, SetupFn, Ref, Exposed, ComponentRef, ComponentFactory, AnyComponentFactory, ComponentOptions, } from './component-types.js'; export type { Model } from './component-types.js'; export { getCurrentInstance, setCurrentInstance, onMounted, onUnmounted, onCreated, onUpdated, } from './component-lifecycle.js'; /** * Get component metadata (for DevTools) */ export declare function getComponentMeta(factory: Function): { name?: string; setup: SetupFn; } | undefined; /** * Helper to create a proxy that tracks property access */ export declare function createPropsProxy>(target: T, onAccess?: (key: string) => void): T; type ExtractExposed = "__exposed" extends keyof T ? (NonNullable extends { __type: infer E; } ? E : void) : void; type ExtractSlots = T extends { __slots?: infer S; } ? S : {}; type StripInternalMarkers = { [K in keyof T as K extends "__exposed" | "__slots" | "__models" | "__modelBindings" ? never : K extends `model:${string}` ? never : K extends `update:${string}` ? never : K]: T[K]; }; /** * Define a component. Returns a JSX factory function. * * @param setup - Setup function that receives context and returns a render function * @param options - Optional configuration (e.g., name for DevTools) * * @example * ```tsx * type CardProps = Define.Prop<"title", string> & Define.Slot<"header">; * * export const Card = component((ctx) => { * const { title } = ctx.props; * const { slots } = ctx; * * return () => ( *
* {slots.header?.() ??

{title}

} * {slots.default?.()} *
* ); * }); * ``` */ export declare function component = {}, TRef = ExtractExposed, TSlots = ExtractSlots>(setup: (ctx: ComponentSetupContext, TCombined, TRef, TSlots>) => ViewFn | Promise, options?: ComponentOptions): ComponentFactory; //# sourceMappingURL=component.d.ts.map