builder-settings-types 0.0.387 → 0.0.388
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.
|
@@ -280,9 +280,9 @@ const pt = (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, u = d.clientY - n, C = window.innerWidth,
|
|
283
|
+
const p = d.clientX - s, u = d.clientY - n, C = window.innerWidth, m = window.innerHeight, g = t.offsetWidth, f = t.offsetHeight;
|
|
284
284
|
let v = o + p, y = a + u;
|
|
285
|
-
v = Math.max(8, Math.min(C -
|
|
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
|
};
|
|
@@ -652,8 +652,8 @@ const ut = (c, t) => {
|
|
|
652
652
|
const u = Ut(d);
|
|
653
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 = V(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
659
|
p.addEventListener("mouseenter", () => o(p, u)), p.addEventListener("mouseleave", () => {
|
|
@@ -771,22 +771,22 @@ class Zt {
|
|
|
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");
|
|
@@ -797,14 +797,14 @@ class Zt {
|
|
|
797
797
|
var v;
|
|
798
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
799
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
800
|
-
const
|
|
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
805
|
let u = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
806
806
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
807
|
-
const C = u * 360,
|
|
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;
|
|
@@ -908,8 +908,8 @@ class Zt {
|
|
|
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
910
|
let u = r.right + 8, C = r.top;
|
|
911
|
-
const
|
|
912
|
-
|
|
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
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
|
}
|
|
@@ -974,10 +974,10 @@ class Jt {
|
|
|
974
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 g = document.createElement("option");
|
|
978
|
-
g.value = "rgb", g.textContent = "RGB";
|
|
979
977
|
const m = document.createElement("option");
|
|
980
|
-
m.value = "
|
|
978
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
979
|
+
const g = document.createElement("option");
|
|
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");
|
|
@@ -987,36 +987,36 @@ class Jt {
|
|
|
987
987
|
}
|
|
988
988
|
bind(t, e, i, s, n, o, a) {
|
|
989
989
|
const l = (p, u) => {
|
|
990
|
-
const C = u || t.getBoundingClientRect(),
|
|
991
|
-
this.colorMarker.style.left = `${
|
|
992
|
-
const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = Z(v,
|
|
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
994
|
}, r = (p, u) => {
|
|
995
|
-
const C = u || e.getBoundingClientRect(),
|
|
996
|
-
this.hueMarker.style.left = `${
|
|
997
|
-
const
|
|
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(${
|
|
999
|
+
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
1000
1000
|
}, h = (p, u) => {
|
|
1001
|
-
const C = u || i.getBoundingClientRect(),
|
|
1002
|
-
this.opacityMarker.style.left = `${
|
|
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
1003
|
}, d = (p, u, C) => {
|
|
1004
1004
|
p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), u(p, this.cachedRect);
|
|
1005
|
-
let
|
|
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);
|
|
@@ -1432,21 +1432,21 @@ const P = class P extends w {
|
|
|
1432
1432
|
let p = {};
|
|
1433
1433
|
try {
|
|
1434
1434
|
p = w.GlobalVariables || {};
|
|
1435
|
-
} catch (
|
|
1436
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
1435
|
+
} catch (g) {
|
|
1436
|
+
console.warn("Could not access Setting.GlobalVariables", g);
|
|
1437
1437
|
}
|
|
1438
1438
|
if (!p || Object.keys(p).length === 0) {
|
|
1439
|
-
const
|
|
1440
|
-
|
|
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);
|
|
1441
1441
|
return;
|
|
1442
1442
|
}
|
|
1443
1443
|
const u = w.GlobalVariableGroups || [
|
|
1444
1444
|
{ title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
|
|
1445
1445
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
1446
1446
|
], C = this.globalSearchQuery.toLowerCase();
|
|
1447
|
-
let
|
|
1448
|
-
this.globalLayoutMode === "list" ? (
|
|
1449
|
-
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));
|
|
1450
1450
|
f.length !== 0 && f.forEach(([v, y]) => {
|
|
1451
1451
|
if (this.globalLayoutMode === "list") {
|
|
1452
1452
|
const b = document.createElement("div");
|
|
@@ -1460,7 +1460,7 @@ const P = class P extends w {
|
|
|
1460
1460
|
S.preventDefault();
|
|
1461
1461
|
const G = `var(--${v})`;
|
|
1462
1462
|
this.setValue(G), this.pendingSolidColor = G, i(d);
|
|
1463
|
-
}),
|
|
1463
|
+
}), m.appendChild(b);
|
|
1464
1464
|
} else {
|
|
1465
1465
|
const b = document.createElement("div");
|
|
1466
1466
|
b.className = "global-color-circle";
|
|
@@ -1469,7 +1469,7 @@ const P = class P extends w {
|
|
|
1469
1469
|
E.preventDefault();
|
|
1470
1470
|
const L = `var(--${v})`;
|
|
1471
1471
|
this.setValue(L), this.pendingSolidColor = L, i(d);
|
|
1472
|
-
}),
|
|
1472
|
+
}), m.appendChild(b);
|
|
1473
1473
|
}
|
|
1474
1474
|
});
|
|
1475
1475
|
});
|
|
@@ -1527,35 +1527,35 @@ const P = class P extends w {
|
|
|
1527
1527
|
const C = document.createElement("button");
|
|
1528
1528
|
C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = zt, d.addEventListener("change", () => {
|
|
1529
1529
|
this.clearGlobalBindingForCustomChange(), this.switchType(d.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
|
|
1530
|
-
}), e.addEventListener("focus", (
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
}), 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) => {
|
|
1534
1534
|
this.clearGlobalBindingForCustomChange();
|
|
1535
|
-
const
|
|
1536
|
-
!Number.isNaN(
|
|
1537
|
-
}), 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) => {
|
|
1538
1538
|
var v;
|
|
1539
1539
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1540
|
-
const
|
|
1541
|
-
let f = parseInt(
|
|
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),
|
|
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();
|
|
1543
1543
|
}), C.addEventListener("click", () => {
|
|
1544
|
-
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((
|
|
1545
|
-
|
|
1546
|
-
}), 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());
|
|
1547
1547
|
}), h.appendChild(d), h.appendChild(e), h.appendChild(C), t.appendChild(h), this.updateDegreeVisibility(e);
|
|
1548
1548
|
}
|
|
1549
1549
|
const i = document.createElement("div");
|
|
1550
1550
|
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
1551
1551
|
const s = document.createElement("div");
|
|
1552
1552
|
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i), i.addEventListener("click", (h) => {
|
|
1553
|
-
var
|
|
1553
|
+
var m;
|
|
1554
1554
|
const d = h.target;
|
|
1555
1555
|
if (d.classList.contains("gstop-handle") || d.classList.contains("gstop-chip"))
|
|
1556
1556
|
return;
|
|
1557
1557
|
const p = i.getBoundingClientRect(), C = (h.clientX - p.left) / p.width * 100;
|
|
1558
|
-
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();
|
|
1559
1559
|
});
|
|
1560
1560
|
const n = document.createElement("div");
|
|
1561
1561
|
n.className = "gradient-stops-header";
|
|
@@ -1603,25 +1603,25 @@ const P = class P extends w {
|
|
|
1603
1603
|
const a = this.resolveGlobalVarColor(i.color);
|
|
1604
1604
|
o.style.backgroundColor = a, n.appendChild(o);
|
|
1605
1605
|
let l = !1, r = !1, h = 0, d = 0;
|
|
1606
|
-
const p = (
|
|
1607
|
-
l = !0, r = !1, h =
|
|
1608
|
-
}, u = (
|
|
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) => {
|
|
1609
1609
|
if (!l || !this.value) return;
|
|
1610
|
-
const
|
|
1611
|
-
if (Math.abs(
|
|
1610
|
+
const g = m.clientX - h;
|
|
1611
|
+
if (Math.abs(g) > 3 && (r = !0), r) {
|
|
1612
1612
|
this.clearGlobalBindingForCustomChange();
|
|
1613
1613
|
const f = e.getBoundingClientRect();
|
|
1614
|
-
let v = d +
|
|
1614
|
+
let v = d + g / f.width * 100;
|
|
1615
1615
|
v = Math.max(0, Math.min(100, v)), this.value.stops[s].position = Math.round(v), n.style.left = `${v}%`, this.updateGradientPreview();
|
|
1616
1616
|
}
|
|
1617
|
-
}, C = (
|
|
1618
|
-
var
|
|
1617
|
+
}, C = (m) => {
|
|
1618
|
+
var g;
|
|
1619
1619
|
if (l)
|
|
1620
1620
|
if (l = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", C), r)
|
|
1621
1621
|
this.value && (this.value.stops.sort((f, v) => f.position - v.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
1622
1622
|
else {
|
|
1623
|
-
|
|
1624
|
-
const f = (
|
|
1623
|
+
m.stopPropagation();
|
|
1624
|
+
const f = (g = this.value) == null ? void 0 : g.stops[s];
|
|
1625
1625
|
f && setTimeout(() => {
|
|
1626
1626
|
const v = this.getSharedStopColorPicker();
|
|
1627
1627
|
v.getIsOpen() && v.close(!1), this.colorPickerStopIndex = s, v.setOnChange((b, k) => {
|
|
@@ -1656,16 +1656,16 @@ const P = class P extends w {
|
|
|
1656
1656
|
u.type = "button", u.className = "gstop-color-copy", u.textContent = "Copy", r.appendChild(d), r.appendChild(p), r.appendChild(u);
|
|
1657
1657
|
const C = document.createElement("button");
|
|
1658
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);
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
const
|
|
1662
|
-
|
|
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";
|
|
1663
1663
|
const f = document.createElement("input");
|
|
1664
1664
|
f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
|
|
1665
1665
|
const v = N(h);
|
|
1666
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)`);
|
|
1667
1667
|
const y = document.createElement("span");
|
|
1668
|
-
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) => {
|
|
1669
1669
|
x.preventDefault(), x.stopPropagation();
|
|
1670
1670
|
const E = this.getSharedStopColorPicker();
|
|
1671
1671
|
E.getIsOpen() && E.close(!1), this.colorPickerStopIndex = n, E.setOnChange((S, G) => {
|
|
@@ -2448,8 +2448,8 @@ const ot = class ot {
|
|
|
2448
2448
|
p.stopPropagation(), p.preventDefault();
|
|
2449
2449
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(u);
|
|
2450
2450
|
if (ft(C)) {
|
|
2451
|
-
const
|
|
2452
|
-
this.addSetting(
|
|
2451
|
+
const m = `${this.addItemCfg.keyPrefix}${u}`;
|
|
2452
|
+
this.addSetting(m, C);
|
|
2453
2453
|
}
|
|
2454
2454
|
}), a.appendChild(h);
|
|
2455
2455
|
}
|
|
@@ -2632,16 +2632,16 @@ class H extends Kt {
|
|
|
2632
2632
|
draw() {
|
|
2633
2633
|
const t = document.createElement("div");
|
|
2634
2634
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
2635
|
-
const
|
|
2636
|
-
if (
|
|
2637
|
-
const
|
|
2638
|
-
|
|
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);
|
|
2639
2639
|
}
|
|
2640
2640
|
if (this.props.title) {
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2641
|
+
const g = document.createElement("span");
|
|
2642
|
+
g.className = "input-label", g.textContent = this.props.title, m.appendChild(g);
|
|
2643
2643
|
}
|
|
2644
|
-
t.appendChild(
|
|
2644
|
+
t.appendChild(m);
|
|
2645
2645
|
}
|
|
2646
2646
|
const e = document.createElement("div");
|
|
2647
2647
|
e.className = "color-input-wrapper";
|
|
@@ -2659,41 +2659,41 @@ class H extends Kt {
|
|
|
2659
2659
|
try {
|
|
2660
2660
|
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !w) {
|
|
2661
2661
|
console.error("ColorSetting: Setting class is undefined");
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2662
|
+
const g = document.createElement("div");
|
|
2663
|
+
g.textContent = "Error: System error (Setting undefined)", a.appendChild(g);
|
|
2664
2664
|
return;
|
|
2665
2665
|
}
|
|
2666
|
-
const
|
|
2667
|
-
if (console.log("ColorSetting: GlobalVariables:",
|
|
2668
|
-
const
|
|
2669
|
-
|
|
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);
|
|
2670
2670
|
return;
|
|
2671
2671
|
}
|
|
2672
|
-
Object.entries(
|
|
2672
|
+
Object.entries(m).forEach(([g, f]) => {
|
|
2673
2673
|
const v = document.createElement("button");
|
|
2674
|
-
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) => {
|
|
2675
2675
|
var k, x;
|
|
2676
2676
|
y.preventDefault();
|
|
2677
|
-
const b = `var(--${
|
|
2677
|
+
const b = `var(--${g})`;
|
|
2678
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) => {
|
|
2679
2679
|
E.style.border = "1px solid #ddd";
|
|
2680
2680
|
}), v.style.border = "2px solid #2196f3", d.style.backgroundColor = f;
|
|
2681
2681
|
}), a.appendChild(v);
|
|
2682
2682
|
});
|
|
2683
|
-
} catch (
|
|
2684
|
-
console.error("ColorSetting: Error in renderGlobalOptions",
|
|
2683
|
+
} catch (m) {
|
|
2684
|
+
console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
|
|
2685
2685
|
}
|
|
2686
2686
|
};
|
|
2687
|
-
l(), s.addEventListener("click", (
|
|
2688
|
-
|
|
2689
|
-
}), n.addEventListener("click", (
|
|
2690
|
-
|
|
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();
|
|
2691
2691
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
2692
|
-
const r = (
|
|
2693
|
-
const
|
|
2694
|
-
if (!
|
|
2692
|
+
const r = (m) => {
|
|
2693
|
+
const g = m.value.trim();
|
|
2694
|
+
if (!g)
|
|
2695
2695
|
return e.classList.remove("error"), !0;
|
|
2696
|
-
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);
|
|
2697
2697
|
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
2698
2698
|
}, h = document.createElement("input");
|
|
2699
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;
|
|
@@ -2701,38 +2701,38 @@ class H extends Kt {
|
|
|
2701
2701
|
d.className = "color-preview";
|
|
2702
2702
|
let p = this.value || "#000000";
|
|
2703
2703
|
if (p.startsWith("var(--")) {
|
|
2704
|
-
const
|
|
2705
|
-
p = (w.GlobalVariables || {})[
|
|
2704
|
+
const m = p.replace("var(--", "").replace(")", "");
|
|
2705
|
+
p = (w.GlobalVariables || {})[m] || "#000000";
|
|
2706
2706
|
}
|
|
2707
2707
|
d.style.backgroundColor = p;
|
|
2708
2708
|
const u = document.createElement("input");
|
|
2709
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 = (
|
|
2710
|
+
const C = (m) => {
|
|
2711
2711
|
var f, v;
|
|
2712
|
-
let
|
|
2713
|
-
if (
|
|
2714
|
-
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);
|
|
2715
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;
|
|
2716
2716
|
}
|
|
2717
2717
|
};
|
|
2718
|
-
return this.textInputEl.addEventListener("input", (
|
|
2719
|
-
const
|
|
2720
|
-
C(
|
|
2721
|
-
}), 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) => {
|
|
2722
2722
|
var f;
|
|
2723
|
-
|
|
2724
|
-
const
|
|
2725
|
-
this.textInputEl && (this.textInputEl.value =
|
|
2726
|
-
}), this.textInputEl.addEventListener("keydown", (
|
|
2727
|
-
var
|
|
2728
|
-
|
|
2729
|
-
}), 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) => {
|
|
2730
2730
|
var v, y;
|
|
2731
|
-
const
|
|
2731
|
+
const g = m.target.value, f = H.normalizeColorValue(g);
|
|
2732
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");
|
|
2733
|
-
}), this.colorInputEl.addEventListener("change", (
|
|
2733
|
+
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
2734
2734
|
var v, y;
|
|
2735
|
-
const
|
|
2735
|
+
const g = m.target.value, f = H.normalizeColorValue(g);
|
|
2736
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;
|
|
2737
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;
|
|
2738
2738
|
}
|
|
@@ -4149,20 +4149,20 @@ const je = `<svg xmlns="http://www.w3.org/2000/svg" width="8" height="4" viewBox
|
|
|
4149
4149
|
this.props.prizeMap
|
|
4150
4150
|
);
|
|
4151
4151
|
u.appendChild(C), r.appendChild(h), r.appendChild(u), t.appendChild(r);
|
|
4152
|
-
const
|
|
4152
|
+
const m = We(
|
|
4153
4153
|
this.hasAllMarkers(),
|
|
4154
4154
|
() => this.handleClearAllMarkers(),
|
|
4155
4155
|
() => {
|
|
4156
4156
|
this.triggerChange(), this.closePopover(!0);
|
|
4157
4157
|
}
|
|
4158
4158
|
);
|
|
4159
|
-
t.appendChild(
|
|
4160
|
-
const
|
|
4159
|
+
t.appendChild(m);
|
|
4160
|
+
const g = h.querySelector(
|
|
4161
4161
|
".image-map-container"
|
|
4162
4162
|
), f = u.querySelector(
|
|
4163
4163
|
".simple-prize-list"
|
|
4164
4164
|
);
|
|
4165
|
-
|
|
4165
|
+
g && (g.scrollTop = s), f && (f.scrollTop = n), this.updateCursorTooltipContent();
|
|
4166
4166
|
} else {
|
|
4167
4167
|
const l = Be({
|
|
4168
4168
|
uploadMethod: this.props.upload || "file-manager",
|
|
@@ -4745,7 +4745,7 @@ class yi extends w {
|
|
|
4745
4745
|
constructor(t) {
|
|
4746
4746
|
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), this.popup = null;
|
|
4747
4747
|
const e = window;
|
|
4748
|
-
e.textElementListeners || (e.textElementListeners = /* @__PURE__ */ new Map()), window.test = window.test || [], test.push(this), t.default ? this.value = t.default : this.value || (this.value = {});
|
|
4748
|
+
e.textElementListeners || (e.textElementListeners = /* @__PURE__ */ new Map()), window.test = window.test || [], test.push(this), t.default ? this.value = t.default : this.value || (this.value = {}), this.value.$id = this.$id = dt();
|
|
4749
4749
|
const i = w.HasExplicitCurrentLanguage(), s = i ? w.CurrentLanguage() : "", n = w.DefaultLanguage;
|
|
4750
4750
|
this.defaultLanguage = i && s && t.languages.includes(s) ? s : n && t.languages.includes(n) ? n : t.languages[0];
|
|
4751
4751
|
const o = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
@@ -4780,8 +4780,8 @@ class yi extends w {
|
|
|
4780
4780
|
const h = "...";
|
|
4781
4781
|
let d = 0, p = e.length, u = 0;
|
|
4782
4782
|
for (; d <= p; ) {
|
|
4783
|
-
const
|
|
4784
|
-
this.measureTextWidth(
|
|
4783
|
+
const m = Math.floor((d + p) / 2), g = e.slice(0, m).trimEnd() + h;
|
|
4784
|
+
this.measureTextWidth(g, i) <= l ? (u = m, d = m + 1) : p = m - 1;
|
|
4785
4785
|
}
|
|
4786
4786
|
const C = e.slice(0, u).trimEnd() + h;
|
|
4787
4787
|
t.placeholder = C;
|
|
@@ -4945,7 +4945,6 @@ class yi extends w {
|
|
|
4945
4945
|
this.popup && (document.body.removeChild(this.popup), this.popup = null);
|
|
4946
4946
|
}
|
|
4947
4947
|
draw() {
|
|
4948
|
-
var l, r;
|
|
4949
4948
|
const t = document.createElement("div");
|
|
4950
4949
|
t.classList.add("simple-multi-language-wrapper");
|
|
4951
4950
|
const e = document.createElement("div");
|
|
@@ -4976,36 +4975,32 @@ class yi extends w {
|
|
|
4976
4975
|
s.style.color = "#000";
|
|
4977
4976
|
}), s.addEventListener("mouseleave", () => {
|
|
4978
4977
|
s.style.color = "#666";
|
|
4979
|
-
}), s.addEventListener("click", (
|
|
4980
|
-
|
|
4978
|
+
}), s.addEventListener("click", (l) => {
|
|
4979
|
+
l.preventDefault(), this.showPopup();
|
|
4981
4980
|
});
|
|
4982
|
-
const n =
|
|
4983
|
-
|
|
4984
|
-
const h =
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
};
|
|
4989
|
-
window.addEventListener("message", h), n.set(this.id, h);
|
|
4990
|
-
}
|
|
4991
|
-
e.appendChild(i), e.appendChild(s), t.appendChild(e);
|
|
4981
|
+
const n = (l) => {
|
|
4982
|
+
var d, p;
|
|
4983
|
+
const { type: r, data: h } = l.data || {};
|
|
4984
|
+
r === "TEXT_ELEMENT_CLICKED" && h.$id && (console.log((d = this.value) == null ? void 0 : d.$id), (h == null ? void 0 : h.$id) === ((p = this.value) == null ? void 0 : p.$id) && this.showPopup());
|
|
4985
|
+
};
|
|
4986
|
+
window.addEventListener("message", n), e.appendChild(i), e.appendChild(s), t.appendChild(e);
|
|
4992
4987
|
const o = document.createElement("div");
|
|
4993
|
-
o.classList.add("simple-multi-language-content"), t.appendChild(o), this.container = t, this.renderContent(t), this.languageChangeUnsubscribe = w.onLanguageChange((
|
|
4994
|
-
|
|
4988
|
+
o.classList.add("simple-multi-language-content"), t.appendChild(o), this.container = t, this.renderContent(t), this.languageChangeUnsubscribe = w.onLanguageChange((l) => {
|
|
4989
|
+
l && this.props.languages.includes(l) && (this.defaultLanguage = l), this.container && this.renderContent(this.container);
|
|
4995
4990
|
});
|
|
4996
4991
|
const a = () => {
|
|
4997
4992
|
if (!this.container) return;
|
|
4998
4993
|
this.container.querySelectorAll(
|
|
4999
4994
|
".simple-language-textarea"
|
|
5000
|
-
).forEach((
|
|
5001
|
-
const
|
|
5002
|
-
|
|
4995
|
+
).forEach((r) => {
|
|
4996
|
+
const h = r.getAttribute("data-full-placeholder") || "";
|
|
4997
|
+
h && this.adaptPlaceholderToSingleLine(r, h);
|
|
5003
4998
|
});
|
|
5004
4999
|
};
|
|
5005
5000
|
return window.addEventListener("resize", a), t;
|
|
5006
5001
|
}
|
|
5007
5002
|
setValue(t) {
|
|
5008
|
-
super.setValue(t), this.
|
|
5003
|
+
super.setValue(t), this.container && this.props.languages.forEach((e) => {
|
|
5009
5004
|
var i;
|
|
5010
5005
|
if (this.props.multiImg) {
|
|
5011
5006
|
const s = this.uploadSettings.get(e);
|
|
@@ -16,6 +16,7 @@ export declare class MultiLanguageSetting extends Setting<MultiLanguageValue, Mu
|
|
|
16
16
|
private uploadSettings;
|
|
17
17
|
private languageChangeUnsubscribe?;
|
|
18
18
|
private popup;
|
|
19
|
+
$id: any;
|
|
19
20
|
private capitalizeFirstLetter;
|
|
20
21
|
private textMeasureCanvas?;
|
|
21
22
|
private measureTextWidth;
|
package/package.json
CHANGED