@elementor/editor-variables 4.2.0-880 → 4.2.0-882

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,30 +1,11 @@
1
1
  // src/components/variables-manager/variables-manager-panel.tsx
2
2
  import * as React14 from "react";
3
- import { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
3
+ import { useCallback as useCallback6, useEffect as useEffect4, useState as useState6 } from "react";
4
4
  import { useSuppressedMessage } from "@elementor/editor-current-user";
5
- import {
6
- __createPanel as createPanel,
7
- Panel,
8
- PanelBody,
9
- PanelFooter,
10
- PanelHeader,
11
- PanelHeaderTitle
12
- } from "@elementor/editor-panels";
13
- import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
14
- import { changeEditMode } from "@elementor/editor-v1-adapters";
5
+ import { PanelBody, PanelFooter } from "@elementor/editor-panels";
6
+ import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, useDialog } from "@elementor/editor-ui";
15
7
  import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, CopyIcon, TrashIcon } from "@elementor/icons";
16
- import {
17
- Alert,
18
- AlertAction,
19
- AlertTitle,
20
- Box as Box2,
21
- Button as Button2,
22
- CloseButton,
23
- Divider,
24
- Infotip,
25
- Stack as Stack6,
26
- usePopupState as usePopupState2
27
- } from "@elementor/ui";
8
+ import { Alert, AlertAction, AlertTitle, Box as Box2, Button as Button2, Divider, Infotip, Stack as Stack6, usePopupState as usePopupState2 } from "@elementor/ui";
28
9
  import { __ as __10 } from "@wordpress/i18n";
29
10
 
30
11
  // src/utils/tracking.ts
@@ -221,19 +202,19 @@ var apiClient = {
221
202
  value
222
203
  });
223
204
  },
