builder-settings-types 0.0.301 → 0.0.303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/base/settings-group/settingsGroup.d.ts +1 -0
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +16 -16
- package/dist/builder-settings-types.es.js +137 -102
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/settings/select-api/select-api.d.ts +1 -0
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/dist/transparency-pattern.svg +11 -11
- package/package.json +1 -1
|
@@ -142,15 +142,15 @@ function Ct(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class w {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || lt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, w.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, w.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -233,14 +233,14 @@ class b {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return c instanceof
|
|
236
|
+
function O(c) {
|
|
237
|
+
return c instanceof w;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function b(c) {
|
|
240
240
|
return c instanceof T;
|
|
241
241
|
}
|
|
242
242
|
function st(c) {
|
|
243
|
-
return
|
|
243
|
+
return O(c) || b(c);
|
|
244
244
|
}
|
|
245
245
|
function W(c, t) {
|
|
246
246
|
for (const e in c)
|
|
@@ -257,7 +257,7 @@ const K = class K {
|
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
259
|
W(this.settings, (e, i) => {
|
|
260
|
-
|
|
260
|
+
b(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -275,7 +275,7 @@ const K = class K {
|
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
276
|
W(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(b(e) || O(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
@@ -284,7 +284,7 @@ const K = class K {
|
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
286
|
try {
|
|
287
|
-
if (
|
|
287
|
+
if (b(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -308,14 +308,22 @@ const K = class K {
|
|
|
308
308
|
);
|
|
309
309
|
if (n) {
|
|
310
310
|
const o = Array.from(
|
|
311
|
-
n.querySelectorAll(
|
|
311
|
+
n.querySelectorAll(
|
|
312
|
+
".setting-group, .setting, [data-setting-id]"
|
|
313
|
+
)
|
|
312
314
|
);
|
|
313
315
|
for (const a of o) {
|
|
314
|
-
const l = a.id
|
|
316
|
+
const l = a.id, r = a.getAttribute(
|
|
317
|
+
"data-setting-id"
|
|
318
|
+
);
|
|
315
319
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
316
320
|
a.remove();
|
|
317
321
|
break;
|
|
318
322
|
}
|
|
323
|
+
if (r && "id" in e && typeof e.id == "string" && r === e.id) {
|
|
324
|
+
a.remove();
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
319
327
|
}
|
|
320
328
|
}
|
|
321
329
|
}
|
|
@@ -326,6 +334,31 @@ const K = class K {
|
|
|
326
334
|
updateVisibility() {
|
|
327
335
|
this.elementRef;
|
|
328
336
|
}
|
|
337
|
+
updateSettings(t) {
|
|
338
|
+
var o;
|
|
339
|
+
const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
|
|
340
|
+
i.forEach((a) => {
|
|
341
|
+
const l = this.settings[a];
|
|
342
|
+
l && (b(l) ? s[a] = l.getValues() : O(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
|
|
343
|
+
}), e.forEach((a) => {
|
|
344
|
+
i.includes(a) || this.removeSetting(a);
|
|
345
|
+
}), i.forEach((a) => {
|
|
346
|
+
var h;
|
|
347
|
+
const l = t[a], r = this.settings[a];
|
|
348
|
+
if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
|
|
349
|
+
const p = s[a];
|
|
350
|
+
try {
|
|
351
|
+
b(l) ? l.setValue(
|
|
352
|
+
p
|
|
353
|
+
) : O(l) ? (h = l.setValue) == null || h.call(l, p) : l.setValue && l.setValue(p);
|
|
354
|
+
} catch (d) {
|
|
355
|
+
console.warn(`Could not preserve value for setting ${a}:`, d);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
359
|
+
const n = this.getValues();
|
|
360
|
+
this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
|
|
361
|
+
}
|
|
329
362
|
clone() {
|
|
330
363
|
const t = {};
|
|
331
364
|
W(this.settings, (s, n) => {
|
|
@@ -355,7 +388,7 @@ const K = class K {
|
|
|
355
388
|
setMobileValues(t) {
|
|
356
389
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
357
390
|
const s = this.settings[e];
|
|
358
|
-
s && (
|
|
391
|
+
s && (b(s) || O(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
359
392
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
360
393
|
}
|
|
361
394
|
getMobileValues(t) {
|
|
@@ -364,7 +397,7 @@ const K = class K {
|
|
|
364
397
|
for (const i in this.settings)
|
|
365
398
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
366
399
|
const s = this.settings[i];
|
|
367
|
-
if (
|
|
400
|
+
if (b(s))
|
|
368
401
|
e[i] = s.getMobileValues();
|
|
369
402
|
else {
|
|
370
403
|
const n = s;
|
|
@@ -375,7 +408,7 @@ const K = class K {
|
|
|
375
408
|
} else {
|
|
376
409
|
const e = this.settings[t];
|
|
377
410
|
if (!e) return;
|
|
378
|
-
if (
|
|
411
|
+
if (b(e)) return e.getMobileValues();
|
|
379
412
|
const i = e;
|
|
380
413
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
381
414
|
}
|
|
@@ -393,12 +426,12 @@ const K = class K {
|
|
|
393
426
|
};
|
|
394
427
|
return this.changeHandlers.clear(), W(this.settings, (i, s) => {
|
|
395
428
|
var n;
|
|
396
|
-
if (
|
|
429
|
+
if (b(s))
|
|
397
430
|
s.setOnChange(() => {
|
|
398
431
|
const o = this.getValues();
|
|
399
432
|
this.initialValues = o, t(o);
|
|
400
433
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
401
|
-
else if (
|
|
434
|
+
else if (O(s)) {
|
|
402
435
|
const o = () => e();
|
|
403
436
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
404
437
|
} else {
|
|
@@ -424,7 +457,7 @@ const K = class K {
|
|
|
424
457
|
st(l) && (this.addSetting(i, l), n = l);
|
|
425
458
|
}
|
|
426
459
|
}
|
|
427
|
-
n && (
|
|
460
|
+
n && (b(n) || O(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
461
|
}), setTimeout(() => {
|
|
429
462
|
this.forceChildUIRefresh();
|
|
430
463
|
}, 0);
|
|
@@ -438,7 +471,7 @@ const K = class K {
|
|
|
438
471
|
const s = this.getValues();
|
|
439
472
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
473
|
};
|
|
441
|
-
|
|
474
|
+
b(t) ? t.setOnChange(() => e()) : O(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
442
475
|
}
|
|
443
476
|
addSetting(t, e) {
|
|
444
477
|
var s, n;
|
|
@@ -447,7 +480,7 @@ const K = class K {
|
|
|
447
480
|
".setting-group-content"
|
|
448
481
|
);
|
|
449
482
|
if (o) {
|
|
450
|
-
|
|
483
|
+
b(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
451
484
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
452
485
|
if (l) {
|
|
453
486
|
const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
@@ -637,7 +670,7 @@ const K = class K {
|
|
|
637
670
|
for (const i in this.settings)
|
|
638
671
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
639
672
|
const s = this.settings[i];
|
|
640
|
-
if (
|
|
673
|
+
if (b(s))
|
|
641
674
|
e[i] = s.getValues();
|
|
642
675
|
else {
|
|
643
676
|
const n = s;
|
|
@@ -648,7 +681,7 @@ const K = class K {
|
|
|
648
681
|
} else {
|
|
649
682
|
const e = this.settings[t];
|
|
650
683
|
if (!e) return;
|
|
651
|
-
if (
|
|
684
|
+
if (b(e)) return e.getValues();
|
|
652
685
|
const i = e;
|
|
653
686
|
return i.getValue ? i.getValue() : i.value;
|
|
654
687
|
}
|
|
@@ -661,7 +694,7 @@ const K = class K {
|
|
|
661
694
|
for (const s in this.settings)
|
|
662
695
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
663
696
|
const n = this.settings[s];
|
|
664
|
-
if (
|
|
697
|
+
if (b(n)) {
|
|
665
698
|
const o = n.getValuesForJson();
|
|
666
699
|
o !== null && (i[s] = o);
|
|
667
700
|
} else {
|
|
@@ -673,7 +706,7 @@ const K = class K {
|
|
|
673
706
|
} else {
|
|
674
707
|
const i = this.settings[t];
|
|
675
708
|
if (!i) return;
|
|
676
|
-
if (
|
|
709
|
+
if (b(i))
|
|
677
710
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
678
711
|
{
|
|
679
712
|
const s = i;
|
|
@@ -687,7 +720,7 @@ const K = class K {
|
|
|
687
720
|
for (const i in this.settings)
|
|
688
721
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
689
722
|
const s = this.settings[i];
|
|
690
|
-
if (
|
|
723
|
+
if (b(s))
|
|
691
724
|
e[i] = s.getDefaultValues();
|
|
692
725
|
else {
|
|
693
726
|
const n = s;
|
|
@@ -698,7 +731,7 @@ const K = class K {
|
|
|
698
731
|
} else {
|
|
699
732
|
const e = this.settings[t];
|
|
700
733
|
if (!e) return;
|
|
701
|
-
if (
|
|
734
|
+
if (b(e)) return e.getDefaultValues();
|
|
702
735
|
const i = e;
|
|
703
736
|
return i.default !== void 0 ? i.default : i.value;
|
|
704
737
|
}
|
|
@@ -737,9 +770,9 @@ const K = class K {
|
|
|
737
770
|
for (const h in this.settings)
|
|
738
771
|
if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
|
|
739
772
|
const p = this.settings[h];
|
|
740
|
-
|
|
773
|
+
b(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
|
|
741
774
|
const d = p.draw();
|
|
742
|
-
|
|
775
|
+
b(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
|
|
743
776
|
d,
|
|
744
777
|
h,
|
|
745
778
|
p
|
|
@@ -855,7 +888,7 @@ class yt extends T {
|
|
|
855
888
|
const h = document.createElement("div");
|
|
856
889
|
h.className = "tab-panel", this.contentContainers[a] = h;
|
|
857
890
|
const p = this.settings[a];
|
|
858
|
-
p && (
|
|
891
|
+
p && (b(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
|
|
859
892
|
p.draw()
|
|
860
893
|
)), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
861
894
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
@@ -871,7 +904,7 @@ function Et(c) {
|
|
|
871
904
|
function ae(c) {
|
|
872
905
|
return c;
|
|
873
906
|
}
|
|
874
|
-
class bt extends
|
|
907
|
+
class bt extends w {
|
|
875
908
|
constructor(t = {}) {
|
|
876
909
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
910
|
}
|
|
@@ -1001,7 +1034,7 @@ const xt = `
|
|
|
1001
1034
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1002
1035
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1003
1036
|
</svg>`;
|
|
1004
|
-
class R extends
|
|
1037
|
+
class R extends w {
|
|
1005
1038
|
constructor(t = {}) {
|
|
1006
1039
|
super({
|
|
1007
1040
|
...t,
|
|
@@ -1123,7 +1156,7 @@ class R extends b {
|
|
|
1123
1156
|
};
|
|
1124
1157
|
}
|
|
1125
1158
|
}
|
|
1126
|
-
class le extends
|
|
1159
|
+
class le extends w {
|
|
1127
1160
|
constructor(t = {}) {
|
|
1128
1161
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1162
|
}
|
|
@@ -1155,7 +1188,7 @@ class le extends b {
|
|
|
1155
1188
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1156
1189
|
}
|
|
1157
1190
|
}
|
|
1158
|
-
class S extends
|
|
1191
|
+
class S extends w {
|
|
1159
1192
|
constructor(t) {
|
|
1160
1193
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1194
|
}
|
|
@@ -1245,7 +1278,7 @@ const Mt = `
|
|
|
1245
1278
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1279
|
</svg>
|
|
1247
1280
|
`;
|
|
1248
|
-
class tt extends
|
|
1281
|
+
class tt extends w {
|
|
1249
1282
|
constructor(t = {}) {
|
|
1250
1283
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1251
1284
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1352,7 +1385,7 @@ class tt extends b {
|
|
|
1352
1385
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1353
1386
|
}
|
|
1354
1387
|
}
|
|
1355
|
-
class St extends
|
|
1388
|
+
class St extends w {
|
|
1356
1389
|
constructor(t = {}) {
|
|
1357
1390
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1358
1391
|
}
|
|
@@ -1408,7 +1441,7 @@ class St extends b {
|
|
|
1408
1441
|
}), t.appendChild(i), t;
|
|
1409
1442
|
}
|
|
1410
1443
|
}
|
|
1411
|
-
class re extends
|
|
1444
|
+
class re extends w {
|
|
1412
1445
|
constructor(t) {
|
|
1413
1446
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1414
1447
|
}
|
|
@@ -1437,7 +1470,7 @@ class re extends b {
|
|
|
1437
1470
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1438
1471
|
}
|
|
1439
1472
|
}
|
|
1440
|
-
class ce extends
|
|
1473
|
+
class ce extends w {
|
|
1441
1474
|
constructor(t = {}) {
|
|
1442
1475
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1443
1476
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1568,7 +1601,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1568
1601
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1569
1602
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1570
1603
|
</svg>
|
|
1571
|
-
`,
|
|
1604
|
+
`, Ot = `
|
|
1572
1605
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1573
1606
|
<!-- Top dot -->
|
|
1574
1607
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1588,7 +1621,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1588
1621
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1589
1622
|
</svg>
|
|
1590
1623
|
`;
|
|
1591
|
-
class rt extends
|
|
1624
|
+
class rt extends w {
|
|
1592
1625
|
constructor(t = {}) {
|
|
1593
1626
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1594
1627
|
}
|
|
@@ -1685,7 +1718,7 @@ class rt extends b {
|
|
|
1685
1718
|
const s = this.value && this.value !== "";
|
|
1686
1719
|
s || i.classList.add("no-image");
|
|
1687
1720
|
const n = document.createElement("div");
|
|
1688
|
-
if (n.className = "preview-placeholder", n.innerHTML = Vt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML =
|
|
1721
|
+
if (n.className = "preview-placeholder", n.innerHTML = Vt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Ot, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1689
1722
|
const a = document.createElement("button");
|
|
1690
1723
|
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Tt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1691
1724
|
var r;
|
|
@@ -1715,7 +1748,7 @@ class he extends S {
|
|
|
1715
1748
|
title: t.title || "Height",
|
|
1716
1749
|
suffix: t.suffix || "px",
|
|
1717
1750
|
minValue: t.minValue ?? 0,
|
|
1718
|
-
icon: t.icon ||
|
|
1751
|
+
icon: t.icon || Pt,
|
|
1719
1752
|
default: t.default ?? 100
|
|
1720
1753
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1721
1754
|
}
|
|
@@ -1726,7 +1759,7 @@ class he extends S {
|
|
|
1726
1759
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1727
1760
|
}
|
|
1728
1761
|
}
|
|
1729
|
-
const
|
|
1762
|
+
const Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1730
1763
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1731
1764
|
</svg>`;
|
|
1732
1765
|
class pe extends S {
|
|
@@ -1754,7 +1787,7 @@ const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1754
1787
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1755
1788
|
</svg>
|
|
1756
1789
|
`;
|
|
1757
|
-
class de extends
|
|
1790
|
+
class de extends w {
|
|
1758
1791
|
constructor(t = {}) {
|
|
1759
1792
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1760
1793
|
const e = this._options.findIndex(
|
|
@@ -1856,19 +1889,11 @@ class de extends b {
|
|
|
1856
1889
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1857
1890
|
}
|
|
1858
1891
|
selectApiOption(t, e, i) {
|
|
1859
|
-
var l, r
|
|
1860
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
1861
|
-
n && (n.checked = !0)
|
|
1892
|
+
var a, l, r;
|
|
1893
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((a = s.closest(".select-api-option")) == null ? void 0 : a.querySelector(".select-api-radio"));
|
|
1894
|
+
n && (n.checked = !0);
|
|
1862
1895
|
const o = this._options[e].value;
|
|
1863
|
-
this.
|
|
1864
|
-
const a = i.querySelector(".select-value");
|
|
1865
|
-
if (a)
|
|
1866
|
-
a.textContent = this._options[e].name;
|
|
1867
|
-
else {
|
|
1868
|
-
const d = i.firstChild;
|
|
1869
|
-
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1870
|
-
}
|
|
1871
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (h = this.svgContainer) == null || h.classList.remove("open"), (p = this.onChange) == null || p.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1896
|
+
this.setValue(o), this.isOpen = !1, (l = this.optionsListEl) == null || l.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open");
|
|
1872
1897
|
}
|
|
1873
1898
|
updateOptionsList() {
|
|
1874
1899
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1892,16 +1917,26 @@ class de extends b {
|
|
|
1892
1917
|
i.textContent = t || n, this.buttonEl.classList.remove("error"), this.buttonEl.removeAttribute("disabled"), this.svgContainer && (this.svgContainer.style.display = "");
|
|
1893
1918
|
}
|
|
1894
1919
|
}
|
|
1920
|
+
update(t = !1) {
|
|
1921
|
+
var e;
|
|
1922
|
+
if (this.selectedOptionIndex = this.value !== void 0 ? this._options.findIndex(
|
|
1923
|
+
(i) => JSON.stringify(i.value) === JSON.stringify(this.value)
|
|
1924
|
+
) : null, this.updateOptionsList(), this.updateButtonText(), t && this.value !== void 0) {
|
|
1925
|
+
(e = this.onChange) == null || e.call(this, this.value);
|
|
1926
|
+
const i = this.props.detectChange || this.detectChangeCallback;
|
|
1927
|
+
i == null || i(this.value);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1895
1930
|
setDetectChange(t) {
|
|
1896
|
-
this.detectChangeCallback = t;
|
|
1931
|
+
this.detectChangeCallback = t, this.props.detectChange = t;
|
|
1897
1932
|
}
|
|
1898
1933
|
setValue(t) {
|
|
1899
|
-
|
|
1934
|
+
super.setValue(t), this.selectedOptionIndex = this._options.findIndex(
|
|
1900
1935
|
(e) => JSON.stringify(e.value) === JSON.stringify(t)
|
|
1901
|
-
), this.updateButtonText();
|
|
1936
|
+
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
1902
1937
|
}
|
|
1903
1938
|
}
|
|
1904
|
-
class ue extends
|
|
1939
|
+
class ue extends w {
|
|
1905
1940
|
constructor(t) {
|
|
1906
1941
|
var e, i;
|
|
1907
1942
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
@@ -1954,7 +1989,7 @@ class ue extends b {
|
|
|
1954
1989
|
const At = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1955
1990
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1956
1991
|
</svg>`;
|
|
1957
|
-
class ge extends
|
|
1992
|
+
class ge extends w {
|
|
1958
1993
|
// Store mobile value
|
|
1959
1994
|
constructor(t = {}) {
|
|
1960
1995
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? At, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
@@ -2041,9 +2076,9 @@ class fe extends S {
|
|
|
2041
2076
|
}), this.inputType = "number";
|
|
2042
2077
|
}
|
|
2043
2078
|
}
|
|
2044
|
-
class ve extends
|
|
2079
|
+
class ve extends w {
|
|
2045
2080
|
constructor(t) {
|
|
2046
|
-
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(
|
|
2081
|
+
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(w.DefaultLanguage) ? w.DefaultLanguage : t.languages[0];
|
|
2047
2082
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2048
2083
|
t.languages.forEach((i) => {
|
|
2049
2084
|
var s, n;
|
|
@@ -2188,7 +2223,7 @@ class ve extends b {
|
|
|
2188
2223
|
});
|
|
2189
2224
|
}
|
|
2190
2225
|
}
|
|
2191
|
-
class Ce extends
|
|
2226
|
+
class Ce extends w {
|
|
2192
2227
|
constructor(t = {}) {
|
|
2193
2228
|
super(t), this.inputType = "select";
|
|
2194
2229
|
const e = [
|
|
@@ -2231,7 +2266,7 @@ const ct = (c, t, e) => {
|
|
|
2231
2266
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", h), document.body.style.userSelect = "";
|
|
2232
2267
|
};
|
|
2233
2268
|
c.addEventListener("mousedown", l);
|
|
2234
|
-
},
|
|
2269
|
+
}, B = (c) => {
|
|
2235
2270
|
if (!c) return null;
|
|
2236
2271
|
let t = c.trim();
|
|
2237
2272
|
return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
|
|
@@ -2242,7 +2277,7 @@ const ct = (c, t, e) => {
|
|
|
2242
2277
|
g: parseInt(e.slice(2, 4), 16),
|
|
2243
2278
|
b: parseInt(e.slice(4, 6), 16)
|
|
2244
2279
|
};
|
|
2245
|
-
},
|
|
2280
|
+
}, $ = (c) => {
|
|
2246
2281
|
const { r: t, g: e, b: i } = k(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2247
2282
|
let h = 0;
|
|
2248
2283
|
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4), h < 0 && (h += 6);
|
|
@@ -2299,7 +2334,7 @@ const ct = (c, t, e) => {
|
|
|
2299
2334
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2300
2335
|
}
|
|
2301
2336
|
}
|
|
2302
|
-
const i =
|
|
2337
|
+
const i = B(c);
|
|
2303
2338
|
if (i) {
|
|
2304
2339
|
const { r: s, g: n, b: o } = k(i);
|
|
2305
2340
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
@@ -2336,7 +2371,7 @@ const ct = (c, t, e) => {
|
|
|
2336
2371
|
/^[a-zA-Z]+$/
|
|
2337
2372
|
].some((e) => e.test(c.trim())), Ut = (c) => {
|
|
2338
2373
|
if (typeof document > "u")
|
|
2339
|
-
return pt(c) || !!
|
|
2374
|
+
return pt(c) || !!B(c);
|
|
2340
2375
|
const t = document.createElement("div");
|
|
2341
2376
|
return t.style.color = c, t.style.color !== "";
|
|
2342
2377
|
}, dt = (c) => {
|
|
@@ -2375,7 +2410,7 @@ const ct = (c, t, e) => {
|
|
|
2375
2410
|
opacity: Math.round(l * 100)
|
|
2376
2411
|
};
|
|
2377
2412
|
}
|
|
2378
|
-
return { color:
|
|
2413
|
+
return { color: B(t) || t, position: 0, opacity: 100 };
|
|
2379
2414
|
}, nt = (c) => {
|
|
2380
2415
|
const t = [];
|
|
2381
2416
|
let e = "", i = 0;
|
|
@@ -2422,7 +2457,7 @@ const ct = (c, t, e) => {
|
|
|
2422
2457
|
const l = dt(n);
|
|
2423
2458
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2424
2459
|
}), t;
|
|
2425
|
-
},
|
|
2460
|
+
}, A = (c) => {
|
|
2426
2461
|
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2427
2462
|
return {
|
|
2428
2463
|
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
@@ -2437,7 +2472,7 @@ const ct = (c, t, e) => {
|
|
|
2437
2472
|
const t = c.replace(/;$/, "").trim();
|
|
2438
2473
|
if (Ut(t)) {
|
|
2439
2474
|
const s = dt(t);
|
|
2440
|
-
return
|
|
2475
|
+
return A({ type: "solid", angle: 0, stops: [s] });
|
|
2441
2476
|
}
|
|
2442
2477
|
const e = ot(t, "linear-gradient");
|
|
2443
2478
|
if (e) {
|
|
@@ -2458,12 +2493,12 @@ const ct = (c, t, e) => {
|
|
|
2458
2493
|
"to top left": 315
|
|
2459
2494
|
}[a] ?? 90, o = s.slice(1));
|
|
2460
2495
|
const l = at(o);
|
|
2461
|
-
return l.length ?
|
|
2496
|
+
return l.length ? A({ type: "linear", angle: n, stops: l }) : null;
|
|
2462
2497
|
}
|
|
2463
2498
|
const i = ot(t, "radial-gradient");
|
|
2464
2499
|
if (i) {
|
|
2465
2500
|
const s = nt(i), n = s[0] && !Gt(s[0]) ? s.slice(1) : s, o = at(n);
|
|
2466
|
-
return o.length ?
|
|
2501
|
+
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
2467
2502
|
}
|
|
2468
2503
|
return null;
|
|
2469
2504
|
}, N = (c) => {
|
|
@@ -2500,7 +2535,7 @@ const ct = (c, t, e) => {
|
|
|
2500
2535
|
static normalizeList(t) {
|
|
2501
2536
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2502
2537
|
return t.forEach((s) => {
|
|
2503
|
-
let n =
|
|
2538
|
+
let n = B(s);
|
|
2504
2539
|
n || P(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2505
2540
|
}), i.slice(0, this.MAX_COLORS);
|
|
2506
2541
|
}
|
|
@@ -2544,7 +2579,7 @@ const ct = (c, t, e) => {
|
|
|
2544
2579
|
}
|
|
2545
2580
|
static addColor(t, e) {
|
|
2546
2581
|
if (!t) return;
|
|
2547
|
-
let i =
|
|
2582
|
+
let i = B(t), s = "solid";
|
|
2548
2583
|
if (i)
|
|
2549
2584
|
s = "solid";
|
|
2550
2585
|
else {
|
|
@@ -2557,7 +2592,7 @@ const ct = (c, t, e) => {
|
|
|
2557
2592
|
}
|
|
2558
2593
|
};
|
|
2559
2594
|
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2560
|
-
let
|
|
2595
|
+
let D = z;
|
|
2561
2596
|
const et = (c, t) => {
|
|
2562
2597
|
const e = document.createElement("div");
|
|
2563
2598
|
e.className = "color-picker-recent-section";
|
|
@@ -2569,7 +2604,7 @@ const et = (c, t) => {
|
|
|
2569
2604
|
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2570
2605
|
const o = () => {
|
|
2571
2606
|
s.innerHTML = "";
|
|
2572
|
-
const a =
|
|
2607
|
+
const a = D.getColors(t);
|
|
2573
2608
|
if (a.length === 0) {
|
|
2574
2609
|
s.style.display = "none", n.style.display = "block";
|
|
2575
2610
|
return;
|
|
@@ -2601,7 +2636,7 @@ const et = (c, t) => {
|
|
|
2601
2636
|
const t = P(c);
|
|
2602
2637
|
if (t)
|
|
2603
2638
|
return _(t);
|
|
2604
|
-
const e =
|
|
2639
|
+
const e = B(c);
|
|
2605
2640
|
if (e) {
|
|
2606
2641
|
const i = k(e);
|
|
2607
2642
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
@@ -2688,10 +2723,10 @@ class Jt {
|
|
|
2688
2723
|
L.value = "hsl", L.textContent = "HSL", g.appendChild(C), g.appendChild(y), g.appendChild(L);
|
|
2689
2724
|
const I = document.createElement("input");
|
|
2690
2725
|
I.type = "text", I.className = "color-picker-color-input", I.value = this.currentColor, this.input = I;
|
|
2691
|
-
const
|
|
2692
|
-
|
|
2726
|
+
const H = document.createElement("div");
|
|
2727
|
+
H.className = "color-picker-input-container";
|
|
2693
2728
|
const v = document.createElement("button");
|
|
2694
|
-
return v.className = "color-picker-copy-inside", v.textContent = "Copy",
|
|
2729
|
+
return v.className = "color-picker-copy-inside", v.textContent = "Copy", H.appendChild(I), H.appendChild(v), f.appendChild(g), f.appendChild(H), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(m.container), t.appendChild(f), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, d, I, g, v, l), t;
|
|
2695
2730
|
}
|
|
2696
2731
|
createBackdrop() {
|
|
2697
2732
|
const t = document.createElement("div");
|
|
@@ -2763,11 +2798,11 @@ class Jt {
|
|
|
2763
2798
|
setColor(t) {
|
|
2764
2799
|
var o;
|
|
2765
2800
|
this.currentColor = t;
|
|
2766
|
-
const { h: e, s: i, v: s } =
|
|
2801
|
+
const { h: e, s: i, v: s } = $(t), n = e >= 360 ? e % 360 : e;
|
|
2767
2802
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2768
2803
|
}
|
|
2769
2804
|
syncInput() {
|
|
2770
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2805
|
+
const t = this.select.value, { h: e, s: i, v: s } = $(this.currentColor);
|
|
2771
2806
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2772
2807
|
else if (t === "rgb") {
|
|
2773
2808
|
const { r: n, g: o, b: a } = k(this.currentColor);
|
|
@@ -2808,7 +2843,7 @@ class Jt {
|
|
|
2808
2843
|
open(t, e, i) {
|
|
2809
2844
|
var L;
|
|
2810
2845
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2811
|
-
const { h: s, s: n, v: o } =
|
|
2846
|
+
const { h: s, s: n, v: o } = $(t);
|
|
2812
2847
|
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (L = this.recentSectionRefresh) == null || L.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2813
2848
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2814
2849
|
let u = r.right + 8, m = r.top;
|
|
@@ -2819,7 +2854,7 @@ class Jt {
|
|
|
2819
2854
|
}
|
|
2820
2855
|
close(t) {
|
|
2821
2856
|
var e;
|
|
2822
|
-
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (
|
|
2857
|
+
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (D.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2823
2858
|
}
|
|
2824
2859
|
getElement() {
|
|
2825
2860
|
return this.element;
|
|
@@ -2887,7 +2922,7 @@ class Xt {
|
|
|
2887
2922
|
);
|
|
2888
2923
|
const t = this.container.querySelector(
|
|
2889
2924
|
".color-picker-copy-inside"
|
|
2890
|
-
), { h: e, s: i, v: s } =
|
|
2925
|
+
), { h: e, s: i, v: s } = $(this.currentColor);
|
|
2891
2926
|
this.hueMarker.style.left = `${e / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${e}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput), this.setupColorAreaEvents(), this.setupHueSliderEvents(), this.setupOpacitySliderEvents(), this.setupFormatEvents(t);
|
|
2892
2927
|
}
|
|
2893
2928
|
scheduleInputUpdate() {
|
|
@@ -2912,7 +2947,7 @@ class Xt {
|
|
|
2912
2947
|
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2913
2948
|
break;
|
|
2914
2949
|
case "hsl":
|
|
2915
|
-
const { h: n, s: o, v: a } =
|
|
2950
|
+
const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
|
|
2916
2951
|
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2917
2952
|
r * 100
|
|
2918
2953
|
)}%, ${Math.round(l * 100)}%)`;
|
|
@@ -2924,7 +2959,7 @@ class Xt {
|
|
|
2924
2959
|
}
|
|
2925
2960
|
commitRecentColor() {
|
|
2926
2961
|
var t;
|
|
2927
|
-
|
|
2962
|
+
D.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
|
|
2928
2963
|
}
|
|
2929
2964
|
setupColorAreaEvents() {
|
|
2930
2965
|
const t = (e) => {
|
|
@@ -3011,7 +3046,7 @@ class Xt {
|
|
|
3011
3046
|
}
|
|
3012
3047
|
parseHexInput(t) {
|
|
3013
3048
|
const e = t.startsWith("#") ? t : `#${t}`;
|
|
3014
|
-
return
|
|
3049
|
+
return B(e);
|
|
3015
3050
|
}
|
|
3016
3051
|
parseRgbInput(t) {
|
|
3017
3052
|
const e = t.match(
|
|
@@ -3046,7 +3081,7 @@ class Xt {
|
|
|
3046
3081
|
return s || null;
|
|
3047
3082
|
}
|
|
3048
3083
|
updatePickerVisualState() {
|
|
3049
|
-
const { h: t, s: e, v: i } =
|
|
3084
|
+
const { h: t, s: e, v: i } = $(this.currentColor);
|
|
3050
3085
|
this.hueMarker.style.left = `${t / 360 * 100}%`, this.colorMarker.style.left = `${e * 100}%`, this.colorMarker.style.top = `${(1 - i) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`, this.updateOpacityBackground(this.opacitySlider);
|
|
3051
3086
|
}
|
|
3052
3087
|
triggerChange() {
|
|
@@ -3057,11 +3092,11 @@ class Xt {
|
|
|
3057
3092
|
}
|
|
3058
3093
|
updateColor(t, e) {
|
|
3059
3094
|
this.currentColor = t, this.currentOpacity = e;
|
|
3060
|
-
const { h: i, s, v: n } =
|
|
3095
|
+
const { h: i, s, v: n } = $(t), o = i >= 360 ? i % 360 : i;
|
|
3061
3096
|
this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput);
|
|
3062
3097
|
}
|
|
3063
3098
|
}
|
|
3064
|
-
const V = class V extends
|
|
3099
|
+
const V = class V extends w {
|
|
3065
3100
|
constructor(t = {}) {
|
|
3066
3101
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3067
3102
|
super({
|
|
@@ -3103,9 +3138,9 @@ const V = class V extends b {
|
|
|
3103
3138
|
if (typeof t == "string") {
|
|
3104
3139
|
const i = P(t);
|
|
3105
3140
|
if (i)
|
|
3106
|
-
return
|
|
3141
|
+
return A(i);
|
|
3107
3142
|
}
|
|
3108
|
-
return
|
|
3143
|
+
return A(t && typeof t == "object" ? t : {
|
|
3109
3144
|
type: "linear",
|
|
3110
3145
|
angle: 90,
|
|
3111
3146
|
stops: [
|
|
@@ -3117,7 +3152,7 @@ const V = class V extends b {
|
|
|
3117
3152
|
setValue(t) {
|
|
3118
3153
|
var i, s;
|
|
3119
3154
|
let e = null;
|
|
3120
|
-
typeof t == "string" ? e = P(t) : t && typeof t == "object" && (e =
|
|
3155
|
+
typeof t == "string" ? e = P(t) : t && typeof t == "object" && (e = A(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null;
|
|
3121
3156
|
}
|
|
3122
3157
|
updateUI() {
|
|
3123
3158
|
if (this.previewEl && this.value)
|
|
@@ -3334,7 +3369,7 @@ const V = class V extends b {
|
|
|
3334
3369
|
var i;
|
|
3335
3370
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3336
3371
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3337
|
-
var I,
|
|
3372
|
+
var I, H;
|
|
3338
3373
|
const o = document.createElement("div");
|
|
3339
3374
|
o.className = "gstop-row";
|
|
3340
3375
|
const a = document.createElement("div");
|
|
@@ -3350,7 +3385,7 @@ const V = class V extends b {
|
|
|
3350
3385
|
const d = document.createElement("button");
|
|
3351
3386
|
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(d);
|
|
3352
3387
|
const u = document.createElement("button");
|
|
3353
|
-
u.type = "button", u.className = "gstop-del", u.innerHTML = _t, u.disabled = (((
|
|
3388
|
+
u.type = "button", u.className = "gstop-del", u.innerHTML = _t, u.disabled = (((H = (I = this.value) == null ? void 0 : I.stops) == null ? void 0 : H.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(u), e.appendChild(o);
|
|
3354
3389
|
const m = document.createElement("span");
|
|
3355
3390
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3356
3391
|
const f = document.createElement("div");
|
|
@@ -3501,13 +3536,13 @@ const V = class V extends b {
|
|
|
3501
3536
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3502
3537
|
if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
|
|
3503
3538
|
const e = N(this.value);
|
|
3504
|
-
|
|
3539
|
+
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3505
3540
|
}
|
|
3506
3541
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
|
|
3507
3542
|
}
|
|
3508
3543
|
}
|
|
3509
3544
|
commitPendingSolidColor() {
|
|
3510
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
3545
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : D.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3511
3546
|
}
|
|
3512
3547
|
handlePaste(t) {
|
|
3513
3548
|
var i;
|
|
@@ -3688,7 +3723,7 @@ class Ee extends T {
|
|
|
3688
3723
|
`;
|
|
3689
3724
|
}
|
|
3690
3725
|
}
|
|
3691
|
-
class j extends
|
|
3726
|
+
class j extends w {
|
|
3692
3727
|
constructor(t) {
|
|
3693
3728
|
super({
|
|
3694
3729
|
...t,
|
|
@@ -3847,7 +3882,7 @@ export {
|
|
|
3847
3882
|
kt as OpacitySetting,
|
|
3848
3883
|
de as SelectApiSettings,
|
|
3849
3884
|
tt as SelectSetting,
|
|
3850
|
-
|
|
3885
|
+
w as Setting,
|
|
3851
3886
|
T as SettingGroup,
|
|
3852
3887
|
bt as StringSetting,
|
|
3853
3888
|
yt as TabSettingGroup,
|
|
@@ -3858,8 +3893,8 @@ export {
|
|
|
3858
3893
|
ae as asSettingGroupWithSettings,
|
|
3859
3894
|
Et as createSettingGroup,
|
|
3860
3895
|
oe as createTabSettingGroup,
|
|
3861
|
-
|
|
3896
|
+
O as isSetting,
|
|
3862
3897
|
st as isSettingChild,
|
|
3863
|
-
|
|
3898
|
+
b as isSettingGroup,
|
|
3864
3899
|
W as iterateSettings
|
|
3865
3900
|
};
|