@elementor/editor-elements 4.2.0-beta1 → 4.3.0-1000

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { PropsSchema, PropValue, SizePropValue, AnyTransformable, Props, LinkPropValue } from '@elementor/editor-props';
1
+ import { PropsSchema, Dependency, PropValue, SizePropValue, AnyTransformable, Props, LinkPropValue } from '@elementor/editor-props';
2
2
  import { ClassState, StyleDefinitionID, StyleDefinition, StyleDefinitionVariant } from '@elementor/editor-styles';
3
3
  import * as _elementor_editor_v1_adapters from '@elementor/editor-v1-adapters';
4
4
 
@@ -58,6 +58,15 @@ type ElementControl = {
58
58
  type ControlItem = ControlsSection | Control | ElementControl;
59
59
  type ControlLayout = 'full' | 'two-columns' | 'custom';
60
60
 
61
+ type ChildDependencyRule = {
62
+ child_type: string;
63
+ when: Dependency;
64
+ position: ElementPosition;
65
+ stash: boolean;
66
+ default_model: V1ElementData | null;
67
+ };
68
+ type ChildDependenciesConfig = ChildDependencyRule[];
69
+
61
70
  type ExtendedWindow = Window & {
62
71
  $e?: {
63
72
  components?: {
@@ -203,14 +212,21 @@ type V1ElementModelProps = {
203
212
  interactions?: string | ElementInteractions;
204
213
  isGlobal?: boolean;
205
214
  skipDefaultChildren?: boolean;
215
+ hydrateDefaultChildren?: boolean;
206
216
  };
207
217
  type V1ElementData = Omit<V1ElementModelProps, 'elements'> & {
208
218
  elements?: V1ElementData[];
209
219
  };
220
+ type ElementPositionKind = 'last' | 'first' | 'index' | 'after_type' | 'before_type';
221
+ type ElementPosition = {
222
+ kind: ElementPositionKind;
223
+ value: number | string | null;
224
+ };
210
225
  type V1ElementEditorSettingsProps = {
211
226
  title?: string;
212
227
  initial_position?: number;
213
228
  component_uid?: string;
229
+ grid_outline?: boolean;
214
230
  };
215
231
  type V1ElementSettingsProps = Record<string, PropValue>;
216
232
  type V1ElementConfig<T = object, TChild = unknown> = {
@@ -233,6 +249,7 @@ type V1ElementConfig<T = object, TChild = unknown> = {
233
249
  show_in_panel?: boolean;
234
250
  allowed_child_types?: string[];
235
251
  default_children?: Array<Record<string, TChild>>;
252
+ children_dependencies?: ChildDependencyRule[];
236
253
  meta?: {
237
254
  [key: string]: string | number | boolean | null | NonNullable<V1ElementConfig['meta']>;
238
255
  };
@@ -244,7 +261,31 @@ type V1Model$1<T> = {
244
261
  remove?: string[];
245
262
  }) => T;
246
263
  trigger?: (event: string, ...args: unknown[]) => void;
264
+ on?: (event: string, callback: (...args: unknown[]) => void, context?: unknown) => void;
265
+ off?: (event: string, callback?: (...args: unknown[]) => void, context?: unknown) => void;
266
+ };
267
+
268
+ type ReactiveModel = {
269
+ get: (key: string) => unknown;
270
+ };
271
+ type BindSettingsReconcileArgs = {
272
+ model: ReactiveModel;
273
+ elementConfig: V1ElementConfig | undefined;
274
+ };
275
+ type Detach = () => void;
276
+ declare function bindSettingsReconcile({ model, elementConfig }: BindSettingsReconcileArgs): Detach;
277
+
278
+ declare function evaluateWhen(when: Dependency | undefined, settings: Record<string, PropValue>): boolean;
279
+
280
+ type ReconcileInitialChildrenArgs = {
281
+ elementId: string;
282
+ elementConfig: V1ElementConfig | undefined;
283
+ attributes: {
284
+ elements?: V1ElementData[];
285
+ settings?: V1ElementSettingsProps;
286
+ };
247
287
  };
288
+ declare function reconcileInitialChildren({ elementId, elementConfig, attributes, }: ReconcileInitialChildrenArgs): void;
248
289
 
249
290
  type ElementModel = {
250
291
  id: string;
@@ -385,8 +426,12 @@ declare function getCurrentDocumentId(): number | null;
385
426
 
386
427
  declare function getElementEditorSettings(elementId: ElementID): V1ElementEditorSettingsProps;
387
428
 
429
+ declare function getElementIcon(elementId: ElementID): string | null;
430
+
388
431
  declare function getElementLabel(elementId?: ElementID): string;
389
432
 
433
+ declare function getElementTitle(elementId: ElementID): string | null;
434
+
390
435
  declare const getElementSetting: <TValue>(elementId: ElementID, settingKey: string) => TValue | null;
391
436
  declare const getElementSettings: <TValue>(elementId: ElementID, settingKey: string[]) => Record<string, TValue | null>;
392
437
 
@@ -482,6 +527,8 @@ type ReplaceElementArgs = {
482
527
  };
483
528
  declare const replaceElement: ({ currentElementId, newElement, withHistory }: ReplaceElementArgs) => V1Element;
484
529
 
530
+ declare function resolveInsertIndex(position: ElementPosition, elements: V1ElementData[]): number;
531
+
485
532
  declare const updateElementEditorSettings: ({ elementId, settings, }: {
486
533
  elementId: string;
487
534
  settings: V1ElementModelProps["editor_settings"];
@@ -547,4 +594,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
547
594
  }) => void;
548
595
  declare const playElementInteractions: (elementId: string, interactionId: string) => void;
549
596
 
550
- export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, 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 PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, findChildRecursive, findModelInDocument, 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, removeModelFromParent, replaceElement, resolveContainer, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
597
+ 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, 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 V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PropsSchema, PropValue, SizePropValue, AnyTransformable, Props, LinkPropValue } from '@elementor/editor-props';
1
+ import { PropsSchema, Dependency, PropValue, SizePropValue, AnyTransformable, Props, LinkPropValue } from '@elementor/editor-props';
2
2
  import { ClassState, StyleDefinitionID, StyleDefinition, StyleDefinitionVariant } from '@elementor/editor-styles';
3
3
  import * as _elementor_editor_v1_adapters from '@elementor/editor-v1-adapters';
4
4
 
@@ -58,6 +58,15 @@ type ElementControl = {
58
58
  type ControlItem = ControlsSection | Control | ElementControl;
59
59
  type ControlLayout = 'full' | 'two-columns' | 'custom';
60
60
 
61
+ type ChildDependencyRule = {
62
+ child_type: string;
63
+ when: Dependency;
64
+ position: ElementPosition;
65
+ stash: boolean;
66
+ default_model: V1ElementData | null;
67
+ };
68
+ type ChildDependenciesConfig = ChildDependencyRule[];
69
+
61
70
  type ExtendedWindow = Window & {
62
71
  $e?: {
63
72
  components?: {
@@ -203,14 +212,21 @@ type V1ElementModelProps = {
203
212
  interactions?: string | ElementInteractions;
204
213
  isGlobal?: boolean;
205
214
  skipDefaultChildren?: boolean;
215
+ hydrateDefaultChildren?: boolean;
206
216
  };
207
217
  type V1ElementData = Omit<V1ElementModelProps, 'elements'> & {
208
218
  elements?: V1ElementData[];
209
219
  };
220
+ type ElementPositionKind = 'last' | 'first' | 'index' | 'after_type' | 'before_type';
221
+ type ElementPosition = {
222
+ kind: ElementPositionKind;
223
+ value: number | string | null;
224
+ };
210
225
  type V1ElementEditorSettingsProps = {
211
226
  title?: string;
212
227
  initial_position?: number;
213
228
  component_uid?: string;
229
+ grid_outline?: boolean;
214
230
  };
215
231
  type V1ElementSettingsProps = Record<string, PropValue>;
216
232
  type V1ElementConfig<T = object, TChild = unknown> = {
@@ -233,6 +249,7 @@ type V1ElementConfig<T = object, TChild = unknown> = {
233
249
  show_in_panel?: boolean;
234
250
  allowed_child_types?: string[];
235
251
  default_children?: Array<Record<string, TChild>>;
252
+ children_dependencies?: ChildDependencyRule[];
236
253
  meta?: {
237
254
  [key: string]: string | number | boolean | null | NonNullable<V1ElementConfig['meta']>;
238
255
  };
@@ -244,7 +261,31 @@ type V1Model$1<T> = {
244
261
  remove?: string[];
245
262
  }) => T;
246
263
  trigger?: (event: string, ...args: unknown[]) => void;
264
+ on?: (event: string, callback: (...args: unknown[]) => void, context?: unknown) => void;
265
+ off?: (event: string, callback?: (...args: unknown[]) => void, context?: unknown) => void;
266
+ };
267
+
268
+ type ReactiveModel = {
269
+ get: (key: string) => unknown;
270
+ };
271
+ type BindSettingsReconcileArgs = {
272
+ model: ReactiveModel;
273
+ elementConfig: V1ElementConfig | undefined;
274
+ };
275
+ type Detach = () => void;
276
+ declare function bindSettingsReconcile({ model, elementConfig }: BindSettingsReconcileArgs): Detach;
277
+
278
+ declare function evaluateWhen(when: Dependency | undefined, settings: Record<string, PropValue>): boolean;
279
+
280
+ type ReconcileInitialChildrenArgs = {
281
+ elementId: string;
282
+ elementConfig: V1ElementConfig | undefined;
283
+ attributes: {
284
+ elements?: V1ElementData[];
285
+ settings?: V1ElementSettingsProps;
286
+ };
247
287
  };
288
+ declare function reconcileInitialChildren({ elementId, elementConfig, attributes, }: ReconcileInitialChildrenArgs): void;
248
289
 
249
290
  type ElementModel = {
250
291
  id: string;
@@ -385,8 +426,12 @@ declare function getCurrentDocumentId(): number | null;
385
426
 
386
427
  declare function getElementEditorSettings(elementId: ElementID): V1ElementEditorSettingsProps;
387
428
 
429
+ declare function getElementIcon(elementId: ElementID): string | null;
430
+
388
431
  declare function getElementLabel(elementId?: ElementID): string;
389
432
 
433
+ declare function getElementTitle(elementId: ElementID): string | null;
434
+
390
435
  declare const getElementSetting: <TValue>(elementId: ElementID, settingKey: string) => TValue | null;
391
436
  declare const getElementSettings: <TValue>(elementId: ElementID, settingKey: string[]) => Record<string, TValue | null>;
392
437
 
@@ -482,6 +527,8 @@ type ReplaceElementArgs = {
482
527
  };
483
528
  declare const replaceElement: ({ currentElementId, newElement, withHistory }: ReplaceElementArgs) => V1Element;
484
529
 
530
+ declare function resolveInsertIndex(position: ElementPosition, elements: V1ElementData[]): number;
531
+
485
532
  declare const updateElementEditorSettings: ({ elementId, settings, }: {
486
533
  elementId: string;
487
534
  settings: V1ElementModelProps["editor_settings"];
@@ -547,4 +594,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
547
594
  }) => void;
548
595
  declare const playElementInteractions: (elementId: string, interactionId: string) => void;
549
596
 
550
- export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, 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 PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, findChildRecursive, findModelInDocument, 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, removeModelFromParent, replaceElement, resolveContainer, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
597
+ 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, 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 V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };