@fluid-app/rep-core 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/data-sources/DataAwareWidget.cjs.map +1 -1
  2. package/dist/data-sources/DataAwareWidget.d.cts +6 -20
  3. package/dist/data-sources/DataAwareWidget.d.cts.map +1 -1
  4. package/dist/data-sources/DataAwareWidget.d.mts +6 -20
  5. package/dist/data-sources/DataAwareWidget.d.mts.map +1 -1
  6. package/dist/data-sources/DataAwareWidget.mjs.map +1 -1
  7. package/dist/data-sources/ErrorState.cjs.map +1 -1
  8. package/dist/data-sources/ErrorState.d.cts +2 -2
  9. package/dist/data-sources/ErrorState.d.cts.map +1 -1
  10. package/dist/data-sources/ErrorState.d.mts +2 -2
  11. package/dist/data-sources/ErrorState.d.mts.map +1 -1
  12. package/dist/data-sources/ErrorState.mjs.map +1 -1
  13. package/dist/data-sources/context.cjs.map +1 -1
  14. package/dist/data-sources/context.d.cts +2 -3
  15. package/dist/data-sources/context.d.cts.map +1 -1
  16. package/dist/data-sources/context.d.mts +2 -3
  17. package/dist/data-sources/context.d.mts.map +1 -1
  18. package/dist/data-sources/context.mjs.map +1 -1
  19. package/dist/data-sources/fetchers/api.d.cts +3 -3
  20. package/dist/data-sources/fetchers/api.d.mts +3 -3
  21. package/dist/data-sources/fetchers/custom.d.cts +10 -10
  22. package/dist/data-sources/fetchers/custom.d.mts +10 -10
  23. package/dist/data-sources/fetchers/static.d.cts +20 -20
  24. package/dist/data-sources/fetchers/static.d.cts.map +1 -1
  25. package/dist/data-sources/fetchers/static.d.mts +20 -20
  26. package/dist/data-sources/fetchers/static.d.mts.map +1 -1
  27. package/dist/data-sources/preview-context.cjs.map +1 -1
  28. package/dist/data-sources/preview-context.d.cts +1 -3
  29. package/dist/data-sources/preview-context.d.cts.map +1 -1
  30. package/dist/data-sources/preview-context.d.mts +1 -3
  31. package/dist/data-sources/preview-context.d.mts.map +1 -1
  32. package/dist/data-sources/preview-context.mjs.map +1 -1
  33. package/dist/data-sources/registry-context.cjs.map +1 -1
  34. package/dist/data-sources/registry-context.d.cts +14 -15
  35. package/dist/data-sources/registry-context.d.cts.map +1 -1
  36. package/dist/data-sources/registry-context.d.mts +14 -15
  37. package/dist/data-sources/registry-context.d.mts.map +1 -1
  38. package/dist/data-sources/registry-context.mjs.map +1 -1
  39. package/dist/data-sources/registry.cjs.map +1 -1
  40. package/dist/data-sources/registry.d.cts +4 -4
  41. package/dist/data-sources/registry.d.cts.map +1 -1
  42. package/dist/data-sources/registry.d.mts +4 -4
  43. package/dist/data-sources/registry.d.mts.map +1 -1
  44. package/dist/data-sources/registry.mjs.map +1 -1
  45. package/dist/data-sources/transformers.d.cts +3 -3
  46. package/dist/data-sources/transformers.d.mts +3 -3
  47. package/dist/data-sources/types.d.cts +1 -1
  48. package/dist/data-sources/types.d.mts +1 -1
  49. package/dist/data-sources/use-widget-data.d.cts +4 -4
  50. package/dist/data-sources/use-widget-data.d.cts.map +1 -1
  51. package/dist/data-sources/use-widget-data.d.mts +4 -4
  52. package/dist/data-sources/use-widget-data.d.mts.map +1 -1
  53. package/dist/{index-Bxe_LIi8.d.cts → index-Bgv8HUpo.d.cts} +36 -77
  54. package/dist/index-Bgv8HUpo.d.cts.map +1 -0
  55. package/dist/{index-CCAu2n19.d.mts → index-Ka_HOwpb.d.mts} +36 -77
  56. package/dist/index-Ka_HOwpb.d.mts.map +1 -0
  57. package/dist/registries/index.cjs.map +1 -1
  58. package/dist/registries/index.d.cts +86 -86
  59. package/dist/registries/index.d.cts.map +1 -1
  60. package/dist/registries/index.d.mts +86 -86
  61. package/dist/registries/index.d.mts.map +1 -1
  62. package/dist/registries/index.mjs.map +1 -1
  63. package/dist/shell/AppShellLayout.cjs.map +1 -1
  64. package/dist/shell/AppShellLayout.d.cts +15 -16
  65. package/dist/shell/AppShellLayout.d.cts.map +1 -1
  66. package/dist/shell/AppShellLayout.d.mts +15 -16
  67. package/dist/shell/AppShellLayout.d.mts.map +1 -1
  68. package/dist/shell/AppShellLayout.mjs.map +1 -1
  69. package/dist/shell/ScreenHeader.cjs.map +1 -1
  70. package/dist/shell/ScreenHeader.d.cts +2 -2
  71. package/dist/shell/ScreenHeader.d.cts.map +1 -1
  72. package/dist/shell/ScreenHeader.d.mts +2 -2
  73. package/dist/shell/ScreenHeader.d.mts.map +1 -1
  74. package/dist/shell/ScreenHeader.mjs.map +1 -1
  75. package/dist/shell/ScreenHeaderContext.cjs.map +1 -1
  76. package/dist/shell/ScreenHeaderContext.d.cts +17 -18
  77. package/dist/shell/ScreenHeaderContext.d.cts.map +1 -1
  78. package/dist/shell/ScreenHeaderContext.d.mts +17 -18
  79. package/dist/shell/ScreenHeaderContext.d.mts.map +1 -1
  80. package/dist/shell/ScreenHeaderContext.mjs.map +1 -1
  81. package/dist/shell/ThemeModeContext.cjs.map +1 -1
  82. package/dist/shell/ThemeModeContext.d.cts +2 -3
  83. package/dist/shell/ThemeModeContext.d.cts.map +1 -1
  84. package/dist/shell/ThemeModeContext.d.mts +2 -3
  85. package/dist/shell/ThemeModeContext.d.mts.map +1 -1
  86. package/dist/shell/ThemeModeContext.mjs.map +1 -1
  87. package/dist/shell/sidebar.cjs.map +1 -1
  88. package/dist/shell/sidebar.d.cts +47 -37
  89. package/dist/shell/sidebar.d.cts.map +1 -1
  90. package/dist/shell/sidebar.d.mts +47 -37
  91. package/dist/shell/sidebar.d.mts.map +1 -1
  92. package/dist/shell/sidebar.mjs +32 -32
  93. package/dist/shell/sidebar.mjs.map +1 -1
  94. package/dist/shell/use-mobile.cjs.map +1 -1
  95. package/dist/shell/use-mobile.mjs.map +1 -1
  96. package/dist/theme/index.d.cts +54 -54
  97. package/dist/theme/index.d.cts.map +1 -1
  98. package/dist/theme/index.d.mts +54 -54
  99. package/dist/theme/index.d.mts.map +1 -1
  100. package/dist/types/index.d.cts +3 -3
  101. package/dist/types/index.d.mts +3 -3
  102. package/dist/{types-ByG6Xy3C.d.mts → types-27AHMek-.d.cts} +4 -4
  103. package/dist/{types-ByG6Xy3C.d.mts.map → types-27AHMek-.d.cts.map} +1 -1
  104. package/dist/types-BXFX9bXp.cjs.map +1 -1
  105. package/dist/types-Bjmd7Fdx.mjs.map +1 -1
  106. package/dist/{types-BIXtQlHB.d.cts → types-C5Zs5V3E.d.mts} +29 -29
  107. package/dist/types-C5Zs5V3E.d.mts.map +1 -0
  108. package/dist/{types-Ctu-Zio6.d.cts → types-CeCPKvOv.d.mts} +4 -4
  109. package/dist/{types-Ctu-Zio6.d.cts.map → types-CeCPKvOv.d.mts.map} +1 -1
  110. package/dist/{types-C5OFJy-O.d.mts → types-DrzvahW8.d.cts} +29 -29
  111. package/dist/types-DrzvahW8.d.cts.map +1 -0
  112. package/dist/{widget-schema--PY1uMWx.d.cts → widget-schema-BKZgsNG7.d.mts} +59 -59
  113. package/dist/widget-schema-BKZgsNG7.d.mts.map +1 -0
  114. package/dist/{widget-schema-YkD5p3v4.d.mts → widget-schema-BSX2fVhW.d.cts} +59 -59
  115. package/dist/widget-schema-BSX2fVhW.d.cts.map +1 -0
  116. package/dist/widget-utils/index.d.cts +20 -20
  117. package/dist/widget-utils/index.d.mts +20 -20
  118. package/package.json +2 -2
  119. package/src/styles/globals.css +1 -0
  120. package/dist/index-Bxe_LIi8.d.cts.map +0 -1
  121. package/dist/index-CCAu2n19.d.mts.map +0 -1
  122. package/dist/types-BIXtQlHB.d.cts.map +0 -1
  123. package/dist/types-C5OFJy-O.d.mts.map +0 -1
  124. package/dist/widget-schema--PY1uMWx.d.cts.map +0 -1
  125. package/dist/widget-schema-YkD5p3v4.d.mts.map +0 -1
  126. package/styles/globals.css +0 -1
