builder-settings-types 0.0.271 → 0.0.272
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.
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
const ut = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let lt = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t += ut[e[
|
|
2
|
+
let lt = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += ut[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function gt(
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function gt(c) {
|
|
9
|
+
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function U(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function Q(
|
|
19
|
-
|
|
18
|
+
function Q(c, t = 0) {
|
|
19
|
+
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
U(s, n), Q(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const mt = {
|
|
@@ -112,20 +112,20 @@ class ft {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const it = new ft();
|
|
115
|
-
function _(
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
115
|
+
function _(c) {
|
|
116
|
+
if (c === null || typeof c != "object") return c;
|
|
117
|
+
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
+
if (c instanceof Array) return c.map((t) => _(t));
|
|
119
|
+
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in c)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = _(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return c;
|
|
126
126
|
}
|
|
127
|
-
function vt(
|
|
128
|
-
switch (
|
|
127
|
+
function vt(c) {
|
|
128
|
+
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,15 +142,15 @@ function vt(r) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class E {
|
|
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, E.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, E.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -195,30 +195,30 @@ class y {
|
|
|
195
195
|
this.inputEl = s, s.value = String(t.value || vt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
196
|
const n = (a) => {
|
|
197
197
|
const l = a.target;
|
|
198
|
-
let
|
|
198
|
+
let r = l.value;
|
|
199
199
|
switch (t.inputType) {
|
|
200
200
|
case "number":
|
|
201
|
-
|
|
201
|
+
r = Number(l.value);
|
|
202
202
|
break;
|
|
203
203
|
case "color":
|
|
204
|
-
|
|
204
|
+
r = l.value;
|
|
205
205
|
break;
|
|
206
206
|
case "date":
|
|
207
|
-
|
|
207
|
+
r = l.value;
|
|
208
208
|
break;
|
|
209
209
|
case "select":
|
|
210
|
-
|
|
210
|
+
r = l.value;
|
|
211
211
|
break;
|
|
212
212
|
case "text":
|
|
213
|
-
|
|
213
|
+
r = l.value;
|
|
214
214
|
break;
|
|
215
215
|
case "button":
|
|
216
|
-
|
|
216
|
+
r = l.value;
|
|
217
217
|
break;
|
|
218
218
|
default:
|
|
219
|
-
|
|
219
|
+
r = l.value;
|
|
220
220
|
}
|
|
221
|
-
this.value =
|
|
221
|
+
this.value = r, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
222
222
|
}, o = (a) => {
|
|
223
223
|
a.target, this.onBlur && this.onBlur(this.value);
|
|
224
224
|
};
|
|
@@ -233,19 +233,19 @@ class y {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function B(
|
|
237
|
-
return
|
|
236
|
+
function B(c) {
|
|
237
|
+
return c instanceof E;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
239
|
+
function x(c) {
|
|
240
|
+
return c instanceof V;
|
|
241
241
|
}
|
|
242
|
-
function st(
|
|
243
|
-
return B(
|
|
242
|
+
function st(c) {
|
|
243
|
+
return B(c) || x(c);
|
|
244
244
|
}
|
|
245
|
-
function q(
|
|
246
|
-
for (const e in
|
|
247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
248
|
-
const i =
|
|
245
|
+
function q(c, t) {
|
|
246
|
+
for (const e in c)
|
|
247
|
+
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
248
|
+
const i = c[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -257,7 +257,7 @@ const Z = class Z {
|
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
259
|
q(this.settings, (e, i) => {
|
|
260
|
-
|
|
260
|
+
x(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -275,16 +275,16 @@ const Z = class Z {
|
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
276
|
q(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(x(e) || B(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (U(this.elementRef, this.nestingLevel), Q(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
286
|
try {
|
|
287
|
-
if (
|
|
287
|
+
if (x(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -355,7 +355,7 @@ const Z = class Z {
|
|
|
355
355
|
setMobileValues(t) {
|
|
356
356
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
357
357
|
const s = this.settings[e];
|
|
358
|
-
s && (
|
|
358
|
+
s && (x(s) || B(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
359
359
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
360
360
|
}
|
|
361
361
|
getMobileValues(t) {
|
|
@@ -364,7 +364,7 @@ const Z = class Z {
|
|
|
364
364
|
for (const i in this.settings)
|
|
365
365
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
366
366
|
const s = this.settings[i];
|
|
367
|
-
if (
|
|
367
|
+
if (x(s))
|
|
368
368
|
e[i] = s.getMobileValues();
|
|
369
369
|
else {
|
|
370
370
|
const n = s;
|
|
@@ -375,7 +375,7 @@ const Z = class Z {
|
|
|
375
375
|
} else {
|
|
376
376
|
const e = this.settings[t];
|
|
377
377
|
if (!e) return;
|
|
378
|
-
if (
|
|
378
|
+
if (x(e)) return e.getMobileValues();
|
|
379
379
|
const i = e;
|
|
380
380
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
381
381
|
}
|
|
@@ -393,7 +393,7 @@ const Z = class Z {
|
|
|
393
393
|
};
|
|
394
394
|
return this.changeHandlers.clear(), q(this.settings, (i, s) => {
|
|
395
395
|
var n;
|
|
396
|
-
if (
|
|
396
|
+
if (x(s))
|
|
397
397
|
s.setOnChange(() => {
|
|
398
398
|
const o = this.getValues();
|
|
399
399
|
this.initialValues = o, t(o);
|
|
@@ -424,7 +424,7 @@ const Z = class Z {
|
|
|
424
424
|
st(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (
|
|
427
|
+
n && (x(n) || B(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
428
|
}), setTimeout(() => {
|
|
429
429
|
this.forceChildUIRefresh();
|
|
430
430
|
}, 0);
|
|
@@ -438,7 +438,7 @@ const Z = class Z {
|
|
|
438
438
|
const s = this.getValues();
|
|
439
439
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
440
|
};
|
|
441
|
-
|
|
441
|
+
x(t) ? t.setOnChange(() => e()) : B(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
442
442
|
}
|
|
443
443
|
addSetting(t, e) {
|
|
444
444
|
var s, n;
|
|
@@ -447,14 +447,14 @@ const Z = class Z {
|
|
|
447
447
|
".setting-group-content"
|
|
448
448
|
);
|
|
449
449
|
if (o) {
|
|
450
|
-
|
|
450
|
+
x(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
451
451
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
452
452
|
if (l) {
|
|
453
|
-
const
|
|
454
|
-
|
|
453
|
+
const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
454
|
+
p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
|
|
455
455
|
}
|
|
456
|
-
const
|
|
457
|
-
|
|
456
|
+
const r = o.querySelector(".sg-add-button-bottom");
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), U(a, this.nestingLevel + 1), Q(a, this.nestingLevel + 1);
|
|
458
458
|
const h = a.style.display;
|
|
459
459
|
a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
|
|
460
460
|
}
|
|
@@ -470,15 +470,15 @@ const Z = class Z {
|
|
|
470
470
|
s = null;
|
|
471
471
|
}
|
|
472
472
|
if (!s) {
|
|
473
|
-
const
|
|
473
|
+
const r = Array.from(
|
|
474
474
|
t.querySelectorAll(".setting-group-title")
|
|
475
475
|
);
|
|
476
|
-
for (const h of
|
|
476
|
+
for (const h of r)
|
|
477
477
|
if (h.closest(".setting-group") === t) {
|
|
478
478
|
s = h;
|
|
479
479
|
break;
|
|
480
480
|
}
|
|
481
|
-
s || (s =
|
|
481
|
+
s || (s = r[0] ?? null);
|
|
482
482
|
}
|
|
483
483
|
if (!s) return;
|
|
484
484
|
const n = s.querySelector(".actions-section");
|
|
@@ -507,8 +507,8 @@ const Z = class Z {
|
|
|
507
507
|
o.style.backgroundColor = "#fef2f2";
|
|
508
508
|
}), o.addEventListener("mouseleave", () => {
|
|
509
509
|
o.style.backgroundColor = "transparent";
|
|
510
|
-
}), o.addEventListener("click", (
|
|
511
|
-
|
|
510
|
+
}), o.addEventListener("click", (r) => {
|
|
511
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((h) => {
|
|
512
512
|
h && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
513
513
|
});
|
|
514
514
|
});
|
|
@@ -594,20 +594,20 @@ const Z = class Z {
|
|
|
594
594
|
}), l.addEventListener("mouseleave", () => {
|
|
595
595
|
l.style.backgroundColor = "#ef4444";
|
|
596
596
|
});
|
|
597
|
-
const
|
|
597
|
+
const r = () => {
|
|
598
598
|
e.style.opacity = "0", i.style.transform = "scale(0.95)", setTimeout(() => {
|
|
599
599
|
e.parentNode && e.parentNode.removeChild(e);
|
|
600
600
|
}, 200);
|
|
601
601
|
};
|
|
602
602
|
a.addEventListener("click", () => {
|
|
603
|
-
|
|
603
|
+
r(), t(!1);
|
|
604
604
|
}), l.addEventListener("click", () => {
|
|
605
|
-
|
|
606
|
-
}), e.addEventListener("click", (
|
|
607
|
-
|
|
605
|
+
r(), t(!0);
|
|
606
|
+
}), e.addEventListener("click", (p) => {
|
|
607
|
+
p.target === e && (r(), t(!1));
|
|
608
608
|
});
|
|
609
|
-
const h = (
|
|
610
|
-
|
|
609
|
+
const h = (p) => {
|
|
610
|
+
p.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", h));
|
|
611
611
|
};
|
|
612
612
|
document.addEventListener("keydown", h), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
613
613
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -637,7 +637,7 @@ const Z = class Z {
|
|
|
637
637
|
for (const i in this.settings)
|
|
638
638
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
639
639
|
const s = this.settings[i];
|
|
640
|
-
if (
|
|
640
|
+
if (x(s))
|
|
641
641
|
e[i] = s.getValues();
|
|
642
642
|
else {
|
|
643
643
|
const n = s;
|
|
@@ -648,7 +648,7 @@ const Z = class Z {
|
|
|
648
648
|
} else {
|
|
649
649
|
const e = this.settings[t];
|
|
650
650
|
if (!e) return;
|
|
651
|
-
if (
|
|
651
|
+
if (x(e)) return e.getValues();
|
|
652
652
|
const i = e;
|
|
653
653
|
return i.getValue ? i.getValue() : i.value;
|
|
654
654
|
}
|
|
@@ -661,7 +661,7 @@ const Z = class Z {
|
|
|
661
661
|
for (const s in this.settings)
|
|
662
662
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
663
663
|
const n = this.settings[s];
|
|
664
|
-
if (
|
|
664
|
+
if (x(n)) {
|
|
665
665
|
const o = n.getValuesForJson();
|
|
666
666
|
o !== null && (i[s] = o);
|
|
667
667
|
} else {
|
|
@@ -673,7 +673,7 @@ const Z = class Z {
|
|
|
673
673
|
} else {
|
|
674
674
|
const i = this.settings[t];
|
|
675
675
|
if (!i) return;
|
|
676
|
-
if (
|
|
676
|
+
if (x(i))
|
|
677
677
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
678
678
|
{
|
|
679
679
|
const s = i;
|
|
@@ -687,7 +687,7 @@ const Z = class Z {
|
|
|
687
687
|
for (const i in this.settings)
|
|
688
688
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
689
689
|
const s = this.settings[i];
|
|
690
|
-
if (
|
|
690
|
+
if (x(s))
|
|
691
691
|
e[i] = s.getDefaultValues();
|
|
692
692
|
else {
|
|
693
693
|
const n = s;
|
|
@@ -698,14 +698,14 @@ const Z = class Z {
|
|
|
698
698
|
} else {
|
|
699
699
|
const e = this.settings[t];
|
|
700
700
|
if (!e) return;
|
|
701
|
-
if (
|
|
701
|
+
if (x(e)) return e.getDefaultValues();
|
|
702
702
|
const i = e;
|
|
703
703
|
return i.default !== void 0 ? i.default : i.value;
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
draw() {
|
|
707
707
|
const t = document.createElement("div");
|
|
708
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`, Z.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"),
|
|
708
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Z.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), U(t, this.nestingLevel);
|
|
709
709
|
const e = document.createElement("div");
|
|
710
710
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
711
711
|
"aria-expanded",
|
|
@@ -736,14 +736,14 @@ const Z = class Z {
|
|
|
736
736
|
}, Object.keys(this.settings).length > 0) {
|
|
737
737
|
for (const h in this.settings)
|
|
738
738
|
if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
739
|
+
const p = this.settings[h];
|
|
740
|
+
x(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
|
|
741
|
+
const d = p.draw();
|
|
742
|
+
x(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
|
|
743
|
+
d,
|
|
744
744
|
h,
|
|
745
|
-
|
|
746
|
-
), a.appendChild(
|
|
745
|
+
p
|
|
746
|
+
), a.appendChild(d);
|
|
747
747
|
}
|
|
748
748
|
} else {
|
|
749
749
|
const h = document.createElement("div");
|
|
@@ -752,14 +752,14 @@ const Z = class Z {
|
|
|
752
752
|
if (this.addItemCfg) {
|
|
753
753
|
const h = document.createElement("button");
|
|
754
754
|
h.type = "button", h.className = "sg-add-button-bottom", h.style.marginTop = "8px";
|
|
755
|
-
const
|
|
755
|
+
const p = `
|
|
756
756
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
757
757
|
xmlns="http://www.w3.org/2000/svg">
|
|
758
758
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
759
759
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
760
760
|
</svg>`;
|
|
761
|
-
h.innerHTML = `${
|
|
762
|
-
|
|
761
|
+
h.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (d) => {
|
|
762
|
+
d.stopPropagation(), d.preventDefault();
|
|
763
763
|
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), u = this.addItemCfg.createItem(g);
|
|
764
764
|
if (st(u)) {
|
|
765
765
|
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
@@ -811,8 +811,8 @@ const Z = class Z {
|
|
|
811
811
|
};
|
|
812
812
|
Z.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
813
|
let V = Z;
|
|
814
|
-
function ne(
|
|
815
|
-
return new Ct(
|
|
814
|
+
function ne(c) {
|
|
815
|
+
return new Ct(c);
|
|
816
816
|
}
|
|
817
817
|
class Ct extends V {
|
|
818
818
|
constructor(t) {
|
|
@@ -850,13 +850,13 @@ class Ct extends V {
|
|
|
850
850
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
851
851
|
const o = document.createElement("div");
|
|
852
852
|
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
853
|
-
const
|
|
854
|
-
|
|
853
|
+
const r = document.createElement("button");
|
|
854
|
+
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
|
|
855
855
|
const h = document.createElement("div");
|
|
856
856
|
h.className = "tab-panel", this.contentContainers[a] = h;
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
857
|
+
const p = this.settings[a];
|
|
858
|
+
p && (x(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
|
|
859
|
+
p.draw()
|
|
860
860
|
)), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
861
861
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
862
862
|
const a = Object.keys(this.settings)[0];
|
|
@@ -865,13 +865,13 @@ class Ct extends V {
|
|
|
865
865
|
return this.updateTabUI(), t;
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
function yt(
|
|
869
|
-
return new V(
|
|
868
|
+
function yt(c) {
|
|
869
|
+
return new V(c);
|
|
870
870
|
}
|
|
871
|
-
function oe(
|
|
872
|
-
return
|
|
871
|
+
function oe(c) {
|
|
872
|
+
return c;
|
|
873
873
|
}
|
|
874
|
-
class Et extends
|
|
874
|
+
class Et extends E {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -911,11 +911,11 @@ class M extends Et {
|
|
|
911
911
|
const e = t.split(",").map((h) => parseInt(h.trim()));
|
|
912
912
|
if (e.length !== 3 || e.some(isNaN))
|
|
913
913
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
914
|
-
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)),
|
|
915
|
-
const
|
|
916
|
-
return
|
|
914
|
+
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (h) => {
|
|
915
|
+
const p = h.toString(16);
|
|
916
|
+
return p.length === 1 ? "0" + p : p;
|
|
917
917
|
};
|
|
918
|
-
return `#${
|
|
918
|
+
return `#${r(o)}${r(a)}${r(l)}`;
|
|
919
919
|
}
|
|
920
920
|
setValue(t) {
|
|
921
921
|
if (t === void 0) {
|
|
@@ -938,23 +938,23 @@ class M extends Et {
|
|
|
938
938
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
939
939
|
const l = document.createElement("div");
|
|
940
940
|
if (l.className = "icon-container", this.props.icon) {
|
|
941
|
-
const
|
|
942
|
-
|
|
941
|
+
const r = document.createElement("span");
|
|
942
|
+
r.className = "input-icon", r.innerHTML = this.props.icon, l.appendChild(r);
|
|
943
943
|
}
|
|
944
944
|
if (this.props.title) {
|
|
945
|
-
const
|
|
946
|
-
|
|
945
|
+
const r = document.createElement("span");
|
|
946
|
+
r.className = "input-label", r.textContent = this.props.title, l.appendChild(r);
|
|
947
947
|
}
|
|
948
948
|
t.appendChild(l);
|
|
949
949
|
}
|
|
950
950
|
const e = document.createElement("div");
|
|
951
951
|
e.className = "color-input-wrapper";
|
|
952
952
|
const i = (l) => {
|
|
953
|
-
const
|
|
954
|
-
if (!
|
|
953
|
+
const r = l.value.trim();
|
|
954
|
+
if (!r)
|
|
955
955
|
return e.classList.remove("error"), !0;
|
|
956
|
-
const
|
|
957
|
-
return
|
|
956
|
+
const p = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
957
|
+
return p ? e.classList.remove("error") : e.classList.add("error"), p;
|
|
958
958
|
}, s = document.createElement("input");
|
|
959
959
|
s.type = "color", s.className = "color-picker", s.value = this.value || "#000000", s.setAttribute("aria-label", "Choose color"), s.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = s;
|
|
960
960
|
const n = document.createElement("div");
|
|
@@ -963,20 +963,20 @@ class M extends Et {
|
|
|
963
963
|
n.style.backgroundColor = o;
|
|
964
964
|
const a = document.createElement("input");
|
|
965
965
|
return a.type = "text", a.className = "color-text-input", a.value = this.value || "", a.placeholder = "#000000", a.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), a.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), a.setAttribute("aria-label", "Hex color value"), a.setAttribute("maxlength", "7"), this.getDataPropsPath() && a.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = a, this.textInputEl.addEventListener("input", (l) => {
|
|
966
|
-
var h,
|
|
967
|
-
let
|
|
966
|
+
var h, p;
|
|
967
|
+
let r = l.target.value.trim();
|
|
968
968
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
969
|
-
const
|
|
970
|
-
this.value =
|
|
969
|
+
const d = M.normalizeColorValue(r);
|
|
970
|
+
this.value = d, (h = this.onChange) == null || h.call(this, d), (p = this.detectChange) == null || p.call(this, d), this.colorInputEl && (this.colorInputEl.value = d), n.style.backgroundColor = d;
|
|
971
971
|
}
|
|
972
972
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
973
|
-
var
|
|
974
|
-
const
|
|
975
|
-
this.value = h, (
|
|
973
|
+
var p, d;
|
|
974
|
+
const r = l.target.value, h = M.normalizeColorValue(r);
|
|
975
|
+
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h, e.classList.remove("error");
|
|
976
976
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
977
|
-
var
|
|
978
|
-
const
|
|
979
|
-
this.value = h, (
|
|
977
|
+
var p, d;
|
|
978
|
+
const r = l.target.value, h = M.normalizeColorValue(r);
|
|
979
|
+
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h;
|
|
980
980
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
981
981
|
}
|
|
982
982
|
getElement() {
|
|
@@ -1001,14 +1001,14 @@ const wt = `
|
|
|
1001
1001
|
<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
1002
|
<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
1003
|
</svg>`;
|
|
1004
|
-
class
|
|
1004
|
+
class P extends E {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
1008
|
icon: t.icon || wt,
|
|
1009
1009
|
title: t.title || "Color & Opacity",
|
|
1010
1010
|
default: t.default || "#000000FF"
|
|
1011
|
-
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value =
|
|
1011
|
+
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = P.normalizeHexWithOpacity(this.value));
|
|
1012
1012
|
}
|
|
1013
1013
|
static normalizeHexWithOpacity(t) {
|
|
1014
1014
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -1026,7 +1026,7 @@ class T extends y {
|
|
|
1026
1026
|
return `#${i}${n}`;
|
|
1027
1027
|
}
|
|
1028
1028
|
setValue(t) {
|
|
1029
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1029
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = P.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1030
1030
|
}
|
|
1031
1031
|
updateInputElements() {
|
|
1032
1032
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1037,7 +1037,7 @@ class T extends y {
|
|
|
1037
1037
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1038
1038
|
}
|
|
1039
1039
|
handleColorChange(t) {
|
|
1040
|
-
const e = this.getOpacityPercent(), i =
|
|
1040
|
+
const e = this.getOpacityPercent(), i = P.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class T extends y {
|
|
|
1048
1048
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1049
1049
|
}
|
|
1050
1050
|
handleOpacityChange(t) {
|
|
1051
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1051
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = P.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1123,7 +1123,7 @@ class T extends y {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class ae extends
|
|
1126
|
+
class ae extends E {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class ae extends y {
|
|
|
1155
1155
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
class I extends
|
|
1158
|
+
class I extends E {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1161
|
}
|
|
@@ -1245,7 +1245,7 @@ const kt = `
|
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class tt extends
|
|
1248
|
+
class tt extends E {
|
|
1249
1249
|
constructor(t = {}) {
|
|
1250
1250
|
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
1251
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1319,8 +1319,8 @@ class tt extends y {
|
|
|
1319
1319
|
selectOption(t, e, i) {
|
|
1320
1320
|
var n, o;
|
|
1321
1321
|
const s = this._options[e];
|
|
1322
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l,
|
|
1323
|
-
|
|
1322
|
+
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l, r) => {
|
|
1323
|
+
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1324
1324
|
}));
|
|
1325
1325
|
}
|
|
1326
1326
|
/**
|
|
@@ -1358,7 +1358,7 @@ class tt extends y {
|
|
|
1358
1358
|
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();
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class Mt extends
|
|
1361
|
+
class Mt extends E {
|
|
1362
1362
|
constructor(t = {}) {
|
|
1363
1363
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1364
|
}
|
|
@@ -1414,7 +1414,7 @@ class Mt extends y {
|
|
|
1414
1414
|
}), t.appendChild(i), t;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
class le extends
|
|
1417
|
+
class le extends E {
|
|
1418
1418
|
constructor(t) {
|
|
1419
1419
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1420
1420
|
}
|
|
@@ -1428,8 +1428,8 @@ class le extends y {
|
|
|
1428
1428
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1429
1429
|
);
|
|
1430
1430
|
if (n) {
|
|
1431
|
-
let a = +n[1], l = +n[2],
|
|
1432
|
-
h >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9),
|
|
1431
|
+
let a = +n[1], l = +n[2], r = +n[3], h = +n[4];
|
|
1432
|
+
h >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : h = Math.min(1, h + 0.12), s = `rgba(${a},${l},${r},${h})`;
|
|
1433
1433
|
}
|
|
1434
1434
|
t.addEventListener("mouseenter", () => {
|
|
1435
1435
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
@@ -1443,7 +1443,7 @@ class le extends y {
|
|
|
1443
1443
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class re extends
|
|
1446
|
+
class re extends E {
|
|
1447
1447
|
constructor(t = {}) {
|
|
1448
1448
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1449
1449
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1594,7 +1594,7 @@ const St = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1594
1594
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1595
1595
|
</svg>
|
|
1596
1596
|
`;
|
|
1597
|
-
class rt extends
|
|
1597
|
+
class rt extends E {
|
|
1598
1598
|
constructor(t = {}) {
|
|
1599
1599
|
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();
|
|
1600
1600
|
}
|
|
@@ -1694,8 +1694,8 @@ class rt extends y {
|
|
|
1694
1694
|
if (n.className = "preview-placeholder", n.innerHTML = Nt, 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) {
|
|
1695
1695
|
const a = document.createElement("button");
|
|
1696
1696
|
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Vt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1697
|
-
var
|
|
1698
|
-
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (
|
|
1697
|
+
var r;
|
|
1698
|
+
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1699
1699
|
};
|
|
1700
1700
|
}
|
|
1701
1701
|
this.previewWrapper.appendChild(this.previewEl);
|
|
@@ -1742,7 +1742,7 @@ class he extends I {
|
|
|
1742
1742
|
title: t.title || "Width",
|
|
1743
1743
|
suffix: t.suffix || "px",
|
|
1744
1744
|
minValue: t.minValue ?? 0,
|
|
1745
|
-
icon: t.icon ||
|
|
1745
|
+
icon: t.icon || Pt,
|
|
1746
1746
|
default: t.default ?? 100
|
|
1747
1747
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1748
1748
|
}
|
|
@@ -1753,14 +1753,14 @@ class he extends I {
|
|
|
1753
1753
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
const
|
|
1756
|
+
const Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1757
1757
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1758
|
-
</svg>`,
|
|
1758
|
+
</svg>`, Tt = `
|
|
1759
1759
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1760
1760
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1761
|
</svg>
|
|
1762
1762
|
`;
|
|
1763
|
-
class
|
|
1763
|
+
class pe extends E {
|
|
1764
1764
|
constructor(t = {}) {
|
|
1765
1765
|
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) {
|
|
1766
1766
|
const e = this._options.findIndex(
|
|
@@ -1815,7 +1815,7 @@ class de extends y {
|
|
|
1815
1815
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1816
1816
|
}), t.appendChild(i);
|
|
1817
1817
|
const s = document.createElement("div");
|
|
1818
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1818
|
+
return s.classList.add("svg-container"), s.innerHTML = Tt, t.appendChild(s), s.onclick = () => {
|
|
1819
1819
|
var n, o;
|
|
1820
1820
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1821
1821
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1826,7 +1826,7 @@ class de extends y {
|
|
|
1826
1826
|
);
|
|
1827
1827
|
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1828
1828
|
const l = this._options.findIndex(
|
|
1829
|
-
(
|
|
1829
|
+
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1830
1830
|
);
|
|
1831
1831
|
this.selectedOptionIndex = l !== -1 ? l : null;
|
|
1832
1832
|
} else
|
|
@@ -1845,7 +1845,7 @@ class de extends y {
|
|
|
1845
1845
|
);
|
|
1846
1846
|
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1847
1847
|
const l = this._options.findIndex(
|
|
1848
|
-
(
|
|
1848
|
+
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1849
1849
|
);
|
|
1850
1850
|
this.selectedOptionIndex = l !== -1 ? l : null;
|
|
1851
1851
|
} else
|
|
@@ -1862,7 +1862,7 @@ class de extends y {
|
|
|
1862
1862
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1863
1863
|
}
|
|
1864
1864
|
selectApiOption(t, e, i) {
|
|
1865
|
-
var l,
|
|
1865
|
+
var l, r, h, p;
|
|
1866
1866
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1867
1867
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1868
1868
|
const o = this._options[e].value;
|
|
@@ -1871,10 +1871,10 @@ class de extends y {
|
|
|
1871
1871
|
if (a)
|
|
1872
1872
|
a.textContent = this._options[e].name;
|
|
1873
1873
|
else {
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1874
|
+
const d = i.firstChild;
|
|
1875
|
+
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1876
1876
|
}
|
|
1877
|
-
this.isOpen = !1, (
|
|
1877
|
+
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);
|
|
1878
1878
|
}
|
|
1879
1879
|
updateOptionsList() {
|
|
1880
1880
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1907,7 +1907,7 @@ class de extends y {
|
|
|
1907
1907
|
), this.updateButtonText();
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
|
-
class
|
|
1910
|
+
class de extends E {
|
|
1911
1911
|
constructor(t) {
|
|
1912
1912
|
var e, i;
|
|
1913
1913
|
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;
|
|
@@ -1930,16 +1930,16 @@ class pe extends y {
|
|
|
1930
1930
|
i.className = "toggle-switch";
|
|
1931
1931
|
const s = document.createElement("input");
|
|
1932
1932
|
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
1933
|
-
var
|
|
1934
|
-
const l = ((h = (
|
|
1933
|
+
var r, h;
|
|
1934
|
+
const l = ((h = (r = this.props.options) == null ? void 0 : r.find((p) => p.status === s.checked)) == null ? void 0 : h.value) ?? "";
|
|
1935
1935
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1936
1936
|
});
|
|
1937
1937
|
const n = document.createElement("span");
|
|
1938
1938
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1939
|
-
const l = document.createElement("style"),
|
|
1939
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", h = this.props.inactiveColor || "#ccc";
|
|
1940
1940
|
l.textContent = `
|
|
1941
1941
|
.toggle-switch input:checked + .toggle-slider {
|
|
1942
|
-
background-color: ${
|
|
1942
|
+
background-color: ${r};
|
|
1943
1943
|
}
|
|
1944
1944
|
.toggle-switch .toggle-slider {
|
|
1945
1945
|
background-color: ${h};
|
|
@@ -1960,7 +1960,7 @@ class pe extends y {
|
|
|
1960
1960
|
const $t = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
1961
|
<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"/>
|
|
1962
1962
|
</svg>`;
|
|
1963
|
-
class ue extends
|
|
1963
|
+
class ue extends E {
|
|
1964
1964
|
// Store mobile value
|
|
1965
1965
|
constructor(t = {}) {
|
|
1966
1966
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? $t, 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);
|
|
@@ -1991,10 +1991,10 @@ class ue extends y {
|
|
|
1991
1991
|
let a = parseFloat(o.value);
|
|
1992
1992
|
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
1993
1993
|
}), s.addEventListener("blur", (n) => {
|
|
1994
|
-
var l,
|
|
1994
|
+
var l, r;
|
|
1995
1995
|
const o = n.target;
|
|
1996
1996
|
let a = parseFloat(o.value);
|
|
1997
|
-
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (
|
|
1997
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (r = (l = this.props).onBlur) == null || r.call(l);
|
|
1998
1998
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
1999
1999
|
const n = document.createElement("span");
|
|
2000
2000
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2047,9 +2047,9 @@ class me extends I {
|
|
|
2047
2047
|
}), this.inputType = "number";
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
class fe extends
|
|
2050
|
+
class fe extends E {
|
|
2051
2051
|
constructor(t) {
|
|
2052
|
-
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(
|
|
2052
|
+
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(E.DefaultLanguage) ? E.DefaultLanguage : t.languages[0];
|
|
2053
2053
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2054
2054
|
t.languages.forEach((i) => {
|
|
2055
2055
|
var s, n;
|
|
@@ -2080,10 +2080,10 @@ class fe extends y {
|
|
|
2080
2080
|
return;
|
|
2081
2081
|
}
|
|
2082
2082
|
const h = "...";
|
|
2083
|
-
let
|
|
2084
|
-
for (;
|
|
2085
|
-
const m = Math.floor((
|
|
2086
|
-
this.measureTextWidth(f, i) <= l ? (g = m,
|
|
2083
|
+
let p = 0, d = e.length, g = 0;
|
|
2084
|
+
for (; p <= d; ) {
|
|
2085
|
+
const m = Math.floor((p + d) / 2), f = e.slice(0, m).trimEnd() + h;
|
|
2086
|
+
this.measureTextWidth(f, i) <= l ? (g = m, p = m + 1) : d = m - 1;
|
|
2087
2087
|
}
|
|
2088
2088
|
const u = e.slice(0, g).trimEnd() + h;
|
|
2089
2089
|
t.placeholder = u;
|
|
@@ -2119,11 +2119,11 @@ class fe extends y {
|
|
|
2119
2119
|
"data-test-id",
|
|
2120
2120
|
`${this.getDataPropsPath()}_${t}`
|
|
2121
2121
|
), n.addEventListener("input", (l) => {
|
|
2122
|
-
const
|
|
2123
|
-
this.updateLanguageValue(t,
|
|
2122
|
+
const r = l.target;
|
|
2123
|
+
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2124
2124
|
const h = n.getAttribute("data-full-placeholder") || "";
|
|
2125
2125
|
h && this.adaptPlaceholderToSingleLine(n, h);
|
|
2126
|
-
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (
|
|
2126
|
+
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2127
2127
|
this.autosizeTextarea(n, 3);
|
|
2128
2128
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
2129
2129
|
l && this.adaptPlaceholderToSingleLine(n, l);
|
|
@@ -2194,7 +2194,7 @@ class fe extends y {
|
|
|
2194
2194
|
});
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
2197
|
-
class ve extends
|
|
2197
|
+
class ve extends E {
|
|
2198
2198
|
constructor(t = {}) {
|
|
2199
2199
|
super(t), this.inputType = "select";
|
|
2200
2200
|
const e = [
|
|
@@ -2221,70 +2221,70 @@ class ve extends y {
|
|
|
2221
2221
|
this.selectSetting.destroy(), super.destroy();
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
const Dt = (
|
|
2224
|
+
const Dt = (c, t) => {
|
|
2225
2225
|
let e = !1, i = 0, s = 0, n = 0, o = 0;
|
|
2226
2226
|
const a = (h) => {
|
|
2227
2227
|
if (h.target.closest("button")) return;
|
|
2228
2228
|
e = !0, i = h.clientX, s = h.clientY;
|
|
2229
|
-
const
|
|
2230
|
-
n =
|
|
2229
|
+
const p = t.getBoundingClientRect();
|
|
2230
|
+
n = p.left, o = p.top, document.addEventListener("mousemove", l), document.addEventListener("mouseup", r), document.body.style.userSelect = "none";
|
|
2231
2231
|
}, l = (h) => {
|
|
2232
2232
|
if (!e) return;
|
|
2233
|
-
const
|
|
2234
|
-
let
|
|
2235
|
-
|
|
2236
|
-
},
|
|
2237
|
-
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup",
|
|
2233
|
+
const p = h.clientX - i, d = h.clientY - s, g = window.innerWidth, u = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2234
|
+
let b = n + p, L = o + d;
|
|
2235
|
+
b = Math.max(8, Math.min(g - m - 8, b)), L = Math.max(8, Math.min(u - f - 8, L)), t.style.left = `${b}px`, t.style.top = `${L}px`;
|
|
2236
|
+
}, r = () => {
|
|
2237
|
+
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2238
2238
|
};
|
|
2239
|
-
|
|
2240
|
-
}, R = (
|
|
2241
|
-
if (!
|
|
2242
|
-
let t =
|
|
2239
|
+
c.addEventListener("mousedown", a);
|
|
2240
|
+
}, R = (c) => {
|
|
2241
|
+
if (!c) return null;
|
|
2242
|
+
let t = c.trim();
|
|
2243
2243
|
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()}`;
|
|
2244
|
-
}, D = (
|
|
2245
|
-
const t =
|
|
2244
|
+
}, D = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (c) => {
|
|
2245
|
+
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2246
2246
|
return {
|
|
2247
2247
|
r: parseInt(e.slice(0, 2), 16),
|
|
2248
2248
|
g: parseInt(e.slice(2, 4), 16),
|
|
2249
2249
|
b: parseInt(e.slice(4, 6), 16)
|
|
2250
2250
|
};
|
|
2251
|
-
}, $ = (
|
|
2252
|
-
const { r: t, g: e, b: i } = S(
|
|
2251
|
+
}, $ = (c) => {
|
|
2252
|
+
const { r: t, g: e, b: i } = S(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;
|
|
2253
2253
|
let h = 0;
|
|
2254
|
-
|
|
2255
|
-
const
|
|
2256
|
-
return { h: h * 60, s:
|
|
2257
|
-
}, W = (
|
|
2258
|
-
const i = e * t, s = i * (1 - Math.abs(
|
|
2254
|
+
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4);
|
|
2255
|
+
const p = a === 0 ? 0 : r / a, d = a;
|
|
2256
|
+
return { h: h * 60, s: p, v: d };
|
|
2257
|
+
}, W = (c, t, e) => {
|
|
2258
|
+
const i = e * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i;
|
|
2259
2259
|
let o = 0, a = 0, l = 0;
|
|
2260
|
-
return
|
|
2260
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), D(
|
|
2261
2261
|
Math.round((o + n) * 255),
|
|
2262
2262
|
Math.round((a + n) * 255),
|
|
2263
2263
|
Math.round((l + n) * 255)
|
|
2264
2264
|
);
|
|
2265
|
-
}, Rt = (
|
|
2265
|
+
}, Rt = (c, t, e) => {
|
|
2266
2266
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2267
|
-
return { hue:
|
|
2268
|
-
}, J = (
|
|
2269
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2267
|
+
return { hue: c, sat: s, lightness: i };
|
|
2268
|
+
}, J = (c, t, e) => {
|
|
2269
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2270
2270
|
let o = 0, a = 0, l = 0;
|
|
2271
|
-
return
|
|
2271
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2272
2272
|
r: Math.round((o + n) * 255),
|
|
2273
2273
|
g: Math.round((a + n) * 255),
|
|
2274
2274
|
b: Math.round((l + n) * 255)
|
|
2275
2275
|
};
|
|
2276
|
-
}, ct = (
|
|
2276
|
+
}, ct = (c, t) => {
|
|
2277
2277
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2278
|
-
if (
|
|
2279
|
-
const { r: s, g: n, b: o } = S(
|
|
2278
|
+
if (c.startsWith("#")) {
|
|
2279
|
+
const { r: s, g: n, b: o } = S(c);
|
|
2280
2280
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2281
2281
|
}
|
|
2282
|
-
if (
|
|
2283
|
-
return
|
|
2284
|
-
if (
|
|
2285
|
-
return
|
|
2286
|
-
if (
|
|
2287
|
-
const s =
|
|
2282
|
+
if (c.startsWith("rgba("))
|
|
2283
|
+
return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2284
|
+
if (c.startsWith("rgb("))
|
|
2285
|
+
return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2286
|
+
if (c.startsWith("hsl(")) {
|
|
2287
|
+
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2288
2288
|
if (s) {
|
|
2289
2289
|
const { r: n, g: o, b: a } = J(
|
|
2290
2290
|
parseInt(s[1]),
|
|
@@ -2294,8 +2294,8 @@ const Dt = (r, t) => {
|
|
|
2294
2294
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2295
2295
|
}
|
|
2296
2296
|
}
|
|
2297
|
-
if (
|
|
2298
|
-
const s =
|
|
2297
|
+
if (c.startsWith("hsla(")) {
|
|
2298
|
+
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2299
2299
|
if (s) {
|
|
2300
2300
|
const { r: n, g: o, b: a } = J(
|
|
2301
2301
|
parseInt(s[1]),
|
|
@@ -2305,13 +2305,13 @@ const Dt = (r, t) => {
|
|
|
2305
2305
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2306
2306
|
}
|
|
2307
2307
|
}
|
|
2308
|
-
const i = R(
|
|
2308
|
+
const i = R(c);
|
|
2309
2309
|
if (i) {
|
|
2310
2310
|
const { r: s, g: n, b: o } = S(i);
|
|
2311
2311
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2312
2312
|
}
|
|
2313
|
-
return
|
|
2314
|
-
}, Ft = (
|
|
2313
|
+
return c;
|
|
2314
|
+
}, Ft = (c) => [
|
|
2315
2315
|
"red",
|
|
2316
2316
|
"green",
|
|
2317
2317
|
"blue",
|
|
@@ -2335,24 +2335,24 @@ const Dt = (r, t) => {
|
|
|
2335
2335
|
"teal",
|
|
2336
2336
|
"fuchsia",
|
|
2337
2337
|
"transparent"
|
|
2338
|
-
].includes(
|
|
2338
|
+
].includes(c.toLowerCase()), ht = (c) => [
|
|
2339
2339
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2340
2340
|
/^rgba?\s*\([^)]+\)$/,
|
|
2341
2341
|
/^hsla?\s*\([^)]+\)$/,
|
|
2342
2342
|
/^[a-zA-Z]+$/
|
|
2343
|
-
].some((e) => e.test(
|
|
2343
|
+
].some((e) => e.test(c.trim())), Gt = (c) => {
|
|
2344
2344
|
if (typeof document > "u")
|
|
2345
|
-
return ht(
|
|
2345
|
+
return ht(c) || !!R(c);
|
|
2346
2346
|
const t = document.createElement("div");
|
|
2347
|
-
return t.style.color =
|
|
2348
|
-
},
|
|
2349
|
-
const t =
|
|
2347
|
+
return t.style.color = c, t.style.color !== "";
|
|
2348
|
+
}, pt = (c) => {
|
|
2349
|
+
const t = c.trim();
|
|
2350
2350
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2351
|
-
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16),
|
|
2351
|
+
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2352
2352
|
return {
|
|
2353
2353
|
color: D(o, a, l),
|
|
2354
2354
|
position: 0,
|
|
2355
|
-
opacity: Math.round(
|
|
2355
|
+
opacity: Math.round(r / 255 * 100)
|
|
2356
2356
|
};
|
|
2357
2357
|
}
|
|
2358
2358
|
const e = t.match(
|
|
@@ -2427,7 +2427,7 @@ const Dt = (r, t) => {
|
|
|
2427
2427
|
};
|
|
2428
2428
|
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2429
2429
|
let N = z;
|
|
2430
|
-
const Wt = (
|
|
2430
|
+
const Wt = (c, t) => {
|
|
2431
2431
|
const e = document.createElement("div");
|
|
2432
2432
|
e.className = "color-picker-recent-section";
|
|
2433
2433
|
const i = document.createElement("div");
|
|
@@ -2444,12 +2444,12 @@ const Wt = (r, t) => {
|
|
|
2444
2444
|
return;
|
|
2445
2445
|
}
|
|
2446
2446
|
s.style.display = "grid", n.style.display = "none", a.forEach((l) => {
|
|
2447
|
-
const
|
|
2448
|
-
|
|
2447
|
+
const r = document.createElement("button");
|
|
2448
|
+
r.type = "button", r.className = "color-picker-recent-swatch", r.title = l, r.setAttribute("aria-label", `Use color ${l}`), r.style.background = l, r.style.borderColor = l, r.addEventListener("click", () => c(l)), s.appendChild(r);
|
|
2449
2449
|
});
|
|
2450
2450
|
};
|
|
2451
2451
|
return o(), { container: e, refresh: o };
|
|
2452
|
-
},
|
|
2452
|
+
}, dt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2453
2453
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2454
2454
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2455
2455
|
fill="#919EAB"/>
|
|
@@ -2459,10 +2459,10 @@ const Wt = (r, t) => {
|
|
|
2459
2459
|
fill="#353C47"/>
|
|
2460
2460
|
</svg>`, qt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2461
2461
|
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2462
|
-
</svg>`,
|
|
2462
|
+
</svg>`, jt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2463
2463
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2464
2464
|
</svg>`;
|
|
2465
|
-
class
|
|
2465
|
+
class Ut {
|
|
2466
2466
|
constructor(t, e = "gradient") {
|
|
2467
2467
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2468
2468
|
if (!this.isOpen) return;
|
|
@@ -2492,7 +2492,7 @@ class jt {
|
|
|
2492
2492
|
const i = document.createElement("span");
|
|
2493
2493
|
i.textContent = "Color";
|
|
2494
2494
|
const s = document.createElement("button");
|
|
2495
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2495
|
+
s.className = "color-picker-close", s.innerHTML = dt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), Dt(e, t);
|
|
2496
2496
|
const n = document.createElement("div");
|
|
2497
2497
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2498
2498
|
const o = document.createElement("div");
|
|
@@ -2501,17 +2501,17 @@ class jt {
|
|
|
2501
2501
|
a.className = "color-picker-hue-container";
|
|
2502
2502
|
const l = document.createElement("button");
|
|
2503
2503
|
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = zt;
|
|
2504
|
-
const
|
|
2505
|
-
|
|
2504
|
+
const r = document.createElement("div");
|
|
2505
|
+
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2506
2506
|
const h = document.createElement("div");
|
|
2507
|
-
h.className = "color-picker-hue-marker", this.hueMarker = h,
|
|
2508
|
-
const d = document.createElement("div");
|
|
2509
|
-
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2507
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, r.appendChild(h), a.appendChild(l), a.appendChild(r);
|
|
2510
2508
|
const p = document.createElement("div");
|
|
2511
|
-
p.className = "color-picker-opacity
|
|
2512
|
-
const
|
|
2509
|
+
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
2510
|
+
const d = document.createElement("div");
|
|
2511
|
+
d.className = "color-picker-opacity-marker", this.opacityMarker = d, p.appendChild(d);
|
|
2512
|
+
const g = Wt((T) => {
|
|
2513
2513
|
var F, G;
|
|
2514
|
-
this.setColor(
|
|
2514
|
+
this.setColor(T), (F = this.onChange) == null || F.call(this, T, this.currentOpacity), N.addColor(T, this.recentScope), (G = this.recentSectionRefresh) == null || G.call(this);
|
|
2515
2515
|
}, this.recentScope);
|
|
2516
2516
|
this.recentSectionRefresh = g.refresh;
|
|
2517
2517
|
const u = document.createElement("div");
|
|
@@ -2520,16 +2520,16 @@ class jt {
|
|
|
2520
2520
|
m.className = "color-picker-format-select", this.select = m;
|
|
2521
2521
|
const f = document.createElement("option");
|
|
2522
2522
|
f.value = "hex", f.textContent = "HEX";
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2523
|
+
const b = document.createElement("option");
|
|
2524
|
+
b.value = "rgb", b.textContent = "RGB";
|
|
2525
2525
|
const L = document.createElement("option");
|
|
2526
|
-
L.value = "hsl", L.textContent = "HSL", m.appendChild(f), m.appendChild(
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2526
|
+
L.value = "hsl", L.textContent = "HSL", m.appendChild(f), m.appendChild(b), m.appendChild(L);
|
|
2527
|
+
const C = document.createElement("input");
|
|
2528
|
+
C.type = "text", C.className = "color-picker-color-input", C.value = this.currentColor, this.input = C;
|
|
2529
2529
|
const O = document.createElement("div");
|
|
2530
2530
|
O.className = "color-picker-input-container";
|
|
2531
2531
|
const k = document.createElement("button");
|
|
2532
|
-
return k.className = "color-picker-copy-inside", k.textContent = "Copy", O.appendChild(
|
|
2532
|
+
return k.className = "color-picker-copy-inside", k.textContent = "Copy", O.appendChild(C), O.appendChild(k), u.appendChild(m), u.appendChild(O), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", (T) => T.stopPropagation()), this.bind(n, r, p, C, m, k, l), t;
|
|
2533
2533
|
}
|
|
2534
2534
|
createBackdrop() {
|
|
2535
2535
|
const t = document.createElement("div");
|
|
@@ -2538,45 +2538,45 @@ class jt {
|
|
|
2538
2538
|
}), t;
|
|
2539
2539
|
}
|
|
2540
2540
|
bind(t, e, i, s, n, o, a) {
|
|
2541
|
-
const l = (
|
|
2542
|
-
const
|
|
2541
|
+
const l = (p) => {
|
|
2542
|
+
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), u = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
2543
2543
|
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
2544
|
-
const f = parseFloat(this.hueMarker.style.left || "0%") / 100 * 360,
|
|
2545
|
-
this.setColor(
|
|
2546
|
-
},
|
|
2547
|
-
const
|
|
2548
|
-
let g = Math.max(1e-3, Math.min(0.999, (
|
|
2544
|
+
const f = parseFloat(this.hueMarker.style.left || "0%") / 100 * 360, b = W(f, g, 1 - u);
|
|
2545
|
+
this.setColor(b);
|
|
2546
|
+
}, r = (p) => {
|
|
2547
|
+
const d = e.getBoundingClientRect();
|
|
2548
|
+
let g = Math.max(1e-3, Math.min(0.999, (p.clientX - d.left) / d.width));
|
|
2549
2549
|
this.hueMarker.style.left = `${g * 100}%`;
|
|
2550
|
-
const u = g * 360, m = parseFloat(this.colorMarker.style.left || "0%") / 100, f = parseFloat(this.colorMarker.style.top || "0%") / 100,
|
|
2551
|
-
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.setColor(
|
|
2552
|
-
}, h = (
|
|
2550
|
+
const u = g * 360, m = parseFloat(this.colorMarker.style.left || "0%") / 100, f = parseFloat(this.colorMarker.style.top || "0%") / 100, b = W(u, m, 1 - f);
|
|
2551
|
+
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.setColor(b);
|
|
2552
|
+
}, h = (p) => {
|
|
2553
2553
|
var u;
|
|
2554
|
-
const
|
|
2554
|
+
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2555
2555
|
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (u = this.onChange) == null || u.call(this, this.currentColor, this.currentOpacity);
|
|
2556
2556
|
};
|
|
2557
|
-
t.addEventListener("mousedown", (
|
|
2558
|
-
|
|
2559
|
-
const
|
|
2557
|
+
t.addEventListener("mousedown", (p) => {
|
|
2558
|
+
p.preventDefault(), l(p);
|
|
2559
|
+
const d = (u) => l(u), g = () => {
|
|
2560
2560
|
var u;
|
|
2561
|
-
document.removeEventListener("mousemove",
|
|
2561
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2562
2562
|
};
|
|
2563
|
-
document.addEventListener("mousemove",
|
|
2564
|
-
}), e.addEventListener("mousedown", (
|
|
2565
|
-
|
|
2566
|
-
const
|
|
2563
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2564
|
+
}), e.addEventListener("mousedown", (p) => {
|
|
2565
|
+
p.preventDefault(), r(p);
|
|
2566
|
+
const d = (u) => r(u), g = () => {
|
|
2567
2567
|
var u;
|
|
2568
|
-
document.removeEventListener("mousemove",
|
|
2568
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2569
2569
|
};
|
|
2570
|
-
document.addEventListener("mousemove",
|
|
2571
|
-
}), i.addEventListener("mousedown", (
|
|
2572
|
-
|
|
2573
|
-
const
|
|
2570
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2571
|
+
}), i.addEventListener("mousedown", (p) => {
|
|
2572
|
+
p.preventDefault(), h(p);
|
|
2573
|
+
const d = (u) => h(u), g = () => {
|
|
2574
2574
|
var u;
|
|
2575
|
-
document.removeEventListener("mousemove",
|
|
2575
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2576
2576
|
};
|
|
2577
|
-
document.addEventListener("mousemove",
|
|
2578
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2579
|
-
|
|
2577
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2578
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
|
|
2579
|
+
p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
|
|
2580
2580
|
}), o.addEventListener("click", async () => {
|
|
2581
2581
|
try {
|
|
2582
2582
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -2584,14 +2584,14 @@ class jt {
|
|
|
2584
2584
|
s.select(), document.execCommand("copy");
|
|
2585
2585
|
}
|
|
2586
2586
|
}), a.addEventListener("click", async () => {
|
|
2587
|
-
var
|
|
2587
|
+
var p, d;
|
|
2588
2588
|
if (!("EyeDropper" in window)) {
|
|
2589
2589
|
alert("EyeDropper API is not supported in this browser.");
|
|
2590
2590
|
return;
|
|
2591
2591
|
}
|
|
2592
2592
|
try {
|
|
2593
2593
|
const g = new window.EyeDropper(), { sRGBHex: u } = await g.open();
|
|
2594
|
-
this.setColor(u), (
|
|
2594
|
+
this.setColor(u), (p = this.onChange) == null || p.call(this, u, this.currentOpacity), N.addColor(u, this.recentScope), (d = this.recentSectionRefresh) == null || d.call(this);
|
|
2595
2595
|
} catch {
|
|
2596
2596
|
}
|
|
2597
2597
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2630,8 +2630,8 @@ class jt {
|
|
|
2630
2630
|
} else {
|
|
2631
2631
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2632
2632
|
if (s) {
|
|
2633
|
-
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a),
|
|
2634
|
-
e = W(n,
|
|
2633
|
+
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
2634
|
+
e = W(n, r, l);
|
|
2635
2635
|
}
|
|
2636
2636
|
}
|
|
2637
2637
|
}
|
|
@@ -2645,14 +2645,16 @@ class jt {
|
|
|
2645
2645
|
);
|
|
2646
2646
|
}
|
|
2647
2647
|
open(t, e, i) {
|
|
2648
|
-
var
|
|
2648
|
+
var C;
|
|
2649
2649
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2650
2650
|
const { h: s, s: n, v: o } = $(t);
|
|
2651
|
-
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}%`, (
|
|
2652
|
-
const a = e.getBoundingClientRect(),
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2651
|
+
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}%`, (C = this.recentSectionRefresh) == null || C.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);
|
|
2652
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2653
|
+
let g = r.right + 8, u = r.top;
|
|
2654
|
+
const m = h - r.right, f = r.left;
|
|
2655
|
+
m >= a + d ? g = r.right + 8 : f >= a + d ? g = r.left - a - 8 : g = Math.max(d, (h - a) / 2);
|
|
2656
|
+
const b = p - r.bottom, L = r.top;
|
|
2657
|
+
b >= l + d ? u = r.bottom + 8 : L >= l + d ? u = r.top - l - 8 : b > L ? (u = r.bottom + 8, u + l > p - d && (u = p - l - d)) : (u = r.top - l - 8, u < d && (u = d)), this.element.style.left = `${g}px`, this.element.style.top = `${u}px`;
|
|
2656
2658
|
}
|
|
2657
2659
|
close(t) {
|
|
2658
2660
|
var e;
|
|
@@ -2715,10 +2717,10 @@ class _t {
|
|
|
2715
2717
|
".color-picker-format-select"
|
|
2716
2718
|
), l = this.container.querySelector(
|
|
2717
2719
|
".color-picker-color-input"
|
|
2718
|
-
),
|
|
2720
|
+
), r = this.container.querySelector(
|
|
2719
2721
|
".color-picker-copy-inside"
|
|
2720
|
-
), { h, s:
|
|
2721
|
-
s.style.left = `${h / 360 * 100}%`, e.style.left = `${
|
|
2722
|
+
), { h, s: p, v: d } = $(this.currentColor);
|
|
2723
|
+
s.style.left = `${h / 360 * 100}%`, e.style.left = `${p * 100}%`, e.style.top = `${(1 - d) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`, o.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(n), this.updateColorInput(a, l), this.setupColorAreaEvents(t, e, s), this.setupHueSliderEvents(
|
|
2722
2724
|
i,
|
|
2723
2725
|
s,
|
|
2724
2726
|
t,
|
|
@@ -2726,7 +2728,7 @@ class _t {
|
|
|
2726
2728
|
a,
|
|
2727
2729
|
l,
|
|
2728
2730
|
n
|
|
2729
|
-
), this.setupOpacitySliderEvents(n, o), this.setupFormatEvents(a, l,
|
|
2731
|
+
), this.setupOpacitySliderEvents(n, o), this.setupFormatEvents(a, l, r);
|
|
2730
2732
|
}
|
|
2731
2733
|
updateOpacityBackground(t) {
|
|
2732
2734
|
const e = S(this.currentColor);
|
|
@@ -2745,9 +2747,9 @@ class _t {
|
|
|
2745
2747
|
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2746
2748
|
break;
|
|
2747
2749
|
case "hsl":
|
|
2748
|
-
const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2),
|
|
2750
|
+
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);
|
|
2749
2751
|
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2750
|
-
|
|
2752
|
+
r * 100
|
|
2751
2753
|
)}%, ${Math.round(l * 100)}%)`;
|
|
2752
2754
|
break;
|
|
2753
2755
|
}
|
|
@@ -2756,16 +2758,16 @@ class _t {
|
|
|
2756
2758
|
const s = (n) => {
|
|
2757
2759
|
const o = t.getBoundingClientRect(), a = Math.max(0, Math.min(1, (n.clientX - o.left) / o.width)), l = Math.max(0, Math.min(1, (n.clientY - o.top) / o.height));
|
|
2758
2760
|
e.style.left = `${a * 100}%`, e.style.top = `${l * 100}%`;
|
|
2759
|
-
const
|
|
2761
|
+
const r = parseFloat(i.style.left || "0%") / 100 * 360, h = W(r, a, 1 - l);
|
|
2760
2762
|
this.currentColor = h;
|
|
2761
|
-
const
|
|
2763
|
+
const p = this.container.querySelector(
|
|
2762
2764
|
".color-picker-format-select"
|
|
2763
|
-
),
|
|
2765
|
+
), d = this.container.querySelector(
|
|
2764
2766
|
".color-picker-color-input"
|
|
2765
2767
|
), g = this.container.querySelector(
|
|
2766
2768
|
".color-picker-opacity"
|
|
2767
2769
|
);
|
|
2768
|
-
this.updateColorInput(
|
|
2770
|
+
this.updateColorInput(p, d), this.updateOpacityBackground(g), this.triggerChange();
|
|
2769
2771
|
};
|
|
2770
2772
|
t.addEventListener("mousedown", (n) => {
|
|
2771
2773
|
n.preventDefault(), s(n);
|
|
@@ -2776,21 +2778,21 @@ class _t {
|
|
|
2776
2778
|
});
|
|
2777
2779
|
}
|
|
2778
2780
|
setupHueSliderEvents(t, e, i, s, n, o, a) {
|
|
2779
|
-
const l = (
|
|
2781
|
+
const l = (r) => {
|
|
2780
2782
|
const h = t.getBoundingClientRect();
|
|
2781
|
-
let
|
|
2782
|
-
|
|
2783
|
-
const
|
|
2784
|
-
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${
|
|
2785
|
-
const m = W(
|
|
2783
|
+
let p = (r.clientX - h.left) / h.width;
|
|
2784
|
+
p = Math.max(1e-3, Math.min(0.999, p)), e.style.left = `${p * 100}%`;
|
|
2785
|
+
const d = p * 360, g = parseFloat(s.style.left || "50%") / 100, u = parseFloat(s.style.top || "50%") / 100;
|
|
2786
|
+
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2787
|
+
const m = W(d, g, 1 - u);
|
|
2786
2788
|
this.currentColor = m, this.updateColorInput(n, o), this.updateOpacityBackground(a), this.triggerChange();
|
|
2787
2789
|
};
|
|
2788
|
-
t.addEventListener("mousedown", (
|
|
2789
|
-
|
|
2790
|
-
const h = (
|
|
2791
|
-
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup",
|
|
2790
|
+
t.addEventListener("mousedown", (r) => {
|
|
2791
|
+
r.preventDefault(), l(r);
|
|
2792
|
+
const h = (d) => l(d), p = () => {
|
|
2793
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", p);
|
|
2792
2794
|
};
|
|
2793
|
-
document.addEventListener("mousemove", h), document.addEventListener("mouseup",
|
|
2795
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", p);
|
|
2794
2796
|
});
|
|
2795
2797
|
}
|
|
2796
2798
|
setupOpacitySliderEvents(t, e) {
|
|
@@ -2909,17 +2911,17 @@ class _t {
|
|
|
2909
2911
|
".color-picker-opacity"
|
|
2910
2912
|
), l = this.container.querySelector(
|
|
2911
2913
|
".color-picker-format-select"
|
|
2912
|
-
),
|
|
2914
|
+
), r = this.container.querySelector(
|
|
2913
2915
|
".color-picker-color-input"
|
|
2914
|
-
), { h, s:
|
|
2915
|
-
n.style.left = `${h / 360 * 100}%`, s.style.left = `${
|
|
2916
|
+
), { h, s: p, v: d } = $(t);
|
|
2917
|
+
n.style.left = `${h / 360 * 100}%`, s.style.left = `${p * 100}%`, s.style.top = `${(1 - d) * 100}%`, i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`, o.style.left = `${e}%`, this.updateOpacityBackground(a), this.updateColorInput(l, r);
|
|
2916
2918
|
}
|
|
2917
2919
|
}
|
|
2918
|
-
const nt = (
|
|
2920
|
+
const nt = (c) => {
|
|
2919
2921
|
const t = [];
|
|
2920
2922
|
let e = "", i = 0;
|
|
2921
|
-
for (let s = 0; s <
|
|
2922
|
-
const n =
|
|
2923
|
+
for (let s = 0; s < c.length; s++) {
|
|
2924
|
+
const n = c[s];
|
|
2923
2925
|
if (n === "(") i++;
|
|
2924
2926
|
else if (n === ")") i--;
|
|
2925
2927
|
else if (n === "," && i === 0) {
|
|
@@ -2929,16 +2931,16 @@ const nt = (r) => {
|
|
|
2929
2931
|
e += n;
|
|
2930
2932
|
}
|
|
2931
2933
|
return e.trim() && t.push(e.trim()), t;
|
|
2932
|
-
}, ot = (
|
|
2933
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2934
|
+
}, ot = (c, t) => {
|
|
2935
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2934
2936
|
if (!i) return null;
|
|
2935
2937
|
const s = i.index + i[0].length;
|
|
2936
2938
|
let n = 1, o = s;
|
|
2937
|
-
for (let a = s; a <
|
|
2938
|
-
|
|
2939
|
-
return n === 0 ?
|
|
2940
|
-
}, Jt = (
|
|
2941
|
-
const t =
|
|
2939
|
+
for (let a = s; a < c.length && n > 0; a++)
|
|
2940
|
+
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2941
|
+
return n === 0 ? c.substring(s, o) : null;
|
|
2942
|
+
}, Jt = (c) => {
|
|
2943
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2942
2944
|
return [
|
|
2943
2945
|
"circle",
|
|
2944
2946
|
"ellipse",
|
|
@@ -2949,33 +2951,33 @@ const nt = (r) => {
|
|
|
2949
2951
|
"at",
|
|
2950
2952
|
"contain",
|
|
2951
2953
|
"cover"
|
|
2952
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2953
|
-
}, at = (
|
|
2954
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Ft(t);
|
|
2955
|
+
}, at = (c) => {
|
|
2954
2956
|
const t = [];
|
|
2955
|
-
return
|
|
2957
|
+
return c.forEach((e, i) => {
|
|
2956
2958
|
const s = e.trim();
|
|
2957
2959
|
if (!s) return;
|
|
2958
2960
|
let n = "", o = 0;
|
|
2959
2961
|
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2960
|
-
a && ht(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o =
|
|
2961
|
-
const l =
|
|
2962
|
+
a && ht(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2963
|
+
const l = pt(n);
|
|
2962
2964
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2963
2965
|
}), t;
|
|
2964
|
-
}, A = (
|
|
2965
|
-
const t =
|
|
2966
|
+
}, A = (c) => {
|
|
2967
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2966
2968
|
return {
|
|
2967
|
-
type:
|
|
2968
|
-
angle: typeof
|
|
2969
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2970
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2969
2971
|
stops: t.map((e, i) => ({
|
|
2970
2972
|
color: e.color || "#000000",
|
|
2971
2973
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2972
2974
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2973
2975
|
}))
|
|
2974
2976
|
};
|
|
2975
|
-
}, Y = (
|
|
2976
|
-
const t =
|
|
2977
|
+
}, Y = (c) => {
|
|
2978
|
+
const t = c.replace(/;$/, "").trim();
|
|
2977
2979
|
if (Gt(t)) {
|
|
2978
|
-
const s =
|
|
2980
|
+
const s = pt(t);
|
|
2979
2981
|
return A({ type: "solid", angle: 0, stops: [s] });
|
|
2980
2982
|
}
|
|
2981
2983
|
const e = ot(t, "linear-gradient");
|
|
@@ -2984,8 +2986,8 @@ const nt = (r) => {
|
|
|
2984
2986
|
let n = 90, o = s;
|
|
2985
2987
|
const a = s[0];
|
|
2986
2988
|
if (a.includes("deg")) {
|
|
2987
|
-
const
|
|
2988
|
-
|
|
2989
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2990
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2989
2991
|
} else a.includes("to ") && (n = {
|
|
2990
2992
|
"to right": 90,
|
|
2991
2993
|
"to left": 270,
|
|
@@ -3005,23 +3007,23 @@ const nt = (r) => {
|
|
|
3005
3007
|
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
3006
3008
|
}
|
|
3007
3009
|
return null;
|
|
3008
|
-
}, H = (
|
|
3009
|
-
if (
|
|
3010
|
-
const e =
|
|
3010
|
+
}, H = (c) => {
|
|
3011
|
+
if (c.type === "solid") {
|
|
3012
|
+
const e = c.stops[0], i = e.opacity ?? 100, s = e.color.replace("#", ""), n = Math.round(i / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3011
3013
|
return `#${s}${n}`;
|
|
3012
3014
|
}
|
|
3013
|
-
const t =
|
|
3015
|
+
const t = c.stops.map(
|
|
3014
3016
|
(e) => `${ct(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
3015
3017
|
).join(", ");
|
|
3016
|
-
return
|
|
3017
|
-
}, K = (
|
|
3018
|
-
if (
|
|
3019
|
-
const t =
|
|
3018
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
3019
|
+
}, K = (c) => {
|
|
3020
|
+
if (c.type === "solid") {
|
|
3021
|
+
const t = c.stops[0];
|
|
3020
3022
|
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
3021
3023
|
}
|
|
3022
|
-
return
|
|
3024
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
3023
3025
|
};
|
|
3024
|
-
class Ce extends
|
|
3026
|
+
class Ce extends E {
|
|
3025
3027
|
constructor(t = {}) {
|
|
3026
3028
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3027
3029
|
super({
|
|
@@ -3033,12 +3035,12 @@ class Ce extends y {
|
|
|
3033
3035
|
angle: "number",
|
|
3034
3036
|
stops: "text"
|
|
3035
3037
|
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.onBackgroundClick = (i) => {
|
|
3036
|
-
var
|
|
3038
|
+
var p;
|
|
3037
3039
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3038
|
-
const s = i.target, n = this.popoverEl.contains(s), o = (
|
|
3040
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((d) => d.contains(s)), r = s.closest(
|
|
3039
3041
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3040
3042
|
), h = s.classList.contains("color-picker-backdrop");
|
|
3041
|
-
!n && !o && !l && !
|
|
3043
|
+
!n && !o && !l && !r && !h && this.closePopover();
|
|
3042
3044
|
}, this.detectChange = t.detectChange, this.forText = t.forText || !1, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3043
3045
|
}
|
|
3044
3046
|
defaultValue() {
|
|
@@ -3110,7 +3112,7 @@ class Ce extends y {
|
|
|
3110
3112
|
const e = document.createElement("span");
|
|
3111
3113
|
e.textContent = "Fill";
|
|
3112
3114
|
const i = document.createElement("button");
|
|
3113
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3115
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = dt, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
3114
3116
|
const s = document.createElement("div");
|
|
3115
3117
|
s.className = "gradient-editor";
|
|
3116
3118
|
const n = this.createTypeTabs();
|
|
@@ -3144,7 +3146,7 @@ class Ce extends y {
|
|
|
3144
3146
|
t === "solid" ? n == null || n.classList.add("active") : o == null || o.classList.add("active");
|
|
3145
3147
|
}
|
|
3146
3148
|
const e = (i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-editor-content");
|
|
3147
|
-
e && this.updatePopoverContent(e), this.updateUI(), this.triggerChange();
|
|
3149
|
+
e && (this.updatePopoverContent(e), this.repositionPopover()), this.updateUI(), this.triggerChange();
|
|
3148
3150
|
}
|
|
3149
3151
|
updatePopoverContent(t) {
|
|
3150
3152
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.renderSolid(t) : this.renderGradient(t));
|
|
@@ -3179,30 +3181,30 @@ class Ce extends y {
|
|
|
3179
3181
|
m.value = m.value.replace(/[^0-9-]/g, ""), setTimeout(() => m.select(), 0);
|
|
3180
3182
|
}), o.addEventListener("input", (u) => {
|
|
3181
3183
|
const m = parseInt(u.target.value);
|
|
3182
|
-
!Number.isNaN(m) && this.value && (this.value.angle = Math.max(0, Math.min(360, m)), this.updateGradientPreview(), this.
|
|
3184
|
+
!Number.isNaN(m) && this.value && (this.value.angle = Math.max(0, Math.min(360, m)), this.updateGradientPreview(), this.triggerChange());
|
|
3183
3185
|
}), o.addEventListener("blur", (u) => {
|
|
3184
|
-
var
|
|
3186
|
+
var b;
|
|
3185
3187
|
const m = u.target;
|
|
3186
3188
|
let f = parseInt(m.value);
|
|
3187
|
-
Number.isNaN(f) && (f = ((
|
|
3189
|
+
Number.isNaN(f) && (f = ((b = this.value) == null ? void 0 : b.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), m.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3188
3190
|
}), a.addEventListener("click", () => {
|
|
3189
3191
|
!this.value || !this.value.stops || (this.value.stops.forEach((u) => {
|
|
3190
3192
|
u.position = 100 - u.position;
|
|
3191
|
-
}), this.value.stops.sort((u, m) => u.position - m.position), this.updateGradientPreview(l), this.createHandles(
|
|
3193
|
+
}), this.value.stops.sort((u, m) => u.position - m.position), this.updateGradientPreview(l), this.createHandles(r, l), this.updateStopsList(g), this.updateUI(), this.triggerChange());
|
|
3192
3194
|
}), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.updateDegreeVisibility(o);
|
|
3193
3195
|
const l = document.createElement("div");
|
|
3194
3196
|
l.className = "gradient-preview", this.updateGradientPreview(l);
|
|
3195
|
-
const
|
|
3196
|
-
|
|
3197
|
+
const r = document.createElement("div");
|
|
3198
|
+
r.className = "gradient-handles", l.appendChild(r), t.appendChild(l), this.createHandles(r, l);
|
|
3197
3199
|
const h = document.createElement("div");
|
|
3198
3200
|
h.className = "gradient-stops-header";
|
|
3199
|
-
const
|
|
3200
|
-
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3201
|
+
const p = document.createElement("span");
|
|
3202
|
+
p.textContent = "Stops";
|
|
3203
|
+
const d = document.createElement("button");
|
|
3204
|
+
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3203
3205
|
const g = document.createElement("div");
|
|
3204
|
-
g.className = "gradient-stops", t.appendChild(h), t.appendChild(g), this.updateStopsList(g),
|
|
3205
|
-
this.addStop(), this.updateStopsList(g), this.updateGradientPreview(l), this.createHandles(
|
|
3206
|
+
g.className = "gradient-stops", t.appendChild(h), t.appendChild(g), this.updateStopsList(g), d.addEventListener("click", () => {
|
|
3207
|
+
this.addStop(), this.updateStopsList(g), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), this.repositionPopover(), this.triggerChange();
|
|
3206
3208
|
});
|
|
3207
3209
|
}
|
|
3208
3210
|
updateDegreeVisibility(t) {
|
|
@@ -3220,16 +3222,16 @@ class Ce extends y {
|
|
|
3220
3222
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3221
3223
|
const o = document.createElement("div");
|
|
3222
3224
|
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o);
|
|
3223
|
-
let a = !1, l = 0,
|
|
3225
|
+
let a = !1, l = 0, r = 0;
|
|
3224
3226
|
const h = (g) => {
|
|
3225
|
-
a = !0, l = g.clientX,
|
|
3226
|
-
},
|
|
3227
|
+
a = !0, l = g.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", p), document.addEventListener("mouseup", d), g.preventDefault(), g.stopPropagation();
|
|
3228
|
+
}, p = (g) => {
|
|
3227
3229
|
if (!a || !this.value) return;
|
|
3228
3230
|
const u = e.getBoundingClientRect(), m = g.clientX - l;
|
|
3229
|
-
let f =
|
|
3231
|
+
let f = r + m / u.width * 100;
|
|
3230
3232
|
f = Math.max(0, Math.min(100, f)), this.value.stops[s].position = Math.round(f), n.style.left = `${f}%`, this.updateGradientPreview(), this.updateUI();
|
|
3231
|
-
},
|
|
3232
|
-
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
3233
|
+
}, d = () => {
|
|
3234
|
+
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((g, u) => g.position - u.position), this.createHandles(t, e)), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3233
3235
|
};
|
|
3234
3236
|
n.addEventListener("mousedown", h), t.appendChild(n);
|
|
3235
3237
|
});
|
|
@@ -3246,61 +3248,61 @@ class Ce extends y {
|
|
|
3246
3248
|
i.forEach((n, o) => {
|
|
3247
3249
|
var F, G;
|
|
3248
3250
|
const a = this.value.stops.findIndex(
|
|
3249
|
-
(v,
|
|
3250
|
-
(
|
|
3251
|
+
(v, y) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, y).filter(
|
|
3252
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3251
3253
|
).length === i.slice(0, o).filter(
|
|
3252
|
-
(
|
|
3254
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3253
3255
|
).length
|
|
3254
|
-
), l = a !== -1 ? a : o,
|
|
3255
|
-
|
|
3256
|
+
), l = a !== -1 ? a : o, r = document.createElement("div");
|
|
3257
|
+
r.className = "gstop-row";
|
|
3256
3258
|
const h = document.createElement("div");
|
|
3257
3259
|
h.className = "gstop-position-group";
|
|
3258
|
-
const
|
|
3259
|
-
|
|
3260
|
-
const
|
|
3261
|
-
|
|
3260
|
+
const p = document.createElement("input");
|
|
3261
|
+
p.type = "text", p.className = "gstop-position-input", p.value = `${n.position}%`, p.style.width = "60px", h.appendChild(p);
|
|
3262
|
+
const d = document.createElement("div");
|
|
3263
|
+
d.className = "gstop-color-container";
|
|
3262
3264
|
const g = document.createElement("div");
|
|
3263
3265
|
g.className = "gstop-color-preview", g.style.backgroundColor = n.color;
|
|
3264
3266
|
const u = document.createElement("input");
|
|
3265
3267
|
u.type = "text", u.className = "gstop-color-input", u.value = n.color.replace("#", "").toUpperCase();
|
|
3266
3268
|
const m = document.createElement("button");
|
|
3267
|
-
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy",
|
|
3269
|
+
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(g), d.appendChild(u), d.appendChild(m);
|
|
3268
3270
|
const f = document.createElement("button");
|
|
3269
|
-
f.type = "button", f.className = "gstop-del", f.innerHTML =
|
|
3270
|
-
const
|
|
3271
|
-
|
|
3271
|
+
f.type = "button", f.className = "gstop-del", f.innerHTML = jt, f.disabled = (((G = (F = this.value) == null ? void 0 : F.stops) == null ? void 0 : G.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
|
|
3272
|
+
const b = document.createElement("span");
|
|
3273
|
+
b.className = "gstop-opacity-label", b.textContent = "Opacity";
|
|
3272
3274
|
const L = document.createElement("div");
|
|
3273
3275
|
L.className = "gstop-opacity-group";
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3276
|
+
const C = document.createElement("input");
|
|
3277
|
+
C.type = "range", C.className = "gstop-opacity-slider", C.min = "0", C.max = "100", C.value = String(n.opacity ?? 100);
|
|
3276
3278
|
const O = S(n.color);
|
|
3277
|
-
|
|
3279
|
+
C.style.setProperty(
|
|
3278
3280
|
"--slider-color",
|
|
3279
3281
|
`rgb(${O.r}, ${O.g}, ${O.b})`
|
|
3280
3282
|
);
|
|
3281
3283
|
const k = document.createElement("span");
|
|
3282
|
-
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, L.appendChild(
|
|
3283
|
-
const
|
|
3284
|
-
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v,
|
|
3285
|
-
const
|
|
3286
|
-
|
|
3284
|
+
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, L.appendChild(C), L.appendChild(k);
|
|
3285
|
+
const T = new Ut((v, y) => {
|
|
3286
|
+
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v, y !== void 0 && (this.value.stops[l].opacity = y, C.value = String(y), k.textContent = `${y}%`);
|
|
3287
|
+
const w = S(v);
|
|
3288
|
+
C.style.setProperty(
|
|
3287
3289
|
"--slider-color",
|
|
3288
|
-
`rgb(${
|
|
3290
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3289
3291
|
), this.updateGradientPreview(), this.createHandles(
|
|
3290
3292
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3291
3293
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3292
3294
|
), this.updateUI(), this.triggerChange();
|
|
3293
3295
|
}, "gradient");
|
|
3294
3296
|
u.addEventListener("click", (v) => {
|
|
3295
|
-
v.preventDefault(), v.stopPropagation(),
|
|
3297
|
+
v.preventDefault(), v.stopPropagation(), T.open(n.color, u, n.opacity ?? 100);
|
|
3296
3298
|
}), u.addEventListener("input", () => {
|
|
3297
|
-
const v = u.value.trim(),
|
|
3298
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3299
|
-
this.value.stops[l].color =
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3299
|
+
const v = u.value.trim(), y = v.startsWith("#") ? v : `#${v}`;
|
|
3300
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(y)) {
|
|
3301
|
+
this.value.stops[l].color = y, g.style.backgroundColor = y;
|
|
3302
|
+
const w = S(y);
|
|
3303
|
+
C.style.setProperty(
|
|
3302
3304
|
"--slider-color",
|
|
3303
|
-
`rgb(${
|
|
3305
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3304
3306
|
), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3305
3307
|
}
|
|
3306
3308
|
}), m.addEventListener("click", async (v) => {
|
|
@@ -3309,28 +3311,28 @@ class Ce extends y {
|
|
|
3309
3311
|
await navigator.clipboard.writeText(`#${u.value}`);
|
|
3310
3312
|
} catch {
|
|
3311
3313
|
}
|
|
3312
|
-
}),
|
|
3313
|
-
const
|
|
3314
|
-
|
|
3315
|
-
}),
|
|
3316
|
-
const
|
|
3317
|
-
if (!Number.isNaN(
|
|
3318
|
-
const et = Math.max(0, Math.min(100,
|
|
3319
|
-
this.value.stops[l].position = et,
|
|
3314
|
+
}), p.addEventListener("focus", (v) => {
|
|
3315
|
+
const y = v.target;
|
|
3316
|
+
y.value = y.value.replace("%", ""), y.select();
|
|
3317
|
+
}), p.addEventListener("input", (v) => {
|
|
3318
|
+
const y = v.target, w = parseInt(y.value.replace(/[^\d]/g, ""), 10);
|
|
3319
|
+
if (!Number.isNaN(w)) {
|
|
3320
|
+
const et = Math.max(0, Math.min(100, w));
|
|
3321
|
+
this.value.stops[l].position = et, y.value = `${et}%`, this.updateGradientPreview(), this.createHandles(
|
|
3320
3322
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3321
3323
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3322
3324
|
), this.updateUI(), this.triggerChange();
|
|
3323
3325
|
}
|
|
3324
|
-
}),
|
|
3325
|
-
const
|
|
3326
|
-
Number.isNaN(
|
|
3326
|
+
}), p.addEventListener("blur", (v) => {
|
|
3327
|
+
const y = v.target, w = parseInt(y.value.replace(/[^\d]/g, ""), 10);
|
|
3328
|
+
Number.isNaN(w) ? y.value = `${this.value.stops[l].position}%` : y.value = `${Math.max(0, Math.min(100, w))}%`;
|
|
3327
3329
|
}), f.addEventListener("click", () => {
|
|
3328
3330
|
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(l, 1), this.createHandles(
|
|
3329
3331
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3330
3332
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3331
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3332
|
-
}),
|
|
3333
|
-
const v = parseInt(
|
|
3333
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.repositionPopover(), this.triggerChange());
|
|
3334
|
+
}), C.addEventListener("input", () => {
|
|
3335
|
+
const v = parseInt(C.value, 10);
|
|
3334
3336
|
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3335
3337
|
});
|
|
3336
3338
|
});
|
|
@@ -3356,10 +3358,13 @@ class Ce extends y {
|
|
|
3356
3358
|
if (!(!this.popoverEl || this.isPopoverOpen)) {
|
|
3357
3359
|
if (this.isPopoverOpen = !0, this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3358
3360
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3359
|
-
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000";
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3361
|
+
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3362
|
+
const o = this.popoverEl.offsetHeight;
|
|
3363
|
+
let a = t.right + 8, l = t.top;
|
|
3364
|
+
const r = i - t.right, h = t.left, p = e + n;
|
|
3365
|
+
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3366
|
+
const d = s - t.bottom, g = t.top;
|
|
3367
|
+
d >= o + n ? l = t.bottom + 8 : g >= o + n ? l = t.top - o - 8 : d > g ? (l = t.bottom + 8, l + o > s - n && (l = s - o - n)) : (l = t.top - o - 8, l < n && (l = n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`;
|
|
3363
3368
|
}
|
|
3364
3369
|
setTimeout(
|
|
3365
3370
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3367,6 +3372,19 @@ class Ce extends y {
|
|
|
3367
3372
|
);
|
|
3368
3373
|
}
|
|
3369
3374
|
}
|
|
3375
|
+
repositionPopover() {
|
|
3376
|
+
!this.popoverEl || !this.isPopoverOpen || !this.element || requestAnimationFrame(() => {
|
|
3377
|
+
if (!this.popoverEl || !this.element) return;
|
|
3378
|
+
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3379
|
+
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3380
|
+
const o = this.popoverEl.offsetHeight;
|
|
3381
|
+
let a = t.right + 8, l = t.top;
|
|
3382
|
+
const r = i - t.right, h = t.left, p = e + n;
|
|
3383
|
+
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3384
|
+
const d = s - t.bottom, g = t.top;
|
|
3385
|
+
d >= o + n ? l = t.bottom + 8 : g >= o + n ? l = t.top - o - 8 : d > g ? (l = t.bottom + 8, l + o > s - n && (l = s - o - n)) : (l = t.top - o - 8, l < n && (l = n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`;
|
|
3386
|
+
});
|
|
3387
|
+
}
|
|
3370
3388
|
refreshPopoverContent() {
|
|
3371
3389
|
var n;
|
|
3372
3390
|
if (!this.popoverEl) return;
|
|
@@ -3432,7 +3450,7 @@ class ye extends V {
|
|
|
3432
3450
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3433
3451
|
suffix: "px"
|
|
3434
3452
|
}),
|
|
3435
|
-
color: new
|
|
3453
|
+
color: new P({
|
|
3436
3454
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3437
3455
|
}),
|
|
3438
3456
|
radius: new I({
|
|
@@ -3477,7 +3495,7 @@ class Ee extends V {
|
|
|
3477
3495
|
collapsed: i.collapsed,
|
|
3478
3496
|
settings: (() => {
|
|
3479
3497
|
const s = {
|
|
3480
|
-
color: new
|
|
3498
|
+
color: new P({
|
|
3481
3499
|
default: i.colorDefault ?? "0, 0, 30"
|
|
3482
3500
|
}),
|
|
3483
3501
|
fontFamily: new tt({
|
|
@@ -3535,7 +3553,7 @@ class Ee extends V {
|
|
|
3535
3553
|
`;
|
|
3536
3554
|
}
|
|
3537
3555
|
}
|
|
3538
|
-
class
|
|
3556
|
+
class j extends E {
|
|
3539
3557
|
constructor(t) {
|
|
3540
3558
|
super({
|
|
3541
3559
|
...t,
|
|
@@ -3545,9 +3563,9 @@ class U extends y {
|
|
|
3545
3563
|
draw() {
|
|
3546
3564
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
3547
3565
|
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
3548
|
-
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER,
|
|
3566
|
+
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3549
3567
|
let h = Number(a.value);
|
|
3550
|
-
h < l && (h = l), h >
|
|
3568
|
+
h < l && (h = l), h > r && (h = r), a.value = String(h);
|
|
3551
3569
|
}));
|
|
3552
3570
|
}, i = this.createInput({
|
|
3553
3571
|
value: this.value,
|
|
@@ -3574,8 +3592,8 @@ class U extends y {
|
|
|
3574
3592
|
if (l.toLowerCase() === "auto")
|
|
3575
3593
|
this.value = "auto";
|
|
3576
3594
|
else {
|
|
3577
|
-
const
|
|
3578
|
-
isNaN(
|
|
3595
|
+
const r = Number(l);
|
|
3596
|
+
isNaN(r) || (this.value = r);
|
|
3579
3597
|
}
|
|
3580
3598
|
this.onChange && this.onChange(this.value);
|
|
3581
3599
|
}), i;
|
|
@@ -3587,25 +3605,25 @@ class be extends V {
|
|
|
3587
3605
|
title: "Margins",
|
|
3588
3606
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3589
3607
|
settings: {
|
|
3590
|
-
marginTop: new
|
|
3608
|
+
marginTop: new j({
|
|
3591
3609
|
title: "Top",
|
|
3592
3610
|
icon: te,
|
|
3593
3611
|
suffix: "px",
|
|
3594
3612
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3595
3613
|
}),
|
|
3596
|
-
marginRight: new
|
|
3614
|
+
marginRight: new j({
|
|
3597
3615
|
title: "Right",
|
|
3598
3616
|
icon: ee,
|
|
3599
3617
|
suffix: "px",
|
|
3600
3618
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3601
3619
|
}),
|
|
3602
|
-
marginBottom: new
|
|
3620
|
+
marginBottom: new j({
|
|
3603
3621
|
title: "Bottom",
|
|
3604
3622
|
icon: ie,
|
|
3605
3623
|
suffix: "px",
|
|
3606
3624
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3607
3625
|
}),
|
|
3608
|
-
marginLeft: new
|
|
3626
|
+
marginLeft: new j({
|
|
3609
3627
|
title: "Left",
|
|
3610
3628
|
icon: se,
|
|
3611
3629
|
suffix: "px",
|
|
@@ -3646,7 +3664,7 @@ class we extends V {
|
|
|
3646
3664
|
opacity: new Lt({
|
|
3647
3665
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3648
3666
|
}),
|
|
3649
|
-
backgroundColor: new
|
|
3667
|
+
backgroundColor: new P({
|
|
3650
3668
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3651
3669
|
})
|
|
3652
3670
|
}
|
|
@@ -3679,7 +3697,7 @@ export {
|
|
|
3679
3697
|
ye as BorderSettingSet,
|
|
3680
3698
|
le as ButtonSetting,
|
|
3681
3699
|
M as ColorSetting,
|
|
3682
|
-
|
|
3700
|
+
P as ColorWithOpacitySetting,
|
|
3683
3701
|
re as DimensionSetting,
|
|
3684
3702
|
ue as GapSetting,
|
|
3685
3703
|
Ce as GradientSetting,
|
|
@@ -3692,14 +3710,14 @@ export {
|
|
|
3692
3710
|
fe as MultiLanguageSetting,
|
|
3693
3711
|
I as NumberSetting,
|
|
3694
3712
|
Lt as OpacitySetting,
|
|
3695
|
-
|
|
3713
|
+
pe as SelectApiSettings,
|
|
3696
3714
|
tt as SelectSetting,
|
|
3697
|
-
|
|
3715
|
+
E as Setting,
|
|
3698
3716
|
V as SettingGroup,
|
|
3699
3717
|
Et as StringSetting,
|
|
3700
3718
|
Ct as TabSettingGroup,
|
|
3701
3719
|
Ct as TabsSettingGroup,
|
|
3702
|
-
|
|
3720
|
+
de as Toggle,
|
|
3703
3721
|
rt as UploadSetting,
|
|
3704
3722
|
he as WidthSetting,
|
|
3705
3723
|
oe as asSettingGroupWithSettings,
|
|
@@ -3707,6 +3725,6 @@ export {
|
|
|
3707
3725
|
ne as createTabSettingGroup,
|
|
3708
3726
|
B as isSetting,
|
|
3709
3727
|
st as isSettingChild,
|
|
3710
|
-
|
|
3728
|
+
x as isSettingGroup,
|
|
3711
3729
|
q as iterateSettings
|
|
3712
3730
|
};
|