@myissue/vue-website-page-builder 3.5.13 → 3.5.15

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 (89) hide show
  1. package/dist/index.d.ts +1384 -11
  2. package/dist/style.css +1 -1
  3. package/dist/vue-website-page-builder.js +2464 -2443
  4. package/dist/vue-website-page-builder.umd.cjs +58 -54
  5. package/package.json +6 -9
  6. package/dist/App.vue.d.ts +0 -2
  7. package/dist/Components/ComponentThumbnail.vue.d.ts +0 -19
  8. package/dist/Components/Homepage/Footer.vue.d.ts +0 -2
  9. package/dist/Components/Icons/LayersIcon.vue.d.ts +0 -7
  10. package/dist/Components/Icons/SliderIcon.vue.d.ts +0 -7
  11. package/dist/Components/Inputs/ToggleInput.vue.d.ts +0 -9
  12. package/dist/Components/Loaders/ElementLoader.vue.d.ts +0 -2
  13. package/dist/Components/Loaders/GlobalLoader.vue.d.ts +0 -2
  14. package/dist/Components/Modals/BuilderComponents.vue.d.ts +0 -42
  15. package/dist/Components/Modals/DynamicModalBuilder.vue.d.ts +0 -142
  16. package/dist/Components/Modals/MediaLibraryModal.vue.d.ts +0 -58
  17. package/dist/Components/Modals/ModalBuilder.vue.d.ts +0 -73
  18. package/dist/Components/Overlays/FloatingSidePanel.vue.d.ts +0 -61
  19. package/dist/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue.d.ts +0 -12
  20. package/dist/Components/PageBuilder/EditorMenu/Editables/BorderRadius.vue.d.ts +0 -2
  21. package/dist/Components/PageBuilder/EditorMenu/Editables/Borders.vue.d.ts +0 -2
  22. package/dist/Components/PageBuilder/EditorMenu/Editables/ClassEditor.vue.d.ts +0 -2
  23. package/dist/Components/PageBuilder/EditorMenu/Editables/ComponentTopMenu.vue.d.ts +0 -2
  24. package/dist/Components/PageBuilder/EditorMenu/Editables/EditGetElement.vue.d.ts +0 -8
  25. package/dist/Components/PageBuilder/EditorMenu/Editables/HTMLEditor.vue.d.ts +0 -2
  26. package/dist/Components/PageBuilder/EditorMenu/Editables/ImageEditor.vue.d.ts +0 -2
  27. package/dist/Components/PageBuilder/EditorMenu/Editables/ImageSettingsModal.vue.d.ts +0 -5
  28. package/dist/Components/PageBuilder/EditorMenu/Editables/ManageBackgroundOpacity.vue.d.ts +0 -2
  29. package/dist/Components/PageBuilder/EditorMenu/Editables/ManageOpacity.vue.d.ts +0 -2
  30. package/dist/Components/PageBuilder/EditorMenu/Editables/MarginControl.vue.d.ts +0 -2
  31. package/dist/Components/PageBuilder/EditorMenu/Editables/OpacityEditor.vue.d.ts +0 -2
  32. package/dist/Components/PageBuilder/EditorMenu/Editables/PaddingControl.vue.d.ts +0 -2
  33. package/dist/Components/PageBuilder/EditorMenu/Editables/StyleEditor.vue.d.ts +0 -2
  34. package/dist/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue.d.ts +0 -12
  35. package/dist/Components/PageBuilder/EditorMenu/Editables/ThemeColorPresetManager.vue.d.ts +0 -2
  36. package/dist/Components/PageBuilder/EditorMenu/Editables/Typography.vue.d.ts +0 -2
  37. package/dist/Components/PageBuilder/EditorMenu/Editables/TypographyForTipTap.vue.d.ts +0 -2
  38. package/dist/Components/PageBuilder/EditorMenu/EditorAccordion.vue.d.ts +0 -14
  39. package/dist/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue.d.ts +0 -6
  40. package/dist/Components/PageBuilder/Settings/AdvancedPageBuilderSettings.vue.d.ts +0 -14
  41. package/dist/Components/PageBuilder/Settings/PageBuilderSettings.vue.d.ts +0 -2
  42. package/dist/Components/PageBuilder/ToolbarOption/ToolbarOption.vue.d.ts +0 -2
  43. package/dist/Components/PageBuilder/UndoRedo/UndoRedo.vue.d.ts +0 -6
  44. package/dist/Components/TipTap/TipTapInput.vue.d.ts +0 -2
  45. package/dist/PageBuilder/PageBuilder.vue.d.ts +0 -47
  46. package/dist/PageBuilder/Preview.vue.d.ts +0 -12
  47. package/dist/composables/builderInstance.d.ts +0 -20
  48. package/dist/composables/delay.d.ts +0 -1
  49. package/dist/composables/extractCleanHTMLFromPageBuilder.d.ts +0 -2
  50. package/dist/composables/preloadImage.d.ts +0 -1
  51. package/dist/composables/useDebounce.d.ts +0 -1
  52. package/dist/composables/usePageBuilderModal.d.ts +0 -4
  53. package/dist/composables/useThemeColorPresets.d.ts +0 -47
  54. package/dist/composables/useTranslations.d.ts +0 -12
  55. package/dist/helpers/isEmptyObject.d.ts +0 -1
  56. package/dist/main.d.ts +0 -0
  57. package/dist/plugin.d.ts +0 -4
  58. package/dist/services/LocalStorageManager.d.ts +0 -7
  59. package/dist/services/PageBuilderService.d.ts +0 -698
  60. package/dist/sitemap.xml +0 -8
  61. package/dist/stores/page-builder-state.d.ts +0 -369
  62. package/dist/stores/shared-store.d.ts +0 -4
  63. package/dist/tests/DefaultComponents/DefaultBuilderComponents.vue.d.ts +0 -14
  64. package/dist/tests/DefaultComponents/DefaultMediaLibraryComponent.vue.d.ts +0 -2
  65. package/dist/tests/PageBuilderTest.vue.d.ts +0 -2
  66. package/dist/tests/TestComponents/DemoMediaLibraryComponentTest.vue.d.ts +0 -2
  67. package/dist/tests/TestComponents/DemoUnsplash.vue.d.ts +0 -2
  68. package/dist/tests/composables/useThemeColorPresets.test.d.ts +0 -16
  69. package/dist/tests/config/config.test.d.ts +0 -1
  70. package/dist/tests/service/componentValidation.test.d.ts +0 -1
  71. package/dist/tests/service/globalPageSettings.test.d.ts +0 -1
  72. package/dist/tests/service/htmlUtils.test.d.ts +0 -1
  73. package/dist/tests/service/localStorage.test.d.ts +0 -1
  74. package/dist/tests/service/pageBuilderService.test.d.ts +0 -1
  75. package/dist/tests/ui/modalStacking.test.d.ts +0 -1
  76. package/dist/types/index.d.ts +0 -312
  77. package/dist/utils/builder/font-family-map.d.ts +0 -22
  78. package/dist/utils/builder/html-doc-declaration-with-components.d.ts +0 -2
  79. package/dist/utils/builder/tailwaind-colors.d.ts +0 -6
  80. package/dist/utils/builder/tailwind-border-radius.d.ts +0 -9
  81. package/dist/utils/builder/tailwind-border-style-width-color.d.ts +0 -7
  82. package/dist/utils/builder/tailwind-font-sizes.d.ts +0 -8
  83. package/dist/utils/builder/tailwind-font-styles.d.ts +0 -7
  84. package/dist/utils/builder/tailwind-image.d.ts +0 -7
  85. package/dist/utils/builder/tailwind-opacities.d.ts +0 -6
  86. package/dist/utils/builder/tailwind-padding-margin.d.ts +0 -16
  87. package/dist/utils/html-elements/component.d.ts +0 -13
  88. package/dist/utils/html-elements/componentHelpers.d.ts +0 -10
  89. package/dist/utils/html-elements/themes.d.ts +0 -13
