UNPKG

@kitn.ai/ui

Version:

Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.

23 lines (22 loc) 1.19 kB
import { CSSProperties, ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from 'react'; export interface WebComponentProps { /** Color mode (`auto` follows prefers-color-scheme). */ theme?: 'light' | 'dark' | 'auto'; className?: string; style?: CSSProperties; id?: string; /** Light-DOM children passed through to the element (slots). */ children?: ReactNode; } /** Eagerly register ALL kai-* elements (the register-all bundle). Opt-in escape * hatch for consumers who prefer no first-mount upgrade delay. Browser-only; * a no-op on the server. */ export declare function registerAll(): Promise<unknown> | undefined; export declare function createWebComponent<P extends WebComponentProps>(tagName: string, /** DOM-property names to assign from props (incl. `theme`). */ propNames: readonly string[], /** Map of React handler prop → DOM event name. */ eventMap: Record<string, string>, /** Client-only thunk that loads + registers this element (a literal dynamic * import of its `@kitn.ai/ui/elements/<name>` chunk). */ register?: () => Promise<unknown>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<HTMLElement>>;