import { W as WidgetInteractions } from './types-CJtAzafC.js'; /** * @eeko/sdk - Widget Manifest Schema (`widget.json`) * * The canonical shape of a widget's `widget.json` manifest, mirrored from the * server's `ComponentFieldDefinition` (`@live-alerts/shared-types/components`) * so a widget validated locally (via `eeko build`) validates the same way the * nexus-api accepts it on commit. * * This module is browser-safe (no Node APIs, zero runtime deps). The matching * `loadManifest()` file loader lives in `./loader` (Node-only). */ /** * Field input types. Mirrors `ComponentFieldType` on the server. `image`, * `audio`, and `video` values are `eeko-asset://` references resolved by * the widget-host at serve time. */ declare const MANIFEST_FIELD_TYPES: readonly ["text", "textarea", "number", "color", "select", "boolean", "url", "image", "audio", "video", "font", "json"]; type ManifestFieldType = (typeof MANIFEST_FIELD_TYPES)[number]; /** * Where a field's value is applied. `global` bakes at serve time; `variant` * is substituted per trigger; `both` participates in either scope. */ declare const MANIFEST_FIELD_SCOPES: readonly ["global", "variant", "both"]; type ManifestFieldScope = (typeof MANIFEST_FIELD_SCOPES)[number]; /** A choice for a `select` field. */ interface ManifestFieldOption { label: string; value: string | number | boolean; } /** * A single configurable field on a widget. Mirrors `ComponentFieldDefinition`. */ interface ManifestField { key: string; label: string; type: ManifestFieldType; scope: ManifestFieldScope; defaultValue?: unknown; required?: boolean; min?: number; max?: number; step?: number; options?: ManifestFieldOption[]; placeholder?: string; helpText?: string; category?: string; /** For image/audio/video fields: MIME prefixes the asset picker restricts to. */ mimeFilter?: string[]; /** UI hint for asset-bearing fields. */ assetDisplay?: 'inline' | 'compact'; } /** * The widget's design surface — the fixed pixel canvas the author works * against. Orientation is derived from width vs height (never stored). The * runtime bridge pins the widget root to these dimensions and zoom-to-fits it * into whatever viewport the iframe is given. */ interface WidgetCanvas { /** Design width in CSS px. */ width: number; /** Design height in CSS px. */ height: number; /** Optional id of the preset the author picked, for UI round-trip. */ preset?: string; } /** * The full `widget.json` manifest. `globalConfig`/`variantConfig` carry the * serve-time default values keyed by field `key`. */ interface WidgetManifest { name: string; componentType: string; fields: ManifestField[]; behavior?: Record; /** * Optional declarative behaviour. Interpreted by the SDK interaction runtime * (see `../interactions/types`). Absent on legacy/hand-coded widgets; the * runtime no-ops when it isn't present. The authoritative schema validation * lives in nexus-api on commit — this is only a structural pre-flight. */ interactions?: WidgetInteractions; /** * Optional design surface (size + orientation). Absent on legacy widgets, * which the host treats as a default 1920×1080 landscape canvas. */ canvas?: WidgetCanvas; globalConfig: Record; variantConfig: Record; } type ValidateManifestResult = { ok: true; manifest: WidgetManifest; } | { ok: false; errors: string[]; }; /** * Structurally validate a parsed `widget.json` manifest. Returns the * normalized manifest (with `fields`/`globalConfig`/`variantConfig` defaulted * to empties) on success, or the full list of problems on failure. * * This is a fast developer-facing pre-flight; the nexus-api remains the * authoritative validator on commit. */ declare function validateManifest(input: unknown): ValidateManifestResult; export { type ManifestField as M, type ValidateManifestResult as V, type WidgetManifest as W, MANIFEST_FIELD_TYPES as a, MANIFEST_FIELD_SCOPES as b, type ManifestFieldType as c, type ManifestFieldScope as d, type ManifestFieldOption as e, type WidgetCanvas as f, validateManifest as v };