builder-settings-types 0.0.319 → 0.0.322
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
|
-
const
|
|
2
|
-
let mt = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const bt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let mt = (d = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(d |= 0));
|
|
4
|
+
for (; d--; )
|
|
5
|
+
t += bt[e[d] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function wt(
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function wt(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 Z(
|
|
14
|
+
function Z(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
|
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(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 kt(
|
|
128
|
-
switch (
|
|
127
|
+
function kt(d) {
|
|
128
|
+
switch (d) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,26 +142,29 @@ function kt(p) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const M = class M {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || mt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, M.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, M.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
static CurrentLanguage(t) {
|
|
156
|
-
return t !== void 0 && (
|
|
156
|
+
return t !== void 0 && (M.currentLanguage = t, M.currentLanguageExplicitlySet = !0, M.DefaultLanguage || M.SetDefaultLanguage(t), M.languageChangeCallbacks.forEach((e) => e(t))), M.currentLanguage || M.DefaultLanguage;
|
|
157
|
+
}
|
|
158
|
+
static HasExplicitCurrentLanguage() {
|
|
159
|
+
return M.currentLanguageExplicitlySet;
|
|
157
160
|
}
|
|
158
161
|
static onLanguageChange(t) {
|
|
159
|
-
return
|
|
160
|
-
|
|
162
|
+
return M.languageChangeCallbacks.add(t), () => {
|
|
163
|
+
M.languageChangeCallbacks.delete(t);
|
|
161
164
|
};
|
|
162
165
|
}
|
|
163
166
|
static SetGlobalVariables(t) {
|
|
164
|
-
|
|
167
|
+
M.GlobalVariables = { ...M.GlobalVariables, ...t };
|
|
165
168
|
}
|
|
166
169
|
destroy() {
|
|
167
170
|
throw new Error("Method not implemented.");
|
|
@@ -244,94 +247,94 @@ const N = class N {
|
|
|
244
247
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
245
248
|
}
|
|
246
249
|
};
|
|
247
|
-
|
|
250
|
+
M.currentLanguageExplicitlySet = !1, M.languageChangeCallbacks = /* @__PURE__ */ new Set(), M.GlobalVariables = {
|
|
248
251
|
primary: "#1B1958",
|
|
249
252
|
secondary: "#0D0938",
|
|
250
253
|
tertiary: "#2A1560",
|
|
251
254
|
accent: "#189541",
|
|
252
255
|
"text-dark": "#00141E",
|
|
253
256
|
"text-light": "#FFFFFF"
|
|
254
|
-
},
|
|
257
|
+
}, M.GlobalVariableGroups = [
|
|
255
258
|
{
|
|
256
259
|
title: "Global Colors",
|
|
257
260
|
keys: ["primary", "secondary", "tertiary", "accent"]
|
|
258
261
|
},
|
|
259
262
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
260
263
|
];
|
|
261
|
-
let x =
|
|
262
|
-
function G(
|
|
263
|
-
return
|
|
264
|
+
let x = M;
|
|
265
|
+
function G(d) {
|
|
266
|
+
return d instanceof x;
|
|
264
267
|
}
|
|
265
|
-
function k(
|
|
266
|
-
return
|
|
268
|
+
function k(d) {
|
|
269
|
+
return d instanceof $;
|
|
267
270
|
}
|
|
268
|
-
function ct(
|
|
269
|
-
return G(
|
|
271
|
+
function ct(d) {
|
|
272
|
+
return G(d) || k(d);
|
|
270
273
|
}
|
|
271
|
-
const ot = (
|
|
274
|
+
const ot = (d, t, e) => {
|
|
272
275
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
273
276
|
const l = (h) => {
|
|
274
277
|
if (h.target.closest("button")) return;
|
|
275
278
|
i = !0, s = h.clientX, n = h.clientY;
|
|
276
|
-
const
|
|
277
|
-
o =
|
|
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";
|
|
278
281
|
}, r = (h) => {
|
|
279
282
|
if (!i) return;
|
|
280
|
-
const
|
|
281
|
-
let C = o +
|
|
282
|
-
C = Math.max(8, Math.min(f -
|
|
283
|
+
const p = h.clientX - s, g = h.clientY - n, f = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, v = t.offsetHeight;
|
|
284
|
+
let C = o + p, y = a + g;
|
|
285
|
+
C = Math.max(8, Math.min(f - u - 8, C)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
|
|
283
286
|
}, c = () => {
|
|
284
287
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
|
|
285
288
|
};
|
|
286
|
-
|
|
287
|
-
}, W = (
|
|
288
|
-
if (!
|
|
289
|
-
let t =
|
|
289
|
+
d.addEventListener("mousedown", l);
|
|
290
|
+
}, W = (d) => {
|
|
291
|
+
if (!d) return null;
|
|
292
|
+
let t = d.trim();
|
|
290
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()}`;
|
|
291
|
-
}, X = (
|
|
292
|
-
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;
|
|
293
296
|
return {
|
|
294
297
|
r: parseInt(e.slice(0, 2), 16),
|
|
295
298
|
g: parseInt(e.slice(2, 4), 16),
|
|
296
299
|
b: parseInt(e.slice(4, 6), 16)
|
|
297
300
|
};
|
|
298
|
-
}, z = (
|
|
299
|
-
const { r: t, g: e, b: i } = P(
|
|
301
|
+
}, z = (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;
|
|
300
303
|
let c = 0;
|
|
301
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);
|
|
302
|
-
const h = a === 0 ? 0 : r / a,
|
|
303
|
-
return { h: c * 60, s: h, v:
|
|
304
|
-
}, U = (
|
|
305
|
-
const i = (
|
|
305
|
+
const h = a === 0 ? 0 : r / a, p = a;
|
|
306
|
+
return { h: c * 60, s: h, v: p };
|
|
307
|
+
}, U = (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;
|
|
306
309
|
let a = 0, l = 0, r = 0;
|
|
307
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(
|
|
308
311
|
Math.round((a + o) * 255),
|
|
309
312
|
Math.round((l + o) * 255),
|
|
310
313
|
Math.round((r + o) * 255)
|
|
311
314
|
);
|
|
312
|
-
}, vt = (
|
|
315
|
+
}, vt = (d, t, e) => {
|
|
313
316
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
314
|
-
return { hue:
|
|
315
|
-
}, it = (
|
|
316
|
-
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;
|
|
317
320
|
let o = 0, a = 0, l = 0;
|
|
318
|
-
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), {
|
|
319
322
|
r: Math.round((o + n) * 255),
|
|
320
323
|
g: Math.round((a + n) * 255),
|
|
321
324
|
b: Math.round((l + n) * 255)
|
|
322
325
|
};
|
|
323
|
-
}, st = (
|
|
326
|
+
}, st = (d, t) => {
|
|
324
327
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
325
|
-
if (
|
|
326
|
-
const { r: s, g: n, b: o } = P(
|
|
328
|
+
if (d.startsWith("#")) {
|
|
329
|
+
const { r: s, g: n, b: o } = P(d);
|
|
327
330
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
328
331
|
}
|
|
329
|
-
if (
|
|
330
|
-
return
|
|
331
|
-
if (
|
|
332
|
-
return
|
|
333
|
-
if (
|
|
334
|
-
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+)%\)/);
|
|
335
338
|
if (s) {
|
|
336
339
|
const { r: n, g: o, b: a } = it(
|
|
337
340
|
parseInt(s[1]),
|
|
@@ -341,8 +344,8 @@ const ot = (p, t, e) => {
|
|
|
341
344
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
342
345
|
}
|
|
343
346
|
}
|
|
344
|
-
if (
|
|
345
|
-
const s =
|
|
347
|
+
if (d.startsWith("hsla(")) {
|
|
348
|
+
const s = d.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
346
349
|
if (s) {
|
|
347
350
|
const { r: n, g: o, b: a } = it(
|
|
348
351
|
parseInt(s[1]),
|
|
@@ -352,13 +355,13 @@ const ot = (p, t, e) => {
|
|
|
352
355
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
|
-
const i = W(
|
|
358
|
+
const i = W(d);
|
|
356
359
|
if (i) {
|
|
357
360
|
const { r: s, g: n, b: o } = P(i);
|
|
358
361
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
359
362
|
}
|
|
360
|
-
return
|
|
361
|
-
}, Mt = (
|
|
363
|
+
return d;
|
|
364
|
+
}, Mt = (d) => [
|
|
362
365
|
"red",
|
|
363
366
|
"green",
|
|
364
367
|
"blue",
|
|
@@ -382,18 +385,18 @@ const ot = (p, t, e) => {
|
|
|
382
385
|
"teal",
|
|
383
386
|
"fuchsia",
|
|
384
387
|
"transparent"
|
|
385
|
-
].includes(
|
|
388
|
+
].includes(d.toLowerCase()), ft = (d) => [
|
|
386
389
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
387
390
|
/^rgba?\s*\([^)]+\)$/,
|
|
388
391
|
/^hsla?\s*\([^)]+\)$/,
|
|
389
392
|
/^[a-zA-Z]+$/
|
|
390
|
-
].some((e) => e.test(
|
|
393
|
+
].some((e) => e.test(d.trim())), Nt = (d) => {
|
|
391
394
|
if (typeof document > "u")
|
|
392
|
-
return ft(
|
|
395
|
+
return ft(d) || !!W(d);
|
|
393
396
|
const t = document.createElement("div");
|
|
394
|
-
return t.style.color =
|
|
395
|
-
}, Ct = (
|
|
396
|
-
const t =
|
|
397
|
+
return t.style.color = d, t.style.color !== "";
|
|
398
|
+
}, Ct = (d) => {
|
|
399
|
+
const t = d.trim();
|
|
397
400
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
398
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);
|
|
399
402
|
return {
|
|
@@ -429,11 +432,11 @@ const ot = (p, t, e) => {
|
|
|
429
432
|
};
|
|
430
433
|
}
|
|
431
434
|
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
432
|
-
}, ht = (
|
|
435
|
+
}, ht = (d) => {
|
|
433
436
|
const t = [];
|
|
434
437
|
let e = "", i = 0;
|
|
435
|
-
for (let s = 0; s <
|
|
436
|
-
const n =
|
|
438
|
+
for (let s = 0; s < d.length; s++) {
|
|
439
|
+
const n = d[s];
|
|
437
440
|
if (n === "(") i++;
|
|
438
441
|
else if (n === ")") i--;
|
|
439
442
|
else if (n === "," && i === 0) {
|
|
@@ -443,16 +446,16 @@ const ot = (p, t, e) => {
|
|
|
443
446
|
e += n;
|
|
444
447
|
}
|
|
445
448
|
return e.trim() && t.push(e.trim()), t;
|
|
446
|
-
}, dt = (
|
|
447
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
449
|
+
}, dt = (d, t) => {
|
|
450
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = d.match(e);
|
|
448
451
|
if (!i) return null;
|
|
449
452
|
const s = i.index + i[0].length;
|
|
450
453
|
let n = 1, o = s;
|
|
451
|
-
for (let a = s; a <
|
|
452
|
-
|
|
453
|
-
return n === 0 ?
|
|
454
|
-
}, It = (
|
|
455
|
-
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
|
+
}, It = (d) => {
|
|
458
|
+
const t = d.split(" ")[0].toLowerCase();
|
|
456
459
|
return [
|
|
457
460
|
"circle",
|
|
458
461
|
"ellipse",
|
|
@@ -463,31 +466,31 @@ const ot = (p, t, e) => {
|
|
|
463
466
|
"at",
|
|
464
467
|
"contain",
|
|
465
468
|
"cover"
|
|
466
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
467
|
-
}, pt = (
|
|
469
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(d) || /^hsl/i.test(d) || Mt(t);
|
|
470
|
+
}, pt = (d) => {
|
|
468
471
|
const t = [];
|
|
469
|
-
return
|
|
472
|
+
return d.forEach((e, i) => {
|
|
470
473
|
const s = e.trim();
|
|
471
474
|
if (!s) return;
|
|
472
475
|
let n = "", o = 0;
|
|
473
476
|
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
474
|
-
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 = d.length === 1 ? 0 : i / (d.length - 1) * 100);
|
|
475
478
|
const l = Ct(n);
|
|
476
479
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
477
480
|
}), t;
|
|
478
|
-
}, A = (
|
|
479
|
-
const t =
|
|
481
|
+
}, A = (d) => {
|
|
482
|
+
const t = d.stops && d.stops.length ? d.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
480
483
|
return {
|
|
481
|
-
type:
|
|
482
|
-
angle: typeof
|
|
484
|
+
type: d.type && ["linear", "radial", "solid"].includes(d.type) ? d.type : "linear",
|
|
485
|
+
angle: typeof d.angle == "number" ? d.angle : 90,
|
|
483
486
|
stops: t.map((e, i) => ({
|
|
484
487
|
color: e.color || "#000000",
|
|
485
488
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
486
489
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
487
490
|
}))
|
|
488
491
|
};
|
|
489
|
-
}, T = (
|
|
490
|
-
const t =
|
|
492
|
+
}, T = (d) => {
|
|
493
|
+
const t = d.replace(/;$/, "").trim();
|
|
491
494
|
if (Nt(t)) {
|
|
492
495
|
const s = Ct(t);
|
|
493
496
|
return A({ type: "solid", angle: 0, stops: [s] });
|
|
@@ -519,21 +522,21 @@ const ot = (p, t, e) => {
|
|
|
519
522
|
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
520
523
|
}
|
|
521
524
|
return null;
|
|
522
|
-
}, S = (
|
|
523
|
-
if (
|
|
524
|
-
const e =
|
|
525
|
+
}, S = (d) => {
|
|
526
|
+
if (d.type === "solid") {
|
|
527
|
+
const e = d.stops[0], i = e.color;
|
|
525
528
|
if (i.startsWith("var(--"))
|
|
526
529
|
return i;
|
|
527
530
|
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
528
531
|
return `#${n}${o}`;
|
|
529
532
|
}
|
|
530
|
-
const t =
|
|
533
|
+
const t = d.stops.map(
|
|
531
534
|
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
532
535
|
).join(", ");
|
|
533
|
-
return
|
|
534
|
-
}, St = (
|
|
535
|
-
if (
|
|
536
|
-
const t =
|
|
536
|
+
return d.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${d.angle}deg, ${t})`;
|
|
537
|
+
}, St = (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];
|
|
537
540
|
if (t) {
|
|
538
541
|
const e = t.color;
|
|
539
542
|
if (e.startsWith("var(--"))
|
|
@@ -549,7 +552,7 @@ const ot = (p, t, e) => {
|
|
|
549
552
|
}
|
|
550
553
|
return "#000000";
|
|
551
554
|
}
|
|
552
|
-
return
|
|
555
|
+
return d.type === "linear" ? `Linear ${d.angle}°` : "Radial Gradient";
|
|
553
556
|
}, q = class q {
|
|
554
557
|
static defaults() {
|
|
555
558
|
return {
|
|
@@ -619,8 +622,8 @@ const ot = (p, t, e) => {
|
|
|
619
622
|
}
|
|
620
623
|
};
|
|
621
624
|
q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
|
|
622
|
-
let
|
|
623
|
-
const at = (
|
|
625
|
+
let F = q;
|
|
626
|
+
const at = (d, t) => {
|
|
624
627
|
const e = document.createElement("div");
|
|
625
628
|
e.className = "color-picker-recent-section";
|
|
626
629
|
const i = document.createElement("div");
|
|
@@ -630,58 +633,58 @@ const at = (p, t) => {
|
|
|
630
633
|
const n = () => {
|
|
631
634
|
s.style.display = "none";
|
|
632
635
|
}, o = (c, h) => {
|
|
633
|
-
const
|
|
634
|
-
s.textContent = h, s.style.left = `${
|
|
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";
|
|
635
638
|
}, a = document.createElement("div");
|
|
636
639
|
a.className = "color-picker-recent-grid";
|
|
637
640
|
const l = document.createElement("div");
|
|
638
641
|
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
639
642
|
const r = () => {
|
|
640
643
|
n(), a.innerHTML = "";
|
|
641
|
-
const c =
|
|
644
|
+
const c = F.getColors(t);
|
|
642
645
|
if (c.length === 0) {
|
|
643
646
|
a.style.display = "none", l.style.display = "block";
|
|
644
647
|
return;
|
|
645
648
|
}
|
|
646
649
|
a.style.display = "grid", l.style.display = "none", c.forEach((h) => {
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
if (
|
|
651
|
-
|
|
650
|
+
const p = document.createElement("button");
|
|
651
|
+
p.type = "button", p.className = "color-picker-recent-swatch";
|
|
652
|
+
const g = Vt(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";
|
|
652
655
|
const m = T(h);
|
|
653
|
-
m && m.stops && m.stops.length > 0 && (
|
|
656
|
+
m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
|
|
654
657
|
} else
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
n(),
|
|
658
|
-
}),
|
|
659
|
-
|
|
660
|
-
}),
|
|
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", () => {
|
|
661
664
|
setTimeout(() => {
|
|
662
|
-
|
|
665
|
+
p.style.boxShadow = "";
|
|
663
666
|
}, 150);
|
|
664
|
-
}),
|
|
665
|
-
n(),
|
|
666
|
-
}), a.appendChild(
|
|
667
|
+
}), p.addEventListener("click", () => {
|
|
668
|
+
n(), d(h);
|
|
669
|
+
}), a.appendChild(p);
|
|
667
670
|
});
|
|
668
671
|
};
|
|
669
672
|
return r(), { container: e, refresh: r };
|
|
670
|
-
}, Vt = (
|
|
671
|
-
const t = T(
|
|
673
|
+
}, Vt = (d) => {
|
|
674
|
+
const t = T(d);
|
|
672
675
|
if (t)
|
|
673
676
|
return K(t);
|
|
674
|
-
const e = W(
|
|
677
|
+
const e = W(d);
|
|
675
678
|
if (e) {
|
|
676
679
|
const i = P(e);
|
|
677
680
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
678
681
|
}
|
|
679
|
-
return
|
|
682
|
+
return d;
|
|
680
683
|
}, yt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
681
684
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
682
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"
|
|
683
686
|
fill="#919EAB"/>
|
|
684
|
-
</svg>`,
|
|
687
|
+
</svg>`, Et = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
685
688
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
686
689
|
</svg>`, Tt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
687
690
|
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -752,38 +755,38 @@ class ut {
|
|
|
752
755
|
const a = document.createElement("div");
|
|
753
756
|
a.className = "color-picker-sliders-container";
|
|
754
757
|
const l = document.createElement("button");
|
|
755
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
758
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Et;
|
|
756
759
|
const r = document.createElement("div");
|
|
757
760
|
r.className = "color-picker-sliders-group";
|
|
758
761
|
const c = document.createElement("div");
|
|
759
762
|
c.className = "color-picker-hue", this.hueSlider = c;
|
|
760
763
|
const h = document.createElement("div");
|
|
761
764
|
h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
const f = at((
|
|
765
|
+
const p = document.createElement("div");
|
|
766
|
+
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
767
|
+
const g = document.createElement("div");
|
|
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 f = at((E) => {
|
|
767
770
|
var w;
|
|
768
|
-
this.setColor(
|
|
771
|
+
this.setColor(E), (w = this.onChange) == null || w.call(this, E, this.currentOpacity);
|
|
769
772
|
}, this.recentScope);
|
|
770
773
|
this.recentSectionRefresh = f.refresh;
|
|
771
774
|
const m = document.createElement("div");
|
|
772
775
|
m.className = "color-picker-format-section";
|
|
773
|
-
const
|
|
774
|
-
|
|
776
|
+
const u = document.createElement("select");
|
|
777
|
+
u.className = "color-picker-format-select", this.select = u;
|
|
775
778
|
const v = document.createElement("option");
|
|
776
779
|
v.value = "hex", v.textContent = "HEX";
|
|
777
780
|
const C = document.createElement("option");
|
|
778
781
|
C.value = "rgb", C.textContent = "RGB";
|
|
779
782
|
const y = document.createElement("option");
|
|
780
|
-
y.value = "hsl", y.textContent = "HSL",
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(v), u.appendChild(C), u.appendChild(y);
|
|
784
|
+
const b = document.createElement("input");
|
|
785
|
+
b.type = "text", b.className = "color-picker-color-input", b.value = this.currentColor, this.input = b;
|
|
783
786
|
const L = document.createElement("div");
|
|
784
787
|
L.className = "color-picker-input-container";
|
|
785
788
|
const I = document.createElement("button");
|
|
786
|
-
return I.className = "color-picker-copy-inside", I.textContent = "Copy", L.appendChild(
|
|
789
|
+
return I.className = "color-picker-copy-inside", I.textContent = "Copy", L.appendChild(b), L.appendChild(I), m.appendChild(u), m.appendChild(L), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(f.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, p, b, u, I, l), t;
|
|
787
790
|
}
|
|
788
791
|
createBackdrop() {
|
|
789
792
|
const t = document.createElement("div");
|
|
@@ -792,40 +795,40 @@ class ut {
|
|
|
792
795
|
bind(t, e, i, s, n, o, a) {
|
|
793
796
|
const l = (h) => {
|
|
794
797
|
var C;
|
|
795
|
-
const
|
|
796
|
-
this.colorMarker.style.left = `${
|
|
797
|
-
const
|
|
798
|
+
const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
|
|
799
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
|
|
800
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
|
|
798
801
|
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
799
802
|
}, r = (h) => {
|
|
800
803
|
var C;
|
|
801
|
-
const
|
|
802
|
-
let
|
|
803
|
-
this.hueMarker.style.left = `${
|
|
804
|
-
const f =
|
|
804
|
+
const p = e.getBoundingClientRect();
|
|
805
|
+
let g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
|
|
806
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
807
|
+
const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
|
|
805
808
|
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
806
809
|
}, c = (h) => {
|
|
807
810
|
var f;
|
|
808
|
-
const
|
|
809
|
-
this.opacityMarker.style.left = `${
|
|
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), (f = this.onChange) == null || f.call(this, this.currentColor, this.currentOpacity);
|
|
810
813
|
};
|
|
811
814
|
t.addEventListener("mousedown", (h) => {
|
|
812
815
|
h.preventDefault(), l(h);
|
|
813
|
-
const
|
|
814
|
-
document.removeEventListener("mousemove",
|
|
816
|
+
const p = (f) => l(f), g = () => {
|
|
817
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
815
818
|
};
|
|
816
|
-
document.addEventListener("mousemove",
|
|
819
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
817
820
|
}), e.addEventListener("mousedown", (h) => {
|
|
818
821
|
h.preventDefault(), r(h);
|
|
819
|
-
const
|
|
820
|
-
document.removeEventListener("mousemove",
|
|
822
|
+
const p = (f) => r(f), g = () => {
|
|
823
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
821
824
|
};
|
|
822
|
-
document.addEventListener("mousemove",
|
|
825
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
823
826
|
}), i.addEventListener("mousedown", (h) => {
|
|
824
827
|
h.preventDefault(), c(h);
|
|
825
|
-
const
|
|
826
|
-
document.removeEventListener("mousemove",
|
|
828
|
+
const p = (f) => c(f), g = () => {
|
|
829
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
827
830
|
};
|
|
828
|
-
document.addEventListener("mousemove",
|
|
831
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
829
832
|
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
|
|
830
833
|
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
831
834
|
}), o.addEventListener("click", async () => {
|
|
@@ -841,8 +844,8 @@ class ut {
|
|
|
841
844
|
return;
|
|
842
845
|
}
|
|
843
846
|
try {
|
|
844
|
-
const
|
|
845
|
-
this.setColor(
|
|
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);
|
|
846
849
|
} catch {
|
|
847
850
|
}
|
|
848
851
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -900,16 +903,16 @@ class ut {
|
|
|
900
903
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
901
904
|
const { h: s, s: n, v: o } = z(t);
|
|
902
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);
|
|
903
|
-
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, h = window.innerHeight,
|
|
904
|
-
let
|
|
905
|
-
const m = c - r.right,
|
|
906
|
-
m >= a +
|
|
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, f = r.top;
|
|
908
|
+
const m = c - r.right, u = r.left;
|
|
909
|
+
m >= a + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (c - a) / 2);
|
|
907
910
|
const v = h - r.bottom, C = r.top;
|
|
908
|
-
v >= l +
|
|
911
|
+
v >= l + p ? f = r.bottom + 8 : C >= l + p ? f = r.top - l - 8 : v > C ? (f = r.bottom + 8, f + l > h - p && (f = h - l - p)) : (f = r.top - l - 8, f < p && (f = p)), this.element.style.left = `${g}px`, this.element.style.top = `${f}px`;
|
|
909
912
|
}
|
|
910
913
|
close(t) {
|
|
911
914
|
var e;
|
|
912
|
-
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" && (F.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
913
916
|
}
|
|
914
917
|
getElement() {
|
|
915
918
|
return this.element;
|
|
@@ -933,7 +936,7 @@ class Bt {
|
|
|
933
936
|
const s = document.createElement("div");
|
|
934
937
|
s.className = "color-picker-sliders-container embedded";
|
|
935
938
|
const n = document.createElement("button");
|
|
936
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
939
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Et;
|
|
937
940
|
const o = document.createElement("div");
|
|
938
941
|
o.className = "color-picker-sliders-group";
|
|
939
942
|
const a = document.createElement("div");
|
|
@@ -944,62 +947,62 @@ class Bt {
|
|
|
944
947
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
945
948
|
const c = document.createElement("div");
|
|
946
949
|
c.className = "color-picker-opacity-marker", this.opacityMarker = c, r.appendChild(c), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
947
|
-
const h = at((
|
|
948
|
-
const L = T(
|
|
949
|
-
L && L.type !== "solid" ? this.onColorChange(
|
|
950
|
+
const h = at((b) => {
|
|
951
|
+
const L = T(b);
|
|
952
|
+
L && L.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
950
953
|
}, "all");
|
|
951
954
|
this.recentSectionRefresh = h.refresh;
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
const
|
|
955
|
-
|
|
955
|
+
const p = document.createElement("div");
|
|
956
|
+
p.className = "color-picker-format-section embedded";
|
|
957
|
+
const g = document.createElement("select");
|
|
958
|
+
g.className = "color-picker-format-select", this.select = g;
|
|
956
959
|
const f = document.createElement("option");
|
|
957
960
|
f.value = "hex", f.textContent = "HEX";
|
|
958
961
|
const m = document.createElement("option");
|
|
959
962
|
m.value = "rgb", m.textContent = "RGB";
|
|
960
|
-
const
|
|
961
|
-
|
|
963
|
+
const u = document.createElement("option");
|
|
964
|
+
u.value = "hsl", u.textContent = "HSL", g.appendChild(f), g.appendChild(m), g.appendChild(u);
|
|
962
965
|
const v = document.createElement("input");
|
|
963
966
|
v.type = "text", v.className = "color-picker-color-input", this.input = v;
|
|
964
967
|
const C = document.createElement("div");
|
|
965
968
|
C.className = "color-picker-input-container";
|
|
966
969
|
const y = document.createElement("button");
|
|
967
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y),
|
|
970
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), p.appendChild(g), p.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(h.container), this.bind(e, a, r, v, g, y, n), t;
|
|
968
971
|
}
|
|
969
972
|
bind(t, e, i, s, n, o, a) {
|
|
970
973
|
const l = (h) => {
|
|
971
|
-
const
|
|
972
|
-
this.colorMarker.style.left = `${
|
|
973
|
-
const
|
|
974
|
+
const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
|
|
975
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
|
|
976
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
|
|
974
977
|
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
975
978
|
}, r = (h) => {
|
|
976
|
-
const
|
|
977
|
-
this.hueMarker.style.left = `${
|
|
978
|
-
const f =
|
|
979
|
+
const p = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
|
|
980
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
981
|
+
const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
|
|
979
982
|
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
980
983
|
linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
981
984
|
}, c = (h) => {
|
|
982
|
-
const
|
|
983
|
-
this.opacityMarker.style.left = `${
|
|
985
|
+
const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
|
|
986
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
|
|
984
987
|
};
|
|
985
988
|
t.addEventListener("mousedown", (h) => {
|
|
986
989
|
h.preventDefault(), this.isDragging = !0, l(h);
|
|
987
|
-
const
|
|
988
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
990
|
+
const p = (f) => l(f), g = () => {
|
|
991
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
989
992
|
};
|
|
990
|
-
document.addEventListener("mousemove",
|
|
993
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
991
994
|
}), e.addEventListener("mousedown", (h) => {
|
|
992
995
|
h.preventDefault(), this.isDragging = !0, r(h);
|
|
993
|
-
const
|
|
994
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
996
|
+
const p = (f) => r(f), g = () => {
|
|
997
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
995
998
|
};
|
|
996
|
-
document.addEventListener("mousemove",
|
|
999
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
997
1000
|
}), i.addEventListener("mousedown", (h) => {
|
|
998
1001
|
h.preventDefault(), this.isDragging = !0, c(h);
|
|
999
|
-
const
|
|
1000
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
1002
|
+
const p = (f) => c(f), g = () => {
|
|
1003
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
1001
1004
|
};
|
|
1002
|
-
document.addEventListener("mousemove",
|
|
1005
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
1003
1006
|
}), n.addEventListener("change", () => {
|
|
1004
1007
|
this.syncInput();
|
|
1005
1008
|
}), s.addEventListener("input", () => {
|
|
@@ -1020,8 +1023,8 @@ class Bt {
|
|
|
1020
1023
|
return;
|
|
1021
1024
|
}
|
|
1022
1025
|
try {
|
|
1023
|
-
const h = new window.EyeDropper(), { sRGBHex:
|
|
1024
|
-
this.setColor(
|
|
1026
|
+
const h = new window.EyeDropper(), { sRGBHex: p } = await h.open();
|
|
1027
|
+
this.setColor(p), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
1025
1028
|
} catch {
|
|
1026
1029
|
}
|
|
1027
1030
|
});
|
|
@@ -1095,7 +1098,7 @@ class Bt {
|
|
|
1095
1098
|
}
|
|
1096
1099
|
commitRecentColor() {
|
|
1097
1100
|
var t;
|
|
1098
|
-
this.recentScope === "solid" && (
|
|
1101
|
+
this.recentScope === "solid" && (F.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
1099
1102
|
}
|
|
1100
1103
|
getElement() {
|
|
1101
1104
|
return this.element;
|
|
@@ -1120,9 +1123,9 @@ const V = class V extends x {
|
|
|
1120
1123
|
angle: "number",
|
|
1121
1124
|
stops: "text"
|
|
1122
1125
|
}, 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) => {
|
|
1123
|
-
var
|
|
1126
|
+
var p;
|
|
1124
1127
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
1125
|
-
const s = i.target, n = this.popoverEl.contains(s), o = (
|
|
1128
|
+
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");
|
|
1126
1129
|
!n && !o && !l && !r && !c && !h && this.closePopover();
|
|
1127
1130
|
}, this.handlePopoverKeydown = (i) => {
|
|
1128
1131
|
if (this.isPopoverOpen) {
|
|
@@ -1375,47 +1378,47 @@ const V = class V extends x {
|
|
|
1375
1378
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
1376
1379
|
const e = this.value.stops[0], i = (h) => {
|
|
1377
1380
|
h.innerHTML = "";
|
|
1378
|
-
let
|
|
1381
|
+
let p = {};
|
|
1379
1382
|
try {
|
|
1380
|
-
|
|
1381
|
-
} catch (
|
|
1382
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
1383
|
+
p = x.GlobalVariables || {};
|
|
1384
|
+
} catch (u) {
|
|
1385
|
+
console.warn("Could not access Setting.GlobalVariables", u);
|
|
1383
1386
|
}
|
|
1384
|
-
if (!
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
+
if (!p || Object.keys(p).length === 0) {
|
|
1388
|
+
const u = document.createElement("div");
|
|
1389
|
+
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", h.appendChild(u);
|
|
1387
1390
|
return;
|
|
1388
1391
|
}
|
|
1389
|
-
const
|
|
1392
|
+
const g = x.GlobalVariableGroups || [
|
|
1390
1393
|
{ title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
|
|
1391
1394
|
{ title: "Text Color", keys: ["text-dark", "text-light"] }
|
|
1392
1395
|
], f = this.globalSearchQuery.toLowerCase();
|
|
1393
1396
|
let m;
|
|
1394
|
-
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m),
|
|
1395
|
-
const v = Object.entries(
|
|
1397
|
+
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) => {
|
|
1398
|
+
const v = Object.entries(p).filter(([C]) => !u.keys.includes(C) && u.title !== "Global Colors" ? !1 : u.keys.includes(C) && C.toLowerCase().includes(f));
|
|
1396
1399
|
v.length !== 0 && v.forEach(([C, y]) => {
|
|
1397
1400
|
if (this.globalLayoutMode === "list") {
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1401
|
+
const b = document.createElement("div");
|
|
1402
|
+
b.className = "global-color-row";
|
|
1400
1403
|
const L = document.createElement("div");
|
|
1401
1404
|
L.className = "global-color-circle";
|
|
1402
1405
|
const I = this.resolveGlobalVarColor(y);
|
|
1403
1406
|
L.style.background = I, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && L.classList.add("selected");
|
|
1404
1407
|
const w = document.createElement("span");
|
|
1405
|
-
w.className = "global-color-label", w.textContent = C.split("-").map((
|
|
1406
|
-
|
|
1408
|
+
w.className = "global-color-label", w.textContent = C.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (N) => {
|
|
1409
|
+
N.preventDefault();
|
|
1407
1410
|
const D = `var(--${C})`;
|
|
1408
1411
|
this.setValue(D), this.pendingSolidColor = D, i(h);
|
|
1409
|
-
}), m.appendChild(
|
|
1412
|
+
}), m.appendChild(b);
|
|
1410
1413
|
} else {
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1414
|
+
const b = document.createElement("div");
|
|
1415
|
+
b.className = "global-color-circle";
|
|
1413
1416
|
const L = this.resolveGlobalVarColor(y);
|
|
1414
|
-
|
|
1415
|
-
|
|
1417
|
+
b.style.background = L, b.title = C.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
|
|
1418
|
+
E.preventDefault();
|
|
1416
1419
|
const w = `var(--${C})`;
|
|
1417
1420
|
this.setValue(w), this.pendingSolidColor = w, i(h);
|
|
1418
|
-
}), m.appendChild(
|
|
1421
|
+
}), m.appendChild(b);
|
|
1419
1422
|
}
|
|
1420
1423
|
});
|
|
1421
1424
|
});
|
|
@@ -1466,30 +1469,30 @@ const V = class V extends x {
|
|
|
1466
1469
|
c.className = "gradient-subtype-inline";
|
|
1467
1470
|
const h = document.createElement("select");
|
|
1468
1471
|
h.className = "gradient-subtype-select";
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1472
|
+
const p = document.createElement("option");
|
|
1473
|
+
p.value = "linear", p.textContent = "Linear";
|
|
1474
|
+
const g = document.createElement("option");
|
|
1475
|
+
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°");
|
|
1473
1476
|
const f = document.createElement("button");
|
|
1474
1477
|
f.type = "button", f.className = "gradient-flip-btn", f.innerHTML = Tt, h.addEventListener("change", () => {
|
|
1475
1478
|
this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
|
|
1476
1479
|
}), e.addEventListener("focus", (m) => {
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1480
|
+
const u = m.target;
|
|
1481
|
+
u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
|
|
1479
1482
|
}), e.addEventListener("input", (m) => {
|
|
1480
1483
|
this.clearGlobalBindingForCustomChange();
|
|
1481
|
-
const
|
|
1482
|
-
!Number.isNaN(
|
|
1484
|
+
const u = parseInt(m.target.value);
|
|
1485
|
+
!Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
|
|
1483
1486
|
}), e.addEventListener("blur", (m) => {
|
|
1484
1487
|
var C;
|
|
1485
1488
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1486
|
-
const
|
|
1487
|
-
let v = parseInt(
|
|
1488
|
-
Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v),
|
|
1489
|
+
const u = m.target;
|
|
1490
|
+
let v = parseInt(u.value);
|
|
1491
|
+
Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), u.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1489
1492
|
}), f.addEventListener("click", () => {
|
|
1490
1493
|
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
1491
1494
|
m.position = 100 - m.position;
|
|
1492
|
-
}), this.value.stops.sort((m,
|
|
1495
|
+
}), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
1493
1496
|
}), c.appendChild(h), c.appendChild(e), c.appendChild(f), t.appendChild(c), this.updateDegreeVisibility(e);
|
|
1494
1497
|
}
|
|
1495
1498
|
const i = document.createElement("div");
|
|
@@ -1541,28 +1544,28 @@ const V = class V extends x {
|
|
|
1541
1544
|
o.className = "gstop-chip";
|
|
1542
1545
|
const a = this.resolveGlobalVarColor(i.color);
|
|
1543
1546
|
o.style.backgroundColor = a, n.appendChild(o);
|
|
1544
|
-
const l = new ut((
|
|
1545
|
-
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color =
|
|
1547
|
+
const l = new ut((u, v) => {
|
|
1548
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
1546
1549
|
}, "solid");
|
|
1547
|
-
let r = !1, c = !1, h = 0,
|
|
1548
|
-
const
|
|
1549
|
-
r = !0, c = !1, h =
|
|
1550
|
-
}, f = (
|
|
1550
|
+
let r = !1, c = !1, h = 0, p = 0;
|
|
1551
|
+
const g = (u) => {
|
|
1552
|
+
r = !0, c = !1, h = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", f), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
|
|
1553
|
+
}, f = (u) => {
|
|
1551
1554
|
if (!r || !this.value) return;
|
|
1552
|
-
const v =
|
|
1555
|
+
const v = u.clientX - h;
|
|
1553
1556
|
if (Math.abs(v) > 3 && (c = !0), c) {
|
|
1554
1557
|
this.clearGlobalBindingForCustomChange();
|
|
1555
1558
|
const C = e.getBoundingClientRect();
|
|
1556
|
-
let y =
|
|
1559
|
+
let y = p + v / C.width * 100;
|
|
1557
1560
|
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
1558
1561
|
}
|
|
1559
|
-
}, m = (
|
|
1562
|
+
}, m = (u) => {
|
|
1560
1563
|
var v;
|
|
1561
1564
|
if (r)
|
|
1562
1565
|
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", m), c)
|
|
1563
1566
|
this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
1564
1567
|
else {
|
|
1565
|
-
|
|
1568
|
+
u.stopPropagation();
|
|
1566
1569
|
const C = (v = this.value) == null ? void 0 : v.stops[s];
|
|
1567
1570
|
C && setTimeout(() => {
|
|
1568
1571
|
const y = this.resolveGlobalVarColor(C.color);
|
|
@@ -1570,7 +1573,7 @@ const V = class V extends x {
|
|
|
1570
1573
|
}, 0);
|
|
1571
1574
|
}
|
|
1572
1575
|
};
|
|
1573
|
-
n.addEventListener("mousedown",
|
|
1576
|
+
n.addEventListener("mousedown", g), t.appendChild(n);
|
|
1574
1577
|
});
|
|
1575
1578
|
}
|
|
1576
1579
|
updateStopsList(t) {
|
|
@@ -1588,67 +1591,67 @@ const V = class V extends x {
|
|
|
1588
1591
|
r.className = "gstop-color-container";
|
|
1589
1592
|
const c = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
|
|
1590
1593
|
h.className = "gstop-color-preview", h.style.backgroundColor = c;
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1594
|
+
const p = document.createElement("input");
|
|
1595
|
+
p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
|
|
1596
|
+
const g = document.createElement("button");
|
|
1597
|
+
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(g);
|
|
1595
1598
|
const f = document.createElement("button");
|
|
1596
1599
|
f.type = "button", f.className = "gstop-del", f.innerHTML = Pt, f.disabled = (((I = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(f), e.appendChild(o);
|
|
1597
1600
|
const m = document.createElement("span");
|
|
1598
1601
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1602
|
+
const u = document.createElement("div");
|
|
1603
|
+
u.className = "gstop-opacity-group";
|
|
1601
1604
|
const v = document.createElement("input");
|
|
1602
1605
|
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
|
|
1603
1606
|
const C = P(c);
|
|
1604
1607
|
v.style.setProperty("--slider-color", `rgb(${C.r}, ${C.g}, ${C.b})`);
|
|
1605
1608
|
const y = document.createElement("span");
|
|
1606
|
-
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`,
|
|
1607
|
-
const
|
|
1608
|
-
this.clearGlobalBindingForCustomChange(),
|
|
1609
|
-
const
|
|
1610
|
-
v.style.setProperty("--slider-color", `rgb(${
|
|
1609
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(v), u.appendChild(y);
|
|
1610
|
+
const b = new ut((E, w) => {
|
|
1611
|
+
this.clearGlobalBindingForCustomChange(), p.value = E.replace("#", "").toUpperCase(), h.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, v.value = String(w), y.textContent = `${w}%`);
|
|
1612
|
+
const N = P(E);
|
|
1613
|
+
v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.updateGradientPreview(), this.createHandles(
|
|
1611
1614
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1612
1615
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1613
1616
|
), this.updateUI(), this.triggerChange();
|
|
1614
1617
|
}, "solid");
|
|
1615
|
-
|
|
1616
|
-
|
|
1618
|
+
p.addEventListener("click", (E) => {
|
|
1619
|
+
E.preventDefault(), E.stopPropagation();
|
|
1617
1620
|
const w = this.resolveGlobalVarColor(s.color);
|
|
1618
|
-
|
|
1619
|
-
}),
|
|
1621
|
+
b.open(w, p, s.opacity ?? 100);
|
|
1622
|
+
}), p.addEventListener("input", () => {
|
|
1620
1623
|
this.clearGlobalBindingForCustomChange();
|
|
1621
|
-
const
|
|
1624
|
+
const E = p.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
|
|
1622
1625
|
if (/^#[0-9A-Fa-f]{6}$/.test(w)) {
|
|
1623
1626
|
this.value.stops[n].color = w, h.style.backgroundColor = w;
|
|
1624
|
-
const
|
|
1625
|
-
v.style.setProperty("--slider-color", `rgb(${
|
|
1627
|
+
const N = P(w);
|
|
1628
|
+
v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.debouncedPreviewUpdate();
|
|
1626
1629
|
}
|
|
1627
|
-
}),
|
|
1630
|
+
}), p.addEventListener("blur", () => {
|
|
1628
1631
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1629
|
-
}),
|
|
1630
|
-
|
|
1632
|
+
}), g.addEventListener("click", async (E) => {
|
|
1633
|
+
E.stopPropagation();
|
|
1631
1634
|
try {
|
|
1632
|
-
await navigator.clipboard.writeText(`#${
|
|
1635
|
+
await navigator.clipboard.writeText(`#${p.value}`);
|
|
1633
1636
|
} catch {
|
|
1634
1637
|
}
|
|
1635
|
-
}), l.addEventListener("focus", (
|
|
1636
|
-
const w =
|
|
1638
|
+
}), l.addEventListener("focus", (E) => {
|
|
1639
|
+
const w = E.target;
|
|
1637
1640
|
w.value = w.value.replace("%", ""), w.select();
|
|
1638
|
-
}), l.addEventListener("input", (
|
|
1641
|
+
}), l.addEventListener("input", (E) => {
|
|
1639
1642
|
this.clearGlobalBindingForCustomChange();
|
|
1640
|
-
const w =
|
|
1641
|
-
if (!Number.isNaN(
|
|
1642
|
-
const D = Math.max(0, Math.min(100,
|
|
1643
|
+
const w = E.target, N = parseInt(w.value.replace(/[^\d]/g, ""), 10);
|
|
1644
|
+
if (!Number.isNaN(N)) {
|
|
1645
|
+
const D = Math.max(0, Math.min(100, N));
|
|
1643
1646
|
this.value.stops[n].position = D, w.value = `${D}%`, this.debouncedPreviewUpdate();
|
|
1644
1647
|
}
|
|
1645
|
-
}), l.addEventListener("blur", (
|
|
1648
|
+
}), l.addEventListener("blur", (E) => {
|
|
1646
1649
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
1647
|
-
const w =
|
|
1648
|
-
if (Number.isNaN(
|
|
1650
|
+
const w = E.target, N = parseInt(w.value.replace(/[^\d]/g, ""), 10);
|
|
1651
|
+
if (Number.isNaN(N))
|
|
1649
1652
|
w.value = `${this.value.stops[n].position}%`;
|
|
1650
1653
|
else {
|
|
1651
|
-
const D = Math.max(0, Math.min(100,
|
|
1654
|
+
const D = Math.max(0, Math.min(100, N));
|
|
1652
1655
|
this.value.stops[n].position = D, w.value = `${D}%`;
|
|
1653
1656
|
}
|
|
1654
1657
|
this.updateGradientPreview(), this.createHandles(
|
|
@@ -1656,15 +1659,15 @@ const V = class V extends x {
|
|
|
1656
1659
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1657
1660
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
1658
1661
|
}), f.addEventListener("click", () => {
|
|
1659
|
-
var
|
|
1662
|
+
var E;
|
|
1660
1663
|
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
1661
1664
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
1662
1665
|
this.popoverEl.querySelector(".gradient-preview")
|
|
1663
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
1666
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((E = document.activeElement) == null ? void 0 : E.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
1664
1667
|
}), v.addEventListener("input", () => {
|
|
1665
1668
|
this.clearGlobalBindingForCustomChange();
|
|
1666
|
-
const
|
|
1667
|
-
this.value.stops[n].opacity = Math.max(0, Math.min(100,
|
|
1669
|
+
const E = parseInt(v.value, 10);
|
|
1670
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, E)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
1668
1671
|
}), v.addEventListener("change", () => {
|
|
1669
1672
|
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
1670
1673
|
});
|
|
@@ -1696,8 +1699,8 @@ const V = class V extends x {
|
|
|
1696
1699
|
let a = t.right + 8, l = t.top;
|
|
1697
1700
|
const r = i - t.right, c = t.left, h = e + n;
|
|
1698
1701
|
r < h && c > r + 100 && (a = t.left - e - 8);
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1702
|
+
const p = s - t.bottom, g = t.top;
|
|
1703
|
+
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 };
|
|
1701
1704
|
}
|
|
1702
1705
|
setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
1703
1706
|
}
|
|
@@ -1715,10 +1718,10 @@ const V = class V extends x {
|
|
|
1715
1718
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
1716
1719
|
const a = this.popoverEl.offsetHeight;
|
|
1717
1720
|
let l = e.right + 8, r = e.top;
|
|
1718
|
-
const c = s - e.right, h = e.left,
|
|
1719
|
-
c <
|
|
1720
|
-
const
|
|
1721
|
-
f >= a + o ? r = e.top - a - 8 :
|
|
1721
|
+
const c = s - e.right, h = e.left, p = i + o;
|
|
1722
|
+
c < p && h > c + 100 && (l = e.left - i - 8);
|
|
1723
|
+
const g = n - e.bottom, f = e.top;
|
|
1724
|
+
f >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : f > 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`;
|
|
1722
1725
|
});
|
|
1723
1726
|
}
|
|
1724
1727
|
}
|
|
@@ -1737,13 +1740,13 @@ const V = class V extends x {
|
|
|
1737
1740
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
1738
1741
|
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") {
|
|
1739
1742
|
const e = S(this.value);
|
|
1740
|
-
|
|
1743
|
+
F.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
1741
1744
|
}
|
|
1742
1745
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
|
|
1743
1746
|
}
|
|
1744
1747
|
}
|
|
1745
1748
|
commitPendingSolidColor() {
|
|
1746
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
1749
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : F.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
1747
1750
|
}
|
|
1748
1751
|
handlePaste(t) {
|
|
1749
1752
|
var i;
|
|
@@ -1793,10 +1796,10 @@ const V = class V extends x {
|
|
|
1793
1796
|
};
|
|
1794
1797
|
V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
|
|
1795
1798
|
let j = V;
|
|
1796
|
-
function J(
|
|
1797
|
-
for (const e in
|
|
1798
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1799
|
-
const i =
|
|
1799
|
+
function J(d, t) {
|
|
1800
|
+
for (const e in d)
|
|
1801
|
+
if (Object.prototype.hasOwnProperty.call(d, e)) {
|
|
1802
|
+
const i = d[e];
|
|
1800
1803
|
t(e, i);
|
|
1801
1804
|
}
|
|
1802
1805
|
}
|
|
@@ -1894,14 +1897,14 @@ const Q = class Q {
|
|
|
1894
1897
|
}), s.forEach((r) => {
|
|
1895
1898
|
n.includes(r) || this.removeSetting(r);
|
|
1896
1899
|
}), n.forEach((r) => {
|
|
1897
|
-
var
|
|
1900
|
+
var p;
|
|
1898
1901
|
const c = t[r], h = this.settings[r];
|
|
1899
1902
|
if (h !== c && (h && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
|
|
1900
|
-
const
|
|
1903
|
+
const g = o[r];
|
|
1901
1904
|
try {
|
|
1902
1905
|
k(c) ? c.setValue(
|
|
1903
|
-
|
|
1904
|
-
) : G(c) ? (
|
|
1906
|
+
g
|
|
1907
|
+
) : G(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
|
|
1905
1908
|
} catch (f) {
|
|
1906
1909
|
console.warn(`Could not preserve value for setting ${r}:`, f);
|
|
1907
1910
|
}
|
|
@@ -2332,12 +2335,12 @@ const Q = class Q {
|
|
|
2332
2335
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
2333
2336
|
const h = this.settings[c];
|
|
2334
2337
|
k(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
2335
|
-
const
|
|
2338
|
+
const p = h.draw();
|
|
2336
2339
|
k(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
2337
|
-
|
|
2340
|
+
p,
|
|
2338
2341
|
c,
|
|
2339
2342
|
h
|
|
2340
|
-
), a.appendChild(
|
|
2343
|
+
), a.appendChild(p);
|
|
2341
2344
|
}
|
|
2342
2345
|
} else {
|
|
2343
2346
|
const c = document.createElement("div");
|
|
@@ -2352,11 +2355,11 @@ const Q = class Q {
|
|
|
2352
2355
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
2353
2356
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
2354
2357
|
</svg>`;
|
|
2355
|
-
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (
|
|
2356
|
-
|
|
2357
|
-
const
|
|
2358
|
+
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
|
|
2359
|
+
p.stopPropagation(), p.preventDefault();
|
|
2360
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), f = this.addItemCfg.createItem(g);
|
|
2358
2361
|
if (ct(f)) {
|
|
2359
|
-
const m = `${this.addItemCfg.keyPrefix}${
|
|
2362
|
+
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
2360
2363
|
this.addSetting(m, f);
|
|
2361
2364
|
}
|
|
2362
2365
|
}), a.appendChild(c);
|
|
@@ -2405,8 +2408,8 @@ const Q = class Q {
|
|
|
2405
2408
|
};
|
|
2406
2409
|
Q.hiddenElements = /* @__PURE__ */ new Set();
|
|
2407
2410
|
let $ = Q;
|
|
2408
|
-
function
|
|
2409
|
-
return new At(
|
|
2411
|
+
function be(d) {
|
|
2412
|
+
return new At(d);
|
|
2410
2413
|
}
|
|
2411
2414
|
class At extends $ {
|
|
2412
2415
|
constructor(t) {
|
|
@@ -2469,11 +2472,11 @@ class At extends $ {
|
|
|
2469
2472
|
return this.updateTabUI(), t;
|
|
2470
2473
|
}
|
|
2471
2474
|
}
|
|
2472
|
-
function Dt(
|
|
2473
|
-
return new $(
|
|
2475
|
+
function Dt(d) {
|
|
2476
|
+
return new $(d);
|
|
2474
2477
|
}
|
|
2475
|
-
function we(
|
|
2476
|
-
return
|
|
2478
|
+
function we(d) {
|
|
2479
|
+
return d;
|
|
2477
2480
|
}
|
|
2478
2481
|
class Gt extends x {
|
|
2479
2482
|
constructor(t = {}) {
|
|
@@ -2495,12 +2498,12 @@ class Gt extends x {
|
|
|
2495
2498
|
});
|
|
2496
2499
|
}
|
|
2497
2500
|
}
|
|
2498
|
-
const
|
|
2501
|
+
const Ft = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
2499
2502
|
class O extends Gt {
|
|
2500
2503
|
constructor(t) {
|
|
2501
2504
|
super({
|
|
2502
2505
|
...t,
|
|
2503
|
-
icon: t.icon ||
|
|
2506
|
+
icon: t.icon || Ft,
|
|
2504
2507
|
title: t.title || "Color",
|
|
2505
2508
|
default: t.default ? O.normalizeColorValue(t.default) : "#000000"
|
|
2506
2509
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
@@ -2542,12 +2545,12 @@ class O extends Gt {
|
|
|
2542
2545
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
2543
2546
|
const m = document.createElement("div");
|
|
2544
2547
|
if (m.className = "icon-container", this.props.icon) {
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2548
|
+
const u = document.createElement("span");
|
|
2549
|
+
u.className = "input-icon", u.innerHTML = this.props.icon, m.appendChild(u);
|
|
2547
2550
|
}
|
|
2548
2551
|
if (this.props.title) {
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2552
|
+
const u = document.createElement("span");
|
|
2553
|
+
u.className = "input-label", u.textContent = this.props.title, m.appendChild(u);
|
|
2551
2554
|
}
|
|
2552
2555
|
t.appendChild(m);
|
|
2553
2556
|
}
|
|
@@ -2567,24 +2570,24 @@ class O extends Gt {
|
|
|
2567
2570
|
try {
|
|
2568
2571
|
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !x) {
|
|
2569
2572
|
console.error("ColorSetting: Setting class is undefined");
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2573
|
+
const u = document.createElement("div");
|
|
2574
|
+
u.textContent = "Error: System error (Setting undefined)", a.appendChild(u);
|
|
2572
2575
|
return;
|
|
2573
2576
|
}
|
|
2574
2577
|
const m = x.GlobalVariables || {};
|
|
2575
2578
|
if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
|
|
2576
|
-
const
|
|
2577
|
-
|
|
2579
|
+
const u = document.createElement("div");
|
|
2580
|
+
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
|
|
2578
2581
|
return;
|
|
2579
2582
|
}
|
|
2580
|
-
Object.entries(m).forEach(([
|
|
2583
|
+
Object.entries(m).forEach(([u, v]) => {
|
|
2581
2584
|
const C = document.createElement("button");
|
|
2582
|
-
C.className = "global-color-btn", C.title =
|
|
2585
|
+
C.className = "global-color-btn", C.title = u, C.style.width = "30px", C.style.height = "30px", C.style.borderRadius = "50%", C.style.border = "1px solid #ddd", C.style.backgroundColor = v, C.style.cursor = "pointer", this.value === `var(--${u})` && (C.style.border = "2px solid #2196f3"), C.addEventListener("click", (y) => {
|
|
2583
2586
|
var L, I;
|
|
2584
2587
|
y.preventDefault();
|
|
2585
|
-
const
|
|
2586
|
-
this.value =
|
|
2587
|
-
|
|
2588
|
+
const b = `var(--${u})`;
|
|
2589
|
+
this.value = b, (L = this.onChange) == null || L.call(this, b), (I = this.detectChange) == null || I.call(this, b), Array.from(a.children).forEach((E) => {
|
|
2590
|
+
E.style.border = "1px solid #ddd";
|
|
2588
2591
|
}), C.style.border = "2px solid #2196f3", h.style.backgroundColor = v;
|
|
2589
2592
|
}), a.appendChild(C);
|
|
2590
2593
|
});
|
|
@@ -2598,51 +2601,51 @@ class O extends Gt {
|
|
|
2598
2601
|
m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
2599
2602
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
2600
2603
|
const r = (m) => {
|
|
2601
|
-
const
|
|
2602
|
-
if (!
|
|
2604
|
+
const u = m.value.trim();
|
|
2605
|
+
if (!u)
|
|
2603
2606
|
return e.classList.remove("error"), !0;
|
|
2604
|
-
const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(
|
|
2607
|
+
const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
|
|
2605
2608
|
return C ? e.classList.remove("error") : e.classList.add("error"), C;
|
|
2606
2609
|
}, c = document.createElement("input");
|
|
2607
2610
|
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;
|
|
2608
2611
|
const h = document.createElement("div");
|
|
2609
2612
|
h.className = "color-preview";
|
|
2610
|
-
let
|
|
2611
|
-
if (
|
|
2612
|
-
const m =
|
|
2613
|
-
|
|
2613
|
+
let p = this.value || "#000000";
|
|
2614
|
+
if (p.startsWith("var(--")) {
|
|
2615
|
+
const m = p.replace("var(--", "").replace(")", "");
|
|
2616
|
+
p = (x.GlobalVariables || {})[m] || "#000000";
|
|
2614
2617
|
}
|
|
2615
|
-
h.style.backgroundColor =
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2618
|
+
h.style.backgroundColor = p;
|
|
2619
|
+
const g = document.createElement("input");
|
|
2620
|
+
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;
|
|
2618
2621
|
const f = (m) => {
|
|
2619
2622
|
var v, C;
|
|
2620
|
-
let
|
|
2621
|
-
if (
|
|
2622
|
-
const y = O.normalizeColorValue(
|
|
2623
|
+
let u = m.trim();
|
|
2624
|
+
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)) {
|
|
2625
|
+
const y = O.normalizeColorValue(u);
|
|
2623
2626
|
this.value = y, (v = this.onChange) == null || v.call(this, y), (C = this.detectChange) == null || C.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), h.style.backgroundColor = y;
|
|
2624
2627
|
}
|
|
2625
2628
|
};
|
|
2626
2629
|
return this.textInputEl.addEventListener("input", (m) => {
|
|
2627
|
-
const
|
|
2628
|
-
f(
|
|
2630
|
+
const u = m.target.value;
|
|
2631
|
+
f(u);
|
|
2629
2632
|
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
2630
2633
|
var v;
|
|
2631
2634
|
m.preventDefault();
|
|
2632
|
-
const
|
|
2633
|
-
this.textInputEl && (this.textInputEl.value =
|
|
2635
|
+
const u = ((v = m.clipboardData) == null ? void 0 : v.getData("text")) || "";
|
|
2636
|
+
this.textInputEl && (this.textInputEl.value = u.trim(), f(u));
|
|
2634
2637
|
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
2635
|
-
var
|
|
2636
|
-
m.key === "Enter" && (m.preventDefault(), f(((
|
|
2638
|
+
var u, v, C;
|
|
2639
|
+
m.key === "Enter" && (m.preventDefault(), f(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (v = this.textInputEl) == null || v.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (C = this.textInputEl) == null || C.blur(), e.classList.remove("error"));
|
|
2637
2640
|
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
2638
2641
|
var C, y;
|
|
2639
|
-
const
|
|
2642
|
+
const u = m.target.value, v = O.normalizeColorValue(u);
|
|
2640
2643
|
this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v, e.classList.remove("error");
|
|
2641
2644
|
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
2642
2645
|
var C, y;
|
|
2643
|
-
const
|
|
2646
|
+
const u = m.target.value, v = O.normalizeColorValue(u);
|
|
2644
2647
|
this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v;
|
|
2645
|
-
}), o.appendChild(c), o.appendChild(h), o.appendChild(
|
|
2648
|
+
}), 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;
|
|
2646
2649
|
}
|
|
2647
2650
|
getElement() {
|
|
2648
2651
|
return this.element;
|
|
@@ -2660,20 +2663,20 @@ class O extends Gt {
|
|
|
2660
2663
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
2661
2664
|
}
|
|
2662
2665
|
}
|
|
2663
|
-
const
|
|
2666
|
+
const Rt = `
|
|
2664
2667
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2665
2668
|
<path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2666
2669
|
<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"/>
|
|
2667
2670
|
<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"/>
|
|
2668
2671
|
</svg>`;
|
|
2669
|
-
class
|
|
2672
|
+
class R extends x {
|
|
2670
2673
|
constructor(t = {}) {
|
|
2671
2674
|
super({
|
|
2672
2675
|
...t,
|
|
2673
|
-
icon: t.icon ||
|
|
2676
|
+
icon: t.icon || Rt,
|
|
2674
2677
|
title: t.title || "Color & Opacity",
|
|
2675
2678
|
default: t.default || "#000000FF"
|
|
2676
|
-
}), 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 =
|
|
2679
|
+
}), 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 = R.normalizeHexWithOpacity(this.value));
|
|
2677
2680
|
}
|
|
2678
2681
|
static normalizeHexWithOpacity(t) {
|
|
2679
2682
|
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");
|
|
@@ -2691,7 +2694,7 @@ class F extends x {
|
|
|
2691
2694
|
return `#${i}${n}`;
|
|
2692
2695
|
}
|
|
2693
2696
|
setValue(t) {
|
|
2694
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
2697
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = R.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
2695
2698
|
}
|
|
2696
2699
|
updateInputElements() {
|
|
2697
2700
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -2702,7 +2705,7 @@ class F extends x {
|
|
|
2702
2705
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2703
2706
|
}
|
|
2704
2707
|
handleColorChange(t) {
|
|
2705
|
-
const e = this.getOpacityPercent(), i =
|
|
2708
|
+
const e = this.getOpacityPercent(), i = R.combineColorOpacity(
|
|
2706
2709
|
t,
|
|
2707
2710
|
e
|
|
2708
2711
|
);
|
|
@@ -2713,7 +2716,7 @@ class F extends x {
|
|
|
2713
2716
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
2714
2717
|
}
|
|
2715
2718
|
handleOpacityChange(t) {
|
|
2716
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
2719
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = R.combineColorOpacity(
|
|
2717
2720
|
e,
|
|
2718
2721
|
i
|
|
2719
2722
|
);
|
|
@@ -3423,12 +3426,52 @@ const Kt = `
|
|
|
3423
3426
|
super(t), this.inputType = {
|
|
3424
3427
|
imageUrl: "text",
|
|
3425
3428
|
markers: "text"
|
|
3426
|
-
}, this.mainButton = null, this.thumbnailEl = null, this.markerCountEl = null, this.popoverEl = null, this.backdropEl = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmOverlayEl = null, this.confirmPromise = null, this.draggingMarkerId = null, this.history = [], this.historyIndex = -1, this.isUndoRedoOperation = !1, this.initialValue = null, this.props.maxMarkers = this.props.maxMarkers ?? 10, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? 5, this.props.markerSize = this.props.markerSize ?? 24, this.value || (this.value = { imageUrl: "", markers: [] }), this.onBackgroundClick = (e) => {
|
|
3427
|
-
this.isPopoverOpen && this.popoverEl && !this.popoverEl.contains(e.target)
|
|
3429
|
+
}, this.mainButton = null, this.thumbnailEl = null, this.markerCountEl = null, this.popoverEl = null, this.backdropEl = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmOverlayEl = null, this.confirmPromise = null, this.lastImageNaturalSize = null, this.draggingMarkerId = null, this.history = [], this.historyIndex = -1, this.isUndoRedoOperation = !1, this.initialValue = null, this.messageListener = null, this.props.maxMarkers = this.props.maxMarkers ?? 10, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? 5, this.props.markerSize = this.props.markerSize ?? 24, this.value || (this.value = { imageUrl: "", markers: [] }), this.setupMessageListener(), this.onBackgroundClick = (e) => {
|
|
3430
|
+
if (this.isPopoverOpen && this.popoverEl && !this.popoverEl.contains(e.target)) {
|
|
3431
|
+
if (e.target.closest(
|
|
3432
|
+
'[class*="modal"], [class*="Modal"], [class*="dialog"], [class*="Dialog"], [class*="overlay"], [class*="Overlay"]'
|
|
3433
|
+
))
|
|
3434
|
+
return;
|
|
3435
|
+
this.closePopover();
|
|
3436
|
+
}
|
|
3428
3437
|
}, this.handlePopoverKeydown = (e) => {
|
|
3429
3438
|
this.isPopoverOpen && (e.key === "Escape" ? this.closePopover() : (e.ctrlKey || e.metaKey) && (e.key === "z" || e.key === "Z" ? e.shiftKey ? (e.preventDefault(), this.redo()) : (e.preventDefault(), this.undo()) : (e.key === "y" || e.key === "Y") && (e.preventDefault(), this.redo())));
|
|
3430
3439
|
}, this.boundHandleMarkerDrag = this.handleMarkerDrag.bind(this), this.boundStopDragging = this.stopDragging.bind(this);
|
|
3431
3440
|
}
|
|
3441
|
+
setupMessageListener() {
|
|
3442
|
+
this.messageListener = (t) => {
|
|
3443
|
+
if (t.data && t.data.type === "FILE_MANAGER_IMAGE_SELECTED" && t.data.settingId === this.id) {
|
|
3444
|
+
const e = t.data.imageUrl;
|
|
3445
|
+
if (e && typeof e == "string") {
|
|
3446
|
+
const i = this.lastImageNaturalSize, s = new Image();
|
|
3447
|
+
s.onload = () => {
|
|
3448
|
+
var a;
|
|
3449
|
+
const n = {
|
|
3450
|
+
width: s.naturalWidth || 0,
|
|
3451
|
+
height: s.naturalHeight || 0
|
|
3452
|
+
}, o = this.scaleMarkersForNewImage(
|
|
3453
|
+
((a = this.value) == null ? void 0 : a.markers) || [],
|
|
3454
|
+
i,
|
|
3455
|
+
n
|
|
3456
|
+
);
|
|
3457
|
+
this.value = {
|
|
3458
|
+
imageUrl: e,
|
|
3459
|
+
markers: o
|
|
3460
|
+
}, this.lastImageNaturalSize = n, this.history = [
|
|
3461
|
+
JSON.parse(
|
|
3462
|
+
JSON.stringify(o)
|
|
3463
|
+
)
|
|
3464
|
+
], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange();
|
|
3465
|
+
}, s.onerror = () => {
|
|
3466
|
+
this.showError("Failed to load image from file manager.");
|
|
3467
|
+
}, s.src = e;
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
}, window.addEventListener("message", this.messageListener);
|
|
3471
|
+
}
|
|
3472
|
+
cleanupMessageListener() {
|
|
3473
|
+
this.messageListener && (window.removeEventListener("message", this.messageListener), this.messageListener = null);
|
|
3474
|
+
}
|
|
3432
3475
|
draw() {
|
|
3433
3476
|
const t = document.createElement("div");
|
|
3434
3477
|
if (t.className = "image-map-setting-wrapper", this.props.title || this.props.icon) {
|
|
@@ -3468,7 +3511,11 @@ const Kt = `
|
|
|
3468
3511
|
s.className = "image-map-content", this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3469
3512
|
}
|
|
3470
3513
|
openPopover() {
|
|
3471
|
-
B.openInstance && B.openInstance !== this && B.openInstance.closePopover(), this.isPopoverOpen = !0, B.openInstance = this, this.value ? this.initialValue = JSON.parse(
|
|
3514
|
+
B.openInstance && B.openInstance !== this && B.openInstance.closePopover(), this.isPopoverOpen = !0, B.openInstance = this, this.value ? this.initialValue = JSON.parse(
|
|
3515
|
+
JSON.stringify(this.value)
|
|
3516
|
+
) : this.initialValue = { imageUrl: "", markers: [] }, this.value && (this.history = [
|
|
3517
|
+
JSON.parse(JSON.stringify(this.value.markers))
|
|
3518
|
+
], this.historyIndex = 0), this.backdropEl && (this.backdropEl.style.display = "block"), this.popoverEl && (this.popoverEl.style.display = "flex"), this.positionPopover(), this.refreshPopoverContent(), setTimeout(() => {
|
|
3472
3519
|
document.addEventListener("click", this.onBackgroundClick, !0);
|
|
3473
3520
|
}, 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
3474
3521
|
}
|
|
@@ -3488,7 +3535,9 @@ const Kt = `
|
|
|
3488
3535
|
"You haven't placed all markers. Closing will discard your changes."
|
|
3489
3536
|
))
|
|
3490
3537
|
return;
|
|
3491
|
-
this.initialValue && (this.value = JSON.parse(
|
|
3538
|
+
this.initialValue && (this.value = JSON.parse(
|
|
3539
|
+
JSON.stringify(this.initialValue)
|
|
3540
|
+
), this.updateButtonDisplay(), this.triggerChange());
|
|
3492
3541
|
}
|
|
3493
3542
|
this.isPopoverOpen = !1, this.draggingMarkerId = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl && (this.popoverEl.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), B.openInstance === this && (B.openInstance = null);
|
|
3494
3543
|
}
|
|
@@ -3502,9 +3551,13 @@ const Kt = `
|
|
|
3502
3551
|
}
|
|
3503
3552
|
refreshPopoverContent() {
|
|
3504
3553
|
if (!this.popoverEl) return;
|
|
3505
|
-
const t = this.popoverEl.querySelector(
|
|
3554
|
+
const t = this.popoverEl.querySelector(
|
|
3555
|
+
".image-map-content"
|
|
3556
|
+
);
|
|
3506
3557
|
if (!t) return;
|
|
3507
|
-
const e = t.querySelector(
|
|
3558
|
+
const e = t.querySelector(
|
|
3559
|
+
".image-map-container"
|
|
3560
|
+
), i = (e == null ? void 0 : e.scrollTop) || 0;
|
|
3508
3561
|
if (t.innerHTML = "", this.value && this.value.imageUrl && this.value.imageUrl !== "") {
|
|
3509
3562
|
const n = document.createElement("div");
|
|
3510
3563
|
n.className = "image-map-main-layout";
|
|
@@ -3512,7 +3565,9 @@ const Kt = `
|
|
|
3512
3565
|
o.className = "image-map-image-section", this.renderImageMapSection(o);
|
|
3513
3566
|
const a = document.createElement("div");
|
|
3514
3567
|
a.className = "image-map-sidebar", this.renderSidebar(a), n.appendChild(o), n.appendChild(a), t.appendChild(n), requestAnimationFrame(() => {
|
|
3515
|
-
const l = o.querySelector(
|
|
3568
|
+
const l = o.querySelector(
|
|
3569
|
+
".image-map-container"
|
|
3570
|
+
);
|
|
3516
3571
|
l && (l.scrollTop = i);
|
|
3517
3572
|
});
|
|
3518
3573
|
} else
|
|
@@ -3521,19 +3576,21 @@ const Kt = `
|
|
|
3521
3576
|
renderUploadSection(t) {
|
|
3522
3577
|
const e = document.createElement("div");
|
|
3523
3578
|
e.className = "upload-section";
|
|
3524
|
-
const i = document.createElement("
|
|
3525
|
-
i.className = "upload-label", i.innerHTML = `
|
|
3579
|
+
const i = document.createElement("button");
|
|
3580
|
+
i.type = "button", i.className = "upload-label", i.innerHTML = `
|
|
3526
3581
|
<div class="upload-placeholder">
|
|
3527
3582
|
${Kt}
|
|
3528
3583
|
<span>Click to upload image</span>
|
|
3529
3584
|
</div>
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3585
|
+
`, i.addEventListener("click", () => {
|
|
3586
|
+
window.postMessage(
|
|
3587
|
+
{
|
|
3588
|
+
type: "OPEN_FILE_MANAGER_MODAL",
|
|
3589
|
+
settingId: this.id
|
|
3590
|
+
},
|
|
3591
|
+
"*"
|
|
3592
|
+
);
|
|
3593
|
+
}), e.appendChild(i), t.appendChild(e);
|
|
3537
3594
|
}
|
|
3538
3595
|
renderImageMapSection(t) {
|
|
3539
3596
|
const e = document.createElement("div");
|
|
@@ -3544,25 +3601,40 @@ const Kt = `
|
|
|
3544
3601
|
s.type = "button", s.className = "undo-btn action-btn", s.innerHTML = te, s.title = "Undo (Ctrl+Z)", s.disabled = !this.canUndo(), s.addEventListener("click", () => this.undo()), i.appendChild(s);
|
|
3545
3602
|
const n = document.createElement("button");
|
|
3546
3603
|
n.type = "button", n.className = "redo-btn action-btn", n.innerHTML = ee, n.title = "Redo (Ctrl+Y)", n.disabled = !this.canRedo(), n.addEventListener("click", () => this.redo()), i.appendChild(n), e.appendChild(i);
|
|
3547
|
-
const o = document.createElement("
|
|
3548
|
-
o.className = "replace-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
const
|
|
3558
|
-
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3561
|
-
const
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3604
|
+
const o = document.createElement("button");
|
|
3605
|
+
o.type = "button", o.className = "replace-btn", o.textContent = "Replace Image", o.addEventListener("click", () => {
|
|
3606
|
+
window.postMessage(
|
|
3607
|
+
{
|
|
3608
|
+
type: "OPEN_FILE_MANAGER_MODAL",
|
|
3609
|
+
settingId: this.id
|
|
3610
|
+
},
|
|
3611
|
+
"*"
|
|
3612
|
+
);
|
|
3613
|
+
}), e.appendChild(o);
|
|
3614
|
+
const a = document.createElement("button");
|
|
3615
|
+
a.type = "button", a.className = "clear-all-btn", a.textContent = "Clear All Markers", a.addEventListener("click", () => this.handleClearAllMarkers()), e.appendChild(a), t.appendChild(e);
|
|
3616
|
+
const l = document.createElement("div");
|
|
3617
|
+
l.className = "image-map-container";
|
|
3618
|
+
const r = document.createElement("div");
|
|
3619
|
+
r.className = "image-map-wrapper", r.addEventListener("mousemove", this.boundHandleMarkerDrag), r.addEventListener("mouseup", this.boundStopDragging), r.addEventListener("mouseleave", this.boundStopDragging), this.imageElement = document.createElement("img"), this.imageElement.className = "image-map-image", this.imageElement.src = this.value.imageUrl, this.imageElement.addEventListener(
|
|
3620
|
+
"load",
|
|
3621
|
+
() => this.recordImageNaturalSize()
|
|
3622
|
+
), this.imageElement.addEventListener(
|
|
3623
|
+
"click",
|
|
3624
|
+
(c) => this.handleImageClick(c)
|
|
3625
|
+
), r.appendChild(this.imageElement), this.cursorTooltip = document.createElement("div"), this.cursorTooltip.className = "marker-cursor-tooltip", r.appendChild(this.cursorTooltip), this.imageElement.addEventListener(
|
|
3626
|
+
"mouseenter",
|
|
3627
|
+
() => this.showCursorTooltip()
|
|
3628
|
+
), this.imageElement.addEventListener(
|
|
3629
|
+
"mouseleave",
|
|
3630
|
+
() => this.hideCursorTooltip()
|
|
3631
|
+
), this.imageElement.addEventListener(
|
|
3632
|
+
"mousemove",
|
|
3633
|
+
(c) => this.updateCursorTooltip(c)
|
|
3634
|
+
), this.value && this.value.markers && this.value.markers.forEach((c) => {
|
|
3635
|
+
const h = this.createMarkerElement(c);
|
|
3636
|
+
r.appendChild(h);
|
|
3637
|
+
}), l.appendChild(r), t.appendChild(l);
|
|
3566
3638
|
}
|
|
3567
3639
|
renderSidebar(t) {
|
|
3568
3640
|
var c, h;
|
|
@@ -3573,20 +3645,20 @@ const Kt = `
|
|
|
3573
3645
|
const o = document.createElement("div");
|
|
3574
3646
|
o.className = "prize-list";
|
|
3575
3647
|
const a = ((h = this.value) == null ? void 0 : h.markers) || [], l = /* @__PURE__ */ new Map();
|
|
3576
|
-
a.forEach((
|
|
3577
|
-
for (let
|
|
3578
|
-
const
|
|
3579
|
-
|
|
3648
|
+
a.forEach((p) => l.set(p.index, p));
|
|
3649
|
+
for (let p = 1; p <= i; p++) {
|
|
3650
|
+
const g = l.get(p), f = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[p - 1] || `Prize #${p}`, u = document.createElement("div");
|
|
3651
|
+
u.className = `prize-item ${f ? "placed" : "missing"}`;
|
|
3580
3652
|
const v = document.createElement("div");
|
|
3581
|
-
v.className = "prize-index", v.textContent = String(
|
|
3653
|
+
v.className = "prize-index", v.textContent = String(p);
|
|
3582
3654
|
const C = document.createElement("div");
|
|
3583
3655
|
C.className = "prize-label";
|
|
3584
3656
|
const y = document.createElement("div");
|
|
3585
|
-
y.className = "prize-title", y.textContent = `Prize #${
|
|
3586
|
-
const
|
|
3587
|
-
|
|
3657
|
+
y.className = "prize-title", y.textContent = `Prize #${p}`;
|
|
3658
|
+
const b = document.createElement("div");
|
|
3659
|
+
b.className = "prize-subtitle", b.textContent = f ? m : "Not Placed", C.appendChild(y), C.appendChild(b);
|
|
3588
3660
|
const L = document.createElement("div");
|
|
3589
|
-
L.className = `prize-status ${f ? "placed" : "missing"}`, L.innerHTML = f ? ie : se,
|
|
3661
|
+
L.className = `prize-status ${f ? "placed" : "missing"}`, L.innerHTML = f ? ie : se, u.appendChild(v), u.appendChild(C), u.appendChild(L), o.appendChild(u);
|
|
3590
3662
|
}
|
|
3591
3663
|
t.appendChild(o);
|
|
3592
3664
|
const r = document.createElement("button");
|
|
@@ -3611,33 +3683,63 @@ const Kt = `
|
|
|
3611
3683
|
}), e;
|
|
3612
3684
|
}
|
|
3613
3685
|
handleImageUpload(t) {
|
|
3614
|
-
|
|
3615
|
-
|
|
3686
|
+
const e = this.lastImageNaturalSize;
|
|
3687
|
+
if (![
|
|
3688
|
+
"image/jpeg",
|
|
3689
|
+
"image/jpg",
|
|
3690
|
+
"image/png",
|
|
3691
|
+
"image/gif",
|
|
3692
|
+
"image/webp"
|
|
3693
|
+
].includes(t.type)) {
|
|
3694
|
+
this.showError(
|
|
3695
|
+
"Invalid file type. Please upload a JPEG, PNG, GIF, or WebP image."
|
|
3696
|
+
);
|
|
3616
3697
|
return;
|
|
3617
3698
|
}
|
|
3618
|
-
const
|
|
3619
|
-
if (t.size >
|
|
3620
|
-
const
|
|
3621
|
-
this.showError(
|
|
3699
|
+
const s = (this.props.maxFileSizeMB || 5) * 1024 * 1024;
|
|
3700
|
+
if (t.size > s) {
|
|
3701
|
+
const o = (t.size / 1048576).toFixed(1);
|
|
3702
|
+
this.showError(
|
|
3703
|
+
`File size (${o}MB) exceeds ${this.props.maxFileSizeMB}MB limit.`
|
|
3704
|
+
);
|
|
3622
3705
|
return;
|
|
3623
3706
|
}
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3626
|
-
var
|
|
3627
|
-
const
|
|
3628
|
-
typeof
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3707
|
+
const n = new FileReader();
|
|
3708
|
+
n.onload = (o) => {
|
|
3709
|
+
var l;
|
|
3710
|
+
const a = (l = o.target) == null ? void 0 : l.result;
|
|
3711
|
+
if (typeof a == "string") {
|
|
3712
|
+
const r = new Image();
|
|
3713
|
+
r.onload = () => {
|
|
3714
|
+
var p;
|
|
3715
|
+
const c = {
|
|
3716
|
+
width: r.naturalWidth || 0,
|
|
3717
|
+
height: r.naturalHeight || 0
|
|
3718
|
+
}, h = this.scaleMarkersForNewImage(
|
|
3719
|
+
((p = this.value) == null ? void 0 : p.markers) || [],
|
|
3720
|
+
e,
|
|
3721
|
+
c
|
|
3722
|
+
);
|
|
3723
|
+
this.value = {
|
|
3724
|
+
imageUrl: a,
|
|
3725
|
+
markers: h
|
|
3726
|
+
}, this.lastImageNaturalSize = c, this.history = [
|
|
3727
|
+
JSON.parse(JSON.stringify(h))
|
|
3728
|
+
], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange();
|
|
3729
|
+
}, r.onerror = () => {
|
|
3730
|
+
this.showError("Failed to read image file.");
|
|
3731
|
+
}, r.src = a;
|
|
3732
|
+
}
|
|
3733
|
+
}, n.onerror = () => {
|
|
3634
3734
|
this.showError("Failed to read image file.");
|
|
3635
|
-
},
|
|
3735
|
+
}, n.readAsDataURL(t);
|
|
3636
3736
|
}
|
|
3637
3737
|
handleImageClick(t) {
|
|
3638
3738
|
if (this.draggingMarkerId !== null || !this.value || !this.imageElement) return;
|
|
3639
3739
|
if (this.value.markers.length >= (this.props.maxMarkers || 10)) {
|
|
3640
|
-
this.showError(
|
|
3740
|
+
this.showError(
|
|
3741
|
+
`Maximum of ${this.props.maxMarkers || 10} markers allowed.`
|
|
3742
|
+
);
|
|
3641
3743
|
return;
|
|
3642
3744
|
}
|
|
3643
3745
|
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);
|
|
@@ -3660,7 +3762,8 @@ const Kt = `
|
|
|
3660
3762
|
}
|
|
3661
3763
|
handleMarkerDrag(t) {
|
|
3662
3764
|
var r;
|
|
3663
|
-
if (this.draggingMarkerId === null || !this.imageElement || !this.value)
|
|
3765
|
+
if (this.draggingMarkerId === null || !this.imageElement || !this.value)
|
|
3766
|
+
return;
|
|
3664
3767
|
const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = Math.min(100, Math.max(0, i)), o = Math.min(100, Math.max(0, s)), a = this.value.markers.map(
|
|
3665
3768
|
(c) => c.id === this.draggingMarkerId ? { ...c, x: n, y: o } : c
|
|
3666
3769
|
), l = (r = this.popoverEl) == null ? void 0 : r.querySelector(
|
|
@@ -3717,7 +3820,9 @@ const Kt = `
|
|
|
3717
3820
|
}
|
|
3718
3821
|
saveState() {
|
|
3719
3822
|
if (this.isUndoRedoOperation || !this.value) return;
|
|
3720
|
-
const t = JSON.parse(
|
|
3823
|
+
const t = JSON.parse(
|
|
3824
|
+
JSON.stringify(this.value.markers)
|
|
3825
|
+
);
|
|
3721
3826
|
if (this.historyIndex >= 0 && this.history.length > 0) {
|
|
3722
3827
|
const e = this.history[this.historyIndex];
|
|
3723
3828
|
if (JSON.stringify(e) === JSON.stringify(t))
|
|
@@ -3749,7 +3854,11 @@ const Kt = `
|
|
|
3749
3854
|
}
|
|
3750
3855
|
updateUndoRedoButtons() {
|
|
3751
3856
|
if (!this.popoverEl) return;
|
|
3752
|
-
const t = this.popoverEl.querySelector(
|
|
3857
|
+
const t = this.popoverEl.querySelector(
|
|
3858
|
+
".undo-btn"
|
|
3859
|
+
), e = this.popoverEl.querySelector(
|
|
3860
|
+
".redo-btn"
|
|
3861
|
+
);
|
|
3753
3862
|
t && (t.disabled = !this.canUndo()), e && (e.disabled = !this.canRedo());
|
|
3754
3863
|
}
|
|
3755
3864
|
showError(t) {
|
|
@@ -3805,6 +3914,25 @@ const Kt = `
|
|
|
3805
3914
|
markers: e
|
|
3806
3915
|
};
|
|
3807
3916
|
}
|
|
3917
|
+
scaleMarkersForNewImage(t, e, i) {
|
|
3918
|
+
if (!t.length) return [];
|
|
3919
|
+
const s = e && e.width && e.height && e || i && i.width && i.height && i || null;
|
|
3920
|
+
return t.map((n) => {
|
|
3921
|
+
const o = { ...n };
|
|
3922
|
+
return s && o.x > 100 && (o.x = o.x / s.width * 100), s && o.y > 100 && (o.y = o.y / s.height * 100), o.x = this.clampPercentage(o.x), o.y = this.clampPercentage(o.y), o;
|
|
3923
|
+
});
|
|
3924
|
+
}
|
|
3925
|
+
clampPercentage(t) {
|
|
3926
|
+
return Number.isFinite(t) ? Math.max(0, Math.min(100, t)) : 0;
|
|
3927
|
+
}
|
|
3928
|
+
recordImageNaturalSize() {
|
|
3929
|
+
if (!this.imageElement) return;
|
|
3930
|
+
const { naturalWidth: t, naturalHeight: e } = this.imageElement;
|
|
3931
|
+
t && e && (this.lastImageNaturalSize = {
|
|
3932
|
+
width: t,
|
|
3933
|
+
height: e
|
|
3934
|
+
});
|
|
3935
|
+
}
|
|
3808
3936
|
showConfirmModal(t, e) {
|
|
3809
3937
|
return this.confirmPromise ? this.confirmPromise : (this.confirmPromise = new Promise((i) => {
|
|
3810
3938
|
this.confirmOverlayEl && (this.confirmOverlayEl.remove(), this.confirmOverlayEl = null);
|
|
@@ -3822,11 +3950,11 @@ const Kt = `
|
|
|
3822
3950
|
r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
|
|
3823
3951
|
const c = document.createElement("button");
|
|
3824
3952
|
c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
|
|
3825
|
-
const h = (
|
|
3826
|
-
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(
|
|
3953
|
+
const h = (p) => {
|
|
3954
|
+
s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(p);
|
|
3827
3955
|
};
|
|
3828
|
-
r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (
|
|
3829
|
-
|
|
3956
|
+
r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (p) => {
|
|
3957
|
+
p.target === s && h(!1);
|
|
3830
3958
|
}), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
|
|
3831
3959
|
n.classList.add("visible");
|
|
3832
3960
|
}, 10);
|
|
@@ -3837,7 +3965,7 @@ const Kt = `
|
|
|
3837
3965
|
}
|
|
3838
3966
|
destroy() {
|
|
3839
3967
|
var t, e;
|
|
3840
|
-
this.closePopover(), (t = this.backdropEl) != null && t.parentElement && this.backdropEl.parentElement.removeChild(this.backdropEl), (e = this.popoverEl) != null && e.parentElement && this.popoverEl.parentElement.removeChild(this.popoverEl), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
3968
|
+
this.closePopover(), (t = this.backdropEl) != null && t.parentElement && this.backdropEl.parentElement.removeChild(this.backdropEl), (e = this.popoverEl) != null && e.parentElement && this.popoverEl.parentElement.removeChild(this.popoverEl), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.cleanupMessageListener();
|
|
3841
3969
|
}
|
|
3842
3970
|
};
|
|
3843
3971
|
B.openInstance = null;
|
|
@@ -4179,11 +4307,13 @@ class Ve extends H {
|
|
|
4179
4307
|
}
|
|
4180
4308
|
class Te extends x {
|
|
4181
4309
|
constructor(t) {
|
|
4182
|
-
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), this.popup = null, t.default ? this.value = { ...t.default } : this.value || (this.value = {})
|
|
4183
|
-
const e =
|
|
4184
|
-
t.languages.
|
|
4185
|
-
|
|
4186
|
-
|
|
4310
|
+
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), this.popup = null, t.default ? this.value = { ...t.default } : this.value || (this.value = {});
|
|
4311
|
+
const e = x.HasExplicitCurrentLanguage(), i = e ? x.CurrentLanguage() : "", s = x.DefaultLanguage;
|
|
4312
|
+
this.defaultLanguage = e && i && t.languages.includes(i) ? i : s && t.languages.includes(s) ? s : t.languages[0];
|
|
4313
|
+
const n = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
4314
|
+
t.languages.forEach((o) => {
|
|
4315
|
+
var a, l;
|
|
4316
|
+
o in (this.value || {}) || (this.value || (this.value = {}), o === this.defaultLanguage && n ? this.value[o] = ((a = t.default) == null ? void 0 : a[o]) || n : this.value[o] = ((l = t.default) == null ? void 0 : l[o]) || "");
|
|
4187
4317
|
});
|
|
4188
4318
|
}
|
|
4189
4319
|
capitalizeFirstLetter(t) {
|
|
@@ -4210,12 +4340,12 @@ class Te extends x {
|
|
|
4210
4340
|
return;
|
|
4211
4341
|
}
|
|
4212
4342
|
const c = "...";
|
|
4213
|
-
let h = 0,
|
|
4214
|
-
for (; h <=
|
|
4215
|
-
const m = Math.floor((h +
|
|
4216
|
-
this.measureTextWidth(
|
|
4343
|
+
let h = 0, p = e.length, g = 0;
|
|
4344
|
+
for (; h <= p; ) {
|
|
4345
|
+
const m = Math.floor((h + p) / 2), u = e.slice(0, m).trimEnd() + c;
|
|
4346
|
+
this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : p = m - 1;
|
|
4217
4347
|
}
|
|
4218
|
-
const f = e.slice(0,
|
|
4348
|
+
const f = e.slice(0, g).trimEnd() + c;
|
|
4219
4349
|
t.placeholder = f;
|
|
4220
4350
|
}
|
|
4221
4351
|
autosizeTextarea(t, e = 3) {
|
|
@@ -4283,28 +4413,28 @@ class Te extends x {
|
|
|
4283
4413
|
});
|
|
4284
4414
|
}
|
|
4285
4415
|
renderContent(t) {
|
|
4286
|
-
var
|
|
4416
|
+
var n;
|
|
4287
4417
|
const e = t.querySelector(
|
|
4288
4418
|
".simple-multi-language-content"
|
|
4289
4419
|
);
|
|
4290
4420
|
if (!e) return;
|
|
4291
4421
|
e.innerHTML = "";
|
|
4292
|
-
const i = x.CurrentLanguage();
|
|
4293
|
-
if (!i || !this.props.languages.includes(
|
|
4294
|
-
this.props.languages.forEach((
|
|
4295
|
-
var
|
|
4296
|
-
const
|
|
4297
|
-
e.appendChild(
|
|
4422
|
+
const i = x.HasExplicitCurrentLanguage(), s = x.CurrentLanguage();
|
|
4423
|
+
if (!i || !s || !this.props.languages.includes(s))
|
|
4424
|
+
this.props.languages.forEach((o) => {
|
|
4425
|
+
var r;
|
|
4426
|
+
const a = ((r = this.value) == null ? void 0 : r[o]) || "", l = this.createTextareaRow(o, a);
|
|
4427
|
+
e.appendChild(l);
|
|
4298
4428
|
});
|
|
4299
4429
|
else {
|
|
4300
|
-
const
|
|
4301
|
-
e.appendChild(
|
|
4302
|
-
const
|
|
4430
|
+
const o = ((n = this.value) == null ? void 0 : n[s]) || "", a = this.createTextareaRow(s, o);
|
|
4431
|
+
e.appendChild(a);
|
|
4432
|
+
const l = e.querySelector(
|
|
4303
4433
|
".simple-language-textarea"
|
|
4304
4434
|
);
|
|
4305
|
-
if (
|
|
4306
|
-
const
|
|
4307
|
-
|
|
4435
|
+
if (l) {
|
|
4436
|
+
const r = l.getAttribute("data-full-placeholder") || "";
|
|
4437
|
+
r && this.adaptPlaceholderToSingleLine(l, r);
|
|
4308
4438
|
}
|
|
4309
4439
|
}
|
|
4310
4440
|
}
|
|
@@ -4320,7 +4450,7 @@ class Te extends x {
|
|
|
4320
4450
|
display: flex;
|
|
4321
4451
|
align-items: center;
|
|
4322
4452
|
justify-content: center;
|
|
4323
|
-
z-index:
|
|
4453
|
+
z-index: 1;
|
|
4324
4454
|
`;
|
|
4325
4455
|
const e = document.createElement("div");
|
|
4326
4456
|
e.classList.add("multi-language-popup"), e.style.cssText = `
|
|
@@ -4411,8 +4541,8 @@ class Te extends x {
|
|
|
4411
4541
|
a.preventDefault(), this.showPopup();
|
|
4412
4542
|
}), e.appendChild(i), e.appendChild(s), t.appendChild(e);
|
|
4413
4543
|
const n = document.createElement("div");
|
|
4414
|
-
n.classList.add("simple-multi-language-content"), t.appendChild(n), this.container = t, this.renderContent(t), this.languageChangeUnsubscribe = x.onLanguageChange(() => {
|
|
4415
|
-
this.container && this.renderContent(this.container);
|
|
4544
|
+
n.classList.add("simple-multi-language-content"), t.appendChild(n), this.container = t, this.renderContent(t), this.languageChangeUnsubscribe = x.onLanguageChange((a) => {
|
|
4545
|
+
a && this.props.languages.includes(a) && (this.defaultLanguage = a), this.container && this.renderContent(this.container);
|
|
4416
4546
|
});
|
|
4417
4547
|
const o = () => {
|
|
4418
4548
|
if (!this.container) return;
|
|
@@ -4686,7 +4816,7 @@ class He extends $ {
|
|
|
4686
4816
|
}),
|
|
4687
4817
|
marginLeft: new _({
|
|
4688
4818
|
title: "Left",
|
|
4689
|
-
icon:
|
|
4819
|
+
icon: Ee,
|
|
4690
4820
|
suffix: "px",
|
|
4691
4821
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
4692
4822
|
})
|
|
@@ -4709,7 +4839,7 @@ const fe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
4709
4839
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4710
4840
|
</svg>`, ye = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4711
4841
|
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4712
|
-
</svg>`,
|
|
4842
|
+
</svg>`, Ee = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4713
4843
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4714
4844
|
</svg>`;
|
|
4715
4845
|
class Be extends $ {
|
|
@@ -4725,7 +4855,7 @@ class Be extends $ {
|
|
|
4725
4855
|
opacity: new Ut({
|
|
4726
4856
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4727
4857
|
}),
|
|
4728
|
-
backgroundColor: new
|
|
4858
|
+
backgroundColor: new R({
|
|
4729
4859
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
4730
4860
|
})
|
|
4731
4861
|
}
|
|
@@ -4780,7 +4910,7 @@ export {
|
|
|
4780
4910
|
Oe as BorderSettingSet,
|
|
4781
4911
|
Le as ButtonSetting,
|
|
4782
4912
|
O as ColorSetting,
|
|
4783
|
-
|
|
4913
|
+
R as ColorWithOpacitySetting,
|
|
4784
4914
|
ke as DimensionSetting,
|
|
4785
4915
|
Ie as GapSetting,
|
|
4786
4916
|
j as GradientSetting,
|
|
@@ -4807,7 +4937,7 @@ export {
|
|
|
4807
4937
|
ae as WidthSetting,
|
|
4808
4938
|
we as asSettingGroupWithSettings,
|
|
4809
4939
|
Dt as createSettingGroup,
|
|
4810
|
-
|
|
4940
|
+
be as createTabSettingGroup,
|
|
4811
4941
|
G as isSetting,
|
|
4812
4942
|
ct as isSettingChild,
|
|
4813
4943
|
k as isSettingGroup,
|