@elementor/editor-elements 4.4.0-beta3 → 4.4.1
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/index.d.mts +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.js +105 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +7 -0
- package/src/sync/create-element.ts +1 -0
- package/src/sync/create-elements.ts +5 -3
- package/src/sync/delete-element.ts +1 -0
- package/src/sync/duplicate-element.ts +1 -0
- package/src/sync/duplicate-elements.ts +5 -3
- package/src/sync/get-element-widget-markers.ts +41 -0
- package/src/sync/move-element.ts +1 -0
- package/src/sync/move-elements.ts +5 -2
- package/src/sync/regenerate-local-style-ids.ts +55 -0
- package/src/sync/remove-elements.ts +5 -3
- package/src/sync/types.ts +9 -0
package/dist/index.d.mts
CHANGED
|
@@ -218,6 +218,14 @@ type V1ElementModelProps = {
|
|
|
218
218
|
isGlobal?: boolean;
|
|
219
219
|
skipDefaultChildren?: boolean;
|
|
220
220
|
hydrateDefaultChildren?: boolean;
|
|
221
|
+
widget?: V1ElementWidgetMarker;
|
|
222
|
+
part?: string;
|
|
223
|
+
slot?: boolean;
|
|
224
|
+
};
|
|
225
|
+
type V1ElementWidgetMarker = {
|
|
226
|
+
id: string;
|
|
227
|
+
version: number;
|
|
228
|
+
values?: Record<string, unknown>;
|
|
221
229
|
};
|
|
222
230
|
type V1ElementData = Omit<V1ElementModelProps, 'elements'> & {
|
|
223
231
|
elements?: V1ElementData[];
|
|
@@ -341,6 +349,7 @@ type Options$4 = {
|
|
|
341
349
|
useHistory?: boolean;
|
|
342
350
|
at?: number;
|
|
343
351
|
clone?: boolean;
|
|
352
|
+
origin?: string;
|
|
344
353
|
};
|
|
345
354
|
type CreateElementParams = {
|
|
346
355
|
container: V1Element;
|
|
@@ -356,6 +365,7 @@ type CreateElementsParams = {
|
|
|
356
365
|
elements: CreateElementParams[];
|
|
357
366
|
title: string;
|
|
358
367
|
subtitle?: string;
|
|
368
|
+
origin?: string;
|
|
359
369
|
};
|
|
360
370
|
type CreatedElement = {
|
|
361
371
|
container: V1Element;
|
|
@@ -369,11 +379,12 @@ type CreatedElementsResult = {
|
|
|
369
379
|
createdElements: CreatedElement[];
|
|
370
380
|
};
|
|
371
381
|
|
|
372
|
-
declare const createElements: ({ elements, title, subtitle, }: CreateElementsParams) => CreatedElementsResult;
|
|
382
|
+
declare const createElements: ({ elements, title, subtitle, origin, }: CreateElementsParams) => CreatedElementsResult;
|
|
373
383
|
|
|
374
384
|
type Options$3 = {
|
|
375
385
|
useHistory?: boolean;
|
|
376
386
|
at?: number;
|
|
387
|
+
origin?: string;
|
|
377
388
|
};
|
|
378
389
|
type DeleteElementParams = {
|
|
379
390
|
container: V1Element;
|
|
@@ -400,6 +411,7 @@ type Options$1 = {
|
|
|
400
411
|
useHistory?: boolean;
|
|
401
412
|
at?: number;
|
|
402
413
|
clone?: boolean;
|
|
414
|
+
origin?: string;
|
|
403
415
|
};
|
|
404
416
|
type DuplicateElementParams = {
|
|
405
417
|
element: V1Element;
|
|
@@ -413,6 +425,7 @@ type DuplicateElementsParams = {
|
|
|
413
425
|
subtitle?: string;
|
|
414
426
|
onDuplicateElements?: () => void;
|
|
415
427
|
onRestoreElements?: () => void;
|
|
428
|
+
origin?: string;
|
|
416
429
|
};
|
|
417
430
|
type DuplicatedElement = {
|
|
418
431
|
container: V1Element;
|
|
@@ -426,7 +439,7 @@ type DuplicatedElementsResult = {
|
|
|
426
439
|
duplicatedElements: DuplicatedElement[];
|
|
427
440
|
};
|
|
428
441
|
|
|
429
|
-
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
442
|
+
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, origin, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
430
443
|
|
|
431
444
|
type CloneableElement = Partial<V1ElementModelProps> | BackboneModel;
|
|
432
445
|
declare function cloneElementTree(item: CloneableElement): V1ElementModelProps;
|
|
@@ -467,6 +480,20 @@ declare const getElementStyles: (elementID: ElementID) => Record<string, StyleDe
|
|
|
467
480
|
|
|
468
481
|
declare function getElementType(type: string): ElementType | null;
|
|
469
482
|
|
|
483
|
+
declare const WIDGET_MARKER_KEYS: {
|
|
484
|
+
readonly widget: "widget";
|
|
485
|
+
readonly part: "part";
|
|
486
|
+
readonly slot: "slot";
|
|
487
|
+
};
|
|
488
|
+
declare function getContainerWidgetMarker(container: V1Element | null): Required<V1ElementWidgetMarker> | null;
|
|
489
|
+
declare function getContainerPart(container: V1Element | null): string | null;
|
|
490
|
+
declare function isContainerSlot(container: V1Element | null): boolean;
|
|
491
|
+
|
|
492
|
+
declare function regenerateLocalStyleIds(element: V1ElementData): {
|
|
493
|
+
styles: Record<StyleDefinitionID, StyleDefinition> | undefined;
|
|
494
|
+
settings: V1ElementSettingsProps | undefined;
|
|
495
|
+
};
|
|
496
|
+
|
|
470
497
|
declare function getAllDescendants(container: V1Element): V1Element[];
|
|
471
498
|
|
|
472
499
|
type V1Model = V1Element['model'];
|
|
@@ -490,6 +517,7 @@ type Options = {
|
|
|
490
517
|
useHistory?: boolean;
|
|
491
518
|
at?: number;
|
|
492
519
|
edit?: boolean;
|
|
520
|
+
origin?: string;
|
|
493
521
|
};
|
|
494
522
|
type MoveElementParams = {
|
|
495
523
|
element: V1Element;
|
|
@@ -514,6 +542,7 @@ type MoveElementsParams = {
|
|
|
514
542
|
subtitle?: string;
|
|
515
543
|
onMoveElements?: () => void;
|
|
516
544
|
onRestoreElements?: () => void;
|
|
545
|
+
origin?: string;
|
|
517
546
|
};
|
|
518
547
|
type MovedElement = {
|
|
519
548
|
element: V1Element;
|
|
@@ -529,7 +558,7 @@ type MovedElementsResult = {
|
|
|
529
558
|
movedElements: MovedElement[];
|
|
530
559
|
};
|
|
531
560
|
|
|
532
|
-
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, }: MoveElementsParams) => MovedElementsResult;
|
|
561
|
+
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, origin, }: MoveElementsParams) => MovedElementsResult;
|
|
533
562
|
|
|
534
563
|
type RemoveElementsParams = {
|
|
535
564
|
elementIds: string[];
|
|
@@ -537,6 +566,7 @@ type RemoveElementsParams = {
|
|
|
537
566
|
subtitle?: string;
|
|
538
567
|
onRemoveElements?: () => void;
|
|
539
568
|
onRestoreElements?: () => void;
|
|
569
|
+
origin?: string;
|
|
540
570
|
};
|
|
541
571
|
type RemovedElement = {
|
|
542
572
|
container: V1Element;
|
|
@@ -549,7 +579,7 @@ type RemovedElement = {
|
|
|
549
579
|
type RemovedElementsResult = {
|
|
550
580
|
removedElements: RemovedElement[];
|
|
551
581
|
};
|
|
552
|
-
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveElementsParams) => RemovedElementsResult;
|
|
582
|
+
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, origin, }: RemoveElementsParams) => RemovedElementsResult;
|
|
553
583
|
|
|
554
584
|
type ReplaceElementArgs = {
|
|
555
585
|
currentElementId: string;
|
|
@@ -629,4 +659,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
629
659
|
}) => void;
|
|
630
660
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
631
661
|
|
|
632
|
-
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, cloneElementTree, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findClosestContainer, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
662
|
+
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, type V1ElementWidgetMarker, WIDGET_MARKER_KEYS, addModelToParent, bindSettingsReconcile, cloneElementTree, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findClosestContainer, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getContainerPart, getContainerWidgetMarker, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isContainerSlot, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, regenerateLocalStyleIds, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -218,6 +218,14 @@ type V1ElementModelProps = {
|
|
|
218
218
|
isGlobal?: boolean;
|
|
219
219
|
skipDefaultChildren?: boolean;
|
|
220
220
|
hydrateDefaultChildren?: boolean;
|
|
221
|
+
widget?: V1ElementWidgetMarker;
|
|
222
|
+
part?: string;
|
|
223
|
+
slot?: boolean;
|
|
224
|
+
};
|
|
225
|
+
type V1ElementWidgetMarker = {
|
|
226
|
+
id: string;
|
|
227
|
+
version: number;
|
|
228
|
+
values?: Record<string, unknown>;
|
|
221
229
|
};
|
|
222
230
|
type V1ElementData = Omit<V1ElementModelProps, 'elements'> & {
|
|
223
231
|
elements?: V1ElementData[];
|
|
@@ -341,6 +349,7 @@ type Options$4 = {
|
|
|
341
349
|
useHistory?: boolean;
|
|
342
350
|
at?: number;
|
|
343
351
|
clone?: boolean;
|
|
352
|
+
origin?: string;
|
|
344
353
|
};
|
|
345
354
|
type CreateElementParams = {
|
|
346
355
|
container: V1Element;
|
|
@@ -356,6 +365,7 @@ type CreateElementsParams = {
|
|
|
356
365
|
elements: CreateElementParams[];
|
|
357
366
|
title: string;
|
|
358
367
|
subtitle?: string;
|
|
368
|
+
origin?: string;
|
|
359
369
|
};
|
|
360
370
|
type CreatedElement = {
|
|
361
371
|
container: V1Element;
|
|
@@ -369,11 +379,12 @@ type CreatedElementsResult = {
|
|
|
369
379
|
createdElements: CreatedElement[];
|
|
370
380
|
};
|
|
371
381
|
|
|
372
|
-
declare const createElements: ({ elements, title, subtitle, }: CreateElementsParams) => CreatedElementsResult;
|
|
382
|
+
declare const createElements: ({ elements, title, subtitle, origin, }: CreateElementsParams) => CreatedElementsResult;
|
|
373
383
|
|
|
374
384
|
type Options$3 = {
|
|
375
385
|
useHistory?: boolean;
|
|
376
386
|
at?: number;
|
|
387
|
+
origin?: string;
|
|
377
388
|
};
|
|
378
389
|
type DeleteElementParams = {
|
|
379
390
|
container: V1Element;
|
|
@@ -400,6 +411,7 @@ type Options$1 = {
|
|
|
400
411
|
useHistory?: boolean;
|
|
401
412
|
at?: number;
|
|
402
413
|
clone?: boolean;
|
|
414
|
+
origin?: string;
|
|
403
415
|
};
|
|
404
416
|
type DuplicateElementParams = {
|
|
405
417
|
element: V1Element;
|
|
@@ -413,6 +425,7 @@ type DuplicateElementsParams = {
|
|
|
413
425
|
subtitle?: string;
|
|
414
426
|
onDuplicateElements?: () => void;
|
|
415
427
|
onRestoreElements?: () => void;
|
|
428
|
+
origin?: string;
|
|
416
429
|
};
|
|
417
430
|
type DuplicatedElement = {
|
|
418
431
|
container: V1Element;
|
|
@@ -426,7 +439,7 @@ type DuplicatedElementsResult = {
|
|
|
426
439
|
duplicatedElements: DuplicatedElement[];
|
|
427
440
|
};
|
|
428
441
|
|
|
429
|
-
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
442
|
+
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, origin, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
430
443
|
|
|
431
444
|
type CloneableElement = Partial<V1ElementModelProps> | BackboneModel;
|
|
432
445
|
declare function cloneElementTree(item: CloneableElement): V1ElementModelProps;
|
|
@@ -467,6 +480,20 @@ declare const getElementStyles: (elementID: ElementID) => Record<string, StyleDe
|
|
|
467
480
|
|
|
468
481
|
declare function getElementType(type: string): ElementType | null;
|
|
469
482
|
|
|
483
|
+
declare const WIDGET_MARKER_KEYS: {
|
|
484
|
+
readonly widget: "widget";
|
|
485
|
+
readonly part: "part";
|
|
486
|
+
readonly slot: "slot";
|
|
487
|
+
};
|
|
488
|
+
declare function getContainerWidgetMarker(container: V1Element | null): Required<V1ElementWidgetMarker> | null;
|
|
489
|
+
declare function getContainerPart(container: V1Element | null): string | null;
|
|
490
|
+
declare function isContainerSlot(container: V1Element | null): boolean;
|
|
491
|
+
|
|
492
|
+
declare function regenerateLocalStyleIds(element: V1ElementData): {
|
|
493
|
+
styles: Record<StyleDefinitionID, StyleDefinition> | undefined;
|
|
494
|
+
settings: V1ElementSettingsProps | undefined;
|
|
495
|
+
};
|
|
496
|
+
|
|
470
497
|
declare function getAllDescendants(container: V1Element): V1Element[];
|
|
471
498
|
|
|
472
499
|
type V1Model = V1Element['model'];
|
|
@@ -490,6 +517,7 @@ type Options = {
|
|
|
490
517
|
useHistory?: boolean;
|
|
491
518
|
at?: number;
|
|
492
519
|
edit?: boolean;
|
|
520
|
+
origin?: string;
|
|
493
521
|
};
|
|
494
522
|
type MoveElementParams = {
|
|
495
523
|
element: V1Element;
|
|
@@ -514,6 +542,7 @@ type MoveElementsParams = {
|
|
|
514
542
|
subtitle?: string;
|
|
515
543
|
onMoveElements?: () => void;
|
|
516
544
|
onRestoreElements?: () => void;
|
|
545
|
+
origin?: string;
|
|
517
546
|
};
|
|
518
547
|
type MovedElement = {
|
|
519
548
|
element: V1Element;
|
|
@@ -529,7 +558,7 @@ type MovedElementsResult = {
|
|
|
529
558
|
movedElements: MovedElement[];
|
|
530
559
|
};
|
|
531
560
|
|
|
532
|
-
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, }: MoveElementsParams) => MovedElementsResult;
|
|
561
|
+
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, origin, }: MoveElementsParams) => MovedElementsResult;
|
|
533
562
|
|
|
534
563
|
type RemoveElementsParams = {
|
|
535
564
|
elementIds: string[];
|
|
@@ -537,6 +566,7 @@ type RemoveElementsParams = {
|
|
|
537
566
|
subtitle?: string;
|
|
538
567
|
onRemoveElements?: () => void;
|
|
539
568
|
onRestoreElements?: () => void;
|
|
569
|
+
origin?: string;
|
|
540
570
|
};
|
|
541
571
|
type RemovedElement = {
|
|
542
572
|
container: V1Element;
|
|
@@ -549,7 +579,7 @@ type RemovedElement = {
|
|
|
549
579
|
type RemovedElementsResult = {
|
|
550
580
|
removedElements: RemovedElement[];
|
|
551
581
|
};
|
|
552
|
-
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveElementsParams) => RemovedElementsResult;
|
|
582
|
+
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, origin, }: RemoveElementsParams) => RemovedElementsResult;
|
|
553
583
|
|
|
554
584
|
type ReplaceElementArgs = {
|
|
555
585
|
currentElementId: string;
|
|
@@ -629,4 +659,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
629
659
|
}) => void;
|
|
630
660
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
631
661
|
|
|
632
|
-
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, cloneElementTree, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findClosestContainer, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
662
|
+
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, type V1ElementWidgetMarker, WIDGET_MARKER_KEYS, addModelToParent, bindSettingsReconcile, cloneElementTree, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findClosestContainer, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getContainerPart, getContainerWidgetMarker, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isContainerSlot, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, regenerateLocalStyleIds, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
DEFAULT_STYLE_CLASS_PREFIX: () => DEFAULT_STYLE_CLASS_PREFIX,
|
|
24
24
|
ELEMENT_STYLE_CHANGE_EVENT: () => ELEMENT_STYLE_CHANGE_EVENT,
|
|
25
|
+
WIDGET_MARKER_KEYS: () => WIDGET_MARKER_KEYS,
|
|
25
26
|
addModelToParent: () => addModelToParent,
|
|
26
27
|
bindSettingsReconcile: () => bindSettingsReconcile,
|
|
27
28
|
cloneElementTree: () => cloneElementTree,
|
|
@@ -42,6 +43,8 @@ __export(index_exports, {
|
|
|
42
43
|
getAnchoredAncestorId: () => getAnchoredAncestorId,
|
|
43
44
|
getAnchoredDescendantId: () => getAnchoredDescendantId,
|
|
44
45
|
getContainer: () => getContainer,
|
|
46
|
+
getContainerPart: () => getContainerPart,
|
|
47
|
+
getContainerWidgetMarker: () => getContainerWidgetMarker,
|
|
45
48
|
getCurrentDocumentContainer: () => getCurrentDocumentContainer,
|
|
46
49
|
getCurrentDocumentId: () => getCurrentDocumentId,
|
|
47
50
|
getDefaultStyleTagFromPreviewElement: () => getDefaultStyleTagFromPreviewElement,
|
|
@@ -62,12 +65,14 @@ __export(index_exports, {
|
|
|
62
65
|
getPreviewElementDOM: () => getPreviewElementDOM,
|
|
63
66
|
getSelectedElements: () => getSelectedElements,
|
|
64
67
|
getWidgetsCache: () => getWidgetsCache,
|
|
68
|
+
isContainerSlot: () => isContainerSlot,
|
|
65
69
|
isElementAnchored: () => isElementAnchored,
|
|
66
70
|
moveElement: () => moveElement,
|
|
67
71
|
moveElements: () => moveElements,
|
|
68
72
|
parseDefaultStyleTagFromClassList: () => parseDefaultStyleTagFromClassList,
|
|
69
73
|
playElementInteractions: () => playElementInteractions,
|
|
70
74
|
reconcileInitialChildren: () => reconcileInitialChildren,
|
|
75
|
+
regenerateLocalStyleIds: () => regenerateLocalStyleIds,
|
|
71
76
|
removeElements: () => removeElements,
|
|
72
77
|
removeModelFromParent: () => removeModelFromParent,
|
|
73
78
|
replaceElement: () => replaceElement,
|
|
@@ -620,7 +625,8 @@ function deleteElement({ container, options = {} }) {
|
|
|
620
625
|
var createElements = ({
|
|
621
626
|
elements,
|
|
622
627
|
title,
|
|
623
|
-
subtitle = (0, import_i18n.__)("Item added", "elementor")
|
|
628
|
+
subtitle = (0, import_i18n.__)("Item added", "elementor"),
|
|
629
|
+
origin
|
|
624
630
|
}) => {
|
|
625
631
|
const undoableCreate = (0, import_editor_v1_adapters9.undoable)(
|
|
626
632
|
{
|
|
@@ -634,7 +640,7 @@ var createElements = ({
|
|
|
634
640
|
const element = createElement({
|
|
635
641
|
container: parentContainer,
|
|
636
642
|
...elementParams,
|
|
637
|
-
options: { ...options, useHistory: false }
|
|
643
|
+
options: { ...options, useHistory: false, origin }
|
|
638
644
|
});
|
|
639
645
|
createdElements.push({
|
|
640
646
|
container: element,
|
|
@@ -653,7 +659,7 @@ var createElements = ({
|
|
|
653
659
|
if (freshContainer) {
|
|
654
660
|
deleteElement({
|
|
655
661
|
container: freshContainer,
|
|
656
|
-
options: { useHistory: false }
|
|
662
|
+
options: { useHistory: false, origin }
|
|
657
663
|
});
|
|
658
664
|
return;
|
|
659
665
|
}
|
|
@@ -668,7 +674,7 @@ var createElements = ({
|
|
|
668
674
|
const element = createElement({
|
|
669
675
|
container: freshParent,
|
|
670
676
|
model,
|
|
671
|
-
options: { ...options, useHistory: false }
|
|
677
|
+
options: { ...options, useHistory: false, origin }
|
|
672
678
|
});
|
|
673
679
|
newElements.push({
|
|
674
680
|
container: element,
|
|
@@ -734,7 +740,8 @@ var duplicateElements = ({
|
|
|
734
740
|
title,
|
|
735
741
|
subtitle = (0, import_i18n2.__)("Item duplicated", "elementor"),
|
|
736
742
|
onDuplicateElements,
|
|
737
|
-
onRestoreElements
|
|
743
|
+
onRestoreElements,
|
|
744
|
+
origin
|
|
738
745
|
}) => {
|
|
739
746
|
const undoableDuplicate = (0, import_editor_v1_adapters12.undoable)(
|
|
740
747
|
{
|
|
@@ -748,7 +755,7 @@ var duplicateElements = ({
|
|
|
748
755
|
}
|
|
749
756
|
const duplicatedElement = duplicateElement({
|
|
750
757
|
element: originalContainer,
|
|
751
|
-
options: { useHistory: false }
|
|
758
|
+
options: { useHistory: false, origin }
|
|
752
759
|
});
|
|
753
760
|
if (!duplicatedElement.parent) {
|
|
754
761
|
return;
|
|
@@ -771,7 +778,7 @@ var duplicateElements = ({
|
|
|
771
778
|
if (freshContainer) {
|
|
772
779
|
deleteElement({
|
|
773
780
|
container: freshContainer,
|
|
774
|
-
options: { useHistory: false }
|
|
781
|
+
options: { useHistory: false, origin }
|
|
775
782
|
});
|
|
776
783
|
return;
|
|
777
784
|
}
|
|
@@ -787,7 +794,7 @@ var duplicateElements = ({
|
|
|
787
794
|
const createdElement = createElement({
|
|
788
795
|
container: freshParent,
|
|
789
796
|
model,
|
|
790
|
-
options: { useHistory: false, clone: false, at }
|
|
797
|
+
options: { useHistory: false, clone: false, at, origin }
|
|
791
798
|
});
|
|
792
799
|
duplicatedElements.push({
|
|
793
800
|
container: createdElement,
|
|
@@ -978,6 +985,74 @@ var getElementStyles = (elementID) => {
|
|
|
978
985
|
return container?.model.get("styles") || null;
|
|
979
986
|
};
|
|
980
987
|
|
|
988
|
+
// src/sync/get-element-widget-markers.ts
|
|
989
|
+
var import_schema = require("@elementor/schema");
|
|
990
|
+
var WIDGET_ID_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
|
|
991
|
+
var PART_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
992
|
+
var MIN_VERSION = 1;
|
|
993
|
+
var WIDGET_MARKER_KEYS = {
|
|
994
|
+
widget: "widget",
|
|
995
|
+
part: "part",
|
|
996
|
+
slot: "slot"
|
|
997
|
+
};
|
|
998
|
+
var widgetMarkerSchema = import_schema.z.object({
|
|
999
|
+
id: import_schema.z.string().regex(WIDGET_ID_PATTERN),
|
|
1000
|
+
version: import_schema.z.number().int().min(MIN_VERSION),
|
|
1001
|
+
values: import_schema.z.record(import_schema.z.unknown()).optional()
|
|
1002
|
+
});
|
|
1003
|
+
var partSchema = import_schema.z.string().regex(PART_PATTERN);
|
|
1004
|
+
function getContainerWidgetMarker(container) {
|
|
1005
|
+
const result = widgetMarkerSchema.safeParse(container?.model.get(WIDGET_MARKER_KEYS.widget));
|
|
1006
|
+
if (!result.success) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
return { ...result.data, values: result.data.values ?? {} };
|
|
1010
|
+
}
|
|
1011
|
+
function getContainerPart(container) {
|
|
1012
|
+
const result = partSchema.safeParse(container?.model.get(WIDGET_MARKER_KEYS.part));
|
|
1013
|
+
return result.success ? result.data : null;
|
|
1014
|
+
}
|
|
1015
|
+
function isContainerSlot(container) {
|
|
1016
|
+
return true === container?.model.get(WIDGET_MARKER_KEYS.slot) && null !== getContainerPart(container);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// src/sync/regenerate-local-style-ids.ts
|
|
1020
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1021
|
+
function regenerateLocalStyleIds(element) {
|
|
1022
|
+
const originalStyles = element.styles;
|
|
1023
|
+
if (!originalStyles || Object.keys(originalStyles).length === 0) {
|
|
1024
|
+
return { styles: void 0, settings: void 0 };
|
|
1025
|
+
}
|
|
1026
|
+
const newStyles = {};
|
|
1027
|
+
const styleIdMapping = {};
|
|
1028
|
+
for (const [originalStyleId, style] of Object.entries(originalStyles)) {
|
|
1029
|
+
const newStyleId = generateLocalStyleId(element.id);
|
|
1030
|
+
newStyles[newStyleId] = { ...style, id: newStyleId };
|
|
1031
|
+
styleIdMapping[originalStyleId] = newStyleId;
|
|
1032
|
+
}
|
|
1033
|
+
const settings = element.settings;
|
|
1034
|
+
if (!settings || Object.keys(settings).length === 0) {
|
|
1035
|
+
return { styles: newStyles, settings: void 0 };
|
|
1036
|
+
}
|
|
1037
|
+
const updatedSettings = { ...settings };
|
|
1038
|
+
for (const [propKey, propValue] of Object.entries(updatedSettings)) {
|
|
1039
|
+
if (isClassesProp(propValue) && propValue.value.length > 0) {
|
|
1040
|
+
const updatedClasses = propValue.value.map((classId) => styleIdMapping[classId] ?? classId);
|
|
1041
|
+
updatedSettings[propKey] = import_editor_props2.classesPropTypeUtil.create(updatedClasses);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return {
|
|
1045
|
+
styles: newStyles,
|
|
1046
|
+
settings: updatedSettings
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
function isClassesProp(prop) {
|
|
1050
|
+
return import_editor_props2.classesPropTypeUtil.isValid(prop);
|
|
1051
|
+
}
|
|
1052
|
+
function generateLocalStyleId(elementId) {
|
|
1053
|
+
return `e-${elementId}-${generateElementId()}`;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
981
1056
|
// src/sync/get-all-descendants.ts
|
|
982
1057
|
function getAllDescendants(container) {
|
|
983
1058
|
const children = (container.children ?? []).flatMap((child) => getAllDescendants(child));
|
|
@@ -1053,7 +1128,8 @@ var moveElements = ({
|
|
|
1053
1128
|
title,
|
|
1054
1129
|
subtitle = (0, import_i18n3.__)("Elements moved", "elementor"),
|
|
1055
1130
|
onMoveElements,
|
|
1056
|
-
onRestoreElements
|
|
1131
|
+
onRestoreElements,
|
|
1132
|
+
origin
|
|
1057
1133
|
}) => {
|
|
1058
1134
|
const undoableMove = (0, import_editor_v1_adapters13.undoable)(
|
|
1059
1135
|
{
|
|
@@ -1077,7 +1153,7 @@ var moveElements = ({
|
|
|
1077
1153
|
const newElement = moveElement({
|
|
1078
1154
|
element: sourceElement,
|
|
1079
1155
|
targetContainer: target,
|
|
1080
|
-
options: { ...options, useHistory: false }
|
|
1156
|
+
options: { ...options, useHistory: false, origin }
|
|
1081
1157
|
});
|
|
1082
1158
|
movedElements.push({
|
|
1083
1159
|
element: newElement,
|
|
@@ -1105,7 +1181,8 @@ var moveElements = ({
|
|
|
1105
1181
|
targetContainer: freshOriginalContainer,
|
|
1106
1182
|
options: {
|
|
1107
1183
|
useHistory: false,
|
|
1108
|
-
at: originalIndex >= 0 ? originalIndex : void 0
|
|
1184
|
+
at: originalIndex >= 0 ? originalIndex : void 0,
|
|
1185
|
+
origin
|
|
1109
1186
|
}
|
|
1110
1187
|
});
|
|
1111
1188
|
});
|
|
@@ -1133,7 +1210,7 @@ var moveElements = ({
|
|
|
1133
1210
|
const newElement = moveElement({
|
|
1134
1211
|
element: freshElement,
|
|
1135
1212
|
targetContainer: freshTarget,
|
|
1136
|
-
options: { ...options, useHistory: false }
|
|
1213
|
+
options: { ...options, useHistory: false, origin }
|
|
1137
1214
|
});
|
|
1138
1215
|
newMovedElements.push({
|
|
1139
1216
|
element: newElement,
|
|
@@ -1166,7 +1243,8 @@ var removeElements = ({
|
|
|
1166
1243
|
title,
|
|
1167
1244
|
subtitle = (0, import_i18n4.__)("Item removed", "elementor"),
|
|
1168
1245
|
onRemoveElements,
|
|
1169
|
-
onRestoreElements
|
|
1246
|
+
onRestoreElements,
|
|
1247
|
+
origin
|
|
1170
1248
|
}) => {
|
|
1171
1249
|
const undoableRemove = (0, import_editor_v1_adapters14.undoable)(
|
|
1172
1250
|
{
|
|
@@ -1189,7 +1267,7 @@ var removeElements = ({
|
|
|
1189
1267
|
removedElements.forEach(({ container }) => {
|
|
1190
1268
|
deleteElement({
|
|
1191
1269
|
container,
|
|
1192
|
-
options: { useHistory: false }
|
|
1270
|
+
options: { useHistory: false, origin }
|
|
1193
1271
|
});
|
|
1194
1272
|
});
|
|
1195
1273
|
return { removedElements };
|
|
@@ -1202,7 +1280,7 @@ var removeElements = ({
|
|
|
1202
1280
|
createElement({
|
|
1203
1281
|
container: freshParent,
|
|
1204
1282
|
model,
|
|
1205
|
-
options: { useHistory: false, at }
|
|
1283
|
+
options: { useHistory: false, at, origin }
|
|
1206
1284
|
});
|
|
1207
1285
|
return;
|
|
1208
1286
|
}
|
|
@@ -1218,7 +1296,7 @@ var removeElements = ({
|
|
|
1218
1296
|
if (freshContainer && freshParent) {
|
|
1219
1297
|
deleteElement({
|
|
1220
1298
|
container: freshContainer,
|
|
1221
|
-
options: { useHistory: false }
|
|
1299
|
+
options: { useHistory: false, origin }
|
|
1222
1300
|
});
|
|
1223
1301
|
newRemovedElements.push({
|
|
1224
1302
|
container: freshContainer,
|
|
@@ -1436,11 +1514,11 @@ var styleRerenderEvents = [
|
|
|
1436
1514
|
];
|
|
1437
1515
|
|
|
1438
1516
|
// src/styles/create-element-style.ts
|
|
1439
|
-
var
|
|
1517
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1440
1518
|
var import_editor_styles = require("@elementor/editor-styles");
|
|
1441
1519
|
|
|
1442
1520
|
// src/styles/mutate-element-styles.ts
|
|
1443
|
-
var
|
|
1521
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
1444
1522
|
var import_editor_v1_adapters18 = require("@elementor/editor-v1-adapters");
|
|
1445
1523
|
function mutateElementStyles(elementId, mutator) {
|
|
1446
1524
|
const container = getContainer(elementId);
|
|
@@ -1495,7 +1573,7 @@ function clearRemovedClasses(container, { oldIds, newIds }) {
|
|
|
1495
1573
|
function getClassesProps(container) {
|
|
1496
1574
|
return Object.entries(container.settings.toJSON()).filter((prop) => {
|
|
1497
1575
|
const [, value] = prop;
|
|
1498
|
-
return
|
|
1576
|
+
return import_editor_props3.classesPropTypeUtil.isValid(value);
|
|
1499
1577
|
});
|
|
1500
1578
|
}
|
|
1501
1579
|
function notifyChanges() {
|
|
@@ -1534,7 +1612,7 @@ function createElementStyle({
|
|
|
1534
1612
|
}
|
|
1535
1613
|
function addStyleToClassesProp(elementId, classesProp, styleId) {
|
|
1536
1614
|
const base = getElementSetting(elementId, classesProp);
|
|
1537
|
-
const classesPropValue =
|
|
1615
|
+
const classesPropValue = import_editor_props4.classesPropTypeUtil.create(
|
|
1538
1616
|
(prev) => {
|
|
1539
1617
|
return [...prev ?? [], styleId];
|
|
1540
1618
|
},
|
|
@@ -1561,7 +1639,7 @@ function deleteElementStyle(elementId, styleId) {
|
|
|
1561
1639
|
}
|
|
1562
1640
|
|
|
1563
1641
|
// src/styles/update-element-style.ts
|
|
1564
|
-
var
|
|
1642
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
1565
1643
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
1566
1644
|
function updateElementStyle(args) {
|
|
1567
1645
|
mutateElementStyles(args.elementId, (styles) => {
|
|
@@ -1572,7 +1650,7 @@ function updateElementStyle(args) {
|
|
|
1572
1650
|
const variant = (0, import_editor_styles2.getVariantByMeta)(style, args.meta);
|
|
1573
1651
|
const customCss = ("custom_css" in args ? args.custom_css : variant?.custom_css) ?? null;
|
|
1574
1652
|
if (variant) {
|
|
1575
|
-
variant.props = (0,
|
|
1653
|
+
variant.props = (0, import_editor_props5.mergeProps)(variant.props, args.props);
|
|
1576
1654
|
variant.custom_css = customCss?.raw ? customCss : null;
|
|
1577
1655
|
} else {
|
|
1578
1656
|
style.variants.push({ meta: args.meta, props: args.props, custom_css: customCss });
|
|
@@ -1656,6 +1734,7 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1656
1734
|
0 && (module.exports = {
|
|
1657
1735
|
DEFAULT_STYLE_CLASS_PREFIX,
|
|
1658
1736
|
ELEMENT_STYLE_CHANGE_EVENT,
|
|
1737
|
+
WIDGET_MARKER_KEYS,
|
|
1659
1738
|
addModelToParent,
|
|
1660
1739
|
bindSettingsReconcile,
|
|
1661
1740
|
cloneElementTree,
|
|
@@ -1676,6 +1755,8 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1676
1755
|
getAnchoredAncestorId,
|
|
1677
1756
|
getAnchoredDescendantId,
|
|
1678
1757
|
getContainer,
|
|
1758
|
+
getContainerPart,
|
|
1759
|
+
getContainerWidgetMarker,
|
|
1679
1760
|
getCurrentDocumentContainer,
|
|
1680
1761
|
getCurrentDocumentId,
|
|
1681
1762
|
getDefaultStyleTagFromPreviewElement,
|
|
@@ -1696,12 +1777,14 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1696
1777
|
getPreviewElementDOM,
|
|
1697
1778
|
getSelectedElements,
|
|
1698
1779
|
getWidgetsCache,
|
|
1780
|
+
isContainerSlot,
|
|
1699
1781
|
isElementAnchored,
|
|
1700
1782
|
moveElement,
|
|
1701
1783
|
moveElements,
|
|
1702
1784
|
parseDefaultStyleTagFromClassList,
|
|
1703
1785
|
playElementInteractions,
|
|
1704
1786
|
reconcileInitialChildren,
|
|
1787
|
+
regenerateLocalStyleIds,
|
|
1705
1788
|
removeElements,
|
|
1706
1789
|
removeModelFromParent,
|
|
1707
1790
|
replaceElement,
|