@elementor/editor-variables 3.35.0-372 → 3.35.0-374

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,6 +1,7 @@
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_canvas from '@elementor/editor-canvas';
4
5
  import * as react from 'react';
5
6
  import { RefObject } from 'react';
6
7
  import * as _mui_material from '@mui/material';
@@ -106,7 +107,7 @@ type ValueFieldProps = {
106
107
  ref?: RefObject<HTMLElement | null>;
107
108
  };
108
109
 
109
- declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
110
+ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
110
111
  icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
111
112
  startIcon?: ({ value }: {
112
113
  value: string;
@@ -115,6 +116,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
115
116
  variableType: string;
116
117
  key?: string;
117
118
  defaultValue?: string;
119
+ styleTransformer?: _elementor_editor_canvas.AnyTransformer;
118
120
  fallbackPropTypeUtil: any;
119
121
  propTypeUtil: _elementor_editor_props.PropTypeUtil<string, string>;
120
122
  selectionFilter?: (variables: NormalizedVariable[], propType: _elementor_editor_props.PropType) => NormalizedVariable[];
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
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_canvas from '@elementor/editor-canvas';
4
5
  import * as react from 'react';
5
6
  import { RefObject } from 'react';
6
7
  import * as _mui_material from '@mui/material';
@@ -106,7 +107,7 @@ type ValueFieldProps = {
106
107
  ref?: RefObject<HTMLElement | null>;
107
108
  };
108
109
 
109
- declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
110
+ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
110
111
  icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
111
112
  startIcon?: ({ value }: {
112
113
  value: string;
@@ -115,6 +116,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
115
116
  variableType: string;
116
117
  key?: string;
117
118
  defaultValue?: string;
119
+ styleTransformer?: _elementor_editor_canvas.AnyTransformer;
118
120
  fallbackPropTypeUtil: any;
119
121
  propTypeUtil: _elementor_editor_props.PropTypeUtil<string, string>;
120
122
  selectionFilter?: (variables: NormalizedVariable[], propType: _elementor_editor_props.PropType) => NormalizedVariable[];
package/dist/index.js CHANGED
@@ -685,6 +685,7 @@ function createVariableTypeRegistry() {
685
685
  defaultValue,
686
686
  selectionFilter,
687
687
  valueTransformer,
688
+ styleTransformer,
688
689
  fallbackPropTypeUtil,
689
690
  isCompatible,
690
691
  emptyState
@@ -713,11 +714,11 @@ function createVariableTypeRegistry() {
713
714
  isCompatible,
714
715
  emptyState
715
716
  };
716
- registerTransformer(propTypeUtil.key);
717
+ registerTransformer(propTypeUtil.key, styleTransformer);
717
718
  registerInheritanceTransformer(propTypeUtil.key);
718
719
  };
719
- const registerTransformer = (key) => {
720
- import_editor_canvas3.styleTransformersRegistry.register(key, variableTransformer);
720
+ const registerTransformer = (key, transformer) => {
721
+ import_editor_canvas3.styleTransformersRegistry.register(key, transformer ?? variableTransformer);
721
722
  };
722
723
  const registerInheritanceTransformer = (key) => {
723
724
  import_editor_editing_panel.stylesInheritanceTransformersRegistry.register(key, inheritanceTransformer);
@@ -3710,6 +3711,12 @@ var import_editor_props4 = require("@elementor/editor-props");
3710
3711
  var import_schema6 = require("@elementor/schema");
3711
3712
  var sizeVariablePropTypeUtil = (0, import_editor_props4.createPropUtils)("global-size-variable", import_schema6.z.string());
3712
3713
 
3714
+ // src/transformers/empty-transformer.tsx
3715
+ var import_editor_canvas4 = require("@elementor/editor-canvas");
3716
+ var EmptyTransformer = (0, import_editor_canvas4.createTransformer)((_value) => {
3717
+ return null;
3718
+ });
3719
+
3713
3720
  // src/register-variable-types.tsx
3714
3721
  function registerVariableTypes() {
3715
3722
  registerVariableType({
@@ -3731,14 +3738,22 @@ function registerVariableTypes() {
3731
3738
  variableType: "font",
3732
3739
  defaultValue: "Roboto"
3733
3740
  });
3734
- registerVariableType({
3735
- key: sizeVariablePropTypeUtil.key,
3741
+ const sizePromotions = {
3736
3742
  icon: import_icons17.ExpandDiagonalIcon,
3737
3743
  propTypeUtil: sizeVariablePropTypeUtil,
3738
3744
  fallbackPropTypeUtil: import_editor_props5.sizePropTypeUtil,
3745
+ styleTransformer: EmptyTransformer,
3739
3746
  variableType: "size",
3740
3747
  selectionFilter: () => [],
3741
3748
  emptyState: /* @__PURE__ */ React35.createElement(import_editor_ui9.UpgradeButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
3749
+ };
3750
+ registerVariableType({
3751
+ ...sizePromotions,
3752
+ key: sizeVariablePropTypeUtil.key
3753
+ });
3754
+ registerVariableType({
3755
+ ...sizePromotions,
3756
+ key: "global-custom-size-variable"
3742
3757
  });
3743
3758
  }
3744
3759