builder-settings-types 0.0.215 → 0.0.217
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +18 -18
- package/dist/builder-settings-types.es.js +225 -207
- package/dist/index.css +1 -1
- package/dist/index.d.ts +7 -0
- package/package.json +1 -1
|
@@ -67,23 +67,23 @@ class p {
|
|
|
67
67
|
t = { ...this.props.inputProps, ...t };
|
|
68
68
|
const e = document.createElement("div");
|
|
69
69
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
70
|
+
const a = document.createElement("div");
|
|
71
|
+
if (a.className = "icon-container", t.icon) {
|
|
72
72
|
const l = this.createIcon(t.icon, t.iconClassName);
|
|
73
|
-
|
|
73
|
+
a.appendChild(l);
|
|
74
74
|
}
|
|
75
75
|
if (t.title) {
|
|
76
76
|
const l = this.createLabel(t.title, t.labelClassName);
|
|
77
|
-
|
|
77
|
+
a.appendChild(l);
|
|
78
78
|
}
|
|
79
|
-
e.appendChild(
|
|
79
|
+
e.appendChild(a);
|
|
80
80
|
}
|
|
81
81
|
const i = document.createElement("div");
|
|
82
82
|
i.className = t.wrapperClassName || "";
|
|
83
83
|
const s = document.createElement("input");
|
|
84
84
|
this.inputEl = s, s.value = String(t.value || N(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "";
|
|
85
|
-
const n = (
|
|
86
|
-
const l =
|
|
85
|
+
const n = (a) => {
|
|
86
|
+
const l = a.target;
|
|
87
87
|
let h = l.value;
|
|
88
88
|
switch (t.inputType) {
|
|
89
89
|
case "number":
|
|
@@ -108,10 +108,10 @@ class p {
|
|
|
108
108
|
h = l.value;
|
|
109
109
|
}
|
|
110
110
|
this.value = h, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
111
|
-
},
|
|
112
|
-
|
|
111
|
+
}, o = (a) => {
|
|
112
|
+
a.target, this.onBlur && this.onBlur(this.value);
|
|
113
113
|
};
|
|
114
|
-
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur",
|
|
114
|
+
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur", o), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
115
115
|
}
|
|
116
116
|
createLabel(t, e) {
|
|
117
117
|
const i = document.createElement("span");
|
|
@@ -239,7 +239,7 @@ function w(c, t) {
|
|
|
239
239
|
const g = class g {
|
|
240
240
|
constructor(t) {
|
|
241
241
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
|
|
242
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id || M(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, this.parentNestingLevel = t.parentNestingLevel ?? 0, this.nestingLevel = this.parentNestingLevel, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel();
|
|
242
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.parentNestingLevel = 0, this.id = t.id || M(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, this.parentNestingLevel = t.parentNestingLevel ?? 0, this.nestingLevel = this.parentNestingLevel, this.includeGetJson = t.includeGetJson ?? !0, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel();
|
|
243
243
|
}
|
|
244
244
|
propagateNestingLevel() {
|
|
245
245
|
const t = this.nestingLevel + 1;
|
|
@@ -280,20 +280,20 @@ const g = class g {
|
|
|
280
280
|
return this.changeHandlers.clear(), w(this.settings, (i, s) => {
|
|
281
281
|
var n;
|
|
282
282
|
if (s instanceof g)
|
|
283
|
-
s.setOnChange((
|
|
284
|
-
const
|
|
285
|
-
this.initialValues =
|
|
283
|
+
s.setOnChange((o) => {
|
|
284
|
+
const a = this.getValues();
|
|
285
|
+
this.initialValues = a, t(a);
|
|
286
286
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
287
287
|
else if (s instanceof p) {
|
|
288
|
-
const
|
|
288
|
+
const o = () => {
|
|
289
289
|
e();
|
|
290
290
|
};
|
|
291
|
-
this.changeHandlers.add(
|
|
291
|
+
this.changeHandlers.add(o), s.setOnChange(o);
|
|
292
292
|
} else {
|
|
293
|
-
const
|
|
293
|
+
const o = () => {
|
|
294
294
|
e();
|
|
295
295
|
};
|
|
296
|
-
this.changeHandlers.add(
|
|
296
|
+
this.changeHandlers.add(o), (n = s.setOnChange) == null || n.call(s, o);
|
|
297
297
|
}
|
|
298
298
|
}), this;
|
|
299
299
|
}
|
|
@@ -379,10 +379,10 @@ const g = class g {
|
|
|
379
379
|
...Object.keys(t),
|
|
380
380
|
...Object.keys(e)
|
|
381
381
|
])).forEach((n) => {
|
|
382
|
-
const
|
|
383
|
-
JSON.stringify(
|
|
384
|
-
from:
|
|
385
|
-
to:
|
|
382
|
+
const o = t[n], a = e[n];
|
|
383
|
+
JSON.stringify(o) !== JSON.stringify(a) && (i[n] = {
|
|
384
|
+
from: o,
|
|
385
|
+
to: a
|
|
386
386
|
});
|
|
387
387
|
}), i;
|
|
388
388
|
}
|
|
@@ -408,6 +408,8 @@ const g = class g {
|
|
|
408
408
|
}
|
|
409
409
|
getValuesForJson(t) {
|
|
410
410
|
if (t === void 0) {
|
|
411
|
+
if (this.includeGetJson === !1)
|
|
412
|
+
return null;
|
|
411
413
|
const e = {};
|
|
412
414
|
for (const i in this.settings)
|
|
413
415
|
if (this.settings.hasOwnProperty(i)) {
|
|
@@ -417,7 +419,7 @@ const g = class g {
|
|
|
417
419
|
return e;
|
|
418
420
|
} else {
|
|
419
421
|
const e = this.settings[t];
|
|
420
|
-
return e ? e instanceof g ? e.getValuesForJson() : e.includeGetJson === !1 ? null : e.value : void 0;
|
|
422
|
+
return e ? e instanceof g ? e.includeGetJson === !1 ? null : e.getValuesForJson() : e.includeGetJson === !1 ? null : e.value : void 0;
|
|
421
423
|
}
|
|
422
424
|
}
|
|
423
425
|
getDefaultValues(t) {
|
|
@@ -502,23 +504,23 @@ const g = class g {
|
|
|
502
504
|
</svg>
|
|
503
505
|
`, r.title = this.description, n.appendChild(r);
|
|
504
506
|
}
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
+
const o = document.createElement("span");
|
|
508
|
+
o.className = "setting-group-arrow", o.innerHTML = `
|
|
507
509
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
508
510
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
509
511
|
</svg>
|
|
510
|
-
`, this.isCollapsed &&
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
512
|
+
`, this.isCollapsed && o.classList.add("rotated"), n.appendChild(o);
|
|
513
|
+
const a = document.createElement("div");
|
|
514
|
+
if (a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content"), this.description && !this.isCollapsed) {
|
|
513
515
|
const r = document.createElement("div");
|
|
514
|
-
r.className = "setting-group-description", r.textContent = this.description,
|
|
516
|
+
r.className = "setting-group-description", r.textContent = this.description, a.appendChild(r);
|
|
515
517
|
}
|
|
516
518
|
const l = () => {
|
|
517
|
-
this.isCollapsed = !this.isCollapsed,
|
|
519
|
+
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
518
520
|
"aria-expanded",
|
|
519
521
|
(!this.isCollapsed).toString()
|
|
520
522
|
);
|
|
521
|
-
const r =
|
|
523
|
+
const r = a.querySelector(
|
|
522
524
|
".setting-group-description"
|
|
523
525
|
), d = n.querySelector(".info-marker");
|
|
524
526
|
if (this.description)
|
|
@@ -530,14 +532,14 @@ const g = class g {
|
|
|
530
532
|
<path d="M8 5.33333V8M8 10.6667H8.00667M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
|
|
531
533
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
532
534
|
</svg>
|
|
533
|
-
`, u.title = this.description, n.insertBefore(u,
|
|
535
|
+
`, u.title = this.description, n.insertBefore(u, o);
|
|
534
536
|
}
|
|
535
537
|
} else {
|
|
536
538
|
if (!r) {
|
|
537
539
|
const u = document.createElement("div");
|
|
538
|
-
u.className = "setting-group-description", u.textContent = this.description,
|
|
540
|
+
u.className = "setting-group-description", u.textContent = this.description, a.insertBefore(
|
|
539
541
|
u,
|
|
540
|
-
|
|
542
|
+
a.firstChild
|
|
541
543
|
);
|
|
542
544
|
}
|
|
543
545
|
d && d.remove();
|
|
@@ -549,13 +551,13 @@ const g = class g {
|
|
|
549
551
|
for (const r in this.settings)
|
|
550
552
|
if (this.settings.hasOwnProperty(r)) {
|
|
551
553
|
const d = this.settings[r];
|
|
552
|
-
d instanceof g && d.setNestingLevel(this.nestingLevel + 1),
|
|
554
|
+
d instanceof g && d.setNestingLevel(this.nestingLevel + 1), a.appendChild(d.draw());
|
|
553
555
|
}
|
|
554
556
|
} else {
|
|
555
557
|
const r = document.createElement("div");
|
|
556
|
-
r.className = "setting-group-empty", r.textContent = "No settings in this group",
|
|
558
|
+
r.className = "setting-group-empty", r.textContent = "No settings in this group", a.appendChild(r);
|
|
557
559
|
}
|
|
558
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(
|
|
560
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, H.trackElement(t), setTimeout(() => {
|
|
559
561
|
this.updateNestingStyles();
|
|
560
562
|
}, 0), this.pendingBlurHandler && (this.setupBlurHandlers(), this.pendingBlurHandler = null), t;
|
|
561
563
|
}
|
|
@@ -592,10 +594,10 @@ const g = class g {
|
|
|
592
594
|
let i = e;
|
|
593
595
|
const s = Object.keys(this.settings), n = Object.keys(e);
|
|
594
596
|
if (!s.some(
|
|
595
|
-
(
|
|
597
|
+
(a) => n.includes(a)
|
|
596
598
|
) && n.length === 1) {
|
|
597
|
-
const
|
|
598
|
-
i = e[
|
|
599
|
+
const a = n[0];
|
|
600
|
+
i = e[a];
|
|
599
601
|
}
|
|
600
602
|
this.setValue(i);
|
|
601
603
|
} catch (e) {
|
|
@@ -639,17 +641,17 @@ class ct extends f {
|
|
|
639
641
|
s.textContent = this.title, i.appendChild(s);
|
|
640
642
|
const n = document.createElement("div");
|
|
641
643
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
642
|
-
const
|
|
643
|
-
if (
|
|
644
|
+
const o = document.createElement("div");
|
|
645
|
+
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
644
646
|
const h = document.createElement("button");
|
|
645
|
-
h.className = "tab-button", h.type = "button", h.setAttribute("data-tab-id",
|
|
647
|
+
h.className = "tab-button", h.type = "button", h.setAttribute("data-tab-id", a), h.textContent = a, h.addEventListener("click", () => this.switchToTab(a)), n.appendChild(h);
|
|
646
648
|
const r = document.createElement("div");
|
|
647
|
-
r.className = "tab-panel", this.contentContainers[
|
|
648
|
-
const d = this.settings[
|
|
649
|
-
d && (d instanceof f && d.setNestingLevel(this.getNestingLevel() + 1), r.appendChild(d.draw())),
|
|
650
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
651
|
-
const
|
|
652
|
-
this.activeTabId =
|
|
649
|
+
r.className = "tab-panel", this.contentContainers[a] = r;
|
|
650
|
+
const d = this.settings[a];
|
|
651
|
+
d && (d instanceof f && d.setNestingLevel(this.getNestingLevel() + 1), r.appendChild(d.draw())), o.appendChild(r), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
652
|
+
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
653
|
+
const a = Object.keys(this.settings)[0];
|
|
654
|
+
this.activeTabId = a || "";
|
|
653
655
|
}
|
|
654
656
|
return this.updateTabUI(), t;
|
|
655
657
|
}
|
|
@@ -660,7 +662,7 @@ function T(c) {
|
|
|
660
662
|
function dt(c) {
|
|
661
663
|
return c;
|
|
662
664
|
}
|
|
663
|
-
class
|
|
665
|
+
class B extends p {
|
|
664
666
|
constructor(t = {}) {
|
|
665
667
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
666
668
|
}
|
|
@@ -680,12 +682,12 @@ class A extends p {
|
|
|
680
682
|
});
|
|
681
683
|
}
|
|
682
684
|
}
|
|
683
|
-
const
|
|
684
|
-
class m extends
|
|
685
|
+
const A = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
686
|
+
class m extends B {
|
|
685
687
|
constructor(t) {
|
|
686
688
|
super({
|
|
687
689
|
...t,
|
|
688
|
-
icon: t.icon ||
|
|
690
|
+
icon: t.icon || A,
|
|
689
691
|
title: t.title || "Color",
|
|
690
692
|
default: t.default ? m.normalizeColorValue(t.default) : "#000000"
|
|
691
693
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
@@ -700,11 +702,11 @@ class m extends A {
|
|
|
700
702
|
const e = t.split(",").map((r) => parseInt(r.trim()));
|
|
701
703
|
if (e.length !== 3 || e.some(isNaN))
|
|
702
704
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
703
|
-
const [i, s, n] = e,
|
|
705
|
+
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)), h = (r) => {
|
|
704
706
|
const d = r.toString(16);
|
|
705
707
|
return d.length === 1 ? "0" + d : d;
|
|
706
708
|
};
|
|
707
|
-
return `#${h(
|
|
709
|
+
return `#${h(o)}${h(a)}${h(l)}`;
|
|
708
710
|
}
|
|
709
711
|
setValue(t) {
|
|
710
712
|
if (t === void 0) {
|
|
@@ -748,10 +750,10 @@ class m extends A {
|
|
|
748
750
|
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.colorInputEl = s;
|
|
749
751
|
const n = document.createElement("div");
|
|
750
752
|
n.className = "color-preview";
|
|
751
|
-
const
|
|
752
|
-
n.style.backgroundColor =
|
|
753
|
-
const
|
|
754
|
-
return
|
|
753
|
+
const o = this.value || "#000000";
|
|
754
|
+
n.style.backgroundColor = o;
|
|
755
|
+
const a = document.createElement("input");
|
|
756
|
+
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.textInputEl = a, this.textInputEl.addEventListener("input", (l) => {
|
|
755
757
|
var r, d;
|
|
756
758
|
let h = l.target.value.trim();
|
|
757
759
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
@@ -766,7 +768,7 @@ class m extends A {
|
|
|
766
768
|
var d, u;
|
|
767
769
|
const h = l.target.value, r = m.normalizeColorValue(h);
|
|
768
770
|
this.value = r, (d = this.onChange) == null || d.call(this, r), (u = this.detectChange) == null || u.call(this, r), this.textInputEl && (this.textInputEl.value = r), n.style.backgroundColor = r;
|
|
769
|
-
}), e.appendChild(s), e.appendChild(n), e.appendChild(
|
|
771
|
+
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
770
772
|
}
|
|
771
773
|
getElement() {
|
|
772
774
|
return this.element;
|
|
@@ -822,8 +824,8 @@ class C extends p {
|
|
|
822
824
|
}
|
|
823
825
|
updateColorPreview() {
|
|
824
826
|
if (!this.colorPreviewEl || !this.value) return;
|
|
825
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
826
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
827
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
828
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
827
829
|
}
|
|
828
830
|
handleColorChange(t) {
|
|
829
831
|
const e = this.getOpacityPercent(), i = C.combineColorOpacity(t, e);
|
|
@@ -840,41 +842,41 @@ class C extends p {
|
|
|
840
842
|
draw() {
|
|
841
843
|
const t = document.createElement("div");
|
|
842
844
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
|
|
845
|
+
const o = document.createElement("div");
|
|
846
|
+
if (o.className = "icon-container", this.props.icon) {
|
|
847
|
+
const a = document.createElement("span");
|
|
848
|
+
a.className = "input-icon", a.innerHTML = this.props.icon, o.appendChild(a);
|
|
847
849
|
}
|
|
848
850
|
if (this.props.title) {
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
+
const a = document.createElement("span");
|
|
852
|
+
a.className = "input-label", a.textContent = this.props.title, o.appendChild(a);
|
|
851
853
|
}
|
|
852
|
-
t.appendChild(
|
|
854
|
+
t.appendChild(o);
|
|
853
855
|
}
|
|
854
856
|
const e = document.createElement("div");
|
|
855
|
-
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (
|
|
856
|
-
const
|
|
857
|
-
this.handleColorChange(
|
|
858
|
-
}), this.textInputEl.addEventListener("input", (
|
|
859
|
-
const
|
|
860
|
-
this.handleTextInput(
|
|
861
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
862
|
-
const
|
|
863
|
-
|
|
857
|
+
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (o) => {
|
|
858
|
+
const a = o.target;
|
|
859
|
+
this.handleColorChange(a.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
860
|
+
}), this.textInputEl.addEventListener("input", (o) => {
|
|
861
|
+
const a = o.target;
|
|
862
|
+
this.handleTextInput(a.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : a.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
|
|
863
|
+
}), this.textInputEl.addEventListener("blur", (o) => {
|
|
864
|
+
const a = o.target;
|
|
865
|
+
a.value.trim() === "" && (a.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
864
866
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
865
|
-
var
|
|
866
|
-
(
|
|
867
|
+
var o;
|
|
868
|
+
(o = this.colorInputEl) == null || o.click();
|
|
867
869
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
868
870
|
const i = document.createElement("div");
|
|
869
871
|
i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100";
|
|
870
872
|
const s = document.createElement("span");
|
|
871
|
-
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
872
|
-
const
|
|
873
|
+
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
|
|
874
|
+
const a = o.target, l = parseFloat(a.value);
|
|
873
875
|
isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
874
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
875
|
-
const
|
|
876
|
-
let l = parseFloat(
|
|
877
|
-
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)),
|
|
876
|
+
}), this.opacityInputEl.addEventListener("blur", (o) => {
|
|
877
|
+
const a = o.target;
|
|
878
|
+
let l = parseFloat(a.value);
|
|
879
|
+
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), a.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
878
880
|
}), i.appendChild(this.opacityInputEl), i.appendChild(s);
|
|
879
881
|
const n = document.createElement("div");
|
|
880
882
|
return n.className = "color-with-opacity-controls-wrapper", n.appendChild(e), n.appendChild(i), t.appendChild(n), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
@@ -887,8 +889,8 @@ class C extends p {
|
|
|
887
889
|
}
|
|
888
890
|
getRgbaValue() {
|
|
889
891
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
890
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
891
|
-
return `rgba(${s}, ${n}, ${
|
|
892
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
893
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
892
894
|
}
|
|
893
895
|
getColorAndOpacity() {
|
|
894
896
|
return {
|
|
@@ -909,20 +911,20 @@ class ut extends p {
|
|
|
909
911
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
910
912
|
const n = document.createElement("div");
|
|
911
913
|
if (n.className = "icon-container", this.props.icon) {
|
|
912
|
-
const
|
|
913
|
-
n.appendChild(
|
|
914
|
+
const o = this.createIcon(this.props.icon);
|
|
915
|
+
n.appendChild(o);
|
|
914
916
|
}
|
|
915
917
|
if (this.props.title) {
|
|
916
|
-
const
|
|
917
|
-
n.appendChild(
|
|
918
|
+
const o = this.createLabel(this.props.title);
|
|
919
|
+
n.appendChild(o);
|
|
918
920
|
}
|
|
919
921
|
t.appendChild(n);
|
|
920
922
|
}
|
|
921
923
|
const e = document.createElement("textarea");
|
|
922
924
|
this.textareaEl = e, e.value = this.value || "", e.placeholder = this.props.placeholder || "Paste your HTML here...", e.className = "html-setting-textarea " + (this.props.textareaClassName || ""), e.rows = this.props.rows || 6, this.props.maxLength !== void 0 && (e.maxLength = this.props.maxLength), this.props.className && e.classList.add(this.props.className);
|
|
923
925
|
const i = (n) => {
|
|
924
|
-
const
|
|
925
|
-
this.value =
|
|
926
|
+
const a = n.target.value;
|
|
927
|
+
this.value = a, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
926
928
|
}, s = (n) => {
|
|
927
929
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
928
930
|
};
|
|
@@ -952,12 +954,12 @@ class v extends p {
|
|
|
952
954
|
const i = document.createElement("input");
|
|
953
955
|
if (i.type = "number", i.className = "number-setting-input " + (this.props.inputClassName || ""), i.value = String(this.value ?? ""), i.placeholder = this.props.placeholder || "", this.props.minValue !== void 0 && (i.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (i.max = String(this.props.maxValue)), this.props.step !== void 0 && (i.step = String(this.props.step)), i.addEventListener("input", () => {
|
|
954
956
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
955
|
-
let
|
|
956
|
-
|
|
957
|
+
let o = Number(i.value);
|
|
958
|
+
o < s && (o = s), o > n && (o = n), String(o) !== i.value && (i.value = String(o)), this.setValue(o);
|
|
957
959
|
}), i.addEventListener("blur", () => {
|
|
958
|
-
var n,
|
|
960
|
+
var n, o;
|
|
959
961
|
const s = this.validateValue(Number(i.value));
|
|
960
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
962
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (o = (n = this.props).onBlur) == null || o.call(n);
|
|
961
963
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
962
964
|
const s = document.createElement("span");
|
|
963
965
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1040,12 +1042,12 @@ class y extends p {
|
|
|
1040
1042
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1041
1043
|
const n = document.createElement("div");
|
|
1042
1044
|
if (n.className = "icon-container", this.props.icon) {
|
|
1043
|
-
const
|
|
1044
|
-
n.appendChild(
|
|
1045
|
+
const o = this.createIcon(this.props.icon);
|
|
1046
|
+
n.appendChild(o);
|
|
1045
1047
|
}
|
|
1046
1048
|
if (this.props.title) {
|
|
1047
|
-
const
|
|
1048
|
-
n.appendChild(
|
|
1049
|
+
const o = this.createLabel(this.props.title);
|
|
1050
|
+
n.appendChild(o);
|
|
1049
1051
|
}
|
|
1050
1052
|
t.appendChild(n);
|
|
1051
1053
|
} else {
|
|
@@ -1054,13 +1056,13 @@ class y extends p {
|
|
|
1054
1056
|
}
|
|
1055
1057
|
const e = document.createElement("div");
|
|
1056
1058
|
e.classList.add("select-button"), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
1057
|
-
var n,
|
|
1058
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1059
|
+
var n, o;
|
|
1060
|
+
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1059
1061
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1060
1062
|
const i = document.createElement("ul");
|
|
1061
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1063
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
1064
|
+
const a = this.createOption(n, o);
|
|
1065
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1064
1066
|
}), document.body.appendChild(i);
|
|
1065
1067
|
const s = document.createElement("div");
|
|
1066
1068
|
return s.classList.add("svg-container"), s.innerHTML = z, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1068,8 +1070,8 @@ class y extends p {
|
|
|
1068
1070
|
}).catch((n) => {
|
|
1069
1071
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1070
1072
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1071
|
-
var
|
|
1072
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1073
|
+
var o, a;
|
|
1074
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition());
|
|
1073
1075
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1074
1076
|
this.isOpen && this.checkDropdownPosition();
|
|
1075
1077
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1091,9 +1093,9 @@ class y extends p {
|
|
|
1091
1093
|
}
|
|
1092
1094
|
}
|
|
1093
1095
|
selectOption(t, e, i) {
|
|
1094
|
-
var n,
|
|
1096
|
+
var n, o, a;
|
|
1095
1097
|
const s = this._options[e];
|
|
1096
|
-
s && (this.value = s.value, (n = this.onChange) == null || n.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (
|
|
1098
|
+
s && (this.value = s.value, (n = this.onChange) == null || n.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((h, r) => {
|
|
1097
1099
|
r === e ? h.classList.add("selected") : h.classList.remove("selected");
|
|
1098
1100
|
}));
|
|
1099
1101
|
}
|
|
@@ -1177,25 +1179,41 @@ class G extends p {
|
|
|
1177
1179
|
`
|
|
1178
1180
|
}
|
|
1179
1181
|
].forEach((n) => {
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
var
|
|
1183
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1184
|
-
}), i.appendChild(
|
|
1182
|
+
const o = document.createElement("button");
|
|
1183
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
1184
|
+
var a;
|
|
1185
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = n.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
1186
|
+
}), i.appendChild(o);
|
|
1185
1187
|
}), t.appendChild(i), t;
|
|
1186
1188
|
}
|
|
1187
1189
|
}
|
|
1188
1190
|
class pt extends p {
|
|
1189
1191
|
constructor(t) {
|
|
1190
|
-
super(t), this.inputType = "button";
|
|
1192
|
+
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1191
1193
|
}
|
|
1192
1194
|
draw() {
|
|
1193
1195
|
const t = document.createElement("button");
|
|
1194
|
-
t.className = "button-setting " + (this.props.className || ""), t.textContent = this.props.label, t.
|
|
1195
|
-
|
|
1196
|
+
t.className = "button-setting " + (this.props.className || ""), t.textContent = this.props.label, t.style.borderColor = this.props.borderColor || "rgba(145, 158, 171, 0.32)";
|
|
1197
|
+
const e = this.props.backgroundColor || "rgba(0,0,0,0)", i = this.props.textColor || "black";
|
|
1198
|
+
t.style.backgroundColor = e, t.style.color = i;
|
|
1199
|
+
let s = e;
|
|
1200
|
+
const n = e.match(
|
|
1201
|
+
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1202
|
+
);
|
|
1203
|
+
if (n) {
|
|
1204
|
+
let a = +n[1], l = +n[2], h = +n[3], r = +n[4];
|
|
1205
|
+
r >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), h = Math.round(h * 0.9)) : r = Math.min(1, r + 0.12), s = `rgba(${a},${l},${h},${r})`;
|
|
1206
|
+
}
|
|
1207
|
+
t.addEventListener("mouseenter", () => {
|
|
1208
|
+
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1209
|
+
}), t.addEventListener("mouseleave", () => {
|
|
1210
|
+
t.style.setProperty("background-color", e, "important");
|
|
1211
|
+
}), t.addEventListener("click", () => {
|
|
1212
|
+
var a, l;
|
|
1213
|
+
return (l = (a = this.props).onClick) == null ? void 0 : l.call(a);
|
|
1196
1214
|
});
|
|
1197
|
-
const
|
|
1198
|
-
return
|
|
1215
|
+
const o = document.createElement("div");
|
|
1216
|
+
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1199
1217
|
}
|
|
1200
1218
|
}
|
|
1201
1219
|
class gt extends p {
|
|
@@ -1211,14 +1229,14 @@ class gt extends p {
|
|
|
1211
1229
|
suffix: "px",
|
|
1212
1230
|
minValue: this.minWidth,
|
|
1213
1231
|
maxValue: this.maxWidth,
|
|
1214
|
-
icon:
|
|
1232
|
+
icon: W
|
|
1215
1233
|
}), this.heightSetting = new v({
|
|
1216
1234
|
title: "Height",
|
|
1217
1235
|
default: this.value.height,
|
|
1218
1236
|
suffix: "px",
|
|
1219
1237
|
minValue: this.minHeight,
|
|
1220
1238
|
maxValue: this.maxHeight,
|
|
1221
|
-
icon:
|
|
1239
|
+
icon: j
|
|
1222
1240
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1223
1241
|
}
|
|
1224
1242
|
handleWidthChange(t) {
|
|
@@ -1288,8 +1306,8 @@ class gt extends p {
|
|
|
1288
1306
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1289
1307
|
"aria-label",
|
|
1290
1308
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1291
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1292
|
-
|
|
1309
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
1310
|
+
o.preventDefault(), this.toggleLock(n);
|
|
1293
1311
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1294
1312
|
}
|
|
1295
1313
|
isLocked() {
|
|
@@ -1312,9 +1330,9 @@ class gt extends p {
|
|
|
1312
1330
|
}
|
|
1313
1331
|
}
|
|
1314
1332
|
}
|
|
1315
|
-
const
|
|
1333
|
+
const W = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1316
1334
|
<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="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1317
|
-
</svg>`,
|
|
1335
|
+
</svg>`, j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1318
1336
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1319
1337
|
</svg>`, b = `
|
|
1320
1338
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
@@ -1403,11 +1421,11 @@ class U extends p {
|
|
|
1403
1421
|
<span class="upload-label">Replace</span>
|
|
1404
1422
|
`);
|
|
1405
1423
|
const n = () => {
|
|
1406
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1407
|
-
},
|
|
1408
|
-
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1424
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1425
|
+
}, o = () => {
|
|
1426
|
+
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1409
1427
|
};
|
|
1410
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1428
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1411
1429
|
} else
|
|
1412
1430
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1413
1431
|
<span class="upload-icon">${b}</span>
|
|
@@ -1418,24 +1436,24 @@ class U extends p {
|
|
|
1418
1436
|
const t = document.createElement("div");
|
|
1419
1437
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1420
1438
|
"focusout",
|
|
1421
|
-
(
|
|
1439
|
+
(a) => {
|
|
1422
1440
|
var l;
|
|
1423
|
-
|
|
1441
|
+
a.relatedTarget && t.contains(a.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1424
1442
|
},
|
|
1425
1443
|
!0
|
|
1426
1444
|
);
|
|
1427
1445
|
const e = !!(this.props.title || this.props.icon);
|
|
1428
1446
|
if (e || t.classList.add("no-label"), e) {
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1447
|
+
const a = document.createElement("div");
|
|
1448
|
+
if (a.className = "icon-title-container", this.props.icon) {
|
|
1431
1449
|
const l = this.createIcon(this.props.icon);
|
|
1432
|
-
|
|
1450
|
+
a.appendChild(l);
|
|
1433
1451
|
}
|
|
1434
1452
|
if (this.props.title) {
|
|
1435
1453
|
const l = this.createLabel(this.props.title);
|
|
1436
|
-
|
|
1454
|
+
a.appendChild(l);
|
|
1437
1455
|
}
|
|
1438
|
-
t.appendChild(
|
|
1456
|
+
t.appendChild(a);
|
|
1439
1457
|
}
|
|
1440
1458
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1441
1459
|
const i = document.createElement("div");
|
|
@@ -1444,18 +1462,18 @@ class U extends p {
|
|
|
1444
1462
|
s || i.classList.add("no-image");
|
|
1445
1463
|
const n = document.createElement("div");
|
|
1446
1464
|
if (n.className = "preview-placeholder", n.innerHTML = P, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = _, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1465
|
+
const a = document.createElement("button");
|
|
1466
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = D, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1449
1467
|
var h;
|
|
1450
1468
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (h = this.onChange) == null || h.call(this, ""), this.hideError();
|
|
1451
1469
|
};
|
|
1452
1470
|
}
|
|
1453
1471
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1454
|
-
const
|
|
1455
|
-
return
|
|
1472
|
+
const o = document.createElement("button");
|
|
1473
|
+
return o.className = "upload-button", o.innerHTML = `
|
|
1456
1474
|
<span class="upload-icon">${b}</span>
|
|
1457
1475
|
<span class="upload-label">Upload</span>
|
|
1458
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1476
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1459
1477
|
window.postMessage(
|
|
1460
1478
|
{
|
|
1461
1479
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1539,44 +1557,44 @@ class vt extends p {
|
|
|
1539
1557
|
e.classList.add("has-label");
|
|
1540
1558
|
const n = document.createElement("div");
|
|
1541
1559
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1560
|
+
const o = document.createElement("span");
|
|
1561
|
+
if (o.className = "select-value", this.isLoading)
|
|
1562
|
+
o.textContent = this.props.loadingText || "Loading options...";
|
|
1545
1563
|
else {
|
|
1546
|
-
const
|
|
1547
|
-
|
|
1564
|
+
const a = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, l = a && typeof a.name == "string" ? a.name : "Select an option";
|
|
1565
|
+
o.textContent = l;
|
|
1548
1566
|
}
|
|
1549
|
-
e.appendChild(
|
|
1567
|
+
e.appendChild(o);
|
|
1550
1568
|
} else {
|
|
1551
1569
|
const n = document.createElement("span");
|
|
1552
1570
|
if (this.isLoading)
|
|
1553
1571
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1554
1572
|
else {
|
|
1555
|
-
const
|
|
1556
|
-
n.textContent =
|
|
1573
|
+
const o = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, a = o && typeof o.name == "string" ? o.name : "Select an option";
|
|
1574
|
+
n.textContent = a;
|
|
1557
1575
|
}
|
|
1558
1576
|
e.appendChild(n);
|
|
1559
1577
|
}
|
|
1560
1578
|
e.onclick = () => {
|
|
1561
|
-
var n,
|
|
1562
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1579
|
+
var n, o;
|
|
1580
|
+
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));
|
|
1563
1581
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1564
1582
|
const i = document.createElement("ul");
|
|
1565
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1583
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
1584
|
+
const a = this.createOption(n, o);
|
|
1585
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1568
1586
|
}), t.appendChild(i);
|
|
1569
1587
|
const s = document.createElement("div");
|
|
1570
1588
|
return s.classList.add("svg-container"), s.innerHTML = Z, t.appendChild(s), s.onclick = () => {
|
|
1571
|
-
var n,
|
|
1572
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1589
|
+
var n, o;
|
|
1590
|
+
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));
|
|
1573
1591
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1574
|
-
const
|
|
1592
|
+
const o = new Set(
|
|
1575
1593
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1576
|
-
),
|
|
1577
|
-
(l) => !
|
|
1594
|
+
), a = n.filter(
|
|
1595
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1578
1596
|
);
|
|
1579
|
-
if (this._options.push(...
|
|
1597
|
+
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1580
1598
|
const l = this._options.findIndex(
|
|
1581
1599
|
(h) => JSON.stringify(h.value) === JSON.stringify(this.value)
|
|
1582
1600
|
);
|
|
@@ -1590,12 +1608,12 @@ class vt extends p {
|
|
|
1590
1608
|
!0
|
|
1591
1609
|
);
|
|
1592
1610
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1593
|
-
const
|
|
1611
|
+
const o = new Set(
|
|
1594
1612
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1595
|
-
),
|
|
1596
|
-
(l) => !
|
|
1613
|
+
), a = n.filter(
|
|
1614
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1597
1615
|
);
|
|
1598
|
-
if (this._options.push(...
|
|
1616
|
+
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1599
1617
|
const l = this._options.findIndex(
|
|
1600
1618
|
(h) => JSON.stringify(h.value) === JSON.stringify(this.value)
|
|
1601
1619
|
);
|
|
@@ -1617,16 +1635,16 @@ class vt extends p {
|
|
|
1617
1635
|
var l, h, r, d;
|
|
1618
1636
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1619
1637
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1620
|
-
const
|
|
1621
|
-
this.value =
|
|
1622
|
-
const
|
|
1623
|
-
if (
|
|
1624
|
-
|
|
1638
|
+
const o = this._options[e].value;
|
|
1639
|
+
this.value = o;
|
|
1640
|
+
const a = i.querySelector(".select-value");
|
|
1641
|
+
if (a)
|
|
1642
|
+
a.textContent = this._options[e].name;
|
|
1625
1643
|
else {
|
|
1626
1644
|
const u = i.firstChild;
|
|
1627
1645
|
u && u.tagName === "SPAN" && (u.textContent = this._options[e].name);
|
|
1628
1646
|
}
|
|
1629
|
-
this.isOpen = !1, (h = this.optionsListEl) == null || h.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open"), (d = this.onChange) == null || d.call(this,
|
|
1647
|
+
this.isOpen = !1, (h = this.optionsListEl) == null || h.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open"), (d = this.onChange) == null || d.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1630
1648
|
}
|
|
1631
1649
|
updateOptionsList() {
|
|
1632
1650
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1665,7 +1683,7 @@ class Ct extends p {
|
|
|
1665
1683
|
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;
|
|
1666
1684
|
}
|
|
1667
1685
|
draw() {
|
|
1668
|
-
var
|
|
1686
|
+
var o, a;
|
|
1669
1687
|
const t = document.createElement("div");
|
|
1670
1688
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
1671
1689
|
const e = document.createElement("div");
|
|
@@ -1681,7 +1699,7 @@ class Ct extends p {
|
|
|
1681
1699
|
const i = document.createElement("label");
|
|
1682
1700
|
i.className = "toggle-switch";
|
|
1683
1701
|
const s = document.createElement("input");
|
|
1684
|
-
s.type = "checkbox", s.checked = ((
|
|
1702
|
+
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, s.addEventListener("change", () => {
|
|
1685
1703
|
var h, r;
|
|
1686
1704
|
const l = ((r = (h = this.props.options) == null ? void 0 : h.find((d) => d.status === s.checked)) == null ? void 0 : r.value) ?? "";
|
|
1687
1705
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
@@ -1721,27 +1739,27 @@ class wt extends p {
|
|
|
1721
1739
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
1722
1740
|
const s = document.createElement("span");
|
|
1723
1741
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1742
|
+
const a = document.createElement("span");
|
|
1743
|
+
a.className = "setting-icon", a.innerHTML = this.props.icon, i.insertBefore(a, s);
|
|
1726
1744
|
}
|
|
1727
1745
|
const n = document.createElement("div");
|
|
1728
1746
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
1729
|
-
const
|
|
1730
|
-
return
|
|
1747
|
+
const o = document.createElement("div");
|
|
1748
|
+
return o.className = "gap-inputs-container", this.props.rowGap && o.appendChild(this.createGapInput("row", "Row")), this.props.columnGap && o.appendChild(this.createGapInput("column", "Col")), n.appendChild(o), e.appendChild(i), e.appendChild(n), t.appendChild(e), t;
|
|
1731
1749
|
}
|
|
1732
1750
|
createGapInput(t, e) {
|
|
1733
1751
|
const i = document.createElement("div");
|
|
1734
1752
|
i.className = "gap-input-wrapper";
|
|
1735
1753
|
const s = document.createElement("input");
|
|
1736
1754
|
if (s.type = "number", s.className = `gap-input gap-${t}-input ${this.props.inputClassName || ""}`, s.id = `${this.id}-${t}-input`, s.min = String(this.props.minValue ?? 0), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), s.step = String(this.props.step ?? 1), s.value = String(this.inputValues[t] ?? this.value), s.title = e, s.addEventListener("input", (n) => {
|
|
1737
|
-
const
|
|
1738
|
-
let
|
|
1739
|
-
|
|
1755
|
+
const o = n.target;
|
|
1756
|
+
let a = parseFloat(o.value);
|
|
1757
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
1740
1758
|
}), s.addEventListener("blur", (n) => {
|
|
1741
1759
|
var l, h;
|
|
1742
|
-
const
|
|
1743
|
-
let
|
|
1744
|
-
|
|
1760
|
+
const o = n.target;
|
|
1761
|
+
let a = parseFloat(o.value);
|
|
1762
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (h = (l = this.props).onBlur) == null || h.call(l);
|
|
1745
1763
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
1746
1764
|
const n = document.createElement("span");
|
|
1747
1765
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -1849,15 +1867,15 @@ class bt extends p {
|
|
|
1849
1867
|
s.classList.add("language-label"), s.textContent = t.toUpperCase();
|
|
1850
1868
|
const n = document.createElement("div");
|
|
1851
1869
|
n.classList.add("language-input-group");
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1870
|
+
const o = document.createElement("input");
|
|
1871
|
+
o.type = "text", o.classList.add("language-input"), o.value = e || "", o.placeholder = this.props.placeholder || "Enter text...", o.addEventListener("input", (l) => {
|
|
1854
1872
|
const h = l.target;
|
|
1855
1873
|
this.updateLanguageValue(t, h.value);
|
|
1856
1874
|
});
|
|
1857
|
-
const
|
|
1858
|
-
return
|
|
1875
|
+
const a = document.createElement("button");
|
|
1876
|
+
return a.type = "button", a.classList.add("delete-language-btn"), a.innerHTML = Y, a.title = `Delete ${t.toUpperCase()}`, a.addEventListener("click", () => {
|
|
1859
1877
|
this.removeLanguage(t);
|
|
1860
|
-
}), n.appendChild(
|
|
1878
|
+
}), n.appendChild(o), n.appendChild(a), i.appendChild(s), i.appendChild(n), i;
|
|
1861
1879
|
}
|
|
1862
1880
|
updateLanguageValue(t, e) {
|
|
1863
1881
|
this.value || (this.value = {}), this.value[t] = e, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
@@ -1889,8 +1907,8 @@ class bt extends p {
|
|
|
1889
1907
|
s.classList.add("add-language-select"), this.addLanguageSelect = s;
|
|
1890
1908
|
const n = document.createElement("button");
|
|
1891
1909
|
return n.type = "button", n.classList.add("add-language-btn"), n.innerHTML = `${tt} Add`, this.addButton = n, n.addEventListener("click", () => {
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1910
|
+
const o = s.value;
|
|
1911
|
+
o && this.addLanguage(o);
|
|
1894
1912
|
}), i.appendChild(s), i.appendChild(n), t.appendChild(e), t.appendChild(i), t;
|
|
1895
1913
|
}
|
|
1896
1914
|
draw() {
|
|
@@ -1902,9 +1920,9 @@ class bt extends p {
|
|
|
1902
1920
|
const e = document.createElement("div");
|
|
1903
1921
|
e.classList.add("multi-language-content");
|
|
1904
1922
|
const i = document.createElement("div");
|
|
1905
|
-
i.classList.add("languages-container"), this.languagesContainer = i, this.value && Object.entries(this.value).forEach(([n,
|
|
1906
|
-
const
|
|
1907
|
-
i.appendChild(
|
|
1923
|
+
i.classList.add("languages-container"), this.languagesContainer = i, this.value && Object.entries(this.value).forEach(([n, o]) => {
|
|
1924
|
+
const a = this.createLanguageRow(n, o);
|
|
1925
|
+
i.appendChild(a);
|
|
1908
1926
|
}), e.appendChild(i);
|
|
1909
1927
|
const s = this.createAddLanguageSection();
|
|
1910
1928
|
return e.appendChild(s), t.appendChild(e), this.updateAddLanguageSelect(), this.container = t, t;
|
|
@@ -2058,8 +2076,8 @@ class Mt extends f {
|
|
|
2058
2076
|
});
|
|
2059
2077
|
}
|
|
2060
2078
|
getCssCode() {
|
|
2061
|
-
var
|
|
2062
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((
|
|
2079
|
+
var o;
|
|
2080
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((o = this.settings.align) == null ? void 0 : o.value) ?? "left";
|
|
2063
2081
|
return `
|
|
2064
2082
|
color: ${t};
|
|
2065
2083
|
font-family: ${e};
|
|
@@ -2077,11 +2095,11 @@ class E extends p {
|
|
|
2077
2095
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
2078
2096
|
}
|
|
2079
2097
|
draw() {
|
|
2080
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
2081
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
2098
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
2099
|
+
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", () => {
|
|
2082
2100
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, h = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
2083
|
-
let r = Number(
|
|
2084
|
-
r < l && (r = l), r > h && (r = h),
|
|
2101
|
+
let r = Number(a.value);
|
|
2102
|
+
r < l && (r = l), r > h && (r = h), a.value = String(r);
|
|
2085
2103
|
}));
|
|
2086
2104
|
}, i = this.createInput({
|
|
2087
2105
|
value: this.value,
|
|
@@ -2102,9 +2120,9 @@ class E extends p {
|
|
|
2102
2120
|
s && (s.style.paddingRight = "35px");
|
|
2103
2121
|
const n = document.createElement("span");
|
|
2104
2122
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
2105
|
-
const
|
|
2106
|
-
return
|
|
2107
|
-
const l =
|
|
2123
|
+
const o = i.querySelector("input");
|
|
2124
|
+
return o && (o.oninput = (a) => {
|
|
2125
|
+
const l = a.target.value.trim();
|
|
2108
2126
|
if (l.toLowerCase() === "auto")
|
|
2109
2127
|
this.value = "auto";
|
|
2110
2128
|
else {
|
|
@@ -2217,10 +2235,10 @@ class Vt extends f {
|
|
|
2217
2235
|
draw() {
|
|
2218
2236
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
2219
2237
|
if (!e) return t;
|
|
2220
|
-
const i = Array.from(e.children), [s, n,
|
|
2238
|
+
const i = Array.from(e.children), [s, n, o] = i;
|
|
2221
2239
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
2222
|
-
const
|
|
2223
|
-
return
|
|
2240
|
+
const a = document.createElement("div");
|
|
2241
|
+
return a.className = "bgset-or-label", a.textContent = "OR", e.appendChild(a), e.appendChild(o), t;
|
|
2224
2242
|
}
|
|
2225
2243
|
/**
|
|
2226
2244
|
* Helper method to generate CSS based on the current settings.
|
|
@@ -2266,7 +2284,7 @@ export {
|
|
|
2266
2284
|
y as SelectSetting,
|
|
2267
2285
|
p as Setting,
|
|
2268
2286
|
f as SettingGroup,
|
|
2269
|
-
|
|
2287
|
+
B as StringSetting,
|
|
2270
2288
|
ct as TabSettingGroup,
|
|
2271
2289
|
ct as TabsSettingGroup,
|
|
2272
2290
|
Ct as Toggle,
|