@fluid-app/rep-core 0.1.0

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 (45) hide show
  1. package/dist/chunk-6QLUUNJL.cjs +153 -0
  2. package/dist/chunk-6QLUUNJL.cjs.map +1 -0
  3. package/dist/chunk-EWR5EIBP.js +136 -0
  4. package/dist/chunk-EWR5EIBP.js.map +1 -0
  5. package/dist/data-sources/context.cjs +26 -0
  6. package/dist/data-sources/context.cjs.map +1 -0
  7. package/dist/data-sources/context.d.cts +16 -0
  8. package/dist/data-sources/context.d.ts +16 -0
  9. package/dist/data-sources/context.js +23 -0
  10. package/dist/data-sources/context.js.map +1 -0
  11. package/dist/data-sources/types.cjs +4 -0
  12. package/dist/data-sources/types.cjs.map +1 -0
  13. package/dist/data-sources/types.d.cts +122 -0
  14. package/dist/data-sources/types.d.ts +122 -0
  15. package/dist/data-sources/types.js +3 -0
  16. package/dist/data-sources/types.js.map +1 -0
  17. package/dist/registries/index.cjs +156 -0
  18. package/dist/registries/index.cjs.map +1 -0
  19. package/dist/registries/index.d.cts +303 -0
  20. package/dist/registries/index.d.ts +303 -0
  21. package/dist/registries/index.js +143 -0
  22. package/dist/registries/index.js.map +1 -0
  23. package/dist/shareable-item-DPmNZkE1.d.cts +138 -0
  24. package/dist/shareable-item-DPmNZkE1.d.ts +138 -0
  25. package/dist/theme/index.cjs +1013 -0
  26. package/dist/theme/index.cjs.map +1 -0
  27. package/dist/theme/index.d.cts +2680 -0
  28. package/dist/theme/index.d.ts +2680 -0
  29. package/dist/theme/index.js +956 -0
  30. package/dist/theme/index.js.map +1 -0
  31. package/dist/theme-DrMUYZTO.d.cts +22 -0
  32. package/dist/theme-DrMUYZTO.d.ts +22 -0
  33. package/dist/types/index.cjs +72 -0
  34. package/dist/types/index.cjs.map +1 -0
  35. package/dist/types/index.d.cts +227 -0
  36. package/dist/types/index.d.ts +227 -0
  37. package/dist/types/index.js +3 -0
  38. package/dist/types/index.js.map +1 -0
  39. package/dist/widget-utils/index.cjs +123 -0
  40. package/dist/widget-utils/index.cjs.map +1 -0
  41. package/dist/widget-utils/index.d.cts +43 -0
  42. package/dist/widget-utils/index.d.ts +43 -0
  43. package/dist/widget-utils/index.js +111 -0
  44. package/dist/widget-utils/index.js.map +1 -0
  45. package/package.json +99 -0
