@dotcms/uve 1.2.0 → 1.2.1-next.2

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/index.esm.js CHANGED
@@ -1,3 +1,594 @@
1
- export { c as createUVESubscription, e as editContentlet, b as enableBlockEditorInline, g as getUVEState, a as initInlineEditing, d as initUVE, i as isAnalyticsActive, r as reorderMenu, s as sendMessageToUVE, u as updateNavigation } from './public.esm.js';
2
- import '@dotcms/types';
1
+ import { g as getUVEState, s as sendMessageToUVE } from './public.esm.js';
2
+ export { c as createUVESubscription, e as editContentlet, b as enableBlockEditorInline, a as initInlineEditing, d as initUVE, i as isAnalyticsActive, r as reorderMenu, u as updateNavigation } from './public.esm.js';
3
+ import { UVE_MODE, DotCMSUVEAction } from '@dotcms/types';
3
4
  import '@dotcms/types/internal';
5
+
6
+ /**
7
+ * Normalizes a field definition into the schema format expected by UVE.
8
+ *
9
+ * Converts developer-friendly field definitions into a normalized structure where
10
+ * all type-specific configuration properties are moved into a `config` object.
11
+ * This transformation ensures consistency in the schema format sent to UVE.
12
+ *
13
+ * **Field Type Handling:**
14
+ * - **Input fields**: Extracts `inputType`, `placeholder`, and `defaultValue` into config
15
+ * - **Dropdown fields**: Normalizes options (strings become `{ label, value }` objects),
16
+ * extracts `placeholder` and `defaultValue` into config
17
+ * - **Radio fields**: Normalizes options (preserves image properties like `imageURL`, `width`, `height`),
18
+ * extracts `defaultValue` into config
19
+ * - **Checkbox group fields**: Normalizes options and extracts `defaultValue` (as Record<string, boolean>) into config
20
+ *
21
+ * @experimental This method is experimental and may be subject to change.
22
+ *
23
+ * @param field - The field definition to normalize. Must be one of: input, dropdown, radio, or checkboxGroup
24
+ * @returns The normalized field schema with type, label, and config properties ready to be sent to UVE
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Input field normalization
29
+ * normalizeField({
30
+ * type: 'input',
31
+ * label: 'Font Size',
32
+ * inputType: 'number',
33
+ * defaultValue: 16,
34
+ * placeholder: 'Enter size'
35
+ * })
36
+ * // Returns: {
37
+ * // type: 'input',
38
+ * // label: 'Font Size',
39
+ * // config: { inputType: 'number', defaultValue: 16, placeholder: 'Enter size' }
40
+ * // }
41
+ *
42
+ * // Dropdown field with string options normalization
43
+ * normalizeField({
44
+ * type: 'dropdown',
45
+ * label: 'Font Family',
46
+ * options: ['Arial', 'Helvetica']
47
+ * })
48
+ * // Returns: {
49
+ * // type: 'dropdown',
50
+ * // label: 'Font Family',
51
+ * // config: { options: [{ label: 'Arial', value: 'Arial' }, { label: 'Helvetica', value: 'Helvetica' }] }
52
+ * // }
53
+ * ```
54
+ */
55
+ function normalizeField(field) {
56
+ const base = {
57
+ type: field.type,
58
+ label: field.label
59
+ };
60
+ const config = {};
61
+ // Handle type-specific properties
62
+ if (field.type === 'input') {
63
+ config.inputType = field.inputType;
64
+ config.placeholder = field.placeholder;
65
+ config.defaultValue = field.defaultValue;
66
+ }
67
+ if (field.type === 'dropdown' || field.type === 'radio') {
68
+ // Normalize options to consistent format
69
+ config.options = field.options.map(opt => typeof opt === 'string' ? {
70
+ label: opt,
71
+ value: opt
72
+ } : opt);
73
+ config.placeholder = field.type === 'dropdown' ? field.placeholder : undefined;
74
+ config.defaultValue = field.defaultValue;
75
+ // Handle radio-specific properties
76
+ if (field.type === 'radio') {
77
+ config.columns = field.columns;
78
+ }
79
+ }
80
+ if (field.type === 'checkboxGroup') {
81
+ // Normalize options to consistent format
82
+ config.options = field.options.map(opt => typeof opt === 'string' ? {
83
+ label: opt,
84
+ value: opt
85
+ } : opt);
86
+ config.defaultValue = field.defaultValue;
87
+ }
88
+ return {
89
+ ...base,
90
+ config
91
+ };
92
+ }
93
+ /**
94
+ * Normalizes a section definition into the schema format expected by UVE.
95
+ *
96
+ * Converts a section with a flat array of fields into the normalized schema format
97
+ * where fields are organized as a multi-dimensional array (array of column arrays).
98
+ * Currently, all sections are normalized to a single-column layout structure.
99
+ *
100
+ * **Normalization Process:**
101
+ * 1. Normalizes each field in the section using `normalizeField`
102
+ * 2. Wraps the normalized fields array in an outer array to create the column structure
103
+ * 3. Preserves the section title
104
+ *
105
+ * The output format always uses a multi-dimensional array structure (`fields: StyleEditorFieldSchema[][]`),
106
+ * even for single-column layouts, ensuring consistency in the UVE schema format.
107
+ *
108
+ * @experimental This method is experimental and may be subject to change.
109
+ *
110
+ * @param section - The section definition to normalize, containing a title and array of fields
111
+ * @param section.title - The section title displayed to users
112
+ * @param section.fields - Array of field definitions to normalize
113
+ * @returns The normalized section schema with fields organized as a single-column array structure
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * normalizeSection({
118
+ * title: 'Typography',
119
+ * fields: [
120
+ * { type: 'input', label: 'Font Size', inputType: 'number' },
121
+ * { type: 'dropdown', label: 'Font Family', options: ['Arial'] }
122
+ * ]
123
+ * })
124
+ * // Returns: {
125
+ * // title: 'Typography',
126
+ * // fields: [
127
+ * // [
128
+ * // { type: 'input', label: 'Font Size', config: { inputType: 'number' } },
129
+ * // { type: 'dropdown', label: 'Font Family', config: { options: [...] } }
130
+ * // ]
131
+ * // ]
132
+ * // }
133
+ * ```
134
+ */
135
+ function normalizeSection(section) {
136
+ // Determine if fields is multi-column or single column
137
+ const normalizedFields = section.fields.map(normalizeField);
138
+ return {
139
+ title: section.title,
140
+ fields: normalizedFields
141
+ };
142
+ }
143
+ /**
144
+ * Normalizes a complete form definition into the schema format expected by UVE.
145
+ *
146
+ * This is the main entry point for converting a developer-friendly form definition
147
+ * into the normalized schema structure that UVE (Universal Visual Editor) can consume.
148
+ * The normalization process transforms the entire form hierarchy:
149
+ *
150
+ * **Normalization Process:**
151
+ * 1. Preserves the `contentType` identifier
152
+ * 2. Processes each section using `normalizeSection`, which:
153
+ * - Normalizes all fields in the section using `normalizeField`
154
+ * - Organizes fields into the required multi-dimensional array structure
155
+ * 3. Returns a fully normalized schema with consistent structure across all sections
156
+ *
157
+ * The resulting schema has all field-specific properties moved into `config` objects
158
+ * and all sections using the consistent single-column array structure, regardless
159
+ * of the input format.
160
+ *
161
+ * @experimental This method is experimental and may be subject to change.
162
+ *
163
+ * @param form - The complete form definition to normalize
164
+ * @param form.contentType - The content type identifier this form is associated with
165
+ * @param form.sections - Array of section definitions, each containing a title and fields
166
+ * @returns The normalized form schema ready to be sent to UVE, with all fields and sections normalized
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const schema = normalizeForm({
171
+ * contentType: 'my-content-type',
172
+ * sections: [
173
+ * {
174
+ * title: 'Typography',
175
+ * fields: [
176
+ * { type: 'input', label: 'Font Size', inputType: 'number', defaultValue: 16 },
177
+ * { type: 'dropdown', label: 'Font Family', options: ['Arial', 'Helvetica'] }
178
+ * ]
179
+ * },
180
+ * {
181
+ * title: 'Colors',
182
+ * fields: [
183
+ * { type: 'input', label: 'Primary Color', inputType: 'text', defaultValue: '#000000' }
184
+ * ]
185
+ * }
186
+ * ]
187
+ * });
188
+ * // Returns: {
189
+ * // contentType: 'my-content-type',
190
+ * // sections: [
191
+ * // {
192
+ * // title: 'Typography',
193
+ * // fields: [
194
+ * // [
195
+ * // { type: 'input', label: 'Font Size', config: { inputType: 'number', defaultValue: 16 } },
196
+ * // { type: 'dropdown', label: 'Font Family', config: { options: [...] } }
197
+ * // ]
198
+ * // ]
199
+ * // },
200
+ * // {
201
+ * // title: 'Colors',
202
+ * // fields: [
203
+ * // [
204
+ * // { type: 'input', label: 'Primary Color', config: { inputType: 'text', defaultValue: '#000000' } }
205
+ * // ]
206
+ * // ]
207
+ * // }
208
+ * // ]
209
+ * // }
210
+ * ```
211
+ */
212
+ function normalizeForm(form) {
213
+ return {
214
+ contentType: form.contentType,
215
+ sections: form.sections.map(normalizeSection)
216
+ };
217
+ }
218
+
219
+ /**
220
+ * Helper functions for creating style editor field definitions.
221
+ *
222
+ * Provides type-safe factory functions for creating different types of form fields
223
+ * used in the style editor. Each function creates a field definition with the
224
+ * appropriate `type` property automatically set, eliminating the need to manually
225
+ * specify the type discriminator.
226
+ *
227
+ * **Available Field Types:**
228
+ * - `input`: Text or number input fields
229
+ * - `dropdown`: Single-value selection from a dropdown list
230
+ * - `radio`: Single-value selection from radio button options (supports visual options with images)
231
+ * - `checkboxGroup`: Multiple-value selection from checkbox options
232
+ *
233
+ * These factory functions ensure type safety by inferring the correct field type
234
+ * based on the configuration provided, and they automatically set the `type` property
235
+ * to match the factory function used.
236
+ *
237
+ * @experimental This API is experimental and may be subject to change.
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * const form = defineStyleEditorSchema({
242
+ * contentType: 'my-content-type',
243
+ * sections: [
244
+ * {
245
+ * title: 'Typography',
246
+ * fields: [
247
+ * styleEditorField.input({
248
+ * label: 'Font Size',
249
+ * inputType: 'number',
250
+ * defaultValue: 16
251
+ * }),
252
+ * styleEditorField.dropdown({
253
+ * label: 'Font Family',
254
+ * options: ['Arial', 'Helvetica'],
255
+ * defaultValue: 'Arial'
256
+ * }),
257
+ * styleEditorField.radio({
258
+ * label: 'Alignment',
259
+ * options: ['Left', 'Center', 'Right'],
260
+ * defaultValue: 'Left'
261
+ * })
262
+ * ]
263
+ * }
264
+ * ]
265
+ * });
266
+ * ```
267
+ */
268
+ const styleEditorField = {
269
+ /**
270
+ * Creates an input field definition with type-safe default values.
271
+ *
272
+ * Supports both text and number input types. The `defaultValue` type is
273
+ * enforced based on the `inputType` using TypeScript generics:
274
+ * - When `inputType` is `'number'`, `defaultValue` must be a `number`
275
+ * - When `inputType` is `'text'`, `defaultValue` must be a `string`
276
+ *
277
+ * This provides compile-time type checking to prevent mismatched types,
278
+ * such as passing a string when a number is expected.
279
+ *
280
+ * @experimental This method is experimental and may be subject to change.
281
+ *
282
+ * @typeParam T - The input type ('text' or 'number'), inferred from `config.inputType`
283
+ * @param config - Input field configuration
284
+ * @param config.label - The label displayed for this input field
285
+ * @param config.inputType - The type of input ('text' or 'number')
286
+ * @param config.placeholder - Optional placeholder text for the input
287
+ * @param config.defaultValue - Optional default value (type enforced based on inputType)
288
+ * @returns A complete input field definition with type 'input'
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * // Number input - defaultValue must be a number
293
+ * styleEditorField.input({
294
+ * label: 'Font Size',
295
+ * inputType: 'number',
296
+ * placeholder: 'Enter font size',
297
+ * defaultValue: 16 // ✓ Correct: number
298
+ * })
299
+ *
300
+ * // Text input - defaultValue must be a string
301
+ * styleEditorField.input({
302
+ * label: 'Font Name',
303
+ * inputType: 'text',
304
+ * placeholder: 'Enter font name',
305
+ * defaultValue: 'Arial' // ✓ Correct: string
306
+ * })
307
+ *
308
+ * // TypeScript error - type mismatch
309
+ * styleEditorField.input({
310
+ * label: 'Font Size',
311
+ * inputType: 'number',
312
+ * defaultValue: '16' // ✗ Error: Type 'string' is not assignable to type 'number'
313
+ * })
314
+ * ```
315
+ */
316
+ input: config => ({
317
+ type: 'input',
318
+ ...config
319
+ }),
320
+ /**
321
+ * Creates a dropdown field definition.
322
+ *
323
+ * Allows users to select a single value from a list of options.
324
+ * Options can be provided as simple strings or as objects with label and value.
325
+ *
326
+ * @experimental This method is experimental and may be subject to change.
327
+ *
328
+ * @param config - Dropdown field configuration (without the 'type' property)
329
+ * @param config.label - The label displayed for this dropdown field
330
+ * @param config.options - Array of options. Can be strings or objects with label and value
331
+ * @param config.defaultValue - Optional default selected value (must match one of the option values)
332
+ * @param config.placeholder - Optional placeholder text shown when no value is selected
333
+ * @returns A complete dropdown field definition with type 'dropdown'
334
+ *
335
+ * @example
336
+ * ```typescript
337
+ * // Simple string options
338
+ * styleEditorField.dropdown({
339
+ * label: 'Font Family',
340
+ * options: ['Arial', 'Helvetica', 'Times New Roman'],
341
+ * defaultValue: 'Arial',
342
+ * placeholder: 'Select a font'
343
+ * })
344
+ *
345
+ * // Object options with custom labels
346
+ * styleEditorField.dropdown({
347
+ * label: 'Theme',
348
+ * options: [
349
+ * { label: 'Light Theme', value: 'light' },
350
+ * { label: 'Dark Theme', value: 'dark' }
351
+ * ],
352
+ * defaultValue: 'light'
353
+ * })
354
+ * ```
355
+ */
356
+ dropdown: config => ({
357
+ type: 'dropdown',
358
+ ...config
359
+ }),
360
+ /**
361
+ * Creates a radio button field definition.
362
+ *
363
+ * Allows users to select a single option from a list. Supports visual
364
+ * options with background images for enhanced UI. Options can be provided
365
+ * as simple strings or as objects with label, value, and optional image properties.
366
+ *
367
+ * **Layout Options:**
368
+ * - `columns: 1` (default): Single column list layout
369
+ * - `columns: 2`: Two-column grid layout, ideal for visual options with images
370
+ *
371
+ * @experimental This method is experimental and may be subject to change.
372
+ *
373
+ * @param config - Radio field configuration (without the 'type' property)
374
+ * @param config.label - The label displayed for this radio group
375
+ * @param config.options - Array of options. Can be strings or objects with label, value, and optional imageURL, width, height
376
+ * @param config.defaultValue - Optional default selected value (must match one of the option values)
377
+ * @param config.columns - Optional number of columns (1 or 2). Defaults to 1 (single column)
378
+ * @returns A complete radio field definition with type 'radio'
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * // Simple string options (single column)
383
+ * styleEditorField.radio({
384
+ * label: 'Alignment',
385
+ * options: ['Left', 'Center', 'Right'],
386
+ * defaultValue: 'Left'
387
+ * })
388
+ *
389
+ * // Two-column grid layout with images
390
+ * styleEditorField.radio({
391
+ * label: 'Layout',
392
+ * columns: 2,
393
+ * options: [
394
+ * {
395
+ * label: 'Left',
396
+ * value: 'left',
397
+ * imageURL: 'https://example.com/layout-left.png',
398
+ * width: 80,
399
+ * height: 50
400
+ * },
401
+ * {
402
+ * label: 'Right',
403
+ * value: 'right',
404
+ * imageURL: 'https://example.com/layout-right.png',
405
+ * width: 80,
406
+ * height: 50
407
+ * },
408
+ * { label: 'Center', value: 'center' },
409
+ * { label: 'Overlap', value: 'overlap' }
410
+ * ],
411
+ * defaultValue: 'right'
412
+ * })
413
+ * ```
414
+ */
415
+ radio: config => ({
416
+ type: 'radio',
417
+ ...config
418
+ }),
419
+ /**
420
+ * Creates a checkbox group field definition.
421
+ *
422
+ * Allows users to select multiple options simultaneously. Each option
423
+ * can be independently checked or unchecked. The defaultValue is a
424
+ * record mapping option values to their boolean checked state.
425
+ *
426
+ * @experimental This method is experimental and may be subject to change.
427
+ *
428
+ * @param config - Checkbox group field configuration (without the 'type' property)
429
+ * @param config.label - The label displayed for this checkbox group
430
+ * @param config.options - Array of options. Can be strings or objects with label and value
431
+ * @param config.defaultValue - Optional default checked state as a record of option values to boolean
432
+ * @returns A complete checkbox group field definition with type 'checkboxGroup'
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * styleEditorField.checkboxGroup({
437
+ * label: 'Text Decoration',
438
+ * options: [
439
+ * { label: 'Underline', value: 'underline' },
440
+ * { label: 'Overline', value: 'overline' },
441
+ * { label: 'Line Through', value: 'line-through' }
442
+ * ],
443
+ * defaultValue: {
444
+ * 'underline': true,
445
+ * 'overline': false,
446
+ * 'line-through': false
447
+ * }
448
+ * })
449
+ * ```
450
+ */
451
+ checkboxGroup: config => ({
452
+ type: 'checkboxGroup',
453
+ ...config
454
+ })
455
+ };
456
+ /**
457
+ * Normalizes and validates a style editor form definition.
458
+ *
459
+ * Converts the developer-friendly form structure into the schema format
460
+ * expected by UVE (Universal Visual Editor). This function processes the
461
+ * form definition and transforms it into the normalized schema format where:
462
+ *
463
+ * - All field-specific properties are moved into `config` objects
464
+ * - String options are normalized to `{ label, value }` objects
465
+ * - Sections are organized into the multi-dimensional array structure required by UVE
466
+ *
467
+ * The normalization process ensures consistency and type safety in the schema
468
+ * format sent to UVE. After normalization, use `registerStyleEditorSchemas`
469
+ * to register the schema with the UVE editor.
470
+ *
471
+ * @experimental This method is experimental and may be subject to change.
472
+ *
473
+ * @param form - The style editor form definition containing contentType and sections
474
+ * @param form.contentType - The content type identifier for this form
475
+ * @param form.sections - Array of sections, each containing a title and fields array
476
+ * @returns The normalized form schema ready to be sent to UVE
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * const formSchema = defineStyleEditorSchema({
481
+ * contentType: 'my-content-type',
482
+ * sections: [
483
+ * {
484
+ * title: 'Typography',
485
+ * fields: [
486
+ * styleEditorField.input({
487
+ * label: 'Font Size',
488
+ * inputType: 'number',
489
+ * defaultValue: 16
490
+ * }),
491
+ * styleEditorField.dropdown({
492
+ * label: 'Font Family',
493
+ * options: ['Arial', 'Helvetica'],
494
+ * defaultValue: 'Arial'
495
+ * })
496
+ * ]
497
+ * },
498
+ * {
499
+ * title: 'Colors',
500
+ * fields: [
501
+ * styleEditorField.input({
502
+ * label: 'Primary Color',
503
+ * inputType: 'text',
504
+ * defaultValue: '#000000'
505
+ * }),
506
+ * styleEditorField.input({
507
+ * label: 'Secondary Color',
508
+ * inputType: 'text',
509
+ * defaultValue: '#FFFFFF'
510
+ * })
511
+ * ]
512
+ * }
513
+ * ]
514
+ * });
515
+ *
516
+ * // Register the schema with UVE
517
+ * registerStyleEditorSchemas([formSchema]);
518
+ * ```
519
+ */
520
+ function defineStyleEditorSchema(form) {
521
+ return normalizeForm(form);
522
+ }
523
+ /**
524
+ * Registers style editor form schemas with the UVE editor.
525
+ *
526
+ * Sends normalized style editor schemas to the UVE (Universal Visual Editor)
527
+ * for registration. The schemas must be normalized using `defineStyleEditorSchema`
528
+ * before being passed to this function.
529
+ *
530
+ * **Behavior:**
531
+ * - Only registers schemas when UVE is in EDIT mode
532
+ * - Validates that each schema has a `contentType` property
533
+ * - Skips schemas without `contentType` and logs a warning
534
+ * - Sends the validated schemas to UVE via the `REGISTER_STYLE_SCHEMAS` action
535
+ *
536
+ * **Note:** This function will silently return early if UVE is not in EDIT mode,
537
+ * so it's safe to call even when the editor is not active.
538
+ *
539
+ * @experimental This method is experimental and may be subject to change.
540
+ *
541
+ * @param schemas - Array of normalized style editor form schemas to register with UVE
542
+ * @returns void - This function does not return a value
543
+ *
544
+ * @example
545
+ * ```typescript
546
+ * // Create and normalize a form schema
547
+ * const formSchema = defineStyleEditorSchema({
548
+ * contentType: 'my-content-type',
549
+ * sections: [
550
+ * {
551
+ * title: 'Typography',
552
+ * fields: [
553
+ * styleEditorField.input({
554
+ * label: 'Font Size',
555
+ * inputType: 'number',
556
+ * defaultValue: 16
557
+ * })
558
+ * ]
559
+ * }
560
+ * ]
561
+ * });
562
+ *
563
+ * // Register the schema with UVE
564
+ * registerStyleEditorSchemas([formSchema]);
565
+ *
566
+ * // Register multiple schemas at once
567
+ * const schema1 = defineStyleEditorSchema({ ... });
568
+ * const schema2 = defineStyleEditorSchema({ ... });
569
+ * registerStyleEditorSchemas([schema1, schema2]);
570
+ * ```
571
+ */
572
+ function registerStyleEditorSchemas(schemas) {
573
+ const {
574
+ mode
575
+ } = getUVEState() || {};
576
+ if (!mode || mode !== UVE_MODE.EDIT) {
577
+ return;
578
+ }
579
+ const validatedSchemas = schemas.filter((schema, index) => {
580
+ if (!schema.contentType) {
581
+ console.warn(`[registerStyleEditorSchemas] Skipping schema with index [${index}] for not having a contentType`);
582
+ return false;
583
+ }
584
+ return true;
585
+ });
586
+ sendMessageToUVE({
587
+ action: DotCMSUVEAction.REGISTER_STYLE_SCHEMAS,
588
+ payload: {
589
+ schemas: validatedSchemas
590
+ }
591
+ });
592
+ }
593
+
594
+ export { defineStyleEditorSchema, getUVEState, registerStyleEditorSchemas, sendMessageToUVE, styleEditorField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-next.2",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,13 +20,13 @@
20
20
  "./package.json": "./package.json",
21
21
  ".": {
22
22
  "module": "./index.esm.js",
23
- "types": "./index.esm.d.ts",
23
+ "types": "./index.d.ts",
24
24
  "import": "./index.cjs.mjs",
25
25
  "default": "./index.cjs.js"
26
26
  },
27
27
  "./internal": {
28
28
  "module": "./internal.esm.js",
29
- "types": "./internal.esm.d.ts",
29
+ "types": "./internal.d.ts",
30
30
  "import": "./internal.cjs.mjs",
31
31
  "default": "./internal.cjs.js"
32
32
  }
@@ -49,5 +49,5 @@
49
49
  "homepage": "https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/uve/README.md",
50
50
  "module": "./index.esm.js",
51
51
  "main": "./index.cjs.js",
52
- "types": "./index.esm.d.ts"
53
- }
52
+ "types": "./index.d.ts"
53
+ }
package/public.cjs.js CHANGED
@@ -970,14 +970,18 @@ function listenBlockEditorInlineEvent() {
970
970
  listenBlockEditorClick();
971
971
  return {
972
972
  destroyListenBlockEditorInlineEvent: () => {
973
- window.removeEventListener('load', () => listenBlockEditorClick());
973
+ // No need to remove listener if page was already loaded
974
974
  }
975
975
  };
976
976
  }
