@elementor/editor-variables 4.1.0-686 → 4.1.0-688

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
@@ -5,201 +5,11 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
5
5
  import { isTransformable as isTransformable2 } from "@elementor/editor-props";
6
6
  import { controlActionsMenu } from "@elementor/menus";
7
7
 
8
- // src/components/open-panel-from-event.tsx
9
- import { useEffect as useEffect4, useRef as useRef7, useState as useState7 } from "react";
10
- import {
11
- __privateListenTo as listenTo,
12
- __privateOpenRoute as openRoute,
13
- routeOpenEvent
14
- } from "@elementor/editor-v1-adapters";
15
-
16
- // src/components/variables-manager/variables-manager-panel.tsx
17
- import * as React14 from "react";
18
- import { useCallback as useCallback6, useEffect as useEffect3, useState as useState6 } from "react";
19
- import { useSuppressedMessage } from "@elementor/editor-current-user";
20
- import {
21
- __createPanel as createPanel,
22
- Panel,
23
- PanelBody,
24
- PanelFooter,
25
- PanelHeader,
26
- PanelHeaderTitle
27
- } from "@elementor/editor-panels";
28
- import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
29
- import { changeEditMode } from "@elementor/editor-v1-adapters";
30
- import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, TrashIcon } from "@elementor/icons";
31
- import {
32
- Alert,
33
- AlertAction,
34
- AlertTitle,
35
- Button as Button2,
36
- CloseButton,
37
- Divider,
38
- Infotip,
39
- Stack as Stack6,
40
- usePopupState as usePopupState2
41
- } from "@elementor/ui";
42
- import { __ as __10 } from "@wordpress/i18n";
43
-
44
- // src/utils/tracking.ts
45
- import { getMixpanel } from "@elementor/events";
46
- var trackVariableEvent = ({ varType, controlPath, action }) => {
47
- const { dispatchEvent, config } = getMixpanel();
48
- if (!config?.names?.variables?.[action]) {
49
- return;
50
- }
51
- const name = config.names.variables[action];
52
- dispatchEvent?.(name, {
53
- location: config?.locations?.variables || "",
54
- secondaryLocation: config?.secondaryLocations?.variablesPopover || "",
55
- trigger: config?.triggers?.click || "",
56
- var_type: varType,
57
- control_path: controlPath,
58
- action_type: name
59
- });
60
- };
61
- var trackVariablesManagerEvent = ({ action, varType, controlPath }) => {
62
- const { dispatchEvent, config } = getMixpanel();
63
- if (!config?.names?.variables?.[action]) {
64
- return;
65
- }
66
- const name = config.names.variables[action];
67
- const eventData = {
68
- location: config?.locations?.variablesManager || "",
69
- trigger: config?.triggers?.click || "",
70
- action_type: name
71
- };
72
- if (varType) {
73
- eventData.var_type = varType;
74
- }
75
- if (controlPath) {
76
- eventData.style_control_path = controlPath;
77
- }
78
- dispatchEvent?.(name, eventData);
79
- };
80
-
81
- // src/utils/validations.ts
82
- import { AlertTriangleFilledIcon, InfoCircleFilledIcon } from "@elementor/icons";
83
- import { __, sprintf } from "@wordpress/i18n";
84
- var ERROR_MESSAGES = {
85
- MISSING_VARIABLE_NAME: __("Give your variable a name.", "elementor"),
86
- MISSING_VARIABLE_VALUE: __("Add a value to complete your variable.", "elementor"),
87
- INVALID_CHARACTERS: __("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
88
- NO_NON_SPECIAL_CHARACTER: __("Names have to include at least one non-special character.", "elementor"),
89
- VARIABLE_LABEL_MAX_LENGTH: __("Keep names up to 50 characters.", "elementor"),
90
- DUPLICATED_LABEL: __("This variable name already exists. Please choose a unique name.", "elementor"),
91
- UNEXPECTED_ERROR: __("There was a glitch. Try saving your variable again.", "elementor"),
92
- BATCH: {
93
- DUPLICATED_LABELS: (count, name) => (
94
- // eslint-disable-next-line @wordpress/i18n-translator-comments
95
- sprintf(__("We found %1$d duplicated %2$s.", "elementor"), count, name)
96
- ),
97
- UNEXPECTED_ERROR: __("There was a glitch.", "elementor"),
98
- DUPLICATED_LABEL_ACTION: __("Take me there", "elementor"),
99
- DUPLICATED_LABEL_ACTION_MESSAGE: __("Please rename the variables.", "elementor"),
100
- UNEXPECTED_ERROR_ACTION_MESSAGE: __("Try saving your variables again.", "elementor")
101
- }
102
- };
103
- var VARIABLE_LABEL_MAX_LENGTH = 50;
104
- var mapServerError = (error) => {
105
- if (error?.response?.data?.code === "duplicated_label") {
106
- return {
107
- field: "label",
108
- message: ERROR_MESSAGES.DUPLICATED_LABEL
109
- };
110
- }
111
- if (error?.response?.data?.code === "batch_duplicated_label") {
112
- const errorData = error?.response?.data?.data ?? {};
113
- const count = Object.keys(errorData).length;
114
- const name = count === 1 ? "name" : "names";
115
- const duplicatedIds = Object.keys(errorData);
116
- return {
117
- field: "label",
118
- message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS(count, name),
119
- severity: "error",
120
- IconComponent: AlertTriangleFilledIcon,
121
- action: {
122
- label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
123
- message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
124
- data: {
125
- duplicatedIds
126
- }
127
- }
128
- };
129
- }
130
- if (error?.response?.data?.code === "batch_operation_failed") {
131
- return {
132
- field: "label",
133
- message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR,
134
- severity: "secondary",
135
- IconComponent: InfoCircleFilledIcon,
136
- action: {
137
- message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR_ACTION_MESSAGE
138
- }
139
- };
140
- }
141
- return void 0;
142
- };
143
- var validateLabel = (name, variables) => {
144
- if (!name.trim()) {
145
- return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
146
- }
147
- const allowedChars = /^[a-zA-Z0-9_-]+$/;
148
- if (!allowedChars.test(name)) {
149
- return ERROR_MESSAGES.INVALID_CHARACTERS;
150
- }
151
- const hasAlphanumeric = /[a-zA-Z0-9]/;
152
- if (!hasAlphanumeric.test(name)) {
153
- return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
154
- }
155
- if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
156
- return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
157
- }
158
- if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
159
- return ERROR_MESSAGES.DUPLICATED_LABEL;
160
- }
161
- return "";
162
- };
163
- var labelHint = (name) => {
164
- const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
165
- if (hintThreshold < name.length) {
166
- return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
167
- }
168
- return "";
169
- };
170
- var validateValue = (value) => {
171
- if (!value.trim()) {
172
- return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
173
- }
174
- return "";
175
- };
176
-
177
- // src/variables-registry/create-variable-type-registry.ts
178
- import {
179
- stylesInheritanceTransformersRegistry,
180
- styleTransformersRegistry
181
- } from "@elementor/editor-canvas";
182
-
183
- // src/transformers/inheritance-transformer.tsx
184
- import * as React from "react";
185
- import { createTransformer } from "@elementor/editor-canvas";
186
- import { Stack, Typography } from "@elementor/ui";
187
- import { __ as __3 } from "@wordpress/i18n";
188
-
189
- // src/components/ui/color-indicator.tsx
190
- import { styled, UnstableColorIndicator } from "@elementor/ui";
191
- var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
192
- borderRadius: `${theme.shape.borderRadius / 2}px`,
193
- marginRight: theme.spacing(0.25)
194
- }));
195
-
196
- // src/prop-types/color-variable-prop-type.ts
197
- import { createPropUtils } from "@elementor/editor-props";
198
- import { z } from "@elementor/schema";
199
- var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
8
+ // src/components/global-styles-import-listener.tsx
9
+ import { useEffect } from "react";
200
10
 
