builder-settings-types 0.0.343 → 0.0.355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +8 -8
- package/dist/builder-settings-types.es.js +250 -234
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/index.css +1 -1
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/package.json +1 -2
|
@@ -280,9 +280,9 @@ const dt = (c, t, e) => {
|
|
|
280
280
|
o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", h), document.body.style.userSelect = "none";
|
|
281
281
|
}, r = (d) => {
|
|
282
282
|
if (!i) return;
|
|
283
|
-
const p = d.clientX - s,
|
|
284
|
-
let v = o + p, y = a +
|
|
285
|
-
v = Math.max(8, Math.min(C -
|
|
283
|
+
const p = d.clientX - s, u = d.clientY - n, C = window.innerWidth, m = window.innerHeight, g = t.offsetWidth, f = t.offsetHeight;
|
|
284
|
+
let v = o + p, y = a + u;
|
|
285
|
+
v = Math.max(8, Math.min(C - g - 8, v)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
|
|
286
286
|
}, h = () => {
|
|
287
287
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", h), document.body.style.userSelect = "";
|
|
288
288
|
};
|
|
@@ -454,7 +454,7 @@ const dt = (c, t, e) => {
|
|
|
454
454
|
for (let a = s; a < c.length && n > 0; a++)
|
|
455
455
|
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
456
456
|
return n === 0 ? c.substring(s, o) : null;
|
|
457
|
-
},
|
|
457
|
+
}, Gt = (c) => {
|
|
458
458
|
const t = c.split(" ")[0].toLowerCase();
|
|
459
459
|
return [
|
|
460
460
|
"circle",
|
|
@@ -518,7 +518,7 @@ const dt = (c, t, e) => {
|
|
|
518
518
|
}
|
|
519
519
|
const i = Ct(t, "radial-gradient");
|
|
520
520
|
if (i) {
|
|
521
|
-
const s = ft(i), n = s[0] && !
|
|
521
|
+
const s = ft(i), n = s[0] && !Gt(s[0]) ? s.slice(1) : s, o = yt(n);
|
|
522
522
|
return o.length ? D({ type: "radial", angle: 0, stops: o }) : null;
|
|
523
523
|
}
|
|
524
524
|
return null;
|
|
@@ -534,7 +534,7 @@ const dt = (c, t, e) => {
|
|
|
534
534
|
(e) => `${ct(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
535
535
|
).join(", ");
|
|
536
536
|
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
537
|
-
},
|
|
537
|
+
}, Ft = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), et = (c) => {
|
|
538
538
|
if (c.type === "solid") {
|
|
539
539
|
const t = c.stops[0];
|
|
540
540
|
if (t) {
|
|
@@ -546,7 +546,7 @@ const dt = (c, t, e) => {
|
|
|
546
546
|
if (i === 100)
|
|
547
547
|
return e;
|
|
548
548
|
{
|
|
549
|
-
const s =
|
|
549
|
+
const s = Ft(i);
|
|
550
550
|
return `${e}${s}`;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
@@ -649,14 +649,14 @@ const pt = (c, t) => {
|
|
|
649
649
|
a.style.display = "grid", l.style.display = "none", h.forEach((d) => {
|
|
650
650
|
const p = document.createElement("button");
|
|
651
651
|
p.type = "button", p.className = "color-picker-recent-swatch";
|
|
652
|
-
const
|
|
653
|
-
if (p.title =
|
|
652
|
+
const u = Ut(d);
|
|
653
|
+
if (p.title = u, p.setAttribute("aria-label", `Use color: ${u}`), d.includes("gradient(")) {
|
|
654
654
|
p.style.backgroundImage = d, p.style.backgroundColor = "transparent";
|
|
655
|
-
const
|
|
656
|
-
|
|
655
|
+
const m = T(d);
|
|
656
|
+
m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
|
|
657
657
|
} else
|
|
658
658
|
p.style.backgroundColor = d, p.style.borderColor = d;
|
|
659
|
-
p.addEventListener("mouseenter", () => o(p,
|
|
659
|
+
p.addEventListener("mouseenter", () => o(p, u)), p.addEventListener("mouseleave", () => {
|
|
660
660
|
n(), p.style.boxShadow = "";
|
|
661
661
|
}), p.addEventListener("mousedown", () => {
|
|
662
662
|
p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
@@ -764,29 +764,29 @@ class Zt {
|
|
|
764
764
|
d.className = "color-picker-hue-marker", this.hueMarker = d, h.appendChild(d);
|
|
765
765
|
const p = document.createElement("div");
|
|
766
766
|
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
767
|
-
const
|
|
768
|
-
|
|
767
|
+
const u = document.createElement("div");
|
|
768
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, p.appendChild(u), r.appendChild(h), r.appendChild(p), a.appendChild(l), a.appendChild(r);
|
|
769
769
|
const C = pt((E) => {
|
|
770
770
|
var L;
|
|
771
771
|
this.setColor(E), (L = this.onChange) == null || L.call(this, E, this.currentOpacity);
|
|
772
772
|
}, this.recentScope);
|
|
773
773
|
this.recentSectionRefresh = C.refresh;
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
const
|
|
777
|
-
|
|
774
|
+
const m = document.createElement("div");
|
|
775
|
+
m.className = "color-picker-format-section";
|
|
776
|
+
const g = document.createElement("select");
|
|
777
|
+
g.className = "color-picker-format-select", this.select = g;
|
|
778
778
|
const f = document.createElement("option");
|
|
779
779
|
f.value = "hex", f.textContent = "HEX";
|
|
780
780
|
const v = document.createElement("option");
|
|
781
781
|
v.value = "rgb", v.textContent = "RGB";
|
|
782
782
|
const y = document.createElement("option");
|
|
783
|
-
y.value = "hsl", y.textContent = "HSL",
|
|
783
|
+
y.value = "hsl", y.textContent = "HSL", g.appendChild(f), g.appendChild(v), g.appendChild(y);
|
|
784
784
|
const b = document.createElement("input");
|
|
785
785
|
b.type = "text", b.className = "color-picker-color-input", b.value = this.currentColor, this.input = b;
|
|
786
786
|
const k = document.createElement("div");
|
|
787
787
|
k.className = "color-picker-input-container";
|
|
788
788
|
const x = document.createElement("button");
|
|
789
|
-
return x.className = "color-picker-copy-inside", x.textContent = "Copy", k.appendChild(b), k.appendChild(x),
|
|
789
|
+
return x.className = "color-picker-copy-inside", x.textContent = "Copy", k.appendChild(b), k.appendChild(x), m.appendChild(g), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(C.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, p, b, g, x, l), t;
|
|
790
790
|
}
|
|
791
791
|
createBackdrop() {
|
|
792
792
|
const t = document.createElement("div");
|
|
@@ -795,40 +795,40 @@ class Zt {
|
|
|
795
795
|
bind(t, e, i, s, n, o, a) {
|
|
796
796
|
const l = (d) => {
|
|
797
797
|
var v;
|
|
798
|
-
const p = t.getBoundingClientRect(),
|
|
799
|
-
this.colorMarker.style.left = `${
|
|
800
|
-
const
|
|
798
|
+
const p = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), C = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
|
|
799
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
800
|
+
const g = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = Z(g, u, 1 - C);
|
|
801
801
|
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
802
802
|
}, r = (d) => {
|
|
803
803
|
var v;
|
|
804
804
|
const p = e.getBoundingClientRect();
|
|
805
|
-
let
|
|
806
|
-
this.hueMarker.style.left = `${
|
|
807
|
-
const C =
|
|
805
|
+
let u = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
806
|
+
this.hueMarker.style.left = `${u * 100}%`;
|
|
807
|
+
const C = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), g = this.parsePercentage(this.colorMarker.style.top || "0%"), f = Z(C, m, 1 - g);
|
|
808
808
|
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
809
809
|
}, h = (d) => {
|
|
810
810
|
var C;
|
|
811
|
-
const p = i.getBoundingClientRect(),
|
|
812
|
-
this.opacityMarker.style.left = `${
|
|
811
|
+
const p = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
812
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
|
|
813
813
|
};
|
|
814
814
|
t.addEventListener("mousedown", (d) => {
|
|
815
815
|
d.preventDefault(), l(d);
|
|
816
|
-
const p = (C) => l(C),
|
|
817
|
-
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup",
|
|
816
|
+
const p = (C) => l(C), u = () => {
|
|
817
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
818
818
|
};
|
|
819
|
-
document.addEventListener("mousemove", p), document.addEventListener("mouseup",
|
|
819
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", u);
|
|
820
820
|
}), e.addEventListener("mousedown", (d) => {
|
|
821
821
|
d.preventDefault(), r(d);
|
|
822
|
-
const p = (C) => r(C),
|
|
823
|
-
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup",
|
|
822
|
+
const p = (C) => r(C), u = () => {
|
|
823
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
824
824
|
};
|
|
825
|
-
document.addEventListener("mousemove", p), document.addEventListener("mouseup",
|
|
825
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", u);
|
|
826
826
|
}), i.addEventListener("mousedown", (d) => {
|
|
827
827
|
d.preventDefault(), h(d);
|
|
828
|
-
const p = (C) => h(C),
|
|
829
|
-
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup",
|
|
828
|
+
const p = (C) => h(C), u = () => {
|
|
829
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", u);
|
|
830
830
|
};
|
|
831
|
-
document.addEventListener("mousemove", p), document.addEventListener("mouseup",
|
|
831
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", u);
|
|
832
832
|
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (d) => {
|
|
833
833
|
d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
|
|
834
834
|
}), o.addEventListener("click", async () => {
|
|
@@ -844,8 +844,8 @@ class Zt {
|
|
|
844
844
|
return;
|
|
845
845
|
}
|
|
846
846
|
try {
|
|
847
|
-
const p = new window.EyeDropper(), { sRGBHex:
|
|
848
|
-
this.setColor(
|
|
847
|
+
const p = new window.EyeDropper(), { sRGBHex: u } = await p.open();
|
|
848
|
+
this.setColor(u), (d = this.onChange) == null || d.call(this, u, this.currentOpacity);
|
|
849
849
|
} catch {
|
|
850
850
|
}
|
|
851
851
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -907,11 +907,11 @@ class Zt {
|
|
|
907
907
|
const { h: s, s: n, v: o } = q(t);
|
|
908
908
|
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}%`, (y = this.recentSectionRefresh) == null || y.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);
|
|
909
909
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, d = window.innerHeight, p = 16;
|
|
910
|
-
let
|
|
911
|
-
const
|
|
912
|
-
|
|
910
|
+
let u = r.right + 8, C = r.top;
|
|
911
|
+
const m = h - r.right, g = r.left;
|
|
912
|
+
m >= a + p ? u = r.right + 8 : g >= a + p ? u = r.left - a - 8 : u = Math.max(p, (h - a) / 2);
|
|
913
913
|
const f = d - r.bottom, v = r.top;
|
|
914
|
-
f >= l + p ? C = r.bottom + 8 : v >= l + p ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > d - p && (C = d - l - p)) : (C = r.top - l - 8, C < p && (C = p)), this.element.style.left = `${
|
|
914
|
+
f >= l + p ? C = r.bottom + 8 : v >= l + p ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > d - p && (C = d - l - p)) : (C = r.top - l - 8, C < p && (C = p)), this.element.style.left = `${u}px`, this.element.style.top = `${C}px`;
|
|
915
915
|
}
|
|
916
916
|
close(t) {
|
|
917
917
|
var e;
|
|
@@ -970,53 +970,53 @@ class Jt {
|
|
|
970
970
|
this.recentSectionRefresh = d.refresh;
|
|
971
971
|
const p = document.createElement("div");
|
|
972
972
|
p.className = "color-picker-format-section embedded";
|
|
973
|
-
const
|
|
974
|
-
|
|
973
|
+
const u = document.createElement("select");
|
|
974
|
+
u.className = "color-picker-format-select", this.select = u;
|
|
975
975
|
const C = document.createElement("option");
|
|
976
976
|
C.value = "hex", C.textContent = "HEX";
|
|
977
|
+
const m = document.createElement("option");
|
|
978
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
977
979
|
const g = document.createElement("option");
|
|
978
|
-
g.value = "
|
|
979
|
-
const u = document.createElement("option");
|
|
980
|
-
u.value = "hsl", u.textContent = "HSL", m.appendChild(C), m.appendChild(g), m.appendChild(u);
|
|
980
|
+
g.value = "hsl", g.textContent = "HSL", u.appendChild(C), u.appendChild(m), u.appendChild(g);
|
|
981
981
|
const f = document.createElement("input");
|
|
982
982
|
f.type = "text", f.className = "color-picker-color-input", this.input = f;
|
|
983
983
|
const v = document.createElement("div");
|
|
984
984
|
v.className = "color-picker-input-container";
|
|
985
985
|
const y = document.createElement("button");
|
|
986
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), p.appendChild(
|
|
986
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), p.appendChild(u), p.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(d.container), this.bind(e, a, r, f, u, y, n), t;
|
|
987
987
|
}
|
|
988
988
|
bind(t, e, i, s, n, o, a) {
|
|
989
|
-
const l = (p,
|
|
990
|
-
const C =
|
|
991
|
-
this.colorMarker.style.left = `${
|
|
992
|
-
const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = Z(v,
|
|
989
|
+
const l = (p, u) => {
|
|
990
|
+
const C = u || t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), g = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height));
|
|
991
|
+
this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
992
|
+
const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = Z(v, m, 1 - g);
|
|
993
993
|
this.currentColor = y, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
994
|
-
}, r = (p,
|
|
995
|
-
const C =
|
|
996
|
-
this.hueMarker.style.left = `${
|
|
997
|
-
const
|
|
994
|
+
}, r = (p, u) => {
|
|
995
|
+
const C = u || e.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
|
|
996
|
+
this.hueMarker.style.left = `${m * 100}%`;
|
|
997
|
+
const g = m * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), y = Z(g, f, 1 - v);
|
|
998
998
|
this.currentColor = y, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
999
|
-
linear-gradient(to right, #fff, hsl(${
|
|
1000
|
-
}, h = (p,
|
|
1001
|
-
const C =
|
|
1002
|
-
this.opacityMarker.style.left = `${
|
|
1003
|
-
}, d = (p,
|
|
1004
|
-
p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(),
|
|
1005
|
-
let
|
|
999
|
+
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
1000
|
+
}, h = (p, u) => {
|
|
1001
|
+
const C = u || i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
|
|
1002
|
+
this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = this.clampOpacity(m * 100), this.queueChange();
|
|
1003
|
+
}, d = (p, u, C) => {
|
|
1004
|
+
p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), u(p, this.cachedRect);
|
|
1005
|
+
let m = null, g;
|
|
1006
1006
|
const f = () => {
|
|
1007
1007
|
this.dragRafId === void 0 && (this.dragRafId = window.requestAnimationFrame(() => {
|
|
1008
|
-
this.dragRafId = void 0,
|
|
1008
|
+
this.dragRafId = void 0, m && this.cachedRect && u(m, this.cachedRect);
|
|
1009
1009
|
}));
|
|
1010
1010
|
}, v = () => {
|
|
1011
|
-
this.isDragging && (this.isDragging = !1, this.dragRafId !== void 0 && (cancelAnimationFrame(this.dragRafId), this.dragRafId = void 0), this.cachedRect = void 0,
|
|
1011
|
+
this.isDragging && (this.isDragging = !1, this.dragRafId !== void 0 && (cancelAnimationFrame(this.dragRafId), this.dragRafId = void 0), this.cachedRect = void 0, m = null, this.flushChange(), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", v), window.removeEventListener("blur", v), this.applyPendingExternal());
|
|
1012
1012
|
};
|
|
1013
|
-
|
|
1013
|
+
g = (y) => {
|
|
1014
1014
|
if (!y.buttons) {
|
|
1015
1015
|
v();
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
|
-
|
|
1019
|
-
}, document.addEventListener("mousemove",
|
|
1018
|
+
m = y, f();
|
|
1019
|
+
}, document.addEventListener("mousemove", g), document.addEventListener("mouseup", v), window.addEventListener("blur", v);
|
|
1020
1020
|
};
|
|
1021
1021
|
t.addEventListener("mousedown", (p) => {
|
|
1022
1022
|
d(p, l, t);
|
|
@@ -1044,8 +1044,8 @@ class Jt {
|
|
|
1044
1044
|
return;
|
|
1045
1045
|
}
|
|
1046
1046
|
try {
|
|
1047
|
-
const p = new window.EyeDropper(), { sRGBHex:
|
|
1048
|
-
this.setColor(
|
|
1047
|
+
const p = new window.EyeDropper(), { sRGBHex: u } = await p.open();
|
|
1048
|
+
this.setColor(u), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
1049
1049
|
} catch {
|
|
1050
1050
|
}
|
|
1051
1051
|
});
|
|
@@ -1151,7 +1151,7 @@ const V = class V extends w {
|
|
|
1151
1151
|
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.changeDebounceTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.sharedStopColorPicker = null, this.colorPickerStopIndex = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
1152
1152
|
var p;
|
|
1153
1153
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
1154
|
-
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((
|
|
1154
|
+
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((u) => u.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), h = s.classList.contains("color-picker-backdrop"), d = s.classList.contains("gradient-popover-backdrop");
|
|
1155
1155
|
!n && !o && !l && !r && !h && !d && this.closePopover();
|
|
1156
1156
|
}, this.handlePopoverKeydown = (i) => {
|
|
1157
1157
|
var s, n;
|
|
@@ -1367,17 +1367,30 @@ const V = class V extends w {
|
|
|
1367
1367
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
1368
1368
|
}
|
|
1369
1369
|
switchType(t, e = !1) {
|
|
1370
|
-
var
|
|
1370
|
+
var l, r;
|
|
1371
1371
|
if (!this.value) return;
|
|
1372
|
-
const i = this.isBoundToGlobal(),
|
|
1373
|
-
|
|
1372
|
+
const i = this.value.type, s = this.isBoundToGlobal(), n = this.linkedGlobalVariable;
|
|
1373
|
+
this.value.type = t;
|
|
1374
|
+
let o = !1;
|
|
1375
|
+
if (s && n && i === "solid" != (t === "solid")) {
|
|
1376
|
+
const h = this.resolveGlobalVarColor(n), d = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
1377
|
+
(l = this.value.stops) != null && l.length && (this.value.stops = this.value.stops.map((p) => ({
|
|
1378
|
+
...p,
|
|
1379
|
+
color: p.color.startsWith("var(--") ? this.resolveGlobalVarColor(p.color) : p.color
|
|
1380
|
+
}))), !this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color: h, position: 0, opacity: d }] : this.value.stops[0] = {
|
|
1381
|
+
...this.value.stops[0],
|
|
1382
|
+
color: h,
|
|
1383
|
+
opacity: d
|
|
1384
|
+
}, this.linkedGlobalVariable = null, o = !0;
|
|
1385
|
+
}
|
|
1386
|
+
if (t !== "solid" && (this.pendingSolidColor = null), t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
1374
1387
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
1375
1388
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
1376
1389
|
]), t !== "solid" && this.value.stops.length === 1) {
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1390
|
+
const d = this.value.stops[0].color;
|
|
1391
|
+
if (d.startsWith("var(--")) {
|
|
1392
|
+
const p = this.resolveGlobalVarColor(d), u = T(p);
|
|
1393
|
+
u && u.type !== "solid" && u.stops.length >= 2 ? (this.value.stops = u.stops, this.value.angle = u.angle, this.value.type = u.type) : (this.value.stops.push({
|
|
1381
1394
|
color: "#786666",
|
|
1382
1395
|
position: 100,
|
|
1383
1396
|
opacity: 100
|
|
@@ -1390,18 +1403,18 @@ const V = class V extends w {
|
|
|
1390
1403
|
}), this.value.angle = 90;
|
|
1391
1404
|
} else if (t !== "solid" && this.value.stops.length >= 2)
|
|
1392
1405
|
this.value.angle || (this.value.angle = 90);
|
|
1393
|
-
else if (t === "solid" &&
|
|
1394
|
-
const
|
|
1395
|
-
this.value.stops = [{ color:
|
|
1406
|
+
else if (t === "solid" && s && n) {
|
|
1407
|
+
const h = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
1408
|
+
this.value.stops = [{ color: n, position: 0, opacity: h }], this.value.angle = 0;
|
|
1396
1409
|
}
|
|
1397
1410
|
if (this.popoverEl) {
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
const
|
|
1401
|
-
t === "solid" ?
|
|
1411
|
+
const h = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
1412
|
+
h.forEach((u) => u.classList.remove("active"));
|
|
1413
|
+
const d = h[0], p = h[1];
|
|
1414
|
+
t === "solid" ? d == null || d.classList.add("active") : p == null || p.classList.add("active");
|
|
1402
1415
|
}
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1416
|
+
const a = (r = this.popoverEl) == null ? void 0 : r.querySelector(".gradient-editor-content");
|
|
1417
|
+
a && this.updatePopoverContent(a), this.updateUI(), (e || o || i !== t) && this.triggerChange();
|
|
1405
1418
|
}
|
|
1406
1419
|
updatePopoverContent(t) {
|
|
1407
1420
|
if (t.innerHTML = "", !!this.value) {
|
|
@@ -1419,21 +1432,21 @@ const V = class V extends w {
|
|
|
1419
1432
|
let p = {};
|
|
1420
1433
|
try {
|
|
1421
1434
|
p = w.GlobalVariables || {};
|
|
1422
|
-
} catch (
|
|
1423
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
1435
|
+
} catch (g) {
|
|
1436
|
+
console.warn("Could not access Setting.GlobalVariables", g);
|
|
1424
1437
|
}
|
|
1425
1438
|
if (!p || Object.keys(p).length === 0) {
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1439
|
+
const g = document.createElement("div");
|
|
1440
|
+
g.textContent = "No global colors defined", g.style.fontSize = "12px", g.style.color = "#666", g.style.padding = "8px", d.appendChild(g);
|
|
1428
1441
|
return;
|
|
1429
1442
|
}
|
|
1430
|
-
const
|
|
1443
|
+
const u = w.GlobalVariableGroups || [
|
|
1431
1444
|
{ title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
|
|
1432
1445
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
1433
1446
|
], C = this.globalSearchQuery.toLowerCase();
|
|
1434
|
-
let
|
|
1435
|
-
this.globalLayoutMode === "list" ? (
|
|
1436
|
-
const f = Object.entries(p).filter(([v]) => !
|
|
1447
|
+
let m;
|
|
1448
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), d.appendChild(m), u.forEach((g) => {
|
|
1449
|
+
const f = Object.entries(p).filter(([v]) => !g.keys.includes(v) && g.title !== "Global Colors" ? !1 : g.keys.includes(v) && v.toLowerCase().includes(C));
|
|
1437
1450
|
f.length !== 0 && f.forEach(([v, y]) => {
|
|
1438
1451
|
if (this.globalLayoutMode === "list") {
|
|
1439
1452
|
const b = document.createElement("div");
|
|
@@ -1445,9 +1458,9 @@ const V = class V extends w {
|
|
|
1445
1458
|
const L = document.createElement("span");
|
|
1446
1459
|
L.className = "global-color-label", L.textContent = v.split("-").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" "), b.appendChild(k), b.appendChild(L), b.addEventListener("click", (I) => {
|
|
1447
1460
|
I.preventDefault();
|
|
1448
|
-
const
|
|
1449
|
-
this.setValue(
|
|
1450
|
-
}),
|
|
1461
|
+
const G = `var(--${v})`;
|
|
1462
|
+
this.setValue(G), this.pendingSolidColor = G, i(d);
|
|
1463
|
+
}), m.appendChild(b);
|
|
1451
1464
|
} else {
|
|
1452
1465
|
const b = document.createElement("div");
|
|
1453
1466
|
b.className = "global-color-circle";
|
|
@@ -1456,7 +1469,7 @@ const V = class V extends w {
|
|
|
1456
1469
|
E.preventDefault();
|
|
1457
1470
|
const L = `var(--${v})`;
|
|
1458
1471
|
this.setValue(L), this.pendingSolidColor = L, i(d);
|
|
1459
|
-
}),
|
|
1472
|
+
}), m.appendChild(b);
|
|
1460
1473
|
}
|
|
1461
1474
|
});
|
|
1462
1475
|
});
|
|
@@ -1509,40 +1522,40 @@ const V = class V extends w {
|
|
|
1509
1522
|
d.className = "gradient-subtype-select";
|
|
1510
1523
|
const p = document.createElement("option");
|
|
1511
1524
|
p.value = "linear", p.textContent = "Linear";
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1525
|
+
const u = document.createElement("option");
|
|
1526
|
+
u.value = "radial", u.textContent = "Radial", d.appendChild(p), d.appendChild(u), d.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
|
|
1514
1527
|
const C = document.createElement("button");
|
|
1515
1528
|
C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = zt, d.addEventListener("change", () => {
|
|
1516
1529
|
this.clearGlobalBindingForCustomChange(), this.switchType(d.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
|
|
1517
|
-
}), e.addEventListener("focus", (
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
}), e.addEventListener("input", (
|
|
1530
|
+
}), e.addEventListener("focus", (m) => {
|
|
1531
|
+
const g = m.target;
|
|
1532
|
+
g.value = g.value.replace(/[^0-9-]/g, ""), setTimeout(() => g.select(), 0);
|
|
1533
|
+
}), e.addEventListener("input", (m) => {
|
|
1521
1534
|
this.clearGlobalBindingForCustomChange();
|
|
1522
|
-
const
|
|
1523
|
-
!Number.isNaN(
|
|
1524
|
-
}), e.addEventListener("blur", (
|
|
1535
|
+
const g = parseInt(m.target.value);
|
|
1536
|
+
!Number.isNaN(g) && this.value && (this.value.angle = Math.max(0, Math.min(360, g)), this.debouncedPreviewUpdate());
|
|
1537
|
+
}), e.addEventListener("blur", (m) => {
|
|
1525
1538
|
var v;
|
|
1526
1539
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1527
|
-
const
|
|
1528
|
-
let f = parseInt(
|
|
1529
|
-
Number.isNaN(f) && (f = ((v = this.value) == null ? void 0 : v.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f),
|
|
1540
|
+
const g = m.target;
|
|
1541
|
+
let f = parseInt(g.value);
|
|
1542
|
+
Number.isNaN(f) && (f = ((v = this.value) == null ? void 0 : v.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), g.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1530
1543
|
}), C.addEventListener("click", () => {
|
|
1531
|
-
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((
|
|
1532
|
-
|
|
1533
|
-
}), this.value.stops.sort((
|
|
1544
|
+
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
1545
|
+
m.position = 100 - m.position;
|
|
1546
|
+
}), this.value.stops.sort((m, g) => m.position - g.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
1534
1547
|
}), h.appendChild(d), h.appendChild(e), h.appendChild(C), t.appendChild(h), this.updateDegreeVisibility(e);
|
|
1535
1548
|
}
|
|
1536
1549
|
const i = document.createElement("div");
|
|
1537
1550
|
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
1538
1551
|
const s = document.createElement("div");
|
|
1539
1552
|
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i), i.addEventListener("click", (h) => {
|
|
1540
|
-
var
|
|
1553
|
+
var m;
|
|
1541
1554
|
const d = h.target;
|
|
1542
1555
|
if (d.classList.contains("gstop-handle") || d.classList.contains("gstop-chip"))
|
|
1543
1556
|
return;
|
|
1544
1557
|
const p = i.getBoundingClientRect(), C = (h.clientX - p.left) / p.width * 100;
|
|
1545
|
-
this.clearGlobalBindingForCustomChange(), this.addStopAtPosition(C), this.updateStopsList(), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((
|
|
1558
|
+
this.clearGlobalBindingForCustomChange(), this.addStopAtPosition(C), this.updateStopsList(), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((m = document.activeElement) == null ? void 0 : m.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
1546
1559
|
});
|
|
1547
1560
|
const n = document.createElement("div");
|
|
1548
1561
|
n.className = "gradient-stops-header";
|
|
@@ -1590,25 +1603,25 @@ const V = class V extends w {
|
|
|
1590
1603
|
const a = this.resolveGlobalVarColor(i.color);
|
|
1591
1604
|
o.style.backgroundColor = a, n.appendChild(o);
|
|
1592
1605
|
let l = !1, r = !1, h = 0, d = 0;
|
|
1593
|
-
const p = (
|
|
1594
|
-
l = !0, r = !1, h =
|
|
1595
|
-
},
|
|
1606
|
+
const p = (m) => {
|
|
1607
|
+
l = !0, r = !1, h = m.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", u), document.addEventListener("mouseup", C), m.preventDefault(), m.stopPropagation();
|
|
1608
|
+
}, u = (m) => {
|
|
1596
1609
|
if (!l || !this.value) return;
|
|
1597
|
-
const
|
|
1598
|
-
if (Math.abs(
|
|
1610
|
+
const g = m.clientX - h;
|
|
1611
|
+
if (Math.abs(g) > 3 && (r = !0), r) {
|
|
1599
1612
|
this.clearGlobalBindingForCustomChange();
|
|
1600
1613
|
const f = e.getBoundingClientRect();
|
|
1601
|
-
let v = d +
|
|
1614
|
+
let v = d + g / f.width * 100;
|
|
1602
1615
|
v = Math.max(0, Math.min(100, v)), this.value.stops[s].position = Math.round(v), n.style.left = `${v}%`, this.updateGradientPreview();
|
|
1603
1616
|
}
|
|
1604
|
-
}, C = (
|
|
1605
|
-
var
|
|
1617
|
+
}, C = (m) => {
|
|
1618
|
+
var g;
|
|
1606
1619
|
if (l)
|
|
1607
|
-
if (l = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
1620
|
+
if (l = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", C), r)
|
|
1608
1621
|
this.value && (this.value.stops.sort((f, v) => f.position - v.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
1609
1622
|
else {
|
|
1610
|
-
|
|
1611
|
-
const f = (
|
|
1623
|
+
m.stopPropagation();
|
|
1624
|
+
const f = (g = this.value) == null ? void 0 : g.stops[s];
|
|
1612
1625
|
f && setTimeout(() => {
|
|
1613
1626
|
const v = this.getSharedStopColorPicker();
|
|
1614
1627
|
v.getIsOpen() && v.close(!1), this.colorPickerStopIndex = s, v.setOnChange((b, k) => {
|
|
@@ -1639,24 +1652,24 @@ const V = class V extends w {
|
|
|
1639
1652
|
d.className = "gstop-color-preview", d.style.backgroundColor = h;
|
|
1640
1653
|
const p = document.createElement("input");
|
|
1641
1654
|
p.type = "text", p.className = "gstop-color-input", p.value = h.replace("#", "").toUpperCase();
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1655
|
+
const u = document.createElement("button");
|
|
1656
|
+
u.type = "button", u.className = "gstop-color-copy", u.textContent = "Copy", r.appendChild(d), r.appendChild(p), r.appendChild(u);
|
|
1644
1657
|
const C = document.createElement("button");
|
|
1645
1658
|
C.type = "button", C.className = "gstop-del", C.innerHTML = Wt, C.disabled = (((k = (b = this.value) == null ? void 0 : b.stops) == null ? void 0 : k.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1659
|
+
const m = document.createElement("span");
|
|
1660
|
+
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
1661
|
+
const g = document.createElement("div");
|
|
1662
|
+
g.className = "gstop-opacity-group";
|
|
1650
1663
|
const f = document.createElement("input");
|
|
1651
1664
|
f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
|
|
1652
1665
|
const v = N(h);
|
|
1653
1666
|
f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${v.r}, ${v.g}, ${v.b}, 0)`);
|
|
1654
1667
|
const y = document.createElement("span");
|
|
1655
|
-
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`,
|
|
1668
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, g.appendChild(f), g.appendChild(y), p.addEventListener("click", (x) => {
|
|
1656
1669
|
x.preventDefault(), x.stopPropagation();
|
|
1657
1670
|
const E = this.getSharedStopColorPicker();
|
|
1658
|
-
E.getIsOpen() && E.close(!1), this.colorPickerStopIndex = n, E.setOnChange((I,
|
|
1659
|
-
this.clearGlobalBindingForCustomChange(), p.value = I.replace("#", "").toUpperCase(), d.style.backgroundColor = I, this.value.stops[n].color = I,
|
|
1671
|
+
E.getIsOpen() && E.close(!1), this.colorPickerStopIndex = n, E.setOnChange((I, G) => {
|
|
1672
|
+
this.clearGlobalBindingForCustomChange(), p.value = I.replace("#", "").toUpperCase(), d.style.backgroundColor = I, this.value.stops[n].color = I, G !== void 0 && (this.value.stops[n].opacity = G, f.value = String(G), y.textContent = `${G}%`);
|
|
1660
1673
|
const j = N(I);
|
|
1661
1674
|
f.style.setProperty("--slider-color", `rgb(${j.r}, ${j.g}, ${j.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${j.r}, ${j.g}, ${j.b}, 0)`), this.updateGradientPreview(), this.createHandles(
|
|
1662
1675
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
@@ -1675,7 +1688,7 @@ const V = class V extends w {
|
|
|
1675
1688
|
}
|
|
1676
1689
|
}), p.addEventListener("blur", () => {
|
|
1677
1690
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1678
|
-
}),
|
|
1691
|
+
}), u.addEventListener("click", async (x) => {
|
|
1679
1692
|
x.stopPropagation();
|
|
1680
1693
|
try {
|
|
1681
1694
|
await navigator.clipboard.writeText(`#${p.value}`);
|
|
@@ -1742,8 +1755,8 @@ const V = class V extends w {
|
|
|
1742
1755
|
if (s === n || s.position === n.position)
|
|
1743
1756
|
o = s.color, a = s.opacity ?? 100;
|
|
1744
1757
|
else {
|
|
1745
|
-
const r = (e - s.position) / (n.position - s.position), h = N(s.color), d = N(n.color), p = Math.round(h.r + (d.r - h.r) * r),
|
|
1746
|
-
o = `#${p.toString(16).padStart(2, "0")}${
|
|
1758
|
+
const r = (e - s.position) / (n.position - s.position), h = N(s.color), d = N(n.color), p = Math.round(h.r + (d.r - h.r) * r), u = Math.round(h.g + (d.g - h.g) * r), C = Math.round(h.b + (d.b - h.b) * r);
|
|
1759
|
+
o = `#${p.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}${C.toString(16).padStart(2, "0")}`.toUpperCase(), a = Math.round((s.opacity ?? 100) + ((n.opacity ?? 100) - (s.opacity ?? 100)) * r);
|
|
1747
1760
|
}
|
|
1748
1761
|
const l = {
|
|
1749
1762
|
position: Math.round(e),
|
|
@@ -1761,8 +1774,8 @@ const V = class V extends w {
|
|
|
1761
1774
|
let a = t.right + 8, l = t.top;
|
|
1762
1775
|
const r = i - t.right, h = t.left, d = e + n;
|
|
1763
1776
|
r < d && h > r + 100 && (a = t.left - e - 8);
|
|
1764
|
-
const p = s - t.bottom,
|
|
1765
|
-
|
|
1777
|
+
const p = s - t.bottom, u = t.top;
|
|
1778
|
+
u >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : u > p ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
|
|
1766
1779
|
}
|
|
1767
1780
|
setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
1768
1781
|
}
|
|
@@ -1782,8 +1795,8 @@ const V = class V extends w {
|
|
|
1782
1795
|
let l = e.right + 8, r = e.top;
|
|
1783
1796
|
const h = s - e.right, d = e.left, p = i + o;
|
|
1784
1797
|
h < p && d > h + 100 && (l = e.left - i - 8);
|
|
1785
|
-
const
|
|
1786
|
-
C >= a + o ? r = e.top - a - 8 :
|
|
1798
|
+
const u = n - e.bottom, C = e.top;
|
|
1799
|
+
C >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : C > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
1787
1800
|
});
|
|
1788
1801
|
}
|
|
1789
1802
|
}
|
|
@@ -1970,11 +1983,11 @@ const ot = class ot {
|
|
|
1970
1983
|
var p;
|
|
1971
1984
|
const h = t[r], d = this.settings[r];
|
|
1972
1985
|
if (d !== h && (d && this.removeSetting(r), this.addSetting(r, h), i && r in o)) {
|
|
1973
|
-
const
|
|
1986
|
+
const u = o[r];
|
|
1974
1987
|
try {
|
|
1975
1988
|
M(h) ? h.setValue(
|
|
1976
|
-
|
|
1977
|
-
) : R(h) ? (p = h.setValue) == null || p.call(h,
|
|
1989
|
+
u
|
|
1990
|
+
) : R(h) ? (p = h.setValue) == null || p.call(h, u) : h.setValue && h.setValue(u);
|
|
1978
1991
|
} catch (C) {
|
|
1979
1992
|
console.warn(`Could not preserve value for setting ${r}:`, C);
|
|
1980
1993
|
}
|
|
@@ -2104,16 +2117,17 @@ const ot = class ot {
|
|
|
2104
2117
|
".setting-group-content"
|
|
2105
2118
|
);
|
|
2106
2119
|
if (o) {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2120
|
+
const a = o.querySelector(".setting-group-empty");
|
|
2121
|
+
a && a.remove(), M(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
2122
|
+
const l = e.draw(), r = this.deleteItemCfg ?? this.addItemCfg;
|
|
2123
|
+
if (r) {
|
|
2124
|
+
const p = r.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
2125
|
+
p && t.startsWith(p) && this.addDeleteButtonToElement(l, t);
|
|
2112
2126
|
}
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2127
|
+
const h = o.querySelector(".sg-add-button-bottom");
|
|
2128
|
+
h ? o.insertBefore(l, h) : o.appendChild(l), mt.trackElement(l), Q(l, this.nestingLevel + 1), lt(l, this.nestingLevel + 1);
|
|
2129
|
+
const d = l.style.display;
|
|
2130
|
+
l.style.display = "none", l.offsetHeight, l.style.display = d, this.updateNestingStyles();
|
|
2117
2131
|
}
|
|
2118
2132
|
}
|
|
2119
2133
|
const i = this.getValues();
|
|
@@ -2432,10 +2446,10 @@ const ot = class ot {
|
|
|
2432
2446
|
</svg>`;
|
|
2433
2447
|
h.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (p) => {
|
|
2434
2448
|
p.stopPropagation(), p.preventDefault();
|
|
2435
|
-
const
|
|
2449
|
+
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(u);
|
|
2436
2450
|
if (vt(C)) {
|
|
2437
|
-
const
|
|
2438
|
-
this.addSetting(
|
|
2451
|
+
const m = `${this.addItemCfg.keyPrefix}${u}`;
|
|
2452
|
+
this.addSetting(m, C);
|
|
2439
2453
|
}
|
|
2440
2454
|
}), a.appendChild(h);
|
|
2441
2455
|
}
|
|
@@ -2618,16 +2632,16 @@ class H extends Kt {
|
|
|
2618
2632
|
draw() {
|
|
2619
2633
|
const t = document.createElement("div");
|
|
2620
2634
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
2621
|
-
const
|
|
2622
|
-
if (
|
|
2623
|
-
const
|
|
2624
|
-
|
|
2635
|
+
const m = document.createElement("div");
|
|
2636
|
+
if (m.className = "icon-container", this.props.icon) {
|
|
2637
|
+
const g = document.createElement("span");
|
|
2638
|
+
g.className = "input-icon", g.innerHTML = this.props.icon, m.appendChild(g);
|
|
2625
2639
|
}
|
|
2626
2640
|
if (this.props.title) {
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2641
|
+
const g = document.createElement("span");
|
|
2642
|
+
g.className = "input-label", g.textContent = this.props.title, m.appendChild(g);
|
|
2629
2643
|
}
|
|
2630
|
-
t.appendChild(
|
|
2644
|
+
t.appendChild(m);
|
|
2631
2645
|
}
|
|
2632
2646
|
const e = document.createElement("div");
|
|
2633
2647
|
e.className = "color-input-wrapper";
|
|
@@ -2645,41 +2659,41 @@ class H extends Kt {
|
|
|
2645
2659
|
try {
|
|
2646
2660
|
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !w) {
|
|
2647
2661
|
console.error("ColorSetting: Setting class is undefined");
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2662
|
+
const g = document.createElement("div");
|
|
2663
|
+
g.textContent = "Error: System error (Setting undefined)", a.appendChild(g);
|
|
2650
2664
|
return;
|
|
2651
2665
|
}
|
|
2652
|
-
const
|
|
2653
|
-
if (console.log("ColorSetting: GlobalVariables:",
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2666
|
+
const m = w.GlobalVariables || {};
|
|
2667
|
+
if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
|
|
2668
|
+
const g = document.createElement("div");
|
|
2669
|
+
g.textContent = "No global colors defined", g.style.gridColumn = "1 / -1", g.style.fontSize = "12px", g.style.color = "#666", a.appendChild(g);
|
|
2656
2670
|
return;
|
|
2657
2671
|
}
|
|
2658
|
-
Object.entries(
|
|
2672
|
+
Object.entries(m).forEach(([g, f]) => {
|
|
2659
2673
|
const v = document.createElement("button");
|
|
2660
|
-
v.className = "global-color-btn", v.title =
|
|
2674
|
+
v.className = "global-color-btn", v.title = g, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = f, v.style.cursor = "pointer", this.value === `var(--${g})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (y) => {
|
|
2661
2675
|
var k, x;
|
|
2662
2676
|
y.preventDefault();
|
|
2663
|
-
const b = `var(--${
|
|
2677
|
+
const b = `var(--${g})`;
|
|
2664
2678
|
this.value = b, (k = this.onChange) == null || k.call(this, b), (x = this.detectChange) == null || x.call(this, b), Array.from(a.children).forEach((E) => {
|
|
2665
2679
|
E.style.border = "1px solid #ddd";
|
|
2666
2680
|
}), v.style.border = "2px solid #2196f3", d.style.backgroundColor = f;
|
|
2667
2681
|
}), a.appendChild(v);
|
|
2668
2682
|
});
|
|
2669
|
-
} catch (
|
|
2670
|
-
console.error("ColorSetting: Error in renderGlobalOptions",
|
|
2683
|
+
} catch (m) {
|
|
2684
|
+
console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
|
|
2671
2685
|
}
|
|
2672
2686
|
};
|
|
2673
|
-
l(), s.addEventListener("click", (
|
|
2674
|
-
|
|
2675
|
-
}), n.addEventListener("click", (
|
|
2676
|
-
|
|
2687
|
+
l(), s.addEventListener("click", (m) => {
|
|
2688
|
+
m.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
2689
|
+
}), n.addEventListener("click", (m) => {
|
|
2690
|
+
m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
2677
2691
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
2678
|
-
const r = (
|
|
2679
|
-
const
|
|
2680
|
-
if (!
|
|
2692
|
+
const r = (m) => {
|
|
2693
|
+
const g = m.value.trim();
|
|
2694
|
+
if (!g)
|
|
2681
2695
|
return e.classList.remove("error"), !0;
|
|
2682
|
-
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(
|
|
2696
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(g);
|
|
2683
2697
|
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
2684
2698
|
}, h = document.createElement("input");
|
|
2685
2699
|
h.type = "color", h.className = "color-picker", h.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", h.setAttribute("aria-label", "Choose color"), h.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && h.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = h;
|
|
@@ -2687,40 +2701,40 @@ class H extends Kt {
|
|
|
2687
2701
|
d.className = "color-preview";
|
|
2688
2702
|
let p = this.value || "#000000";
|
|
2689
2703
|
if (p.startsWith("var(--")) {
|
|
2690
|
-
const
|
|
2691
|
-
p = (w.GlobalVariables || {})[
|
|
2704
|
+
const m = p.replace("var(--", "").replace(")", "");
|
|
2705
|
+
p = (w.GlobalVariables || {})[m] || "#000000";
|
|
2692
2706
|
}
|
|
2693
2707
|
d.style.backgroundColor = p;
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
const C = (
|
|
2708
|
+
const u = document.createElement("input");
|
|
2709
|
+
u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u;
|
|
2710
|
+
const C = (m) => {
|
|
2697
2711
|
var f, v;
|
|
2698
|
-
let
|
|
2699
|
-
if (
|
|
2700
|
-
const y = H.normalizeColorValue(
|
|
2712
|
+
let g = m.trim();
|
|
2713
|
+
if (g && !g.startsWith("#") && !g.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(g) && (g = "#" + g, this.textInputEl && (this.textInputEl.value = g)), this.textInputEl && r(this.textInputEl)) {
|
|
2714
|
+
const y = H.normalizeColorValue(g);
|
|
2701
2715
|
this.value = y, (f = this.onChange) == null || f.call(this, y), (v = this.detectChange) == null || v.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), d.style.backgroundColor = y;
|
|
2702
2716
|
}
|
|
2703
2717
|
};
|
|
2704
|
-
return this.textInputEl.addEventListener("input", (
|
|
2705
|
-
const
|
|
2706
|
-
C(
|
|
2707
|
-
}), this.textInputEl.addEventListener("paste", (
|
|
2718
|
+
return this.textInputEl.addEventListener("input", (m) => {
|
|
2719
|
+
const g = m.target.value;
|
|
2720
|
+
C(g);
|
|
2721
|
+
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
2708
2722
|
var f;
|
|
2709
|
-
|
|
2710
|
-
const
|
|
2711
|
-
this.textInputEl && (this.textInputEl.value =
|
|
2712
|
-
}), this.textInputEl.addEventListener("keydown", (
|
|
2713
|
-
var
|
|
2714
|
-
|
|
2715
|
-
}), this.colorInputEl.addEventListener("input", (
|
|
2723
|
+
m.preventDefault();
|
|
2724
|
+
const g = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
|
|
2725
|
+
this.textInputEl && (this.textInputEl.value = g.trim(), C(g));
|
|
2726
|
+
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
2727
|
+
var g, f, v;
|
|
2728
|
+
m.key === "Enter" && (m.preventDefault(), C(((g = this.textInputEl) == null ? void 0 : g.value) || ""), (f = this.textInputEl) == null || f.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (v = this.textInputEl) == null || v.blur(), e.classList.remove("error"));
|
|
2729
|
+
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
2716
2730
|
var v, y;
|
|
2717
|
-
const
|
|
2731
|
+
const g = m.target.value, f = H.normalizeColorValue(g);
|
|
2718
2732
|
this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f, e.classList.remove("error");
|
|
2719
|
-
}), this.colorInputEl.addEventListener("change", (
|
|
2733
|
+
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
2720
2734
|
var v, y;
|
|
2721
|
-
const
|
|
2735
|
+
const g = m.target.value, f = H.normalizeColorValue(g);
|
|
2722
2736
|
this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f;
|
|
2723
|
-
}), o.appendChild(h), o.appendChild(d), o.appendChild(
|
|
2737
|
+
}), o.appendChild(h), o.appendChild(d), o.appendChild(u), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
2724
2738
|
}
|
|
2725
2739
|
getElement() {
|
|
2726
2740
|
return this.element;
|
|
@@ -3521,7 +3535,7 @@ const st = `
|
|
|
3521
3535
|
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="4" viewBox="0 0 8 4" fill="none">
|
|
3522
3536
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 0L2.58579 2.58579C3.36684 3.36684 4.63317 3.36683 5.41421 2.58579L8 0L0 0Z" fill="#1C252E"/>
|
|
3523
3537
|
</svg>
|
|
3524
|
-
`,
|
|
3538
|
+
`, F = 10, bt = 5, Ee = 24, be = 50, we = 5e3, xe = 800, Le = 0.8, ke = 700, Me = [
|
|
3525
3539
|
"image/jpeg",
|
|
3526
3540
|
"image/jpg",
|
|
3527
3541
|
"image/png",
|
|
@@ -3883,7 +3897,7 @@ function Re(c, t) {
|
|
|
3883
3897
|
n.stopPropagation(), t();
|
|
3884
3898
|
}), i.appendChild(s), e.appendChild(i), e;
|
|
3885
3899
|
}
|
|
3886
|
-
function
|
|
3900
|
+
function Ge(c, t, e) {
|
|
3887
3901
|
if (c === "input") {
|
|
3888
3902
|
const i = document.createElement("label");
|
|
3889
3903
|
i.className = "image-map-upload-label", i.innerHTML = `
|
|
@@ -3914,7 +3928,7 @@ function Fe(c, t, e) {
|
|
|
3914
3928
|
}), i;
|
|
3915
3929
|
}
|
|
3916
3930
|
}
|
|
3917
|
-
function
|
|
3931
|
+
function Fe(c, t, e, i) {
|
|
3918
3932
|
const s = document.createElement("div");
|
|
3919
3933
|
s.className = "image-map-container", s.addEventListener("scroll", e.onScroll);
|
|
3920
3934
|
const n = document.createElement("div");
|
|
@@ -3983,7 +3997,7 @@ const A = class A extends w {
|
|
|
3983
3997
|
super(t), this.inputType = {
|
|
3984
3998
|
imageUrl: "text",
|
|
3985
3999
|
markers: "text"
|
|
3986
|
-
}, this.mainDisplayElements = null, this.popoverElements = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmModal = new Ne(), this.previousImageDimensions = null, this.draggingMarkerId = null, this.historyManager = new Ve(), this.isUndoRedoOperation = !1, this.initialValue = null, this.lastMouseX = 0, this.lastMouseY = 0, this.props.maxMarkers = this.props.maxMarkers ?? ((e = this.props.prizeMap) == null ? void 0 : e.length) ??
|
|
4000
|
+
}, this.mainDisplayElements = null, this.popoverElements = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmModal = new Ne(), this.previousImageDimensions = null, this.draggingMarkerId = null, this.historyManager = new Ve(), this.isUndoRedoOperation = !1, this.initialValue = null, this.lastMouseX = 0, this.lastMouseY = 0, this.props.maxMarkers = this.props.maxMarkers ?? ((e = this.props.prizeMap) == null ? void 0 : e.length) ?? F, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? bt, this.props.markerSize = this.props.markerSize ?? Ee, this.value || (this.value = { imageUrl: "", markers: [] }), Lt.registerHandler(this.id, (i) => {
|
|
3987
4001
|
this.handleFileManagerImageSelected(i);
|
|
3988
4002
|
}), this.onBackgroundClick = (i) => {
|
|
3989
4003
|
if (this.isPopoverOpen && this.popoverElements && !this.popoverElements.popover.contains(i.target)) {
|
|
@@ -4022,7 +4036,7 @@ const A = class A extends w {
|
|
|
4022
4036
|
() => {
|
|
4023
4037
|
this.value = { imageUrl: "", markers: [] }, this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange();
|
|
4024
4038
|
}
|
|
4025
|
-
), o = this.props.upload || "file-manager", a =
|
|
4039
|
+
), o = this.props.upload || "file-manager", a = Ge(
|
|
4026
4040
|
o,
|
|
4027
4041
|
(h) => this.handleImageUpload(h),
|
|
4028
4042
|
this.id
|
|
@@ -4053,7 +4067,7 @@ const A = class A extends w {
|
|
|
4053
4067
|
}
|
|
4054
4068
|
hasAllMarkers() {
|
|
4055
4069
|
if (!this.value) return !1;
|
|
4056
|
-
const t = this.props.maxMarkers ||
|
|
4070
|
+
const t = this.props.maxMarkers || F;
|
|
4057
4071
|
return this.value.markers.length === t;
|
|
4058
4072
|
}
|
|
4059
4073
|
hasChanges() {
|
|
@@ -4094,7 +4108,7 @@ const A = class A extends w {
|
|
|
4094
4108
|
canUndo: this.historyManager.canUndo(),
|
|
4095
4109
|
canRedo: this.historyManager.canRedo(),
|
|
4096
4110
|
markerCount: ((a = this.value) == null ? void 0 : a.markers.length) || 0,
|
|
4097
|
-
maxMarkers: this.props.maxMarkers ||
|
|
4111
|
+
maxMarkers: this.props.maxMarkers || F
|
|
4098
4112
|
},
|
|
4099
4113
|
{
|
|
4100
4114
|
onUndo: () => this.undo(),
|
|
@@ -4106,7 +4120,7 @@ const A = class A extends w {
|
|
|
4106
4120
|
r.className = "image-map-main-layout";
|
|
4107
4121
|
const h = document.createElement("div");
|
|
4108
4122
|
h.className = "image-map-image-section", this.cursorTooltip = new Pe();
|
|
4109
|
-
const { container: d, imageElement: p } =
|
|
4123
|
+
const { container: d, imageElement: p } = Fe(
|
|
4110
4124
|
this.value.imageUrl,
|
|
4111
4125
|
this.value.markers,
|
|
4112
4126
|
{
|
|
@@ -4124,28 +4138,28 @@ const A = class A extends w {
|
|
|
4124
4138
|
this.cursorTooltip
|
|
4125
4139
|
);
|
|
4126
4140
|
this.imageElement = p, h.appendChild(d);
|
|
4127
|
-
const
|
|
4128
|
-
|
|
4141
|
+
const u = document.createElement("div");
|
|
4142
|
+
u.className = "prize-list-section";
|
|
4129
4143
|
const C = He(
|
|
4130
4144
|
this.value.markers,
|
|
4131
|
-
this.props.maxMarkers ||
|
|
4145
|
+
this.props.maxMarkers || F,
|
|
4132
4146
|
this.props.prizeMap
|
|
4133
4147
|
);
|
|
4134
|
-
|
|
4135
|
-
const
|
|
4148
|
+
u.appendChild(C), r.appendChild(h), r.appendChild(u), t.appendChild(r);
|
|
4149
|
+
const m = We(
|
|
4136
4150
|
this.hasAllMarkers(),
|
|
4137
4151
|
() => this.handleClearAllMarkers(),
|
|
4138
4152
|
() => {
|
|
4139
4153
|
this.triggerChange(), this.closePopover(!0);
|
|
4140
4154
|
}
|
|
4141
4155
|
);
|
|
4142
|
-
t.appendChild(
|
|
4143
|
-
const
|
|
4156
|
+
t.appendChild(m);
|
|
4157
|
+
const g = h.querySelector(
|
|
4144
4158
|
".image-map-container"
|
|
4145
|
-
), f =
|
|
4159
|
+
), f = u.querySelector(
|
|
4146
4160
|
".simple-prize-list"
|
|
4147
4161
|
);
|
|
4148
|
-
|
|
4162
|
+
g && (g.scrollTop = s), f && (f.scrollTop = n), this.updateCursorTooltipContent();
|
|
4149
4163
|
} else {
|
|
4150
4164
|
const l = Be({
|
|
4151
4165
|
uploadMethod: this.props.upload || "file-manager",
|
|
@@ -4230,9 +4244,9 @@ const A = class A extends w {
|
|
|
4230
4244
|
}
|
|
4231
4245
|
handleImageClick(t) {
|
|
4232
4246
|
if (this.draggingMarkerId !== null || !this.value || !this.imageElement) return;
|
|
4233
|
-
if (this.value.markers.length >= (this.props.maxMarkers ||
|
|
4247
|
+
if (this.value.markers.length >= (this.props.maxMarkers || F)) {
|
|
4234
4248
|
U.show(
|
|
4235
|
-
`Maximum of ${this.props.maxMarkers ||
|
|
4249
|
+
`Maximum of ${this.props.maxMarkers || F} markers allowed.`
|
|
4236
4250
|
);
|
|
4237
4251
|
return;
|
|
4238
4252
|
}
|
|
@@ -4291,7 +4305,7 @@ const A = class A extends w {
|
|
|
4291
4305
|
}
|
|
4292
4306
|
updateCursorTooltipContent() {
|
|
4293
4307
|
if (!this.cursorTooltip || !this.value) return;
|
|
4294
|
-
const t = this.props.maxMarkers ||
|
|
4308
|
+
const t = this.props.maxMarkers || F;
|
|
4295
4309
|
if (this.cursorTooltip.shouldShow(this.value.markers.length, t)) {
|
|
4296
4310
|
const e = Ie(
|
|
4297
4311
|
this.value.markers,
|
|
@@ -4415,9 +4429,11 @@ class ui extends w {
|
|
|
4415
4429
|
}
|
|
4416
4430
|
createOption(t, e) {
|
|
4417
4431
|
const i = document.createElement("li");
|
|
4418
|
-
i.classList.add("select-api-option"), i.
|
|
4432
|
+
i.classList.add("select-api-option"), i.dataset.index = String(e);
|
|
4419
4433
|
const s = document.createElement("input");
|
|
4420
|
-
|
|
4434
|
+
s.type = "radio", s.classList.add("select-api-radio"), s.name = "select-api-radio-group", this.selectedOptionIndex === e && (s.checked = !0);
|
|
4435
|
+
const n = document.createElement("span");
|
|
4436
|
+
return n.classList.add("select-api-option-text"), n.textContent = t.name, i.appendChild(s), i.appendChild(n), i;
|
|
4421
4437
|
}
|
|
4422
4438
|
draw() {
|
|
4423
4439
|
const t = document.createElement("div");
|
|
@@ -4724,12 +4740,12 @@ class Ci extends w {
|
|
|
4724
4740
|
return;
|
|
4725
4741
|
}
|
|
4726
4742
|
const h = "...";
|
|
4727
|
-
let d = 0, p = e.length,
|
|
4743
|
+
let d = 0, p = e.length, u = 0;
|
|
4728
4744
|
for (; d <= p; ) {
|
|
4729
|
-
const
|
|
4730
|
-
this.measureTextWidth(
|
|
4745
|
+
const m = Math.floor((d + p) / 2), g = e.slice(0, m).trimEnd() + h;
|
|
4746
|
+
this.measureTextWidth(g, i) <= l ? (u = m, d = m + 1) : p = m - 1;
|
|
4731
4747
|
}
|
|
4732
|
-
const C = e.slice(0,
|
|
4748
|
+
const C = e.slice(0, u).trimEnd() + h;
|
|
4733
4749
|
t.placeholder = C;
|
|
4734
4750
|
}
|
|
4735
4751
|
autosizeTextarea(t, e = 3) {
|