builder-settings-types 0.0.343 → 0.0.356
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 +34 -32
- package/dist/builder-settings-types.es.js +458 -406
- 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/settings/image-map-settings/ImageMapSetting.d.ts +5 -0
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/package.json +1 -2
|
@@ -142,29 +142,29 @@ function At(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const I = class I {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || Mt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, I.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, I.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
static CurrentLanguage(t) {
|
|
156
|
-
return t !== void 0 && (
|
|
156
|
+
return t !== void 0 && (I.currentLanguage = t, I.currentLanguageExplicitlySet = !0, I.DefaultLanguage || I.SetDefaultLanguage(t), I.languageChangeCallbacks.forEach((e) => e(t))), I.currentLanguage || I.DefaultLanguage;
|
|
157
157
|
}
|
|
158
158
|
static HasExplicitCurrentLanguage() {
|
|
159
|
-
return
|
|
159
|
+
return I.currentLanguageExplicitlySet;
|
|
160
160
|
}
|
|
161
161
|
static onLanguageChange(t) {
|
|
162
|
-
return
|
|
163
|
-
|
|
162
|
+
return I.languageChangeCallbacks.add(t), () => {
|
|
163
|
+
I.languageChangeCallbacks.delete(t);
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
static SetGlobalVariables(t) {
|
|
167
|
-
|
|
167
|
+
I.GlobalVariables = { ...I.GlobalVariables, ...t };
|
|
168
168
|
}
|
|
169
169
|
destroy() {
|
|
170
170
|
throw new Error("Method not implemented.");
|
|
@@ -247,21 +247,21 @@ const S = class S {
|
|
|
247
247
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
|
-
|
|
250
|
+
I.currentLanguageExplicitlySet = !1, I.languageChangeCallbacks = /* @__PURE__ */ new Set(), I.GlobalVariables = {
|
|
251
251
|
primary: "#1B1958",
|
|
252
252
|
secondary: "#0D0938",
|
|
253
253
|
tertiary: "#2A1560",
|
|
254
254
|
accent: "#189541",
|
|
255
255
|
"text-dark": "#00141E",
|
|
256
256
|
"text-light": "#FFFFFF"
|
|
257
|
-
},
|
|
257
|
+
}, I.GlobalVariableGroups = [
|
|
258
258
|
{
|
|
259
259
|
title: "Global Colors",
|
|
260
260
|
keys: ["primary", "secondary", "tertiary", "accent"]
|
|
261
261
|
},
|
|
262
262
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
263
263
|
];
|
|
264
|
-
let w =
|
|
264
|
+
let w = I;
|
|
265
265
|
function R(c) {
|
|
266
266
|
return c instanceof w;
|
|
267
267
|
}
|
|
@@ -280,14 +280,14 @@ 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
|
};
|
|
289
289
|
c.addEventListener("mousedown", l);
|
|
290
|
-
},
|
|
290
|
+
}, U = (c) => {
|
|
291
291
|
if (!c) return null;
|
|
292
292
|
let t = c.trim();
|
|
293
293
|
return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
|
|
@@ -312,7 +312,7 @@ const dt = (c, t, e) => {
|
|
|
312
312
|
Math.round((l + o) * 255),
|
|
313
313
|
Math.round((r + o) * 255)
|
|
314
314
|
);
|
|
315
|
-
},
|
|
315
|
+
}, It = (c, t, e) => {
|
|
316
316
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
317
317
|
return { hue: c, sat: s, lightness: i };
|
|
318
318
|
}, rt = (c, t, e) => {
|
|
@@ -355,7 +355,7 @@ const dt = (c, t, e) => {
|
|
|
355
355
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
const i =
|
|
358
|
+
const i = U(c);
|
|
359
359
|
if (i) {
|
|
360
360
|
const { r: s, g: n, b: o } = N(i);
|
|
361
361
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
@@ -385,14 +385,14 @@ const dt = (c, t, e) => {
|
|
|
385
385
|
"teal",
|
|
386
386
|
"fuchsia",
|
|
387
387
|
"transparent"
|
|
388
|
-
].includes(c.toLowerCase()),
|
|
388
|
+
].includes(c.toLowerCase()), St = (c) => [
|
|
389
389
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
390
390
|
/^rgba?\s*\([^)]+\)$/,
|
|
391
391
|
/^hsla?\s*\([^)]+\)$/,
|
|
392
392
|
/^[a-zA-Z]+$/
|
|
393
393
|
].some((e) => e.test(c.trim())), Rt = (c) => {
|
|
394
394
|
if (typeof document > "u")
|
|
395
|
-
return
|
|
395
|
+
return St(c) || !!U(c);
|
|
396
396
|
const t = document.createElement("div");
|
|
397
397
|
return t.style.color = c, t.style.color !== "";
|
|
398
398
|
}, Nt = (c) => {
|
|
@@ -431,7 +431,7 @@ const dt = (c, t, e) => {
|
|
|
431
431
|
opacity: Math.round(l * 100)
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
|
-
return { color:
|
|
434
|
+
return { color: U(t) || t, position: 0, opacity: 100 };
|
|
435
435
|
}, ft = (c) => {
|
|
436
436
|
const t = [];
|
|
437
437
|
let e = "", i = 0;
|
|
@@ -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",
|
|
@@ -474,7 +474,7 @@ const dt = (c, t, e) => {
|
|
|
474
474
|
if (!s) return;
|
|
475
475
|
let n = "", o = 0;
|
|
476
476
|
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
477
|
-
a &&
|
|
477
|
+
a && St(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
478
478
|
const l = Nt(n);
|
|
479
479
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
480
480
|
}), t;
|
|
@@ -489,7 +489,7 @@ const dt = (c, t, e) => {
|
|
|
489
489
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
490
490
|
}))
|
|
491
491
|
};
|
|
492
|
-
},
|
|
492
|
+
}, V = (c) => {
|
|
493
493
|
const t = c.replace(/;$/, "").trim();
|
|
494
494
|
if (Rt(t)) {
|
|
495
495
|
const s = Nt(t);
|
|
@@ -518,11 +518,11 @@ 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;
|
|
525
|
-
},
|
|
525
|
+
}, T = (c) => {
|
|
526
526
|
if (c.type === "solid") {
|
|
527
527
|
const e = c.stops[0], i = e.color;
|
|
528
528
|
if (i.startsWith("var(--"))
|
|
@@ -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
|
}
|
|
@@ -563,8 +563,8 @@ const dt = (c, t, e) => {
|
|
|
563
563
|
static normalizeList(t) {
|
|
564
564
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
565
565
|
return t.forEach((s) => {
|
|
566
|
-
let n =
|
|
567
|
-
n ||
|
|
566
|
+
let n = U(s);
|
|
567
|
+
n || V(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
568
568
|
}), i.slice(0, this.MAX_COLORS);
|
|
569
569
|
}
|
|
570
570
|
static ensureLoaded() {
|
|
@@ -609,11 +609,11 @@ const dt = (c, t, e) => {
|
|
|
609
609
|
}
|
|
610
610
|
static addColor(t, e) {
|
|
611
611
|
if (!t) return;
|
|
612
|
-
let i =
|
|
612
|
+
let i = U(t), s = "solid";
|
|
613
613
|
if (i)
|
|
614
614
|
s = "solid";
|
|
615
615
|
else {
|
|
616
|
-
const l =
|
|
616
|
+
const l = V(t);
|
|
617
617
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
618
618
|
}
|
|
619
619
|
if (!i) return;
|
|
@@ -622,7 +622,7 @@ const dt = (c, t, e) => {
|
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
624
|
X.STORAGE_KEY = "settingsLib_recentColors", X.MAX_COLORS = 18, X.colors = null;
|
|
625
|
-
let
|
|
625
|
+
let z = X;
|
|
626
626
|
const pt = (c, t) => {
|
|
627
627
|
const e = document.createElement("div");
|
|
628
628
|
e.className = "color-picker-recent-section";
|
|
@@ -641,7 +641,7 @@ const pt = (c, t) => {
|
|
|
641
641
|
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
642
642
|
const r = () => {
|
|
643
643
|
n(), a.innerHTML = "";
|
|
644
|
-
const h =
|
|
644
|
+
const h = z.getColors(t);
|
|
645
645
|
if (h.length === 0) {
|
|
646
646
|
a.style.display = "none", l.style.display = "block";
|
|
647
647
|
return;
|
|
@@ -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 = 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
|
-
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)";
|
|
@@ -671,20 +671,20 @@ const pt = (c, t) => {
|
|
|
671
671
|
};
|
|
672
672
|
return r(), { container: e, refresh: r };
|
|
673
673
|
}, Ut = (c) => {
|
|
674
|
-
const t =
|
|
674
|
+
const t = V(c);
|
|
675
675
|
if (t)
|
|
676
676
|
return et(t);
|
|
677
|
-
const e =
|
|
677
|
+
const e = U(c);
|
|
678
678
|
if (e) {
|
|
679
679
|
const i = N(e);
|
|
680
680
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
681
681
|
}
|
|
682
682
|
return c;
|
|
683
|
-
},
|
|
683
|
+
}, Tt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
684
684
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
685
685
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
686
686
|
fill="#919EAB"/>
|
|
687
|
-
</svg>`,
|
|
687
|
+
</svg>`, Pt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
688
688
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
689
689
|
</svg>`, zt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
690
690
|
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -747,7 +747,7 @@ class Zt {
|
|
|
747
747
|
const i = document.createElement("span");
|
|
748
748
|
i.textContent = "Color";
|
|
749
749
|
const s = document.createElement("button");
|
|
750
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
750
|
+
s.className = "color-picker-close", s.innerHTML = Tt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), dt(e, t);
|
|
751
751
|
const n = document.createElement("div");
|
|
752
752
|
n.className = "color-picker-area", this.colorArea = n;
|
|
753
753
|
const o = document.createElement("div");
|
|
@@ -755,7 +755,7 @@ class Zt {
|
|
|
755
755
|
const a = document.createElement("div");
|
|
756
756
|
a.className = "color-picker-sliders-container";
|
|
757
757
|
const l = document.createElement("button");
|
|
758
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
758
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Pt;
|
|
759
759
|
const r = document.createElement("div");
|
|
760
760
|
r.className = "color-picker-sliders-group";
|
|
761
761
|
const h = document.createElement("div");
|
|
@@ -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(
|
|
@@ -866,7 +866,7 @@ class Zt {
|
|
|
866
866
|
const { r: n, g: o, b: a } = N(this.currentColor);
|
|
867
867
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
868
868
|
} else {
|
|
869
|
-
const { hue: n, sat: o, lightness: a } =
|
|
869
|
+
const { hue: n, sat: o, lightness: a } = It(e, i, s);
|
|
870
870
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
871
871
|
o * 100
|
|
872
872
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -907,15 +907,15 @@ 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;
|
|
918
|
-
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (
|
|
918
|
+
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (z.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
919
919
|
}
|
|
920
920
|
setOnChange(t) {
|
|
921
921
|
this.onChange = t;
|
|
@@ -937,7 +937,7 @@ class Jt {
|
|
|
937
937
|
}
|
|
938
938
|
sanitizeColor(t) {
|
|
939
939
|
const e = this.currentColor || "#FFFFFF";
|
|
940
|
-
return
|
|
940
|
+
return U(t) ?? e;
|
|
941
941
|
}
|
|
942
942
|
clampOpacity(t) {
|
|
943
943
|
return Number.isFinite(t) ? Math.min(100, Math.max(0, Math.round(t))) : 100;
|
|
@@ -952,7 +952,7 @@ class Jt {
|
|
|
952
952
|
const s = document.createElement("div");
|
|
953
953
|
s.className = "color-picker-sliders-container embedded";
|
|
954
954
|
const n = document.createElement("button");
|
|
955
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
955
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Pt;
|
|
956
956
|
const o = document.createElement("div");
|
|
957
957
|
o.className = "color-picker-sliders-group";
|
|
958
958
|
const a = document.createElement("div");
|
|
@@ -964,59 +964,59 @@ class Jt {
|
|
|
964
964
|
const h = document.createElement("div");
|
|
965
965
|
h.className = "color-picker-opacity-marker", this.opacityMarker = h, r.appendChild(h), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
966
966
|
const d = pt((b) => {
|
|
967
|
-
const k =
|
|
967
|
+
const k = V(b);
|
|
968
968
|
k && k.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
969
969
|
}, "all");
|
|
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
|
});
|
|
@@ -1065,7 +1065,7 @@ class Jt {
|
|
|
1065
1065
|
const { r: n, g: o, b: a } = N(this.currentColor);
|
|
1066
1066
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
1067
1067
|
} else {
|
|
1068
|
-
const { hue: n, sat: o, lightness: a } =
|
|
1068
|
+
const { hue: n, sat: o, lightness: a } = It(e, i, s);
|
|
1069
1069
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
1070
1070
|
o * 100
|
|
1071
1071
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -1124,7 +1124,7 @@ class Jt {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
commitRecentColor() {
|
|
1126
1126
|
var t;
|
|
1127
|
-
this.recentScope === "solid" && (
|
|
1127
|
+
this.recentScope === "solid" && (z.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
1128
1128
|
}
|
|
1129
1129
|
getElement() {
|
|
1130
1130
|
return this.element;
|
|
@@ -1137,7 +1137,7 @@ class Jt {
|
|
|
1137
1137
|
this.initFromColor(t, e);
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
const
|
|
1140
|
+
const P = class P extends w {
|
|
1141
1141
|
constructor(t = {}) {
|
|
1142
1142
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
1143
1143
|
super({
|
|
@@ -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;
|
|
@@ -1221,7 +1221,7 @@ const V = class V extends w {
|
|
|
1221
1221
|
angle: 0,
|
|
1222
1222
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
1223
1223
|
});
|
|
1224
|
-
const i =
|
|
1224
|
+
const i = V(t);
|
|
1225
1225
|
if (i)
|
|
1226
1226
|
return D(i);
|
|
1227
1227
|
}
|
|
@@ -1240,7 +1240,7 @@ const V = class V extends w {
|
|
|
1240
1240
|
type: "solid",
|
|
1241
1241
|
angle: 0,
|
|
1242
1242
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
1243
|
-
}) : e =
|
|
1243
|
+
}) : e = V(t) : t && typeof t == "object" && (e = D(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
|
|
1244
1244
|
}
|
|
1245
1245
|
updateUI() {
|
|
1246
1246
|
if (this.previewEl && this.value)
|
|
@@ -1249,7 +1249,7 @@ const V = class V extends w {
|
|
|
1249
1249
|
this.previewEl.style.background = ct(i, e);
|
|
1250
1250
|
} else {
|
|
1251
1251
|
const t = this.resolveGradientGlobalVars(this.value);
|
|
1252
|
-
this.previewEl.style.background =
|
|
1252
|
+
this.previewEl.style.background = T(t);
|
|
1253
1253
|
}
|
|
1254
1254
|
if (this.inputEl && this.value && !this.isEditing)
|
|
1255
1255
|
if (this.isBoundToGlobal() && this.linkedGlobalVariable) {
|
|
@@ -1275,7 +1275,7 @@ const V = class V extends w {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
cssForTextValue() {
|
|
1277
1277
|
return this.value ? {
|
|
1278
|
-
background:
|
|
1278
|
+
background: T(this.value),
|
|
1279
1279
|
"-webkit-background-clip": "text",
|
|
1280
1280
|
"background-clip": "text",
|
|
1281
1281
|
color: "transparent",
|
|
@@ -1291,7 +1291,7 @@ const V = class V extends w {
|
|
|
1291
1291
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
1292
1292
|
}
|
|
1293
1293
|
const e = document.createElement("div");
|
|
1294
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
1294
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? T(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
1295
1295
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
1296
1296
|
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? et(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
1297
1297
|
if (this.isEditing = !0, this.value)
|
|
@@ -1307,11 +1307,11 @@ const V = class V extends w {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
1309
|
} else
|
|
1310
|
-
this.inputEl.value =
|
|
1310
|
+
this.inputEl.value = T(this.value);
|
|
1311
1311
|
}), this.inputEl.addEventListener("blur", () => {
|
|
1312
1312
|
this.isEditing = !1, this.value && (this.inputEl.value = et(this.value));
|
|
1313
1313
|
}), this.inputEl.addEventListener("paste", (i) => this.handlePaste(i)), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
1314
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
1314
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = T(this.value)), this.inputEl.blur());
|
|
1315
1315
|
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = qt, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
1316
1316
|
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
1317
1317
|
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
@@ -1335,7 +1335,7 @@ const V = class V extends w {
|
|
|
1335
1335
|
t.appendChild(l);
|
|
1336
1336
|
}
|
|
1337
1337
|
const i = document.createElement("button");
|
|
1338
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
1338
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = Tt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), dt(t, this.popoverEl, (l, r) => {
|
|
1339
1339
|
this.popoverPosition = { left: l, top: r };
|
|
1340
1340
|
});
|
|
1341
1341
|
const s = document.createElement("div");
|
|
@@ -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 = V(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");
|
|
@@ -1443,11 +1456,11 @@ const V = class V extends w {
|
|
|
1443
1456
|
const x = this.resolveGlobalVarColor(y);
|
|
1444
1457
|
k.style.background = x, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && k.classList.add("selected");
|
|
1445
1458
|
const L = document.createElement("span");
|
|
1446
|
-
L.className = "global-color-label", L.textContent = v.split("-").map((
|
|
1447
|
-
|
|
1448
|
-
const
|
|
1449
|
-
this.setValue(
|
|
1450
|
-
}),
|
|
1459
|
+
L.className = "global-color-label", L.textContent = v.split("-").map((S) => S.charAt(0).toUpperCase() + S.slice(1)).join(" "), b.appendChild(k), b.appendChild(L), b.addEventListener("click", (S) => {
|
|
1460
|
+
S.preventDefault();
|
|
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
|
});
|
|
@@ -1488,7 +1501,7 @@ const V = class V extends w {
|
|
|
1488
1501
|
initialOpacity: e.opacity ?? 100,
|
|
1489
1502
|
onColorChange: (s, n) => {
|
|
1490
1503
|
if (this.clearGlobalBindingForCustomChange(), this.value) {
|
|
1491
|
-
const o =
|
|
1504
|
+
const o = V(s);
|
|
1492
1505
|
if (o && o.type !== "solid") {
|
|
1493
1506
|
this.value = o, this.switchType(o.type, !0);
|
|
1494
1507
|
return;
|
|
@@ -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";
|
|
@@ -1553,7 +1566,7 @@ const V = class V extends w {
|
|
|
1553
1566
|
const l = document.createElement("div");
|
|
1554
1567
|
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
1555
1568
|
const r = pt((h) => {
|
|
1556
|
-
const d =
|
|
1569
|
+
const d = V(h);
|
|
1557
1570
|
d && (this.clearGlobalBindingForCustomChange(), this.value = d, this.switchType(d.type, !0), this.updateUI(), this.triggerChange());
|
|
1558
1571
|
}, "all");
|
|
1559
1572
|
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
@@ -1570,7 +1583,7 @@ const V = class V extends w {
|
|
|
1570
1583
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
1571
1584
|
if (e && this.value)
|
|
1572
1585
|
if (this.value.type === "solid")
|
|
1573
|
-
e.style.background =
|
|
1586
|
+
e.style.background = T(this.value);
|
|
1574
1587
|
else {
|
|
1575
1588
|
const s = this.value.stops.map((n) => `${ct(n.color, n.opacity ?? 100)} ${n.position}%`).join(", ");
|
|
1576
1589
|
e.style.background = `linear-gradient(90deg, ${s})`;
|
|
@@ -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,26 +1652,26 @@ 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((
|
|
1659
|
-
this.clearGlobalBindingForCustomChange(), p.value =
|
|
1660
|
-
const
|
|
1661
|
-
f.style.setProperty("--slider-color", `rgb(${
|
|
1671
|
+
E.getIsOpen() && E.close(!1), this.colorPickerStopIndex = n, E.setOnChange((S, G) => {
|
|
1672
|
+
this.clearGlobalBindingForCustomChange(), p.value = S.replace("#", "").toUpperCase(), d.style.backgroundColor = S, this.value.stops[n].color = S, G !== void 0 && (this.value.stops[n].opacity = G, f.value = String(G), y.textContent = `${G}%`);
|
|
1673
|
+
const W = N(S);
|
|
1674
|
+
f.style.setProperty("--slider-color", `rgb(${W.r}, ${W.g}, ${W.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${W.r}, ${W.g}, ${W.b}, 0)`), this.updateGradientPreview(), this.createHandles(
|
|
1662
1675
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1663
1676
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1664
1677
|
), this.updateUI(), this.triggerChange();
|
|
@@ -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}`);
|
|
@@ -1688,8 +1701,8 @@ const V = class V extends w {
|
|
|
1688
1701
|
this.clearGlobalBindingForCustomChange();
|
|
1689
1702
|
const E = x.target, L = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
1690
1703
|
if (!Number.isNaN(L)) {
|
|
1691
|
-
const
|
|
1692
|
-
this.value.stops[n].position =
|
|
1704
|
+
const S = Math.max(0, Math.min(100, L));
|
|
1705
|
+
this.value.stops[n].position = S, E.value = `${S}%`, this.debouncedPreviewUpdate();
|
|
1693
1706
|
}
|
|
1694
1707
|
}), l.addEventListener("blur", (x) => {
|
|
1695
1708
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
@@ -1697,8 +1710,8 @@ const V = class V extends w {
|
|
|
1697
1710
|
if (Number.isNaN(L))
|
|
1698
1711
|
E.value = `${this.value.stops[n].position}%`;
|
|
1699
1712
|
else {
|
|
1700
|
-
const
|
|
1701
|
-
this.value.stops[n].position =
|
|
1713
|
+
const S = Math.max(0, Math.min(100, L));
|
|
1714
|
+
this.value.stops[n].position = S, E.value = `${S}%`;
|
|
1702
1715
|
}
|
|
1703
1716
|
this.updateGradientPreview(), this.createHandles(
|
|
1704
1717
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
@@ -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),
|
|
@@ -1753,16 +1766,16 @@ const V = class V extends w {
|
|
|
1753
1766
|
this.value.stops.push(l), this.value.stops.sort((r, h) => r.position - h.position);
|
|
1754
1767
|
}
|
|
1755
1768
|
openPopover() {
|
|
1756
|
-
if (this.popoverEl && (
|
|
1757
|
-
if (this.isPopoverOpen = !0,
|
|
1769
|
+
if (this.popoverEl && (P.openInstance && P.openInstance !== this && P.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
1770
|
+
if (this.isPopoverOpen = !0, P.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
1758
1771
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
1759
1772
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1760
1773
|
const o = this.popoverEl.offsetHeight;
|
|
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
|
}
|
|
@@ -1801,14 +1814,14 @@ const V = class V extends w {
|
|
|
1801
1814
|
var t, e;
|
|
1802
1815
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
1803
1816
|
if (this.isPopoverOpen = !1, this.popoverPosition = null, (t = this.sharedStopColorPicker) != null && t.getIsOpen() && (this.sharedStopColorPicker.close(!0), this.colorPickerStopIndex = null), this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
|
|
1804
|
-
const i =
|
|
1805
|
-
|
|
1817
|
+
const i = T(this.value);
|
|
1818
|
+
z.addColor(i, "gradient"), (e = this.recentGradientRefresh) == null || e.call(this);
|
|
1806
1819
|
}
|
|
1807
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
1820
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), P.openInstance === this && (P.openInstance = null);
|
|
1808
1821
|
}
|
|
1809
1822
|
}
|
|
1810
1823
|
commitPendingSolidColor() {
|
|
1811
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
1824
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : z.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
1812
1825
|
}
|
|
1813
1826
|
handlePaste(t) {
|
|
1814
1827
|
var i;
|
|
@@ -1823,7 +1836,7 @@ const V = class V extends w {
|
|
|
1823
1836
|
parseAndSet(t) {
|
|
1824
1837
|
let e = t.trim();
|
|
1825
1838
|
e && !e.startsWith("#") && !e.startsWith("var(") && !e.startsWith("rgb") && !e.startsWith("hsl") && !e.includes("gradient") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(e) && (e = "#" + e, this.inputEl && (this.inputEl.value = e));
|
|
1826
|
-
const i =
|
|
1839
|
+
const i = V(e);
|
|
1827
1840
|
i && this.setValue(i);
|
|
1828
1841
|
}
|
|
1829
1842
|
getChangePayload() {
|
|
@@ -1836,18 +1849,18 @@ const V = class V extends w {
|
|
|
1836
1849
|
t !== void 0 && (this.changeDebounceTimeout && clearTimeout(this.changeDebounceTimeout), this.changeDebounceTimeout = setTimeout(() => {
|
|
1837
1850
|
var e, i;
|
|
1838
1851
|
(e = this.onChange) == null || e.call(this, t), (i = this.detectChange) == null || i.call(this, t), this.changeDebounceTimeout = null;
|
|
1839
|
-
},
|
|
1852
|
+
}, P.CHANGE_DEBOUNCE_DELAY));
|
|
1840
1853
|
}
|
|
1841
1854
|
getElement() {
|
|
1842
1855
|
return this.element;
|
|
1843
1856
|
}
|
|
1844
1857
|
getValue() {
|
|
1845
1858
|
const t = this.getChangePayload();
|
|
1846
|
-
return t ? typeof t == "string" ? t :
|
|
1859
|
+
return t ? typeof t == "string" ? t : T(t) : "";
|
|
1847
1860
|
}
|
|
1848
1861
|
getCSSValue() {
|
|
1849
1862
|
const t = this.getChangePayload();
|
|
1850
|
-
return t ? typeof t == "string" ? t :
|
|
1863
|
+
return t ? typeof t == "string" ? t : T(t) : "";
|
|
1851
1864
|
}
|
|
1852
1865
|
getCSSForText() {
|
|
1853
1866
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -1856,8 +1869,8 @@ const V = class V extends w {
|
|
|
1856
1869
|
return this.value;
|
|
1857
1870
|
}
|
|
1858
1871
|
};
|
|
1859
|
-
|
|
1860
|
-
let J =
|
|
1872
|
+
P.openInstance = null, P.CHANGE_DEBOUNCE_DELAY = 150;
|
|
1873
|
+
let J = P;
|
|
1861
1874
|
function Y(c, t) {
|
|
1862
1875
|
for (const e in c)
|
|
1863
1876
|
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
@@ -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();
|
|
@@ -2331,7 +2345,7 @@ const ot = class ot {
|
|
|
2331
2345
|
if (o.includeGetJson !== !1)
|
|
2332
2346
|
if (n instanceof J) {
|
|
2333
2347
|
const a = n.getRawValue();
|
|
2334
|
-
i[s] = a ?
|
|
2348
|
+
i[s] = a ? T(a) : null;
|
|
2335
2349
|
} else
|
|
2336
2350
|
i[s] = o.value;
|
|
2337
2351
|
}
|
|
@@ -2347,7 +2361,7 @@ const ot = class ot {
|
|
|
2347
2361
|
if (s.includeGetJson === !1) return null;
|
|
2348
2362
|
if (i instanceof J) {
|
|
2349
2363
|
const n = i.getRawValue();
|
|
2350
|
-
return n ?
|
|
2364
|
+
return n ? T(n) : null;
|
|
2351
2365
|
}
|
|
2352
2366
|
return s.value;
|
|
2353
2367
|
}
|
|
@@ -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
|
}
|
|
@@ -2483,7 +2497,7 @@ const ot = class ot {
|
|
|
2483
2497
|
};
|
|
2484
2498
|
ot.hiddenElements = /* @__PURE__ */ new Set();
|
|
2485
2499
|
let $ = ot;
|
|
2486
|
-
function
|
|
2500
|
+
function ci(c) {
|
|
2487
2501
|
return new Xt(c);
|
|
2488
2502
|
}
|
|
2489
2503
|
class Xt extends $ {
|
|
@@ -2550,7 +2564,7 @@ class Xt extends $ {
|
|
|
2550
2564
|
function Yt(c) {
|
|
2551
2565
|
return new $(c);
|
|
2552
2566
|
}
|
|
2553
|
-
function
|
|
2567
|
+
function hi(c) {
|
|
2554
2568
|
return c;
|
|
2555
2569
|
}
|
|
2556
2570
|
class Kt extends w {
|
|
@@ -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;
|
|
@@ -2744,14 +2758,14 @@ const te = `
|
|
|
2744
2758
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
2745
2759
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
2746
2760
|
</svg>`;
|
|
2747
|
-
class
|
|
2761
|
+
class j extends w {
|
|
2748
2762
|
constructor(t = {}) {
|
|
2749
2763
|
super({
|
|
2750
2764
|
...t,
|
|
2751
2765
|
icon: t.icon || te,
|
|
2752
2766
|
title: t.title || "Color & Opacity",
|
|
2753
2767
|
default: t.default || "#000000FF"
|
|
2754
|
-
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value =
|
|
2768
|
+
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = j.normalizeHexWithOpacity(this.value));
|
|
2755
2769
|
}
|
|
2756
2770
|
static normalizeHexWithOpacity(t) {
|
|
2757
2771
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -2769,7 +2783,7 @@ class _ extends w {
|
|
|
2769
2783
|
return `#${i}${n}`;
|
|
2770
2784
|
}
|
|
2771
2785
|
setValue(t) {
|
|
2772
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
2786
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = j.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
2773
2787
|
}
|
|
2774
2788
|
updateInputElements() {
|
|
2775
2789
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -2780,7 +2794,7 @@ class _ extends w {
|
|
|
2780
2794
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2781
2795
|
}
|
|
2782
2796
|
handleColorChange(t) {
|
|
2783
|
-
const e = this.getOpacityPercent(), i =
|
|
2797
|
+
const e = this.getOpacityPercent(), i = j.combineColorOpacity(
|
|
2784
2798
|
t,
|
|
2785
2799
|
e
|
|
2786
2800
|
);
|
|
@@ -2791,7 +2805,7 @@ class _ extends w {
|
|
|
2791
2805
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
2792
2806
|
}
|
|
2793
2807
|
handleOpacityChange(t) {
|
|
2794
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
2808
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = j.combineColorOpacity(
|
|
2795
2809
|
e,
|
|
2796
2810
|
i
|
|
2797
2811
|
);
|
|
@@ -2881,7 +2895,7 @@ class _ extends w {
|
|
|
2881
2895
|
};
|
|
2882
2896
|
}
|
|
2883
2897
|
}
|
|
2884
|
-
class
|
|
2898
|
+
class di extends w {
|
|
2885
2899
|
constructor(t = {}) {
|
|
2886
2900
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
2887
2901
|
}
|
|
@@ -3166,7 +3180,7 @@ class ne extends w {
|
|
|
3166
3180
|
}), t.appendChild(i), t;
|
|
3167
3181
|
}
|
|
3168
3182
|
}
|
|
3169
|
-
class
|
|
3183
|
+
class pi extends w {
|
|
3170
3184
|
constructor(t) {
|
|
3171
3185
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
3172
3186
|
}
|
|
@@ -3195,7 +3209,7 @@ class di extends w {
|
|
|
3195
3209
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
3196
3210
|
}
|
|
3197
3211
|
}
|
|
3198
|
-
class
|
|
3212
|
+
class ui extends w {
|
|
3199
3213
|
constructor(t = {}) {
|
|
3200
3214
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
3201
3215
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -3521,14 +3535,14 @@ 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",
|
|
3528
3542
|
"image/gif",
|
|
3529
3543
|
"image/webp"
|
|
3530
3544
|
];
|
|
3531
|
-
function
|
|
3545
|
+
function Ie(c, t) {
|
|
3532
3546
|
if (!Me.includes(c.type))
|
|
3533
3547
|
return {
|
|
3534
3548
|
valid: !1,
|
|
@@ -3558,7 +3572,7 @@ function xt(c, t, e) {
|
|
|
3558
3572
|
y: nt(s)
|
|
3559
3573
|
};
|
|
3560
3574
|
}
|
|
3561
|
-
function
|
|
3575
|
+
function Vt(c) {
|
|
3562
3576
|
const t = c.map((i) => i.index).sort((i, s) => i - s);
|
|
3563
3577
|
let e = 1;
|
|
3564
3578
|
for (const i of t)
|
|
@@ -3568,8 +3582,8 @@ function Tt(c) {
|
|
|
3568
3582
|
break;
|
|
3569
3583
|
return e;
|
|
3570
3584
|
}
|
|
3571
|
-
function
|
|
3572
|
-
const e =
|
|
3585
|
+
function Se(c, t) {
|
|
3586
|
+
const e = Vt(c);
|
|
3573
3587
|
let i = `Prize ${e}`;
|
|
3574
3588
|
if (t && t.length > 0) {
|
|
3575
3589
|
const s = t[e - 1];
|
|
@@ -3632,7 +3646,7 @@ const gt = class gt {
|
|
|
3632
3646
|
}
|
|
3633
3647
|
};
|
|
3634
3648
|
gt.styleInjected = !1;
|
|
3635
|
-
let
|
|
3649
|
+
let _ = gt;
|
|
3636
3650
|
class Ne {
|
|
3637
3651
|
constructor() {
|
|
3638
3652
|
this.overlayElement = null, this.activePromise = null;
|
|
@@ -3668,7 +3682,7 @@ class Ne {
|
|
|
3668
3682
|
this.overlayElement && (this.overlayElement.remove(), this.overlayElement = null), this.activePromise = null;
|
|
3669
3683
|
}
|
|
3670
3684
|
}
|
|
3671
|
-
class
|
|
3685
|
+
class Te {
|
|
3672
3686
|
constructor() {
|
|
3673
3687
|
this.element = document.createElement("div"), this.element.className = "marker-cursor-tooltip";
|
|
3674
3688
|
}
|
|
@@ -3692,7 +3706,7 @@ class Pe {
|
|
|
3692
3706
|
return t < e;
|
|
3693
3707
|
}
|
|
3694
3708
|
}
|
|
3695
|
-
class
|
|
3709
|
+
class Pe {
|
|
3696
3710
|
constructor() {
|
|
3697
3711
|
this.history = [], this.historyIndex = -1;
|
|
3698
3712
|
}
|
|
@@ -3730,7 +3744,7 @@ class Ve {
|
|
|
3730
3744
|
this.history = [], this.historyIndex = -1;
|
|
3731
3745
|
}
|
|
3732
3746
|
}
|
|
3733
|
-
class
|
|
3747
|
+
class Ve {
|
|
3734
3748
|
constructor() {
|
|
3735
3749
|
this.messageListener = null, this.handlers = /* @__PURE__ */ new Map();
|
|
3736
3750
|
}
|
|
@@ -3767,7 +3781,7 @@ class Te {
|
|
|
3767
3781
|
this.handlers.clear(), this.cleanupMessageListener();
|
|
3768
3782
|
}
|
|
3769
3783
|
}
|
|
3770
|
-
const Lt = new
|
|
3784
|
+
const Lt = new Ve();
|
|
3771
3785
|
function Oe(c, t) {
|
|
3772
3786
|
const e = document.createElement("div");
|
|
3773
3787
|
e.className = "marker-container", e.style.left = `${c.x}%`, e.style.top = `${c.y}%`, e.setAttribute("data-marker-id", String(c.id));
|
|
@@ -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");
|
|
@@ -3977,13 +3991,15 @@ function We(c, t, e) {
|
|
|
3977
3991
|
}
|
|
3978
3992
|
return i.appendChild(n), i;
|
|
3979
3993
|
}
|
|
3980
|
-
const
|
|
3994
|
+
const je = `<svg xmlns="http://www.w3.org/2000/svg" width="8" height="4" viewBox="0 0 8 4" fill="none">
|
|
3995
|
+
<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="#FF5630"/>
|
|
3996
|
+
</svg>`, A = class A extends w {
|
|
3981
3997
|
constructor(t = {}) {
|
|
3982
3998
|
var e;
|
|
3983
3999
|
super(t), this.inputType = {
|
|
3984
4000
|
imageUrl: "text",
|
|
3985
4001
|
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
|
|
4002
|
+
}, 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 Pe(), this.isUndoRedoOperation = !1, this.initialValue = null, this.lastMouseX = 0, this.lastMouseY = 0, this.errorTooltipEl = null, this.errorTooltipTimeoutId = null, 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
4003
|
this.handleFileManagerImageSelected(i);
|
|
3988
4004
|
}), this.onBackgroundClick = (i) => {
|
|
3989
4005
|
if (this.isPopoverOpen && this.popoverElements && !this.popoverElements.popover.contains(i.target)) {
|
|
@@ -4022,7 +4038,7 @@ const A = class A extends w {
|
|
|
4022
4038
|
() => {
|
|
4023
4039
|
this.value = { imageUrl: "", markers: [] }, this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange();
|
|
4024
4040
|
}
|
|
4025
|
-
), o = this.props.upload || "file-manager", a =
|
|
4041
|
+
), o = this.props.upload || "file-manager", a = Ge(
|
|
4026
4042
|
o,
|
|
4027
4043
|
(h) => this.handleImageUpload(h),
|
|
4028
4044
|
this.id
|
|
@@ -4053,7 +4069,7 @@ const A = class A extends w {
|
|
|
4053
4069
|
}
|
|
4054
4070
|
hasAllMarkers() {
|
|
4055
4071
|
if (!this.value) return !1;
|
|
4056
|
-
const t = this.props.maxMarkers ||
|
|
4072
|
+
const t = this.props.maxMarkers || F;
|
|
4057
4073
|
return this.value.markers.length === t;
|
|
4058
4074
|
}
|
|
4059
4075
|
hasChanges() {
|
|
@@ -4071,7 +4087,7 @@ const A = class A extends w {
|
|
|
4071
4087
|
JSON.stringify(this.initialValue)
|
|
4072
4088
|
), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange());
|
|
4073
4089
|
}
|
|
4074
|
-
this.isPopoverOpen = !1, this.draggingMarkerId = null, this.popoverElements && (this.popoverElements.backdrop.style.display = "none", this.popoverElements.popover.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), A.openInstance === this && (A.openInstance = null);
|
|
4090
|
+
this.isPopoverOpen = !1, this.draggingMarkerId = null, this.clearErrorTooltip(), this.popoverElements && (this.popoverElements.backdrop.style.display = "none", this.popoverElements.popover.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), A.openInstance === this && (A.openInstance = null);
|
|
4075
4091
|
}
|
|
4076
4092
|
}
|
|
4077
4093
|
positionPopoverElement() {
|
|
@@ -4083,6 +4099,7 @@ const A = class A extends w {
|
|
|
4083
4099
|
refreshPopoverContent() {
|
|
4084
4100
|
var a;
|
|
4085
4101
|
if (!this.popoverElements) return;
|
|
4102
|
+
this.clearErrorTooltip();
|
|
4086
4103
|
const t = this.popoverElements.content, e = t.querySelector(
|
|
4087
4104
|
".image-map-container"
|
|
4088
4105
|
), i = t.querySelector(
|
|
@@ -4094,7 +4111,7 @@ const A = class A extends w {
|
|
|
4094
4111
|
canUndo: this.historyManager.canUndo(),
|
|
4095
4112
|
canRedo: this.historyManager.canRedo(),
|
|
4096
4113
|
markerCount: ((a = this.value) == null ? void 0 : a.markers.length) || 0,
|
|
4097
|
-
maxMarkers: this.props.maxMarkers ||
|
|
4114
|
+
maxMarkers: this.props.maxMarkers || F
|
|
4098
4115
|
},
|
|
4099
4116
|
{
|
|
4100
4117
|
onUndo: () => this.undo(),
|
|
@@ -4105,8 +4122,8 @@ const A = class A extends w {
|
|
|
4105
4122
|
const r = document.createElement("div");
|
|
4106
4123
|
r.className = "image-map-main-layout";
|
|
4107
4124
|
const h = document.createElement("div");
|
|
4108
|
-
h.className = "image-map-image-section", this.cursorTooltip = new
|
|
4109
|
-
const { container: d, imageElement: p } =
|
|
4125
|
+
h.className = "image-map-image-section", this.cursorTooltip = new Te();
|
|
4126
|
+
const { container: d, imageElement: p } = Fe(
|
|
4110
4127
|
this.value.imageUrl,
|
|
4111
4128
|
this.value.markers,
|
|
4112
4129
|
{
|
|
@@ -4124,28 +4141,28 @@ const A = class A extends w {
|
|
|
4124
4141
|
this.cursorTooltip
|
|
4125
4142
|
);
|
|
4126
4143
|
this.imageElement = p, h.appendChild(d);
|
|
4127
|
-
const
|
|
4128
|
-
|
|
4144
|
+
const u = document.createElement("div");
|
|
4145
|
+
u.className = "prize-list-section";
|
|
4129
4146
|
const C = He(
|
|
4130
4147
|
this.value.markers,
|
|
4131
|
-
this.props.maxMarkers ||
|
|
4148
|
+
this.props.maxMarkers || F,
|
|
4132
4149
|
this.props.prizeMap
|
|
4133
4150
|
);
|
|
4134
|
-
|
|
4135
|
-
const
|
|
4151
|
+
u.appendChild(C), r.appendChild(h), r.appendChild(u), t.appendChild(r);
|
|
4152
|
+
const m = We(
|
|
4136
4153
|
this.hasAllMarkers(),
|
|
4137
4154
|
() => this.handleClearAllMarkers(),
|
|
4138
4155
|
() => {
|
|
4139
4156
|
this.triggerChange(), this.closePopover(!0);
|
|
4140
4157
|
}
|
|
4141
4158
|
);
|
|
4142
|
-
t.appendChild(
|
|
4143
|
-
const
|
|
4159
|
+
t.appendChild(m);
|
|
4160
|
+
const g = h.querySelector(
|
|
4144
4161
|
".image-map-container"
|
|
4145
|
-
), f =
|
|
4162
|
+
), f = u.querySelector(
|
|
4146
4163
|
".simple-prize-list"
|
|
4147
4164
|
);
|
|
4148
|
-
|
|
4165
|
+
g && (g.scrollTop = s), f && (f.scrollTop = n), this.updateCursorTooltipContent();
|
|
4149
4166
|
} else {
|
|
4150
4167
|
const l = Be({
|
|
4151
4168
|
uploadMethod: this.props.upload || "file-manager",
|
|
@@ -4188,16 +4205,16 @@ const A = class A extends w {
|
|
|
4188
4205
|
markers: n
|
|
4189
4206
|
}, this.previousImageDimensions = s, this.historyManager.initialize(n), this.updateUndoRedoButtons(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
|
|
4190
4207
|
}, i.onerror = () => {
|
|
4191
|
-
|
|
4208
|
+
_.show("Failed to load image from file manager.");
|
|
4192
4209
|
}, i.src = t;
|
|
4193
4210
|
}
|
|
4194
4211
|
handleImageUpload(t) {
|
|
4195
|
-
const e = this.previousImageDimensions, i =
|
|
4212
|
+
const e = this.previousImageDimensions, i = Ie(
|
|
4196
4213
|
t,
|
|
4197
4214
|
this.props.maxFileSizeMB || bt
|
|
4198
4215
|
);
|
|
4199
4216
|
if (!i.valid) {
|
|
4200
|
-
|
|
4217
|
+
_.show(i.error);
|
|
4201
4218
|
return;
|
|
4202
4219
|
}
|
|
4203
4220
|
const s = new FileReader();
|
|
@@ -4221,22 +4238,21 @@ const A = class A extends w {
|
|
|
4221
4238
|
markers: h
|
|
4222
4239
|
}, this.previousImageDimensions = r, this.historyManager.initialize(h), this.updateUndoRedoButtons(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
|
|
4223
4240
|
}, l.onerror = () => {
|
|
4224
|
-
|
|
4241
|
+
_.show("Failed to read image file.");
|
|
4225
4242
|
}, l.src = o;
|
|
4226
4243
|
}
|
|
4227
4244
|
}, s.onerror = () => {
|
|
4228
|
-
|
|
4245
|
+
_.show("Failed to read image file.");
|
|
4229
4246
|
}, s.readAsDataURL(t);
|
|
4230
4247
|
}
|
|
4231
4248
|
handleImageClick(t) {
|
|
4232
4249
|
if (this.draggingMarkerId !== null || !this.value || !this.imageElement) return;
|
|
4233
|
-
if (this.value.markers.length >= (this.props.maxMarkers ||
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
);
|
|
4250
|
+
if (this.value.markers.length >= (this.props.maxMarkers || F)) {
|
|
4251
|
+
const r = `Maximum of ${this.props.maxMarkers || F} markers allowed.`;
|
|
4252
|
+
this.showErrorTooltip(r, t.clientX, t.clientY);
|
|
4237
4253
|
return;
|
|
4238
4254
|
}
|
|
4239
|
-
const e = this.imageElement.getBoundingClientRect(), { x: i, y: s } = xt(t.clientX, t.clientY, e), n =
|
|
4255
|
+
const e = this.imageElement.getBoundingClientRect(), { x: i, y: s } = xt(t.clientX, t.clientY, e), n = Vt(this.value.markers);
|
|
4240
4256
|
let o;
|
|
4241
4257
|
this.props.prizeMap && this.props.prizeMap.length > 0 && (o = this.props.prizeMap[n - 1]);
|
|
4242
4258
|
const a = {
|
|
@@ -4291,9 +4307,9 @@ const A = class A extends w {
|
|
|
4291
4307
|
}
|
|
4292
4308
|
updateCursorTooltipContent() {
|
|
4293
4309
|
if (!this.cursorTooltip || !this.value) return;
|
|
4294
|
-
const t = this.props.maxMarkers ||
|
|
4310
|
+
const t = this.props.maxMarkers || F;
|
|
4295
4311
|
if (this.cursorTooltip.shouldShow(this.value.markers.length, t)) {
|
|
4296
|
-
const e =
|
|
4312
|
+
const e = Se(
|
|
4297
4313
|
this.value.markers,
|
|
4298
4314
|
this.props.prizeMap
|
|
4299
4315
|
);
|
|
@@ -4340,8 +4356,42 @@ const A = class A extends w {
|
|
|
4340
4356
|
triggerChange() {
|
|
4341
4357
|
this.value && (this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value));
|
|
4342
4358
|
}
|
|
4359
|
+
showErrorTooltip(t, e, i) {
|
|
4360
|
+
if (!this.imageElement || !this.isPopoverOpen) return;
|
|
4361
|
+
const s = this.imageElement.parentElement;
|
|
4362
|
+
if (!s) return;
|
|
4363
|
+
const n = this.imageElement.getBoundingClientRect();
|
|
4364
|
+
if (!this.errorTooltipEl || !s.contains(this.errorTooltipEl)) {
|
|
4365
|
+
this.errorTooltipEl = document.createElement("div"), this.errorTooltipEl.className = "image-map-error-tooltip";
|
|
4366
|
+
const p = document.createElement("div");
|
|
4367
|
+
p.className = "image-map-error-tooltip-content", this.errorTooltipEl.appendChild(p);
|
|
4368
|
+
const u = document.createElement("div");
|
|
4369
|
+
u.className = "image-map-error-tooltip-tail", u.innerHTML = je, this.errorTooltipEl.appendChild(u), s.appendChild(this.errorTooltipEl);
|
|
4370
|
+
}
|
|
4371
|
+
const o = this.errorTooltipEl.querySelector(
|
|
4372
|
+
".image-map-error-tooltip-content"
|
|
4373
|
+
);
|
|
4374
|
+
o && (o.textContent = t);
|
|
4375
|
+
const a = s.getBoundingClientRect(), l = e - a.left, r = i - a.top, h = Math.min(
|
|
4376
|
+
Math.max(l, n.left - a.left),
|
|
4377
|
+
n.right - a.left
|
|
4378
|
+
), d = Math.min(
|
|
4379
|
+
Math.max(r, n.top - a.top),
|
|
4380
|
+
n.bottom - a.top
|
|
4381
|
+
);
|
|
4382
|
+
this.errorTooltipEl.style.left = `${h}px`, this.errorTooltipEl.style.top = `${d}px`, this.errorTooltipEl.classList.remove("visible"), this.errorTooltipEl.offsetWidth, this.errorTooltipEl.classList.add("visible"), this.errorTooltipTimeoutId !== null && window.clearTimeout(this.errorTooltipTimeoutId), this.errorTooltipTimeoutId = window.setTimeout(() => {
|
|
4383
|
+
this.hideErrorTooltip();
|
|
4384
|
+
}, 2e3);
|
|
4385
|
+
}
|
|
4386
|
+
hideErrorTooltip() {
|
|
4387
|
+
this.errorTooltipEl && (this.errorTooltipEl.classList.remove("visible"), this.errorTooltipTimeoutId = null);
|
|
4388
|
+
}
|
|
4389
|
+
clearErrorTooltip() {
|
|
4390
|
+
var t;
|
|
4391
|
+
this.errorTooltipTimeoutId !== null && (window.clearTimeout(this.errorTooltipTimeoutId), this.errorTooltipTimeoutId = null), (t = this.errorTooltipEl) != null && t.parentElement && this.errorTooltipEl.parentElement.removeChild(this.errorTooltipEl), this.errorTooltipEl = null;
|
|
4392
|
+
}
|
|
4343
4393
|
destroy() {
|
|
4344
|
-
this.closePopover(), this.popoverElements && (this.popoverElements.backdrop.parentElement && this.popoverElements.backdrop.parentElement.removeChild(
|
|
4394
|
+
this.closePopover(), this.clearErrorTooltip(), this.popoverElements && (this.popoverElements.backdrop.parentElement && this.popoverElements.backdrop.parentElement.removeChild(
|
|
4345
4395
|
this.popoverElements.backdrop
|
|
4346
4396
|
), this.popoverElements.popover.parentElement && this.popoverElements.popover.parentElement.removeChild(
|
|
4347
4397
|
this.popoverElements.popover
|
|
@@ -4350,14 +4400,14 @@ const A = class A extends w {
|
|
|
4350
4400
|
};
|
|
4351
4401
|
A.openInstance = null;
|
|
4352
4402
|
let kt = A;
|
|
4353
|
-
class
|
|
4403
|
+
class _e extends B {
|
|
4354
4404
|
constructor(t = {}) {
|
|
4355
4405
|
super({
|
|
4356
4406
|
...t,
|
|
4357
4407
|
title: t.title || "Height",
|
|
4358
4408
|
suffix: t.suffix || "px",
|
|
4359
4409
|
minValue: t.minValue ?? 0,
|
|
4360
|
-
icon: t.icon ||
|
|
4410
|
+
icon: t.icon || qe,
|
|
4361
4411
|
default: t.default ?? 100
|
|
4362
4412
|
}), this.inputType = "number", this.mobileValue = t.mobile, this.suffix = t.suffix || "px";
|
|
4363
4413
|
}
|
|
@@ -4372,17 +4422,17 @@ class je extends B {
|
|
|
4372
4422
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
4373
4423
|
}
|
|
4374
4424
|
}
|
|
4375
|
-
const
|
|
4425
|
+
const qe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4376
4426
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4377
4427
|
</svg>`;
|
|
4378
|
-
class
|
|
4428
|
+
class Ze extends B {
|
|
4379
4429
|
constructor(t = {}) {
|
|
4380
4430
|
super({
|
|
4381
4431
|
...t,
|
|
4382
4432
|
title: t.title || "Width",
|
|
4383
4433
|
suffix: t.suffix || "px",
|
|
4384
4434
|
minValue: t.minValue ?? 0,
|
|
4385
|
-
icon: t.icon ||
|
|
4435
|
+
icon: t.icon || Je,
|
|
4386
4436
|
default: t.default ?? 100
|
|
4387
4437
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
4388
4438
|
}
|
|
@@ -4393,14 +4443,14 @@ class qe extends B {
|
|
|
4393
4443
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
4394
4444
|
}
|
|
4395
4445
|
}
|
|
4396
|
-
const
|
|
4446
|
+
const Je = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4397
4447
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4398
|
-
</svg>`,
|
|
4448
|
+
</svg>`, Xe = `
|
|
4399
4449
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
4400
4450
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
4401
4451
|
</svg>
|
|
4402
4452
|
`;
|
|
4403
|
-
class
|
|
4453
|
+
class gi extends w {
|
|
4404
4454
|
constructor(t = {}) {
|
|
4405
4455
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
4406
4456
|
const e = this._options.findIndex(
|
|
@@ -4415,9 +4465,11 @@ class ui extends w {
|
|
|
4415
4465
|
}
|
|
4416
4466
|
createOption(t, e) {
|
|
4417
4467
|
const i = document.createElement("li");
|
|
4418
|
-
i.classList.add("select-api-option"), i.
|
|
4468
|
+
i.classList.add("select-api-option"), i.dataset.index = String(e);
|
|
4419
4469
|
const s = document.createElement("input");
|
|
4420
|
-
|
|
4470
|
+
s.type = "radio", s.classList.add("select-api-radio"), s.name = "select-api-radio-group", this.selectedOptionIndex === e && (s.checked = !0);
|
|
4471
|
+
const n = document.createElement("span");
|
|
4472
|
+
return n.classList.add("select-api-option-text"), n.textContent = t.name, i.appendChild(s), i.appendChild(n), i;
|
|
4421
4473
|
}
|
|
4422
4474
|
draw() {
|
|
4423
4475
|
const t = document.createElement("div");
|
|
@@ -4455,7 +4507,7 @@ class ui extends w {
|
|
|
4455
4507
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
4456
4508
|
}), t.appendChild(i);
|
|
4457
4509
|
const s = document.createElement("div");
|
|
4458
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
4510
|
+
return s.classList.add("svg-container"), s.innerHTML = Xe, t.appendChild(s), s.onclick = () => {
|
|
4459
4511
|
var n, o;
|
|
4460
4512
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
4461
4513
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -4549,7 +4601,7 @@ class ui extends w {
|
|
|
4549
4601
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
4550
4602
|
}
|
|
4551
4603
|
}
|
|
4552
|
-
class
|
|
4604
|
+
class mi extends w {
|
|
4553
4605
|
constructor(t) {
|
|
4554
4606
|
var e, i;
|
|
4555
4607
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
@@ -4599,13 +4651,13 @@ class gi extends w {
|
|
|
4599
4651
|
this.detectChangeCallback = t;
|
|
4600
4652
|
}
|
|
4601
4653
|
}
|
|
4602
|
-
const
|
|
4654
|
+
const Ye = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4603
4655
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4604
4656
|
</svg>`;
|
|
4605
|
-
class
|
|
4657
|
+
class vi extends w {
|
|
4606
4658
|
// Store mobile value
|
|
4607
4659
|
constructor(t = {}) {
|
|
4608
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
4660
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Ye, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
4609
4661
|
}
|
|
4610
4662
|
draw() {
|
|
4611
4663
|
const t = document.createElement("div");
|
|
@@ -4656,40 +4708,40 @@ class mi extends w {
|
|
|
4656
4708
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
4657
4709
|
}
|
|
4658
4710
|
}
|
|
4659
|
-
const
|
|
4711
|
+
const Ke = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4660
4712
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4661
4713
|
</svg>`;
|
|
4662
|
-
class
|
|
4714
|
+
class fi extends B {
|
|
4663
4715
|
constructor(t = {}) {
|
|
4664
4716
|
super({
|
|
4665
4717
|
...t,
|
|
4666
4718
|
minValue: t.minValue ?? 0,
|
|
4667
4719
|
maxValue: t.maxValue ?? 1e3,
|
|
4668
|
-
icon: t.icon ||
|
|
4720
|
+
icon: t.icon || Ke,
|
|
4669
4721
|
title: t.title || "Margin Bottom",
|
|
4670
4722
|
default: t.default ?? 20,
|
|
4671
4723
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
4672
4724
|
}), this.inputType = "number";
|
|
4673
4725
|
}
|
|
4674
4726
|
}
|
|
4675
|
-
const
|
|
4727
|
+
const Qe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4676
4728
|
<path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
|
|
4677
4729
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4678
4730
|
</svg>`;
|
|
4679
|
-
class
|
|
4731
|
+
class Ci extends B {
|
|
4680
4732
|
constructor(t = {}) {
|
|
4681
4733
|
super({
|
|
4682
4734
|
...t,
|
|
4683
4735
|
minValue: t.minValue ?? 0,
|
|
4684
4736
|
maxValue: t.maxValue ?? 1e3,
|
|
4685
|
-
icon: t.icon ||
|
|
4737
|
+
icon: t.icon || Qe,
|
|
4686
4738
|
title: t.title || "Margin Top",
|
|
4687
4739
|
default: t.default ?? 20,
|
|
4688
4740
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
4689
4741
|
}), this.inputType = "number";
|
|
4690
4742
|
}
|
|
4691
4743
|
}
|
|
4692
|
-
class
|
|
4744
|
+
class yi extends w {
|
|
4693
4745
|
constructor(t) {
|
|
4694
4746
|
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), this.popup = null, t.default ? this.value = { ...t.default } : this.value || (this.value = {});
|
|
4695
4747
|
const e = w.HasExplicitCurrentLanguage(), i = e ? w.CurrentLanguage() : "", s = w.DefaultLanguage;
|
|
@@ -4724,12 +4776,12 @@ class Ci extends w {
|
|
|
4724
4776
|
return;
|
|
4725
4777
|
}
|
|
4726
4778
|
const h = "...";
|
|
4727
|
-
let d = 0, p = e.length,
|
|
4779
|
+
let d = 0, p = e.length, u = 0;
|
|
4728
4780
|
for (; d <= p; ) {
|
|
4729
|
-
const
|
|
4730
|
-
this.measureTextWidth(
|
|
4781
|
+
const m = Math.floor((d + p) / 2), g = e.slice(0, m).trimEnd() + h;
|
|
4782
|
+
this.measureTextWidth(g, i) <= l ? (u = m, d = m + 1) : p = m - 1;
|
|
4731
4783
|
}
|
|
4732
|
-
const C = e.slice(0,
|
|
4784
|
+
const C = e.slice(0, u).trimEnd() + h;
|
|
4733
4785
|
t.placeholder = C;
|
|
4734
4786
|
}
|
|
4735
4787
|
autosizeTextarea(t, e = 3) {
|
|
@@ -4958,7 +5010,7 @@ class Ci extends w {
|
|
|
4958
5010
|
});
|
|
4959
5011
|
}
|
|
4960
5012
|
}
|
|
4961
|
-
class
|
|
5013
|
+
class Ei extends w {
|
|
4962
5014
|
constructor(t = {}) {
|
|
4963
5015
|
super(t), this.inputType = "select";
|
|
4964
5016
|
const e = [
|
|
@@ -4985,16 +5037,16 @@ class yi extends w {
|
|
|
4985
5037
|
this.selectSetting.destroy(), super.destroy();
|
|
4986
5038
|
}
|
|
4987
5039
|
}
|
|
4988
|
-
const
|
|
5040
|
+
const ti = `
|
|
4989
5041
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4990
5042
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4991
5043
|
</svg>
|
|
4992
|
-
`,
|
|
5044
|
+
`, ei = `
|
|
4993
5045
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4994
5046
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4995
5047
|
</svg>
|
|
4996
5048
|
`;
|
|
4997
|
-
class
|
|
5049
|
+
class bi extends $ {
|
|
4998
5050
|
constructor(t) {
|
|
4999
5051
|
super({
|
|
5000
5052
|
title: "Border",
|
|
@@ -5002,7 +5054,7 @@ class Ei extends $ {
|
|
|
5002
5054
|
settings: {
|
|
5003
5055
|
size: new B({
|
|
5004
5056
|
title: "Size",
|
|
5005
|
-
icon:
|
|
5057
|
+
icon: ei,
|
|
5006
5058
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
5007
5059
|
suffix: "px"
|
|
5008
5060
|
}),
|
|
@@ -5012,7 +5064,7 @@ class Ei extends $ {
|
|
|
5012
5064
|
}),
|
|
5013
5065
|
radius: new B({
|
|
5014
5066
|
title: "Radius",
|
|
5015
|
-
icon:
|
|
5067
|
+
icon: ti,
|
|
5016
5068
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
5017
5069
|
suffix: "px"
|
|
5018
5070
|
})
|
|
@@ -5036,20 +5088,20 @@ class Ei extends $ {
|
|
|
5036
5088
|
`;
|
|
5037
5089
|
}
|
|
5038
5090
|
}
|
|
5039
|
-
const
|
|
5091
|
+
const ii = `
|
|
5040
5092
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
5041
5093
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5042
5094
|
</svg>
|
|
5043
|
-
`,
|
|
5095
|
+
`, si = `
|
|
5044
5096
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5045
5097
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5046
5098
|
</svg>
|
|
5047
|
-
`,
|
|
5099
|
+
`, ni = `
|
|
5048
5100
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5049
5101
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5050
5102
|
</svg>
|
|
5051
5103
|
`;
|
|
5052
|
-
class
|
|
5104
|
+
class wi extends $ {
|
|
5053
5105
|
constructor(t = {}) {
|
|
5054
5106
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
5055
5107
|
super({
|
|
@@ -5063,7 +5115,7 @@ class bi extends $ {
|
|
|
5063
5115
|
}),
|
|
5064
5116
|
fontFamily: new ht({
|
|
5065
5117
|
title: "Font",
|
|
5066
|
-
icon:
|
|
5118
|
+
icon: ii,
|
|
5067
5119
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
5068
5120
|
options: i.fontFamilyOptions ?? [
|
|
5069
5121
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -5076,7 +5128,7 @@ class bi extends $ {
|
|
|
5076
5128
|
}),
|
|
5077
5129
|
fontWeight: new ht({
|
|
5078
5130
|
title: "Weight",
|
|
5079
|
-
icon:
|
|
5131
|
+
icon: si,
|
|
5080
5132
|
default: i.fontWeightDefault ?? "400",
|
|
5081
5133
|
options: i.fontWeightOptions ?? [
|
|
5082
5134
|
{ name: "Regular", value: "400" },
|
|
@@ -5088,7 +5140,7 @@ class bi extends $ {
|
|
|
5088
5140
|
}),
|
|
5089
5141
|
fontSize: new B({
|
|
5090
5142
|
title: "Size",
|
|
5091
|
-
icon:
|
|
5143
|
+
icon: ni,
|
|
5092
5144
|
default: i.fontSizeDefault ?? 12,
|
|
5093
5145
|
suffix: "px",
|
|
5094
5146
|
mobile: i.fontSizeMobileDefault
|
|
@@ -5174,7 +5226,7 @@ class K extends w {
|
|
|
5174
5226
|
}), i;
|
|
5175
5227
|
}
|
|
5176
5228
|
}
|
|
5177
|
-
class
|
|
5229
|
+
class xi extends $ {
|
|
5178
5230
|
constructor(t) {
|
|
5179
5231
|
super({
|
|
5180
5232
|
title: "Margins",
|
|
@@ -5182,25 +5234,25 @@ class wi extends $ {
|
|
|
5182
5234
|
settings: {
|
|
5183
5235
|
marginTop: new K({
|
|
5184
5236
|
title: "Top",
|
|
5185
|
-
icon:
|
|
5237
|
+
icon: oi,
|
|
5186
5238
|
suffix: "px",
|
|
5187
5239
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
5188
5240
|
}),
|
|
5189
5241
|
marginRight: new K({
|
|
5190
5242
|
title: "Right",
|
|
5191
|
-
icon:
|
|
5243
|
+
icon: ai,
|
|
5192
5244
|
suffix: "px",
|
|
5193
5245
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
5194
5246
|
}),
|
|
5195
5247
|
marginBottom: new K({
|
|
5196
5248
|
title: "Bottom",
|
|
5197
|
-
icon:
|
|
5249
|
+
icon: li,
|
|
5198
5250
|
suffix: "px",
|
|
5199
5251
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
5200
5252
|
}),
|
|
5201
5253
|
marginLeft: new K({
|
|
5202
5254
|
title: "Left",
|
|
5203
|
-
icon:
|
|
5255
|
+
icon: ri,
|
|
5204
5256
|
suffix: "px",
|
|
5205
5257
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
5206
5258
|
})
|
|
@@ -5217,16 +5269,16 @@ class wi extends $ {
|
|
|
5217
5269
|
`;
|
|
5218
5270
|
}
|
|
5219
5271
|
}
|
|
5220
|
-
const
|
|
5272
|
+
const oi = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5221
5273
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5222
|
-
</svg>`, oi = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5223
|
-
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5224
5274
|
</svg>`, ai = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5225
|
-
<path d="
|
|
5275
|
+
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5226
5276
|
</svg>`, li = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5277
|
+
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5278
|
+
</svg>`, ri = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
5227
5279
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5228
5280
|
</svg>`;
|
|
5229
|
-
class
|
|
5281
|
+
class Li extends $ {
|
|
5230
5282
|
constructor(t) {
|
|
5231
5283
|
super({
|
|
5232
5284
|
title: "Background Image",
|
|
@@ -5239,7 +5291,7 @@ class xi extends $ {
|
|
|
5239
5291
|
opacity: new ie({
|
|
5240
5292
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
5241
5293
|
}),
|
|
5242
|
-
backgroundColor: new
|
|
5294
|
+
backgroundColor: new j({
|
|
5243
5295
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
5244
5296
|
})
|
|
5245
5297
|
}
|
|
@@ -5265,7 +5317,7 @@ class xi extends $ {
|
|
|
5265
5317
|
`;
|
|
5266
5318
|
}
|
|
5267
5319
|
}
|
|
5268
|
-
class
|
|
5320
|
+
class ki extends $ {
|
|
5269
5321
|
constructor(t) {
|
|
5270
5322
|
super({
|
|
5271
5323
|
title: (t == null ? void 0 : t.title) ?? "Image",
|
|
@@ -5275,11 +5327,11 @@ class Li extends $ {
|
|
|
5275
5327
|
...t == null ? void 0 : t.uploadProps,
|
|
5276
5328
|
default: (t == null ? void 0 : t.image) ?? ""
|
|
5277
5329
|
}),
|
|
5278
|
-
width: new
|
|
5330
|
+
width: new Ze({
|
|
5279
5331
|
default: (t == null ? void 0 : t.width) ?? 1e3,
|
|
5280
5332
|
mobile: t == null ? void 0 : t.widthMobile
|
|
5281
5333
|
}),
|
|
5282
|
-
height: new
|
|
5334
|
+
height: new _e({
|
|
5283
5335
|
default: (t == null ? void 0 : t.height) ?? 300,
|
|
5284
5336
|
mobile: t == null ? void 0 : t.heightMobile
|
|
5285
5337
|
})
|
|
@@ -5289,39 +5341,39 @@ class Li extends $ {
|
|
|
5289
5341
|
}
|
|
5290
5342
|
export {
|
|
5291
5343
|
ne as AlignSetting,
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5344
|
+
Ei as AnimationSetting,
|
|
5345
|
+
Li as BackgroundSettingSet,
|
|
5346
|
+
bi as BorderSettingSet,
|
|
5347
|
+
pi as ButtonSetting,
|
|
5296
5348
|
H as ColorSetting,
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5349
|
+
j as ColorWithOpacitySetting,
|
|
5350
|
+
ui as DimensionSetting,
|
|
5351
|
+
vi as GapSetting,
|
|
5300
5352
|
J as GradientSetting,
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5353
|
+
wi as HeaderTypographySettingSet,
|
|
5354
|
+
_e as HeightSetting,
|
|
5355
|
+
di as HtmlSetting,
|
|
5304
5356
|
kt as ImageMapSetting,
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5357
|
+
ki as ImageSettingSet,
|
|
5358
|
+
fi as MarginBottomSetting,
|
|
5359
|
+
xi as MarginSettingGroup,
|
|
5360
|
+
Ci as MarginTopSetting,
|
|
5361
|
+
yi as MultiLanguageSetting,
|
|
5310
5362
|
B as NumberSetting,
|
|
5311
5363
|
ie as OpacitySetting,
|
|
5312
|
-
|
|
5364
|
+
gi as SelectApiSettings,
|
|
5313
5365
|
ht as SelectSetting,
|
|
5314
5366
|
w as Setting,
|
|
5315
5367
|
$ as SettingGroup,
|
|
5316
5368
|
Kt as StringSetting,
|
|
5317
5369
|
Xt as TabSettingGroup,
|
|
5318
5370
|
Xt as TabsSettingGroup,
|
|
5319
|
-
|
|
5371
|
+
mi as Toggle,
|
|
5320
5372
|
ut as UploadSetting,
|
|
5321
|
-
|
|
5322
|
-
|
|
5373
|
+
Ze as WidthSetting,
|
|
5374
|
+
hi as asSettingGroupWithSettings,
|
|
5323
5375
|
Yt as createSettingGroup,
|
|
5324
|
-
|
|
5376
|
+
ci as createTabSettingGroup,
|
|
5325
5377
|
R as isSetting,
|
|
5326
5378
|
vt as isSettingChild,
|
|
5327
5379
|
M as isSettingGroup,
|