builder-settings-types 0.0.305 → 0.0.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/base/settings-group/settingsGroup.d.ts +0 -1
- package/dist/base/settings.d.ts +2 -0
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +59 -72
- package/dist/builder-settings-types.es.js +1127 -948
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/settings/gradient-settings/GradientSetting.d.ts +10 -0
- package/dist/settings/gradient-settings/components/EmbeddedColorPicker.d.ts +24 -28
- package/dist/settings/gradient-settings/utils/icon.d.ts +3 -0
- package/dist/settings/gradient-settings/utils/types.d.ts +1 -0
- package/dist/settings/select-api/select-api.d.ts +0 -1
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const ft = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let rt = (h = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
|
+
for (; h--; )
|
|
5
|
+
t += ft[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function Ct(h) {
|
|
9
|
+
let t = 0, e = h.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function q(
|
|
14
|
+
function q(h, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function Q(
|
|
19
|
-
|
|
18
|
+
function Q(h, t = 0) {
|
|
19
|
+
h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
21
|
q(s, n), Q(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const yt = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class bt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...yt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class vt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = Ct(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class vt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
114
|
+
const st = new bt();
|
|
115
|
+
function Z(h) {
|
|
116
|
+
if (h === null || typeof h != "object") return h;
|
|
117
|
+
if (h instanceof Date) return new Date(h.getTime());
|
|
118
|
+
if (h instanceof Array) return h.map((t) => Z(t));
|
|
119
|
+
if (typeof h == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in h)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(h, e) && (t[e] = Z(h[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return h;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function Et(h) {
|
|
128
|
+
switch (h) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,15 +142,18 @@ function Ct(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
const A = class A {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || rt(), 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, A.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, A.DefaultLanguage = t;
|
|
154
|
+
}
|
|
155
|
+
static SetGlobalVariables(t) {
|
|
156
|
+
A.GlobalVariables = { ...A.GlobalVariables, ...t };
|
|
154
157
|
}
|
|
155
158
|
destroy() {
|
|
156
159
|
throw new Error("Method not implemented.");
|
|
@@ -171,8 +174,8 @@ class w {
|
|
|
171
174
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
172
175
|
}
|
|
173
176
|
clone() {
|
|
174
|
-
const t = this.constructor, e =
|
|
175
|
-
return i.value =
|
|
177
|
+
const t = this.constructor, e = Z(this.props), i = new t(e);
|
|
178
|
+
return i.value = Z(this.value), i;
|
|
176
179
|
}
|
|
177
180
|
createInput(t) {
|
|
178
181
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -192,7 +195,7 @@ class w {
|
|
|
192
195
|
const i = document.createElement("div");
|
|
193
196
|
i.className = t.wrapperClassName || "";
|
|
194
197
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
198
|
+
this.inputEl = s, s.value = String(t.value || Et(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
199
|
const n = (a) => {
|
|
197
200
|
const l = a.target;
|
|
198
201
|
let r = l.value;
|
|
@@ -232,32 +235,43 @@ class w {
|
|
|
232
235
|
const i = document.createElement("span");
|
|
233
236
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
237
|
}
|
|
238
|
+
};
|
|
239
|
+
A.GlobalVariables = {
|
|
240
|
+
// Global Colors (each supports solid OR gradient)
|
|
241
|
+
primary: "#00141E",
|
|
242
|
+
secondary: "#00141E",
|
|
243
|
+
tertiary: "#00141E",
|
|
244
|
+
accent: "#00141E",
|
|
245
|
+
// Text Color
|
|
246
|
+
"text-dark": "#00141E",
|
|
247
|
+
"text-light": "#00141E"
|
|
248
|
+
};
|
|
249
|
+
let x = A;
|
|
250
|
+
function D(h) {
|
|
251
|
+
return h instanceof x;
|
|
235
252
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
238
|
-
}
|
|
239
|
-
function b(c) {
|
|
240
|
-
return c instanceof V;
|
|
253
|
+
function M(h) {
|
|
254
|
+
return h instanceof H;
|
|
241
255
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
256
|
+
function nt(h) {
|
|
257
|
+
return D(h) || M(h);
|
|
244
258
|
}
|
|
245
|
-
function
|
|
246
|
-
for (const e in
|
|
247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
248
|
-
const i =
|
|
259
|
+
function z(h, t) {
|
|
260
|
+
for (const e in h)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(h, e)) {
|
|
262
|
+
const i = h[e];
|
|
249
263
|
t(e, i);
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
266
|
const K = class K {
|
|
253
267
|
constructor(t) {
|
|
254
268
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
|
|
255
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id ||
|
|
269
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || rt(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
256
270
|
}
|
|
257
271
|
propagateNestingLevel() {
|
|
258
272
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
z(this.settings, (e, i) => {
|
|
274
|
+
M(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
275
|
});
|
|
262
276
|
}
|
|
263
277
|
getNestingLevel() {
|
|
@@ -273,9 +287,9 @@ const K = class K {
|
|
|
273
287
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
288
|
}
|
|
275
289
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
290
|
+
z(this.settings, (t, e) => {
|
|
277
291
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
292
|
+
(M(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
293
|
});
|
|
280
294
|
}
|
|
281
295
|
updateNestingStyles() {
|
|
@@ -284,7 +298,7 @@ const K = class K {
|
|
|
284
298
|
forceChildUIRefresh() {
|
|
285
299
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
300
|
try {
|
|
287
|
-
if (
|
|
301
|
+
if (M(e)) {
|
|
288
302
|
const i = e.getValues();
|
|
289
303
|
e.setValue(i);
|
|
290
304
|
} else if (typeof e.setValue == "function") {
|
|
@@ -308,22 +322,14 @@ const K = class K {
|
|
|
308
322
|
);
|
|
309
323
|
if (n) {
|
|
310
324
|
const o = Array.from(
|
|
311
|
-
n.querySelectorAll(
|
|
312
|
-
".setting-group, .setting, [data-setting-id]"
|
|
313
|
-
)
|
|
325
|
+
n.querySelectorAll(".setting-group, .setting")
|
|
314
326
|
);
|
|
315
327
|
for (const a of o) {
|
|
316
|
-
const l = a.id
|
|
317
|
-
"data-setting-id"
|
|
318
|
-
);
|
|
328
|
+
const l = a.id;
|
|
319
329
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
320
330
|
a.remove();
|
|
321
331
|
break;
|
|
322
332
|
}
|
|
323
|
-
if (r && "id" in e && typeof e.id == "string" && r === e.id) {
|
|
324
|
-
a.remove();
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
333
|
}
|
|
328
334
|
}
|
|
329
335
|
}
|
|
@@ -334,34 +340,9 @@ const K = class K {
|
|
|
334
340
|
updateVisibility() {
|
|
335
341
|
this.elementRef;
|
|
336
342
|
}
|
|
337
|
-
updateSettings(t) {
|
|
338
|
-
var o;
|
|
339
|
-
const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
|
|
340
|
-
i.forEach((a) => {
|
|
341
|
-
const l = this.settings[a];
|
|
342
|
-
l && (b(l) ? s[a] = l.getValues() : O(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
|
|
343
|
-
}), e.forEach((a) => {
|
|
344
|
-
i.includes(a) || this.removeSetting(a);
|
|
345
|
-
}), i.forEach((a) => {
|
|
346
|
-
var h;
|
|
347
|
-
const l = t[a], r = this.settings[a];
|
|
348
|
-
if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
|
|
349
|
-
const p = s[a];
|
|
350
|
-
try {
|
|
351
|
-
b(l) ? l.setValue(
|
|
352
|
-
p
|
|
353
|
-
) : O(l) ? (h = l.setValue) == null || h.call(l, p) : l.setValue && l.setValue(p);
|
|
354
|
-
} catch (d) {
|
|
355
|
-
console.warn(`Could not preserve value for setting ${a}:`, d);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
359
|
-
const n = this.getValues();
|
|
360
|
-
this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
|
|
361
|
-
}
|
|
362
343
|
clone() {
|
|
363
344
|
const t = {};
|
|
364
|
-
|
|
345
|
+
z(this.settings, (s, n) => {
|
|
365
346
|
const o = String(s);
|
|
366
347
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
367
348
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -378,7 +359,7 @@ const K = class K {
|
|
|
378
359
|
deleteItem: this.deleteItemCfg,
|
|
379
360
|
dataProps: this.dataProps,
|
|
380
361
|
hide: this.hide
|
|
381
|
-
}, i =
|
|
362
|
+
}, i = xt(e);
|
|
382
363
|
return i.initialValues = this.getValues(), i;
|
|
383
364
|
}
|
|
384
365
|
resetDefault() {
|
|
@@ -388,7 +369,7 @@ const K = class K {
|
|
|
388
369
|
setMobileValues(t) {
|
|
389
370
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
390
371
|
const s = this.settings[e];
|
|
391
|
-
s && (
|
|
372
|
+
s && (M(s) || D(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
392
373
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
393
374
|
}
|
|
394
375
|
getMobileValues(t) {
|
|
@@ -397,7 +378,7 @@ const K = class K {
|
|
|
397
378
|
for (const i in this.settings)
|
|
398
379
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
399
380
|
const s = this.settings[i];
|
|
400
|
-
if (
|
|
381
|
+
if (M(s))
|
|
401
382
|
e[i] = s.getMobileValues();
|
|
402
383
|
else {
|
|
403
384
|
const n = s;
|
|
@@ -408,7 +389,7 @@ const K = class K {
|
|
|
408
389
|
} else {
|
|
409
390
|
const e = this.settings[t];
|
|
410
391
|
if (!e) return;
|
|
411
|
-
if (
|
|
392
|
+
if (M(e)) return e.getMobileValues();
|
|
412
393
|
const i = e;
|
|
413
394
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
414
395
|
}
|
|
@@ -424,14 +405,14 @@ const K = class K {
|
|
|
424
405
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
425
406
|
}, 50));
|
|
426
407
|
};
|
|
427
|
-
return this.changeHandlers.clear(),
|
|
408
|
+
return this.changeHandlers.clear(), z(this.settings, (i, s) => {
|
|
428
409
|
var n;
|
|
429
|
-
if (
|
|
410
|
+
if (M(s))
|
|
430
411
|
s.setOnChange(() => {
|
|
431
412
|
const o = this.getValues();
|
|
432
413
|
this.initialValues = o, t(o);
|
|
433
414
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
434
|
-
else if (
|
|
415
|
+
else if (D(s)) {
|
|
435
416
|
const o = () => e();
|
|
436
417
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
437
418
|
} else {
|
|
@@ -454,10 +435,10 @@ const K = class K {
|
|
|
454
435
|
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
455
436
|
if (Number.isFinite(a)) {
|
|
456
437
|
const l = this.addItemCfg.createItem(a);
|
|
457
|
-
|
|
438
|
+
nt(l) && (this.addSetting(i, l), n = l);
|
|
458
439
|
}
|
|
459
440
|
}
|
|
460
|
-
n && (
|
|
441
|
+
n && (M(n) || D(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
461
442
|
}), setTimeout(() => {
|
|
462
443
|
this.forceChildUIRefresh();
|
|
463
444
|
}, 0);
|
|
@@ -471,7 +452,7 @@ const K = class K {
|
|
|
471
452
|
const s = this.getValues();
|
|
472
453
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
473
454
|
};
|
|
474
|
-
|
|
455
|
+
M(t) ? t.setOnChange(() => e()) : D(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
475
456
|
}
|
|
476
457
|
addSetting(t, e) {
|
|
477
458
|
var s, n;
|
|
@@ -480,16 +461,16 @@ const K = class K {
|
|
|
480
461
|
".setting-group-content"
|
|
481
462
|
);
|
|
482
463
|
if (o) {
|
|
483
|
-
|
|
464
|
+
M(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
484
465
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
485
466
|
if (l) {
|
|
486
|
-
const
|
|
487
|
-
|
|
467
|
+
const c = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
468
|
+
c && t.startsWith(c) && this.addDeleteButtonToElement(a, t);
|
|
488
469
|
}
|
|
489
470
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
490
|
-
r ? o.insertBefore(a, r) : o.appendChild(a),
|
|
491
|
-
const
|
|
492
|
-
a.style.display = "none", a.offsetHeight, a.style.display =
|
|
471
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), st.trackElement(a), q(a, this.nestingLevel + 1), Q(a, this.nestingLevel + 1);
|
|
472
|
+
const p = a.style.display;
|
|
473
|
+
a.style.display = "none", a.offsetHeight, a.style.display = p, this.updateNestingStyles();
|
|
493
474
|
}
|
|
494
475
|
}
|
|
495
476
|
const i = this.getValues();
|
|
@@ -506,9 +487,9 @@ const K = class K {
|
|
|
506
487
|
const r = Array.from(
|
|
507
488
|
t.querySelectorAll(".setting-group-title")
|
|
508
489
|
);
|
|
509
|
-
for (const
|
|
510
|
-
if (
|
|
511
|
-
s =
|
|
490
|
+
for (const p of r)
|
|
491
|
+
if (p.closest(".setting-group") === t) {
|
|
492
|
+
s = p;
|
|
512
493
|
break;
|
|
513
494
|
}
|
|
514
495
|
s || (s = r[0] ?? null);
|
|
@@ -541,8 +522,8 @@ const K = class K {
|
|
|
541
522
|
}), o.addEventListener("mouseleave", () => {
|
|
542
523
|
o.style.backgroundColor = "transparent";
|
|
543
524
|
}), o.addEventListener("click", (r) => {
|
|
544
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
545
|
-
|
|
525
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((p) => {
|
|
526
|
+
p && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
546
527
|
});
|
|
547
528
|
});
|
|
548
529
|
const l = n.querySelector(".setting-group-arrow");
|
|
@@ -636,13 +617,13 @@ const K = class K {
|
|
|
636
617
|
r(), t(!1);
|
|
637
618
|
}), l.addEventListener("click", () => {
|
|
638
619
|
r(), t(!0);
|
|
639
|
-
}), e.addEventListener("click", (
|
|
640
|
-
|
|
620
|
+
}), e.addEventListener("click", (c) => {
|
|
621
|
+
c.target === e && (r(), t(!1));
|
|
641
622
|
});
|
|
642
|
-
const
|
|
643
|
-
|
|
623
|
+
const p = (c) => {
|
|
624
|
+
c.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", p));
|
|
644
625
|
};
|
|
645
|
-
document.addEventListener("keydown",
|
|
626
|
+
document.addEventListener("keydown", p), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
646
627
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
647
628
|
}), setTimeout(() => l.focus(), 100);
|
|
648
629
|
});
|
|
@@ -670,7 +651,7 @@ const K = class K {
|
|
|
670
651
|
for (const i in this.settings)
|
|
671
652
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
672
653
|
const s = this.settings[i];
|
|
673
|
-
if (
|
|
654
|
+
if (M(s))
|
|
674
655
|
e[i] = s.getValues();
|
|
675
656
|
else {
|
|
676
657
|
const n = s;
|
|
@@ -681,7 +662,7 @@ const K = class K {
|
|
|
681
662
|
} else {
|
|
682
663
|
const e = this.settings[t];
|
|
683
664
|
if (!e) return;
|
|
684
|
-
if (
|
|
665
|
+
if (M(e)) return e.getValues();
|
|
685
666
|
const i = e;
|
|
686
667
|
return i.getValue ? i.getValue() : i.value;
|
|
687
668
|
}
|
|
@@ -694,7 +675,7 @@ const K = class K {
|
|
|
694
675
|
for (const s in this.settings)
|
|
695
676
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
696
677
|
const n = this.settings[s];
|
|
697
|
-
if (
|
|
678
|
+
if (M(n)) {
|
|
698
679
|
const o = n.getValuesForJson();
|
|
699
680
|
o !== null && (i[s] = o);
|
|
700
681
|
} else {
|
|
@@ -706,7 +687,7 @@ const K = class K {
|
|
|
706
687
|
} else {
|
|
707
688
|
const i = this.settings[t];
|
|
708
689
|
if (!i) return;
|
|
709
|
-
if (
|
|
690
|
+
if (M(i))
|
|
710
691
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
711
692
|
{
|
|
712
693
|
const s = i;
|
|
@@ -720,7 +701,7 @@ const K = class K {
|
|
|
720
701
|
for (const i in this.settings)
|
|
721
702
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
722
703
|
const s = this.settings[i];
|
|
723
|
-
if (
|
|
704
|
+
if (M(s))
|
|
724
705
|
e[i] = s.getDefaultValues();
|
|
725
706
|
else {
|
|
726
707
|
const n = s;
|
|
@@ -731,7 +712,7 @@ const K = class K {
|
|
|
731
712
|
} else {
|
|
732
713
|
const e = this.settings[t];
|
|
733
714
|
if (!e) return;
|
|
734
|
-
if (
|
|
715
|
+
if (M(e)) return e.getDefaultValues();
|
|
735
716
|
const i = e;
|
|
736
717
|
return i.default !== void 0 ? i.default : i.value;
|
|
737
718
|
}
|
|
@@ -764,43 +745,43 @@ const K = class K {
|
|
|
764
745
|
(!this.isCollapsed).toString()
|
|
765
746
|
);
|
|
766
747
|
};
|
|
767
|
-
if (e.onclick = l, e.onkeydown = (
|
|
768
|
-
(
|
|
748
|
+
if (e.onclick = l, e.onkeydown = (p) => {
|
|
749
|
+
(p.key === "Enter" || p.key === " ") && (p.preventDefault(), l());
|
|
769
750
|
}, Object.keys(this.settings).length > 0) {
|
|
770
|
-
for (const
|
|
771
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
const d =
|
|
775
|
-
|
|
751
|
+
for (const p in this.settings)
|
|
752
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, p)) {
|
|
753
|
+
const c = this.settings[p];
|
|
754
|
+
M(c) && typeof c.setNestingLevel == "function" && c.setNestingLevel(this.nestingLevel + 1);
|
|
755
|
+
const d = c.draw();
|
|
756
|
+
M(c) && c.deleteItemCfg && this.addDeleteButtonToElement(
|
|
776
757
|
d,
|
|
777
|
-
|
|
778
|
-
|
|
758
|
+
p,
|
|
759
|
+
c
|
|
779
760
|
), a.appendChild(d);
|
|
780
761
|
}
|
|
781
762
|
} else {
|
|
782
|
-
const
|
|
783
|
-
|
|
763
|
+
const p = document.createElement("div");
|
|
764
|
+
p.className = "setting-group-empty", p.textContent = "No settings in this group", a.appendChild(p);
|
|
784
765
|
}
|
|
785
766
|
if (this.addItemCfg) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
const
|
|
767
|
+
const p = document.createElement("button");
|
|
768
|
+
p.type = "button", p.className = "sg-add-button-bottom", p.style.marginTop = "8px";
|
|
769
|
+
const c = `
|
|
789
770
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
790
771
|
xmlns="http://www.w3.org/2000/svg">
|
|
791
772
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
792
773
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
793
774
|
</svg>`;
|
|
794
|
-
|
|
775
|
+
p.innerHTML = `${c}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, p.addEventListener("click", (d) => {
|
|
795
776
|
d.stopPropagation(), d.preventDefault();
|
|
796
|
-
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),
|
|
797
|
-
if (
|
|
798
|
-
const
|
|
799
|
-
this.addSetting(
|
|
777
|
+
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
778
|
+
if (nt(g)) {
|
|
779
|
+
const v = `${this.addItemCfg.keyPrefix}${u}`;
|
|
780
|
+
this.addSetting(v, g);
|
|
800
781
|
}
|
|
801
|
-
}), a.appendChild(
|
|
782
|
+
}), a.appendChild(p);
|
|
802
783
|
}
|
|
803
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t,
|
|
784
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, st.trackElement(t), setTimeout(() => {
|
|
804
785
|
this.updateNestingStyles();
|
|
805
786
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
806
787
|
}
|
|
@@ -843,11 +824,11 @@ const K = class K {
|
|
|
843
824
|
}
|
|
844
825
|
};
|
|
845
826
|
K.hiddenElements = /* @__PURE__ */ new Set();
|
|
846
|
-
let
|
|
847
|
-
function
|
|
848
|
-
return new
|
|
827
|
+
let H = K;
|
|
828
|
+
function ce(h) {
|
|
829
|
+
return new wt(h);
|
|
849
830
|
}
|
|
850
|
-
class
|
|
831
|
+
class wt extends H {
|
|
851
832
|
constructor(t) {
|
|
852
833
|
super(t);
|
|
853
834
|
const e = Object.keys(this.settings)[0];
|
|
@@ -885,12 +866,12 @@ class yt extends V {
|
|
|
885
866
|
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
886
867
|
const r = document.createElement("button");
|
|
887
868
|
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
)), o.appendChild(
|
|
869
|
+
const p = document.createElement("div");
|
|
870
|
+
p.className = "tab-panel", this.contentContainers[a] = p;
|
|
871
|
+
const c = this.settings[a];
|
|
872
|
+
c && (M(c) && typeof c.setNestingLevel == "function" && c.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
|
|
873
|
+
c.draw()
|
|
874
|
+
)), o.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
894
875
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
895
876
|
const a = Object.keys(this.settings)[0];
|
|
896
877
|
this.activeTabId = a || "";
|
|
@@ -898,13 +879,13 @@ class yt extends V {
|
|
|
898
879
|
return this.updateTabUI(), t;
|
|
899
880
|
}
|
|
900
881
|
}
|
|
901
|
-
function
|
|
902
|
-
return new
|
|
882
|
+
function xt(h) {
|
|
883
|
+
return new H(h);
|
|
903
884
|
}
|
|
904
|
-
function
|
|
905
|
-
return
|
|
885
|
+
function he(h) {
|
|
886
|
+
return h;
|
|
906
887
|
}
|
|
907
|
-
class
|
|
888
|
+
class Lt extends x {
|
|
908
889
|
constructor(t = {}) {
|
|
909
890
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
910
891
|
}
|
|
@@ -924,29 +905,29 @@ class bt extends w {
|
|
|
924
905
|
});
|
|
925
906
|
}
|
|
926
907
|
}
|
|
927
|
-
const
|
|
928
|
-
class
|
|
908
|
+
const kt = "<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>";
|
|
909
|
+
class N extends Lt {
|
|
929
910
|
constructor(t) {
|
|
930
911
|
super({
|
|
931
912
|
...t,
|
|
932
|
-
icon: t.icon ||
|
|
913
|
+
icon: t.icon || kt,
|
|
933
914
|
title: t.title || "Color",
|
|
934
|
-
default: t.default ?
|
|
915
|
+
default: t.default ? N.normalizeColorValue(t.default) : "#000000"
|
|
935
916
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
936
917
|
}
|
|
937
918
|
static normalizeColorValue(t) {
|
|
938
|
-
return t.startsWith("#") ?
|
|
919
|
+
return t.startsWith("var(--") ? t : t.startsWith("#") ? N.normalizeHexValue(t) : t.includes(",") ? N.rgbToHexStatic(t) : N.normalizeHexValue(t);
|
|
939
920
|
}
|
|
940
921
|
static normalizeHexValue(t) {
|
|
941
922
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
942
923
|
}
|
|
943
924
|
static rgbToHexStatic(t) {
|
|
944
|
-
const e = t.split(",").map((
|
|
925
|
+
const e = t.split(",").map((p) => parseInt(p.trim()));
|
|
945
926
|
if (e.length !== 3 || e.some(isNaN))
|
|
946
927
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
947
|
-
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (
|
|
948
|
-
const
|
|
949
|
-
return
|
|
928
|
+
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (p) => {
|
|
929
|
+
const c = p.toString(16);
|
|
930
|
+
return c.length === 1 ? "0" + c : c;
|
|
950
931
|
};
|
|
951
932
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
952
933
|
}
|
|
@@ -956,7 +937,7 @@ class M extends bt {
|
|
|
956
937
|
return;
|
|
957
938
|
}
|
|
958
939
|
if (typeof t == "string") {
|
|
959
|
-
const e =
|
|
940
|
+
const e = N.normalizeColorValue(t);
|
|
960
941
|
this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
|
|
961
942
|
} else
|
|
962
943
|
this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
|
|
@@ -969,55 +950,103 @@ class M extends bt {
|
|
|
969
950
|
draw() {
|
|
970
951
|
const t = document.createElement("div");
|
|
971
952
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
972
|
-
const
|
|
973
|
-
if (
|
|
974
|
-
const
|
|
975
|
-
|
|
953
|
+
const g = document.createElement("div");
|
|
954
|
+
if (g.className = "icon-container", this.props.icon) {
|
|
955
|
+
const v = document.createElement("span");
|
|
956
|
+
v.className = "input-icon", v.innerHTML = this.props.icon, g.appendChild(v);
|
|
976
957
|
}
|
|
977
958
|
if (this.props.title) {
|
|
978
|
-
const
|
|
979
|
-
|
|
959
|
+
const v = document.createElement("span");
|
|
960
|
+
v.className = "input-label", v.textContent = this.props.title, g.appendChild(v);
|
|
980
961
|
}
|
|
981
|
-
t.appendChild(
|
|
962
|
+
t.appendChild(g);
|
|
982
963
|
}
|
|
983
964
|
const e = document.createElement("div");
|
|
984
965
|
e.className = "color-input-wrapper";
|
|
985
|
-
const i = (
|
|
986
|
-
|
|
987
|
-
|
|
966
|
+
const i = document.createElement("div");
|
|
967
|
+
i.className = "color-setting-tabs", i.style.display = "flex", i.style.marginBottom = "8px", i.style.gap = "4px";
|
|
968
|
+
const s = document.createElement("button");
|
|
969
|
+
s.className = "color-tab active", s.textContent = "Solid";
|
|
970
|
+
const n = document.createElement("button");
|
|
971
|
+
n.className = "color-tab", n.textContent = "Global", i.appendChild(s), i.appendChild(n);
|
|
972
|
+
const o = document.createElement("div");
|
|
973
|
+
o.className = "color-content-solid";
|
|
974
|
+
const a = document.createElement("div");
|
|
975
|
+
a.className = "color-content-global", a.style.display = "none", a.style.display = "grid", a.style.gridTemplateColumns = "repeat(auto-fill, minmax(30px, 1fr))", a.style.gap = "8px";
|
|
976
|
+
const l = () => {
|
|
977
|
+
try {
|
|
978
|
+
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !x) {
|
|
979
|
+
console.error("ColorSetting: Setting class is undefined");
|
|
980
|
+
const v = document.createElement("div");
|
|
981
|
+
v.textContent = "Error: System error (Setting undefined)", a.appendChild(v);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const g = x.GlobalVariables || {};
|
|
985
|
+
if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
|
|
986
|
+
const v = document.createElement("div");
|
|
987
|
+
v.textContent = "No global colors defined", v.style.gridColumn = "1 / -1", v.style.fontSize = "12px", v.style.color = "#666", a.appendChild(v);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
Object.entries(g).forEach(([v, m]) => {
|
|
991
|
+
const f = document.createElement("button");
|
|
992
|
+
f.className = "global-color-btn", f.title = v, f.style.width = "30px", f.style.height = "30px", f.style.borderRadius = "50%", f.style.border = "1px solid #ddd", f.style.backgroundColor = m, f.style.cursor = "pointer", this.value === `var(--${v})` && (f.style.border = "2px solid #2196f3"), f.addEventListener("click", (C) => {
|
|
993
|
+
var E, k;
|
|
994
|
+
C.preventDefault();
|
|
995
|
+
const w = `var(--${v})`;
|
|
996
|
+
this.value = w, (E = this.onChange) == null || E.call(this, w), (k = this.detectChange) == null || k.call(this, w), Array.from(a.children).forEach((y) => {
|
|
997
|
+
y.style.border = "1px solid #ddd";
|
|
998
|
+
}), f.style.border = "2px solid #2196f3", c.style.backgroundColor = m;
|
|
999
|
+
}), a.appendChild(f);
|
|
1000
|
+
});
|
|
1001
|
+
} catch (g) {
|
|
1002
|
+
console.error("ColorSetting: Error in renderGlobalOptions", g), a.innerHTML = "Error loading global options";
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
l(), s.addEventListener("click", (g) => {
|
|
1006
|
+
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1007
|
+
}), n.addEventListener("click", (g) => {
|
|
1008
|
+
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
1009
|
+
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1010
|
+
const r = (g) => {
|
|
1011
|
+
const v = g.value.trim();
|
|
1012
|
+
if (!v)
|
|
988
1013
|
return e.classList.remove("error"), !0;
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
-
},
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1014
|
+
const f = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(v);
|
|
1015
|
+
return f ? e.classList.remove("error") : e.classList.add("error"), f;
|
|
1016
|
+
}, p = document.createElement("input");
|
|
1017
|
+
p.type = "color", p.className = "color-picker", p.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", p.setAttribute("aria-label", "Choose color"), p.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && p.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = p;
|
|
1018
|
+
const c = document.createElement("div");
|
|
1019
|
+
c.className = "color-preview";
|
|
1020
|
+
let d = this.value || "#000000";
|
|
1021
|
+
if (d.startsWith("var(--")) {
|
|
1022
|
+
const g = d.replace("var(--", "").replace(")", "");
|
|
1023
|
+
d = (x.GlobalVariables || {})[g] || "#000000";
|
|
1024
|
+
}
|
|
1025
|
+
c.style.backgroundColor = d;
|
|
1026
|
+
const u = document.createElement("input");
|
|
1027
|
+
return u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u, this.textInputEl.addEventListener("input", (g) => {
|
|
1028
|
+
var m, f;
|
|
1029
|
+
let v = g.target.value.trim();
|
|
1030
|
+
if (this.textInputEl && r(this.textInputEl)) {
|
|
1031
|
+
const C = N.normalizeColorValue(v);
|
|
1032
|
+
this.value = C, (m = this.onChange) == null || m.call(this, C), (f = this.detectChange) == null || f.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), c.style.backgroundColor = C;
|
|
1004
1033
|
}
|
|
1005
|
-
}), this.colorInputEl.addEventListener("input", (
|
|
1006
|
-
var
|
|
1007
|
-
const
|
|
1008
|
-
this.value =
|
|
1009
|
-
}), this.colorInputEl.addEventListener("change", (
|
|
1010
|
-
var
|
|
1011
|
-
const
|
|
1012
|
-
this.value =
|
|
1013
|
-
}), e.appendChild(
|
|
1034
|
+
}), this.colorInputEl.addEventListener("input", (g) => {
|
|
1035
|
+
var f, C;
|
|
1036
|
+
const v = g.target.value, m = N.normalizeColorValue(v);
|
|
1037
|
+
this.value = m, (f = this.onChange) == null || f.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m, e.classList.remove("error");
|
|
1038
|
+
}), this.colorInputEl.addEventListener("change", (g) => {
|
|
1039
|
+
var f, C;
|
|
1040
|
+
const v = g.target.value, m = N.normalizeColorValue(v);
|
|
1041
|
+
this.value = m, (f = this.onChange) == null || f.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m;
|
|
1042
|
+
}), o.appendChild(p), o.appendChild(c), o.appendChild(u), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
1014
1043
|
}
|
|
1015
1044
|
getElement() {
|
|
1016
1045
|
return this.element;
|
|
1017
1046
|
}
|
|
1018
1047
|
// Helper method to get normalized hex value
|
|
1019
1048
|
getNormalizedValue() {
|
|
1020
|
-
return this.value ?
|
|
1049
|
+
return this.value ? N.normalizeColorValue(this.value) : "#000000";
|
|
1021
1050
|
}
|
|
1022
1051
|
// Helper method to check if current value is valid hex
|
|
1023
1052
|
isValidHex() {
|
|
@@ -1028,17 +1057,17 @@ class M extends bt {
|
|
|
1028
1057
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1029
1058
|
}
|
|
1030
1059
|
}
|
|
1031
|
-
const
|
|
1060
|
+
const Mt = `
|
|
1032
1061
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1033
1062
|
<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"/>
|
|
1034
1063
|
<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"/>
|
|
1035
1064
|
<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"/>
|
|
1036
1065
|
</svg>`;
|
|
1037
|
-
class R extends
|
|
1066
|
+
class R extends x {
|
|
1038
1067
|
constructor(t = {}) {
|
|
1039
1068
|
super({
|
|
1040
1069
|
...t,
|
|
1041
|
-
icon: t.icon ||
|
|
1070
|
+
icon: t.icon || Mt,
|
|
1042
1071
|
title: t.title || "Color & Opacity",
|
|
1043
1072
|
default: t.default || "#000000FF"
|
|
1044
1073
|
}), 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));
|
|
@@ -1156,7 +1185,7 @@ class R extends w {
|
|
|
1156
1185
|
};
|
|
1157
1186
|
}
|
|
1158
1187
|
}
|
|
1159
|
-
class
|
|
1188
|
+
class de extends x {
|
|
1160
1189
|
constructor(t = {}) {
|
|
1161
1190
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1162
1191
|
}
|
|
@@ -1188,7 +1217,7 @@ class le extends w {
|
|
|
1188
1217
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1189
1218
|
}
|
|
1190
1219
|
}
|
|
1191
|
-
class
|
|
1220
|
+
class V extends x {
|
|
1192
1221
|
constructor(t) {
|
|
1193
1222
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1194
1223
|
}
|
|
@@ -1247,12 +1276,12 @@ class S extends w {
|
|
|
1247
1276
|
);
|
|
1248
1277
|
}
|
|
1249
1278
|
}
|
|
1250
|
-
const
|
|
1279
|
+
const St = `
|
|
1251
1280
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1252
1281
|
<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="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1253
1282
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1254
1283
|
</svg>`;
|
|
1255
|
-
class
|
|
1284
|
+
class Nt extends V {
|
|
1256
1285
|
constructor(t = {}) {
|
|
1257
1286
|
const e = {
|
|
1258
1287
|
title: "Opacity",
|
|
@@ -1261,7 +1290,7 @@ class kt extends S {
|
|
|
1261
1290
|
maxValue: 100,
|
|
1262
1291
|
step: 1,
|
|
1263
1292
|
default: t.default ?? 100,
|
|
1264
|
-
icon:
|
|
1293
|
+
icon: St,
|
|
1265
1294
|
...t
|
|
1266
1295
|
};
|
|
1267
1296
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1273,12 +1302,12 @@ class kt extends S {
|
|
|
1273
1302
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1274
1303
|
}
|
|
1275
1304
|
}
|
|
1276
|
-
const
|
|
1305
|
+
const It = `
|
|
1277
1306
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1278
1307
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1279
1308
|
</svg>
|
|
1280
1309
|
`;
|
|
1281
|
-
class tt extends
|
|
1310
|
+
class tt extends x {
|
|
1282
1311
|
constructor(t = {}) {
|
|
1283
1312
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1284
1313
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1322,7 +1351,7 @@ class tt extends w {
|
|
|
1322
1351
|
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1323
1352
|
}), document.body.appendChild(i);
|
|
1324
1353
|
const s = document.createElement("div");
|
|
1325
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1354
|
+
return s.classList.add("svg-container"), s.innerHTML = It, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1326
1355
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1327
1356
|
}).catch((n) => {
|
|
1328
1357
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1385,7 +1414,7 @@ class tt extends w {
|
|
|
1385
1414
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1386
1415
|
}
|
|
1387
1416
|
}
|
|
1388
|
-
class
|
|
1417
|
+
class Vt extends x {
|
|
1389
1418
|
constructor(t = {}) {
|
|
1390
1419
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1391
1420
|
}
|
|
@@ -1441,7 +1470,7 @@ class St extends w {
|
|
|
1441
1470
|
}), t.appendChild(i), t;
|
|
1442
1471
|
}
|
|
1443
1472
|
}
|
|
1444
|
-
class
|
|
1473
|
+
class pe extends x {
|
|
1445
1474
|
constructor(t) {
|
|
1446
1475
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1447
1476
|
}
|
|
@@ -1455,8 +1484,8 @@ class re extends w {
|
|
|
1455
1484
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1456
1485
|
);
|
|
1457
1486
|
if (n) {
|
|
1458
|
-
let a = +n[1], l = +n[2], r = +n[3],
|
|
1459
|
-
|
|
1487
|
+
let a = +n[1], l = +n[2], r = +n[3], p = +n[4];
|
|
1488
|
+
p >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : p = Math.min(1, p + 0.12), s = `rgba(${a},${l},${r},${p})`;
|
|
1460
1489
|
}
|
|
1461
1490
|
t.addEventListener("mouseenter", () => {
|
|
1462
1491
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
@@ -1470,27 +1499,27 @@ class re extends w {
|
|
|
1470
1499
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1471
1500
|
}
|
|
1472
1501
|
}
|
|
1473
|
-
class
|
|
1502
|
+
class ue extends x {
|
|
1474
1503
|
constructor(t = {}) {
|
|
1475
1504
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1476
1505
|
const e = t.width || 0, i = t.height || 0;
|
|
1477
1506
|
this.value || (this.value = {
|
|
1478
1507
|
width: e,
|
|
1479
1508
|
height: i
|
|
1480
|
-
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
1509
|
+
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new V({
|
|
1481
1510
|
title: "Width",
|
|
1482
1511
|
default: this.value.width,
|
|
1483
1512
|
suffix: "px",
|
|
1484
1513
|
minValue: this.minWidth,
|
|
1485
1514
|
maxValue: this.maxWidth,
|
|
1486
|
-
icon:
|
|
1487
|
-
}), this.heightSetting = new
|
|
1515
|
+
icon: Tt
|
|
1516
|
+
}), this.heightSetting = new V({
|
|
1488
1517
|
title: "Height",
|
|
1489
1518
|
default: this.value.height,
|
|
1490
1519
|
suffix: "px",
|
|
1491
1520
|
minValue: this.minHeight,
|
|
1492
1521
|
maxValue: this.maxHeight,
|
|
1493
|
-
icon:
|
|
1522
|
+
icon: Pt
|
|
1494
1523
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1495
1524
|
}
|
|
1496
1525
|
handleWidthChange(t) {
|
|
@@ -1584,24 +1613,24 @@ class ce extends w {
|
|
|
1584
1613
|
}
|
|
1585
1614
|
}
|
|
1586
1615
|
}
|
|
1587
|
-
const
|
|
1616
|
+
const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1588
1617
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1589
|
-
</svg>`,
|
|
1618
|
+
</svg>`, Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1590
1619
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1591
1620
|
</svg>`, Y = `
|
|
1592
1621
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1593
1622
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1594
1623
|
</svg>
|
|
1595
|
-
`,
|
|
1624
|
+
`, Ot = `
|
|
1596
1625
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1597
1626
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1598
1627
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1599
1628
|
</svg>
|
|
1600
|
-
`,
|
|
1629
|
+
`, Ht = `
|
|
1601
1630
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1602
1631
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1603
1632
|
</svg>
|
|
1604
|
-
`,
|
|
1633
|
+
`, $t = `
|
|
1605
1634
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1606
1635
|
<!-- Top dot -->
|
|
1607
1636
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1621,7 +1650,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1621
1650
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1622
1651
|
</svg>
|
|
1623
1652
|
`;
|
|
1624
|
-
class
|
|
1653
|
+
class ct extends x {
|
|
1625
1654
|
constructor(t = {}) {
|
|
1626
1655
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1627
1656
|
}
|
|
@@ -1718,9 +1747,9 @@ class rt extends w {
|
|
|
1718
1747
|
const s = this.value && this.value !== "";
|
|
1719
1748
|
s || i.classList.add("no-image");
|
|
1720
1749
|
const n = document.createElement("div");
|
|
1721
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1750
|
+
if (n.className = "preview-placeholder", n.innerHTML = Ot, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = $t, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1722
1751
|
const a = document.createElement("button");
|
|
1723
|
-
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML =
|
|
1752
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Ht, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1724
1753
|
var r;
|
|
1725
1754
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1726
1755
|
};
|
|
@@ -1741,14 +1770,14 @@ class rt extends w {
|
|
|
1741
1770
|
}, t;
|
|
1742
1771
|
}
|
|
1743
1772
|
}
|
|
1744
|
-
class
|
|
1773
|
+
class ge extends V {
|
|
1745
1774
|
constructor(t = {}) {
|
|
1746
1775
|
super({
|
|
1747
1776
|
...t,
|
|
1748
1777
|
title: t.title || "Height",
|
|
1749
1778
|
suffix: t.suffix || "px",
|
|
1750
1779
|
minValue: t.minValue ?? 0,
|
|
1751
|
-
icon: t.icon ||
|
|
1780
|
+
icon: t.icon || At,
|
|
1752
1781
|
default: t.default ?? 100
|
|
1753
1782
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1754
1783
|
}
|
|
@@ -1759,17 +1788,17 @@ class he extends S {
|
|
|
1759
1788
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1760
1789
|
}
|
|
1761
1790
|
}
|
|
1762
|
-
const
|
|
1791
|
+
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1763
1792
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1764
1793
|
</svg>`;
|
|
1765
|
-
class
|
|
1794
|
+
class me extends V {
|
|
1766
1795
|
constructor(t = {}) {
|
|
1767
1796
|
super({
|
|
1768
1797
|
...t,
|
|
1769
1798
|
title: t.title || "Width",
|
|
1770
1799
|
suffix: t.suffix || "px",
|
|
1771
1800
|
minValue: t.minValue ?? 0,
|
|
1772
|
-
icon: t.icon ||
|
|
1801
|
+
icon: t.icon || Bt,
|
|
1773
1802
|
default: t.default ?? 100
|
|
1774
1803
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1775
1804
|
}
|
|
@@ -1780,14 +1809,14 @@ class pe extends S {
|
|
|
1780
1809
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1781
1810
|
}
|
|
1782
1811
|
}
|
|
1783
|
-
const
|
|
1812
|
+
const Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1784
1813
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1785
|
-
</svg>`,
|
|
1814
|
+
</svg>`, Dt = `
|
|
1786
1815
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1787
1816
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1788
1817
|
</svg>
|
|
1789
1818
|
`;
|
|
1790
|
-
class
|
|
1819
|
+
class ve extends x {
|
|
1791
1820
|
constructor(t = {}) {
|
|
1792
1821
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1793
1822
|
const e = this._options.findIndex(
|
|
@@ -1842,7 +1871,7 @@ class de extends w {
|
|
|
1842
1871
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1843
1872
|
}), t.appendChild(i);
|
|
1844
1873
|
const s = document.createElement("div");
|
|
1845
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1874
|
+
return s.classList.add("svg-container"), s.innerHTML = Dt, t.appendChild(s), s.onclick = () => {
|
|
1846
1875
|
var n, o;
|
|
1847
1876
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1848
1877
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1889,11 +1918,19 @@ class de extends w {
|
|
|
1889
1918
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1890
1919
|
}
|
|
1891
1920
|
selectApiOption(t, e, i) {
|
|
1892
|
-
var
|
|
1893
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
1894
|
-
n && (n.checked = !0);
|
|
1921
|
+
var l, r, p, c;
|
|
1922
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1923
|
+
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1895
1924
|
const o = this._options[e].value;
|
|
1896
|
-
this.
|
|
1925
|
+
this.value = o;
|
|
1926
|
+
const a = i.querySelector(".select-value");
|
|
1927
|
+
if (a)
|
|
1928
|
+
a.textContent = this._options[e].name;
|
|
1929
|
+
else {
|
|
1930
|
+
const d = i.firstChild;
|
|
1931
|
+
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1932
|
+
}
|
|
1933
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (p = this.svgContainer) == null || p.classList.remove("open"), (c = this.onChange) == null || c.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1897
1934
|
}
|
|
1898
1935
|
updateOptionsList() {
|
|
1899
1936
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1917,26 +1954,16 @@ class de extends w {
|
|
|
1917
1954
|
i.textContent = t || n, this.buttonEl.classList.remove("error"), this.buttonEl.removeAttribute("disabled"), this.svgContainer && (this.svgContainer.style.display = "");
|
|
1918
1955
|
}
|
|
1919
1956
|
}
|
|
1920
|
-
update(t = !1) {
|
|
1921
|
-
var e;
|
|
1922
|
-
if (this.selectedOptionIndex = this.value !== void 0 ? this._options.findIndex(
|
|
1923
|
-
(i) => JSON.stringify(i.value) === JSON.stringify(this.value)
|
|
1924
|
-
) : null, this.updateOptionsList(), this.updateButtonText(), t && this.value !== void 0) {
|
|
1925
|
-
(e = this.onChange) == null || e.call(this, this.value);
|
|
1926
|
-
const i = this.props.detectChange || this.detectChangeCallback;
|
|
1927
|
-
i == null || i(this.value);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
1957
|
setDetectChange(t) {
|
|
1931
|
-
this.detectChangeCallback = t
|
|
1958
|
+
this.detectChangeCallback = t;
|
|
1932
1959
|
}
|
|
1933
1960
|
setValue(t) {
|
|
1934
|
-
|
|
1961
|
+
this.value = t, this.selectedOptionIndex = this._options.findIndex(
|
|
1935
1962
|
(e) => JSON.stringify(e.value) === JSON.stringify(t)
|
|
1936
|
-
), this.updateButtonText()
|
|
1963
|
+
), this.updateButtonText();
|
|
1937
1964
|
}
|
|
1938
1965
|
}
|
|
1939
|
-
class
|
|
1966
|
+
class fe extends x {
|
|
1940
1967
|
constructor(t) {
|
|
1941
1968
|
var e, i;
|
|
1942
1969
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
@@ -1959,19 +1986,19 @@ class ue extends w {
|
|
|
1959
1986
|
i.className = "toggle-switch";
|
|
1960
1987
|
const s = document.createElement("input");
|
|
1961
1988
|
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
1962
|
-
var r,
|
|
1963
|
-
const l = ((
|
|
1989
|
+
var r, p;
|
|
1990
|
+
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((c) => c.status === s.checked)) == null ? void 0 : p.value) ?? "";
|
|
1964
1991
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1965
1992
|
});
|
|
1966
1993
|
const n = document.createElement("span");
|
|
1967
1994
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1968
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
1995
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", p = this.props.inactiveColor || "#ccc";
|
|
1969
1996
|
l.textContent = `
|
|
1970
1997
|
.toggle-switch input:checked + .toggle-slider {
|
|
1971
1998
|
background-color: ${r};
|
|
1972
1999
|
}
|
|
1973
2000
|
.toggle-switch .toggle-slider {
|
|
1974
|
-
background-color: ${
|
|
2001
|
+
background-color: ${p};
|
|
1975
2002
|
}
|
|
1976
2003
|
`, document.head.appendChild(l);
|
|
1977
2004
|
}
|
|
@@ -1986,13 +2013,13 @@ class ue extends w {
|
|
|
1986
2013
|
this.detectChangeCallback = t;
|
|
1987
2014
|
}
|
|
1988
2015
|
}
|
|
1989
|
-
const
|
|
2016
|
+
const Rt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1990
2017
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1991
2018
|
</svg>`;
|
|
1992
|
-
class
|
|
2019
|
+
class Ce extends x {
|
|
1993
2020
|
// Store mobile value
|
|
1994
2021
|
constructor(t = {}) {
|
|
1995
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2022
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Rt, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
1996
2023
|
}
|
|
1997
2024
|
draw() {
|
|
1998
2025
|
const t = document.createElement("div");
|
|
@@ -2043,42 +2070,42 @@ class ge extends w {
|
|
|
2043
2070
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2044
2071
|
}
|
|
2045
2072
|
}
|
|
2046
|
-
const
|
|
2073
|
+
const Gt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2047
2074
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2048
2075
|
</svg>`;
|
|
2049
|
-
class
|
|
2076
|
+
class ye extends V {
|
|
2050
2077
|
constructor(t = {}) {
|
|
2051
2078
|
super({
|
|
2052
2079
|
...t,
|
|
2053
2080
|
minValue: t.minValue ?? 0,
|
|
2054
2081
|
maxValue: t.maxValue ?? 1e3,
|
|
2055
|
-
icon: t.icon ||
|
|
2082
|
+
icon: t.icon || Gt,
|
|
2056
2083
|
title: t.title || "Margin Bottom",
|
|
2057
2084
|
default: t.default ?? 20,
|
|
2058
2085
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2059
2086
|
}), this.inputType = "number";
|
|
2060
2087
|
}
|
|
2061
2088
|
}
|
|
2062
|
-
const
|
|
2089
|
+
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2063
2090
|
<path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
|
|
2064
2091
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2065
2092
|
</svg>`;
|
|
2066
|
-
class
|
|
2093
|
+
class be extends V {
|
|
2067
2094
|
constructor(t = {}) {
|
|
2068
2095
|
super({
|
|
2069
2096
|
...t,
|
|
2070
2097
|
minValue: t.minValue ?? 0,
|
|
2071
2098
|
maxValue: t.maxValue ?? 1e3,
|
|
2072
|
-
icon: t.icon ||
|
|
2099
|
+
icon: t.icon || Ft,
|
|
2073
2100
|
title: t.title || "Margin Top",
|
|
2074
2101
|
default: t.default ?? 20,
|
|
2075
2102
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2076
2103
|
}), this.inputType = "number";
|
|
2077
2104
|
}
|
|
2078
2105
|
}
|
|
2079
|
-
class
|
|
2106
|
+
class Ee extends x {
|
|
2080
2107
|
constructor(t) {
|
|
2081
|
-
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(
|
|
2108
|
+
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(x.DefaultLanguage) ? x.DefaultLanguage : t.languages[0];
|
|
2082
2109
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2083
2110
|
t.languages.forEach((i) => {
|
|
2084
2111
|
var s, n;
|
|
@@ -2108,14 +2135,14 @@ class ve extends w {
|
|
|
2108
2135
|
t.placeholder = e;
|
|
2109
2136
|
return;
|
|
2110
2137
|
}
|
|
2111
|
-
const
|
|
2112
|
-
let
|
|
2113
|
-
for (;
|
|
2114
|
-
const
|
|
2115
|
-
this.measureTextWidth(
|
|
2138
|
+
const p = "...";
|
|
2139
|
+
let c = 0, d = e.length, u = 0;
|
|
2140
|
+
for (; c <= d; ) {
|
|
2141
|
+
const v = Math.floor((c + d) / 2), m = e.slice(0, v).trimEnd() + p;
|
|
2142
|
+
this.measureTextWidth(m, i) <= l ? (u = v, c = v + 1) : d = v - 1;
|
|
2116
2143
|
}
|
|
2117
|
-
const
|
|
2118
|
-
t.placeholder =
|
|
2144
|
+
const g = e.slice(0, u).trimEnd() + p;
|
|
2145
|
+
t.placeholder = g;
|
|
2119
2146
|
}
|
|
2120
2147
|
autosizeTextarea(t, e = 3) {
|
|
2121
2148
|
t.style.height = "auto";
|
|
@@ -2127,7 +2154,7 @@ class ve extends w {
|
|
|
2127
2154
|
i.classList.add("simple-multi-language-row");
|
|
2128
2155
|
const s = document.createElement("label");
|
|
2129
2156
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2130
|
-
const n = new
|
|
2157
|
+
const n = new ct({
|
|
2131
2158
|
defaultUrl: e || "",
|
|
2132
2159
|
title: "",
|
|
2133
2160
|
id: `${this.id}_upload_${t}`
|
|
@@ -2150,8 +2177,8 @@ class ve extends w {
|
|
|
2150
2177
|
), n.addEventListener("input", (l) => {
|
|
2151
2178
|
const r = l.target;
|
|
2152
2179
|
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2180
|
+
const p = n.getAttribute("data-full-placeholder") || "";
|
|
2181
|
+
p && this.adaptPlaceholderToSingleLine(n, p);
|
|
2155
2182
|
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2156
2183
|
this.autosizeTextarea(n, 3);
|
|
2157
2184
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
@@ -2223,7 +2250,7 @@ class ve extends w {
|
|
|
2223
2250
|
});
|
|
2224
2251
|
}
|
|
2225
2252
|
}
|
|
2226
|
-
class
|
|
2253
|
+
class we extends x {
|
|
2227
2254
|
constructor(t = {}) {
|
|
2228
2255
|
super(t), this.inputType = "select";
|
|
2229
2256
|
const e = [
|
|
@@ -2250,72 +2277,72 @@ class Ce extends w {
|
|
|
2250
2277
|
this.selectSetting.destroy(), super.destroy();
|
|
2251
2278
|
}
|
|
2252
2279
|
}
|
|
2253
|
-
const
|
|
2280
|
+
const ht = (h, t, e) => {
|
|
2254
2281
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2255
|
-
const l = (
|
|
2256
|
-
if (
|
|
2257
|
-
i = !0, s =
|
|
2282
|
+
const l = (c) => {
|
|
2283
|
+
if (c.target.closest("button")) return;
|
|
2284
|
+
i = !0, s = c.clientX, n = c.clientY;
|
|
2258
2285
|
const d = t.getBoundingClientRect();
|
|
2259
|
-
o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
2260
|
-
}, r = (
|
|
2286
|
+
o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2287
|
+
}, r = (c) => {
|
|
2261
2288
|
if (!i) return;
|
|
2262
|
-
const d =
|
|
2263
|
-
let
|
|
2264
|
-
|
|
2265
|
-
},
|
|
2266
|
-
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
2289
|
+
const d = c.clientX - s, u = c.clientY - n, g = window.innerWidth, v = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2290
|
+
let C = o + d, w = a + u;
|
|
2291
|
+
C = Math.max(8, Math.min(g - m - 8, C)), w = Math.max(8, Math.min(v - f - 8, w)), t.style.left = `${C}px`, t.style.top = `${w}px`, e == null || e(C, w);
|
|
2292
|
+
}, p = () => {
|
|
2293
|
+
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2267
2294
|
};
|
|
2268
|
-
|
|
2269
|
-
},
|
|
2270
|
-
if (!
|
|
2271
|
-
let t =
|
|
2295
|
+
h.addEventListener("mousedown", l);
|
|
2296
|
+
}, W = (h) => {
|
|
2297
|
+
if (!h) return null;
|
|
2298
|
+
let t = h.trim();
|
|
2272
2299
|
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()}`;
|
|
2273
|
-
},
|
|
2274
|
-
const t =
|
|
2300
|
+
}, _ = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (h) => {
|
|
2301
|
+
const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2275
2302
|
return {
|
|
2276
2303
|
r: parseInt(e.slice(0, 2), 16),
|
|
2277
2304
|
g: parseInt(e.slice(2, 4), 16),
|
|
2278
2305
|
b: parseInt(e.slice(4, 6), 16)
|
|
2279
2306
|
};
|
|
2280
|
-
},
|
|
2281
|
-
const { r: t, g: e, b: i } =
|
|
2282
|
-
let
|
|
2283
|
-
r !== 0 && (a === s ?
|
|
2284
|
-
const
|
|
2285
|
-
return { h:
|
|
2286
|
-
},
|
|
2287
|
-
const i = (
|
|
2307
|
+
}, G = (h) => {
|
|
2308
|
+
const { r: t, g: e, b: i } = S(h), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2309
|
+
let p = 0;
|
|
2310
|
+
r !== 0 && (a === s ? p = (n - o) / r % 6 : a === n ? p = (o - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
|
|
2311
|
+
const c = a === 0 ? 0 : r / a, d = a;
|
|
2312
|
+
return { h: p * 60, s: c, v: d };
|
|
2313
|
+
}, F = (h, t, e) => {
|
|
2314
|
+
const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2288
2315
|
let a = 0, l = 0, r = 0;
|
|
2289
|
-
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),
|
|
2316
|
+
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), _(
|
|
2290
2317
|
Math.round((a + o) * 255),
|
|
2291
2318
|
Math.round((l + o) * 255),
|
|
2292
2319
|
Math.round((r + o) * 255)
|
|
2293
2320
|
);
|
|
2294
|
-
},
|
|
2321
|
+
}, dt = (h, t, e) => {
|
|
2295
2322
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2296
|
-
return { hue:
|
|
2297
|
-
},
|
|
2298
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2323
|
+
return { hue: h, sat: s, lightness: i };
|
|
2324
|
+
}, et = (h, t, e) => {
|
|
2325
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
|
|
2299
2326
|
let o = 0, a = 0, l = 0;
|
|
2300
|
-
return
|
|
2327
|
+
return h < 60 ? (o = i, a = s, l = 0) : h < 120 ? (o = s, a = i, l = 0) : h < 180 ? (o = 0, a = i, l = s) : h < 240 ? (o = 0, a = s, l = i) : h < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2301
2328
|
r: Math.round((o + n) * 255),
|
|
2302
2329
|
g: Math.round((a + n) * 255),
|
|
2303
2330
|
b: Math.round((l + n) * 255)
|
|
2304
2331
|
};
|
|
2305
|
-
},
|
|
2332
|
+
}, pt = (h, t) => {
|
|
2306
2333
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2307
|
-
if (
|
|
2308
|
-
const { r: s, g: n, b: o } =
|
|
2334
|
+
if (h.startsWith("#")) {
|
|
2335
|
+
const { r: s, g: n, b: o } = S(h);
|
|
2309
2336
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2310
2337
|
}
|
|
2311
|
-
if (
|
|
2312
|
-
return
|
|
2313
|
-
if (
|
|
2314
|
-
return
|
|
2315
|
-
if (
|
|
2316
|
-
const s =
|
|
2338
|
+
if (h.startsWith("rgba("))
|
|
2339
|
+
return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2340
|
+
if (h.startsWith("rgb("))
|
|
2341
|
+
return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2342
|
+
if (h.startsWith("hsl(")) {
|
|
2343
|
+
const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2317
2344
|
if (s) {
|
|
2318
|
-
const { r: n, g: o, b: a } =
|
|
2345
|
+
const { r: n, g: o, b: a } = et(
|
|
2319
2346
|
parseInt(s[1]),
|
|
2320
2347
|
parseInt(s[2]) / 100,
|
|
2321
2348
|
parseInt(s[3]) / 100
|
|
@@ -2323,10 +2350,10 @@ const ct = (c, t, e) => {
|
|
|
2323
2350
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2324
2351
|
}
|
|
2325
2352
|
}
|
|
2326
|
-
if (
|
|
2327
|
-
const s =
|
|
2353
|
+
if (h.startsWith("hsla(")) {
|
|
2354
|
+
const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2328
2355
|
if (s) {
|
|
2329
|
-
const { r: n, g: o, b: a } =
|
|
2356
|
+
const { r: n, g: o, b: a } = et(
|
|
2330
2357
|
parseInt(s[1]),
|
|
2331
2358
|
parseInt(s[2]) / 100,
|
|
2332
2359
|
parseInt(s[3]) / 100
|
|
@@ -2334,13 +2361,13 @@ const ct = (c, t, e) => {
|
|
|
2334
2361
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2335
2362
|
}
|
|
2336
2363
|
}
|
|
2337
|
-
const i =
|
|
2364
|
+
const i = W(h);
|
|
2338
2365
|
if (i) {
|
|
2339
|
-
const { r: s, g: n, b: o } =
|
|
2366
|
+
const { r: s, g: n, b: o } = S(i);
|
|
2340
2367
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2341
2368
|
}
|
|
2342
|
-
return
|
|
2343
|
-
},
|
|
2369
|
+
return h;
|
|
2370
|
+
}, Wt = (h) => [
|
|
2344
2371
|
"red",
|
|
2345
2372
|
"green",
|
|
2346
2373
|
"blue",
|
|
@@ -2364,22 +2391,22 @@ const ct = (c, t, e) => {
|
|
|
2364
2391
|
"teal",
|
|
2365
2392
|
"fuchsia",
|
|
2366
2393
|
"transparent"
|
|
2367
|
-
].includes(
|
|
2394
|
+
].includes(h.toLowerCase()), ut = (h) => [
|
|
2368
2395
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2369
2396
|
/^rgba?\s*\([^)]+\)$/,
|
|
2370
2397
|
/^hsla?\s*\([^)]+\)$/,
|
|
2371
2398
|
/^[a-zA-Z]+$/
|
|
2372
|
-
].some((e) => e.test(
|
|
2399
|
+
].some((e) => e.test(h.trim())), Ut = (h) => {
|
|
2373
2400
|
if (typeof document > "u")
|
|
2374
|
-
return
|
|
2401
|
+
return ut(h) || !!W(h);
|
|
2375
2402
|
const t = document.createElement("div");
|
|
2376
|
-
return t.style.color =
|
|
2377
|
-
},
|
|
2378
|
-
const t =
|
|
2403
|
+
return t.style.color = h, t.style.color !== "";
|
|
2404
|
+
}, gt = (h) => {
|
|
2405
|
+
const t = h.trim();
|
|
2379
2406
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2380
2407
|
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);
|
|
2381
2408
|
return {
|
|
2382
|
-
color:
|
|
2409
|
+
color: _(o, a, l),
|
|
2383
2410
|
position: 0,
|
|
2384
2411
|
opacity: Math.round(r / 255 * 100)
|
|
2385
2412
|
};
|
|
@@ -2390,7 +2417,7 @@ const ct = (c, t, e) => {
|
|
|
2390
2417
|
if (e) {
|
|
2391
2418
|
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2392
2419
|
return {
|
|
2393
|
-
color:
|
|
2420
|
+
color: _(n, o, a),
|
|
2394
2421
|
position: 0,
|
|
2395
2422
|
opacity: Math.round(l * 100)
|
|
2396
2423
|
};
|
|
@@ -2399,23 +2426,23 @@ const ct = (c, t, e) => {
|
|
|
2399
2426
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2400
2427
|
);
|
|
2401
2428
|
if (i) {
|
|
2402
|
-
const { r: n, g: o, b: a } =
|
|
2429
|
+
const { r: n, g: o, b: a } = et(
|
|
2403
2430
|
parseFloat(i[1]),
|
|
2404
2431
|
parseFloat(i[2]) / 100,
|
|
2405
2432
|
parseFloat(i[3]) / 100
|
|
2406
2433
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2407
2434
|
return {
|
|
2408
|
-
color:
|
|
2435
|
+
color: _(n, o, a),
|
|
2409
2436
|
position: 0,
|
|
2410
2437
|
opacity: Math.round(l * 100)
|
|
2411
2438
|
};
|
|
2412
2439
|
}
|
|
2413
|
-
return { color:
|
|
2414
|
-
},
|
|
2440
|
+
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
2441
|
+
}, ot = (h) => {
|
|
2415
2442
|
const t = [];
|
|
2416
2443
|
let e = "", i = 0;
|
|
2417
|
-
for (let s = 0; s <
|
|
2418
|
-
const n =
|
|
2444
|
+
for (let s = 0; s < h.length; s++) {
|
|
2445
|
+
const n = h[s];
|
|
2419
2446
|
if (n === "(") i++;
|
|
2420
2447
|
else if (n === ")") i--;
|
|
2421
2448
|
else if (n === "," && i === 0) {
|
|
@@ -2425,16 +2452,16 @@ const ct = (c, t, e) => {
|
|
|
2425
2452
|
e += n;
|
|
2426
2453
|
}
|
|
2427
2454
|
return e.trim() && t.push(e.trim()), t;
|
|
2428
|
-
},
|
|
2429
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2455
|
+
}, at = (h, t) => {
|
|
2456
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
|
|
2430
2457
|
if (!i) return null;
|
|
2431
2458
|
const s = i.index + i[0].length;
|
|
2432
2459
|
let n = 1, o = s;
|
|
2433
|
-
for (let a = s; a <
|
|
2434
|
-
|
|
2435
|
-
return n === 0 ?
|
|
2436
|
-
},
|
|
2437
|
-
const t =
|
|
2460
|
+
for (let a = s; a < h.length && n > 0; a++)
|
|
2461
|
+
h[a] === "(" ? n++ : h[a] === ")" && n--, o = a;
|
|
2462
|
+
return n === 0 ? h.substring(s, o) : null;
|
|
2463
|
+
}, zt = (h) => {
|
|
2464
|
+
const t = h.split(" ")[0].toLowerCase();
|
|
2438
2465
|
return [
|
|
2439
2466
|
"circle",
|
|
2440
2467
|
"ellipse",
|
|
@@ -2445,38 +2472,38 @@ const ct = (c, t, e) => {
|
|
|
2445
2472
|
"at",
|
|
2446
2473
|
"contain",
|
|
2447
2474
|
"cover"
|
|
2448
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2449
|
-
},
|
|
2475
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Wt(t);
|
|
2476
|
+
}, lt = (h) => {
|
|
2450
2477
|
const t = [];
|
|
2451
|
-
return
|
|
2478
|
+
return h.forEach((e, i) => {
|
|
2452
2479
|
const s = e.trim();
|
|
2453
2480
|
if (!s) return;
|
|
2454
2481
|
let n = "", o = 0;
|
|
2455
2482
|
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2456
|
-
a &&
|
|
2457
|
-
const l =
|
|
2483
|
+
a && ut(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = h.length === 1 ? 0 : i / (h.length - 1) * 100);
|
|
2484
|
+
const l = gt(n);
|
|
2458
2485
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2459
2486
|
}), t;
|
|
2460
|
-
},
|
|
2461
|
-
const t =
|
|
2487
|
+
}, O = (h) => {
|
|
2488
|
+
const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2462
2489
|
return {
|
|
2463
|
-
type:
|
|
2464
|
-
angle: typeof
|
|
2490
|
+
type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
|
|
2491
|
+
angle: typeof h.angle == "number" ? h.angle : 90,
|
|
2465
2492
|
stops: t.map((e, i) => ({
|
|
2466
2493
|
color: e.color || "#000000",
|
|
2467
2494
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2468
2495
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2469
2496
|
}))
|
|
2470
2497
|
};
|
|
2471
|
-
},
|
|
2472
|
-
const t =
|
|
2498
|
+
}, I = (h) => {
|
|
2499
|
+
const t = h.replace(/;$/, "").trim();
|
|
2473
2500
|
if (Ut(t)) {
|
|
2474
|
-
const s =
|
|
2475
|
-
return
|
|
2501
|
+
const s = gt(t);
|
|
2502
|
+
return O({ type: "solid", angle: 0, stops: [s] });
|
|
2476
2503
|
}
|
|
2477
|
-
const e =
|
|
2504
|
+
const e = at(t, "linear-gradient");
|
|
2478
2505
|
if (e) {
|
|
2479
|
-
const s =
|
|
2506
|
+
const s = ot(e);
|
|
2480
2507
|
let n = 90, o = s;
|
|
2481
2508
|
const a = s[0];
|
|
2482
2509
|
if (a.includes("deg")) {
|
|
@@ -2492,40 +2519,47 @@ const ct = (c, t, e) => {
|
|
|
2492
2519
|
"to top right": 45,
|
|
2493
2520
|
"to top left": 315
|
|
2494
2521
|
}[a] ?? 90, o = s.slice(1));
|
|
2495
|
-
const l =
|
|
2496
|
-
return l.length ?
|
|
2522
|
+
const l = lt(o);
|
|
2523
|
+
return l.length ? O({ type: "linear", angle: n, stops: l }) : null;
|
|
2497
2524
|
}
|
|
2498
|
-
const i =
|
|
2525
|
+
const i = at(t, "radial-gradient");
|
|
2499
2526
|
if (i) {
|
|
2500
|
-
const s =
|
|
2501
|
-
return o.length ?
|
|
2527
|
+
const s = ot(i), n = s[0] && !zt(s[0]) ? s.slice(1) : s, o = lt(n);
|
|
2528
|
+
return o.length ? O({ type: "radial", angle: 0, stops: o }) : null;
|
|
2502
2529
|
}
|
|
2503
2530
|
return null;
|
|
2504
|
-
}, T = (
|
|
2505
|
-
if (
|
|
2506
|
-
const e =
|
|
2507
|
-
|
|
2531
|
+
}, T = (h) => {
|
|
2532
|
+
if (h.type === "solid") {
|
|
2533
|
+
const e = h.stops[0], i = e.color;
|
|
2534
|
+
if (i.startsWith("var(--"))
|
|
2535
|
+
return i;
|
|
2536
|
+
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2537
|
+
return `#${n}${o}`;
|
|
2508
2538
|
}
|
|
2509
|
-
const t =
|
|
2510
|
-
(e) => `${
|
|
2539
|
+
const t = h.stops.map(
|
|
2540
|
+
(e) => `${pt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2511
2541
|
).join(", ");
|
|
2512
|
-
return
|
|
2513
|
-
},
|
|
2514
|
-
if (
|
|
2515
|
-
const t =
|
|
2542
|
+
return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
|
|
2543
|
+
}, jt = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), J = (h) => {
|
|
2544
|
+
if (h.type === "solid") {
|
|
2545
|
+
const t = h.stops[0];
|
|
2516
2546
|
if (t) {
|
|
2517
|
-
const e = t.color
|
|
2547
|
+
const e = t.color;
|
|
2548
|
+
if (e.startsWith("var(--"))
|
|
2549
|
+
return e.replace("var(--", "").replace(")", "").split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
|
|
2550
|
+
e.toUpperCase();
|
|
2551
|
+
const i = t.opacity ?? 100;
|
|
2518
2552
|
if (i === 100)
|
|
2519
2553
|
return e;
|
|
2520
2554
|
{
|
|
2521
|
-
const s =
|
|
2555
|
+
const s = jt(i);
|
|
2522
2556
|
return `${e}${s}`;
|
|
2523
2557
|
}
|
|
2524
2558
|
}
|
|
2525
2559
|
return "#000000";
|
|
2526
2560
|
}
|
|
2527
|
-
return
|
|
2528
|
-
},
|
|
2561
|
+
return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
|
|
2562
|
+
}, U = class U {
|
|
2529
2563
|
static defaults() {
|
|
2530
2564
|
return {
|
|
2531
2565
|
solid: [],
|
|
@@ -2535,8 +2569,8 @@ const ct = (c, t, e) => {
|
|
|
2535
2569
|
static normalizeList(t) {
|
|
2536
2570
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2537
2571
|
return t.forEach((s) => {
|
|
2538
|
-
let n =
|
|
2539
|
-
n ||
|
|
2572
|
+
let n = W(s);
|
|
2573
|
+
n || I(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2540
2574
|
}), i.slice(0, this.MAX_COLORS);
|
|
2541
2575
|
}
|
|
2542
2576
|
static ensureLoaded() {
|
|
@@ -2579,11 +2613,11 @@ const ct = (c, t, e) => {
|
|
|
2579
2613
|
}
|
|
2580
2614
|
static addColor(t, e) {
|
|
2581
2615
|
if (!t) return;
|
|
2582
|
-
let i =
|
|
2616
|
+
let i = W(t), s = "solid";
|
|
2583
2617
|
if (i)
|
|
2584
2618
|
s = "solid";
|
|
2585
2619
|
else {
|
|
2586
|
-
const l =
|
|
2620
|
+
const l = I(t);
|
|
2587
2621
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2588
2622
|
}
|
|
2589
2623
|
if (!i) return;
|
|
@@ -2591,78 +2625,102 @@ const ct = (c, t, e) => {
|
|
|
2591
2625
|
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2592
2626
|
}
|
|
2593
2627
|
};
|
|
2594
|
-
|
|
2595
|
-
let
|
|
2596
|
-
const
|
|
2628
|
+
U.STORAGE_KEY = "settingsLib_recentColors", U.MAX_COLORS = 12, U.colors = null;
|
|
2629
|
+
let B = U;
|
|
2630
|
+
const it = (h, t) => {
|
|
2597
2631
|
const e = document.createElement("div");
|
|
2598
2632
|
e.className = "color-picker-recent-section";
|
|
2599
2633
|
const i = document.createElement("div");
|
|
2600
2634
|
i.className = "color-picker-recent-title", i.textContent = "Recently Used";
|
|
2601
2635
|
const s = document.createElement("div");
|
|
2602
|
-
s.className = "color-picker-
|
|
2603
|
-
const n =
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2636
|
+
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2637
|
+
const n = () => {
|
|
2638
|
+
s.style.display = "none";
|
|
2639
|
+
}, o = (p, c) => {
|
|
2640
|
+
const d = p.getBoundingClientRect();
|
|
2641
|
+
s.textContent = c, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
2642
|
+
}, a = document.createElement("div");
|
|
2643
|
+
a.className = "color-picker-recent-grid";
|
|
2644
|
+
const l = document.createElement("div");
|
|
2645
|
+
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
2646
|
+
const r = () => {
|
|
2647
|
+
n(), a.innerHTML = "";
|
|
2648
|
+
const p = B.getColors(t);
|
|
2649
|
+
if (p.length === 0) {
|
|
2650
|
+
a.style.display = "none", l.style.display = "block";
|
|
2610
2651
|
return;
|
|
2611
2652
|
}
|
|
2612
|
-
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2615
|
-
const
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
}), r.addEventListener("mouseleave", () => {
|
|
2622
|
-
p.style.display = "none", r.style.boxShadow = "";
|
|
2623
|
-
}), r.addEventListener("mousedown", () => {
|
|
2624
|
-
r.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
2625
|
-
}), r.addEventListener("mouseup", () => {
|
|
2653
|
+
a.style.display = "grid", l.style.display = "none", p.forEach((c) => {
|
|
2654
|
+
const d = document.createElement("button");
|
|
2655
|
+
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
2656
|
+
const u = qt(c);
|
|
2657
|
+
d.title = u, d.setAttribute("aria-label", `Use color: ${u}`), d.style.background = c, d.style.borderColor = c, d.addEventListener("mouseenter", () => o(d, u)), d.addEventListener("mouseleave", () => {
|
|
2658
|
+
n(), d.style.boxShadow = "";
|
|
2659
|
+
}), d.addEventListener("mousedown", () => {
|
|
2660
|
+
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
2661
|
+
}), d.addEventListener("mouseup", () => {
|
|
2626
2662
|
setTimeout(() => {
|
|
2627
|
-
|
|
2663
|
+
d.style.boxShadow = "";
|
|
2628
2664
|
}, 150);
|
|
2629
|
-
}),
|
|
2630
|
-
|
|
2631
|
-
}),
|
|
2665
|
+
}), d.addEventListener("click", () => {
|
|
2666
|
+
n(), h(c);
|
|
2667
|
+
}), a.appendChild(d);
|
|
2632
2668
|
});
|
|
2633
2669
|
};
|
|
2634
|
-
return
|
|
2635
|
-
},
|
|
2636
|
-
const t =
|
|
2670
|
+
return r(), { container: e, refresh: r };
|
|
2671
|
+
}, qt = (h) => {
|
|
2672
|
+
const t = I(h);
|
|
2637
2673
|
if (t)
|
|
2638
|
-
return
|
|
2639
|
-
const e =
|
|
2674
|
+
return J(t);
|
|
2675
|
+
const e = W(h);
|
|
2640
2676
|
if (e) {
|
|
2641
|
-
const i =
|
|
2677
|
+
const i = S(e);
|
|
2642
2678
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2643
2679
|
}
|
|
2644
|
-
return
|
|
2645
|
-
},
|
|
2680
|
+
return h;
|
|
2681
|
+
}, mt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2646
2682
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2647
2683
|
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"
|
|
2648
2684
|
fill="#919EAB"/>
|
|
2649
|
-
</svg>`,
|
|
2685
|
+
</svg>`, vt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2650
2686
|
<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"/>
|
|
2651
|
-
</svg>`,
|
|
2687
|
+
</svg>`, _t = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2652
2688
|
<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"/>
|
|
2653
|
-
</svg>`,
|
|
2689
|
+
</svg>`, Jt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2654
2690
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2655
|
-
</svg
|
|
2656
|
-
|
|
2691
|
+
</svg>`, Zt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2692
|
+
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2693
|
+
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2694
|
+
</svg>
|
|
2695
|
+
|
|
2696
|
+
`, Xt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2697
|
+
<path d="M4.5 21L19.5 21C19.8978 21 20.2794 20.842 20.5607 20.5607C20.842 20.2794 21 19.8978 21 19.5L21 4.5C21 4.10218 20.842 3.72065 20.5607 3.43934C20.2794 3.15804 19.8978 3 19.5 3L4.5 3C4.10218 3 3.72065 3.15804 3.43934 3.43934C3.15804 3.72064 3 4.10218 3 4.5L3 19.5C3 19.8978 3.15804 20.2794 3.43934 20.5607C3.72065 20.842 4.10218 21 4.5 21ZM7.5 4.5L7.5 7.5L10.5 7.5L10.5 4.5L13.5 4.5L13.5 7.5L16.5 7.5L16.5 10.5L13.5 10.5L13.5 13.5L16.5 13.5L16.5 16.5L13.5 16.5L13.5 19.5L10.5 19.5L10.5 16.5L7.5 16.5L7.5 19.5L4.5 19.5L4.5 4.5L7.5 4.5Z" fill="#637381"/>
|
|
2698
|
+
<path d="M13.5 16.5L10.5 16.5L10.5 13.5L13.5 13.5L13.5 16.5ZM13.5 10.5L10.5 10.5L10.5 7.5L13.5 7.5L13.5 10.5ZM10.5 13.5L7.5 13.5L7.5 10.5L10.5 10.5L10.5 13.5Z" fill="#637381"/>
|
|
2699
|
+
</svg>
|
|
2700
|
+
|
|
2701
|
+
`, Kt = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2702
|
+
<path d="M20.6106 19.5062C20.6887 19.5843 20.6887 19.711 20.6106 19.7891L19.7896 20.6101C19.7115 20.6882 19.5848 20.6882 19.5067 20.6101L5.98957 7.09298C5.91146 7.01488 5.91146 6.88825 5.98957 6.81014L6.81063 5.98908C6.88873 5.91097 7.01537 5.91097 7.09347 5.98908L20.6106 19.5062Z" fill="#46525C"/>
|
|
2703
|
+
<path d="M9.69583 12.2146C9.81298 12.3318 9.81298 12.5217 9.69583 12.6389L7.80151 14.5332C6.72071 15.614 6.6062 17.4365 7.80151 18.6318C8.99473 19.8267 10.8184 19.7123 11.8992 18.6318L13.7935 16.7366C13.9106 16.6194 14.1006 16.6194 14.2178 16.7366L14.816 17.3348C14.9331 17.4519 14.9332 17.6418 14.816 17.759L12.9216 19.6543C11.2241 21.3536 8.47364 21.3518 6.77417 19.6543C5.07483 17.9568 5.0749 15.2064 6.77417 13.5068L8.66848 11.6116C8.78563 11.4944 8.97562 11.4944 9.0928 11.6116L9.69583 12.2146ZM13.5085 6.77441C15.2061 5.07514 17.9565 5.07509 19.656 6.77441C21.3535 8.47388 21.3533 11.2243 19.656 12.9238L17.7607 14.8182C17.6436 14.9354 17.4536 14.9353 17.3365 14.8182L16.7344 14.2161C16.6172 14.0989 16.6172 13.9089 16.7344 13.7918L18.6296 11.8975C19.7101 10.8167 19.8245 8.99503 18.6296 7.7998C17.4363 6.60449 15.6118 6.719 14.531 7.7998L12.6367 9.69412C12.5195 9.81128 12.3296 9.81128 12.2124 9.69412L11.6123 9.09402C11.4952 8.97684 11.4952 8.78685 11.6124 8.6697L13.5085 6.77441Z" fill="#46525C"/>
|
|
2704
|
+
</svg>
|
|
2705
|
+
`;
|
|
2706
|
+
class Yt {
|
|
2657
2707
|
constructor(t, e = "gradient") {
|
|
2658
2708
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2659
2709
|
if (!this.isOpen) return;
|
|
2660
2710
|
const s = i.target;
|
|
2661
2711
|
if (this.element.contains(s)) return;
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2712
|
+
if (this.backdrop.contains(s)) {
|
|
2713
|
+
i.preventDefault(), i.stopPropagation(), this.close(!0);
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
const n = document.querySelectorAll(
|
|
2717
|
+
".gstop-color-input, .gstop-color-preview, .gradient-mini-preview"
|
|
2718
|
+
);
|
|
2719
|
+
if (Array.from(n).some(
|
|
2720
|
+
(l) => l.contains(s)
|
|
2721
|
+
)) return;
|
|
2722
|
+
const a = document.querySelector(".gradient-popover");
|
|
2723
|
+
a && a.contains(s) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2666
2724
|
}, this.keyDown = (i) => {
|
|
2667
2725
|
if (this.isOpen) {
|
|
2668
2726
|
if (i.key === "Escape")
|
|
@@ -2687,7 +2745,7 @@ class Jt {
|
|
|
2687
2745
|
const i = document.createElement("span");
|
|
2688
2746
|
i.textContent = "Color";
|
|
2689
2747
|
const s = document.createElement("button");
|
|
2690
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2748
|
+
s.className = "color-picker-close", s.innerHTML = mt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ht(e, t);
|
|
2691
2749
|
const n = document.createElement("div");
|
|
2692
2750
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2693
2751
|
const o = document.createElement("div");
|
|
@@ -2695,38 +2753,38 @@ class Jt {
|
|
|
2695
2753
|
const a = document.createElement("div");
|
|
2696
2754
|
a.className = "color-picker-sliders-container";
|
|
2697
2755
|
const l = document.createElement("button");
|
|
2698
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2756
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = vt;
|
|
2699
2757
|
const r = document.createElement("div");
|
|
2700
2758
|
r.className = "color-picker-sliders-group";
|
|
2701
|
-
const h = document.createElement("div");
|
|
2702
|
-
h.className = "color-picker-hue", this.hueSlider = h;
|
|
2703
2759
|
const p = document.createElement("div");
|
|
2704
|
-
p.className = "color-picker-hue
|
|
2760
|
+
p.className = "color-picker-hue", this.hueSlider = p;
|
|
2761
|
+
const c = document.createElement("div");
|
|
2762
|
+
c.className = "color-picker-hue-marker", this.hueMarker = c, p.appendChild(c);
|
|
2705
2763
|
const d = document.createElement("div");
|
|
2706
2764
|
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2707
2765
|
const u = document.createElement("div");
|
|
2708
|
-
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(
|
|
2709
|
-
const
|
|
2710
|
-
var
|
|
2711
|
-
this.setColor(
|
|
2766
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d), a.appendChild(l), a.appendChild(r);
|
|
2767
|
+
const g = it((b) => {
|
|
2768
|
+
var L;
|
|
2769
|
+
this.setColor(b), (L = this.onChange) == null || L.call(this, b, this.currentOpacity);
|
|
2712
2770
|
}, this.recentScope);
|
|
2713
|
-
this.recentSectionRefresh =
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2771
|
+
this.recentSectionRefresh = g.refresh;
|
|
2772
|
+
const v = document.createElement("div");
|
|
2773
|
+
v.className = "color-picker-format-section";
|
|
2774
|
+
const m = document.createElement("select");
|
|
2775
|
+
m.className = "color-picker-format-select", this.select = m;
|
|
2776
|
+
const f = document.createElement("option");
|
|
2777
|
+
f.value = "hex", f.textContent = "HEX";
|
|
2718
2778
|
const C = document.createElement("option");
|
|
2719
|
-
C.value = "
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
const
|
|
2727
|
-
|
|
2728
|
-
const v = document.createElement("button");
|
|
2729
|
-
return v.className = "color-picker-copy-inside", v.textContent = "Copy", H.appendChild(I), H.appendChild(v), f.appendChild(g), f.appendChild(H), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(m.container), t.appendChild(f), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, d, I, g, v, l), t;
|
|
2779
|
+
C.value = "rgb", C.textContent = "RGB";
|
|
2780
|
+
const w = document.createElement("option");
|
|
2781
|
+
w.value = "hsl", w.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(w);
|
|
2782
|
+
const E = document.createElement("input");
|
|
2783
|
+
E.type = "text", E.className = "color-picker-color-input", E.value = this.currentColor, this.input = E;
|
|
2784
|
+
const k = document.createElement("div");
|
|
2785
|
+
k.className = "color-picker-input-container";
|
|
2786
|
+
const y = document.createElement("button");
|
|
2787
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", k.appendChild(E), k.appendChild(y), v.appendChild(m), v.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(g.container), t.appendChild(v), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, E, m, y, l), t;
|
|
2730
2788
|
}
|
|
2731
2789
|
createBackdrop() {
|
|
2732
2790
|
const t = document.createElement("div");
|
|
@@ -2735,44 +2793,44 @@ class Jt {
|
|
|
2735
2793
|
}), t;
|
|
2736
2794
|
}
|
|
2737
2795
|
bind(t, e, i, s, n, o, a) {
|
|
2738
|
-
const l = (
|
|
2739
|
-
var
|
|
2740
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2741
|
-
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${
|
|
2742
|
-
const
|
|
2743
|
-
this.currentColor =
|
|
2744
|
-
}, r = (
|
|
2745
|
-
var
|
|
2796
|
+
const l = (c) => {
|
|
2797
|
+
var C;
|
|
2798
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
2799
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2800
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = F(m, u, 1 - g);
|
|
2801
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
|
|
2802
|
+
}, r = (c) => {
|
|
2803
|
+
var C;
|
|
2746
2804
|
const d = e.getBoundingClientRect();
|
|
2747
|
-
let u = Math.max(0, Math.min(1, (
|
|
2805
|
+
let u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2748
2806
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2749
|
-
const
|
|
2750
|
-
this.currentColor =
|
|
2751
|
-
},
|
|
2752
|
-
var
|
|
2753
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2754
|
-
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (
|
|
2807
|
+
const g = u * 360, v = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), f = F(g, v, 1 - m);
|
|
2808
|
+
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, f, this.currentOpacity);
|
|
2809
|
+
}, p = (c) => {
|
|
2810
|
+
var g;
|
|
2811
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2812
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
|
|
2755
2813
|
};
|
|
2756
|
-
t.addEventListener("mousedown", (
|
|
2757
|
-
|
|
2758
|
-
const d = (
|
|
2814
|
+
t.addEventListener("mousedown", (c) => {
|
|
2815
|
+
c.preventDefault(), l(c);
|
|
2816
|
+
const d = (g) => l(g), u = () => {
|
|
2759
2817
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2760
2818
|
};
|
|
2761
2819
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2762
|
-
}), e.addEventListener("mousedown", (
|
|
2763
|
-
|
|
2764
|
-
const d = (
|
|
2820
|
+
}), e.addEventListener("mousedown", (c) => {
|
|
2821
|
+
c.preventDefault(), r(c);
|
|
2822
|
+
const d = (g) => r(g), u = () => {
|
|
2765
2823
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2766
2824
|
};
|
|
2767
2825
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2768
|
-
}), i.addEventListener("mousedown", (
|
|
2769
|
-
|
|
2770
|
-
const d = (
|
|
2826
|
+
}), i.addEventListener("mousedown", (c) => {
|
|
2827
|
+
c.preventDefault(), p(c);
|
|
2828
|
+
const d = (g) => p(g), u = () => {
|
|
2771
2829
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2772
2830
|
};
|
|
2773
2831
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2774
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2775
|
-
|
|
2832
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (c) => {
|
|
2833
|
+
c.key === "Enter" && (c.preventDefault(), this.syncInput(), s.blur());
|
|
2776
2834
|
}), o.addEventListener("click", async () => {
|
|
2777
2835
|
try {
|
|
2778
2836
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -2780,14 +2838,14 @@ class Jt {
|
|
|
2780
2838
|
s.select(), document.execCommand("copy");
|
|
2781
2839
|
}
|
|
2782
2840
|
}), a.addEventListener("click", async () => {
|
|
2783
|
-
var
|
|
2841
|
+
var c;
|
|
2784
2842
|
if (!("EyeDropper" in window)) {
|
|
2785
2843
|
alert("EyeDropper API is not supported in this browser.");
|
|
2786
2844
|
return;
|
|
2787
2845
|
}
|
|
2788
2846
|
try {
|
|
2789
2847
|
const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
|
|
2790
|
-
this.setColor(u), (
|
|
2848
|
+
this.setColor(u), (c = this.onChange) == null || c.call(this, u, this.currentOpacity);
|
|
2791
2849
|
} catch {
|
|
2792
2850
|
}
|
|
2793
2851
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2798,17 +2856,17 @@ class Jt {
|
|
|
2798
2856
|
setColor(t) {
|
|
2799
2857
|
var o;
|
|
2800
2858
|
this.currentColor = t;
|
|
2801
|
-
const { h: e, s: i, v: s } =
|
|
2859
|
+
const { h: e, s: i, v: s } = G(t), n = e >= 360 ? e % 360 : e;
|
|
2802
2860
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2803
2861
|
}
|
|
2804
2862
|
syncInput() {
|
|
2805
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2863
|
+
const t = this.select.value, { h: e, s: i, v: s } = G(this.currentColor);
|
|
2806
2864
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2807
2865
|
else if (t === "rgb") {
|
|
2808
|
-
const { r: n, g: o, b: a } =
|
|
2866
|
+
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
2809
2867
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2810
2868
|
} else {
|
|
2811
|
-
const { hue: n, sat: o, lightness: a } =
|
|
2869
|
+
const { hue: n, sat: o, lightness: a } = dt(e, i, s);
|
|
2812
2870
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2813
2871
|
o * 100
|
|
2814
2872
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -2827,276 +2885,233 @@ class Jt {
|
|
|
2827
2885
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2828
2886
|
if (s) {
|
|
2829
2887
|
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
2830
|
-
e =
|
|
2888
|
+
e = F(n, r, l);
|
|
2831
2889
|
}
|
|
2832
2890
|
}
|
|
2833
2891
|
}
|
|
2834
2892
|
e && this.setColor(e);
|
|
2835
2893
|
}
|
|
2836
2894
|
updateOpacityBg() {
|
|
2837
|
-
const { r: t, g: e, b: i } =
|
|
2895
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
2838
2896
|
this.opacitySlider.style.setProperty(
|
|
2839
2897
|
"--base-color",
|
|
2840
2898
|
`rgb(${t}, ${e}, ${i})`
|
|
2841
2899
|
);
|
|
2842
2900
|
}
|
|
2843
2901
|
open(t, e, i) {
|
|
2844
|
-
var
|
|
2902
|
+
var w;
|
|
2845
2903
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2846
|
-
const { h: s, s: n, v: o } =
|
|
2847
|
-
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}%`, (
|
|
2848
|
-
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(),
|
|
2849
|
-
let u = r.right + 8,
|
|
2850
|
-
const
|
|
2851
|
-
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2904
|
+
const { h: s, s: n, v: o } = G(t);
|
|
2905
|
+
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}%`, (w = this.recentSectionRefresh) == null || w.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);
|
|
2906
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, c = window.innerHeight, d = 16;
|
|
2907
|
+
let u = r.right + 8, g = r.top;
|
|
2908
|
+
const v = p - r.right, m = r.left;
|
|
2909
|
+
v >= a + d ? u = r.right + 8 : m >= a + d ? u = r.left - a - 8 : u = Math.max(d, (p - a) / 2);
|
|
2910
|
+
const f = c - r.bottom, C = r.top;
|
|
2911
|
+
f >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : f > C ? (g = r.bottom + 8, g + l > c - d && (g = c - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2854
2912
|
}
|
|
2855
2913
|
close(t) {
|
|
2856
2914
|
var e;
|
|
2857
|
-
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" && (
|
|
2915
|
+
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" && (B.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2858
2916
|
}
|
|
2859
2917
|
getElement() {
|
|
2860
2918
|
return this.element;
|
|
2861
2919
|
}
|
|
2862
2920
|
}
|
|
2863
|
-
class
|
|
2921
|
+
class Qt {
|
|
2864
2922
|
constructor(t) {
|
|
2865
|
-
this.
|
|
2923
|
+
this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
|
|
2866
2924
|
}
|
|
2867
|
-
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
<div class="color-picker-area embedded">
|
|
2871
|
-
<div class="color-picker-marker"></div>
|
|
2872
|
-
</div>
|
|
2873
|
-
<div class="color-picker-sliders-container embedded">
|
|
2874
|
-
<button class="color-picker-eyedropper">
|
|
2875
|
-
<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2876
|
-
<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"/>
|
|
2877
|
-
</svg>
|
|
2878
|
-
</button>
|
|
2879
|
-
<div class="color-picker-sliders-group">
|
|
2880
|
-
<div class="color-picker-hue embedded">
|
|
2881
|
-
<div class="color-picker-hue-marker"></div>
|
|
2882
|
-
</div>
|
|
2883
|
-
<div class="color-picker-opacity embedded">
|
|
2884
|
-
<div class="color-picker-opacity-marker"></div>
|
|
2885
|
-
</div>
|
|
2886
|
-
</div>
|
|
2887
|
-
</div>
|
|
2888
|
-
<div class="color-picker-format-section embedded">
|
|
2889
|
-
<select class="color-picker-format-select">
|
|
2890
|
-
<option value="hex">HEX</option>
|
|
2891
|
-
<option value="rgb">RGB</option>
|
|
2892
|
-
<option value="hsl">HSL</option>
|
|
2893
|
-
</select>
|
|
2894
|
-
<div class="color-picker-input-container">
|
|
2895
|
-
<input type="text" class="color-picker-color-input" />
|
|
2896
|
-
<button class="color-picker-copy-inside">Copy</button>
|
|
2897
|
-
</div>
|
|
2898
|
-
</div>
|
|
2899
|
-
`;
|
|
2900
|
-
const e = et((i) => {
|
|
2901
|
-
this.applyRecentColor(i);
|
|
2902
|
-
}, this.recentScope);
|
|
2903
|
-
return this.recentSectionRefresh = e.refresh, t.appendChild(e.container), t;
|
|
2904
|
-
}
|
|
2905
|
-
initializePicker() {
|
|
2906
|
-
this.colorArea = this.container.querySelector(
|
|
2907
|
-
".color-picker-area"
|
|
2908
|
-
), this.colorMarker = this.container.querySelector(
|
|
2909
|
-
".color-picker-marker"
|
|
2910
|
-
), this.hueSlider = this.container.querySelector(
|
|
2911
|
-
".color-picker-hue"
|
|
2912
|
-
), this.hueMarker = this.container.querySelector(
|
|
2913
|
-
".color-picker-hue-marker"
|
|
2914
|
-
), this.opacitySlider = this.container.querySelector(
|
|
2915
|
-
".color-picker-opacity"
|
|
2916
|
-
), this.opacityMarker = this.container.querySelector(
|
|
2917
|
-
".color-picker-opacity-marker"
|
|
2918
|
-
), this.formatSelect = this.container.querySelector(
|
|
2919
|
-
".color-picker-format-select"
|
|
2920
|
-
), this.colorInput = this.container.querySelector(
|
|
2921
|
-
".color-picker-color-input"
|
|
2922
|
-
);
|
|
2923
|
-
const t = this.container.querySelector(
|
|
2924
|
-
".color-picker-copy-inside"
|
|
2925
|
-
), { h: e, s: i, v: s } = $(this.currentColor);
|
|
2926
|
-
this.hueMarker.style.left = `${e / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${e}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput), this.setupColorAreaEvents(), this.setupHueSliderEvents(), this.setupOpacitySliderEvents(), this.setupFormatEvents(t);
|
|
2927
|
-
}
|
|
2928
|
-
scheduleInputUpdate() {
|
|
2929
|
-
this.inputUpdateTimeout && clearTimeout(this.inputUpdateTimeout), this.inputUpdateTimeout = window.setTimeout(() => {
|
|
2930
|
-
this.updateColorInput(this.formatSelect, this.colorInput);
|
|
2931
|
-
}, 16);
|
|
2932
|
-
}
|
|
2933
|
-
updateOpacityBackground(t) {
|
|
2934
|
-
const e = k(this.currentColor);
|
|
2935
|
-
t.style.setProperty(
|
|
2936
|
-
"--base-color",
|
|
2937
|
-
`rgb(${e.r}, ${e.g}, ${e.b})`
|
|
2938
|
-
);
|
|
2939
|
-
}
|
|
2940
|
-
updateColorInput(t, e) {
|
|
2941
|
-
switch (t.value) {
|
|
2942
|
-
case "hex":
|
|
2943
|
-
e.value = this.currentColor;
|
|
2944
|
-
break;
|
|
2945
|
-
case "rgb":
|
|
2946
|
-
const s = k(this.currentColor);
|
|
2947
|
-
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2948
|
-
break;
|
|
2949
|
-
case "hsl":
|
|
2950
|
-
const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
|
|
2951
|
-
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2952
|
-
r * 100
|
|
2953
|
-
)}%, ${Math.round(l * 100)}%)`;
|
|
2954
|
-
break;
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
applyRecentColor(t) {
|
|
2958
|
-
this.currentColor = t, t.includes("gradient") || t.includes("radial") || (this.updatePickerVisualState(), this.updateColorInput(this.formatSelect, this.colorInput)), this.triggerChange();
|
|
2925
|
+
parsePercentage(t) {
|
|
2926
|
+
const e = parseFloat(t);
|
|
2927
|
+
return isNaN(e) ? 0 : e / 100;
|
|
2959
2928
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2929
|
+
build() {
|
|
2930
|
+
const t = document.createElement("div");
|
|
2931
|
+
t.className = "embedded-color-picker";
|
|
2932
|
+
const e = document.createElement("div");
|
|
2933
|
+
e.className = "color-picker-area embedded", this.colorArea = e;
|
|
2934
|
+
const i = document.createElement("div");
|
|
2935
|
+
i.className = "color-picker-marker", this.colorMarker = i, e.appendChild(i);
|
|
2936
|
+
const s = document.createElement("div");
|
|
2937
|
+
s.className = "color-picker-sliders-container embedded";
|
|
2938
|
+
const n = document.createElement("button");
|
|
2939
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = vt;
|
|
2940
|
+
const o = document.createElement("div");
|
|
2941
|
+
o.className = "color-picker-sliders-group";
|
|
2942
|
+
const a = document.createElement("div");
|
|
2943
|
+
a.className = "color-picker-hue embedded", this.hueSlider = a;
|
|
2944
|
+
const l = document.createElement("div");
|
|
2945
|
+
l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
|
|
2946
|
+
const r = document.createElement("div");
|
|
2947
|
+
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
2948
|
+
const p = document.createElement("div");
|
|
2949
|
+
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
2950
|
+
const c = it((E) => {
|
|
2951
|
+
const k = I(E);
|
|
2952
|
+
k && k.type !== "solid" ? this.onColorChange(E, this.currentOpacity) : (this.setColor(E), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
2953
|
+
}, "all");
|
|
2954
|
+
this.recentSectionRefresh = c.refresh;
|
|
2955
|
+
const d = document.createElement("div");
|
|
2956
|
+
d.className = "color-picker-format-section embedded";
|
|
2957
|
+
const u = document.createElement("select");
|
|
2958
|
+
u.className = "color-picker-format-select", this.select = u;
|
|
2959
|
+
const g = document.createElement("option");
|
|
2960
|
+
g.value = "hex", g.textContent = "HEX";
|
|
2961
|
+
const v = document.createElement("option");
|
|
2962
|
+
v.value = "rgb", v.textContent = "RGB";
|
|
2963
|
+
const m = document.createElement("option");
|
|
2964
|
+
m.value = "hsl", m.textContent = "HSL", u.appendChild(g), u.appendChild(v), u.appendChild(m);
|
|
2965
|
+
const f = document.createElement("input");
|
|
2966
|
+
f.type = "text", f.className = "color-picker-color-input", this.input = f;
|
|
2967
|
+
const C = document.createElement("div");
|
|
2968
|
+
C.className = "color-picker-input-container";
|
|
2969
|
+
const w = document.createElement("button");
|
|
2970
|
+
return w.className = "color-picker-copy-inside", w.textContent = "Copy", C.appendChild(f), C.appendChild(w), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(c.container), this.bind(e, a, r, f, u, w, n), t;
|
|
2963
2971
|
}
|
|
2964
|
-
|
|
2965
|
-
const
|
|
2966
|
-
const
|
|
2967
|
-
this.colorMarker.style.left = `${
|
|
2968
|
-
const
|
|
2969
|
-
this.currentColor =
|
|
2972
|
+
bind(t, e, i, s, n, o, a) {
|
|
2973
|
+
const l = (c) => {
|
|
2974
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
2975
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2976
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = F(m, u, 1 - g);
|
|
2977
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
2978
|
+
}, r = (c) => {
|
|
2979
|
+
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2980
|
+
this.hueMarker.style.left = `${u * 100}%`;
|
|
2981
|
+
const g = u * 360, v = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), f = F(g, v, 1 - m);
|
|
2982
|
+
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
2983
|
+
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
2984
|
+
}, p = (c) => {
|
|
2985
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2986
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), this.queueChange();
|
|
2970
2987
|
};
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
const
|
|
2974
|
-
document.removeEventListener("mousemove",
|
|
2988
|
+
t.addEventListener("mousedown", (c) => {
|
|
2989
|
+
c.preventDefault(), this.isDragging = !0, l(c);
|
|
2990
|
+
const d = (g) => l(g), u = () => {
|
|
2991
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
2975
2992
|
};
|
|
2976
|
-
document.addEventListener("mousemove",
|
|
2977
|
-
})
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
const i = this.hueSlider.getBoundingClientRect();
|
|
2982
|
-
let s = (e.clientX - i.left) / i.width;
|
|
2983
|
-
s = Math.max(0, Math.min(1, s)), this.hueMarker.style.left = `${s * 100}%`;
|
|
2984
|
-
const n = Math.max(0, Math.min(360, s * 360)), o = parseFloat(
|
|
2985
|
-
this.colorMarker.style.left || "50%"
|
|
2986
|
-
), a = parseFloat(this.colorMarker.style.top || "50%"), l = Math.max(
|
|
2987
|
-
0,
|
|
2988
|
-
Math.min(1, (isNaN(o) ? 50 : o) / 100)
|
|
2989
|
-
), r = Math.max(
|
|
2990
|
-
0,
|
|
2991
|
-
Math.min(1, (isNaN(a) ? 50 : a) / 100)
|
|
2992
|
-
);
|
|
2993
|
-
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`;
|
|
2994
|
-
const h = G(n, l, 1 - r);
|
|
2995
|
-
this.currentColor = h, this.updateOpacityBackground(this.opacitySlider), this.triggerChange();
|
|
2996
|
-
};
|
|
2997
|
-
this.hueSlider.addEventListener("mousedown", (e) => {
|
|
2998
|
-
e.preventDefault(), t(e);
|
|
2999
|
-
const i = (n) => t(n), s = () => {
|
|
3000
|
-
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", s), this.inputUpdateTimeout && clearTimeout(this.inputUpdateTimeout), this.updateColorInput(this.formatSelect, this.colorInput);
|
|
2993
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2994
|
+
}), e.addEventListener("mousedown", (c) => {
|
|
2995
|
+
c.preventDefault(), this.isDragging = !0, r(c);
|
|
2996
|
+
const d = (g) => r(g), u = () => {
|
|
2997
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3001
2998
|
};
|
|
3002
|
-
document.addEventListener("mousemove",
|
|
3003
|
-
})
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
const i = this.opacitySlider.getBoundingClientRect(), s = Math.max(0, Math.min(1, (e.clientX - i.left) / i.width));
|
|
3008
|
-
this.opacityMarker.style.left = `${s * 100}%`, this.currentOpacity = Math.round(s * 100), this.triggerChange();
|
|
3009
|
-
};
|
|
3010
|
-
this.opacitySlider.addEventListener("mousedown", (e) => {
|
|
3011
|
-
e.preventDefault(), t(e);
|
|
3012
|
-
const i = (n) => t(n), s = () => {
|
|
3013
|
-
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", s);
|
|
2999
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3000
|
+
}), i.addEventListener("mousedown", (c) => {
|
|
3001
|
+
c.preventDefault(), this.isDragging = !0, p(c);
|
|
3002
|
+
const d = (g) => p(g), u = () => {
|
|
3003
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3014
3004
|
};
|
|
3015
|
-
document.addEventListener("mousemove",
|
|
3005
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3006
|
+
}), n.addEventListener("change", () => {
|
|
3007
|
+
this.syncInput();
|
|
3008
|
+
}), s.addEventListener("input", () => {
|
|
3009
|
+
this.applyFromInput();
|
|
3010
|
+
}), s.addEventListener("blur", () => {
|
|
3011
|
+
this.syncInput();
|
|
3012
|
+
}), s.addEventListener("keydown", (c) => {
|
|
3013
|
+
c.key === "Enter" && (c.preventDefault(), this.syncInput(), s.blur());
|
|
3014
|
+
}), o.addEventListener("click", async () => {
|
|
3015
|
+
try {
|
|
3016
|
+
await navigator.clipboard.writeText(s.value);
|
|
3017
|
+
} catch {
|
|
3018
|
+
s.select(), document.execCommand("copy");
|
|
3019
|
+
}
|
|
3020
|
+
}), a.addEventListener("click", async () => {
|
|
3021
|
+
if (!("EyeDropper" in window)) {
|
|
3022
|
+
alert("EyeDropper API is not supported in this browser.");
|
|
3023
|
+
return;
|
|
3024
|
+
}
|
|
3025
|
+
try {
|
|
3026
|
+
const c = new window.EyeDropper(), { sRGBHex: d } = await c.open();
|
|
3027
|
+
this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3028
|
+
} catch {
|
|
3029
|
+
}
|
|
3016
3030
|
});
|
|
3017
3031
|
}
|
|
3018
|
-
|
|
3019
|
-
this.
|
|
3020
|
-
|
|
3021
|
-
})
|
|
3022
|
-
|
|
3023
|
-
this.colorInput.select(), document.execCommand("copy");
|
|
3024
|
-
});
|
|
3025
|
-
}), this.colorInput.addEventListener("input", () => {
|
|
3026
|
-
this.handleManualColorInput(this.colorInput.value, this.formatSelect);
|
|
3027
|
-
}), this.colorInput.addEventListener("blur", () => {
|
|
3028
|
-
this.updateColorInput(this.formatSelect, this.colorInput);
|
|
3029
|
-
});
|
|
3032
|
+
setColor(t) {
|
|
3033
|
+
this.currentColor = t;
|
|
3034
|
+
const { h: e, s: i, v: s } = G(t), n = e >= 360 ? e % 360 : e;
|
|
3035
|
+
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3036
|
+
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3030
3037
|
}
|
|
3031
|
-
|
|
3032
|
-
const i =
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
break;
|
|
3044
|
-
}
|
|
3045
|
-
s || (s = this.autoDetectColorFormat(i)), s && (this.currentColor = s, this.updatePickerVisualState(), this.triggerChange());
|
|
3046
|
-
}
|
|
3047
|
-
parseHexInput(t) {
|
|
3048
|
-
const e = t.startsWith("#") ? t : `#${t}`;
|
|
3049
|
-
return B(e);
|
|
3050
|
-
}
|
|
3051
|
-
parseRgbInput(t) {
|
|
3052
|
-
const e = t.match(
|
|
3053
|
-
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/
|
|
3054
|
-
);
|
|
3055
|
-
if (e) {
|
|
3056
|
-
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
3057
|
-
if (i <= 255 && s <= 255 && n <= 255)
|
|
3058
|
-
return F(i, s, n);
|
|
3038
|
+
syncInput() {
|
|
3039
|
+
const t = this.select.value, { h: e, s: i, v: s } = G(this.currentColor);
|
|
3040
|
+
if (t === "hex")
|
|
3041
|
+
this.input.value = this.currentColor;
|
|
3042
|
+
else if (t === "rgb") {
|
|
3043
|
+
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
3044
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
3045
|
+
} else {
|
|
3046
|
+
const { hue: n, sat: o, lightness: a } = dt(e, i, s);
|
|
3047
|
+
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3048
|
+
o * 100
|
|
3049
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
3059
3050
|
}
|
|
3060
|
-
return null;
|
|
3061
3051
|
}
|
|
3062
|
-
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3065
|
-
)
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3052
|
+
applyFromInput() {
|
|
3053
|
+
const t = this.input.value.trim();
|
|
3054
|
+
let e = "";
|
|
3055
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(t))
|
|
3056
|
+
e = t;
|
|
3057
|
+
else {
|
|
3058
|
+
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3059
|
+
if (i) {
|
|
3060
|
+
const s = parseInt(i[1], 10), n = parseInt(i[2], 10), o = parseInt(i[3], 10);
|
|
3061
|
+
s <= 255 && n <= 255 && o <= 255 && (e = "#" + [s, n, o].map((a) => a.toString(16).padStart(2, "0")).join(""));
|
|
3062
|
+
} else {
|
|
3063
|
+
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3064
|
+
if (s) {
|
|
3065
|
+
const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
3066
|
+
e = F(n, r, l);
|
|
3067
|
+
}
|
|
3071
3068
|
}
|
|
3072
3069
|
}
|
|
3073
|
-
|
|
3070
|
+
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3074
3071
|
}
|
|
3075
|
-
|
|
3076
|
-
const e = this.
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
return s || null;
|
|
3072
|
+
updateOpacityBg() {
|
|
3073
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
3074
|
+
this.opacitySlider.style.setProperty(
|
|
3075
|
+
"--base-color",
|
|
3076
|
+
`rgb(${t}, ${e}, ${i})`
|
|
3077
|
+
);
|
|
3082
3078
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3079
|
+
queueChange() {
|
|
3080
|
+
this.changeRafId === void 0 && (this.changeRafId = window.requestAnimationFrame(() => {
|
|
3081
|
+
this.changeRafId = void 0, this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3082
|
+
}));
|
|
3086
3083
|
}
|
|
3087
|
-
|
|
3088
|
-
this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3084
|
+
flushChange() {
|
|
3085
|
+
this.changeRafId !== void 0 && (cancelAnimationFrame(this.changeRafId), this.changeRafId = void 0), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3086
|
+
}
|
|
3087
|
+
applyPendingExternal() {
|
|
3088
|
+
if (!this.pendingExternalUpdate) return;
|
|
3089
|
+
const { color: t, opacity: e } = this.pendingExternalUpdate;
|
|
3090
|
+
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
3091
|
+
}
|
|
3092
|
+
initFromColor(t, e) {
|
|
3093
|
+
var a;
|
|
3094
|
+
this.currentColor = t, this.currentOpacity = e;
|
|
3095
|
+
const { h: i, s, v: n } = G(t), o = i >= 360 ? i % 360 : i;
|
|
3096
|
+
this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3097
|
+
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (a = this.recentSectionRefresh) == null || a.call(this);
|
|
3098
|
+
}
|
|
3099
|
+
commitRecentColor() {
|
|
3100
|
+
var t;
|
|
3101
|
+
this.recentScope === "solid" && (B.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
3089
3102
|
}
|
|
3090
3103
|
getElement() {
|
|
3091
|
-
return this.
|
|
3104
|
+
return this.element;
|
|
3092
3105
|
}
|
|
3093
3106
|
updateColor(t, e) {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3107
|
+
if (this.isDragging) {
|
|
3108
|
+
this.pendingExternalUpdate = { color: t, opacity: e };
|
|
3109
|
+
return;
|
|
3110
|
+
}
|
|
3111
|
+
this.initFromColor(t, e);
|
|
3097
3112
|
}
|
|
3098
3113
|
}
|
|
3099
|
-
const
|
|
3114
|
+
const P = class P extends x {
|
|
3100
3115
|
constructor(t = {}) {
|
|
3101
3116
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3102
3117
|
super({
|
|
@@ -3107,17 +3122,17 @@ const N = class N extends w {
|
|
|
3107
3122
|
type: "text",
|
|
3108
3123
|
angle: "number",
|
|
3109
3124
|
stops: "text"
|
|
3110
|
-
}, 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.solidPicker = null, this.pendingSolidColor = null, this.onBackgroundClick = (i) => {
|
|
3125
|
+
}, 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.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
3111
3126
|
var d;
|
|
3112
3127
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3113
3128
|
const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((u) => u.contains(s)), r = s.closest(
|
|
3114
3129
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3115
|
-
), h = s.classList.contains(
|
|
3116
|
-
"color-picker-backdrop"
|
|
3117
3130
|
), p = s.classList.contains(
|
|
3131
|
+
"color-picker-backdrop"
|
|
3132
|
+
), c = s.classList.contains(
|
|
3118
3133
|
"gradient-popover-backdrop"
|
|
3119
3134
|
);
|
|
3120
|
-
!n && !o && !l && !r && !
|
|
3135
|
+
!n && !o && !l && !r && !p && !c && this.closePopover();
|
|
3121
3136
|
}, this.handlePopoverKeydown = (i) => {
|
|
3122
3137
|
if (this.isPopoverOpen) {
|
|
3123
3138
|
if (i.key === "Escape") {
|
|
@@ -3131,16 +3146,42 @@ const N = class N extends w {
|
|
|
3131
3146
|
i.preventDefault(), this.closePopover();
|
|
3132
3147
|
}
|
|
3133
3148
|
}
|
|
3134
|
-
}, this.detectChange = t.detectChange, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3149
|
+
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3150
|
+
}
|
|
3151
|
+
resolveGlobalVarColor(t) {
|
|
3152
|
+
if (t.startsWith("var(--")) {
|
|
3153
|
+
const e = t.replace("var(--", "").replace(")", "");
|
|
3154
|
+
return (x.GlobalVariables || {})[e] || t;
|
|
3155
|
+
}
|
|
3156
|
+
return t;
|
|
3157
|
+
}
|
|
3158
|
+
breakGlobalBinding() {
|
|
3159
|
+
if (!this.value || this.value.type !== "solid" || !this.value.stops.length)
|
|
3160
|
+
return;
|
|
3161
|
+
const e = this.value.stops[0].color;
|
|
3162
|
+
if (!e.startsWith("var(--"))
|
|
3163
|
+
return;
|
|
3164
|
+
const i = this.resolveGlobalVarColor(e);
|
|
3165
|
+
if (i === e) {
|
|
3166
|
+
console.warn(`Could not resolve global variable: ${e}`);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
this.value.stops[0].color = i, this.updateUI(), this.triggerChange(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
3135
3170
|
}
|
|
3136
3171
|
defaultValue() {
|
|
3137
3172
|
const t = this.originalDefault;
|
|
3138
3173
|
if (typeof t == "string") {
|
|
3139
|
-
|
|
3174
|
+
if (t.startsWith("var(--"))
|
|
3175
|
+
return O({
|
|
3176
|
+
type: "solid",
|
|
3177
|
+
angle: 0,
|
|
3178
|
+
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3179
|
+
});
|
|
3180
|
+
const i = I(t);
|
|
3140
3181
|
if (i)
|
|
3141
|
-
return
|
|
3182
|
+
return O(i);
|
|
3142
3183
|
}
|
|
3143
|
-
return
|
|
3184
|
+
return O(t && typeof t == "object" ? t : {
|
|
3144
3185
|
type: "linear",
|
|
3145
3186
|
angle: 90,
|
|
3146
3187
|
stops: [
|
|
@@ -3152,16 +3193,35 @@ const N = class N extends w {
|
|
|
3152
3193
|
setValue(t) {
|
|
3153
3194
|
var i, s;
|
|
3154
3195
|
let e = null;
|
|
3155
|
-
typeof t == "string" ?
|
|
3196
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = O({
|
|
3197
|
+
type: "solid",
|
|
3198
|
+
angle: 0,
|
|
3199
|
+
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3200
|
+
}) : e = I(t) : t && typeof t == "object" && (e = O(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
|
|
3156
3201
|
}
|
|
3157
3202
|
updateUI() {
|
|
3158
3203
|
if (this.previewEl && this.value)
|
|
3159
3204
|
if (this.value.type === "solid") {
|
|
3160
|
-
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3161
|
-
this.previewEl.style.background =
|
|
3162
|
-
} else
|
|
3163
|
-
|
|
3164
|
-
|
|
3205
|
+
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3206
|
+
this.previewEl.style.background = pt(i, e);
|
|
3207
|
+
} else {
|
|
3208
|
+
const t = this.resolveGradientGlobalVars(this.value);
|
|
3209
|
+
this.previewEl.style.background = T(t);
|
|
3210
|
+
}
|
|
3211
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = J(this.value)), this.updateUnlinkButtonVisibility();
|
|
3212
|
+
}
|
|
3213
|
+
resolveGradientGlobalVars(t) {
|
|
3214
|
+
return {
|
|
3215
|
+
...t,
|
|
3216
|
+
stops: t.stops.map((e) => ({
|
|
3217
|
+
...e,
|
|
3218
|
+
color: this.resolveGlobalVarColor(e.color)
|
|
3219
|
+
}))
|
|
3220
|
+
};
|
|
3221
|
+
}
|
|
3222
|
+
updateUnlinkButtonVisibility() {
|
|
3223
|
+
if (!this.unlinkButton || !this.value) return;
|
|
3224
|
+
this.value.type === "solid" && this.value.stops.length > 0 && this.value.stops[0].color.startsWith("var(--") ? this.unlinkButton.classList.add("visible") : this.unlinkButton.classList.remove("visible");
|
|
3165
3225
|
}
|
|
3166
3226
|
cssForTextValue() {
|
|
3167
3227
|
return this.value ? {
|
|
@@ -3183,7 +3243,7 @@ const N = class N extends w {
|
|
|
3183
3243
|
const e = document.createElement("div");
|
|
3184
3244
|
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? T(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
3185
3245
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3186
|
-
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ?
|
|
3246
|
+
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? J(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3187
3247
|
if (this.isEditing = !0, this.value)
|
|
3188
3248
|
if (this.value.type === "solid") {
|
|
3189
3249
|
const i = this.value.stops[0];
|
|
@@ -3199,44 +3259,64 @@ const N = class N extends w {
|
|
|
3199
3259
|
} else
|
|
3200
3260
|
this.inputEl.value = T(this.value);
|
|
3201
3261
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3202
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3262
|
+
this.isEditing = !1, this.value && (this.inputEl.value = J(this.value));
|
|
3203
3263
|
}), this.inputEl.addEventListener(
|
|
3204
3264
|
"paste",
|
|
3205
3265
|
(i) => this.handlePaste(i)
|
|
3206
3266
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3207
3267
|
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = T(this.value)), this.inputEl.blur());
|
|
3208
|
-
}), e.appendChild(this.previewEl),
|
|
3268
|
+
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = Kt, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
3269
|
+
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3270
|
+
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3209
3271
|
}
|
|
3210
3272
|
createPopover() {
|
|
3273
|
+
var l, r, p;
|
|
3211
3274
|
if (this.popoverEl) return;
|
|
3212
|
-
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (
|
|
3213
|
-
|
|
3214
|
-
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (
|
|
3215
|
-
|
|
3275
|
+
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (c) => {
|
|
3276
|
+
c.preventDefault(), c.stopPropagation(), this.closePopover();
|
|
3277
|
+
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (c) => {
|
|
3278
|
+
c.stopPropagation();
|
|
3216
3279
|
});
|
|
3217
3280
|
const t = document.createElement("div");
|
|
3218
3281
|
t.className = "gradient-popover-header", t.style.cursor = "move";
|
|
3219
|
-
|
|
3220
|
-
|
|
3282
|
+
let e = null;
|
|
3283
|
+
if (this.variant !== "global") {
|
|
3284
|
+
e = document.createElement("div"), e.className = "color-setting-tabs header-tabs";
|
|
3285
|
+
const c = document.createElement("button");
|
|
3286
|
+
c.className = "color-tab active", c.textContent = "Custom";
|
|
3287
|
+
const d = document.createElement("button");
|
|
3288
|
+
d.className = "color-tab", d.textContent = "Global", e.appendChild(c), e.appendChild(d), t.appendChild(e);
|
|
3289
|
+
} else {
|
|
3290
|
+
const c = document.createElement("div");
|
|
3291
|
+
t.appendChild(c);
|
|
3292
|
+
}
|
|
3221
3293
|
const i = document.createElement("button");
|
|
3222
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3223
|
-
this.popoverPosition = { left:
|
|
3294
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = mt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), ht(t, this.popoverEl, (c, d) => {
|
|
3295
|
+
this.popoverPosition = { left: c, top: d };
|
|
3224
3296
|
});
|
|
3225
3297
|
const s = document.createElement("div");
|
|
3226
3298
|
s.className = "gradient-editor";
|
|
3227
|
-
const n =
|
|
3228
|
-
|
|
3229
|
-
const o =
|
|
3230
|
-
|
|
3299
|
+
const n = document.createElement("div");
|
|
3300
|
+
n.className = "type-tabs-wrapper";
|
|
3301
|
+
const o = this.createTypeTabs();
|
|
3302
|
+
n.appendChild(o), s.appendChild(n);
|
|
3303
|
+
const a = document.createElement("div");
|
|
3304
|
+
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
3305
|
+
const c = e.children[0], d = e.children[1], u = (g) => {
|
|
3306
|
+
this.currentMode = g, g === "custom" ? (c.classList.add("active"), d.classList.remove("active"), n.style.display = "block") : (d.classList.add("active"), c.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
|
|
3307
|
+
};
|
|
3308
|
+
c.addEventListener("click", () => u("custom")), d.addEventListener("click", () => u("global")), (p = (r = (l = this.value) == null ? void 0 : l.stops) == null ? void 0 : r[0]) != null && p.color.startsWith("var(--") ? (this.currentMode = "global", u("global")) : (this.currentMode = "custom", u("custom"));
|
|
3309
|
+
}
|
|
3310
|
+
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3231
3311
|
}
|
|
3232
3312
|
createTypeTabs() {
|
|
3233
3313
|
var s, n;
|
|
3234
3314
|
const t = document.createElement("div");
|
|
3235
3315
|
t.className = "gradient-type-tabs";
|
|
3236
3316
|
const e = document.createElement("button");
|
|
3237
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.
|
|
3317
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = Zt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
|
|
3238
3318
|
const i = document.createElement("button");
|
|
3239
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.
|
|
3319
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = Xt, i.style.minWidth = "32px", i.addEventListener("click", () => {
|
|
3240
3320
|
var a, l;
|
|
3241
3321
|
const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3242
3322
|
this.switchType(o);
|
|
@@ -3248,7 +3328,23 @@ const N = class N extends w {
|
|
|
3248
3328
|
if (this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3249
3329
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3250
3330
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3251
|
-
]), t !== "solid" && this.value.stops.length
|
|
3331
|
+
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3332
|
+
const n = this.value.stops[0].color;
|
|
3333
|
+
if (n.startsWith("var(--")) {
|
|
3334
|
+
const o = this.resolveGlobalVarColor(n), a = I(o);
|
|
3335
|
+
a && a.type !== "solid" && a.stops.length >= 2 ? (this.value.stops = a.stops, this.value.angle = a.angle, this.value.type = a.type) : (this.value.stops.push({
|
|
3336
|
+
color: "#786666",
|
|
3337
|
+
position: 100,
|
|
3338
|
+
opacity: 100
|
|
3339
|
+
}), this.value.angle = 90);
|
|
3340
|
+
} else
|
|
3341
|
+
this.value.stops.push({
|
|
3342
|
+
color: "#786666",
|
|
3343
|
+
position: 100,
|
|
3344
|
+
opacity: 100
|
|
3345
|
+
}), this.value.angle = 90;
|
|
3346
|
+
} else t !== "solid" && this.value.stops.length >= 2 && (this.value.angle || (this.value.angle = 90));
|
|
3347
|
+
if (this.popoverEl) {
|
|
3252
3348
|
const s = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3253
3349
|
s.forEach((a) => a.classList.remove("active"));
|
|
3254
3350
|
const n = s[0], o = s[1];
|
|
@@ -3258,16 +3354,97 @@ const N = class N extends w {
|
|
|
3258
3354
|
e && this.updatePopoverContent(e), this.updateUI(), this.triggerChange();
|
|
3259
3355
|
}
|
|
3260
3356
|
updatePopoverContent(t) {
|
|
3261
|
-
t.innerHTML = "", this.value
|
|
3357
|
+
if (t.innerHTML = "", !!this.value) {
|
|
3358
|
+
if (this.variant !== "global" && this.currentMode === "global") {
|
|
3359
|
+
this.renderGlobalColors(t);
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3362
|
+
this.value.type === "solid" ? this.renderSolid(t) : this.renderGradient(t);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
renderGlobalColors(t) {
|
|
3366
|
+
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3367
|
+
const e = this.value.stops[0], i = (c) => {
|
|
3368
|
+
c.innerHTML = "";
|
|
3369
|
+
let d = {};
|
|
3370
|
+
try {
|
|
3371
|
+
d = x.GlobalVariables || {};
|
|
3372
|
+
} catch (m) {
|
|
3373
|
+
console.warn("Could not access Setting.GlobalVariables", m);
|
|
3374
|
+
}
|
|
3375
|
+
if (!d || Object.keys(d).length === 0) {
|
|
3376
|
+
const m = document.createElement("div");
|
|
3377
|
+
m.textContent = "No global colors defined", m.style.fontSize = "12px", m.style.color = "#666", m.style.padding = "8px", c.appendChild(m);
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
const u = [
|
|
3381
|
+
{
|
|
3382
|
+
title: "Global Colors",
|
|
3383
|
+
keys: ["primary", "secondary", "tertiary", "accent", "background"]
|
|
3384
|
+
},
|
|
3385
|
+
{
|
|
3386
|
+
title: "Text Color",
|
|
3387
|
+
keys: ["text-dark", "text-light"]
|
|
3388
|
+
}
|
|
3389
|
+
], g = this.globalSearchQuery.toLowerCase();
|
|
3390
|
+
let v;
|
|
3391
|
+
this.globalLayoutMode === "list" ? (v = document.createElement("div"), v.className = "global-colors-list") : (v = document.createElement("div"), v.className = "global-colors-grid"), c.appendChild(v), u.forEach((m) => {
|
|
3392
|
+
const f = Object.entries(d).filter(([C]) => !m.keys.includes(C) && m.title !== "Global Colors" ? !1 : m.keys.includes(C) && C.toLowerCase().includes(g));
|
|
3393
|
+
f.length !== 0 && f.forEach(([C, w]) => {
|
|
3394
|
+
if (this.globalLayoutMode === "list") {
|
|
3395
|
+
const E = document.createElement("div");
|
|
3396
|
+
E.className = "global-color-row";
|
|
3397
|
+
const k = document.createElement("div");
|
|
3398
|
+
k.className = "global-color-circle";
|
|
3399
|
+
const y = this.resolveGlobalVarColor(w);
|
|
3400
|
+
k.style.background = y, e.color === `var(--${C})` && k.classList.add("selected");
|
|
3401
|
+
const b = document.createElement("span");
|
|
3402
|
+
b.className = "global-color-label", b.textContent = C.split("-").map((L) => L.charAt(0).toUpperCase() + L.slice(1)).join(" "), E.appendChild(k), E.appendChild(b), E.addEventListener("click", (L) => {
|
|
3403
|
+
L.preventDefault();
|
|
3404
|
+
const $ = `var(--${C})`;
|
|
3405
|
+
this.setValue($), this.pendingSolidColor = $, i(c);
|
|
3406
|
+
}), v.appendChild(E);
|
|
3407
|
+
} else {
|
|
3408
|
+
const E = document.createElement("div");
|
|
3409
|
+
E.className = "global-color-circle";
|
|
3410
|
+
const k = this.resolveGlobalVarColor(w);
|
|
3411
|
+
E.style.background = k, E.title = C.split("-").map((y) => y.charAt(0).toUpperCase() + y.slice(1)).join(" "), e.color === `var(--${C})` && E.classList.add("selected"), E.addEventListener("click", (y) => {
|
|
3412
|
+
y.preventDefault();
|
|
3413
|
+
const b = `var(--${C})`;
|
|
3414
|
+
this.setValue(b), this.pendingSolidColor = b, i(c);
|
|
3415
|
+
}), v.appendChild(E);
|
|
3416
|
+
}
|
|
3417
|
+
});
|
|
3418
|
+
});
|
|
3419
|
+
}, s = document.createElement("div");
|
|
3420
|
+
s.className = "global-controls-row";
|
|
3421
|
+
const n = document.createElement("div");
|
|
3422
|
+
n.className = "global-search-container";
|
|
3423
|
+
const o = document.createElement("span");
|
|
3424
|
+
o.className = "global-search-icon", o.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';
|
|
3425
|
+
const a = document.createElement("input");
|
|
3426
|
+
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
3427
|
+
const l = document.createElement("div");
|
|
3428
|
+
a.addEventListener("input", (c) => {
|
|
3429
|
+
this.globalSearchQuery = c.target.value, i(l);
|
|
3430
|
+
}), n.appendChild(o), n.appendChild(a);
|
|
3431
|
+
const r = document.createElement("button");
|
|
3432
|
+
r.className = "global-layout-toggle", r.type = "button";
|
|
3433
|
+
const p = () => {
|
|
3434
|
+
r.innerHTML = this.globalLayoutMode === "list" ? '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>';
|
|
3435
|
+
};
|
|
3436
|
+
p(), r.addEventListener("click", () => {
|
|
3437
|
+
this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", p(), i(l);
|
|
3438
|
+
}), s.appendChild(n), s.appendChild(r), t.appendChild(s), t.appendChild(l), i(l);
|
|
3262
3439
|
}
|
|
3263
3440
|
renderSolid(t) {
|
|
3264
3441
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3265
|
-
const e = this.value.stops[0], i = new
|
|
3266
|
-
initialColor: e.color,
|
|
3442
|
+
const e = this.value.stops[0], i = new Qt({
|
|
3443
|
+
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3267
3444
|
initialOpacity: e.opacity ?? 100,
|
|
3268
3445
|
onColorChange: (s, n) => {
|
|
3269
3446
|
if (this.value) {
|
|
3270
|
-
const o =
|
|
3447
|
+
const o = I(s);
|
|
3271
3448
|
if (o && o.type !== "solid") {
|
|
3272
3449
|
this.value = o, this.switchType(o.type);
|
|
3273
3450
|
return;
|
|
@@ -3280,60 +3457,62 @@ const N = class N extends w {
|
|
|
3280
3457
|
}
|
|
3281
3458
|
renderGradient(t) {
|
|
3282
3459
|
this.solidPicker = null;
|
|
3283
|
-
const e =
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3460
|
+
const e = this.variant !== "global";
|
|
3461
|
+
let i = null;
|
|
3462
|
+
if (e) {
|
|
3463
|
+
const c = document.createElement("div");
|
|
3464
|
+
c.className = "gradient-subtype-inline";
|
|
3465
|
+
const d = document.createElement("select");
|
|
3466
|
+
d.className = "gradient-subtype-select";
|
|
3467
|
+
const u = document.createElement("option");
|
|
3468
|
+
u.value = "linear", u.textContent = "Linear";
|
|
3469
|
+
const g = document.createElement("option");
|
|
3470
|
+
g.value = "radial", g.textContent = "Radial", d.appendChild(u), d.appendChild(g), d.value = this.value.type === "radial" ? "radial" : "linear", i = document.createElement("input"), i.type = "text", i.inputMode = "numeric", i.className = "gradient-degree-input", i.value = `${this.value.angle ?? 90}°`, i.style.width = "75px", i.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, i.value = "90°");
|
|
3471
|
+
const v = document.createElement("button");
|
|
3472
|
+
v.type = "button", v.className = "gradient-flip-btn", v.innerHTML = _t, d.addEventListener("change", () => {
|
|
3473
|
+
this.switchType(d.value === "radial" ? "radial" : "linear"), i && this.updateDegreeVisibility(i);
|
|
3474
|
+
}), i.addEventListener("focus", (m) => {
|
|
3475
|
+
const f = m.target;
|
|
3476
|
+
f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
|
|
3477
|
+
}), i.addEventListener("input", (m) => {
|
|
3478
|
+
const f = parseInt(m.target.value);
|
|
3479
|
+
!Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
|
|
3480
|
+
}), i.addEventListener("blur", (m) => {
|
|
3481
|
+
var w;
|
|
3482
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3483
|
+
const f = m.target;
|
|
3484
|
+
let C = parseInt(f.value);
|
|
3485
|
+
Number.isNaN(C) && (C = ((w = this.value) == null ? void 0 : w.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C), f.value = `${C}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3486
|
+
}), v.addEventListener("click", () => {
|
|
3487
|
+
!this.value || !this.value.stops || (this.value.stops.forEach((m) => {
|
|
3488
|
+
m.position = 100 - m.position;
|
|
3489
|
+
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(s), this.createHandles(n, s), this.updateStopsList(r), this.updateUI(), this.triggerChange());
|
|
3490
|
+
}), c.appendChild(d), c.appendChild(i), c.appendChild(v), t.appendChild(c), this.updateDegreeVisibility(i);
|
|
3491
|
+
}
|
|
3492
|
+
const s = document.createElement("div");
|
|
3493
|
+
s.className = "gradient-preview", this.updateGradientPreview(s);
|
|
3494
|
+
const n = document.createElement("div");
|
|
3495
|
+
n.className = "gradient-handles", s.appendChild(n), t.appendChild(s), this.createHandles(n, s);
|
|
3496
|
+
const o = document.createElement("div");
|
|
3497
|
+
o.className = "gradient-stops-header";
|
|
3498
|
+
const a = document.createElement("span");
|
|
3499
|
+
a.textContent = "Stops";
|
|
3500
|
+
const l = document.createElement("button");
|
|
3501
|
+
l.type = "button", l.className = "gradient-add-stop", l.textContent = "+", o.appendChild(a), o.appendChild(l);
|
|
3315
3502
|
const r = document.createElement("div");
|
|
3316
|
-
r.className = "gradient-
|
|
3317
|
-
const
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
p.textContent = "Stops";
|
|
3321
|
-
const d = document.createElement("button");
|
|
3322
|
-
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3323
|
-
const u = document.createElement("div");
|
|
3324
|
-
u.className = "gradient-stops", t.appendChild(h), t.appendChild(u), this.updateStopsList(u);
|
|
3325
|
-
const m = et((f) => {
|
|
3326
|
-
const g = P(f);
|
|
3327
|
-
g && (this.value = g, this.switchType(g.type), this.updateUI(), this.triggerChange());
|
|
3503
|
+
r.className = "gradient-stops", t.appendChild(o), t.appendChild(r), this.updateStopsList(r);
|
|
3504
|
+
const p = it((c) => {
|
|
3505
|
+
const d = I(c);
|
|
3506
|
+
d && (this.value = d, this.switchType(d.type), this.updateUI(), this.triggerChange());
|
|
3328
3507
|
}, "all");
|
|
3329
|
-
this.recentGradientRefresh =
|
|
3330
|
-
var
|
|
3331
|
-
this.addStop(), this.updateStopsList(
|
|
3508
|
+
this.recentGradientRefresh = p.refresh, t.appendChild(p.container), l.addEventListener("click", () => {
|
|
3509
|
+
var c;
|
|
3510
|
+
this.addStop(), this.updateStopsList(r), this.updateGradientPreview(s), this.createHandles(n, s), this.updateUI(), ((c = document.activeElement) == null ? void 0 : c.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3332
3511
|
});
|
|
3333
3512
|
}
|
|
3334
3513
|
updateDegreeVisibility(t) {
|
|
3335
3514
|
var e;
|
|
3336
|
-
((e = this.value) == null ? void 0 : e.type) === "radial" ? (t.disabled = !0, t.style.opacity = "0.5") : (t.disabled = !1, t.style.opacity = "1");
|
|
3515
|
+
t && (((e = this.value) == null ? void 0 : e.type) === "radial" ? (t.disabled = !0, t.style.opacity = "0.5") : (t.disabled = !1, t.style.opacity = "1"));
|
|
3337
3516
|
}
|
|
3338
3517
|
updateGradientPreview(t) {
|
|
3339
3518
|
var i;
|
|
@@ -3352,24 +3531,24 @@ const N = class N extends w {
|
|
|
3352
3531
|
const o = document.createElement("div");
|
|
3353
3532
|
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o);
|
|
3354
3533
|
let a = !1, l = 0, r = 0;
|
|
3355
|
-
const
|
|
3356
|
-
a = !0, l = u.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove",
|
|
3357
|
-
},
|
|
3534
|
+
const p = (u) => {
|
|
3535
|
+
a = !0, l = u.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", c), document.addEventListener("mouseup", d), u.preventDefault(), u.stopPropagation();
|
|
3536
|
+
}, c = (u) => {
|
|
3358
3537
|
if (!a || !this.value) return;
|
|
3359
|
-
const
|
|
3360
|
-
let
|
|
3361
|
-
|
|
3538
|
+
const g = e.getBoundingClientRect(), v = u.clientX - l;
|
|
3539
|
+
let m = r + v / g.width * 100;
|
|
3540
|
+
m = Math.max(0, Math.min(100, m)), this.value.stops[s].position = Math.round(m), n.style.left = `${m}%`, this.updateGradientPreview();
|
|
3362
3541
|
}, d = () => {
|
|
3363
|
-
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
3542
|
+
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((u, g) => u.position - g.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange());
|
|
3364
3543
|
};
|
|
3365
|
-
n.addEventListener("mousedown",
|
|
3544
|
+
n.addEventListener("mousedown", p), t.appendChild(n);
|
|
3366
3545
|
});
|
|
3367
3546
|
}
|
|
3368
3547
|
updateStopsList(t) {
|
|
3369
3548
|
var i;
|
|
3370
3549
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3371
3550
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3372
|
-
var
|
|
3551
|
+
var E, k;
|
|
3373
3552
|
const o = document.createElement("div");
|
|
3374
3553
|
o.className = "gstop-row";
|
|
3375
3554
|
const a = document.createElement("div");
|
|
@@ -3378,90 +3557,90 @@ const N = class N extends w {
|
|
|
3378
3557
|
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
3379
3558
|
const r = document.createElement("div");
|
|
3380
3559
|
r.className = "gstop-color-container";
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3383
|
-
const
|
|
3384
|
-
|
|
3560
|
+
const p = document.createElement("div");
|
|
3561
|
+
p.className = "gstop-color-preview", p.style.backgroundColor = s.color;
|
|
3562
|
+
const c = document.createElement("input");
|
|
3563
|
+
c.type = "text", c.className = "gstop-color-input", c.value = s.color.replace("#", "").toUpperCase();
|
|
3385
3564
|
const d = document.createElement("button");
|
|
3386
|
-
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(
|
|
3565
|
+
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(p), r.appendChild(c), r.appendChild(d);
|
|
3387
3566
|
const u = document.createElement("button");
|
|
3388
|
-
u.type = "button", u.className = "gstop-del", u.innerHTML =
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3391
|
-
const
|
|
3392
|
-
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3395
|
-
const
|
|
3396
|
-
|
|
3567
|
+
u.type = "button", u.className = "gstop-del", u.innerHTML = Jt, u.disabled = (((k = (E = this.value) == null ? void 0 : E.stops) == null ? void 0 : k.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(u), e.appendChild(o);
|
|
3568
|
+
const g = document.createElement("span");
|
|
3569
|
+
g.className = "gstop-opacity-label", g.textContent = "Opacity";
|
|
3570
|
+
const v = document.createElement("div");
|
|
3571
|
+
v.className = "gstop-opacity-group";
|
|
3572
|
+
const m = document.createElement("input");
|
|
3573
|
+
m.type = "range", m.className = "gstop-opacity-slider", m.min = "0", m.max = "100", m.value = String(s.opacity ?? 100);
|
|
3574
|
+
const f = S(s.color);
|
|
3575
|
+
m.style.setProperty(
|
|
3397
3576
|
"--slider-color",
|
|
3398
|
-
`rgb(${
|
|
3577
|
+
`rgb(${f.r}, ${f.g}, ${f.b})`
|
|
3399
3578
|
);
|
|
3400
|
-
const
|
|
3401
|
-
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3404
|
-
const
|
|
3405
|
-
|
|
3579
|
+
const C = document.createElement("span");
|
|
3580
|
+
C.className = "gstop-opacity-value", C.textContent = `${s.opacity ?? 100}%`, v.appendChild(m), v.appendChild(C);
|
|
3581
|
+
const w = new Yt((y, b) => {
|
|
3582
|
+
c.value = y.replace("#", "").toUpperCase(), p.style.backgroundColor = y, this.value.stops[n].color = y, b !== void 0 && (this.value.stops[n].opacity = b, m.value = String(b), C.textContent = `${b}%`);
|
|
3583
|
+
const L = S(y);
|
|
3584
|
+
m.style.setProperty(
|
|
3406
3585
|
"--slider-color",
|
|
3407
|
-
`rgb(${
|
|
3586
|
+
`rgb(${L.r}, ${L.g}, ${L.b})`
|
|
3408
3587
|
), this.updateGradientPreview(), this.createHandles(
|
|
3409
3588
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3410
3589
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3411
3590
|
), this.updateUI(), this.triggerChange();
|
|
3412
3591
|
}, "solid");
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
}),
|
|
3416
|
-
const
|
|
3417
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3418
|
-
this.value.stops[n].color =
|
|
3419
|
-
const
|
|
3420
|
-
|
|
3592
|
+
c.addEventListener("click", (y) => {
|
|
3593
|
+
y.preventDefault(), y.stopPropagation(), w.open(s.color, c, s.opacity ?? 100);
|
|
3594
|
+
}), c.addEventListener("input", () => {
|
|
3595
|
+
const y = c.value.trim(), b = y.startsWith("#") ? y : `#${y}`;
|
|
3596
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(b)) {
|
|
3597
|
+
this.value.stops[n].color = b, p.style.backgroundColor = b;
|
|
3598
|
+
const L = S(b);
|
|
3599
|
+
m.style.setProperty(
|
|
3421
3600
|
"--slider-color",
|
|
3422
|
-
`rgb(${
|
|
3601
|
+
`rgb(${L.r}, ${L.g}, ${L.b})`
|
|
3423
3602
|
), this.debouncedPreviewUpdate();
|
|
3424
3603
|
}
|
|
3425
|
-
}),
|
|
3604
|
+
}), c.addEventListener("blur", () => {
|
|
3426
3605
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3427
|
-
}), d.addEventListener("click", async (
|
|
3428
|
-
|
|
3606
|
+
}), d.addEventListener("click", async (y) => {
|
|
3607
|
+
y.stopPropagation();
|
|
3429
3608
|
try {
|
|
3430
|
-
await navigator.clipboard.writeText(`#${
|
|
3609
|
+
await navigator.clipboard.writeText(`#${c.value}`);
|
|
3431
3610
|
} catch {
|
|
3432
3611
|
}
|
|
3433
|
-
}), l.addEventListener("focus", (
|
|
3434
|
-
const
|
|
3435
|
-
|
|
3436
|
-
}), l.addEventListener("input", (
|
|
3437
|
-
const
|
|
3438
|
-
if (!Number.isNaN(
|
|
3439
|
-
const
|
|
3440
|
-
this.value.stops[n].position =
|
|
3612
|
+
}), l.addEventListener("focus", (y) => {
|
|
3613
|
+
const b = y.target;
|
|
3614
|
+
b.value = b.value.replace("%", ""), b.select();
|
|
3615
|
+
}), l.addEventListener("input", (y) => {
|
|
3616
|
+
const b = y.target, L = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3617
|
+
if (!Number.isNaN(L)) {
|
|
3618
|
+
const $ = Math.max(0, Math.min(100, L));
|
|
3619
|
+
this.value.stops[n].position = $, b.value = `${$}%`, this.debouncedPreviewUpdate();
|
|
3441
3620
|
}
|
|
3442
|
-
}), l.addEventListener("blur", (
|
|
3621
|
+
}), l.addEventListener("blur", (y) => {
|
|
3443
3622
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3444
|
-
const
|
|
3445
|
-
if (Number.isNaN(
|
|
3446
|
-
|
|
3623
|
+
const b = y.target, L = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3624
|
+
if (Number.isNaN(L))
|
|
3625
|
+
b.value = `${this.value.stops[n].position}%`;
|
|
3447
3626
|
else {
|
|
3448
|
-
const
|
|
3449
|
-
this.value.stops[n].position =
|
|
3627
|
+
const $ = Math.max(0, Math.min(100, L));
|
|
3628
|
+
this.value.stops[n].position = $, b.value = `${$}%`;
|
|
3450
3629
|
}
|
|
3451
3630
|
this.updateGradientPreview(), this.createHandles(
|
|
3452
3631
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3453
3632
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3454
3633
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3455
3634
|
}), u.addEventListener("click", () => {
|
|
3456
|
-
var
|
|
3635
|
+
var y;
|
|
3457
3636
|
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(n, 1), this.createHandles(
|
|
3458
3637
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3459
3638
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3460
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
3461
|
-
}),
|
|
3462
|
-
const
|
|
3463
|
-
this.value.stops[n].opacity = Math.max(0, Math.min(100,
|
|
3464
|
-
}),
|
|
3639
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((y = document.activeElement) == null ? void 0 : y.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3640
|
+
}), m.addEventListener("input", () => {
|
|
3641
|
+
const y = parseInt(m.value, 10);
|
|
3642
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, y)), C.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3643
|
+
}), m.addEventListener("change", () => {
|
|
3465
3644
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3466
3645
|
});
|
|
3467
3646
|
}));
|
|
@@ -3484,14 +3663,14 @@ const N = class N extends w {
|
|
|
3484
3663
|
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3485
3664
|
}
|
|
3486
3665
|
openPopover() {
|
|
3487
|
-
if (this.popoverEl && (
|
|
3488
|
-
if (this.isPopoverOpen = !0,
|
|
3666
|
+
if (this.popoverEl && (P.openInstance && P.openInstance !== this && P.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3667
|
+
if (this.isPopoverOpen = !0, P.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3489
3668
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3490
3669
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3491
3670
|
const o = this.popoverEl.offsetHeight;
|
|
3492
3671
|
let a = t.right + 8, l = t.top;
|
|
3493
|
-
const r = i - t.right,
|
|
3494
|
-
r <
|
|
3672
|
+
const r = i - t.right, p = t.left, c = e + n;
|
|
3673
|
+
r < c && p > r + 100 && (a = t.left - e - 8);
|
|
3495
3674
|
const d = s - t.bottom, u = t.top;
|
|
3496
3675
|
u >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : u > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
|
|
3497
3676
|
}
|
|
@@ -3514,10 +3693,10 @@ const N = class N extends w {
|
|
|
3514
3693
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3515
3694
|
const a = this.popoverEl.offsetHeight;
|
|
3516
3695
|
let l = e.right + 8, r = e.top;
|
|
3517
|
-
const
|
|
3518
|
-
|
|
3519
|
-
const u = n - e.bottom,
|
|
3520
|
-
|
|
3696
|
+
const p = s - e.right, c = e.left, d = i + o;
|
|
3697
|
+
p < d && c > p + 100 && (l = e.left - i - 8);
|
|
3698
|
+
const u = n - e.bottom, g = e.top;
|
|
3699
|
+
g >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : g > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3521
3700
|
});
|
|
3522
3701
|
}
|
|
3523
3702
|
}
|
|
@@ -3536,13 +3715,13 @@ const N = class N extends w {
|
|
|
3536
3715
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3537
3716
|
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") {
|
|
3538
3717
|
const e = T(this.value);
|
|
3539
|
-
|
|
3718
|
+
B.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3540
3719
|
}
|
|
3541
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3720
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), P.openInstance === this && (P.openInstance = null);
|
|
3542
3721
|
}
|
|
3543
3722
|
}
|
|
3544
3723
|
commitPendingSolidColor() {
|
|
3545
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
3724
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : B.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3546
3725
|
}
|
|
3547
3726
|
handlePaste(t) {
|
|
3548
3727
|
var i;
|
|
@@ -3555,7 +3734,7 @@ const N = class N extends w {
|
|
|
3555
3734
|
this.parseAndSet(e.value);
|
|
3556
3735
|
}
|
|
3557
3736
|
parseAndSet(t) {
|
|
3558
|
-
const e =
|
|
3737
|
+
const e = I(t.trim());
|
|
3559
3738
|
e && this.setValue(e);
|
|
3560
3739
|
}
|
|
3561
3740
|
triggerChange() {
|
|
@@ -3566,7 +3745,7 @@ const N = class N extends w {
|
|
|
3566
3745
|
return this.element;
|
|
3567
3746
|
}
|
|
3568
3747
|
getValue() {
|
|
3569
|
-
return
|
|
3748
|
+
return this.value ? T(this.value) : "";
|
|
3570
3749
|
}
|
|
3571
3750
|
getCSSValue() {
|
|
3572
3751
|
return this.value ? T(this.value) : "";
|
|
@@ -3578,36 +3757,36 @@ const N = class N extends w {
|
|
|
3578
3757
|
return this.value;
|
|
3579
3758
|
}
|
|
3580
3759
|
};
|
|
3581
|
-
|
|
3582
|
-
let
|
|
3583
|
-
const
|
|
3760
|
+
P.openInstance = null;
|
|
3761
|
+
let X = P;
|
|
3762
|
+
const te = `
|
|
3584
3763
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3585
3764
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3586
3765
|
</svg>
|
|
3587
|
-
`,
|
|
3766
|
+
`, ee = `
|
|
3588
3767
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3589
3768
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3590
3769
|
</svg>
|
|
3591
3770
|
`;
|
|
3592
|
-
class
|
|
3771
|
+
class xe extends H {
|
|
3593
3772
|
constructor(t) {
|
|
3594
3773
|
super({
|
|
3595
3774
|
title: "Border",
|
|
3596
3775
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3597
3776
|
settings: {
|
|
3598
|
-
size: new
|
|
3777
|
+
size: new V({
|
|
3599
3778
|
title: "Size",
|
|
3600
|
-
icon:
|
|
3779
|
+
icon: ee,
|
|
3601
3780
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3602
3781
|
suffix: "px"
|
|
3603
3782
|
}),
|
|
3604
|
-
color: new
|
|
3783
|
+
color: new X({
|
|
3605
3784
|
title: "Border Color",
|
|
3606
3785
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3607
3786
|
}),
|
|
3608
|
-
radius: new
|
|
3787
|
+
radius: new V({
|
|
3609
3788
|
title: "Radius",
|
|
3610
|
-
icon:
|
|
3789
|
+
icon: te,
|
|
3611
3790
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3612
3791
|
suffix: "px"
|
|
3613
3792
|
})
|
|
@@ -3618,7 +3797,7 @@ class ye extends V {
|
|
|
3618
3797
|
const t = super.getValues(), e = this.settings.color.getValue();
|
|
3619
3798
|
return {
|
|
3620
3799
|
...t,
|
|
3621
|
-
color: e ? `${e}` : t.color
|
|
3800
|
+
color: e ? `${e} 1` : t.color
|
|
3622
3801
|
};
|
|
3623
3802
|
}
|
|
3624
3803
|
getCssCode() {
|
|
@@ -3631,20 +3810,20 @@ class ye extends V {
|
|
|
3631
3810
|
`;
|
|
3632
3811
|
}
|
|
3633
3812
|
}
|
|
3634
|
-
const
|
|
3813
|
+
const ie = `
|
|
3635
3814
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3636
3815
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3637
3816
|
</svg>
|
|
3638
|
-
`,
|
|
3817
|
+
`, se = `
|
|
3639
3818
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3640
3819
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3641
3820
|
</svg>
|
|
3642
|
-
`,
|
|
3821
|
+
`, ne = `
|
|
3643
3822
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3644
3823
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3645
3824
|
</svg>
|
|
3646
3825
|
`;
|
|
3647
|
-
class
|
|
3826
|
+
class Le extends H {
|
|
3648
3827
|
constructor(t = {}) {
|
|
3649
3828
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3650
3829
|
super({
|
|
@@ -3652,13 +3831,13 @@ class Ee extends V {
|
|
|
3652
3831
|
collapsed: i.collapsed,
|
|
3653
3832
|
settings: (() => {
|
|
3654
3833
|
const s = {
|
|
3655
|
-
color: new
|
|
3834
|
+
color: new X({
|
|
3656
3835
|
title: "Color",
|
|
3657
3836
|
default: i.colorDefault ?? "#001E1E"
|
|
3658
3837
|
}),
|
|
3659
3838
|
fontFamily: new tt({
|
|
3660
3839
|
title: "Font",
|
|
3661
|
-
icon:
|
|
3840
|
+
icon: ie,
|
|
3662
3841
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3663
3842
|
options: i.fontFamilyOptions ?? [
|
|
3664
3843
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3671,7 +3850,7 @@ class Ee extends V {
|
|
|
3671
3850
|
}),
|
|
3672
3851
|
fontWeight: new tt({
|
|
3673
3852
|
title: "Weight",
|
|
3674
|
-
icon:
|
|
3853
|
+
icon: se,
|
|
3675
3854
|
default: i.fontWeightDefault ?? "400",
|
|
3676
3855
|
options: i.fontWeightOptions ?? [
|
|
3677
3856
|
{ name: "Regular", value: "400" },
|
|
@@ -3681,9 +3860,9 @@ class Ee extends V {
|
|
|
3681
3860
|
getOptions: i.fontWeightGetOptions,
|
|
3682
3861
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3683
3862
|
}),
|
|
3684
|
-
fontSize: new
|
|
3863
|
+
fontSize: new V({
|
|
3685
3864
|
title: "Size",
|
|
3686
|
-
icon:
|
|
3865
|
+
icon: ne,
|
|
3687
3866
|
default: i.fontSizeDefault ?? 12,
|
|
3688
3867
|
suffix: "px",
|
|
3689
3868
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3691,7 +3870,7 @@ class Ee extends V {
|
|
|
3691
3870
|
};
|
|
3692
3871
|
return e ? {
|
|
3693
3872
|
...s,
|
|
3694
|
-
align: new
|
|
3873
|
+
align: new Vt({
|
|
3695
3874
|
title: "Align",
|
|
3696
3875
|
default: i.alignDefault ?? "center"
|
|
3697
3876
|
})
|
|
@@ -3723,7 +3902,7 @@ class Ee extends V {
|
|
|
3723
3902
|
`;
|
|
3724
3903
|
}
|
|
3725
3904
|
}
|
|
3726
|
-
class j extends
|
|
3905
|
+
class j extends x {
|
|
3727
3906
|
constructor(t) {
|
|
3728
3907
|
super({
|
|
3729
3908
|
...t,
|
|
@@ -3734,8 +3913,8 @@ class j extends w {
|
|
|
3734
3913
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
3735
3914
|
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
3736
3915
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3737
|
-
let
|
|
3738
|
-
|
|
3916
|
+
let p = Number(a.value);
|
|
3917
|
+
p < l && (p = l), p > r && (p = r), a.value = String(p);
|
|
3739
3918
|
}));
|
|
3740
3919
|
}, i = this.createInput({
|
|
3741
3920
|
value: this.value,
|
|
@@ -3769,7 +3948,7 @@ class j extends w {
|
|
|
3769
3948
|
}), i;
|
|
3770
3949
|
}
|
|
3771
3950
|
}
|
|
3772
|
-
class
|
|
3951
|
+
class ke extends H {
|
|
3773
3952
|
constructor(t) {
|
|
3774
3953
|
super({
|
|
3775
3954
|
title: "Margins",
|
|
@@ -3777,25 +3956,25 @@ class be extends V {
|
|
|
3777
3956
|
settings: {
|
|
3778
3957
|
marginTop: new j({
|
|
3779
3958
|
title: "Top",
|
|
3780
|
-
icon:
|
|
3959
|
+
icon: oe,
|
|
3781
3960
|
suffix: "px",
|
|
3782
3961
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3783
3962
|
}),
|
|
3784
3963
|
marginRight: new j({
|
|
3785
3964
|
title: "Right",
|
|
3786
|
-
icon:
|
|
3965
|
+
icon: ae,
|
|
3787
3966
|
suffix: "px",
|
|
3788
3967
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3789
3968
|
}),
|
|
3790
3969
|
marginBottom: new j({
|
|
3791
3970
|
title: "Bottom",
|
|
3792
|
-
icon:
|
|
3971
|
+
icon: le,
|
|
3793
3972
|
suffix: "px",
|
|
3794
3973
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3795
3974
|
}),
|
|
3796
3975
|
marginLeft: new j({
|
|
3797
3976
|
title: "Left",
|
|
3798
|
-
icon:
|
|
3977
|
+
icon: re,
|
|
3799
3978
|
suffix: "px",
|
|
3800
3979
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
3801
3980
|
})
|
|
@@ -3812,26 +3991,26 @@ class be extends V {
|
|
|
3812
3991
|
`;
|
|
3813
3992
|
}
|
|
3814
3993
|
}
|
|
3815
|
-
const
|
|
3994
|
+
const oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3816
3995
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3817
|
-
</svg>`,
|
|
3996
|
+
</svg>`, ae = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3818
3997
|
<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"/>
|
|
3819
|
-
</svg>`,
|
|
3998
|
+
</svg>`, le = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3820
3999
|
<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"/>
|
|
3821
|
-
</svg>`,
|
|
4000
|
+
</svg>`, re = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3822
4001
|
<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"/>
|
|
3823
4002
|
</svg>`;
|
|
3824
|
-
class
|
|
4003
|
+
class Me extends H {
|
|
3825
4004
|
constructor(t) {
|
|
3826
4005
|
super({
|
|
3827
4006
|
title: "Background Image",
|
|
3828
4007
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3829
4008
|
settings: {
|
|
3830
|
-
backgroundImage: new
|
|
4009
|
+
backgroundImage: new ct({
|
|
3831
4010
|
...t == null ? void 0 : t.uploadProps,
|
|
3832
4011
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3833
4012
|
}),
|
|
3834
|
-
opacity: new
|
|
4013
|
+
opacity: new Nt({
|
|
3835
4014
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3836
4015
|
}),
|
|
3837
4016
|
backgroundColor: new R({
|
|
@@ -3861,40 +4040,40 @@ class we extends V {
|
|
|
3861
4040
|
}
|
|
3862
4041
|
}
|
|
3863
4042
|
export {
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
4043
|
+
Vt as AlignSetting,
|
|
4044
|
+
we as AnimationSetting,
|
|
4045
|
+
Me as BackgroundSettingSet,
|
|
4046
|
+
xe as BorderSettingSet,
|
|
4047
|
+
pe as ButtonSetting,
|
|
4048
|
+
N as ColorSetting,
|
|
3870
4049
|
R as ColorWithOpacitySetting,
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
4050
|
+
ue as DimensionSetting,
|
|
4051
|
+
Ce as GapSetting,
|
|
4052
|
+
X as GradientSetting,
|
|
4053
|
+
Le as HeaderTypographySettingSet,
|
|
4054
|
+
ge as HeightSetting,
|
|
4055
|
+
de as HtmlSetting,
|
|
4056
|
+
ye as MarginBottomSetting,
|
|
4057
|
+
ke as MarginSettingGroup,
|
|
4058
|
+
be as MarginTopSetting,
|
|
4059
|
+
Ee as MultiLanguageSetting,
|
|
4060
|
+
V as NumberSetting,
|
|
4061
|
+
Nt as OpacitySetting,
|
|
4062
|
+
ve as SelectApiSettings,
|
|
3884
4063
|
tt as SelectSetting,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
4064
|
+
x as Setting,
|
|
4065
|
+
H as SettingGroup,
|
|
4066
|
+
Lt as StringSetting,
|
|
4067
|
+
wt as TabSettingGroup,
|
|
4068
|
+
wt as TabsSettingGroup,
|
|
4069
|
+
fe as Toggle,
|
|
4070
|
+
ct as UploadSetting,
|
|
4071
|
+
me as WidthSetting,
|
|
4072
|
+
he as asSettingGroupWithSettings,
|
|
4073
|
+
xt as createSettingGroup,
|
|
4074
|
+
ce as createTabSettingGroup,
|
|
4075
|
+
D as isSetting,
|
|
4076
|
+
nt as isSettingChild,
|
|
4077
|
+
M as isSettingGroup,
|
|
4078
|
+
z as iterateSettings
|
|
3900
4079
|
};
|