@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.mjs CHANGED
@@ -4187,6 +4187,8 @@ function convertToCssVariables(variables) {
4187
4187
  import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elementor/editor-controls";
4188
4188
  import {
4189
4189
  backgroundColorOverlayPropTypeUtil,
4190
+ cssFilterFunctionPropUtil as cssFilterFunctionPropUtil2,
4191
+ dropShadowFilterPropTypeUtil as dropShadowFilterPropTypeUtil2,
4190
4192
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2,
4191
4193
  shadowPropTypeUtil as shadowPropTypeUtil2
4192
4194
  } from "@elementor/editor-props";
@@ -4194,9 +4196,13 @@ import {
4194
4196
  // src/components/variables-repeater-item-slot.tsx
4195
4197
  import * as React39 from "react";
4196
4198
  import {
4199
+ cssFilterFunctionPropUtil,
4200
+ dropShadowFilterPropTypeUtil,
4197
4201
  selectionSizePropTypeUtil,
4198
4202
  shadowPropTypeUtil
4199
4203
  } from "@elementor/editor-props";
4204
+ import { Box as Box9 } from "@elementor/ui";
4205
+ import { __ as __27 } from "@wordpress/i18n";
4200
4206
 
4201
4207
  // src/utils/size-value.ts
4202
4208
  import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
@@ -4238,23 +4244,51 @@ var BackgroundRepeaterColorIndicator = ({ value }) => {
4238
4244
  };
4239
4245
  var BackgroundRepeaterLabel = ({ value }) => {
4240
4246
  const colorVariable = useColorVariable(value);
4241
- return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
4247
+ return /* @__PURE__ */ React39.createElement(Box9, { component: "span" }, colorVariable?.label);
4242
4248
  };
4243
4249
  var BoxShadowRepeaterColorIndicator = ({ value }) => {
4244
4250
  const colorVariable = useColorVariable(value);
4245
4251
  return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
4246
4252
  };
4253
+ var FilterDropShadowIconIndicator = ({ value }) => {
4254
+ const { args } = cssFilterFunctionPropUtil.extract(value) || {};
4255
+ const { color } = dropShadowFilterPropTypeUtil.extract(args) || {};
4256
+ const colorVariable = getVariable(color?.value || "");
4257
+ return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
4258
+ };
4259
+ var FilterSingleSizeRepeaterLabel = ({ value }) => {
4260
+ const cssFilterFunction = cssFilterFunctionPropUtil.extract(value);
4261
+ if (dropShadowFilterPropTypeUtil.isValid(cssFilterFunction?.args)) {
4262
+ return null;
4263
+ }
4264
+ const args = cssFilterFunction?.args;
4265
+ const func = cssFilterFunction?.func?.value ?? "";
4266
+ const rendered = sizeValue(args?.value?.size);
4267
+ return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Box9, { component: "span", style: { textTransform: "capitalize" } }, `${func}: `), /* @__PURE__ */ React39.createElement(Box9, { component: "span" }, rendered));
4268
+ };
4269
+ var FilterDropShadowRepeaterLabel = ({ value }) => {
4270
+ const { args } = cssFilterFunctionPropUtil.extract(value) || {};
4271
+ const { xAxis, yAxis, blur } = dropShadowFilterPropTypeUtil.extract(args) || {};
4272
+ const labels = [];
4273
+ for (const val of [xAxis, yAxis, blur]) {
4274
+ const rendered = sizeValue(val);
4275
+ if (rendered) {
4276
+ labels.push(rendered);
4277
+ }
4278
+ }
4279
+ return /* @__PURE__ */ React39.createElement(Box9, { component: "span" }, __27("Drop shadow:", "elementor"), " ", labels.join(" "));
4280
+ };
4247
4281
  var BoxShadowRepeaterLabel = ({ value }) => {
4248
- const shadowPropValue = shadowPropTypeUtil.extract(value) || {};
4282
+ const { position, hOffset, vOffset, blur, spread } = shadowPropTypeUtil.extract(value) || {};
4249
4283
  const labels = [];
4250
- for (const key of ["hOffset", "vOffset", "blur", "spread"]) {
4251
- const rendered = sizeValue(shadowPropValue[key]);
4284
+ for (const val of [hOffset, vOffset, blur, spread]) {
4285
+ const rendered = sizeValue(val);
4252
4286
  if (rendered) {
4253
4287
  labels.push(rendered);
4254
4288
  }
4255
4289
  }
4256
- const positionLabel = shadowPropValue.position?.value || "outset";
4257
- return /* @__PURE__ */ React39.createElement("span", { style: { textTransform: "capitalize" } }, positionLabel, ": ", labels.join(" "));
4290
+ const positionLabel = position?.value || "outset";
4291
+ return /* @__PURE__ */ React39.createElement(Box9, { component: "span", style: { textTransform: "capitalize" } }, positionLabel, ": ", labels.join(" "));
4258
4292
  };
4259
4293
  var TransitionsSizeVariableLabel = ({ value: prop }) => {
4260
4294
  let label = "";
@@ -4267,7 +4301,7 @@ var TransitionsSizeVariableLabel = ({ value: prop }) => {
4267
4301
  }
4268
4302
  label += variable?.value;
4269
4303
  }
4270
- return /* @__PURE__ */ React39.createElement("span", null, label);
4304
+ return /* @__PURE__ */ React39.createElement(Box9, { component: "span" }, label);
4271
4305
  };
4272
4306
 
4273
4307
  // src/repeater-injections.ts
