@elementor/editor-elements 3.33.0-271 → 3.33.0-273
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 +125 -122
- package/dist/index.d.ts +125 -122
- package/dist/index.js +478 -469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +486 -477
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +35 -35
- package/src/sync/get-widgets-cache.ts +4 -3
- package/src/sync/move-elements.ts +11 -0
- package/src/sync/remove-elements.ts +9 -9
- package/src/sync/types.ts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -87,7 +87,7 @@ type V1ElementEditorSettingsProps = {
|
|
|
87
87
|
component_uid?: string;
|
|
88
88
|
};
|
|
89
89
|
type V1ElementSettingsProps = Record<string, PropValue>;
|
|
90
|
-
type V1ElementConfig = {
|
|
90
|
+
type V1ElementConfig<T = object> = {
|
|
91
91
|
title: string;
|
|
92
92
|
controls: object;
|
|
93
93
|
atomic?: boolean;
|
|
@@ -99,7 +99,7 @@ type V1ElementConfig = {
|
|
|
99
99
|
base_styles?: Record<string, StyleDefinition>;
|
|
100
100
|
base_styles_dictionary?: Record<string, string>;
|
|
101
101
|
atomic_style_states?: ClassState[];
|
|
102
|
-
};
|
|
102
|
+
} & T;
|
|
103
103
|
type V1Model<T> = {
|
|
104
104
|
get: <K extends keyof T>(key: K) => T[K];
|
|
105
105
|
set: <K extends keyof T>(key: K, value: T[K]) => void;
|
|
@@ -108,9 +108,19 @@ type V1Model<T> = {
|
|
|
108
108
|
}) => T;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
type ElementModel = {
|
|
112
|
+
id: string;
|
|
113
|
+
};
|
|
114
|
+
type ElementChildren = Record<string, ElementModel[]>;
|
|
115
|
+
declare function useElementChildren<T extends ElementChildren>(elementId: ElementID, childrenTypes: (keyof T & string)[]): T;
|
|
116
|
+
|
|
117
|
+
declare const useElementEditorSettings: (elementId: ElementID) => V1ElementEditorSettingsProps;
|
|
118
|
+
|
|
111
119
|
declare const useElementSetting: <TValue>(elementId: ElementID, settingKey: string) => TValue | null;
|
|
112
120
|
declare const useElementSettings: <TValue>(elementId: ElementID, settingKeys: string[]) => Record<string, TValue>;
|
|
113
121
|
|
|
122
|
+
declare function useParentElement(elementId: string | null): any;
|
|
123
|
+
|
|
114
124
|
declare function useSelectedElement(): {
|
|
115
125
|
element: null;
|
|
116
126
|
elementType: null;
|
|
@@ -119,16 +129,6 @@ declare function useSelectedElement(): {
|
|
|
119
129
|
elementType: ElementType;
|
|
120
130
|
};
|
|
121
131
|
|
|
122
|
-
declare function useParentElement(elementId: string | null): any;
|
|
123
|
-
|
|
124
|
-
type ElementModel = {
|
|
125
|
-
id: string;
|
|
126
|
-
};
|
|
127
|
-
type ElementChildren = Record<string, ElementModel[]>;
|
|
128
|
-
declare function useElementChildren<T extends ElementChildren>(elementId: ElementID, childrenTypes: (keyof T & string)[]): T;
|
|
129
|
-
|
|
130
|
-
declare const useElementEditorSettings: (elementId: ElementID) => V1ElementEditorSettingsProps;
|
|
131
|
-
|
|
132
132
|
type Options$4 = {
|
|
133
133
|
useHistory?: boolean;
|
|
134
134
|
at?: number;
|
|
@@ -144,72 +144,57 @@ type CreateElementParams = {
|
|
|
144
144
|
};
|
|
145
145
|
declare function createElement({ containerId, model, options }: CreateElementParams): V1Element;
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
type CreateNestedElementsParams = {
|
|
148
|
+
elements: CreateElementParams[];
|
|
149
|
+
title: string;
|
|
150
|
+
subtitle?: string;
|
|
151
|
+
};
|
|
152
|
+
type CreatedElement = {
|
|
148
153
|
elementId: string;
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
model: V1ElementModelProps;
|
|
155
|
+
createParams: CreateElementParams;
|
|
156
|
+
};
|
|
157
|
+
type CreatedElementsResult = {
|
|
158
|
+
createdElements: CreatedElement[];
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
declare const createElements: ({ elements, title, subtitle, }: CreateNestedElementsParams) => CreatedElementsResult;
|
|
151
162
|
|
|
152
163
|
type Options$3 = {
|
|
153
164
|
useHistory?: boolean;
|
|
154
165
|
at?: number;
|
|
155
|
-
edit?: boolean;
|
|
156
166
|
};
|
|
157
|
-
|
|
167
|
+
declare function deleteElement({ elementId, options, }: {
|
|
158
168
|
elementId: string;
|
|
159
|
-
targetContainerId: string;
|
|
160
169
|
options?: Options$3;
|
|
161
|
-
}
|
|
162
|
-
declare function moveElement({ elementId, targetContainerId, options }: MoveElementParams): V1Element;
|
|
170
|
+
}): Promise<void>;
|
|
163
171
|
|
|
164
|
-
type
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
};
|
|
169
|
-
type OriginalPosition = {
|
|
170
|
-
elementId: string;
|
|
171
|
-
originalContainerId: string;
|
|
172
|
-
originalIndex: number;
|
|
173
|
-
};
|
|
174
|
-
type MovedElement = {
|
|
175
|
-
elementId: string;
|
|
176
|
-
originalPosition: OriginalPosition;
|
|
177
|
-
move: MoveElementParams;
|
|
178
|
-
element: V1Element;
|
|
172
|
+
type Options$2 = {
|
|
173
|
+
useHistory?: boolean;
|
|
174
|
+
at?: number;
|
|
175
|
+
scrollIntoView: boolean;
|
|
179
176
|
};
|
|
180
|
-
type
|
|
181
|
-
|
|
177
|
+
type DropElementParams = {
|
|
178
|
+
containerId: string;
|
|
179
|
+
options?: Options$2;
|
|
180
|
+
model?: Omit<V1ElementModelProps, 'settings' | 'id'> & {
|
|
181
|
+
settings?: V1ElementSettingsProps;
|
|
182
|
+
id?: string;
|
|
183
|
+
};
|
|
182
184
|
};
|
|
185
|
+
declare function dropElement({ containerId, model, options }: DropElementParams): V1Element;
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
type Options$2 = {
|
|
187
|
+
type Options$1 = {
|
|
187
188
|
useHistory?: boolean;
|
|
188
189
|
at?: number;
|
|
189
190
|
clone?: boolean;
|
|
190
191
|
};
|
|
191
192
|
type DuplicateElementParams = {
|
|
192
193
|
elementId: string;
|
|
193
|
-
options?: Options$
|
|
194
|
+
options?: Options$1;
|
|
194
195
|
};
|
|
195
196
|
declare function duplicateElement({ elementId, options }: DuplicateElementParams): V1Element;
|
|
196
197
|
|
|
197
|
-
type CreateNestedElementsParams = {
|
|
198
|
-
elements: CreateElementParams[];
|
|
199
|
-
title: string;
|
|
200
|
-
subtitle?: string;
|
|
201
|
-
};
|
|
202
|
-
type CreatedElement = {
|
|
203
|
-
elementId: string;
|
|
204
|
-
model: V1ElementModelProps;
|
|
205
|
-
createParams: CreateElementParams;
|
|
206
|
-
};
|
|
207
|
-
type CreatedElementsResult = {
|
|
208
|
-
createdElements: CreatedElement[];
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
declare const createElements: ({ elements, title, subtitle, }: CreateNestedElementsParams) => CreatedElementsResult;
|
|
212
|
-
|
|
213
198
|
type DuplicateElementsParams = {
|
|
214
199
|
elementIds: string[];
|
|
215
200
|
title: string;
|
|
@@ -230,14 +215,68 @@ type DuplicatedElementsResult = {
|
|
|
230
215
|
|
|
231
216
|
declare const duplicateElements: ({ elementIds, title, subtitle, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
232
217
|
|
|
233
|
-
|
|
218
|
+
declare const generateElementId: () => string;
|
|
219
|
+
|
|
220
|
+
declare function getContainer(id: string): V1Element | null;
|
|
221
|
+
declare const selectElement: (elementId: string) => void;
|
|
222
|
+
|
|
223
|
+
declare function getCurrentDocumentContainer(): V1Element | null;
|
|
224
|
+
|
|
225
|
+
declare function getCurrentDocumentId(): number | null;
|
|
226
|
+
|
|
227
|
+
declare function getElementEditorSettings(elementId: ElementID): V1ElementEditorSettingsProps;
|
|
228
|
+
|
|
229
|
+
declare function getElementLabel(elementId?: ElementID): string;
|
|
230
|
+
|
|
231
|
+
declare const getElementSetting: <TValue>(elementId: ElementID, settingKey: string) => TValue | null;
|
|
232
|
+
declare const getElementSettings: <TValue>(elementId: ElementID, settingKey: string[]) => Record<string, TValue | null>;
|
|
233
|
+
|
|
234
|
+
declare const getElementStyles: (elementID: ElementID) => Record<string, StyleDefinition> | null;
|
|
235
|
+
|
|
236
|
+
declare function getElementType(type: string): ElementType | null;
|
|
237
|
+
|
|
238
|
+
declare function getElements(root?: ElementID): V1Element[];
|
|
239
|
+
|
|
240
|
+
declare function getSelectedElements(): Element[];
|
|
241
|
+
|
|
242
|
+
type WidgetsCache<T> = Record<string, T>;
|
|
243
|
+
declare function getWidgetsCache<T extends V1ElementConfig>(): WidgetsCache<T> | null;
|
|
244
|
+
|
|
245
|
+
type Options = {
|
|
234
246
|
useHistory?: boolean;
|
|
235
247
|
at?: number;
|
|
248
|
+
edit?: boolean;
|
|
236
249
|
};
|
|
237
|
-
|
|
250
|
+
type MoveElementParams = {
|
|
238
251
|
elementId: string;
|
|
239
|
-
|
|
240
|
-
|
|
252
|
+
targetContainerId: string;
|
|
253
|
+
options?: Options;
|
|
254
|
+
};
|
|
255
|
+
declare function moveElement({ elementId, targetContainerId, options }: MoveElementParams): V1Element;
|
|
256
|
+
|
|
257
|
+
type MoveElementsParams = {
|
|
258
|
+
moves: MoveElementParams[];
|
|
259
|
+
title: string;
|
|
260
|
+
subtitle?: string;
|
|
261
|
+
onMoveElements?: () => void;
|
|
262
|
+
onRestoreElements?: () => void;
|
|
263
|
+
};
|
|
264
|
+
type OriginalPosition = {
|
|
265
|
+
elementId: string;
|
|
266
|
+
originalContainerId: string;
|
|
267
|
+
originalIndex: number;
|
|
268
|
+
};
|
|
269
|
+
type MovedElement = {
|
|
270
|
+
elementId: string;
|
|
271
|
+
originalPosition: OriginalPosition;
|
|
272
|
+
move: MoveElementParams;
|
|
273
|
+
element: V1Element;
|
|
274
|
+
};
|
|
275
|
+
type MovedElementsResult = {
|
|
276
|
+
movedElements: MovedElement[];
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
declare const moveElements: ({ moves: movesToMake, title, subtitle, onMoveElements, onRestoreElements, }: MoveElementsParams) => MovedElementsResult;
|
|
241
280
|
|
|
242
281
|
type RemoveNestedElementsParams = {
|
|
243
282
|
elementIds: string[];
|
|
@@ -259,37 +298,6 @@ type RemovedElementsResult = {
|
|
|
259
298
|
|
|
260
299
|
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveNestedElementsParams) => RemovedElementsResult;
|
|
261
300
|
|
|
262
|
-
declare function getContainer(id: string): V1Element | null;
|
|
263
|
-
declare const selectElement: (elementId: string) => void;
|
|
264
|
-
|
|
265
|
-
declare function getElementType(type: string): ElementType | null;
|
|
266
|
-
|
|
267
|
-
declare const getElementSetting: <TValue>(elementId: ElementID, settingKey: string) => TValue | null;
|
|
268
|
-
declare const getElementSettings: <TValue>(elementId: ElementID, settingKey: string[]) => Record<string, TValue | null>;
|
|
269
|
-
|
|
270
|
-
declare function getElementEditorSettings(elementId: ElementID): V1ElementEditorSettingsProps;
|
|
271
|
-
|
|
272
|
-
declare const getElementStyles: (elementID: ElementID) => Record<string, StyleDefinition> | null;
|
|
273
|
-
|
|
274
|
-
declare function getElementLabel(elementId?: ElementID): string;
|
|
275
|
-
|
|
276
|
-
declare function getElements(root?: ElementID): V1Element[];
|
|
277
|
-
|
|
278
|
-
declare function getCurrentDocumentId(): number | null;
|
|
279
|
-
|
|
280
|
-
declare function getSelectedElements(): Element[];
|
|
281
|
-
|
|
282
|
-
declare function getWidgetsCache(): Record<string, V1ElementConfig> | null;
|
|
283
|
-
|
|
284
|
-
type UpdateElementSettingsArgs = {
|
|
285
|
-
id: ElementID;
|
|
286
|
-
props: Props;
|
|
287
|
-
withHistory?: boolean;
|
|
288
|
-
};
|
|
289
|
-
declare const updateElementSettings: ({ id, props, withHistory }: UpdateElementSettingsArgs) => void;
|
|
290
|
-
|
|
291
|
-
declare const generateElementId: () => string;
|
|
292
|
-
|
|
293
301
|
type ReplaceElementArgs = {
|
|
294
302
|
currentElement: V1ElementData;
|
|
295
303
|
newElement: Omit<V1ElementModelProps, 'id'>;
|
|
@@ -297,22 +305,31 @@ type ReplaceElementArgs = {
|
|
|
297
305
|
};
|
|
298
306
|
declare const replaceElement: ({ currentElement, newElement, withHistory }: ReplaceElementArgs) => void;
|
|
299
307
|
|
|
300
|
-
declare
|
|
308
|
+
declare const updateElementEditorSettings: ({ elementId, settings, }: {
|
|
309
|
+
elementId: string;
|
|
310
|
+
settings: V1ElementModelProps["editor_settings"];
|
|
311
|
+
}) => void;
|
|
301
312
|
|
|
302
|
-
type
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
313
|
+
type UpdateElementSettingsArgs = {
|
|
314
|
+
id: ElementID;
|
|
315
|
+
props: Props;
|
|
316
|
+
withHistory?: boolean;
|
|
306
317
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
318
|
+
declare const updateElementSettings: ({ id, props, withHistory }: UpdateElementSettingsArgs) => void;
|
|
319
|
+
|
|
320
|
+
type LinkInLinkRestriction = {
|
|
321
|
+
shouldRestrict: true;
|
|
322
|
+
reason: 'ancestor' | 'descendant';
|
|
323
|
+
elementId: string | null;
|
|
324
|
+
} | {
|
|
325
|
+
shouldRestrict: false;
|
|
326
|
+
reason?: never;
|
|
327
|
+
elementId?: never;
|
|
314
328
|
};
|
|
315
|
-
declare function
|
|
329
|
+
declare function getLinkInLinkRestriction(elementId: string): LinkInLinkRestriction;
|
|
330
|
+
declare function getAnchoredDescendantId(elementId: string): string | null;
|
|
331
|
+
declare function getAnchoredAncestorId(elementId: string): string | null;
|
|
332
|
+
declare function isElementAnchored(elementId: string): boolean;
|
|
316
333
|
|
|
317
334
|
declare const ELEMENT_STYLE_CHANGE_EVENT = "elementor/editor-v2/editor-elements/style";
|
|
318
335
|
declare const styleRerenderEvents: (_elementor_editor_v1_adapters.CommandEventDescriptor | _elementor_editor_v1_adapters.WindowEventDescriptor)[];
|
|
@@ -333,6 +350,8 @@ declare function shouldCreateNewLocalStyle<T>(payload: {
|
|
|
333
350
|
provider: T | null;
|
|
334
351
|
} | null): boolean;
|
|
335
352
|
|
|
353
|
+
declare function deleteElementStyle(elementId: ElementID, styleId: StyleDefinitionID): void;
|
|
354
|
+
|
|
336
355
|
type UpdateElementStyleArgs = {
|
|
337
356
|
elementId: ElementID;
|
|
338
357
|
styleId: StyleDefinition['id'];
|
|
@@ -342,21 +361,7 @@ type UpdateElementStyleArgs = {
|
|
|
342
361
|
};
|
|
343
362
|
declare function updateElementStyle(args: UpdateElementStyleArgs): void;
|
|
344
363
|
|
|
345
|
-
declare
|
|
346
|
-
|
|
347
|
-
type LinkInLinkRestriction = {
|
|
348
|
-
shouldRestrict: true;
|
|
349
|
-
reason: 'ancestor' | 'descendant';
|
|
350
|
-
elementId: string | null;
|
|
351
|
-
} | {
|
|
352
|
-
shouldRestrict: false;
|
|
353
|
-
reason?: never;
|
|
354
|
-
elementId?: never;
|
|
355
|
-
};
|
|
356
|
-
declare function getLinkInLinkRestriction(elementId: string): LinkInLinkRestriction;
|
|
357
|
-
declare function getAnchoredDescendantId(elementId: string): string | null;
|
|
358
|
-
declare function getAnchoredAncestorId(elementId: string): string | null;
|
|
359
|
-
declare function isElementAnchored(elementId: string): boolean;
|
|
364
|
+
declare const useElementInteractions: (elementId: ElementID) => string;
|
|
360
365
|
|
|
361
366
|
declare function getElementInteractions(elementId: ElementID): string;
|
|
362
367
|
|
|
@@ -366,8 +371,6 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
366
371
|
}) => void;
|
|
367
372
|
declare const playElementInteractions: (elementId: string) => void;
|
|
368
373
|
|
|
369
|
-
declare const useElementInteractions: (elementId: ElementID) => string;
|
|
370
|
-
|
|
371
374
|
declare function initMcp(): void;
|
|
372
375
|
|
|
373
376
|
export { 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 ElementModel, type ElementType, type LinkInLinkRestriction, type MoveElementParams, type MoveElementsParams, type MovedElement, type MovedElementsResult, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementModelProps, type V1ElementSettingsProps, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, generateElementId, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getElementEditorSettings, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, initMcp as initElementsMcp, isElementAnchored, moveElement, moveElements, playElementInteractions, removeElements, replaceElement, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useElementInteractions, useElementSetting, useElementSettings, useParentElement, useSelectedElement };
|