@elementor/editor-variables 4.2.0-880 → 4.2.0-881
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.d.mts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +266 -423
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variable-selection-popover.tsx +3 -9
- package/src/components/variables-manager/variables-manager-panel.tsx +158 -295
- package/src/init.ts +0 -19
- package/src/components/open-panel-from-event.tsx +0 -46
- package/src/components/open-panel-from-url.tsx +0 -40
package/dist/index.js
CHANGED
|
@@ -49,7 +49,6 @@ var import_react13 = require("react");
|
|
|
49
49
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
50
50
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
51
51
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
52
|
-
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
53
52
|
var import_icons5 = require("@elementor/icons");
|
|
54
53
|
var import_ui14 = require("@elementor/ui");
|
|
55
54
|
var import_i18n10 = require("@wordpress/i18n");
|
|
@@ -245,19 +244,19 @@ var apiClient = {
|
|
|
245
244
|
value
|
|
246
245
|
});
|
|
247
246
|
},
|
|
248
|
-
update: (
|
|
247
|
+
update: (id, label, value, type) => {
|
|
249
248
|
return (0, import_http_client.httpService)().put(BASE_PATH + "/update", {
|
|
250
|
-
id
|
|
249
|
+
id,
|
|
251
250
|
label,
|
|
252
251
|
value,
|
|
253
252
|
type
|
|
254
253
|
});
|
|
255
254
|
},
|
|
256
|
-
delete: (
|
|
257
|
-
return (0, import_http_client.httpService)().post(BASE_PATH + "/delete", { id
|
|
255
|
+
delete: (id) => {
|
|
256
|
+
return (0, import_http_client.httpService)().post(BASE_PATH + "/delete", { id });
|
|
258
257
|
},
|
|
259
|
-
restore: (
|
|
260
|
-
const payload = { id
|
|
258
|
+
restore: (id, label, value, type) => {
|
|
259
|
+
const payload = { id };
|
|
261
260
|
if (label) {
|
|
262
261
|
payload.label = label;
|
|
263
262
|
}
|
|
@@ -280,34 +279,34 @@ var generateTempId = () => {
|
|
|
280
279
|
const random = Math.random().toString(36).substring(2, 8);
|
|
281
280
|
return `tmp-${timestamp}-${random}`;
|
|
282
281
|
};
|
|
283
|
-
var isTempId = (
|
|
284
|
-
return
|
|
282
|
+
var isTempId = (id) => {
|
|
283
|
+
return id.startsWith("tmp-");
|
|
285
284
|
};
|
|
286
285
|
var buildOperationsArray = (originalVariables, currentVariables, deletedVariables) => {
|
|
287
286
|
const operations = [];
|
|
288
|
-
Object.entries(currentVariables).forEach(([
|
|
289
|
-
if (isTempId(
|
|
287
|
+
Object.entries(currentVariables).forEach(([id, variable]) => {
|
|
288
|
+
if (isTempId(id)) {
|
|
290
289
|
operations.push({
|
|
291
290
|
type: "create",
|
|
292
291
|
variable: {
|
|
293
292
|
...variable,
|
|
294
|
-
id
|
|
293
|
+
id
|
|
295
294
|
}
|
|
296
295
|
});
|
|
297
|
-
} else if (originalVariables[
|
|
298
|
-
const original = originalVariables[
|
|
296
|
+
} else if (originalVariables[id]) {
|
|
297
|
+
const original = originalVariables[id];
|
|
299
298
|
const syncChanged = original.sync_to_v3 !== variable.sync_to_v3;
|
|
300
299
|
if (original.deleted && !variable.deleted) {
|
|
301
300
|
operations.push({
|
|
302
301
|
type: "restore",
|
|
303
|
-
id
|
|
302
|
+
id,
|
|
304
303
|
...original.label !== variable.label && { label: variable.label },
|
|
305
304
|
...original.value !== variable.value && { value: variable.value }
|
|
306
305
|
});
|
|
307
306
|
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order || original.type !== variable.type || syncChanged)) {
|
|
308
307
|
operations.push({
|
|
309
308
|
type: "update",
|
|
310
|
-
id
|
|
309
|
+
id,
|
|
311
310
|
variable: {
|
|
312
311
|
...original.label !== variable.label && { label: variable.label },
|
|
313
312
|
...original.value !== variable.value && { value: variable.value },
|
|
@@ -319,15 +318,15 @@ var buildOperationsArray = (originalVariables, currentVariables, deletedVariable
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
});
|
|
322
|
-
deletedVariables.forEach((
|
|
321
|
+
deletedVariables.forEach((id) => {
|
|
323
322
|
operations.push({
|
|
324
323
|
type: "delete",
|
|
325
|
-
id
|
|
324
|
+
id
|
|
326
325
|
});
|
|
327
326
|
});
|
|
328
327
|
return operations.filter((op) => {
|
|
329
|
-
const
|
|
330
|
-
return
|
|
328
|
+
const id = op.id || op.variable?.id;
|
|
329
|
+
return id && !(isTempId(id) && currentVariables[id]?.deleted);
|
|
331
330
|
});
|
|
332
331
|
};
|
|
333
332
|
|
|
@@ -363,15 +362,15 @@ var Storage = class {
|
|
|
363
362
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
|
|
364
363
|
this.notifyChange();
|
|
365
364
|
}
|
|
366
|
-
add(
|
|
365
|
+
add(id, variable) {
|
|
367
366
|
this.load();
|
|
368
|
-
this.state.variables[
|
|
367
|
+
this.state.variables[id] = variable;
|
|
369
368
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
|
|
370
369
|
this.notifyChange();
|
|
371
370
|
}
|
|
372
|
-
update(
|
|
371
|
+
update(id, variable) {
|
|
373
372
|
this.load();
|
|
374
|
-
this.state.variables[
|
|
373
|
+
this.state.variables[id] = variable;
|
|
375
374
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
|
|
376
375
|
this.notifyChange();
|
|
377
376
|
}
|
|
@@ -527,8 +526,8 @@ var service = {
|
|
|
527
526
|
};
|
|
528
527
|
});
|
|
529
528
|
},
|
|
530
|
-
update: (
|
|
531
|
-
return apiClient.update(
|
|
529
|
+
update: (id, { label, value, type }) => {
|
|
530
|
+
return apiClient.update(id, label, value, type).then((response) => {
|
|
532
531
|
const { success, data: payload } = response.data;
|
|
533
532
|
if (!success) {
|
|
534
533
|
const errorMessage = payload?.message || (0, import_i18n2.__)("Unexpected response from server", "elementor");
|
|
@@ -549,8 +548,8 @@ var service = {
|
|
|
549
548
|
};
|
|
550
549
|
});
|
|
551
550
|
},
|
|
552
|
-
delete: (
|
|
553
|
-
return apiClient.delete(
|
|
551
|
+
delete: (id) => {
|
|
552
|
+
return apiClient.delete(id).then((response) => {
|
|
554
553
|
const { success, data: payload } = response.data;
|
|
555
554
|
if (!success) {
|
|
556
555
|
throw new Error("Unexpected response from server");
|
|
@@ -570,8 +569,8 @@ var service = {
|
|
|
570
569
|
};
|
|
571
570
|
});
|
|
572
571
|
},
|
|
573
|
-
restore: (
|
|
574
|
-
return apiClient.restore(
|
|
572
|
+
restore: (id, label, value, type) => {
|
|
573
|
+
return apiClient.restore(id, label, value, type).then((response) => {
|
|
575
574
|
const { success, data: payload } = response.data;
|
|
576
575
|
if (!success) {
|
|
577
576
|
throw new Error("Unexpected response from server");
|
|
@@ -641,8 +640,8 @@ var handleWatermark = (operation, newWatermark) => {
|
|
|
641
640
|
};
|
|
642
641
|
|
|
643
642
|
// src/transformers/utils/resolve-css-variable.ts
|
|
644
|
-
var resolveCssVariable = (
|
|
645
|
-
let name =
|
|
643
|
+
var resolveCssVariable = (id, variable) => {
|
|
644
|
+
let name = id;
|
|
646
645
|
let fallbackValue = "";
|
|
647
646
|
if (variable) {
|
|
648
647
|
fallbackValue = variable.value;
|
|
@@ -661,14 +660,14 @@ var resolveCssVariable = (id2, variable) => {
|
|
|
661
660
|
};
|
|
662
661
|
|
|
663
662
|
// src/transformers/inheritance-transformer.tsx
|
|
664
|
-
var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((
|
|
663
|
+
var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((id) => {
|
|
665
664
|
const variables = service.variables();
|
|
666
|
-
const variable = variables[
|
|
665
|
+
const variable = variables[id];
|
|
667
666
|
if (!variable) {
|
|
668
667
|
return /* @__PURE__ */ React.createElement("span", null, (0, import_i18n3.__)("Missing variable", "elementor"));
|
|
669
668
|
}
|
|
670
669
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
671
|
-
const css = resolveCssVariable(
|
|
670
|
+
const css = resolveCssVariable(id, variable);
|
|
672
671
|
return /* @__PURE__ */ React.createElement(import_ui2.Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React.createElement(import_ui2.Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
|
|
673
672
|
});
|
|
674
673
|
|
|
@@ -684,8 +683,8 @@ var variableTransformer = (0, import_editor_canvas2.createTransformer)((idOrLabe
|
|
|
684
683
|
const count = parseInt((targetVariable.value ?? "").trim(), 10);
|
|
685
684
|
return (0, import_editor_canvas2.formatGridTrackRepeat)(count);
|
|
686
685
|
}
|
|
687
|
-
const
|
|
688
|
-
return resolveCssVariable(
|
|
686
|
+
const id = service.findIdByLabel(targetVariable.label);
|
|
687
|
+
return resolveCssVariable(id, targetVariable);
|
|
689
688
|
});
|
|
690
689
|
|
|
691
690
|
// src/variables-registry/create-variable-type-registry.ts
|
|
@@ -1018,7 +1017,7 @@ var normalizeVariables = (propKey) => {
|
|
|
1018
1017
|
const matchingTypes = getMatchingTypes(propKey);
|
|
1019
1018
|
return variablesToList(variables).filter((variable) => matchingTypes.includes(variable.type)).map(toNormalizedVariable);
|
|
1020
1019
|
};
|
|
1021
|
-
var extractId = ({ id
|
|
1020
|
+
var extractId = ({ id }) => id;
|
|
1022
1021
|
var createVariable = (newVariable) => {
|
|
1023
1022
|
return service.create(newVariable).then(extractId);
|
|
1024
1023
|
};
|
|
@@ -1429,7 +1428,7 @@ var LabelField = ({
|
|
|
1429
1428
|
value,
|
|
1430
1429
|
error,
|
|
1431
1430
|
onChange,
|
|
1432
|
-
id
|
|
1431
|
+
id,
|
|
1433
1432
|
onErrorChange,
|
|
1434
1433
|
size = "tiny",
|
|
1435
1434
|
focusOnShow = false,
|
|
@@ -1457,7 +1456,7 @@ var LabelField = ({
|
|
|
1457
1456
|
import_ui9.TextField,
|
|
1458
1457
|
{
|
|
1459
1458
|
ref: fieldRef,
|
|
1460
|
-
id
|
|
1459
|
+
id,
|
|
1461
1460
|
size,
|
|
1462
1461
|
fullWidth: true,
|
|
1463
1462
|
value: label,
|
|
@@ -1878,22 +1877,22 @@ var VariablesManagerTable = ({
|
|
|
1878
1877
|
}
|
|
1879
1878
|
}
|
|
1880
1879
|
}, [autoEditVariableId]);
|
|
1881
|
-
const handleRowRef = (
|
|
1880
|
+
const handleRowRef = (id) => (ref) => {
|
|
1882
1881
|
if (ref) {
|
|
1883
|
-
variableRowRefs.current.set(
|
|
1882
|
+
variableRowRefs.current.set(id, ref);
|
|
1884
1883
|
} else {
|
|
1885
|
-
variableRowRefs.current.delete(
|
|
1884
|
+
variableRowRefs.current.delete(id);
|
|
1886
1885
|
}
|
|
1887
1886
|
};
|
|
1888
1887
|
const ids = Object.keys(variables).sort(sortVariablesOrder(variables));
|
|
1889
|
-
const rows = ids.map((
|
|
1890
|
-
const variable = variables[
|
|
1888
|
+
const rows = ids.map((id) => {
|
|
1889
|
+
const variable = variables[id];
|
|
1891
1890
|
const variableType = getVariableType(variable.type);
|
|
1892
1891
|
if (!variableType) {
|
|
1893
1892
|
return null;
|
|
1894
1893
|
}
|
|
1895
1894
|
return {
|
|
1896
|
-
id
|
|
1895
|
+
id,
|
|
1897
1896
|
type: variable.type,
|
|
1898
1897
|
name: variable.label,
|
|
1899
1898
|
value: variable.value,
|
|
@@ -1906,12 +1905,12 @@ var VariablesManagerTable = ({
|
|
|
1906
1905
|
};
|
|
1907
1906
|
const handleReorder = (newIds) => {
|
|
1908
1907
|
const updatedVariables = { ...variables };
|
|
1909
|
-
newIds.forEach((
|
|
1910
|
-
const current = updatedVariables[
|
|
1908
|
+
newIds.forEach((id, index) => {
|
|
1909
|
+
const current = updatedVariables[id];
|
|
1911
1910
|
if (!current) {
|
|
1912
1911
|
return;
|
|
1913
1912
|
}
|
|
1914
|
-
updatedVariables[
|
|
1913
|
+
updatedVariables[id] = Object.assign({}, current, { order: index + 1 });
|
|
1915
1914
|
});
|
|
1916
1915
|
handleOnChange(updatedVariables);
|
|
1917
1916
|
};
|
|
@@ -1956,47 +1955,14 @@ function sortVariablesOrder(variables) {
|
|
|
1956
1955
|
}
|
|
1957
1956
|
|
|
1958
1957
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
1959
|
-
var id = "variables-manager";
|
|
1960
1958
|
var STOP_SYNC_MESSAGE_KEY = "stop-sync-variable";
|
|
1961
|
-
var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
1962
|
-
id,
|
|
1963
|
-
component: VariablesManagerPanel,
|
|
1964
|
-
allowedEditModes: ["edit", id],
|
|
1965
|
-
onOpen: () => {
|
|
1966
|
-
(0, import_editor_v1_adapters2.changeEditMode)(id);
|
|
1967
|
-
},
|
|
1968
|
-
onClose: async () => {
|
|
1969
|
-
(0, import_editor_v1_adapters2.changeEditMode)("edit");
|
|
1970
|
-
},
|
|
1971
|
-
isOpenPreviousElement: true
|
|
1972
|
-
});
|
|
1973
1959
|
function VariablesManagerPanelEmbedded({
|
|
1974
1960
|
onRequestClose,
|
|
1975
1961
|
onExposeCloseAttempt
|
|
1976
1962
|
}) {
|
|
1977
|
-
return /* @__PURE__ */ React14.createElement(
|
|
1978
|
-
VariablesManagerPanelRoot,
|
|
1979
|
-
{
|
|
1980
|
-
embedded: true,
|
|
1981
|
-
onRequestClose,
|
|
1982
|
-
onExposeCloseAttempt
|
|
1983
|
-
}
|
|
1984
|
-
);
|
|
1985
|
-
}
|
|
1986
|
-
function VariablesManagerPanel() {
|
|
1987
|
-
return /* @__PURE__ */ React14.createElement(VariablesManagerPanelRoot, null);
|
|
1963
|
+
return /* @__PURE__ */ React14.createElement(VariablesManagerPanelContent, { onRequestClose, onExposeCloseAttempt });
|
|
1988
1964
|
}
|
|
1989
|
-
function
|
|
1990
|
-
embedded = false,
|
|
1991
|
-
onRequestClose,
|
|
1992
|
-
onExposeCloseAttempt
|
|
1993
|
-
} = {}) {
|
|
1994
|
-
const { close: closeStandalonePanel } = usePanelActions();
|
|
1995
|
-
const closePanel = (0, import_react13.useMemo)(
|
|
1996
|
-
() => embedded ? onRequestClose ?? (async () => {
|
|
1997
|
-
}) : closeStandalonePanel,
|
|
1998
|
-
[embedded, onRequestClose, closeStandalonePanel]
|
|
1999
|
-
);
|
|
1965
|
+
function VariablesManagerPanelContent({ onRequestClose, onExposeCloseAttempt }) {
|
|
2000
1966
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
2001
1967
|
const [isStopSyncSuppressed] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
|
|
2002
1968
|
const createMenuState = (0, import_ui14.usePopupState)({
|
|
@@ -2030,15 +1996,15 @@ function VariablesManagerPanelRoot({
|
|
|
2030
1996
|
openSaveChangesDialog();
|
|
2031
1997
|
return;
|
|
2032
1998
|
}
|
|
2033
|
-
void
|
|
2034
|
-
}, [isDirty, openSaveChangesDialog,
|
|
1999
|
+
void onRequestClose();
|
|
2000
|
+
}, [isDirty, openSaveChangesDialog, onRequestClose]);
|
|
2035
2001
|
(0, import_react13.useEffect)(() => {
|
|
2036
|
-
if (!
|
|
2002
|
+
if (!onExposeCloseAttempt) {
|
|
2037
2003
|
return;
|
|
2038
2004
|
}
|
|
2039
2005
|
onExposeCloseAttempt(() => handleClosePanel());
|
|
2040
2006
|
return () => onExposeCloseAttempt(null);
|
|
2041
|
-
}, [
|
|
2007
|
+
}, [onExposeCloseAttempt, handleClosePanel]);
|
|
2042
2008
|
const handleCreateVariable = (0, import_react13.useCallback)(
|
|
2043
2009
|
(type, defaultName, defaultValue) => {
|
|
2044
2010
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
@@ -2156,144 +2122,7 @@ function VariablesManagerPanelRoot({
|
|
|
2156
2122
|
[variables, handleStartSync, handleStopSync, duplicateVariable, startAutoEdit]
|
|
2157
2123
|
);
|
|
2158
2124
|
const hasVariables = Object.keys(variables).length > 0;
|
|
2159
|
-
|
|
2160
|
-
flex: 1,
|
|
2161
|
-
minWidth: 0,
|
|
2162
|
-
px: 0,
|
|
2163
|
-
py: 0,
|
|
2164
|
-
display: "flex",
|
|
2165
|
-
alignItems: "center",
|
|
2166
|
-
alignSelf: "stretch"
|
|
2167
|
-
} : {
|
|
2168
|
-
display: "flex",
|
|
2169
|
-
flex: 1
|
|
2170
|
-
};
|
|
2171
|
-
const searchField = /* @__PURE__ */ React14.createElement(
|
|
2172
|
-
import_editor_ui5.SearchField,
|
|
2173
|
-
{
|
|
2174
|
-
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
2175
|
-
value: searchValue,
|
|
2176
|
-
onSearch: handleSearch,
|
|
2177
|
-
sx: variablesSearchFieldSx
|
|
2178
|
-
}
|
|
2179
|
-
);
|
|
2180
|
-
const bodyInner = /* @__PURE__ */ React14.createElement(React14.Fragment, null, hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2181
|
-
VariablesManagerTable,
|
|
2182
|
-
{
|
|
2183
|
-
menuActions: buildMenuActions,
|
|
2184
|
-
variables,
|
|
2185
|
-
onChange: handleOnChange,
|
|
2186
|
-
autoEditVariableId,
|
|
2187
|
-
onAutoEditComplete: handleAutoEditComplete,
|
|
2188
|
-
onFieldError: setIsSaveDisabled
|
|
2189
|
-
}
|
|
2190
|
-
), !hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2191
|
-
NoSearchResults,
|
|
2192
|
-
{
|
|
2193
|
-
searchValue,
|
|
2194
|
-
onClear: () => handleSearch(""),
|
|
2195
|
-
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
2196
|
-
}
|
|
2197
|
-
), !hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2198
|
-
EmptyState,
|
|
2199
|
-
{
|
|
2200
|
-
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
2201
|
-
message: (0, import_i18n10.__)(
|
|
2202
|
-
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2203
|
-
"elementor"
|
|
2204
|
-
),
|
|
2205
|
-
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
2206
|
-
onAdd: createMenuState.open
|
|
2207
|
-
}
|
|
2208
|
-
));
|
|
2209
|
-
const saveFooter = /* @__PURE__ */ React14.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2210
|
-
import_ui14.Infotip,
|
|
2211
|
-
{
|
|
2212
|
-
placement: "right",
|
|
2213
|
-
open: !!serverError,
|
|
2214
|
-
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2215
|
-
import_ui14.Alert,
|
|
2216
|
-
{
|
|
2217
|
-
severity: serverError.severity ?? "error",
|
|
2218
|
-
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(import_ui14.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2219
|
-
onClose: !serverError.action?.label ? () => {
|
|
2220
|
-
setServerError(null);
|
|
2221
|
-
setIsSaveDisabled(false);
|
|
2222
|
-
} : void 0,
|
|
2223
|
-
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(import_icons5.AlertTriangleFilledIcon, null)
|
|
2224
|
-
},
|
|
2225
|
-
/* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, serverError.message),
|
|
2226
|
-
serverError.action?.message
|
|
2227
|
-
) : null,
|
|
2228
|
-
arrow: false,
|
|
2229
|
-
slotProps: {
|
|
2230
|
-
popper: {
|
|
2231
|
-
modifiers: [
|
|
2232
|
-
{
|
|
2233
|
-
name: "offset",
|
|
2234
|
-
options: { offset: [-10, 10] }
|
|
2235
|
-
}
|
|
2236
|
-
]
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
},
|
|
2240
|
-
/* @__PURE__ */ React14.createElement(
|
|
2241
|
-
import_ui14.Button,
|
|
2242
|
-
{
|
|
2243
|
-
fullWidth: true,
|
|
2244
|
-
size: "small",
|
|
2245
|
-
color: "global",
|
|
2246
|
-
variant: "contained",
|
|
2247
|
-
disabled: isSaveDisabled || !isDirty || isSaving,
|
|
2248
|
-
onClick: handleSaveClick,
|
|
2249
|
-
loading: isSaving
|
|
2250
|
-
},
|
|
2251
|
-
(0, import_i18n10.__)("Save changes", "elementor")
|
|
2252
|
-
)
|
|
2253
|
-
));
|
|
2254
|
-
const dialogs = /* @__PURE__ */ React14.createElement(React14.Fragment, null, deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2255
|
-
DeleteConfirmationDialog,
|
|
2256
|
-
{
|
|
2257
|
-
open: true,
|
|
2258
|
-
label: deleteConfirmation.label,
|
|
2259
|
-
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2260
|
-
closeDialog: () => setDeleteConfirmation(null)
|
|
2261
|
-
}
|
|
2262
|
-
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2263
|
-
StopSyncConfirmationDialog,
|
|
2264
|
-
{
|
|
2265
|
-
open: true,
|
|
2266
|
-
onClose: () => setStopSyncConfirmation(null),
|
|
2267
|
-
onConfirm: () => {
|
|
2268
|
-
commitStopSync(stopSyncConfirmation);
|
|
2269
|
-
setStopSyncConfirmation(null);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
2273
|
-
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2274
|
-
{
|
|
2275
|
-
actions: {
|
|
2276
|
-
discard: {
|
|
2277
|
-
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
2278
|
-
action: () => {
|
|
2279
|
-
closeSaveChangesDialog();
|
|
2280
|
-
void closePanel();
|
|
2281
|
-
}
|
|
2282
|
-
},
|
|
2283
|
-
confirm: {
|
|
2284
|
-
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
2285
|
-
action: async () => {
|
|
2286
|
-
const result = await handleSaveClick();
|
|
2287
|
-
closeSaveChangesDialog();
|
|
2288
|
-
if (result?.success) {
|
|
2289
|
-
void closePanel();
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
)));
|
|
2296
|
-
const panelChrome = embedded ? /* @__PURE__ */ React14.createElement(
|
|
2125
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
|
|
2297
2126
|
import_ui14.Stack,
|
|
2298
2127
|
{
|
|
2299
2128
|
direction: "column",
|
|
@@ -2318,7 +2147,23 @@ function VariablesManagerPanelRoot({
|
|
|
2318
2147
|
pb: 1
|
|
2319
2148
|
}
|
|
2320
2149
|
},
|
|
2321
|
-
|
|
2150
|
+
/* @__PURE__ */ React14.createElement(
|
|
2151
|
+
import_editor_ui5.SearchField,
|
|
2152
|
+
{
|
|
2153
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
2154
|
+
value: searchValue,
|
|
2155
|
+
onSearch: handleSearch,
|
|
2156
|
+
sx: {
|
|
2157
|
+
flex: 1,
|
|
2158
|
+
minWidth: 0,
|
|
2159
|
+
px: 0,
|
|
2160
|
+
py: 0,
|
|
2161
|
+
display: "flex",
|
|
2162
|
+
alignItems: "center",
|
|
2163
|
+
alignSelf: "stretch"
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
),
|
|
2322
2167
|
/* @__PURE__ */ React14.createElement(import_ui14.Box, { sx: { display: "flex", flexShrink: 0, alignItems: "center" } }, /* @__PURE__ */ React14.createElement(
|
|
2323
2168
|
VariableManagerCreateMenu,
|
|
2324
2169
|
{
|
|
@@ -2340,46 +2185,125 @@ function VariablesManagerPanelRoot({
|
|
|
2340
2185
|
minHeight: 0
|
|
2341
2186
|
}
|
|
2342
2187
|
},
|
|
2343
|
-
|
|
2188
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2189
|
+
VariablesManagerTable,
|
|
2190
|
+
{
|
|
2191
|
+
menuActions: buildMenuActions,
|
|
2192
|
+
variables,
|
|
2193
|
+
onChange: handleOnChange,
|
|
2194
|
+
autoEditVariableId,
|
|
2195
|
+
onAutoEditComplete: handleAutoEditComplete,
|
|
2196
|
+
onFieldError: setIsSaveDisabled
|
|
2197
|
+
}
|
|
2198
|
+
),
|
|
2199
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2200
|
+
NoSearchResults,
|
|
2201
|
+
{
|
|
2202
|
+
searchValue,
|
|
2203
|
+
onClear: () => handleSearch(""),
|
|
2204
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
2205
|
+
}
|
|
2206
|
+
),
|
|
2207
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2208
|
+
EmptyState,
|
|
2209
|
+
{
|
|
2210
|
+
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
2211
|
+
message: (0, import_i18n10.__)(
|
|
2212
|
+
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2213
|
+
"elementor"
|
|
2214
|
+
),
|
|
2215
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
2216
|
+
onAdd: createMenuState.open
|
|
2217
|
+
}
|
|
2218
|
+
)
|
|
2344
2219
|
),
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
import_editor_panels.PanelHeader,
|
|
2348
|
-
{
|
|
2349
|
-
sx: {
|
|
2350
|
-
height: "unset"
|
|
2351
|
-
}
|
|
2352
|
-
},
|
|
2353
|
-
/* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(import_ui14.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n10.__)("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
|
|
2354
|
-
VariableManagerCreateMenu,
|
|
2355
|
-
{
|
|
2356
|
-
onCreate: handleCreateVariable,
|
|
2357
|
-
variables,
|
|
2358
|
-
menuState: createMenuState
|
|
2359
|
-
}
|
|
2360
|
-
), /* @__PURE__ */ React14.createElement(
|
|
2361
|
-
import_ui14.CloseButton,
|
|
2220
|
+
/* @__PURE__ */ React14.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2221
|
+
import_ui14.Infotip,
|
|
2362
2222
|
{
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2223
|
+
placement: "right",
|
|
2224
|
+
open: !!serverError,
|
|
2225
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2226
|
+
import_ui14.Alert,
|
|
2227
|
+
{
|
|
2228
|
+
severity: serverError.severity ?? "error",
|
|
2229
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(import_ui14.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2230
|
+
onClose: !serverError.action?.label ? () => {
|
|
2231
|
+
setServerError(null);
|
|
2232
|
+
setIsSaveDisabled(false);
|
|
2233
|
+
} : void 0,
|
|
2234
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(import_icons5.AlertTriangleFilledIcon, null)
|
|
2235
|
+
},
|
|
2236
|
+
/* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, serverError.message),
|
|
2237
|
+
serverError.action?.message
|
|
2238
|
+
) : null,
|
|
2239
|
+
arrow: false,
|
|
2240
|
+
slotProps: {
|
|
2241
|
+
popper: {
|
|
2242
|
+
modifiers: [
|
|
2243
|
+
{
|
|
2244
|
+
name: "offset",
|
|
2245
|
+
options: { offset: [-10, 10] }
|
|
2246
|
+
}
|
|
2247
|
+
]
|
|
2248
|
+
}
|
|
2367
2249
|
}
|
|
2250
|
+
},
|
|
2251
|
+
/* @__PURE__ */ React14.createElement(
|
|
2252
|
+
import_ui14.Button,
|
|
2253
|
+
{
|
|
2254
|
+
fullWidth: true,
|
|
2255
|
+
size: "small",
|
|
2256
|
+
color: "global",
|
|
2257
|
+
variant: "contained",
|
|
2258
|
+
disabled: isSaveDisabled || !isDirty || isSaving,
|
|
2259
|
+
onClick: handleSaveClick,
|
|
2260
|
+
loading: isSaving
|
|
2261
|
+
},
|
|
2262
|
+
(0, import_i18n10.__)("Save changes", "elementor")
|
|
2263
|
+
)
|
|
2264
|
+
))
|
|
2265
|
+
), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2266
|
+
DeleteConfirmationDialog,
|
|
2267
|
+
{
|
|
2268
|
+
open: true,
|
|
2269
|
+
label: deleteConfirmation.label,
|
|
2270
|
+
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2271
|
+
closeDialog: () => setDeleteConfirmation(null)
|
|
2272
|
+
}
|
|
2273
|
+
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2274
|
+
StopSyncConfirmationDialog,
|
|
2275
|
+
{
|
|
2276
|
+
open: true,
|
|
2277
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2278
|
+
onConfirm: () => {
|
|
2279
|
+
commitStopSync(stopSyncConfirmation);
|
|
2280
|
+
setStopSyncConfirmation(null);
|
|
2368
2281
|
}
|
|
2369
|
-
|
|
2370
|
-
), /* @__PURE__ */ React14.createElement(
|
|
2371
|
-
|
|
2282
|
+
}
|
|
2283
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
2284
|
+
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2372
2285
|
{
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2286
|
+
actions: {
|
|
2287
|
+
discard: {
|
|
2288
|
+
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
2289
|
+
action: () => {
|
|
2290
|
+
closeSaveChangesDialog();
|
|
2291
|
+
void onRequestClose();
|
|
2292
|
+
}
|
|
2293
|
+
},
|
|
2294
|
+
confirm: {
|
|
2295
|
+
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
2296
|
+
action: async () => {
|
|
2297
|
+
const result = await handleSaveClick();
|
|
2298
|
+
closeSaveChangesDialog();
|
|
2299
|
+
if (result?.success) {
|
|
2300
|
+
void onRequestClose();
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2377
2304
|
}
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
|
-
), saveFooter);
|
|
2381
|
-
const core = /* @__PURE__ */ React14.createElement(React14.Fragment, null, panelChrome, dialogs);
|
|
2382
|
-
return embedded ? core : /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, core);
|
|
2305
|
+
}
|
|
2306
|
+
)));
|
|
2383
2307
|
}
|
|
2384
2308
|
var usePreventUnload = (isDirty) => {
|
|
2385
2309
|
(0, import_react13.useEffect)(() => {
|
|
@@ -2417,9 +2341,7 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
|
2417
2341
|
var import_editor = require("@elementor/editor");
|
|
2418
2342
|
var import_editor_controls18 = require("@elementor/editor-controls");
|
|
2419
2343
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
2420
|
-
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
2421
2344
|
var import_editor_props10 = require("@elementor/editor-props");
|
|
2422
|
-
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
2423
2345
|
var import_menus = require("@elementor/menus");
|
|
2424
2346
|
|
|
2425
2347
|
// src/components/global-styles-import-listener.tsx
|
|
@@ -2438,75 +2360,12 @@ function GlobalStylesImportListener() {
|
|
|
2438
2360
|
return null;
|
|
2439
2361
|
}
|
|
2440
2362
|
|
|
2441
|
-
// src/components/open-panel-from-event.tsx
|
|
2442
|
-
var import_react15 = require("react");
|
|
2443
|
-
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2444
|
-
var EVENT_NAME = "elementor/open-variables-manager";
|
|
2445
|
-
var DEFAULT_PANEL_ROUTE = "panel/elements/categories";
|
|
2446
|
-
function OpenPanelFromEvent() {
|
|
2447
|
-
const { open } = usePanelActions();
|
|
2448
|
-
const pendingRef = (0, import_react15.useRef)(false);
|
|
2449
|
-
const [readyToOpen, setReadyToOpen] = (0, import_react15.useState)(false);
|
|
2450
|
-
(0, import_react15.useEffect)(() => {
|
|
2451
|
-
if (readyToOpen) {
|
|
2452
|
-
setReadyToOpen(false);
|
|
2453
|
-
open();
|
|
2454
|
-
}
|
|
2455
|
-
}, [readyToOpen, open]);
|
|
2456
|
-
(0, import_react15.useEffect)(() => {
|
|
2457
|
-
return (0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2458
|
-
if (pendingRef.current) {
|
|
2459
|
-
pendingRef.current = false;
|
|
2460
|
-
setReadyToOpen(true);
|
|
2461
|
-
}
|
|
2462
|
-
});
|
|
2463
|
-
}, []);
|
|
2464
|
-
(0, import_react15.useEffect)(() => {
|
|
2465
|
-
const handler = () => {
|
|
2466
|
-
pendingRef.current = true;
|
|
2467
|
-
(0, import_editor_v1_adapters3.__privateOpenRoute)(DEFAULT_PANEL_ROUTE);
|
|
2468
|
-
};
|
|
2469
|
-
window.addEventListener(EVENT_NAME, handler);
|
|
2470
|
-
return () => window.removeEventListener(EVENT_NAME, handler);
|
|
2471
|
-
}, []);
|
|
2472
|
-
return null;
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
|
-
// src/components/open-panel-from-url.tsx
|
|
2476
|
-
var import_react16 = require("react");
|
|
2477
|
-
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2478
|
-
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2479
|
-
var PANEL_ID = "variables-manager";
|
|
2480
|
-
var DEFAULT_PANEL_ROUTE2 = "panel/elements";
|
|
2481
|
-
function OpenPanelFromUrl() {
|
|
2482
|
-
const { open } = usePanelActions();
|
|
2483
|
-
const hasOpened = (0, import_react16.useRef)(false);
|
|
2484
|
-
(0, import_react16.useEffect)(() => {
|
|
2485
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
2486
|
-
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2487
|
-
if (activePanel !== PANEL_ID) {
|
|
2488
|
-
return;
|
|
2489
|
-
}
|
|
2490
|
-
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE2), () => {
|
|
2491
|
-
if (hasOpened.current) {
|
|
2492
|
-
return;
|
|
2493
|
-
}
|
|
2494
|
-
hasOpened.current = true;
|
|
2495
|
-
requestAnimationFrame(() => {
|
|
2496
|
-
open();
|
|
2497
|
-
});
|
|
2498
|
-
});
|
|
2499
|
-
return cleanup;
|
|
2500
|
-
}, [open]);
|
|
2501
|
-
return null;
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
2363
|
// src/controls/variable-control.tsx
|
|
2505
2364
|
var React33 = __toESM(require("react"));
|
|
2506
2365
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
2507
2366
|
|
|
2508
2367
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2509
|
-
var
|
|
2368
|
+
var import_react21 = require("react");
|
|
2510
2369
|
var React24 = __toESM(require("react"));
|
|
2511
2370
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
2512
2371
|
var import_icons12 = require("@elementor/icons");
|
|
@@ -2530,25 +2389,25 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2530
2389
|
|
|
2531
2390
|
// src/components/variable-selection-popover.tsx
|
|
2532
2391
|
var React22 = __toESM(require("react"));
|
|
2533
|
-
var
|
|
2534
|
-
var
|
|
2392
|
+
var import_react20 = require("react");
|
|
2393
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
2535
2394
|
|
|
2536
2395
|
// src/context/variable-selection-popover.context.tsx
|
|
2537
2396
|
var React15 = __toESM(require("react"));
|
|
2538
|
-
var
|
|
2397
|
+
var import_react15 = require("react");
|
|
2539
2398
|
var import_ui15 = require("@elementor/ui");
|
|
2540
|
-
var PopoverContentRefContext = (0,
|
|
2399
|
+
var PopoverContentRefContext = (0, import_react15.createContext)(null);
|
|
2541
2400
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2542
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2401
|
+
const [anchorRef, setAnchorRef] = (0, import_react15.useState)(null);
|
|
2543
2402
|
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: setAnchorRef }, children));
|
|
2544
2403
|
};
|
|
2545
2404
|
var usePopoverContentRef = () => {
|
|
2546
|
-
return (0,
|
|
2405
|
+
return (0, import_react15.useContext)(PopoverContentRefContext);
|
|
2547
2406
|
};
|
|
2548
2407
|
|
|
2549
2408
|
// src/components/variable-creation.tsx
|
|
2550
2409
|
var React17 = __toESM(require("react"));
|
|
2551
|
-
var
|
|
2410
|
+
var import_react16 = require("react");
|
|
2552
2411
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2553
2412
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2554
2413
|
var import_icons6 = require("@elementor/icons");
|
|
@@ -2598,8 +2457,8 @@ var unwrapValue = (input) => {
|
|
|
2598
2457
|
// src/components/ui/form-field.tsx
|
|
2599
2458
|
var React16 = __toESM(require("react"));
|
|
2600
2459
|
var import_ui16 = require("@elementor/ui");
|
|
2601
|
-
var FormField = ({ id
|
|
2602
|
-
return /* @__PURE__ */ React16.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(import_ui16.FormLabel, { htmlFor:
|
|
2460
|
+
var FormField = ({ id, label, errorMsg, noticeMsg, children }) => {
|
|
2461
|
+
return /* @__PURE__ */ React16.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(import_ui16.FormLabel, { htmlFor: id, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, null, noticeMsg)));
|
|
2603
2462
|
};
|
|
2604
2463
|
|
|
2605
2464
|
// src/components/variable-creation.tsx
|
|
@@ -2609,11 +2468,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2609
2468
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2610
2469
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2611
2470
|
const initialValue = useInitialValue();
|
|
2612
|
-
const [value, setValue] = (0,
|
|
2613
|
-
const [label, setLabel] = (0,
|
|
2614
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2615
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2616
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2471
|
+
const [value, setValue] = (0, import_react16.useState)(initialValue);
|
|
2472
|
+
const [label, setLabel] = (0, import_react16.useState)("");
|
|
2473
|
+
const [errorMessage, setErrorMessage] = (0, import_react16.useState)("");
|
|
2474
|
+
const [valueFieldError, setValueFieldError] = (0, import_react16.useState)("");
|
|
2475
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react16.useState)(propTypeUtil.key);
|
|
2617
2476
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2618
2477
|
const resetFields = () => {
|
|
2619
2478
|
setValue("");
|
|
@@ -2734,7 +2593,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2734
2593
|
|
|
2735
2594
|
// src/components/variable-edit.tsx
|
|
2736
2595
|
var React19 = __toESM(require("react"));
|
|
2737
|
-
var
|
|
2596
|
+
var import_react18 = require("react");
|
|
2738
2597
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2739
2598
|
var import_editor_current_user3 = require("@elementor/editor-current-user");
|
|
2740
2599
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
@@ -2744,7 +2603,7 @@ var import_i18n13 = require("@wordpress/i18n");
|
|
|
2744
2603
|
|
|
2745
2604
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2746
2605
|
var React18 = __toESM(require("react"));
|
|
2747
|
-
var
|
|
2606
|
+
var import_react17 = require("react");
|
|
2748
2607
|
var import_icons7 = require("@elementor/icons");
|
|
2749
2608
|
var import_ui18 = require("@elementor/ui");
|
|
2750
2609
|
var import_i18n12 = require("@wordpress/i18n");
|
|
@@ -2754,7 +2613,7 @@ var EditConfirmationDialog = ({
|
|
|
2754
2613
|
onConfirm,
|
|
2755
2614
|
onSuppressMessage
|
|
2756
2615
|
}) => {
|
|
2757
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2616
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react17.useState)(false);
|
|
2758
2617
|
const handleSave = () => {
|
|
2759
2618
|
if (dontShowAgain) {
|
|
2760
2619
|
onSuppressMessage?.();
|
|
@@ -2788,20 +2647,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2788
2647
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2789
2648
|
const { propType } = (0, import_editor_controls6.useBoundProp)();
|
|
2790
2649
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user3.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2791
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2792
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2793
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2794
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2650
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react18.useState)(false);
|
|
2651
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react18.useState)(false);
|
|
2652
|
+
const [errorMessage, setErrorMessage] = (0, import_react18.useState)("");
|
|
2653
|
+
const [valueFieldError, setValueFieldError] = (0, import_react18.useState)("");
|
|
2795
2654
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2796
2655
|
const variable = useVariable(editId);
|
|
2797
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2656
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react18.useState)(variable?.type ?? propTypeUtil.key);
|
|
2798
2657
|
if (!variable) {
|
|
2799
2658
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2800
2659
|
}
|
|
2801
2660
|
const userPermissions = usePermissions();
|
|
2802
|
-
const [value, setValue] = (0,
|
|
2803
|
-
const [label, setLabel] = (0,
|
|
2804
|
-
(0,
|
|
2661
|
+
const [value, setValue] = (0, import_react18.useState)(() => variable.value);
|
|
2662
|
+
const [label, setLabel] = (0, import_react18.useState)(() => variable.label);
|
|
2663
|
+
(0, import_react18.useEffect)(() => {
|
|
2805
2664
|
styleVariablesRepository.update({
|
|
2806
2665
|
[editId]: {
|
|
2807
2666
|
...variable,
|
|
@@ -2966,7 +2825,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2966
2825
|
};
|
|
2967
2826
|
|
|
2968
2827
|
// src/components/variables-selection.tsx
|
|
2969
|
-
var
|
|
2828
|
+
var import_react19 = require("react");
|
|
2970
2829
|
var React21 = __toESM(require("react"));
|
|
2971
2830
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
2972
2831
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
@@ -3074,7 +2933,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
|
|
|
3074
2933
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
3075
2934
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
3076
2935
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
3077
|
-
const [searchValue, setSearchValue] = (0,
|
|
2936
|
+
const [searchValue, setSearchValue] = (0, import_react19.useState)("");
|
|
3078
2937
|
const {
|
|
3079
2938
|
list: variables,
|
|
3080
2939
|
hasMatches: hasSearchResults,
|
|
@@ -3151,7 +3010,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
3151
3010
|
const handleClearSearch = () => {
|
|
3152
3011
|
setSearchValue("");
|
|
3153
3012
|
};
|
|
3154
|
-
(0,
|
|
3013
|
+
(0, import_react19.useEffect)(() => {
|
|
3155
3014
|
if (disabled) {
|
|
3156
3015
|
(0, import_editor_controls7.trackViewPromotion)({
|
|
3157
3016
|
target_name: "variables_popover",
|
|
@@ -3259,17 +3118,12 @@ var VIEW_LIST = "list";
|
|
|
3259
3118
|
var VIEW_ADD = "add";
|
|
3260
3119
|
var VIEW_EDIT = "edit";
|
|
3261
3120
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
3262
|
-
const [currentView, setCurrentView] = (0,
|
|
3263
|
-
const [editId, setEditId] = (0,
|
|
3264
|
-
const
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
new CustomEvent("elementor/toggle-design-system", { detail: { tab: "variables" } })
|
|
3269
|
-
);
|
|
3270
|
-
} else {
|
|
3271
|
-
openStandaloneVariablesPanel();
|
|
3272
|
-
}
|
|
3121
|
+
const [currentView, setCurrentView] = (0, import_react20.useState)(VIEW_LIST);
|
|
3122
|
+
const [editId, setEditId] = (0, import_react20.useState)("");
|
|
3123
|
+
const onSettingsAvailable = (0, import_editor_v1_adapters2.isExperimentActive)("e_variables_manager") ? () => {
|
|
3124
|
+
window.dispatchEvent(
|
|
3125
|
+
new CustomEvent("elementor/toggle-design-system", { detail: { tab: "variables" } })
|
|
3126
|
+
);
|
|
3273
3127
|
} : void 0;
|
|
3274
3128
|
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
3275
3129
|
propTypeKey,
|
|
@@ -3377,8 +3231,8 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3377
3231
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3378
3232
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3379
3233
|
const { setValue } = (0, import_editor_controls8.useBoundProp)();
|
|
3380
|
-
const anchorRef = (0,
|
|
3381
|
-
const popupId = (0,
|
|
3234
|
+
const anchorRef = (0, import_react21.useRef)(null);
|
|
3235
|
+
const popupId = (0, import_react21.useId)();
|
|
3382
3236
|
const popupState = (0, import_ui24.usePopupState)({
|
|
3383
3237
|
variant: "popover",
|
|
3384
3238
|
popupId: `elementor-variables-list-${popupId}`
|
|
@@ -3418,14 +3272,14 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3418
3272
|
|
|
3419
3273
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3420
3274
|
var React28 = __toESM(require("react"));
|
|
3421
|
-
var
|
|
3275
|
+
var import_react23 = require("react");
|
|
3422
3276
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3423
3277
|
var import_ui28 = require("@elementor/ui");
|
|
3424
3278
|
var import_i18n19 = require("@wordpress/i18n");
|
|
3425
3279
|
|
|
3426
3280
|
// src/components/variable-restore.tsx
|
|
3427
3281
|
var React25 = __toESM(require("react"));
|
|
3428
|
-
var
|
|
3282
|
+
var import_react22 = require("react");
|
|
3429
3283
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3430
3284
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3431
3285
|
var import_ui25 = require("@elementor/ui");
|
|
@@ -3439,11 +3293,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3439
3293
|
if (!variable) {
|
|
3440
3294
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3441
3295
|
}
|
|
3442
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3443
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3444
|
-
const [label, setLabel] = (0,
|
|
3445
|
-
const [value, setValue] = (0,
|
|
3446
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3296
|
+
const [errorMessage, setErrorMessage] = (0, import_react22.useState)("");
|
|
3297
|
+
const [valueFieldError, setValueFieldError] = (0, import_react22.useState)("");
|
|
3298
|
+
const [label, setLabel] = (0, import_react22.useState)(variable.label);
|
|
3299
|
+
const [value, setValue] = (0, import_react22.useState)(variable.value);
|
|
3300
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react22.useState)(variable?.type ?? propTypeUtil.key);
|
|
3447
3301
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3448
3302
|
value: variable.label,
|
|
3449
3303
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3600,11 +3454,11 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3600
3454
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3601
3455
|
const boundProp = (0, import_editor_controls10.useBoundProp)();
|
|
3602
3456
|
const userPermissions = usePermissions();
|
|
3603
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3457
|
+
const [showInfotip, setShowInfotip] = (0, import_react23.useState)(false);
|
|
3604
3458
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3605
3459
|
const closeInfotip = () => setShowInfotip(false);
|
|
3606
|
-
const deletedChipAnchorRef = (0,
|
|
3607
|
-
const popupId = (0,
|
|
3460
|
+
const deletedChipAnchorRef = (0, import_react23.useRef)(null);
|
|
3461
|
+
const popupId = (0, import_react23.useId)();
|
|
3608
3462
|
const popupState = (0, import_ui28.usePopupState)({
|
|
3609
3463
|
variant: "popover",
|
|
3610
3464
|
popupId: `elementor-variables-restore-${popupId}`
|
|
@@ -3618,8 +3472,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3618
3472
|
if (!variable.key) {
|
|
3619
3473
|
return;
|
|
3620
3474
|
}
|
|
3621
|
-
restoreVariable(variable.key).then((
|
|
3622
|
-
resolveBoundPropAndSetValue(propTypeUtil.create(
|
|
3475
|
+
restoreVariable(variable.key).then((id) => {
|
|
3476
|
+
resolveBoundPropAndSetValue(propTypeUtil.create(id), boundProp);
|
|
3623
3477
|
closeInfotip();
|
|
3624
3478
|
}).catch(() => {
|
|
3625
3479
|
closeInfotip();
|
|
@@ -3691,7 +3545,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3691
3545
|
|
|
3692
3546
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3693
3547
|
var React30 = __toESM(require("react"));
|
|
3694
|
-
var
|
|
3548
|
+
var import_react24 = require("react");
|
|
3695
3549
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
3696
3550
|
var import_ui30 = require("@elementor/ui");
|
|
3697
3551
|
var import_i18n21 = require("@wordpress/i18n");
|
|
@@ -3729,13 +3583,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
3729
3583
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3730
3584
|
var MismatchVariable = ({ variable }) => {
|
|
3731
3585
|
const { setValue, value } = (0, import_editor_controls11.useBoundProp)();
|
|
3732
|
-
const anchorRef = (0,
|
|
3733
|
-
const popupId = (0,
|
|
3586
|
+
const anchorRef = (0, import_react24.useRef)(null);
|
|
3587
|
+
const popupId = (0, import_react24.useId)();
|
|
3734
3588
|
const popupState = (0, import_ui30.usePopupState)({
|
|
3735
3589
|
variant: "popover",
|
|
3736
3590
|
popupId: `elementor-variables-list-${popupId}`
|
|
3737
3591
|
});
|
|
3738
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3592
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react24.useState)(false);
|
|
3739
3593
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3740
3594
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3741
3595
|
const triggerSelect = () => {
|
|
@@ -3808,7 +3662,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3808
3662
|
|
|
3809
3663
|
// src/components/ui/variable/missing-variable.tsx
|
|
3810
3664
|
var React32 = __toESM(require("react"));
|
|
3811
|
-
var
|
|
3665
|
+
var import_react25 = require("react");
|
|
3812
3666
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3813
3667
|
var import_ui32 = require("@elementor/ui");
|
|
3814
3668
|
var import_i18n23 = require("@wordpress/i18n");
|
|
@@ -3838,7 +3692,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3838
3692
|
// src/components/ui/variable/missing-variable.tsx
|
|
3839
3693
|
var MissingVariable = () => {
|
|
3840
3694
|
const { setValue } = (0, import_editor_controls12.useBoundProp)();
|
|
3841
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3695
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3842
3696
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3843
3697
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3844
3698
|
const clearValue = () => setValue(null);
|
|
@@ -4008,13 +3862,13 @@ Delete a variable:
|
|
|
4008
3862
|
};
|
|
4009
3863
|
|
|
4010
3864
|
// src/mcp/variables-resource.ts
|
|
4011
|
-
var
|
|
3865
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
4012
3866
|
var GLOBAL_VARIABLES_URI = "elementor://global-variables";
|
|
4013
3867
|
var buildGlobalVariablesPayload = async () => {
|
|
4014
3868
|
const merged = {};
|
|
4015
|
-
Object.entries(service.variables()).forEach(([
|
|
3869
|
+
Object.entries(service.variables()).forEach(([id, variable]) => {
|
|
4016
3870
|
if (!variable.deleted) {
|
|
4017
|
-
merged[
|
|
3871
|
+
merged[id] = { ...variable, version: "v4" };
|
|
4018
3872
|
}
|
|
4019
3873
|
});
|
|
4020
3874
|
return merged;
|
|
@@ -4043,7 +3897,7 @@ var initVariablesResource = (variablesMcpEntry, canvasMcpEntry) => {
|
|
|
4043
3897
|
}
|
|
4044
3898
|
);
|
|
4045
3899
|
window.addEventListener(STORAGE_UPDATED_EVENT, notifyGlobalVariablesUpdated);
|
|
4046
|
-
(0,
|
|
3900
|
+
(0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("document/save/update"), notifyGlobalVariablesUpdated);
|
|
4047
3901
|
});
|
|
4048
3902
|
};
|
|
4049
3903
|
|
|
@@ -4138,28 +3992,28 @@ function getServiceActions(svc) {
|
|
|
4138
3992
|
}
|
|
4139
3993
|
return svc.create({ type, label, value });
|
|
4140
3994
|
},
|
|
4141
|
-
update({ id
|
|
4142
|
-
if (!
|
|
3995
|
+
update({ id, label, value }) {
|
|
3996
|
+
if (!id || !label || !value) {
|
|
4143
3997
|
throw new Error("Update requires id, label, and value");
|
|
4144
3998
|
}
|
|
4145
3999
|
const labelError = validateLabel(label);
|
|
4146
4000
|
if (labelError) {
|
|
4147
4001
|
throw new Error(labelError);
|
|
4148
4002
|
}
|
|
4149
|
-
const existingVariable = svc.variables()[
|
|
4003
|
+
const existingVariable = svc.variables()[id];
|
|
4150
4004
|
if (existingVariable) {
|
|
4151
4005
|
const valueError = validateValueForType(existingVariable.type, value);
|
|
4152
4006
|
if (valueError) {
|
|
4153
4007
|
throw new Error(valueError);
|
|
4154
4008
|
}
|
|
4155
4009
|
}
|
|
4156
|
-
return svc.update(
|
|
4010
|
+
return svc.update(id, { label, value });
|
|
4157
4011
|
},
|
|
4158
|
-
delete({ id
|
|
4159
|
-
if (!
|
|
4012
|
+
delete({ id }) {
|
|
4013
|
+
if (!id) {
|
|
4160
4014
|
throw new Error("delete requires id");
|
|
4161
4015
|
}
|
|
4162
|
-
return svc.delete(
|
|
4016
|
+
return svc.delete(id);
|
|
4163
4017
|
}
|
|
4164
4018
|
};
|
|
4165
4019
|
}
|
|
@@ -4180,12 +4034,12 @@ var import_i18n26 = require("@wordpress/i18n");
|
|
|
4180
4034
|
|
|
4181
4035
|
// src/components/fields/color-field.tsx
|
|
4182
4036
|
var React35 = __toESM(require("react"));
|
|
4183
|
-
var
|
|
4037
|
+
var import_react26 = require("react");
|
|
4184
4038
|
var import_ui33 = require("@elementor/ui");
|
|
4185
4039
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
4186
|
-
const [color, setColor] = (0,
|
|
4187
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
4188
|
-
const defaultRef = (0,
|
|
4040
|
+
const [color, setColor] = (0, import_react26.useState)(value);
|
|
4041
|
+
const [errorMessage, setErrorMessage] = (0, import_react26.useState)("");
|
|
4042
|
+
const defaultRef = (0, import_react26.useRef)(null);
|
|
4189
4043
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
4190
4044
|
const handleChange = (newValue) => {
|
|
4191
4045
|
setColor(newValue);
|
|
@@ -4224,20 +4078,20 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
4224
4078
|
|
|
4225
4079
|
// src/components/fields/font-field.tsx
|
|
4226
4080
|
var React36 = __toESM(require("react"));
|
|
4227
|
-
var
|
|
4081
|
+
var import_react27 = require("react");
|
|
4228
4082
|
var import_editor_controls15 = require("@elementor/editor-controls");
|
|
4229
4083
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
4230
4084
|
var import_icons15 = require("@elementor/icons");
|
|
4231
4085
|
var import_ui34 = require("@elementor/ui");
|
|
4232
4086
|
var import_i18n25 = require("@wordpress/i18n");
|
|
4233
4087
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
4234
|
-
const [fontFamily, setFontFamily] = (0,
|
|
4235
|
-
const defaultRef = (0,
|
|
4088
|
+
const [fontFamily, setFontFamily] = (0, import_react27.useState)(value);
|
|
4089
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
4236
4090
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
4237
4091
|
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
4238
4092
|
const fontFamilies = (0, import_editor_controls15.useFontFamilies)();
|
|
4239
4093
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
4240
|
-
const mapFontSubs = (0,
|
|
4094
|
+
const mapFontSubs = (0, import_react27.useMemo)(() => {
|
|
4241
4095
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
4242
4096
|
label,
|
|
4243
4097
|
items: fonts
|
|
@@ -4253,11 +4107,11 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
4253
4107
|
handleChange(newFontFamily);
|
|
4254
4108
|
fontPopoverState.close();
|
|
4255
4109
|
};
|
|
4256
|
-
const
|
|
4110
|
+
const id = (0, import_react27.useId)();
|
|
4257
4111
|
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
4258
4112
|
import_ui34.UnstableTag,
|
|
4259
4113
|
{
|
|
4260
|
-
id
|
|
4114
|
+
id,
|
|
4261
4115
|
variant: "outlined",
|
|
4262
4116
|
label: fontFamily,
|
|
4263
4117
|
endIcon: /* @__PURE__ */ React36.createElement(import_icons15.ChevronDownIcon, { fontSize: "tiny" }),
|
|
@@ -4373,8 +4227,8 @@ function registerVariableTypes() {
|
|
|
4373
4227
|
|
|
4374
4228
|
// src/renderers/style-variables-renderer.tsx
|
|
4375
4229
|
var React38 = __toESM(require("react"));
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
4230
|
+
var import_react28 = require("react");
|
|
4231
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
4378
4232
|
var import_ui35 = require("@elementor/ui");
|
|
4379
4233
|
var VARIABLES_WRAPPER = ":root";
|
|
4380
4234
|
function StyleVariablesRenderer() {
|
|
@@ -4389,11 +4243,11 @@ function StyleVariablesRenderer() {
|
|
|
4389
4243
|
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
4390
4244
|
}
|
|
4391
4245
|
function usePortalContainer() {
|
|
4392
|
-
return (0,
|
|
4246
|
+
return (0, import_editor_v1_adapters4.__privateUseListenTo)((0, import_editor_v1_adapters4.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters4.getCanvasIframeDocument)()?.head);
|
|
4393
4247
|
}
|
|
4394
4248
|
function useStyleVariables() {
|
|
4395
|
-
const [variables, setVariables] = (0,
|
|
4396
|
-
(0,
|
|
4249
|
+
const [variables, setVariables] = (0, import_react28.useState)({});
|
|
4250
|
+
(0, import_react28.useEffect)(() => {
|
|
4397
4251
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
4398
4252
|
return () => {
|
|
4399
4253
|
unsubscribe();
|
|
@@ -4694,17 +4548,6 @@ function init() {
|
|
|
4694
4548
|
id: "variables-import-listener",
|
|
4695
4549
|
component: GlobalStylesImportListener
|
|
4696
4550
|
});
|
|
4697
|
-
if (!(0, import_editor_v1_adapters8.isExperimentActive)("e_editor_design_system_panel")) {
|
|
4698
|
-
(0, import_editor.injectIntoLogic)({
|
|
4699
|
-
id: "variables-open-panel-from-url",
|
|
4700
|
-
component: OpenPanelFromUrl
|
|
4701
|
-
});
|
|
4702
|
-
(0, import_editor.injectIntoLogic)({
|
|
4703
|
-
id: "variables-open-panel-from-event",
|
|
4704
|
-
component: OpenPanelFromEvent
|
|
4705
|
-
});
|
|
4706
|
-
(0, import_editor_panels2.__registerPanel)(panel);
|
|
4707
|
-
}
|
|
4708
4551
|
}
|
|
4709
4552
|
function hasVariableAssigned(value) {
|
|
4710
4553
|
if ((0, import_editor_props10.isTransformable)(value)) {
|