builder-settings-types 0.0.324 → 0.0.326
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const bt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let mt = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t += bt[e[
|
|
2
|
+
let mt = (h = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
|
+
for (; h--; )
|
|
5
|
+
t += bt[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function wt(
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function wt(h) {
|
|
9
|
+
let t = 0, e = h.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function Z(
|
|
14
|
+
function Z(h, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function et(
|
|
19
|
-
|
|
18
|
+
function et(h, t = 0) {
|
|
19
|
+
h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
21
|
Z(s, n), et(s, n);
|
|
22
22
|
});
|
|
@@ -112,20 +112,20 @@ class Lt {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const rt = new Lt();
|
|
115
|
-
function Y(
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
115
|
+
function Y(h) {
|
|
116
|
+
if (h === null || typeof h != "object") return h;
|
|
117
|
+
if (h instanceof Date) return new Date(h.getTime());
|
|
118
|
+
if (h instanceof Array) return h.map((t) => Y(t));
|
|
119
|
+
if (typeof h == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in h)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(h, e) && (t[e] = Y(h[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return h;
|
|
126
126
|
}
|
|
127
|
-
function kt(
|
|
128
|
-
switch (
|
|
127
|
+
function kt(h) {
|
|
128
|
+
switch (h) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -262,79 +262,79 @@ M.currentLanguageExplicitlySet = !1, M.languageChangeCallbacks = /* @__PURE__ */
|
|
|
262
262
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
263
263
|
];
|
|
264
264
|
let x = M;
|
|
265
|
-
function G(
|
|
266
|
-
return
|
|
265
|
+
function G(h) {
|
|
266
|
+
return h instanceof x;
|
|
267
267
|
}
|
|
268
|
-
function k(
|
|
269
|
-
return
|
|
268
|
+
function k(h) {
|
|
269
|
+
return h instanceof $;
|
|
270
270
|
}
|
|
271
|
-
function ct(
|
|
272
|
-
return G(
|
|
271
|
+
function ct(h) {
|
|
272
|
+
return G(h) || k(h);
|
|
273
273
|
}
|
|
274
|
-
const ot = (
|
|
274
|
+
const ot = (h, t, e) => {
|
|
275
275
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
276
|
-
const l = (
|
|
277
|
-
if (
|
|
278
|
-
i = !0, s =
|
|
279
|
-
const
|
|
280
|
-
o =
|
|
281
|
-
}, r = (
|
|
276
|
+
const l = (p) => {
|
|
277
|
+
if (p.target.closest("button")) return;
|
|
278
|
+
i = !0, s = p.clientX, n = p.clientY;
|
|
279
|
+
const d = t.getBoundingClientRect();
|
|
280
|
+
o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
281
|
+
}, r = (p) => {
|
|
282
282
|
if (!i) return;
|
|
283
|
-
const
|
|
284
|
-
let
|
|
285
|
-
|
|
283
|
+
const d = p.clientX - s, g = p.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
|
|
284
|
+
let v = o + d, y = a + g;
|
|
285
|
+
v = Math.max(8, Math.min(C - u - 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
|
}, c = () => {
|
|
287
287
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
|
|
288
288
|
};
|
|
289
|
-
|
|
290
|
-
},
|
|
291
|
-
if (!
|
|
292
|
-
let t =
|
|
289
|
+
h.addEventListener("mousedown", l);
|
|
290
|
+
}, F = (h) => {
|
|
291
|
+
if (!h) return null;
|
|
292
|
+
let t = h.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()}`;
|
|
294
|
-
}, X = (
|
|
295
|
-
const t =
|
|
294
|
+
}, X = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (h) => {
|
|
295
|
+
const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
296
296
|
return {
|
|
297
297
|
r: parseInt(e.slice(0, 2), 16),
|
|
298
298
|
g: parseInt(e.slice(2, 4), 16),
|
|
299
299
|
b: parseInt(e.slice(4, 6), 16)
|
|
300
300
|
};
|
|
301
|
-
},
|
|
302
|
-
const { r: t, g: e, b: i } = P(
|
|
301
|
+
}, U = (h) => {
|
|
302
|
+
const { r: t, g: e, b: i } = P(h), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
303
303
|
let c = 0;
|
|
304
304
|
r !== 0 && (a === s ? c = (n - o) / r % 6 : a === n ? c = (o - s) / r + 2 : c = (s - n) / r + 4), c < 0 && (c += 6);
|
|
305
|
-
const
|
|
306
|
-
return { h: c * 60, s:
|
|
307
|
-
},
|
|
308
|
-
const i = (
|
|
305
|
+
const p = a === 0 ? 0 : r / a, d = a;
|
|
306
|
+
return { h: c * 60, s: p, v: d };
|
|
307
|
+
}, W = (h, t, e) => {
|
|
308
|
+
const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
309
309
|
let a = 0, l = 0, r = 0;
|
|
310
310
|
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), X(
|
|
311
311
|
Math.round((a + o) * 255),
|
|
312
312
|
Math.round((l + o) * 255),
|
|
313
313
|
Math.round((r + o) * 255)
|
|
314
314
|
);
|
|
315
|
-
}, vt = (
|
|
315
|
+
}, vt = (h, t, e) => {
|
|
316
316
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
317
|
-
return { hue:
|
|
318
|
-
}, it = (
|
|
319
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
317
|
+
return { hue: h, sat: s, lightness: i };
|
|
318
|
+
}, it = (h, t, e) => {
|
|
319
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
|
|
320
320
|
let o = 0, a = 0, l = 0;
|
|
321
|
-
return
|
|
321
|
+
return h < 60 ? (o = i, a = s, l = 0) : h < 120 ? (o = s, a = i, l = 0) : h < 180 ? (o = 0, a = i, l = s) : h < 240 ? (o = 0, a = s, l = i) : h < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
322
322
|
r: Math.round((o + n) * 255),
|
|
323
323
|
g: Math.round((a + n) * 255),
|
|
324
324
|
b: Math.round((l + n) * 255)
|
|
325
325
|
};
|
|
326
|
-
}, st = (
|
|
326
|
+
}, st = (h, t) => {
|
|
327
327
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
328
|
-
if (
|
|
329
|
-
const { r: s, g: n, b: o } = P(
|
|
328
|
+
if (h.startsWith("#")) {
|
|
329
|
+
const { r: s, g: n, b: o } = P(h);
|
|
330
330
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
331
331
|
}
|
|
332
|
-
if (
|
|
333
|
-
return
|
|
334
|
-
if (
|
|
335
|
-
return
|
|
336
|
-
if (
|
|
337
|
-
const s =
|
|
332
|
+
if (h.startsWith("rgba("))
|
|
333
|
+
return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
334
|
+
if (h.startsWith("rgb("))
|
|
335
|
+
return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
336
|
+
if (h.startsWith("hsl(")) {
|
|
337
|
+
const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
338
338
|
if (s) {
|
|
339
339
|
const { r: n, g: o, b: a } = it(
|
|
340
340
|
parseInt(s[1]),
|
|
@@ -344,8 +344,8 @@ const ot = (d, t, e) => {
|
|
|
344
344
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
if (
|
|
348
|
-
const s =
|
|
347
|
+
if (h.startsWith("hsla(")) {
|
|
348
|
+
const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
349
349
|
if (s) {
|
|
350
350
|
const { r: n, g: o, b: a } = it(
|
|
351
351
|
parseInt(s[1]),
|
|
@@ -355,13 +355,13 @@ const ot = (d, t, e) => {
|
|
|
355
355
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
const i =
|
|
358
|
+
const i = F(h);
|
|
359
359
|
if (i) {
|
|
360
360
|
const { r: s, g: n, b: o } = P(i);
|
|
361
361
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
362
362
|
}
|
|
363
|
-
return
|
|
364
|
-
}, Mt = (
|
|
363
|
+
return h;
|
|
364
|
+
}, Mt = (h) => [
|
|
365
365
|
"red",
|
|
366
366
|
"green",
|
|
367
367
|
"blue",
|
|
@@ -385,18 +385,18 @@ const ot = (d, t, e) => {
|
|
|
385
385
|
"teal",
|
|
386
386
|
"fuchsia",
|
|
387
387
|
"transparent"
|
|
388
|
-
].includes(
|
|
388
|
+
].includes(h.toLowerCase()), ft = (h) => [
|
|
389
389
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
390
390
|
/^rgba?\s*\([^)]+\)$/,
|
|
391
391
|
/^hsla?\s*\([^)]+\)$/,
|
|
392
392
|
/^[a-zA-Z]+$/
|
|
393
|
-
].some((e) => e.test(
|
|
393
|
+
].some((e) => e.test(h.trim())), It = (h) => {
|
|
394
394
|
if (typeof document > "u")
|
|
395
|
-
return ft(
|
|
395
|
+
return ft(h) || !!F(h);
|
|
396
396
|
const t = document.createElement("div");
|
|
397
|
-
return t.style.color =
|
|
398
|
-
}, Ct = (
|
|
399
|
-
const t =
|
|
397
|
+
return t.style.color = h, t.style.color !== "";
|
|
398
|
+
}, Ct = (h) => {
|
|
399
|
+
const t = h.trim();
|
|
400
400
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
401
401
|
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
402
402
|
return {
|
|
@@ -431,12 +431,12 @@ const ot = (d, t, e) => {
|
|
|
431
431
|
opacity: Math.round(l * 100)
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
|
-
return { color:
|
|
435
|
-
}, ht = (
|
|
434
|
+
return { color: F(t) || t, position: 0, opacity: 100 };
|
|
435
|
+
}, ht = (h) => {
|
|
436
436
|
const t = [];
|
|
437
437
|
let e = "", i = 0;
|
|
438
|
-
for (let s = 0; s <
|
|
439
|
-
const n =
|
|
438
|
+
for (let s = 0; s < h.length; s++) {
|
|
439
|
+
const n = h[s];
|
|
440
440
|
if (n === "(") i++;
|
|
441
441
|
else if (n === ")") i--;
|
|
442
442
|
else if (n === "," && i === 0) {
|
|
@@ -446,16 +446,16 @@ const ot = (d, t, e) => {
|
|
|
446
446
|
e += n;
|
|
447
447
|
}
|
|
448
448
|
return e.trim() && t.push(e.trim()), t;
|
|
449
|
-
}, dt = (
|
|
450
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
449
|
+
}, dt = (h, t) => {
|
|
450
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
|
|
451
451
|
if (!i) return null;
|
|
452
452
|
const s = i.index + i[0].length;
|
|
453
453
|
let n = 1, o = s;
|
|
454
|
-
for (let a = s; a <
|
|
455
|
-
|
|
456
|
-
return n === 0 ?
|
|
457
|
-
},
|
|
458
|
-
const t =
|
|
454
|
+
for (let a = s; a < h.length && n > 0; a++)
|
|
455
|
+
h[a] === "(" ? n++ : h[a] === ")" && n--, o = a;
|
|
456
|
+
return n === 0 ? h.substring(s, o) : null;
|
|
457
|
+
}, Nt = (h) => {
|
|
458
|
+
const t = h.split(" ")[0].toLowerCase();
|
|
459
459
|
return [
|
|
460
460
|
"circle",
|
|
461
461
|
"ellipse",
|
|
@@ -466,32 +466,32 @@ const ot = (d, t, e) => {
|
|
|
466
466
|
"at",
|
|
467
467
|
"contain",
|
|
468
468
|
"cover"
|
|
469
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
470
|
-
}, pt = (
|
|
469
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Mt(t);
|
|
470
|
+
}, pt = (h) => {
|
|
471
471
|
const t = [];
|
|
472
|
-
return
|
|
472
|
+
return h.forEach((e, i) => {
|
|
473
473
|
const s = e.trim();
|
|
474
474
|
if (!s) return;
|
|
475
475
|
let n = "", o = 0;
|
|
476
476
|
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
477
|
-
a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o =
|
|
477
|
+
a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = h.length === 1 ? 0 : i / (h.length - 1) * 100);
|
|
478
478
|
const l = Ct(n);
|
|
479
479
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
480
480
|
}), t;
|
|
481
|
-
}, A = (
|
|
482
|
-
const t =
|
|
481
|
+
}, A = (h) => {
|
|
482
|
+
const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
483
483
|
return {
|
|
484
|
-
type:
|
|
485
|
-
angle: typeof
|
|
484
|
+
type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
|
|
485
|
+
angle: typeof h.angle == "number" ? h.angle : 90,
|
|
486
486
|
stops: t.map((e, i) => ({
|
|
487
487
|
color: e.color || "#000000",
|
|
488
488
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
489
489
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
490
490
|
}))
|
|
491
491
|
};
|
|
492
|
-
}, T = (
|
|
493
|
-
const t =
|
|
494
|
-
if (
|
|
492
|
+
}, T = (h) => {
|
|
493
|
+
const t = h.replace(/;$/, "").trim();
|
|
494
|
+
if (It(t)) {
|
|
495
495
|
const s = Ct(t);
|
|
496
496
|
return A({ type: "solid", angle: 0, stops: [s] });
|
|
497
497
|
}
|
|
@@ -518,25 +518,25 @@ const ot = (d, t, e) => {
|
|
|
518
518
|
}
|
|
519
519
|
const i = dt(t, "radial-gradient");
|
|
520
520
|
if (i) {
|
|
521
|
-
const s = ht(i), n = s[0] && !
|
|
521
|
+
const s = ht(i), n = s[0] && !Nt(s[0]) ? s.slice(1) : s, o = pt(n);
|
|
522
522
|
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
523
523
|
}
|
|
524
524
|
return null;
|
|
525
|
-
}, S = (
|
|
526
|
-
if (
|
|
527
|
-
const e =
|
|
525
|
+
}, S = (h) => {
|
|
526
|
+
if (h.type === "solid") {
|
|
527
|
+
const e = h.stops[0], i = e.color;
|
|
528
528
|
if (i.startsWith("var(--"))
|
|
529
529
|
return i;
|
|
530
530
|
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
531
531
|
return `#${n}${o}`;
|
|
532
532
|
}
|
|
533
|
-
const t =
|
|
533
|
+
const t = h.stops.map(
|
|
534
534
|
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
535
535
|
).join(", ");
|
|
536
|
-
return
|
|
537
|
-
}, St = (
|
|
538
|
-
if (
|
|
539
|
-
const t =
|
|
536
|
+
return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
|
|
537
|
+
}, St = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (h) => {
|
|
538
|
+
if (h.type === "solid") {
|
|
539
|
+
const t = h.stops[0];
|
|
540
540
|
if (t) {
|
|
541
541
|
const e = t.color;
|
|
542
542
|
if (e.startsWith("var(--"))
|
|
@@ -552,7 +552,7 @@ const ot = (d, t, e) => {
|
|
|
552
552
|
}
|
|
553
553
|
return "#000000";
|
|
554
554
|
}
|
|
555
|
-
return
|
|
555
|
+
return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
|
|
556
556
|
}, q = class q {
|
|
557
557
|
static defaults() {
|
|
558
558
|
return {
|
|
@@ -563,7 +563,7 @@ const ot = (d, t, e) => {
|
|
|
563
563
|
static normalizeList(t) {
|
|
564
564
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
565
565
|
return t.forEach((s) => {
|
|
566
|
-
let n =
|
|
566
|
+
let n = F(s);
|
|
567
567
|
n || T(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
568
568
|
}), i.slice(0, this.MAX_COLORS);
|
|
569
569
|
}
|
|
@@ -609,7 +609,7 @@ const ot = (d, t, e) => {
|
|
|
609
609
|
}
|
|
610
610
|
static addColor(t, e) {
|
|
611
611
|
if (!t) return;
|
|
612
|
-
let i =
|
|
612
|
+
let i = F(t), s = "solid";
|
|
613
613
|
if (i)
|
|
614
614
|
s = "solid";
|
|
615
615
|
else {
|
|
@@ -622,8 +622,8 @@ const ot = (d, t, e) => {
|
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
624
|
q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
|
|
625
|
-
let
|
|
626
|
-
const at = (
|
|
625
|
+
let R = q;
|
|
626
|
+
const at = (h, t) => {
|
|
627
627
|
const e = document.createElement("div");
|
|
628
628
|
e.className = "color-picker-recent-section";
|
|
629
629
|
const i = document.createElement("div");
|
|
@@ -632,54 +632,54 @@ const at = (d, t) => {
|
|
|
632
632
|
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
633
633
|
const n = () => {
|
|
634
634
|
s.style.display = "none";
|
|
635
|
-
}, o = (c,
|
|
636
|
-
const
|
|
637
|
-
s.textContent =
|
|
635
|
+
}, o = (c, p) => {
|
|
636
|
+
const d = c.getBoundingClientRect();
|
|
637
|
+
s.textContent = p, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
638
638
|
}, a = document.createElement("div");
|
|
639
639
|
a.className = "color-picker-recent-grid";
|
|
640
640
|
const l = document.createElement("div");
|
|
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 c =
|
|
644
|
+
const c = R.getColors(t);
|
|
645
645
|
if (c.length === 0) {
|
|
646
646
|
a.style.display = "none", l.style.display = "block";
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
|
-
a.style.display = "grid", l.style.display = "none", c.forEach((
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
const g = Vt(
|
|
653
|
-
if (
|
|
654
|
-
|
|
655
|
-
const m = T(
|
|
656
|
-
m && m.stops && m.stops.length > 0 && (
|
|
649
|
+
a.style.display = "grid", l.style.display = "none", c.forEach((p) => {
|
|
650
|
+
const d = document.createElement("button");
|
|
651
|
+
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
652
|
+
const g = Vt(p);
|
|
653
|
+
if (d.title = g, d.setAttribute("aria-label", `Use color: ${g}`), p.includes("gradient(")) {
|
|
654
|
+
d.style.backgroundImage = p, d.style.backgroundColor = "transparent";
|
|
655
|
+
const m = T(p);
|
|
656
|
+
m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
|
|
657
657
|
} else
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
n(),
|
|
661
|
-
}),
|
|
662
|
-
|
|
663
|
-
}),
|
|
658
|
+
d.style.backgroundColor = p, d.style.borderColor = p;
|
|
659
|
+
d.addEventListener("mouseenter", () => o(d, g)), d.addEventListener("mouseleave", () => {
|
|
660
|
+
n(), d.style.boxShadow = "";
|
|
661
|
+
}), d.addEventListener("mousedown", () => {
|
|
662
|
+
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
663
|
+
}), d.addEventListener("mouseup", () => {
|
|
664
664
|
setTimeout(() => {
|
|
665
|
-
|
|
665
|
+
d.style.boxShadow = "";
|
|
666
666
|
}, 150);
|
|
667
|
-
}),
|
|
668
|
-
n(),
|
|
669
|
-
}), a.appendChild(
|
|
667
|
+
}), d.addEventListener("click", () => {
|
|
668
|
+
n(), h(p);
|
|
669
|
+
}), a.appendChild(d);
|
|
670
670
|
});
|
|
671
671
|
};
|
|
672
672
|
return r(), { container: e, refresh: r };
|
|
673
|
-
}, Vt = (
|
|
674
|
-
const t = T(
|
|
673
|
+
}, Vt = (h) => {
|
|
674
|
+
const t = T(h);
|
|
675
675
|
if (t)
|
|
676
676
|
return K(t);
|
|
677
|
-
const e =
|
|
677
|
+
const e = F(h);
|
|
678
678
|
if (e) {
|
|
679
679
|
const i = P(e);
|
|
680
680
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
681
681
|
}
|
|
682
|
-
return
|
|
682
|
+
return h;
|
|
683
683
|
}, yt = `<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"
|
|
@@ -760,77 +760,77 @@ class ut {
|
|
|
760
760
|
r.className = "color-picker-sliders-group";
|
|
761
761
|
const c = document.createElement("div");
|
|
762
762
|
c.className = "color-picker-hue", this.hueSlider = c;
|
|
763
|
-
const h = document.createElement("div");
|
|
764
|
-
h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
|
|
765
763
|
const p = document.createElement("div");
|
|
766
|
-
p.className = "color-picker-
|
|
764
|
+
p.className = "color-picker-hue-marker", this.hueMarker = p, c.appendChild(p);
|
|
765
|
+
const d = document.createElement("div");
|
|
766
|
+
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
767
767
|
const g = document.createElement("div");
|
|
768
|
-
g.className = "color-picker-opacity-marker", this.opacityMarker = g,
|
|
769
|
-
const
|
|
768
|
+
g.className = "color-picker-opacity-marker", this.opacityMarker = g, d.appendChild(g), r.appendChild(c), r.appendChild(d), a.appendChild(l), a.appendChild(r);
|
|
769
|
+
const C = at((E) => {
|
|
770
770
|
var w;
|
|
771
771
|
this.setColor(E), (w = this.onChange) == null || w.call(this, E, this.currentOpacity);
|
|
772
772
|
}, this.recentScope);
|
|
773
|
-
this.recentSectionRefresh =
|
|
773
|
+
this.recentSectionRefresh = C.refresh;
|
|
774
774
|
const m = document.createElement("div");
|
|
775
775
|
m.className = "color-picker-format-section";
|
|
776
776
|
const u = document.createElement("select");
|
|
777
777
|
u.className = "color-picker-format-select", this.select = u;
|
|
778
|
+
const f = document.createElement("option");
|
|
779
|
+
f.value = "hex", f.textContent = "HEX";
|
|
778
780
|
const v = document.createElement("option");
|
|
779
|
-
v.value = "
|
|
780
|
-
const C = document.createElement("option");
|
|
781
|
-
C.value = "rgb", C.textContent = "RGB";
|
|
781
|
+
v.value = "rgb", v.textContent = "RGB";
|
|
782
782
|
const y = document.createElement("option");
|
|
783
|
-
y.value = "hsl", y.textContent = "HSL", u.appendChild(
|
|
783
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.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 L = document.createElement("div");
|
|
787
787
|
L.className = "color-picker-input-container";
|
|
788
|
-
const
|
|
789
|
-
return
|
|
788
|
+
const N = document.createElement("button");
|
|
789
|
+
return N.className = "color-picker-copy-inside", N.textContent = "Copy", L.appendChild(b), L.appendChild(N), m.appendChild(u), m.appendChild(L), 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, c, d, b, u, N, l), t;
|
|
790
790
|
}
|
|
791
791
|
createBackdrop() {
|
|
792
792
|
const t = document.createElement("div");
|
|
793
793
|
return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
|
|
794
794
|
}
|
|
795
795
|
bind(t, e, i, s, n, o, a) {
|
|
796
|
-
const l = (
|
|
797
|
-
var
|
|
798
|
-
const
|
|
799
|
-
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${
|
|
800
|
-
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360,
|
|
801
|
-
this.currentColor =
|
|
802
|
-
}, r = (
|
|
803
|
-
var
|
|
804
|
-
const
|
|
805
|
-
let g = Math.max(0, Math.min(1, (
|
|
796
|
+
const l = (p) => {
|
|
797
|
+
var v;
|
|
798
|
+
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
799
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
800
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - C);
|
|
801
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
802
|
+
}, r = (p) => {
|
|
803
|
+
var v;
|
|
804
|
+
const d = e.getBoundingClientRect();
|
|
805
|
+
let g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
806
806
|
this.hueMarker.style.left = `${g * 100}%`;
|
|
807
|
-
const
|
|
808
|
-
this.currentColor =
|
|
809
|
-
}, c = (
|
|
810
|
-
var
|
|
811
|
-
const
|
|
812
|
-
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (
|
|
807
|
+
const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
|
|
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
|
+
}, c = (p) => {
|
|
810
|
+
var C;
|
|
811
|
+
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
812
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
|
|
813
813
|
};
|
|
814
|
-
t.addEventListener("mousedown", (
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
document.removeEventListener("mousemove",
|
|
814
|
+
t.addEventListener("mousedown", (p) => {
|
|
815
|
+
p.preventDefault(), l(p);
|
|
816
|
+
const d = (C) => l(C), g = () => {
|
|
817
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
818
818
|
};
|
|
819
|
-
document.addEventListener("mousemove",
|
|
820
|
-
}), e.addEventListener("mousedown", (
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
document.removeEventListener("mousemove",
|
|
819
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
820
|
+
}), e.addEventListener("mousedown", (p) => {
|
|
821
|
+
p.preventDefault(), r(p);
|
|
822
|
+
const d = (C) => r(C), g = () => {
|
|
823
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
824
824
|
};
|
|
825
|
-
document.addEventListener("mousemove",
|
|
826
|
-
}), i.addEventListener("mousedown", (
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
document.removeEventListener("mousemove",
|
|
825
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
826
|
+
}), i.addEventListener("mousedown", (p) => {
|
|
827
|
+
p.preventDefault(), c(p);
|
|
828
|
+
const d = (C) => c(C), g = () => {
|
|
829
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
830
830
|
};
|
|
831
|
-
document.addEventListener("mousemove",
|
|
832
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
833
|
-
|
|
831
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
832
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
|
|
833
|
+
p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
|
|
834
834
|
}), o.addEventListener("click", async () => {
|
|
835
835
|
try {
|
|
836
836
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -838,14 +838,14 @@ class ut {
|
|
|
838
838
|
s.select(), document.execCommand("copy");
|
|
839
839
|
}
|
|
840
840
|
}), a.addEventListener("click", async () => {
|
|
841
|
-
var
|
|
841
|
+
var p;
|
|
842
842
|
if (!("EyeDropper" in window)) {
|
|
843
843
|
alert("EyeDropper API is not supported in this browser.");
|
|
844
844
|
return;
|
|
845
845
|
}
|
|
846
846
|
try {
|
|
847
|
-
const
|
|
848
|
-
this.setColor(g), (
|
|
847
|
+
const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
|
|
848
|
+
this.setColor(g), (p = this.onChange) == null || p.call(this, g, this.currentOpacity);
|
|
849
849
|
} catch {
|
|
850
850
|
}
|
|
851
851
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -856,11 +856,11 @@ class ut {
|
|
|
856
856
|
setColor(t) {
|
|
857
857
|
var o;
|
|
858
858
|
this.currentColor = t;
|
|
859
|
-
const { h: e, s: i, v: s } =
|
|
859
|
+
const { h: e, s: i, v: s } = U(t), n = e >= 360 ? e % 360 : e;
|
|
860
860
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
861
861
|
}
|
|
862
862
|
syncInput() {
|
|
863
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
863
|
+
const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
|
|
864
864
|
if (t === "hex") this.input.value = this.currentColor;
|
|
865
865
|
else if (t === "rgb") {
|
|
866
866
|
const { r: n, g: o, b: a } = P(this.currentColor);
|
|
@@ -885,7 +885,7 @@ class ut {
|
|
|
885
885
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
886
886
|
if (s) {
|
|
887
887
|
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
888
|
-
e =
|
|
888
|
+
e = W(n, r, l);
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
}
|
|
@@ -901,18 +901,18 @@ class ut {
|
|
|
901
901
|
open(t, e, i) {
|
|
902
902
|
var y;
|
|
903
903
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
904
|
-
const { h: s, s: n, v: o } =
|
|
904
|
+
const { h: s, s: n, v: o } = U(t);
|
|
905
905
|
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);
|
|
906
|
-
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth,
|
|
907
|
-
let g = r.right + 8,
|
|
906
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, p = window.innerHeight, d = 16;
|
|
907
|
+
let g = r.right + 8, C = r.top;
|
|
908
908
|
const m = c - r.right, u = r.left;
|
|
909
|
-
m >= a +
|
|
910
|
-
const
|
|
911
|
-
|
|
909
|
+
m >= a + d ? g = r.right + 8 : u >= a + d ? g = r.left - a - 8 : g = Math.max(d, (c - a) / 2);
|
|
910
|
+
const f = p - r.bottom, v = r.top;
|
|
911
|
+
f >= l + d ? C = r.bottom + 8 : v >= l + d ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > p - d && (C = p - l - d)) : (C = r.top - l - 8, C < d && (C = d)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
|
|
912
912
|
}
|
|
913
913
|
close(t) {
|
|
914
914
|
var e;
|
|
915
|
-
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" && (
|
|
915
|
+
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" && (R.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
916
916
|
}
|
|
917
917
|
getElement() {
|
|
918
918
|
return this.element;
|
|
@@ -920,12 +920,19 @@ class ut {
|
|
|
920
920
|
}
|
|
921
921
|
class Bt {
|
|
922
922
|
constructor(t) {
|
|
923
|
-
this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
|
|
923
|
+
this.isDragging = !1, this.currentColor = "#FFFFFF", this.currentColor = this.sanitizeColor(t.initialColor), this.currentOpacity = this.clampOpacity(t.initialOpacity), this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
|
|
924
924
|
}
|
|
925
925
|
parsePercentage(t) {
|
|
926
926
|
const e = parseFloat(t);
|
|
927
927
|
return isNaN(e) ? 0 : e / 100;
|
|
928
928
|
}
|
|
929
|
+
sanitizeColor(t) {
|
|
930
|
+
const e = this.currentColor || "#FFFFFF";
|
|
931
|
+
return F(t) ?? e;
|
|
932
|
+
}
|
|
933
|
+
clampOpacity(t) {
|
|
934
|
+
return Number.isFinite(t) ? Math.min(100, Math.max(0, Math.round(t))) : 100;
|
|
935
|
+
}
|
|
929
936
|
build() {
|
|
930
937
|
const t = document.createElement("div");
|
|
931
938
|
t.className = "embedded-color-picker";
|
|
@@ -947,70 +954,75 @@ class Bt {
|
|
|
947
954
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
948
955
|
const c = document.createElement("div");
|
|
949
956
|
c.className = "color-picker-opacity-marker", this.opacityMarker = c, r.appendChild(c), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
950
|
-
const
|
|
957
|
+
const p = at((b) => {
|
|
951
958
|
const L = T(b);
|
|
952
959
|
L && L.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
953
960
|
}, "all");
|
|
954
|
-
this.recentSectionRefresh =
|
|
955
|
-
const
|
|
956
|
-
|
|
961
|
+
this.recentSectionRefresh = p.refresh;
|
|
962
|
+
const d = document.createElement("div");
|
|
963
|
+
d.className = "color-picker-format-section embedded";
|
|
957
964
|
const g = document.createElement("select");
|
|
958
965
|
g.className = "color-picker-format-select", this.select = g;
|
|
959
|
-
const
|
|
960
|
-
|
|
966
|
+
const C = document.createElement("option");
|
|
967
|
+
C.value = "hex", C.textContent = "HEX";
|
|
961
968
|
const m = document.createElement("option");
|
|
962
969
|
m.value = "rgb", m.textContent = "RGB";
|
|
963
970
|
const u = document.createElement("option");
|
|
964
|
-
u.value = "hsl", u.textContent = "HSL", g.appendChild(
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
const
|
|
968
|
-
|
|
971
|
+
u.value = "hsl", u.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(u);
|
|
972
|
+
const f = document.createElement("input");
|
|
973
|
+
f.type = "text", f.className = "color-picker-color-input", this.input = f;
|
|
974
|
+
const v = document.createElement("div");
|
|
975
|
+
v.className = "color-picker-input-container";
|
|
969
976
|
const y = document.createElement("button");
|
|
970
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy",
|
|
977
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), d.appendChild(g), d.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(p.container), this.bind(e, a, r, f, g, y, n), t;
|
|
971
978
|
}
|
|
972
979
|
bind(t, e, i, s, n, o, a) {
|
|
973
|
-
const l = (
|
|
974
|
-
const
|
|
975
|
-
this.colorMarker.style.left = `${
|
|
976
|
-
const
|
|
977
|
-
this.currentColor =
|
|
978
|
-
}, r = (
|
|
979
|
-
const
|
|
980
|
-
this.hueMarker.style.left = `${
|
|
981
|
-
const
|
|
982
|
-
this.currentColor =
|
|
983
|
-
linear-gradient(to right, #fff, hsl(${
|
|
984
|
-
}, c = (
|
|
985
|
-
const
|
|
986
|
-
this.opacityMarker.style.left = `${
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
const
|
|
991
|
-
this.
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
const p = (f) => r(f), g = () => {
|
|
997
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
980
|
+
const l = (d, g) => {
|
|
981
|
+
const C = g || t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width)), u = Math.max(0, Math.min(1, (d.clientY - C.top) / C.height));
|
|
982
|
+
this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
983
|
+
const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = W(v, m, 1 - u);
|
|
984
|
+
this.currentColor = y, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
985
|
+
}, r = (d, g) => {
|
|
986
|
+
const C = g || e.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width));
|
|
987
|
+
this.hueMarker.style.left = `${m * 100}%`;
|
|
988
|
+
const u = m * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), y = W(u, f, 1 - v);
|
|
989
|
+
this.currentColor = y, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
990
|
+
linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
991
|
+
}, c = (d, g) => {
|
|
992
|
+
const C = g || i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - C.left) / C.width));
|
|
993
|
+
this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = this.clampOpacity(m * 100), this.queueChange();
|
|
994
|
+
}, p = (d, g, C) => {
|
|
995
|
+
d.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), g(d, this.cachedRect);
|
|
996
|
+
let m = null, u;
|
|
997
|
+
const f = () => {
|
|
998
|
+
this.dragRafId === void 0 && (this.dragRafId = window.requestAnimationFrame(() => {
|
|
999
|
+
this.dragRafId = void 0, m && this.cachedRect && g(m, this.cachedRect);
|
|
1000
|
+
}));
|
|
1001
|
+
}, v = () => {
|
|
1002
|
+
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", u), document.removeEventListener("mouseup", v), window.removeEventListener("blur", v), this.applyPendingExternal());
|
|
998
1003
|
};
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
document.addEventListener("mousemove",
|
|
1004
|
+
u = (y) => {
|
|
1005
|
+
if (!y.buttons) {
|
|
1006
|
+
v();
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
m = y, f();
|
|
1010
|
+
}, document.addEventListener("mousemove", u), document.addEventListener("mouseup", v), window.addEventListener("blur", v);
|
|
1011
|
+
};
|
|
1012
|
+
t.addEventListener("mousedown", (d) => {
|
|
1013
|
+
p(d, l, t);
|
|
1014
|
+
}), e.addEventListener("mousedown", (d) => {
|
|
1015
|
+
p(d, r, e);
|
|
1016
|
+
}), i.addEventListener("mousedown", (d) => {
|
|
1017
|
+
p(d, c, i);
|
|
1006
1018
|
}), n.addEventListener("change", () => {
|
|
1007
1019
|
this.syncInput();
|
|
1008
1020
|
}), s.addEventListener("input", () => {
|
|
1009
1021
|
this.applyFromInput();
|
|
1010
1022
|
}), s.addEventListener("blur", () => {
|
|
1011
1023
|
this.syncInput();
|
|
1012
|
-
}), s.addEventListener("keydown", (
|
|
1013
|
-
|
|
1024
|
+
}), s.addEventListener("keydown", (d) => {
|
|
1025
|
+
d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
|
|
1014
1026
|
}), o.addEventListener("click", async () => {
|
|
1015
1027
|
try {
|
|
1016
1028
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -1023,20 +1035,21 @@ class Bt {
|
|
|
1023
1035
|
return;
|
|
1024
1036
|
}
|
|
1025
1037
|
try {
|
|
1026
|
-
const
|
|
1027
|
-
this.setColor(
|
|
1038
|
+
const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
|
|
1039
|
+
this.setColor(g), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
1028
1040
|
} catch {
|
|
1029
1041
|
}
|
|
1030
1042
|
});
|
|
1031
1043
|
}
|
|
1032
1044
|
setColor(t) {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1045
|
+
const e = this.sanitizeColor(t);
|
|
1046
|
+
this.currentColor = e;
|
|
1047
|
+
const { h: i, s, v: n } = U(e), o = i >= 360 ? i % 360 : i;
|
|
1048
|
+
this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
1049
|
+
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
1037
1050
|
}
|
|
1038
1051
|
syncInput() {
|
|
1039
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
1052
|
+
const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
|
|
1040
1053
|
if (t === "hex")
|
|
1041
1054
|
this.input.value = this.currentColor;
|
|
1042
1055
|
else if (t === "rgb") {
|
|
@@ -1063,7 +1076,7 @@ class Bt {
|
|
|
1063
1076
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
1064
1077
|
if (s) {
|
|
1065
1078
|
const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
1066
|
-
e =
|
|
1079
|
+
e = W(n, r, l);
|
|
1067
1080
|
}
|
|
1068
1081
|
}
|
|
1069
1082
|
}
|
|
@@ -1090,15 +1103,16 @@ class Bt {
|
|
|
1090
1103
|
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
1091
1104
|
}
|
|
1092
1105
|
initFromColor(t, e) {
|
|
1093
|
-
var
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1106
|
+
var l;
|
|
1107
|
+
const i = this.sanitizeColor(t);
|
|
1108
|
+
this.currentColor = i, this.currentOpacity = this.clampOpacity(e);
|
|
1109
|
+
const { h: s, s: n, v: o } = U(i), a = s >= 360 ? s % 360 : s;
|
|
1110
|
+
this.hueMarker.style.left = `${a / 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),
|
|
1111
|
+
linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBg(), this.syncInput(), (l = this.recentSectionRefresh) == null || l.call(this);
|
|
1098
1112
|
}
|
|
1099
1113
|
commitRecentColor() {
|
|
1100
1114
|
var t;
|
|
1101
|
-
this.recentScope === "solid" && (
|
|
1115
|
+
this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
1102
1116
|
}
|
|
1103
1117
|
getElement() {
|
|
1104
1118
|
return this.element;
|
|
@@ -1123,10 +1137,10 @@ const V = class V extends x {
|
|
|
1123
1137
|
angle: "number",
|
|
1124
1138
|
stops: "text"
|
|
1125
1139
|
}, 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.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
1126
|
-
var
|
|
1140
|
+
var d;
|
|
1127
1141
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
1128
|
-
const s = i.target, n = this.popoverEl.contains(s), o = (
|
|
1129
|
-
!n && !o && !l && !r && !c && !
|
|
1142
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), p = s.classList.contains("gradient-popover-backdrop");
|
|
1143
|
+
!n && !o && !l && !r && !c && !p && this.closePopover();
|
|
1130
1144
|
}, this.handlePopoverKeydown = (i) => {
|
|
1131
1145
|
if (this.isPopoverOpen) {
|
|
1132
1146
|
if (i.key === "Escape") {
|
|
@@ -1308,8 +1322,8 @@ const V = class V extends x {
|
|
|
1308
1322
|
n.appendChild(o), s.appendChild(n);
|
|
1309
1323
|
const a = document.createElement("div");
|
|
1310
1324
|
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
1311
|
-
const l = e.children[0], r = e.children[1], c = (
|
|
1312
|
-
this.currentMode =
|
|
1325
|
+
const l = e.children[0], r = e.children[1], c = (p) => {
|
|
1326
|
+
this.currentMode = p, p === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
|
|
1313
1327
|
};
|
|
1314
1328
|
l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
|
|
1315
1329
|
}
|
|
@@ -1376,48 +1390,48 @@ const V = class V extends x {
|
|
|
1376
1390
|
}
|
|
1377
1391
|
renderGlobalColors(t) {
|
|
1378
1392
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
1379
|
-
const e = this.value.stops[0], i = (
|
|
1380
|
-
|
|
1381
|
-
let
|
|
1393
|
+
const e = this.value.stops[0], i = (p) => {
|
|
1394
|
+
p.innerHTML = "";
|
|
1395
|
+
let d = {};
|
|
1382
1396
|
try {
|
|
1383
|
-
|
|
1397
|
+
d = x.GlobalVariables || {};
|
|
1384
1398
|
} catch (u) {
|
|
1385
1399
|
console.warn("Could not access Setting.GlobalVariables", u);
|
|
1386
1400
|
}
|
|
1387
|
-
if (!
|
|
1401
|
+
if (!d || Object.keys(d).length === 0) {
|
|
1388
1402
|
const u = document.createElement("div");
|
|
1389
|
-
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px",
|
|
1403
|
+
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", p.appendChild(u);
|
|
1390
1404
|
return;
|
|
1391
1405
|
}
|
|
1392
1406
|
const g = x.GlobalVariableGroups || [
|
|
1393
1407
|
{ title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
|
|
1394
1408
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
1395
|
-
],
|
|
1409
|
+
], C = this.globalSearchQuery.toLowerCase();
|
|
1396
1410
|
let m;
|
|
1397
|
-
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"),
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1411
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), p.appendChild(m), g.forEach((u) => {
|
|
1412
|
+
const f = Object.entries(d).filter(([v]) => !u.keys.includes(v) && u.title !== "Global Colors" ? !1 : u.keys.includes(v) && v.toLowerCase().includes(C));
|
|
1413
|
+
f.length !== 0 && f.forEach(([v, y]) => {
|
|
1400
1414
|
if (this.globalLayoutMode === "list") {
|
|
1401
1415
|
const b = document.createElement("div");
|
|
1402
1416
|
b.className = "global-color-row";
|
|
1403
1417
|
const L = document.createElement("div");
|
|
1404
1418
|
L.className = "global-color-circle";
|
|
1405
|
-
const
|
|
1406
|
-
L.style.background =
|
|
1419
|
+
const N = this.resolveGlobalVarColor(y);
|
|
1420
|
+
L.style.background = N, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && L.classList.add("selected");
|
|
1407
1421
|
const w = document.createElement("span");
|
|
1408
|
-
w.className = "global-color-label", w.textContent =
|
|
1409
|
-
|
|
1410
|
-
const D = `var(--${
|
|
1411
|
-
this.setValue(D), this.pendingSolidColor = D, i(
|
|
1422
|
+
w.className = "global-color-label", w.textContent = v.split("-").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (I) => {
|
|
1423
|
+
I.preventDefault();
|
|
1424
|
+
const D = `var(--${v})`;
|
|
1425
|
+
this.setValue(D), this.pendingSolidColor = D, i(p);
|
|
1412
1426
|
}), m.appendChild(b);
|
|
1413
1427
|
} else {
|
|
1414
1428
|
const b = document.createElement("div");
|
|
1415
1429
|
b.className = "global-color-circle";
|
|
1416
1430
|
const L = this.resolveGlobalVarColor(y);
|
|
1417
|
-
b.style.background = L, b.title =
|
|
1431
|
+
b.style.background = L, b.title = v.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
|
|
1418
1432
|
E.preventDefault();
|
|
1419
|
-
const w = `var(--${
|
|
1420
|
-
this.setValue(w), this.pendingSolidColor = w, i(
|
|
1433
|
+
const w = `var(--${v})`;
|
|
1434
|
+
this.setValue(w), this.pendingSolidColor = w, i(p);
|
|
1421
1435
|
}), m.appendChild(b);
|
|
1422
1436
|
}
|
|
1423
1437
|
});
|
|
@@ -1431,8 +1445,8 @@ const V = class V extends x {
|
|
|
1431
1445
|
const a = document.createElement("input");
|
|
1432
1446
|
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
1433
1447
|
const l = document.createElement("div");
|
|
1434
|
-
a.addEventListener("input", (
|
|
1435
|
-
this.globalSearchQuery =
|
|
1448
|
+
a.addEventListener("input", (p) => {
|
|
1449
|
+
this.globalSearchQuery = p.target.value, i(l);
|
|
1436
1450
|
}), n.appendChild(o), n.appendChild(a);
|
|
1437
1451
|
const r = document.createElement("button");
|
|
1438
1452
|
r.className = "global-layout-toggle", r.type = "button";
|
|
@@ -1467,15 +1481,15 @@ const V = class V extends x {
|
|
|
1467
1481
|
{
|
|
1468
1482
|
const c = document.createElement("div");
|
|
1469
1483
|
c.className = "gradient-subtype-inline";
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
const
|
|
1473
|
-
|
|
1484
|
+
const p = document.createElement("select");
|
|
1485
|
+
p.className = "gradient-subtype-select";
|
|
1486
|
+
const d = document.createElement("option");
|
|
1487
|
+
d.value = "linear", d.textContent = "Linear";
|
|
1474
1488
|
const g = document.createElement("option");
|
|
1475
|
-
g.value = "radial", g.textContent = "Radial",
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1478
|
-
this.clearGlobalBindingForCustomChange(), this.switchType(
|
|
1489
|
+
g.value = "radial", g.textContent = "Radial", p.appendChild(d), p.appendChild(g), p.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°");
|
|
1490
|
+
const C = document.createElement("button");
|
|
1491
|
+
C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = Tt, p.addEventListener("change", () => {
|
|
1492
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(p.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
|
|
1479
1493
|
}), e.addEventListener("focus", (m) => {
|
|
1480
1494
|
const u = m.target;
|
|
1481
1495
|
u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
|
|
@@ -1484,16 +1498,16 @@ const V = class V extends x {
|
|
|
1484
1498
|
const u = parseInt(m.target.value);
|
|
1485
1499
|
!Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
|
|
1486
1500
|
}), e.addEventListener("blur", (m) => {
|
|
1487
|
-
var
|
|
1501
|
+
var v;
|
|
1488
1502
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1489
1503
|
const u = m.target;
|
|
1490
|
-
let
|
|
1491
|
-
Number.isNaN(
|
|
1492
|
-
}),
|
|
1504
|
+
let f = parseInt(u.value);
|
|
1505
|
+
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), u.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1506
|
+
}), C.addEventListener("click", () => {
|
|
1493
1507
|
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
1494
1508
|
m.position = 100 - m.position;
|
|
1495
1509
|
}), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
1496
|
-
}), c.appendChild(
|
|
1510
|
+
}), c.appendChild(p), c.appendChild(e), c.appendChild(C), t.appendChild(c), this.updateDegreeVisibility(e);
|
|
1497
1511
|
}
|
|
1498
1512
|
const i = document.createElement("div");
|
|
1499
1513
|
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
@@ -1508,8 +1522,8 @@ const V = class V extends x {
|
|
|
1508
1522
|
const l = document.createElement("div");
|
|
1509
1523
|
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
1510
1524
|
const r = at((c) => {
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1525
|
+
const p = T(c);
|
|
1526
|
+
p && (this.clearGlobalBindingForCustomChange(), this.value = p, this.switchType(p.type, !0), this.updateUI(), this.triggerChange());
|
|
1513
1527
|
}, "all");
|
|
1514
1528
|
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
1515
1529
|
var c;
|
|
@@ -1544,32 +1558,32 @@ const V = class V extends x {
|
|
|
1544
1558
|
o.className = "gstop-chip";
|
|
1545
1559
|
const a = this.resolveGlobalVarColor(i.color);
|
|
1546
1560
|
o.style.backgroundColor = a, n.appendChild(o);
|
|
1547
|
-
const l = new ut((u,
|
|
1548
|
-
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u,
|
|
1561
|
+
const l = new ut((u, f) => {
|
|
1562
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, f !== void 0 && (this.value.stops[s].opacity = f), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
1549
1563
|
}, "solid");
|
|
1550
|
-
let r = !1, c = !1,
|
|
1564
|
+
let r = !1, c = !1, p = 0, d = 0;
|
|
1551
1565
|
const g = (u) => {
|
|
1552
|
-
r = !0, c = !1,
|
|
1553
|
-
},
|
|
1566
|
+
r = !0, c = !1, p = u.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
|
|
1567
|
+
}, C = (u) => {
|
|
1554
1568
|
if (!r || !this.value) return;
|
|
1555
|
-
const
|
|
1556
|
-
if (Math.abs(
|
|
1569
|
+
const f = u.clientX - p;
|
|
1570
|
+
if (Math.abs(f) > 3 && (c = !0), c) {
|
|
1557
1571
|
this.clearGlobalBindingForCustomChange();
|
|
1558
|
-
const
|
|
1559
|
-
let y =
|
|
1572
|
+
const v = e.getBoundingClientRect();
|
|
1573
|
+
let y = d + f / v.width * 100;
|
|
1560
1574
|
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
1561
1575
|
}
|
|
1562
1576
|
}, m = (u) => {
|
|
1563
|
-
var
|
|
1577
|
+
var f;
|
|
1564
1578
|
if (r)
|
|
1565
|
-
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
1566
|
-
this.value && (this.value.stops.sort((
|
|
1579
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), c)
|
|
1580
|
+
this.value && (this.value.stops.sort((v, y) => v.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
1567
1581
|
else {
|
|
1568
1582
|
u.stopPropagation();
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
const y = this.resolveGlobalVarColor(
|
|
1572
|
-
l.open(y, o,
|
|
1583
|
+
const v = (f = this.value) == null ? void 0 : f.stops[s];
|
|
1584
|
+
v && setTimeout(() => {
|
|
1585
|
+
const y = this.resolveGlobalVarColor(v.color);
|
|
1586
|
+
l.open(y, o, v.opacity ?? 100);
|
|
1573
1587
|
}, 0);
|
|
1574
1588
|
}
|
|
1575
1589
|
};
|
|
@@ -1580,7 +1594,7 @@ const V = class V extends x {
|
|
|
1580
1594
|
var i;
|
|
1581
1595
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
1582
1596
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
1583
|
-
var L,
|
|
1597
|
+
var L, N;
|
|
1584
1598
|
const o = document.createElement("div");
|
|
1585
1599
|
o.className = "gstop-row";
|
|
1586
1600
|
const a = document.createElement("div");
|
|
@@ -1589,50 +1603,50 @@ const V = class V extends x {
|
|
|
1589
1603
|
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
1590
1604
|
const r = document.createElement("div");
|
|
1591
1605
|
r.className = "gstop-color-container";
|
|
1592
|
-
const c = this.resolveGlobalVarColor(s.color),
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1606
|
+
const c = this.resolveGlobalVarColor(s.color), p = document.createElement("div");
|
|
1607
|
+
p.className = "gstop-color-preview", p.style.backgroundColor = c;
|
|
1608
|
+
const d = document.createElement("input");
|
|
1609
|
+
d.type = "text", d.className = "gstop-color-input", d.value = c.replace("#", "").toUpperCase();
|
|
1596
1610
|
const g = document.createElement("button");
|
|
1597
|
-
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1611
|
+
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(p), r.appendChild(d), r.appendChild(g);
|
|
1612
|
+
const C = document.createElement("button");
|
|
1613
|
+
C.type = "button", C.className = "gstop-del", C.innerHTML = Pt, C.disabled = (((N = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : N.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
|
|
1600
1614
|
const m = document.createElement("span");
|
|
1601
1615
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
1602
1616
|
const u = document.createElement("div");
|
|
1603
1617
|
u.className = "gstop-opacity-group";
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1618
|
+
const f = document.createElement("input");
|
|
1619
|
+
f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
|
|
1620
|
+
const v = P(c);
|
|
1621
|
+
f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`);
|
|
1608
1622
|
const y = document.createElement("span");
|
|
1609
|
-
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(
|
|
1623
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y);
|
|
1610
1624
|
const b = new ut((E, w) => {
|
|
1611
|
-
this.clearGlobalBindingForCustomChange(),
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1625
|
+
this.clearGlobalBindingForCustomChange(), d.value = E.replace("#", "").toUpperCase(), p.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, f.value = String(w), y.textContent = `${w}%`);
|
|
1626
|
+
const I = P(E);
|
|
1627
|
+
f.style.setProperty("--slider-color", `rgb(${I.r}, ${I.g}, ${I.b})`), this.updateGradientPreview(), this.createHandles(
|
|
1614
1628
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1615
1629
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1616
1630
|
), this.updateUI(), this.triggerChange();
|
|
1617
1631
|
}, "solid");
|
|
1618
|
-
|
|
1632
|
+
d.addEventListener("click", (E) => {
|
|
1619
1633
|
E.preventDefault(), E.stopPropagation();
|
|
1620
1634
|
const w = this.resolveGlobalVarColor(s.color);
|
|
1621
|
-
b.open(w,
|
|
1622
|
-
}),
|
|
1635
|
+
b.open(w, d, s.opacity ?? 100);
|
|
1636
|
+
}), d.addEventListener("input", () => {
|
|
1623
1637
|
this.clearGlobalBindingForCustomChange();
|
|
1624
|
-
const E =
|
|
1638
|
+
const E = d.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
|
|
1625
1639
|
if (/^#[0-9A-Fa-f]{6}$/.test(w)) {
|
|
1626
|
-
this.value.stops[n].color = w,
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1640
|
+
this.value.stops[n].color = w, p.style.backgroundColor = w;
|
|
1641
|
+
const I = P(w);
|
|
1642
|
+
f.style.setProperty("--slider-color", `rgb(${I.r}, ${I.g}, ${I.b})`), this.debouncedPreviewUpdate();
|
|
1629
1643
|
}
|
|
1630
|
-
}),
|
|
1644
|
+
}), d.addEventListener("blur", () => {
|
|
1631
1645
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1632
1646
|
}), g.addEventListener("click", async (E) => {
|
|
1633
1647
|
E.stopPropagation();
|
|
1634
1648
|
try {
|
|
1635
|
-
await navigator.clipboard.writeText(`#${
|
|
1649
|
+
await navigator.clipboard.writeText(`#${d.value}`);
|
|
1636
1650
|
} catch {
|
|
1637
1651
|
}
|
|
1638
1652
|
}), l.addEventListener("focus", (E) => {
|
|
@@ -1640,35 +1654,35 @@ const V = class V extends x {
|
|
|
1640
1654
|
w.value = w.value.replace("%", ""), w.select();
|
|
1641
1655
|
}), l.addEventListener("input", (E) => {
|
|
1642
1656
|
this.clearGlobalBindingForCustomChange();
|
|
1643
|
-
const w = E.target,
|
|
1644
|
-
if (!Number.isNaN(
|
|
1645
|
-
const D = Math.max(0, Math.min(100,
|
|
1657
|
+
const w = E.target, I = parseInt(w.value.replace(/[^\d]/g, ""), 10);
|
|
1658
|
+
if (!Number.isNaN(I)) {
|
|
1659
|
+
const D = Math.max(0, Math.min(100, I));
|
|
1646
1660
|
this.value.stops[n].position = D, w.value = `${D}%`, this.debouncedPreviewUpdate();
|
|
1647
1661
|
}
|
|
1648
1662
|
}), l.addEventListener("blur", (E) => {
|
|
1649
1663
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1650
|
-
const w = E.target,
|
|
1651
|
-
if (Number.isNaN(
|
|
1664
|
+
const w = E.target, I = parseInt(w.value.replace(/[^\d]/g, ""), 10);
|
|
1665
|
+
if (Number.isNaN(I))
|
|
1652
1666
|
w.value = `${this.value.stops[n].position}%`;
|
|
1653
1667
|
else {
|
|
1654
|
-
const D = Math.max(0, Math.min(100,
|
|
1668
|
+
const D = Math.max(0, Math.min(100, I));
|
|
1655
1669
|
this.value.stops[n].position = D, w.value = `${D}%`;
|
|
1656
1670
|
}
|
|
1657
1671
|
this.updateGradientPreview(), this.createHandles(
|
|
1658
1672
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1659
1673
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1660
1674
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
1661
|
-
}),
|
|
1675
|
+
}), C.addEventListener("click", () => {
|
|
1662
1676
|
var E;
|
|
1663
1677
|
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
1664
1678
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1665
1679
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1666
1680
|
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((E = document.activeElement) == null ? void 0 : E.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
1667
|
-
}),
|
|
1681
|
+
}), f.addEventListener("input", () => {
|
|
1668
1682
|
this.clearGlobalBindingForCustomChange();
|
|
1669
|
-
const E = parseInt(
|
|
1683
|
+
const E = parseInt(f.value, 10);
|
|
1670
1684
|
this.value.stops[n].opacity = Math.max(0, Math.min(100, E)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
1671
|
-
}),
|
|
1685
|
+
}), f.addEventListener("change", () => {
|
|
1672
1686
|
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1673
1687
|
});
|
|
1674
1688
|
}));
|
|
@@ -1697,10 +1711,10 @@ const V = class V extends x {
|
|
|
1697
1711
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1698
1712
|
const o = this.popoverEl.offsetHeight;
|
|
1699
1713
|
let a = t.right + 8, l = t.top;
|
|
1700
|
-
const r = i - t.right, c = t.left,
|
|
1701
|
-
r <
|
|
1702
|
-
const
|
|
1703
|
-
g >= o + n ? l = t.top - o - 8 :
|
|
1714
|
+
const r = i - t.right, c = t.left, p = e + n;
|
|
1715
|
+
r < p && c > r + 100 && (a = t.left - e - 8);
|
|
1716
|
+
const d = s - t.bottom, g = t.top;
|
|
1717
|
+
g >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : g > d ? (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 };
|
|
1704
1718
|
}
|
|
1705
1719
|
setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
1706
1720
|
}
|
|
@@ -1718,10 +1732,10 @@ const V = class V extends x {
|
|
|
1718
1732
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1719
1733
|
const a = this.popoverEl.offsetHeight;
|
|
1720
1734
|
let l = e.right + 8, r = e.top;
|
|
1721
|
-
const c = s - e.right,
|
|
1722
|
-
c <
|
|
1723
|
-
const g = n - e.bottom,
|
|
1724
|
-
|
|
1735
|
+
const c = s - e.right, p = e.left, d = i + o;
|
|
1736
|
+
c < d && p > c + 100 && (l = e.left - i - 8);
|
|
1737
|
+
const g = n - e.bottom, C = e.top;
|
|
1738
|
+
C >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : C > g ? (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`;
|
|
1725
1739
|
});
|
|
1726
1740
|
}
|
|
1727
1741
|
}
|
|
@@ -1740,13 +1754,13 @@ const V = class V extends x {
|
|
|
1740
1754
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
1741
1755
|
if (this.isPopoverOpen = !1, this.popoverPosition = 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") {
|
|
1742
1756
|
const e = S(this.value);
|
|
1743
|
-
|
|
1757
|
+
R.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
1744
1758
|
}
|
|
1745
1759
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
|
|
1746
1760
|
}
|
|
1747
1761
|
}
|
|
1748
1762
|
commitPendingSolidColor() {
|
|
1749
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
1763
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : R.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
1750
1764
|
}
|
|
1751
1765
|
handlePaste(t) {
|
|
1752
1766
|
var i;
|
|
@@ -1796,10 +1810,10 @@ const V = class V extends x {
|
|
|
1796
1810
|
};
|
|
1797
1811
|
V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
|
|
1798
1812
|
let j = V;
|
|
1799
|
-
function J(
|
|
1800
|
-
for (const e in
|
|
1801
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1802
|
-
const i =
|
|
1813
|
+
function J(h, t) {
|
|
1814
|
+
for (const e in h)
|
|
1815
|
+
if (Object.prototype.hasOwnProperty.call(h, e)) {
|
|
1816
|
+
const i = h[e];
|
|
1803
1817
|
t(e, i);
|
|
1804
1818
|
}
|
|
1805
1819
|
}
|
|
@@ -1820,6 +1834,14 @@ const Q = class Q {
|
|
|
1820
1834
|
setNestingLevel(t) {
|
|
1821
1835
|
this.nestingLevel = t, this.propagateNestingLevel(), this.elementRef && this.updateNestingStyles();
|
|
1822
1836
|
}
|
|
1837
|
+
setTitle(t) {
|
|
1838
|
+
if (this.title = t, this.elementRef) {
|
|
1839
|
+
const e = this.elementRef.querySelector(
|
|
1840
|
+
".setting-group-title h3"
|
|
1841
|
+
);
|
|
1842
|
+
e && (e.textContent = t);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1823
1845
|
getDataPropsPath() {
|
|
1824
1846
|
return this.dataPropsPath;
|
|
1825
1847
|
}
|
|
@@ -1897,16 +1919,16 @@ const Q = class Q {
|
|
|
1897
1919
|
}), s.forEach((r) => {
|
|
1898
1920
|
n.includes(r) || this.removeSetting(r);
|
|
1899
1921
|
}), n.forEach((r) => {
|
|
1900
|
-
var
|
|
1901
|
-
const c = t[r],
|
|
1902
|
-
if (
|
|
1922
|
+
var d;
|
|
1923
|
+
const c = t[r], p = this.settings[r];
|
|
1924
|
+
if (p !== c && (p && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
|
|
1903
1925
|
const g = o[r];
|
|
1904
1926
|
try {
|
|
1905
1927
|
k(c) ? c.setValue(
|
|
1906
1928
|
g
|
|
1907
|
-
) : G(c) ? (
|
|
1908
|
-
} catch (
|
|
1909
|
-
console.warn(`Could not preserve value for setting ${r}:`,
|
|
1929
|
+
) : G(c) ? (d = c.setValue) == null || d.call(c, g) : c.setValue && c.setValue(g);
|
|
1930
|
+
} catch (C) {
|
|
1931
|
+
console.warn(`Could not preserve value for setting ${r}:`, C);
|
|
1910
1932
|
}
|
|
1911
1933
|
}
|
|
1912
1934
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
@@ -2037,8 +2059,8 @@ const Q = class Q {
|
|
|
2037
2059
|
k(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
2038
2060
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
2039
2061
|
if (l) {
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2062
|
+
const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
2063
|
+
p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
|
|
2042
2064
|
}
|
|
2043
2065
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
2044
2066
|
r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), Z(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
|
|
@@ -2190,11 +2212,11 @@ const Q = class Q {
|
|
|
2190
2212
|
r(), t(!1);
|
|
2191
2213
|
}), l.addEventListener("click", () => {
|
|
2192
2214
|
r(), t(!0);
|
|
2193
|
-
}), e.addEventListener("click", (
|
|
2194
|
-
|
|
2215
|
+
}), e.addEventListener("click", (p) => {
|
|
2216
|
+
p.target === e && (r(), t(!1));
|
|
2195
2217
|
});
|
|
2196
|
-
const c = (
|
|
2197
|
-
|
|
2218
|
+
const c = (p) => {
|
|
2219
|
+
p.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
2198
2220
|
};
|
|
2199
2221
|
document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
2200
2222
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -2338,14 +2360,14 @@ const Q = class Q {
|
|
|
2338
2360
|
}, Object.keys(this.settings).length > 0) {
|
|
2339
2361
|
for (const c in this.settings)
|
|
2340
2362
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
2341
|
-
const
|
|
2342
|
-
k(
|
|
2343
|
-
const
|
|
2344
|
-
k(
|
|
2345
|
-
|
|
2363
|
+
const p = this.settings[c];
|
|
2364
|
+
k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
|
|
2365
|
+
const d = p.draw();
|
|
2366
|
+
k(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
|
|
2367
|
+
d,
|
|
2346
2368
|
c,
|
|
2347
|
-
|
|
2348
|
-
), a.appendChild(
|
|
2369
|
+
p
|
|
2370
|
+
), a.appendChild(d);
|
|
2349
2371
|
}
|
|
2350
2372
|
} else {
|
|
2351
2373
|
const c = document.createElement("div");
|
|
@@ -2354,18 +2376,18 @@ const Q = class Q {
|
|
|
2354
2376
|
if (this.addItemCfg) {
|
|
2355
2377
|
const c = document.createElement("button");
|
|
2356
2378
|
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
2357
|
-
const
|
|
2379
|
+
const p = `
|
|
2358
2380
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
2359
2381
|
xmlns="http://www.w3.org/2000/svg">
|
|
2360
2382
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
2361
2383
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
2362
2384
|
</svg>`;
|
|
2363
|
-
c.innerHTML = `${
|
|
2364
|
-
|
|
2365
|
-
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),
|
|
2366
|
-
if (ct(
|
|
2385
|
+
c.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
|
|
2386
|
+
d.stopPropagation(), d.preventDefault();
|
|
2387
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
|
|
2388
|
+
if (ct(C)) {
|
|
2367
2389
|
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
2368
|
-
this.addSetting(m,
|
|
2390
|
+
this.addSetting(m, C);
|
|
2369
2391
|
}
|
|
2370
2392
|
}), a.appendChild(c);
|
|
2371
2393
|
}
|
|
@@ -2413,8 +2435,8 @@ const Q = class Q {
|
|
|
2413
2435
|
};
|
|
2414
2436
|
Q.hiddenElements = /* @__PURE__ */ new Set();
|
|
2415
2437
|
let $ = Q;
|
|
2416
|
-
function be(
|
|
2417
|
-
return new At(
|
|
2438
|
+
function be(h) {
|
|
2439
|
+
return new At(h);
|
|
2418
2440
|
}
|
|
2419
2441
|
class At extends $ {
|
|
2420
2442
|
constructor(t) {
|
|
@@ -2466,9 +2488,9 @@ class At extends $ {
|
|
|
2466
2488
|
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
|
|
2467
2489
|
const c = document.createElement("div");
|
|
2468
2490
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2471
|
-
|
|
2491
|
+
const p = this.settings[a];
|
|
2492
|
+
p && (k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
2493
|
+
p.draw()
|
|
2472
2494
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
2473
2495
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
2474
2496
|
const a = Object.keys(this.settings)[0];
|
|
@@ -2477,11 +2499,11 @@ class At extends $ {
|
|
|
2477
2499
|
return this.updateTabUI(), t;
|
|
2478
2500
|
}
|
|
2479
2501
|
}
|
|
2480
|
-
function Dt(
|
|
2481
|
-
return new $(
|
|
2502
|
+
function Dt(h) {
|
|
2503
|
+
return new $(h);
|
|
2482
2504
|
}
|
|
2483
|
-
function we(
|
|
2484
|
-
return
|
|
2505
|
+
function we(h) {
|
|
2506
|
+
return h;
|
|
2485
2507
|
}
|
|
2486
2508
|
class Gt extends x {
|
|
2487
2509
|
constructor(t = {}) {
|
|
@@ -2524,8 +2546,8 @@ class O extends Gt {
|
|
|
2524
2546
|
if (e.length !== 3 || e.some(isNaN))
|
|
2525
2547
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
2526
2548
|
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (c) => {
|
|
2527
|
-
const
|
|
2528
|
-
return
|
|
2549
|
+
const p = c.toString(16);
|
|
2550
|
+
return p.length === 1 ? "0" + p : p;
|
|
2529
2551
|
};
|
|
2530
2552
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
2531
2553
|
}
|
|
@@ -2585,16 +2607,16 @@ class O extends Gt {
|
|
|
2585
2607
|
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
|
|
2586
2608
|
return;
|
|
2587
2609
|
}
|
|
2588
|
-
Object.entries(m).forEach(([u,
|
|
2589
|
-
const
|
|
2590
|
-
|
|
2591
|
-
var L,
|
|
2610
|
+
Object.entries(m).forEach(([u, f]) => {
|
|
2611
|
+
const v = document.createElement("button");
|
|
2612
|
+
v.className = "global-color-btn", v.title = u, 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(--${u})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (y) => {
|
|
2613
|
+
var L, N;
|
|
2592
2614
|
y.preventDefault();
|
|
2593
2615
|
const b = `var(--${u})`;
|
|
2594
|
-
this.value = b, (L = this.onChange) == null || L.call(this, b), (
|
|
2616
|
+
this.value = b, (L = this.onChange) == null || L.call(this, b), (N = this.detectChange) == null || N.call(this, b), Array.from(a.children).forEach((E) => {
|
|
2595
2617
|
E.style.border = "1px solid #ddd";
|
|
2596
|
-
}),
|
|
2597
|
-
}), a.appendChild(
|
|
2618
|
+
}), v.style.border = "2px solid #2196f3", p.style.backgroundColor = f;
|
|
2619
|
+
}), a.appendChild(v);
|
|
2598
2620
|
});
|
|
2599
2621
|
} catch (m) {
|
|
2600
2622
|
console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
|
|
@@ -2609,48 +2631,48 @@ class O extends Gt {
|
|
|
2609
2631
|
const u = m.value.trim();
|
|
2610
2632
|
if (!u)
|
|
2611
2633
|
return e.classList.remove("error"), !0;
|
|
2612
|
-
const
|
|
2613
|
-
return
|
|
2634
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
|
|
2635
|
+
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
2614
2636
|
}, c = document.createElement("input");
|
|
2615
2637
|
c.type = "color", c.className = "color-picker", c.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", c.setAttribute("aria-label", "Choose color"), c.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && c.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = c;
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2618
|
-
let
|
|
2619
|
-
if (
|
|
2620
|
-
const m =
|
|
2621
|
-
|
|
2638
|
+
const p = document.createElement("div");
|
|
2639
|
+
p.className = "color-preview";
|
|
2640
|
+
let d = this.value || "#000000";
|
|
2641
|
+
if (d.startsWith("var(--")) {
|
|
2642
|
+
const m = d.replace("var(--", "").replace(")", "");
|
|
2643
|
+
d = (x.GlobalVariables || {})[m] || "#000000";
|
|
2622
2644
|
}
|
|
2623
|
-
|
|
2645
|
+
p.style.backgroundColor = d;
|
|
2624
2646
|
const g = document.createElement("input");
|
|
2625
2647
|
g.type = "text", g.className = "color-text-input", g.value = this.value || "", g.placeholder = "#000000", g.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), g.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), g.setAttribute("aria-label", "Hex color value"), g.setAttribute("maxlength", "7"), this.getDataPropsPath() && g.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = g;
|
|
2626
|
-
const
|
|
2627
|
-
var
|
|
2648
|
+
const C = (m) => {
|
|
2649
|
+
var f, v;
|
|
2628
2650
|
let u = m.trim();
|
|
2629
2651
|
if (u && !u.startsWith("#") && !u.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(u) && (u = "#" + u, this.textInputEl && (this.textInputEl.value = u)), this.textInputEl && r(this.textInputEl)) {
|
|
2630
2652
|
const y = O.normalizeColorValue(u);
|
|
2631
|
-
this.value = y, (
|
|
2653
|
+
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), p.style.backgroundColor = y;
|
|
2632
2654
|
}
|
|
2633
2655
|
};
|
|
2634
2656
|
return this.textInputEl.addEventListener("input", (m) => {
|
|
2635
2657
|
const u = m.target.value;
|
|
2636
|
-
|
|
2658
|
+
C(u);
|
|
2637
2659
|
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
2638
|
-
var
|
|
2660
|
+
var f;
|
|
2639
2661
|
m.preventDefault();
|
|
2640
|
-
const u = ((
|
|
2641
|
-
this.textInputEl && (this.textInputEl.value = u.trim(),
|
|
2662
|
+
const u = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
|
|
2663
|
+
this.textInputEl && (this.textInputEl.value = u.trim(), C(u));
|
|
2642
2664
|
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
2643
|
-
var u,
|
|
2644
|
-
m.key === "Enter" && (m.preventDefault(),
|
|
2665
|
+
var u, f, v;
|
|
2666
|
+
m.key === "Enter" && (m.preventDefault(), C(((u = this.textInputEl) == null ? void 0 : u.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"));
|
|
2645
2667
|
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
2646
|
-
var
|
|
2647
|
-
const u = m.target.value,
|
|
2648
|
-
this.value =
|
|
2668
|
+
var v, y;
|
|
2669
|
+
const u = m.target.value, f = O.normalizeColorValue(u);
|
|
2670
|
+
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), p.style.backgroundColor = f, e.classList.remove("error");
|
|
2649
2671
|
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
2650
|
-
var
|
|
2651
|
-
const u = m.target.value,
|
|
2652
|
-
this.value =
|
|
2653
|
-
}), o.appendChild(c), o.appendChild(
|
|
2672
|
+
var v, y;
|
|
2673
|
+
const u = m.target.value, f = O.normalizeColorValue(u);
|
|
2674
|
+
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), p.style.backgroundColor = f;
|
|
2675
|
+
}), o.appendChild(c), o.appendChild(p), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
2654
2676
|
}
|
|
2655
2677
|
getElement() {
|
|
2656
2678
|
return this.element;
|
|
@@ -2674,14 +2696,14 @@ const Rt = `
|
|
|
2674
2696
|
<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"/>
|
|
2675
2697
|
<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"/>
|
|
2676
2698
|
</svg>`;
|
|
2677
|
-
class
|
|
2699
|
+
class z extends x {
|
|
2678
2700
|
constructor(t = {}) {
|
|
2679
2701
|
super({
|
|
2680
2702
|
...t,
|
|
2681
2703
|
icon: t.icon || Rt,
|
|
2682
2704
|
title: t.title || "Color & Opacity",
|
|
2683
2705
|
default: t.default || "#000000FF"
|
|
2684
|
-
}), 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 =
|
|
2706
|
+
}), 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 = z.normalizeHexWithOpacity(this.value));
|
|
2685
2707
|
}
|
|
2686
2708
|
static normalizeHexWithOpacity(t) {
|
|
2687
2709
|
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");
|
|
@@ -2699,7 +2721,7 @@ class R extends x {
|
|
|
2699
2721
|
return `#${i}${n}`;
|
|
2700
2722
|
}
|
|
2701
2723
|
setValue(t) {
|
|
2702
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
2724
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = z.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
2703
2725
|
}
|
|
2704
2726
|
updateInputElements() {
|
|
2705
2727
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -2710,7 +2732,7 @@ class R extends x {
|
|
|
2710
2732
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2711
2733
|
}
|
|
2712
2734
|
handleColorChange(t) {
|
|
2713
|
-
const e = this.getOpacityPercent(), i =
|
|
2735
|
+
const e = this.getOpacityPercent(), i = z.combineColorOpacity(
|
|
2714
2736
|
t,
|
|
2715
2737
|
e
|
|
2716
2738
|
);
|
|
@@ -2721,7 +2743,7 @@ class R extends x {
|
|
|
2721
2743
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
2722
2744
|
}
|
|
2723
2745
|
handleOpacityChange(t) {
|
|
2724
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
2746
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = z.combineColorOpacity(
|
|
2725
2747
|
e,
|
|
2726
2748
|
i
|
|
2727
2749
|
);
|
|
@@ -3637,33 +3659,33 @@ const Kt = `
|
|
|
3637
3659
|
"mousemove",
|
|
3638
3660
|
(c) => this.updateCursorTooltip(c)
|
|
3639
3661
|
), this.value && this.value.markers && this.value.markers.forEach((c) => {
|
|
3640
|
-
const
|
|
3641
|
-
r.appendChild(
|
|
3662
|
+
const p = this.createMarkerElement(c);
|
|
3663
|
+
r.appendChild(p);
|
|
3642
3664
|
}), l.appendChild(r), t.appendChild(l);
|
|
3643
3665
|
}
|
|
3644
3666
|
renderSidebar(t) {
|
|
3645
|
-
var c,
|
|
3667
|
+
var c, p;
|
|
3646
3668
|
const e = document.createElement("div");
|
|
3647
3669
|
e.className = "prize-counter";
|
|
3648
3670
|
const i = this.props.maxMarkers || 10, s = ((c = this.value) == null ? void 0 : c.markers.length) || 0, n = s === i;
|
|
3649
3671
|
e.textContent = `Prizes ${s}/${i}`, n && e.classList.add("complete"), t.appendChild(e);
|
|
3650
3672
|
const o = document.createElement("div");
|
|
3651
3673
|
o.className = "prize-list";
|
|
3652
|
-
const a = ((
|
|
3653
|
-
a.forEach((
|
|
3654
|
-
for (let
|
|
3655
|
-
const g = l.get(
|
|
3656
|
-
u.className = `prize-item ${
|
|
3674
|
+
const a = ((p = this.value) == null ? void 0 : p.markers) || [], l = /* @__PURE__ */ new Map();
|
|
3675
|
+
a.forEach((d) => l.set(d.index, d));
|
|
3676
|
+
for (let d = 1; d <= i; d++) {
|
|
3677
|
+
const g = l.get(d), C = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[d - 1] || `Prize #${d}`, u = document.createElement("div");
|
|
3678
|
+
u.className = `prize-item ${C ? "placed" : "missing"}`;
|
|
3679
|
+
const f = document.createElement("div");
|
|
3680
|
+
f.className = "prize-index", f.textContent = String(d);
|
|
3657
3681
|
const v = document.createElement("div");
|
|
3658
|
-
v.className = "prize-
|
|
3659
|
-
const C = document.createElement("div");
|
|
3660
|
-
C.className = "prize-label";
|
|
3682
|
+
v.className = "prize-label";
|
|
3661
3683
|
const y = document.createElement("div");
|
|
3662
|
-
y.className = "prize-title", y.textContent = `Prize #${
|
|
3684
|
+
y.className = "prize-title", y.textContent = `Prize #${d}`;
|
|
3663
3685
|
const b = document.createElement("div");
|
|
3664
|
-
b.className = "prize-subtitle", b.textContent =
|
|
3686
|
+
b.className = "prize-subtitle", b.textContent = C ? m : "Not Placed", v.appendChild(y), v.appendChild(b);
|
|
3665
3687
|
const L = document.createElement("div");
|
|
3666
|
-
L.className = `prize-status ${
|
|
3688
|
+
L.className = `prize-status ${C ? "placed" : "missing"}`, L.innerHTML = C ? ie : se, u.appendChild(f), u.appendChild(v), u.appendChild(L), o.appendChild(u);
|
|
3667
3689
|
}
|
|
3668
3690
|
t.appendChild(o);
|
|
3669
3691
|
const r = document.createElement("button");
|
|
@@ -3716,20 +3738,20 @@ const Kt = `
|
|
|
3716
3738
|
if (typeof a == "string") {
|
|
3717
3739
|
const r = new Image();
|
|
3718
3740
|
r.onload = () => {
|
|
3719
|
-
var
|
|
3741
|
+
var d;
|
|
3720
3742
|
const c = {
|
|
3721
3743
|
width: r.naturalWidth || 0,
|
|
3722
3744
|
height: r.naturalHeight || 0
|
|
3723
|
-
},
|
|
3724
|
-
((
|
|
3745
|
+
}, p = this.scaleMarkersForNewImage(
|
|
3746
|
+
((d = this.value) == null ? void 0 : d.markers) || [],
|
|
3725
3747
|
e,
|
|
3726
3748
|
c
|
|
3727
3749
|
);
|
|
3728
3750
|
this.value = {
|
|
3729
3751
|
imageUrl: a,
|
|
3730
|
-
markers:
|
|
3752
|
+
markers: p
|
|
3731
3753
|
}, this.lastImageNaturalSize = c, this.history = [
|
|
3732
|
-
JSON.parse(JSON.stringify(
|
|
3754
|
+
JSON.parse(JSON.stringify(p))
|
|
3733
3755
|
], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange();
|
|
3734
3756
|
}, r.onerror = () => {
|
|
3735
3757
|
this.showError("Failed to read image file.");
|
|
@@ -3747,7 +3769,7 @@ const Kt = `
|
|
|
3747
3769
|
);
|
|
3748
3770
|
return;
|
|
3749
3771
|
}
|
|
3750
|
-
const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c,
|
|
3772
|
+
const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, p) => c - p);
|
|
3751
3773
|
let o = 1;
|
|
3752
3774
|
for (const c of n)
|
|
3753
3775
|
if (c === o)
|
|
@@ -3955,11 +3977,11 @@ const Kt = `
|
|
|
3955
3977
|
r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
|
|
3956
3978
|
const c = document.createElement("button");
|
|
3957
3979
|
c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
|
|
3958
|
-
const
|
|
3959
|
-
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(
|
|
3980
|
+
const p = (d) => {
|
|
3981
|
+
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(d);
|
|
3960
3982
|
};
|
|
3961
|
-
r.addEventListener("click", () =>
|
|
3962
|
-
|
|
3983
|
+
r.addEventListener("click", () => p(!1)), c.addEventListener("click", () => p(!0)), s.addEventListener("click", (d) => {
|
|
3984
|
+
d.target === s && p(!1);
|
|
3963
3985
|
}), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
|
|
3964
3986
|
n.classList.add("visible");
|
|
3965
3987
|
}, 10);
|
|
@@ -4170,7 +4192,7 @@ class Me extends x {
|
|
|
4170
4192
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
4171
4193
|
}
|
|
4172
4194
|
}
|
|
4173
|
-
class
|
|
4195
|
+
class Ie extends x {
|
|
4174
4196
|
constructor(t) {
|
|
4175
4197
|
var e, i;
|
|
4176
4198
|
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;
|
|
@@ -4194,7 +4216,7 @@ class Ne extends x {
|
|
|
4194
4216
|
const s = document.createElement("input");
|
|
4195
4217
|
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
4196
4218
|
var r, c;
|
|
4197
|
-
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((
|
|
4219
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((p) => p.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
4198
4220
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
4199
4221
|
});
|
|
4200
4222
|
const n = document.createElement("span");
|
|
@@ -4223,7 +4245,7 @@ class Ne extends x {
|
|
|
4223
4245
|
const ce = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4224
4246
|
<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"/>
|
|
4225
4247
|
</svg>`;
|
|
4226
|
-
class
|
|
4248
|
+
class Ne extends x {
|
|
4227
4249
|
// Store mobile value
|
|
4228
4250
|
constructor(t = {}) {
|
|
4229
4251
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? ce, 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);
|
|
@@ -4345,13 +4367,13 @@ class Te extends x {
|
|
|
4345
4367
|
return;
|
|
4346
4368
|
}
|
|
4347
4369
|
const c = "...";
|
|
4348
|
-
let
|
|
4349
|
-
for (;
|
|
4350
|
-
const m = Math.floor((
|
|
4351
|
-
this.measureTextWidth(u, i) <= l ? (g = m,
|
|
4370
|
+
let p = 0, d = e.length, g = 0;
|
|
4371
|
+
for (; p <= d; ) {
|
|
4372
|
+
const m = Math.floor((p + d) / 2), u = e.slice(0, m).trimEnd() + c;
|
|
4373
|
+
this.measureTextWidth(u, i) <= l ? (g = m, p = m + 1) : d = m - 1;
|
|
4352
4374
|
}
|
|
4353
|
-
const
|
|
4354
|
-
t.placeholder =
|
|
4375
|
+
const C = e.slice(0, g).trimEnd() + c;
|
|
4376
|
+
t.placeholder = C;
|
|
4355
4377
|
}
|
|
4356
4378
|
autosizeTextarea(t, e = 3) {
|
|
4357
4379
|
t.style.height = "auto";
|
|
@@ -4860,7 +4882,7 @@ class Be extends $ {
|
|
|
4860
4882
|
opacity: new Ut({
|
|
4861
4883
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4862
4884
|
}),
|
|
4863
|
-
backgroundColor: new
|
|
4885
|
+
backgroundColor: new z({
|
|
4864
4886
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
4865
4887
|
})
|
|
4866
4888
|
}
|
|
@@ -4915,9 +4937,9 @@ export {
|
|
|
4915
4937
|
Oe as BorderSettingSet,
|
|
4916
4938
|
Le as ButtonSetting,
|
|
4917
4939
|
O as ColorSetting,
|
|
4918
|
-
|
|
4940
|
+
z as ColorWithOpacitySetting,
|
|
4919
4941
|
ke as DimensionSetting,
|
|
4920
|
-
|
|
4942
|
+
Ne as GapSetting,
|
|
4921
4943
|
j as GradientSetting,
|
|
4922
4944
|
$e as HeaderTypographySettingSet,
|
|
4923
4945
|
ne as HeightSetting,
|
|
@@ -4937,7 +4959,7 @@ export {
|
|
|
4937
4959
|
Gt as StringSetting,
|
|
4938
4960
|
At as TabSettingGroup,
|
|
4939
4961
|
At as TabsSettingGroup,
|
|
4940
|
-
|
|
4962
|
+
Ie as Toggle,
|
|
4941
4963
|
lt as UploadSetting,
|
|
4942
4964
|
ae as WidthSetting,
|
|
4943
4965
|
we as asSettingGroupWithSettings,
|