@@ -23,9 +23,9 @@ interface ThemeDefinition {
23
23
  /** Light mode — always fully specified */
24
24
  light: Record<SemanticColorName, ThemeColorInput>;
25
25
  /**
26
- * Dark mode — only user-overridden colors.
27
- * Missing keys are auto-derived from `light` at resolve time.
28
- */
26
+ * Dark mode — only user-overridden colors.
27
+ * Missing keys are auto-derived from `light` at resolve time.
28
+ */
29
29
  dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>>;
30
30
  fontSizes: Record<FontSizeKey, string>;
31
31
  fontFamilies: Record<FontFamilyKey, string>;
@@ -82,4 +82,4 @@ interface ThemePayload {
82
82
  }
83
83
  //#endregion
84
84
  export { ThemeDefinition as _, OklchPlain as a, ResolvedColorSet as c, SEMANTIC_COLOR_NAMES as d, SHADE_STEPS as f, ThemeColorPlain as g, ThemeColorInput as h, FontSizeKey as i, ResolvedSemanticColor as l, ShadeStep as m, FONT_SIZE_KEYS as n, RADIUS_KEYS as o, SemanticColorName as p, FontFamilyKey as r, RadiusKey as s, FONT_FAMILY_KEYS as t, ResolvedTheme as u, ThemePayload as v };
85
- //# sourceMappingURL=types-ByG6Xy3C.d.mts.map
85
+ //# sourceMappingURL=types-27AHMek-.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-ByG6Xy3C.d.mts","names":[],"sources":["../src/theme/types.ts"],"mappings":";;;cAGa,oBAAA;AAAA,KASD,iBAAA,WAA4B,oBAAA;AAAA,cAE3B,WAAA;AAAA,KAGD,SAAA,WAAoB,WAAA;AAAA,cAEnB,cAAA;AAAA,KAQD,WAAA,WAAsB,cAAA;AAAA,cAErB,gBAAA;AAAA,KACD,aAAA,WAAwB,gBAAA;AAAA,cAEvB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;;UAGf,eAAA;EACf,IAAA,EAAM,KAAA;EACN,UAAA,EAAY,KAAA;AAAA;;UAIG,eAAA;EACf,EAAA;EACA,IAAA;;EAEA,KAAA,EAAO,MAAA,CAAO,iBAAA,EAAmB,eAAA;EA7BQ;AAE3C;;;EAgCE,IAAA,EAAM,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,OAAA,CAAQ,eAAA;EAChD,SAAA,EAAW,MAAA,CAAO,WAAA;EAClB,YAAA,EAAc,MAAA,CAAO,aAAA;EACrB,OAAA;EACA,KAAA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schema.ts","../src/types/field-types.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type { DataSourceConfig } from \"../data-sources/types\";\n\n/**\n * Widget type names as a const object.\n * This serves as the single source of truth for widget discriminants.\n * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).\n */\nexport const WIDGET_TYPE_NAMES = {\n Alert: \"AlertWidget\",\n Calendar: \"CalendarWidget\",\n Carousel: \"CarouselWidget\",\n CatchUp: \"CatchUpWidget\",\n Chart: \"ChartWidget\",\n Container: \"ContainerWidget\",\n Embed: \"EmbedWidget\",\n Image: \"ImageWidget\",\n Layout: \"LayoutWidget\",\n List: \"ListWidget\",\n MySite: \"MySiteWidget\",\n Nested: \"NestedWidget\",\n QuickShare: \"QuickShareWidget\",\n RecentActivity: \"RecentActivityWidget\",\n Spacer: \"SpacerWidget\",\n Table: \"TableWidget\",\n Text: \"TextWidget\",\n ToDo: \"ToDoWidget\",\n Video: \"VideoWidget\",\n} as const;\n\n/**\n * Union of all known widget type names.\n * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).\n */\nexport type WidgetTypeName =\n (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];\n\n/**\n * Legacy alias for backwards compatibility.\n * Prefer using WidgetTypeName for new code when you need the union type.\n */\nexport type WidgetType = string;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type WidgetRegistry = Record<WidgetType, ComponentType<any>>;\n\n/**\n * Base widget schema with loose typing for runtime data.\n * Use TypedWidgetSchema<T> when you have a known registry for better type safety.\n */\nexport type WidgetSchema = {\n readonly type: WidgetType;\n readonly props: Readonly<Record<string, unknown>>;\n readonly id?: string; // Optional unique identifier for drag-and-drop\n /** Optional data source configuration for data-bound widgets */\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n};\n\n/**\n * Type-safe widget schema based on registry.\n * Uses discriminated unions - the `type` field serves as discriminant.\n * When narrowed (e.g., `if (widget.type === \"AlertWidget\")`),\n * TypeScript automatically knows the correct props type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = {\n [K in keyof T]: {\n readonly type: K;\n readonly props: Readonly<React.ComponentProps<T[K]>>;\n readonly id?: string;\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n };\n}[keyof T];\n\n/**\n * Widget path in the tree - array of indices.\n * Readonly tuple to prevent accidental mutation.\n */\nexport type WidgetPath = readonly number[];\n\n// ============================================================================\n// Type Guards and Assertion Functions\n// ============================================================================\n\n/**\n * Type predicate to check if a string is a known widget type name.\n * Use for runtime validation of widget types.\n *\n * @example\n * if (isWidgetTypeName(widget.type)) {\n * // TypeScript knows widget.type is WidgetTypeName\n * }\n */\nexport function isWidgetTypeName(type: string): type is WidgetTypeName {\n // Type assertion required in type guard: Object.values() returns string[], but we\n // need to check against WidgetTypeName values. The assertion is safe because we're\n // checking membership, and the return type predicate ensures correct narrowing.\n return Object.values(WIDGET_TYPE_NAMES).includes(type as WidgetTypeName);\n}\n\n/**\n * Type predicate to check if a widget has a specific type.\n * Enables type-safe widget narrowing without `as` assertions.\n *\n * @example\n * if (isWidgetType(widget, \"LayoutWidget\")) {\n * // TypeScript knows widget.type === \"LayoutWidget\"\n * // and widget.props is LayoutWidget props\n * }\n */\nexport function isWidgetType<T extends WidgetTypeName>(\n widget: WidgetSchema | null | undefined,\n typeName: T,\n): widget is WidgetSchema & { readonly type: T } {\n return widget != null && widget.type === typeName;\n}\n\n/**\n * Helper for exhaustive switch statements on widget types.\n * Use in the default case to ensure all widget types are handled.\n *\n * @example\n * switch (widget.type) {\n * case \"AlertWidget\": return handleAlert();\n * case \"TextWidget\": return handleText();\n * // ... all other widget types\n * default: return assertNever(widget.type, \"widget type\");\n * }\n */\nexport function assertNever(value: never, context?: string): never {\n const message = context\n ? `Unexpected ${context}: ${String(value)}`\n : `Unexpected value: ${String(value)}`;\n throw new Error(message);\n}\n\n/**\n * Assertion function that throws if value is undefined.\n * Narrows the type to exclude undefined.\n *\n * @example\n * const widget = screen[0];\n * assertDefined(widget, \"widget at index 0\");\n * // TypeScript knows widget is defined here\n */\nexport function assertDefined<T>(\n value: T | undefined | null,\n name?: string,\n): asserts value is T {\n if (value == null) {\n throw new Error(name ? `${name} is required` : \"Value is required\");\n }\n}\n","import type { ShareableItem } from \"./shareable-item\";\n\n// ============================================================================\n// Color Options - Derive type from constant for single source of truth\n// ============================================================================\n\n/**\n * Color options constant - single source of truth for color values.\n * Use COLOR_OPTIONS.primary instead of \"primary\" for type-safe comparisons.\n */\nexport const COLOR_OPTIONS = {\n background: \"background\",\n foreground: \"foreground\",\n primary: \"primary\",\n secondary: \"secondary\",\n accent: \"accent\",\n muted: \"muted\",\n destructive: \"destructive\",\n} as const;\n\n/**\n * Union type of all color options, derived from COLOR_OPTIONS constant.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];\n\n// ============================================================================\n// Size Options - Derive types from constants for single source of truth\n// ============================================================================\n\nexport const FONT_SIZE_OPTIONS = {\n \"2xl\": \"2xl\",\n xl: \"xl\",\n lg: \"lg\",\n md: \"md\",\n sm: \"sm\",\n xs: \"xs\",\n} as const;\n\nexport type FontSizeOptions =\n (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];\n\nexport const BORDER_RADIUS_OPTIONS = {\n none: \"none\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n full: \"full\",\n} as const;\n\nexport type BorderRadiusOptions =\n (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];\n\n/** Padding values - numeric, so we use a tuple for derivation */\nexport const PADDING_VALUES = [0, 2, 4, 6, 8, 10] as const;\nexport type PaddingOptions = (typeof PADDING_VALUES)[number];\n\nexport const BUTTON_SIZE_OPTIONS = {\n sm: \"sm\",\n default: \"default\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type ButtonSizeOptions =\n (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];\n\nexport const GAP_OPTIONS = {\n none: \"none\",\n xs: \"xs\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];\n\n// ============================================================================\n// Alignment Options - Derive from constants\n// ============================================================================\n\nexport const VERTICAL_ALIGN_OPTIONS = {\n top: \"top\",\n center: \"center\",\n bottom: \"bottom\",\n} as const;\n\nexport type VerticalAlign =\n (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];\n\nexport const HORIZONTAL_ALIGN_OPTIONS = {\n left: \"left\",\n center: \"center\",\n right: \"right\",\n} as const;\n\nexport type HorizontalAlign =\n (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];\n\nexport type AlignOptions = {\n vertical?: VerticalAlign;\n horizontal?: HorizontalAlign;\n};\n\n// ============================================================================\n// Background Options - Derive from constant\n// ============================================================================\n\nexport const BACKGROUND_TYPES = {\n solid: \"solid\",\n image: \"image\",\n} as const;\n\nexport type BackgroundType =\n (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];\nexport interface BackgroundValue {\n type: BackgroundType;\n color?: ColorOptions;\n resource?: ShareableItem;\n}\n\n// ============================================================================\n// Section Layout - Derive type from config keys (single source of truth)\n// ============================================================================\n\n/**\n * Section layout configuration - single source of truth for layout types.\n * SectionLayoutType is derived from these keys to prevent drift.\n */\nexport const SECTION_LAYOUT_CONFIG = {\n \"single-column\": { columns: 1, widths: [\"1fr\"], gridClasses: \"\" },\n \"2c-equal\": {\n columns: 2,\n widths: [\"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-2\",\n },\n \"2c-left-wider\": {\n columns: 2,\n widths: [\"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[2fr_1fr]\",\n },\n \"2c-right-wider\": {\n columns: 2,\n widths: [\"1fr\", \"2fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr]\",\n },\n \"2c-left-narrow\": {\n columns: 2,\n widths: [\"1fr\", \"3fr\"],\n gridClasses: \"@md:grid-cols-[1fr_3fr]\",\n },\n \"2c-right-narrow\": {\n columns: 2,\n widths: [\"3fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[3fr_1fr]\",\n },\n \"3c-equal\": {\n columns: 3,\n widths: [\"1fr\", \"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-3\",\n },\n \"3c-middle-wider\": {\n columns: 3,\n widths: [\"1fr\", \"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\",\n },\n} as const satisfies Record<\n string,\n {\n readonly columns: number;\n readonly widths: readonly string[];\n readonly gridClasses: string;\n }\n>;\n\n/**\n * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;\n\n/** @deprecated Use SECTION_LAYOUT_CONFIG instead */\nexport const sectionLayoutConfig = SECTION_LAYOUT_CONFIG;\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;CAC/B,OAAO;CACP,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACR;;;;;;;;;;AAqED,SAAgB,iBAAiB,MAAsC;AAIrE,QAAO,OAAO,OAAO,kBAAkB,CAAC,SAAS,KAAuB;;;;;;;;;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CACD,iBAAiB;EACf,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,mBAAmB;EACjB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,YAAY;EACV,SAAS;EACT,QAAQ;GAAC;GAAO;GAAO;GAAM;EAC7B,aAAa;EACd;CACD,mBAAmB;EACjB,SAAS;EACT,QAAQ;GAAC;GAAO;GAAO;GAAM;EAC7B,aAAa;EACd;CACF;;AAgBD,MAAa,sBAAsB"}
1
+ {"version":3,"file":"types-BXFX9bXp.cjs","names":[],"sources":["../src/types/widget-schema.ts","../src/types/field-types.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type { DataSourceConfig } from \"../data-sources/types\";\n\n/**\n * Widget type names as a const object.\n * This serves as the single source of truth for widget discriminants.\n * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).\n */\nexport const WIDGET_TYPE_NAMES = {\n Alert: \"AlertWidget\",\n Calendar: \"CalendarWidget\",\n Carousel: \"CarouselWidget\",\n CatchUp: \"CatchUpWidget\",\n Chart: \"ChartWidget\",\n Container: \"ContainerWidget\",\n Embed: \"EmbedWidget\",\n Image: \"ImageWidget\",\n Layout: \"LayoutWidget\",\n List: \"ListWidget\",\n MySite: \"MySiteWidget\",\n Nested: \"NestedWidget\",\n QuickShare: \"QuickShareWidget\",\n RecentActivity: \"RecentActivityWidget\",\n Spacer: \"SpacerWidget\",\n Table: \"TableWidget\",\n Text: \"TextWidget\",\n ToDo: \"ToDoWidget\",\n Video: \"VideoWidget\",\n} as const;\n\n/**\n * Union of all known widget type names.\n * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).\n */\nexport type WidgetTypeName =\n (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];\n\n/**\n * Legacy alias for backwards compatibility.\n * Prefer using WidgetTypeName for new code when you need the union type.\n */\nexport type WidgetType = string;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type WidgetRegistry = Record<WidgetType, ComponentType<any>>;\n\n/**\n * Base widget schema with loose typing for runtime data.\n * Use TypedWidgetSchema<T> when you have a known registry for better type safety.\n */\nexport type WidgetSchema = {\n readonly type: WidgetType;\n readonly props: Readonly<Record<string, unknown>>;\n readonly id?: string; // Optional unique identifier for drag-and-drop\n /** Optional data source configuration for data-bound widgets */\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n};\n\n/**\n * Type-safe widget schema based on registry.\n * Uses discriminated unions - the `type` field serves as discriminant.\n * When narrowed (e.g., `if (widget.type === \"AlertWidget\")`),\n * TypeScript automatically knows the correct props type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = {\n [K in keyof T]: {\n readonly type: K;\n readonly props: Readonly<React.ComponentProps<T[K]>>;\n readonly id?: string;\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n };\n}[keyof T];\n\n/**\n * Widget path in the tree - array of indices.\n * Readonly tuple to prevent accidental mutation.\n */\nexport type WidgetPath = readonly number[];\n\n// ============================================================================\n// Type Guards and Assertion Functions\n// ============================================================================\n\n/**\n * Type predicate to check if a string is a known widget type name.\n * Use for runtime validation of widget types.\n *\n * @example\n * if (isWidgetTypeName(widget.type)) {\n * // TypeScript knows widget.type is WidgetTypeName\n * }\n */\nexport function isWidgetTypeName(type: string): type is WidgetTypeName {\n // Type assertion required in type guard: Object.values() returns string[], but we\n // need to check against WidgetTypeName values. The assertion is safe because we're\n // checking membership, and the return type predicate ensures correct narrowing.\n return Object.values(WIDGET_TYPE_NAMES).includes(type as WidgetTypeName);\n}\n\n/**\n * Type predicate to check if a widget has a specific type.\n * Enables type-safe widget narrowing without `as` assertions.\n *\n * @example\n * if (isWidgetType(widget, \"LayoutWidget\")) {\n * // TypeScript knows widget.type === \"LayoutWidget\"\n * // and widget.props is LayoutWidget props\n * }\n */\nexport function isWidgetType<T extends WidgetTypeName>(\n widget: WidgetSchema | null | undefined,\n typeName: T,\n): widget is WidgetSchema & { readonly type: T } {\n return widget != null && widget.type === typeName;\n}\n\n/**\n * Helper for exhaustive switch statements on widget types.\n * Use in the default case to ensure all widget types are handled.\n *\n * @example\n * switch (widget.type) {\n * case \"AlertWidget\": return handleAlert();\n * case \"TextWidget\": return handleText();\n * // ... all other widget types\n * default: return assertNever(widget.type, \"widget type\");\n * }\n */\nexport function assertNever(value: never, context?: string): never {\n const message = context\n ? `Unexpected ${context}: ${String(value)}`\n : `Unexpected value: ${String(value)}`;\n throw new Error(message);\n}\n\n/**\n * Assertion function that throws if value is undefined.\n * Narrows the type to exclude undefined.\n *\n * @example\n * const widget = screen[0];\n * assertDefined(widget, \"widget at index 0\");\n * // TypeScript knows widget is defined here\n */\nexport function assertDefined<T>(\n value: T | undefined | null,\n name?: string,\n): asserts value is T {\n if (value == null) {\n throw new Error(name ? `${name} is required` : \"Value is required\");\n }\n}\n","import type { ShareableItem } from \"./shareable-item\";\n\n// ============================================================================\n// Color Options - Derive type from constant for single source of truth\n// ============================================================================\n\n/**\n * Color options constant - single source of truth for color values.\n * Use COLOR_OPTIONS.primary instead of \"primary\" for type-safe comparisons.\n */\nexport const COLOR_OPTIONS = {\n background: \"background\",\n foreground: \"foreground\",\n primary: \"primary\",\n secondary: \"secondary\",\n accent: \"accent\",\n muted: \"muted\",\n destructive: \"destructive\",\n} as const;\n\n/**\n * Union type of all color options, derived from COLOR_OPTIONS constant.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];\n\n// ============================================================================\n// Size Options - Derive types from constants for single source of truth\n// ============================================================================\n\nexport const FONT_SIZE_OPTIONS = {\n \"2xl\": \"2xl\",\n xl: \"xl\",\n lg: \"lg\",\n md: \"md\",\n sm: \"sm\",\n xs: \"xs\",\n} as const;\n\nexport type FontSizeOptions =\n (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];\n\nexport const BORDER_RADIUS_OPTIONS = {\n none: \"none\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n full: \"full\",\n} as const;\n\nexport type BorderRadiusOptions =\n (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];\n\n/** Padding values - numeric, so we use a tuple for derivation */\nexport const PADDING_VALUES = [0, 2, 4, 6, 8, 10] as const;\nexport type PaddingOptions = (typeof PADDING_VALUES)[number];\n\nexport const BUTTON_SIZE_OPTIONS = {\n sm: \"sm\",\n default: \"default\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type ButtonSizeOptions =\n (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];\n\nexport const GAP_OPTIONS = {\n none: \"none\",\n xs: \"xs\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];\n\n// ============================================================================\n// Alignment Options - Derive from constants\n// ============================================================================\n\nexport const VERTICAL_ALIGN_OPTIONS = {\n top: \"top\",\n center: \"center\",\n bottom: \"bottom\",\n} as const;\n\nexport type VerticalAlign =\n (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];\n\nexport const HORIZONTAL_ALIGN_OPTIONS = {\n left: \"left\",\n center: \"center\",\n right: \"right\",\n} as const;\n\nexport type HorizontalAlign =\n (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];\n\nexport type AlignOptions = {\n vertical?: VerticalAlign;\n horizontal?: HorizontalAlign;\n};\n\n// ============================================================================\n// Background Options - Derive from constant\n// ============================================================================\n\nexport const BACKGROUND_TYPES = {\n solid: \"solid\",\n image: \"image\",\n} as const;\n\nexport type BackgroundType =\n (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];\nexport interface BackgroundValue {\n type: BackgroundType;\n color?: ColorOptions;\n resource?: ShareableItem;\n}\n\n// ============================================================================\n// Section Layout - Derive type from config keys (single source of truth)\n// ============================================================================\n\n/**\n * Section layout configuration - single source of truth for layout types.\n * SectionLayoutType is derived from these keys to prevent drift.\n */\nexport const SECTION_LAYOUT_CONFIG: {\n readonly \"single-column\": {\n readonly columns: 1;\n readonly widths: readonly [\"1fr\"];\n readonly gridClasses: \"\";\n };\n readonly \"2c-equal\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-2\";\n };\n readonly \"2c-left-wider\": {\n readonly columns: 2;\n readonly widths: readonly [\"2fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[2fr_1fr]\";\n };\n readonly \"2c-right-wider\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"2fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_2fr]\";\n };\n readonly \"2c-left-narrow\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"3fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_3fr]\";\n };\n readonly \"2c-right-narrow\": {\n readonly columns: 2;\n readonly widths: readonly [\"3fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[3fr_1fr]\";\n };\n readonly \"3c-equal\": {\n readonly columns: 3;\n readonly widths: readonly [\"1fr\", \"1fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-3\";\n };\n readonly \"3c-middle-wider\": {\n readonly columns: 3;\n readonly widths: readonly [\"1fr\", \"2fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\";\n };\n} = {\n \"single-column\": { columns: 1, widths: [\"1fr\"], gridClasses: \"\" },\n \"2c-equal\": {\n columns: 2,\n widths: [\"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-2\",\n },\n \"2c-left-wider\": {\n columns: 2,\n widths: [\"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[2fr_1fr]\",\n },\n \"2c-right-wider\": {\n columns: 2,\n widths: [\"1fr\", \"2fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr]\",\n },\n \"2c-left-narrow\": {\n columns: 2,\n widths: [\"1fr\", \"3fr\"],\n gridClasses: \"@md:grid-cols-[1fr_3fr]\",\n },\n \"2c-right-narrow\": {\n columns: 2,\n widths: [\"3fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[3fr_1fr]\",\n },\n \"3c-equal\": {\n columns: 3,\n widths: [\"1fr\", \"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-3\",\n },\n \"3c-middle-wider\": {\n columns: 3,\n widths: [\"1fr\", \"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\",\n },\n} as const satisfies Record<\n string,\n {\n readonly columns: number;\n readonly widths: readonly string[];\n readonly gridClasses: string;\n }\n>;\n\n/**\n * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;\n\n/** @deprecated Use SECTION_LAYOUT_CONFIG instead */\nexport const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG =\n SECTION_LAYOUT_CONFIG;\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;CAC/B,OAAO;CACP,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,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;CACR;;;;;AAkBD,MAAa,wBAyCT;CACF,iBAAiB;EAAE,SAAS;EAAG,QAAQ,CAAC,MAAM;EAAE,aAAa;EAAI;CACjE,YAAY;EACV,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,iBAAiB;EACf,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,mBAAmB;EACjB,SAAS;EACT,QAAQ,CAAC,OAAO,MAAM;EACtB,aAAa;EACd;CACD,YAAY;EACV,SAAS;EACT,QAAQ;GAAC;GAAO;GAAO;GAAM;EAC7B,aAAa;EACd;CACD,mBAAmB;EACjB,SAAS;EACT,QAAQ;GAAC;GAAO;GAAO;GAAM;EAC7B,aAAa;EACd;CACF;;AAgBD,MAAa,sBACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"types-Bjmd7Fdx.mjs","names":[],"sources":["../src/types/widget-schema.ts","../src/types/field-types.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type { DataSourceConfig } from \"../data-sources/types\";\n\n/**\n * Widget type names as a const object.\n * This serves as the single source of truth for widget discriminants.\n * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).\n */\nexport const WIDGET_TYPE_NAMES = {\n Alert: \"AlertWidget\",\n Calendar: \"CalendarWidget\",\n Carousel: \"CarouselWidget\",\n CatchUp: \"CatchUpWidget\",\n Chart: \"ChartWidget\",\n Container: \"ContainerWidget\",\n Embed: \"EmbedWidget\",\n Image: \"ImageWidget\",\n Layout: \"LayoutWidget\",\n List: \"ListWidget\",\n MySite: \"MySiteWidget\",\n Nested: \"NestedWidget\",\n QuickShare: \"QuickShareWidget\",\n RecentActivity: \"RecentActivityWidget\",\n Spacer: \"SpacerWidget\",\n Table: \"TableWidget\",\n Text: \"TextWidget\",\n ToDo: \"ToDoWidget\",\n Video: \"VideoWidget\",\n} as const;\n\n/**\n * Union of all known widget type names.\n * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).\n */\nexport type WidgetTypeName =\n (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];\n\n/**\n * Legacy alias for backwards compatibility.\n * Prefer using WidgetTypeName for new code when you need the union type.\n */\nexport type WidgetType = string;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type WidgetRegistry = Record<WidgetType, ComponentType<any>>;\n\n/**\n * Base widget schema with loose typing for runtime data.\n * Use TypedWidgetSchema<T> when you have a known registry for better type safety.\n */\nexport type WidgetSchema = {\n readonly type: WidgetType;\n readonly props: Readonly<Record<string, unknown>>;\n readonly id?: string; // Optional unique identifier for drag-and-drop\n /** Optional data source configuration for data-bound widgets */\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n};\n\n/**\n * Type-safe widget schema based on registry.\n * Uses discriminated unions - the `type` field serves as discriminant.\n * When narrowed (e.g., `if (widget.type === \"AlertWidget\")`),\n * TypeScript automatically knows the correct props type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = {\n [K in keyof T]: {\n readonly type: K;\n readonly props: Readonly<React.ComponentProps<T[K]>>;\n readonly id?: string;\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n };\n}[keyof T];\n\n/**\n * Widget path in the tree - array of indices.\n * Readonly tuple to prevent accidental mutation.\n */\nexport type WidgetPath = readonly number[];\n\n// ============================================================================\n// Type Guards and Assertion Functions\n// ============================================================================\n\n/**\n * Type predicate to check if a string is a known widget type name.\n * Use for runtime validation of widget types.\n *\n * @example\n * if (isWidgetTypeName(widget.type)) {\n * // TypeScript knows widget.type is WidgetTypeName\n * }\n */\nexport function isWidgetTypeName(type: string): type is WidgetTypeName {\n // Type assertion required in type guard: Object.values() returns string[], but we\n // need to check against WidgetTypeName values. The assertion is safe because we're\n // checking membership, and the return type predicate ensures correct narrowing.\n return Object.values(WIDGET_TYPE_NAMES).includes(type as WidgetTypeName);\n}\n\n/**\n * Type predicate to check if a widget has a specific type.\n * Enables type-safe widget narrowing without `as` assertions.\n *\n * @example\n * if (isWidgetType(widget, \"LayoutWidget\")) {\n * // TypeScript knows widget.type === \"LayoutWidget\"\n * // and widget.props is LayoutWidget props\n * }\n */\nexport function isWidgetType<T extends WidgetTypeName>(\n widget: WidgetSchema | null | undefined,\n typeName: T,\n): widget is WidgetSchema & { readonly type: T } {\n return widget != null && widget.type === typeName;\n}\n\n/**\n * Helper for exhaustive switch statements on widget types.\n * Use in the default case to ensure all widget types are handled.\n *\n * @example\n * switch (widget.type) {\n * case \"AlertWidget\": return handleAlert();\n * case \"TextWidget\": return handleText();\n * // ... all other widget types\n * default: return assertNever(widget.type, \"widget type\");\n * }\n */\nexport function assertNever(value: never, context?: string): never {\n const message = context\n ? `Unexpected ${context}: ${String(value)}`\n : `Unexpected value: ${String(value)}`;\n throw new Error(message);\n}\n\n/**\n * Assertion function that throws if value is undefined.\n * Narrows the type to exclude undefined.\n *\n * @example\n * const widget = screen[0];\n * assertDefined(widget, \"widget at index 0\");\n * // TypeScript knows widget is defined here\n */\nexport function assertDefined<T>(\n value: T | undefined | null,\n name?: string,\n): asserts value is T {\n if (value == null) {\n throw new Error(name ? `${name} is required` : \"Value is required\");\n }\n}\n","import type { ShareableItem } from \"./shareable-item\";\n\n// ============================================================================\n// Color Options - Derive type from constant for single source of truth\n// ============================================================================\n\n/**\n * Color options constant - single source of truth for color values.\n * Use COLOR_OPTIONS.primary instead of \"primary\" for type-safe comparisons.\n */\nexport const COLOR_OPTIONS = {\n background: \"background\",\n foreground: \"foreground\",\n primary: \"primary\",\n secondary: \"secondary\",\n accent: \"accent\",\n muted: \"muted\",\n destructive: \"destructive\",\n} as const;\n\n/**\n * Union type of all color options, derived from COLOR_OPTIONS constant.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];\n\n// ============================================================================\n// Size Options - Derive types from constants for single source of truth\n// ============================================================================\n\nexport const FONT_SIZE_OPTIONS = {\n \"2xl\": \"2xl\",\n xl: \"xl\",\n lg: \"lg\",\n md: \"md\",\n sm: \"sm\",\n xs: \"xs\",\n} as const;\n\nexport type FontSizeOptions =\n (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];\n\nexport const BORDER_RADIUS_OPTIONS = {\n none: \"none\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n full: \"full\",\n} as const;\n\nexport type BorderRadiusOptions =\n (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];\n\n/** Padding values - numeric, so we use a tuple for derivation */\nexport const PADDING_VALUES = [0, 2, 4, 6, 8, 10] as const;\nexport type PaddingOptions = (typeof PADDING_VALUES)[number];\n\nexport const BUTTON_SIZE_OPTIONS = {\n sm: \"sm\",\n default: \"default\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type ButtonSizeOptions =\n (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];\n\nexport const GAP_OPTIONS = {\n none: \"none\",\n xs: \"xs\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];\n\n// ============================================================================\n// Alignment Options - Derive from constants\n// ============================================================================\n\nexport const VERTICAL_ALIGN_OPTIONS = {\n top: \"top\",\n center: \"center\",\n bottom: \"bottom\",\n} as const;\n\nexport type VerticalAlign =\n (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];\n\nexport const HORIZONTAL_ALIGN_OPTIONS = {\n left: \"left\",\n center: \"center\",\n right: \"right\",\n} as const;\n\nexport type HorizontalAlign =\n (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];\n\nexport type AlignOptions = {\n vertical?: VerticalAlign;\n horizontal?: HorizontalAlign;\n};\n\n// ============================================================================\n// Background Options - Derive from constant\n// ============================================================================\n\nexport const BACKGROUND_TYPES = {\n solid: \"solid\",\n image: \"image\",\n} as const;\n\nexport type BackgroundType =\n (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];\nexport interface BackgroundValue {\n type: BackgroundType;\n color?: ColorOptions;\n resource?: ShareableItem;\n}\n\n// ============================================================================\n// Section Layout - Derive type from config keys (single source of truth)\n// ============================================================================\n\n/**\n * Section layout configuration - single source of truth for layout types.\n * SectionLayoutType is derived from these keys to prevent drift.\n */\nexport const SECTION_LAYOUT_CONFIG = {\n \"single-column\": { columns: 1, widths: [\"1fr\"], gridClasses: \"\" },\n \"2c-equal\": {\n columns: 2,\n widths: [\"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-2\",\n },\n \"2c-left-wider\": {\n columns: 2,\n widths: [\"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[2fr_1fr]\",\n },\n \"2c-right-wider\": {\n columns: 2,\n widths: [\"1fr\", \"2fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr]\",\n },\n \"2c-left-narrow\": {\n columns: 2,\n widths: [\"1fr\", \"3fr\"],\n gridClasses: \"@md:grid-cols-[1fr_3fr]\",\n },\n \"2c-right-narrow\": {\n columns: 2,\n widths: [\"3fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[3fr_1fr]\",\n },\n \"3c-equal\": {\n columns: 3,\n widths: [\"1fr\", \"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-3\",\n },\n \"3c-middle-wider\": {\n columns: 3,\n widths: [\"1fr\", \"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\",\n },\n} as const satisfies Record<\n string,\n {\n readonly columns: number;\n readonly widths: readonly string[];\n readonly gridClasses: string;\n }\n>;\n\n/**\n * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;\n\n/** @deprecated Use SECTION_LAYOUT_CONFIG instead */\nexport const sectionLayoutConfig = SECTION_LAYOUT_CONFIG;\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;CAC/B,OAAO;CACP,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACR;;;;;;;;;;AAqED,SAAgB,iBAAiB,MAAsC;AAIrE,QAAO,OAAO,OAAO,kBAAkB,CAAC,SAAS,KAAuB;;;;;;;;;;;;AAa1E,SAAgB,aACd,QACA,UAC+C;AAC/C,QAAO,UAAU,QAAQ,OAAO,SAAS;;;;;;;;;;;;;;AAe3C,SAAgB,YAAY,OAAc,SAAyB;CACjE,MAAM,UAAU,UACZ,cAAc,QAAQ,IAAI,OAAO,MAAM,KACvC,qBAAqB,OAAO,MAAM;AACtC,OAAM,IAAI,MAAM,QAAQ;;;;;;;;;;;AAY1B,SAAgB,cACd,OACA,MACoB;AACpB,KAAI,SAAS,KACX,OAAM,IAAI,MAAM,OAAO,GAAG,KAAK,gBAAgB,oBAAoB;;;;;;;;AChJvE,MAAa,gBAAgB;CAC3B,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,WAAW;CACX,QAAQ;CACR,OAAO;CACP,aAAa;CACd;AAYD,MAAa,oBAAoB;CAC/B,OAAO;CACP,IAAI;CACJ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["../src/types/widget-schema.ts","../src/types/field-types.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type { DataSourceConfig } from \"../data-sources/types\";\n\n/**\n * Widget type names as a const object.\n * This serves as the single source of truth for widget discriminants.\n * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).\n */\nexport const WIDGET_TYPE_NAMES = {\n Alert: \"AlertWidget\",\n Calendar: \"CalendarWidget\",\n Carousel: \"CarouselWidget\",\n CatchUp: \"CatchUpWidget\",\n Chart: \"ChartWidget\",\n Container: \"ContainerWidget\",\n Embed: \"EmbedWidget\",\n Image: \"ImageWidget\",\n Layout: \"LayoutWidget\",\n List: \"ListWidget\",\n MySite: \"MySiteWidget\",\n Nested: \"NestedWidget\",\n QuickShare: \"QuickShareWidget\",\n RecentActivity: \"RecentActivityWidget\",\n Spacer: \"SpacerWidget\",\n Table: \"TableWidget\",\n Text: \"TextWidget\",\n ToDo: \"ToDoWidget\",\n Video: \"VideoWidget\",\n} as const;\n\n/**\n * Union of all known widget type names.\n * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).\n */\nexport type WidgetTypeName =\n (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];\n\n/**\n * Legacy alias for backwards compatibility.\n * Prefer using WidgetTypeName for new code when you need the union type.\n */\nexport type WidgetType = string;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type WidgetRegistry = Record<WidgetType, ComponentType<any>>;\n\n/**\n * Base widget schema with loose typing for runtime data.\n * Use TypedWidgetSchema<T> when you have a known registry for better type safety.\n */\nexport type WidgetSchema = {\n readonly type: WidgetType;\n readonly props: Readonly<Record<string, unknown>>;\n readonly id?: string; // Optional unique identifier for drag-and-drop\n /** Optional data source configuration for data-bound widgets */\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n};\n\n/**\n * Type-safe widget schema based on registry.\n * Uses discriminated unions - the `type` field serves as discriminant.\n * When narrowed (e.g., `if (widget.type === \"AlertWidget\")`),\n * TypeScript automatically knows the correct props type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = {\n [K in keyof T]: {\n readonly type: K;\n readonly props: Readonly<React.ComponentProps<T[K]>>;\n readonly id?: string;\n readonly dataSource?: DataSourceConfig | undefined;\n /** Column index for masonry layouts (0-indexed) */\n readonly columnIndex?: number;\n };\n}[keyof T];\n\n/**\n * Widget path in the tree - array of indices.\n * Readonly tuple to prevent accidental mutation.\n */\nexport type WidgetPath = readonly number[];\n\n// ============================================================================\n// Type Guards and Assertion Functions\n// ============================================================================\n\n/**\n * Type predicate to check if a string is a known widget type name.\n * Use for runtime validation of widget types.\n *\n * @example\n * if (isWidgetTypeName(widget.type)) {\n * // TypeScript knows widget.type is WidgetTypeName\n * }\n */\nexport function isWidgetTypeName(type: string): type is WidgetTypeName {\n // Type assertion required in type guard: Object.values() returns string[], but we\n // need to check against WidgetTypeName values. The assertion is safe because we're\n // checking membership, and the return type predicate ensures correct narrowing.\n return Object.values(WIDGET_TYPE_NAMES).includes(type as WidgetTypeName);\n}\n\n/**\n * Type predicate to check if a widget has a specific type.\n * Enables type-safe widget narrowing without `as` assertions.\n *\n * @example\n * if (isWidgetType(widget, \"LayoutWidget\")) {\n * // TypeScript knows widget.type === \"LayoutWidget\"\n * // and widget.props is LayoutWidget props\n * }\n */\nexport function isWidgetType<T extends WidgetTypeName>(\n widget: WidgetSchema | null | undefined,\n typeName: T,\n): widget is WidgetSchema & { readonly type: T } {\n return widget != null && widget.type === typeName;\n}\n\n/**\n * Helper for exhaustive switch statements on widget types.\n * Use in the default case to ensure all widget types are handled.\n *\n * @example\n * switch (widget.type) {\n * case \"AlertWidget\": return handleAlert();\n * case \"TextWidget\": return handleText();\n * // ... all other widget types\n * default: return assertNever(widget.type, \"widget type\");\n * }\n */\nexport function assertNever(value: never, context?: string): never {\n const message = context\n ? `Unexpected ${context}: ${String(value)}`\n : `Unexpected value: ${String(value)}`;\n throw new Error(message);\n}\n\n/**\n * Assertion function that throws if value is undefined.\n * Narrows the type to exclude undefined.\n *\n * @example\n * const widget = screen[0];\n * assertDefined(widget, \"widget at index 0\");\n * // TypeScript knows widget is defined here\n */\nexport function assertDefined<T>(\n value: T | undefined | null,\n name?: string,\n): asserts value is T {\n if (value == null) {\n throw new Error(name ? `${name} is required` : \"Value is required\");\n }\n}\n","import type { ShareableItem } from \"./shareable-item\";\n\n// ============================================================================\n// Color Options - Derive type from constant for single source of truth\n// ============================================================================\n\n/**\n * Color options constant - single source of truth for color values.\n * Use COLOR_OPTIONS.primary instead of \"primary\" for type-safe comparisons.\n */\nexport const COLOR_OPTIONS = {\n background: \"background\",\n foreground: \"foreground\",\n primary: \"primary\",\n secondary: \"secondary\",\n accent: \"accent\",\n muted: \"muted\",\n destructive: \"destructive\",\n} as const;\n\n/**\n * Union type of all color options, derived from COLOR_OPTIONS constant.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type ColorOptions = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];\n\n// ============================================================================\n// Size Options - Derive types from constants for single source of truth\n// ============================================================================\n\nexport const FONT_SIZE_OPTIONS = {\n \"2xl\": \"2xl\",\n xl: \"xl\",\n lg: \"lg\",\n md: \"md\",\n sm: \"sm\",\n xs: \"xs\",\n} as const;\n\nexport type FontSizeOptions =\n (typeof FONT_SIZE_OPTIONS)[keyof typeof FONT_SIZE_OPTIONS];\n\nexport const BORDER_RADIUS_OPTIONS = {\n none: \"none\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n full: \"full\",\n} as const;\n\nexport type BorderRadiusOptions =\n (typeof BORDER_RADIUS_OPTIONS)[keyof typeof BORDER_RADIUS_OPTIONS];\n\n/** Padding values - numeric, so we use a tuple for derivation */\nexport const PADDING_VALUES = [0, 2, 4, 6, 8, 10] as const;\nexport type PaddingOptions = (typeof PADDING_VALUES)[number];\n\nexport const BUTTON_SIZE_OPTIONS = {\n sm: \"sm\",\n default: \"default\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type ButtonSizeOptions =\n (typeof BUTTON_SIZE_OPTIONS)[keyof typeof BUTTON_SIZE_OPTIONS];\n\nexport const GAP_OPTIONS = {\n none: \"none\",\n xs: \"xs\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n} as const;\n\nexport type GapOptions = (typeof GAP_OPTIONS)[keyof typeof GAP_OPTIONS];\n\n// ============================================================================\n// Alignment Options - Derive from constants\n// ============================================================================\n\nexport const VERTICAL_ALIGN_OPTIONS = {\n top: \"top\",\n center: \"center\",\n bottom: \"bottom\",\n} as const;\n\nexport type VerticalAlign =\n (typeof VERTICAL_ALIGN_OPTIONS)[keyof typeof VERTICAL_ALIGN_OPTIONS];\n\nexport const HORIZONTAL_ALIGN_OPTIONS = {\n left: \"left\",\n center: \"center\",\n right: \"right\",\n} as const;\n\nexport type HorizontalAlign =\n (typeof HORIZONTAL_ALIGN_OPTIONS)[keyof typeof HORIZONTAL_ALIGN_OPTIONS];\n\nexport type AlignOptions = {\n vertical?: VerticalAlign;\n horizontal?: HorizontalAlign;\n};\n\n// ============================================================================\n// Background Options - Derive from constant\n// ============================================================================\n\nexport const BACKGROUND_TYPES = {\n solid: \"solid\",\n image: \"image\",\n} as const;\n\nexport type BackgroundType =\n (typeof BACKGROUND_TYPES)[keyof typeof BACKGROUND_TYPES];\nexport interface BackgroundValue {\n type: BackgroundType;\n color?: ColorOptions;\n resource?: ShareableItem;\n}\n\n// ============================================================================\n// Section Layout - Derive type from config keys (single source of truth)\n// ============================================================================\n\n/**\n * Section layout configuration - single source of truth for layout types.\n * SectionLayoutType is derived from these keys to prevent drift.\n */\nexport const SECTION_LAYOUT_CONFIG: {\n readonly \"single-column\": {\n readonly columns: 1;\n readonly widths: readonly [\"1fr\"];\n readonly gridClasses: \"\";\n };\n readonly \"2c-equal\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-2\";\n };\n readonly \"2c-left-wider\": {\n readonly columns: 2;\n readonly widths: readonly [\"2fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[2fr_1fr]\";\n };\n readonly \"2c-right-wider\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"2fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_2fr]\";\n };\n readonly \"2c-left-narrow\": {\n readonly columns: 2;\n readonly widths: readonly [\"1fr\", \"3fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_3fr]\";\n };\n readonly \"2c-right-narrow\": {\n readonly columns: 2;\n readonly widths: readonly [\"3fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[3fr_1fr]\";\n };\n readonly \"3c-equal\": {\n readonly columns: 3;\n readonly widths: readonly [\"1fr\", \"1fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-3\";\n };\n readonly \"3c-middle-wider\": {\n readonly columns: 3;\n readonly widths: readonly [\"1fr\", \"2fr\", \"1fr\"];\n readonly gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\";\n };\n} = {\n \"single-column\": { columns: 1, widths: [\"1fr\"], gridClasses: \"\" },\n \"2c-equal\": {\n columns: 2,\n widths: [\"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-2\",\n },\n \"2c-left-wider\": {\n columns: 2,\n widths: [\"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[2fr_1fr]\",\n },\n \"2c-right-wider\": {\n columns: 2,\n widths: [\"1fr\", \"2fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr]\",\n },\n \"2c-left-narrow\": {\n columns: 2,\n widths: [\"1fr\", \"3fr\"],\n gridClasses: \"@md:grid-cols-[1fr_3fr]\",\n },\n \"2c-right-narrow\": {\n columns: 2,\n widths: [\"3fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[3fr_1fr]\",\n },\n \"3c-equal\": {\n columns: 3,\n widths: [\"1fr\", \"1fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-3\",\n },\n \"3c-middle-wider\": {\n columns: 3,\n widths: [\"1fr\", \"2fr\", \"1fr\"],\n gridClasses: \"@md:grid-cols-[1fr_2fr_1fr]\",\n },\n} as const satisfies Record<\n string,\n {\n readonly columns: number;\n readonly widths: readonly string[];\n readonly gridClasses: string;\n }\n>;\n\n/**\n * Union type of all section layout types, derived from SECTION_LAYOUT_CONFIG keys.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type SectionLayoutType = keyof typeof SECTION_LAYOUT_CONFIG;\n\n/** @deprecated Use SECTION_LAYOUT_CONFIG instead */\nexport const sectionLayoutConfig: typeof SECTION_LAYOUT_CONFIG =\n SECTION_LAYOUT_CONFIG;\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;CAC/B,OAAO;CACP,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACR;;;;;;;;;;AAqED,SAAgB,iBAAiB,MAAsC;AAIrE,QAAO,OAAO,OAAO,kBAAkB,CAAC,SAAS,KAAuB;;;;;;;;;;;;AAa1E,SAAgB,aACd,QACA,UAC+C;AAC/C,QAAO,UAAU,QAAQ,OAAO,SAAS;;;;;;;;;;;;;;AAe3C,SAAgB,YAAY,OAAc,SAAyB;CACjE,MAAM,UAAU,UACZ,cAAc,QAAQ,IAAI,OAAO,MAAM,KACvC,qBAAqB,OAAO,MAAM;AACtC,OAAM,IAAI,MAAM,QAAQ;;;;;;;;;;;AAY1B,SAAgB,cACd,OACA,MACoB;AACpB,KAAI,SAAS,KACX,OAAM,IAAI,MAAM,OAAO,GAAG,KAAK,gBAAgB,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AC7B,aAAa;EACd;CACD,mBAAmB;EACjB,SAAS;EACT,QAAQ;GAAC;GAAO;GAAO;GAAM;EAC7B,aAAa;EACd;CACF;;AAgBD,MAAa,sBACX"}
@@ -27,26 +27,26 @@ interface ApiDataSource {
27
27
  /** Request body for POST/PUT (will be JSON.stringify'd) */
28
28
  body?: unknown;
29
29
  /**
30
- * Path to extract from response using dot notation
31
- * e.g., "data.items" extracts response.data.items
32
- */
30
+ * Path to extract from response using dot notation
31
+ * e.g., "data.items" extracts response.data.items
32
+ */
33
33
  resultPath?: string;
34
34
  /**
35
- * Which widget props this source populates
36
- * e.g., ['data'] means the fetched result goes to props.data
37
- */
35
+ * Which widget props this source populates
36
+ * e.g., ['data'] means the fetched result goes to props.data
37
+ */
38
38
  targetProps: string[];
39
39
  /**
40
- * Name of a registered transform function to process the data
41
- * Transform is applied after resultPath extraction
42
- */
40
+ * Name of a registered transform function to process the data
41
+ * Transform is applied after resultPath extraction
42
+ */
43
43
  transform?: string;
44
44
  /** Per-source variables for endpoint template interpolation (e.g., { limit: "10" }) */
45
45
  variables?: Record<string, string>;
46
46
  /**
47
- * Auto-refresh interval in milliseconds
48
- * 0 or undefined = no auto-refresh
49
- */
47
+ * Auto-refresh interval in milliseconds
48
+ * 0 or undefined = no auto-refresh
49
+ */
50
50
  refreshInterval?: number;
51
51
  }
