@fluid-app/portal-core 0.1.16

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 (195) hide show
  1. package/dist/chunk-CKQMccvm.cjs +28 -0
  2. package/dist/data-sources/DataAwareWidget.cjs +50 -0
  3. package/dist/data-sources/DataAwareWidget.cjs.map +1 -0
  4. package/dist/data-sources/DataAwareWidget.d.cts +24 -0
  5. package/dist/data-sources/DataAwareWidget.d.cts.map +1 -0
  6. package/dist/data-sources/DataAwareWidget.d.mts +24 -0
  7. package/dist/data-sources/DataAwareWidget.d.mts.map +1 -0
  8. package/dist/data-sources/DataAwareWidget.mjs +48 -0
  9. package/dist/data-sources/DataAwareWidget.mjs.map +1 -0
  10. package/dist/data-sources/ErrorState.cjs +20 -0
  11. package/dist/data-sources/ErrorState.cjs.map +1 -0
  12. package/dist/data-sources/ErrorState.d.cts +7 -0
  13. package/dist/data-sources/ErrorState.d.cts.map +1 -0
  14. package/dist/data-sources/ErrorState.d.mts +7 -0
  15. package/dist/data-sources/ErrorState.d.mts.map +1 -0
  16. package/dist/data-sources/ErrorState.mjs +18 -0
  17. package/dist/data-sources/ErrorState.mjs.map +1 -0
  18. package/dist/data-sources/context.cjs +24 -0
  19. package/dist/data-sources/context.cjs.map +1 -0
  20. package/dist/data-sources/context.d.cts +21 -0
  21. package/dist/data-sources/context.d.cts.map +1 -0
  22. package/dist/data-sources/context.d.mts +21 -0
  23. package/dist/data-sources/context.d.mts.map +1 -0
  24. package/dist/data-sources/context.mjs +21 -0
  25. package/dist/data-sources/context.mjs.map +1 -0
  26. package/dist/data-sources/fetchers/api.cjs +65 -0
  27. package/dist/data-sources/fetchers/api.cjs.map +1 -0
  28. package/dist/data-sources/fetchers/api.d.cts +10 -0
  29. package/dist/data-sources/fetchers/api.d.cts.map +1 -0
  30. package/dist/data-sources/fetchers/api.d.mts +10 -0
  31. package/dist/data-sources/fetchers/api.d.mts.map +1 -0
  32. package/dist/data-sources/fetchers/api.mjs +64 -0
  33. package/dist/data-sources/fetchers/api.mjs.map +1 -0
  34. package/dist/data-sources/fetchers/custom.cjs +108 -0
  35. package/dist/data-sources/fetchers/custom.cjs.map +1 -0
  36. package/dist/data-sources/fetchers/custom.d.cts +17 -0
  37. package/dist/data-sources/fetchers/custom.d.cts.map +1 -0
  38. package/dist/data-sources/fetchers/custom.d.mts +17 -0
  39. package/dist/data-sources/fetchers/custom.d.mts.map +1 -0
  40. package/dist/data-sources/fetchers/custom.mjs +107 -0
  41. package/dist/data-sources/fetchers/custom.mjs.map +1 -0
  42. package/dist/data-sources/fetchers/static.cjs +161 -0
  43. package/dist/data-sources/fetchers/static.cjs.map +1 -0
  44. package/dist/data-sources/fetchers/static.d.cts +40 -0
  45. package/dist/data-sources/fetchers/static.d.cts.map +1 -0
  46. package/dist/data-sources/fetchers/static.d.mts +40 -0
  47. package/dist/data-sources/fetchers/static.d.mts.map +1 -0
  48. package/dist/data-sources/fetchers/static.mjs +158 -0
  49. package/dist/data-sources/fetchers/static.mjs.map +1 -0
  50. package/dist/data-sources/preview-context.cjs +21 -0
  51. package/dist/data-sources/preview-context.cjs.map +1 -0
  52. package/dist/data-sources/preview-context.d.cts +13 -0
  53. package/dist/data-sources/preview-context.d.cts.map +1 -0
  54. package/dist/data-sources/preview-context.d.mts +13 -0
  55. package/dist/data-sources/preview-context.d.mts.map +1 -0
  56. package/dist/data-sources/preview-context.mjs +18 -0
  57. package/dist/data-sources/preview-context.mjs.map +1 -0
  58. package/dist/data-sources/registry-context.cjs +53 -0
  59. package/dist/data-sources/registry-context.cjs.map +1 -0
  60. package/dist/data-sources/registry-context.d.cts +48 -0
  61. package/dist/data-sources/registry-context.d.cts.map +1 -0
  62. package/dist/data-sources/registry-context.d.mts +48 -0
  63. package/dist/data-sources/registry-context.d.mts.map +1 -0
  64. package/dist/data-sources/registry-context.mjs +49 -0
  65. package/dist/data-sources/registry-context.mjs.map +1 -0
  66. package/dist/data-sources/registry.cjs +31 -0
  67. package/dist/data-sources/registry.cjs.map +1 -0
  68. package/dist/data-sources/registry.d.cts +19 -0
  69. package/dist/data-sources/registry.d.cts.map +1 -0
  70. package/dist/data-sources/registry.d.mts +19 -0
  71. package/dist/data-sources/registry.d.mts.map +1 -0
  72. package/dist/data-sources/registry.mjs +29 -0
  73. package/dist/data-sources/registry.mjs.map +1 -0
  74. package/dist/data-sources/transformers.cjs +154 -0
  75. package/dist/data-sources/transformers.cjs.map +1 -0
  76. package/dist/data-sources/transformers.d.cts +10 -0
  77. package/dist/data-sources/transformers.d.cts.map +1 -0
  78. package/dist/data-sources/transformers.d.mts +10 -0
  79. package/dist/data-sources/transformers.d.mts.map +1 -0
  80. package/dist/data-sources/transformers.mjs +153 -0
  81. package/dist/data-sources/transformers.mjs.map +1 -0
  82. package/dist/data-sources/types.cjs +0 -0
  83. package/dist/data-sources/types.d.cts +2 -0
  84. package/dist/data-sources/types.d.mts +2 -0
  85. package/dist/data-sources/types.mjs +1 -0
  86. package/dist/data-sources/use-widget-data.cjs +111 -0
  87. package/dist/data-sources/use-widget-data.cjs.map +1 -0
  88. package/dist/data-sources/use-widget-data.d.cts +17 -0
  89. package/dist/data-sources/use-widget-data.d.cts.map +1 -0
  90. package/dist/data-sources/use-widget-data.d.mts +17 -0
  91. package/dist/data-sources/use-widget-data.d.mts.map +1 -0
  92. package/dist/data-sources/use-widget-data.mjs +109 -0
  93. package/dist/data-sources/use-widget-data.mjs.map +1 -0
  94. package/dist/index-B5cTNde-.d.cts +246 -0
  95. package/dist/index-B5cTNde-.d.cts.map +1 -0
  96. package/dist/index-Cqt2JzkQ.d.mts +246 -0
  97. package/dist/index-Cqt2JzkQ.d.mts.map +1 -0
  98. package/dist/registries/index.cjs +243 -0
  99. package/dist/registries/index.cjs.map +1 -0
  100. package/dist/registries/index.d.cts +338 -0
  101. package/dist/registries/index.d.cts.map +1 -0
  102. package/dist/registries/index.d.mts +338 -0
  103. package/dist/registries/index.d.mts.map +1 -0
  104. package/dist/registries/index.mjs +229 -0
  105. package/dist/registries/index.mjs.map +1 -0
  106. package/dist/shell/AppShellLayout.cjs +49 -0
  107. package/dist/shell/AppShellLayout.cjs.map +1 -0
  108. package/dist/shell/AppShellLayout.d.cts +39 -0
  109. package/dist/shell/AppShellLayout.d.cts.map +1 -0
  110. package/dist/shell/AppShellLayout.d.mts +39 -0
  111. package/dist/shell/AppShellLayout.d.mts.map +1 -0
  112. package/dist/shell/AppShellLayout.mjs +46 -0
  113. package/dist/shell/AppShellLayout.mjs.map +1 -0
  114. package/dist/shell/ScreenHeader.cjs +44 -0
  115. package/dist/shell/ScreenHeader.cjs.map +1 -0
  116. package/dist/shell/ScreenHeader.d.cts +12 -0
  117. package/dist/shell/ScreenHeader.d.cts.map +1 -0
  118. package/dist/shell/ScreenHeader.d.mts +12 -0
  119. package/dist/shell/ScreenHeader.d.mts.map +1 -0
  120. package/dist/shell/ScreenHeader.mjs +42 -0
  121. package/dist/shell/ScreenHeader.mjs.map +1 -0
  122. package/dist/shell/ScreenHeaderContext.cjs +91 -0
  123. package/dist/shell/ScreenHeaderContext.cjs.map +1 -0
  124. package/dist/shell/ScreenHeaderContext.d.cts +35 -0
  125. package/dist/shell/ScreenHeaderContext.d.cts.map +1 -0
  126. package/dist/shell/ScreenHeaderContext.d.mts +35 -0
  127. package/dist/shell/ScreenHeaderContext.d.mts.map +1 -0
  128. package/dist/shell/ScreenHeaderContext.mjs +86 -0
  129. package/dist/shell/ScreenHeaderContext.mjs.map +1 -0
  130. package/dist/shell/ThemeModeContext.cjs +70 -0
  131. package/dist/shell/ThemeModeContext.cjs.map +1 -0
  132. package/dist/shell/ThemeModeContext.d.cts +33 -0
  133. package/dist/shell/ThemeModeContext.d.cts.map +1 -0
  134. package/dist/shell/ThemeModeContext.d.mts +33 -0
  135. package/dist/shell/ThemeModeContext.d.mts.map +1 -0
  136. package/dist/shell/ThemeModeContext.mjs +66 -0
  137. package/dist/shell/ThemeModeContext.mjs.map +1 -0
  138. package/dist/shell/index.cjs +43 -0
  139. package/dist/shell/index.d.cts +7 -0
  140. package/dist/shell/index.d.mts +7 -0
  141. package/dist/shell/index.mjs +7 -0
  142. package/dist/shell/sidebar.cjs +390 -0
  143. package/dist/shell/sidebar.cjs.map +1 -0
  144. package/dist/shell/sidebar.d.cts +85 -0
  145. package/dist/shell/sidebar.d.cts.map +1 -0
  146. package/dist/shell/sidebar.d.mts +85 -0
  147. package/dist/shell/sidebar.d.mts.map +1 -0
  148. package/dist/shell/sidebar.mjs +364 -0
  149. package/dist/shell/sidebar.mjs.map +1 -0
  150. package/dist/shell/use-mobile.cjs +51 -0
  151. package/dist/shell/use-mobile.cjs.map +1 -0
  152. package/dist/shell/use-mobile.d.cts +7 -0
  153. package/dist/shell/use-mobile.d.cts.map +1 -0
  154. package/dist/shell/use-mobile.d.mts +7 -0
  155. package/dist/shell/use-mobile.d.mts.map +1 -0
  156. package/dist/shell/use-mobile.mjs +47 -0
  157. package/dist/shell/use-mobile.mjs.map +1 -0
  158. package/dist/theme/index.cjs +758 -0
  159. package/dist/theme/index.cjs.map +1 -0
  160. package/dist/theme/index.d.cts +131 -0
  161. package/dist/theme/index.d.cts.map +1 -0
  162. package/dist/theme/index.d.mts +131 -0
  163. package/dist/theme/index.d.mts.map +1 -0
  164. package/dist/theme/index.mjs +728 -0
  165. package/dist/theme/index.mjs.map +1 -0
  166. package/dist/types/index.cjs +18 -0
  167. package/dist/types/index.d.cts +4 -0
  168. package/dist/types/index.d.mts +4 -0
  169. package/dist/types/index.mjs +2 -0
  170. package/dist/types-27AHMek-.d.cts +85 -0
  171. package/dist/types-27AHMek-.d.cts.map +1 -0
  172. package/dist/types-BXFX9bXp.cjs +303 -0
  173. package/dist/types-BXFX9bXp.cjs.map +1 -0
  174. package/dist/types-Bjmd7Fdx.mjs +208 -0
  175. package/dist/types-Bjmd7Fdx.mjs.map +1 -0
  176. package/dist/types-C5Zs5V3E.d.mts +155 -0
  177. package/dist/types-C5Zs5V3E.d.mts.map +1 -0
  178. package/dist/types-CeCPKvOv.d.mts +85 -0
  179. package/dist/types-CeCPKvOv.d.mts.map +1 -0
  180. package/dist/types-DrzvahW8.d.cts +155 -0
  181. package/dist/types-DrzvahW8.d.cts.map +1 -0
  182. package/dist/widget-schema-BKZgsNG7.d.mts +119 -0
  183. package/dist/widget-schema-BKZgsNG7.d.mts.map +1 -0
  184. package/dist/widget-schema-BSX2fVhW.d.cts +119 -0
  185. package/dist/widget-schema-BSX2fVhW.d.cts.map +1 -0
  186. package/dist/widget-utils/index.cjs +130 -0
  187. package/dist/widget-utils/index.cjs.map +1 -0
  188. package/dist/widget-utils/index.d.cts +47 -0
  189. package/dist/widget-utils/index.d.cts.map +1 -0
  190. package/dist/widget-utils/index.d.mts +47 -0
  191. package/dist/widget-utils/index.d.mts.map +1 -0
  192. package/dist/widget-utils/index.mjs +119 -0
  193. package/dist/widget-utils/index.mjs.map +1 -0
  194. package/package.json +200 -0
  195. package/src/styles/globals.css +1 -0
