@elementor/editor-variables 4.2.0-879 → 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.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
  };
@@ -1413,7 +1394,7 @@ var LabelField = ({
1413
1394
  value,
1414
1395
  error,
1415
1396
  onChange,
1416
- id: id2,
1397
+ id,
1417
1398
  onErrorChange,
1418
1399
  size = "tiny",
1419
1400
  focusOnShow = false,
@@ -1441,7 +1422,7 @@ var LabelField = ({
1441
1422
  TextField,
1442
1423
  {
1443
1424
  ref: fieldRef,
1444
- id: id2,
1425
+ id,
1445
1426
  size,
1446
1427
  fullWidth: true,
1447
1428
  value: label,
@@ -1862,22 +1843,22 @@ var VariablesManagerTable = ({
1862
1843
  }
1863
1844
  }
1864
1845
  }, [autoEditVariableId]);
1865
- const handleRowRef = (id2) => (ref) => {
1846
+ const handleRowRef = (id) => (ref) => {
1866
1847
  if (ref) {
1867
- variableRowRefs.current.set(id2, ref);
1848
+ variableRowRefs.current.set(id, ref);
1868
1849
  } else {
1869
- variableRowRefs.current.delete(id2);
1850
+ variableRowRefs.current.delete(id);
1870
1851
  }
1871
1852
  };
1872
1853
  const ids = Object.keys(variables).sort(sortVariablesOrder(variables));
1873
- const rows = ids.map((id2) => {
1874
- const variable = variables[id2];
1854
+ const rows = ids.map((id) => {
1855
+ const variable = variables[id];
1875
1856
  const variableType = getVariableType(variable.type);
1876
1857
  if (!variableType) {
1877
1858
  return null;
1878
1859
  }
1879
1860
  return {
1880
- id: id2,
1861
+ id,
1881
1862
  type: variable.type,
1882
1863
  name: variable.label,
1883
1864
  value: variable.value,
@@ -1890,12 +1871,12 @@ var VariablesManagerTable = ({
1890
1871
  };
1891
1872
  const handleReorder = (newIds) => {
1892
1873
  const updatedVariables = { ...variables };
1893
- newIds.forEach((id2, index) => {
1894
- const current = updatedVariables[id2];
1874
+ newIds.forEach((id, index) => {
1875
+ const current = updatedVariables[id];
1895
1876
  if (!current) {
1896
1877
  return;
1897
1878
  }
1898
- updatedVariables[id2] = Object.assign({}, current, { order: index + 1 });
1879
+ updatedVariables[id] = Object.assign({}, current, { order: index + 1 });
1899
1880
  });
1900
1881
  handleOnChange(updatedVariables);
1901
1882
  };
@@ -1940,47 +1921,14 @@ function sortVariablesOrder(variables) {
1940
1921
  }
1941
1922
 
1942
1923
  // src/components/variables-manager/variables-manager-panel.tsx
1943
- var id = "variables-manager";
1944
1924
  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
1925
  function VariablesManagerPanelEmbedded({
1958
1926
  onRequestClose,
1959
1927
  onExposeCloseAttempt
1960
1928
  }) {
1961
- return /* @__PURE__ */ React14.createElement(
1962
- VariablesManagerPanelRoot,
1963
- {
1964
- embedded: true,
1965
- onRequestClose,
1966
- onExposeCloseAttempt
1967
- }
1968
- );
1969
- }
1970
- function VariablesManagerPanel() {
1971
- return /* @__PURE__ */ React14.createElement(VariablesManagerPanelRoot, null);
1929
+ return /* @__PURE__ */ React14.createElement(VariablesManagerPanelContent, { onRequestClose, onExposeCloseAttempt });
1972
1930
  }
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
- );
1931
+ function VariablesManagerPanelContent({ onRequestClose, onExposeCloseAttempt }) {
1984
1932
  const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
1985
1933
  const [isStopSyncSuppressed] = useSuppressedMessage(STOP_SYNC_MESSAGE_KEY);
1986
1934
  const createMenuState = usePopupState2({
@@ -2014,15 +1962,15 @@ function VariablesManagerPanelRoot({
2014
1962
  openSaveChangesDialog();
2015
1963
  return;
2016
1964
  }
2017
- void closePanel();
2018
- }, [isDirty, openSaveChangesDialog, closePanel]);
1965
+ void onRequestClose();
1966
+ }, [isDirty, openSaveChangesDialog, onRequestClose]);
2019
1967
  useEffect4(() => {
2020
- if (!embedded || !onExposeCloseAttempt) {
1968
+ if (!onExposeCloseAttempt) {
2021
1969
  return;
2022
1970
  }
2023
1971
  onExposeCloseAttempt(() => handleClosePanel());
2024
1972
  return () => onExposeCloseAttempt(null);
2025
- }, [embedded, onExposeCloseAttempt, handleClosePanel]);
1973
+ }, [onExposeCloseAttempt, handleClosePanel]);
2026
1974
  const handleCreateVariable = useCallback6(
2027
1975
  (type, defaultName, defaultValue) => {
2028
1976
  const newId = createVariable2(type, defaultName, defaultValue);
@@ -2140,144 +2088,7 @@ function VariablesManagerPanelRoot({
2140
2088
  [variables, handleStartSync, handleStopSync, duplicateVariable, startAutoEdit]
2141
2089
  );
2142
2090
  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(
2091
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
2281
2092
  Stack6,
2282
2093
  {
2283
2094
  direction: "column",
@@ -2302,7 +2113,23 @@ function VariablesManagerPanelRoot({
2302
2113
  pb: 1
2303
2114
  }
2304
2115
  },
2305
- searchField,
2116
+ /* @__PURE__ */ React14.createElement(
2117
+ SearchField,
2118
+ {
2119
+ placeholder: __10("Search", "elementor"),
2120
+ value: searchValue,
2121
+ onSearch: handleSearch,
2122
+ sx: {
2123
+ flex: 1,
2124
+ minWidth: 0,
2125
+ px: 0,
2126
+ py: 0,
2127
+ display: "flex",
2128
+ alignItems: "center",
2129
+ alignSelf: "stretch"
2130
+ }
2131
+ }
2132
+ ),
2306
2133
  /* @__PURE__ */ React14.createElement(Box2, { sx: { display: "flex", flexShrink: 0, alignItems: "center" } }, /* @__PURE__ */ React14.createElement(
2307
2134
  VariableManagerCreateMenu,
2308
2135
  {
@@ -2324,46 +2151,125 @@ function VariablesManagerPanelRoot({
2324
2151
  minHeight: 0
2325
2152
  }
2326
2153
  },
2327
- bodyInner
2154
+ hasVariables && /* @__PURE__ */ React14.createElement(
2155
+ VariablesManagerTable,
2156
+ {
2157
+ menuActions: buildMenuActions,
2158
+ variables,
2159
+ onChange: handleOnChange,
2160
+ autoEditVariableId,
2161
+ onAutoEditComplete: handleAutoEditComplete,
2162
+ onFieldError: setIsSaveDisabled
2163
+ }
2164
+ ),
2165
+ !hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
2166
+ NoSearchResults,
2167
+ {
2168
+ searchValue,
2169
+ onClear: () => handleSearch(""),
2170
+ icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
2171
+ }
2172
+ ),
2173
+ !hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
2174
+ EmptyState,
2175
+ {
2176
+ title: __10("Create your first variable", "elementor"),
2177
+ message: __10(
2178
+ "Variables are saved attributes that you can apply anywhere on your site.",
2179
+ "elementor"
2180
+ ),
2181
+ icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
2182
+ onAdd: createMenuState.open
2183
+ }
2184
+ )
2328
2185
  ),
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,
2339
- {
2340
- onCreate: handleCreateVariable,
2341
- variables,
2342
- menuState: createMenuState
2343
- }
2344
- ), /* @__PURE__ */ React14.createElement(
2345
- CloseButton,
2186
+ /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
2187
+ Infotip,
2346
2188
  {
2347
- "aria-label": "Close",
2348
- slotProps: { icon: { fontSize: SIZE } },
2349
- onClick: () => {
2350
- handleClosePanel();
2189
+ placement: "right",
2190
+ open: !!serverError,
2191
+ content: serverError ? /* @__PURE__ */ React14.createElement(
2192
+ Alert,
2193
+ {
2194
+ severity: serverError.severity ?? "error",
2195
+ action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
2196
+ onClose: !serverError.action?.label ? () => {
2197
+ setServerError(null);
2198
+ setIsSaveDisabled(false);
2199
+ } : void 0,
2200
+ icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
2201
+ },
2202
+ /* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
2203
+ serverError.action?.message
2204
+ ) : null,
2205
+ arrow: false,
2206
+ slotProps: {
2207
+ popper: {
2208
+ modifiers: [
2209
+ {
2210
+ name: "offset",
2211
+ options: { offset: [-10, 10] }
2212
+ }
2213
+ ]
2214
+ }
2351
2215
  }
2216
+ },
2217
+ /* @__PURE__ */ React14.createElement(
2218
+ Button2,
2219
+ {
2220
+ fullWidth: true,
2221
+ size: "small",
2222
+ color: "global",
2223
+ variant: "contained",
2224
+ disabled: isSaveDisabled || !isDirty || isSaving,
2225
+ onClick: handleSaveClick,
2226
+ loading: isSaving
2227
+ },
2228
+ __10("Save changes", "elementor")
2229
+ )
2230
+ ))
2231
+ ), deleteConfirmation && /* @__PURE__ */ React14.createElement(
2232
+ DeleteConfirmationDialog,
2233
+ {
2234
+ open: true,
2235
+ label: deleteConfirmation.label,
2236
+ onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
2237
+ closeDialog: () => setDeleteConfirmation(null)
2238
+ }
2239
+ ), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
2240
+ StopSyncConfirmationDialog,
2241
+ {
2242
+ open: true,
2243
+ onClose: () => setStopSyncConfirmation(null),
2244
+ onConfirm: () => {
2245
+ commitStopSync(stopSyncConfirmation);
2246
+ setStopSyncConfirmation(null);
2352
2247
  }
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,
2248
+ }
2249
+ ), 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(
2250
+ SaveChangesDialog.Actions,
2356
2251
  {
2357
- sx: {
2358
- display: "flex",
2359
- flexDirection: "column",
2360
- height: "100%"
2252
+ actions: {
2253
+ discard: {
2254
+ label: __10("Discard", "elementor"),
2255
+ action: () => {
2256
+ closeSaveChangesDialog();
2257
+ void onRequestClose();
2258
+ }
2259
+ },
2260
+ confirm: {
2261
+ label: __10("Save", "elementor"),
2262
+ action: async () => {
2263
+ const result = await handleSaveClick();
2264
+ closeSaveChangesDialog();
2265
+ if (result?.success) {
2266
+ void onRequestClose();
2267
+ }
2268
+ }
2269
+ }
2361
2270
  }
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);
2271
+ }
2272
+ )));
2367
2273
  }
2368
2274
  var usePreventUnload = (isDirty) => {
2369
2275
  useEffect4(() => {
@@ -2401,9 +2307,7 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
2401
2307
  import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
2402
2308
  import { registerControlReplacement } from "@elementor/editor-controls";
2403
2309
  import { getMCPByDomain } from "@elementor/editor-mcp";
2404
- import { __registerPanel as registerPanel } from "@elementor/editor-panels";
2405
2310
  import { isTransformable as isTransformable2 } from "@elementor/editor-props";
2406
- import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
2407
2311
  import { controlActionsMenu } from "@elementor/menus";
2408
2312
 
2409
2313
  // src/components/global-styles-import-listener.tsx
@@ -2422,79 +2326,12 @@ function GlobalStylesImportListener() {
2422
2326
  return null;
2423
2327
  }
2424
2328
 
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
2329
  // src/controls/variable-control.tsx
2493
2330
  import * as React33 from "react";
2494
2331
  import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
2495
2332
 
2496
2333
  // src/components/ui/variable/assigned-variable.tsx
2497
- import { useId, useRef as useRef9 } from "react";
2334
+ import { useId, useRef as useRef7 } from "react";
2498
2335
  import * as React24 from "react";
2499
2336
  import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
2500
2337
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
@@ -2518,16 +2355,16 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
2518
2355
 
2519
2356
  // src/components/variable-selection-popover.tsx
2520
2357
  import * as React22 from "react";
2521
- import { useState as useState13 } from "react";
2358
+ import { useState as useState12 } from "react";
2522
2359
  import { isExperimentActive } from "@elementor/editor-v1-adapters";
2523
2360
 
2524
2361
  // src/context/variable-selection-popover.context.tsx
2525
2362
  import * as React15 from "react";
2526
- import { createContext as createContext2, useContext as useContext2, useState as useState8 } from "react";
2363
+ import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
2527
2364
  import { Box as Box3 } from "@elementor/ui";
2528
2365
  var PopoverContentRefContext = createContext2(null);
2529
2366
  var PopoverContentRefContextProvider = ({ children }) => {
2530
- const [anchorRef, setAnchorRef] = useState8(null);
2367
+ const [anchorRef, setAnchorRef] = useState7(null);
2531
2368
  return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box3, { ref: setAnchorRef }, children));
2532
2369
  };
2533
2370
  var usePopoverContentRef = () => {
@@ -2536,7 +2373,7 @@ var usePopoverContentRef = () => {
2536
2373
 
2537
2374
  // src/components/variable-creation.tsx
2538
2375
  import * as React17 from "react";
2539
- import { useState as useState9 } from "react";
2376
+ import { useState as useState8 } from "react";
2540
2377
  import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
2541
2378
  import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
2542
2379
  import { ArrowLeftIcon } from "@elementor/icons";
@@ -2586,8 +2423,8 @@ var unwrapValue = (input) => {
2586
2423
  // src/components/ui/form-field.tsx
2587
2424
  import * as React16 from "react";
2588
2425
  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)));
2426
+ var FormField = ({ id, label, errorMsg, noticeMsg, children }) => {
2427
+ 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
2428
  };
2592
2429
 
2593
2430
  // src/components/variable-creation.tsx
@@ -2597,11 +2434,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2597
2434
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
2598
2435
  const { propType } = useBoundProp4();
2599
2436
  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);
2437
+ const [value, setValue] = useState8(initialValue);
2438
+ const [label, setLabel] = useState8("");
2439
+ const [errorMessage, setErrorMessage] = useState8("");
2440
+ const [valueFieldError, setValueFieldError] = useState8("");
2441
+ const [propTypeKey, setPropTypeKey] = useState8(propTypeUtil.key);
2605
2442
  const { labelFieldError, setLabelFieldError } = useLabelError();
2606
2443
  const resetFields = () => {
2607
2444
  setValue("");
@@ -2722,7 +2559,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2722
2559
 
2723
2560
  // src/components/variable-edit.tsx
2724
2561
  import * as React19 from "react";
2725
- import { useEffect as useEffect8, useState as useState11 } from "react";
2562
+ import { useEffect as useEffect6, useState as useState10 } from "react";
2726
2563
  import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
2727
2564
  import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
2728
2565
  import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
@@ -2732,7 +2569,7 @@ import { __ as __13 } from "@wordpress/i18n";
2732
2569
 
2733
2570
  // src/components/ui/edit-confirmation-dialog.tsx
2734
2571
  import * as React18 from "react";
2735
- import { useState as useState10 } from "react";
2572
+ import { useState as useState9 } from "react";
2736
2573
  import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
2737
2574
  import {
2738
2575
  Button as Button4,
@@ -2752,7 +2589,7 @@ var EditConfirmationDialog = ({
2752
2589
  onConfirm,
2753
2590
  onSuppressMessage
2754
2591
  }) => {
2755
- const [dontShowAgain, setDontShowAgain] = useState10(false);
2592
+ const [dontShowAgain, setDontShowAgain] = useState9(false);
2756
2593
  const handleSave = () => {
2757
2594
  if (dontShowAgain) {
2758
2595
  onSuppressMessage?.();
@@ -2786,20 +2623,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2786
2623
  const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
2787
2624
  const { propType } = useBoundProp5();
2788
2625
  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("");
2626
+ const [deleteConfirmation, setDeleteConfirmation] = useState10(false);
2627
+ const [editConfirmation, setEditConfirmation] = useState10(false);
2628
+ const [errorMessage, setErrorMessage] = useState10("");
2629
+ const [valueFieldError, setValueFieldError] = useState10("");
2793
2630
  const { labelFieldError, setLabelFieldError } = useLabelError();
2794
2631
  const variable = useVariable(editId);
2795
- const [propTypeKey, setPropTypeKey] = useState11(variable?.type ?? propTypeUtil.key);
2632
+ const [propTypeKey, setPropTypeKey] = useState10(variable?.type ?? propTypeUtil.key);
2796
2633
  if (!variable) {
2797
2634
  throw new Error(`Global ${variableType} variable not found`);
2798
2635
  }
2799
2636
  const userPermissions = usePermissions();
2800
- const [value, setValue] = useState11(() => variable.value);
2801
- const [label, setLabel] = useState11(() => variable.label);
2802
- useEffect8(() => {
2637
+ const [value, setValue] = useState10(() => variable.value);
2638
+ const [label, setLabel] = useState10(() => variable.label);
2639
+ useEffect6(() => {
2803
2640
  styleVariablesRepository.update({
2804
2641
  [editId]: {
2805
2642
  ...variable,
@@ -2964,7 +2801,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2964
2801
  };
2965
2802
 
2966
2803
  // src/components/variables-selection.tsx
2967
- import { useEffect as useEffect9, useState as useState12 } from "react";
2804
+ import { useEffect as useEffect7, useState as useState11 } from "react";
2968
2805
  import * as React21 from "react";
2969
2806
  import { trackUpgradePromotionClick as trackUpgradePromotionClick2, trackViewPromotion as trackViewPromotion2 } from "@elementor/editor-controls";
2970
2807
  import {
@@ -3077,7 +2914,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
3077
2914
  var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
3078
2915
  const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
3079
2916
  const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
3080
- const [searchValue, setSearchValue] = useState12("");
2917
+ const [searchValue, setSearchValue] = useState11("");
3081
2918
  const {
3082
2919
  list: variables,
3083
2920
  hasMatches: hasSearchResults,
@@ -3154,7 +2991,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
3154
2991
  const handleClearSearch = () => {
3155
2992
  setSearchValue("");
3156
2993
  };
3157
- useEffect9(() => {
2994
+ useEffect7(() => {
3158
2995
  if (disabled) {
3159
2996
  trackViewPromotion2({
3160
2997
  target_name: "variables_popover",
@@ -3262,17 +3099,12 @@ var VIEW_LIST = "list";
3262
3099
  var VIEW_ADD = "add";
3263
3100
  var VIEW_EDIT = "edit";
3264
3101
  var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
3265
- const [currentView, setCurrentView] = useState13(VIEW_LIST);
3266
- const [editId, setEditId] = useState13("");
3267
- const { open: openStandaloneVariablesPanel } = usePanelActions();
3102
+ const [currentView, setCurrentView] = useState12(VIEW_LIST);
3103
+ const [editId, setEditId] = useState12("");
3268
3104
  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
- }
3105
+ window.dispatchEvent(
3106
+ new CustomEvent("elementor/toggle-design-system", { detail: { tab: "variables" } })
3107
+ );
3276
3108
  } : void 0;
3277
3109
  return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
3278
3110
  propTypeKey,
@@ -3380,7 +3212,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
3380
3212
  var AssignedVariable = ({ variable, propTypeKey }) => {
3381
3213
  const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
3382
3214
  const { setValue } = useBoundProp6();
3383
- const anchorRef = useRef9(null);
3215
+ const anchorRef = useRef7(null);
3384
3216
  const popupId = useId();
3385
3217
  const popupState = usePopupState3({
3386
3218
  variant: "popover",
@@ -3421,14 +3253,14 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
3421
3253
 
3422
3254
  // src/components/ui/variable/deleted-variable.tsx
3423
3255
  import * as React28 from "react";
3424
- import { useId as useId2, useRef as useRef10, useState as useState15 } from "react";
3256
+ import { useId as useId2, useRef as useRef8, useState as useState14 } from "react";
3425
3257
  import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
3426
3258
  import { Backdrop, bindPopover as bindPopover2, Box as Box8, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
3427
3259
  import { __ as __19 } from "@wordpress/i18n";
3428
3260
 
3429
3261
  // src/components/variable-restore.tsx
3430
3262
  import * as React25 from "react";
3431
- import { useState as useState14 } from "react";
3263
+ import { useState as useState13 } from "react";
3432
3264
  import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
3433
3265
  import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
3434
3266
  import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
@@ -3442,11 +3274,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
3442
3274
  if (!variable) {
3443
3275
  throw new Error(`Global ${variableType} variable not found`);
3444
3276
  }
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);
3277
+ const [errorMessage, setErrorMessage] = useState13("");
3278
+ const [valueFieldError, setValueFieldError] = useState13("");
3279
+ const [label, setLabel] = useState13(variable.label);
3280
+ const [value, setValue] = useState13(variable.value);
3281
+ const [propTypeKey, setPropTypeKey] = useState13(variable?.type ?? propTypeUtil.key);
3450
3282
  const { labelFieldError, setLabelFieldError } = useLabelError({
3451
3283
  value: variable.label,
3452
3284
  message: ERROR_MESSAGES.DUPLICATED_LABEL
@@ -3603,10 +3435,10 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3603
3435
  const { propTypeUtil } = getVariableType(propTypeKey);
3604
3436
  const boundProp = useBoundProp8();
3605
3437
  const userPermissions = usePermissions();
3606
- const [showInfotip, setShowInfotip] = useState15(false);
3438
+ const [showInfotip, setShowInfotip] = useState14(false);
3607
3439
  const toggleInfotip = () => setShowInfotip((prev) => !prev);
3608
3440
  const closeInfotip = () => setShowInfotip(false);
3609
- const deletedChipAnchorRef = useRef10(null);
3441
+ const deletedChipAnchorRef = useRef8(null);
3610
3442
  const popupId = useId2();
3611
3443
  const popupState = usePopupState4({
3612
3444
  variant: "popover",
@@ -3621,8 +3453,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3621
3453
  if (!variable.key) {
3622
3454
  return;
3623
3455
  }
3624
- restoreVariable(variable.key).then((id2) => {
3625
- resolveBoundPropAndSetValue(propTypeUtil.create(id2), boundProp);
3456
+ restoreVariable(variable.key).then((id) => {
3457
+ resolveBoundPropAndSetValue(propTypeUtil.create(id), boundProp);
3626
3458
  closeInfotip();
3627
3459
  }).catch(() => {
3628
3460
  closeInfotip();
@@ -3694,7 +3526,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3694
3526
 
3695
3527
  // src/components/ui/variable/mismatch-variable.tsx
3696
3528
  import * as React30 from "react";
3697
- import { useId as useId3, useRef as useRef11, useState as useState16 } from "react";
3529
+ import { useId as useId3, useRef as useRef9, useState as useState15 } from "react";
3698
3530
  import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
3699
3531
  import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box9, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
3700
3532
  import { __ as __21 } from "@wordpress/i18n";
@@ -3732,13 +3564,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
3732
3564
  // src/components/ui/variable/mismatch-variable.tsx
3733
3565
  var MismatchVariable = ({ variable }) => {
3734
3566
  const { setValue, value } = useBoundProp9();
3735
- const anchorRef = useRef11(null);
3567
+ const anchorRef = useRef9(null);
3736
3568
  const popupId = useId3();
3737
3569
  const popupState = usePopupState5({
3738
3570
  variant: "popover",
3739
3571
  popupId: `elementor-variables-list-${popupId}`
3740
3572
  });
3741
- const [infotipVisible, setInfotipVisible] = useState16(false);
3573
+ const [infotipVisible, setInfotipVisible] = useState15(false);
3742
3574
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3743
3575
  const closeInfotip = () => setInfotipVisible(false);
3744
3576
  const triggerSelect = () => {
@@ -3811,7 +3643,7 @@ var MismatchVariable = ({ variable }) => {
3811
3643
 
3812
3644
  // src/components/ui/variable/missing-variable.tsx
3813
3645
  import * as React32 from "react";
3814
- import { useState as useState17 } from "react";
3646
+ import { useState as useState16 } from "react";
3815
3647
  import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
3816
3648
  import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
3817
3649
  import { __ as __23 } from "@wordpress/i18n";
@@ -3841,7 +3673,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
3841
3673
  // src/components/ui/variable/missing-variable.tsx
3842
3674
  var MissingVariable = () => {
3843
3675
  const { setValue } = useBoundProp10();
3844
- const [infotipVisible, setInfotipVisible] = useState17(false);
3676
+ const [infotipVisible, setInfotipVisible] = useState16(false);
3845
3677
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3846
3678
  const closeInfotip = () => setInfotipVisible(false);
3847
3679
  const clearValue = () => setValue(null);
@@ -4011,13 +3843,13 @@ Delete a variable:
4011
3843
  };
4012
3844
 
4013
3845
  // src/mcp/variables-resource.ts
4014
- import { __privateListenTo as listenTo3, commandEndEvent } from "@elementor/editor-v1-adapters";
3846
+ import { __privateListenTo as listenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
4015
3847
  var GLOBAL_VARIABLES_URI = "elementor://global-variables";
4016
3848
  var buildGlobalVariablesPayload = async () => {
4017
3849
  const merged = {};
4018
- Object.entries(service.variables()).forEach(([id2, variable]) => {
3850
+ Object.entries(service.variables()).forEach(([id, variable]) => {
4019
3851
  if (!variable.deleted) {
4020
- merged[id2] = { ...variable, version: "v4" };
3852
+ merged[id] = { ...variable, version: "v4" };
4021
3853
  }
4022
3854
  });
4023
3855
  return merged;
@@ -4046,7 +3878,7 @@ var initVariablesResource = (variablesMcpEntry, canvasMcpEntry) => {
4046
3878
  }
4047
3879
  );
4048
3880
  window.addEventListener(STORAGE_UPDATED_EVENT, notifyGlobalVariablesUpdated);
4049
- listenTo3(commandEndEvent("document/save/update"), notifyGlobalVariablesUpdated);
3881
+ listenTo(commandEndEvent("document/save/update"), notifyGlobalVariablesUpdated);
4050
3882
  });
4051
3883
  };
4052
3884
 
@@ -4141,28 +3973,28 @@ function getServiceActions(svc) {
4141
3973
  }
4142
3974
  return svc.create({ type, label, value });
4143
3975
  },
4144
- update({ id: id2, label, value }) {
4145
- if (!id2 || !label || !value) {
3976
+ update({ id, label, value }) {
3977
+ if (!id || !label || !value) {
4146
3978
  throw new Error("Update requires id, label, and value");
4147
3979
  }
4148
3980
  const labelError = validateLabel(label);
4149
3981
  if (labelError) {
4150
3982
  throw new Error(labelError);
4151
3983
  }
4152
- const existingVariable = svc.variables()[id2];
3984
+ const existingVariable = svc.variables()[id];
4153
3985
  if (existingVariable) {
4154
3986
  const valueError = validateValueForType(existingVariable.type, value);
4155
3987
  if (valueError) {
4156
3988
  throw new Error(valueError);
4157
3989
  }
4158
3990
  }
4159
- return svc.update(id2, { label, value });
3991
+ return svc.update(id, { label, value });
4160
3992
  },
4161
- delete({ id: id2 }) {
4162
- if (!id2) {
3993
+ delete({ id }) {
3994
+ if (!id) {
4163
3995
  throw new Error("delete requires id");
4164
3996
  }
4165
- return svc.delete(id2);
3997
+ return svc.delete(id);
4166
3998
  }
4167
3999
  };
4168
4000
  }
@@ -4183,12 +4015,12 @@ import { __ as __26 } from "@wordpress/i18n";
4183
4015
 
4184
4016
  // src/components/fields/color-field.tsx
4185
4017
  import * as React35 from "react";
4186
- import { useRef as useRef12, useState as useState18 } from "react";
4018
+ import { useRef as useRef10, useState as useState17 } from "react";
4187
4019
  import { UnstableColorField } from "@elementor/ui";
4188
4020
  var ColorField = ({ value, onChange, onValidationChange }) => {
4189
- const [color, setColor] = useState18(value);
4190
- const [errorMessage, setErrorMessage] = useState18("");
4191
- const defaultRef = useRef12(null);
4021
+ const [color, setColor] = useState17(value);
4022
+ const [errorMessage, setErrorMessage] = useState17("");
4023
+ const defaultRef = useRef10(null);
4192
4024
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
4193
4025
  const handleChange = (newValue) => {
4194
4026
  setColor(newValue);
@@ -4227,20 +4059,20 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
4227
4059
 
4228
4060
  // src/components/fields/font-field.tsx
4229
4061
  import * as React36 from "react";
4230
- import { useId as useId4, useMemo as useMemo4, useRef as useRef13, useState as useState19 } from "react";
4062
+ import { useId as useId4, useMemo as useMemo3, useRef as useRef11, useState as useState18 } from "react";
4231
4063
  import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
4232
4064
  import { useSectionWidth } from "@elementor/editor-ui";
4233
4065
  import { ChevronDownIcon, TextIcon } from "@elementor/icons";
4234
4066
  import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
4235
4067
  import { __ as __25 } from "@wordpress/i18n";
4236
4068
  var FontField = ({ value, onChange, onValidationChange }) => {
4237
- const [fontFamily, setFontFamily] = useState19(value);
4238
- const defaultRef = useRef13(null);
4069
+ const [fontFamily, setFontFamily] = useState18(value);
4070
+ const defaultRef = useRef11(null);
4239
4071
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
4240
4072
  const fontPopoverState = usePopupState6({ variant: "popover" });
4241
4073
  const fontFamilies = useFontFamilies();
4242
4074
  const sectionWidth = useSectionWidth();
4243
- const mapFontSubs = useMemo4(() => {
4075
+ const mapFontSubs = useMemo3(() => {
4244
4076
  return fontFamilies.map(({ label, fonts }) => ({
4245
4077
  label,
4246
4078
  items: fonts
@@ -4256,11 +4088,11 @@ var FontField = ({ value, onChange, onValidationChange }) => {
4256
4088
  handleChange(newFontFamily);
4257
4089
  fontPopoverState.close();
4258
4090
  };
4259
- const id2 = useId4();
4091
+ const id = useId4();
4260
4092
  return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
4261
4093
  UnstableTag,
4262
4094
  {
4263
- id: id2,
4095
+ id,
4264
4096
  variant: "outlined",
4265
4097
  label: fontFamily,
4266
4098
  endIcon: /* @__PURE__ */ React36.createElement(ChevronDownIcon, { fontSize: "tiny" }),
@@ -4376,7 +4208,7 @@ function registerVariableTypes() {
4376
4208
 
4377
4209
  // src/renderers/style-variables-renderer.tsx
4378
4210
  import * as React38 from "react";
4379
- import { useEffect as useEffect10, useState as useState20 } from "react";
4211
+ import { useEffect as useEffect8, useState as useState19 } from "react";
4380
4212
  import {
4381
4213
  __privateUseListenTo as useListenTo,
4382
4214
  commandEndEvent as commandEndEvent2,
@@ -4399,8 +4231,8 @@ function usePortalContainer() {
4399
4231
  return useListenTo(commandEndEvent2("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
4400
4232
  }
4401
4233
  function useStyleVariables() {
4402
- const [variables, setVariables] = useState20({});
4403
- useEffect10(() => {
4234
+ const [variables, setVariables] = useState19({});
4235
+ useEffect8(() => {
4404
4236
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
4405
4237
  return () => {
4406
4238
  unsubscribe();
@@ -4696,17 +4528,16 @@ function init() {
4696
4528
  priority: 40,
4697
4529
  useProps: usePropVariableAction
4698
4530
  });
4699
- service.init().then(() => {
4700
- const variablesMcpRegistry = getMCPByDomain("variables", {
4701
- instructions: `Everything related to V4 ( Atomic ) variables.
4531
+ service.init();
4532
+ const variablesMcpRegistry = getMCPByDomain("variables", {
4533
+ instructions: `Everything related to V4 ( Atomic ) variables.
4702
4534
  # Global variables
4703
4535
  - Create/update/delete global variables
4704
4536
  - Get list of global variables
4705
4537
  - Get details of a global variable
4706
4538
  `
4707
- });
4708
- initMcp(variablesMcpRegistry, getMCPByDomain("canvas"));
4709
4539
  });
4540
+ initMcp(variablesMcpRegistry, getMCPByDomain("canvas"));
4710
4541
  injectIntoTop({
4711
4542
  id: "canvas-style-variables-render",
4712
4543
  component: StyleVariablesRenderer
@@ -4715,17 +4546,6 @@ function init() {
4715
4546
  id: "variables-import-listener",
4716
4547
  component: GlobalStylesImportListener
4717
4548
  });
4718
- if (!isExperimentActive2("e_editor_design_system_panel")) {
4719
- injectIntoLogic({
4720
- id: "variables-open-panel-from-url",
4721
- component: OpenPanelFromUrl
4722
- });
4723
- injectIntoLogic({
4724
- id: "variables-open-panel-from-event",
4725
- component: OpenPanelFromEvent
4726
- });
4727
- registerPanel(panel);
4728
- }
4729
4549
  }
4730
4550
  function hasVariableAssigned(value) {
4731
4551
  if (isTransformable2(value)) {