@fluid-app/portal-core 0.1.19 → 0.1.20
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.
- package/dist/registries/index.d.cts +3 -315
- package/dist/registries/index.d.cts.map +1 -1
- package/dist/registries/index.d.mts +3 -315
- package/dist/registries/index.d.mts.map +1 -1
- package/dist/widget-manifest-DQmTtAF1.d.mts +373 -0
- package/dist/widget-manifest-DQmTtAF1.d.mts.map +1 -0
- package/dist/widget-manifest-Ei8Wnspj.d.cts +373 -0
- package/dist/widget-manifest-Ei8Wnspj.d.cts.map +1 -0
- package/dist/widget-utils/index.cjs +7 -2
- package/dist/widget-utils/index.cjs.map +1 -1
- package/dist/widget-utils/index.d.cts +2 -1
- package/dist/widget-utils/index.d.cts.map +1 -1
- package/dist/widget-utils/index.d.mts +2 -1
- package/dist/widget-utils/index.d.mts.map +1 -1
- package/dist/widget-utils/index.mjs +7 -2
- package/dist/widget-utils/index.mjs.map +1 -1
- package/package.json +8 -1
|
@@ -1,318 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as
|
|
3
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
1
|
+
import { c as BorderRadiusOptions, h as GapOptions, l as ButtonSizeOptions, y as PaddingOptions } from "../index-B5cTNde-.cjs";
|
|
2
|
+
import { A as TextFieldSchema, C as ResourceFieldSchema, D as SeparatorFieldSchema, E as SelectFieldSchema, F as extractPropertyValues, I as groupPropertyFields, L as isPropertyFieldType, M as TextareaFieldSchema, N as WidgetPropertySchema, O as SliderFieldSchema, P as applyPropertyValues, S as RangeFieldSchema, T as SectionLayoutSelectFieldSchema, _ as PROPERTY_FIELD_TYPES, a as BooleanFieldSchema, b as PropertyFieldType, c as ColorPickerFieldSchema, d as CssUnit, f as CssUnitFieldSchema, g as NumberFieldSchema, h as ItemConfigSchema, i as BackgroundFieldSchema, j as TextSizeSelectFieldSchema, k as TabConfig, l as ColorSelectFieldSchema, m as ImageFieldSchema, n as ContainerWidgetBehavior, o as ButtonGroupFieldSchema, p as DataSourceFieldSchema, r as AlignmentFieldSchema, s as ColorFieldSchema, t as WidgetManifest, u as ContentPositionFieldSchema, v as PropertyField, w as SectionHeaderFieldSchema, x as PropertySchemaRegistry, y as PropertyFieldSchema } from "../widget-manifest-Ei8Wnspj.cjs";
|
|
4
3
|
|
|
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
|
-
minByUnit?: Partial<Record<CssUnit, number>>;
|
|
260
|
-
maxByUnit?: Partial<Record<CssUnit, number>>;
|
|
261
|
-
stepByUnit?: Partial<Record<CssUnit, 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
4
|
//#region src/registries/field-helpers.d.ts
|
|
317
5
|
declare const getColorField: (props: Readonly<Omit<ColorSelectFieldSchema, "type">>) => ColorSelectFieldSchema;
|
|
318
6
|
declare const getBorderRadiusField: (props: Readonly<Omit<ButtonGroupFieldSchema<BorderRadiusOptions>, "options" | "type">>) => ButtonGroupFieldSchema<BorderRadiusOptions>;
|
|
@@ -334,5 +22,5 @@ declare const gapValues: {
|
|
|
334
22
|
readonly xl: 8;
|
|
335
23
|
};
|
|
336
24
|
//#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 };
|
|
25
|
+
export { type AlignmentFieldSchema, type BackgroundFieldSchema, type BooleanFieldSchema, type ButtonGroupFieldSchema, type ColorFieldSchema, type ColorPickerFieldSchema, type ColorSelectFieldSchema, type ContainerWidgetBehavior, 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 WidgetManifest, type WidgetPropertySchema, applyPropertyValues, extractPropertyValues, gapValues, getBorderRadiusField, getButtonSizeField, getColorField, getFontSizeField, getGapField, getHeightField, getPaddingField, groupPropertyFields, isPropertyFieldType };
|
|
338
26
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/registries/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/registries/field-helpers.ts"],"mappings":";;;;cAca,aAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,sBAAA,eACpB,sBAAA;AAAA,cAOU,oBAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,mBAAA,4BAE7B,sBAAA,CAAuB,mBAAA;AAAA,cAeb,eAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,cAAA,4BAE7B,sBAAA,CAAuB,cAAA;AAAA,cAeb,kBAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,iBAAA,4BAE7B,sBAAA,CAAuB,iBAAA;AAAA,cAab,gBAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,yBAAA,eACpB,yBAAA;AAAA,cAOU,WAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,sBAAA,CAAuB,UAAA,4BAC3C,sBAAA,CAAuB,UAAA;AAAA,cAeb,cAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CACE,kBAAA,2EAIH,kBAAA;;;;;cAeU,SAAA;EAAA,SACF,IAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;AAAA"}
|
|
@@ -1,318 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as
|
|
3
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
1
|
+
import { c as BorderRadiusOptions, h as GapOptions, l as ButtonSizeOptions, y as PaddingOptions } from "../index-Cqt2JzkQ.mjs";
|
|
2
|
+
import { A as TextFieldSchema, C as ResourceFieldSchema, D as SeparatorFieldSchema, E as SelectFieldSchema, F as extractPropertyValues, I as groupPropertyFields, L as isPropertyFieldType, M as TextareaFieldSchema, N as WidgetPropertySchema, O as SliderFieldSchema, P as applyPropertyValues, S as RangeFieldSchema, T as SectionLayoutSelectFieldSchema, _ as PROPERTY_FIELD_TYPES, a as BooleanFieldSchema, b as PropertyFieldType, c as ColorPickerFieldSchema, d as CssUnit, f as CssUnitFieldSchema, g as NumberFieldSchema, h as ItemConfigSchema, i as BackgroundFieldSchema, j as TextSizeSelectFieldSchema, k as TabConfig, l as ColorSelectFieldSchema, m as ImageFieldSchema, n as ContainerWidgetBehavior, o as ButtonGroupFieldSchema, p as DataSourceFieldSchema, r as AlignmentFieldSchema, s as ColorFieldSchema, t as WidgetManifest, u as ContentPositionFieldSchema, v as PropertyField, w as SectionHeaderFieldSchema, x as PropertySchemaRegistry, y as PropertyFieldSchema } from "../widget-manifest-DQmTtAF1.mjs";
|
|
4
3
|
|
|
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
|
-
minByUnit?: Partial<Record<CssUnit, number>>;
|
|
260
|
-
maxByUnit?: Partial<Record<CssUnit, number>>;
|
|
261
|
-
stepByUnit?: Partial<Record<CssUnit, 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
4
|
//#region src/registries/field-helpers.d.ts
|
|
317
5
|
declare const getColorField: (props: Readonly<Omit<ColorSelectFieldSchema, "type">>) => ColorSelectFieldSchema;
|
|
318
6
|
declare const getBorderRadiusField: (props: Readonly<Omit<ButtonGroupFieldSchema<BorderRadiusOptions>, "options" | "type">>) => ButtonGroupFieldSchema<BorderRadiusOptions>;
|
|
@@ -334,5 +22,5 @@ declare const gapValues: {
|
|
|
334
22
|
readonly xl: 8;
|
|
335
23
|
};
|
|
336
24
|
//#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 };
|
|
25
|
+
export { type AlignmentFieldSchema, type BackgroundFieldSchema, type BooleanFieldSchema, type ButtonGroupFieldSchema, type ColorFieldSchema, type ColorPickerFieldSchema, type ColorSelectFieldSchema, type ContainerWidgetBehavior, 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 WidgetManifest, type WidgetPropertySchema, applyPropertyValues, extractPropertyValues, gapValues, getBorderRadiusField, getButtonSizeField, getColorField, getFontSizeField, getGapField, getHeightField, getPaddingField, groupPropertyFields, isPropertyFieldType };
|
|
338
26
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/registries/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/registries/field-helpers.ts"],"mappings":";;;;cAca,aAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,sBAAA,eACpB,sBAAA;AAAA,cAOU,oBAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,mBAAA,4BAE7B,sBAAA,CAAuB,mBAAA;AAAA,cAeb,eAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,cAAA,4BAE7B,sBAAA,CAAuB,cAAA;AAAA,cAeb,kBAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CAAK,sBAAA,CAAuB,iBAAA,4BAE7B,sBAAA,CAAuB,iBAAA;AAAA,cAab,gBAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,yBAAA,eACpB,yBAAA;AAAA,cAOU,WAAA,GACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,sBAAA,CAAuB,UAAA,4BAC3C,sBAAA,CAAuB,UAAA;AAAA,cAeb,cAAA,GACX,KAAA,EAAO,QAAA,CACL,IAAA,CACE,kBAAA,2EAIH,kBAAA;;;;;cAeU,SAAA;EAAA,SACF,IAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;EAAA,SACA,EAAA;AAAA"}
|