import { LucideIcon } from "lucide-react"; import Color from "colorjs.io"; import { RemoteDomSerializableValue } from "@fluid-app/widget-runtime/worker"; //#region ../core/src/data-sources/types.d.ts type StaticSourceType = "collections" | "categories" | "tags"; type ShareableType = "Medium" | "Page" | "EnrollmentPack" | "Library" | "Product"; interface SelectedItem { /** The unique ID of the selected item */ id: string | number; /** The type of shareable content */ shareableType: ShareableType; /** Optional cached data for preview/display purposes in the editor UI */ cachedData?: { title?: string; imageUrl?: string; kind?: string; }; /** Widget-specific per-item configuration overrides */ widgetConfig?: Record; } interface ApiDataSource { type: "api"; /** If this source was created from a preset, the preset's unique ID. At runtime, the preset's current endpoint/resultPath/transform are used instead of the stored snapshot values. */ presetId?: string; /** API endpoint URL (can include {variable} placeholders, e.g., /api/reps/{rep_id}/items) */ endpoint: string; /** HTTP method (defaults to GET) */ method?: "GET" | "POST" | "PUT" | "DELETE"; /** Request headers */ headers?: Record; /** Request body for POST/PUT (will be JSON.stringify'd) */ body?: unknown; /** * Path to extract from response using dot notation * e.g., "data.items" extracts response.data.items */ resultPath?: string; /** * Which widget props this source populates * e.g., ['data'] means the fetched result goes to props.data */ targetProps: string[]; /** * Name of a registered transform function to process the data * Transform is applied after resultPath extraction */ transform?: string; /** Per-source variables for endpoint template interpolation (e.g., { limit: "10" }) */ variables?: Record; /** * Auto-refresh interval in milliseconds * 0 or undefined = no auto-refresh */ refreshInterval?: number; } interface CustomDataSource { type: "custom"; /** Array of selected items to fetch */ selectedItems: SelectedItem[]; /** * Which widget props this source populates * e.g., ['slides'] means the fetched results go to props.slides */ targetProps: string[]; /** * Name of a registered transform function to process the data * Transform is applied after all items are fetched */ transform?: string; /** * Auto-refresh interval in milliseconds * 0 or undefined = no auto-refresh */ refreshInterval?: number; } interface StaticDataSource { type: "static"; /** The type of static data (collections, categories, tags) */ staticType: StaticSourceType; /** The selected item ID */ selectedId: string | number; /** Cached data for preview/display in editor UI */ cachedData?: { title?: string; imageUrl?: string; }; /** * Which widget props this source populates */ targetProps: string[]; /** * Name of a registered transform function to process the data */ transform?: string; /** * Auto-refresh interval in milliseconds * 0 or undefined = no auto-refresh */ refreshInterval?: number; } type DataSource = ApiDataSource | CustomDataSource | StaticDataSource; interface DataSourceConfig { /** Array of data sources (usually just one, but supports multiple) */ sources: DataSource[]; /** Loading state configuration */ loading?: { /** Show skeleton placeholder while loading (default: true) */showSkeleton?: boolean; }; /** Error handling configuration */ error?: { /** Fallback props to use when fetch fails */fallback?: Record; /** Number of retry attempts (default: 0) */ retryCount?: number; /** Delay between retries in ms (default: 1000) */ retryDelay?: number; }; } //#endregion //#region ../core/src/registries/property-schema-types.d.ts /** * Tab configuration for organizing properties */ interface TabConfig { /** Unique identifier for the tab */ id: string; /** Display label for the tab */ label: string; } /** * Property field type constant - single source of truth for field types. * Use PROPERTY_FIELD_TYPES.text instead of "text" for type-safe comparisons. */ declare const PROPERTY_FIELD_TYPES: { readonly text: "text"; readonly textarea: "textarea"; readonly number: "number"; readonly boolean: "boolean"; readonly select: "select"; /** @deprecated Use `colorSelect` for semantic portal-theme colors. */ readonly color: "color"; readonly range: "range"; readonly dataSource: "dataSource"; readonly resource: "resource"; readonly image: "image"; readonly alignment: "alignment"; readonly slider: "slider"; readonly colorPicker: "colorPicker"; readonly sectionHeader: "sectionHeader"; readonly separator: "separator"; readonly buttonGroup: "buttonGroup"; readonly colorSelect: "colorSelect"; readonly sectionLayoutSelect: "sectionLayoutSelect"; readonly background: "background"; readonly contentPosition: "contentPosition"; readonly textSizeSelect: "textSizeSelect"; readonly cssUnit: "cssUnit"; readonly fontPicker: "fontPicker"; readonly stringArray: "stringArray"; readonly quoteList: "quoteList"; readonly borderRadius: "borderRadius"; readonly screenPicker: "screenPicker"; }; /** * Union type of all property field types, derived from PROPERTY_FIELD_TYPES constant. * @see deriving-typeof-for-object-keys pattern */ type PropertyFieldType = (typeof PROPERTY_FIELD_TYPES)[keyof typeof PROPERTY_FIELD_TYPES]; /** * Runtime validation for property field types. * @param value - The value to check * @returns true if value is a valid PropertyFieldType */ declare function isPropertyFieldType(value: string): value is PropertyFieldType; /** * Base schema for a property field */ interface PropertyFieldSchema { /** Property key in the widget props */ key: string; /** Display label for the field */ label: string; /** Field type determines the input control */ type: PropertyFieldType; /** Optional description/help text */ description?: string; /** Optional default value */ defaultValue?: unknown; /** Optional tab ID (must match a TabConfig id if widget has tabsConfig) */ tab?: string; /** Optional group for organizing fields within a tab */ group?: string; /** * When true, this field is treated as an override of a value that can * otherwise be inherited from the active theme (e.g. border radius, * padding, border width). Advanced fields are automatically bucketed * into the `CUSTOM_STYLING_GROUP` at the bottom of their tab and * rendered collapsed by default so the default surface area stays * minimal. */ advanced?: boolean; /** * @deprecated Use requiresKeyValue instead */ requiresKeyToBeTrue?: string; /** Optional requires a specific key to have a specific value. Supports single condition or array (AND logic). */ requiresKeyValue?: { key: string; value: unknown; } | Array<{ key: string; value: unknown; }>; } /** * Text field schema */ interface TextFieldSchema extends PropertyFieldSchema { type: "text"; placeholder?: string; maxLength?: number; /** * Optional quick-insert chips rendered below the input. Clicking a chip * inserts `{{value}}` at the caret. Used for URL template tokens * (e.g. `{{username}}`, `{{replicated_url || /signup}}`) so admins * don't have to remember the exact spelling. */ tokenSuggestions?: ReadonlyArray<{ /** Chip label shown to the admin (e.g. `username`). */label: string; /** Token body inserted between `{{` and `}}` (e.g. `username || /signup`). */ value: string; }>; } /** * Textarea field schema */ interface TextareaFieldSchema extends PropertyFieldSchema { type: "textarea"; placeholder?: string; rows?: number; maxLength?: number; } /** * Number field schema */ interface NumberFieldSchema extends PropertyFieldSchema { type: "number"; min?: number; max?: number; step?: number; } /** * Boolean field schema */ interface BooleanFieldSchema extends PropertyFieldSchema { type: "boolean"; } /** * Select field schema with type-safe option values. * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema. */ interface SelectFieldSchema extends StrictOmit { type: "select"; options: Array<{ label: string; value: T; }>; defaultValue?: T; } /** * Legacy free-form color field schema. * * @deprecated Use {@link ColorSelectFieldSchema} (`type: "colorSelect"`) so * widget authors select a semantic color token supplied by the portal theme. */ interface ColorFieldSchema extends PropertyFieldSchema { type: "color"; } /** * Range slider field schema */ interface RangeFieldSchema extends PropertyFieldSchema { type: "range"; min: number; max: number; step?: number; } /** * Data source field schema for configuring widget data sources */ interface DataSourceFieldSchema extends PropertyFieldSchema { /** Identifies this field as the data-source editor. */ type: "dataSource"; /** Widget props that this data-source editor can populate. */ targetProps?: ReadonlyArray<{ /** Widget prop key populated with the resolved data-source result. */key: string; /** Description emitted for this prop in the portal JSON Schema and types. */ description: string; }>; } /** * Resource field schema for selecting a single resource from the selection modal */ interface ResourceFieldSchema extends PropertyFieldSchema { type: "resource"; /** Optional filter to specific shareable types */ allowedTypes?: string[]; } /** * Image field schema for selecting a single asset (image or video) from the * image picker. Despite the legacy "image" name, this field supports video * picking via the `accept` parameter — `VideoWidget`, `ListWidget` Featured * Asset, and `NestedWidget` Primary Media all use it for video-or-mixed * content. */ interface ImageFieldSchema extends PropertyFieldSchema { type: "image"; /** * Restricts which MIME categories the picker offers. Defaults to "image". */ accept?: "image" | "video" | "any"; } /** * Alignment field schema */ interface AlignmentFieldSchema extends PropertyFieldSchema { type: "alignment"; options: { verticalEnabled: boolean; horizontalEnabled: boolean; }; defaultValue?: AlignOptions; } /** * Slider field schema with optional unit suffix (e.g., "rem", "px") */ interface SliderFieldSchema extends PropertyFieldSchema { type: "slider"; min: number; max: number; step?: number; unit?: string; } /** * Color picker field schema with optional swatches */ interface ColorPickerFieldSchema extends PropertyFieldSchema { type: "colorPicker"; swatches?: string[]; } /** * Section header field schema for visual grouping */ interface SectionHeaderFieldSchema extends PropertyFieldSchema { type: "sectionHeader"; subtitle?: string; } /** * Separator field schema for visual separation */ interface SeparatorFieldSchema extends PropertyFieldSchema { type: "separator"; } /** * Button group field schema. * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema. */ interface ButtonGroupFieldSchema extends StrictOmit { type: "buttonGroup"; options: Array<{ label?: string; ariaLabel?: string; icon?: LucideIcon; value: T; }>; defaultValue?: T; } /** * Semantic theme-color token selector. Prefer this field over free-form color * controls so widgets continue to work across portal themes and color modes. */ interface ColorSelectFieldSchema extends PropertyFieldSchema { type: "colorSelect"; defaultValue?: ColorOptions; excludeColors?: ColorOptions[]; } /** * Section layout select field schema for visual masonry layout selector */ interface SectionLayoutSelectFieldSchema extends PropertyFieldSchema { type: "sectionLayoutSelect"; defaultValue?: SectionLayoutType; } /** * Background field combines resource selection and color properties. * Uses StrictOmit to exclude conflicting "type" discriminant from parents. */ interface BackgroundFieldSchema extends StrictOmit, StrictOmit { type: "background"; } /** * Content position field schema for 3x3 grid position picker */ interface ContentPositionFieldSchema extends PropertyFieldSchema { type: "contentPosition"; defaultValue?: string; } /** * Text size select field schema for visual font size selector */ interface TextSizeSelectFieldSchema extends PropertyFieldSchema { type: "textSizeSelect"; defaultValue?: FontSizeOptions; } /** * CSS unit type for height/width fields */ type CssUnit = "px" | "rem" | "vh" | "%"; /** * CSS unit field schema for numeric values with selectable units (px, rem, vh, %) */ interface CssUnitFieldSchema extends PropertyFieldSchema { type: "cssUnit"; minByUnit?: Partial>; maxByUnit?: Partial>; stepByUnit?: Partial>; allowedUnits?: CssUnit[]; defaultUnit?: CssUnit; } /** * Font picker field schema for Google Fonts selection */ interface FontPickerFieldSchema extends PropertyFieldSchema { type: "fontPicker"; placeholder?: string; } /** * String array field schema for managing lists of text items */ interface StringArrayFieldSchema extends PropertyFieldSchema { type: "stringArray"; placeholder?: string; defaultValue?: string[]; } /** * A single quote in a QuoteList: the text plus optional attribution + role. */ interface QuoteListItem { quote: string; attribution?: string; role?: string; } /** * An editable list of quotes (add / remove / edit inline in the panel). Powers * the Quote widget's one-or-many quotes. */ interface QuoteListFieldSchema extends PropertyFieldSchema { type: "quoteList"; defaultValue?: QuoteListItem[]; } /** * Border radius composite field schema for controlling 4 corners with a single field. * Maps to 4 individual widget prop keys (topLeft, topRight, bottomLeft, bottomRight). */ interface BorderRadiusFieldSchema extends PropertyFieldSchema { type: "borderRadius"; keys: { topLeft: string; topRight: string; bottomLeft: string; bottomRight: string; }; defaultValue?: BorderRadiusOptions; } /** * Screen picker field schema for selecting a portal screen (navigation, system, or available) */ interface ScreenPickerFieldSchema extends PropertyFieldSchema { type: "screenPicker"; /** Whether to include system navigation items in the picker */ includeSystemItems?: boolean; } /** * Union of all field schema types */ type PropertyField = TextFieldSchema | TextareaFieldSchema | NumberFieldSchema | BooleanFieldSchema | SelectFieldSchema | ColorFieldSchema | RangeFieldSchema | DataSourceFieldSchema | ResourceFieldSchema | ImageFieldSchema | AlignmentFieldSchema | SliderFieldSchema | ColorPickerFieldSchema | SectionHeaderFieldSchema | SeparatorFieldSchema | ButtonGroupFieldSchema | ColorSelectFieldSchema | SectionLayoutSelectFieldSchema | BackgroundFieldSchema | ContentPositionFieldSchema | TextSizeSelectFieldSchema | CssUnitFieldSchema | FontPickerFieldSchema | StringArrayFieldSchema | QuoteListFieldSchema | BorderRadiusFieldSchema | ScreenPickerFieldSchema; /** * Schema for per-item configuration in custom data sources. * Widgets can define this to allow users to configure widget-specific * settings for each selected item (e.g., title, description, button). */ interface ItemConfigSchema { /** Fields available for per-item configuration */ fields: PropertyField[]; /** Optional description shown at top of item config panel */ description?: string; } /** * Schema for a widget's editable properties */ interface WidgetPropertySchema { /** Widget type this schema applies to */ widgetType: WidgetType; /** Display name for the widget */ displayName: string; /** Optional tab configuration - if present, tabs are enabled */ tabsConfig?: TabConfig[]; /** Editable property fields */ fields: PropertyField[]; /** Optional custom validator function */ validate?: (props: Record) => string | null; /** Props that can be populated from data sources */ dataSourceTargetProps?: string[]; /** Optional schema for per-item configurations in custom data sources */ itemConfigSchema?: ItemConfigSchema; } /** * Group property fields by their group property. * * Fields flagged with `advanced: true` are collected into the * `CUSTOM_STYLING_GROUP` bucket regardless of their declared `group`, * and that bucket is always placed last so it renders at the bottom of * the tab. Non-advanced fields keep their author-declared group and * their relative insertion order, including fields that explicitly use * `CUSTOM_STYLING_GROUP`. */ declare function groupPropertyFields(fields: readonly PropertyField[]): Record; /** * Extract current values from widget props based on property fields */ declare function extractPropertyValues(widget: Readonly, fields: readonly PropertyField[]): Record; /** * Apply property values to widget props */ declare function applyPropertyValues(widget: Readonly, values: Readonly>): WidgetSchema; //#endregion //#region ../core/src/remote-dom-widget-package.d.ts declare const REMOTE_DOM_WIDGET_MANIFEST_VERSION: 1; declare const REMOTE_DOM_WIDGET_RUNTIME: "remote-dom"; type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | readonly JsonValue[] | JsonObject; interface JsonObject { readonly [key: string]: JsonValue; } type SerializableValue = unknown extends Value ? JsonValue : Value extends JsonValue ? Value : Value extends readonly (infer Item)[] ? readonly SerializableValue[] : Value extends object ? { readonly [Key in keyof Value as NonNullable extends ((...args: never[]) => unknown) ? never : Key]: SerializableValue } : never; /** * A property field that can be included in published widget metadata. * * The legacy `color` field is deprecated. Use `colorSelect` so the value is a * semantic color token supplied by the portal theme. */ type WidgetSourcePropertyField = PropertyField extends infer Field ? Field extends ButtonGroupFieldSchema ? Omit, "options"> & { /** Serializable button choices. Runtime icon components are not supported. */readonly options: readonly { readonly label?: string; readonly ariaLabel?: string; readonly value: string | number; }[]; } : SerializableValue : never; /** * JSON-serializable property editor schema accepted by widget source metadata. * The build adds `widgetType`; authors must not supply it. */ interface WidgetSourcePropertySchema { /** Optional tabs used to organize the property editor. */ readonly tabsConfig?: SerializableValue>; /** Editable fields shown in the property editor. */ readonly fields: readonly WidgetSourcePropertyField[]; /** Widget props that data sources can populate. */ readonly dataSourceTargetProps?: readonly string[]; /** Optional per-item fields for custom data-source selections. */ readonly itemConfigSchema?: { /** Fields available for each selected item. */readonly fields: readonly WidgetSourcePropertyField[]; /** Help text shown above the per-item editor. */ readonly description?: string; }; } interface RemoteDomWidgetCapabilityDeclaration { readonly name: string; readonly version: string; } interface RemoteDomWidgetDefinition { readonly type: string; readonly displayName: string; readonly description: string; readonly icon: string; readonly category: string; readonly propertySchema: JsonObject; readonly defaultProps: JsonObject; readonly container: "inline" | "block" | "card" | "fullscreen"; readonly resizable: boolean | "horizontal" | "vertical" | "both"; readonly minSdkVersion: string; readonly capabilities: readonly RemoteDomWidgetCapabilityDeclaration[]; } /** * Canonical package contract shared by the CLI, catalog APIs, and portal hosts. * Catalog producers resolve every artifact to its public URL before returning * this descriptor; consumers do not translate legacy manifest shapes. */ interface RemoteDomWidgetPackageDescriptor { readonly manifestVersion: typeof REMOTE_DOM_WIDGET_MANIFEST_VERSION; readonly runtime: typeof REMOTE_DOM_WIDGET_RUNTIME; readonly packageId: string; readonly source: "company" | "droplet"; readonly version: string; readonly workerEntryUrl: string; readonly cssUrls: readonly string[]; readonly assetUrls: readonly string[]; readonly widgets: readonly RemoteDomWidgetDefinition[]; } //#endregion //#region ../core/src/remote-widget-capability-grants.d.ts interface RemoteWidgetCapabilityGrant { readonly packageId: string; readonly packageVersion: string; readonly capabilityVersion: string; } type RemoteWidgetCapabilityGrants = Readonly>; //#endregion //#region ../core/src/types/widget-schema.d.ts /** * Generic component type — avoids React dependency in core. * Accepts both function components and class component constructors. */ type AnyComponent = ((props: any) => any) | (new (props: any) => any); /** * Widget type names as a const object. * This serves as the single source of truth for widget discriminants. * Use `as const` for literal type inference (safety-as-const-deep-readonly rule). */ declare const WIDGET_TYPE_NAMES: { readonly Alert: "AlertWidget"; readonly Announcement: "AnnouncementWidget"; readonly BulletList: "BulletListWidget"; readonly Calendar: "CalendarWidget"; readonly Card: "CardWidget"; readonly Carousel: "CarouselWidget"; readonly CatchUp: "CatchUpWidget"; readonly Chart: "ChartWidget"; readonly Container: "ContainerWidget"; readonly Embed: "EmbedWidget"; readonly Image: "ImageWidget"; readonly Layout: "LayoutWidget"; readonly Link: "LinkWidget"; readonly List: "ListWidget"; readonly MySite: "MySiteWidget"; readonly Nested: "NestedWidget"; readonly Points: "PointsWidget"; readonly Quote: "QuoteWidget"; readonly QuickLinks: "QuickLinksWidget"; readonly QuickShare: "QuickShareWidget"; readonly RecentActivity: "RecentActivityWidget"; readonly Separator: "SeparatorWidget"; readonly Shop: "ShopWidget"; readonly Spacer: "SpacerWidget"; readonly Table: "TableWidget"; readonly Text: "TextWidget"; readonly ToDo: "ToDoWidget"; readonly Video: "VideoWidget"; }; /** * Union of all known widget type names. * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule). */ type WidgetTypeName = (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES]; /** * Legacy alias for backwards compatibility. * Prefer using WidgetTypeName for new code when you need the union type. */ type WidgetType = string; type WidgetRegistry = Record; /** * Base widget schema with loose typing for runtime data. * Use TypedWidgetSchema when you have a known registry for better type safety. */ type WidgetSchema = { readonly type: WidgetType; readonly props: Readonly>; readonly id?: string; /** Optional data source configuration for data-bound widgets */ readonly dataSource?: DataSourceConfig | undefined; /** Column index for masonry layouts (0-indexed) */ readonly columnIndex?: number; /** Host-approved capabilities for a specific remote widget package version. */ readonly capabilityGrants?: RemoteWidgetCapabilityGrants; }; /** * Type-safe widget schema based on registry. * Uses discriminated unions - the `type` field serves as discriminant. * When narrowed (e.g., `if (widget.type === "AlertWidget")`), * TypeScript automatically knows the correct props type. */ type TypedWidgetSchema> = { [K in keyof T]: { readonly type: K; readonly props: Readonly any) ? P : T[K] extends (new (props: infer P) => any) ? P : never>; readonly id?: string; readonly dataSource?: DataSourceConfig | undefined; /** Column index for masonry layouts (0-indexed) */ readonly columnIndex?: number; readonly capabilityGrants?: RemoteWidgetCapabilityGrants; } }[keyof T]; /** * Widget path in the tree - array of indices. * Readonly tuple to prevent accidental mutation. */ type WidgetPath = readonly number[]; /** * Type predicate to check if a string is a known widget type name. * Use for runtime validation of widget types. * * @example * if (isWidgetTypeName(widget.type)) { * // TypeScript knows widget.type is WidgetTypeName * } */ declare function isWidgetTypeName(type: string): type is WidgetTypeName; /** * Type predicate to check if a widget has a specific type. * Enables type-safe widget narrowing without `as` assertions. * * @example * if (isWidgetType(widget, "LayoutWidget")) { * // TypeScript knows widget.type === "LayoutWidget" * // and widget.props is LayoutWidget props * } */ declare function isWidgetType(widget: WidgetSchema | null | undefined, typeName: T): widget is WidgetSchema & { readonly type: T; }; /** * Helper for exhaustive switch statements on widget types. * Use in the default case to ensure all widget types are handled. * * @example * switch (widget.type) { * case "AlertWidget": return handleAlert(); * case "TextWidget": return handleText(); * // ... all other widget types * default: return assertNever(widget.type, "widget type"); * } */ declare function assertNever(value: never, context?: string): never; /** * Assertion function that throws if value is undefined. * Narrows the type to exclude undefined. * * @example * const widget = screen[0]; * assertDefined(widget, "widget at index 0"); * // TypeScript knows widget is defined here */ declare function assertDefined(value: T | undefined | null, name?: string): asserts value is T; //#endregion //#region ../../platform/theme-engine/src/types.d.ts declare const SEMANTIC_COLOR_NAMES: readonly ["background", "foreground", "primary", "secondary", "accent", "muted", "destructive"]; type SemanticColorName = (typeof SEMANTIC_COLOR_NAMES)[number]; declare const FONT_SIZE_KEYS: readonly ["extraSmall", "small", "regular", "large", "extraLarge", "giant"]; type FontSizeKey = (typeof FONT_SIZE_KEYS)[number]; declare const FONT_FAMILY_KEYS: readonly ["header", "body"]; type FontFamilyKey = (typeof FONT_FAMILY_KEYS)[number]; declare const RADIUS_KEYS: readonly ["small", "medium", "large", "extraLarge"]; type RadiusKey = (typeof RADIUS_KEYS)[number]; /** Author-time color input (what the user configures) */ interface ThemeColorInput { base: Color; foreground: Color; } /** Complete theme definition — stored in-memory with Color objects */ interface ThemeDefinition { id: string; name: string; /** Light mode — always fully specified */ light: Record; /** * Dark mode — only user-overridden colors. * Missing keys are auto-derived from `light` at resolve time. */ dark: Partial>>; fontSizes: Record; fontFamilies: Record; spacing: string; radii: Record; /** When true, theme colors are re-derived from brand guidelines on every load */ syncWithBrandColors?: boolean; } /** Resolved semantic color */ interface ResolvedSemanticColor { base: Color; foreground: Color; } /** Complete resolved color set for one mode */ type ResolvedColorSet = Record; /** Fully resolved theme — all colors materialised for both modes */ interface ResolvedTheme { id: string; name: string; light: ResolvedColorSet; dark: ResolvedColorSet; fontSizes: ThemeDefinition["fontSizes"]; fontFamilies: ThemeDefinition["fontFamilies"]; spacing: string; radii: ThemeDefinition["radii"]; } /** Plain OKLCH triplet for JSON serialisation (no Color dependency) */ interface OklchPlain { l: number; c: number; h: number; } /** Serialised color pair as stored in the backend payload */ interface ThemeColorPlain { base: OklchPlain; foreground: OklchPlain; } /** Backend payload — plain JSON, no Color objects */ interface ThemePayload { [key: string]: unknown; id: string; name: string; light: Record; dark: Partial>; fontSizes: Record; fontFamilies: Record; spacing: string; radii: Record; syncWithBrandColors?: boolean; } //#endregion //#region ../core/src/types/navigation.d.ts /** * Navigation item in the sidebar/menu structure. * * Field types match the FluidOS API schema (`FluidOSNavigationItem`). * Differences from the raw API type: * - `id` is optional (system/default items may not have one) * - `label` is required (transforms default null to "Untitled") * - `section` is a frontend-only extension (not in API) * - Nullable fields use `undefined` instead of `null` (except `parent_id`) */ interface NavigationItem { /** Database-generated identifier — optional because system/default items may not have one */ readonly id?: number; /** URL slug for routing (`| undefined` for exactOptionalPropertyTypes compat) */ slug?: string | undefined; /** Display label — required; transforms default null API values to "Untitled" */ label: string; /** Icon identifier (e.g., FontAwesome name) */ icon?: string | undefined; /** Section grouping for quick links (frontend-only, not in API) */ section?: string; /** Associated screen ID */ screen_id?: number | undefined; /** Sort order */ position?: number | undefined; /** Parent navigation item ID (null for root items) */ parent_id?: number | null; /** Origin of this navigation item */ source?: "user" | "system" | "code"; /** Nested navigation items */ children: NavigationItem[]; } /** * Screen definition with its component tree */ interface ScreenDefinition { readonly id: number; slug: string; name: string; component_tree: WidgetSchema[]; } /** * Navigation configuration for the portal */ interface Navigation { readonly definition_id: number; readonly id: number; name: string; navigation_items: NavigationItem[]; screens: ScreenDefinition[]; } /** A portal app profile — themes, navigation, and definition reference. */ interface RepAppProfile { name: string; themes: ThemeDefinition[]; activeThemeId?: string; navigation: Navigation; mobile_navigation?: Navigation; definition_id: number; } /** Full portal app data returned by the fluidos API or builder preview. */ interface RepAppData { definition_id: number; published_version: number; screens: ScreenDefinition[]; profile: RepAppProfile; } /** Wrapper for the `/fluid_os/definitions/active` API response. */ interface RepAppManifest { manifest: RepAppData; } //#endregion //#region ../core/src/types/shareable-item.d.ts /** * Base props for a shareable item. * Uses structural typing to be compatible with various modal implementations. * The index signature allows additional properties from consuming apps. */ interface ShareableItem { id: string | number; title?: string | null; image_url?: string | null; imageUrl?: string | null; kind?: string | null; type?: string | null; shareableType?: string | null; share_link?: string | null; videoUrl?: string; price?: string | number | null; display_price?: string | null; [key: string]: unknown; } //#endregion //#region ../core/src/types/field-types.d.ts /** * Color options constant - single source of truth for color values. * Use COLOR_OPTIONS.primary instead of "primary" for type-safe comparisons. */ declare const COLOR_OPTIONS: { readonly background: "background"; readonly foreground: "foreground"; readonly primary: "primary"; readonly secondary: "secondary"; readonly accent: "accent"; readonly muted: "muted"; readonly border: "border"; readonly destructive: "destructive"; readonly transparent: "transparent"; }; /** * Union type of all color options, derived from COLOR_OPTIONS constant. * @see deriving-typeof-for-object-keys pattern */ type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS]; declare const FONT_SIZE_OPTIONS: { readonly "2xl": "2xl"; readonly xl: "xl"; readonly lg: "lg"; readonly md: "md"; readonly sm: "sm"; readonly xs: "xs"; }; type FontSizeOptions = (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS]; declare const FONT_WEIGHT_OPTIONS: { readonly normal: "normal"; readonly medium: "medium"; readonly semibold: "semibold"; readonly bold: "bold"; }; type FontWeightOptions = (typeof FONT_WEIGHT_OPTIONS)[keyof typeof FONT_WEIGHT_OPTIONS]; declare const BORDER_RADIUS_OPTIONS: { readonly none: "none"; readonly sm: "sm"; readonly md: "md"; readonly lg: "lg"; readonly xl: "xl"; readonly full: "full"; }; type BorderRadiusOptions = (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS]; declare const BORDER_WIDTH_OPTIONS: { readonly none: "none"; readonly thin: "thin"; readonly medium: "medium"; readonly thick: "thick"; }; type BorderWidthOptions = (typeof BORDER_WIDTH_OPTIONS)[keyof typeof BORDER_WIDTH_OPTIONS]; /** Padding values - numeric, so we use a tuple for derivation */ declare const PADDING_VALUES: readonly [0, 2, 4, 6, 8, 10]; type PaddingOptions = (typeof PADDING_VALUES)[number]; declare const BUTTON_SIZE_OPTIONS: { readonly sm: "sm"; readonly default: "default"; readonly lg: "lg"; readonly xl: "xl"; }; type ButtonSizeOptions = (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS]; declare const GAP_OPTIONS: { readonly none: "none"; readonly xs: "xs"; readonly sm: "sm"; readonly md: "md"; readonly lg: "lg"; readonly xl: "xl"; }; type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS]; declare const VERTICAL_ALIGN_OPTIONS: { readonly top: "top"; readonly center: "center"; readonly bottom: "bottom"; }; type VerticalAlign = (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS]; declare const HORIZONTAL_ALIGN_OPTIONS: { readonly left: "left"; readonly center: "center"; readonly right: "right"; }; type HorizontalAlign = (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS]; type AlignOptions = { vertical?: VerticalAlign; horizontal?: HorizontalAlign; }; declare const BACKGROUND_TYPES: { readonly solid: "solid"; readonly image: "image"; }; type BackgroundType = (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES]; interface BackgroundValue { type: BackgroundType; color?: ColorOptions; resource?: ShareableItem; } /** * Section layout configuration - single source of truth for layout types. * SectionLayoutType is derived from these keys to prevent drift. */ declare const SECTION_LAYOUT_CONFIG: { readonly "single-column": { readonly columns: 1; readonly widths: readonly ["1fr"]; readonly gridClasses: ""; }; readonly "2c-equal": { readonly columns: 2; readonly widths: readonly ["1fr", "1fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"; }; readonly "2c-left-wider": { readonly columns: 2; readonly widths: readonly ["2fr", "1fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]"; }; readonly "2c-right-wider": { readonly columns: 2; readonly widths: readonly ["1fr", "2fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]"; }; readonly "2c-left-narrow": { readonly columns: 2; readonly widths: readonly ["1fr", "3fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,1fr)_minmax(0,3fr)]"; }; readonly "2c-right-narrow": { readonly columns: 2; readonly widths: readonly ["3fr", "1fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,3fr)_minmax(0,1fr)]"; }; readonly "3c-equal": { readonly columns: 3; readonly widths: readonly ["1fr", "1fr", "1fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)]"; }; readonly "3c-middle-wider": { readonly columns: 3; readonly widths: readonly ["1fr", "2fr", "1fr"]; readonly gridClasses: "@md:grid-cols-[minmax(0,1fr)_minmax(0,2fr)_minmax(0,1fr)]"; }; }; /** * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys. * @see deriving-typeof-for-object-keys pattern */ type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG; /** @deprecated Use SECTION_LAYOUT_CONFIG instead */ declare const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG; //#endregion //#region ../core/src/types/index.d.ts type StrictOmit = Omit; //#endregion //#region src/widgets/remote/contract/portal-function.d.ts /** JSON-compatible value that can cross the widget worker boundary. */ type PortalFunctionJsonValue = RemoteDomSerializableValue; type PortalFunctionJsonPrimitive = null | boolean | number | string; type IsAny = 0 extends 1 & Value ? true : false; type IsPortalFunctionJsonBranch = Value extends PortalFunctionJsonPrimitive ? true : Value extends readonly (infer Item)[] ? IsPortalFunctionJsonValue : Value extends ((...args: never[]) => unknown) ? false : Value extends object ? Extract extends never ? false extends { [Key in keyof Value]-?: IsPortalFunctionJsonValue[Key], Seen | Value> }[keyof Value] ? false : true : false : false; type IsPortalFunctionJsonValue = IsAny extends true ? false : [Value] extends [never] ? false : [Value] extends [Seen] ? true : false extends (Value extends unknown ? IsPortalFunctionJsonBranch : never) ? false : true; type IsExactlyVoid = [Value] extends [void] ? [void] extends [Value] ? true : false : false; type PortalFunctionContractErrors = IsPortalFunctionJsonValue extends true ? IsExactlyVoid extends true ? [] : IsPortalFunctionJsonValue extends true ? [] : [error: "Portal function input must contain only JSON values"] : [error: "Portal function output must contain only JSON values"]; /** Stable error classification returned by Portal functions. */ type PortalFunctionErrorCode = "NOT_MOUNTED" | "NOT_DECLARED" | "NOT_GRANTED" | "INVALID_ARGUMENT" | "UNAVAILABLE" | "UNSUPPORTED" | "HOST_FAILURE" | "INVALID_RESPONSE"; /** A stable, serializable failure reported by a Portal function call. */ declare class PortalFunctionError extends Error { /** Machine-readable failure classification. */ readonly code: PortalFunctionErrorCode; /** * Creates an error with a stable code and developer-facing message. * @param code - Machine-readable failure classification. * @param message - Developer-facing explanation safe to cross the worker boundary. * @example throw new PortalFunctionError("INVALID_ARGUMENT", "An id is required."); */ constructor(code: PortalFunctionErrorCode, message: string); } /** Serializable identity of one versioned host capability method. */ interface PortalFunctionDefinition { /** Capability family declared by a widget. */ readonly capability: string; /** Capability contract version. */ readonly version: string; /** Method name within the capability. */ readonly method: string; } /** Async worker-side callable for a Portal function. */ type PortalFunction = [Input] extends [void] ? () => Promise : (input: Input) => Promise; type AnyPortalFunction = (...args: never[]) => Promise; /** Host-side handler shape for a Portal function definition. */ type PortalFunctionHandler = [Input] extends [void] ? () => Output | Promise : (input: Input) => Output | Promise; /** Bound Portal function definition and host handler. */ interface PortalFunctionImplementation { /** Capability identity implemented by the handler. */ readonly definition: PortalFunctionDefinition; /** Worker callable associated with the implementation. */ readonly portalFunction: AnyPortalFunction; /** Host handler invoked for the function. */ readonly handler: (...args: never[]) => unknown | Promise; } /** * Defines a typed Portal function backed by a versioned host capability. * Widgets must include the returned function in `defineWidget({ uses: [...] })` * before calling it. Inputs and outputs must contain only JSON values. * * @param definition - Stable capability, version, and method identity. * @returns An async worker callable that rejects with {@link PortalFunctionError}. * @throws {@link PortalFunctionError} when a call is not mounted or declared, has invalid input, is unsupported or unavailable, fails in the host, or returns an invalid response. * @remarks Define functions during module initialization. Both input and output types must contain only JSON-compatible values. * * @example * ```ts * const getGreeting = definePortalFunction({ * capability: "greeting", * version: "1", * method: "get", * }); * ``` */ declare function definePortalFunction(definition: PortalFunctionDefinition, ..._contractErrors: PortalFunctionContractErrors): PortalFunction; /** * Binds a host handler to a function created by {@link definePortalFunction}. * * @param portalFunction - Defined function whose metadata identifies the capability. * @param handler - Host handler with the same input and output contract. * @returns The definition, callable, and handler as one implementation record. * @throws {@link PortalFunctionError} when `portalFunction` was not created by `definePortalFunction`. * @remarks This registration helper is for capability implementations. Widget components call the defined Portal function instead. * @example * ```ts * const implementation = implementPortalFunction(getGreeting, () => "Hello"); * ``` */ declare function implementPortalFunction(portalFunction: PortalFunction, handler: PortalFunctionHandler, NoInfer>): PortalFunctionImplementation; //#endregion export { WidgetTypeName as $, FONT_FAMILY_KEYS as A, SEMANTIC_COLOR_NAMES as B, sectionLayoutConfig as C, RepAppManifest as D, RepAppData as E, RADIUS_KEYS as F, ThemePayload as G, ThemeColorInput as H, RadiusKey as I, WIDGET_TYPE_NAMES as J, AnyComponent as K, ResolvedColorSet as L, FontFamilyKey as M, FontSizeKey as N, RepAppProfile as O, OklchPlain as P, WidgetType as Q, ResolvedSemanticColor as R, SectionLayoutType as S, NavigationItem as T, ThemeColorPlain as U, SemanticColorName as V, ThemeDefinition as W, WidgetRegistry as X, WidgetPath as Y, WidgetSchema as Z, ColorOptions as _, extractPropertyValues as _t, PortalFunctionErrorCode as a, JsonValue as at, GapOptions as b, PortalFunctionJsonValue as c, WidgetSourcePropertyField as ct, AlignOptions as d, PropertyFieldSchema as dt, assertDefined as et, BackgroundType as f, PropertyFieldType as ft, ButtonSizeOptions as g, applyPropertyValues as gt, BorderWidthOptions as h, WidgetPropertySchema as ht, PortalFunctionError as i, RemoteWidgetCapabilityGrants as it, FONT_SIZE_KEYS as j, ScreenDefinition as k, definePortalFunction as l, WidgetSourcePropertySchema as lt, BorderRadiusOptions as m, TabConfig as mt, PortalFunction as n, isWidgetType as nt, PortalFunctionHandler as o, RemoteDomWidgetDefinition as ot, BackgroundValue as p, QuoteListItem as pt, TypedWidgetSchema as q, PortalFunctionDefinition as r, isWidgetTypeName as rt, PortalFunctionImplementation as s, RemoteDomWidgetPackageDescriptor as st, AnyPortalFunction as t, assertNever as tt, implementPortalFunction as u, PROPERTY_FIELD_TYPES as ut, FontSizeOptions as v, groupPropertyFields as vt, ShareableItem as w, PaddingOptions as x, FontWeightOptions as y, isPropertyFieldType as yt, ResolvedTheme as z }; //# sourceMappingURL=portal-function-VhLYKC5u.d.cts.map