@@ -0,0 +1,303 @@
1
+ import { StrictOmit, AlignOptions, ColorOptions, SectionLayoutType, BorderRadiusOptions, PaddingOptions, ButtonSizeOptions, FontSizeOptions, GapOptions } from '../types/index.js';
2
+ import { b as WidgetType, a as WidgetSchema } from '../shareable-item-DPmNZkE1.js';
3
+ import '../theme-DrMUYZTO.js';
4
+ import 'react';
5
+
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 alignment: "alignment";
30
+ readonly slider: "slider";
31
+ readonly colorPicker: "colorPicker";
32
+ readonly sectionHeader: "sectionHeader";
33
+ readonly separator: "separator";
34
+ readonly buttonGroup: "buttonGroup";
35
+ readonly colorSelect: "colorSelect";
36
+ readonly sectionLayoutSelect: "sectionLayoutSelect";
37
+ readonly background: "background";
38
+ readonly contentPosition: "contentPosition";
39
+ };
40
+ /**
41
+ * Union type of all property field types, derived from PROPERTY_FIELD_TYPES constant.
42
+ * @see deriving-typeof-for-object-keys pattern
43
+ */
44
+ type PropertyFieldType = (typeof PROPERTY_FIELD_TYPES)[keyof typeof PROPERTY_FIELD_TYPES];
45
+ /**
46
+ * Runtime validation for property field types.
47
+ * @param value - The value to check
48
+ * @returns true if value is a valid PropertyFieldType
49
+ */
50
+ declare function isPropertyFieldType(value: string): value is PropertyFieldType;
51
+ /**
52
+ * Base schema for a property field
53
+ */
54
+ interface PropertyFieldSchema {
55
+ /** Property key in the widget props */
56
+ key: string;
57
+ /** Display label for the field */
58
+ label: string;
59
+ /** Field type determines the input control */
60
+ type: PropertyFieldType;
61
+ /** Optional description/help text */
62
+ description?: string;
63
+ /** Optional default value */
64
+ defaultValue?: unknown;
65
+ /** Optional tab ID (must match a TabConfig id if widget has tabsConfig) */
66
+ tab?: string;
67
+ /** Optional group for organizing fields within a tab */
68
+ group?: string;
69
+ /**
70
+ * @deprecated Use requiresKeyValue instead
71
+ */
72
+ requiresKeyToBeTrue?: string;
73
+ /** Optional requires a specific key to have a specific value */
74
+ requiresKeyValue?: {
75
+ key: string;
76
+ value: unknown;
77
+ };
78
+ }
79
+ /**
80
+ * Text field schema
81
+ */
82
+ interface TextFieldSchema extends PropertyFieldSchema {
83
+ type: "text";
84
+ placeholder?: string;
85
+ maxLength?: number;
86
+ }
87
+ /**
88
+ * Textarea field schema
89
+ */
90
+ interface TextareaFieldSchema extends PropertyFieldSchema {
91
+ type: "textarea";
92
+ placeholder?: string;
93
+ rows?: number;
94
+ maxLength?: number;
95
+ }
96
+ /**
97
+ * Number field schema
98
+ */
99
+ interface NumberFieldSchema extends PropertyFieldSchema {
100
+ type: "number";
101
+ min?: number;
102
+ max?: number;
103
+ step?: number;
104
+ }
105
+ /**
106
+ * Boolean field schema
107
+ */
108
+ interface BooleanFieldSchema extends PropertyFieldSchema {
109
+ type: "boolean";
110
+ }
111
+ /**
112
+ * Select field schema with type-safe option values.
113
+ * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema.
114
+ */
115
+ interface SelectFieldSchema<T extends string | number = string | number> extends StrictOmit<PropertyFieldSchema, "defaultValue"> {
116
+ type: "select";
117
+ options: Array<{
118
+ label: string;
119
+ value: T;
120
+ }>;
121
+ defaultValue?: T;
122
+ }
123
+ /**
124
+ * Color field schema
125
+ */
126
+ interface ColorFieldSchema extends PropertyFieldSchema {
127
+ type: "color";
128
+ }
129
+ /**
130
+ * Range slider field schema
131
+ */
132
+ interface RangeFieldSchema extends PropertyFieldSchema {
133
+ type: "range";
134
+ min: number;
135
+ max: number;
136
+ step?: number;
137
+ }
138
+ /**
139
+ * Data source field schema for configuring widget data sources
140
+ */
141
+ interface DataSourceFieldSchema extends PropertyFieldSchema {
142
+ type: "dataSource";
143
+ }
144
+ /**
145
+ * Resource field schema for selecting a single resource from the selection modal
146
+ */
147
+ interface ResourceFieldSchema extends PropertyFieldSchema {
148
+ type: "resource";
149
+ /** Optional filter to specific shareable types */
150
+ allowedTypes?: string[];
151
+ }
152
+ /**
153
+ * Alignment field schema
154
+ */
155
+ interface AlignmentFieldSchema extends PropertyFieldSchema {
156
+ type: "alignment";
157
+ options: {
158
+ verticalEnabled: boolean;
159
+ horizontalEnabled: boolean;
160
+ };
161
+ defaultValue?: AlignOptions;
162
+ }
163
+ /**
164
+ * Slider field schema with optional unit suffix (e.g., "rem", "px")
165
+ */
166
+ interface SliderFieldSchema extends PropertyFieldSchema {
167
+ type: "slider";
168
+ min: number;
169
+ max: number;
170
+ step?: number;
171
+ unit?: string;
172
+ }
173
+ /**
174
+ * Color picker field schema with optional swatches
175
+ */
176
+ interface ColorPickerFieldSchema extends PropertyFieldSchema {
177
+ type: "colorPicker";
178
+ swatches?: string[];
179
+ }
180
+ /**
181
+ * Section header field schema for visual grouping
182
+ */
183
+ interface SectionHeaderFieldSchema extends PropertyFieldSchema {
184
+ type: "sectionHeader";
185
+ subtitle?: string;
186
+ }
187
+ /**
188
+ * Separator field schema for visual separation
189
+ */
190
+ interface SeparatorFieldSchema extends PropertyFieldSchema {
191
+ type: "separator";
192
+ }
193
+ /**
194
+ * Button group field schema.
195
+ * Uses StrictOmit to ensure "defaultValue" key exists on PropertyFieldSchema.
196
+ */
197
+ interface ButtonGroupFieldSchema<T extends string | number = string | number> extends StrictOmit<PropertyFieldSchema, "defaultValue"> {
198
+ type: "buttonGroup";
199
+ options: Array<{
200
+ label: string;
201
+ value: T;
202
+ }>;
203
+ defaultValue?: T;
204
+ }
205
+ /**
206
+ * Color select field schema
207
+ */
208
+ interface ColorSelectFieldSchema extends PropertyFieldSchema {
209
+ type: "colorSelect";
210
+ defaultValue?: ColorOptions;
211
+ }
212
+ /**
213
+ * Section layout select field schema for visual masonry layout selector
214
+ */
215
+ interface SectionLayoutSelectFieldSchema extends PropertyFieldSchema {
216
+ type: "sectionLayoutSelect";
217
+ defaultValue?: SectionLayoutType;
218
+ }
219
+ /**
220
+ * Background field combines resource selection and color properties.
221
+ * Uses StrictOmit to exclude conflicting "type" discriminant from parents.
222
+ */
223
+ interface BackgroundFieldSchema extends StrictOmit<ResourceFieldSchema, "type">, StrictOmit<ColorFieldSchema, "type"> {
224
+ type: "background";
225
+ }
226
+ /**
227
+ * Content position field schema for 3x3 grid position picker
228
+ */
229
+ interface ContentPositionFieldSchema extends PropertyFieldSchema {
230
+ type: "contentPosition";
231
+ defaultValue?: string;
232
+ }
233
+ /**
234
+ * Union of all field schema types
235
+ */
236
+ type PropertyField = TextFieldSchema | TextareaFieldSchema | NumberFieldSchema | BooleanFieldSchema | SelectFieldSchema<string | number> | ColorFieldSchema | RangeFieldSchema | DataSourceFieldSchema | ResourceFieldSchema | AlignmentFieldSchema | SliderFieldSchema | ColorPickerFieldSchema | SectionHeaderFieldSchema | SeparatorFieldSchema | ButtonGroupFieldSchema<string | number> | ColorSelectFieldSchema | SectionLayoutSelectFieldSchema | BackgroundFieldSchema | ContentPositionFieldSchema;
237
+ /**
238
+ * Schema for per-item configuration in custom data sources.
239
+ * Widgets can define this to allow users to configure widget-specific
240
+ * settings for each selected item (e.g., title, description, button).
241
+ */
242
+ interface ItemConfigSchema {
243
+ /** Fields available for per-item configuration */
244
+ fields: PropertyField[];
245
+ /** Optional description shown at top of item config panel */
246
+ description?: string;
247
+ }
248
+ /**
249
+ * Schema for a widget's editable properties
250
+ */
251
+ interface WidgetPropertySchema {
252
+ /** Widget type this schema applies to */
253
+ widgetType: WidgetType;
254
+ /** Display name for the widget */
255
+ displayName: string;
256
+ /** Optional tab configuration - if present, tabs are enabled */
257
+ tabsConfig?: TabConfig[];
258
+ /** Editable property fields */
259
+ fields: PropertyField[];
260
+ /** Optional custom validator function */
261
+ validate?: (props: Record<string, unknown>) => string | null;
262
+ /** Props that can be populated from data sources */
263
+ dataSourceTargetProps?: string[];
264
+ /** Optional schema for per-item configurations in custom data sources */
265
+ itemConfigSchema?: ItemConfigSchema;
266
+ }
267
+ /**
268
+ * Registry mapping widget types to their property schemas
269
+ */
270
+ type PropertySchemaRegistry = Record<WidgetType, WidgetPropertySchema>;
271
+ /**
272
+ * Group property fields by their group property
273
+ */
274
+ declare function groupPropertyFields(fields: readonly PropertyField[]): Record<string, PropertyField[]>;
275
+ /**
276
+ * Extract current values from widget props based on property fields
277
+ */
278
+ declare function extractPropertyValues(widget: Readonly<WidgetSchema>, fields: readonly PropertyField[]): Record<string, unknown>;
279
+ /**
280
+ * Apply property values to widget props
281
+ */
282
+ declare function applyPropertyValues(widget: Readonly<WidgetSchema>, values: Readonly<Record<string, unknown>>): WidgetSchema;
283
+
284
+ declare const getColorField: (props: Readonly<Omit<ColorSelectFieldSchema, "type">>) => ColorSelectFieldSchema;
285
+ declare const getBorderRadiusField: (props: Readonly<Omit<ButtonGroupFieldSchema<BorderRadiusOptions>, "options" | "type">>) => ButtonGroupFieldSchema<BorderRadiusOptions>;
286
+ declare const getPaddingField: (props: Readonly<Omit<ButtonGroupFieldSchema<PaddingOptions>, "options" | "type">>) => ButtonGroupFieldSchema<PaddingOptions>;
287
+ declare const getButtonSizeField: (props: Readonly<Omit<ButtonGroupFieldSchema<ButtonSizeOptions>, "options" | "type">>) => ButtonGroupFieldSchema<ButtonSizeOptions>;
288
+ declare const getFontSizeField: (props: Readonly<Omit<SelectFieldSchema<FontSizeOptions>, "options" | "type">>) => SelectFieldSchema<FontSizeOptions>;
289
+ declare const getGapField: (props: Readonly<Omit<ButtonGroupFieldSchema<GapOptions>, "options" | "type">>) => ButtonGroupFieldSchema<GapOptions>;
290
+ /**
291
+ * Gap value mapping - use `as const satisfies` for compile-time validation
292
+ * with literal type preservation.
293
+ */
294
+ declare const gapValues: {
295
+ readonly none: 0;
296
+ readonly xs: 1;
297
+ readonly sm: 2;
298
+ readonly md: 4;
299
+ readonly lg: 6;
300
+ readonly xl: 8;
301
+ };
302
+
303
+ export { type AlignmentFieldSchema, type BackgroundFieldSchema, type BooleanFieldSchema, type ButtonGroupFieldSchema, type ColorFieldSchema, type ColorPickerFieldSchema, type ColorSelectFieldSchema, type ContentPositionFieldSchema, type DataSourceFieldSchema, 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 TextareaFieldSchema, type WidgetPropertySchema, applyPropertyValues, extractPropertyValues, gapValues, getBorderRadiusField, getButtonSizeField, getColorField, getFontSizeField, getGapField, getPaddingField, groupPropertyFields, isPropertyFieldType };
@@ -0,0 +1,143 @@
1
+ // src/registries/property-schema-types.ts
2
+ var PROPERTY_FIELD_TYPES = {
3
+ text: "text",
4
+ textarea: "textarea",
5
+ number: "number",
6
+ boolean: "boolean",
7
+ select: "select",
8
+ color: "color",
9
+ range: "range",
10
+ dataSource: "dataSource",
11
+ resource: "resource",
12
+ alignment: "alignment",
13
+ slider: "slider",
14
+ colorPicker: "colorPicker",
15
+ sectionHeader: "sectionHeader",
16
+ separator: "separator",
17
+ buttonGroup: "buttonGroup",
18
+ colorSelect: "colorSelect",
19
+ sectionLayoutSelect: "sectionLayoutSelect",
20
+ background: "background",
21
+ contentPosition: "contentPosition"
22
+ };
23
+ function isPropertyFieldType(value) {
24
+ return Object.values(PROPERTY_FIELD_TYPES).includes(
25
+ value
26
+ );
27
+ }
28
+ function groupPropertyFields(fields) {
29
+ const grouped = {};
30
+ fields.forEach((field) => {
31
+ const group = field.group || "General";
32
+ if (!grouped[group]) {
33
+ grouped[group] = [];
34
+ }
35
+ grouped[group].push(field);
36
+ });
37
+ return grouped;
38
+ }
39
+ function extractPropertyValues(widget, fields) {
40
+ const values = {};
41
+ fields.forEach((field) => {
42
+ const value = widget.props[field.key];
43
+ values[field.key] = value !== void 0 ? value : field.defaultValue;
44
+ });
45
+ return values;
46
+ }
47
+ function applyPropertyValues(widget, values) {
48
+ return {
49
+ ...widget,
50
+ props: {
51
+ ...widget.props,
52
+ ...values
53
+ }
54
+ };
55
+ }
56
+
57
+ // src/registries/field-helpers.ts
58
+ var getColorField = (props) => {
59
+ return {
60
+ ...props,
61
+ type: "colorSelect"
62
+ };
63
+ };
64
+ var getBorderRadiusField = (props) => {
65
+ return {
66
+ ...props,
67
+ type: "buttonGroup",
68
+ options: [
69
+ { label: "None", value: "none" },
70
+ { label: "SM", value: "sm" },
71
+ { label: "MD", value: "md" },
72
+ { label: "LG", value: "lg" },
73
+ { label: "XL", value: "xl" },
74
+ { label: "FULL", value: "full" }
75
+ ]
76
+ };
77
+ };
78
+ var getPaddingField = (props) => {
79
+ return {
80
+ ...props,
81
+ type: "buttonGroup",
82
+ options: [
83
+ { label: "None", value: 0 },
84
+ { label: "SM", value: 2 },
85
+ { label: "MD", value: 4 },
86
+ { label: "LG", value: 6 },
87
+ { label: "XL", value: 8 },
88
+ { label: "FULL", value: 10 }
89
+ ]
90
+ };
91
+ };
92
+ var getButtonSizeField = (props) => {
93
+ return {
94
+ ...props,
95
+ type: "buttonGroup",
96
+ options: [
97
+ { label: "SM", value: "sm" },
98
+ { label: "MD", value: "default" },
99
+ { label: "LG", value: "lg" },
100
+ { label: "XL", value: "xl" }
101
+ ]
102
+ };
103
+ };
104
+ var getFontSizeField = (props) => {
105
+ return {
106
+ ...props,
107
+ type: "select",
108
+ options: [
109
+ { label: "Giant", value: "2xl" },
110
+ { label: "Extra Large", value: "xl" },
111
+ { label: "Large", value: "lg" },
112
+ { label: "Regular", value: "md" },
113
+ { label: "Small", value: "sm" },
114
+ { label: "Extra Small", value: "xs" }
115
+ ]
116
+ };
117
+ };
118
+ var getGapField = (props) => {
119
+ return {
120
+ ...props,
121
+ type: "buttonGroup",
122
+ options: [
123
+ { label: "None", value: "none" },
124
+ { label: "XS", value: "xs" },
125
+ { label: "SM", value: "sm" },
126
+ { label: "MD", value: "md" },
127
+ { label: "LG", value: "lg" },
128
+ { label: "XL", value: "xl" }
129
+ ]
130
+ };
131
+ };
132
+ var gapValues = {
133
+ none: 0,
134
+ xs: 1,
135
+ sm: 2,
136
+ md: 4,
137
+ lg: 6,
138
+ xl: 8
139
+ };
140
+
141
+ export { PROPERTY_FIELD_TYPES, applyPropertyValues, extractPropertyValues, gapValues, getBorderRadiusField, getButtonSizeField, getColorField, getFontSizeField, getGapField, getPaddingField, groupPropertyFields, isPropertyFieldType };
142
+ //# sourceMappingURL=index.js.map
143
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/registries/property-schema-types.ts","../../src/registries/field-helpers.ts"],"names":[],"mappings":";AA2BO,IAAM,oBAAA,GAAuB;AAAA,EAClC,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,UAAA;AAAA,EACV,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ,QAAA;AAAA,EACR,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,UAAA,EAAY,YAAA;AAAA,EACZ,QAAA,EAAU,UAAA;AAAA,EACV,SAAA,EAAW,WAAA;AAAA,EACX,MAAA,EAAQ,QAAA;AAA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Q,KAAA,EAAO,MAAA,EAAO;AAAA,MAC/B,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,EAAK;AAAA,MAC3B,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,EAAK;AAAA,MAC3B,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,EAAK;AAAA,MAC3B,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,EAAK;AAAA,MAC3B,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA;AAAK;AAC7B,GACF;AACF;AAMO,IAAM,SAAA,GAAY;AAAA,EACvB,IAAA,EAAM,CAAA;AAAA,EACN,EAAA,EAAI,CAAA;AAAA,EACJ,EAAA,EAAI,CAAA;AAAA,EACJ,EAAA,EAAI,CAAA;AAAA,EACJ,EAAA,EAAI,CAAA;AAAA,EACJ,EAAA,EAAI;AACN","file":"index.js","sourcesContent":["import type {\n WidgetType,\n WidgetSchema,\n AlignOptions,\n ColorOptions,\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 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} 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<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 * 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; 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 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 * 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 | AlignmentFieldSchema\n | SliderFieldSchema\n | ColorPickerFieldSchema\n | SectionHeaderFieldSchema\n | SeparatorFieldSchema\n | ButtonGroupFieldSchema<string | number>\n | ColorSelectFieldSchema\n | SectionLayoutSelectFieldSchema\n | BackgroundFieldSchema\n | ContentPositionFieldSchema;\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 SelectFieldSchema,\n} from \"./property-schema-types\";\nimport type {\n BorderRadiusOptions,\n FontSizeOptions,\n PaddingOptions,\n ButtonSizeOptions,\n GapOptions,\n} from \"../types\";\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 { label: \"None\", 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 { label: \"None\", 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<SelectFieldSchema<FontSizeOptions>, \"options\" | \"type\">>,\n): SelectFieldSchema<FontSizeOptions> => {\n return {\n ...props,\n type: \"select\",\n options: [\n { label: \"Giant\", value: \"2xl\" },\n { label: \"Extra Large\", value: \"xl\" },\n { label: \"Large\", value: \"lg\" },\n { label: \"Regular\", value: \"md\" },\n { label: \"Small\", value: \"sm\" },\n { label: \"Extra Small\", value: \"xs\" },\n ],\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 { label: \"None\", 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\n/**\n * Gap value mapping - use `as const satisfies` for compile-time validation\n * with literal type preservation.\n */\nexport const gapValues = {\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"]}
@@ -0,0 +1,138 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ /**
4
+ * Widget type names as a const object.
5
+ * This serves as the single source of truth for widget discriminants.
6
+ * Use `as const` for literal type inference (safety-as-const-deep-readonly rule).
7
+ */
8
+ declare const WIDGET_TYPE_NAMES: {
9
+ readonly Alert: "AlertWidget";
10
+ readonly Calendar: "CalendarWidget";
11
+ readonly Carousel: "CarouselWidget";
12
+ readonly CatchUp: "CatchUpWidget";
13
+ readonly Chart: "ChartWidget";
14
+ readonly Container: "ContainerWidget";
15
+ readonly Embed: "EmbedWidget";
16
+ readonly Image: "ImageWidget";
17
+ readonly Layout: "LayoutWidget";
18
+ readonly List: "ListWidget";
19
+ readonly MySite: "MySiteWidget";
20
+ readonly Nested: "NestedWidget";
21
+ readonly QuickShare: "QuickShareWidget";
22
+ readonly RecentActivity: "RecentActivityWidget";
23
+ readonly Spacer: "SpacerWidget";
24
+ readonly Table: "TableWidget";
25
+ readonly Text: "TextWidget";
26
+ readonly ToDo: "ToDoWidget";
27
+ readonly Video: "VideoWidget";
28
+ };
29
+ /**
30
+ * Union of all known widget type names.
31
+ * Derived from WIDGET_TYPE_NAMES to avoid duplication (deriving-typeof-for-object-keys rule).
32
+ */
33
+ type WidgetTypeName = (typeof WIDGET_TYPE_NAMES)[keyof typeof WIDGET_TYPE_NAMES];
34
+ /**
35
+ * Legacy alias for backwards compatibility.
36
+ * Prefer using WidgetTypeName for new code when you need the union type.
37
+ */
38
+ type WidgetType = string;
39
+ type WidgetRegistry = Record<WidgetType, ComponentType<any>>;
40
+ /**
41
+ * Base widget schema with loose typing for runtime data.
42
+ * Use TypedWidgetSchema<T> when you have a known registry for better type safety.
43
+ */
44
+ type WidgetSchema = {
45
+ readonly type: WidgetType;
46
+ readonly props: Readonly<Record<string, unknown>>;
47
+ readonly id?: string;
48
+ /** Column index for masonry layouts (0-indexed) */
49
+ readonly columnIndex?: number;
50
+ };
51
+ /**
52
+ * Type-safe widget schema based on registry.
53
+ * Uses discriminated unions - the `type` field serves as discriminant.
54
+ * When narrowed (e.g., `if (widget.type === "AlertWidget")`),
55
+ * TypeScript automatically knows the correct props type.
56
+ */
57
+ type TypedWidgetSchema<T extends Record<string, ComponentType<any>>> = {
58
+ [K in keyof T]: {
59
+ readonly type: K;
60
+ readonly props: Readonly<React.ComponentProps<T[K]>>;
61
+ readonly id?: string;
62
+ /** Column index for masonry layouts (0-indexed) */
63
+ readonly columnIndex?: number;
64
+ };
65
+ }[keyof T];
66
+ /**
67
+ * Widget path in the tree - array of indices.
68
+ * Readonly tuple to prevent accidental mutation.
69
+ */
70
+ type WidgetPath = readonly number[];
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
+ */
80
+ declare function isWidgetTypeName(type: string): type is WidgetTypeName;
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
+ */
91
+ declare function isWidgetType<T extends WidgetTypeName>(widget: WidgetSchema | null | undefined, typeName: T): widget is WidgetSchema & {
92
+ readonly type: T;
93
+ };
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
+ */
106
+ declare function assertNever(value: never, context?: string): never;
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
+ */
116
+ declare function assertDefined<T>(value: T | undefined | null, name?: string): asserts value is T;
117
+
118
+ /**
119
+ * Base props for a shareable item.
120
+ * Uses structural typing to be compatible with various modal implementations.
121
+ * The index signature allows additional properties from consuming apps.
122
+ */
123
+ interface ShareableItem {
124
+ id: string | number;
125
+ title?: string | null;
126
+ image_url?: string | null;
127
+ imageUrl?: string | null;
128
+ kind?: string | null;
129
+ type?: string | null;
130
+ shareableType?: string | null;
131
+ share_link?: string | null;
132
+ videoUrl?: string;
133
+ price?: string | number | null;
134
+ display_price?: string | null;
135
+ [key: string]: unknown;
136
+ }
137
+
138
+ export { type ShareableItem as S, type TypedWidgetSchema as T, type WidgetPath as W, type WidgetSchema as a, type WidgetType as b, type WidgetTypeName as c, type WidgetRegistry as d, WIDGET_TYPE_NAMES as e, isWidgetType as f, assertNever as g, assertDefined as h, isWidgetTypeName as i };