@dotcms/uve 1.2.1-next.12 → 1.2.1-next.14
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/README.md +1143 -0
- package/index.cjs.js +96 -183
- package/index.esm.js +97 -183
- package/internal.cjs.js +0 -4
- package/internal.esm.js +1 -1
- package/package.json +1 -1
- package/public.cjs.js +8 -78
- package/public.esm.js +9 -75
- package/src/internal/constants.d.ts +0 -2
- package/src/lib/core/core.utils.d.ts +0 -48
- package/src/lib/dom/dom.utils.d.ts +1 -10
- package/src/lib/style-editor/internal.d.ts +7 -7
- package/src/lib/style-editor/public.d.ts +83 -165
- package/src/lib/style-editor/types.d.ts +72 -179
package/index.cjs.js
CHANGED
|
@@ -12,13 +12,11 @@ require('@dotcms/types/internal');
|
|
|
12
12
|
* This transformation ensures consistency in the schema format sent to UVE.
|
|
13
13
|
*
|
|
14
14
|
* **Field Type Handling:**
|
|
15
|
-
* - **Input fields**: Extracts `inputType
|
|
16
|
-
* - **Dropdown fields**: Normalizes options (strings become `{ label, value }` objects)
|
|
17
|
-
* extracts `placeholder` and `defaultValue` into config
|
|
15
|
+
* - **Input fields**: Extracts `inputType` and `placeholder` into config
|
|
16
|
+
* - **Dropdown fields**: Normalizes options (strings become `{ label, value }` objects)
|
|
18
17
|
* - **Radio fields**: Normalizes options (preserves image properties like `imageURL`, `width`, `height`),
|
|
19
|
-
* extracts `
|
|
20
|
-
* - **Checkbox group fields**: Normalizes options
|
|
21
|
-
* (creates Record<string, boolean> mapping option keys to their boolean values)
|
|
18
|
+
* extracts `columns` into config
|
|
19
|
+
* - **Checkbox group fields**: Normalizes options (converts to format expected by UVE)
|
|
22
20
|
*
|
|
23
21
|
* @experimental This method is experimental and may be subject to change.
|
|
24
22
|
*
|
|
@@ -30,15 +28,16 @@ require('@dotcms/types/internal');
|
|
|
30
28
|
* // Input field normalization
|
|
31
29
|
* normalizeField({
|
|
32
30
|
* type: 'input',
|
|
31
|
+
* id: 'font-size',
|
|
33
32
|
* label: 'Font Size',
|
|
34
33
|
* inputType: 'number',
|
|
35
|
-
* defaultValue: 16,
|
|
36
34
|
* placeholder: 'Enter size'
|
|
37
35
|
* })
|
|
38
36
|
* // Returns: {
|
|
39
37
|
* // type: 'input',
|
|
38
|
+
* // id: 'font-size',
|
|
40
39
|
* // label: 'Font Size',
|
|
41
|
-
* // config: { inputType: 'number',
|
|
40
|
+
* // config: { inputType: 'number', placeholder: 'Enter size' }
|
|
42
41
|
* // }
|
|
43
42
|
*
|
|
44
43
|
* // Dropdown field with string options normalization
|
|
@@ -65,7 +64,6 @@ function normalizeField(field) {
|
|
|
65
64
|
if (field.type === 'input') {
|
|
66
65
|
config.inputType = field.inputType;
|
|
67
66
|
config.placeholder = field.placeholder;
|
|
68
|
-
config.defaultValue = field.defaultValue;
|
|
69
67
|
}
|
|
70
68
|
if (field.type === 'dropdown' || field.type === 'radio') {
|
|
71
69
|
// Normalize options to consistent format
|
|
@@ -73,7 +71,6 @@ function normalizeField(field) {
|
|
|
73
71
|
label: opt,
|
|
74
72
|
value: opt
|
|
75
73
|
} : opt);
|
|
76
|
-
config.defaultValue = field.defaultValue;
|
|
77
74
|
// Handle radio-specific properties
|
|
78
75
|
if (field.type === 'radio') {
|
|
79
76
|
config.columns = field.columns;
|
|
@@ -81,16 +78,11 @@ function normalizeField(field) {
|
|
|
81
78
|
}
|
|
82
79
|
if (field.type === 'checkboxGroup') {
|
|
83
80
|
// Normalize checkbox options - convert to format expected by UVE
|
|
84
|
-
// Options
|
|
81
|
+
// Options have label and key - convert key to 'value' for UVE format
|
|
85
82
|
config.options = field.options.map(opt => ({
|
|
86
83
|
label: opt.label,
|
|
87
84
|
value: opt.key // UVE expects 'value' to be the key identifier
|
|
88
85
|
}));
|
|
89
|
-
// Derive defaultValue from options - map key to boolean value
|
|
90
|
-
config.defaultValue = field.options.reduce((acc, opt) => {
|
|
91
|
-
acc[opt.key] = opt.value;
|
|
92
|
-
return acc;
|
|
93
|
-
}, {});
|
|
94
86
|
}
|
|
95
87
|
return {
|
|
96
88
|
...base,
|
|
@@ -180,14 +172,14 @@ function normalizeSection(section) {
|
|
|
180
172
|
* {
|
|
181
173
|
* title: 'Typography',
|
|
182
174
|
* fields: [
|
|
183
|
-
* { type: 'input', label: 'Font Size', inputType: 'number'
|
|
184
|
-
* { type: 'dropdown', label: 'Font Family', options: ['Arial', 'Helvetica'] }
|
|
175
|
+
* { type: 'input', id: 'font-size', label: 'Font Size', inputType: 'number' },
|
|
176
|
+
* { type: 'dropdown', id: 'font-family', label: 'Font Family', options: ['Arial', 'Helvetica'] }
|
|
185
177
|
* ]
|
|
186
178
|
* },
|
|
187
179
|
* {
|
|
188
180
|
* title: 'Colors',
|
|
189
181
|
* fields: [
|
|
190
|
-
* { type: 'input', label: 'Primary Color', inputType: 'text'
|
|
182
|
+
* { type: 'input', id: 'primary-color', label: 'Primary Color', inputType: 'text' }
|
|
191
183
|
* ]
|
|
192
184
|
* }
|
|
193
185
|
* ]
|
|
@@ -199,8 +191,8 @@ function normalizeSection(section) {
|
|
|
199
191
|
* // title: 'Typography',
|
|
200
192
|
* // fields: [
|
|
201
193
|
* // [
|
|
202
|
-
* // { type: 'input', label: 'Font Size', config: { inputType: 'number'
|
|
203
|
-
* // { type: 'dropdown', label: 'Font Family', config: { options: [...] } }
|
|
194
|
+
* // { type: 'input', id: 'font-size', label: 'Font Size', config: { inputType: 'number' } },
|
|
195
|
+
* // { type: 'dropdown', id: 'font-family', label: 'Font Family', config: { options: [...] } }
|
|
204
196
|
* // ]
|
|
205
197
|
* // ]
|
|
206
198
|
* // },
|
|
@@ -208,7 +200,7 @@ function normalizeSection(section) {
|
|
|
208
200
|
* // title: 'Colors',
|
|
209
201
|
* // fields: [
|
|
210
202
|
* // [
|
|
211
|
-
* // { type: 'input', label: 'Primary Color', config: { inputType: 'text'
|
|
203
|
+
* // { type: 'input', id: 'primary-color', label: 'Primary Color', config: { inputType: 'text' } }
|
|
212
204
|
* // ]
|
|
213
205
|
* // ]
|
|
214
206
|
* // }
|
|
@@ -252,19 +244,19 @@ function normalizeForm(form) {
|
|
|
252
244
|
* title: 'Typography',
|
|
253
245
|
* fields: [
|
|
254
246
|
* styleEditorField.input({
|
|
247
|
+
* id: 'font-size',
|
|
255
248
|
* label: 'Font Size',
|
|
256
|
-
* inputType: 'number'
|
|
257
|
-
* defaultValue: 16
|
|
249
|
+
* inputType: 'number'
|
|
258
250
|
* }),
|
|
259
251
|
* styleEditorField.dropdown({
|
|
252
|
+
* id: 'font-family',
|
|
260
253
|
* label: 'Font Family',
|
|
261
|
-
* options: ['Arial', 'Helvetica']
|
|
262
|
-
* defaultValue: 'Arial'
|
|
254
|
+
* options: ['Arial', 'Helvetica']
|
|
263
255
|
* }),
|
|
264
256
|
* styleEditorField.radio({
|
|
257
|
+
* id: 'alignment',
|
|
265
258
|
* label: 'Alignment',
|
|
266
|
-
* options: ['Left', 'Center', 'Right']
|
|
267
|
-
* defaultValue: 'Left'
|
|
259
|
+
* options: ['Left', 'Center', 'Right']
|
|
268
260
|
* })
|
|
269
261
|
* ]
|
|
270
262
|
* }
|
|
@@ -274,49 +266,36 @@ function normalizeForm(form) {
|
|
|
274
266
|
*/
|
|
275
267
|
const styleEditorField = {
|
|
276
268
|
/**
|
|
277
|
-
* Creates an input field definition
|
|
269
|
+
* Creates an input field definition.
|
|
278
270
|
*
|
|
279
|
-
* Supports both text and number input types
|
|
280
|
-
* enforced based on the `inputType` using TypeScript generics:
|
|
281
|
-
* - When `inputType` is `'number'`, `defaultValue` must be a `number`
|
|
282
|
-
* - When `inputType` is `'text'`, `defaultValue` must be a `string`
|
|
283
|
-
*
|
|
284
|
-
* This provides compile-time type checking to prevent mismatched types,
|
|
285
|
-
* such as passing a string when a number is expected.
|
|
271
|
+
* Supports both text and number input types for different value types.
|
|
286
272
|
*
|
|
287
273
|
* @experimental This method is experimental and may be subject to change.
|
|
288
274
|
*
|
|
289
275
|
* @typeParam T - The input type ('text' or 'number'), inferred from `config.inputType`
|
|
290
276
|
* @param config - Input field configuration
|
|
277
|
+
* @param config.id - The unique identifier for this field
|
|
291
278
|
* @param config.label - The label displayed for this input field
|
|
292
279
|
* @param config.inputType - The type of input ('text' or 'number')
|
|
293
280
|
* @param config.placeholder - Optional placeholder text for the input
|
|
294
|
-
* @param config.defaultValue - Optional default value (type enforced based on inputType)
|
|
295
281
|
* @returns A complete input field definition with type 'input'
|
|
296
282
|
*
|
|
297
283
|
* @example
|
|
298
284
|
* ```typescript
|
|
299
|
-
* // Number input
|
|
285
|
+
* // Number input
|
|
300
286
|
* styleEditorField.input({
|
|
287
|
+
* id: 'font-size',
|
|
301
288
|
* label: 'Font Size',
|
|
302
289
|
* inputType: 'number',
|
|
303
|
-
* placeholder: 'Enter font size'
|
|
304
|
-
* defaultValue: 16 // ✓ Correct: number
|
|
290
|
+
* placeholder: 'Enter font size'
|
|
305
291
|
* })
|
|
306
292
|
*
|
|
307
|
-
* // Text input
|
|
293
|
+
* // Text input
|
|
308
294
|
* styleEditorField.input({
|
|
295
|
+
* id: 'font-name',
|
|
309
296
|
* label: 'Font Name',
|
|
310
297
|
* inputType: 'text',
|
|
311
|
-
* placeholder: 'Enter font name'
|
|
312
|
-
* defaultValue: 'Arial' // ✓ Correct: string
|
|
313
|
-
* })
|
|
314
|
-
*
|
|
315
|
-
* // TypeScript error - type mismatch
|
|
316
|
-
* styleEditorField.input({
|
|
317
|
-
* label: 'Font Size',
|
|
318
|
-
* inputType: 'number',
|
|
319
|
-
* defaultValue: '16' // ✗ Error: Type 'string' is not assignable to type 'number'
|
|
298
|
+
* placeholder: 'Enter font name'
|
|
320
299
|
* })
|
|
321
300
|
* ```
|
|
322
301
|
*/
|
|
@@ -325,94 +304,62 @@ const styleEditorField = {
|
|
|
325
304
|
...config
|
|
326
305
|
}),
|
|
327
306
|
/**
|
|
328
|
-
* Creates a dropdown field definition
|
|
307
|
+
* Creates a dropdown field definition.
|
|
329
308
|
*
|
|
330
309
|
* Allows users to select a single value from a list of options.
|
|
331
310
|
* Options can be provided as simple strings or as objects with label and value.
|
|
332
311
|
*
|
|
333
|
-
* **
|
|
312
|
+
* **Best Practice:** Use `as const` when defining options for better type safety:
|
|
334
313
|
* ```typescript
|
|
335
|
-
* const
|
|
336
|
-
* { label: '
|
|
337
|
-
* { label: '
|
|
314
|
+
* const OPTIONS = [
|
|
315
|
+
* { label: '18', value: '18px' },
|
|
316
|
+
* { label: '24', value: '24px' }
|
|
338
317
|
* ] as const;
|
|
339
318
|
*
|
|
340
319
|
* styleEditorField.dropdown({
|
|
341
|
-
* id: '
|
|
342
|
-
* label: '
|
|
343
|
-
* options
|
|
344
|
-
*
|
|
345
|
-
* // defaultValue: 'three' // ✗ TypeScript error: not assignable
|
|
346
|
-
* })
|
|
347
|
-
* ```
|
|
348
|
-
*
|
|
349
|
-
* Without `as const`, the function still works but won't provide autocomplete:
|
|
350
|
-
* ```typescript
|
|
351
|
-
* styleEditorField.dropdown({
|
|
352
|
-
* id: 'my-field',
|
|
353
|
-
* label: 'Select option',
|
|
354
|
-
* options: [
|
|
355
|
-
* { label: 'The one', value: 'one' },
|
|
356
|
-
* { label: 'The two', value: 'two' }
|
|
357
|
-
* ],
|
|
358
|
-
* defaultValue: 'one' // Works, but no autocomplete
|
|
359
|
-
* })
|
|
320
|
+
* id: 'size',
|
|
321
|
+
* label: 'Size',
|
|
322
|
+
* options: OPTIONS
|
|
323
|
+
* });
|
|
360
324
|
* ```
|
|
361
325
|
*
|
|
362
326
|
* @experimental This method is experimental and may be subject to change.
|
|
363
327
|
*
|
|
364
|
-
* @typeParam TOptions - The options array type (inferred from config, use `as const` for type safety)
|
|
365
328
|
* @param config - Dropdown field configuration (without the 'type' property)
|
|
366
329
|
* @param config.id - The unique identifier for this field
|
|
367
330
|
* @param config.label - The label displayed for this dropdown field
|
|
368
|
-
* @param config.options - Array of options. Use `as const` for type safety
|
|
369
|
-
* @param config.defaultValue - Optional default selected value (type-safe when options are `as const`)
|
|
331
|
+
* @param config.options - Array of options. Can be strings or objects with label and value. Use `as const` for best type safety.
|
|
370
332
|
* @returns A complete dropdown field definition with type 'dropdown'
|
|
371
333
|
*
|
|
372
334
|
* @example
|
|
373
335
|
* ```typescript
|
|
374
|
-
* // With type safety - use 'as const' for autocomplete
|
|
375
|
-
* const options = [
|
|
376
|
-
* { label: 'The one', value: 'one' },
|
|
377
|
-
* { label: 'The two', value: 'two' }
|
|
378
|
-
* ] as const;
|
|
379
|
-
*
|
|
380
|
-
* styleEditorField.dropdown({
|
|
381
|
-
* id: 'my-field',
|
|
382
|
-
* label: 'Select option',
|
|
383
|
-
* options,
|
|
384
|
-
* defaultValue: 'one' // ✓ Autocomplete works!
|
|
385
|
-
* })
|
|
386
|
-
*
|
|
387
336
|
* // Simple string options
|
|
388
337
|
* styleEditorField.dropdown({
|
|
389
338
|
* id: 'font-family',
|
|
390
339
|
* label: 'Font Family',
|
|
391
|
-
* options: ['Arial', 'Helvetica', 'Times New Roman']
|
|
392
|
-
* defaultValue: 'Arial',
|
|
393
|
-
* placeholder: 'Select a font'
|
|
340
|
+
* options: ['Arial', 'Helvetica', 'Times New Roman']
|
|
394
341
|
* })
|
|
395
342
|
*
|
|
396
|
-
* // Object options with custom labels
|
|
343
|
+
* // Object options with custom labels (recommended: use 'as const')
|
|
344
|
+
* const OPTIONS = [
|
|
345
|
+
* { label: 'Light Theme', value: 'light' },
|
|
346
|
+
* { label: 'Dark Theme', value: 'dark' }
|
|
347
|
+
* ] as const;
|
|
348
|
+
*
|
|
397
349
|
* styleEditorField.dropdown({
|
|
398
350
|
* id: 'theme',
|
|
399
351
|
* label: 'Theme',
|
|
400
|
-
* options:
|
|
401
|
-
* { label: 'Light Theme', value: 'light' },
|
|
402
|
-
* { label: 'Dark Theme', value: 'dark' }
|
|
403
|
-
* ],
|
|
404
|
-
* defaultValue: 'light'
|
|
352
|
+
* options: OPTIONS
|
|
405
353
|
* })
|
|
406
354
|
* ```
|
|
407
355
|
*/
|
|
408
356
|
dropdown: config => ({
|
|
409
357
|
type: 'dropdown',
|
|
410
358
|
...config,
|
|
411
|
-
options: config.options
|
|
412
|
-
defaultValue: config.defaultValue
|
|
359
|
+
options: config.options
|
|
413
360
|
}),
|
|
414
361
|
/**
|
|
415
|
-
* Creates a radio button field definition
|
|
362
|
+
* Creates a radio button field definition.
|
|
416
363
|
*
|
|
417
364
|
* Allows users to select a single option from a list. Supports visual
|
|
418
365
|
* options with background images for enhanced UI. Options can be provided
|
|
@@ -422,97 +369,66 @@ const styleEditorField = {
|
|
|
422
369
|
* - `columns: 1` (default): Single column list layout
|
|
423
370
|
* - `columns: 2`: Two-column grid layout, ideal for visual options with images
|
|
424
371
|
*
|
|
425
|
-
* **
|
|
372
|
+
* **Best Practice:** Use `as const` when defining options for better type safety:
|
|
426
373
|
* ```typescript
|
|
427
|
-
* const
|
|
428
|
-
* { label: '
|
|
429
|
-
* { label: '
|
|
374
|
+
* const RADIO_OPTIONS = [
|
|
375
|
+
* { label: 'Left', value: 'left' },
|
|
376
|
+
* { label: 'Right', value: 'right' }
|
|
430
377
|
* ] as const;
|
|
431
378
|
*
|
|
432
379
|
* styleEditorField.radio({
|
|
433
|
-
* id: '
|
|
434
|
-
* label: '
|
|
435
|
-
* options
|
|
436
|
-
*
|
|
437
|
-
* // defaultValue: 'three' // ✗ TypeScript error: not assignable
|
|
438
|
-
* })
|
|
439
|
-
* ```
|
|
440
|
-
*
|
|
441
|
-
* Without `as const`, the function still works but won't provide autocomplete:
|
|
442
|
-
* ```typescript
|
|
443
|
-
* styleEditorField.radio({
|
|
444
|
-
* id: 'my-field',
|
|
445
|
-
* label: 'Select option',
|
|
446
|
-
* options: [
|
|
447
|
-
* { label: 'The one', value: 'one' },
|
|
448
|
-
* { label: 'The two', value: 'two' }
|
|
449
|
-
* ],
|
|
450
|
-
* defaultValue: 'one' // Works, but no autocomplete
|
|
451
|
-
* })
|
|
380
|
+
* id: 'layout',
|
|
381
|
+
* label: 'Layout',
|
|
382
|
+
* options: RADIO_OPTIONS
|
|
383
|
+
* });
|
|
452
384
|
* ```
|
|
453
385
|
*
|
|
454
386
|
* @experimental This method is experimental and may be subject to change.
|
|
455
387
|
*
|
|
456
|
-
* @typeParam TOptions - The options array type (inferred from config, use `as const` for type safety)
|
|
457
388
|
* @param config - Radio field configuration (without the 'type' property)
|
|
458
389
|
* @param config.id - The unique identifier for this field
|
|
459
390
|
* @param config.label - The label displayed for this radio group
|
|
460
|
-
* @param config.options - Array of options. Use `as const` for type safety
|
|
461
|
-
* @param config.defaultValue - Optional default selected value (type-safe when options are `as const`)
|
|
391
|
+
* @param config.options - Array of options. Can be strings or objects with label, value, and optional image properties. Use `as const` for best type safety.
|
|
462
392
|
* @param config.columns - Optional number of columns (1 or 2). Defaults to 1 (single column)
|
|
463
393
|
* @returns A complete radio field definition with type 'radio'
|
|
464
394
|
*
|
|
465
395
|
* @example
|
|
466
396
|
* ```typescript
|
|
467
|
-
* // With type safety - use 'as const' for autocomplete
|
|
468
|
-
* const options = [
|
|
469
|
-
* { label: 'The one', value: 'one' },
|
|
470
|
-
* { label: 'The two', value: 'two' }
|
|
471
|
-
* ] as const;
|
|
472
|
-
*
|
|
473
|
-
* styleEditorField.radio({
|
|
474
|
-
* id: 'my-field',
|
|
475
|
-
* label: 'Select option',
|
|
476
|
-
* options,
|
|
477
|
-
* defaultValue: 'one' // ✓ Autocomplete works!
|
|
478
|
-
* })
|
|
479
|
-
*
|
|
480
397
|
* // Simple string options (single column)
|
|
481
398
|
* styleEditorField.radio({
|
|
482
399
|
* id: 'alignment',
|
|
483
400
|
* label: 'Alignment',
|
|
484
|
-
* options: ['Left', 'Center', 'Right']
|
|
485
|
-
* defaultValue: 'Left'
|
|
401
|
+
* options: ['Left', 'Center', 'Right']
|
|
486
402
|
* })
|
|
487
403
|
*
|
|
488
|
-
* // Two-column grid layout with images
|
|
404
|
+
* // Two-column grid layout with images (recommended: use 'as const')
|
|
405
|
+
* const LAYOUT_OPTIONS = [
|
|
406
|
+
* {
|
|
407
|
+
* label: 'Left',
|
|
408
|
+
* value: 'left',
|
|
409
|
+
* imageURL: 'https://example.com/layout-left.png',
|
|
410
|
+
* },
|
|
411
|
+
* {
|
|
412
|
+
* label: 'Right',
|
|
413
|
+
* value: 'right',
|
|
414
|
+
* imageURL: 'https://example.com/layout-right.png',
|
|
415
|
+
* },
|
|
416
|
+
* { label: 'Center', value: 'center' },
|
|
417
|
+
* { label: 'Overlap', value: 'overlap' }
|
|
418
|
+
* ] as const;
|
|
419
|
+
*
|
|
489
420
|
* styleEditorField.radio({
|
|
490
421
|
* id: 'layout',
|
|
491
422
|
* label: 'Layout',
|
|
492
423
|
* columns: 2,
|
|
493
|
-
* options:
|
|
494
|
-
* {
|
|
495
|
-
* label: 'Left',
|
|
496
|
-
* value: 'left',
|
|
497
|
-
* imageURL: 'https://example.com/layout-left.png',
|
|
498
|
-
* },
|
|
499
|
-
* {
|
|
500
|
-
* label: 'Right',
|
|
501
|
-
* value: 'right',
|
|
502
|
-
* imageURL: 'https://example.com/layout-right.png',
|
|
503
|
-
* },
|
|
504
|
-
* { label: 'Center', value: 'center' },
|
|
505
|
-
* { label: 'Overlap', value: 'overlap' }
|
|
506
|
-
* ],
|
|
507
|
-
* defaultValue: 'right'
|
|
424
|
+
* options: LAYOUT_OPTIONS
|
|
508
425
|
* })
|
|
509
426
|
* ```
|
|
510
427
|
*/
|
|
511
428
|
radio: config => ({
|
|
512
429
|
type: 'radio',
|
|
513
430
|
...config,
|
|
514
|
-
options: config.options
|
|
515
|
-
defaultValue: config.defaultValue
|
|
431
|
+
options: config.options
|
|
516
432
|
}),
|
|
517
433
|
/**
|
|
518
434
|
* Creates a checkbox group field definition.
|
|
@@ -523,8 +439,7 @@ const styleEditorField = {
|
|
|
523
439
|
*
|
|
524
440
|
* **Key Differences from Other Field Types:**
|
|
525
441
|
* - Uses `key` instead of `value` for the identifier (to avoid confusion)
|
|
526
|
-
* -
|
|
527
|
-
* - No separate `defaultValue` property - defaults are embedded in options
|
|
442
|
+
* - Checked state is managed by the form system, not stored in the option definition
|
|
528
443
|
*
|
|
529
444
|
* **Why `key` instead of `value`?**
|
|
530
445
|
* In dropdown and radio fields, `value` represents the actual selected value (string).
|
|
@@ -537,7 +452,7 @@ const styleEditorField = {
|
|
|
537
452
|
* @param config - Checkbox group field configuration (without the 'type' property)
|
|
538
453
|
* @param config.id - The unique identifier for this field
|
|
539
454
|
* @param config.label - The label displayed for this checkbox group
|
|
540
|
-
* @param config.options - Array of checkbox options with label
|
|
455
|
+
* @param config.options - Array of checkbox options with label and key
|
|
541
456
|
* @returns A complete checkbox group field definition with type 'checkboxGroup'
|
|
542
457
|
*
|
|
543
458
|
* @example
|
|
@@ -546,11 +461,10 @@ const styleEditorField = {
|
|
|
546
461
|
* id: 'text-decoration',
|
|
547
462
|
* label: 'Text Decoration',
|
|
548
463
|
* options: [
|
|
549
|
-
* { label: 'Underline', key: 'underline'
|
|
550
|
-
* { label: 'Overline', key: 'overline'
|
|
551
|
-
* { label: 'Line Through', key: 'line-through'
|
|
464
|
+
* { label: 'Underline', key: 'underline' },
|
|
465
|
+
* { label: 'Overline', key: 'overline' },
|
|
466
|
+
* { label: 'Line Through', key: 'line-through' }
|
|
552
467
|
* ]
|
|
553
|
-
* // No defaultValue needed - it's automatically derived from options
|
|
554
468
|
* })
|
|
555
469
|
*
|
|
556
470
|
* // Example with type settings
|
|
@@ -558,10 +472,10 @@ const styleEditorField = {
|
|
|
558
472
|
* id: 'type-settings',
|
|
559
473
|
* label: 'Type settings',
|
|
560
474
|
* options: [
|
|
561
|
-
* { label: 'Bold', key: 'bold'
|
|
562
|
-
* { label: 'Italic', key: 'italic'
|
|
563
|
-
* { label: 'Underline', key: 'underline'
|
|
564
|
-
* { label: 'Strikethrough', key: 'strikethrough'
|
|
475
|
+
* { label: 'Bold', key: 'bold' },
|
|
476
|
+
* { label: 'Italic', key: 'italic' },
|
|
477
|
+
* { label: 'Underline', key: 'underline' },
|
|
478
|
+
* { label: 'Strikethrough', key: 'strikethrough' }
|
|
565
479
|
* ]
|
|
566
480
|
* })
|
|
567
481
|
* ```
|
|
@@ -602,14 +516,14 @@ const styleEditorField = {
|
|
|
602
516
|
* title: 'Typography',
|
|
603
517
|
* fields: [
|
|
604
518
|
* styleEditorField.input({
|
|
519
|
+
* id: 'font-size',
|
|
605
520
|
* label: 'Font Size',
|
|
606
|
-
* inputType: 'number'
|
|
607
|
-
* defaultValue: 16
|
|
521
|
+
* inputType: 'number'
|
|
608
522
|
* }),
|
|
609
523
|
* styleEditorField.dropdown({
|
|
524
|
+
* id: 'font-family',
|
|
610
525
|
* label: 'Font Family',
|
|
611
|
-
* options: ['Arial', 'Helvetica']
|
|
612
|
-
* defaultValue: 'Arial'
|
|
526
|
+
* options: ['Arial', 'Helvetica']
|
|
613
527
|
* })
|
|
614
528
|
* ]
|
|
615
529
|
* },
|
|
@@ -617,14 +531,14 @@ const styleEditorField = {
|
|
|
617
531
|
* title: 'Colors',
|
|
618
532
|
* fields: [
|
|
619
533
|
* styleEditorField.input({
|
|
534
|
+
* id: 'primary-color',
|
|
620
535
|
* label: 'Primary Color',
|
|
621
|
-
* inputType: 'text'
|
|
622
|
-
* defaultValue: '#000000'
|
|
536
|
+
* inputType: 'text'
|
|
623
537
|
* }),
|
|
624
538
|
* styleEditorField.input({
|
|
539
|
+
* id: 'secondary-color',
|
|
625
540
|
* label: 'Secondary Color',
|
|
626
|
-
* inputType: 'text'
|
|
627
|
-
* defaultValue: '#FFFFFF'
|
|
541
|
+
* inputType: 'text'
|
|
628
542
|
* })
|
|
629
543
|
* ]
|
|
630
544
|
* }
|
|
@@ -669,9 +583,9 @@ function defineStyleEditorSchema(form) {
|
|
|
669
583
|
* title: 'Typography',
|
|
670
584
|
* fields: [
|
|
671
585
|
* styleEditorField.input({
|
|
586
|
+
* id: 'font-size',
|
|
672
587
|
* label: 'Font Size',
|
|
673
|
-
* inputType: 'number'
|
|
674
|
-
* defaultValue: 16
|
|
588
|
+
* inputType: 'number'
|
|
675
589
|
* })
|
|
676
590
|
* ]
|
|
677
591
|
* }
|
|
@@ -715,7 +629,6 @@ exports.enableBlockEditorInline = _public.enableBlockEditorInline;
|
|
|
715
629
|
exports.getUVEState = _public.getUVEState;
|
|
716
630
|
exports.initInlineEditing = _public.initInlineEditing;
|
|
717
631
|
exports.initUVE = _public.initUVE;
|
|
718
|
-
exports.isAnalyticsActive = _public.isAnalyticsActive;
|
|
719
632
|
exports.reorderMenu = _public.reorderMenu;
|
|
720
633
|
exports.sendMessageToUVE = _public.sendMessageToUVE;
|
|
721
634
|
exports.updateNavigation = _public.updateNavigation;
|