@elementor/editor-variables 4.0.0-659 → 4.0.0-661
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 +105 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/open-panel-from-event.tsx +46 -0
- package/src/init.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ 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
|
|
|
@@ -2190,20 +2190,54 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
|
2190
2190
|
));
|
|
2191
2191
|
};
|
|
2192
2192
|
|
|
2193
|
+
// src/components/open-panel-from-event.tsx
|
|
2194
|
+
var EVENT_NAME = "elementor/open-variables-manager";
|
|
2195
|
+
var DEFAULT_PANEL_ROUTE = "panel/elements/categories";
|
|
2196
|
+
function OpenPanelFromEvent() {
|
|
2197
|
+
const { open } = usePanelActions();
|
|
2198
|
+
const pendingRef = (0, import_react14.useRef)(false);
|
|
2199
|
+
const [readyToOpen, setReadyToOpen] = (0, import_react14.useState)(false);
|
|
2200
|
+
(0, import_react14.useEffect)(() => {
|
|
2201
|
+
if (readyToOpen) {
|
|
2202
|
+
setReadyToOpen(false);
|
|
2203
|
+
open();
|
|
2204
|
+
}
|
|
2205
|
+
}, [readyToOpen, open]);
|
|
2206
|
+
(0, import_react14.useEffect)(() => {
|
|
2207
|
+
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2208
|
+
if (pendingRef.current) {
|
|
2209
|
+
pendingRef.current = false;
|
|
2210
|
+
setReadyToOpen(true);
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
}, []);
|
|
2214
|
+
(0, import_react14.useEffect)(() => {
|
|
2215
|
+
const handler = () => {
|
|
2216
|
+
pendingRef.current = true;
|
|
2217
|
+
(0, import_editor_v1_adapters3.__privateOpenRoute)(DEFAULT_PANEL_ROUTE);
|
|
2218
|
+
};
|
|
2219
|
+
window.addEventListener(EVENT_NAME, handler);
|
|
2220
|
+
return () => window.removeEventListener(EVENT_NAME, handler);
|
|
2221
|
+
}, []);
|
|
2222
|
+
return null;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2193
2225
|
// src/components/open-panel-from-url.tsx
|
|
2226
|
+
var import_react15 = require("react");
|
|
2227
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2194
2228
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2195
2229
|
var PANEL_ID = "variables-manager";
|
|
2196
|
-
var
|
|
2230
|
+
var DEFAULT_PANEL_ROUTE2 = "panel/elements";
|
|
2197
2231
|
function OpenPanelFromUrl() {
|
|
2198
2232
|
const { open } = usePanelActions();
|
|
2199
|
-
const hasOpened = (0,
|
|
2200
|
-
(0,
|
|
2233
|
+
const hasOpened = (0, import_react15.useRef)(false);
|
|
2234
|
+
(0, import_react15.useEffect)(() => {
|
|
2201
2235
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2202
2236
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2203
2237
|
if (activePanel !== PANEL_ID) {
|
|
2204
2238
|
return;
|
|
2205
2239
|
}
|
|
2206
|
-
const cleanup = (0,
|
|
2240
|
+
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE2), () => {
|
|
2207
2241
|
if (hasOpened.current) {
|
|
2208
2242
|
return;
|
|
2209
2243
|
}
|
|
@@ -2222,7 +2256,7 @@ var React33 = __toESM(require("react"));
|
|
|
2222
2256
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2223
2257
|
|
|
2224
2258
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2225
|
-
var
|
|
2259
|
+
var import_react22 = require("react");
|
|
2226
2260
|
var React24 = __toESM(require("react"));
|
|
2227
2261
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2228
2262
|
var import_icons12 = require("@elementor/icons");
|
|
@@ -2246,25 +2280,25 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2246
2280
|
|
|
2247
2281
|
// src/components/variable-selection-popover.tsx
|
|
2248
2282
|
var React22 = __toESM(require("react"));
|
|
2249
|
-
var
|
|
2250
|
-
var
|
|
2283
|
+
var import_react21 = require("react");
|
|
2284
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2251
2285
|
|
|
2252
2286
|
// src/context/variable-selection-popover.context.tsx
|
|
2253
2287
|
var React15 = __toESM(require("react"));
|
|
2254
|
-
var
|
|
2288
|
+
var import_react16 = require("react");
|
|
2255
2289
|
var import_ui15 = require("@elementor/ui");
|
|
2256
|
-
var PopoverContentRefContext = (0,
|
|
2290
|
+
var PopoverContentRefContext = (0, import_react16.createContext)(null);
|
|
2257
2291
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2258
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2292
|
+
const [anchorRef, setAnchorRef] = (0, import_react16.useState)(null);
|
|
2259
2293
|
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: setAnchorRef }, children));
|
|
2260
2294
|
};
|
|
2261
2295
|
var usePopoverContentRef = () => {
|
|
2262
|
-
return (0,
|
|
2296
|
+
return (0, import_react16.useContext)(PopoverContentRefContext);
|
|
2263
2297
|
};
|
|
2264
2298
|
|
|
2265
2299
|
// src/components/variable-creation.tsx
|
|
2266
2300
|
var React17 = __toESM(require("react"));
|
|
2267
|
-
var
|
|
2301
|
+
var import_react17 = require("react");
|
|
2268
2302
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2269
2303
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2270
2304
|
var import_icons6 = require("@elementor/icons");
|
|
@@ -2325,11 +2359,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2325
2359
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2326
2360
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2327
2361
|
const initialValue = useInitialValue();
|
|
2328
|
-
const [value, setValue] = (0,
|
|
2329
|
-
const [label, setLabel] = (0,
|
|
2330
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2331
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2332
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2362
|
+
const [value, setValue] = (0, import_react17.useState)(initialValue);
|
|
2363
|
+
const [label, setLabel] = (0, import_react17.useState)("");
|
|
2364
|
+
const [errorMessage, setErrorMessage] = (0, import_react17.useState)("");
|
|
2365
|
+
const [valueFieldError, setValueFieldError] = (0, import_react17.useState)("");
|
|
2366
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react17.useState)(propTypeUtil.key);
|
|
2333
2367
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2334
2368
|
const resetFields = () => {
|
|
2335
2369
|
setValue("");
|
|
@@ -2449,7 +2483,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2449
2483
|
|
|
2450
2484
|
// src/components/variable-edit.tsx
|
|
2451
2485
|
var React19 = __toESM(require("react"));
|
|
2452
|
-
var
|
|
2486
|
+
var import_react19 = require("react");
|
|
2453
2487
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2454
2488
|
var import_editor_current_user3 = require("@elementor/editor-current-user");
|
|
2455
2489
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
@@ -2459,7 +2493,7 @@ var import_i18n13 = require("@wordpress/i18n");
|
|
|
2459
2493
|
|
|
2460
2494
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2461
2495
|
var React18 = __toESM(require("react"));
|
|
2462
|
-
var
|
|
2496
|
+
var import_react18 = require("react");
|
|
2463
2497
|
var import_icons7 = require("@elementor/icons");
|
|
2464
2498
|
var import_ui18 = require("@elementor/ui");
|
|
2465
2499
|
var import_i18n12 = require("@wordpress/i18n");
|
|
@@ -2469,7 +2503,7 @@ var EditConfirmationDialog = ({
|
|
|
2469
2503
|
onConfirm,
|
|
2470
2504
|
onSuppressMessage
|
|
2471
2505
|
}) => {
|
|
2472
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2506
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react18.useState)(false);
|
|
2473
2507
|
const handleSave = () => {
|
|
2474
2508
|
if (dontShowAgain) {
|
|
2475
2509
|
onSuppressMessage?.();
|
|
@@ -2503,20 +2537,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2503
2537
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2504
2538
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2505
2539
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user3.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2506
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2507
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2508
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2509
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2540
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react19.useState)(false);
|
|
2541
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react19.useState)(false);
|
|
2542
|
+
const [errorMessage, setErrorMessage] = (0, import_react19.useState)("");
|
|
2543
|
+
const [valueFieldError, setValueFieldError] = (0, import_react19.useState)("");
|
|
2510
2544
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2511
2545
|
const variable = useVariable(editId);
|
|
2512
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2546
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react19.useState)(variable?.type ?? propTypeUtil.key);
|
|
2513
2547
|
if (!variable) {
|
|
2514
2548
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2515
2549
|
}
|
|
2516
2550
|
const userPermissions = usePermissions();
|
|
2517
|
-
const [value, setValue] = (0,
|
|
2518
|
-
const [label, setLabel] = (0,
|
|
2519
|
-
(0,
|
|
2551
|
+
const [value, setValue] = (0, import_react19.useState)(() => variable.value);
|
|
2552
|
+
const [label, setLabel] = (0, import_react19.useState)(() => variable.label);
|
|
2553
|
+
(0, import_react19.useEffect)(() => {
|
|
2520
2554
|
styleVariablesRepository.update({
|
|
2521
2555
|
[editId]: {
|
|
2522
2556
|
...variable,
|
|
@@ -2680,7 +2714,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2680
2714
|
};
|
|
2681
2715
|
|
|
2682
2716
|
// src/components/variables-selection.tsx
|
|
2683
|
-
var
|
|
2717
|
+
var import_react20 = require("react");
|
|
2684
2718
|
var React21 = __toESM(require("react"));
|
|
2685
2719
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2686
2720
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
@@ -2787,7 +2821,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
|
|
|
2787
2821
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2788
2822
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2789
2823
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2790
|
-
const [searchValue, setSearchValue] = (0,
|
|
2824
|
+
const [searchValue, setSearchValue] = (0, import_react20.useState)("");
|
|
2791
2825
|
const {
|
|
2792
2826
|
list: variables,
|
|
2793
2827
|
hasMatches: hasSearchResults,
|
|
@@ -2959,10 +2993,10 @@ var VIEW_LIST = "list";
|
|
|
2959
2993
|
var VIEW_ADD = "add";
|
|
2960
2994
|
var VIEW_EDIT = "edit";
|
|
2961
2995
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2962
|
-
const [currentView, setCurrentView] = (0,
|
|
2963
|
-
const [editId, setEditId] = (0,
|
|
2996
|
+
const [currentView, setCurrentView] = (0, import_react21.useState)(VIEW_LIST);
|
|
2997
|
+
const [editId, setEditId] = (0, import_react21.useState)("");
|
|
2964
2998
|
const { open } = usePanelActions();
|
|
2965
|
-
const onSettingsAvailable = (0,
|
|
2999
|
+
const onSettingsAvailable = (0, import_editor_v1_adapters5.isExperimentActive)("e_variables_manager") ? () => {
|
|
2966
3000
|
open();
|
|
2967
3001
|
} : void 0;
|
|
2968
3002
|
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
@@ -3071,8 +3105,8 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3071
3105
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3072
3106
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3073
3107
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
3074
|
-
const anchorRef = (0,
|
|
3075
|
-
const popupId = (0,
|
|
3108
|
+
const anchorRef = (0, import_react22.useRef)(null);
|
|
3109
|
+
const popupId = (0, import_react22.useId)();
|
|
3076
3110
|
const popupState = (0, import_ui24.usePopupState)({
|
|
3077
3111
|
variant: "popover",
|
|
3078
3112
|
popupId: `elementor-variables-list-${popupId}`
|
|
@@ -3112,14 +3146,14 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3112
3146
|
|
|
3113
3147
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3114
3148
|
var React28 = __toESM(require("react"));
|
|
3115
|
-
var
|
|
3149
|
+
var import_react24 = require("react");
|
|
3116
3150
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
3117
3151
|
var import_ui28 = require("@elementor/ui");
|
|
3118
3152
|
var import_i18n19 = require("@wordpress/i18n");
|
|
3119
3153
|
|
|
3120
3154
|
// src/components/variable-restore.tsx
|
|
3121
3155
|
var React25 = __toESM(require("react"));
|
|
3122
|
-
var
|
|
3156
|
+
var import_react23 = require("react");
|
|
3123
3157
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
3124
3158
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3125
3159
|
var import_ui25 = require("@elementor/ui");
|
|
@@ -3133,11 +3167,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3133
3167
|
if (!variable) {
|
|
3134
3168
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3135
3169
|
}
|
|
3136
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3137
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3138
|
-
const [label, setLabel] = (0,
|
|
3139
|
-
const [value, setValue] = (0,
|
|
3140
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3170
|
+
const [errorMessage, setErrorMessage] = (0, import_react23.useState)("");
|
|
3171
|
+
const [valueFieldError, setValueFieldError] = (0, import_react23.useState)("");
|
|
3172
|
+
const [label, setLabel] = (0, import_react23.useState)(variable.label);
|
|
3173
|
+
const [value, setValue] = (0, import_react23.useState)(variable.value);
|
|
3174
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react23.useState)(variable?.type ?? propTypeUtil.key);
|
|
3141
3175
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3142
3176
|
value: variable.label,
|
|
3143
3177
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3293,11 +3327,11 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3293
3327
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3294
3328
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3295
3329
|
const userPermissions = usePermissions();
|
|
3296
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3330
|
+
const [showInfotip, setShowInfotip] = (0, import_react24.useState)(false);
|
|
3297
3331
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3298
3332
|
const closeInfotip = () => setShowInfotip(false);
|
|
3299
|
-
const deletedChipAnchorRef = (0,
|
|
3300
|
-
const popupId = (0,
|
|
3333
|
+
const deletedChipAnchorRef = (0, import_react24.useRef)(null);
|
|
3334
|
+
const popupId = (0, import_react24.useId)();
|
|
3301
3335
|
const popupState = (0, import_ui28.usePopupState)({
|
|
3302
3336
|
variant: "popover",
|
|
3303
3337
|
popupId: `elementor-variables-restore-${popupId}`
|
|
@@ -3384,7 +3418,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3384
3418
|
|
|
3385
3419
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3386
3420
|
var React30 = __toESM(require("react"));
|
|
3387
|
-
var
|
|
3421
|
+
var import_react25 = require("react");
|
|
3388
3422
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3389
3423
|
var import_ui30 = require("@elementor/ui");
|
|
3390
3424
|
var import_i18n21 = require("@wordpress/i18n");
|
|
@@ -3422,13 +3456,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
3422
3456
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3423
3457
|
var MismatchVariable = ({ variable }) => {
|
|
3424
3458
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3425
|
-
const anchorRef = (0,
|
|
3426
|
-
const popupId = (0,
|
|
3459
|
+
const anchorRef = (0, import_react25.useRef)(null);
|
|
3460
|
+
const popupId = (0, import_react25.useId)();
|
|
3427
3461
|
const popupState = (0, import_ui30.usePopupState)({
|
|
3428
3462
|
variant: "popover",
|
|
3429
3463
|
popupId: `elementor-variables-list-${popupId}`
|
|
3430
3464
|
});
|
|
3431
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3465
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3432
3466
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3433
3467
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3434
3468
|
const triggerSelect = () => {
|
|
@@ -3501,7 +3535,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3501
3535
|
|
|
3502
3536
|
// src/components/ui/variable/missing-variable.tsx
|
|
3503
3537
|
var React32 = __toESM(require("react"));
|
|
3504
|
-
var
|
|
3538
|
+
var import_react26 = require("react");
|
|
3505
3539
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3506
3540
|
var import_ui32 = require("@elementor/ui");
|
|
3507
3541
|
var import_i18n23 = require("@wordpress/i18n");
|
|
@@ -3531,7 +3565,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3531
3565
|
// src/components/ui/variable/missing-variable.tsx
|
|
3532
3566
|
var MissingVariable = () => {
|
|
3533
3567
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3534
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3568
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react26.useState)(false);
|
|
3535
3569
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3536
3570
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3537
3571
|
const clearValue = () => setValue(null);
|
|
@@ -3744,18 +3778,18 @@ function initMcp() {
|
|
|
3744
3778
|
var React37 = __toESM(require("react"));
|
|
3745
3779
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3746
3780
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3747
|
-
var
|
|
3781
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3748
3782
|
var import_icons16 = require("@elementor/icons");
|
|
3749
3783
|
var import_i18n26 = require("@wordpress/i18n");
|
|
3750
3784
|
|
|
3751
3785
|
// src/components/fields/color-field.tsx
|
|
3752
3786
|
var React35 = __toESM(require("react"));
|
|
3753
|
-
var
|
|
3787
|
+
var import_react27 = require("react");
|
|
3754
3788
|
var import_ui33 = require("@elementor/ui");
|
|
3755
3789
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3756
|
-
const [color, setColor] = (0,
|
|
3757
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3758
|
-
const defaultRef = (0,
|
|
3790
|
+
const [color, setColor] = (0, import_react27.useState)(value);
|
|
3791
|
+
const [errorMessage, setErrorMessage] = (0, import_react27.useState)("");
|
|
3792
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
3759
3793
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3760
3794
|
const handleChange = (newValue) => {
|
|
3761
3795
|
setColor(newValue);
|
|
@@ -3794,15 +3828,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3794
3828
|
|
|
3795
3829
|
// src/components/fields/font-field.tsx
|
|
3796
3830
|
var React36 = __toESM(require("react"));
|
|
3797
|
-
var
|
|
3831
|
+
var import_react28 = require("react");
|
|
3798
3832
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3799
3833
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3800
3834
|
var import_icons15 = require("@elementor/icons");
|
|
3801
3835
|
var import_ui34 = require("@elementor/ui");
|
|
3802
3836
|
var import_i18n25 = require("@wordpress/i18n");
|
|
3803
3837
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3804
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3805
|
-
const defaultRef = (0,
|
|
3838
|
+
const [fontFamily, setFontFamily] = (0, import_react28.useState)(value);
|
|
3839
|
+
const defaultRef = (0, import_react28.useRef)(null);
|
|
3806
3840
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3807
3841
|
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
3808
3842
|
const fontFamilies = (0, import_editor_controls13.useFontFamilies)();
|
|
@@ -3823,7 +3857,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3823
3857
|
handleChange(newFontFamily);
|
|
3824
3858
|
fontPopoverState.close();
|
|
3825
3859
|
};
|
|
3826
|
-
const id2 = (0,
|
|
3860
|
+
const id2 = (0, import_react28.useId)();
|
|
3827
3861
|
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3828
3862
|
import_ui34.UnstableTag,
|
|
3829
3863
|
{
|
|
@@ -3886,7 +3920,7 @@ function registerVariableTypes() {
|
|
|
3886
3920
|
defaultValue: "#ffffff",
|
|
3887
3921
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3888
3922
|
const actions = [];
|
|
3889
|
-
if (!(0,
|
|
3923
|
+
if (!(0, import_editor_v1_adapters6.isExperimentActive)("e_design_system_sync")) {
|
|
3890
3924
|
return [];
|
|
3891
3925
|
}
|
|
3892
3926
|
if (variable.sync_to_v3) {
|
|
@@ -3939,8 +3973,8 @@ function registerVariableTypes() {
|
|
|
3939
3973
|
|
|
3940
3974
|
// src/renderers/style-variables-renderer.tsx
|
|
3941
3975
|
var React38 = __toESM(require("react"));
|
|
3942
|
-
var
|
|
3943
|
-
var
|
|
3976
|
+
var import_react29 = require("react");
|
|
3977
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
3944
3978
|
var import_ui35 = require("@elementor/ui");
|
|
3945
3979
|
var VARIABLES_WRAPPER = "body";
|
|
3946
3980
|
function StyleVariablesRenderer() {
|
|
@@ -3955,11 +3989,11 @@ function StyleVariablesRenderer() {
|
|
|
3955
3989
|
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3956
3990
|
}
|
|
3957
3991
|
function usePortalContainer() {
|
|
3958
|
-
return (0,
|
|
3992
|
+
return (0, import_editor_v1_adapters7.__privateUseListenTo)((0, import_editor_v1_adapters7.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters7.getCanvasIframeDocument)()?.head);
|
|
3959
3993
|
}
|
|
3960
3994
|
function useStyleVariables() {
|
|
3961
|
-
const [variables, setVariables] = (0,
|
|
3962
|
-
(0,
|
|
3995
|
+
const [variables, setVariables] = (0, import_react29.useState)({});
|
|
3996
|
+
(0, import_react29.useEffect)(() => {
|
|
3963
3997
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3964
3998
|
return () => {
|
|
3965
3999
|
unsubscribe();
|
|
@@ -4061,6 +4095,10 @@ function init() {
|
|
|
4061
4095
|
id: "variables-open-panel-from-url",
|
|
4062
4096
|
component: OpenPanelFromUrl
|
|
4063
4097
|
});
|
|
4098
|
+
(0, import_editor.injectIntoLogic)({
|
|
4099
|
+
id: "variables-open-panel-from-event",
|
|
4100
|
+
component: OpenPanelFromEvent
|
|
4101
|
+
});
|
|
4064
4102
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
4065
4103
|
}
|
|
4066
4104
|
function hasVariableAssigned(value) {
|