@elementor/editor-variables 4.0.0-526 → 4.0.0-528

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
@@ -4,6 +4,7 @@ import { z } from '@elementor/schema';
4
4
  import * as _elementor_editor_canvas from '@elementor/editor-canvas';
5
5
  import * as react from 'react';
6
6
  import { KeyboardEvent } from 'react';
7
+ import { SvgIconProps } from '@elementor/ui';
7
8
  import * as _mui_material from '@mui/material';
8
9
 
9
10
  declare function init(): void;
@@ -43,6 +44,7 @@ type TVariable = {
43
44
  order?: number;
44
45
  deleted?: boolean;
45
46
  deleted_at?: string;
47
+ sync_to_v3?: boolean;
46
48
  };
47
49
  type TVariablesList = Record<string, TVariable>;
48
50
 
@@ -53,12 +55,14 @@ type Variable = {
53
55
  type: string;
54
56
  deleted?: boolean;
55
57
  deleted_at?: string;
58
+ sync_to_v3?: boolean;
56
59
  };
57
60
  type NormalizedVariable = {
58
61
  key: string;
59
62
  label: string;
60
63
  value: string;
61
64
  order?: number;
65
+ sync_to_v3?: boolean;
62
66
  };
63
67
 
64
68
  declare const service: {
@@ -93,6 +97,22 @@ declare const service: {
93
97
  }>;
94
98
  };
95
99
 
100
+ type VariableManagerMenuAction = {
101
+ name: string;
102
+ icon: react.ForwardRefExoticComponent<Omit<SvgIconProps, 'ref'> & react.RefAttributes<SVGSVGElement>>;
103
+ color: string;
104
+ onClick: (id: string) => void;
105
+ };
106
+
107
+ type MenuActionContext = {
108
+ variable: Variable;
109
+ variableId: string;
110
+ handlers: {
111
+ onStartSync: (id: string) => void;
112
+ onStopSync: (id: string) => void;
113
+ };
114
+ };
115
+ type MenuActionsFactory = (context: MenuActionContext) => VariableManagerMenuAction[];
96
116
  type ValueFieldProps = {
97
117
  value: string;
98
118
  onChange: (value: string) => void;
@@ -107,7 +127,7 @@ type ValueFieldProps = {
107
127
  onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
108
128
  };
109
129
 
110
- declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, isActive, }: {
130
+ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, isActive, menuActionsFactory, }: {
111
131
  icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
112
132
  startIcon?: ({ value }: {
113
133
  value: string;
@@ -124,7 +144,9 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
124
144
  isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
125
145
  emptyState?: react.JSX.Element;
126
146
  isActive?: boolean;
147
+ menuActionsFactory?: MenuActionsFactory;
127
148
  }) => void;
149
+ declare function getMenuActionsForVariable(variableType: string, context: MenuActionContext): VariableManagerMenuAction[];
128
150
 
129
151
  declare const hasVariable: (key: string) => boolean;
130
152
 
@@ -145,4 +167,4 @@ declare const Utils: {
145
167
  };
146
168
  };
147
169
 
148
- export { GLOBAL_VARIABLES_URI, Utils, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };
170
+ export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableManagerMenuAction, getMenuActionsForVariable, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { z } from '@elementor/schema';
4
4
  import * as _elementor_editor_canvas from '@elementor/editor-canvas';
5
5
  import * as react from 'react';
6
6
  import { KeyboardEvent } from 'react';
7
+ import { SvgIconProps } from '@elementor/ui';
7
8
  import * as _mui_material from '@mui/material';
8
9
 
9
10
  declare function init(): void;
@@ -43,6 +44,7 @@ type TVariable = {
43
44
  order?: number;
44
45
  deleted?: boolean;
45
46
  deleted_at?: string;
47
+ sync_to_v3?: boolean;
46
48
  };
47
49
  type TVariablesList = Record<string, TVariable>;
48
50
 
@@ -53,12 +55,14 @@ type Variable = {
53
55
  type: string;
54
56
  deleted?: boolean;
55
57
  deleted_at?: string;
58
+ sync_to_v3?: boolean;
56
59
  };
57
60
  type NormalizedVariable = {
58
61
  key: string;
59
62
  label: string;
60
63
  value: string;
61
64
  order?: number;
65
+ sync_to_v3?: boolean;
62
66
  };
63
67
 
64
68
  declare const service: {
@@ -93,6 +97,22 @@ declare const service: {
93
97
  }>;
94
98
  };
95
99
 
100
+ type VariableManagerMenuAction = {
101
+ name: string;
102
+ icon: react.ForwardRefExoticComponent<Omit<SvgIconProps, 'ref'> & react.RefAttributes<SVGSVGElement>>;
103
+ color: string;
104
+ onClick: (id: string) => void;
105
+ };
106
+
107
+ type MenuActionContext = {
108
+ variable: Variable;
109
+ variableId: string;
110
+ handlers: {
111
+ onStartSync: (id: string) => void;
112
+ onStopSync: (id: string) => void;
113
+ };
114
+ };
115
+ type MenuActionsFactory = (context: MenuActionContext) => VariableManagerMenuAction[];
96
116
  type ValueFieldProps = {
97
117
  value: string;
98
118
  onChange: (value: string) => void;
@@ -107,7 +127,7 @@ type ValueFieldProps = {
107
127
  onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
108
128
  };
109
129
 
110
- declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, isActive, }: {
130
+ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, isActive, menuActionsFactory, }: {
111
131
  icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
112
132
  startIcon?: ({ value }: {
113
133
  value: string;
@@ -124,7 +144,9 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
124
144
  isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
125
145
  emptyState?: react.JSX.Element;
126
146
  isActive?: boolean;
147
+ menuActionsFactory?: MenuActionsFactory;
127
148
  }) => void;
149
+ declare function getMenuActionsForVariable(variableType: string, context: MenuActionContext): VariableManagerMenuAction[];
128
150
 
129
151
  declare const hasVariable: (key: string) => boolean;
130
152
 
@@ -145,4 +167,4 @@ declare const Utils: {
145
167
  };
146
168
  };
147
169
 
148
- export { GLOBAL_VARIABLES_URI, Utils, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };
170
+ export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableManagerMenuAction, getMenuActionsForVariable, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };