@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.mjs
CHANGED
|
@@ -4182,10 +4182,17 @@ function convertToCssVariables(variables) {
|
|
|
4182
4182
|
|
|
4183
4183
|
// src/repeater-injections.ts
|
|
4184
4184
|
import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elementor/editor-controls";
|
|
4185
|
-
import {
|
|
4185
|
+
import {
|
|
4186
|
+
backgroundColorOverlayPropTypeUtil,
|
|
4187
|
+
selectionSizePropTypeUtil as selectionSizePropTypeUtil2,
|
|
4188
|
+
shadowPropTypeUtil
|
|
4189
|
+
} from "@elementor/editor-props";
|
|
4186
4190
|
|
|
4187
4191
|
// src/components/variables-repeater-item-slot.tsx
|
|
4188
4192
|
import * as React39 from "react";
|
|
4193
|
+
import {
|
|
4194
|
+
selectionSizePropTypeUtil
|
|
4195
|
+
} from "@elementor/editor-props";
|
|
4189
4196
|
var useColorVariable = (value) => {
|
|
4190
4197
|
const variableId = value?.value?.color?.value;
|
|
4191
4198
|
return useVariable(variableId || "");
|
|
@@ -4202,33 +4209,76 @@ var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
|
4202
4209
|
const colorVariable = useColorVariable(value);
|
|
4203
4210
|
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4204
4211
|
};
|
|
4212
|
+
var TransitionsSizeVariableLabel = ({ value: prop }) => {
|
|
4213
|
+
let label = "";
|
|
4214
|
+
const variableId = prop?.value?.size?.value || "";
|
|
4215
|
+
const variable = useVariable(variableId);
|
|
4216
|
+
if (variable && selectionSizePropTypeUtil.isValid(prop)) {
|
|
4217
|
+
const selection = prop.value?.selection?.value?.key?.value;
|
|
4218
|
+
if (selection) {
|
|
4219
|
+
label += `${selection}: `;
|
|
4220
|
+
}
|
|
4221
|
+
label += variable?.value;
|
|
4222
|
+
}
|
|
4223
|
+
return /* @__PURE__ */ React39.createElement("span", null, label);
|
|
4224
|
+
};
|
|
4225
|
+
|
|
4226
|
+
// src/prop-types/custom-size-variable-prop-type.ts
|
|
4227
|
+
import { createPropUtils as createPropUtils4 } from "@elementor/editor-props";
|
|
4228
|
+
import { z as z5 } from "@elementor/schema";
|
|
4229
|
+
var customSizeVariablePropTypeUtil = createPropUtils4("global-custom-size-variable", z5.string());
|
|
4205
4230
|
|
|
4206
4231
|
// src/repeater-injections.ts
|
|
4207
4232
|
function registerRepeaterInjections() {
|
|
4233
|
+
backgroundOverlayRepeaterInjections();
|
|
4234
|
+
boxShadowRepeaterInjections();
|
|
4235
|
+
transitionsRepeaterInjections();
|
|
4236
|
+
}
|
|
4237
|
+
var backgroundOverlayRepeaterInjections = () => {
|
|
4208
4238
|
injectIntoRepeaterItemIcon({
|
|
4209
4239
|
id: "color-variables-background-icon",
|
|
4210
4240
|
component: BackgroundRepeaterColorIndicator,
|
|
4211
|
-
condition: ({ value
|
|
4212
|
-
return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(
|
|
4241
|
+
condition: ({ value }) => {
|
|
4242
|
+
return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4213
4243
|
}
|
|
4214
4244
|
});
|
|
4245
|
+
injectIntoRepeaterItemLabel({
|
|
4246
|
+
id: "color-variables-label",
|
|
4247
|
+
component: BackgroundRepeaterLabel,
|
|
4248
|
+
condition: ({ value }) => {
|
|
4249
|
+
return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(value)?.color);
|
|
4250
|
+
}
|
|
4251
|
+
});
|
|
4252
|
+
};
|
|
4253
|
+
var boxShadowRepeaterInjections = () => {
|
|
4215
4254
|
injectIntoRepeaterItemIcon({
|
|
4216
|
-
id: "color-variables-icon",
|
|
4255
|
+
id: "color-variables-box-shadow-icon",
|
|
4217
4256
|
component: BoxShadowRepeaterColorIndicator,
|
|
4218
|
-
condition: ({ value
|
|
4219
|
-
return hasAssignedColorVariable(shadowPropTypeUtil.extract(
|
|
4257
|
+
condition: ({ value }) => {
|
|
4258
|
+
return hasAssignedColorVariable(shadowPropTypeUtil.extract(value)?.color);
|
|
4220
4259
|
}
|
|
4221
4260
|
});
|
|
4261
|
+
};
|
|
4262
|
+
var transitionsRepeaterInjections = () => {
|
|
4222
4263
|
injectIntoRepeaterItemLabel({
|
|
4223
|
-
id: "
|
|
4224
|
-
component:
|
|
4225
|
-
condition: ({ value
|
|
4226
|
-
return
|
|
4264
|
+
id: "transition-size-variables-label",
|
|
4265
|
+
component: TransitionsSizeVariableLabel,
|
|
4266
|
+
condition: ({ value }) => {
|
|
4267
|
+
return hasAssignedSizeVariable(selectionSizePropTypeUtil2.extract(value)?.size);
|
|
4227
4268
|
}
|
|
4228
4269
|
});
|
|
4229
|
-
}
|
|
4230
|
-
var
|
|
4231
|
-
|
|
4270
|
+
};
|
|
4271
|
+
var hasAssignedSizeVariable = (value) => {
|
|
4272
|
+
if (sizeVariablePropTypeUtil.isValid(value)) {
|
|
4273
|
+
return true;
|
|
4274
|
+
}
|
|
4275
|
+
if (customSizeVariablePropTypeUtil.isValid(value)) {
|
|
4276
|
+
return true;
|
|
4277
|
+
}
|
|
4278
|
+
return false;
|
|
4279
|
+
};
|
|
4280
|
+
var hasAssignedColorVariable = (value) => {
|
|
4281
|
+
return !!colorVariablePropTypeUtil.isValid(value);
|
|
4232
4282
|
};
|
|
4233
4283
|
|
|
4234
4284
|
// src/init.ts
|