@elementor/editor-variables 4.1.0-772 → 4.1.0-773
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.js +59 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-repeater-item-slot.tsx +32 -4
- package/src/prop-types/custom-size-variable-prop-type.ts +4 -0
- package/src/prop-types/index.ts +4 -0
- package/src/repeater-injections.ts +54 -14
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var import_editor = require("@elementor/editor");
|
|
|
47
47
|
var import_editor_controls18 = require("@elementor/editor-controls");
|
|
48
48
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
49
49
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
50
|
-
var
|
|
50
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
51
51
|
var import_menus = require("@elementor/menus");
|
|
52
52
|
|
|
53
53
|
// src/components/global-styles-import-listener.tsx
|
|
@@ -4175,10 +4175,11 @@ function convertToCssVariables(variables) {
|
|
|
4175
4175
|
|
|
4176
4176
|
// src/repeater-injections.ts
|
|
4177
4177
|
var import_editor_controls17 = require("@elementor/editor-controls");
|
|
4178
|
-
var
|
|
4178
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
4179
4179
|
|
|
4180
4180
|
// src/components/variables-repeater-item-slot.tsx
|
|
4181
4181
|
var React39 = __toESM(require("react"));
|
|
4182
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
4182
4183
|
var useColorVariable = (value) => {
|
|
4183
4184
|
const variableId = value?.value?.color?.value;
|
|
4184
4185
|
return useVariable(variableId || "");
|
|
@@ -4195,33 +4196,76 @@ var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
|
4195
4196
|
const colorVariable = useColorVariable(value);
|
|
4196
4197
|
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4197
4198
|
};
|
|
4199
|
+
var TransitionsSizeVariableLabel = ({ value: prop }) => {
|
|
4200
|
+
let label = "";
|
|
4201
|
+
const variableId = prop?.value?.size?.value || "";
|
|
4202
|
+
const variable = useVariable(variableId);
|
|
4203
|
+
if (variable && import_editor_props6.selectionSizePropTypeUtil.isValid(prop)) {
|
|
4204
|
+
const selection = prop.value?.selection?.value?.key?.value;
|
|
4205
|
+
if (selection) {
|
|
4206
|
+
label += `${selection}: `;
|
|
4207
|
+
}
|
|
4208
|
+
label += variable?.value;
|
|
4209
|
+
}
|
|
4210
|
+
return /* @__PURE__ */ React39.createElement("span", null, label);
|
|
4211
|
+
};
|
|
4212
|
+
|
|
4213
|
+
// src/prop-types/custom-size-variable-prop-type.ts
|
|
4214
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
4215
|
+
var import_schema5 = require("@elementor/schema");
|
|
4216
|
+
var customSizeVariablePropTypeUtil = (0, import_editor_props7.createPropUtils)("global-custom-size-variable", import_schema5.z.string());
|
|
4198
4217
|
|
|
4199
4218
|
// src/repeater-injections.ts
|
|
4200
4219
|
function registerRepeaterInjections() {
|
|
4220
|
+
backgroundOverlayRepeaterInjections();
|
|
4221
|
+
boxShadowRepeaterInjections();
|
|
4222
|
+
transitionsRepeaterInjections();
|
|
4223
|
+
}
|
|
4224
|
+
var backgroundOverlayRepeaterInjections = () => {
|
|
4201
4225
|
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4202
4226
|
id: "color-variables-background-icon",
|
|
4203
4227
|
component: BackgroundRepeaterColorIndicator,
|
|
4204
|
-
condition: ({ value
|
|
4205
|
-
return hasAssignedColorVariable(
|
|
4228
|
+
condition: ({ value }) => {
|
|
4229
|
+
return hasAssignedColorVariable(import_editor_props8.backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4206
4230
|
}
|
|
4207
4231
|
});
|
|
4232
|
+
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4233
|
+
id: "color-variables-label",
|
|
4234
|
+
component: BackgroundRepeaterLabel,
|
|
4235
|
+
condition: ({ value }) => {
|
|
4236
|
+
return hasAssignedColorVariable(import_editor_props8.backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4237
|
+
}
|
|
4238
|
+
});
|
|
4239
|
+
};
|
|
4240
|
+
var boxShadowRepeaterInjections = () => {
|
|
4208
4241
|
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4209
|
-
id: "color-variables-icon",
|
|
4242
|
+
id: "color-variables-box-shadow-icon",
|
|
4210
4243
|
component: BoxShadowRepeaterColorIndicator,
|
|
4211
|
-
condition: ({ value
|
|
4212
|
-
return hasAssignedColorVariable(
|
|
4244
|
+
condition: ({ value }) => {
|
|
4245
|
+
return hasAssignedColorVariable(import_editor_props8.shadowPropTypeUtil.extract(value)?.color);
|
|
4213
4246
|
}
|
|
4214
4247
|
});
|
|
4248
|
+
};
|
|
4249
|
+
var transitionsRepeaterInjections = () => {
|
|
4215
4250
|
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4216
|
-
id: "
|
|
4217
|
-
component:
|
|
4218
|
-
condition: ({ value
|
|
4219
|
-
return
|
|
4251
|
+
id: "transition-size-variables-label",
|
|
4252
|
+
component: TransitionsSizeVariableLabel,
|
|
4253
|
+
condition: ({ value }) => {
|
|
4254
|
+
return hasAssignedSizeVariable(import_editor_props8.selectionSizePropTypeUtil.extract(value)?.size);
|
|
4220
4255
|
}
|
|
4221
4256
|
});
|
|
4222
|
-
}
|
|
4223
|
-
var
|
|
4224
|
-
|
|
4257
|
+
};
|
|
4258
|
+
var hasAssignedSizeVariable = (value) => {
|
|
4259
|
+
if (sizeVariablePropTypeUtil.isValid(value)) {
|
|
4260
|
+
return true;
|
|
4261
|
+
}
|
|
4262
|
+
if (customSizeVariablePropTypeUtil.isValid(value)) {
|
|
4263
|
+
return true;
|
|
4264
|
+
}
|
|
4265
|
+
return false;
|
|
4266
|
+
};
|
|
4267
|
+
var hasAssignedColorVariable = (value) => {
|
|
4268
|
+
return !!colorVariablePropTypeUtil.isValid(value);
|
|
4225
4269
|
};
|
|
4226
4270
|
|
|
4227
4271
|
// src/init.ts
|
|
@@ -4268,7 +4312,7 @@ function init() {
|
|
|
4268
4312
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
4269
4313
|
}
|
|
4270
4314
|
function hasVariableAssigned(value) {
|
|
4271
|
-
if ((0,
|
|
4315
|
+
if ((0, import_editor_props9.isTransformable)(value)) {
|
|
4272
4316
|
return hasVariableType(value.$$type);
|
|
4273
4317
|
}
|
|
4274
4318
|
return false;
|