@@ -4275,26 +4309,27 @@ function registerRepeaterInjections() {
4275
4309
  backgroundOverlayRepeaterInjections();
4276
4310
  boxShadowRepeaterInjections();
4277
4311
  transitionsRepeaterInjections();
4312
+ filterRepeaterInjections();
4278
4313
  }
4279
- var backgroundOverlayRepeaterInjections = () => {
4314
+ function backgroundOverlayRepeaterInjections() {
4280
4315
  injectIntoRepeaterItemIcon({
4281
- id: "color-variables-background-icon",
4316
+ id: "background-color-variables-icon",
4282
4317
  component: BackgroundRepeaterColorIndicator,
4283
4318
  condition: ({ value }) => {
4284
4319
  return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(value)?.color);
4285
4320
  }
4286
4321
  });
4287
4322
  injectIntoRepeaterItemLabel({
4288
- id: "color-variables-label",
4323
+ id: "background-color-variables-label",
4289
4324
  component: BackgroundRepeaterLabel,
4290
4325
  condition: ({ value }) => {
4291
4326
  return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(value)?.color);
4292
4327
  }
4293
4328
  });
4294
- };
4295
- var boxShadowRepeaterInjections = () => {
4329
+ }
4330
+ function boxShadowRepeaterInjections() {
4296
4331
  injectIntoRepeaterItemIcon({
4297
- id: "color-variables-box-shadow-icon",
4332
+ id: "box-shadow-color-variables-icon",
4298
4333
  component: BoxShadowRepeaterColorIndicator,
4299
4334
  condition: ({ value }) => {
4300
4335
  const { color } = shadowPropTypeUtil2.extract(value) || {};
@@ -4309,8 +4344,8 @@ var boxShadowRepeaterInjections = () => {
4309
4344
  return hasAssignedSizeVariable(hOffset) || hasAssignedSizeVariable(vOffset) || hasAssignedSizeVariable(blur) || hasAssignedSizeVariable(spread);
4310
4345
  }
4311
4346
  });
4312
- };
4313
- var transitionsRepeaterInjections = () => {
4347
+ }
4348
+ function transitionsRepeaterInjections() {
4314
4349
  injectIntoRepeaterItemLabel({
4315
4350
  id: "transition-size-variables-label",
4316
4351
  component: TransitionsSizeVariableLabel,
@@ -4318,8 +4353,50 @@ var transitionsRepeaterInjections = () => {
4318
4353
  return hasAssignedSizeVariable(selectionSizePropTypeUtil2.extract(value)?.size);
4319
4354
  }
4320
4355
  });
4321
- };
4322
- var hasAssignedSizeVariable = (value) => {
4356
+ }
4357
+ function filterRepeaterInjections() {
4358
+ injectIntoRepeaterItemIcon({
4359
+ id: "filters-color-variables-icon",
4360
+ component: FilterDropShadowIconIndicator,
4361
+ condition: ({ value }) => {
4362
+ if (!cssFilterFunctionPropUtil2.isValid(value)) {
4363
+ return false;
4364
+ }
4365
+ const args = cssFilterFunctionPropUtil2.extract(value)?.args;
4366
+ if (dropShadowFilterPropTypeUtil2.isValid(args)) {
4367
+ return hasAssignedColorVariable(dropShadowFilterPropTypeUtil2.extract(args)?.color);
4368
+ }
4369
+ return false;
4370
+ }
4371
+ });
4372
+ injectIntoRepeaterItemLabel({
4373
+ id: "filters-drop-shadow-size-variables-label",
4374
+ component: FilterDropShadowRepeaterLabel,
4375
+ condition: ({ value }) => {
4376
+ if (!cssFilterFunctionPropUtil2.isValid(value)) {
4377
+ return false;
4378
+ }
4379
+ const args = cssFilterFunctionPropUtil2.extract(value)?.args;
4380
+ if (dropShadowFilterPropTypeUtil2.isValid(args)) {
4381
+ const { xAxis, yAxis, blur } = dropShadowFilterPropTypeUtil2.extract(args) || {};
4382
+ return hasAssignedSizeVariable(xAxis) || hasAssignedSizeVariable(yAxis) || hasAssignedSizeVariable(blur);
4383
+ }
4384
+ return false;
4385
+ }
4386
+ });
4387
+ injectIntoRepeaterItemLabel({
4388
+ id: "filters-size-variables-label",
4389
+ component: FilterSingleSizeRepeaterLabel,
4390
+ condition: ({ value }) => {
4391
+ if (!cssFilterFunctionPropUtil2.isValid(value)) {
4392
+ return false;
4393
+ }
4394
+ const args = cssFilterFunctionPropUtil2.extract(value)?.args;
4395
+ return hasAssignedSizeVariable(args?.value?.size);
4396
+ }
4397
+ });
4398
+ }
4399
+ function hasAssignedSizeVariable(value) {
4323
4400
  if (sizeVariablePropTypeUtil.isValid(value)) {
4324
4401
  return true;
4325
4402
  }
@@ -4327,10 +4404,10 @@ var hasAssignedSizeVariable = (value) => {
4327
4404
  return true;
4328
4405
  }
4329
4406
  return false;
4330
- };
4331
- var hasAssignedColorVariable = (value) => {
4407
+ }
4408
+ function hasAssignedColorVariable(value) {
4332
4409
  return !!colorVariablePropTypeUtil.isValid(value);
4333
- };
4410
+ }
4334
4411
 
4335
4412
  // src/init.ts
4336
4413
  var { registerPopoverAction } = controlActionsMenu;