@elementor/editor-variables 4.1.0-823 → 4.1.0-824
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 +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/global-styles-import-listener.tsx +3 -5
- package/src/types.ts +2 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
2
2
|
import { PropType } from '@elementor/editor-props';
|
|
3
3
|
import { z } from '@elementor/schema';
|
|
4
|
+
import * as _elementor_editor_styles from '@elementor/editor-styles';
|
|
5
|
+
import { Variable } from '@elementor/editor-styles';
|
|
4
6
|
import * as _elementor_editor_canvas from '@elementor/editor-canvas';
|
|
5
7
|
import * as react from 'react';
|
|
6
8
|
import { KeyboardEvent } from 'react';
|
|
@@ -48,15 +50,6 @@ type TVariable = {
|
|
|
48
50
|
};
|
|
49
51
|
type TVariablesList = Record<string, TVariable>;
|
|
50
52
|
|
|
51
|
-
type Variable = {
|
|
52
|
-
key?: string;
|
|
53
|
-
label: string;
|
|
54
|
-
value: string;
|
|
55
|
-
type: string;
|
|
56
|
-
deleted?: boolean;
|
|
57
|
-
deleted_at?: string;
|
|
58
|
-
sync_to_v3?: boolean;
|
|
59
|
-
};
|
|
60
53
|
type NormalizedVariable = {
|
|
61
54
|
key: string;
|
|
62
55
|
label: string;
|
|
@@ -141,7 +134,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
|
|
|
141
134
|
propTypeUtil: _elementor_editor_props.PropTypeUtil<string, string>;
|
|
142
135
|
selectionFilter?: (variables: NormalizedVariable[], propType?: _elementor_editor_props.PropType) => NormalizedVariable[];
|
|
143
136
|
valueTransformer?: (value: string, type?: string) => _elementor_editor_props.PropValue;
|
|
144
|
-
isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
|
|
137
|
+
isCompatible?: (propType: _elementor_editor_props.PropType, variable: _elementor_editor_styles.Variable) => boolean;
|
|
145
138
|
emptyState?: react.JSX.Element;
|
|
146
139
|
isActive?: boolean;
|
|
147
140
|
menuActionsFactory?: MenuActionsFactory;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
2
2
|
import { PropType } from '@elementor/editor-props';
|
|
3
3
|
import { z } from '@elementor/schema';
|
|
4
|
+
import * as _elementor_editor_styles from '@elementor/editor-styles';
|
|
5
|
+
import { Variable } from '@elementor/editor-styles';
|
|
4
6
|
import * as _elementor_editor_canvas from '@elementor/editor-canvas';
|
|
5
7
|
import * as react from 'react';
|
|
6
8
|
import { KeyboardEvent } from 'react';
|
|
@@ -48,15 +50,6 @@ type TVariable = {
|
|
|
48
50
|
};
|
|
49
51
|
type TVariablesList = Record<string, TVariable>;
|
|
50
52
|
|
|
51
|
-
type Variable = {
|
|
52
|
-
key?: string;
|
|
53
|
-
label: string;
|
|
54
|
-
value: string;
|
|
55
|
-
type: string;
|
|
56
|
-
deleted?: boolean;
|
|
57
|
-
deleted_at?: string;
|
|
58
|
-
sync_to_v3?: boolean;
|
|
59
|
-
};
|
|
60
53
|
type NormalizedVariable = {
|
|
61
54
|
key: string;
|
|
62
55
|
label: string;
|
|
@@ -141,7 +134,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
|
|
|
141
134
|
propTypeUtil: _elementor_editor_props.PropTypeUtil<string, string>;
|
|
142
135
|
selectionFilter?: (variables: NormalizedVariable[], propType?: _elementor_editor_props.PropType) => NormalizedVariable[];
|
|
143
136
|
valueTransformer?: (value: string, type?: string) => _elementor_editor_props.PropValue;
|
|
144
|
-
isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
|
|
137
|
+
isCompatible?: (propType: _elementor_editor_props.PropType, variable: _elementor_editor_styles.Variable) => boolean;
|
|
145
138
|
emptyState?: react.JSX.Element;
|
|
146
139
|
isActive?: boolean;
|
|
147
140
|
menuActionsFactory?: MenuActionsFactory;
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ var import_menus = require("@elementor/menus");
|
|
|
52
52
|
|
|
53
53
|
// src/components/global-styles-import-listener.tsx
|
|
54
54
|
var import_react = require("react");
|
|
55
|
+
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
55
56
|
|
|
56
57
|
// src/service.ts
|
|
57
58
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -477,12 +478,9 @@ function GlobalStylesImportListener() {
|
|
|
477
478
|
}
|
|
478
479
|
service.load();
|
|
479
480
|
};
|
|
480
|
-
window.addEventListener(
|
|
481
|
+
window.addEventListener(import_editor_canvas.GLOBAL_STYLES_IMPORTED_EVENT, handleGlobalStylesImported);
|
|
481
482
|
return () => {
|
|
482
|
-
window.removeEventListener(
|
|
483
|
-
"elementor/global-styles/imported",
|
|
484
|
-
handleGlobalStylesImported
|
|
485
|
-
);
|
|
483
|
+
window.removeEventListener(import_editor_canvas.GLOBAL_STYLES_IMPORTED_EVENT, handleGlobalStylesImported);
|
|
486
484
|
};
|
|
487
485
|
}, []);
|
|
488
486
|
return null;
|
|
@@ -657,11 +655,11 @@ var validateValue = (value) => {
|
|
|
657
655
|
};
|
|
658
656
|
|
|
659
657
|
// src/variables-registry/create-variable-type-registry.ts
|
|
660
|
-
var
|
|
658
|
+
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
661
659
|
|
|
662
660
|
// src/transformers/inheritance-transformer.tsx
|
|
663
661
|
var React = __toESM(require("react"));
|
|
664
|
-
var
|
|
662
|
+
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
665
663
|
var import_ui2 = require("@elementor/ui");
|
|
666
664
|
var import_i18n3 = require("@wordpress/i18n");
|
|
667
665
|
|
|
@@ -698,7 +696,7 @@ var resolveCssVariable = (id2, variable) => {
|
|
|
698
696
|
};
|
|
699
697
|
|
|
700
698
|
// src/transformers/inheritance-transformer.tsx
|
|
701
|
-
var inheritanceTransformer = (0,
|
|
699
|
+
var inheritanceTransformer = (0, import_editor_canvas2.createTransformer)((id2) => {
|
|
702
700
|
const variables = service.variables();
|
|
703
701
|
const variable = variables[id2];
|
|
704
702
|
if (!variable) {
|
|
@@ -710,8 +708,8 @@ var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((id2) =
|
|
|
710
708
|
});
|
|
711
709
|
|
|
712
710
|
// src/transformers/variable-transformer.ts
|
|
713
|
-
var
|
|
714
|
-
var variableTransformer = (0,
|
|
711
|
+
var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
712
|
+
var variableTransformer = (0, import_editor_canvas3.createTransformer)((idOrLabel) => {
|
|
715
713
|
const variables = service.variables();
|
|
716
714
|
const targetVariable = variables[idOrLabel] || service.findVariableByLabel(idOrLabel);
|
|
717
715
|
if (!targetVariable) {
|
|
@@ -771,10 +769,10 @@ function createVariableTypeRegistry() {
|
|
|
771
769
|
registerInheritanceTransformer(propTypeUtil.key);
|
|
772
770
|
};
|
|
773
771
|
const registerTransformer = (key, transformer) => {
|
|
774
|
-
|
|
772
|
+
import_editor_canvas4.styleTransformersRegistry.register(key, transformer ?? variableTransformer);
|
|
775
773
|
};
|
|
776
774
|
const registerInheritanceTransformer = (key) => {
|
|
777
|
-
|
|
775
|
+
import_editor_canvas4.stylesInheritanceTransformersRegistry.register(key, inheritanceTransformer);
|
|
778
776
|
};
|
|
779
777
|
const getVariableType2 = (key) => {
|
|
780
778
|
return variableTypes[key];
|
|
@@ -4080,8 +4078,8 @@ var import_schema4 = require("@elementor/schema");
|
|
|
4080
4078
|
var sizeVariablePropTypeUtil = (0, import_editor_props4.createPropUtils)("global-size-variable", import_schema4.z.string());
|
|
4081
4079
|
|
|
4082
4080
|
// src/transformers/empty-transformer.tsx
|
|
4083
|
-
var
|
|
4084
|
-
var EmptyTransformer = (0,
|
|
4081
|
+
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
4082
|
+
var EmptyTransformer = (0, import_editor_canvas5.createTransformer)((_value) => {
|
|
4085
4083
|
return null;
|
|
4086
4084
|
});
|
|
4087
4085
|
|