@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.
13 lines (12 loc) • 870 B
TypeScript
import { CardEvent, CardPolicy } from './card-contract';
/** The single contract event name. */
export declare const CARD_EVENT_NAME = "kai-card";
/** Dispatch a CardEvent as the bubbling, composed `kai-card` event a host listener
* routes. NB: this is deliberately different from defineWebComponent's built-in
* non-bubbling dispatch. */
export declare function emitCardEvent(element: HTMLElement, event: CardEvent): void;
/** Apply the contract's policy to one event. The ONE place routing lives. */
export declare function routeCardEvent(policy: CardPolicy | undefined, event: CardEvent): void;
/** Attach a host-level `kai-card` listener that routes every bubbling card event
* through `policy`. Returns an unsubscribe fn. For the bare-element path. */
export declare function listenForCardEvents(root: HTMLElement | Document, policy: CardPolicy): () => void;