@elementor/editor-variables 4.1.0-788 → 4.1.0-789
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 +93 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-repeater-item-slot.tsx +61 -8
- package/src/repeater-injections.ts +73 -13
package/dist/index.js
CHANGED
|
@@ -4183,6 +4183,8 @@ var import_editor_props9 = require("@elementor/editor-props");
|
|
|
4183
4183
|
// src/components/variables-repeater-item-slot.tsx
|
|
4184
4184
|
var React39 = __toESM(require("react"));
|
|
4185
4185
|
var import_editor_props8 = require("@elementor/editor-props");
|
|
4186
|
+
var import_ui36 = require("@elementor/ui");
|
|
4187
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
4186
4188
|
|
|
4187
4189
|
// src/utils/size-value.ts
|
|
4188
4190
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
@@ -4224,23 +4226,51 @@ var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
|
4224
4226
|
};
|
|
4225
4227
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
4226
4228
|
const colorVariable = useColorVariable(value);
|
|
4227
|
-
return /* @__PURE__ */ React39.createElement("span"
|
|
4229
|
+
return /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span" }, colorVariable?.label);
|
|
4228
4230
|
};
|
|
4229
4231
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
4230
4232
|
const colorVariable = useColorVariable(value);
|
|
4231
4233
|
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4232
4234
|
};
|
|
4235
|
+
var FilterDropShadowIconIndicator = ({ value }) => {
|
|
4236
|
+
const { args } = import_editor_props8.cssFilterFunctionPropUtil.extract(value) || {};
|
|
4237
|
+
const { color } = import_editor_props8.dropShadowFilterPropTypeUtil.extract(args) || {};
|
|
4238
|
+
const colorVariable = getVariable(color?.value || "");
|
|
4239
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4240
|
+
};
|
|
4241
|
+
var FilterSingleSizeRepeaterLabel = ({ value }) => {
|
|
4242
|
+
const cssFilterFunction = import_editor_props8.cssFilterFunctionPropUtil.extract(value);
|
|
4243
|
+
if (import_editor_props8.dropShadowFilterPropTypeUtil.isValid(cssFilterFunction?.args)) {
|
|
4244
|
+
return null;
|
|
4245
|
+
}
|
|
4246
|
+
const args = cssFilterFunction?.args;
|
|
4247
|
+
const func = cssFilterFunction?.func?.value ?? "";
|
|
4248
|
+
const rendered = sizeValue(args?.value?.size);
|
|
4249
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span", style: { textTransform: "capitalize" } }, `${func}: `), /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span" }, rendered));
|
|
4250
|
+
};
|
|
4251
|
+
var FilterDropShadowRepeaterLabel = ({ value }) => {
|
|
4252
|
+
const { args } = import_editor_props8.cssFilterFunctionPropUtil.extract(value) || {};
|
|
4253
|
+
const { xAxis, yAxis, blur } = import_editor_props8.dropShadowFilterPropTypeUtil.extract(args) || {};
|
|
4254
|
+
const labels = [];
|
|
4255
|
+
for (const val of [xAxis, yAxis, blur]) {
|
|
4256
|
+
const rendered = sizeValue(val);
|
|
4257
|
+
if (rendered) {
|
|
4258
|
+
labels.push(rendered);
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
return /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span" }, (0, import_i18n27.__)("Drop shadow:", "elementor"), " ", labels.join(" "));
|
|
4262
|
+
};
|
|
4233
4263
|
var BoxShadowRepeaterLabel = ({ value }) => {
|
|
4234
|
-
const
|
|
4264
|
+
const { position, hOffset, vOffset, blur, spread } = import_editor_props8.shadowPropTypeUtil.extract(value) || {};
|
|
4235
4265
|
const labels = [];
|
|
4236
|
-
for (const
|
|
4237
|
-
const rendered = sizeValue(
|
|
4266
|
+
for (const val of [hOffset, vOffset, blur, spread]) {
|
|
4267
|
+
const rendered = sizeValue(val);
|
|
4238
4268
|
if (rendered) {
|
|
4239
4269
|
labels.push(rendered);
|
|
4240
4270
|
}
|
|
4241
4271
|
}
|
|
4242
|
-
const positionLabel =
|
|
4243
|
-
return /* @__PURE__ */ React39.createElement("span",
|
|
4272
|
+
const positionLabel = position?.value || "outset";
|
|
4273
|
+
return /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span", style: { textTransform: "capitalize" } }, positionLabel, ": ", labels.join(" "));
|
|
4244
4274
|
};
|
|
4245
4275
|
var TransitionsSizeVariableLabel = ({ value: prop }) => {
|
|
4246
4276
|
let label = "";
|
|
@@ -4253,7 +4283,7 @@ var TransitionsSizeVariableLabel = ({ value: prop }) => {
|
|
|
4253
4283
|
}
|
|
4254
4284
|
label += variable?.value;
|
|
4255
4285
|
}
|
|
4256
|
-
return /* @__PURE__ */ React39.createElement("span"
|
|
4286
|
+
return /* @__PURE__ */ React39.createElement(import_ui36.Box, { component: "span" }, label);
|
|
4257
4287
|
};
|
|
4258
4288
|
|
|
4259
4289
|
// src/repeater-injections.ts
|
|
@@ -4261,26 +4291,27 @@ function registerRepeaterInjections() {
|
|
|
4261
4291
|
backgroundOverlayRepeaterInjections();
|
|
4262
4292
|
boxShadowRepeaterInjections();
|
|
4263
4293
|
transitionsRepeaterInjections();
|
|
4294
|
+
filterRepeaterInjections();
|
|
4264
4295
|
}
|
|
4265
|
-
|
|
4296
|
+
function backgroundOverlayRepeaterInjections() {
|
|
4266
4297
|
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4267
|
-
id: "color-variables-
|
|
4298
|
+
id: "background-color-variables-icon",
|
|
4268
4299
|
component: BackgroundRepeaterColorIndicator,
|
|
4269
4300
|
condition: ({ value }) => {
|
|
4270
4301
|
return hasAssignedColorVariable(import_editor_props9.backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4271
4302
|
}
|
|
4272
4303
|
});
|
|
4273
4304
|
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4274
|
-
id: "color-variables-label",
|
|
4305
|
+
id: "background-color-variables-label",
|
|
4275
4306
|
component: BackgroundRepeaterLabel,
|
|
4276
4307
|
condition: ({ value }) => {
|
|
4277
4308
|
return hasAssignedColorVariable(import_editor_props9.backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4278
4309
|
}
|
|
4279
4310
|
});
|
|
4280
|
-
}
|
|
4281
|
-
|
|
4311
|
+
}
|
|
4312
|
+
function boxShadowRepeaterInjections() {
|
|
4282
4313
|
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4283
|
-
id: "color-variables-
|
|
4314
|
+
id: "box-shadow-color-variables-icon",
|
|
4284
4315
|
component: BoxShadowRepeaterColorIndicator,
|
|
4285
4316
|
condition: ({ value }) => {
|
|
4286
4317
|
const { color } = import_editor_props9.shadowPropTypeUtil.extract(value) || {};
|
|
@@ -4295,8 +4326,8 @@ var boxShadowRepeaterInjections = () => {
|
|
|
4295
4326
|
return hasAssignedSizeVariable(hOffset) || hasAssignedSizeVariable(vOffset) || hasAssignedSizeVariable(blur) || hasAssignedSizeVariable(spread);
|
|
4296
4327
|
}
|
|
4297
4328
|
});
|
|
4298
|
-
}
|
|
4299
|
-
|
|
4329
|
+
}
|
|
4330
|
+
function transitionsRepeaterInjections() {
|
|
4300
4331
|
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4301
4332
|
id: "transition-size-variables-label",
|
|
4302
4333
|
component: TransitionsSizeVariableLabel,
|
|
@@ -4304,8 +4335,50 @@ var transitionsRepeaterInjections = () => {
|
|
|
4304
4335
|
return hasAssignedSizeVariable(import_editor_props9.selectionSizePropTypeUtil.extract(value)?.size);
|
|
4305
4336
|
}
|
|
4306
4337
|
});
|
|
4307
|
-
}
|
|
4308
|
-
|
|
4338
|
+
}
|
|
4339
|
+
function filterRepeaterInjections() {
|
|
4340
|
+
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4341
|
+
id: "filters-color-variables-icon",
|
|
4342
|
+
component: FilterDropShadowIconIndicator,
|
|
4343
|
+
condition: ({ value }) => {
|
|
4344
|
+
if (!import_editor_props9.cssFilterFunctionPropUtil.isValid(value)) {
|
|
4345
|
+
return false;
|
|
4346
|
+
}
|
|
4347
|
+
const args = import_editor_props9.cssFilterFunctionPropUtil.extract(value)?.args;
|
|
4348
|
+
if (import_editor_props9.dropShadowFilterPropTypeUtil.isValid(args)) {
|
|
4349
|
+
return hasAssignedColorVariable(import_editor_props9.dropShadowFilterPropTypeUtil.extract(args)?.color);
|
|
4350
|
+
}
|
|
4351
|
+
return false;
|
|
4352
|
+
}
|
|
4353
|
+
});
|
|
4354
|
+
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4355
|
+
id: "filters-drop-shadow-size-variables-label",
|
|
4356
|
+
component: FilterDropShadowRepeaterLabel,
|
|
4357
|
+
condition: ({ value }) => {
|
|
4358
|
+
if (!import_editor_props9.cssFilterFunctionPropUtil.isValid(value)) {
|
|
4359
|
+
return false;
|
|
4360
|
+
}
|
|
4361
|
+
const args = import_editor_props9.cssFilterFunctionPropUtil.extract(value)?.args;
|
|
4362
|
+
if (import_editor_props9.dropShadowFilterPropTypeUtil.isValid(args)) {
|
|
4363
|
+
const { xAxis, yAxis, blur } = import_editor_props9.dropShadowFilterPropTypeUtil.extract(args) || {};
|
|
4364
|
+
return hasAssignedSizeVariable(xAxis) || hasAssignedSizeVariable(yAxis) || hasAssignedSizeVariable(blur);
|
|
4365
|
+
}
|
|
4366
|
+
return false;
|
|
4367
|
+
}
|
|
4368
|
+
});
|
|
4369
|
+
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4370
|
+
id: "filters-size-variables-label",
|
|
4371
|
+
component: FilterSingleSizeRepeaterLabel,
|
|
4372
|
+
condition: ({ value }) => {
|
|
4373
|
+
if (!import_editor_props9.cssFilterFunctionPropUtil.isValid(value)) {
|
|
4374
|
+
return false;
|
|
4375
|
+
}
|
|
4376
|
+
const args = import_editor_props9.cssFilterFunctionPropUtil.extract(value)?.args;
|
|
4377
|
+
return hasAssignedSizeVariable(args?.value?.size);
|
|
4378
|
+
}
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
function hasAssignedSizeVariable(value) {
|
|
4309
4382
|
if (sizeVariablePropTypeUtil.isValid(value)) {
|
|
4310
4383
|
return true;
|
|
4311
4384
|
}
|
|
@@ -4313,10 +4386,10 @@ var hasAssignedSizeVariable = (value) => {
|
|
|
4313
4386
|
return true;
|
|
4314
4387
|
}
|
|
4315
4388
|
return false;
|
|
4316
|
-
}
|
|
4317
|
-
|
|
4389
|
+
}
|
|
4390
|
+
function hasAssignedColorVariable(value) {
|
|
4318
4391
|
return !!colorVariablePropTypeUtil.isValid(value);
|
|
4319
|
-
}
|
|
4392
|
+
}
|
|
4320
4393
|
|
|
4321
4394
|
// src/init.ts
|
|
4322
4395
|
var { registerPopoverAction } = import_menus.controlActionsMenu;
|