@elementor/editor-elements 4.0.0-543 → 4.0.0-545
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 +40 -36
- package/dist/index.d.ts +40 -36
- package/dist/index.js +174 -183
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -182
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/hooks/use-element-children.ts +1 -1
- package/src/index.ts +2 -8
- package/src/sync/create-element.ts +3 -10
- package/src/sync/create-elements.ts +42 -35
- package/src/sync/delete-element.ts +5 -12
- package/src/sync/duplicate-element.ts +4 -12
- package/src/sync/duplicate-elements.ts +40 -44
- package/src/sync/{get-model.ts → model-utils.ts} +8 -22
- package/src/sync/move-element.ts +13 -15
- package/src/sync/move-elements.ts +73 -51
- package/src/sync/remove-elements.ts +37 -29
- package/src/sync/replace-element.ts +20 -21
- package/src/sync/types.ts +1 -0
- package/src/sync/update-element-editor-settings.ts +1 -5
- package/src/sync/update-element-interactions.ts +1 -5
- package/src/sync/update-element-settings.ts +4 -0
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,7 @@ type V1Element = {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
parent?: V1Element;
|
|
91
|
+
lookup?: () => V1Element;
|
|
91
92
|
};
|
|
92
93
|
type StringPropValue = {
|
|
93
94
|
$$type: 'string';
|
|
@@ -230,39 +231,41 @@ type Options$4 = {
|
|
|
230
231
|
clone?: boolean;
|
|
231
232
|
};
|
|
232
233
|
type CreateElementParams = {
|
|
233
|
-
|
|
234
|
-
options?: Options$4;
|
|
234
|
+
container: V1Element;
|
|
235
235
|
model?: Omit<V1ElementModelProps, 'settings' | 'id'> & {
|
|
236
236
|
settings?: V1ElementSettingsProps;
|
|
237
237
|
id?: string;
|
|
238
238
|
};
|
|
239
|
+
options?: Options$4;
|
|
239
240
|
};
|
|
240
|
-
declare function createElement({
|
|
241
|
+
declare function createElement({ container, model, options }: CreateElementParams): V1Element;
|
|
241
242
|
|
|
242
|
-
type
|
|
243
|
+
type CreateElementsParams = {
|
|
243
244
|
elements: CreateElementParams[];
|
|
244
245
|
title: string;
|
|
245
246
|
subtitle?: string;
|
|
246
247
|
};
|
|
247
248
|
type CreatedElement = {
|
|
248
|
-
|
|
249
|
+
container: V1Element;
|
|
250
|
+
parentContainer: V1Element;
|
|
249
251
|
model: V1ElementModelProps;
|
|
250
|
-
|
|
252
|
+
options?: CreateElementParams['options'];
|
|
251
253
|
};
|
|
252
254
|
type CreatedElementsResult = {
|
|
253
255
|
createdElements: CreatedElement[];
|
|
254
256
|
};
|
|
255
257
|
|
|
256
|
-
declare const createElements: ({ elements, title, subtitle, }:
|
|
258
|
+
declare const createElements: ({ elements, title, subtitle, }: CreateElementsParams) => CreatedElementsResult;
|
|
257
259
|
|
|
258
260
|
type Options$3 = {
|
|
259
261
|
useHistory?: boolean;
|
|
260
262
|
at?: number;
|
|
261
263
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
type DeleteElementParams = {
|
|
265
|
+
container: V1Element;
|
|
264
266
|
options?: Options$3;
|
|
265
|
-
}
|
|
267
|
+
};
|
|
268
|
+
declare function deleteElement({ container, options }: DeleteElementParams): Promise<void>;
|
|
266
269
|
|
|
267
270
|
type Options$2 = {
|
|
268
271
|
useHistory?: boolean;
|
|
@@ -285,10 +288,10 @@ type Options$1 = {
|
|
|
285
288
|
clone?: boolean;
|
|
286
289
|
};
|
|
287
290
|
type DuplicateElementParams = {
|
|
288
|
-
|
|
291
|
+
element: V1Element;
|
|
289
292
|
options?: Options$1;
|
|
290
293
|
};
|
|
291
|
-
declare function duplicateElement({
|
|
294
|
+
declare function duplicateElement({ element, options }: DuplicateElementParams): V1Element;
|
|
292
295
|
|
|
293
296
|
type DuplicateElementsParams = {
|
|
294
297
|
elementIds: string[];
|
|
@@ -298,11 +301,9 @@ type DuplicateElementsParams = {
|
|
|
298
301
|
onRestoreElements?: () => void;
|
|
299
302
|
};
|
|
300
303
|
type DuplicatedElement = {
|
|
301
|
-
|
|
304
|
+
container: V1Element;
|
|
305
|
+
parentContainer: V1Element;
|
|
302
306
|
model: V1ElementModelProps;
|
|
303
|
-
originalElementId: string;
|
|
304
|
-
modelToRestore?: V1ElementModelProps;
|
|
305
|
-
parentContainerId?: string;
|
|
306
307
|
at?: number;
|
|
307
308
|
};
|
|
308
309
|
type DuplicatedElementsResult = {
|
|
@@ -337,7 +338,6 @@ type V1Model = V1Element['model'];
|
|
|
337
338
|
type ModelResult = {
|
|
338
339
|
model: V1Model;
|
|
339
340
|
};
|
|
340
|
-
declare function getModel(id: string, parentModel?: V1Model): ModelResult | null;
|
|
341
341
|
declare function findChildRecursive(model: V1Model, predicate: (model: V1Model) => boolean): ModelResult | null;
|
|
342
342
|
declare function getElementChildren(model: V1Model, predicate?: (model: V1Model) => boolean): ModelResult[];
|
|
343
343
|
|
|
@@ -354,29 +354,35 @@ type Options = {
|
|
|
354
354
|
edit?: boolean;
|
|
355
355
|
};
|
|
356
356
|
type MoveElementParams = {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
element: V1Element;
|
|
358
|
+
targetContainer: V1Element;
|
|
359
359
|
options?: Options;
|
|
360
360
|
};
|
|
361
|
-
declare function moveElement({
|
|
361
|
+
declare function moveElement({ element, targetContainer, options }: MoveElementParams): V1Element;
|
|
362
362
|
|
|
363
|
+
type MoveOptions = {
|
|
364
|
+
useHistory?: boolean;
|
|
365
|
+
at?: number;
|
|
366
|
+
edit?: boolean;
|
|
367
|
+
};
|
|
368
|
+
type MoveInput = {
|
|
369
|
+
element: V1Element;
|
|
370
|
+
targetContainer: V1Element;
|
|
371
|
+
options?: MoveOptions;
|
|
372
|
+
};
|
|
363
373
|
type MoveElementsParams = {
|
|
364
|
-
moves:
|
|
374
|
+
moves: MoveInput[];
|
|
365
375
|
title: string;
|
|
366
376
|
subtitle?: string;
|
|
367
377
|
onMoveElements?: () => void;
|
|
368
378
|
onRestoreElements?: () => void;
|
|
369
379
|
};
|
|
370
|
-
type OriginalPosition = {
|
|
371
|
-
elementId: string;
|
|
372
|
-
originalContainerId: string;
|
|
373
|
-
originalIndex: number;
|
|
374
|
-
};
|
|
375
380
|
type MovedElement = {
|
|
376
|
-
elementId: string;
|
|
377
|
-
originalPosition: OriginalPosition;
|
|
378
|
-
move: MoveElementParams;
|
|
379
381
|
element: V1Element;
|
|
382
|
+
originalContainer: V1Element;
|
|
383
|
+
originalIndex: number;
|
|
384
|
+
targetContainer: V1Element;
|
|
385
|
+
options?: MoveOptions;
|
|
380
386
|
};
|
|
381
387
|
type MovedElementsResult = {
|
|
382
388
|
movedElements: MovedElement[];
|
|
@@ -384,7 +390,7 @@ type MovedElementsResult = {
|
|
|
384
390
|
|
|
385
391
|
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, }: MoveElementsParams) => MovedElementsResult;
|
|
386
392
|
|
|
387
|
-
type
|
|
393
|
+
type RemoveElementsParams = {
|
|
388
394
|
elementIds: string[];
|
|
389
395
|
title: string;
|
|
390
396
|
subtitle?: string;
|
|
@@ -392,17 +398,15 @@ type RemoveNestedElementsParams = {
|
|
|
392
398
|
onRestoreElements?: () => void;
|
|
393
399
|
};
|
|
394
400
|
type RemovedElement = {
|
|
395
|
-
|
|
401
|
+
container: V1Element;
|
|
402
|
+
parent: V1Element;
|
|
396
403
|
model: V1ElementModelProps;
|
|
397
|
-
parent: V1Element | null;
|
|
398
404
|
at: number;
|
|
399
405
|
};
|
|
400
406
|
type RemovedElementsResult = {
|
|
401
|
-
elementIds: string[];
|
|
402
407
|
removedElements: RemovedElement[];
|
|
403
408
|
};
|
|
404
|
-
|
|
405
|
-
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveNestedElementsParams) => RemovedElementsResult;
|
|
409
|
+
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveElementsParams) => RemovedElementsResult;
|
|
406
410
|
|
|
407
411
|
type ReplaceElementArgs = {
|
|
408
412
|
currentElement: V1ElementData;
|
|
@@ -478,4 +482,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
478
482
|
}) => void;
|
|
479
483
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
480
484
|
|
|
481
|
-
export { type AnimationPresetPropValue, type BooleanPropValue, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, 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 ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type
|
|
485
|
+
export { type AnimationPresetPropValue, type BooleanPropValue, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, 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 ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, findChildRecursive, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, removeElements, replaceElement, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useElementInteractions, useElementSetting, useElementSettings, useParentElement, useSelectedElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ type V1Element = {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
parent?: V1Element;
|
|
91
|
+
lookup?: () => V1Element;
|
|
91
92
|
};
|
|
92
93
|
type StringPropValue = {
|
|
93
94
|
$$type: 'string';
|
|
@@ -230,39 +231,41 @@ type Options$4 = {
|
|
|
230
231
|
clone?: boolean;
|
|
231
232
|
};
|
|
232
233
|
type CreateElementParams = {
|
|
233
|
-
|
|
234
|
-
options?: Options$4;
|
|
234
|
+
container: V1Element;
|
|
235
235
|
model?: Omit<V1ElementModelProps, 'settings' | 'id'> & {
|
|
236
236
|
settings?: V1ElementSettingsProps;
|
|
237
237
|
id?: string;
|
|
238
238
|
};
|
|
239
|
+
options?: Options$4;
|
|
239
240
|
};
|
|
240
|
-
declare function createElement({
|
|
241
|
+
declare function createElement({ container, model, options }: CreateElementParams): V1Element;
|
|
241
242
|
|
|
242
|
-
type
|
|
243
|
+
type CreateElementsParams = {
|
|
243
244
|
elements: CreateElementParams[];
|
|
244
245
|
title: string;
|
|
245
246
|
subtitle?: string;
|
|
246
247
|
};
|
|
247
248
|
type CreatedElement = {
|
|
248
|
-
|
|
249
|
+
container: V1Element;
|
|
250
|
+
parentContainer: V1Element;
|
|
249
251
|
model: V1ElementModelProps;
|
|
250
|
-
|
|
252
|
+
options?: CreateElementParams['options'];
|
|
251
253
|
};
|
|
252
254
|
type CreatedElementsResult = {
|
|
253
255
|
createdElements: CreatedElement[];
|
|
254
256
|
};
|
|
255
257
|
|
|
256
|
-
declare const createElements: ({ elements, title, subtitle, }:
|
|
258
|
+
declare const createElements: ({ elements, title, subtitle, }: CreateElementsParams) => CreatedElementsResult;
|
|
257
259
|
|
|
258
260
|
type Options$3 = {
|
|
259
261
|
useHistory?: boolean;
|
|
260
262
|
at?: number;
|
|
261
263
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
type DeleteElementParams = {
|
|
265
|
+
container: V1Element;
|
|
264
266
|
options?: Options$3;
|
|
265
|
-
}
|
|
267
|
+
};
|
|
268
|
+
declare function deleteElement({ container, options }: DeleteElementParams): Promise<void>;
|
|
266
269
|
|
|
267
270
|
type Options$2 = {
|
|
268
271
|
useHistory?: boolean;
|
|
@@ -285,10 +288,10 @@ type Options$1 = {
|
|
|
285
288
|
clone?: boolean;
|
|
286
289
|
};
|
|
287
290
|
type DuplicateElementParams = {
|
|
288
|
-
|
|
291
|
+
element: V1Element;
|
|
289
292
|
options?: Options$1;
|
|
290
293
|
};
|
|
291
|
-
declare function duplicateElement({
|
|
294
|
+
declare function duplicateElement({ element, options }: DuplicateElementParams): V1Element;
|
|
292
295
|
|
|
293
296
|
type DuplicateElementsParams = {
|
|
294
297
|
elementIds: string[];
|
|
@@ -298,11 +301,9 @@ type DuplicateElementsParams = {
|
|
|
298
301
|
onRestoreElements?: () => void;
|
|
299
302
|
};
|
|
300
303
|
type DuplicatedElement = {
|
|
301
|
-
|
|
304
|
+
container: V1Element;
|
|
305
|
+
parentContainer: V1Element;
|
|
302
306
|
model: V1ElementModelProps;
|
|
303
|
-
originalElementId: string;
|
|
304
|
-
modelToRestore?: V1ElementModelProps;
|
|
305
|
-
parentContainerId?: string;
|
|
306
307
|
at?: number;
|
|
307
308
|
};
|
|
308
309
|
type DuplicatedElementsResult = {
|
|
@@ -337,7 +338,6 @@ type V1Model = V1Element['model'];
|
|
|
337
338
|
type ModelResult = {
|
|
338
339
|
model: V1Model;
|
|
339
340
|
};
|
|
340
|
-
declare function getModel(id: string, parentModel?: V1Model): ModelResult | null;
|
|
341
341
|
declare function findChildRecursive(model: V1Model, predicate: (model: V1Model) => boolean): ModelResult | null;
|
|
342
342
|
declare function getElementChildren(model: V1Model, predicate?: (model: V1Model) => boolean): ModelResult[];
|
|
343
343
|
|
|
@@ -354,29 +354,35 @@ type Options = {
|
|
|
354
354
|
edit?: boolean;
|
|
355
355
|
};
|
|
356
356
|
type MoveElementParams = {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
element: V1Element;
|
|
358
|
+
targetContainer: V1Element;
|
|
359
359
|
options?: Options;
|
|
360
360
|
};
|
|
361
|
-
declare function moveElement({
|
|
361
|
+
declare function moveElement({ element, targetContainer, options }: MoveElementParams): V1Element;
|
|
362
362
|
|
|
363
|
+
type MoveOptions = {
|
|
364
|
+
useHistory?: boolean;
|
|
365
|
+
at?: number;
|
|
366
|
+
edit?: boolean;
|
|
367
|
+
};
|
|
368
|
+
type MoveInput = {
|
|
369
|
+
element: V1Element;
|
|
370
|
+
targetContainer: V1Element;
|
|
371
|
+
options?: MoveOptions;
|
|
372
|
+
};
|
|
363
373
|
type MoveElementsParams = {
|
|
364
|
-
moves:
|
|
374
|
+
moves: MoveInput[];
|
|
365
375
|
title: string;
|
|
366
376
|
subtitle?: string;
|
|
367
377
|
onMoveElements?: () => void;
|
|
368
378
|
onRestoreElements?: () => void;
|
|
369
379
|
};
|
|
370
|
-
type OriginalPosition = {
|
|
371
|
-
elementId: string;
|
|
372
|
-
originalContainerId: string;
|
|
373
|
-
originalIndex: number;
|
|
374
|
-
};
|
|
375
380
|
type MovedElement = {
|
|
376
|
-
elementId: string;
|
|
377
|
-
originalPosition: OriginalPosition;
|
|
378
|
-
move: MoveElementParams;
|
|
379
381
|
element: V1Element;
|
|
382
|
+
originalContainer: V1Element;
|
|
383
|
+
originalIndex: number;
|
|
384
|
+
targetContainer: V1Element;
|
|
385
|
+
options?: MoveOptions;
|
|
380
386
|
};
|
|
381
387
|
type MovedElementsResult = {
|
|
382
388
|
movedElements: MovedElement[];
|
|
@@ -384,7 +390,7 @@ type MovedElementsResult = {
|
|
|
384
390
|
|
|
385
391
|
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, }: MoveElementsParams) => MovedElementsResult;
|
|
386
392
|
|
|
387
|
-
type
|
|
393
|
+
type RemoveElementsParams = {
|
|
388
394
|
elementIds: string[];
|
|
389
395
|
title: string;
|
|
390
396
|
subtitle?: string;
|
|
@@ -392,17 +398,15 @@ type RemoveNestedElementsParams = {
|
|
|
392
398
|
onRestoreElements?: () => void;
|
|
393
399
|
};
|
|
394
400
|
type RemovedElement = {
|
|
395
|
-
|
|
401
|
+
container: V1Element;
|
|
402
|
+
parent: V1Element;
|
|
396
403
|
model: V1ElementModelProps;
|
|
397
|
-
parent: V1Element | null;
|
|
398
404
|
at: number;
|
|
399
405
|
};
|
|
400
406
|
type RemovedElementsResult = {
|
|
401
|
-
elementIds: string[];
|
|
402
407
|
removedElements: RemovedElement[];
|
|
403
408
|
};
|
|
404
|
-
|
|
405
|
-
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveNestedElementsParams) => RemovedElementsResult;
|
|
409
|
+
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveElementsParams) => RemovedElementsResult;
|
|
406
410
|
|
|
407
411
|
type ReplaceElementArgs = {
|
|
408
412
|
currentElement: V1ElementData;
|
|
@@ -478,4 +482,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
478
482
|
}) => void;
|
|
479
483
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
480
484
|
|
|
481
|
-
export { type AnimationPresetPropValue, type BooleanPropValue, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, 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 ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type
|
|
485
|
+
export { type AnimationPresetPropValue, type BooleanPropValue, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, 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 ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, findChildRecursive, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, removeElements, replaceElement, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useElementInteractions, useElementSetting, useElementSettings, useParentElement, useSelectedElement };
|