@@ -0,0 +1,243 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ let _fortawesome_pro_regular_svg_icons = require("@fortawesome/pro-regular-svg-icons");
4
+ //#region src/registries/property-schema-types.ts
5
+ /**
6
+ * Property field type constant - single source of truth for field types.
7
+ * Use PROPERTY_FIELD_TYPES.text instead of "text" for type-safe comparisons.
8
+ */
9
+ const PROPERTY_FIELD_TYPES = {
10
+ text: "text",
11
+ textarea: "textarea",
12
+ number: "number",
13
+ boolean: "boolean",
14
+ select: "select",
15
+ color: "color",
16
+ range: "range",
17
+ dataSource: "dataSource",
18
+ resource: "resource",
19
+ image: "image",
20
+ alignment: "alignment",
21
+ slider: "slider",
22
+ colorPicker: "colorPicker",
23
+ sectionHeader: "sectionHeader",
24
+ separator: "separator",
25
+ buttonGroup: "buttonGroup",
26
+ colorSelect: "colorSelect",
27
+ sectionLayoutSelect: "sectionLayoutSelect",
28
+ background: "background",
29
+ contentPosition: "contentPosition",
30
+ textSizeSelect: "textSizeSelect",
31
+ cssUnit: "cssUnit"
32
+ };
33
+ /**
34
+ * Runtime validation for property field types.
35
+ * @param value - The value to check
36
+ * @returns true if value is a valid PropertyFieldType
37
+ */
38
+ function isPropertyFieldType(value) {
39
+ return Object.values(PROPERTY_FIELD_TYPES).includes(value);
40
+ }
41
+ /**
42
+ * Group property fields by their group property
43
+ */
44
+ function groupPropertyFields(fields) {
45
+ const grouped = {};
46
+ fields.forEach((field) => {
47
+ const group = field.group || "General";
48
+ if (!grouped[group]) grouped[group] = [];
49
+ grouped[group].push(field);
50
+ });
51
+ return grouped;
52
+ }
53
+ /**
54
+ * Extract current values from widget props based on property fields
55
+ */
56
+ function extractPropertyValues(widget, fields) {
57
+ const values = {};
58
+ fields.forEach((field) => {
59
+ const value = widget.props[field.key];
60
+ values[field.key] = value !== void 0 ? value : field.defaultValue;
61
+ });
62
+ return values;
63
+ }
64
+ /**
65
+ * Apply property values to widget props
66
+ */
67
+ function applyPropertyValues(widget, values) {
68
+ return {
69
+ ...widget,
70
+ props: {
71
+ ...widget.props,
72
+ ...values
73
+ }
74
+ };
75
+ }
76
+ //#endregion
77
+ //#region src/registries/field-helpers.ts
78
+ const getColorField = (props) => {
79
+ return {
80
+ ...props,
81
+ type: "colorSelect"
82
+ };
83
+ };
84
+ const getBorderRadiusField = (props) => {
85
+ return {
86
+ ...props,
87
+ type: "buttonGroup",
88
+ options: [
89
+ {
90
+ icon: _fortawesome_pro_regular_svg_icons.faBan,
91
+ value: "none"
92
+ },
93
+ {
94
+ label: "SM",
95
+ value: "sm"
96
+ },
97
+ {
98
+ label: "MD",
99
+ value: "md"
100
+ },
101
+ {
102
+ label: "LG",
103
+ value: "lg"
104
+ },
105
+ {
106
+ label: "XL",
107
+ value: "xl"
108
+ },
109
+ {
110
+ label: "FULL",
111
+ value: "full"
112
+ }
113
+ ]
114
+ };
115
+ };
116
+ const getPaddingField = (props) => {
117
+ return {
118
+ ...props,
119
+ type: "buttonGroup",
120
+ options: [
121
+ {
122
+ icon: _fortawesome_pro_regular_svg_icons.faBan,
123
+ value: 0
124
+ },
125
+ {
126
+ label: "SM",
127
+ value: 2
128
+ },
129
+ {
130
+ label: "MD",
131
+ value: 4
132
+ },
133
+ {
134
+ label: "LG",
135
+ value: 6
136
+ },
137
+ {
138
+ label: "XL",
139
+ value: 8
140
+ },
141
+ {
142
+ label: "FULL",
143
+ value: 10
144
+ }
145
+ ]
146
+ };
147
+ };
148
+ const getButtonSizeField = (props) => {
149
+ return {
150
+ ...props,
151
+ type: "buttonGroup",
152
+ options: [
153
+ {
154
+ label: "SM",
155
+ value: "sm"
156
+ },
157
+ {
158
+ label: "MD",
159
+ value: "default"
160
+ },
161
+ {
162
+ label: "LG",
163
+ value: "lg"
164
+ },
165
+ {
166
+ label: "XL",
167
+ value: "xl"
168
+ }
169
+ ]
170
+ };
171
+ };
172
+ const getFontSizeField = (props) => {
173
+ return {
174
+ ...props,
175
+ type: "textSizeSelect"
176
+ };
177
+ };
178
+ const getGapField = (props) => {
179
+ return {
180
+ ...props,
181
+ type: "buttonGroup",
182
+ options: [
183
+ {
184
+ icon: _fortawesome_pro_regular_svg_icons.faBan,
185
+ value: "none"
186
+ },
187
+ {
188
+ label: "XS",
189
+ value: "xs"
190
+ },
191
+ {
192
+ label: "SM",
193
+ value: "sm"
194
+ },
195
+ {
196
+ label: "MD",
197
+ value: "md"
198
+ },
199
+ {
200
+ label: "LG",
201
+ value: "lg"
202
+ },
203
+ {
204
+ label: "XL",
205
+ value: "xl"
206
+ }
207
+ ]
208
+ };
209
+ };
210
+ const getHeightField = (props) => {
211
+ return {
212
+ ...props,
213
+ type: "cssUnit"
214
+ };
215
+ };
216
+ /**
217
+ * Gap value mapping - use `as const satisfies` for compile-time validation
218
+ * with literal type preservation.
219
+ */
220
+ const gapValues = {
221
+ none: 0,
222
+ xs: 1,
223
+ sm: 2,
224
+ md: 4,
225
+ lg: 6,
226
+ xl: 8
227
+ };
228
+ //#endregion
229
+ exports.PROPERTY_FIELD_TYPES = PROPERTY_FIELD_TYPES;
230
+ exports.applyPropertyValues = applyPropertyValues;
231
+ exports.extractPropertyValues = extractPropertyValues;
232
+ exports.gapValues = gapValues;
233
+ exports.getBorderRadiusField = getBorderRadiusField;
234
+ exports.getButtonSizeField = getButtonSizeField;
235
+ exports.getColorField = getColorField;
236
+ exports.getFontSizeField = getFontSizeField;
237
+ exports.getGapField = getGapField;
238
+ exports.getHeightField = getHeightField;
239
+ exports.getPaddingField = getPaddingField;
240
+ exports.groupPropertyFields = groupPropertyFields;
241
+ exports.isPropertyFieldType = isPropertyFieldType;
242
+
243
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["faBan"],"sources":["../../src/registries/property-schema-types.ts","../../src/registries/field-helpers.ts"],"sourcesContent":["import type { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport type {\n WidgetType,\n WidgetSchema,\n AlignOptions,\n ColorOptions,\n FontSizeOptions,\n SectionLayoutType,\n StrictOmit,\n} from \"../types\";\n\n/**\n * Tab configuration for organizing properties\n */\nexport interface TabConfig {\n /** Unique identifier for the tab */\n id: string;\n /** Display label for the tab */\n label: string;\n}\n\n// ============================================================================\n// Property Field Types - Derive from constant for single source of truth\n// ============================================================================\n\n/**\n * Property field type constant - single source of truth for field types.\n * Use PROPERTY_FIELD_TYPES.text instead of \"text\" for type-safe comparisons.\n */\nexport const PROPERTY_FIELD_TYPES = {\n text: \"text\",\n textarea: \"textarea\",\n number: \"number\",\n boolean: \"boolean\",\n select: \"select\",\n color: \"color\",\n range: \"range\",\n dataSource: \"dataSource\",\n resource: \"resource\",\n image: \"image\",\n alignment: \"alignment\",\n slider: \"slider\",\n colorPicker: \"colorPicker\",\n sectionHeader: \"sectionHeader\",\n separator: \"separator\",\n buttonGroup: \"buttonGroup\",\n colorSelect: \"colorSelect\",\n sectionLayoutSelect: \"sectionLayoutSelect\",\n background: \"background\",\n contentPosition: \"contentPosition\",\n textSizeSelect: \"textSizeSelect\",\n cssUnit: \"cssUnit\",\n} as const;\n\n/**\n * Union type of all property field types, derived from PROPERTY_FIELD_TYPES constant.\n * @see deriving-typeof-for-object-keys pattern\n */\nexport type PropertyFieldType =\n (typeof PROPERTY_FIELD_TYPES)[keyof typeof PROPERTY_FIELD_TYPES];\n\n/**\n * Runtime validation for property field types.\n * @param value - The value to check\n * @returns true if value is a valid PropertyFieldType\n */\nexport function isPropertyFieldType(value: string): value is PropertyFieldType {\n return Object.values(PROPERTY_FIELD_TYPES).includes(\n value as PropertyFieldType,\n );\n}\n\n/**\n * Base schema for a property field\n */\nexport interface PropertyFieldSchema {\n /** Property key in the widget props */\n key: string;\n /** Display label for the field */\n label: string;\n /** Field type determines the input control */\n type: PropertyFieldType;\n /** Optional description/help text */\n description?: string;\n /** Optional default value */\n defaultValue?: unknown;\n /** Optional tab ID (must match a TabConfig id if widget has tabsConfig) */\n tab?: string;\n /** Optional group for organizing fields within a tab */\n group?: string;\n /**\n * @deprecated Use requiresKeyValue instead\n */\n requiresKeyToBeTrue?: string;\n /** Optional requires a specific key to have a specific value */\n requiresKeyValue?: { key: string; value: unknown };\n}\n\n/**\n * Text field schema\n */\nexport interface TextFieldSchema extends PropertyFieldSchema {\n type: \"text\";\n placeholder?: string;\n maxLength?: number;\n}\n\n/**\n * Textarea field schema\n */\nexport interface TextareaFieldSchema extends PropertyFieldSchema {\n type: \"textarea\";\n placeholder?: string;\n rows?: number;\n maxLength?: number;\n}\n\n/**\n * Number field schema\n */\nexport interface NumberFieldSchema extends PropertyFieldSchema {\n type: \"number\";\n min?: number;\n max?: number;\n step?: number;\n}\n\n/**\n * Boolean field schema\n */\nexport interface BooleanFieldSchema extends PropertyFieldSchema {\n type: \"boolean\";\n}\n\n/**\n * Select field schema with type-safe option values.\n * Uses StrictOmit to ensure \"defaultValue\" key exists on PropertyFieldSchema.\n */\nexport interface SelectFieldSchema<\n T extends string | number = string | number,\n> extends StrictOmit<PropertyFieldSchema, \"defaultValue\"> {\n type: \"select\";\n options: Array<{ label: string; value: T }>;\n defaultValue?: T;\n}\n\n/**\n * Color field schema\n */\nexport interface ColorFieldSchema extends PropertyFieldSchema {\n type: \"color\";\n}\n\n/**\n * Range slider field schema\n */\nexport interface RangeFieldSchema extends PropertyFieldSchema {\n type: \"range\";\n min: number;\n max: number;\n step?: number;\n}\n\n/**\n * Data source field schema for configuring widget data sources\n */\nexport interface DataSourceFieldSchema extends PropertyFieldSchema {\n type: \"dataSource\";\n}\n\n/**\n * Resource field schema for selecting a single resource from the selection modal\n */\nexport interface ResourceFieldSchema extends PropertyFieldSchema {\n type: \"resource\";\n /** Optional filter to specific shareable types */\n allowedTypes?: string[];\n}\n\n/**\n * Image field schema for selecting a single image from the image picker\n */\nexport interface ImageFieldSchema extends PropertyFieldSchema {\n type: \"image\";\n}\n\n/**\n * Alignment field schema\n */\nexport interface AlignmentFieldSchema extends PropertyFieldSchema {\n type: \"alignment\";\n options: {\n verticalEnabled: boolean;\n horizontalEnabled: boolean;\n };\n defaultValue?: AlignOptions;\n}\n\n/**\n * Slider field schema with optional unit suffix (e.g., \"rem\", \"px\")\n */\nexport interface SliderFieldSchema extends PropertyFieldSchema {\n type: \"slider\";\n min: number;\n max: number;\n step?: number;\n unit?: string;\n}\n\n/**\n * Color picker field schema with optional swatches\n */\nexport interface ColorPickerFieldSchema extends PropertyFieldSchema {\n type: \"colorPicker\";\n swatches?: string[];\n}\n\n/**\n * Section header field schema for visual grouping\n */\nexport interface SectionHeaderFieldSchema extends PropertyFieldSchema {\n type: \"sectionHeader\";\n subtitle?: string;\n}\n\n/**\n * Separator field schema for visual separation\n */\nexport interface SeparatorFieldSchema extends PropertyFieldSchema {\n type: \"separator\";\n}\n\n/**\n * Button group field schema.\n * Uses StrictOmit to ensure \"defaultValue\" key exists on PropertyFieldSchema.\n */\nexport interface ButtonGroupFieldSchema<\n T extends string | number = string | number,\n> extends StrictOmit<PropertyFieldSchema, \"defaultValue\"> {\n type: \"buttonGroup\";\n options: Array<{ label?: string; icon?: IconDefinition; value: T }>;\n defaultValue?: T;\n}\n\n/**\n * Color select field schema\n */\nexport interface ColorSelectFieldSchema extends PropertyFieldSchema {\n type: \"colorSelect\";\n defaultValue?: ColorOptions;\n}\n\n/**\n * Section layout select field schema for visual masonry layout selector\n */\nexport interface SectionLayoutSelectFieldSchema extends PropertyFieldSchema {\n type: \"sectionLayoutSelect\";\n defaultValue?: SectionLayoutType;\n}\n\n/**\n * Background field combines resource selection and color properties.\n * Uses StrictOmit to exclude conflicting \"type\" discriminant from parents.\n */\nexport interface BackgroundFieldSchema\n extends\n StrictOmit<ResourceFieldSchema, \"type\">,\n StrictOmit<ColorFieldSchema, \"type\"> {\n type: \"background\";\n}\n\n/**\n * Content position field schema for 3x3 grid position picker\n */\nexport interface ContentPositionFieldSchema extends PropertyFieldSchema {\n type: \"contentPosition\";\n defaultValue?: string;\n}\n\n/**\n * Text size select field schema for visual font size selector\n */\nexport interface TextSizeSelectFieldSchema extends PropertyFieldSchema {\n type: \"textSizeSelect\";\n defaultValue?: FontSizeOptions;\n}\n\n/**\n * CSS unit type for height/width fields\n */\nexport type CssUnit = \"px\" | \"rem\" | \"vh\";\n\n/**\n * CSS unit field schema for numeric values with selectable units (px, rem, vh)\n */\nexport interface CssUnitFieldSchema extends PropertyFieldSchema {\n type: \"cssUnit\";\n min?: number;\n max?: number;\n step?: number;\n allowedUnits?: CssUnit[];\n defaultUnit?: CssUnit;\n}\n\n/**\n * Union of all field schema types\n */\nexport type PropertyField =\n | TextFieldSchema\n | TextareaFieldSchema\n | NumberFieldSchema\n | BooleanFieldSchema\n | SelectFieldSchema<string | number>\n | ColorFieldSchema\n | RangeFieldSchema\n | DataSourceFieldSchema\n | ResourceFieldSchema\n | ImageFieldSchema\n | AlignmentFieldSchema\n | SliderFieldSchema\n | ColorPickerFieldSchema\n | SectionHeaderFieldSchema\n | SeparatorFieldSchema\n | ButtonGroupFieldSchema<string | number>\n | ColorSelectFieldSchema\n | SectionLayoutSelectFieldSchema\n | BackgroundFieldSchema\n | ContentPositionFieldSchema\n | TextSizeSelectFieldSchema\n | CssUnitFieldSchema;\n\n/**\n * Schema for per-item configuration in custom data sources.\n * Widgets can define this to allow users to configure widget-specific\n * settings for each selected item (e.g., title, description, button).\n */\nexport interface ItemConfigSchema {\n /** Fields available for per-item configuration */\n fields: PropertyField[];\n /** Optional description shown at top of item config panel */\n description?: string;\n}\n\n/**\n * Schema for a widget's editable properties\n */\nexport interface WidgetPropertySchema {\n /** Widget type this schema applies to */\n widgetType: WidgetType;\n /** Display name for the widget */\n displayName: string;\n /** Optional tab configuration - if present, tabs are enabled */\n tabsConfig?: TabConfig[];\n /** Editable property fields */\n fields: PropertyField[];\n /** Optional custom validator function */\n validate?: (props: Record<string, unknown>) => string | null;\n /** Props that can be populated from data sources */\n dataSourceTargetProps?: string[];\n /** Optional schema for per-item configurations in custom data sources */\n itemConfigSchema?: ItemConfigSchema;\n}\n\n/**\n * Registry mapping widget types to their property schemas\n */\nexport type PropertySchemaRegistry = Record<WidgetType, WidgetPropertySchema>;\n\n/**\n * Group property fields by their group property\n */\nexport function groupPropertyFields(\n fields: readonly PropertyField[],\n): Record<string, PropertyField[]> {\n const grouped: Record<string, PropertyField[]> = {};\n\n fields.forEach((field) => {\n const group = field.group || \"General\";\n if (!grouped[group]) {\n grouped[group] = [];\n }\n grouped[group].push(field);\n });\n\n return grouped;\n}\n\n/**\n * Extract current values from widget props based on property fields\n */\nexport function extractPropertyValues(\n widget: Readonly<WidgetSchema>,\n fields: readonly PropertyField[],\n): Record<string, unknown> {\n const values: Record<string, unknown> = {};\n\n fields.forEach((field) => {\n const value = widget.props[field.key];\n values[field.key] = value !== undefined ? value : field.defaultValue;\n });\n\n return values;\n}\n\n/**\n * Apply property values to widget props\n */\nexport function applyPropertyValues(\n widget: Readonly<WidgetSchema>,\n values: Readonly<Record<string, unknown>>,\n): WidgetSchema {\n return {\n ...widget,\n props: {\n ...widget.props,\n ...values,\n },\n };\n}\n","import type {\n ButtonGroupFieldSchema,\n ColorSelectFieldSchema,\n CssUnitFieldSchema,\n TextSizeSelectFieldSchema,\n} from \"./property-schema-types\";\nimport type {\n BorderRadiusOptions,\n PaddingOptions,\n ButtonSizeOptions,\n GapOptions,\n} from \"../types\";\nimport { faBan } from \"@fortawesome/pro-regular-svg-icons\";\n\nexport const getColorField = (\n props: Readonly<Omit<ColorSelectFieldSchema, \"type\">>,\n): ColorSelectFieldSchema => {\n return {\n ...props,\n type: \"colorSelect\",\n };\n};\n\nexport const getBorderRadiusField = (\n props: Readonly<\n Omit<ButtonGroupFieldSchema<BorderRadiusOptions>, \"options\" | \"type\">\n >,\n): ButtonGroupFieldSchema<BorderRadiusOptions> => {\n return {\n ...props,\n type: \"buttonGroup\",\n options: [\n { icon: faBan, value: \"none\" },\n { label: \"SM\", value: \"sm\" },\n { label: \"MD\", value: \"md\" },\n { label: \"LG\", value: \"lg\" },\n { label: \"XL\", value: \"xl\" },\n { label: \"FULL\", value: \"full\" },\n ],\n };\n};\n\nexport const getPaddingField = (\n props: Readonly<\n Omit<ButtonGroupFieldSchema<PaddingOptions>, \"options\" | \"type\">\n >,\n): ButtonGroupFieldSchema<PaddingOptions> => {\n return {\n ...props,\n type: \"buttonGroup\",\n options: [\n { icon: faBan, value: 0 },\n { label: \"SM\", value: 2 },\n { label: \"MD\", value: 4 },\n { label: \"LG\", value: 6 },\n { label: \"XL\", value: 8 },\n { label: \"FULL\", value: 10 },\n ],\n };\n};\n\nexport const getButtonSizeField = (\n props: Readonly<\n Omit<ButtonGroupFieldSchema<ButtonSizeOptions>, \"options\" | \"type\">\n >,\n): ButtonGroupFieldSchema<ButtonSizeOptions> => {\n return {\n ...props,\n type: \"buttonGroup\",\n options: [\n { label: \"SM\", value: \"sm\" },\n { label: \"MD\", value: \"default\" },\n { label: \"LG\", value: \"lg\" },\n { label: \"XL\", value: \"xl\" },\n ],\n };\n};\n\nexport const getFontSizeField = (\n props: Readonly<Omit<TextSizeSelectFieldSchema, \"type\">>,\n): TextSizeSelectFieldSchema => {\n return {\n ...props,\n type: \"textSizeSelect\",\n };\n};\n\nexport const getGapField = (\n props: Readonly<Omit<ButtonGroupFieldSchema<GapOptions>, \"options\" | \"type\">>,\n): ButtonGroupFieldSchema<GapOptions> => {\n return {\n ...props,\n type: \"buttonGroup\",\n options: [\n { icon: faBan, value: \"none\" },\n { label: \"XS\", value: \"xs\" },\n { label: \"SM\", value: \"sm\" },\n { label: \"MD\", value: \"md\" },\n { label: \"LG\", value: \"lg\" },\n { label: \"XL\", value: \"xl\" },\n ],\n };\n};\n\nexport const getHeightField = (\n props: Readonly<Omit<CssUnitFieldSchema, \"type\">>,\n): CssUnitFieldSchema => {\n return {\n ...props,\n type: \"cssUnit\",\n };\n};\n\n/**\n * Gap value mapping - use `as const satisfies` for compile-time validation\n * with literal type preservation.\n */\nexport const gapValues: {\n readonly none: 0;\n readonly xs: 1;\n readonly sm: 2;\n readonly md: 4;\n readonly lg: 6;\n readonly xl: 8;\n} = {\n none: 0,\n xs: 1,\n sm: 2,\n md: 4,\n lg: 6,\n xl: 8,\n} as const satisfies Record<GapOptions, number>;\n"],"mappings":";;;;;;;;AA6BA,MAAa,uBAAuB;CAClC,MAAM;CACN,UAAU;CACV,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,OAAO;CACP,OAAO;CACP,YAAY;CACZ,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;CACR,aAAa;CACb,eAAe;CACf,WAAW;CACX,aAAa;CACb,aAAa;CACb,qBAAqB;CACrB,YAAY;CACZ,iBAAiB;CACjB,gBAAgB;CAChB,SAAS;CACV;;;;;;AAcD,SAAgB,oBAAoB,OAA2C;AAC7E,QAAO,OAAO,OAAO,qBAAqB,CAAC,SACzC,MACD;;;;;AA8SH,SAAgB,oBACd,QACiC;CACjC,MAAM,UAA2C,EAAE;AAEnD,QAAO,SAAS,UAAU;EACxB,MAAM,QAAQ,MAAM,SAAS;AAC7B,MAA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GACjC;IAAE,OAAO;IAAM,OAAO;IAAM;GAC5B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC7B;EACF;;AAGH,MAAa,oBACX,UAC8B;AAC9B,QAAO;EACL,GAAG;EACH,MAAM;EACP;;AAGH,MAAa,eACX,UACuC;AACvC,QAAO;EACL,GAAG;EACH,MAAM;EACN,SAAS;GACP;IAAE,MAAMA,mCAAAA;IAAO,OAAO;IAAQ;GAC9B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC5B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC5B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC5B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC5B;IAAE,OAAO;IAAM,OAAO;IAAM;GAC7B;EACF;;AAGH,MAAa,kBACX,UACuB;AACvB,QAAO;EACL,GAAG;EACH,MAAM;EACP;;;;;;AAOH,MAAa,YAOT;CACF,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL"}
@@ -0,0 +1,338 @@
1
+ import { a as WidgetSchema, o as WidgetType } from "../widget-schema-BSX2fVhW.cjs";
2
+ import { c as BorderRadiusOptions, d as ColorOptions, h as GapOptions, l as ButtonSizeOptions, n as AlignOptions, p as FontSizeOptions, t as StrictOmit, x as SectionLayoutType, y as PaddingOptions } from "../index-B5cTNde-.cjs";
3
+ import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
4
+
5
+ //#region src/registries/property-schema-types.d.ts
6
+ /**
7
+ * Tab configuration for organizing properties
8
+ */
9
+ interface TabConfig {
10
+ /** Unique identifier for the tab */
11
+ id: string;
12
+ /** Display label for the tab */
13
+ label: string;
14
+ }
15
+ /**
16
+ * Property field type constant - single source of truth for field types.
17
+ * Use PROPERTY_FIELD_TYPES.text instead of "text" for type-safe comparisons.
18
+ */
19
+ declare const PROPERTY_FIELD_TYPES: {
20
+ readonly text: "text";
21
+ readonly textarea: "textarea";
22
+ readonly number: "number";
23
+ readonly boolean: "boolean";
24
+ readonly select: "select";
25
+ readonly color: "color";
26
+ readonly range: "range";
27
+ readonly dataSource: "dataSource";
28
+ readonly resource: "resource";
29
+ readonly image: "image";
30
+ readonly alignment: "alignment";
31
+ readonly slider: "slider";
32
+ readonly colorPicker: "colorPicker";
33
+ readonly sectionHeader: "sectionHeader";
34
+ readonly separator: "separator";
35
+ readonly buttonGroup: "buttonGroup";
36
+ readonly colorSelect: "colorSelect";
37
+ readonly sectionLayoutSelect: "sectionLayoutSelect";
38
+ readonly background: "background";
39
+ readonly contentPosition: "contentPosition";
40
+ readonly textSizeSelect: "textSizeSelect";
41
+ readonly cssUnit: "cssUnit";
42
+ };
43
+ /**
44
+ * Union type of all property field types, derived from PROPERTY_FIELD_TYPES constant.
45
+ * @see deriving-typeof-for-object-keys pattern
46
+ */
47
+ type PropertyFieldType = (typeof PROPERTY_FIELD_TYPES)[keyof typeof PROPERTY_FIELD_TYPES];
48
+ /**
49
+ * Runtime validation for property field types.
50
+ * @param value - The value to check
51
+ * @returns true if value is a valid PropertyFieldType
52
+ */
53
+ declare function isPropertyFieldType(value: string): value is PropertyFieldType;
54
+ /**
55
+ * Base schema for a property field
56
+ */
57
+ interface PropertyFieldSchema {
58
+ /** Property key in the widget props */
59
+ key: string;
60
+ /** Display label for the field */
61
+ label: string;
62
+ /** Field type determines the input control */
63
+ type: PropertyFieldType;
64
+ /** Optional description/help text */
65
+ description?: string;
66
+ /** Optional default value */
67
+ defaultValue?: unknown;
68
+ /** Optional tab ID (must match a TabConfig id if widget has tabsConfig) */
69
+ tab?: string;
70
+ /** Optional group for organizing fields within a tab */
71
+ group?: string;
72
+ /**
73
+ * @deprecated Use requiresKeyValue instead
74
+ */
75
+ requiresKeyToBeTrue?: string;
76
+ /** Optional requires a specific key to have a specific value */
77
+ requiresKeyValue?: {
78
+ key: string;
79
+ value: unknown;
80
+ };
81
+ }
82
+ /**
83
+ * Text field schema
84
+ */
85
+ interface TextFieldSchema extends PropertyFieldSchema {
86
+ type: "text";
87
+ placeholder?: string;
88
+ maxLength?: number;
89
+ }
90
+ /**
91
+ * Textarea field schema
92
+ */
93
+ interface TextareaFieldSchema extends PropertyFieldSchema {
94
+ type: "textarea";
95
+ placeholder?: string;
96
+ rows?: number;
97
+ maxLength?: number;
98
+ }
99
+ /**
100
+ * Number field schema
101
+ */
102
+ interface NumberFieldSchema extends PropertyFieldSchema {
103
+ type: "number";
104
+ min?: number;
105
+ max?: number;
106
+ step?: number;
107
+ }
108
+ /**
109
+ * Boolean field schema
110
+ */
111
+ interface BooleanFieldSchema extends PropertyFieldSchema {
112
+ type: "boolean";
113
+ }
114
+ /**
115
+ * Select field schema with type-safe option values.
116
+ * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema.
117
+ */
118
+ interface SelectFieldSchema<T extends string | number = string | number> extends StrictOmit<PropertyFieldSchema, "defaultValue"> {
119
+ type: "select";
120
+ options: Array<{
121
+ label: string;
122
+ value: T;
123
+ }>;
124
+ defaultValue?: T;
125
+ }
126
+ /**
127
+ * Color field schema
128
+ */
129
+ interface ColorFieldSchema extends PropertyFieldSchema {
130
+ type: "color";
131
+ }
132
+ /**
133
+ * Range slider field schema
134
+ */
135
+ interface RangeFieldSchema extends PropertyFieldSchema {
136
+ type: "range";
137
+ min: number;
138
+ max: number;
139
+ step?: number;
140
+ }
141
+ /**
142
+ * Data source field schema for configuring widget data sources
143
+ */
144
+ interface DataSourceFieldSchema extends PropertyFieldSchema {
145
+ type: "dataSource";
146
+ }
147
+ /**
148
+ * Resource field schema for selecting a single resource from the selection modal
149
+ */
150
+ interface ResourceFieldSchema extends PropertyFieldSchema {
151
+ type: "resource";
152
+ /** Optional filter to specific shareable types */
153
+ allowedTypes?: string[];
154
+ }
155
+ /**
156
+ * Image field schema for selecting a single image from the image picker
157
+ */
158
+ interface ImageFieldSchema extends PropertyFieldSchema {
159
+ type: "image";
160
+ }
161
+ /**
162
+ * Alignment field schema
163
+ */
164
+ interface AlignmentFieldSchema extends PropertyFieldSchema {
165
+ type: "alignment";
166
+ options: {
167
+ verticalEnabled: boolean;
168
+ horizontalEnabled: boolean;
169
+ };
170
+ defaultValue?: AlignOptions;
171
+ }
172
+ /**
173
+ * Slider field schema with optional unit suffix (e.g., "rem", "px")
174
+ */
175
+ interface SliderFieldSchema extends PropertyFieldSchema {
176
+ type: "slider";
177
+ min: number;
178
+ max: number;
179
+ step?: number;
180
+ unit?: string;
181
+ }
182
+ /**
183
+ * Color picker field schema with optional swatches
184
+ */
185
+ interface ColorPickerFieldSchema extends PropertyFieldSchema {
186
+ type: "colorPicker";
187
+ swatches?: string[];
188
+ }
189
+ /**
190
+ * Section header field schema for visual grouping
191
+ */
192
+ interface SectionHeaderFieldSchema extends PropertyFieldSchema {
193
+ type: "sectionHeader";
194
+ subtitle?: string;
195
+ }
196
+ /**
197
+ * Separator field schema for visual separation
198
+ */
199
+ interface SeparatorFieldSchema extends PropertyFieldSchema {
200
+ type: "separator";
201
+ }
202
+ /**
203
+ * Button group field schema.
204
+ * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema.
205
+ */
206
+ interface ButtonGroupFieldSchema<T extends string | number = string | number> extends StrictOmit<PropertyFieldSchema, "defaultValue"> {
207
+ type: "buttonGroup";
208
+ options: Array<{
209
+ label?: string;
210
+ icon?: IconDefinition;
211
+ value: T;
212
+ }>;
213
+ defaultValue?: T;
214
+ }
215
+ /**
216
+ * Color select field schema
217
+ */
218
+ interface ColorSelectFieldSchema extends PropertyFieldSchema {
219
+ type: "colorSelect";
220
+ defaultValue?: ColorOptions;
221
+ }
222
+ /**
223
+ * Section layout select field schema for visual masonry layout selector
224
+ */
225
+ interface SectionLayoutSelectFieldSchema extends PropertyFieldSchema {
226
+ type: "sectionLayoutSelect";
227
+ defaultValue?: SectionLayoutType;
228
+ }
229
+ /**
230
+ * Background field combines resource selection and color properties.
231
+ * Uses StrictOmit to exclude conflicting "type" discriminant from parents.
232
+ */
233
+ interface BackgroundFieldSchema extends StrictOmit<ResourceFieldSchema, "type">, StrictOmit<ColorFieldSchema, "type"> {
234
+ type: "background";
235
+ }
236
+ /**
237
+ * Content position field schema for 3x3 grid position picker
238
+ */
239
+ interface ContentPositionFieldSchema extends PropertyFieldSchema {
240
+ type: "contentPosition";
241
+ defaultValue?: string;
242
+ }
243
+ /**
244
+ * Text size select field schema for visual font size selector
245
+ */
246
+ interface TextSizeSelectFieldSchema extends PropertyFieldSchema {
247
+ type: "textSizeSelect";
248
+ defaultValue?: FontSizeOptions;
249
+ }
250
+ /**
251
+ * CSS unit type for height/width fields
252
+ */
253
+ type CssUnit = "px" | "rem" | "vh";
254
+ /**
255
+ * CSS unit field schema for numeric values with selectable units (px, rem, vh)
256
+ */
257
+ interface CssUnitFieldSchema extends PropertyFieldSchema {
258
+ type: "cssUnit";
259
+ min?: number;
260
+ max?: number;
261
+ step?: number;
262
+ allowedUnits?: CssUnit[];
263
+ defaultUnit?: CssUnit;
264
+ }
265
+ /**
266
+ * Union of all field schema types
267
+ */
268
+ type PropertyField = TextFieldSchema | TextareaFieldSchema | NumberFieldSchema | BooleanFieldSchema | SelectFieldSchema<string | number> | ColorFieldSchema | RangeFieldSchema | DataSourceFieldSchema | ResourceFieldSchema | ImageFieldSchema | AlignmentFieldSchema | SliderFieldSchema | ColorPickerFieldSchema | SectionHeaderFieldSchema | SeparatorFieldSchema | ButtonGroupFieldSchema<string | number> | ColorSelectFieldSchema | SectionLayoutSelectFieldSchema | BackgroundFieldSchema | ContentPositionFieldSchema | TextSizeSelectFieldSchema | CssUnitFieldSchema;
269
+ /**
270
+ * Schema for per-item configuration in custom data sources.
271
+ * Widgets can define this to allow users to configure widget-specific
272
+ * settings for each selected item (e.g., title, description, button).
273
+ */
274
+ interface ItemConfigSchema {
275
+ /** Fields available for per-item configuration */
276
+ fields: PropertyField[];
277
+ /** Optional description shown at top of item config panel */
278
+ description?: string;
279
+ }
280
+ /**
281
+ * Schema for a widget's editable properties
282
+ */
283
+ interface WidgetPropertySchema {
284
+ /** Widget type this schema applies to */
285
+ widgetType: WidgetType;
286
+ /** Display name for the widget */
287
+ displayName: string;
288
+ /** Optional tab configuration - if present, tabs are enabled */
289
+ tabsConfig?: TabConfig[];
290
+ /** Editable property fields */
291
+ fields: PropertyField[];
292
+ /** Optional custom validator function */
293
+ validate?: (props: Record<string, unknown>) => string | null;
294
+ /** Props that can be populated from data sources */
295
+ dataSourceTargetProps?: string[];
296
+ /** Optional schema for per-item configurations in custom data sources */
297
+ itemConfigSchema?: ItemConfigSchema;
298
+ }
299
+ /**
300
+ * Registry mapping widget types to their property schemas
301
+ */
302
+ type PropertySchemaRegistry = Record<WidgetType, WidgetPropertySchema>;
303
+ /**
304
+ * Group property fields by their group property
305
+ */
306
+ declare function groupPropertyFields(fields: readonly PropertyField[]): Record<string, PropertyField[]>;
307
+ /**
308
+ * Extract current values from widget props based on property fields
309
+ */
310
+ declare function extractPropertyValues(widget: Readonly<WidgetSchema>, fields: readonly PropertyField[]): Record<string, unknown>;
311
+ /**
312
+ * Apply property values to widget props
313
+ */
314
+ declare function applyPropertyValues(widget: Readonly<WidgetSchema>, values: Readonly<Record<string, unknown>>): WidgetSchema;
315
+ //#endregion
316
+ //#region src/registries/field-helpers.d.ts
317
+ declare const getColorField: (props: Readonly<Omit<ColorSelectFieldSchema, "type">>) => ColorSelectFieldSchema;
318
+ declare const getBorderRadiusField: (props: Readonly<Omit<ButtonGroupFieldSchema<BorderRadiusOptions>, "options" | "type">>) => ButtonGroupFieldSchema<BorderRadiusOptions>;
319
+ declare const getPaddingField: (props: Readonly<Omit<ButtonGroupFieldSchema<PaddingOptions>, "options" | "type">>) => ButtonGroupFieldSchema<PaddingOptions>;
320
+ declare const getButtonSizeField: (props: Readonly<Omit<ButtonGroupFieldSchema<ButtonSizeOptions>, "options" | "type">>) => ButtonGroupFieldSchema<ButtonSizeOptions>;
321
+ declare const getFontSizeField: (props: Readonly<Omit<TextSizeSelectFieldSchema, "type">>) => TextSizeSelectFieldSchema;
322
+ declare const getGapField: (props: Readonly<Omit<ButtonGroupFieldSchema<GapOptions>, "options" | "type">>) => ButtonGroupFieldSchema<GapOptions>;
323
+ declare const getHeightField: (props: Readonly<Omit<CssUnitFieldSchema, "type">>) => CssUnitFieldSchema;
324
+ /**
325
+ * Gap value mapping - use `as const satisfies` for compile-time validation
326
+ * with literal type preservation.
327
+ */
328
+ declare const gapValues: {
329
+ readonly none: 0;
330
+ readonly xs: 1;
331
+ readonly sm: 2;
332
+ readonly md: 4;
333
+ readonly lg: 6;
334
+ readonly xl: 8;
335
+ };
336
+ //#endregion
337
+ export { type AlignmentFieldSchema, type BackgroundFieldSchema, type BooleanFieldSchema, type ButtonGroupFieldSchema, type ColorFieldSchema, type ColorPickerFieldSchema, type ColorSelectFieldSchema, type ContentPositionFieldSchema, type CssUnit, type CssUnitFieldSchema, type DataSourceFieldSchema, type ImageFieldSchema, type ItemConfigSchema, type NumberFieldSchema, PROPERTY_FIELD_TYPES, type PropertyField, type PropertyFieldSchema, type PropertyFieldType, type PropertySchemaRegistry, type RangeFieldSchema, type ResourceFieldSchema, type SectionHeaderFieldSchema, type SectionLayoutSelectFieldSchema, type SelectFieldSchema, type SeparatorFieldSchema, type SliderFieldSchema, type TabConfig, type TextFieldSchema, type TextSizeSelectFieldSchema, type TextareaFieldSchema, type WidgetPropertySchema, applyPropertyValues, extractPropertyValues, gapValues, getBorderRadiusField, getButtonSizeField, getColorField, getFontSizeField, getGapField, getHeightField, getPaddingField, groupPropertyFields, isPropertyFieldType };
338
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/registries/property-schema-types.ts","../../src/registries/field-helpers.ts"],"mappings":";;;;;;;;UAciB,SAAA;EAAA;EAEf,EAAA;EAFe;EAIf,KAAA;AAAA;;;;;cAWW,oBAAA;EAAA,SACX,IAAA;EAAA,SACA,QAAA;EAAA,SACA,MAAA;EAAA,SACA,OAAA;EAAA,SACA,MAAA;EAAA,SACA,KAAA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