/** * Meissa schema element — a tuple of [componentType, ...args] * Examples: * ["heading", "Dashboard"] * ["btn", { label: "Click me", action: "onClick" }] * ["row", [...children]] */ export type MeissaSchemaElement = [string, ...unknown[]]; /** * A Meissa schema is an array of schema elements. */ export type MeissaSchema = MeissaSchemaElement[]; /** * Theme configuration for the Meissa renderer. */ export interface MeissaTheme { /** Background color */ bg?: string; /** Foreground/text color */ fg?: string; /** Primary accent color */ primary?: string; /** Secondary accent color */ secondary?: string; /** Muted/subtle color */ muted?: string; /** Border color */ border?: string; /** Error/danger color */ error?: string; /** Success color */ success?: string; /** Warning color */ warning?: string; /** Border radius (e.g., "0.5rem") */ radius?: string; /** Font family */ font?: string; } /** * Options for createMeissaApp. */ export interface MeissaAppOptions { /** Theme configuration */ theme?: MeissaTheme; /** HTML page title */ title?: string; /** Width hint for iframe (e.g., "800px", "100%") */ width?: string; /** Height hint for iframe (e.g., "600px", "100%") */ height?: string; } /** * The result returned by createMeissaApp. */ export interface MeissaAppResult { /** The complete self-contained HTML string */ content: string; /** MIME type — always "text/html" */ mimeType: "text/html"; } /** * Outgoing messages (iframe -> host). */ export type MeissaOutgoingMessage = MeissaActionMessage | MeissaNavigateMessage | MeissaReadyMessage | MeissaResizeMessage; export interface MeissaActionMessage { type: "meissa:action"; action: string; args: Record; } export interface MeissaNavigateMessage { type: "meissa:navigate"; uri: string; } export interface MeissaReadyMessage { type: "meissa:ready"; } export interface MeissaResizeMessage { type: "meissa:resize"; height: number; } /** * Incoming messages (host -> iframe). */ export type MeissaIncomingMessage = MeissaDataMessage | MeissaPatchMessage | MeissaUpdateMessage | MeissaActionResponseMessage; export interface MeissaDataMessage { type: "meissa:data"; data: Record; } export interface MeissaPatchMessage { type: "meissa:patch"; patches: MeissaJsonPatch[]; } export interface MeissaUpdateMessage { type: "meissa:update"; data: Record; } export interface MeissaActionResponseMessage { type: "meissa:action-response"; result: unknown; } export interface MeissaJsonPatch { op: "add" | "remove" | "replace" | "move" | "copy" | "test"; path: string; value?: unknown; from?: string; }