@elementor/editor-elements 3.33.0-270 → 3.33.0-272
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 +123 -122
- package/dist/index.d.ts +123 -122
- package/dist/index.js +487 -481
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +476 -470
- 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/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,66 @@ 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
|
+
};
|
|
262
|
+
type OriginalPosition = {
|
|
263
|
+
elementId: string;
|
|
264
|
+
originalContainerId: string;
|
|
265
|
+
originalIndex: number;
|
|
266
|
+
};
|
|
267
|
+
type MovedElement = {
|
|
268
|
+
elementId: string;
|
|
269
|
+
originalPosition: OriginalPosition;
|
|
270
|
+
move: MoveElementParams;
|
|
271
|
+
element: V1Element;
|
|
272
|
+
};
|
|
273
|
+
type MovedElementsResult = {
|
|
274
|
+
movedElements: MovedElement[];
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
declare const moveElements: ({ moves: movesToMake, title, subtitle, }: MoveElementsParams) => MovedElementsResult;
|
|
241
278
|
|
|
242
279
|
type RemoveNestedElementsParams = {
|
|
243
280
|
elementIds: string[];
|
|
@@ -259,37 +296,6 @@ type RemovedElementsResult = {
|
|
|
259
296
|
|
|
260
297
|
declare const removeElements: ({ elementIds, title, subtitle, onRemoveElements, onRestoreElements, }: RemoveNestedElementsParams) => RemovedElementsResult;
|
|
261
298
|
|
|
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
299
|
type ReplaceElementArgs = {
|
|
294
300
|
currentElement: V1ElementData;
|
|
295
301
|
newElement: Omit<V1ElementModelProps, 'id'>;
|
|
@@ -297,22 +303,31 @@ type ReplaceElementArgs = {
|
|
|
297
303
|
};
|
|
298
304
|
declare const replaceElement: ({ currentElement, newElement, withHistory }: ReplaceElementArgs) => void;
|
|
299
305
|
|
|
300
|
-
declare
|
|
306
|
+
declare const updateElementEditorSettings: ({ elementId, settings, }: {
|
|
307
|
+
elementId: string;
|
|
308
|
+
settings: V1ElementModelProps["editor_settings"];
|
|
309
|
+
}) => void;
|
|
301
310
|
|
|
302
|
-
type
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
311
|
+
type UpdateElementSettingsArgs = {
|
|
312
|
+
id: ElementID;
|
|
313
|
+
props: Props;
|
|
314
|
+
withHistory?: boolean;
|
|
306
315
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
316
|
+
declare const updateElementSettings: ({ id, props, withHistory }: UpdateElementSettingsArgs) => void;
|
|
317
|
+
|
|
318
|
+
type LinkInLinkRestriction = {
|
|
319
|
+
shouldRestrict: true;
|
|
320
|
+
reason: 'ancestor' | 'descendant';
|
|
321
|
+
elementId: string | null;
|
|
322
|
+
} | {
|
|
323
|
+
shouldRestrict: false;
|
|
324
|
+
reason?: never;
|
|
325
|
+
elementId?: never;
|
|
314
326
|
};
|
|
315
|
-
declare function
|
|
327
|
+
declare function getLinkInLinkRestriction(elementId: string): LinkInLinkRestriction;
|
|
328
|
+
declare function getAnchoredDescendantId(elementId: string): string | null;
|
|
329
|
+
declare function getAnchoredAncestorId(elementId: string): string | null;
|
|
330
|
+
declare function isElementAnchored(elementId: string): boolean;
|
|
316
331
|
|
|
317
332
|
declare const ELEMENT_STYLE_CHANGE_EVENT = "elementor/editor-v2/editor-elements/style";
|
|
318
333
|
declare const styleRerenderEvents: (_elementor_editor_v1_adapters.CommandEventDescriptor | _elementor_editor_v1_adapters.WindowEventDescriptor)[];
|
|
@@ -333,6 +348,8 @@ declare function shouldCreateNewLocalStyle<T>(payload: {
|
|
|
333
348
|
provider: T | null;
|
|
334
349
|
} | null): boolean;
|
|
335
350
|
|
|
351
|
+
declare function deleteElementStyle(elementId: ElementID, styleId: StyleDefinitionID): void;
|
|
352
|
+
|
|
336
353
|
type UpdateElementStyleArgs = {
|
|
337
354
|
elementId: ElementID;
|
|
338
355
|
styleId: StyleDefinition['id'];
|
|
@@ -342,21 +359,7 @@ type UpdateElementStyleArgs = {
|
|
|
342
359
|
};
|
|
343
360
|
declare function updateElementStyle(args: UpdateElementStyleArgs): void;
|
|
344
361
|
|
|
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;
|
|
362
|
+
declare const useElementInteractions: (elementId: ElementID) => string;
|
|
360
363
|
|
|
361
364
|
declare function getElementInteractions(elementId: ElementID): string;
|
|
362
365
|
|
|
@@ -366,8 +369,6 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
366
369
|
}) => void;
|
|
367
370
|
declare const playElementInteractions: (elementId: string) => void;
|
|
368
371
|
|
|
369
|
-
declare const useElementInteractions: (elementId: ElementID) => string;
|
|
370
|
-
|
|
371
372
|
declare function initMcp(): void;
|
|
372
373
|
|
|
373
374
|
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 };
|