builder-settings-types 0.0.329 → 0.0.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +18 -18
- package/dist/builder-settings-types.es.js +423 -421
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const xt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let ft = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t += xt[e[
|
|
2
|
+
let ft = (d = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(d |= 0));
|
|
4
|
+
for (; d--; )
|
|
5
|
+
t += xt[e[d] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function Lt(
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function Lt(d) {
|
|
9
|
+
let t = 0, e = d.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== d && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function _(
|
|
14
|
+
function _(d, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
d.setAttribute("data-nesting-level", e.toString()), e > 0 ? d.style.setProperty("--visual-indent", `${e * 2}px`) : (d.style.removeProperty("--visual-indent"), d.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function et(
|
|
19
|
-
|
|
18
|
+
function et(d, t = 0) {
|
|
19
|
+
d.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
21
|
_(s, n), et(s, n);
|
|
22
22
|
});
|
|
@@ -112,20 +112,20 @@ class Mt {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const rt = new Mt();
|
|
115
|
-
function Y(
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
115
|
+
function Y(d) {
|
|
116
|
+
if (d === null || typeof d != "object") return d;
|
|
117
|
+
if (d instanceof Date) return new Date(d.getTime());
|
|
118
|
+
if (d instanceof Array) return d.map((t) => Y(t));
|
|
119
|
+
if (typeof d == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in d)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(d, e) && (t[e] = Y(d[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return d;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function Nt(d) {
|
|
128
|
+
switch (d) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -206,7 +206,7 @@ const M = class M {
|
|
|
206
206
|
const i = document.createElement("div");
|
|
207
207
|
i.className = t.wrapperClassName || "";
|
|
208
208
|
const s = document.createElement("input");
|
|
209
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
209
|
+
this.inputEl = s, s.value = String(t.value || Nt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
210
210
|
const n = (a) => {
|
|
211
211
|
const l = a.target;
|
|
212
212
|
let r = l.value;
|
|
@@ -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 w = M;
|
|
265
|
-
function F(
|
|
266
|
-
return
|
|
265
|
+
function F(d) {
|
|
266
|
+
return d instanceof w;
|
|
267
267
|
}
|
|
268
|
-
function L(
|
|
269
|
-
return
|
|
268
|
+
function L(d) {
|
|
269
|
+
return d instanceof H;
|
|
270
270
|
}
|
|
271
|
-
function ct(
|
|
272
|
-
return F(
|
|
271
|
+
function ct(d) {
|
|
272
|
+
return F(d) || L(d);
|
|
273
273
|
}
|
|
274
|
-
const ot = (
|
|
274
|
+
const ot = (d, 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 = (h) => {
|
|
277
|
+
if (h.target.closest("button")) return;
|
|
278
|
+
i = !0, s = h.clientX, n = h.clientY;
|
|
279
|
+
const p = t.getBoundingClientRect();
|
|
280
|
+
o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
281
|
+
}, r = (h) => {
|
|
282
282
|
if (!i) return;
|
|
283
|
-
const
|
|
284
|
-
let v = o +
|
|
285
|
-
v = Math.max(8, Math.min(
|
|
283
|
+
const p = h.clientX - s, g = h.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
|
|
284
|
+
let v = o + p, 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
|
-
}, G = (
|
|
291
|
-
if (!
|
|
292
|
-
let t =
|
|
289
|
+
d.addEventListener("mousedown", l);
|
|
290
|
+
}, G = (d) => {
|
|
291
|
+
if (!d) return null;
|
|
292
|
+
let t = d.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 = (d, t, e) => `#${[d, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (d) => {
|
|
295
|
+
const t = d.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
|
-
}, U = (
|
|
302
|
-
const { r: t, g: e, b: i } = P(
|
|
301
|
+
}, U = (d) => {
|
|
302
|
+
const { r: t, g: e, b: i } = P(d), 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
|
-
}, W = (
|
|
308
|
-
const i = (
|
|
305
|
+
const h = a === 0 ? 0 : r / a, p = a;
|
|
306
|
+
return { h: c * 60, s: h, v: p };
|
|
307
|
+
}, W = (d, t, e) => {
|
|
308
|
+
const i = (d % 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
|
-
}, Ct = (
|
|
315
|
+
}, Ct = (d, 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: d, sat: s, lightness: i };
|
|
318
|
+
}, it = (d, t, e) => {
|
|
319
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(d / 60 % 2 - 1)), n = e - i / 2;
|
|
320
320
|
let o = 0, a = 0, l = 0;
|
|
321
|
-
return
|
|
321
|
+
return d < 60 ? (o = i, a = s, l = 0) : d < 120 ? (o = s, a = i, l = 0) : d < 180 ? (o = 0, a = i, l = s) : d < 240 ? (o = 0, a = s, l = i) : d < 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 = (d, 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 (d.startsWith("#")) {
|
|
329
|
+
const { r: s, g: n, b: o } = P(d);
|
|
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 (d.startsWith("rgba("))
|
|
333
|
+
return d.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
334
|
+
if (d.startsWith("rgb("))
|
|
335
|
+
return d.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
336
|
+
if (d.startsWith("hsl(")) {
|
|
337
|
+
const s = d.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 = (p, t, e) => {
|
|
|
344
344
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
if (
|
|
348
|
-
const s =
|
|
347
|
+
if (d.startsWith("hsla(")) {
|
|
348
|
+
const s = d.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 = (p, t, e) => {
|
|
|
355
355
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
const i = G(
|
|
358
|
+
const i = G(d);
|
|
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
|
-
},
|
|
363
|
+
return d;
|
|
364
|
+
}, It = (d) => [
|
|
365
365
|
"red",
|
|
366
366
|
"green",
|
|
367
367
|
"blue",
|
|
@@ -385,18 +385,18 @@ const ot = (p, t, e) => {
|
|
|
385
385
|
"teal",
|
|
386
386
|
"fuchsia",
|
|
387
387
|
"transparent"
|
|
388
|
-
].includes(
|
|
388
|
+
].includes(d.toLowerCase()), yt = (d) => [
|
|
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(d.trim())), St = (d) => {
|
|
394
394
|
if (typeof document > "u")
|
|
395
|
-
return yt(
|
|
395
|
+
return yt(d) || !!G(d);
|
|
396
396
|
const t = document.createElement("div");
|
|
397
|
-
return t.style.color =
|
|
398
|
-
}, Et = (
|
|
399
|
-
const t =
|
|
397
|
+
return t.style.color = d, t.style.color !== "";
|
|
398
|
+
}, Et = (d) => {
|
|
399
|
+
const t = d.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 {
|
|
@@ -432,11 +432,11 @@ const ot = (p, t, e) => {
|
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
return { color: G(t) || t, position: 0, opacity: 100 };
|
|
435
|
-
}, ht = (
|
|
435
|
+
}, ht = (d) => {
|
|
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 < d.length; s++) {
|
|
439
|
+
const n = d[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 = (p, 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 = (d, t) => {
|
|
450
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = d.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
|
-
}, Vt = (
|
|
458
|
-
const t =
|
|
454
|
+
for (let a = s; a < d.length && n > 0; a++)
|
|
455
|
+
d[a] === "(" ? n++ : d[a] === ")" && n--, o = a;
|
|
456
|
+
return n === 0 ? d.substring(s, o) : null;
|
|
457
|
+
}, Vt = (d) => {
|
|
458
|
+
const t = d.split(" ")[0].toLowerCase();
|
|
459
459
|
return [
|
|
460
460
|
"circle",
|
|
461
461
|
"ellipse",
|
|
@@ -466,31 +466,31 @@ const ot = (p, 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(d) || /^hsl/i.test(d) || It(t);
|
|
470
|
+
}, pt = (d) => {
|
|
471
471
|
const t = [];
|
|
472
|
-
return
|
|
472
|
+
return d.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 && yt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o =
|
|
477
|
+
a && yt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = d.length === 1 ? 0 : i / (d.length - 1) * 100);
|
|
478
478
|
const l = Et(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 = (d) => {
|
|
482
|
+
const t = d.stops && d.stops.length ? d.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
483
483
|
return {
|
|
484
|
-
type:
|
|
485
|
-
angle: typeof
|
|
484
|
+
type: d.type && ["linear", "radial", "solid"].includes(d.type) ? d.type : "linear",
|
|
485
|
+
angle: typeof d.angle == "number" ? d.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 =
|
|
492
|
+
}, T = (d) => {
|
|
493
|
+
const t = d.replace(/;$/, "").trim();
|
|
494
494
|
if (St(t)) {
|
|
495
495
|
const s = Et(t);
|
|
496
496
|
return A({ type: "solid", angle: 0, stops: [s] });
|
|
@@ -522,21 +522,21 @@ const ot = (p, t, e) => {
|
|
|
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 = (d) => {
|
|
526
|
+
if (d.type === "solid") {
|
|
527
|
+
const e = d.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 = d.stops.map(
|
|
534
534
|
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
535
535
|
).join(", ");
|
|
536
|
-
return
|
|
537
|
-
}, Tt = (
|
|
538
|
-
if (
|
|
539
|
-
const t =
|
|
536
|
+
return d.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${d.angle}deg, ${t})`;
|
|
537
|
+
}, Tt = (d) => Math.round(d / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (d) => {
|
|
538
|
+
if (d.type === "solid") {
|
|
539
|
+
const t = d.stops[0];
|
|
540
540
|
if (t) {
|
|
541
541
|
const e = t.color;
|
|
542
542
|
if (e.startsWith("var(--"))
|
|
@@ -552,7 +552,7 @@ const ot = (p, t, e) => {
|
|
|
552
552
|
}
|
|
553
553
|
return "#000000";
|
|
554
554
|
}
|
|
555
|
-
return
|
|
555
|
+
return d.type === "linear" ? `Linear ${d.angle}°` : "Radial Gradient";
|
|
556
556
|
}, q = class q {
|
|
557
557
|
static defaults() {
|
|
558
558
|
return {
|
|
@@ -623,7 +623,7 @@ const ot = (p, t, e) => {
|
|
|
623
623
|
};
|
|
624
624
|
q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
|
|
625
625
|
let R = q;
|
|
626
|
-
const at = (
|
|
626
|
+
const at = (d, t) => {
|
|
627
627
|
const e = document.createElement("div");
|
|
628
628
|
e.className = "color-picker-recent-section";
|
|
629
629
|
const i = document.createElement("div");
|
|
@@ -632,9 +632,9 @@ const at = (p, 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, h) => {
|
|
636
|
+
const p = c.getBoundingClientRect();
|
|
637
|
+
s.textContent = h, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.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");
|
|
@@ -646,40 +646,40 @@ const at = (p, t) => {
|
|
|
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 = Pt(
|
|
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((h) => {
|
|
650
|
+
const p = document.createElement("button");
|
|
651
|
+
p.type = "button", p.className = "color-picker-recent-swatch";
|
|
652
|
+
const g = Pt(h);
|
|
653
|
+
if (p.title = g, p.setAttribute("aria-label", `Use color: ${g}`), h.includes("gradient(")) {
|
|
654
|
+
p.style.backgroundImage = h, p.style.backgroundColor = "transparent";
|
|
655
|
+
const m = T(h);
|
|
656
|
+
m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
|
|
657
657
|
} else
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
n(),
|
|
661
|
-
}),
|
|
662
|
-
|
|
663
|
-
}),
|
|
658
|
+
p.style.backgroundColor = h, p.style.borderColor = h;
|
|
659
|
+
p.addEventListener("mouseenter", () => o(p, g)), p.addEventListener("mouseleave", () => {
|
|
660
|
+
n(), p.style.boxShadow = "";
|
|
661
|
+
}), p.addEventListener("mousedown", () => {
|
|
662
|
+
p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
663
|
+
}), p.addEventListener("mouseup", () => {
|
|
664
664
|
setTimeout(() => {
|
|
665
|
-
|
|
665
|
+
p.style.boxShadow = "";
|
|
666
666
|
}, 150);
|
|
667
|
-
}),
|
|
668
|
-
n(),
|
|
669
|
-
}), a.appendChild(
|
|
667
|
+
}), p.addEventListener("click", () => {
|
|
668
|
+
n(), d(h);
|
|
669
|
+
}), a.appendChild(p);
|
|
670
670
|
});
|
|
671
671
|
};
|
|
672
672
|
return r(), { container: e, refresh: r };
|
|
673
|
-
}, Pt = (
|
|
674
|
-
const t = T(
|
|
673
|
+
}, Pt = (d) => {
|
|
674
|
+
const t = T(d);
|
|
675
675
|
if (t)
|
|
676
676
|
return K(t);
|
|
677
|
-
const e = G(
|
|
677
|
+
const e = G(d);
|
|
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 d;
|
|
683
683
|
}, bt = `<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 d = document.createElement("div");
|
|
764
|
-
d.className = "color-picker-hue-marker", this.hueMarker = d, c.appendChild(d);
|
|
765
763
|
const h = document.createElement("div");
|
|
766
|
-
h.className = "color-picker-
|
|
764
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
|
|
765
|
+
const p = document.createElement("div");
|
|
766
|
+
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
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, p.appendChild(g), r.appendChild(c), r.appendChild(p), a.appendChild(l), a.appendChild(r);
|
|
769
|
+
const C = at((E) => {
|
|
770
770
|
var b;
|
|
771
771
|
this.setColor(E), (b = this.onChange) == null || b.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
|
|
779
|
-
|
|
778
|
+
const f = document.createElement("option");
|
|
779
|
+
f.value = "hex", f.textContent = "HEX";
|
|
780
780
|
const v = document.createElement("option");
|
|
781
781
|
v.value = "rgb", v.textContent = "RGB";
|
|
782
782
|
const y = document.createElement("option");
|
|
783
|
-
y.value = "hsl", y.textContent = "HSL", u.appendChild(
|
|
783
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(y);
|
|
784
784
|
const x = document.createElement("input");
|
|
785
785
|
x.type = "text", x.className = "color-picker-color-input", x.value = this.currentColor, this.input = x;
|
|
786
786
|
const k = document.createElement("div");
|
|
787
787
|
k.className = "color-picker-input-container";
|
|
788
|
-
const
|
|
789
|
-
return
|
|
788
|
+
const I = document.createElement("button");
|
|
789
|
+
return I.className = "color-picker-copy-inside", I.textContent = "Copy", k.appendChild(x), k.appendChild(I), m.appendChild(u), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(C.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, p, x, u, I, 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 = (
|
|
796
|
+
const l = (h) => {
|
|
797
797
|
var v;
|
|
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 = (
|
|
798
|
+
const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), C = Math.max(0, Math.min(1, (h.clientY - p.top) / p.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 = (h) => {
|
|
803
803
|
var v;
|
|
804
|
-
const
|
|
805
|
-
let g = Math.max(0, Math.min(1, (
|
|
804
|
+
const p = e.getBoundingClientRect();
|
|
805
|
+
let g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.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 = (h) => {
|
|
810
|
+
var C;
|
|
811
|
+
const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.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", (h) => {
|
|
815
|
+
h.preventDefault(), l(h);
|
|
816
|
+
const p = (C) => l(C), g = () => {
|
|
817
|
+
document.removeEventListener("mousemove", p), 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", p), document.addEventListener("mouseup", g);
|
|
820
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
821
|
+
h.preventDefault(), r(h);
|
|
822
|
+
const p = (C) => r(C), g = () => {
|
|
823
|
+
document.removeEventListener("mousemove", p), 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", p), document.addEventListener("mouseup", g);
|
|
826
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
827
|
+
h.preventDefault(), c(h);
|
|
828
|
+
const p = (C) => c(C), g = () => {
|
|
829
|
+
document.removeEventListener("mousemove", p), 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", p), document.addEventListener("mouseup", g);
|
|
832
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
|
|
833
|
+
h.key === "Enter" && (h.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 h;
|
|
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 p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
|
|
848
|
+
this.setColor(g), (h = this.onChange) == null || h.call(this, g, this.currentOpacity);
|
|
849
849
|
} catch {
|
|
850
850
|
}
|
|
851
851
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -903,12 +903,12 @@ class ut {
|
|
|
903
903
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
904
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, h = window.innerHeight, p = 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 + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (c - a) / 2);
|
|
910
|
+
const f = h - r.bottom, v = r.top;
|
|
911
|
+
f >= l + p ? C = r.bottom + 8 : v >= l + p ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > h - p && (C = h - l - p)) : (C = r.top - l - 8, C < p && (C = p)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
|
|
912
912
|
}
|
|
913
913
|
close(t) {
|
|
914
914
|
var e;
|
|
@@ -954,47 +954,47 @@ class Dt {
|
|
|
954
954
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
955
955
|
const c = document.createElement("div");
|
|
956
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);
|
|
957
|
-
const
|
|
957
|
+
const h = at((x) => {
|
|
958
958
|
const k = T(x);
|
|
959
959
|
k && k.type !== "solid" ? this.onColorChange(x, this.currentOpacity) : (this.setColor(x), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
960
960
|
}, "all");
|
|
961
|
-
this.recentSectionRefresh =
|
|
962
|
-
const
|
|
963
|
-
|
|
961
|
+
this.recentSectionRefresh = h.refresh;
|
|
962
|
+
const p = document.createElement("div");
|
|
963
|
+
p.className = "color-picker-format-section embedded";
|
|
964
964
|
const g = document.createElement("select");
|
|
965
965
|
g.className = "color-picker-format-select", this.select = g;
|
|
966
|
-
const
|
|
967
|
-
|
|
966
|
+
const C = document.createElement("option");
|
|
967
|
+
C.value = "hex", C.textContent = "HEX";
|
|
968
968
|
const m = document.createElement("option");
|
|
969
969
|
m.value = "rgb", m.textContent = "RGB";
|
|
970
970
|
const u = document.createElement("option");
|
|
971
|
-
u.value = "hsl", u.textContent = "HSL", g.appendChild(
|
|
972
|
-
const
|
|
973
|
-
|
|
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
974
|
const v = document.createElement("div");
|
|
975
975
|
v.className = "color-picker-input-container";
|
|
976
976
|
const y = document.createElement("button");
|
|
977
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(
|
|
977
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), p.appendChild(g), p.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(h.container), this.bind(e, a, r, f, g, y, n), t;
|
|
978
978
|
}
|
|
979
979
|
bind(t, e, i, s, n, o, a) {
|
|
980
|
-
const l = (
|
|
981
|
-
const
|
|
980
|
+
const l = (p, g) => {
|
|
981
|
+
const C = g || t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), u = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height));
|
|
982
982
|
this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
983
983
|
const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = W(v, m, 1 - u);
|
|
984
984
|
this.currentColor = y, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
985
|
-
}, r = (
|
|
986
|
-
const
|
|
985
|
+
}, r = (p, g) => {
|
|
986
|
+
const C = g || e.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
|
|
987
987
|
this.hueMarker.style.left = `${m * 100}%`;
|
|
988
|
-
const u = m * 360,
|
|
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
989
|
this.currentColor = y, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
990
990
|
linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
991
|
-
}, c = (
|
|
992
|
-
const
|
|
991
|
+
}, c = (p, g) => {
|
|
992
|
+
const C = g || i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
|
|
993
993
|
this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = this.clampOpacity(m * 100), this.queueChange();
|
|
994
|
-
},
|
|
995
|
-
|
|
994
|
+
}, h = (p, g, C) => {
|
|
995
|
+
p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), g(p, this.cachedRect);
|
|
996
996
|
let m = null, u;
|
|
997
|
-
const
|
|
997
|
+
const f = () => {
|
|
998
998
|
this.dragRafId === void 0 && (this.dragRafId = window.requestAnimationFrame(() => {
|
|
999
999
|
this.dragRafId = void 0, m && this.cachedRect && g(m, this.cachedRect);
|
|
1000
1000
|
}));
|
|
@@ -1006,23 +1006,23 @@ class Dt {
|
|
|
1006
1006
|
v();
|
|
1007
1007
|
return;
|
|
1008
1008
|
}
|
|
1009
|
-
m = y,
|
|
1009
|
+
m = y, f();
|
|
1010
1010
|
}, document.addEventListener("mousemove", u), document.addEventListener("mouseup", v), window.addEventListener("blur", v);
|
|
1011
1011
|
};
|
|
1012
|
-
t.addEventListener("mousedown", (
|
|
1013
|
-
|
|
1014
|
-
}), e.addEventListener("mousedown", (
|
|
1015
|
-
|
|
1016
|
-
}), i.addEventListener("mousedown", (
|
|
1017
|
-
|
|
1012
|
+
t.addEventListener("mousedown", (p) => {
|
|
1013
|
+
h(p, l, t);
|
|
1014
|
+
}), e.addEventListener("mousedown", (p) => {
|
|
1015
|
+
h(p, r, e);
|
|
1016
|
+
}), i.addEventListener("mousedown", (p) => {
|
|
1017
|
+
h(p, c, i);
|
|
1018
1018
|
}), n.addEventListener("change", () => {
|
|
1019
1019
|
this.syncInput();
|
|
1020
1020
|
}), s.addEventListener("input", () => {
|
|
1021
1021
|
this.applyFromInput();
|
|
1022
1022
|
}), s.addEventListener("blur", () => {
|
|
1023
1023
|
this.syncInput();
|
|
1024
|
-
}), s.addEventListener("keydown", (
|
|
1025
|
-
|
|
1024
|
+
}), s.addEventListener("keydown", (p) => {
|
|
1025
|
+
p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
|
|
1026
1026
|
}), o.addEventListener("click", async () => {
|
|
1027
1027
|
try {
|
|
1028
1028
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -1035,7 +1035,7 @@ class Dt {
|
|
|
1035
1035
|
return;
|
|
1036
1036
|
}
|
|
1037
1037
|
try {
|
|
1038
|
-
const
|
|
1038
|
+
const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
|
|
1039
1039
|
this.setColor(g), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
1040
1040
|
} catch {
|
|
1041
1041
|
}
|
|
@@ -1137,10 +1137,10 @@ const V = class V extends w {
|
|
|
1137
1137
|
angle: "number",
|
|
1138
1138
|
stops: "text"
|
|
1139
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) => {
|
|
1140
|
-
var
|
|
1140
|
+
var p;
|
|
1141
1141
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
1142
|
-
const s = i.target, n = this.popoverEl.contains(s), o = (
|
|
1143
|
-
!n && !o && !l && !r && !c && !
|
|
1142
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), h = s.classList.contains("gradient-popover-backdrop");
|
|
1143
|
+
!n && !o && !l && !r && !c && !h && this.closePopover();
|
|
1144
1144
|
}, this.handlePopoverKeydown = (i) => {
|
|
1145
1145
|
if (this.isPopoverOpen) {
|
|
1146
1146
|
if (i.key === "Escape") {
|
|
@@ -1322,8 +1322,8 @@ const V = class V extends w {
|
|
|
1322
1322
|
n.appendChild(o), s.appendChild(n);
|
|
1323
1323
|
const a = document.createElement("div");
|
|
1324
1324
|
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
1325
|
-
const l = e.children[0], r = e.children[1], c = (
|
|
1326
|
-
this.currentMode =
|
|
1325
|
+
const l = e.children[0], r = e.children[1], c = (h) => {
|
|
1326
|
+
this.currentMode = h, h === "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);
|
|
1327
1327
|
};
|
|
1328
1328
|
l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
|
|
1329
1329
|
}
|
|
@@ -1390,39 +1390,39 @@ const V = class V extends w {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
renderGlobalColors(t) {
|
|
1392
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 }]);
|
|
1393
|
-
const e = this.value.stops[0], i = (
|
|
1394
|
-
|
|
1395
|
-
let
|
|
1393
|
+
const e = this.value.stops[0], i = (h) => {
|
|
1394
|
+
h.innerHTML = "";
|
|
1395
|
+
let p = {};
|
|
1396
1396
|
try {
|
|
1397
|
-
|
|
1397
|
+
p = w.GlobalVariables || {};
|
|
1398
1398
|
} catch (u) {
|
|
1399
1399
|
console.warn("Could not access Setting.GlobalVariables", u);
|
|
1400
1400
|
}
|
|
1401
|
-
if (!
|
|
1401
|
+
if (!p || Object.keys(p).length === 0) {
|
|
1402
1402
|
const u = document.createElement("div");
|
|
1403
|
-
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", h.appendChild(u);
|
|
1404
1404
|
return;
|
|
1405
1405
|
}
|
|
1406
1406
|
const g = w.GlobalVariableGroups || [
|
|
1407
1407
|
{ title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
|
|
1408
1408
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
1409
|
-
],
|
|
1409
|
+
], C = this.globalSearchQuery.toLowerCase();
|
|
1410
1410
|
let m;
|
|
1411
|
-
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"),
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1411
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), g.forEach((u) => {
|
|
1412
|
+
const f = Object.entries(p).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]) => {
|
|
1414
1414
|
if (this.globalLayoutMode === "list") {
|
|
1415
1415
|
const x = document.createElement("div");
|
|
1416
1416
|
x.className = "global-color-row";
|
|
1417
1417
|
const k = document.createElement("div");
|
|
1418
1418
|
k.className = "global-color-circle";
|
|
1419
|
-
const
|
|
1420
|
-
k.style.background =
|
|
1419
|
+
const I = this.resolveGlobalVarColor(y);
|
|
1420
|
+
k.style.background = I, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && k.classList.add("selected");
|
|
1421
1421
|
const b = document.createElement("span");
|
|
1422
|
-
b.className = "global-color-label", b.textContent = v.split("-").map((
|
|
1423
|
-
|
|
1422
|
+
b.className = "global-color-label", b.textContent = v.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), x.appendChild(k), x.appendChild(b), x.addEventListener("click", (N) => {
|
|
1423
|
+
N.preventDefault();
|
|
1424
1424
|
const D = `var(--${v})`;
|
|
1425
|
-
this.setValue(D), this.pendingSolidColor = D, i(
|
|
1425
|
+
this.setValue(D), this.pendingSolidColor = D, i(h);
|
|
1426
1426
|
}), m.appendChild(x);
|
|
1427
1427
|
} else {
|
|
1428
1428
|
const x = document.createElement("div");
|
|
@@ -1431,7 +1431,7 @@ const V = class V extends w {
|
|
|
1431
1431
|
x.style.background = k, x.title = v.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && x.classList.add("selected"), x.addEventListener("click", (E) => {
|
|
1432
1432
|
E.preventDefault();
|
|
1433
1433
|
const b = `var(--${v})`;
|
|
1434
|
-
this.setValue(b), this.pendingSolidColor = b, i(
|
|
1434
|
+
this.setValue(b), this.pendingSolidColor = b, i(h);
|
|
1435
1435
|
}), m.appendChild(x);
|
|
1436
1436
|
}
|
|
1437
1437
|
});
|
|
@@ -1445,8 +1445,8 @@ const V = class V extends w {
|
|
|
1445
1445
|
const a = document.createElement("input");
|
|
1446
1446
|
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
1447
1447
|
const l = document.createElement("div");
|
|
1448
|
-
a.addEventListener("input", (
|
|
1449
|
-
this.globalSearchQuery =
|
|
1448
|
+
a.addEventListener("input", (h) => {
|
|
1449
|
+
this.globalSearchQuery = h.target.value, i(l);
|
|
1450
1450
|
}), n.appendChild(o), n.appendChild(a);
|
|
1451
1451
|
const r = document.createElement("button");
|
|
1452
1452
|
r.className = "global-layout-toggle", r.type = "button";
|
|
@@ -1481,15 +1481,15 @@ const V = class V extends w {
|
|
|
1481
1481
|
{
|
|
1482
1482
|
const c = document.createElement("div");
|
|
1483
1483
|
c.className = "gradient-subtype-inline";
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1484
|
+
const h = document.createElement("select");
|
|
1485
|
+
h.className = "gradient-subtype-select";
|
|
1486
|
+
const p = document.createElement("option");
|
|
1487
|
+
p.value = "linear", p.textContent = "Linear";
|
|
1488
1488
|
const g = document.createElement("option");
|
|
1489
|
-
g.value = "radial", g.textContent = "Radial",
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
this.clearGlobalBindingForCustomChange(), this.switchType(
|
|
1489
|
+
g.value = "radial", g.textContent = "Radial", h.appendChild(p), h.appendChild(g), h.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 = Ot, h.addEventListener("change", () => {
|
|
1492
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
|
|
1493
1493
|
}), e.addEventListener("focus", (m) => {
|
|
1494
1494
|
const u = m.target;
|
|
1495
1495
|
u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
|
|
@@ -1501,13 +1501,13 @@ const V = class V extends w {
|
|
|
1501
1501
|
var v;
|
|
1502
1502
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1503
1503
|
const u = m.target;
|
|
1504
|
-
let
|
|
1505
|
-
Number.isNaN(
|
|
1506
|
-
}),
|
|
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", () => {
|
|
1507
1507
|
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
1508
1508
|
m.position = 100 - m.position;
|
|
1509
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());
|
|
1510
|
-
}), c.appendChild(
|
|
1510
|
+
}), c.appendChild(h), c.appendChild(e), c.appendChild(C), t.appendChild(c), this.updateDegreeVisibility(e);
|
|
1511
1511
|
}
|
|
1512
1512
|
const i = document.createElement("div");
|
|
1513
1513
|
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
@@ -1522,8 +1522,8 @@ const V = class V extends w {
|
|
|
1522
1522
|
const l = document.createElement("div");
|
|
1523
1523
|
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
1524
1524
|
const r = at((c) => {
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1525
|
+
const h = T(c);
|
|
1526
|
+
h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type, !0), this.updateUI(), this.triggerChange());
|
|
1527
1527
|
}, "all");
|
|
1528
1528
|
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
1529
1529
|
var c;
|
|
@@ -1558,29 +1558,29 @@ const V = class V extends w {
|
|
|
1558
1558
|
o.className = "gstop-chip";
|
|
1559
1559
|
const a = this.resolveGlobalVarColor(i.color);
|
|
1560
1560
|
o.style.backgroundColor = a, n.appendChild(o);
|
|
1561
|
-
const l = new ut((u,
|
|
1562
|
-
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());
|
|
1563
1563
|
}, "solid");
|
|
1564
|
-
let r = !1, c = !1,
|
|
1564
|
+
let r = !1, c = !1, h = 0, p = 0;
|
|
1565
1565
|
const g = (u) => {
|
|
1566
|
-
r = !0, c = !1,
|
|
1567
|
-
},
|
|
1566
|
+
r = !0, c = !1, h = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
|
|
1567
|
+
}, C = (u) => {
|
|
1568
1568
|
if (!r || !this.value) return;
|
|
1569
|
-
const
|
|
1570
|
-
if (Math.abs(
|
|
1569
|
+
const f = u.clientX - h;
|
|
1570
|
+
if (Math.abs(f) > 3 && (c = !0), c) {
|
|
1571
1571
|
this.clearGlobalBindingForCustomChange();
|
|
1572
1572
|
const v = e.getBoundingClientRect();
|
|
1573
|
-
let y =
|
|
1573
|
+
let y = p + f / v.width * 100;
|
|
1574
1574
|
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
1575
1575
|
}
|
|
1576
1576
|
}, m = (u) => {
|
|
1577
|
-
var
|
|
1577
|
+
var f;
|
|
1578
1578
|
if (r)
|
|
1579
|
-
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
1579
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), c)
|
|
1580
1580
|
this.value && (this.value.stops.sort((v, y) => v.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
1581
1581
|
else {
|
|
1582
1582
|
u.stopPropagation();
|
|
1583
|
-
const v = (
|
|
1583
|
+
const v = (f = this.value) == null ? void 0 : f.stops[s];
|
|
1584
1584
|
v && setTimeout(() => {
|
|
1585
1585
|
const y = this.resolveGlobalVarColor(v.color);
|
|
1586
1586
|
l.open(y, o, v.opacity ?? 100);
|
|
@@ -1594,7 +1594,7 @@ const V = class V extends w {
|
|
|
1594
1594
|
var i;
|
|
1595
1595
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
1596
1596
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
1597
|
-
var k,
|
|
1597
|
+
var k, I;
|
|
1598
1598
|
const o = document.createElement("div");
|
|
1599
1599
|
o.className = "gstop-row";
|
|
1600
1600
|
const a = document.createElement("div");
|
|
@@ -1603,50 +1603,50 @@ const V = class V extends w {
|
|
|
1603
1603
|
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
1604
1604
|
const r = document.createElement("div");
|
|
1605
1605
|
r.className = "gstop-color-container";
|
|
1606
|
-
const c = this.resolveGlobalVarColor(s.color),
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1606
|
+
const c = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
|
|
1607
|
+
h.className = "gstop-color-preview", h.style.backgroundColor = c;
|
|
1608
|
+
const p = document.createElement("input");
|
|
1609
|
+
p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
|
|
1610
1610
|
const g = document.createElement("button");
|
|
1611
|
-
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1611
|
+
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(g);
|
|
1612
|
+
const C = document.createElement("button");
|
|
1613
|
+
C.type = "button", C.className = "gstop-del", C.innerHTML = Ht, C.disabled = (((I = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
|
|
1614
1614
|
const m = document.createElement("span");
|
|
1615
1615
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
1616
1616
|
const u = document.createElement("div");
|
|
1617
1617
|
u.className = "gstop-opacity-group";
|
|
1618
|
-
const
|
|
1619
|
-
|
|
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
1620
|
const v = P(c);
|
|
1621
|
-
|
|
1621
|
+
f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`);
|
|
1622
1622
|
const y = document.createElement("span");
|
|
1623
|
-
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);
|
|
1624
1624
|
const x = new ut((E, b) => {
|
|
1625
|
-
this.clearGlobalBindingForCustomChange(),
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1625
|
+
this.clearGlobalBindingForCustomChange(), p.value = E.replace("#", "").toUpperCase(), h.style.backgroundColor = E, this.value.stops[n].color = E, b !== void 0 && (this.value.stops[n].opacity = b, f.value = String(b), y.textContent = `${b}%`);
|
|
1626
|
+
const N = P(E);
|
|
1627
|
+
f.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.updateGradientPreview(), this.createHandles(
|
|
1628
1628
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1629
1629
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1630
1630
|
), this.updateUI(), this.triggerChange();
|
|
1631
1631
|
}, "solid");
|
|
1632
|
-
|
|
1632
|
+
p.addEventListener("click", (E) => {
|
|
1633
1633
|
E.preventDefault(), E.stopPropagation();
|
|
1634
1634
|
const b = this.resolveGlobalVarColor(s.color);
|
|
1635
|
-
x.open(b,
|
|
1636
|
-
}),
|
|
1635
|
+
x.open(b, p, s.opacity ?? 100);
|
|
1636
|
+
}), p.addEventListener("input", () => {
|
|
1637
1637
|
this.clearGlobalBindingForCustomChange();
|
|
1638
|
-
const E =
|
|
1638
|
+
const E = p.value.trim(), b = E.startsWith("#") ? E : `#${E}`;
|
|
1639
1639
|
if (/^#[0-9A-Fa-f]{6}$/.test(b)) {
|
|
1640
|
-
this.value.stops[n].color = b,
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1640
|
+
this.value.stops[n].color = b, h.style.backgroundColor = b;
|
|
1641
|
+
const N = P(b);
|
|
1642
|
+
f.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.debouncedPreviewUpdate();
|
|
1643
1643
|
}
|
|
1644
|
-
}),
|
|
1644
|
+
}), p.addEventListener("blur", () => {
|
|
1645
1645
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1646
1646
|
}), g.addEventListener("click", async (E) => {
|
|
1647
1647
|
E.stopPropagation();
|
|
1648
1648
|
try {
|
|
1649
|
-
await navigator.clipboard.writeText(`#${
|
|
1649
|
+
await navigator.clipboard.writeText(`#${p.value}`);
|
|
1650
1650
|
} catch {
|
|
1651
1651
|
}
|
|
1652
1652
|
}), l.addEventListener("focus", (E) => {
|
|
@@ -1654,35 +1654,35 @@ const V = class V extends w {
|
|
|
1654
1654
|
b.value = b.value.replace("%", ""), b.select();
|
|
1655
1655
|
}), l.addEventListener("input", (E) => {
|
|
1656
1656
|
this.clearGlobalBindingForCustomChange();
|
|
1657
|
-
const b = E.target,
|
|
1658
|
-
if (!Number.isNaN(
|
|
1659
|
-
const D = Math.max(0, Math.min(100,
|
|
1657
|
+
const b = E.target, N = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
1658
|
+
if (!Number.isNaN(N)) {
|
|
1659
|
+
const D = Math.max(0, Math.min(100, N));
|
|
1660
1660
|
this.value.stops[n].position = D, b.value = `${D}%`, this.debouncedPreviewUpdate();
|
|
1661
1661
|
}
|
|
1662
1662
|
}), l.addEventListener("blur", (E) => {
|
|
1663
1663
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1664
|
-
const b = E.target,
|
|
1665
|
-
if (Number.isNaN(
|
|
1664
|
+
const b = E.target, N = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
1665
|
+
if (Number.isNaN(N))
|
|
1666
1666
|
b.value = `${this.value.stops[n].position}%`;
|
|
1667
1667
|
else {
|
|
1668
|
-
const D = Math.max(0, Math.min(100,
|
|
1668
|
+
const D = Math.max(0, Math.min(100, N));
|
|
1669
1669
|
this.value.stops[n].position = D, b.value = `${D}%`;
|
|
1670
1670
|
}
|
|
1671
1671
|
this.updateGradientPreview(), this.createHandles(
|
|
1672
1672
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1673
1673
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1674
1674
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
1675
|
-
}),
|
|
1675
|
+
}), C.addEventListener("click", () => {
|
|
1676
1676
|
var E;
|
|
1677
1677
|
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
1678
1678
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1679
1679
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1680
1680
|
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((E = document.activeElement) == null ? void 0 : E.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
1681
|
-
}),
|
|
1681
|
+
}), f.addEventListener("input", () => {
|
|
1682
1682
|
this.clearGlobalBindingForCustomChange();
|
|
1683
|
-
const E = parseInt(
|
|
1683
|
+
const E = parseInt(f.value, 10);
|
|
1684
1684
|
this.value.stops[n].opacity = Math.max(0, Math.min(100, E)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
1685
|
-
}),
|
|
1685
|
+
}), f.addEventListener("change", () => {
|
|
1686
1686
|
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1687
1687
|
});
|
|
1688
1688
|
}));
|
|
@@ -1711,10 +1711,10 @@ const V = class V extends w {
|
|
|
1711
1711
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1712
1712
|
const o = this.popoverEl.offsetHeight;
|
|
1713
1713
|
let a = t.right + 8, l = t.top;
|
|
1714
|
-
const r = i - t.right, c = t.left,
|
|
1715
|
-
r <
|
|
1716
|
-
const
|
|
1717
|
-
g >= o + n ? l = t.top - o - 8 :
|
|
1714
|
+
const r = i - t.right, c = t.left, h = e + n;
|
|
1715
|
+
r < h && c > r + 100 && (a = t.left - e - 8);
|
|
1716
|
+
const p = s - t.bottom, g = t.top;
|
|
1717
|
+
g >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : g > p ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
|
|
1718
1718
|
}
|
|
1719
1719
|
setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
1720
1720
|
}
|
|
@@ -1732,10 +1732,10 @@ const V = class V extends w {
|
|
|
1732
1732
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1733
1733
|
const a = this.popoverEl.offsetHeight;
|
|
1734
1734
|
let l = e.right + 8, r = e.top;
|
|
1735
|
-
const c = s - e.right,
|
|
1736
|
-
c <
|
|
1737
|
-
const g = n - e.bottom,
|
|
1738
|
-
|
|
1735
|
+
const c = s - e.right, h = e.left, p = i + o;
|
|
1736
|
+
c < p && h > 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`;
|
|
1739
1739
|
});
|
|
1740
1740
|
}
|
|
1741
1741
|
}
|
|
@@ -1810,10 +1810,10 @@ const V = class V extends w {
|
|
|
1810
1810
|
};
|
|
1811
1811
|
V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
|
|
1812
1812
|
let j = V;
|
|
1813
|
-
function J(
|
|
1814
|
-
for (const e in
|
|
1815
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1816
|
-
const i =
|
|
1813
|
+
function J(d, t) {
|
|
1814
|
+
for (const e in d)
|
|
1815
|
+
if (Object.prototype.hasOwnProperty.call(d, e)) {
|
|
1816
|
+
const i = d[e];
|
|
1817
1817
|
t(e, i);
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
@@ -1919,16 +1919,16 @@ const Q = class Q {
|
|
|
1919
1919
|
}), s.forEach((r) => {
|
|
1920
1920
|
n.includes(r) || this.removeSetting(r);
|
|
1921
1921
|
}), n.forEach((r) => {
|
|
1922
|
-
var
|
|
1923
|
-
const c = t[r],
|
|
1924
|
-
if (
|
|
1922
|
+
var p;
|
|
1923
|
+
const c = t[r], h = this.settings[r];
|
|
1924
|
+
if (h !== c && (h && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
|
|
1925
1925
|
const g = o[r];
|
|
1926
1926
|
try {
|
|
1927
1927
|
L(c) ? c.setValue(
|
|
1928
1928
|
g
|
|
1929
|
-
) : F(c) ? (
|
|
1930
|
-
} catch (
|
|
1931
|
-
console.warn(`Could not preserve value for setting ${r}:`,
|
|
1929
|
+
) : F(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
|
|
1930
|
+
} catch (C) {
|
|
1931
|
+
console.warn(`Could not preserve value for setting ${r}:`, C);
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
@@ -2059,8 +2059,8 @@ const Q = class Q {
|
|
|
2059
2059
|
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
2060
2060
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
2061
2061
|
if (l) {
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2062
|
+
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
2063
|
+
h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
|
|
2064
2064
|
}
|
|
2065
2065
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
2066
2066
|
r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), _(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
|
|
@@ -2212,11 +2212,11 @@ const Q = class Q {
|
|
|
2212
2212
|
r(), t(!1);
|
|
2213
2213
|
}), l.addEventListener("click", () => {
|
|
2214
2214
|
r(), t(!0);
|
|
2215
|
-
}), e.addEventListener("click", (
|
|
2216
|
-
|
|
2215
|
+
}), e.addEventListener("click", (h) => {
|
|
2216
|
+
h.target === e && (r(), t(!1));
|
|
2217
2217
|
});
|
|
2218
|
-
const c = (
|
|
2219
|
-
|
|
2218
|
+
const c = (h) => {
|
|
2219
|
+
h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
2220
2220
|
};
|
|
2221
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(() => {
|
|
2222
2222
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -2360,14 +2360,14 @@ const Q = class Q {
|
|
|
2360
2360
|
}, Object.keys(this.settings).length > 0) {
|
|
2361
2361
|
for (const c in this.settings)
|
|
2362
2362
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
2363
|
-
const
|
|
2364
|
-
L(
|
|
2365
|
-
const
|
|
2366
|
-
L(
|
|
2367
|
-
|
|
2363
|
+
const h = this.settings[c];
|
|
2364
|
+
L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
2365
|
+
const p = h.draw();
|
|
2366
|
+
L(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
2367
|
+
p,
|
|
2368
2368
|
c,
|
|
2369
|
-
|
|
2370
|
-
), a.appendChild(
|
|
2369
|
+
h
|
|
2370
|
+
), a.appendChild(p);
|
|
2371
2371
|
}
|
|
2372
2372
|
} else {
|
|
2373
2373
|
const c = document.createElement("div");
|
|
@@ -2376,18 +2376,18 @@ const Q = class Q {
|
|
|
2376
2376
|
if (this.addItemCfg) {
|
|
2377
2377
|
const c = document.createElement("button");
|
|
2378
2378
|
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
2379
|
-
const
|
|
2379
|
+
const h = `
|
|
2380
2380
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
2381
2381
|
xmlns="http://www.w3.org/2000/svg">
|
|
2382
2382
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
2383
2383
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
2384
2384
|
</svg>`;
|
|
2385
|
-
c.innerHTML = `${
|
|
2386
|
-
|
|
2387
|
-
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),
|
|
2388
|
-
if (ct(
|
|
2385
|
+
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
|
|
2386
|
+
p.stopPropagation(), p.preventDefault();
|
|
2387
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
|
|
2388
|
+
if (ct(C)) {
|
|
2389
2389
|
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
2390
|
-
this.addSetting(m,
|
|
2390
|
+
this.addSetting(m, C);
|
|
2391
2391
|
}
|
|
2392
2392
|
}), a.appendChild(c);
|
|
2393
2393
|
}
|
|
@@ -2435,8 +2435,8 @@ const Q = class Q {
|
|
|
2435
2435
|
};
|
|
2436
2436
|
Q.hiddenElements = /* @__PURE__ */ new Set();
|
|
2437
2437
|
let H = Q;
|
|
2438
|
-
function Me(
|
|
2439
|
-
return new Ft(
|
|
2438
|
+
function Me(d) {
|
|
2439
|
+
return new Ft(d);
|
|
2440
2440
|
}
|
|
2441
2441
|
class Ft extends H {
|
|
2442
2442
|
constructor(t) {
|
|
@@ -2488,9 +2488,9 @@ class Ft extends H {
|
|
|
2488
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);
|
|
2489
2489
|
const c = document.createElement("div");
|
|
2490
2490
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2493
|
-
|
|
2491
|
+
const h = this.settings[a];
|
|
2492
|
+
h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
2493
|
+
h.draw()
|
|
2494
2494
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
2495
2495
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
2496
2496
|
const a = Object.keys(this.settings)[0];
|
|
@@ -2499,11 +2499,11 @@ class Ft extends H {
|
|
|
2499
2499
|
return this.updateTabUI(), t;
|
|
2500
2500
|
}
|
|
2501
2501
|
}
|
|
2502
|
-
function Gt(
|
|
2503
|
-
return new H(
|
|
2502
|
+
function Gt(d) {
|
|
2503
|
+
return new H(d);
|
|
2504
2504
|
}
|
|
2505
|
-
function
|
|
2506
|
-
return
|
|
2505
|
+
function Ne(d) {
|
|
2506
|
+
return d;
|
|
2507
2507
|
}
|
|
2508
2508
|
class Rt extends w {
|
|
2509
2509
|
constructor(t = {}) {
|
|
@@ -2546,8 +2546,8 @@ class O extends Rt {
|
|
|
2546
2546
|
if (e.length !== 3 || e.some(isNaN))
|
|
2547
2547
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
2548
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) => {
|
|
2549
|
-
const
|
|
2550
|
-
return
|
|
2549
|
+
const h = c.toString(16);
|
|
2550
|
+
return h.length === 1 ? "0" + h : h;
|
|
2551
2551
|
};
|
|
2552
2552
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
2553
2553
|
}
|
|
@@ -2607,15 +2607,15 @@ class O extends Rt {
|
|
|
2607
2607
|
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
|
-
Object.entries(m).forEach(([u,
|
|
2610
|
+
Object.entries(m).forEach(([u, f]) => {
|
|
2611
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 =
|
|
2613
|
-
var k,
|
|
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 k, I;
|
|
2614
2614
|
y.preventDefault();
|
|
2615
2615
|
const x = `var(--${u})`;
|
|
2616
|
-
this.value = x, (k = this.onChange) == null || k.call(this, x), (
|
|
2616
|
+
this.value = x, (k = this.onChange) == null || k.call(this, x), (I = this.detectChange) == null || I.call(this, x), Array.from(a.children).forEach((E) => {
|
|
2617
2617
|
E.style.border = "1px solid #ddd";
|
|
2618
|
-
}), v.style.border = "2px solid #2196f3",
|
|
2618
|
+
}), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
|
|
2619
2619
|
}), a.appendChild(v);
|
|
2620
2620
|
});
|
|
2621
2621
|
} catch (m) {
|
|
@@ -2635,44 +2635,44 @@ class O extends Rt {
|
|
|
2635
2635
|
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
2636
2636
|
}, c = document.createElement("input");
|
|
2637
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;
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2640
|
-
let
|
|
2641
|
-
if (
|
|
2642
|
-
const m =
|
|
2643
|
-
|
|
2638
|
+
const h = document.createElement("div");
|
|
2639
|
+
h.className = "color-preview";
|
|
2640
|
+
let p = this.value || "#000000";
|
|
2641
|
+
if (p.startsWith("var(--")) {
|
|
2642
|
+
const m = p.replace("var(--", "").replace(")", "");
|
|
2643
|
+
p = (w.GlobalVariables || {})[m] || "#000000";
|
|
2644
2644
|
}
|
|
2645
|
-
|
|
2645
|
+
h.style.backgroundColor = p;
|
|
2646
2646
|
const g = document.createElement("input");
|
|
2647
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;
|
|
2648
|
-
const
|
|
2649
|
-
var
|
|
2648
|
+
const C = (m) => {
|
|
2649
|
+
var f, v;
|
|
2650
2650
|
let u = m.trim();
|
|
2651
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)) {
|
|
2652
2652
|
const y = O.normalizeColorValue(u);
|
|
2653
|
-
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), h.style.backgroundColor = y;
|
|
2654
2654
|
}
|
|
2655
2655
|
};
|
|
2656
2656
|
return this.textInputEl.addEventListener("input", (m) => {
|
|
2657
2657
|
const u = m.target.value;
|
|
2658
|
-
|
|
2658
|
+
C(u);
|
|
2659
2659
|
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
2660
|
-
var
|
|
2660
|
+
var f;
|
|
2661
2661
|
m.preventDefault();
|
|
2662
|
-
const u = ((
|
|
2663
|
-
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));
|
|
2664
2664
|
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
2665
|
-
var u,
|
|
2666
|
-
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"));
|
|
2667
2667
|
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
2668
2668
|
var v, y;
|
|
2669
|
-
const u = m.target.value,
|
|
2670
|
-
this.value =
|
|
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), h.style.backgroundColor = f, e.classList.remove("error");
|
|
2671
2671
|
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
2672
2672
|
var v, y;
|
|
2673
|
-
const u = m.target.value,
|
|
2674
|
-
this.value =
|
|
2675
|
-
}), o.appendChild(c), o.appendChild(
|
|
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), h.style.backgroundColor = f;
|
|
2675
|
+
}), o.appendChild(c), o.appendChild(h), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
2676
2676
|
}
|
|
2677
2677
|
getElement() {
|
|
2678
2678
|
return this.element;
|
|
@@ -2833,7 +2833,7 @@ class z extends w {
|
|
|
2833
2833
|
};
|
|
2834
2834
|
}
|
|
2835
2835
|
}
|
|
2836
|
-
class
|
|
2836
|
+
class Ie extends w {
|
|
2837
2837
|
constructor(t = {}) {
|
|
2838
2838
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
2839
2839
|
}
|
|
@@ -3530,12 +3530,12 @@ const gt = `
|
|
|
3530
3530
|
if (t.className = "image-map-setting-wrapper", this.props.title || this.props.icon) {
|
|
3531
3531
|
const h = document.createElement("div");
|
|
3532
3532
|
if (h.className = "icon-container", this.props.icon) {
|
|
3533
|
-
const
|
|
3534
|
-
h.appendChild(
|
|
3533
|
+
const p = this.createIcon(this.props.icon);
|
|
3534
|
+
h.appendChild(p);
|
|
3535
3535
|
}
|
|
3536
3536
|
if (this.props.title) {
|
|
3537
|
-
const
|
|
3538
|
-
h.appendChild(
|
|
3537
|
+
const p = this.createLabel(this.props.title);
|
|
3538
|
+
h.appendChild(p);
|
|
3539
3539
|
}
|
|
3540
3540
|
t.appendChild(h);
|
|
3541
3541
|
}
|
|
@@ -3553,25 +3553,27 @@ const gt = `
|
|
|
3553
3553
|
a.type = "button", a.className = "image-map-delete-btn", a.innerHTML = ie, a.addEventListener("click", (h) => {
|
|
3554
3554
|
h.stopPropagation(), this.value = { imageUrl: "", markers: [] }, this.updateMainDisplay(), this.triggerChange();
|
|
3555
3555
|
}), o.appendChild(a), n.appendChild(o);
|
|
3556
|
-
const l = document.createElement("
|
|
3557
|
-
l.className = "image-map-upload-label", l.innerHTML = `
|
|
3556
|
+
const l = document.createElement("button");
|
|
3557
|
+
l.type = "button", l.className = "image-map-upload-label", l.innerHTML = `
|
|
3558
3558
|
<div class="upload-icon upload-icon-default">${gt}</div>
|
|
3559
3559
|
<div class="upload-icon upload-icon-replace">${Qt}</div>
|
|
3560
3560
|
<span class="upload-text">Upload Image</span>
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
const
|
|
3571
|
-
|
|
3561
|
+
`, l.addEventListener("click", () => {
|
|
3562
|
+
window.postMessage(
|
|
3563
|
+
{
|
|
3564
|
+
type: "OPEN_FILE_MANAGER_MODAL",
|
|
3565
|
+
settingId: this.id
|
|
3566
|
+
},
|
|
3567
|
+
"*"
|
|
3568
|
+
);
|
|
3569
|
+
}), n.appendChild(l), i.appendChild(n), e.appendChild(i);
|
|
3570
|
+
const r = document.createElement("div");
|
|
3571
|
+
r.className = "image-map-section";
|
|
3572
|
+
const c = document.createElement("h4");
|
|
3573
|
+
return c.className = "image-map-section-title", c.textContent = "Map Setup", r.appendChild(c), this.mainButton = document.createElement("button"), this.mainButton.type = "button", this.mainButton.className = "image-map-button", this.mapIconEl = document.createElement("span"), this.mapIconEl.className = "image-map-icon", this.mapIconEl.innerHTML = mt, this.mainButton.appendChild(this.mapIconEl), this.markerCountEl = document.createElement("span"), this.markerCountEl.className = "image-map-marker-count", this.mainButton.appendChild(this.markerCountEl), this.mainButton.addEventListener("click", () => {
|
|
3572
3574
|
var h;
|
|
3573
3575
|
(h = this.mainButton) != null && h.disabled || this.openPopover();
|
|
3574
|
-
}),
|
|
3576
|
+
}), r.appendChild(this.mainButton), e.appendChild(r), t.appendChild(e), this.createPopover(), this.updateMainDisplay(), t;
|
|
3575
3577
|
}
|
|
3576
3578
|
updateMainDisplay() {
|
|
3577
3579
|
var s;
|
|
@@ -3651,14 +3653,14 @@ const gt = `
|
|
|
3651
3653
|
r.className = "image-map-image-section", this.renderImageMapSection(r);
|
|
3652
3654
|
const c = document.createElement("div");
|
|
3653
3655
|
c.className = "prize-list-section", this.renderPrizeList(c), l.appendChild(r), l.appendChild(c), t.appendChild(l);
|
|
3654
|
-
const
|
|
3655
|
-
t.appendChild(
|
|
3656
|
-
const
|
|
3656
|
+
const h = this.renderBottomButtons();
|
|
3657
|
+
t.appendChild(h);
|
|
3658
|
+
const p = r.querySelector(
|
|
3657
3659
|
".image-map-container"
|
|
3658
3660
|
), g = c.querySelector(
|
|
3659
3661
|
".simple-prize-list"
|
|
3660
3662
|
);
|
|
3661
|
-
|
|
3663
|
+
p && (p.scrollTop = s), g && (g.scrollTop = n);
|
|
3662
3664
|
} else
|
|
3663
3665
|
this.renderUploadSection(t);
|
|
3664
3666
|
}
|
|
@@ -3692,9 +3694,9 @@ const gt = `
|
|
|
3692
3694
|
`;
|
|
3693
3695
|
const o = document.createElement("input");
|
|
3694
3696
|
o.type = "file", o.accept = "image/jpeg,image/jpg,image/png,image/gif,image/webp", o.style.display = "none", o.addEventListener("change", (c) => {
|
|
3695
|
-
var
|
|
3696
|
-
const
|
|
3697
|
-
|
|
3697
|
+
var p;
|
|
3698
|
+
const h = (p = c.target.files) == null ? void 0 : p[0];
|
|
3699
|
+
h && this.handleImageUpload(h);
|
|
3698
3700
|
}), n.appendChild(o), s.appendChild(n), e.appendChild(s);
|
|
3699
3701
|
const a = document.createElement("h4");
|
|
3700
3702
|
a.className = "upload-section-title", a.textContent = "Map Setup", e.appendChild(a);
|
|
@@ -3771,8 +3773,8 @@ const gt = `
|
|
|
3771
3773
|
r.className = "done-btn-tooltip";
|
|
3772
3774
|
const c = document.createElement("div");
|
|
3773
3775
|
c.className = "done-btn-tooltip-content", c.textContent = "Map all prizes";
|
|
3774
|
-
const
|
|
3775
|
-
|
|
3776
|
+
const h = document.createElement("div");
|
|
3777
|
+
h.className = "done-btn-tooltip-tail", h.innerHTML = re, r.appendChild(c), r.appendChild(h), o.appendChild(r);
|
|
3776
3778
|
}
|
|
3777
3779
|
return s.appendChild(o), s;
|
|
3778
3780
|
}
|
|
@@ -3783,16 +3785,16 @@ const gt = `
|
|
|
3783
3785
|
const n = document.createElement("div");
|
|
3784
3786
|
n.className = "simple-prize-list";
|
|
3785
3787
|
for (let a = e; a >= 1; a--) {
|
|
3786
|
-
const l = s.get(a), r = !!l, c = (l == null ? void 0 : l.prizeName) || this.props.prizeMap && this.props.prizeMap[a - 1] || "Prize Name",
|
|
3787
|
-
|
|
3788
|
-
const
|
|
3789
|
-
|
|
3788
|
+
const l = s.get(a), r = !!l, c = (l == null ? void 0 : l.prizeName) || this.props.prizeMap && this.props.prizeMap[a - 1] || "Prize Name", h = document.createElement("div");
|
|
3789
|
+
h.className = `simple-prize-item ${r ? "placed" : ""}`;
|
|
3790
|
+
const p = document.createElement("div");
|
|
3791
|
+
p.className = "simple-prize-number", p.textContent = `#${a}`, h.appendChild(p);
|
|
3790
3792
|
const g = document.createElement("div");
|
|
3791
|
-
if (g.className = "simple-prize-text", g.textContent = `${c}`,
|
|
3792
|
-
const
|
|
3793
|
-
|
|
3793
|
+
if (g.className = "simple-prize-text", g.textContent = `${c}`, h.appendChild(g), r) {
|
|
3794
|
+
const C = document.createElement("div");
|
|
3795
|
+
C.className = "simple-prize-check", C.innerHTML = oe, h.appendChild(C);
|
|
3794
3796
|
}
|
|
3795
|
-
n.appendChild(
|
|
3797
|
+
n.appendChild(h);
|
|
3796
3798
|
}
|
|
3797
3799
|
t.appendChild(n);
|
|
3798
3800
|
}
|
|
@@ -3839,20 +3841,20 @@ const gt = `
|
|
|
3839
3841
|
if (typeof a == "string") {
|
|
3840
3842
|
const r = new Image();
|
|
3841
3843
|
r.onload = () => {
|
|
3842
|
-
var
|
|
3844
|
+
var p;
|
|
3843
3845
|
const c = {
|
|
3844
3846
|
width: r.naturalWidth || 0,
|
|
3845
3847
|
height: r.naturalHeight || 0
|
|
3846
|
-
},
|
|
3847
|
-
((
|
|
3848
|
+
}, h = this.scaleMarkersForNewImage(
|
|
3849
|
+
((p = this.value) == null ? void 0 : p.markers) || [],
|
|
3848
3850
|
e,
|
|
3849
3851
|
c
|
|
3850
3852
|
);
|
|
3851
3853
|
this.value = {
|
|
3852
3854
|
imageUrl: a,
|
|
3853
|
-
markers:
|
|
3855
|
+
markers: h
|
|
3854
3856
|
}, this.lastImageNaturalSize = c, this.history = [
|
|
3855
|
-
JSON.parse(JSON.stringify(
|
|
3857
|
+
JSON.parse(JSON.stringify(h))
|
|
3856
3858
|
], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateMainDisplay(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
|
|
3857
3859
|
}, r.onerror = () => {
|
|
3858
3860
|
this.showError("Failed to read image file.");
|
|
@@ -3870,7 +3872,7 @@ const gt = `
|
|
|
3870
3872
|
);
|
|
3871
3873
|
return;
|
|
3872
3874
|
}
|
|
3873
|
-
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,
|
|
3875
|
+
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, h) => c - h);
|
|
3874
3876
|
let o = 1;
|
|
3875
3877
|
for (const c of n)
|
|
3876
3878
|
if (c === o)
|
|
@@ -4078,11 +4080,11 @@ const gt = `
|
|
|
4078
4080
|
r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
|
|
4079
4081
|
const c = document.createElement("button");
|
|
4080
4082
|
c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
|
|
4081
|
-
const
|
|
4082
|
-
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(
|
|
4083
|
+
const h = (p) => {
|
|
4084
|
+
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(p);
|
|
4083
4085
|
};
|
|
4084
|
-
r.addEventListener("click", () =>
|
|
4085
|
-
|
|
4086
|
+
r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (p) => {
|
|
4087
|
+
p.target === s && h(!1);
|
|
4086
4088
|
}), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
|
|
4087
4089
|
n.classList.add("visible");
|
|
4088
4090
|
}, 10);
|
|
@@ -4317,7 +4319,7 @@ class Pe extends w {
|
|
|
4317
4319
|
const s = document.createElement("input");
|
|
4318
4320
|
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", () => {
|
|
4319
4321
|
var r, c;
|
|
4320
|
-
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((
|
|
4322
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
4321
4323
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
4322
4324
|
});
|
|
4323
4325
|
const n = document.createElement("span");
|
|
@@ -4468,13 +4470,13 @@ class $e extends w {
|
|
|
4468
4470
|
return;
|
|
4469
4471
|
}
|
|
4470
4472
|
const c = "...";
|
|
4471
|
-
let
|
|
4472
|
-
for (;
|
|
4473
|
-
const m = Math.floor((
|
|
4474
|
-
this.measureTextWidth(u, i) <= l ? (g = m,
|
|
4473
|
+
let h = 0, p = e.length, g = 0;
|
|
4474
|
+
for (; h <= p; ) {
|
|
4475
|
+
const m = Math.floor((h + p) / 2), u = e.slice(0, m).trimEnd() + c;
|
|
4476
|
+
this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : p = m - 1;
|
|
4475
4477
|
}
|
|
4476
|
-
const
|
|
4477
|
-
t.placeholder =
|
|
4478
|
+
const C = e.slice(0, g).trimEnd() + c;
|
|
4479
|
+
t.placeholder = C;
|
|
4478
4480
|
}
|
|
4479
4481
|
autosizeTextarea(t, e = 3) {
|
|
4480
4482
|
t.style.height = "auto";
|
|
@@ -5044,7 +5046,7 @@ export {
|
|
|
5044
5046
|
j as GradientSetting,
|
|
5045
5047
|
Fe as HeaderTypographySettingSet,
|
|
5046
5048
|
ce as HeightSetting,
|
|
5047
|
-
|
|
5049
|
+
Ie as HtmlSetting,
|
|
5048
5050
|
vt as ImageMapSetting,
|
|
5049
5051
|
ze as ImageSettingSet,
|
|
5050
5052
|
He as MarginBottomSetting,
|
|
@@ -5063,7 +5065,7 @@ export {
|
|
|
5063
5065
|
Pe as Toggle,
|
|
5064
5066
|
lt as UploadSetting,
|
|
5065
5067
|
de as WidthSetting,
|
|
5066
|
-
|
|
5068
|
+
Ne as asSettingGroupWithSettings,
|
|
5067
5069
|
Gt as createSettingGroup,
|
|
5068
5070
|
Me as createTabSettingGroup,
|
|
5069
5071
|
F as isSetting,
|