224
- update: (id2, label, value, type) => {
205
+ update: (id, label, value, type) => {
225
206
  return httpService().put(BASE_PATH + "/update", {
226
- id: id2,
207
+ id,
227
208
  label,
228
209
  value,
229
210
  type
230
211
  });
231
212
  },
232
- delete: (id2) => {
233
- return httpService().post(BASE_PATH + "/delete", { id: id2 });
213
+ delete: (id) => {
214
+ return httpService().post(BASE_PATH + "/delete", { id });
234
215
  },
235
- restore: (id2, label, value, type) => {
236
- const payload = { id: id2 };
216
+ restore: (id, label, value, type) => {
217
+ const payload = { id };
237
218
  if (label) {
238
219
  payload.label = label;
239
220
  }
@@ -256,34 +237,34 @@ var generateTempId = () => {
256
237
  const random = Math.random().toString(36).substring(2, 8);
257
238
  return `tmp-${timestamp}-${random}`;
258
239
  };
259
- var isTempId = (id2) => {
260
- return id2.startsWith("tmp-");
240
+ var isTempId = (id) => {
241
+ return id.startsWith("tmp-");
261
242
  };
262
243
  var buildOperationsArray = (originalVariables, currentVariables, deletedVariables) => {
263
244
  const operations = [];
264
- Object.entries(currentVariables).forEach(([id2, variable]) => {
265
- if (isTempId(id2)) {
245
+ Object.entries(currentVariables).forEach(([id, variable]) => {
246
+ if (isTempId(id)) {
266
247
  operations.push({
267
248
  type: "create",
268
249
  variable: {
269
250
  ...variable,
270
- id: id2
251
+ id
271
252
  }
272
253
  });
273
- } else if (originalVariables[id2]) {
274
- const original = originalVariables[id2];
254
+ } else if (originalVariables[id]) {
255
+ const original = originalVariables[id];
275
256
  const syncChanged = original.sync_to_v3 !== variable.sync_to_v3;
276
257
  if (original.deleted && !variable.deleted) {
277
258
  operations.push({
278
259
  type: "restore",
279
- id: id2,
260
+ id,
280
261
  ...original.label !== variable.label && { label: variable.label },
281
262
  ...original.value !== variable.value && { value: variable.value }
282
263
  });
283
264
  } else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order || original.type !== variable.type || syncChanged)) {
284
265
  operations.push({
285
266
  type: "update",
286
- id: id2,
267
+ id,
287
268
  variable: {
288
269
  ...original.label !== variable.label && { label: variable.label },
289
270
  ...original.value !== variable.value && { value: variable.value },
@@ -295,15 +276,15 @@ var buildOperationsArray = (originalVariables, currentVariables, deletedVariable
295
276
  }
296
277
  }
297
278
  });
298
- deletedVariables.forEach((id2) => {
279
+ deletedVariables.forEach((id) => {
299
280
  operations.push({
300
281
  type: "delete",
301
- id: id2
282
+ id
302
283
  });
303
284
  });
304
285
  return operations.filter((op) => {
305
- const id2 = op.id || op.variable?.id;
306
- return id2 && !(isTempId(id2) && currentVariables[id2]?.deleted);
286
+ const id = op.id || op.variable?.id;
287
+ return id && !(isTempId(id) && currentVariables[id]?.deleted);
307
288
  });
308
289
  };
309
290
 
@@ -339,15 +320,15 @@ var Storage = class {
339
320
  localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
340
321
  this.notifyChange();
341
322
  }
342
- add(id2, variable) {
323
+ add(id, variable) {
343
324
  this.load();
344
- this.state.variables[id2] = variable;
325
+ this.state.variables[id] = variable;
345
326
  localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
346
327
  this.notifyChange();
347
328
  }
348
- update(id2, variable) {
329
+ update(id, variable) {
349
330
  this.load();
350
- this.state.variables[id2] = variable;
331
+ this.state.variables[id] = variable;
351
332
  localStorage.setItem(STORAGE_KEY, JSON.stringify(this.state.variables));
352
333
  this.notifyChange();
353
334
  }
@@ -503,8 +484,8 @@ var service = {
503
484
  };
504
485
  });
505
486
  },
506
- update: (id2, { label, value, type }) => {
507
- return apiClient.update(id2, label, value, type).then((response) => {
487
+ update: (id, { label, value, type }) => {
488
+ return apiClient.update(id, label, value, type).then((response) => {
508
489
  const { success, data: payload } = response.data;
509
490
  if (!success) {
510
491
  const errorMessage = payload?.message || __2("Unexpected response from server", "elementor");
@@ -525,8 +506,8 @@ var service = {
525
506
  };
526
507
  });
527
508
  },
528
- delete: (id2) => {
529
- return apiClient.delete(id2).then((response) => {
509
+ delete: (id) => {
510
+ return apiClient.delete(id).then((response) => {
530
511
  const { success, data: payload } = response.data;
531
512
  if (!success) {
532
513
  throw new Error("Unexpected response from server");
@@ -546,8 +527,8 @@ var service = {
546
527
  };
547
528
  });
548
529
  },
549
- restore: (id2, label, value, type) => {
550
- return apiClient.restore(id2, label, value, type).then((response) => {
530
+ restore: (id, label, value, type) => {
531
+ return apiClient.restore(id, label, value, type).then((response) => {
551
532
  const { success, data: payload } = response.data;
552
533
  if (!success) {
553
534
  throw new Error("Unexpected response from server");
@@ -617,8 +598,8 @@ var handleWatermark = (operation, newWatermark) => {
617
598
  };
618
599
 
619
600
  // src/transformers/utils/resolve-css-variable.ts
620
- var resolveCssVariable = (id2, variable) => {
621
- let name = id2;
601
+ var resolveCssVariable = (id, variable) => {
602
+ let name = id;
622
603
  let fallbackValue = "";
623
604
  if (variable) {
624
605
  fallbackValue = variable.value;
@@ -637,14 +618,14 @@ var resolveCssVariable = (id2, variable) => {
637
618
  };
638
619
 
639
620
  // src/transformers/inheritance-transformer.tsx
640
- var inheritanceTransformer = createTransformer((id2) => {
621
+ var inheritanceTransformer = createTransformer((id) => {
641
622
  const variables = service.variables();
642
- const variable = variables[id2];
623
+ const variable = variables[id];
643
624
  if (!variable) {
644
625
  return /* @__PURE__ */ React.createElement("span", null, __3("Missing variable", "elementor"));
645
626
  }
646
627
  const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
647
- const css = resolveCssVariable(id2, variable);
628
+ const css = resolveCssVariable(id, variable);
648
629
  return /* @__PURE__ */ React.createElement(Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React.createElement(Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
649
630
  });
650
631
 
@@ -660,8 +641,8 @@ var variableTransformer = createTransformer2((idOrLabel, { key }) => {
660
641
  const count = parseInt((targetVariable.value ?? "").trim(), 10);
661
642
  return formatGridTrackRepeat(count);
662
643
  }
663
- const id2 = service.findIdByLabel(targetVariable.label);
664
- return resolveCssVariable(id2, targetVariable);
644
+ const id = service.findIdByLabel(targetVariable.label);
645
+ return resolveCssVariable(id, targetVariable);
665
646
  });
666
647
 
667
648
  // src/variables-registry/create-variable-type-registry.ts
@@ -994,7 +975,7 @@ var normalizeVariables = (propKey) => {
994
975
  const matchingTypes = getMatchingTypes(propKey);
995
976
  return variablesToList(variables).filter((variable) => matchingTypes.includes(variable.type)).map(toNormalizedVariable);
996
977
  };
997
- var extractId = ({ id: id2 }) => id2;
978
+ var extractId = ({ id }) => id;
998
979
  var createVariable = (newVariable) => {
999
980
  return service.create(newVariable).then(extractId);
1000
981
  };
@@ -1053,8 +1034,17 @@ var useVariablesManagerState = () => {
1053
1034
  }, []);
1054
1035
  const handleOnChange = useCallback3(
1055
1036
  (newVariables) => {
1056
- setVariables({ ...variables, ...newVariables });
1057
- setIsDirty(true);
1037
+ const hasChanges = Object.entries(newVariables).some(([id, newVar]) => {
1038
+ const existingVar = variables[id];
1039
+ if (!existingVar) {
1040
+ return true;
1041
+ }
1042
+ return existingVar.label !== newVar.label || existingVar.value !== newVar.value || existingVar.order !== newVar.order || existingVar.type !== newVar.type || (existingVar.sync_to_v3 ?? false) !== (newVar.sync_to_v3 ?? false);
1043
+ });
1044
+ if (hasChanges) {
1045
+ setVariables({ ...variables, ...newVariables });
1046
+ setIsDirty(true);
1047
+ }
1058
1048
  },
1059
1049
  [variables]
1060
1050
  );
@@ -1413,7 +1403,7 @@ var LabelField = ({
1413
1403
  value,
1414
1404
  error,
1415
1405
  onChange,
1416
- id: id2,
1406
+ id,
1417
1407
  onErrorChange,
1418
1408
  size = "tiny",
1419
1409
  focusOnShow = false,
@@ -1441,7 +1431,7 @@ var LabelField = ({
1441
1431
  TextField,
1442
1432
  {
1443
1433
  ref: fieldRef,
1444
- id: id2,
1434
+ id,
1445
1435
  size,
1446
1436
  fullWidth: true,
1447
1437
  value: label,
@@ -1792,7 +1782,7 @@ var VariableRow = (props) => {
1792
1782
  value,
1793
1783
  onChange,
1794
1784
  onPropTypeKeyChange: (type) => {
1795
- if (!isDisabled) {
1785
+ if (!isDisabled && type !== row.type) {
1796
1786
  handleOnChange({
1797
1787
  ...variables,
1798
1788
  [row.id]: { ...variables[row.id], type }
@@ -1862,22 +1852,22 @@ var VariablesManagerTable = ({
1862
1852
  }
1863
1853
  }
1864
1854
  }, [autoEditVariableId]);
1865
- const handleRowRef = (id2) => (ref) => {
1855
+ const handleRowRef = (id) => (ref) => {
1866
1856
  if (ref) {
1867
- variableRowRefs.current.set(id2, ref);
1857
+ variableRowRefs.current.set(id, ref);
1868
1858
  } else {
1869
- variableRowRefs.current.delete(id2);
1859
+ variableRowRefs.current.delete(id);
1870
1860
  }
1871
1861
  };
1872
1862
  const ids = Object.keys(variables).sort(sortVariablesOrder(variables));
1873
- const rows = ids.map((id2) => {
1874
- const variable = variables[id2];
1863
+ const rows = ids.map((id) => {
1864
+ const variable = variables[id];
1875
1865
  const variableType = getVariableType(variable.type);
1876
1866
  if (!variableType) {
1877
1867
  return null;
1878
1868
  }
1879
1869
  return {
1880
- id: id2,
1870
+ id,
1881
1871
  type: variable.type,
1882
1872
  name: variable.label,
1883
1873
  value: variable.value,
@@ -1890,12 +1880,12 @@ var VariablesManagerTable = ({
1890
1880
  };
1891
1881
  const handleReorder = (newIds) => {
1892
1882
  const updatedVariables = { ...variables };
1893
- newIds.forEach((id2, index) => {
1894
- const current = updatedVariables[id2];
1883
+ newIds.forEach((id, index) => {
1884
+ const current = updatedVariables[id];
1895
1885
  if (!current) {
1896
1886
  return;
1897
1887
  }
1898
- updatedVariables[id2] = Object.assign({}, current, { order: index + 1 });
1888
+ updatedVariables[id] = Object.assign({}, current, { order: index + 1 });
1899
1889
  });
1900
1890
  handleOnChange(updatedVariables);
1901
1891
  };
@@ -1940,47 +1930,14 @@ function sortVariablesOrder(variables) {
1940
1930
  }
1941
1931
 
1942
1932
  // src/components/variables-manager/variables-manager-panel.tsx
1943
- var id = "variables-manager";
1944
1933
  var STOP_SYNC_MESSAGE_KEY = "stop-sync-variable";
1945
- var { panel, usePanelActions } = createPanel({
1946
- id,
1947
- component: VariablesManagerPanel,
1948
- allowedEditModes: ["edit", id],
1949
- onOpen: () => {
1950
- changeEditMode(id);
1951
- },
1952
- onClose: async () => {
1953
- changeEditMode("edit");
1954
- },
1955
- isOpenPreviousElement: true
1956
- });
1957
1934
  function VariablesManagerPanelEmbedded({
1958
1935
  onRequestClose,
1959
1936
  onExposeCloseAttempt
1960
1937
  }) {
1961
- return /* @__PURE__ */ React14.createElement(
1962
- VariablesManagerPanelRoot,
1963
- {
1964
- embedded: true,
1965
- onRequestClose,
1966
- onExposeCloseAttempt
1967
- }
1968
- );
1938
+ return /* @__PURE__ */ React14.createElement(VariablesManagerPanelContent, { onRequestClose, onExposeCloseAttempt });
1969
1939
  }
1970
- function VariablesManagerPanel() {
1971
- return /* @__PURE__ */ React14.createElement(VariablesManagerPanelRoot, null);
1972
- }
1973
- function VariablesManagerPanelRoot({
1974
- embedded = false,
1975
- onRequestClose,
1976
- onExposeCloseAttempt
1977
- } = {}) {
1978
- const { close: closeStandalonePanel } = usePanelActions();
1979
- const closePanel = useMemo3(
1980
- () => embedded ? onRequestClose ?? (async () => {
1981
- }) : closeStandalonePanel,
1982
- [embedded, onRequestClose, closeStandalonePanel]
1983
- );
1940
+ function VariablesManagerPanelContent({ onRequestClose, onExposeCloseAttempt }) {
1984
1941
  const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
1985
1942
  const [isStopSyncSuppressed] = useSuppressedMessage(STOP_SYNC_MESSAGE_KEY);
1986
1943
  const createMenuState = usePopupState2({
@@ -2014,15 +1971,15 @@ function VariablesManagerPanelRoot({
2014
1971
  openSaveChangesDialog();
2015
1972
  return;
2016
1973
  }
2017
- void closePanel();
2018
- }, [isDirty, openSaveChangesDialog, closePanel]);
1974
+ void onRequestClose();
1975
+ }, [isDirty, openSaveChangesDialog, onRequestClose]);
2019
1976
  useEffect4(() => {
2020
- if (!embedded || !onExposeCloseAttempt) {
1977
+ if (!onExposeCloseAttempt) {
2021
1978
  return;
2022
1979
  }
2023
1980
  onExposeCloseAttempt(() => handleClosePanel());
2024
1981
  return () => onExposeCloseAttempt(null);
2025
- }, [embedded, onExposeCloseAttempt, handleClosePanel]);
1982
+ }, [onExposeCloseAttempt, handleClosePanel]);
2026
1983
  const handleCreateVariable = useCallback6(
2027
1984
  (type, defaultName, defaultValue) => {
2028
1985
  const newId = createVariable2(type, defaultName, defaultValue);
@@ -2140,144 +2097,7 @@ function VariablesManagerPanelRoot({
2140
2097
  [variables, handleStartSync, handleStopSync, duplicateVariable, startAutoEdit]
2141
2098
  );
2142
2099
  const hasVariables = Object.keys(variables).length > 0;
2143
- const variablesSearchFieldSx = embedded ? {
2144
- flex: 1,
2145
- minWidth: 0,
2146
- px: 0,
2147
- py: 0,
2148
- display: "flex",
2149
- alignItems: "center",
2150
- alignSelf: "stretch"
2151
- } : {
2152
- display: "flex",
2153
- flex: 1
2154
- };
2155
- const searchField = /* @__PURE__ */ React14.createElement(
2156
- SearchField,
2157
- {
2158
- placeholder: __10("Search", "elementor"),
2159
- value: searchValue,
2160
- onSearch: handleSearch,
2161
- sx: variablesSearchFieldSx
2162
- }
2163
- );
2164
- const bodyInner = /* @__PURE__ */ React14.createElement(React14.Fragment, null, hasVariables && /* @__PURE__ */ React14.createElement(
2165
- VariablesManagerTable,
2166
- {
2167
- menuActions: buildMenuActions,
2168
- variables,
2169
- onChange: handleOnChange,
2170
- autoEditVariableId,
2171
- onAutoEditComplete: handleAutoEditComplete,
2172
- onFieldError: setIsSaveDisabled
2173
- }
2174
- ), !hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
2175
- NoSearchResults,
2176
- {
2177
- searchValue,
2178
- onClear: () => handleSearch(""),
2179
- icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
2180
- }
2181
- ), !hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
2182
- EmptyState,
2183
- {
2184
- title: __10("Create your first variable", "elementor"),
2185
- message: __10(
2186
- "Variables are saved attributes that you can apply anywhere on your site.",
2187
- "elementor"
2188
- ),
2189
- icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
2190
- onAdd: createMenuState.open
2191
- }
2192
- ));
2193
- const saveFooter = /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
2194
- Infotip,
2195
- {
2196
- placement: "right",
2197
- open: !!serverError,
2198
- content: serverError ? /* @__PURE__ */ React14.createElement(
2199
- Alert,
2200
- {
2201
- severity: serverError.severity ?? "error",
2202
- action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
2203
- onClose: !serverError.action?.label ? () => {
2204
- setServerError(null);
2205
- setIsSaveDisabled(false);
2206
- } : void 0,
2207
- icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
2208
- },
2209
- /* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
2210
- serverError.action?.message
2211
- ) : null,
2212
- arrow: false,
2213
- slotProps: {
2214
- popper: {
2215
- modifiers: [
2216
- {
2217
- name: "offset",
2218
- options: { offset: [-10, 10] }
2219
- }
2220
- ]
2221
- }
2222
- }
2223
- },
2224
- /* @__PURE__ */ React14.createElement(
2225
- Button2,
2226
- {
2227
- fullWidth: true,
2228
- size: "small",
2229
- color: "global",
2230
- variant: "contained",
2231
- disabled: isSaveDisabled || !isDirty || isSaving,
2232
- onClick: handleSaveClick,
2233
- loading: isSaving
2234
- },
2235
- __10("Save changes", "elementor")
2236
- )
2237
- ));
2238
- const dialogs = /* @__PURE__ */ React14.createElement(React14.Fragment, null, deleteConfirmation && /* @__PURE__ */ React14.createElement(
2239
- DeleteConfirmationDialog,
2240
- {
2241
- open: true,
2242
- label: deleteConfirmation.label,
2243
- onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
2244
- closeDialog: () => setDeleteConfirmation(null)
2245
- }
2246
- ), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
2247
- StopSyncConfirmationDialog,
2248
- {
2249
- open: true,
2250
- onClose: () => setStopSyncConfirmation(null),
2251
- onConfirm: () => {
2252
- commitStopSync(stopSyncConfirmation);
2253
- setStopSyncConfirmation(null);
2254
- }
2255
- }
2256
- ), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
2257
- SaveChangesDialog.Actions,
2258
- {
2259
- actions: {
2260
- discard: {
2261
- label: __10("Discard", "elementor"),
2262
- action: () => {
2263
- closeSaveChangesDialog();
2264
- void closePanel();
2265
- }
2266
- },
2267
- confirm: {
2268
- label: __10("Save", "elementor"),
2269
- action: async () => {
2270
- const result = await handleSaveClick();
2271
- closeSaveChangesDialog();
2272
- if (result?.success) {
2273
- void closePanel();
2274
- }
2275
- }
2276
- }
2277
- }
2278
- }
2279
- )));
2280
- const panelChrome = embedded ? /* @__PURE__ */ React14.createElement(
2100
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
2281
2101
  Stack6,
2282
2102
  {
2283
2103
  direction: "column",
@@ -2302,7 +2122,23 @@ function VariablesManagerPanelRoot({
2302
2122
  pb: 1
2303
2123
  }
2304
2124
  },
2305
- searchField,
2125
+ /* @__PURE__ */ React14.createElement(
2126
+ SearchField,
2127
+ {
2128
+ placeholder: __10("Search", "elementor"),
2129
+ value: searchValue,
2130
+ onSearch: handleSearch,
2131
+ sx: {
2132
+ flex: 1,
2133
+ minWidth: 0,
2134
+ px: 0,
2135
+ py: 0,
2136
+ display: "flex",
2137
+ alignItems: "center",
2138
+ alignSelf: "stretch"
2139
+ }
2140
+ }
2141
+ ),
2306
2142
  /* @__PURE__ */ React14.createElement(Box2, { sx: { display: "flex", flexShrink: 0, alignItems: "center" } }, /* @__PURE__ */ React14.createElement(
2307
2143
  VariableManagerCreateMenu,
2308
2144
  {
@@ -2324,46 +2160,125 @@ function VariablesManagerPanelRoot({
2324
2160
  minHeight: 0
2325
2161
  }
2326
2162
  },
2327
- bodyInner
2163
+ hasVariables && /* @__PURE__ */ React14.createElement(
2164
+ VariablesManagerTable,
2165
+ {
2166
+ menuActions: buildMenuActions,
2167
+ variables,
2168
+ onChange: handleOnChange,
2169
+ autoEditVariableId,
2170
+ onAutoEditComplete: handleAutoEditComplete,
2171
+ onFieldError: setIsSaveDisabled
2172
+ }
2173
+ ),
2174
+ !hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
2175
+ NoSearchResults,
2176
+ {
2177
+ searchValue,
2178
+ onClear: () => handleSearch(""),
2179
+ icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
2180
+ }
2181
+ ),
2182
+ !hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
2183
+ EmptyState,
2184
+ {
2185
+ title: __10("Create your first variable", "elementor"),
2186
+ message: __10(
2187
+ "Variables are saved attributes that you can apply anywhere on your site.",
2188
+ "elementor"
2189
+ ),
2190
+ icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
2191
+ onAdd: createMenuState.open
2192
+ }
2193
+ )
2328
2194
  ),
2329
- saveFooter
2330
- ) : /* @__PURE__ */ React14.createElement(Panel, null, /* @__PURE__ */ React14.createElement(
2331
- PanelHeader,
2332
- {
2333
- sx: {
2334
- height: "unset"
2335
- }
2336
- },
2337
- /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "inherit" }), __10("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
2338
- VariableManagerCreateMenu,
2195
+ /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
2196
+ Infotip,
2339
2197
  {
2340
- onCreate: handleCreateVariable,
2341
- variables,
2342
- menuState: createMenuState
2343
- }
2344
- ), /* @__PURE__ */ React14.createElement(
2345
- CloseButton,
2346
- {
2347
- "aria-label": "Close",
2348
- slotProps: { icon: { fontSize: SIZE } },
2349
- onClick: () => {
2350
- handleClosePanel();
2198
+ placement: "right",
2199
+ open: !!serverError,
2200
+ content: serverError ? /* @__PURE__ */ React14.createElement(
2201
+ Alert,
2202
+ {
2203
+ severity: serverError.severity ?? "error",
2204
+ action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
2205
+ onClose: !serverError.action?.label ? () => {
2206
+ setServerError(null);
2207
+ setIsSaveDisabled(false);
2208
+ } : void 0,
2209
+ icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
2210
+ },
2211
+ /* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
2212
+ serverError.action?.message
2213
+ ) : null,
2214
+ arrow: false,
2215
+ slotProps: {
2216
+ popper: {
2217
+ modifiers: [
2218
+ {
2219
+ name: "offset",
2220
+ options: { offset: [-10, 10] }
2221
+ }
2222
+ ]
2223
+ }
2351
2224
  }
2225
+ },
2226
+ /* @__PURE__ */ React14.createElement(
2227
+ Button2,
2228
+ {
2229
+ fullWidth: true,
2230
+ size: "small",
2231
+ color: "global",
2232
+ variant: "contained",
2233
+ disabled: isSaveDisabled || !isDirty || isSaving,
2234
+ onClick: handleSaveClick,
2235
+ loading: isSaving
2236
+ },
2237
+ __10("Save changes", "elementor")
2238
+ )
2239
+ ))
2240
+ ), deleteConfirmation && /* @__PURE__ */ React14.createElement(
2241
+ DeleteConfirmationDialog,
2242
+ {
2243
+ open: true,
2244
+ label: deleteConfirmation.label,
2245
+ onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
2246
+ closeDialog: () => setDeleteConfirmation(null)
2247
+ }
2248
+ ), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
2249
+ StopSyncConfirmationDialog,
2250
+ {
2251
+ open: true,
2252
+ onClose: () => setStopSyncConfirmation(null),
2253
+ onConfirm: () => {
2254
+ commitStopSync(stopSyncConfirmation);
2255
+ setStopSyncConfirmation(null);
2352
2256
  }
2353
- ))), /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, searchField), /* @__PURE__ */ React14.createElement(Divider, { sx: { width: "100%" } }))
2354
- ), /* @__PURE__ */ React14.createElement(
2355
- PanelBody,
2257
+ }
2258
+ ), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
2259
+ SaveChangesDialog.Actions,
2356
2260
  {
2357
- sx: {
2358
- display: "flex",
2359
- flexDirection: "column",
2360
- height: "100%"
2261
+ actions: {
2262
+ discard: {
2263
+ label: __10("Discard", "elementor"),
2264
+ action: () => {
2265
+ closeSaveChangesDialog();
2266
+ void onRequestClose();
2267
+ }
2268
+ },
2269
+ confirm: {
2270
+ label: __10("Save", "elementor"),
2271
+ action: async () => {
2272
+ const result = await handleSaveClick();
2273
+ closeSaveChangesDialog();
2274
+ if (result?.success) {
2275
+ void onRequestClose();
2276
+ }
2277
+ }
2278
+ }
2361
2279
  }
2362
- },
2363
- bodyInner
2364
- ), saveFooter);
2365
- const core = /* @__PURE__ */ React14.createElement(React14.Fragment, null, panelChrome, dialogs);
2366
- return embedded ? core : /* @__PURE__ */ React14.createElement(ThemeProvider, null, core);
2280
+ }
2281
+ )));
2367
2282
  }
2368
2283
  var usePreventUnload = (isDirty) => {
2369
2284
  useEffect4(() => {
@@ -2401,9 +2316,7 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
2401
2316
  import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
2402
2317
  import { registerControlReplacement } from "@elementor/editor-controls";
2403
2318
  import { getMCPByDomain } from "@elementor/editor-mcp";
2404
- import { __registerPanel as registerPanel } from "@elementor/editor-panels";
2405
2319
  import { isTransformable as isTransformable2 } from "@elementor/editor-props";
2406
- import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
2407
2320
  import { controlActionsMenu } from "@elementor/menus";
2408
2321
 
2409
2322
  // src/components/global-styles-import-listener.tsx
@@ -2422,79 +2335,12 @@ function GlobalStylesImportListener() {
2422
2335
  return null;
2423
2336
  }
2424
2337
 
2425
- // src/components/open-panel-from-event.tsx
2426
- import { useEffect as useEffect6, useRef as useRef7, useState as useState7 } from "react";
2427
- import {
2428
- __privateListenTo as listenTo,
2429
- __privateOpenRoute as openRoute,
2430
- routeOpenEvent
2431
- } from "@elementor/editor-v1-adapters";
2432
- var EVENT_NAME = "elementor/open-variables-manager";
2433
- var DEFAULT_PANEL_ROUTE = "panel/elements/categories";
2434
- function OpenPanelFromEvent() {
2435
- const { open } = usePanelActions();
2436
- const pendingRef = useRef7(false);
2437
- const [readyToOpen, setReadyToOpen] = useState7(false);
2438
- useEffect6(() => {
2439
- if (readyToOpen) {
2440
- setReadyToOpen(false);
2441
- open();
2442
- }
2443
- }, [readyToOpen, open]);
2444
- useEffect6(() => {
2445
- return listenTo(routeOpenEvent(DEFAULT_PANEL_ROUTE), () => {
2446
- if (pendingRef.current) {
2447
- pendingRef.current = false;
2448
- setReadyToOpen(true);
2449
- }
2450
- });
2451
- }, []);
2452
- useEffect6(() => {
2453
- const handler = () => {
2454
- pendingRef.current = true;
2455
- openRoute(DEFAULT_PANEL_ROUTE);
2456
- };
2457
- window.addEventListener(EVENT_NAME, handler);
2458
- return () => window.removeEventListener(EVENT_NAME, handler);
2459
- }, []);
2460
- return null;
2461
- }
2462
-
2463
- // src/components/open-panel-from-url.tsx
2464
- import { useEffect as useEffect7, useRef as useRef8 } from "react";
2465
- import { __privateListenTo as listenTo2, routeOpenEvent as routeOpenEvent2 } from "@elementor/editor-v1-adapters";
2466
- var ACTIVE_PANEL_PARAM = "active-panel";
2467
- var PANEL_ID = "variables-manager";
2468
- var DEFAULT_PANEL_ROUTE2 = "panel/elements";
2469
- function OpenPanelFromUrl() {
2470
- const { open } = usePanelActions();
2471
- const hasOpened = useRef8(false);
2472
- useEffect7(() => {
2473
- const urlParams = new URLSearchParams(window.location.search);
2474
- const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
2475
- if (activePanel !== PANEL_ID) {
2476
- return;
2477
- }
2478
- const cleanup = listenTo2(routeOpenEvent2(DEFAULT_PANEL_ROUTE2), () => {
2479
- if (hasOpened.current) {
2480
- return;
2481
- }
2482
- hasOpened.current = true;
2483
- requestAnimationFrame(() => {
2484
- open();
2485
- });
2486
- });
2487
- return cleanup;
2488
- }, [open]);
2489
- return null;
2490
- }
2491
-
2492
2338
  // src/controls/variable-control.tsx
2493
2339
  import * as React33 from "react";
2494
2340
  import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
2495
2341
 
2496
2342
  // src/components/ui/variable/assigned-variable.tsx
2497
- import { useId, useRef as useRef9 } from "react";
2343
+ import { useId, useRef as useRef7 } from "react";
2498
2344
  import * as React24 from "react";
2499
2345
  import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
2500
2346
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
@@ -2518,16 +2364,16 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
2518
2364
 
2519
2365
  // src/components/variable-selection-popover.tsx
2520
2366
  import * as React22 from "react";
2521
- import { useState as useState13 } from "react";
2367
+ import { useState as useState12 } from "react";
2522
2368
  import { isExperimentActive } from "@elementor/editor-v1-adapters";
2523
2369
 
2524
2370
  // src/context/variable-selection-popover.context.tsx
2525
2371
  import * as React15 from "react";
2526
- import { createContext as createContext2, useContext as useContext2, useState as useState8 } from "react";
2372
+ import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
2527
2373
  import { Box as Box3 } from "@elementor/ui";
2528
2374
  var PopoverContentRefContext = createContext2(null);
2529
2375
  var PopoverContentRefContextProvider = ({ children }) => {
2530
- const [anchorRef, setAnchorRef] = useState8(null);
2376
+ const [anchorRef, setAnchorRef] = useState7(null);
2531
2377
  return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box3, { ref: setAnchorRef }, children));
2532
2378
  };
2533
2379
  var usePopoverContentRef = () => {
@@ -2536,7 +2382,7 @@ var usePopoverContentRef = () => {
2536
2382
 
2537
2383
  // src/components/variable-creation.tsx
2538
2384
  import * as React17 from "react";
2539
- import { useState as useState9 } from "react";
2385
+ import { useState as useState8 } from "react";
2540
2386
  import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
2541
2387
  import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
2542
2388
  import { ArrowLeftIcon } from "@elementor/icons";
@@ -2586,8 +2432,8 @@ var unwrapValue = (input) => {
2586
2432
  // src/components/ui/form-field.tsx
2587
2433
  import * as React16 from "react";
2588
2434
  import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
2589
- var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
2590
- return /* @__PURE__ */ React16.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(FormHelperText, null, noticeMsg)));
2435
+ var FormField = ({ id, label, errorMsg, noticeMsg, children }) => {
2436
+ return /* @__PURE__ */ React16.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(FormLabel, { htmlFor: id, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(FormHelperText, null, noticeMsg)));
2591
2437
  };
2592
2438
 
2593
2439
  // src/components/variable-creation.tsx
@@ -2597,11 +2443,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2597
2443
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
2598
2444
  const { propType } = useBoundProp4();
2599
2445
  const initialValue = useInitialValue();
2600
- const [value, setValue] = useState9(initialValue);
2601
- const [label, setLabel] = useState9("");
2602
- const [errorMessage, setErrorMessage] = useState9("");
2603
- const [valueFieldError, setValueFieldError] = useState9("");
2604
- const [propTypeKey, setPropTypeKey] = useState9(propTypeUtil.key);
2446
+ const [value, setValue] = useState8(initialValue);
2447
+ const [label, setLabel] = useState8("");
2448
+ const [errorMessage, setErrorMessage] = useState8("");
2449
+ const [valueFieldError, setValueFieldError] = useState8("");
2450
+ const [propTypeKey, setPropTypeKey] = useState8(propTypeUtil.key);
2605
2451
  const { labelFieldError, setLabelFieldError } = useLabelError();
2606
2452
  const resetFields = () => {
2607
2453
  setValue("");
@@ -2722,7 +2568,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2722
2568
 
2723
2569
  // src/components/variable-edit.tsx
2724
2570
  import * as React19 from "react";
2725
- import { useEffect as useEffect8, useState as useState11 } from "react";
2571
+ import { useEffect as useEffect6, useState as useState10 } from "react";
2726
2572
  import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
2727
2573
  import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
2728
2574
  import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
@@ -2732,7 +2578,7 @@ import { __ as __13 } from "@wordpress/i18n";
2732
2578
 
2733
2579
  // src/components/ui/edit-confirmation-dialog.tsx
2734
2580
  import * as React18 from "react";
2735
- import { useState as useState10 } from "react";
2581
+ import { useState as useState9 } from "react";
2736
2582
  import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
2737
2583
  import {
2738
2584
  Button as Button4,
@@ -2752,7 +2598,7 @@ var EditConfirmationDialog = ({
2752
2598
  onConfirm,
2753
2599
  onSuppressMessage
2754
2600
  }) => {
2755
- const [dontShowAgain, setDontShowAgain] = useState10(false);
2601
+ const [dontShowAgain, setDontShowAgain] = useState9(false);
2756
2602
  const handleSave = () => {
2757
2603
  if (dontShowAgain) {
2758
2604
  onSuppressMessage?.();
@@ -2786,20 +2632,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2786
2632
  const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
2787
2633
  const { propType } = useBoundProp5();
2788
2634
  const [isMessageSuppressed, suppressMessage] = useSuppressedMessage2(EDIT_CONFIRMATION_DIALOG_ID);
2789
- const [deleteConfirmation, setDeleteConfirmation] = useState11(false);
2790
- const [editConfirmation, setEditConfirmation] = useState11(false);
2791
- const [errorMessage, setErrorMessage] = useState11("");
2792
- const [valueFieldError, setValueFieldError] = useState11("");
2635
+ const [deleteConfirmation, setDeleteConfirmation] = useState10(false);
2636
+ const [editConfirmation, setEditConfirmation] = useState10(false);
2637
+ const [errorMessage, setErrorMessage] = useState10("");
2638
+ const [valueFieldError, setValueFieldError] = useState10("");
2793
2639
  const { labelFieldError, setLabelFieldError } = useLabelError();
2794
2640
  const variable = useVariable(editId);
2795
- const [propTypeKey, setPropTypeKey] = useState11(variable?.type ?? propTypeUtil.key);
2641
+ const [propTypeKey, setPropTypeKey] = useState10(variable?.type ?? propTypeUtil.key);
2796
2642
  if (!variable) {
2797
2643
  throw new Error(`Global ${variableType} variable not found`);
2798
2644
  }
2799
2645
  const userPermissions = usePermissions();
2800
- const [value, setValue] = useState11(() => variable.value);
2801
- const [label, setLabel] = useState11(() => variable.label);
2802
- useEffect8(() => {
2646
+ const [value, setValue] = useState10(() => variable.value);
2647
+ const [label, setLabel] = useState10(() => variable.label);
2648
+ useEffect6(() => {
2803
2649
  styleVariablesRepository.update({
2804
2650
  [editId]: {
2805
2651
  ...variable,
@@ -2964,7 +2810,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2964
2810
  };
2965
2811
 
2966
2812
  // src/components/variables-selection.tsx
2967
- import { useEffect as useEffect9, useState as useState12 } from "react";
2813
+ import { useEffect as useEffect7, useState as useState11 } from "react";
2968
2814
  import * as React21 from "react";
2969
2815
  import { trackUpgradePromotionClick as trackUpgradePromotionClick2, trackViewPromotion as trackViewPromotion2 } from "@elementor/editor-controls";
2970
2816
  import {
@@ -3077,7 +2923,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
3077
2923
  var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
3078
2924
  const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
3079
2925
  const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
3080
- const [searchValue, setSearchValue] = useState12("");
2926
+ const [searchValue, setSearchValue] = useState11("");
3081
2927
  const {
3082
2928
  list: variables,
3083
2929
  hasMatches: hasSearchResults,
@@ -3154,7 +3000,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
3154
3000
  const handleClearSearch = () => {
3155
3001
  setSearchValue("");
3156
3002
  };
3157
- useEffect9(() => {
3003
+ useEffect7(() => {
3158
3004
  if (disabled) {
3159
3005
  trackViewPromotion2({
3160
3006
  target_name: "variables_popover",
@@ -3262,17 +3108,12 @@ var VIEW_LIST = "list";
3262
3108
  var VIEW_ADD = "add";
3263
3109
  var VIEW_EDIT = "edit";
3264
3110
  var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
3265
- const [currentView, setCurrentView] = useState13(VIEW_LIST);
3266
- const [editId, setEditId] = useState13("");
3267
- const { open: openStandaloneVariablesPanel } = usePanelActions();
3111
+ const [currentView, setCurrentView] = useState12(VIEW_LIST);
3112
+ const [editId, setEditId] = useState12("");
3268
3113
  const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
3269
- if (isExperimentActive("e_editor_design_system_panel")) {
3270
- window.dispatchEvent(
3271
- new CustomEvent("elementor/toggle-design-system", { detail: { tab: "variables" } })
3272
- );
3273
- } else {
3274
- openStandaloneVariablesPanel();
3275
- }
3114
+ window.dispatchEvent(
3115
+ new CustomEvent("elementor/toggle-design-system", { detail: { tab: "variables" } })
3116
+ );
3276
3117
  } : void 0;
3277
3118
  return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
3278
3119
  propTypeKey,
@@ -3380,7 +3221,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
3380
3221
  var AssignedVariable = ({ variable, propTypeKey }) => {
3381
3222
  const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
3382
3223
  const { setValue } = useBoundProp6();
3383
- const anchorRef = useRef9(null);
3224
+ const anchorRef = useRef7(null);
3384
3225
  const popupId = useId();
3385
3226
  const popupState = usePopupState3({
3386
3227
  variant: "popover",
@@ -3421,14 +3262,14 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
3421
3262
 
3422
3263
  // src/components/ui/variable/deleted-variable.tsx
3423
3264
  import * as React28 from "react";
3424
- import { useId as useId2, useRef as useRef10, useState as useState15 } from "react";
3265
+ import { useId as useId2, useRef as useRef8, useState as useState14 } from "react";
3425
3266
  import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
3426
3267
  import { Backdrop, bindPopover as bindPopover2, Box as Box8, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
3427
3268
  import { __ as __19 } from "@wordpress/i18n";
3428
3269
 
3429
3270
  // src/components/variable-restore.tsx
3430
3271
  import * as React25 from "react";
3431
- import { useState as useState14 } from "react";
3272
+ import { useState as useState13 } from "react";
3432
3273
  import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
3433
3274
  import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
3434
3275
  import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
@@ -3442,11 +3283,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
3442
3283
  if (!variable) {
3443
3284
  throw new Error(`Global ${variableType} variable not found`);
3444
3285
  }
3445
- const [errorMessage, setErrorMessage] = useState14("");
3446
- const [valueFieldError, setValueFieldError] = useState14("");
3447
- const [label, setLabel] = useState14(variable.label);
3448
- const [value, setValue] = useState14(variable.value);
3449
- const [propTypeKey, setPropTypeKey] = useState14(variable?.type ?? propTypeUtil.key);
3286
+ const [errorMessage, setErrorMessage] = useState13("");
3287
+ const [valueFieldError, setValueFieldError] = useState13("");
3288
+ const [label, setLabel] = useState13(variable.label);
3289
+ const [value, setValue] = useState13(variable.value);
3290
+ const [propTypeKey, setPropTypeKey] = useState13(variable?.type ?? propTypeUtil.key);
3450
3291
  const { labelFieldError, setLabelFieldError } = useLabelError({
3451
3292
  value: variable.label,
3452
3293
  message: ERROR_MESSAGES.DUPLICATED_LABEL
@@ -3603,10 +3444,10 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3603
3444
  const { propTypeUtil } = getVariableType(propTypeKey);
3604
3445
  const boundProp = useBoundProp8();
3605
3446
  const userPermissions = usePermissions();
3606
- const [showInfotip, setShowInfotip] = useState15(false);
3447
+ const [showInfotip, setShowInfotip] = useState14(false);
3607
3448
  const toggleInfotip = () => setShowInfotip((prev) => !prev);
3608
3449
  const closeInfotip = () => setShowInfotip(false);
3609
- const deletedChipAnchorRef = useRef10(null);
3450
+ const deletedChipAnchorRef = useRef8(null);
3610
3451
  const popupId = useId2();
3611
3452
  const popupState = usePopupState4({
3612
3453
  variant: "popover",
@@ -3621,8 +3462,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3621
3462
  if (!variable.key) {
3622
3463
  return;
3623
3464
  }
3624
- restoreVariable(variable.key).then((id2) => {
3625
- resolveBoundPropAndSetValue(propTypeUtil.create(id2), boundProp);
3465
+ restoreVariable(variable.key).then((id) => {
3466
+ resolveBoundPropAndSetValue(propTypeUtil.create(id), boundProp);
3626
3467
  closeInfotip();
3627
3468
  }).catch(() => {
3628
3469
  closeInfotip();
@@ -3694,7 +3535,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3694
3535
 
3695
3536
  // src/components/ui/variable/mismatch-variable.tsx
3696
3537
  import * as React30 from "react";
3697
- import { useId as useId3, useRef as useRef11, useState as useState16 } from "react";
3538
+ import { useId as useId3, useRef as useRef9, useState as useState15 } from "react";
3698
3539
  import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
3699
3540
  import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box9, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
3700
3541
  import { __ as __21 } from "@wordpress/i18n";
@@ -3732,13 +3573,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
3732
3573
  // src/components/ui/variable/mismatch-variable.tsx
3733
3574
  var MismatchVariable = ({ variable }) => {
3734
3575
  const { setValue, value } = useBoundProp9();
3735
- const anchorRef = useRef11(null);
3576
+ const anchorRef = useRef9(null);
3736
3577
  const popupId = useId3();
3737
3578
  const popupState = usePopupState5({
3738
3579
  variant: "popover",
3739
3580
  popupId: `elementor-variables-list-${popupId}`
3740
3581
  });
3741
- const [infotipVisible, setInfotipVisible] = useState16(false);
3582
+ const [infotipVisible, setInfotipVisible] = useState15(false);
3742
3583
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3743
3584
  const closeInfotip = () => setInfotipVisible(false);
3744
3585
  const triggerSelect = () => {
@@ -3811,7 +3652,7 @@ var MismatchVariable = ({ variable }) => {
3811
3652
 
3812
3653
  // src/components/ui/variable/missing-variable.tsx
3813
3654
  import * as React32 from "react";
3814
- import { useState as useState17 } from "react";
3655
+ import { useState as useState16 } from "react";
3815
3656
  import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
3816
3657
  import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
3817
3658
  import { __ as __23 } from "@wordpress/i18n";
@@ -3841,7 +3682,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
3841
3682
  // src/components/ui/variable/missing-variable.tsx
3842
3683
  var MissingVariable = () => {
3843
3684
  const { setValue } = useBoundProp10();
3844
- const [infotipVisible, setInfotipVisible] = useState17(false);
3685
+ const [infotipVisible, setInfotipVisible] = useState16(false);
3845
3686
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3846
3687
  const closeInfotip = () => setInfotipVisible(false);
3847
3688
  const clearValue = () => setValue(null);
@@ -4011,13 +3852,13 @@ Delete a variable:
4011
3852
  };
4012
3853
 
4013
3854
  // src/mcp/variables-resource.ts
4014
- import { __privateListenTo as listenTo3, commandEndEvent } from "@elementor/editor-v1-adapters";
3855
+ import { __privateListenTo as listenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
4015
3856
  var GLOBAL_VARIABLES_URI = "elementor://global-variables";
4016
3857
  var buildGlobalVariablesPayload = async () => {
4017
3858
  const merged = {};
4018
- Object.entries(service.variables()).forEach(([id2, variable]) => {
3859
+ Object.entries(service.variables()).forEach(([id, variable]) => {
4019
3860
  if (!variable.deleted) {
4020
- merged[id2] = { ...variable, version: "v4" };
3861
+ merged[id] = { ...variable, version: "v4" };
4021
3862
  }
4022
3863
  });
4023
3864
  return merged;
@@ -4046,7 +3887,7 @@ var initVariablesResource = (variablesMcpEntry, canvasMcpEntry) => {
4046
3887
  }
4047
3888
  );
4048
3889
  window.addEventListener(STORAGE_UPDATED_EVENT, notifyGlobalVariablesUpdated);
4049
- listenTo3(commandEndEvent("document/save/update"), notifyGlobalVariablesUpdated);
3890
+ listenTo(commandEndEvent("document/save/update"), notifyGlobalVariablesUpdated);
4050
3891
  });
4051
3892
  };
4052
3893
 
@@ -4141,28 +3982,28 @@ function getServiceActions(svc) {
4141
3982
  }
4142
3983
  return svc.create({ type, label, value });
4143
3984
  },
4144
- update({ id: id2, label, value }) {
4145
- if (!id2 || !label || !value) {
3985
+ update({ id, label, value }) {
3986
+ if (!id || !label || !value) {
4146
3987
  throw new Error("Update requires id, label, and value");
4147
3988
  }
4148
3989
  const labelError = validateLabel(label);
4149
3990
  if (labelError) {
4150
3991
  throw new Error(labelError);
4151
3992
  }
4152
- const existingVariable = svc.variables()[id2];
3993
+ const existingVariable = svc.variables()[id];
4153
3994
  if (existingVariable) {
4154
3995
  const valueError = validateValueForType(existingVariable.type, value);
4155
3996
  if (valueError) {
4156
3997
  throw new Error(valueError);
4157
3998
  }
4158
3999
  }
4159
- return svc.update(id2, { label, value });
4000
+ return svc.update(id, { label, value });
4160
4001
  },
4161
- delete({ id: id2 }) {
4162
- if (!id2) {
4002
+ delete({ id }) {
4003
+ if (!id) {
4163
4004
  throw new Error("delete requires id");
4164
4005
  }
4165
- return svc.delete(id2);
4006
+ return svc.delete(id);
4166
4007
  }
4167
4008
  };
4168
4009
  }
@@ -4183,12 +4024,12 @@ import { __ as __26 } from "@wordpress/i18n";
4183
4024
 
4184
4025
  // src/components/fields/color-field.tsx
4185
4026
  import * as React35 from "react";
4186
- import { useRef as useRef12, useState as useState18 } from "react";
4027
+ import { useRef as useRef10, useState as useState17 } from "react";
4187
4028
  import { UnstableColorField } from "@elementor/ui";
4188
4029
  var ColorField = ({ value, onChange, onValidationChange }) => {
4189
- const [color, setColor] = useState18(value);
4190
- const [errorMessage, setErrorMessage] = useState18("");
4191
- const defaultRef = useRef12(null);
4030
+ const [color, setColor] = useState17(value);
4031
+ const [errorMessage, setErrorMessage] = useState17("");
4032
+ const defaultRef = useRef10(null);
4192
4033
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
4193
4034
  const handleChange = (newValue) => {
4194
4035
  setColor(newValue);
@@ -4227,20 +4068,20 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
4227
4068
 
4228
4069
  // src/components/fields/font-field.tsx
4229
4070
  import * as React36 from "react";
4230
- import { useId as useId4, useMemo as useMemo4, useRef as useRef13, useState as useState19 } from "react";
4071
+ import { useId as useId4, useMemo as useMemo3, useRef as useRef11, useState as useState18 } from "react";
4231
4072
  import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
4232
4073
  import { useSectionWidth } from "@elementor/editor-ui";
4233
4074
  import { ChevronDownIcon, TextIcon } from "@elementor/icons";
4234
4075
  import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
4235
4076
  import { __ as __25 } from "@wordpress/i18n";
4236
4077
  var FontField = ({ value, onChange, onValidationChange }) => {
4237
- const [fontFamily, setFontFamily] = useState19(value);
4238
- const defaultRef = useRef13(null);
4078
+ const [fontFamily, setFontFamily] = useState18(value);
4079
+ const defaultRef = useRef11(null);
4239
4080
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
4240
4081
  const fontPopoverState = usePopupState6({ variant: "popover" });
4241
4082
  const fontFamilies = useFontFamilies();
4242
4083
  const sectionWidth = useSectionWidth();
4243
- const mapFontSubs = useMemo4(() => {
4084
+ const mapFontSubs = useMemo3(() => {
4244
4085
  return fontFamilies.map(({ label, fonts }) => ({
4245
4086
  label,
4246
4087
  items: fonts
@@ -4256,11 +4097,11 @@ var FontField = ({ value, onChange, onValidationChange }) => {
4256
4097
  handleChange(newFontFamily);
4257
4098
  fontPopoverState.close();
4258
4099
  };
4259
- const id2 = useId4();
4100
+ const id = useId4();
4260
4101
  return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
4261
4102
  UnstableTag,
4262
4103
  {
4263
- id: id2,
4104
+ id,
4264
4105
  variant: "outlined",
4265
4106
  label: fontFamily,
4266
4107
  endIcon: /* @__PURE__ */ React36.createElement(ChevronDownIcon, { fontSize: "tiny" }),
@@ -4376,7 +4217,7 @@ function registerVariableTypes() {
4376
4217
 
4377
4218
  // src/renderers/style-variables-renderer.tsx
4378
4219
  import * as React38 from "react";
4379
- import { useEffect as useEffect10, useState as useState20 } from "react";
4220
+ import { useEffect as useEffect8, useState as useState19 } from "react";
4380
4221
  import {
4381
4222
  __privateUseListenTo as useListenTo,
4382
4223
  commandEndEvent as commandEndEvent2,
@@ -4399,8 +4240,8 @@ function usePortalContainer() {
4399
4240
  return useListenTo(commandEndEvent2("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
4400
4241
  }
4401
4242
  function useStyleVariables() {
4402
- const [variables, setVariables] = useState20({});
4403
- useEffect10(() => {
4243
+ const [variables, setVariables] = useState19({});
4244
+ useEffect8(() => {
4404
4245
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
4405
4246
  return () => {
4406
4247
  unsubscribe();
@@ -4714,17 +4555,6 @@ function init() {
4714
4555
  id: "variables-import-listener",
4715
4556
  component: GlobalStylesImportListener
4716
4557
  });
4717
- if (!isExperimentActive2("e_editor_design_system_panel")) {
4718
- injectIntoLogic({
4719
- id: "variables-open-panel-from-url",
4720
- component: OpenPanelFromUrl
4721
- });
4722
- injectIntoLogic({
4723
- id: "variables-open-panel-from-event",
4724
- component: OpenPanelFromEvent
4725
- });
4726
- registerPanel(panel);
4727
- }
4728
4558
  }
4729
4559
  function hasVariableAssigned(value) {
4730
4560
  if (isTransformable2(value)) {