@elementor/editor-variables 0.15.0 → 0.18.0
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/CHANGELOG.md +88 -0
- package/dist/index.js +894 -486
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +892 -511
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/components/color-variable-creation.tsx +37 -58
- package/src/components/color-variable-edit.tsx +110 -86
- package/src/components/color-variables-selection.tsx +32 -34
- package/src/components/fields/color-field.tsx +54 -0
- package/src/components/fields/font-field.tsx +85 -0
- package/src/components/fields/label-field.tsx +54 -0
- package/src/components/font-variable-creation.tsx +39 -78
- package/src/components/font-variable-edit.tsx +108 -114
- package/src/components/font-variables-selection.tsx +32 -34
- package/src/components/ui/delete-confirmation-dialog.tsx +52 -0
- package/src/components/ui/deleted-variable-alert.tsx +47 -0
- package/src/components/ui/menu-item-content.tsx +2 -5
- package/src/components/ui/tags/assigned-tag.tsx +45 -0
- package/src/components/ui/tags/deleted-tag.tsx +37 -0
- package/src/components/ui/variable/assigned-variable.tsx +70 -0
- package/src/components/ui/variable/deleted-variable.tsx +76 -0
- package/src/controls/color-variable-control.tsx +21 -48
- package/src/controls/font-variable-control.tsx +20 -43
- package/src/create-style-variables-repository.ts +44 -5
- package/src/hooks/use-prop-variables.ts +6 -0
- package/src/init-color-variables.ts +3 -48
- package/src/renderers/style-variables-renderer.tsx +10 -4
- package/src/repeater-injections.ts +35 -0
- package/src/service.ts +23 -2
- package/src/sync/enqueue-font.ts +7 -0
- package/src/sync/types.ts +5 -0
- package/src/transformers/variable-transformer.ts +21 -3
- package/src/types.ts +1 -1
- package/src/utils/validations.ts +42 -0
- package/src/components/ui/variable-tag.tsx +0 -43
package/dist/index.js
CHANGED
|
@@ -39,16 +39,58 @@ var import_editor = require("@elementor/editor");
|
|
|
39
39
|
|
|
40
40
|
// src/init-color-variables.ts
|
|
41
41
|
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
42
|
+
var import_editor_editing_panel10 = require("@elementor/editor-editing-panel");
|
|
43
|
+
|
|
44
|
+
// src/controls/color-variable-control.tsx
|
|
45
|
+
var React20 = __toESM(require("react"));
|
|
46
|
+
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
47
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
48
|
+
|
|
49
|
+
// src/components/ui/color-indicator.tsx
|
|
50
|
+
var import_ui = require("@elementor/ui");
|
|
51
|
+
var ColorIndicator = (0, import_ui.styled)(import_ui.UnstableColorIndicator)(({ theme }) => ({
|
|
52
|
+
borderRadius: `${theme.shape.borderRadius / 2}px`,
|
|
53
|
+
marginRight: theme.spacing(0.25)
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
// src/components/ui/variable/assigned-variable.tsx
|
|
57
|
+
var import_react13 = require("react");
|
|
58
|
+
var React16 = __toESM(require("react"));
|
|
42
59
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
43
|
-
var
|
|
44
|
-
var
|
|
60
|
+
var import_icons11 = require("@elementor/icons");
|
|
61
|
+
var import_ui18 = require("@elementor/ui");
|
|
45
62
|
|
|
46
|
-
// src/components/
|
|
47
|
-
var
|
|
63
|
+
// src/components/variable-selection-popover.tsx
|
|
64
|
+
var React14 = __toESM(require("react"));
|
|
65
|
+
var import_react12 = require("react");
|
|
66
|
+
var import_ui16 = require("@elementor/ui");
|
|
67
|
+
|
|
68
|
+
// src/prop-types/color-variable-prop-type.ts
|
|
69
|
+
var import_editor_props = require("@elementor/editor-props");
|
|
70
|
+
var import_schema = require("@elementor/schema");
|
|
71
|
+
var colorVariablePropTypeUtil = (0, import_editor_props.createPropUtils)("global-color-variable", import_schema.z.string());
|
|
72
|
+
|
|
73
|
+
// src/prop-types/font-variable-prop-type.ts
|
|
74
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
75
|
+
var import_schema2 = require("@elementor/schema");
|
|
76
|
+
var fontVariablePropTypeUtil = (0, import_editor_props2.createPropUtils)("global-font-variable", import_schema2.z.string());
|
|
77
|
+
|
|
78
|
+
// src/components/color-variable-creation.tsx
|
|
79
|
+
var React3 = __toESM(require("react"));
|
|
80
|
+
var import_react5 = require("react");
|
|
81
|
+
var import_editor_controls = require("@elementor/editor-controls");
|
|
82
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
83
|
+
var import_editor_ui = require("@elementor/editor-ui");
|
|
84
|
+
var import_icons = require("@elementor/icons");
|
|
85
|
+
var import_ui4 = require("@elementor/ui");
|
|
86
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
48
87
|
|
|
49
88
|
// src/hooks/use-prop-variables.ts
|
|
50
89
|
var import_react = require("react");
|
|
51
90
|
|
|
91
|
+
// src/service.ts
|
|
92
|
+
var import_i18n = require("@wordpress/i18n");
|
|
93
|
+
|
|
52
94
|
// src/api.ts
|
|
53
95
|
var import_http_client = require("@elementor/http-client");
|
|
54
96
|
var BASE_PATH = "elementor/v1/variables";
|
|
@@ -131,6 +173,12 @@ var Storage = class {
|
|
|
131
173
|
}
|
|
132
174
|
};
|
|
133
175
|
|
|
176
|
+
// src/sync/enqueue-font.ts
|
|
177
|
+
var enqueueFont = (fontFamily, context = "preview") => {
|
|
178
|
+
const extendedWindow = window;
|
|
179
|
+
return extendedWindow.elementor?.helpers?.enqueueFont?.(fontFamily, context) ?? null;
|
|
180
|
+
};
|
|
181
|
+
|
|
134
182
|
// src/create-style-variables-repository.ts
|
|
135
183
|
var createStyleVariablesRepository = () => {
|
|
136
184
|
const variables = {};
|
|
@@ -147,19 +195,46 @@ var createStyleVariablesRepository = () => {
|
|
|
147
195
|
subscription({ ...variables });
|
|
148
196
|
}
|
|
149
197
|
};
|
|
150
|
-
const shouldUpdate = (key,
|
|
151
|
-
|
|
198
|
+
const shouldUpdate = (key, maybeUpdated) => {
|
|
199
|
+
if (!(key in variables)) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (variables[key].label !== maybeUpdated.label) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
if (variables[key].value !== maybeUpdated.value) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
if (!variables[key]?.deleted && maybeUpdated?.deleted) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (variables[key]?.deleted && !maybeUpdated?.deleted) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
152
215
|
};
|
|
153
216
|
const applyUpdates = (updatedVars) => {
|
|
154
217
|
let hasChanges = false;
|
|
155
|
-
for (const [key,
|
|
156
|
-
if (shouldUpdate(key,
|
|
157
|
-
variables[key] =
|
|
218
|
+
for (const [key, variable] of Object.entries(updatedVars)) {
|
|
219
|
+
if (shouldUpdate(key, variable)) {
|
|
220
|
+
variables[key] = variable;
|
|
221
|
+
if (variable.type === fontVariablePropTypeUtil.key) {
|
|
222
|
+
fontEnqueue(variable.value);
|
|
223
|
+
}
|
|
158
224
|
hasChanges = true;
|
|
159
225
|
}
|
|
160
226
|
}
|
|
161
227
|
return hasChanges;
|
|
162
228
|
};
|
|
229
|
+
const fontEnqueue = (value) => {
|
|
230
|
+
if (!value) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
enqueueFont(value);
|
|
235
|
+
} catch {
|
|
236
|
+
}
|
|
237
|
+
};
|
|
163
238
|
const update = (updatedVars) => {
|
|
164
239
|
if (applyUpdates(updatedVars)) {
|
|
165
240
|
notify();
|
|
@@ -201,7 +276,8 @@ var service = {
|
|
|
201
276
|
return apiClient.create(type, label, value).then((response) => {
|
|
202
277
|
const { success, data: payload } = response.data;
|
|
203
278
|
if (!success) {
|
|
204
|
-
|
|
279
|
+
const errorMessage = payload?.message || (0, import_i18n.__)("Unexpected response from server", "elementor");
|
|
280
|
+
throw new Error(errorMessage);
|
|
205
281
|
}
|
|
206
282
|
return payload;
|
|
207
283
|
}).then((data) => {
|
|
@@ -216,13 +292,17 @@ var service = {
|
|
|
216
292
|
id: variableId,
|
|
217
293
|
variable: createdVariable
|
|
218
294
|
};
|
|
295
|
+
}).catch((error) => {
|
|
296
|
+
const message = getErrorMessage(error.response);
|
|
297
|
+
throw message ? new Error(message) : error;
|
|
219
298
|
});
|
|
220
299
|
},
|
|
221
300
|
update: (id, { label, value }) => {
|
|
222
301
|
return apiClient.update(id, label, value).then((response) => {
|
|
223
302
|
const { success, data: payload } = response.data;
|
|
224
303
|
if (!success) {
|
|
225
|
-
|
|
304
|
+
const errorMessage = payload?.message || (0, import_i18n.__)("Unexpected response from server", "elementor");
|
|
305
|
+
throw new Error(errorMessage);
|
|
226
306
|
}
|
|
227
307
|
return payload;
|
|
228
308
|
}).then((data) => {
|
|
@@ -237,6 +317,9 @@ var service = {
|
|
|
237
317
|
id: variableId,
|
|
238
318
|
variable: updatedVariable
|
|
239
319
|
};
|
|
320
|
+
}).catch((error) => {
|
|
321
|
+
const message = getErrorMessage(error.response);
|
|
322
|
+
throw message ? new Error(message) : error;
|
|
240
323
|
});
|
|
241
324
|
},
|
|
242
325
|
delete: (id) => {
|
|
@@ -288,6 +371,12 @@ var handleWatermark = (operation, newWatermark) => {
|
|
|
288
371
|
}
|
|
289
372
|
storage.watermark(newWatermark);
|
|
290
373
|
};
|
|
374
|
+
var getErrorMessage = (response) => {
|
|
375
|
+
if (response?.data?.code === "duplicated_label") {
|
|
376
|
+
return (0, import_i18n.__)("This variable name already exists. Please choose a unique name.", "elementor");
|
|
377
|
+
}
|
|
378
|
+
return (0, import_i18n.__)("There was a glitch. Try saving your variable again.", "elementor");
|
|
379
|
+
};
|
|
291
380
|
|
|
292
381
|
// src/hooks/use-prop-variables.ts
|
|
293
382
|
var useVariable = (key) => {
|
|
@@ -338,109 +427,133 @@ var deleteVariable = (deleteId) => {
|
|
|
338
427
|
return id;
|
|
339
428
|
});
|
|
340
429
|
};
|
|
430
|
+
var restoreVariable = (restoreId) => {
|
|
431
|
+
return service.restore(restoreId).then(({ id }) => {
|
|
432
|
+
return id;
|
|
433
|
+
});
|
|
434
|
+
};
|
|
341
435
|
|
|
342
|
-
// src/components/
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}));
|
|
436
|
+
// src/components/fields/color-field.tsx
|
|
437
|
+
var React = __toESM(require("react"));
|
|
438
|
+
var import_react3 = require("react");
|
|
439
|
+
var import_ui2 = require("@elementor/ui");
|
|
440
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
348
441
|
|
|
349
|
-
// src/
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
442
|
+
// src/utils/validations.ts
|
|
443
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
444
|
+
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
445
|
+
var validateLabel = (name) => {
|
|
446
|
+
if (!name.trim()) {
|
|
447
|
+
return (0, import_i18n2.__)("Give your variable a name.", "elementor");
|
|
448
|
+
}
|
|
449
|
+
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
450
|
+
if (!allowedChars.test(name)) {
|
|
451
|
+
return (0, import_i18n2.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor");
|
|
452
|
+
}
|
|
453
|
+
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
454
|
+
if (!hasAlphanumeric.test(name)) {
|
|
455
|
+
return (0, import_i18n2.__)("Names have to include at least one non-special character.", "elementor");
|
|
456
|
+
}
|
|
457
|
+
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
458
|
+
return (0, import_i18n2.__)("Keep names up to 50 characters.", "elementor");
|
|
459
|
+
}
|
|
460
|
+
return "";
|
|
357
461
|
};
|
|
358
|
-
var
|
|
359
|
-
const
|
|
360
|
-
|
|
462
|
+
var labelHint = (name) => {
|
|
463
|
+
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
464
|
+
if (hintThreshold < name.length) {
|
|
465
|
+
return (0, import_i18n2.__)("Keep names up to 50 characters.", "elementor");
|
|
466
|
+
}
|
|
467
|
+
return "";
|
|
361
468
|
};
|
|
362
|
-
var
|
|
363
|
-
|
|
364
|
-
|
|
469
|
+
var validateValue = (value) => {
|
|
470
|
+
if (!value.trim()) {
|
|
471
|
+
return (0, import_i18n2.__)("Add a value to complete your variable.", "elementor");
|
|
472
|
+
}
|
|
473
|
+
return "";
|
|
365
474
|
};
|
|
366
475
|
|
|
367
|
-
// src/
|
|
368
|
-
var
|
|
369
|
-
var
|
|
370
|
-
var
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
var import_ui14 = require("@elementor/ui");
|
|
476
|
+
// src/components/variable-selection-popover.context.ts
|
|
477
|
+
var import_react2 = require("react");
|
|
478
|
+
var PopoverContentRefContext = (0, import_react2.createContext)(null);
|
|
479
|
+
var usePopoverContentRef = () => {
|
|
480
|
+
return (0, import_react2.useContext)(PopoverContentRefContext);
|
|
481
|
+
};
|
|
374
482
|
|
|
375
|
-
// src/components/
|
|
376
|
-
var
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
import_ui2.UnstableTag,
|
|
483
|
+
// src/components/fields/color-field.tsx
|
|
484
|
+
var ColorField = ({ value, onChange }) => {
|
|
485
|
+
const [color, setColor] = (0, import_react3.useState)(value);
|
|
486
|
+
const [errorMessage, setErrorMessage] = (0, import_react3.useState)("");
|
|
487
|
+
const defaultRef = (0, import_react3.useRef)(null);
|
|
488
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
489
|
+
const handleChange = (newValue) => {
|
|
490
|
+
setColor(newValue);
|
|
491
|
+
const errorMsg = validateValue(newValue);
|
|
492
|
+
setErrorMessage(errorMsg);
|
|
493
|
+
onChange(errorMsg ? "" : newValue);
|
|
494
|
+
};
|
|
495
|
+
return /* @__PURE__ */ React.createElement(import_ui2.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(import_ui2.FormLabel, { size: "tiny" }, (0, import_i18n3.__)("Value", "elementor"))), /* @__PURE__ */ React.createElement(import_ui2.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
|
|
496
|
+
import_ui2.UnstableColorField,
|
|
390
497
|
{
|
|
498
|
+
size: "tiny",
|
|
391
499
|
fullWidth: true,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
500
|
+
value: color,
|
|
501
|
+
onChange: handleChange,
|
|
502
|
+
error: errorMessage ?? void 0,
|
|
503
|
+
slotProps: {
|
|
504
|
+
colorPicker: {
|
|
505
|
+
anchorEl: anchorRef.current,
|
|
506
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
507
|
+
transformOrigin: { vertical: "top", horizontal: -10 }
|
|
508
|
+
}
|
|
509
|
+
}
|
|
397
510
|
}
|
|
398
|
-
);
|
|
511
|
+
), errorMessage && /* @__PURE__ */ React.createElement(import_ui2.FormHelperText, { error: true }, errorMessage)));
|
|
399
512
|
};
|
|
400
513
|
|
|
401
|
-
// src/components/
|
|
402
|
-
var
|
|
403
|
-
var
|
|
404
|
-
var import_ui13 = require("@elementor/ui");
|
|
405
|
-
|
|
406
|
-
// src/prop-types/color-variable-prop-type.ts
|
|
407
|
-
var import_editor_props = require("@elementor/editor-props");
|
|
408
|
-
var import_schema = require("@elementor/schema");
|
|
409
|
-
var colorVariablePropTypeUtil = (0, import_editor_props.createPropUtils)("global-color-variable", import_schema.z.string());
|
|
410
|
-
|
|
411
|
-
// src/prop-types/font-variable-prop-type.ts
|
|
412
|
-
var import_editor_props2 = require("@elementor/editor-props");
|
|
413
|
-
var import_schema2 = require("@elementor/schema");
|
|
414
|
-
var fontVariablePropTypeUtil = (0, import_editor_props2.createPropUtils)("global-font-variable", import_schema2.z.string());
|
|
415
|
-
|
|
416
|
-
// src/components/color-variable-creation.tsx
|
|
417
|
-
var React3 = __toESM(require("react"));
|
|
418
|
-
var import_react3 = require("react");
|
|
419
|
-
var import_editor_controls = require("@elementor/editor-controls");
|
|
420
|
-
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
421
|
-
var import_editor_ui = require("@elementor/editor-ui");
|
|
422
|
-
var import_icons2 = require("@elementor/icons");
|
|
514
|
+
// src/components/fields/label-field.tsx
|
|
515
|
+
var React2 = __toESM(require("react"));
|
|
516
|
+
var import_react4 = require("react");
|
|
423
517
|
var import_ui3 = require("@elementor/ui");
|
|
424
|
-
var
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
518
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
519
|
+
var LabelField = ({ value, onChange }) => {
|
|
520
|
+
const [label, setLabel] = (0, import_react4.useState)(value);
|
|
521
|
+
const [errorMessage, setErrorMessage] = (0, import_react4.useState)("");
|
|
522
|
+
const [noticeMessage, setNoticeMessage] = (0, import_react4.useState)(() => labelHint(value));
|
|
523
|
+
const handleChange = (newValue) => {
|
|
524
|
+
setLabel(newValue);
|
|
525
|
+
const errorMsg = validateLabel(newValue);
|
|
526
|
+
const hintMsg = labelHint(newValue);
|
|
527
|
+
setErrorMessage(errorMsg);
|
|
528
|
+
setNoticeMessage(errorMsg ? "" : hintMsg);
|
|
529
|
+
onChange(errorMsg ? "" : newValue);
|
|
530
|
+
};
|
|
531
|
+
const id = (0, import_react4.useId)();
|
|
532
|
+
return /* @__PURE__ */ React2.createElement(import_ui3.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui3.FormLabel, { htmlFor: id, size: "tiny" }, (0, import_i18n4.__)("Name", "elementor"))), /* @__PURE__ */ React2.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
|
|
533
|
+
import_ui3.TextField,
|
|
534
|
+
{
|
|
535
|
+
id,
|
|
536
|
+
size: "tiny",
|
|
537
|
+
fullWidth: true,
|
|
538
|
+
value: label,
|
|
539
|
+
error: !!errorMessage,
|
|
540
|
+
onChange: (e) => handleChange(e.target.value),
|
|
541
|
+
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH }
|
|
542
|
+
}
|
|
543
|
+
), errorMessage && /* @__PURE__ */ React2.createElement(import_ui3.FormHelperText, { error: true }, errorMessage), noticeMessage && /* @__PURE__ */ React2.createElement(import_ui3.FormHelperText, null, noticeMessage)));
|
|
431
544
|
};
|
|
432
545
|
|
|
433
546
|
// src/components/color-variable-creation.tsx
|
|
434
|
-
var
|
|
547
|
+
var SIZE = "tiny";
|
|
435
548
|
var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
436
549
|
const { setValue: setVariable } = (0, import_editor_controls.useBoundProp)(colorVariablePropTypeUtil);
|
|
437
|
-
const [color, setColor] = (0,
|
|
438
|
-
const [label, setLabel] = (0,
|
|
439
|
-
const
|
|
440
|
-
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
550
|
+
const [color, setColor] = (0, import_react5.useState)("");
|
|
551
|
+
const [label, setLabel] = (0, import_react5.useState)("");
|
|
552
|
+
const [errorMessage, setErrorMessage] = (0, import_react5.useState)("");
|
|
441
553
|
const resetFields = () => {
|
|
442
554
|
setColor("");
|
|
443
555
|
setLabel("");
|
|
556
|
+
setErrorMessage("");
|
|
444
557
|
};
|
|
445
558
|
const closePopover = () => {
|
|
446
559
|
resetFields();
|
|
@@ -454,139 +567,193 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
454
567
|
}).then((key) => {
|
|
455
568
|
setVariable(key);
|
|
456
569
|
closePopover();
|
|
570
|
+
}).catch((error) => {
|
|
571
|
+
setErrorMessage(error.message);
|
|
457
572
|
});
|
|
458
573
|
};
|
|
459
|
-
const
|
|
460
|
-
return
|
|
574
|
+
const hasEmptyValue = () => {
|
|
575
|
+
return "" === color.trim() || "" === label.trim();
|
|
461
576
|
};
|
|
462
|
-
|
|
577
|
+
const isSubmitDisabled = hasEmptyValue();
|
|
578
|
+
return /* @__PURE__ */ React3.createElement(import_editor_editing_panel.PopoverBody, { height: "auto" }, /* @__PURE__ */ React3.createElement(
|
|
463
579
|
import_editor_ui.PopoverHeader,
|
|
464
580
|
{
|
|
465
|
-
icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(
|
|
466
|
-
title: (0,
|
|
581
|
+
icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(import_ui4.IconButton, { size: SIZE, "aria-label": (0, import_i18n5.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React3.createElement(import_icons.ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React3.createElement(import_icons.BrushIcon, { fontSize: SIZE })),
|
|
582
|
+
title: (0, import_i18n5.__)("Create variable", "elementor"),
|
|
467
583
|
onClose: closePopover
|
|
468
584
|
}
|
|
469
|
-
), /* @__PURE__ */ React3.createElement(
|
|
470
|
-
|
|
585
|
+
), /* @__PURE__ */ React3.createElement(import_ui4.Divider, null), /* @__PURE__ */ React3.createElement(import_editor_controls.PopoverContent, { p: 2 }, /* @__PURE__ */ React3.createElement(
|
|
586
|
+
LabelField,
|
|
471
587
|
{
|
|
472
|
-
size: "tiny",
|
|
473
|
-
fullWidth: true,
|
|
474
588
|
value: label,
|
|
475
|
-
onChange: (
|
|
589
|
+
onChange: (value) => {
|
|
590
|
+
setLabel(value);
|
|
591
|
+
setErrorMessage("");
|
|
592
|
+
}
|
|
476
593
|
}
|
|
477
|
-
)
|
|
478
|
-
|
|
594
|
+
), /* @__PURE__ */ React3.createElement(
|
|
595
|
+
ColorField,
|
|
479
596
|
{
|
|
480
|
-
size: "tiny",
|
|
481
|
-
fullWidth: true,
|
|
482
597
|
value: color,
|
|
483
|
-
onChange:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
anchorEl: anchorRef.current,
|
|
487
|
-
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
488
|
-
transformOrigin: { vertical: "top", horizontal: -10 }
|
|
489
|
-
}
|
|
598
|
+
onChange: (value) => {
|
|
599
|
+
setColor(value);
|
|
600
|
+
setErrorMessage("");
|
|
490
601
|
}
|
|
491
602
|
}
|
|
492
|
-
)))
|
|
603
|
+
), errorMessage && /* @__PURE__ */ React3.createElement(import_ui4.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React3.createElement(import_ui4.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React3.createElement(import_ui4.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreate }, (0, import_i18n5.__)("Create", "elementor"))));
|
|
493
604
|
};
|
|
494
605
|
|
|
495
606
|
// src/components/color-variable-edit.tsx
|
|
496
|
-
var
|
|
497
|
-
var
|
|
607
|
+
var React5 = __toESM(require("react"));
|
|
608
|
+
var import_react6 = require("react");
|
|
498
609
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
610
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
499
611
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
500
612
|
var import_icons3 = require("@elementor/icons");
|
|
501
|
-
var
|
|
502
|
-
var
|
|
503
|
-
|
|
613
|
+
var import_ui6 = require("@elementor/ui");
|
|
614
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
615
|
+
|
|
616
|
+
// src/components/ui/delete-confirmation-dialog.tsx
|
|
617
|
+
var React4 = __toESM(require("react"));
|
|
618
|
+
var import_icons2 = require("@elementor/icons");
|
|
619
|
+
var import_ui5 = require("@elementor/ui");
|
|
620
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
621
|
+
var TITLE_ID = "delete-variable-dialog";
|
|
622
|
+
var DeleteConfirmationDialog = ({
|
|
623
|
+
open,
|
|
624
|
+
label,
|
|
625
|
+
closeDialog,
|
|
626
|
+
onConfirm
|
|
627
|
+
}) => {
|
|
628
|
+
return /* @__PURE__ */ React4.createElement(import_ui5.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React4.createElement(import_ui5.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React4.createElement(import_icons2.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n6.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React4.createElement(import_ui5.DialogContent, null, /* @__PURE__ */ React4.createElement(import_ui5.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n6.__)("All elements using", "elementor"), /* @__PURE__ */ React4.createElement(import_ui5.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), (0, import_i18n6.__)("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React4.createElement(import_ui5.DialogActions, null, /* @__PURE__ */ React4.createElement(import_ui5.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n6.__)("Not now", "elementor")), /* @__PURE__ */ React4.createElement(import_ui5.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n6.__)("Delete", "elementor"))));
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
// src/components/color-variable-edit.tsx
|
|
632
|
+
var SIZE2 = "tiny";
|
|
504
633
|
var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
634
|
+
const { setValue: notifyBoundPropChange, value: assignedValue } = (0, import_editor_controls2.useBoundProp)(colorVariablePropTypeUtil);
|
|
635
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react6.useState)(false);
|
|
636
|
+
const [errorMessage, setErrorMessage] = (0, import_react6.useState)("");
|
|
505
637
|
const variable = useVariable(editId);
|
|
506
638
|
if (!variable) {
|
|
507
639
|
throw new Error(`Global color variable not found`);
|
|
508
640
|
}
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
const [color, setColor] = (0, import_react4.useState)(variable.value);
|
|
512
|
-
const [label, setLabel] = (0, import_react4.useState)(variable.label);
|
|
641
|
+
const [color, setColor] = (0, import_react6.useState)(variable.value);
|
|
642
|
+
const [label, setLabel] = (0, import_react6.useState)(variable.label);
|
|
513
643
|
const handleUpdate = () => {
|
|
514
644
|
updateVariable(editId, {
|
|
515
645
|
value: color,
|
|
516
646
|
label
|
|
517
647
|
}).then(() => {
|
|
648
|
+
maybeTriggerBoundPropChange();
|
|
518
649
|
onSubmit?.();
|
|
650
|
+
}).catch((error) => {
|
|
651
|
+
setErrorMessage(error.message);
|
|
519
652
|
});
|
|
520
653
|
};
|
|
521
654
|
const handleDelete = () => {
|
|
522
655
|
deleteVariable(editId).then(() => {
|
|
656
|
+
maybeTriggerBoundPropChange();
|
|
523
657
|
onSubmit?.();
|
|
524
658
|
});
|
|
525
659
|
};
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
660
|
+
const maybeTriggerBoundPropChange = () => {
|
|
661
|
+
if (editId === assignedValue) {
|
|
662
|
+
notifyBoundPropChange(editId);
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
const handleDeleteConfirmation = () => {
|
|
666
|
+
setDeleteConfirmation(true);
|
|
667
|
+
};
|
|
668
|
+
const closeDeleteDialog = () => () => {
|
|
669
|
+
setDeleteConfirmation(false);
|
|
670
|
+
};
|
|
529
671
|
const actions = [];
|
|
530
672
|
actions.push(
|
|
531
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ React5.createElement(
|
|
674
|
+
import_ui6.IconButton,
|
|
675
|
+
{
|
|
676
|
+
key: "delete",
|
|
677
|
+
size: SIZE2,
|
|
678
|
+
"aria-label": (0, import_i18n7.__)("Delete", "elementor"),
|
|
679
|
+
onClick: handleDeleteConfirmation
|
|
680
|
+
},
|
|
681
|
+
/* @__PURE__ */ React5.createElement(import_icons3.TrashIcon, { fontSize: SIZE2 })
|
|
682
|
+
)
|
|
532
683
|
);
|
|
533
|
-
|
|
684
|
+
const hasEmptyValues = () => {
|
|
685
|
+
return !color.trim() || !label.trim();
|
|
686
|
+
};
|
|
687
|
+
const noValueChanged = () => {
|
|
688
|
+
return color === variable.value && label === variable.label;
|
|
689
|
+
};
|
|
690
|
+
const isSubmitDisabled = noValueChanged() || hasEmptyValues();
|
|
691
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React5.createElement(
|
|
534
692
|
import_editor_ui2.PopoverHeader,
|
|
535
693
|
{
|
|
536
|
-
title: (0,
|
|
694
|
+
title: (0, import_i18n7.__)("Edit variable", "elementor"),
|
|
537
695
|
onClose,
|
|
538
|
-
icon: /* @__PURE__ */
|
|
696
|
+
icon: /* @__PURE__ */ React5.createElement(React5.Fragment, null, onGoBack && /* @__PURE__ */ React5.createElement(
|
|
697
|
+
import_ui6.IconButton,
|
|
698
|
+
{
|
|
699
|
+
size: SIZE2,
|
|
700
|
+
"aria-label": (0, import_i18n7.__)("Go Back", "elementor"),
|
|
701
|
+
onClick: onGoBack
|
|
702
|
+
},
|
|
703
|
+
/* @__PURE__ */ React5.createElement(import_icons3.ArrowLeftIcon, { fontSize: SIZE2 })
|
|
704
|
+
), /* @__PURE__ */ React5.createElement(import_icons3.BrushIcon, { fontSize: SIZE2 })),
|
|
539
705
|
actions
|
|
540
706
|
}
|
|
541
|
-
), /* @__PURE__ */
|
|
542
|
-
|
|
707
|
+
), /* @__PURE__ */ React5.createElement(import_ui6.Divider, null), /* @__PURE__ */ React5.createElement(import_editor_controls2.PopoverContent, { p: 2 }, /* @__PURE__ */ React5.createElement(
|
|
708
|
+
LabelField,
|
|
543
709
|
{
|
|
544
|
-
size: "tiny",
|
|
545
|
-
fullWidth: true,
|
|
546
710
|
value: label,
|
|
547
|
-
onChange: (
|
|
711
|
+
onChange: (value) => {
|
|
712
|
+
setLabel(value);
|
|
713
|
+
setErrorMessage("");
|
|
714
|
+
}
|
|
548
715
|
}
|
|
549
|
-
)
|
|
550
|
-
|
|
716
|
+
), /* @__PURE__ */ React5.createElement(
|
|
717
|
+
ColorField,
|
|
551
718
|
{
|
|
552
|
-
size: "tiny",
|
|
553
|
-
fullWidth: true,
|
|
554
719
|
value: color,
|
|
555
|
-
onChange:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
anchorEl: anchorRef.current,
|
|
559
|
-
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
560
|
-
transformOrigin: { vertical: "top", horizontal: -10 }
|
|
561
|
-
}
|
|
720
|
+
onChange: (value) => {
|
|
721
|
+
setColor(value);
|
|
722
|
+
setErrorMessage("");
|
|
562
723
|
}
|
|
563
724
|
}
|
|
564
|
-
)))
|
|
725
|
+
), errorMessage && /* @__PURE__ */ React5.createElement(import_ui6.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React5.createElement(import_ui6.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React5.createElement(import_ui6.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n7.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React5.createElement(
|
|
726
|
+
DeleteConfirmationDialog,
|
|
727
|
+
{
|
|
728
|
+
open: true,
|
|
729
|
+
label,
|
|
730
|
+
onConfirm: handleDelete,
|
|
731
|
+
closeDialog: closeDeleteDialog()
|
|
732
|
+
}
|
|
733
|
+
));
|
|
565
734
|
};
|
|
566
735
|
|
|
567
736
|
// src/components/color-variables-selection.tsx
|
|
568
|
-
var
|
|
569
|
-
var
|
|
737
|
+
var React9 = __toESM(require("react"));
|
|
738
|
+
var import_react7 = require("react");
|
|
570
739
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
571
|
-
var
|
|
740
|
+
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
572
741
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
573
742
|
var import_icons5 = require("@elementor/icons");
|
|
574
|
-
var
|
|
575
|
-
var
|
|
743
|
+
var import_ui11 = require("@elementor/ui");
|
|
744
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
576
745
|
|
|
577
746
|
// src/components/ui/menu-item-content.tsx
|
|
578
|
-
var
|
|
747
|
+
var React6 = __toESM(require("react"));
|
|
579
748
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
580
|
-
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
581
749
|
var import_icons4 = require("@elementor/icons");
|
|
582
|
-
var
|
|
583
|
-
var
|
|
584
|
-
var
|
|
585
|
-
var isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)("e_v_3_30");
|
|
750
|
+
var import_ui7 = require("@elementor/ui");
|
|
751
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
752
|
+
var SIZE3 = "tiny";
|
|
586
753
|
var MenuItemContent = ({ item }) => {
|
|
587
754
|
const onEdit = item.onEdit;
|
|
588
|
-
return /* @__PURE__ */
|
|
589
|
-
|
|
755
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui7.ListItemIcon, null, item.icon), /* @__PURE__ */ React6.createElement(
|
|
756
|
+
import_ui7.Box,
|
|
590
757
|
{
|
|
591
758
|
sx: {
|
|
592
759
|
flex: 1,
|
|
@@ -596,49 +763,49 @@ var MenuItemContent = ({ item }) => {
|
|
|
596
763
|
gap: 1
|
|
597
764
|
}
|
|
598
765
|
},
|
|
599
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ React6.createElement(
|
|
600
767
|
import_editor_ui3.EllipsisWithTooltip,
|
|
601
768
|
{
|
|
602
769
|
title: item.label || item.value,
|
|
603
|
-
as:
|
|
604
|
-
variant:
|
|
605
|
-
color:
|
|
770
|
+
as: import_ui7.Typography,
|
|
771
|
+
variant: "caption",
|
|
772
|
+
color: "text.primary",
|
|
606
773
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
607
774
|
maxWidth: "50%"
|
|
608
775
|
}
|
|
609
776
|
),
|
|
610
|
-
item.secondaryText && /* @__PURE__ */
|
|
777
|
+
item.secondaryText && /* @__PURE__ */ React6.createElement(
|
|
611
778
|
import_editor_ui3.EllipsisWithTooltip,
|
|
612
779
|
{
|
|
613
780
|
title: item.secondaryText,
|
|
614
|
-
as:
|
|
781
|
+
as: import_ui7.Typography,
|
|
615
782
|
variant: "caption",
|
|
616
783
|
color: "text.tertiary",
|
|
617
784
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
618
785
|
maxWidth: "50%"
|
|
619
786
|
}
|
|
620
787
|
)
|
|
621
|
-
), !!onEdit && /* @__PURE__ */
|
|
622
|
-
|
|
788
|
+
), !!onEdit && /* @__PURE__ */ React6.createElement(
|
|
789
|
+
import_ui7.IconButton,
|
|
623
790
|
{
|
|
624
791
|
sx: { mx: 1, opacity: "0" },
|
|
625
792
|
onClick: (e) => {
|
|
626
793
|
e.stopPropagation();
|
|
627
794
|
onEdit(item.value);
|
|
628
795
|
},
|
|
629
|
-
"aria-label": (0,
|
|
796
|
+
"aria-label": (0, import_i18n8.__)("Edit", "elementor")
|
|
630
797
|
},
|
|
631
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ React6.createElement(import_icons4.EditIcon, { color: "action", fontSize: SIZE3 })
|
|
632
799
|
));
|
|
633
800
|
};
|
|
634
801
|
|
|
635
802
|
// src/components/ui/no-search-results.tsx
|
|
636
|
-
var
|
|
637
|
-
var
|
|
638
|
-
var
|
|
803
|
+
var React7 = __toESM(require("react"));
|
|
804
|
+
var import_ui8 = require("@elementor/ui");
|
|
805
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
639
806
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
640
|
-
return /* @__PURE__ */
|
|
641
|
-
|
|
807
|
+
return /* @__PURE__ */ React7.createElement(
|
|
808
|
+
import_ui8.Stack,
|
|
642
809
|
{
|
|
643
810
|
gap: 1,
|
|
644
811
|
alignItems: "center",
|
|
@@ -649,17 +816,17 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
649
816
|
sx: { pb: 3.5 }
|
|
650
817
|
},
|
|
651
818
|
icon,
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ React7.createElement(import_ui8.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n9.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React7.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
820
|
+
/* @__PURE__ */ React7.createElement(import_ui8.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n9.__)("Try something else.", "elementor"), /* @__PURE__ */ React7.createElement(import_ui8.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n9.__)("Clear & try again", "elementor")))
|
|
654
821
|
);
|
|
655
822
|
};
|
|
656
823
|
|
|
657
824
|
// src/components/ui/no-variables.tsx
|
|
658
|
-
var
|
|
659
|
-
var
|
|
660
|
-
var
|
|
661
|
-
var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */
|
|
662
|
-
|
|
825
|
+
var React8 = __toESM(require("react"));
|
|
826
|
+
var import_ui9 = require("@elementor/ui");
|
|
827
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
828
|
+
var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React8.createElement(
|
|
829
|
+
import_ui9.Stack,
|
|
663
830
|
{
|
|
664
831
|
gap: 1,
|
|
665
832
|
alignItems: "center",
|
|
@@ -669,14 +836,14 @@ var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React7.createEleme
|
|
|
669
836
|
sx: { p: 2.5, pb: 5.5 }
|
|
670
837
|
},
|
|
671
838
|
icon,
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
onAdd && /* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ React8.createElement(import_ui9.Typography, { align: "center", variant: "subtitle2" }, title),
|
|
840
|
+
/* @__PURE__ */ React8.createElement(import_ui9.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, (0, import_i18n10.__)("Variables are saved attributes that you can apply anywhere on your site.", "elementor")),
|
|
841
|
+
onAdd && /* @__PURE__ */ React8.createElement(import_ui9.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n10.__)("Create a variable", "elementor"))
|
|
675
842
|
);
|
|
676
843
|
|
|
677
844
|
// src/components/ui/styled-menu-list.tsx
|
|
678
|
-
var
|
|
679
|
-
var VariablesStyledMenuList = (0,
|
|
845
|
+
var import_ui10 = require("@elementor/ui");
|
|
846
|
+
var VariablesStyledMenuList = (0, import_ui10.styled)(import_ui10.MenuList)(({ theme }) => ({
|
|
680
847
|
"& > li": {
|
|
681
848
|
height: 32,
|
|
682
849
|
width: "100%",
|
|
@@ -707,10 +874,10 @@ var VariablesStyledMenuList = (0, import_ui8.styled)(import_ui8.MenuList)(({ the
|
|
|
707
874
|
}));
|
|
708
875
|
|
|
709
876
|
// src/components/color-variables-selection.tsx
|
|
710
|
-
var
|
|
877
|
+
var SIZE4 = "tiny";
|
|
711
878
|
var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
712
879
|
const { value: variable, setValue: setVariable } = (0, import_editor_controls3.useBoundProp)(colorVariablePropTypeUtil);
|
|
713
|
-
const [searchValue, setSearchValue] = (0,
|
|
880
|
+
const [searchValue, setSearchValue] = (0, import_react7.useState)("");
|
|
714
881
|
const {
|
|
715
882
|
list: variables,
|
|
716
883
|
hasMatches: hasSearchResults,
|
|
@@ -723,19 +890,19 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
723
890
|
const actions = [];
|
|
724
891
|
if (onAdd) {
|
|
725
892
|
actions.push(
|
|
726
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ React9.createElement(import_ui11.IconButton, { key: "add", size: SIZE4, onClick: onAdd }, /* @__PURE__ */ React9.createElement(import_icons5.PlusIcon, { fontSize: SIZE4 }))
|
|
727
894
|
);
|
|
728
895
|
}
|
|
729
896
|
if (onSettings) {
|
|
730
897
|
actions.push(
|
|
731
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ React9.createElement(import_ui11.IconButton, { key: "settings", size: SIZE4, onClick: onSettings }, /* @__PURE__ */ React9.createElement(import_icons5.SettingsIcon, { fontSize: SIZE4 }))
|
|
732
899
|
);
|
|
733
900
|
}
|
|
734
901
|
const items = variables.map(({ value, label, key }) => ({
|
|
735
902
|
type: "item",
|
|
736
903
|
value: key,
|
|
737
904
|
label,
|
|
738
|
-
icon: /* @__PURE__ */
|
|
905
|
+
icon: /* @__PURE__ */ React9.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
739
906
|
secondaryText: value,
|
|
740
907
|
onEdit: () => onEdit?.(key)
|
|
741
908
|
}));
|
|
@@ -745,22 +912,22 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
745
912
|
const handleClearSearch = () => {
|
|
746
913
|
setSearchValue("");
|
|
747
914
|
};
|
|
748
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ React9.createElement(import_editor_editing_panel3.PopoverBody, null, /* @__PURE__ */ React9.createElement(
|
|
749
916
|
import_editor_ui4.PopoverHeader,
|
|
750
917
|
{
|
|
751
|
-
title: (0,
|
|
752
|
-
icon: /* @__PURE__ */
|
|
918
|
+
title: (0, import_i18n11.__)("Variables", "elementor"),
|
|
919
|
+
icon: /* @__PURE__ */ React9.createElement(import_icons5.ColorFilterIcon, { fontSize: SIZE4 }),
|
|
753
920
|
onClose: closePopover,
|
|
754
921
|
actions
|
|
755
922
|
}
|
|
756
|
-
), hasVariables && /* @__PURE__ */
|
|
923
|
+
), hasVariables && /* @__PURE__ */ React9.createElement(
|
|
757
924
|
import_editor_ui4.PopoverSearch,
|
|
758
925
|
{
|
|
759
926
|
value: searchValue,
|
|
760
927
|
onSearch: handleSearch,
|
|
761
|
-
placeholder: (0,
|
|
928
|
+
placeholder: (0, import_i18n11.__)("Search", "elementor")
|
|
762
929
|
}
|
|
763
|
-
), /* @__PURE__ */
|
|
930
|
+
), /* @__PURE__ */ React9.createElement(import_ui11.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React9.createElement(
|
|
764
931
|
import_editor_ui4.PopoverMenuList,
|
|
765
932
|
{
|
|
766
933
|
items,
|
|
@@ -770,45 +937,104 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
770
937
|
selectedValue: variable,
|
|
771
938
|
"data-testid": "color-variables-list",
|
|
772
939
|
menuListTemplate: VariablesStyledMenuList,
|
|
773
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
940
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React9.createElement(MenuItemContent, { item })
|
|
774
941
|
}
|
|
775
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
942
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React9.createElement(
|
|
776
943
|
NoSearchResults,
|
|
777
944
|
{
|
|
778
945
|
searchValue,
|
|
779
946
|
onClear: handleClearSearch,
|
|
780
|
-
icon: /* @__PURE__ */
|
|
947
|
+
icon: /* @__PURE__ */ React9.createElement(import_icons5.BrushIcon, { fontSize: "large" })
|
|
781
948
|
}
|
|
782
|
-
), !hasVariables && /* @__PURE__ */
|
|
949
|
+
), !hasVariables && /* @__PURE__ */ React9.createElement(
|
|
783
950
|
NoVariables,
|
|
784
951
|
{
|
|
785
|
-
title: (0,
|
|
786
|
-
icon: /* @__PURE__ */
|
|
952
|
+
title: (0, import_i18n11.__)("Create your first color variable", "elementor"),
|
|
953
|
+
icon: /* @__PURE__ */ React9.createElement(import_icons5.BrushIcon, { fontSize: "large" }),
|
|
787
954
|
onAdd
|
|
788
955
|
}
|
|
789
|
-
))
|
|
956
|
+
));
|
|
790
957
|
};
|
|
791
958
|
|
|
792
959
|
// src/components/font-variable-creation.tsx
|
|
793
|
-
var
|
|
794
|
-
var
|
|
795
|
-
var
|
|
796
|
-
var
|
|
960
|
+
var React11 = __toESM(require("react"));
|
|
961
|
+
var import_react9 = require("react");
|
|
962
|
+
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
963
|
+
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
797
964
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
965
|
+
var import_icons7 = require("@elementor/icons");
|
|
966
|
+
var import_ui13 = require("@elementor/ui");
|
|
967
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
968
|
+
|
|
969
|
+
// src/components/fields/font-field.tsx
|
|
970
|
+
var React10 = __toESM(require("react"));
|
|
971
|
+
var import_react8 = require("react");
|
|
972
|
+
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
973
|
+
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
798
974
|
var import_icons6 = require("@elementor/icons");
|
|
799
|
-
var
|
|
800
|
-
var
|
|
801
|
-
var
|
|
975
|
+
var import_ui12 = require("@elementor/ui");
|
|
976
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
977
|
+
var FontField = ({ value, onChange }) => {
|
|
978
|
+
const [fontFamily, setFontFamily] = (0, import_react8.useState)(value);
|
|
979
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
980
|
+
const defaultRef = (0, import_react8.useRef)(null);
|
|
981
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
982
|
+
const fontPopoverState = (0, import_ui12.usePopupState)({ variant: "popover" });
|
|
983
|
+
const fontFamilies = (0, import_editor_editing_panel4.useFontFamilies)();
|
|
984
|
+
const sectionWidth = (0, import_editor_editing_panel4.useSectionWidth)();
|
|
985
|
+
const handleChange = (newValue) => {
|
|
986
|
+
setFontFamily(newValue);
|
|
987
|
+
const errorMsg = validateValue(newValue);
|
|
988
|
+
setErrorMessage(errorMsg);
|
|
989
|
+
onChange(errorMsg ? "" : newValue);
|
|
990
|
+
};
|
|
991
|
+
const handleFontFamilyChange = (newFontFamily) => {
|
|
992
|
+
handleChange(newFontFamily);
|
|
993
|
+
fontPopoverState.close();
|
|
994
|
+
};
|
|
995
|
+
return /* @__PURE__ */ React10.createElement(import_ui12.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui12.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(import_ui12.FormLabel, { size: "tiny" }, (0, import_i18n12.__)("Value", "elementor"))), /* @__PURE__ */ React10.createElement(import_ui12.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(
|
|
996
|
+
import_ui12.UnstableTag,
|
|
997
|
+
{
|
|
998
|
+
variant: "outlined",
|
|
999
|
+
label: fontFamily,
|
|
1000
|
+
endIcon: /* @__PURE__ */ React10.createElement(import_icons6.ChevronDownIcon, { fontSize: "tiny" }),
|
|
1001
|
+
...(0, import_ui12.bindTrigger)(fontPopoverState),
|
|
1002
|
+
fullWidth: true
|
|
1003
|
+
}
|
|
1004
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1005
|
+
import_ui12.Popover,
|
|
1006
|
+
{
|
|
1007
|
+
disablePortal: true,
|
|
1008
|
+
disableScrollLock: true,
|
|
1009
|
+
anchorEl: anchorRef.current,
|
|
1010
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
1011
|
+
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
1012
|
+
...(0, import_ui12.bindPopover)(fontPopoverState)
|
|
1013
|
+
},
|
|
1014
|
+
/* @__PURE__ */ React10.createElement(
|
|
1015
|
+
import_editor_controls4.FontFamilySelector,
|
|
1016
|
+
{
|
|
1017
|
+
fontFamilies,
|
|
1018
|
+
fontFamily,
|
|
1019
|
+
onFontFamilyChange: handleFontFamilyChange,
|
|
1020
|
+
onClose: fontPopoverState.close,
|
|
1021
|
+
sectionWidth
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
), errorMessage && /* @__PURE__ */ React10.createElement(import_ui12.FormHelperText, { error: true }, errorMessage)));
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
// src/components/font-variable-creation.tsx
|
|
1028
|
+
var SIZE5 = "tiny";
|
|
802
1029
|
var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
803
|
-
const
|
|
804
|
-
const
|
|
805
|
-
const [
|
|
806
|
-
const [
|
|
807
|
-
const anchorRef = (0, import_react6.useRef)(null);
|
|
808
|
-
const fontPopoverState = (0, import_ui10.usePopupState)({ variant: "popover" });
|
|
1030
|
+
const { setValue: setVariable } = (0, import_editor_controls5.useBoundProp)(fontVariablePropTypeUtil);
|
|
1031
|
+
const [fontFamily, setFontFamily] = (0, import_react9.useState)("");
|
|
1032
|
+
const [label, setLabel] = (0, import_react9.useState)("");
|
|
1033
|
+
const [errorMessage, setErrorMessage] = (0, import_react9.useState)("");
|
|
809
1034
|
const resetFields = () => {
|
|
810
1035
|
setFontFamily("");
|
|
811
1036
|
setLabel("");
|
|
1037
|
+
setErrorMessage("");
|
|
812
1038
|
};
|
|
813
1039
|
const closePopover = () => {
|
|
814
1040
|
resetFields();
|
|
@@ -822,165 +1048,168 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
|
822
1048
|
}).then((key) => {
|
|
823
1049
|
setVariable(key);
|
|
824
1050
|
closePopover();
|
|
1051
|
+
}).catch((error) => {
|
|
1052
|
+
setErrorMessage(error.message);
|
|
825
1053
|
});
|
|
826
1054
|
};
|
|
827
|
-
const
|
|
828
|
-
return
|
|
1055
|
+
const hasEmptyValue = () => {
|
|
1056
|
+
return "" === fontFamily.trim() || "" === label.trim();
|
|
829
1057
|
};
|
|
830
|
-
const
|
|
831
|
-
return /* @__PURE__ */
|
|
1058
|
+
const isSubmitDisabled = hasEmptyValue();
|
|
1059
|
+
return /* @__PURE__ */ React11.createElement(import_editor_editing_panel5.PopoverBody, { height: "auto" }, /* @__PURE__ */ React11.createElement(
|
|
832
1060
|
import_editor_ui5.PopoverHeader,
|
|
833
1061
|
{
|
|
834
|
-
icon: /* @__PURE__ */
|
|
835
|
-
title: (0,
|
|
1062
|
+
icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(import_ui13.IconButton, { size: SIZE5, "aria-label": (0, import_i18n13.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React11.createElement(import_icons7.ArrowLeftIcon, { fontSize: SIZE5 })), /* @__PURE__ */ React11.createElement(import_icons7.TextIcon, { fontSize: SIZE5 })),
|
|
1063
|
+
title: (0, import_i18n13.__)("Create variable", "elementor"),
|
|
836
1064
|
onClose: closePopover
|
|
837
1065
|
}
|
|
838
|
-
), /* @__PURE__ */
|
|
839
|
-
|
|
1066
|
+
), /* @__PURE__ */ React11.createElement(import_ui13.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React11.createElement(
|
|
1067
|
+
LabelField,
|
|
840
1068
|
{
|
|
841
|
-
size: "tiny",
|
|
842
|
-
fullWidth: true,
|
|
843
1069
|
value: label,
|
|
844
|
-
onChange: (
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
{
|
|
849
|
-
variant: "outlined",
|
|
850
|
-
label: fontFamily,
|
|
851
|
-
endIcon: /* @__PURE__ */ React9.createElement(import_icons6.ChevronDownIcon, { fontSize: "tiny" }),
|
|
852
|
-
...(0, import_ui10.bindTrigger)(fontPopoverState),
|
|
853
|
-
fullWidth: true
|
|
1070
|
+
onChange: (value) => {
|
|
1071
|
+
setLabel(value);
|
|
1072
|
+
setErrorMessage("");
|
|
1073
|
+
}
|
|
854
1074
|
}
|
|
855
|
-
), /* @__PURE__ */
|
|
856
|
-
|
|
1075
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1076
|
+
FontField,
|
|
857
1077
|
{
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
863
|
-
...(0, import_ui10.bindPopover)(fontPopoverState)
|
|
864
|
-
},
|
|
865
|
-
/* @__PURE__ */ React9.createElement(
|
|
866
|
-
import_editor_controls4.FontFamilySelector,
|
|
867
|
-
{
|
|
868
|
-
fontFamilies,
|
|
869
|
-
fontFamily,
|
|
870
|
-
onFontFamilyChange: setFontFamily,
|
|
871
|
-
onClose: fontPopoverState.close,
|
|
872
|
-
sectionWidth
|
|
1078
|
+
value: fontFamily,
|
|
1079
|
+
onChange: (value) => {
|
|
1080
|
+
setFontFamily(value);
|
|
1081
|
+
setErrorMessage("");
|
|
873
1082
|
}
|
|
874
|
-
|
|
875
|
-
)))
|
|
1083
|
+
}
|
|
1084
|
+
), errorMessage && /* @__PURE__ */ React11.createElement(import_ui13.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React11.createElement(import_ui13.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(import_ui13.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreate }, (0, import_i18n13.__)("Create", "elementor"))));
|
|
876
1085
|
};
|
|
877
1086
|
|
|
878
1087
|
// src/components/font-variable-edit.tsx
|
|
879
|
-
var
|
|
880
|
-
var
|
|
881
|
-
var
|
|
882
|
-
var
|
|
1088
|
+
var React12 = __toESM(require("react"));
|
|
1089
|
+
var import_react10 = require("react");
|
|
1090
|
+
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
1091
|
+
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
883
1092
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
884
|
-
var
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
1093
|
+
var import_icons8 = require("@elementor/icons");
|
|
1094
|
+
var import_ui14 = require("@elementor/ui");
|
|
1095
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1096
|
+
var SIZE6 = "tiny";
|
|
888
1097
|
var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
1098
|
+
const { setValue: notifyBoundPropChange, value: assignedValue } = (0, import_editor_controls6.useBoundProp)(fontVariablePropTypeUtil);
|
|
1099
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react10.useState)(false);
|
|
1100
|
+
const [errorMessage, setErrorMessage] = (0, import_react10.useState)("");
|
|
889
1101
|
const variable = useVariable(editId);
|
|
890
1102
|
if (!variable) {
|
|
891
1103
|
throw new Error(`Global font variable "${editId}" not found`);
|
|
892
1104
|
}
|
|
893
|
-
const [fontFamily, setFontFamily] = (0,
|
|
894
|
-
const [label, setLabel] = (0,
|
|
895
|
-
const variableNameId = (0, import_react7.useId)();
|
|
896
|
-
const variableValueId = (0, import_react7.useId)();
|
|
897
|
-
const anchorRef = (0, import_react7.useRef)(null);
|
|
898
|
-
const fontPopoverState = (0, import_ui11.usePopupState)({ variant: "popover" });
|
|
899
|
-
const fontFamilies = (0, import_editor_editing_panel4.useFontFamilies)();
|
|
1105
|
+
const [fontFamily, setFontFamily] = (0, import_react10.useState)(variable.value);
|
|
1106
|
+
const [label, setLabel] = (0, import_react10.useState)(variable.label);
|
|
900
1107
|
const handleUpdate = () => {
|
|
901
1108
|
updateVariable(editId, {
|
|
902
1109
|
value: fontFamily,
|
|
903
1110
|
label
|
|
904
1111
|
}).then(() => {
|
|
1112
|
+
maybeTriggerBoundPropChange();
|
|
905
1113
|
onSubmit?.();
|
|
1114
|
+
}).catch((error) => {
|
|
1115
|
+
setErrorMessage(error.message);
|
|
906
1116
|
});
|
|
907
1117
|
};
|
|
908
1118
|
const handleDelete = () => {
|
|
909
1119
|
deleteVariable(editId).then(() => {
|
|
1120
|
+
maybeTriggerBoundPropChange();
|
|
910
1121
|
onSubmit?.();
|
|
911
1122
|
});
|
|
912
1123
|
};
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1124
|
+
const maybeTriggerBoundPropChange = () => {
|
|
1125
|
+
if (editId === assignedValue) {
|
|
1126
|
+
notifyBoundPropChange(editId);
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
const handleDeleteConfirmation = () => {
|
|
1130
|
+
setDeleteConfirmation(true);
|
|
1131
|
+
};
|
|
1132
|
+
const closeDeleteDialog = () => () => {
|
|
1133
|
+
setDeleteConfirmation(false);
|
|
1134
|
+
};
|
|
1135
|
+
const hasEmptyValue = () => {
|
|
1136
|
+
return !fontFamily.trim() || !label.trim();
|
|
1137
|
+
};
|
|
1138
|
+
const noValueChanged = () => {
|
|
1139
|
+
return fontFamily === variable.value && label === variable.label;
|
|
1140
|
+
};
|
|
1141
|
+
const isSubmitDisabled = noValueChanged() || hasEmptyValue();
|
|
917
1142
|
const actions = [];
|
|
918
1143
|
actions.push(
|
|
919
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ React12.createElement(
|
|
1145
|
+
import_ui14.IconButton,
|
|
1146
|
+
{
|
|
1147
|
+
key: "delete",
|
|
1148
|
+
size: SIZE6,
|
|
1149
|
+
"aria-label": (0, import_i18n14.__)("Delete", "elementor"),
|
|
1150
|
+
onClick: handleDeleteConfirmation
|
|
1151
|
+
},
|
|
1152
|
+
/* @__PURE__ */ React12.createElement(import_icons8.TrashIcon, { fontSize: SIZE6 })
|
|
1153
|
+
)
|
|
920
1154
|
);
|
|
921
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_editor_editing_panel6.PopoverBody, { height: "auto" }, /* @__PURE__ */ React12.createElement(
|
|
922
1156
|
import_editor_ui6.PopoverHeader,
|
|
923
1157
|
{
|
|
924
|
-
icon: /* @__PURE__ */
|
|
925
|
-
|
|
1158
|
+
icon: /* @__PURE__ */ React12.createElement(React12.Fragment, null, onGoBack && /* @__PURE__ */ React12.createElement(
|
|
1159
|
+
import_ui14.IconButton,
|
|
1160
|
+
{
|
|
1161
|
+
size: SIZE6,
|
|
1162
|
+
"aria-label": (0, import_i18n14.__)("Go Back", "elementor"),
|
|
1163
|
+
onClick: onGoBack
|
|
1164
|
+
},
|
|
1165
|
+
/* @__PURE__ */ React12.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE6 })
|
|
1166
|
+
), /* @__PURE__ */ React12.createElement(import_icons8.TextIcon, { fontSize: SIZE6 })),
|
|
1167
|
+
title: (0, import_i18n14.__)("Edit variable", "elementor"),
|
|
926
1168
|
onClose,
|
|
927
1169
|
actions
|
|
928
1170
|
}
|
|
929
|
-
), /* @__PURE__ */
|
|
930
|
-
|
|
1171
|
+
), /* @__PURE__ */ React12.createElement(import_ui14.Divider, null), /* @__PURE__ */ React12.createElement(import_editor_controls6.PopoverContent, { p: 2 }, /* @__PURE__ */ React12.createElement(
|
|
1172
|
+
LabelField,
|
|
931
1173
|
{
|
|
932
|
-
id: variableNameId,
|
|
933
|
-
size: "tiny",
|
|
934
|
-
fullWidth: true,
|
|
935
1174
|
value: label,
|
|
936
|
-
onChange: (
|
|
1175
|
+
onChange: (value) => {
|
|
1176
|
+
setLabel(value);
|
|
1177
|
+
setErrorMessage("");
|
|
1178
|
+
}
|
|
937
1179
|
}
|
|
938
|
-
)
|
|
939
|
-
|
|
1180
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1181
|
+
FontField,
|
|
940
1182
|
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
fullWidth: true
|
|
1183
|
+
value: fontFamily,
|
|
1184
|
+
onChange: (value) => {
|
|
1185
|
+
setFontFamily(value);
|
|
1186
|
+
setErrorMessage("");
|
|
1187
|
+
}
|
|
947
1188
|
}
|
|
948
|
-
), /* @__PURE__ */
|
|
949
|
-
|
|
1189
|
+
), errorMessage && /* @__PURE__ */ React12.createElement(import_ui14.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React12.createElement(import_ui14.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React12.createElement(import_ui14.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n14.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React12.createElement(
|
|
1190
|
+
DeleteConfirmationDialog,
|
|
950
1191
|
{
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
},
|
|
958
|
-
/* @__PURE__ */ React10.createElement(
|
|
959
|
-
import_editor_controls5.FontFamilySelector,
|
|
960
|
-
{
|
|
961
|
-
fontFamilies,
|
|
962
|
-
fontFamily,
|
|
963
|
-
onFontFamilyChange: setFontFamily,
|
|
964
|
-
onClose: fontPopoverState.close,
|
|
965
|
-
sectionWidth
|
|
966
|
-
}
|
|
967
|
-
)
|
|
968
|
-
))))), /* @__PURE__ */ React10.createElement(import_ui11.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(import_ui11.Button, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, (0, import_i18n9.__)("Save", "elementor"))));
|
|
1192
|
+
open: true,
|
|
1193
|
+
label,
|
|
1194
|
+
onConfirm: handleDelete,
|
|
1195
|
+
closeDialog: closeDeleteDialog()
|
|
1196
|
+
}
|
|
1197
|
+
));
|
|
969
1198
|
};
|
|
970
1199
|
|
|
971
1200
|
// src/components/font-variables-selection.tsx
|
|
972
|
-
var
|
|
973
|
-
var
|
|
974
|
-
var
|
|
975
|
-
var
|
|
1201
|
+
var React13 = __toESM(require("react"));
|
|
1202
|
+
var import_react11 = require("react");
|
|
1203
|
+
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
1204
|
+
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
976
1205
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
977
|
-
var
|
|
978
|
-
var
|
|
979
|
-
var
|
|
980
|
-
var
|
|
1206
|
+
var import_icons9 = require("@elementor/icons");
|
|
1207
|
+
var import_ui15 = require("@elementor/ui");
|
|
1208
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
1209
|
+
var SIZE7 = "tiny";
|
|
981
1210
|
var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
982
|
-
const { value: variable, setValue: setVariable } = (0,
|
|
983
|
-
const [searchValue, setSearchValue] = (0,
|
|
1211
|
+
const { value: variable, setValue: setVariable } = (0, import_editor_controls7.useBoundProp)(fontVariablePropTypeUtil);
|
|
1212
|
+
const [searchValue, setSearchValue] = (0, import_react11.useState)("");
|
|
984
1213
|
const {
|
|
985
1214
|
list: variables,
|
|
986
1215
|
hasMatches: hasSearchResults,
|
|
@@ -993,19 +1222,19 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
993
1222
|
const actions = [];
|
|
994
1223
|
if (onAdd) {
|
|
995
1224
|
actions.push(
|
|
996
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ React13.createElement(import_ui15.IconButton, { key: "add", size: SIZE7, onClick: onAdd }, /* @__PURE__ */ React13.createElement(import_icons9.PlusIcon, { fontSize: SIZE7 }))
|
|
997
1226
|
);
|
|
998
1227
|
}
|
|
999
1228
|
if (onSettings) {
|
|
1000
1229
|
actions.push(
|
|
1001
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ React13.createElement(import_ui15.IconButton, { key: "settings", size: SIZE7, onClick: onSettings }, /* @__PURE__ */ React13.createElement(import_icons9.SettingsIcon, { fontSize: SIZE7 }))
|
|
1002
1231
|
);
|
|
1003
1232
|
}
|
|
1004
1233
|
const items = variables.map(({ value, label, key }) => ({
|
|
1005
1234
|
type: "item",
|
|
1006
1235
|
value: key,
|
|
1007
1236
|
label,
|
|
1008
|
-
icon: /* @__PURE__ */
|
|
1237
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons9.TextIcon, { fontSize: SIZE7 }),
|
|
1009
1238
|
secondaryText: value,
|
|
1010
1239
|
onEdit: () => onEdit?.(key)
|
|
1011
1240
|
}));
|
|
@@ -1015,22 +1244,22 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1015
1244
|
const handleClearSearch = () => {
|
|
1016
1245
|
setSearchValue("");
|
|
1017
1246
|
};
|
|
1018
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ React13.createElement(import_editor_editing_panel7.PopoverBody, null, /* @__PURE__ */ React13.createElement(
|
|
1019
1248
|
import_editor_ui7.PopoverHeader,
|
|
1020
1249
|
{
|
|
1021
|
-
title: (0,
|
|
1250
|
+
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
1022
1251
|
onClose: closePopover,
|
|
1023
|
-
icon: /* @__PURE__ */
|
|
1252
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons9.ColorFilterIcon, { fontSize: SIZE7 }),
|
|
1024
1253
|
actions
|
|
1025
1254
|
}
|
|
1026
|
-
), hasVariables && /* @__PURE__ */
|
|
1255
|
+
), hasVariables && /* @__PURE__ */ React13.createElement(
|
|
1027
1256
|
import_editor_ui7.PopoverSearch,
|
|
1028
1257
|
{
|
|
1029
1258
|
value: searchValue,
|
|
1030
1259
|
onSearch: handleSearch,
|
|
1031
|
-
placeholder: (0,
|
|
1260
|
+
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
1032
1261
|
}
|
|
1033
|
-
), /* @__PURE__ */
|
|
1262
|
+
), /* @__PURE__ */ React13.createElement(import_ui15.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React13.createElement(
|
|
1034
1263
|
import_editor_ui7.PopoverMenuList,
|
|
1035
1264
|
{
|
|
1036
1265
|
items,
|
|
@@ -1040,23 +1269,23 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1040
1269
|
selectedValue: variable,
|
|
1041
1270
|
"data-testid": "font-variables-list",
|
|
1042
1271
|
menuListTemplate: VariablesStyledMenuList,
|
|
1043
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
1272
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React13.createElement(MenuItemContent, { item })
|
|
1044
1273
|
}
|
|
1045
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
1274
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React13.createElement(
|
|
1046
1275
|
NoSearchResults,
|
|
1047
1276
|
{
|
|
1048
1277
|
searchValue,
|
|
1049
1278
|
onClear: handleClearSearch,
|
|
1050
|
-
icon: /* @__PURE__ */
|
|
1279
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons9.TextIcon, { fontSize: "large" })
|
|
1051
1280
|
}
|
|
1052
|
-
), !hasVariables && /* @__PURE__ */
|
|
1281
|
+
), !hasVariables && /* @__PURE__ */ React13.createElement(
|
|
1053
1282
|
NoVariables,
|
|
1054
1283
|
{
|
|
1055
|
-
title: (0,
|
|
1056
|
-
icon: /* @__PURE__ */
|
|
1284
|
+
title: (0, import_i18n15.__)("Create your first font variable", "elementor"),
|
|
1285
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons9.TextIcon, { fontSize: "large" }),
|
|
1057
1286
|
onAdd
|
|
1058
1287
|
}
|
|
1059
|
-
))
|
|
1288
|
+
));
|
|
1060
1289
|
};
|
|
1061
1290
|
|
|
1062
1291
|
// src/components/variable-selection-popover.tsx
|
|
@@ -1064,10 +1293,10 @@ var VIEW_LIST = "list";
|
|
|
1064
1293
|
var VIEW_ADD = "add";
|
|
1065
1294
|
var VIEW_EDIT = "edit";
|
|
1066
1295
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
1067
|
-
const [currentView, setCurrentView] = (0,
|
|
1068
|
-
const editIdRef = (0,
|
|
1069
|
-
const anchorRef = (0,
|
|
1070
|
-
return /* @__PURE__ */
|
|
1296
|
+
const [currentView, setCurrentView] = (0, import_react12.useState)(VIEW_LIST);
|
|
1297
|
+
const editIdRef = (0, import_react12.useRef)("");
|
|
1298
|
+
const anchorRef = (0, import_react12.useRef)(null);
|
|
1299
|
+
return /* @__PURE__ */ React14.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React14.createElement(import_ui16.Box, { ref: anchorRef }, renderStage({
|
|
1071
1300
|
propTypeKey,
|
|
1072
1301
|
currentView,
|
|
1073
1302
|
selectedVariable,
|
|
@@ -1086,7 +1315,7 @@ function renderStage(props) {
|
|
|
1086
1315
|
};
|
|
1087
1316
|
if (fontVariablePropTypeUtil.key === props.propTypeKey) {
|
|
1088
1317
|
if (VIEW_LIST === props.currentView) {
|
|
1089
|
-
return /* @__PURE__ */
|
|
1318
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1090
1319
|
FontVariablesSelection,
|
|
1091
1320
|
{
|
|
1092
1321
|
closePopover: props.closePopover,
|
|
@@ -1101,7 +1330,7 @@ function renderStage(props) {
|
|
|
1101
1330
|
);
|
|
1102
1331
|
}
|
|
1103
1332
|
if (VIEW_ADD === props.currentView) {
|
|
1104
|
-
return /* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1105
1334
|
FontVariableCreation,
|
|
1106
1335
|
{
|
|
1107
1336
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1110,7 +1339,7 @@ function renderStage(props) {
|
|
|
1110
1339
|
);
|
|
1111
1340
|
}
|
|
1112
1341
|
if (VIEW_EDIT === props.currentView) {
|
|
1113
|
-
return /* @__PURE__ */
|
|
1342
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1114
1343
|
FontVariableEdit,
|
|
1115
1344
|
{
|
|
1116
1345
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1123,7 +1352,7 @@ function renderStage(props) {
|
|
|
1123
1352
|
}
|
|
1124
1353
|
if (colorVariablePropTypeUtil.key === props.propTypeKey) {
|
|
1125
1354
|
if (VIEW_LIST === props.currentView) {
|
|
1126
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1127
1356
|
ColorVariablesSelection,
|
|
1128
1357
|
{
|
|
1129
1358
|
closePopover: props.closePopover,
|
|
@@ -1138,7 +1367,7 @@ function renderStage(props) {
|
|
|
1138
1367
|
);
|
|
1139
1368
|
}
|
|
1140
1369
|
if (VIEW_ADD === props.currentView) {
|
|
1141
|
-
return /* @__PURE__ */
|
|
1370
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1142
1371
|
ColorVariableCreation,
|
|
1143
1372
|
{
|
|
1144
1373
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1147,7 +1376,7 @@ function renderStage(props) {
|
|
|
1147
1376
|
);
|
|
1148
1377
|
}
|
|
1149
1378
|
if (VIEW_EDIT === props.currentView) {
|
|
1150
|
-
return /* @__PURE__ */
|
|
1379
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1151
1380
|
ColorVariableEdit,
|
|
1152
1381
|
{
|
|
1153
1382
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1161,33 +1390,59 @@ function renderStage(props) {
|
|
|
1161
1390
|
return null;
|
|
1162
1391
|
}
|
|
1163
1392
|
|
|
1164
|
-
// src/
|
|
1165
|
-
var
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1393
|
+
// src/components/ui/tags/assigned-tag.tsx
|
|
1394
|
+
var React15 = __toESM(require("react"));
|
|
1395
|
+
var import_icons10 = require("@elementor/icons");
|
|
1396
|
+
var import_ui17 = require("@elementor/ui");
|
|
1397
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1398
|
+
var SIZE8 = "tiny";
|
|
1399
|
+
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
1400
|
+
const actions = [];
|
|
1401
|
+
if (onUnlink) {
|
|
1402
|
+
actions.push(
|
|
1403
|
+
/* @__PURE__ */ React15.createElement(import_ui17.IconButton, { key: "unlink", size: SIZE8, onClick: onUnlink, "aria-label": (0, import_i18n16.__)("Unlink", "elementor") }, /* @__PURE__ */ React15.createElement(import_icons10.DetachIcon, { fontSize: SIZE8 }))
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
return /* @__PURE__ */ React15.createElement(import_ui17.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React15.createElement(
|
|
1407
|
+
import_ui17.UnstableTag,
|
|
1408
|
+
{
|
|
1409
|
+
fullWidth: true,
|
|
1410
|
+
showActionsOnHover: true,
|
|
1411
|
+
startIcon: /* @__PURE__ */ React15.createElement(import_ui17.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
1412
|
+
label: /* @__PURE__ */ React15.createElement(import_ui17.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React15.createElement(import_ui17.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
1413
|
+
actions,
|
|
1414
|
+
...props
|
|
1415
|
+
}
|
|
1416
|
+
));
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// src/components/ui/variable/assigned-variable.tsx
|
|
1420
|
+
var AssignedVariable = ({
|
|
1421
|
+
variable,
|
|
1422
|
+
variablePropTypeUtil,
|
|
1423
|
+
fallbackPropTypeUtil,
|
|
1424
|
+
additionalStartIcon
|
|
1425
|
+
}) => {
|
|
1426
|
+
const { setValue } = (0, import_editor_controls8.useBoundProp)();
|
|
1427
|
+
const anchorRef = (0, import_react13.useRef)(null);
|
|
1428
|
+
const popupId = (0, import_react13.useId)();
|
|
1429
|
+
const popupState = (0, import_ui18.usePopupState)({
|
|
1171
1430
|
variant: "popover",
|
|
1172
1431
|
popupId: `elementor-variables-list-${popupId}`
|
|
1173
1432
|
});
|
|
1174
|
-
const selectedVariable = useVariable(variableValue);
|
|
1175
|
-
if (!selectedVariable) {
|
|
1176
|
-
throw new Error(`Global color variable ${variableValue} not found`);
|
|
1177
|
-
}
|
|
1178
1433
|
const unlinkVariable = () => {
|
|
1179
|
-
|
|
1434
|
+
setValue(fallbackPropTypeUtil.create(variable.value));
|
|
1180
1435
|
};
|
|
1181
|
-
return /* @__PURE__ */
|
|
1182
|
-
|
|
1436
|
+
return /* @__PURE__ */ React16.createElement(import_ui18.Box, { ref: anchorRef }, /* @__PURE__ */ React16.createElement(
|
|
1437
|
+
AssignedTag,
|
|
1183
1438
|
{
|
|
1184
|
-
label:
|
|
1185
|
-
startIcon: /* @__PURE__ */
|
|
1439
|
+
label: variable.label,
|
|
1440
|
+
startIcon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE8 }), additionalStartIcon),
|
|
1186
1441
|
onUnlink: unlinkVariable,
|
|
1187
|
-
...(0,
|
|
1442
|
+
...(0, import_ui18.bindTrigger)(popupState)
|
|
1188
1443
|
}
|
|
1189
|
-
), /* @__PURE__ */
|
|
1190
|
-
|
|
1444
|
+
), /* @__PURE__ */ React16.createElement(
|
|
1445
|
+
import_ui18.Popover,
|
|
1191
1446
|
{
|
|
1192
1447
|
disableScrollLock: true,
|
|
1193
1448
|
anchorEl: anchorRef.current,
|
|
@@ -1196,24 +1451,168 @@ var ColorVariableControl = () => {
|
|
|
1196
1451
|
PaperProps: {
|
|
1197
1452
|
sx: { my: 1 }
|
|
1198
1453
|
},
|
|
1199
|
-
...(0,
|
|
1454
|
+
...(0, import_ui18.bindPopover)(popupState)
|
|
1200
1455
|
},
|
|
1201
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ React16.createElement(
|
|
1202
1457
|
VariableSelectionPopover,
|
|
1203
1458
|
{
|
|
1204
|
-
selectedVariable,
|
|
1459
|
+
selectedVariable: variable,
|
|
1205
1460
|
closePopover: popupState.close,
|
|
1206
|
-
propTypeKey:
|
|
1461
|
+
propTypeKey: variablePropTypeUtil.key
|
|
1207
1462
|
}
|
|
1208
1463
|
)
|
|
1209
1464
|
));
|
|
1210
1465
|
};
|
|
1211
1466
|
|
|
1467
|
+
// src/components/ui/variable/deleted-variable.tsx
|
|
1468
|
+
var React19 = __toESM(require("react"));
|
|
1469
|
+
var import_react14 = require("react");
|
|
1470
|
+
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
1471
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
1472
|
+
var import_ui21 = require("@elementor/ui");
|
|
1473
|
+
|
|
1474
|
+
// src/components/ui/deleted-variable-alert.tsx
|
|
1475
|
+
var React17 = __toESM(require("react"));
|
|
1476
|
+
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
1477
|
+
var import_ui19 = require("@elementor/ui");
|
|
1478
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
1479
|
+
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
1480
|
+
const sectionWidth = (0, import_editor_editing_panel8.useSectionWidth)();
|
|
1481
|
+
return /* @__PURE__ */ React17.createElement(import_ui19.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React17.createElement(
|
|
1482
|
+
import_ui19.Alert,
|
|
1483
|
+
{
|
|
1484
|
+
variant: "standard",
|
|
1485
|
+
severity: "warning",
|
|
1486
|
+
onClose,
|
|
1487
|
+
action: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onUnlink && /* @__PURE__ */ React17.createElement(import_ui19.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n17.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React17.createElement(import_ui19.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n17.__)("Restore", "elementor"))),
|
|
1488
|
+
sx: { width: sectionWidth }
|
|
1489
|
+
},
|
|
1490
|
+
/* @__PURE__ */ React17.createElement(import_ui19.AlertTitle, null, (0, import_i18n17.__)("Deleted variable", "elementor")),
|
|
1491
|
+
(0, import_i18n17.__)("The variable", "elementor"),
|
|
1492
|
+
" '",
|
|
1493
|
+
label,
|
|
1494
|
+
"'",
|
|
1495
|
+
" ",
|
|
1496
|
+
(0, import_i18n17.__)(
|
|
1497
|
+
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
1498
|
+
"elementor"
|
|
1499
|
+
)
|
|
1500
|
+
));
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1503
|
+
// src/components/ui/tags/deleted-tag.tsx
|
|
1504
|
+
var React18 = __toESM(require("react"));
|
|
1505
|
+
var import_icons12 = require("@elementor/icons");
|
|
1506
|
+
var import_ui20 = require("@elementor/ui");
|
|
1507
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
1508
|
+
var DeletedTag = React18.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1509
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1510
|
+
import_ui20.Chip,
|
|
1511
|
+
{
|
|
1512
|
+
ref,
|
|
1513
|
+
size: "tiny",
|
|
1514
|
+
color: "warning",
|
|
1515
|
+
shape: "rounded",
|
|
1516
|
+
variant: "standard",
|
|
1517
|
+
onClick,
|
|
1518
|
+
icon: /* @__PURE__ */ React18.createElement(import_icons12.AlertTriangleFilledIcon, null),
|
|
1519
|
+
label: /* @__PURE__ */ React18.createElement(import_ui20.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React18.createElement(import_ui20.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React18.createElement(import_ui20.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React18.createElement(import_ui20.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0, import_i18n18.__)("deleted", "elementor"), ")"))),
|
|
1520
|
+
sx: {
|
|
1521
|
+
height: (theme) => theme.spacing(3.5),
|
|
1522
|
+
borderRadius: (theme) => theme.spacing(1),
|
|
1523
|
+
justifyContent: "flex-start",
|
|
1524
|
+
width: "100%"
|
|
1525
|
+
},
|
|
1526
|
+
...props
|
|
1527
|
+
}
|
|
1528
|
+
);
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
// src/components/ui/variable/deleted-variable.tsx
|
|
1532
|
+
var isV331Active = (0, import_editor_v1_adapters.isExperimentActive)("e_v_3_31");
|
|
1533
|
+
var DeletedVariable = ({ variable, variablePropTypeUtil, fallbackPropTypeUtil }) => {
|
|
1534
|
+
const { setValue } = (0, import_editor_controls9.useBoundProp)();
|
|
1535
|
+
const [showInfotip, setShowInfotip] = (0, import_react14.useState)(false);
|
|
1536
|
+
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
1537
|
+
const closeInfotip = () => setShowInfotip(false);
|
|
1538
|
+
const unlinkVariable = () => {
|
|
1539
|
+
setValue(fallbackPropTypeUtil.create(variable.value));
|
|
1540
|
+
};
|
|
1541
|
+
const handleRestore = () => {
|
|
1542
|
+
if (!variable.key) {
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
restoreVariable(variable.key).then((key) => {
|
|
1546
|
+
setValue(variablePropTypeUtil.create(key));
|
|
1547
|
+
closeInfotip();
|
|
1548
|
+
});
|
|
1549
|
+
};
|
|
1550
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, showInfotip && /* @__PURE__ */ React19.createElement(import_ui21.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React19.createElement(
|
|
1551
|
+
import_ui21.Infotip,
|
|
1552
|
+
{
|
|
1553
|
+
color: "warning",
|
|
1554
|
+
placement: "right-start",
|
|
1555
|
+
open: showInfotip,
|
|
1556
|
+
disableHoverListener: true,
|
|
1557
|
+
onClose: closeInfotip,
|
|
1558
|
+
content: /* @__PURE__ */ React19.createElement(
|
|
1559
|
+
DeletedVariableAlert,
|
|
1560
|
+
{
|
|
1561
|
+
onClose: closeInfotip,
|
|
1562
|
+
onUnlink: unlinkVariable,
|
|
1563
|
+
onRestore: isV331Active ? handleRestore : void 0,
|
|
1564
|
+
label: variable.label
|
|
1565
|
+
}
|
|
1566
|
+
),
|
|
1567
|
+
slotProps: {
|
|
1568
|
+
popper: {
|
|
1569
|
+
modifiers: [
|
|
1570
|
+
{
|
|
1571
|
+
name: "offset",
|
|
1572
|
+
options: { offset: [0, 24] }
|
|
1573
|
+
}
|
|
1574
|
+
]
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
/* @__PURE__ */ React19.createElement(DeletedTag, { label: variable.label, onClick: toggleInfotip })
|
|
1579
|
+
));
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1582
|
+
// src/controls/color-variable-control.tsx
|
|
1583
|
+
var ColorVariableControl = () => {
|
|
1584
|
+
const { value: variableValue } = (0, import_editor_controls10.useBoundProp)(colorVariablePropTypeUtil);
|
|
1585
|
+
const assignedVariable = useVariable(variableValue);
|
|
1586
|
+
if (!assignedVariable) {
|
|
1587
|
+
throw new Error(`Global color variable ${variableValue} not found`);
|
|
1588
|
+
}
|
|
1589
|
+
const isVariableDeleted = assignedVariable?.deleted;
|
|
1590
|
+
if (isVariableDeleted) {
|
|
1591
|
+
return /* @__PURE__ */ React20.createElement(
|
|
1592
|
+
DeletedVariable,
|
|
1593
|
+
{
|
|
1594
|
+
variable: assignedVariable,
|
|
1595
|
+
variablePropTypeUtil: colorVariablePropTypeUtil,
|
|
1596
|
+
fallbackPropTypeUtil: import_editor_props3.colorPropTypeUtil
|
|
1597
|
+
}
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1600
|
+
return /* @__PURE__ */ React20.createElement(
|
|
1601
|
+
AssignedVariable,
|
|
1602
|
+
{
|
|
1603
|
+
variable: assignedVariable,
|
|
1604
|
+
variablePropTypeUtil: colorVariablePropTypeUtil,
|
|
1605
|
+
fallbackPropTypeUtil: import_editor_props3.colorPropTypeUtil,
|
|
1606
|
+
additionalStartIcon: /* @__PURE__ */ React20.createElement(ColorIndicator, { size: "inherit", value: assignedVariable.value, component: "span" })
|
|
1607
|
+
}
|
|
1608
|
+
);
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1212
1611
|
// src/hooks/use-prop-color-variable-action.tsx
|
|
1213
|
-
var
|
|
1214
|
-
var
|
|
1215
|
-
var
|
|
1216
|
-
var
|
|
1612
|
+
var React21 = __toESM(require("react"));
|
|
1613
|
+
var import_editor_editing_panel9 = require("@elementor/editor-editing-panel");
|
|
1614
|
+
var import_icons13 = require("@elementor/icons");
|
|
1615
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
1217
1616
|
|
|
1218
1617
|
// src/utils.ts
|
|
1219
1618
|
var hasAssignedColorVariable = (propValue) => {
|
|
@@ -1231,39 +1630,91 @@ var supportsFontVariables = (propType) => {
|
|
|
1231
1630
|
|
|
1232
1631
|
// src/hooks/use-prop-color-variable-action.tsx
|
|
1233
1632
|
var usePropColorVariableAction = () => {
|
|
1234
|
-
const { propType } = (0,
|
|
1633
|
+
const { propType } = (0, import_editor_editing_panel9.useBoundProp)();
|
|
1235
1634
|
const visible = !!propType && supportsColorVariables(propType);
|
|
1236
1635
|
return {
|
|
1237
1636
|
visible,
|
|
1238
|
-
icon:
|
|
1239
|
-
title: (0,
|
|
1637
|
+
icon: import_icons13.ColorFilterIcon,
|
|
1638
|
+
title: (0, import_i18n19.__)("Variables", "elementor"),
|
|
1240
1639
|
content: ({ close: closePopover }) => {
|
|
1241
|
-
return /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ React21.createElement(VariableSelectionPopover, { closePopover, propTypeKey: colorVariablePropTypeUtil.key });
|
|
1242
1641
|
}
|
|
1243
1642
|
};
|
|
1244
1643
|
};
|
|
1245
1644
|
|
|
1645
|
+
// src/repeater-injections.ts
|
|
1646
|
+
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1647
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1648
|
+
|
|
1649
|
+
// src/components/variables-repeater-item-slot.tsx
|
|
1650
|
+
var React22 = __toESM(require("react"));
|
|
1651
|
+
var useColorVariable = (value) => {
|
|
1652
|
+
const variableId = value?.value?.color?.value;
|
|
1653
|
+
return useVariable(variableId || "");
|
|
1654
|
+
};
|
|
1655
|
+
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
1656
|
+
const colorVariable = useColorVariable(value);
|
|
1657
|
+
return /* @__PURE__ */ React22.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
1658
|
+
};
|
|
1659
|
+
var BackgroundRepeaterLabel = ({ value }) => {
|
|
1660
|
+
const colorVariable = useColorVariable(value);
|
|
1661
|
+
return /* @__PURE__ */ React22.createElement("span", null, colorVariable?.label);
|
|
1662
|
+
};
|
|
1663
|
+
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
1664
|
+
const colorVariable = useColorVariable(value);
|
|
1665
|
+
return /* @__PURE__ */ React22.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
// src/repeater-injections.ts
|
|
1669
|
+
function registerRepeaterInjections() {
|
|
1670
|
+
(0, import_editor_controls11.injectIntoRepeaterItemIcon)({
|
|
1671
|
+
id: "color-variables-background-icon",
|
|
1672
|
+
component: BackgroundRepeaterColorIndicator,
|
|
1673
|
+
condition: ({ value: prop }) => {
|
|
1674
|
+
return hasAssignedColorVariable(import_editor_props4.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
(0, import_editor_controls11.injectIntoRepeaterItemIcon)({
|
|
1678
|
+
id: "color-variables-icon",
|
|
1679
|
+
component: BoxShadowRepeaterColorIndicator,
|
|
1680
|
+
condition: ({ value: prop }) => {
|
|
1681
|
+
return hasAssignedColorVariable(import_editor_props4.shadowPropTypeUtil.extract(prop)?.color);
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
(0, import_editor_controls11.injectIntoRepeaterItemLabel)({
|
|
1685
|
+
id: "color-variables-label",
|
|
1686
|
+
component: BackgroundRepeaterLabel,
|
|
1687
|
+
condition: ({ value: prop }) => {
|
|
1688
|
+
return hasAssignedColorVariable(import_editor_props4.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1246
1693
|
// src/transformers/variable-transformer.ts
|
|
1247
1694
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
1248
|
-
var variableTransformer = (0, import_editor_canvas.createTransformer)((
|
|
1249
|
-
|
|
1695
|
+
var variableTransformer = (0, import_editor_canvas.createTransformer)((id) => {
|
|
1696
|
+
const variables = service.variables();
|
|
1697
|
+
let name = id;
|
|
1698
|
+
let fallbackValue = "";
|
|
1699
|
+
if (variables[id]) {
|
|
1700
|
+
fallbackValue = variables[id].value;
|
|
1701
|
+
if (!variables[id]?.deleted) {
|
|
1702
|
+
name = variables[id].label;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
if (!name.trim()) {
|
|
1250
1706
|
return null;
|
|
1251
1707
|
}
|
|
1252
|
-
|
|
1708
|
+
if (!fallbackValue.trim()) {
|
|
1709
|
+
return `var(--${name})`;
|
|
1710
|
+
}
|
|
1711
|
+
return `var(--${name}, ${fallbackValue})`;
|
|
1253
1712
|
});
|
|
1254
1713
|
|
|
1255
1714
|
// src/init-color-variables.ts
|
|
1256
|
-
var { registerPopoverAction } =
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
return hasAssignedColorVariable(import_editor_props4.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
1260
|
-
},
|
|
1261
|
-
boxShadow: ({ value: prop }) => {
|
|
1262
|
-
return hasAssignedColorVariable(import_editor_props4.shadowPropTypeUtil.extract(prop)?.color);
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
function registerControlsAndActions() {
|
|
1266
|
-
(0, import_editor_editing_panel7.registerControlReplacement)({
|
|
1715
|
+
var { registerPopoverAction } = import_editor_editing_panel10.controlActionsMenu;
|
|
1716
|
+
function initColorVariables() {
|
|
1717
|
+
(0, import_editor_editing_panel10.registerControlReplacement)({
|
|
1267
1718
|
component: ColorVariableControl,
|
|
1268
1719
|
condition: ({ value }) => hasAssignedColorVariable(value)
|
|
1269
1720
|
});
|
|
@@ -1271,116 +1722,67 @@ function registerControlsAndActions() {
|
|
|
1271
1722
|
id: "color-variables",
|
|
1272
1723
|
useProps: usePropColorVariableAction
|
|
1273
1724
|
});
|
|
1274
|
-
}
|
|
1275
|
-
function registerRepeaterItemIcons() {
|
|
1276
|
-
(0, import_editor_controls8.injectIntoRepeaterItemIcon)({
|
|
1277
|
-
id: "color-variables-background-icon",
|
|
1278
|
-
component: BackgroundRepeaterColorIndicator,
|
|
1279
|
-
condition: conditions.backgroundOverlay
|
|
1280
|
-
});
|
|
1281
|
-
(0, import_editor_controls8.injectIntoRepeaterItemIcon)({
|
|
1282
|
-
id: "color-variables-icon",
|
|
1283
|
-
component: BoxShadowRepeaterColorIndicator,
|
|
1284
|
-
condition: conditions.boxShadow
|
|
1285
|
-
});
|
|
1286
|
-
}
|
|
1287
|
-
function registerRepeaterItemLabels() {
|
|
1288
|
-
(0, import_editor_controls8.injectIntoRepeaterItemLabel)({
|
|
1289
|
-
id: "color-variables-label",
|
|
1290
|
-
component: BackgroundRepeaterLabel,
|
|
1291
|
-
condition: conditions.backgroundOverlay
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
function registerStyleTransformers() {
|
|
1295
1725
|
import_editor_canvas2.styleTransformersRegistry.register(colorVariablePropTypeUtil.key, variableTransformer);
|
|
1296
|
-
|
|
1297
|
-
function initColorVariables() {
|
|
1298
|
-
registerControlsAndActions();
|
|
1299
|
-
registerRepeaterItemIcons();
|
|
1300
|
-
registerRepeaterItemLabels();
|
|
1301
|
-
registerStyleTransformers();
|
|
1726
|
+
registerRepeaterInjections();
|
|
1302
1727
|
}
|
|
1303
1728
|
|
|
1304
1729
|
// src/init-font-variables.ts
|
|
1305
1730
|
var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
1306
|
-
var
|
|
1731
|
+
var import_editor_editing_panel12 = require("@elementor/editor-editing-panel");
|
|
1307
1732
|
|
|
1308
1733
|
// src/controls/font-variable-control.tsx
|
|
1309
|
-
var
|
|
1310
|
-
var
|
|
1311
|
-
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
1734
|
+
var React23 = __toESM(require("react"));
|
|
1735
|
+
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
1312
1736
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
1313
|
-
var import_icons11 = require("@elementor/icons");
|
|
1314
|
-
var import_ui15 = require("@elementor/ui");
|
|
1315
1737
|
var FontVariableControl = () => {
|
|
1316
|
-
const {
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1319
|
-
const popupId = (0, import_react11.useId)();
|
|
1320
|
-
const popupState = (0, import_ui15.usePopupState)({
|
|
1321
|
-
variant: "popover",
|
|
1322
|
-
popupId: `elementor-variables-list-${popupId}`
|
|
1323
|
-
});
|
|
1324
|
-
const selectedVariable = useVariable(variableValue);
|
|
1325
|
-
if (!selectedVariable) {
|
|
1738
|
+
const { value: variableValue } = (0, import_editor_controls12.useBoundProp)(fontVariablePropTypeUtil);
|
|
1739
|
+
const assignedVariable = useVariable(variableValue);
|
|
1740
|
+
if (!assignedVariable) {
|
|
1326
1741
|
throw new Error(`Global font variable ${variableValue} not found`);
|
|
1327
1742
|
}
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
VariableTag,
|
|
1333
|
-
{
|
|
1334
|
-
label: selectedVariable.label,
|
|
1335
|
-
startIcon: /* @__PURE__ */ React15.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE }),
|
|
1336
|
-
onUnlink: unlinkVariable,
|
|
1337
|
-
...(0, import_ui15.bindTrigger)(popupState)
|
|
1338
|
-
}
|
|
1339
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1340
|
-
import_ui15.Popover,
|
|
1341
|
-
{
|
|
1342
|
-
disableScrollLock: true,
|
|
1343
|
-
anchorEl: anchorRef.current,
|
|
1344
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1345
|
-
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1346
|
-
PaperProps: {
|
|
1347
|
-
sx: { my: 1 }
|
|
1348
|
-
},
|
|
1349
|
-
...(0, import_ui15.bindPopover)(popupState)
|
|
1350
|
-
},
|
|
1351
|
-
/* @__PURE__ */ React15.createElement(
|
|
1352
|
-
VariableSelectionPopover,
|
|
1743
|
+
const isVariableDeleted = assignedVariable?.deleted;
|
|
1744
|
+
if (isVariableDeleted) {
|
|
1745
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1746
|
+
DeletedVariable,
|
|
1353
1747
|
{
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1748
|
+
variable: assignedVariable,
|
|
1749
|
+
variablePropTypeUtil: fontVariablePropTypeUtil,
|
|
1750
|
+
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil
|
|
1357
1751
|
}
|
|
1358
|
-
)
|
|
1359
|
-
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1755
|
+
AssignedVariable,
|
|
1756
|
+
{
|
|
1757
|
+
variable: assignedVariable,
|
|
1758
|
+
variablePropTypeUtil: fontVariablePropTypeUtil,
|
|
1759
|
+
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil
|
|
1760
|
+
}
|
|
1761
|
+
);
|
|
1360
1762
|
};
|
|
1361
1763
|
|
|
1362
1764
|
// src/hooks/use-prop-font-variable-action.tsx
|
|
1363
|
-
var
|
|
1364
|
-
var
|
|
1365
|
-
var
|
|
1366
|
-
var
|
|
1765
|
+
var React24 = __toESM(require("react"));
|
|
1766
|
+
var import_editor_editing_panel11 = require("@elementor/editor-editing-panel");
|
|
1767
|
+
var import_icons14 = require("@elementor/icons");
|
|
1768
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1367
1769
|
var usePropFontVariableAction = () => {
|
|
1368
|
-
const { propType } = (0,
|
|
1770
|
+
const { propType } = (0, import_editor_editing_panel11.useBoundProp)();
|
|
1369
1771
|
const visible = !!propType && supportsFontVariables(propType);
|
|
1370
1772
|
return {
|
|
1371
1773
|
visible,
|
|
1372
|
-
icon:
|
|
1373
|
-
title: (0,
|
|
1774
|
+
icon: import_icons14.ColorFilterIcon,
|
|
1775
|
+
title: (0, import_i18n20.__)("Variables", "elementor"),
|
|
1374
1776
|
content: ({ close: closePopover }) => {
|
|
1375
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ React24.createElement(VariableSelectionPopover, { closePopover, propTypeKey: fontVariablePropTypeUtil.key });
|
|
1376
1778
|
}
|
|
1377
1779
|
};
|
|
1378
1780
|
};
|
|
1379
1781
|
|
|
1380
1782
|
// src/init-font-variables.ts
|
|
1381
|
-
var { registerPopoverAction: registerPopoverAction2 } =
|
|
1783
|
+
var { registerPopoverAction: registerPopoverAction2 } = import_editor_editing_panel12.controlActionsMenu;
|
|
1382
1784
|
function initFontVariables() {
|
|
1383
|
-
(0,
|
|
1785
|
+
(0, import_editor_editing_panel12.registerControlReplacement)({
|
|
1384
1786
|
component: FontVariableControl,
|
|
1385
1787
|
condition: ({ value }) => hasAssignedFontVariable(value)
|
|
1386
1788
|
});
|
|
@@ -1392,10 +1794,10 @@ function initFontVariables() {
|
|
|
1392
1794
|
}
|
|
1393
1795
|
|
|
1394
1796
|
// src/renderers/style-variables-renderer.tsx
|
|
1395
|
-
var
|
|
1396
|
-
var
|
|
1797
|
+
var React25 = __toESM(require("react"));
|
|
1798
|
+
var import_react15 = require("react");
|
|
1397
1799
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1398
|
-
var
|
|
1800
|
+
var import_ui22 = require("@elementor/ui");
|
|
1399
1801
|
|
|
1400
1802
|
// src/sync/get-canvas-iframe-document.ts
|
|
1401
1803
|
function getCanvasIframeDocument() {
|
|
@@ -1414,14 +1816,14 @@ function StyleVariablesRenderer() {
|
|
|
1414
1816
|
}
|
|
1415
1817
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
1416
1818
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
1417
|
-
return /* @__PURE__ */
|
|
1819
|
+
return /* @__PURE__ */ React25.createElement(import_ui22.Portal, { container }, /* @__PURE__ */ React25.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
1418
1820
|
}
|
|
1419
1821
|
function usePortalContainer() {
|
|
1420
1822
|
return (0, import_editor_v1_adapters2.__privateUseListenTo)((0, import_editor_v1_adapters2.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
1421
1823
|
}
|
|
1422
1824
|
function useStyleVariables() {
|
|
1423
|
-
const [variables, setVariables] = (0,
|
|
1424
|
-
(0,
|
|
1825
|
+
const [variables, setVariables] = (0, import_react15.useState)({});
|
|
1826
|
+
(0, import_react15.useEffect)(() => {
|
|
1425
1827
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
1426
1828
|
return () => {
|
|
1427
1829
|
unsubscribe();
|
|
@@ -1429,8 +1831,14 @@ function useStyleVariables() {
|
|
|
1429
1831
|
}, []);
|
|
1430
1832
|
return variables;
|
|
1431
1833
|
}
|
|
1834
|
+
function cssVariableDeclaration(key, variable) {
|
|
1835
|
+
const variableName = variable?.deleted ? key : variable.label;
|
|
1836
|
+
const value = variable.value;
|
|
1837
|
+
return `--${variableName}:${value};`;
|
|
1838
|
+
}
|
|
1432
1839
|
function convertToCssVariables(variables) {
|
|
1433
|
-
|
|
1840
|
+
const listOfVariables = Object.entries(variables);
|
|
1841
|
+
return listOfVariables.map(([key, variable]) => cssVariableDeclaration(key, variable)).join("");
|
|
1434
1842
|
}
|
|
1435
1843
|
|
|
1436
1844
|
// src/init.ts
|