@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/src/index.ts CHANGED
@@ -1,74 +1,74 @@
1
1
  // types
2
- export * from './types';
3
2
  export type {
4
3
  V1Element,
4
+ V1ElementConfig,
5
5
  V1ElementData,
6
6
  V1ElementModelProps,
7
7
  V1ElementSettingsProps,
8
- V1ElementConfig,
9
8
  } from './sync/types';
9
+ export * from './types';
10
10
 
11
11
  // hooks
12
- export { useElementSetting, useElementSettings } from './hooks/use-element-setting';
13
- export { useSelectedElement } from './hooks/use-selected-element';
14
- export { useParentElement } from './hooks/use-parent-element';
15
12
  export { useElementChildren, type ElementChildren, type ElementModel } from './hooks/use-element-children';
16
13
  export { useElementEditorSettings } from './hooks/use-element-editor-settings';
14
+ export { useElementSetting, useElementSettings } from './hooks/use-element-setting';
15
+ export { useParentElement } from './hooks/use-parent-element';
16
+ export { useSelectedElement } from './hooks/use-selected-element';
17
17
 
18
18
  // utils
19
19
  export { createElement, type CreateElementParams } from './sync/create-element';
20
- export { updateElementEditorSettings } from './sync/update-element-editor-settings';
21
- export { moveElement, type MoveElementParams } from './sync/move-element';
22
- export {
23
- moveElements,
24
- type MoveElementsParams,
25
- type MovedElement,
26
- type MovedElementsResult,
27
- } from './sync/move-elements';
28
- export { duplicateElement, type DuplicateElementParams } from './sync/duplicate-element';
29
20
  export { createElements } from './sync/create-elements';
21
+ export { deleteElement } from './sync/delete-element';
22
+ export { dropElement, type DropElementParams } from './sync/drop-element';
23
+ export { duplicateElement, type DuplicateElementParams } from './sync/duplicate-element';
30
24
  export {
31
25
  duplicateElements,
32
- type DuplicateElementsParams,
33
26
  type DuplicatedElement,
34
27
  type DuplicatedElementsResult,
28
+ type DuplicateElementsParams,
35
29
  } from './sync/duplicate-elements';
36
- export { deleteElement } from './sync/delete-element';
37
- export { removeElements } from './sync/remove-elements';
30
+ export { generateElementId } from './sync/generate-element-id';
38
31
  export { getContainer, selectElement } from './sync/get-container';
39
- export { getElementType } from './sync/get-element-type';
40
- export { getElementSetting, getElementSettings } from './sync/get-element-setting';
32
+ export { getCurrentDocumentContainer } from './sync/get-current-document-container';
33
+ export { getCurrentDocumentId } from './sync/get-current-document-id';
41
34
  export { getElementEditorSettings } from './sync/get-element-editor-settings';
42
- export { getElementStyles } from './sync/get-element-styles';
43
35
  export { getElementLabel } from './sync/get-element-label';
36
+ export { getElementSetting, getElementSettings } from './sync/get-element-setting';
37
+ export { getElementStyles } from './sync/get-element-styles';
38
+ export { getElementType } from './sync/get-element-type';
44
39
  export { getElements } from './sync/get-elements';
45
- export { getCurrentDocumentId } from './sync/get-current-document-id';
46
40
  export { getSelectedElements } from './sync/get-selected-elements';
47
41
  export { getWidgetsCache } from './sync/get-widgets-cache';
48
- export { updateElementSettings, type UpdateElementSettingsArgs } from './sync/update-element-settings';
49
- export { generateElementId } from './sync/generate-element-id';
42
+ export { moveElement, type MoveElementParams } from './sync/move-element';
43
+ export {
44
+ moveElements,
45
+ type MovedElement,
46
+ type MovedElementsResult,
47
+ type MoveElementsParams,
48
+ } from './sync/move-elements';
49
+ export { removeElements } from './sync/remove-elements';
50
50
  export { replaceElement } from './sync/replace-element';
51
- export { getCurrentDocumentContainer } from './sync/get-current-document-container';
52
- export { dropElement, type DropElementParams } from './sync/drop-element';
51
+ export { updateElementEditorSettings } from './sync/update-element-editor-settings';
52
+ export { updateElementSettings, type UpdateElementSettingsArgs } from './sync/update-element-settings';
53
53
 
54
+ export {
55
+ getAnchoredAncestorId,
56
+ getAnchoredDescendantId,
57
+ getLinkInLinkRestriction,
58
+ isElementAnchored,
59
+ type LinkInLinkRestriction,
60
+ } from './link-restriction';
54
61
  export { ELEMENT_STYLE_CHANGE_EVENT, styleRerenderEvents } from './styles/consts';
55
62
  export {
56
63
  createElementStyle,
57
64
  shouldCreateNewLocalStyle,
58
65
  type CreateElementStyleArgs,
59
66
  } from './styles/create-element-style';
60
- export { updateElementStyle, type UpdateElementStyleArgs } from './styles/update-element-style';
61
67
  export { deleteElementStyle } from './styles/delete-element-style';
62
- export {
63
- isElementAnchored,
64
- getAnchoredDescendantId,
65
- getAnchoredAncestorId,
66
- getLinkInLinkRestriction,
67
- type LinkInLinkRestriction,
68
- } from './link-restriction';
68
+ export { updateElementStyle, type UpdateElementStyleArgs } from './styles/update-element-style';
69
69
 
70
- export { getElementInteractions } from './sync/get-element-interactions';
71
- export { updateElementInteractions, playElementInteractions } from './sync/update-element-interactions';
72
70
  export { useElementInteractions } from './hooks/use-element-interactions';
71
+ export { getElementInteractions } from './sync/get-element-interactions';
72
+ export { playElementInteractions, updateElementInteractions } from './sync/update-element-interactions';
73
73
 
74
74
  export { initMcp as initElementsMcp } from './mcp';
@@ -1,7 +1,8 @@
1
- import { type ExtendedWindow } from './types';
1
+ import { type ExtendedWindow, type V1ElementConfig } from '../sync/types.js';
2
+ type WidgetsCache< T > = Record< string, T >;
2
3
 
3
- export function getWidgetsCache() {
4
+ export function getWidgetsCache< T extends V1ElementConfig >(): WidgetsCache< T > | null {
4
5
  const extendedWindow = window as unknown as ExtendedWindow;
5
6
 
6
- return extendedWindow?.elementor?.widgetsCache || null;
7
+ return ( extendedWindow?.elementor?.widgetsCache as WidgetsCache< T > ) || null;
7
8
  }
package/src/sync/types.ts CHANGED
@@ -66,7 +66,7 @@ export type V1ElementEditorSettingsProps = {
66
66
 
67
67
  export type V1ElementSettingsProps = Record< string, PropValue >;
68
68
 
69
- export type V1ElementConfig = {
69
+ export type V1ElementConfig< T = object > = {
70
70
  title: string;
71
71
  controls: object;
72
72
  atomic?: boolean;
@@ -78,7 +78,7 @@ export type V1ElementConfig = {
78
78
  base_styles?: Record< string, StyleDefinition >;
79
79
  base_styles_dictionary?: Record< string, string >;
80
80
  atomic_style_states?: ClassState[];
81
- };
81
+ } & T;
82
82
 
83
83
  type V1Model< T > = {
84
84
  get: < K extends keyof T >( key: K ) => T[ K ];