@elementor/editor-variables 4.0.0-manual → 4.1.0-684
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 +199 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/open-panel-from-event.tsx +46 -0
- package/src/components/ui/variable-promotion-chip.tsx +14 -4
- package/src/components/variables-manager/ui/variable-table-row.tsx +3 -0
- package/src/components/variables-manager/variables-manager-create-menu.tsx +16 -3
- package/src/components/variables-manager/variables-manager-panel.tsx +1 -1
- package/src/components/variables-selection.tsx +18 -1
- package/src/init.ts +6 -0
- package/src/register-variable-types.tsx +12 -3
- package/src/renderers/style-variables-renderer.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -44,12 +44,12 @@ module.exports = __toCommonJS(index_exports);
|
|
|
44
44
|
|
|
45
45
|
// src/init.ts
|
|
46
46
|
var import_editor = require("@elementor/editor");
|
|
47
|
-
var
|
|
47
|
+
var import_editor_controls18 = require("@elementor/editor-controls");
|
|
48
48
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
49
49
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
50
50
|
var import_menus = require("@elementor/menus");
|
|
51
51
|
|
|
52
|
-
// src/components/open-panel-from-
|
|
52
|
+
// src/components/open-panel-from-event.tsx
|
|
53
53
|
var import_react14 = require("react");
|
|
54
54
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
55
55
|
|
|
@@ -1127,16 +1127,24 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1127
1127
|
// src/components/ui/variable-promotion-chip.tsx
|
|
1128
1128
|
var React6 = __toESM(require("react"));
|
|
1129
1129
|
var import_react6 = require("react");
|
|
1130
|
+
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
1130
1131
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1131
1132
|
var import_ui6 = require("@elementor/ui");
|
|
1132
1133
|
var import_utils = require("@elementor/utils");
|
|
1133
1134
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1134
1135
|
var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
1135
|
-
({ variableType, upgradeUrl }, ref) => {
|
|
1136
|
+
({ variableType, upgradeUrl, trackingData }, ref) => {
|
|
1136
1137
|
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
1137
1138
|
(0, import_editor_ui2.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1138
|
-
const toggle = ()
|
|
1139
|
-
|
|
1139
|
+
const toggle = (0, import_react6.useCallback)(() => {
|
|
1140
|
+
setIsOpen((prev) => {
|
|
1141
|
+
if (!prev) {
|
|
1142
|
+
(0, import_editor_controls2.trackViewPromotion)(trackingData);
|
|
1143
|
+
}
|
|
1144
|
+
return !prev;
|
|
1145
|
+
});
|
|
1146
|
+
}, [trackingData]);
|
|
1147
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
|
|
1140
1148
|
const title = (0, import_i18n7.sprintf)(
|
|
1141
1149
|
/* translators: %s: Variable Type. */
|
|
1142
1150
|
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
@@ -1158,7 +1166,8 @@ var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
|
1158
1166
|
onClose: (e) => {
|
|
1159
1167
|
e.stopPropagation();
|
|
1160
1168
|
setIsOpen(false);
|
|
1161
|
-
}
|
|
1169
|
+
},
|
|
1170
|
+
onCtaClick: () => (0, import_editor_controls2.trackUpgradePromotionClick)(trackingData)
|
|
1162
1171
|
},
|
|
1163
1172
|
/* @__PURE__ */ React6.createElement(
|
|
1164
1173
|
import_ui6.Box,
|
|
@@ -1176,6 +1185,11 @@ var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
|
1176
1185
|
);
|
|
1177
1186
|
|
|
1178
1187
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1188
|
+
var TRACKING_DATA = {
|
|
1189
|
+
target_name: "variables_manager",
|
|
1190
|
+
target_location: "variables_manager",
|
|
1191
|
+
location_l1: "create variable menu"
|
|
1192
|
+
};
|
|
1179
1193
|
var SIZE = "tiny";
|
|
1180
1194
|
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1181
1195
|
const buttonRef = (0, import_react7.useRef)(null);
|
|
@@ -1258,18 +1272,24 @@ var MenuOption = ({
|
|
|
1258
1272
|
{
|
|
1259
1273
|
variableType: config.variableType,
|
|
1260
1274
|
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1261
|
-
ref: promotionRef
|
|
1275
|
+
ref: promotionRef,
|
|
1276
|
+
trackingData: TRACKING_DATA
|
|
1262
1277
|
}
|
|
1263
1278
|
));
|
|
1264
1279
|
};
|
|
1265
1280
|
var getDefaultName = (variables, baseName) => {
|
|
1266
1281
|
const pattern = new RegExp(`^${baseName}-(\\d+)$`, "i");
|
|
1267
|
-
|
|
1282
|
+
const takenNumbers = /* @__PURE__ */ new Set();
|
|
1268
1283
|
Object.values(variables).forEach((variable) => {
|
|
1269
|
-
|
|
1270
|
-
|
|
1284
|
+
const match = variable.label.match(pattern);
|
|
1285
|
+
if (match) {
|
|
1286
|
+
takenNumbers.add(parseInt(match[1], 10));
|
|
1271
1287
|
}
|
|
1272
1288
|
});
|
|
1289
|
+
let counter = 1;
|
|
1290
|
+
while (takenNumbers.has(counter)) {
|
|
1291
|
+
counter++;
|
|
1292
|
+
}
|
|
1273
1293
|
return `${baseName}-${counter}`;
|
|
1274
1294
|
};
|
|
1275
1295
|
|
|
@@ -1583,6 +1603,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1583
1603
|
};
|
|
1584
1604
|
|
|
1585
1605
|
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1606
|
+
var TRACKING_DATA2 = { target_name: "variables_manager", target_location: "variables_manager" };
|
|
1586
1607
|
var VariableRow = (props) => {
|
|
1587
1608
|
const {
|
|
1588
1609
|
row,
|
|
@@ -1745,7 +1766,8 @@ var VariableRow = (props) => {
|
|
|
1745
1766
|
{
|
|
1746
1767
|
variableType: row.variableType,
|
|
1747
1768
|
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1748
|
-
ref: promotionRef
|
|
1769
|
+
ref: promotionRef,
|
|
1770
|
+
trackingData: TRACKING_DATA2
|
|
1749
1771
|
}
|
|
1750
1772
|
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1751
1773
|
);
|
|
@@ -2169,7 +2191,7 @@ var usePreventUnload = (isDirty) => {
|
|
|
2169
2191
|
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
2170
2192
|
const [, suppressStopSyncMessage] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
|
|
2171
2193
|
return /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Title, { icon: import_icons5.ColorFilterIcon, iconColor: "primary" }, (0, import_i18n10.__)("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n10.__)(
|
|
2172
|
-
"This will disconnect the variable color from
|
|
2194
|
+
"This will disconnect the variable color from Global Colors. Existing uses on your site will automatically switch to a default color.",
|
|
2173
2195
|
"elementor"
|
|
2174
2196
|
))), /* @__PURE__ */ React14.createElement(
|
|
2175
2197
|
import_editor_ui5.ConfirmationDialog.Actions,
|
|
@@ -2185,20 +2207,54 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
|
2185
2207
|
));
|
|
2186
2208
|
};
|
|
2187
2209
|
|
|
2210
|
+
// src/components/open-panel-from-event.tsx
|
|
2211
|
+
var EVENT_NAME = "elementor/open-variables-manager";
|
|
2212
|
+
var DEFAULT_PANEL_ROUTE = "panel/elements/categories";
|
|
2213
|
+
function OpenPanelFromEvent() {
|
|
2214
|
+
const { open } = usePanelActions();
|
|
2215
|
+
const pendingRef = (0, import_react14.useRef)(false);
|
|
2216
|
+
const [readyToOpen, setReadyToOpen] = (0, import_react14.useState)(false);
|
|
2217
|
+
(0, import_react14.useEffect)(() => {
|
|
2218
|
+
if (readyToOpen) {
|
|
2219
|
+
setReadyToOpen(false);
|
|
2220
|
+
open();
|
|
2221
|
+
}
|
|
2222
|
+
}, [readyToOpen, open]);
|
|
2223
|
+
(0, import_react14.useEffect)(() => {
|
|
2224
|
+
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2225
|
+
if (pendingRef.current) {
|
|
2226
|
+
pendingRef.current = false;
|
|
2227
|
+
setReadyToOpen(true);
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
}, []);
|
|
2231
|
+
(0, import_react14.useEffect)(() => {
|
|
2232
|
+
const handler = () => {
|
|
2233
|
+
pendingRef.current = true;
|
|
2234
|
+
(0, import_editor_v1_adapters3.__privateOpenRoute)(DEFAULT_PANEL_ROUTE);
|
|
2235
|
+
};
|
|
2236
|
+
window.addEventListener(EVENT_NAME, handler);
|
|
2237
|
+
return () => window.removeEventListener(EVENT_NAME, handler);
|
|
2238
|
+
}, []);
|
|
2239
|
+
return null;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2188
2242
|
// src/components/open-panel-from-url.tsx
|
|
2243
|
+
var import_react15 = require("react");
|
|
2244
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2189
2245
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2190
2246
|
var PANEL_ID = "variables-manager";
|
|
2191
|
-
var
|
|
2247
|
+
var DEFAULT_PANEL_ROUTE2 = "panel/elements";
|
|
2192
2248
|
function OpenPanelFromUrl() {
|
|
2193
2249
|
const { open } = usePanelActions();
|
|
2194
|
-
const hasOpened = (0,
|
|
2195
|
-
(0,
|
|
2250
|
+
const hasOpened = (0, import_react15.useRef)(false);
|
|
2251
|
+
(0, import_react15.useEffect)(() => {
|
|
2196
2252
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2197
2253
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2198
2254
|
if (activePanel !== PANEL_ID) {
|
|
2199
2255
|
return;
|
|
2200
2256
|
}
|
|
2201
|
-
const cleanup = (0,
|
|
2257
|
+
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE2), () => {
|
|
2202
2258
|
if (hasOpened.current) {
|
|
2203
2259
|
return;
|
|
2204
2260
|
}
|
|
@@ -2214,12 +2270,12 @@ function OpenPanelFromUrl() {
|
|
|
2214
2270
|
|
|
2215
2271
|
// src/controls/variable-control.tsx
|
|
2216
2272
|
var React33 = __toESM(require("react"));
|
|
2217
|
-
var
|
|
2273
|
+
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
2218
2274
|
|
|
2219
2275
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2220
|
-
var
|
|
2276
|
+
var import_react22 = require("react");
|
|
2221
2277
|
var React24 = __toESM(require("react"));
|
|
2222
|
-
var
|
|
2278
|
+
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
2223
2279
|
var import_icons12 = require("@elementor/icons");
|
|
2224
2280
|
var import_ui24 = require("@elementor/ui");
|
|
2225
2281
|
|
|
@@ -2241,35 +2297,35 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2241
2297
|
|
|
2242
2298
|
// src/components/variable-selection-popover.tsx
|
|
2243
2299
|
var React22 = __toESM(require("react"));
|
|
2244
|
-
var
|
|
2245
|
-
var
|
|
2300
|
+
var import_react21 = require("react");
|
|
2301
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2246
2302
|
|
|
2247
2303
|
// src/context/variable-selection-popover.context.tsx
|
|
2248
2304
|
var React15 = __toESM(require("react"));
|
|
2249
|
-
var
|
|
2305
|
+
var import_react16 = require("react");
|
|
2250
2306
|
var import_ui15 = require("@elementor/ui");
|
|
2251
|
-
var PopoverContentRefContext = (0,
|
|
2307
|
+
var PopoverContentRefContext = (0, import_react16.createContext)(null);
|
|
2252
2308
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2253
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2309
|
+
const [anchorRef, setAnchorRef] = (0, import_react16.useState)(null);
|
|
2254
2310
|
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: setAnchorRef }, children));
|
|
2255
2311
|
};
|
|
2256
2312
|
var usePopoverContentRef = () => {
|
|
2257
|
-
return (0,
|
|
2313
|
+
return (0, import_react16.useContext)(PopoverContentRefContext);
|
|
2258
2314
|
};
|
|
2259
2315
|
|
|
2260
2316
|
// src/components/variable-creation.tsx
|
|
2261
2317
|
var React17 = __toESM(require("react"));
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2318
|
+
var import_react17 = require("react");
|
|
2319
|
+
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2264
2320
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2265
2321
|
var import_icons6 = require("@elementor/icons");
|
|
2266
2322
|
var import_ui17 = require("@elementor/ui");
|
|
2267
2323
|
var import_i18n11 = require("@wordpress/i18n");
|
|
2268
2324
|
|
|
2269
2325
|
// src/hooks/use-initial-value.ts
|
|
2270
|
-
var
|
|
2326
|
+
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
2271
2327
|
var useInitialValue = () => {
|
|
2272
|
-
const { value: initial } = (0,
|
|
2328
|
+
const { value: initial } = (0, import_editor_controls3.useBoundProp)();
|
|
2273
2329
|
const hasAssignedVariable = hasVariableType(initial?.$$type) && Boolean(initial?.value);
|
|
2274
2330
|
const variable = useVariable(hasAssignedVariable ? initial.value : "");
|
|
2275
2331
|
if (hasAssignedVariable) {
|
|
@@ -2279,11 +2335,11 @@ var useInitialValue = () => {
|
|
|
2279
2335
|
};
|
|
2280
2336
|
|
|
2281
2337
|
// src/hooks/use-variable-bound-prop.ts
|
|
2282
|
-
var
|
|
2338
|
+
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2283
2339
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
2284
2340
|
var useVariableBoundProp = () => {
|
|
2285
2341
|
const { propTypeUtil } = useVariableType();
|
|
2286
|
-
const boundProp = (0,
|
|
2342
|
+
const boundProp = (0, import_editor_controls4.useBoundProp)(propTypeUtil);
|
|
2287
2343
|
return {
|
|
2288
2344
|
...boundProp,
|
|
2289
2345
|
setVariableValue: (value) => resolveBoundPropAndSetValue(value, boundProp),
|
|
@@ -2318,13 +2374,13 @@ var SIZE2 = "tiny";
|
|
|
2318
2374
|
var VariableCreation = ({ onGoBack, onClose }) => {
|
|
2319
2375
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2320
2376
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2321
|
-
const { propType } = (0,
|
|
2377
|
+
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2322
2378
|
const initialValue = useInitialValue();
|
|
2323
|
-
const [value, setValue] = (0,
|
|
2324
|
-
const [label, setLabel] = (0,
|
|
2325
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2326
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2327
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2379
|
+
const [value, setValue] = (0, import_react17.useState)(initialValue);
|
|
2380
|
+
const [label, setLabel] = (0, import_react17.useState)("");
|
|
2381
|
+
const [errorMessage, setErrorMessage] = (0, import_react17.useState)("");
|
|
2382
|
+
const [valueFieldError, setValueFieldError] = (0, import_react17.useState)("");
|
|
2383
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react17.useState)(propTypeUtil.key);
|
|
2328
2384
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2329
2385
|
const resetFields = () => {
|
|
2330
2386
|
setValue("");
|
|
@@ -2388,7 +2444,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2388
2444
|
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
2389
2445
|
onClose: closePopover
|
|
2390
2446
|
}
|
|
2391
|
-
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(
|
|
2447
|
+
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2392
2448
|
FormField,
|
|
2393
2449
|
{
|
|
2394
2450
|
id: "variable-label",
|
|
@@ -2444,8 +2500,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2444
2500
|
|
|
2445
2501
|
// src/components/variable-edit.tsx
|
|
2446
2502
|
var React19 = __toESM(require("react"));
|
|
2447
|
-
var
|
|
2448
|
-
var
|
|
2503
|
+
var import_react19 = require("react");
|
|
2504
|
+
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2449
2505
|
var import_editor_current_user3 = require("@elementor/editor-current-user");
|
|
2450
2506
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2451
2507
|
var import_icons8 = require("@elementor/icons");
|
|
@@ -2454,7 +2510,7 @@ var import_i18n13 = require("@wordpress/i18n");
|
|
|
2454
2510
|
|
|
2455
2511
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2456
2512
|
var React18 = __toESM(require("react"));
|
|
2457
|
-
var
|
|
2513
|
+
var import_react18 = require("react");
|
|
2458
2514
|
var import_icons7 = require("@elementor/icons");
|
|
2459
2515
|
var import_ui18 = require("@elementor/ui");
|
|
2460
2516
|
var import_i18n12 = require("@wordpress/i18n");
|
|
@@ -2464,7 +2520,7 @@ var EditConfirmationDialog = ({
|
|
|
2464
2520
|
onConfirm,
|
|
2465
2521
|
onSuppressMessage
|
|
2466
2522
|
}) => {
|
|
2467
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2523
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react18.useState)(false);
|
|
2468
2524
|
const handleSave = () => {
|
|
2469
2525
|
if (dontShowAgain) {
|
|
2470
2526
|
onSuppressMessage?.();
|
|
@@ -2496,22 +2552,22 @@ var DELETE_LABEL = (0, import_i18n13.__)("Delete variable", "elementor");
|
|
|
2496
2552
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2497
2553
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2498
2554
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2499
|
-
const { propType } = (0,
|
|
2555
|
+
const { propType } = (0, import_editor_controls6.useBoundProp)();
|
|
2500
2556
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user3.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2501
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2502
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2503
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2504
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2557
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react19.useState)(false);
|
|
2558
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react19.useState)(false);
|
|
2559
|
+
const [errorMessage, setErrorMessage] = (0, import_react19.useState)("");
|
|
2560
|
+
const [valueFieldError, setValueFieldError] = (0, import_react19.useState)("");
|
|
2505
2561
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2506
2562
|
const variable = useVariable(editId);
|
|
2507
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2563
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react19.useState)(variable?.type ?? propTypeUtil.key);
|
|
2508
2564
|
if (!variable) {
|
|
2509
2565
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2510
2566
|
}
|
|
2511
2567
|
const userPermissions = usePermissions();
|
|
2512
|
-
const [value, setValue] = (0,
|
|
2513
|
-
const [label, setLabel] = (0,
|
|
2514
|
-
(0,
|
|
2568
|
+
const [value, setValue] = (0, import_react19.useState)(() => variable.value);
|
|
2569
|
+
const [label, setLabel] = (0, import_react19.useState)(() => variable.label);
|
|
2570
|
+
(0, import_react19.useEffect)(() => {
|
|
2515
2571
|
styleVariablesRepository.update({
|
|
2516
2572
|
[editId]: {
|
|
2517
2573
|
...variable,
|
|
@@ -2614,7 +2670,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2614
2670
|
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2615
2671
|
actions
|
|
2616
2672
|
}
|
|
2617
|
-
), /* @__PURE__ */ React19.createElement(import_ui19.Divider, null), /* @__PURE__ */ React19.createElement(
|
|
2673
|
+
), /* @__PURE__ */ React19.createElement(import_ui19.Divider, null), /* @__PURE__ */ React19.createElement(import_editor_controls6.PopoverContent, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2618
2674
|
FormField,
|
|
2619
2675
|
{
|
|
2620
2676
|
id: "variable-label",
|
|
@@ -2675,8 +2731,9 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2675
2731
|
};
|
|
2676
2732
|
|
|
2677
2733
|
// src/components/variables-selection.tsx
|
|
2678
|
-
var
|
|
2734
|
+
var import_react20 = require("react");
|
|
2679
2735
|
var React21 = __toESM(require("react"));
|
|
2736
|
+
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
2680
2737
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2681
2738
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2682
2739
|
var import_icons10 = require("@elementor/icons");
|
|
@@ -2782,7 +2839,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
|
|
|
2782
2839
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2783
2840
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2784
2841
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2785
|
-
const [searchValue, setSearchValue] = (0,
|
|
2842
|
+
const [searchValue, setSearchValue] = (0, import_react20.useState)("");
|
|
2786
2843
|
const {
|
|
2787
2844
|
list: variables,
|
|
2788
2845
|
hasMatches: hasSearchResults,
|
|
@@ -2859,6 +2916,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2859
2916
|
const handleClearSearch = () => {
|
|
2860
2917
|
setSearchValue("");
|
|
2861
2918
|
};
|
|
2919
|
+
(0, import_react20.useEffect)(() => {
|
|
2920
|
+
if (disabled) {
|
|
2921
|
+
(0, import_editor_controls7.trackViewPromotion)({
|
|
2922
|
+
target_name: "variables_popover",
|
|
2923
|
+
target_location: "widget_panel",
|
|
2924
|
+
location_l1: "variables_list"
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
}, [disabled]);
|
|
2862
2928
|
return /* @__PURE__ */ React21.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React21.createElement(
|
|
2863
2929
|
import_editor_ui9.PopoverHeader,
|
|
2864
2930
|
{
|
|
@@ -2895,7 +2961,11 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2895
2961
|
(0, import_i18n15.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2896
2962
|
variableType
|
|
2897
2963
|
),
|
|
2898
|
-
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2964
|
+
upgradeUrl: getProUpgradeUrl(variableType),
|
|
2965
|
+
onCtaClick: () => (0, import_editor_controls7.trackUpgradePromotionClick)({
|
|
2966
|
+
target_name: "variables_popover",
|
|
2967
|
+
location_l1: "variables_list"
|
|
2968
|
+
})
|
|
2899
2969
|
}
|
|
2900
2970
|
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2901
2971
|
NoSearchResults,
|
|
@@ -2954,10 +3024,10 @@ var VIEW_LIST = "list";
|
|
|
2954
3024
|
var VIEW_ADD = "add";
|
|
2955
3025
|
var VIEW_EDIT = "edit";
|
|
2956
3026
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2957
|
-
const [currentView, setCurrentView] = (0,
|
|
2958
|
-
const [editId, setEditId] = (0,
|
|
3027
|
+
const [currentView, setCurrentView] = (0, import_react21.useState)(VIEW_LIST);
|
|
3028
|
+
const [editId, setEditId] = (0, import_react21.useState)("");
|
|
2959
3029
|
const { open } = usePanelActions();
|
|
2960
|
-
const onSettingsAvailable = (0,
|
|
3030
|
+
const onSettingsAvailable = (0, import_editor_v1_adapters5.isExperimentActive)("e_variables_manager") ? () => {
|
|
2961
3031
|
open();
|
|
2962
3032
|
} : void 0;
|
|
2963
3033
|
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
@@ -3065,9 +3135,9 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3065
3135
|
// src/components/ui/variable/assigned-variable.tsx
|
|
3066
3136
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3067
3137
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3068
|
-
const { setValue } = (0,
|
|
3069
|
-
const anchorRef = (0,
|
|
3070
|
-
const popupId = (0,
|
|
3138
|
+
const { setValue } = (0, import_editor_controls8.useBoundProp)();
|
|
3139
|
+
const anchorRef = (0, import_react22.useRef)(null);
|
|
3140
|
+
const popupId = (0, import_react22.useId)();
|
|
3071
3141
|
const popupState = (0, import_ui24.usePopupState)({
|
|
3072
3142
|
variant: "popover",
|
|
3073
3143
|
popupId: `elementor-variables-list-${popupId}`
|
|
@@ -3107,15 +3177,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3107
3177
|
|
|
3108
3178
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3109
3179
|
var React28 = __toESM(require("react"));
|
|
3110
|
-
var
|
|
3111
|
-
var
|
|
3180
|
+
var import_react24 = require("react");
|
|
3181
|
+
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3112
3182
|
var import_ui28 = require("@elementor/ui");
|
|
3113
3183
|
var import_i18n19 = require("@wordpress/i18n");
|
|
3114
3184
|
|
|
3115
3185
|
// src/components/variable-restore.tsx
|
|
3116
3186
|
var React25 = __toESM(require("react"));
|
|
3117
|
-
var
|
|
3118
|
-
var
|
|
3187
|
+
var import_react23 = require("react");
|
|
3188
|
+
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3119
3189
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3120
3190
|
var import_ui25 = require("@elementor/ui");
|
|
3121
3191
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -3123,16 +3193,16 @@ var SIZE7 = "tiny";
|
|
|
3123
3193
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
3124
3194
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
3125
3195
|
const { setVariableValue: notifyBoundPropChange } = useVariableBoundProp();
|
|
3126
|
-
const { propType } = (0,
|
|
3196
|
+
const { propType } = (0, import_editor_controls9.useBoundProp)();
|
|
3127
3197
|
const variable = useVariable(variableId);
|
|
3128
3198
|
if (!variable) {
|
|
3129
3199
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3130
3200
|
}
|
|
3131
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3132
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3133
|
-
const [label, setLabel] = (0,
|
|
3134
|
-
const [value, setValue] = (0,
|
|
3135
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3201
|
+
const [errorMessage, setErrorMessage] = (0, import_react23.useState)("");
|
|
3202
|
+
const [valueFieldError, setValueFieldError] = (0, import_react23.useState)("");
|
|
3203
|
+
const [label, setLabel] = (0, import_react23.useState)(variable.label);
|
|
3204
|
+
const [value, setValue] = (0, import_react23.useState)(variable.value);
|
|
3205
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react23.useState)(variable?.type ?? propTypeUtil.key);
|
|
3136
3206
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3137
3207
|
value: variable.label,
|
|
3138
3208
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3185,7 +3255,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3185
3255
|
title: (0, import_i18n17.__)("Restore variable", "elementor"),
|
|
3186
3256
|
onClose
|
|
3187
3257
|
}
|
|
3188
|
-
), /* @__PURE__ */ React25.createElement(import_ui25.Divider, null), /* @__PURE__ */ React25.createElement(
|
|
3258
|
+
), /* @__PURE__ */ React25.createElement(import_ui25.Divider, null), /* @__PURE__ */ React25.createElement(import_editor_controls9.PopoverContent, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
3189
3259
|
FormField,
|
|
3190
3260
|
{
|
|
3191
3261
|
id: "variable-label",
|
|
@@ -3286,13 +3356,13 @@ WarningVariableTag.displayName = "WarningVariableTag";
|
|
|
3286
3356
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3287
3357
|
var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
3288
3358
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3289
|
-
const boundProp = (0,
|
|
3359
|
+
const boundProp = (0, import_editor_controls10.useBoundProp)();
|
|
3290
3360
|
const userPermissions = usePermissions();
|
|
3291
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3361
|
+
const [showInfotip, setShowInfotip] = (0, import_react24.useState)(false);
|
|
3292
3362
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3293
3363
|
const closeInfotip = () => setShowInfotip(false);
|
|
3294
|
-
const deletedChipAnchorRef = (0,
|
|
3295
|
-
const popupId = (0,
|
|
3364
|
+
const deletedChipAnchorRef = (0, import_react24.useRef)(null);
|
|
3365
|
+
const popupId = (0, import_react24.useId)();
|
|
3296
3366
|
const popupState = (0, import_ui28.usePopupState)({
|
|
3297
3367
|
variant: "popover",
|
|
3298
3368
|
popupId: `elementor-variables-restore-${popupId}`
|
|
@@ -3379,8 +3449,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3379
3449
|
|
|
3380
3450
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3381
3451
|
var React30 = __toESM(require("react"));
|
|
3382
|
-
var
|
|
3383
|
-
var
|
|
3452
|
+
var import_react25 = require("react");
|
|
3453
|
+
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
3384
3454
|
var import_ui30 = require("@elementor/ui");
|
|
3385
3455
|
var import_i18n21 = require("@wordpress/i18n");
|
|
3386
3456
|
|
|
@@ -3416,14 +3486,14 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
3416
3486
|
|
|
3417
3487
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3418
3488
|
var MismatchVariable = ({ variable }) => {
|
|
3419
|
-
const { setValue, value } = (0,
|
|
3420
|
-
const anchorRef = (0,
|
|
3421
|
-
const popupId = (0,
|
|
3489
|
+
const { setValue, value } = (0, import_editor_controls11.useBoundProp)();
|
|
3490
|
+
const anchorRef = (0, import_react25.useRef)(null);
|
|
3491
|
+
const popupId = (0, import_react25.useId)();
|
|
3422
3492
|
const popupState = (0, import_ui30.usePopupState)({
|
|
3423
3493
|
variant: "popover",
|
|
3424
3494
|
popupId: `elementor-variables-list-${popupId}`
|
|
3425
3495
|
});
|
|
3426
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3496
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3427
3497
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3428
3498
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3429
3499
|
const triggerSelect = () => {
|
|
@@ -3496,8 +3566,8 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3496
3566
|
|
|
3497
3567
|
// src/components/ui/variable/missing-variable.tsx
|
|
3498
3568
|
var React32 = __toESM(require("react"));
|
|
3499
|
-
var
|
|
3500
|
-
var
|
|
3569
|
+
var import_react26 = require("react");
|
|
3570
|
+
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3501
3571
|
var import_ui32 = require("@elementor/ui");
|
|
3502
3572
|
var import_i18n23 = require("@wordpress/i18n");
|
|
3503
3573
|
|
|
@@ -3525,8 +3595,8 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3525
3595
|
|
|
3526
3596
|
// src/components/ui/variable/missing-variable.tsx
|
|
3527
3597
|
var MissingVariable = () => {
|
|
3528
|
-
const { setValue } = (0,
|
|
3529
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3598
|
+
const { setValue } = (0, import_editor_controls12.useBoundProp)();
|
|
3599
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react26.useState)(false);
|
|
3530
3600
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3531
3601
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3532
3602
|
const clearValue = () => setValue(null);
|
|
@@ -3556,7 +3626,7 @@ var MissingVariable = () => {
|
|
|
3556
3626
|
|
|
3557
3627
|
// src/controls/variable-control.tsx
|
|
3558
3628
|
var VariableControl = () => {
|
|
3559
|
-
const boundProp = (0,
|
|
3629
|
+
const boundProp = (0, import_editor_controls13.useBoundProp)();
|
|
3560
3630
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3561
3631
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3562
3632
|
if (!assignedVariable) {
|
|
@@ -3575,11 +3645,11 @@ var VariableControl = () => {
|
|
|
3575
3645
|
|
|
3576
3646
|
// src/hooks/use-prop-variable-action.tsx
|
|
3577
3647
|
var React34 = __toESM(require("react"));
|
|
3578
|
-
var
|
|
3648
|
+
var import_editor_controls14 = require("@elementor/editor-controls");
|
|
3579
3649
|
var import_icons14 = require("@elementor/icons");
|
|
3580
3650
|
var import_i18n24 = require("@wordpress/i18n");
|
|
3581
3651
|
var usePropVariableAction = () => {
|
|
3582
|
-
const { propType, path } = (0,
|
|
3652
|
+
const { propType, path } = (0, import_editor_controls14.useBoundProp)();
|
|
3583
3653
|
const variable = resolveVariableFromPropType(propType);
|
|
3584
3654
|
return {
|
|
3585
3655
|
visible: Boolean(variable),
|
|
@@ -3737,20 +3807,21 @@ function initMcp() {
|
|
|
3737
3807
|
|
|
3738
3808
|
// src/register-variable-types.tsx
|
|
3739
3809
|
var React37 = __toESM(require("react"));
|
|
3810
|
+
var import_editor_controls16 = require("@elementor/editor-controls");
|
|
3740
3811
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3741
3812
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3742
|
-
var
|
|
3813
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3743
3814
|
var import_icons16 = require("@elementor/icons");
|
|
3744
3815
|
var import_i18n26 = require("@wordpress/i18n");
|
|
3745
3816
|
|
|
3746
3817
|
// src/components/fields/color-field.tsx
|
|
3747
3818
|
var React35 = __toESM(require("react"));
|
|
3748
|
-
var
|
|
3819
|
+
var import_react27 = require("react");
|
|
3749
3820
|
var import_ui33 = require("@elementor/ui");
|
|
3750
3821
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3751
|
-
const [color, setColor] = (0,
|
|
3752
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3753
|
-
const defaultRef = (0,
|
|
3822
|
+
const [color, setColor] = (0, import_react27.useState)(value);
|
|
3823
|
+
const [errorMessage, setErrorMessage] = (0, import_react27.useState)("");
|
|
3824
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
3754
3825
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3755
3826
|
const handleChange = (newValue) => {
|
|
3756
3827
|
setColor(newValue);
|
|
@@ -3789,18 +3860,18 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3789
3860
|
|
|
3790
3861
|
// src/components/fields/font-field.tsx
|
|
3791
3862
|
var React36 = __toESM(require("react"));
|
|
3792
|
-
var
|
|
3793
|
-
var
|
|
3863
|
+
var import_react28 = require("react");
|
|
3864
|
+
var import_editor_controls15 = require("@elementor/editor-controls");
|
|
3794
3865
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3795
3866
|
var import_icons15 = require("@elementor/icons");
|
|
3796
3867
|
var import_ui34 = require("@elementor/ui");
|
|
3797
3868
|
var import_i18n25 = require("@wordpress/i18n");
|
|
3798
3869
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3799
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3800
|
-
const defaultRef = (0,
|
|
3870
|
+
const [fontFamily, setFontFamily] = (0, import_react28.useState)(value);
|
|
3871
|
+
const defaultRef = (0, import_react28.useRef)(null);
|
|
3801
3872
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3802
3873
|
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
3803
|
-
const fontFamilies = (0,
|
|
3874
|
+
const fontFamilies = (0, import_editor_controls15.useFontFamilies)();
|
|
3804
3875
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
3805
3876
|
const mapFontSubs = React36.useMemo(() => {
|
|
3806
3877
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
@@ -3818,7 +3889,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3818
3889
|
handleChange(newFontFamily);
|
|
3819
3890
|
fontPopoverState.close();
|
|
3820
3891
|
};
|
|
3821
|
-
const id2 = (0,
|
|
3892
|
+
const id2 = (0, import_react28.useId)();
|
|
3822
3893
|
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3823
3894
|
import_ui34.UnstableTag,
|
|
3824
3895
|
{
|
|
@@ -3840,7 +3911,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3840
3911
|
...(0, import_ui34.bindPopover)(fontPopoverState)
|
|
3841
3912
|
},
|
|
3842
3913
|
/* @__PURE__ */ React36.createElement(
|
|
3843
|
-
|
|
3914
|
+
import_editor_controls15.ItemSelector,
|
|
3844
3915
|
{
|
|
3845
3916
|
id: "font-family-variables-selector",
|
|
3846
3917
|
itemsList: mapFontSubs,
|
|
@@ -3850,7 +3921,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3850
3921
|
sectionWidth,
|
|
3851
3922
|
title: (0, import_i18n25.__)("Font family", "elementor"),
|
|
3852
3923
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3853
|
-
onDebounce:
|
|
3924
|
+
onDebounce: import_editor_controls15.enqueueFont,
|
|
3854
3925
|
icon: import_icons15.TextIcon
|
|
3855
3926
|
}
|
|
3856
3927
|
)
|
|
@@ -3881,19 +3952,19 @@ function registerVariableTypes() {
|
|
|
3881
3952
|
defaultValue: "#ffffff",
|
|
3882
3953
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3883
3954
|
const actions = [];
|
|
3884
|
-
if (!(0,
|
|
3955
|
+
if (!(0, import_editor_v1_adapters6.isExperimentActive)("e_design_system_sync")) {
|
|
3885
3956
|
return [];
|
|
3886
3957
|
}
|
|
3887
3958
|
if (variable.sync_to_v3) {
|
|
3888
3959
|
actions.push({
|
|
3889
|
-
name: (0, import_i18n26.__)("Stop syncing to
|
|
3960
|
+
name: (0, import_i18n26.__)("Stop syncing to Global Colors", "elementor"),
|
|
3890
3961
|
icon: import_icons16.ResetIcon,
|
|
3891
3962
|
color: "text.primary",
|
|
3892
3963
|
onClick: () => handlers.onStopSync(variableId)
|
|
3893
3964
|
});
|
|
3894
3965
|
} else {
|
|
3895
3966
|
actions.push({
|
|
3896
|
-
name: (0, import_i18n26.__)("Sync to
|
|
3967
|
+
name: (0, import_i18n26.__)("Sync to Global Colors", "elementor"),
|
|
3897
3968
|
icon: import_icons16.ResetIcon,
|
|
3898
3969
|
color: "text.primary",
|
|
3899
3970
|
onClick: () => handlers.onStartSync(variableId)
|
|
@@ -3919,7 +3990,14 @@ function registerVariableTypes() {
|
|
|
3919
3990
|
styleTransformer: EmptyTransformer,
|
|
3920
3991
|
variableType: "size",
|
|
3921
3992
|
selectionFilter: () => [],
|
|
3922
|
-
emptyState: /* @__PURE__ */ React37.createElement(
|
|
3993
|
+
emptyState: /* @__PURE__ */ React37.createElement(
|
|
3994
|
+
import_editor_ui13.CtaButton,
|
|
3995
|
+
{
|
|
3996
|
+
size: "small",
|
|
3997
|
+
href: "https://go.elementor.com/go-pro-panel-size-variable/",
|
|
3998
|
+
onClick: () => (0, import_editor_controls16.trackUpgradePromotionClick)({ target_name: "variables_popover", location_l1: "variables_list" })
|
|
3999
|
+
}
|
|
4000
|
+
)
|
|
3923
4001
|
};
|
|
3924
4002
|
registerVariableType({
|
|
3925
4003
|
...sizePromotions,
|
|
@@ -3934,10 +4012,10 @@ function registerVariableTypes() {
|
|
|
3934
4012
|
|
|
3935
4013
|
// src/renderers/style-variables-renderer.tsx
|
|
3936
4014
|
var React38 = __toESM(require("react"));
|
|
3937
|
-
var
|
|
3938
|
-
var
|
|
4015
|
+
var import_react29 = require("react");
|
|
4016
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
3939
4017
|
var import_ui35 = require("@elementor/ui");
|
|
3940
|
-
var VARIABLES_WRAPPER = "
|
|
4018
|
+
var VARIABLES_WRAPPER = ":root";
|
|
3941
4019
|
function StyleVariablesRenderer() {
|
|
3942
4020
|
const container = usePortalContainer();
|
|
3943
4021
|
const styleVariables = useStyleVariables();
|
|
@@ -3950,11 +4028,11 @@ function StyleVariablesRenderer() {
|
|
|
3950
4028
|
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3951
4029
|
}
|
|
3952
4030
|
function usePortalContainer() {
|
|
3953
|
-
return (0,
|
|
4031
|
+
return (0, import_editor_v1_adapters7.__privateUseListenTo)((0, import_editor_v1_adapters7.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters7.getCanvasIframeDocument)()?.head);
|
|
3954
4032
|
}
|
|
3955
4033
|
function useStyleVariables() {
|
|
3956
|
-
const [variables, setVariables] = (0,
|
|
3957
|
-
(0,
|
|
4034
|
+
const [variables, setVariables] = (0, import_react29.useState)({});
|
|
4035
|
+
(0, import_react29.useEffect)(() => {
|
|
3958
4036
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3959
4037
|
return () => {
|
|
3960
4038
|
unsubscribe();
|
|
@@ -3973,7 +4051,7 @@ function convertToCssVariables(variables) {
|
|
|
3973
4051
|
}
|
|
3974
4052
|
|
|
3975
4053
|
// src/repeater-injections.ts
|
|
3976
|
-
var
|
|
4054
|
+
var import_editor_controls17 = require("@elementor/editor-controls");
|
|
3977
4055
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3978
4056
|
|
|
3979
4057
|
// src/components/variables-repeater-item-slot.tsx
|
|
@@ -3997,21 +4075,21 @@ var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
|
3997
4075
|
|
|
3998
4076
|
// src/repeater-injections.ts
|
|
3999
4077
|
function registerRepeaterInjections() {
|
|
4000
|
-
(0,
|
|
4078
|
+
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4001
4079
|
id: "color-variables-background-icon",
|
|
4002
4080
|
component: BackgroundRepeaterColorIndicator,
|
|
4003
4081
|
condition: ({ value: prop }) => {
|
|
4004
4082
|
return hasAssignedColorVariable(import_editor_props6.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
4005
4083
|
}
|
|
4006
4084
|
});
|
|
4007
|
-
(0,
|
|
4085
|
+
(0, import_editor_controls17.injectIntoRepeaterItemIcon)({
|
|
4008
4086
|
id: "color-variables-icon",
|
|
4009
4087
|
component: BoxShadowRepeaterColorIndicator,
|
|
4010
4088
|
condition: ({ value: prop }) => {
|
|
4011
4089
|
return hasAssignedColorVariable(import_editor_props6.shadowPropTypeUtil.extract(prop)?.color);
|
|
4012
4090
|
}
|
|
4013
4091
|
});
|
|
4014
|
-
(0,
|
|
4092
|
+
(0, import_editor_controls17.injectIntoRepeaterItemLabel)({
|
|
4015
4093
|
id: "color-variables-label",
|
|
4016
4094
|
component: BackgroundRepeaterLabel,
|
|
4017
4095
|
condition: ({ value: prop }) => {
|
|
@@ -4028,7 +4106,7 @@ var { registerPopoverAction } = import_menus.controlActionsMenu;
|
|
|
4028
4106
|
function init() {
|
|
4029
4107
|
registerVariableTypes();
|
|
4030
4108
|
registerRepeaterInjections();
|
|
4031
|
-
(0,
|
|
4109
|
+
(0, import_editor_controls18.registerControlReplacement)({
|
|
4032
4110
|
component: VariableControl,
|
|
4033
4111
|
condition: ({ value, placeholder }) => {
|
|
4034
4112
|
if (hasVariableAssigned(value)) {
|
|
@@ -4056,6 +4134,10 @@ function init() {
|
|
|
4056
4134
|
id: "variables-open-panel-from-url",
|
|
4057
4135
|
component: OpenPanelFromUrl
|
|
4058
4136
|
});
|
|
4137
|
+
(0, import_editor.injectIntoLogic)({
|
|
4138
|
+
id: "variables-open-panel-from-event",
|
|
4139
|
+
component: OpenPanelFromEvent
|
|
4140
|
+
});
|
|
4059
4141
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
4060
4142
|
}
|
|
4061
4143
|
function hasVariableAssigned(value) {
|