977
- window.addEventListener('load', () => listenBlockEditorClick());
977
+ // If the page is not fully loaded, listen for the DOMContentLoaded event
978
+ const handleDOMContentLoaded = () => {
979
+ listenBlockEditorClick();
980
+ };
981
+ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded);
978
982
  return {
979
983
  destroyListenBlockEditorInlineEvent: () => {
980
- window.removeEventListener('load', () => listenBlockEditorClick());
984
+ document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
981
985
  }
982
986
  };
983
987
  }
package/public.esm.js CHANGED
@@ -968,14 +968,18 @@ function listenBlockEditorInlineEvent() {
968
968
  listenBlockEditorClick();
969
969
  return {
970
970
  destroyListenBlockEditorInlineEvent: () => {
971
- window.removeEventListener('load', () => listenBlockEditorClick());
971
+ // No need to remove listener if page was already loaded
972
972
  }
973
973
  };
974
974
  }
975
- window.addEventListener('load', () => listenBlockEditorClick());
975
+ // If the page is not fully loaded, listen for the DOMContentLoaded event
976
+ const handleDOMContentLoaded = () => {
977
+ listenBlockEditorClick();
978
+ };
979
+ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded);
976
980
  return {
977
981
  destroyListenBlockEditorInlineEvent: () => {
978
- window.removeEventListener('load', () => listenBlockEditorClick());
982
+ document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
979
983
  }
980
984
  };
981
985
  }
package/src/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './lib/core/core.utils';
2
2
  export * from './lib/editor/public';
3
+ export * from './lib/style-editor/types';
4
+ export * from './lib/style-editor/public';