@@ -1,698 +0,0 @@
1
- import { BuilderResourceData, ComponentObject, ImageObject, PageBuilderConfig, PageSettings, SEOSummary, StartBuilderResult } from '../types';
2
- import { usePageBuilderStateStore } from '../stores/page-builder-state';
3
- export type AvailableLanguage = 'en' | 'zh-Hans' | 'fr' | 'ja' | 'ru' | 'es' | 'pt' | 'de' | 'ar' | 'hi' | 'da' | 'it';
4
- export declare const AVAILABLE_LANGUAGES: AvailableLanguage[];
5
- export declare class PageBuilderService {
6
- private fontSizeRegex;
7
- protected pageBuilderStateStore: ReturnType<typeof usePageBuilderStateStore>;
8
- private getLocalStorageItemName;
9
- private getApplyImageToSelection;
10
- private getHyberlinkEnable;
11
- private getComponents;
12
- private getComponent;
13
- private getElement;
14
- private getComponentArrayAddMethod;
15
- private NoneListernesTags;
16
- private hasStartedEditing;
17
- private originalComponents;
18
- private savedMountComponents;
19
- private pendingMountComponents;
20
- private globalStylesObserver;
21
- private _pendingPageSettings;
22
- private _lastKnownPageSettings;
23
- private isPageBuilderMissingOnStart;
24
- private elementsWithListeners;
25
- private translate;
26
- constructor(pageBuilderStateStore: ReturnType<typeof usePageBuilderStateStore>);
27
- /**
28
- * Returns an array of available languages.
29
- * @returns {AvailableLanguage[]} An array of available language codes.
30
- */
31
- availableLanguage(): AvailableLanguage[];
32
- /**
33
- * Sets the current language in the page builder state.
34
- * @param {string} lang - The language code to set.
35
- */
36
- changeLanguage(lang: string): void;
37
- /**
38
- * Deselects any selected or hovered elements in the builder UI.
39
- * @returns {Promise<void>}
40
- */
41
- clearHtmlSelection(): Promise<void>;
42
- /**
43
- * Ensures that the `updateOrCreate` configuration is valid and sets default values if necessary.
44
- * @param {PageBuilderConfig} config - The page builder configuration.
45
- * @private
46
- */
47
- private ensureUpdateOrCreateConfig;
48
- /**
49
- * Validates the user-provided components array.
50
- * @param {unknown} components - The components data to validate.
51
- * @returns {{error: true, warning: string, status: string} | {error: true, reason: string} | undefined} An error object if validation fails, otherwise undefined.
52
- * @private
53
- */
54
- private validateUserProvidedComponents;
55
- /**
56
- * Ensures that the language configuration is valid and sets default values if necessary.
57
- * @param {PageBuilderConfig} config - The page builder configuration.
58
- * @private
59
- */
60
- private ensureLanguage;
61
- /**
62
- * Validates the entire page builder configuration.
63
- * @param {PageBuilderConfig} config - The page builder configuration.
64
- * @private
65
- */
66
- private validateConfig;
67
- /**
68
- * Saves user settings to local storage.
69
- * @param {string} newLang - The new language to save.
70
- */
71
- saveUserSettingsStorage(newLang: string): void;
72
- /**
73
- * Initializes the Page Builder.
74
- * @param {PageBuilderConfig} config - The configuration object for the Page Builder.
75
- * @param {BuilderResourceData} [passedComponentsArray] - Optional array of components to load.
76
- * @returns {Promise<StartBuilderResult>} A result object indicating success or failure.
77
- */
78
- startBuilder(config: PageBuilderConfig, passedComponentsArray?: BuilderResourceData): Promise<StartBuilderResult>;
79
- /**
80
- * Completes the builder initialization process once the DOM is ready.
81
- * @param {BuilderResourceData} [passedComponentsArray] - Optional array of components to load.
82
- * @returns {Promise<void>}
83
- */
84
- completeBuilderInitialization(passedComponentsArray?: BuilderResourceData): Promise<void>;
85
- /**
86
- * Converts an array of ComponentObject into a single HTML string.
87
- *
88
- * @returns {string} A single HTML string containing all components.
89
- */
90
- private renderComponentsToHtml;
91
- /**
92
- * Completes the mounting process by loading components into the DOM and setting up listeners.
93
- * @param {string} html - The HTML string of components to mount.
94
- * @param {boolean} [useConfigPageSettings] - Whether to use page settings from the passed data.
95
- * @private
96
- */
97
- private completeMountProcess;
98
- /**
99
- * Applies CSS class changes to the currently selected element.
100
- * @param {string | undefined} cssUserSelection - The user's CSS class selection.
101
- * @param {string[]} CSSArray - The array of possible CSS classes for this property.
102
- * @param {string} mutationName - The name of the store mutation to call.
103
- * @returns {string | undefined} The previously applied CSS class.
104
- * @private
105
- */
106
- private applyElementClassChanges;
107
- private removeElementClassesFromArray;
108
- /**
109
- * Removes all CSS classes from the main page builder container.
110
- * @returns {Promise<void>}
111
- */
112
- clearClassesFromPage(): Promise<void>;
113
- /**
114
- * Removes all inline styles from the main page builder container.
115
- * @returns {Promise<void>}
116
- */
117
- clearInlineStylesFromPage(): Promise<void>;
118
- /**
119
- * Selects the main page builder container for global styling.
120
- * @returns {Promise<void>}
121
- */
122
- globalPageStyles(): Promise<void>;
123
- /**
124
- * Disconnects the MutationObserver that tracks global page style changes.
125
- * Call when closing the global styles editor panel.
126
- */
127
- stopGlobalStylesSync(): void;
128
- /**
129
- * Handles changes to the font weight of the selected element.
130
- * @param {string} [userSelectedFontWeight] - The selected font weight class.
131
- */
132
- handleFontWeight(userSelectedFontWeight?: string): void;
133
- /**
134
- * Handles changes to the base font size of the selected element.
135
- * @param {string} [userSelectedFontSize] - The selected font size class.
136
- */
137
- handleFontSizeBase(userSelectedFontSize?: string): void;
138
- /**
139
- * Handles changes to the desktop font size of the selected element.
140
- * @param {string} [userSelectedFontSize] - The selected font size class for desktop.
141
- */
142
- handleFontSizeDesktop(userSelectedFontSize?: string): void;
143
- /**
144
- * Applies helper CSS classes to elements, such as wrapping them or adding responsive text classes.
145
- * @param {HTMLElement} element - The element to process.
146
- * @private
147
- */
148
- private ensureImagesHaveAltText;
149
- private applyHelperCSSToElements;
150
- /**
151
- * Toggles the visibility of the TipTap modal for rich text editing.
152
- * @param {boolean} status - Whether to show or hide the modal.
153
- * @returns {Promise<void>}
154
- */
155
- toggleTipTapModal(status: boolean): Promise<void>;
156
- /**
157
- * Wraps an element in a div if it's an excluded tag and adjacent to an image.
158
- * @param {HTMLElement} element - The element to potentially wrap.
159
- * @private
160
- */
161
- private wrapElementInDivIfExcluded;
162
- /**
163
- * Handles the mouseover event for editable elements, showing a hover state.
164
- * @param {Event} e - The mouse event.
165
- * @param {HTMLElement} element - The element being hovered over.
166
- * @private
167
- */
168
- private handleMouseOver;
169
- /**
170
- * Handles the mouseleave event for editable elements, removing the hover state.
171
- * @param {Event} e - The mouse event.
172
- * @private
173
- */
174
- private handleMouseLeave;
175
- /**
176
- * Checks if an element is editable based on its tag name.
177
- * @param {Element | null} el - The element to check.
178
- * @returns {boolean} True if the element is editable, false otherwise.
179
- */
180
- isEditableElement(el: Element | null): boolean;
181
- getSelectedComponentSection(): HTMLElement | null;
182
- isSelectedComponentTopElement(): boolean;
183
- selectedComponentIsFullWidth(): boolean;
184
- setSelectedComponentFullWidth(enabled: boolean): Promise<void>;
185
- /**
186
- * Returns true when the global page wrapper has the full-width class applied.
187
- */
188
- isGlobalFullWidth(): boolean;
189
- /**
190
- * Toggles the full-width class on the page wrapper so that global background
191
- * colours stretch across the entire browser viewport.
192
- */
193
- setGlobalFullWidth(enabled: boolean): Promise<void>;
194
- /** Returns true when the currently selected element is an `<img>`. */
195
- isSelectedElementImage(): boolean;
196
- setImageSettingsModalOpen(open: boolean): void;
197
- isImageSettingsModalOpen(): boolean;
198
- private findImageAspectClass;
199
- private removeImageAspectClasses;
200
- handleImageObjectFit(userSelection?: string): void;
201
- handleImageObjectPosition(userSelection?: string): void;
202
- handleImageAspectRatio(userSelection?: string): void;
203
- handleImageAltText(alt?: string): Promise<void>;
204
- getSelectedImageAltText(): string;
205
- /**
206
- * Attaches click, mouseover, and mouseleave event listeners to all editable elements in the page builder.
207
- * @private
208
- */
209
- private addListenersToEditableElements;
210
- /**
211
- * Handles the click event for editable elements, setting the element as selected.
212
- * @param {Event} e - The click event.
213
- * @param {HTMLElement} element - The clicked element.
214
- * @private
215
- */
216
- private handleElementClick;
217
- private getHistoryBaseKey;
218
- private initializeHistory;
219
- /**
220
- * Triggers an auto-save of the current page builder content to local storage if enabled.
221
- */
222
- handleAutoSave: () => Promise<void>;
223
- /**
224
- * Manually saves the current page builder content to local storage.
225
- */
226
- handleManualSave: (doNoClearHTML?: boolean) => Promise<void>;
227
- /**
228
- * Clones a component object and prepares it for insertion into the DOM by adding unique IDs and prefixes.
229
- * @param {ComponentObject} componentObject - The component object to clone.
230
- * @returns {ComponentObject} The cloned and prepared component object.
231
- */
232
- cloneCompObjForDOMInsertion(componentObject: ComponentObject): ComponentObject;
233
- /**
234
- * Removes the 'hovered' and 'selected' attributes from all elements in the page builder.
235
- * @private
236
- */
237
- private removeHoveredAndSelected;
238
- /**
239
- * Syncs the CSS classes of the currently selected element to the state store.
240
- * @private
241
- */
242
- private syncCurrentClasses;
243
- /**
244
- * Syncs the inline styles of the currently selected element to the state store.
245
- * @private
246
- */
247
- private syncCurrentStyles;
248
- /**
249
- * Adds a CSS class to the currently selected element.
250
- * @param {string} userSelectedClass - The class to add.
251
- */
252
- handleAddClasses(userSelectedClass: string): void;
253
- /**
254
- * Adds or updates an inline style property on the currently selected element.
255
- * @param {string} property - The CSS property to add/update.
256
- * @param {string} value - The value of the CSS property.
257
- */
258
- handleAddStyle(property: string, value: string): void;
259
- /**
260
- * Removes an inline style property from the currently selected element.
261
- * @param {string} property - The CSS property to remove.
262
- */
263
- handleRemoveStyle(property: string): void;
264
- /**
265
- * Handles changes to the font family of the selected element.
266
- * @param {string} [userSelectedFontFamily] - The selected font family class.
267
- */
268
- handleFontFamily(userSelectedFontFamily?: string): void;
269
- /**
270
- * Handles changes to the font style of the selected element.
271
- * @param {string} [userSelectedFontStyle] - The selected font style class.
272
- */
273
- handleFontStyle(userSelectedFontStyle?: string): void;
274
- /**
275
- * Removes every class that appears in any of the given arrays from the currently
276
- * selected element. Used to strip conflicting shorthand/directional padding or
277
- * margin classes before applying a new value (e.g. remove pbx-py-* when setting
278
- * pbx-pt-*, so the shorthand never silently overrides the directional value).
279
- */
280
- private purgeConflictingClasses;
281
- /**
282
- * Handles changes to the vertical padding of the selected element.
283
- * py-* shorthand: also clear individual pt-* and pb-* so they don't override.
284
- */
285
- handleVerticalPadding(userSelectedVerticalPadding?: string): void;
286
- /**
287
- * Handles changes to the horizontal padding of the selected element.
288
- * px-* shorthand: also clear individual pl-* and pr-* so they don't override.
289
- */
290
- handleHorizontalPadding(userSelectedHorizontalPadding?: string): void;
291
- /**
292
- * Handles changes to the top padding of the selected element.
293
- * pt-*: also clear py-* shorthand which also sets padding-top.
294
- */
295
- handleTopPadding(userSelectedTopPadding?: string): void;
296
- /**
297
- * Handles changes to the right padding of the selected element.
298
- * pr-*: also clear px-* shorthand which also sets padding-right.
299
- */
300
- handleRightPadding(userSelectedRightPadding?: string): void;
301
- /**
302
- * Handles changes to the bottom padding of the selected element.
303
- * pb-*: also clear py-* shorthand which also sets padding-bottom.
304
- */
305
- handleBottomPadding(userSelectedBottomPadding?: string): void;
306
- /**
307
- * Handles changes to the left padding of the selected element.
308
- * pl-*: also clear px-* shorthand which also sets padding-left.
309
- */
310
- handleLeftPadding(userSelectedLeftPadding?: string): void;
311
- /**
312
- * Handles changes to the vertical margin of the selected element.
313
- * my-* shorthand: also clear individual mt-* and mb-*.
314
- */
315
- handleVerticalMargin(userSelectedVerticalMargin?: string): void;
316
- /**
317
- * Handles changes to the horizontal margin of the selected element.
318
- * mx-* shorthand: also clear individual ml-* and mr-*.
319
- */
320
- handleHorizontalMargin(userSelectedHorizontalMargin?: string): void;
321
- /**
322
- * Handles changes to the top margin of the selected element.
323
- * mt-*: also clear my-* shorthand.
324
- */
325
- handleTopMargin(userSelectedTopMargin?: string): void;
326
- /**
327
- * Handles changes to the right margin of the selected element.
328
- * mr-*: also clear mx-* shorthand.
329
- */
330
- handleRightMargin(userSelectedRightMargin?: string): void;
331
- /**
332
- * Handles changes to the bottom margin of the selected element.
333
- * mb-*: also clear my-* shorthand.
334
- */
335
- handleBottomMargin(userSelectedBottomMargin?: string): void;
336
- /**
337
- * Handles changes to the left margin of the selected element.
338
- * ml-*: also clear mx-* shorthand.
339
- */
340
- handleLeftMargin(userSelectedLeftMargin?: string): void;
341
- /**
342
- * Handles changes to the border style of the selected element.
343
- * @param {string} [borderStyle] - The selected border style class.
344
- */
345
- handleBorderStyle(borderStyle?: string): void;
346
- /**
347
- * Handles changes to the border width of the selected element.
348
- * @param {string} [borderWidth] - The selected border width class.
349
- */
350
- handleBorderWidth(borderWidth?: string): void;
351
- /**
352
- * Handles changes to the border color of the selected element.
353
- * @param {string} [borderColor] - The selected border color class.
354
- */
355
- handleBorderColor(borderColor?: string): void;
356
- /**
357
- * Handles changes to the background color of the selected element.
358
- * @param {string} [color] - The selected background color class.
359
- */
360
- handleBackgroundColor(color?: string): void;
361
- handleCustomBackgroundColor(color: string): void;
362
- /**
363
- * Handles changes to the text color of the selected element.
364
- * @param {string} [color] - The selected text color class.
365
- */
366
- handleTextColor(color?: string): void;
367
- handleCustomTextColor(color: string): void;
368
- /**
369
- * Handles changes to the global border radius of the selected element.
370
- * @param {string} [borderRadiusGlobal] - The selected global border radius class.
371
- */
372
- handleBorderRadiusGlobal(borderRadiusGlobal?: string): void;
373
- /**
374
- * Handles changes to the top-left border radius of the selected element.
375
- * @param {string} [borderRadiusTopLeft] - The selected top-left border radius class.
376
- */
377
- handleBorderRadiusTopLeft(borderRadiusTopLeft?: string): void;
378
- /**
379
- * Handles changes to the top-right border radius of the selected element.
380
- * @param {string} [borderRadiusTopRight] - The selected top-right border radius class.
381
- */
382
- handleBorderRadiusTopRight(borderRadiusTopRight?: string): void;
383
- /**
384
- * Handles changes to the bottom-left border radius of the selected element.
385
- * @param {string} [borderRadiusBottomleft] - The selected bottom-left border radius class.
386
- */
387
- handleBorderRadiusBottomleft(borderRadiusBottomleft?: string): void;
388
- /**
389
- * Handles changes to the bottom-right border radius of the selected element.
390
- * @param {string} [borderRadiusBottomRight] - The selected bottom-right border radius class.
391
- */
392
- handleBorderRadiusBottomRight(borderRadiusBottomRight?: string): void;
393
- /**
394
- * Handles changes to the tablet font size of the selected element.
395
- * @param {string} [userSelectedFontSize] - The selected font size class for tablet.
396
- */
397
- handleFontSizeTablet(userSelectedFontSize?: string): void;
398
- /**
399
- * Handles changes to the mobile font size of the selected element.
400
- * @param {string} [userSelectedFontSize] - The selected font size class for mobile.
401
- */
402
- handleFontSizeMobile(userSelectedFontSize?: string): void;
403
- /**
404
- * Handles changes to the background opacity of the selected element.
405
- * @param {string} [opacity] - The selected background opacity class.
406
- */
407
- handleBackgroundOpacity(opacity?: string): void;
408
- /**
409
- * Handles changes to the opacity of the selected element.
410
- * @param {string} [opacity] - The selected opacity class.
411
- */
412
- handleOpacity(opacity?: string): void;
413
- /**
414
- * Removes all components from both the builder state and the DOM.
415
- * @private
416
- */
417
- private deleteAllComponentsFromDOM;
418
- undo(): Promise<void>;
419
- redo(): Promise<void>;
420
- private hasVisibleContent;
421
- private isSectionEmpty;
422
- /**
423
- * Duplicate the currently selected component from the DOM and the state.
424
- * @returns {Promise<void>}
425
- */
426
- /**
427
- * Finds the first two-column layout container inside the selected section.
428
- * Matches flex-row containers (including responsive variants like lg:pbx-flex-row)
429
- * AND grid containers with a grid-cols-2 class, in each case requiring exactly
430
- * two direct element children. Returns the container or null.
431
- */
432
- findReverseableContainer(): HTMLElement | null;
433
- /**
434
- * Reverses the visual order of a two-column layout by physically swapping the
435
- * two direct children of the detected container. This works for both flex-row
436
- * and grid-cols-2 layouts and naturally toggles on repeated clicks.
437
- * Persists the change to the store and localStorage.
438
- */
439
- reverseComponentLayout(): Promise<void>;
440
- duplicateComponent(): Promise<void>;
441
- /**
442
- * Deletes the currently selected component from the DOM and the state.
443
- * @returns {Promise<void>}
444
- */
445
- deleteComponentFromDOM(): Promise<void>;
446
- /**
447
- * Duplicates the currently selected element and inserts the copy immediately
448
- * after it in the DOM, then syncs the change to the store.
449
- */
450
- duplicateElementInDOM(): Promise<void>;
451
- /**
452
- * Deletes the currently selected element from the DOM and stores it for potential restoration.
453
- * @returns {Promise<void>}
454
- */
455
- deleteElementFromDOM(): Promise<void>;
456
- /**
457
- * Removes a CSS class from the currently selected element.
458
- * @param {string} userSelectedClass - The class to remove.
459
- */
460
- handleRemoveClasses(userSelectedClass: string): void;
461
- /**
462
- * Reorders the currently selected component up or down in the component list.
463
- * @param {number} direction - The direction to move the component (-1 for up, 1 for down).
464
- */
465
- reorderComponent(direction: number): Promise<void>;
466
- /**
467
- * Checks if the currently selected component can be moved up.
468
- * @returns {boolean} True if the component can be moved up, false otherwise.
469
- */
470
- canMoveUp(): boolean;
471
- /**
472
- * Checks if the currently selected component can be moved down.
473
- * @returns {boolean} True if the component can be moved down, false otherwise.
474
- */
475
- canMoveDown(): boolean;
476
- /**
477
- * Ensures that a text area element has content, adding a visual indicator if it's empty.
478
- */
479
- ensureTextAreaHasContent: () => void;
480
- /**
481
- * Handles text input for an element, updating its content.
482
- * @param {string} textContentVueModel - The new text content from the Vue model.
483
- * @returns {Promise<void>}
484
- */
485
- handleTextInput: (textContentVueModel: string) => Promise<void>;
486
- /**
487
- * Checks if the selected element or its first child is an iframe.
488
- * @returns {boolean} True if it is an iframe, false otherwise.
489
- */
490
- ElOrFirstChildIsIframe(): boolean;
491
- /**
492
- * Checks if the selected element is a valid text container (i.e., does not contain images or divs).
493
- * @returns {boolean | undefined} True if it's a valid text element, otherwise undefined.
494
- */
495
- isSelectedElementValidText(): false | undefined;
496
- /**
497
- * Generates a preview of the current page design.
498
- */
499
- previewCurrentDesign(): void;
500
- /**
501
- * Sanitizes a string to be used as a key in local storage.
502
- * @param {string} input - The string to sanitize.
503
- * @returns {string} The sanitized string.
504
- */
505
- sanitizeForLocalStorage(input: string): string;
506
- /**
507
- * Clones an element and removes selection-related attributes from the clone.
508
- * @param {HTMLElement} element - The element to clone.
509
- * @returns {HTMLElement} The sanitized clone.
510
- * @private
511
- */
512
- private cloneAndRemoveSelectionAttributes;
513
- /**
514
- * Syncs the current DOM state of components to the in-memory store.
515
- * @private
516
- */
517
- syncDomToStoreOnly(): Promise<void>;
518
- generateHtmlFromComponents(): Promise<string>;
519
- generateFullPageHtml(): Promise<string>;
520
- /**
521
- * Saves the current DOM state of components to local storage.
522
- * @private
523
- */
524
- private saveDomComponentsToLocalStorage;
525
- /**
526
- * Removes the current page's components from local storage.
527
- * @private
528
- */
529
- private removeCurrentComponentsFromLocalStorage;
530
- /**
531
- * Handles the form submission process, clearing local storage and the DOM.
532
- * Global page settings (classes / inline styles on the page wrapper) are
533
- * intentionally preserved so they survive a "remove all components" action.
534
- * @returns {Promise<void>}
535
- */
536
- handleFormSubmission(): Promise<void>;
537
- /**
538
- * Reads the current page settings.
539
- * Prioritises the live #pagebuilder element (always current) and falls back to localStorage.
540
- */
541
- private readCurrentPageSettings;
542
- /** Applies captured global page classes/styles to the page wrapper once. */
543
- private applyPageSettingsToPage;
544
- /** Reconnects the global-styles MutationObserver after a Vue remount replaces nodes. */
545
- private reconnectGlobalStylesObserver;
546
- /**
547
- * Updates the component store and re-renders the page without losing global page
548
- * styles on #pagebuilder. Settings must be captured before the remount and
549
- * re-applied after Vue renders.
550
- */
551
- private setComponentsPreservingPageSettings;
552
- /**
553
- * Parses a CSS style string into a key-value object.
554
- * @param {string} style - The style string to parse.
555
- * @returns {Record<string, string>} The parsed style object.
556
- * @private
557
- */
558
- private parseStyleString;
559
- /**
560
- * Deletes old page builder data from local storage (older than 2 weeks).
561
- */
562
- deleteOldPageBuilderLocalStorage(): void;
563
- /**
564
- * Sets a flag to indicate that the user has started editing.
565
- */
566
- startEditing(): void;
567
- /**
568
- * Re-attaches click/hover listeners to any newly added DOM elements.
569
- * Call this after programmatically inserting elements into the builder canvas.
570
- */
571
- refreshListeners(): Promise<void>;
572
- /**
573
- * Resumes editing from a draft saved in local storage.
574
- * @returns {Promise<void>}
575
- */
576
- resumeEditingFromDraft(): Promise<void>;
577
- /**
578
- * Restores the original content that was loaded when the builder started.
579
- * @returns {Promise<void>}
580
- */
581
- restoreOriginalContent(): Promise<void>;
582
- returnLatestComponents(): Promise<ComponentObject[]>;
583
- /**
584
- * Gets the local storage key for the current resource.
585
- * @returns {string | null} The local storage key.
586
- */
587
- getStorageItemNameForResource(): string | null;
588
- /**
589
- * Retrieves the saved page HTML from local storage.
590
- * @returns {string | false} The HTML string or false if not found.
591
- */
592
- getSavedPageHtml(): string | false;
593
- /**
594
- * Applies a selected image to the current element.
595
- * @param {ImageObject} image - The image object to apply.
596
- * @returns {Promise<void>}
597
- */
598
- applySelectedImage(image: ImageObject): Promise<void>;
599
- /**
600
- * Sets the base primary image from the currently selected element if it's an image.
601
- * @private
602
- */
603
- private setBasePrimaryImageFromSelectedElement;
604
- /**
605
- * Adds or removes a hyperlink from the selected element.
606
- * @param {boolean} hyperlinkEnable - Whether to enable or disable the hyperlink.
607
- * @param {string | null} urlInput - The URL for the hyperlink.
608
- * @param {boolean} openHyperlinkInNewTab - Whether the link should open in a new tab.
609
- * @private
610
- */
611
- private addHyperlinkToElement;
612
- /**
613
- * Checks if the selected element contains a hyperlink and updates the state accordingly.
614
- * @private
615
- */
616
- private checkForHyperlink;
617
- /**
618
- * Handles all hyperlink-related actions for the selected element.
619
- * @param {boolean} [hyperlinkEnable] - Whether to enable or disable the hyperlink.
620
- * @param {string | null} [urlInput] - The URL for the hyperlink.
621
- * @param {boolean} [openHyperlinkInNewTab] - Whether the link should open in a new tab.
622
- */
623
- handleHyperlink(hyperlinkEnable?: boolean, urlInput?: string | null, openHyperlinkInNewTab?: boolean): void;
624
- addTheme(components: string): Promise<void>;
625
- analyzeSEO(): Promise<SEOSummary>;
626
- /**
627
- * Adds a new component to the page builder.
628
- * @param {ComponentObject} componentObject - The component to add.
629
- * @returns {Promise<void>}
630
- */
631
- addComponent(componentObject: ComponentObject): Promise<void>;
632
- /**
633
- * Adds a prefix to Tailwind CSS classes in a string.
634
- * @param {string} classList - The string of classes.
635
- * @param {string} [prefix='pbx-'] - The prefix to add.
636
- * @returns {string} The prefixed class string.
637
- * @private
638
- */
639
- private addTailwindPrefixToClasses;
640
- /**
641
- * Converts a style object to a CSS string.
642
- * @param {string | Record<string, string> | null | undefined} styleObj - The style object.
643
- * @returns {string} The CSS style string.
644
- * @private
645
- */
646
- private convertStyleObjectToString;
647
- /**
648
- * Parses a string of HTML and extracts builder components and global page settings.
649
- * - This method expects an **HTML string** containing one or more `<section>...</section>` elements (such as the output from `getSavedPageHtml()` or a previously saved builder HTML string).
650
- * - **Do NOT pass a JSON string** (such as the result of `JSON.stringify(componentsArray)`) to this method. Passing a JSON string to `DOMParser.parseFromString(..., 'text/html')` will not produce valid DOM nodes. Instead, it will treat the JSON as plain text, resulting in a `<html><head></head><body>{...json...}</body></html>` structure, not real HTML elements.
651
- * - If you pass a JSON string, you will see lots of `\n` and strange HTML, because the parser is just wrapping your JSON in a `<body>` tag as text.
652
- *
653
- * Why only HTML?
654
- * - It enforces a single source of truth for builder state (HTML).
655
- * - It prevents misuse (e.g., passing JSON to a DOM parser, which is always a bug).
656
- * - It makes your documentation and support much simpler.
657
- *
658
- * @param htmlString - The HTML string to parse (must contain `<section>...</section>` elements, not JSON).
659
- * @returns An object with `components` (array of builder components) and `pageSettings` (global styles for the page).
660
- */
661
- parsePageBuilderHTML(htmlString: string): {
662
- components: ComponentObject[];
663
- pageSettings: PageSettings;
664
- };
665
- /**
666
- * Applies modified components by mounting them to the DOM and attaching listeners.
667
- * @param htmlString - The HTML string to apply
668
- * @returns {Promise<string | null>} - Returns error message if failed, otherwise null
669
- */
670
- applyModifiedHTML(htmlString: string): Promise<string | null>;
671
- private validateMountingHTML;
672
- /**
673
- * Applies modified components by mounting them to the DOM and attaching listeners.
674
- * @param htmlString - The HTML string to apply
675
- * @returns {Promise<string | null>} - Returns error message if failed, otherwise null
676
- */
677
- applyModifiedComponents(htmlString: string): Promise<string | null>;
678
- /**
679
- * Mounts builder components to the DOM from an HTML string.
680
- *
681
- * Input format detection:
682
- * - If the input starts with `[` or `{`: treated as JSON (array or object).
683
- * - If the input starts with `<`: treated as HTML.
684
- *
685
- * This function should be used when:
686
- * - Restoring the builder from a published HTML snapshot.
687
- * - Importing a static HTML export.
688
- * - Loading the builder from previously published or saved HTML (e.g., from `getSavedPageHtml()`).
689
- *
690
- * Typical use cases include restoring a published state, importing templates, or previewing published content.
691
- */
692
- private mountComponentsToDOM;
693
- private updateLocalStorageItemName;
694
- /**
695
- * Initializes the styles for the currently selected element.
696
- */
697
- initializeElementStyles(): Promise<void>;
698
- }