201
11
  // src/service.ts
202
- import { __ as __2 } from "@wordpress/i18n";
12
+ import { __ } from "@wordpress/i18n";
203
13
 
204
14
  // src/api.ts
205
15
  import { httpService } from "@elementor/http-client";
@@ -364,9 +174,9 @@ var Storage = class {
364
174
  import { enqueueFont } from "@elementor/editor-v1-adapters";
365
175
 
366
176
  // src/prop-types/font-variable-prop-type.ts
367
- import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
368
- import { z as z2 } from "@elementor/schema";
369
- var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
177
+ import { createPropUtils } from "@elementor/editor-props";
178
+ import { z } from "@elementor/schema";
179
+ var fontVariablePropTypeUtil = createPropUtils("global-font-variable", z.string());
370
180
 
371
181
  // src/create-style-variables-repository.ts
372
182
  var createStyleVariablesRepository = () => {
@@ -478,7 +288,7 @@ var service = {
478
288
  return apiClient.create(type, label, value).then((response) => {
479
289
  const { success, data: payload } = response.data;
480
290
  if (!success) {
481
- const errorMessage = payload?.message || __2("Unexpected response from server", "elementor");
291
+ const errorMessage = payload?.message || __("Unexpected response from server", "elementor");
482
292
  throw new Error(errorMessage);
483
293
  }
484
294
  return payload;
@@ -500,7 +310,7 @@ var service = {
500
310
  return apiClient.update(id2, label, value, type).then((response) => {
501
311
  const { success, data: payload } = response.data;
502
312
  if (!success) {
503
- const errorMessage = payload?.message || __2("Unexpected response from server", "elementor");
313
+ const errorMessage = payload?.message || __("Unexpected response from server", "elementor");
504
314
  throw new Error(errorMessage);
505
315
  }
506
316
  return payload;
@@ -609,6 +419,223 @@ var handleWatermark = (operation, newWatermark) => {
609
419
  storage.watermark(newWatermark);
610
420
  };
611
421
 
422
+ // src/components/global-styles-import-listener.tsx
423
+ function GlobalStylesImportListener() {
424
+ useEffect(() => {
425
+ const handleGlobalStylesImported = (event) => {
426
+ const importedVars = event.detail?.global_variables;
427
+ if (!importedVars) {
428
+ return;
429
+ }
430
+ if (importedVars.data && typeof importedVars.data === "object") {
431
+ styleVariablesRepository.update(importedVars.data);
432
+ }
433
+ service.load();
434
+ };
435
+ window.addEventListener("elementor/global-styles/imported", handleGlobalStylesImported);
436
+ return () => {
437
+ window.removeEventListener(
438
+ "elementor/global-styles/imported",
439
+ handleGlobalStylesImported
440
+ );
441
+ };
442
+ }, []);
443
+ return null;
444
+ }
445
+
446
+ // src/components/open-panel-from-event.tsx
447
+ import { useEffect as useEffect5, useRef as useRef7, useState as useState7 } from "react";
448
+ import {
449
+ __privateListenTo as listenTo,
450
+ __privateOpenRoute as openRoute,
451
+ routeOpenEvent
452
+ } from "@elementor/editor-v1-adapters";
453
+
454
+ // src/components/variables-manager/variables-manager-panel.tsx
455
+ import * as React14 from "react";
456
+ import { useCallback as useCallback6, useEffect as useEffect4, useState as useState6 } from "react";
457
+ import { useSuppressedMessage } from "@elementor/editor-current-user";
458
+ import {
459
+ __createPanel as createPanel,
460
+ Panel,
461
+ PanelBody,
462
+ PanelFooter,
463
+ PanelHeader,
464
+ PanelHeaderTitle
465
+ } from "@elementor/editor-panels";
466
+ import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
467
+ import { changeEditMode } from "@elementor/editor-v1-adapters";
468
+ import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, TrashIcon } from "@elementor/icons";
469
+ import {
470
+ Alert,
471
+ AlertAction,
472
+ AlertTitle,
473
+ Button as Button2,
474
+ CloseButton,
475
+ Divider,
476
+ Infotip,
477
+ Stack as Stack6,
478
+ usePopupState as usePopupState2
479
+ } from "@elementor/ui";
480
+ import { __ as __10 } from "@wordpress/i18n";
481
+
482
+ // src/utils/tracking.ts
483
+ import { getMixpanel } from "@elementor/events";
484
+ var trackVariableEvent = ({ varType, controlPath, action }) => {
485
+ const { dispatchEvent, config } = getMixpanel();
486
+ if (!config?.names?.variables?.[action]) {
487
+ return;
488
+ }
489
+ const name = config.names.variables[action];
490
+ dispatchEvent?.(name, {
491
+ location: config?.locations?.variables || "",
492
+ secondaryLocation: config?.secondaryLocations?.variablesPopover || "",
493
+ trigger: config?.triggers?.click || "",
494
+ var_type: varType,
495
+ control_path: controlPath,
496
+ action_type: name
497
+ });
498
+ };
499
+ var trackVariablesManagerEvent = ({ action, varType, controlPath }) => {
500
+ const { dispatchEvent, config } = getMixpanel();
501
+ if (!config?.names?.variables?.[action]) {
502
+ return;
503
+ }
504
+ const name = config.names.variables[action];
505
+ const eventData = {
506
+ location: config?.locations?.variablesManager || "",
507
+ trigger: config?.triggers?.click || "",
508
+ action_type: name
509
+ };
510
+ if (varType) {
511
+ eventData.var_type = varType;
512
+ }
513
+ if (controlPath) {
514
+ eventData.style_control_path = controlPath;
515
+ }
516
+ dispatchEvent?.(name, eventData);
517
+ };
518
+
519
+ // src/utils/validations.ts
520
+ import { AlertTriangleFilledIcon, InfoCircleFilledIcon } from "@elementor/icons";
521
+ import { __ as __2, sprintf } from "@wordpress/i18n";
522
+ var ERROR_MESSAGES = {
523
+ MISSING_VARIABLE_NAME: __2("Give your variable a name.", "elementor"),
524
+ MISSING_VARIABLE_VALUE: __2("Add a value to complete your variable.", "elementor"),
525
+ INVALID_CHARACTERS: __2("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
526
+ NO_NON_SPECIAL_CHARACTER: __2("Names have to include at least one non-special character.", "elementor"),
527
+ VARIABLE_LABEL_MAX_LENGTH: __2("Keep names up to 50 characters.", "elementor"),
528
+ DUPLICATED_LABEL: __2("This variable name already exists. Please choose a unique name.", "elementor"),
529
+ UNEXPECTED_ERROR: __2("There was a glitch. Try saving your variable again.", "elementor"),
530
+ BATCH: {
531
+ DUPLICATED_LABELS: (count, name) => (
532
+ // eslint-disable-next-line @wordpress/i18n-translator-comments
533
+ sprintf(__2("We found %1$d duplicated %2$s.", "elementor"), count, name)
534
+ ),
535
+ UNEXPECTED_ERROR: __2("There was a glitch.", "elementor"),
536
+ DUPLICATED_LABEL_ACTION: __2("Take me there", "elementor"),
537
+ DUPLICATED_LABEL_ACTION_MESSAGE: __2("Please rename the variables.", "elementor"),
538
+ UNEXPECTED_ERROR_ACTION_MESSAGE: __2("Try saving your variables again.", "elementor")
539
+ }
540
+ };
541
+ var VARIABLE_LABEL_MAX_LENGTH = 50;
542
+ var mapServerError = (error) => {
543
+ if (error?.response?.data?.code === "duplicated_label") {
544
+ return {
545
+ field: "label",
546
+ message: ERROR_MESSAGES.DUPLICATED_LABEL
547
+ };
548
+ }
549
+ if (error?.response?.data?.code === "batch_duplicated_label") {
550
+ const errorData = error?.response?.data?.data ?? {};
551
+ const count = Object.keys(errorData).length;
552
+ const name = count === 1 ? "name" : "names";
553
+ const duplicatedIds = Object.keys(errorData);
554
+ return {
555
+ field: "label",
556
+ message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS(count, name),
557
+ severity: "error",
558
+ IconComponent: AlertTriangleFilledIcon,
559
+ action: {
560
+ label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
561
+ message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
562
+ data: {
563
+ duplicatedIds
564
+ }
565
+ }
566
+ };
567
+ }
568
+ if (error?.response?.data?.code === "batch_operation_failed") {
569
+ return {
570
+ field: "label",
571
+ message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR,
572
+ severity: "secondary",
573
+ IconComponent: InfoCircleFilledIcon,
574
+ action: {
575
+ message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR_ACTION_MESSAGE
576
+ }
577
+ };
578
+ }
579
+ return void 0;
580
+ };
581
+ var validateLabel = (name, variables) => {
582
+ if (!name.trim()) {
583
+ return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
584
+ }
585
+ const allowedChars = /^[a-zA-Z0-9_-]+$/;
586
+ if (!allowedChars.test(name)) {
587
+ return ERROR_MESSAGES.INVALID_CHARACTERS;
588
+ }
589
+ const hasAlphanumeric = /[a-zA-Z0-9]/;
590
+ if (!hasAlphanumeric.test(name)) {
591
+ return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
592
+ }
593
+ if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
594
+ return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
595
+ }
596
+ if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
597
+ return ERROR_MESSAGES.DUPLICATED_LABEL;
598
+ }
599
+ return "";
600
+ };
601
+ var labelHint = (name) => {
602
+ const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
603
+ if (hintThreshold < name.length) {
604
+ return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
605
+ }
606
+ return "";
607
+ };
608
+ var validateValue = (value) => {
609
+ if (!value.trim()) {
610
+ return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
611
+ }
612
+ return "";
613
+ };
614
+
615
+ // src/variables-registry/create-variable-type-registry.ts
616
+ import {
617
+ stylesInheritanceTransformersRegistry,
618
+ styleTransformersRegistry
619
+ } from "@elementor/editor-canvas";
620
+
621
+ // src/transformers/inheritance-transformer.tsx
622
+ import * as React from "react";
623
+ import { createTransformer } from "@elementor/editor-canvas";
624
+ import { Stack, Typography } from "@elementor/ui";
625
+ import { __ as __3 } from "@wordpress/i18n";
626
+
627
+ // src/components/ui/color-indicator.tsx
628
+ import { styled, UnstableColorIndicator } from "@elementor/ui";
629
+ var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
630
+ borderRadius: `${theme.shape.borderRadius / 2}px`,
631
+ marginRight: theme.spacing(0.25)
632
+ }));
633
+
634
+ // src/prop-types/color-variable-prop-type.ts
635
+ import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
636
+ import { z as z2 } from "@elementor/schema";
637
+ var colorVariablePropTypeUtil = createPropUtils2("global-color-variable", z2.string());
638
+
612
639
  // src/transformers/utils/resolve-css-variable.ts
613
640
  var resolveCssVariable = (id2, variable) => {
614
641
  let name = id2;
@@ -1275,7 +1302,7 @@ var getDefaultName = (variables, baseName) => {
1275
1302
 
1276
1303
  // src/components/variables-manager/variables-manager-table.tsx
1277
1304
  import * as React13 from "react";
1278
- import { useEffect as useEffect2, useRef as useRef6 } from "react";
1305
+ import { useEffect as useEffect3, useRef as useRef6 } from "react";
1279
1306
  import {
1280
1307
  Table,
1281
1308
  TableBody,
@@ -1400,7 +1427,7 @@ var LabelField = ({
1400
1427
 
1401
1428
  // src/components/variables-manager/variable-editable-cell.tsx
1402
1429
  import * as React10 from "react";
1403
- import { useCallback as useCallback5, useEffect, useRef as useRef4, useState as useState5 } from "react";
1430
+ import { useCallback as useCallback5, useEffect as useEffect2, useRef as useRef4, useState as useState5 } from "react";
1404
1431
  import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
1405
1432
  var VariableEditableCell = React10.memo(
1406
1433
  ({
@@ -1428,10 +1455,10 @@ var VariableEditableCell = React10.memo(
1428
1455
  }
1429
1456
  setIsEditing(false);
1430
1457
  }, [value, onChange, fieldType, labelFieldError, valueFieldError]);
1431
- useEffect(() => {
1458
+ useEffect2(() => {
1432
1459
  onRowRef?.(rowRef?.current);
1433
1460
  }, [onRowRef]);
1434
- useEffect(() => {
1461
+ useEffect2(() => {
1435
1462
  if (autoEdit && !isEditing && !disabled) {
1436
1463
  setIsEditing(true);
1437
1464
  onAutoEditComplete?.();
@@ -1772,7 +1799,7 @@ var VariablesManagerTable = ({
1772
1799
  }) => {
1773
1800
  const tableContainerRef = useRef6(null);
1774
1801
  const variableRowRefs = useRef6(/* @__PURE__ */ new Map());
1775
- useEffect2(() => {
1802
+ useEffect3(() => {
1776
1803
  if (autoEditVariableId && tableContainerRef.current) {
1777
1804
  const rowElement = variableRowRefs.current.get(autoEditVariableId);
1778
1805
  if (rowElement) {
@@ -2164,7 +2191,7 @@ function VariablesManagerPanel() {
2164
2191
  )));
2165
2192
  }
2166
2193
  var usePreventUnload = (isDirty) => {
2167
- useEffect3(() => {
2194
+ useEffect4(() => {
2168
2195
  const handleBeforeUnload = (event) => {
2169
2196
  if (isDirty) {
2170
2197
  event.preventDefault();
@@ -2202,13 +2229,13 @@ function OpenPanelFromEvent() {
2202
2229
  const { open } = usePanelActions();
2203
2230
  const pendingRef = useRef7(false);
2204
2231
  const [readyToOpen, setReadyToOpen] = useState7(false);
2205
- useEffect4(() => {
2232
+ useEffect5(() => {
2206
2233
  if (readyToOpen) {
2207
2234
  setReadyToOpen(false);
2208
2235
  open();
2209
2236
  }
2210
2237
  }, [readyToOpen, open]);
2211
- useEffect4(() => {
2238
+ useEffect5(() => {
2212
2239
  return listenTo(routeOpenEvent(DEFAULT_PANEL_ROUTE), () => {
2213
2240
  if (pendingRef.current) {
2214
2241
  pendingRef.current = false;
@@ -2216,7 +2243,7 @@ function OpenPanelFromEvent() {
2216
2243
  }
2217
2244
  });
2218
2245
  }, []);
2219
- useEffect4(() => {
2246
+ useEffect5(() => {
2220
2247
  const handler = () => {
2221
2248
  pendingRef.current = true;
2222
2249
  openRoute(DEFAULT_PANEL_ROUTE);
@@ -2228,7 +2255,7 @@ function OpenPanelFromEvent() {
2228
2255
  }
2229
2256
 
2230
2257
  // src/components/open-panel-from-url.tsx
2231
- import { useEffect as useEffect5, useRef as useRef8 } from "react";
2258
+ import { useEffect as useEffect6, useRef as useRef8 } from "react";
2232
2259
  import { __privateListenTo as listenTo2, routeOpenEvent as routeOpenEvent2 } from "@elementor/editor-v1-adapters";
2233
2260
  var ACTIVE_PANEL_PARAM = "active-panel";
2234
2261
  var PANEL_ID = "variables-manager";
@@ -2236,7 +2263,7 @@ var DEFAULT_PANEL_ROUTE2 = "panel/elements";
2236
2263
  function OpenPanelFromUrl() {
2237
2264
  const { open } = usePanelActions();
2238
2265
  const hasOpened = useRef8(false);
2239
- useEffect5(() => {
2266
+ useEffect6(() => {
2240
2267
  const urlParams = new URLSearchParams(window.location.search);
2241
2268
  const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
2242
2269
  if (activePanel !== PANEL_ID) {
@@ -2488,7 +2515,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2488
2515
 
2489
2516
  // src/components/variable-edit.tsx
2490
2517
  import * as React19 from "react";
2491
- import { useEffect as useEffect6, useState as useState11 } from "react";
2518
+ import { useEffect as useEffect7, useState as useState11 } from "react";
2492
2519
  import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
2493
2520
  import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
2494
2521
  import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
@@ -2565,7 +2592,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2565
2592
  const userPermissions = usePermissions();
2566
2593
  const [value, setValue] = useState11(() => variable.value);
2567
2594
  const [label, setLabel] = useState11(() => variable.label);
2568
- useEffect6(() => {
2595
+ useEffect7(() => {
2569
2596
  styleVariablesRepository.update({
2570
2597
  [editId]: {
2571
2598
  ...variable,
@@ -2729,7 +2756,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2729
2756
  };
2730
2757
 
2731
2758
  // src/components/variables-selection.tsx
2732
- import { useEffect as useEffect7, useState as useState12 } from "react";
2759
+ import { useEffect as useEffect8, useState as useState12 } from "react";
2733
2760
  import * as React21 from "react";
2734
2761
  import { trackUpgradePromotionClick as trackUpgradePromotionClick2, trackViewPromotion as trackViewPromotion2 } from "@elementor/editor-controls";
2735
2762
  import {
@@ -2919,7 +2946,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
2919
2946
  const handleClearSearch = () => {
2920
2947
  setSearchValue("");
2921
2948
  };
2922
- useEffect7(() => {
2949
+ useEffect8(() => {
2923
2950
  if (disabled) {
2924
2951
  trackViewPromotion2({
2925
2952
  target_name: "variables_popover",
@@ -4015,7 +4042,7 @@ function registerVariableTypes() {
4015
4042
 
4016
4043
  // src/renderers/style-variables-renderer.tsx
4017
4044
  import * as React38 from "react";
4018
- import { useEffect as useEffect8, useState as useState20 } from "react";
4045
+ import { useEffect as useEffect9, useState as useState20 } from "react";
4019
4046
  import {
4020
4047
  __privateUseListenTo as useListenTo,
4021
4048
  commandEndEvent,
@@ -4039,7 +4066,7 @@ function usePortalContainer() {
4039
4066
  }
4040
4067
  function useStyleVariables() {
4041
4068
  const [variables, setVariables] = useState20({});
4042
- useEffect8(() => {
4069
+ useEffect9(() => {
4043
4070
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
4044
4071
  return () => {
4045
4072
  unsubscribe();
@@ -4137,6 +4164,10 @@ function init() {
4137
4164
  id: "canvas-style-variables-render",
4138
4165
  component: StyleVariablesRenderer
4139
4166
  });
4167
+ injectIntoLogic({
4168
+ id: "variables-import-listener",
4169
+ component: GlobalStylesImportListener
4170
+ });
4140
4171
  injectIntoLogic({
4141
4172
  id: "variables-open-panel-from-url",
4142
4173
  component: OpenPanelFromUrl