52
52
  interface CustomDataSource {
@@ -54,19 +54,19 @@ interface CustomDataSource {
54
54
  /** Array of selected items to fetch */
55
55
  selectedItems: SelectedItem[];
56
56
  /**
57
- * Which widget props this source populates
58
- * e.g., ['slides'] means the fetched results go to props.slides
59
- */
57
+ * Which widget props this source populates
58
+ * e.g., ['slides'] means the fetched results go to props.slides
59
+ */
60
60
  targetProps: string[];
61
61
  /**
62
- * Name of a registered transform function to process the data
63
- * Transform is applied after all items are fetched
64
- */
62
+ * Name of a registered transform function to process the data
63
+ * Transform is applied after all items are fetched
64
+ */
65
65
  transform?: string;
66
66
  /**
67
- * Auto-refresh interval in milliseconds
68
- * 0 or undefined = no auto-refresh
69
- */
67
+ * Auto-refresh interval in milliseconds
68
+ * 0 or undefined = no auto-refresh
69
+ */
70
70
  refreshInterval?: number;
71
71
  }
72
72
  interface StaticDataSource {
@@ -81,17 +81,17 @@ interface StaticDataSource {
81
81
  imageUrl?: string;
82
82
  };
83
83
  /**
84
- * Which widget props this source populates
85
- */
84
+ * Which widget props this source populates
85
+ */
86
86
  targetProps: string[];
87
87
  /**
88
- * Name of a registered transform function to process the data
89
- */
88
+ * Name of a registered transform function to process the data
89
+ */
90
90
  transform?: string;
91
91
  /**
92
- * Auto-refresh interval in milliseconds
93
- * 0 or undefined = no auto-refresh
94
- */
92
+ * Auto-refresh interval in milliseconds
93
+ * 0 or undefined = no auto-refresh
94
+ */
95
95
  refreshInterval?: number;
96
96
  }
97
97
  type DataSource = ApiDataSource | CustomDataSource | StaticDataSource;
@@ -152,4 +152,4 @@ interface WidgetDataResult<T = unknown> {
152
152
  }
153
153
  //#endregion
154
154
  export { DataSourceConfig as a, DataSourceType as c, ShareableType as d, StaticDataSource as f, WidgetDataResult as h, DataSource as i, DataTransformer as l, StaticSourceType as m, CustomDataSource as n, DataSourceContext as o, StaticItem as p, DataFetcher as r, DataSourceRegistry as s, ApiDataSource as t, SelectedItem as u };
155
- //# sourceMappingURL=types-BIXtQlHB.d.cts.map
155
+ //# sourceMappingURL=types-C5Zs5V3E.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-C5Zs5V3E.d.mts","names":[],"sources":["../src/data-sources/types.ts"],"mappings":";KACY,cAAA;AAAA,KAGA,gBAAA;AAAA,KAGA,aAAA;AAAA,UAQK,YAAA;EAdL;EAgBV,EAAA;EAbF;EAeE,aAAA,EAAe,aAAA;;EAEf,UAAA;IACE,KAAA;IACA,QAAA;IACA,IAAA;EAAA;EAjBQ;EAoBV,YAAA,GAAe,MAAA;AAAA;AAAA,UAGA,aAAA;EACf,IAAA;EAJe;EAMf,QAAA;;EAEA,MAAA;;EAEA,OA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KAAA;EAtBJ;EAwBH,OAAA;AAAA"}
@@ -23,9 +23,9 @@ interface ThemeDefinition {
23
23
  /** Light mode — always fully specified */
24
24
  light: Record<SemanticColorName, ThemeColorInput>;
25
25
  /**
26
- * Dark mode — only user-overridden colors.
27
- * Missing keys are auto-derived from `light` at resolve time.
28
- */
26
+ * Dark mode — only user-overridden colors.
27
+ * Missing keys are auto-derived from `light` at resolve time.
28
+ */
29
29
  dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>>;
30
30
  fontSizes: Record<FontSizeKey, string>;
31
31
  fontFamilies: Record<FontFamilyKey, string>;
@@ -82,4 +82,4 @@ interface ThemePayload {
82
82
  }
83
83
  //#endregion
84
84
  export { ThemeDefinition as _, OklchPlain as a, ResolvedColorSet as c, SEMANTIC_COLOR_NAMES as d, SHADE_STEPS as f, ThemeColorPlain as g, ThemeColorInput as h, FontSizeKey as i, ResolvedSemanticColor as l, ShadeStep as m, FONT_SIZE_KEYS as n, RADIUS_KEYS as o, SemanticColorName as p, FontFamilyKey as r, RadiusKey as s, FONT_FAMILY_KEYS as t, ResolvedTheme as u, ThemePayload as v };
85
- //# sourceMappingURL=types-Ctu-Zio6.d.cts.map
85
+ //# sourceMappingURL=types-CeCPKvOv.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Ctu-Zio6.d.cts","names":[],"sources":["../src/theme/types.ts"],"mappings":";;;cAGa,oBAAA;AAAA,KASD,iBAAA,WAA4B,oBAAA;AAAA,cAE3B,WAAA;AAAA,KAGD,SAAA,WAAoB,WAAA;AAAA,cAEnB,cAAA;AAAA,KAQD,WAAA,WAAsB,cAAA;AAAA,cAErB,gBAAA;AAAA,KACD,aAAA,WAAwB,gBAAA;AAAA,cAEvB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;;UAGf,eAAA;EACf,IAAA,EAAM,KAAA;EACN,UAAA,EAAY,KAAA;AAAA;;UAIG,eAAA;EACf,EAAA;EACA,IAAA;;EAEA,KAAA,EAAO,MA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,UAAA;EAAA;EAE9D,SAAA,EAAW,MAAA,CAAO,WAAA;EAClB,YAAA,EAAc,MAAA,CAAO,aAAA;EACrB,OAAA;EACA,KAAA,EAAO,MAAA,CAAO,SAAA;EACd,mBAAA;AAAA"}
@@ -27,26 +27,26 @@ interface ApiDataSource {
27
27
  /** Request body for POST/PUT (will be JSON.stringify'd) */
28
28
  body?: unknown;
29
29
  /**
30
- * Path to extract from response using dot notation
31
- * e.g., "data.items" extracts response.data.items
32
- */
30
+ * Path to extract from response using dot notation
31
+ * e.g., "data.items" extracts response.data.items
32
+ */
33
33
  resultPath?: string;
34
34
  /**
35
- * Which widget props this source populates
36
- * e.g., ['data'] means the fetched result goes to props.data
37
- */
35
+ * Which widget props this source populates
36
+ * e.g., ['data'] means the fetched result goes to props.data
37
+ */
38
38
  targetProps: string[];
39
39
  /**
40
- * Name of a registered transform function to process the data
41
- * Transform is applied after resultPath extraction
42
- */
40
+ * Name of a registered transform function to process the data
41
+ * Transform is applied after resultPath extraction
42
+ */
43
43
  transform?: string;
44
44
  /** Per-source variables for endpoint template interpolation (e.g., { limit: "10" }) */
45
45
  variables?: Record<string, string>;
46
46
  /**
47
- * Auto-refresh interval in milliseconds
48
- * 0 or undefined = no auto-refresh
49
- */
47
+ * Auto-refresh interval in milliseconds
48
+ * 0 or undefined = no auto-refresh
49
+ */
50
50
  refreshInterval?: number;
51
51
  }
52
52
  interface CustomDataSource {
@@ -54,19 +54,19 @@ interface CustomDataSource {
54
54
  /** Array of selected items to fetch */
55
55
  selectedItems: SelectedItem[];
56
56
  /**
57
- * Which widget props this source populates
58
- * e.g., ['slides'] means the fetched results go to props.slides
59
- */
57
+ * Which widget props this source populates
58
+ * e.g., ['slides'] means the fetched results go to props.slides
59
+ */
60
60
  targetProps: string[];
61
61
  /**
62
- * Name of a registered transform function to process the data
63
- * Transform is applied after all items are fetched
64
- */
62
+ * Name of a registered transform function to process the data
63
+ * Transform is applied after all items are fetched
64
+ */
65
65
  transform?: string;
66
66
  /**
67
- * Auto-refresh interval in milliseconds
68
- * 0 or undefined = no auto-refresh
69
- */
67
+ * Auto-refresh interval in milliseconds
68
+ * 0 or undefined = no auto-refresh
69
+ */
70
70
  refreshInterval?: number;
71
71
  }
72
72
  interface StaticDataSource {
@@ -81,17 +81,17 @@ interface StaticDataSource {
81
81
  imageUrl?: string;
82
82
  };
83
83
  /**
84
- * Which widget props this source populates
85
- */
84
+ * Which widget props this source populates
85
+ */
86
86
  targetProps: string[];
87
87
  /**
88
- * Name of a registered transform function to process the data
89
- */
88
+ * Name of a registered transform function to process the data
89
+ */
90
90
  transform?: string;
91
91
  /**
92
- * Auto-refresh interval in milliseconds
93
- * 0 or undefined = no auto-refresh
94
- */
92
+ * Auto-refresh interval in milliseconds
93
+ * 0 or undefined = no auto-refresh
94
+ */
95
95
  refreshInterval?: number;
96
96
  }
97
97
  type DataSource = ApiDataSource | CustomDataSource | StaticDataSource;
@@ -152,4 +152,4 @@ interface WidgetDataResult<T = unknown> {
152
152
  }
153
153
  //#endregion
154
154
  export { DataSourceConfig as a, DataSourceType as c, ShareableType as d, StaticDataSource as f, WidgetDataResult as h, DataSource as i, DataTransformer as l, StaticSourceType as m, CustomDataSource as n, DataSourceContext as o, StaticItem as p, DataFetcher as r, DataSourceRegistry as s, ApiDataSource as t, SelectedItem as u };
155
- //# sourceMappingURL=types-C5OFJy-O.d.mts.map
155
+ //# sourceMappingURL=types-DrzvahW8.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DrzvahW8.d.cts","names":[],"sources":["../src/data-sources/types.ts"],"mappings":";KACY,cAAA;AAAA,KAGA,gBAAA;AAAA,KAGA,aAAA;AAAA,UAQK,YAAA;EAdL;EAgBV,EAAA;EAbF;EAeE,aAAA,EAAe,aAAA;;EAEf,UAAA;IACE,KAAA;IACA,QAAA;IACA,IAAA;EAAA;EAjBQ;EAoBV,YAAA,GAAe,MAAA;AAAA;AAAA,UAGA,aAAA;EACf,IAAA;EAJe;EAMf,QAA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SAAA;;EAEA,KAAA,EAAO,KAAA;EAtBJ;EAwBH,OAAA;AAAA"}
@@ -1,12 +1,12 @@
1
- import { a as DataSourceConfig } from "./types-BIXtQlHB.cjs";
1
+ import { a as DataSourceConfig } from "./types-C5Zs5V3E.mjs";
2
2
  import { ComponentType } from "react";
3
3
 
4
4
  //#region src/types/widget-schema.d.ts
5
5
  /**
6
- * Widget type names as a const object.
7
- * This serves as the single source of truth for widget discriminants.
8
- * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).
9
- */
6
+ * Widget type names as a const object.
7
+ * This serves as the single source of truth for widget discriminants.
8
+ * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).
9
+ */
10
10
  declare const WIDGET_TYPE_NAMES: {
11
11
  readonly Alert: "AlertWidget";
12
12
  readonly Calendar: "CalendarWidget";
@@ -29,20 +29,20 @@ declare const WIDGET_TYPE_NAMES: {
29
29
  readonly Video: "VideoWidget";
30
30
  };
31
31
  /**
32
- * Union of all known widget type names.
33
- * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).
34
- */
32
+ * Union of all known widget type names.
33
+ * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).
34
+ */
35
35
  type WidgetTypeName = (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];
36
36
  /**
37
- * Legacy alias for backwards compatibility.
38
- * Prefer using WidgetTypeName for new code when you need the union type.
39
- */
37
+ * Legacy alias for backwards compatibility.
38
+ * Prefer using WidgetTypeName for new code when you need the union type.
39
+ */
40
40
  type WidgetType = string;
41
41
  type WidgetRegistry = Record<WidgetType, ComponentType<any>>;
42
42
  /**
43
- * Base widget schema with loose typing for runtime data.
44
- * Use TypedWidgetSchema<T> when you have a known registry for better type safety.
45
- */
43
+ * Base widget schema with loose typing for runtime data.
44
+ * Use TypedWidgetSchema<T> when you have a known registry for better type safety.
45
+ */
46
46
  type WidgetSchema = {
47
47
  readonly type: WidgetType;
48
48
  readonly props: Readonly<Record<string, unknown>>;
@@ -51,11 +51,11 @@ type WidgetSchema = {
51
51
  readonly columnIndex?: number;
52
52
  };
53
53
  /**
54
- * Type-safe widget schema based on registry.
55
- * Uses discriminated unions - the `type` field serves as discriminant.
56
- * When narrowed (e.g., `if (widget.type === "AlertWidget")`),
57
- * TypeScript automatically knows the correct props type.
58
- */
54
+ * Type-safe widget schema based on registry.
55
+ * Uses discriminated unions - the `type` field serves as discriminant.
56
+ * When narrowed (e.g., `if (widget.type === "AlertWidget")`),
57
+ * TypeScript automatically knows the correct props type.
58
+ */
59
59
  type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = { [K in keyof T]: {
60
60
  readonly type: K;
61
61
  readonly props: Readonly<React.ComponentProps<T[K]>>;
@@ -64,56 +64,56 @@ type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = { [K in k
64
64
  readonly columnIndex?: number;
65
65
  } }[keyof T];
66
66
  /**
67
- * Widget path in the tree - array of indices.
68
- * Readonly tuple to prevent accidental mutation.
69
- */
67
+ * Widget path in the tree - array of indices.
68
+ * Readonly tuple to prevent accidental mutation.
69
+ */
70
70
  type WidgetPath = readonly number[];
71
71
  /**
72
- * Type predicate to check if a string is a known widget type name.
73
- * Use for runtime validation of widget types.
74
- *
75
- * @example
76
- * if (isWidgetTypeName(widget.type)) {
77
- * // TypeScript knows widget.type is WidgetTypeName
78
- * }
79
- */
72
+ * Type predicate to check if a string is a known widget type name.
73
+ * Use for runtime validation of widget types.
74
+ *
75
+ * @example
76
+ * if (isWidgetTypeName(widget.type)) {
77
+ * // TypeScript knows widget.type is WidgetTypeName
78
+ * }
79
+ */
80
80
  declare function isWidgetTypeName(type: string): type is WidgetTypeName;
81
81
  /**
82
- * Type predicate to check if a widget has a specific type.
83
- * Enables type-safe widget narrowing without `as` assertions.
84
- *
85
- * @example
86
- * if (isWidgetType(widget, "LayoutWidget")) {
87
- * // TypeScript knows widget.type === "LayoutWidget"
88
- * // and widget.props is LayoutWidget props
89
- * }
90
- */
82
+ * Type predicate to check if a widget has a specific type.
83
+ * Enables type-safe widget narrowing without `as` assertions.
84
+ *
85
+ * @example
86
+ * if (isWidgetType(widget, "LayoutWidget")) {
87
+ * // TypeScript knows widget.type === "LayoutWidget"
88
+ * // and widget.props is LayoutWidget props
89
+ * }
90
+ */
91
91
  declare function isWidgetType<T extends WidgetTypeName>(widget: WidgetSchema | null | undefined, typeName: T): widget is WidgetSchema & {
92
92
  readonly type: T;
93
93
  };
94
94
  /**
95
- * Helper for exhaustive switch statements on widget types.
96
- * Use in the default case to ensure all widget types are handled.
97
- *
98
- * @example
99
- * switch (widget.type) {
100
- * case "AlertWidget": return handleAlert();
101
- * case "TextWidget": return handleText();
102
- * // ... all other widget types
103
- * default: return assertNever(widget.type, "widget type");
104
- * }
105
- */
95
+ * Helper for exhaustive switch statements on widget types.
96
+ * Use in the default case to ensure all widget types are handled.
97
+ *
98
+ * @example
99
+ * switch (widget.type) {
100
+ * case "AlertWidget": return handleAlert();
101
+ * case "TextWidget": return handleText();
102
+ * // ... all other widget types
103
+ * default: return assertNever(widget.type, "widget type");
104
+ * }
105
+ */
106
106
  declare function assertNever(value: never, context?: string): never;
107
107
  /**
108
- * Assertion function that throws if value is undefined.
109
- * Narrows the type to exclude undefined.
110
- *
111
- * @example
112
- * const widget = screen[0];
113
- * assertDefined(widget, "widget at index 0");
114
- * // TypeScript knows widget is defined here
115
- */
108
+ * Assertion function that throws if value is undefined.
109
+ * Narrows the type to exclude undefined.
110
+ *
111
+ * @example
112
+ * const widget = screen[0];
113
+ * assertDefined(widget, "widget at index 0");
114
+ * // TypeScript knows widget is defined here
115
+ */
116
116
  declare function assertDefined<T>(value: T | undefined | null, name?: string): asserts value is T;
117
117
  //#endregion
118
118
  export { WidgetSchema as a, assertDefined as c, isWidgetTypeName as d, WidgetRegistry as i, assertNever as l, WIDGET_TYPE_NAMES as n, WidgetType as o, WidgetPath as r, WidgetTypeName as s, TypedWidgetSchema as t, isWidgetType as u };
119
- //# sourceMappingURL=widget-schema--PY1uMWx.d.cts.map
119
+ //# sourceMappingURL=widget-schema-BKZgsNG7.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-schema-BKZgsNG7.d.mts","names":[],"sources":["../src/types/widget-schema.ts"],"mappings":";;;;;;AAQA;;;cAAa,iBAAA;EAAA,SACX,KAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;EAAA,SACA,MAAA;EAAA,SACA,UAAA;EAAA,SACA,cAAA;EAAA,SACA,MAAA;EAAA,SACA,KAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;AAAA;;AAOF;;;KAAY,cAAA,WACF,iBAAA,eAAgC,iBAAA;;AAM1C;;;KAAY,UAAA;AAAA,KAGA,cAAA,GAAiB,MAAA,CAAO,UAAA,EAAY,aAAA;AAAhD;;;;AAAA,KAMY,YAAA;EAAA,SACD,IAAA,EAAM,UAAA;EAAA,SACN,KAAA,EAAO,QAAA,CAAS,MAAA;EAAA,SAChB,EAAA;WAEA,UAAA,GAAa,gBAAA;WAEb,WAAA;AAAA;AAPX;;;;;;AAAA,KAiBY,iBAAA,WAA4B,MAAA,SAAe,aAAA,wBACzC,CAAA;EAAA,SACD,IAAA,EAAM,CAAA;EAAA,SACN,KAAA,EAAO,QAAA,CAAS,KAAA,CAAM,cAAA,CAAe,CAAA,CAAE,CAAA;EAAA,SACvC,EAAA;EAAA,SACA,UAAA,GAAa,gBAAA;WAEb,WAAA;AAAA,UAEL,CAAA;;;;;KAMI,UAAA;;AAfZ;;;;;;;;iBA8BgB,gBAAA,CAAiB,IAAA,WAAe,IAAA,IAAQ,cAAA;;;;;;;;;;;iBAiBxC,YAAA,WAAuB,cAAA,CAAA,CACrC,MAAA,EAA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