builder-settings-types 0.0.270 → 0.0.272
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +79 -72
- package/dist/builder-settings-types.es.js +1263 -1552
- package/dist/index.css +1 -1
- package/dist/settings/gradient-settings/GradientSetting.d.ts +48 -0
- package/dist/settings/gradient-settings/components/CustomColorPicker.d.ts +34 -0
- package/dist/settings/gradient-settings/components/EmbeddedColorPicker.d.ts +29 -0
- package/dist/settings/gradient-settings/index.d.ts +1 -1
- package/dist/settings/gradient-settings/parsers/gradientParser.d.ts +5 -0
- package/dist/settings/gradient-settings/recent/RecentColorManager.d.ts +12 -0
- package/dist/settings/gradient-settings/recent/createRecentColorsSection.d.ts +2 -0
- package/dist/settings/gradient-settings/utils/color.d.ts +29 -0
- package/dist/settings/gradient-settings/utils/dom.d.ts +1 -0
- package/dist/settings/gradient-settings/utils/icon.d.ts +4 -0
- package/dist/settings/gradient-settings/utils/types.d.ts +25 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/settings/gradient-settings/gradientSettings.d.ts +0 -84
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const ut = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let lt = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += ut[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function gt(c) {
|
|
9
|
+
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function U(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function Q(c, t = 0) {
|
|
19
|
+
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
U(s, n), Q(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const mt = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class ft {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...mt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class yt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = gt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class yt {
|
|
|
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 it = new ft();
|
|
115
|
+
function _(c) {
|
|
116
|
+
if (c === null || typeof c != "object") return c;
|
|
117
|
+
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
+
if (c instanceof Array) return c.map((t) => _(t));
|
|
119
|
+
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in c)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = _(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return c;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function vt(c) {
|
|
128
|
+
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,15 +142,15 @@ function Et(p) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class E {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || lt(), 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, E.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, E.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -171,8 +171,8 @@ class T {
|
|
|
171
171
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
172
172
|
}
|
|
173
173
|
clone() {
|
|
174
|
-
const t = this.constructor, e =
|
|
175
|
-
return i.value =
|
|
174
|
+
const t = this.constructor, e = _(this.props), i = new t(e);
|
|
175
|
+
return i.value = _(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -192,7 +192,7 @@ class T {
|
|
|
192
192
|
const i = document.createElement("div");
|
|
193
193
|
i.className = t.wrapperClassName || "";
|
|
194
194
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
195
|
+
this.inputEl = s, s.value = String(t.value || vt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
196
|
const n = (a) => {
|
|
197
197
|
const l = a.target;
|
|
198
198
|
let r = l.value;
|
|
@@ -233,31 +233,31 @@ class T {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
236
|
+
function B(c) {
|
|
237
|
+
return c instanceof E;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
239
|
+
function x(c) {
|
|
240
|
+
return c instanceof V;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function st(c) {
|
|
243
|
+
return B(c) || x(c);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
for (const e in
|
|
247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
248
|
-
const i =
|
|
245
|
+
function q(c, t) {
|
|
246
|
+
for (const e in c)
|
|
247
|
+
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
248
|
+
const i = c[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const Z = class Z {
|
|
253
253
|
constructor(t) {
|
|
254
254
|
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 ||
|
|
255
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || lt(), 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
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
q(this.settings, (e, i) => {
|
|
260
|
+
x(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -273,18 +273,18 @@ const it = class it {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
q(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(x(e) || B(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (U(this.elementRef, this.nestingLevel), Q(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
286
|
try {
|
|
287
|
-
if (
|
|
287
|
+
if (x(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -328,7 +328,7 @@ const it = class it {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
331
|
+
q(this.settings, (s, n) => {
|
|
332
332
|
const o = String(s);
|
|
333
333
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
334
334
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -345,7 +345,7 @@ const it = class it {
|
|
|
345
345
|
deleteItem: this.deleteItemCfg,
|
|
346
346
|
dataProps: this.dataProps,
|
|
347
347
|
hide: this.hide
|
|
348
|
-
}, i =
|
|
348
|
+
}, i = yt(e);
|
|
349
349
|
return i.initialValues = this.getValues(), i;
|
|
350
350
|
}
|
|
351
351
|
resetDefault() {
|
|
@@ -355,7 +355,7 @@ const it = class it {
|
|
|
355
355
|
setMobileValues(t) {
|
|
356
356
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
357
357
|
const s = this.settings[e];
|
|
358
|
-
s && (
|
|
358
|
+
s && (x(s) || B(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
359
359
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
360
360
|
}
|
|
361
361
|
getMobileValues(t) {
|
|
@@ -364,7 +364,7 @@ const it = class it {
|
|
|
364
364
|
for (const i in this.settings)
|
|
365
365
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
366
366
|
const s = this.settings[i];
|
|
367
|
-
if (
|
|
367
|
+
if (x(s))
|
|
368
368
|
e[i] = s.getMobileValues();
|
|
369
369
|
else {
|
|
370
370
|
const n = s;
|
|
@@ -375,7 +375,7 @@ const it = class it {
|
|
|
375
375
|
} else {
|
|
376
376
|
const e = this.settings[t];
|
|
377
377
|
if (!e) return;
|
|
378
|
-
if (
|
|
378
|
+
if (x(e)) return e.getMobileValues();
|
|
379
379
|
const i = e;
|
|
380
380
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
381
381
|
}
|
|
@@ -391,14 +391,14 @@ const it = class it {
|
|
|
391
391
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
392
392
|
}, 50));
|
|
393
393
|
};
|
|
394
|
-
return this.changeHandlers.clear(),
|
|
394
|
+
return this.changeHandlers.clear(), q(this.settings, (i, s) => {
|
|
395
395
|
var n;
|
|
396
|
-
if (
|
|
396
|
+
if (x(s))
|
|
397
397
|
s.setOnChange(() => {
|
|
398
398
|
const o = this.getValues();
|
|
399
399
|
this.initialValues = o, t(o);
|
|
400
400
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
401
|
-
else if (
|
|
401
|
+
else if (B(s)) {
|
|
402
402
|
const o = () => e();
|
|
403
403
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
404
404
|
} else {
|
|
@@ -421,10 +421,10 @@ const it = class it {
|
|
|
421
421
|
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
422
422
|
if (Number.isFinite(a)) {
|
|
423
423
|
const l = this.addItemCfg.createItem(a);
|
|
424
|
-
|
|
424
|
+
st(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (
|
|
427
|
+
n && (x(n) || B(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
428
|
}), setTimeout(() => {
|
|
429
429
|
this.forceChildUIRefresh();
|
|
430
430
|
}, 0);
|
|
@@ -438,7 +438,7 @@ const it = class it {
|
|
|
438
438
|
const s = this.getValues();
|
|
439
439
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
440
|
};
|
|
441
|
-
|
|
441
|
+
x(t) ? t.setOnChange(() => e()) : B(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
442
442
|
}
|
|
443
443
|
addSetting(t, e) {
|
|
444
444
|
var s, n;
|
|
@@ -447,16 +447,16 @@ const it = class it {
|
|
|
447
447
|
".setting-group-content"
|
|
448
448
|
);
|
|
449
449
|
if (o) {
|
|
450
|
-
|
|
450
|
+
x(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
451
451
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
452
452
|
if (l) {
|
|
453
|
-
const
|
|
454
|
-
|
|
453
|
+
const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
454
|
+
p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
|
|
455
455
|
}
|
|
456
456
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
457
|
-
r ? o.insertBefore(a, r) : o.appendChild(a),
|
|
458
|
-
const
|
|
459
|
-
a.style.display = "none", a.offsetHeight, a.style.display =
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), U(a, this.nestingLevel + 1), Q(a, this.nestingLevel + 1);
|
|
458
|
+
const h = a.style.display;
|
|
459
|
+
a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
const i = this.getValues();
|
|
@@ -473,9 +473,9 @@ const it = class it {
|
|
|
473
473
|
const r = Array.from(
|
|
474
474
|
t.querySelectorAll(".setting-group-title")
|
|
475
475
|
);
|
|
476
|
-
for (const
|
|
477
|
-
if (
|
|
478
|
-
s =
|
|
476
|
+
for (const h of r)
|
|
477
|
+
if (h.closest(".setting-group") === t) {
|
|
478
|
+
s = h;
|
|
479
479
|
break;
|
|
480
480
|
}
|
|
481
481
|
s || (s = r[0] ?? null);
|
|
@@ -508,8 +508,8 @@ const it = class it {
|
|
|
508
508
|
}), o.addEventListener("mouseleave", () => {
|
|
509
509
|
o.style.backgroundColor = "transparent";
|
|
510
510
|
}), o.addEventListener("click", (r) => {
|
|
511
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
512
|
-
|
|
511
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((h) => {
|
|
512
|
+
h && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
513
513
|
});
|
|
514
514
|
});
|
|
515
515
|
const l = n.querySelector(".setting-group-arrow");
|
|
@@ -603,13 +603,13 @@ const it = class it {
|
|
|
603
603
|
r(), t(!1);
|
|
604
604
|
}), l.addEventListener("click", () => {
|
|
605
605
|
r(), t(!0);
|
|
606
|
-
}), e.addEventListener("click", (
|
|
607
|
-
|
|
606
|
+
}), e.addEventListener("click", (p) => {
|
|
607
|
+
p.target === e && (r(), t(!1));
|
|
608
608
|
});
|
|
609
|
-
const
|
|
610
|
-
|
|
609
|
+
const h = (p) => {
|
|
610
|
+
p.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", h));
|
|
611
611
|
};
|
|
612
|
-
document.addEventListener("keydown",
|
|
612
|
+
document.addEventListener("keydown", h), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
613
613
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
614
614
|
}), setTimeout(() => l.focus(), 100);
|
|
615
615
|
});
|
|
@@ -637,7 +637,7 @@ const it = class it {
|
|
|
637
637
|
for (const i in this.settings)
|
|
638
638
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
639
639
|
const s = this.settings[i];
|
|
640
|
-
if (
|
|
640
|
+
if (x(s))
|
|
641
641
|
e[i] = s.getValues();
|
|
642
642
|
else {
|
|
643
643
|
const n = s;
|
|
@@ -648,7 +648,7 @@ const it = class it {
|
|
|
648
648
|
} else {
|
|
649
649
|
const e = this.settings[t];
|
|
650
650
|
if (!e) return;
|
|
651
|
-
if (
|
|
651
|
+
if (x(e)) return e.getValues();
|
|
652
652
|
const i = e;
|
|
653
653
|
return i.getValue ? i.getValue() : i.value;
|
|
654
654
|
}
|
|
@@ -661,7 +661,7 @@ const it = class it {
|
|
|
661
661
|
for (const s in this.settings)
|
|
662
662
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
663
663
|
const n = this.settings[s];
|
|
664
|
-
if (
|
|
664
|
+
if (x(n)) {
|
|
665
665
|
const o = n.getValuesForJson();
|
|
666
666
|
o !== null && (i[s] = o);
|
|
667
667
|
} else {
|
|
@@ -673,7 +673,7 @@ const it = class it {
|
|
|
673
673
|
} else {
|
|
674
674
|
const i = this.settings[t];
|
|
675
675
|
if (!i) return;
|
|
676
|
-
if (
|
|
676
|
+
if (x(i))
|
|
677
677
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
678
678
|
{
|
|
679
679
|
const s = i;
|
|
@@ -687,7 +687,7 @@ const it = class it {
|
|
|
687
687
|
for (const i in this.settings)
|
|
688
688
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
689
689
|
const s = this.settings[i];
|
|
690
|
-
if (
|
|
690
|
+
if (x(s))
|
|
691
691
|
e[i] = s.getDefaultValues();
|
|
692
692
|
else {
|
|
693
693
|
const n = s;
|
|
@@ -698,14 +698,14 @@ const it = class it {
|
|
|
698
698
|
} else {
|
|
699
699
|
const e = this.settings[t];
|
|
700
700
|
if (!e) return;
|
|
701
|
-
if (
|
|
701
|
+
if (x(e)) return e.getDefaultValues();
|
|
702
702
|
const i = e;
|
|
703
703
|
return i.default !== void 0 ? i.default : i.value;
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
draw() {
|
|
707
707
|
const t = document.createElement("div");
|
|
708
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
708
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Z.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), U(t, this.nestingLevel);
|
|
709
709
|
const e = document.createElement("div");
|
|
710
710
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
711
711
|
"aria-expanded",
|
|
@@ -731,43 +731,43 @@ const it = class it {
|
|
|
731
731
|
(!this.isCollapsed).toString()
|
|
732
732
|
);
|
|
733
733
|
};
|
|
734
|
-
if (e.onclick = l, e.onkeydown = (
|
|
735
|
-
(
|
|
734
|
+
if (e.onclick = l, e.onkeydown = (h) => {
|
|
735
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), l());
|
|
736
736
|
}, Object.keys(this.settings).length > 0) {
|
|
737
|
-
for (const
|
|
738
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
const d =
|
|
742
|
-
|
|
737
|
+
for (const h in this.settings)
|
|
738
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
|
|
739
|
+
const p = this.settings[h];
|
|
740
|
+
x(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
|
|
741
|
+
const d = p.draw();
|
|
742
|
+
x(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
|
|
743
743
|
d,
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
h,
|
|
745
|
+
p
|
|
746
746
|
), a.appendChild(d);
|
|
747
747
|
}
|
|
748
748
|
} else {
|
|
749
|
-
const
|
|
750
|
-
|
|
749
|
+
const h = document.createElement("div");
|
|
750
|
+
h.className = "setting-group-empty", h.textContent = "No settings in this group", a.appendChild(h);
|
|
751
751
|
}
|
|
752
752
|
if (this.addItemCfg) {
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
const
|
|
753
|
+
const h = document.createElement("button");
|
|
754
|
+
h.type = "button", h.className = "sg-add-button-bottom", h.style.marginTop = "8px";
|
|
755
|
+
const p = `
|
|
756
756
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
757
757
|
xmlns="http://www.w3.org/2000/svg">
|
|
758
758
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
759
759
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
760
760
|
</svg>`;
|
|
761
|
-
|
|
761
|
+
h.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (d) => {
|
|
762
762
|
d.stopPropagation(), d.preventDefault();
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
this.addSetting(
|
|
763
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), u = this.addItemCfg.createItem(g);
|
|
764
|
+
if (st(u)) {
|
|
765
|
+
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
766
|
+
this.addSetting(m, u);
|
|
767
767
|
}
|
|
768
|
-
}), a.appendChild(
|
|
768
|
+
}), a.appendChild(h);
|
|
769
769
|
}
|
|
770
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t,
|
|
770
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, it.trackElement(t), setTimeout(() => {
|
|
771
771
|
this.updateNestingStyles();
|
|
772
772
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
773
773
|
}
|
|
@@ -809,12 +809,12 @@ const it = class it {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
let
|
|
814
|
-
function
|
|
815
|
-
return new
|
|
812
|
+
Z.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
|
+
let V = Z;
|
|
814
|
+
function ne(c) {
|
|
815
|
+
return new Ct(c);
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class Ct extends V {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super(t);
|
|
820
820
|
const e = Object.keys(this.settings)[0];
|
|
@@ -852,12 +852,12 @@ class bt extends U {
|
|
|
852
852
|
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
853
853
|
const r = document.createElement("button");
|
|
854
854
|
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);
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
)), o.appendChild(
|
|
855
|
+
const h = document.createElement("div");
|
|
856
|
+
h.className = "tab-panel", this.contentContainers[a] = h;
|
|
857
|
+
const p = this.settings[a];
|
|
858
|
+
p && (x(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
|
|
859
|
+
p.draw()
|
|
860
|
+
)), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
861
861
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
862
862
|
const a = Object.keys(this.settings)[0];
|
|
863
863
|
this.activeTabId = a || "";
|
|
@@ -865,13 +865,13 @@ class bt extends U {
|
|
|
865
865
|
return this.updateTabUI(), t;
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
function
|
|
869
|
-
return new
|
|
868
|
+
function yt(c) {
|
|
869
|
+
return new V(c);
|
|
870
870
|
}
|
|
871
|
-
function
|
|
872
|
-
return
|
|
871
|
+
function oe(c) {
|
|
872
|
+
return c;
|
|
873
873
|
}
|
|
874
|
-
class
|
|
874
|
+
class Et extends E {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -891,29 +891,29 @@ class xt extends T {
|
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
const
|
|
895
|
-
class
|
|
894
|
+
const bt = "<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>";
|
|
895
|
+
class M extends Et {
|
|
896
896
|
constructor(t) {
|
|
897
897
|
super({
|
|
898
898
|
...t,
|
|
899
|
-
icon: t.icon ||
|
|
899
|
+
icon: t.icon || bt,
|
|
900
900
|
title: t.title || "Color",
|
|
901
|
-
default: t.default ?
|
|
901
|
+
default: t.default ? M.normalizeColorValue(t.default) : "#000000"
|
|
902
902
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
903
903
|
}
|
|
904
904
|
static normalizeColorValue(t) {
|
|
905
|
-
return t.startsWith("#") ?
|
|
905
|
+
return t.startsWith("#") ? M.normalizeHexValue(t) : t.includes(",") ? M.rgbToHexStatic(t) : M.normalizeHexValue(t);
|
|
906
906
|
}
|
|
907
907
|
static normalizeHexValue(t) {
|
|
908
908
|
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");
|
|
909
909
|
}
|
|
910
910
|
static rgbToHexStatic(t) {
|
|
911
|
-
const e = t.split(",").map((
|
|
911
|
+
const e = t.split(",").map((h) => parseInt(h.trim()));
|
|
912
912
|
if (e.length !== 3 || e.some(isNaN))
|
|
913
913
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
914
|
-
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 = (
|
|
915
|
-
const
|
|
916
|
-
return
|
|
914
|
+
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 = (h) => {
|
|
915
|
+
const p = h.toString(16);
|
|
916
|
+
return p.length === 1 ? "0" + p : p;
|
|
917
917
|
};
|
|
918
918
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
919
919
|
}
|
|
@@ -923,7 +923,7 @@ class W extends xt {
|
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
if (typeof t == "string") {
|
|
926
|
-
const e =
|
|
926
|
+
const e = M.normalizeColorValue(t);
|
|
927
927
|
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);
|
|
928
928
|
} else
|
|
929
929
|
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");
|
|
@@ -953,8 +953,8 @@ class W extends xt {
|
|
|
953
953
|
const r = l.value.trim();
|
|
954
954
|
if (!r)
|
|
955
955
|
return e.classList.remove("error"), !0;
|
|
956
|
-
const
|
|
957
|
-
return
|
|
956
|
+
const p = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
957
|
+
return p ? e.classList.remove("error") : e.classList.add("error"), p;
|
|
958
958
|
}, s = document.createElement("input");
|
|
959
959
|
s.type = "color", s.className = "color-picker", s.value = this.value || "#000000", s.setAttribute("aria-label", "Choose color"), s.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = s;
|
|
960
960
|
const n = document.createElement("div");
|
|
@@ -963,20 +963,20 @@ class W extends xt {
|
|
|
963
963
|
n.style.backgroundColor = o;
|
|
964
964
|
const a = document.createElement("input");
|
|
965
965
|
return a.type = "text", a.className = "color-text-input", a.value = this.value || "", a.placeholder = "#000000", a.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), a.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), a.setAttribute("aria-label", "Hex color value"), a.setAttribute("maxlength", "7"), this.getDataPropsPath() && a.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = a, this.textInputEl.addEventListener("input", (l) => {
|
|
966
|
-
var
|
|
966
|
+
var h, p;
|
|
967
967
|
let r = l.target.value.trim();
|
|
968
968
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
969
|
-
const d =
|
|
970
|
-
this.value = d, (
|
|
969
|
+
const d = M.normalizeColorValue(r);
|
|
970
|
+
this.value = d, (h = this.onChange) == null || h.call(this, d), (p = this.detectChange) == null || p.call(this, d), this.colorInputEl && (this.colorInputEl.value = d), n.style.backgroundColor = d;
|
|
971
971
|
}
|
|
972
972
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
973
|
-
var
|
|
974
|
-
const r = l.target.value,
|
|
975
|
-
this.value =
|
|
973
|
+
var p, d;
|
|
974
|
+
const r = l.target.value, h = M.normalizeColorValue(r);
|
|
975
|
+
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h, e.classList.remove("error");
|
|
976
976
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
977
|
-
var
|
|
978
|
-
const r = l.target.value,
|
|
979
|
-
this.value =
|
|
977
|
+
var p, d;
|
|
978
|
+
const r = l.target.value, h = M.normalizeColorValue(r);
|
|
979
|
+
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h;
|
|
980
980
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
981
981
|
}
|
|
982
982
|
getElement() {
|
|
@@ -984,7 +984,7 @@ class W extends xt {
|
|
|
984
984
|
}
|
|
985
985
|
// Helper method to get normalized hex value
|
|
986
986
|
getNormalizedValue() {
|
|
987
|
-
return this.value ?
|
|
987
|
+
return this.value ? M.normalizeColorValue(this.value) : "#000000";
|
|
988
988
|
}
|
|
989
989
|
// Helper method to check if current value is valid hex
|
|
990
990
|
isValidHex() {
|
|
@@ -995,20 +995,20 @@ class W extends xt {
|
|
|
995
995
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
const
|
|
998
|
+
const wt = `
|
|
999
999
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1000
1000
|
<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"/>
|
|
1001
1001
|
<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"/>
|
|
1002
1002
|
<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"/>
|
|
1003
1003
|
</svg>`;
|
|
1004
|
-
class
|
|
1004
|
+
class P extends E {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
|
-
icon: t.icon ||
|
|
1008
|
+
icon: t.icon || wt,
|
|
1009
1009
|
title: t.title || "Color & Opacity",
|
|
1010
1010
|
default: t.default || "#000000FF"
|
|
1011
|
-
}), 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 =
|
|
1011
|
+
}), 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 = P.normalizeHexWithOpacity(this.value));
|
|
1012
1012
|
}
|
|
1013
1013
|
static normalizeHexWithOpacity(t) {
|
|
1014
1014
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -1026,7 +1026,7 @@ class j extends T {
|
|
|
1026
1026
|
return `#${i}${n}`;
|
|
1027
1027
|
}
|
|
1028
1028
|
setValue(t) {
|
|
1029
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1029
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = P.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1030
1030
|
}
|
|
1031
1031
|
updateInputElements() {
|
|
1032
1032
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1037,7 +1037,7 @@ class j extends T {
|
|
|
1037
1037
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1038
1038
|
}
|
|
1039
1039
|
handleColorChange(t) {
|
|
1040
|
-
const e = this.getOpacityPercent(), i =
|
|
1040
|
+
const e = this.getOpacityPercent(), i = P.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class j extends T {
|
|
|
1048
1048
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1049
1049
|
}
|
|
1050
1050
|
handleOpacityChange(t) {
|
|
1051
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1051
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = P.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1123,7 +1123,7 @@ class j extends T {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class
|
|
1126
|
+
class ae extends E {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class Kt extends T {
|
|
|
1155
1155
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
class
|
|
1158
|
+
class I extends E {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1161
|
}
|
|
@@ -1214,12 +1214,12 @@ class z extends T {
|
|
|
1214
1214
|
);
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
const
|
|
1217
|
+
const xt = `
|
|
1218
1218
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1219
1219
|
<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"/>
|
|
1220
1220
|
<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"/>
|
|
1221
1221
|
</svg>`;
|
|
1222
|
-
class
|
|
1222
|
+
class Lt extends I {
|
|
1223
1223
|
constructor(t = {}) {
|
|
1224
1224
|
const e = {
|
|
1225
1225
|
title: "Opacity",
|
|
@@ -1228,7 +1228,7 @@ class St extends z {
|
|
|
1228
1228
|
maxValue: 100,
|
|
1229
1229
|
step: 1,
|
|
1230
1230
|
default: t.default ?? 100,
|
|
1231
|
-
icon:
|
|
1231
|
+
icon: xt,
|
|
1232
1232
|
...t
|
|
1233
1233
|
};
|
|
1234
1234
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1240,12 +1240,12 @@ class St extends z {
|
|
|
1240
1240
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
const
|
|
1243
|
+
const kt = `
|
|
1244
1244
|
<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">
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class
|
|
1248
|
+
class tt extends E {
|
|
1249
1249
|
constructor(t = {}) {
|
|
1250
1250
|
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) {
|
|
1251
1251
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1289,7 +1289,7 @@ class at extends T {
|
|
|
1289
1289
|
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1290
1290
|
}), document.body.appendChild(i);
|
|
1291
1291
|
const s = document.createElement("div");
|
|
1292
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1292
|
+
return s.classList.add("svg-container"), s.innerHTML = kt, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1293
1293
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1294
1294
|
}).catch((n) => {
|
|
1295
1295
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1358,7 +1358,7 @@ class at extends T {
|
|
|
1358
1358
|
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();
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class
|
|
1361
|
+
class Mt extends E {
|
|
1362
1362
|
constructor(t = {}) {
|
|
1363
1363
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1364
|
}
|
|
@@ -1414,7 +1414,7 @@ class Nt extends T {
|
|
|
1414
1414
|
}), t.appendChild(i), t;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
class
|
|
1417
|
+
class le extends E {
|
|
1418
1418
|
constructor(t) {
|
|
1419
1419
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1420
1420
|
}
|
|
@@ -1428,8 +1428,8 @@ class Qt extends T {
|
|
|
1428
1428
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1429
1429
|
);
|
|
1430
1430
|
if (n) {
|
|
1431
|
-
let a = +n[1], l = +n[2], r = +n[3],
|
|
1432
|
-
|
|
1431
|
+
let a = +n[1], l = +n[2], r = +n[3], h = +n[4];
|
|
1432
|
+
h >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : h = Math.min(1, h + 0.12), s = `rgba(${a},${l},${r},${h})`;
|
|
1433
1433
|
}
|
|
1434
1434
|
t.addEventListener("mouseenter", () => {
|
|
1435
1435
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
@@ -1443,27 +1443,27 @@ class Qt extends T {
|
|
|
1443
1443
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class
|
|
1446
|
+
class re extends E {
|
|
1447
1447
|
constructor(t = {}) {
|
|
1448
1448
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1449
1449
|
const e = t.width || 0, i = t.height || 0;
|
|
1450
1450
|
this.value || (this.value = {
|
|
1451
1451
|
width: e,
|
|
1452
1452
|
height: i
|
|
1453
|
-
}), 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
|
|
1453
|
+
}), 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 I({
|
|
1454
1454
|
title: "Width",
|
|
1455
1455
|
default: this.value.width,
|
|
1456
1456
|
suffix: "px",
|
|
1457
1457
|
minValue: this.minWidth,
|
|
1458
1458
|
maxValue: this.maxWidth,
|
|
1459
|
-
icon:
|
|
1460
|
-
}), this.heightSetting = new
|
|
1459
|
+
icon: St
|
|
1460
|
+
}), this.heightSetting = new I({
|
|
1461
1461
|
title: "Height",
|
|
1462
1462
|
default: this.value.height,
|
|
1463
1463
|
suffix: "px",
|
|
1464
1464
|
minValue: this.minHeight,
|
|
1465
1465
|
maxValue: this.maxHeight,
|
|
1466
|
-
icon:
|
|
1466
|
+
icon: It
|
|
1467
1467
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1468
1468
|
}
|
|
1469
1469
|
handleWidthChange(t) {
|
|
@@ -1557,24 +1557,24 @@ class te extends T {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
const
|
|
1560
|
+
const St = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1561
1561
|
<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"/>
|
|
1562
|
-
</svg>`,
|
|
1562
|
+
</svg>`, It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1563
1563
|
<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"/>
|
|
1564
|
-
</svg>`,
|
|
1564
|
+
</svg>`, X = `
|
|
1565
1565
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1566
1566
|
<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"/>
|
|
1567
1567
|
</svg>
|
|
1568
|
-
`,
|
|
1568
|
+
`, Nt = `
|
|
1569
1569
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1570
1570
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1571
1571
|
<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"/>
|
|
1572
1572
|
</svg>
|
|
1573
|
-
`,
|
|
1573
|
+
`, Vt = `
|
|
1574
1574
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1575
1575
|
<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"/>
|
|
1576
1576
|
</svg>
|
|
1577
|
-
`,
|
|
1577
|
+
`, Ot = `
|
|
1578
1578
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1579
1579
|
<!-- Top dot -->
|
|
1580
1580
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1594,7 +1594,7 @@ const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1594
1594
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1595
1595
|
</svg>
|
|
1596
1596
|
`;
|
|
1597
|
-
class
|
|
1597
|
+
class rt extends E {
|
|
1598
1598
|
constructor(t = {}) {
|
|
1599
1599
|
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();
|
|
1600
1600
|
}
|
|
@@ -1647,7 +1647,7 @@ class pt extends T {
|
|
|
1647
1647
|
);
|
|
1648
1648
|
if (t && t !== "") {
|
|
1649
1649
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1650
|
-
<span class="upload-icon">${
|
|
1650
|
+
<span class="upload-icon">${X}</span>
|
|
1651
1651
|
<span class="upload-label">Replace</span>
|
|
1652
1652
|
`);
|
|
1653
1653
|
const n = () => {
|
|
@@ -1658,7 +1658,7 @@ class pt extends T {
|
|
|
1658
1658
|
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1659
1659
|
} else
|
|
1660
1660
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1661
|
-
<span class="upload-icon">${
|
|
1661
|
+
<span class="upload-icon">${X}</span>
|
|
1662
1662
|
<span class="upload-label">Upload</span>
|
|
1663
1663
|
`);
|
|
1664
1664
|
}
|
|
@@ -1691,9 +1691,9 @@ class pt extends T {
|
|
|
1691
1691
|
const s = this.value && this.value !== "";
|
|
1692
1692
|
s || i.classList.add("no-image");
|
|
1693
1693
|
const n = document.createElement("div");
|
|
1694
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1694
|
+
if (n.className = "preview-placeholder", n.innerHTML = Nt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Ot, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1695
1695
|
const a = document.createElement("button");
|
|
1696
|
-
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML =
|
|
1696
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Vt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1697
1697
|
var r;
|
|
1698
1698
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1699
1699
|
};
|
|
@@ -1701,7 +1701,7 @@ class pt extends T {
|
|
|
1701
1701
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1702
1702
|
const o = document.createElement("button");
|
|
1703
1703
|
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1704
|
-
<span class="upload-icon">${
|
|
1704
|
+
<span class="upload-icon">${X}</span>
|
|
1705
1705
|
<span class="upload-label">Upload</span>
|
|
1706
1706
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1707
1707
|
window.postMessage(
|
|
@@ -1714,14 +1714,14 @@ class pt extends T {
|
|
|
1714
1714
|
}, t;
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
|
-
class
|
|
1717
|
+
class ce extends I {
|
|
1718
1718
|
constructor(t = {}) {
|
|
1719
1719
|
super({
|
|
1720
1720
|
...t,
|
|
1721
1721
|
title: t.title || "Height",
|
|
1722
1722
|
suffix: t.suffix || "px",
|
|
1723
1723
|
minValue: t.minValue ?? 0,
|
|
1724
|
-
icon: t.icon ||
|
|
1724
|
+
icon: t.icon || Ht,
|
|
1725
1725
|
default: t.default ?? 100
|
|
1726
1726
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1727
1727
|
}
|
|
@@ -1732,17 +1732,17 @@ class ee extends z {
|
|
|
1732
1732
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1736
1736
|
<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"/>
|
|
1737
1737
|
</svg>`;
|
|
1738
|
-
class
|
|
1738
|
+
class he extends I {
|
|
1739
1739
|
constructor(t = {}) {
|
|
1740
1740
|
super({
|
|
1741
1741
|
...t,
|
|
1742
1742
|
title: t.title || "Width",
|
|
1743
1743
|
suffix: t.suffix || "px",
|
|
1744
1744
|
minValue: t.minValue ?? 0,
|
|
1745
|
-
icon: t.icon ||
|
|
1745
|
+
icon: t.icon || Pt,
|
|
1746
1746
|
default: t.default ?? 100
|
|
1747
1747
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1748
1748
|
}
|
|
@@ -1753,14 +1753,14 @@ class ie extends z {
|
|
|
1753
1753
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
const
|
|
1756
|
+
const Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1757
1757
|
<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"/>
|
|
1758
|
-
</svg>`,
|
|
1758
|
+
</svg>`, Tt = `
|
|
1759
1759
|
<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">
|
|
1760
1760
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1761
|
</svg>
|
|
1762
1762
|
`;
|
|
1763
|
-
class
|
|
1763
|
+
class pe extends E {
|
|
1764
1764
|
constructor(t = {}) {
|
|
1765
1765
|
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) {
|
|
1766
1766
|
const e = this._options.findIndex(
|
|
@@ -1815,7 +1815,7 @@ class se extends T {
|
|
|
1815
1815
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1816
1816
|
}), t.appendChild(i);
|
|
1817
1817
|
const s = document.createElement("div");
|
|
1818
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1818
|
+
return s.classList.add("svg-container"), s.innerHTML = Tt, t.appendChild(s), s.onclick = () => {
|
|
1819
1819
|
var n, o;
|
|
1820
1820
|
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));
|
|
1821
1821
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1862,7 +1862,7 @@ class se extends T {
|
|
|
1862
1862
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1863
1863
|
}
|
|
1864
1864
|
selectApiOption(t, e, i) {
|
|
1865
|
-
var l, r,
|
|
1865
|
+
var l, r, h, p;
|
|
1866
1866
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1867
1867
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1868
1868
|
const o = this._options[e].value;
|
|
@@ -1874,7 +1874,7 @@ class se extends T {
|
|
|
1874
1874
|
const d = i.firstChild;
|
|
1875
1875
|
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1876
1876
|
}
|
|
1877
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (
|
|
1877
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (h = this.svgContainer) == null || h.classList.remove("open"), (p = this.onChange) == null || p.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1878
1878
|
}
|
|
1879
1879
|
updateOptionsList() {
|
|
1880
1880
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1907,7 +1907,7 @@ class se extends T {
|
|
|
1907
1907
|
), this.updateButtonText();
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
|
-
class
|
|
1910
|
+
class de extends E {
|
|
1911
1911
|
constructor(t) {
|
|
1912
1912
|
var e, i;
|
|
1913
1913
|
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;
|
|
@@ -1930,19 +1930,19 @@ class ne extends T {
|
|
|
1930
1930
|
i.className = "toggle-switch";
|
|
1931
1931
|
const s = document.createElement("input");
|
|
1932
1932
|
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", () => {
|
|
1933
|
-
var r,
|
|
1934
|
-
const l = ((
|
|
1933
|
+
var r, h;
|
|
1934
|
+
const l = ((h = (r = this.props.options) == null ? void 0 : r.find((p) => p.status === s.checked)) == null ? void 0 : h.value) ?? "";
|
|
1935
1935
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1936
1936
|
});
|
|
1937
1937
|
const n = document.createElement("span");
|
|
1938
1938
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1939
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
1939
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", h = this.props.inactiveColor || "#ccc";
|
|
1940
1940
|
l.textContent = `
|
|
1941
1941
|
.toggle-switch input:checked + .toggle-slider {
|
|
1942
1942
|
background-color: ${r};
|
|
1943
1943
|
}
|
|
1944
1944
|
.toggle-switch .toggle-slider {
|
|
1945
|
-
background-color: ${
|
|
1945
|
+
background-color: ${h};
|
|
1946
1946
|
}
|
|
1947
1947
|
`, document.head.appendChild(l);
|
|
1948
1948
|
}
|
|
@@ -1957,13 +1957,13 @@ class ne extends T {
|
|
|
1957
1957
|
this.detectChangeCallback = t;
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
|
-
const
|
|
1960
|
+
const $t = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
1961
|
<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"/>
|
|
1962
1962
|
</svg>`;
|
|
1963
|
-
class
|
|
1963
|
+
class ue extends E {
|
|
1964
1964
|
// Store mobile value
|
|
1965
1965
|
constructor(t = {}) {
|
|
1966
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
1966
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? $t, 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);
|
|
1967
1967
|
}
|
|
1968
1968
|
draw() {
|
|
1969
1969
|
const t = document.createElement("div");
|
|
@@ -2014,42 +2014,42 @@ class oe extends T {
|
|
|
2014
2014
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
const
|
|
2017
|
+
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2018
2018
|
<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"/>
|
|
2019
2019
|
</svg>`;
|
|
2020
|
-
class
|
|
2020
|
+
class ge extends I {
|
|
2021
2021
|
constructor(t = {}) {
|
|
2022
2022
|
super({
|
|
2023
2023
|
...t,
|
|
2024
2024
|
minValue: t.minValue ?? 0,
|
|
2025
2025
|
maxValue: t.maxValue ?? 1e3,
|
|
2026
|
-
icon: t.icon ||
|
|
2026
|
+
icon: t.icon || At,
|
|
2027
2027
|
title: t.title || "Margin Bottom",
|
|
2028
2028
|
default: t.default ?? 20,
|
|
2029
2029
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2030
2030
|
}), this.inputType = "number";
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
|
-
const
|
|
2033
|
+
const Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2034
2034
|
<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"
|
|
2035
2035
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2036
2036
|
</svg>`;
|
|
2037
|
-
class
|
|
2037
|
+
class me extends I {
|
|
2038
2038
|
constructor(t = {}) {
|
|
2039
2039
|
super({
|
|
2040
2040
|
...t,
|
|
2041
2041
|
minValue: t.minValue ?? 0,
|
|
2042
2042
|
maxValue: t.maxValue ?? 1e3,
|
|
2043
|
-
icon: t.icon ||
|
|
2043
|
+
icon: t.icon || Bt,
|
|
2044
2044
|
title: t.title || "Margin Top",
|
|
2045
2045
|
default: t.default ?? 20,
|
|
2046
2046
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2047
2047
|
}), this.inputType = "number";
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
class
|
|
2050
|
+
class fe extends E {
|
|
2051
2051
|
constructor(t) {
|
|
2052
|
-
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(
|
|
2052
|
+
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(E.DefaultLanguage) ? E.DefaultLanguage : t.languages[0];
|
|
2053
2053
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2054
2054
|
t.languages.forEach((i) => {
|
|
2055
2055
|
var s, n;
|
|
@@ -2079,13 +2079,13 @@ class re extends T {
|
|
|
2079
2079
|
t.placeholder = e;
|
|
2080
2080
|
return;
|
|
2081
2081
|
}
|
|
2082
|
-
const
|
|
2083
|
-
let
|
|
2084
|
-
for (;
|
|
2085
|
-
const
|
|
2086
|
-
this.measureTextWidth(
|
|
2082
|
+
const h = "...";
|
|
2083
|
+
let p = 0, d = e.length, g = 0;
|
|
2084
|
+
for (; p <= d; ) {
|
|
2085
|
+
const m = Math.floor((p + d) / 2), f = e.slice(0, m).trimEnd() + h;
|
|
2086
|
+
this.measureTextWidth(f, i) <= l ? (g = m, p = m + 1) : d = m - 1;
|
|
2087
2087
|
}
|
|
2088
|
-
const u = e.slice(0,
|
|
2088
|
+
const u = e.slice(0, g).trimEnd() + h;
|
|
2089
2089
|
t.placeholder = u;
|
|
2090
2090
|
}
|
|
2091
2091
|
autosizeTextarea(t, e = 3) {
|
|
@@ -2098,7 +2098,7 @@ class re extends T {
|
|
|
2098
2098
|
i.classList.add("simple-multi-language-row");
|
|
2099
2099
|
const s = document.createElement("label");
|
|
2100
2100
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2101
|
-
const n = new
|
|
2101
|
+
const n = new rt({
|
|
2102
2102
|
defaultUrl: e || "",
|
|
2103
2103
|
title: "",
|
|
2104
2104
|
id: `${this.id}_upload_${t}`
|
|
@@ -2121,8 +2121,8 @@ class re extends T {
|
|
|
2121
2121
|
), n.addEventListener("input", (l) => {
|
|
2122
2122
|
const r = l.target;
|
|
2123
2123
|
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2124
|
+
const h = n.getAttribute("data-full-placeholder") || "";
|
|
2125
|
+
h && this.adaptPlaceholderToSingleLine(n, h);
|
|
2126
2126
|
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2127
2127
|
this.autosizeTextarea(n, 3);
|
|
2128
2128
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
@@ -2194,7 +2194,7 @@ class re extends T {
|
|
|
2194
2194
|
});
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
2197
|
-
class
|
|
2197
|
+
class ve extends E {
|
|
2198
2198
|
constructor(t = {}) {
|
|
2199
2199
|
super(t), this.inputType = "select";
|
|
2200
2200
|
const e = [
|
|
@@ -2205,7 +2205,7 @@ class ce extends T {
|
|
|
2205
2205
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2206
2206
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2207
2207
|
];
|
|
2208
|
-
this.selectSetting = new
|
|
2208
|
+
this.selectSetting = new tt({
|
|
2209
2209
|
title: this.title || "Animation",
|
|
2210
2210
|
options: e,
|
|
2211
2211
|
default: this.props.default || "none"
|
|
@@ -2221,27 +2221,184 @@ class ce extends T {
|
|
|
2221
2221
|
this.selectSetting.destroy(), super.destroy();
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
const
|
|
2225
|
-
|
|
2224
|
+
const Dt = (c, t) => {
|
|
2225
|
+
let e = !1, i = 0, s = 0, n = 0, o = 0;
|
|
2226
|
+
const a = (h) => {
|
|
2227
|
+
if (h.target.closest("button")) return;
|
|
2228
|
+
e = !0, i = h.clientX, s = h.clientY;
|
|
2229
|
+
const p = t.getBoundingClientRect();
|
|
2230
|
+
n = p.left, o = p.top, document.addEventListener("mousemove", l), document.addEventListener("mouseup", r), document.body.style.userSelect = "none";
|
|
2231
|
+
}, l = (h) => {
|
|
2232
|
+
if (!e) return;
|
|
2233
|
+
const p = h.clientX - i, d = h.clientY - s, g = window.innerWidth, u = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2234
|
+
let b = n + p, L = o + d;
|
|
2235
|
+
b = Math.max(8, Math.min(g - m - 8, b)), L = Math.max(8, Math.min(u - f - 8, L)), t.style.left = `${b}px`, t.style.top = `${L}px`;
|
|
2236
|
+
}, r = () => {
|
|
2237
|
+
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2238
|
+
};
|
|
2239
|
+
c.addEventListener("mousedown", a);
|
|
2240
|
+
}, R = (c) => {
|
|
2241
|
+
if (!c) return null;
|
|
2242
|
+
let t = c.trim();
|
|
2243
|
+
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()}`;
|
|
2244
|
+
}, D = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (c) => {
|
|
2245
|
+
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2246
|
+
return {
|
|
2247
|
+
r: parseInt(e.slice(0, 2), 16),
|
|
2248
|
+
g: parseInt(e.slice(2, 4), 16),
|
|
2249
|
+
b: parseInt(e.slice(4, 6), 16)
|
|
2250
|
+
};
|
|
2251
|
+
}, $ = (c) => {
|
|
2252
|
+
const { r: t, g: e, b: i } = S(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2253
|
+
let h = 0;
|
|
2254
|
+
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4);
|
|
2255
|
+
const p = a === 0 ? 0 : r / a, d = a;
|
|
2256
|
+
return { h: h * 60, s: p, v: d };
|
|
2257
|
+
}, W = (c, t, e) => {
|
|
2258
|
+
const i = e * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i;
|
|
2259
|
+
let o = 0, a = 0, l = 0;
|
|
2260
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), D(
|
|
2261
|
+
Math.round((o + n) * 255),
|
|
2262
|
+
Math.round((a + n) * 255),
|
|
2263
|
+
Math.round((l + n) * 255)
|
|
2264
|
+
);
|
|
2265
|
+
}, Rt = (c, t, e) => {
|
|
2266
|
+
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2267
|
+
return { hue: c, sat: s, lightness: i };
|
|
2268
|
+
}, J = (c, t, e) => {
|
|
2269
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2270
|
+
let o = 0, a = 0, l = 0;
|
|
2271
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2272
|
+
r: Math.round((o + n) * 255),
|
|
2273
|
+
g: Math.round((a + n) * 255),
|
|
2274
|
+
b: Math.round((l + n) * 255)
|
|
2275
|
+
};
|
|
2276
|
+
}, ct = (c, t) => {
|
|
2277
|
+
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2278
|
+
if (c.startsWith("#")) {
|
|
2279
|
+
const { r: s, g: n, b: o } = S(c);
|
|
2280
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2281
|
+
}
|
|
2282
|
+
if (c.startsWith("rgba("))
|
|
2283
|
+
return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2284
|
+
if (c.startsWith("rgb("))
|
|
2285
|
+
return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2286
|
+
if (c.startsWith("hsl(")) {
|
|
2287
|
+
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2288
|
+
if (s) {
|
|
2289
|
+
const { r: n, g: o, b: a } = J(
|
|
2290
|
+
parseInt(s[1]),
|
|
2291
|
+
parseInt(s[2]) / 100,
|
|
2292
|
+
parseInt(s[3]) / 100
|
|
2293
|
+
);
|
|
2294
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
if (c.startsWith("hsla(")) {
|
|
2298
|
+
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2299
|
+
if (s) {
|
|
2300
|
+
const { r: n, g: o, b: a } = J(
|
|
2301
|
+
parseInt(s[1]),
|
|
2302
|
+
parseInt(s[2]) / 100,
|
|
2303
|
+
parseInt(s[3]) / 100
|
|
2304
|
+
);
|
|
2305
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
const i = R(c);
|
|
2309
|
+
if (i) {
|
|
2310
|
+
const { r: s, g: n, b: o } = S(i);
|
|
2311
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2312
|
+
}
|
|
2313
|
+
return c;
|
|
2314
|
+
}, Ft = (c) => [
|
|
2315
|
+
"red",
|
|
2316
|
+
"green",
|
|
2317
|
+
"blue",
|
|
2318
|
+
"yellow",
|
|
2319
|
+
"orange",
|
|
2320
|
+
"purple",
|
|
2321
|
+
"pink",
|
|
2322
|
+
"brown",
|
|
2323
|
+
"black",
|
|
2324
|
+
"white",
|
|
2325
|
+
"gray",
|
|
2326
|
+
"grey",
|
|
2327
|
+
"cyan",
|
|
2328
|
+
"magenta",
|
|
2329
|
+
"lime",
|
|
2330
|
+
"navy",
|
|
2331
|
+
"maroon",
|
|
2332
|
+
"olive",
|
|
2333
|
+
"aqua",
|
|
2334
|
+
"silver",
|
|
2335
|
+
"teal",
|
|
2336
|
+
"fuchsia",
|
|
2337
|
+
"transparent"
|
|
2338
|
+
].includes(c.toLowerCase()), ht = (c) => [
|
|
2339
|
+
/^#[0-9a-fA-F]{3,8}$/,
|
|
2340
|
+
/^rgba?\s*\([^)]+\)$/,
|
|
2341
|
+
/^hsla?\s*\([^)]+\)$/,
|
|
2342
|
+
/^[a-zA-Z]+$/
|
|
2343
|
+
].some((e) => e.test(c.trim())), Gt = (c) => {
|
|
2344
|
+
if (typeof document > "u")
|
|
2345
|
+
return ht(c) || !!R(c);
|
|
2346
|
+
const t = document.createElement("div");
|
|
2347
|
+
return t.style.color = c, t.style.color !== "";
|
|
2348
|
+
}, pt = (c) => {
|
|
2349
|
+
const t = c.trim();
|
|
2350
|
+
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2351
|
+
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);
|
|
2352
|
+
return {
|
|
2353
|
+
color: D(o, a, l),
|
|
2354
|
+
position: 0,
|
|
2355
|
+
opacity: Math.round(r / 255 * 100)
|
|
2356
|
+
};
|
|
2357
|
+
}
|
|
2358
|
+
const e = t.match(
|
|
2359
|
+
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2360
|
+
);
|
|
2361
|
+
if (e) {
|
|
2362
|
+
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2363
|
+
return {
|
|
2364
|
+
color: D(n, o, a),
|
|
2365
|
+
position: 0,
|
|
2366
|
+
opacity: Math.round(l * 100)
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
const i = t.match(
|
|
2370
|
+
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2371
|
+
);
|
|
2372
|
+
if (i) {
|
|
2373
|
+
const { r: n, g: o, b: a } = J(
|
|
2374
|
+
parseFloat(i[1]),
|
|
2375
|
+
parseFloat(i[2]) / 100,
|
|
2376
|
+
parseFloat(i[3]) / 100
|
|
2377
|
+
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2226
2378
|
return {
|
|
2227
|
-
|
|
2228
|
-
|
|
2379
|
+
color: D(n, o, a),
|
|
2380
|
+
position: 0,
|
|
2381
|
+
opacity: Math.round(l * 100)
|
|
2229
2382
|
};
|
|
2230
2383
|
}
|
|
2384
|
+
return { color: R(t) || t, position: 0, opacity: 100 };
|
|
2385
|
+
}, z = class z {
|
|
2386
|
+
static defaults() {
|
|
2387
|
+
return { solid: [], gradient: [] };
|
|
2388
|
+
}
|
|
2231
2389
|
static ensureLoaded() {
|
|
2232
2390
|
var t;
|
|
2233
|
-
if (this.colors
|
|
2391
|
+
if (!this.colors && (this.colors = this.defaults(), !(typeof window > "u")))
|
|
2234
2392
|
try {
|
|
2235
2393
|
const e = (t = window.sessionStorage) == null ? void 0 : t.getItem(this.STORAGE_KEY);
|
|
2236
|
-
if (e)
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
console.warn("Unable to load recent colors:", e), this.colors = this.getDefaultState();
|
|
2394
|
+
if (!e) return;
|
|
2395
|
+
const i = JSON.parse(e);
|
|
2396
|
+
["solid", "gradient"].forEach((s) => {
|
|
2397
|
+
const n = Array.isArray(i == null ? void 0 : i[s]) ? i[s] : [];
|
|
2398
|
+
this.colors[s] = n.map((o) => R(o)).filter((o) => !!o);
|
|
2399
|
+
});
|
|
2400
|
+
} catch {
|
|
2401
|
+
this.colors = this.defaults();
|
|
2245
2402
|
}
|
|
2246
2403
|
}
|
|
2247
2404
|
static persist() {
|
|
@@ -2250,35 +2407,27 @@ const Y = class Y {
|
|
|
2250
2407
|
try {
|
|
2251
2408
|
(t = window.sessionStorage) == null || t.setItem(
|
|
2252
2409
|
this.STORAGE_KEY,
|
|
2253
|
-
JSON.stringify(this.colors || this.
|
|
2410
|
+
JSON.stringify(this.colors || this.defaults())
|
|
2254
2411
|
);
|
|
2255
|
-
} catch
|
|
2256
|
-
console.warn("Unable to persist recent colors:", e);
|
|
2412
|
+
} catch {
|
|
2257
2413
|
}
|
|
2258
2414
|
}
|
|
2259
|
-
static
|
|
2260
|
-
|
|
2261
|
-
const e = t.trim();
|
|
2262
|
-
if (!e.startsWith("#")) return null;
|
|
2263
|
-
let i = e.slice(1);
|
|
2264
|
-
return i.length === 3 && (i = i.split("").map((s) => s + s).join("")), i.length !== 6 || !/^[0-9a-fA-F]{6}$/.test(i) ? null : `#${i.toUpperCase()}`;
|
|
2265
|
-
}
|
|
2266
|
-
static getScopeList(t) {
|
|
2267
|
-
return this.ensureLoaded(), this.colors || (this.colors = this.getDefaultState()), this.colors[t];
|
|
2415
|
+
static list(t) {
|
|
2416
|
+
return this.ensureLoaded(), this.colors || (this.colors = this.defaults()), this.colors[t];
|
|
2268
2417
|
}
|
|
2269
2418
|
static getColors(t) {
|
|
2270
|
-
return [...this.
|
|
2419
|
+
return [...this.list(t)];
|
|
2271
2420
|
}
|
|
2272
2421
|
static addColor(t, e) {
|
|
2273
|
-
const i =
|
|
2422
|
+
const i = R(t);
|
|
2274
2423
|
if (!i) return;
|
|
2275
|
-
const s = this.
|
|
2424
|
+
const s = this.list(e), n = s.indexOf(i);
|
|
2276
2425
|
n !== -1 && s.splice(n, 1), s.unshift(i), s.length > this.MAX_COLORS && (s.length = this.MAX_COLORS), this.persist();
|
|
2277
2426
|
}
|
|
2278
2427
|
};
|
|
2279
|
-
|
|
2280
|
-
let
|
|
2281
|
-
|
|
2428
|
+
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2429
|
+
let N = z;
|
|
2430
|
+
const Wt = (c, t) => {
|
|
2282
2431
|
const e = document.createElement("div");
|
|
2283
2432
|
e.className = "color-picker-recent-section";
|
|
2284
2433
|
const i = document.createElement("div");
|
|
@@ -2289,54 +2438,53 @@ function lt(p, t) {
|
|
|
2289
2438
|
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2290
2439
|
const o = () => {
|
|
2291
2440
|
s.innerHTML = "";
|
|
2292
|
-
const a =
|
|
2441
|
+
const a = N.getColors(t);
|
|
2293
2442
|
if (a.length === 0) {
|
|
2294
2443
|
s.style.display = "none", n.style.display = "block";
|
|
2295
2444
|
return;
|
|
2296
2445
|
}
|
|
2297
2446
|
s.style.display = "grid", n.style.display = "none", a.forEach((l) => {
|
|
2298
2447
|
const r = document.createElement("button");
|
|
2299
|
-
r.type = "button", r.className = "color-picker-recent-swatch", r.title = l, r.setAttribute("aria-label", `Use color ${l}`), r.style.background = l, r.style.borderColor = l, r.addEventListener("click", () =>
|
|
2448
|
+
r.type = "button", r.className = "color-picker-recent-swatch", r.title = l, r.setAttribute("aria-label", `Use color ${l}`), r.style.background = l, r.style.borderColor = l, r.addEventListener("click", () => c(l)), s.appendChild(r);
|
|
2300
2449
|
});
|
|
2301
2450
|
};
|
|
2302
|
-
return o(), {
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
};
|
|
2306
|
-
}
|
|
2307
|
-
const ut = `<svg
|
|
2308
|
-
width="13"
|
|
2309
|
-
height="13"
|
|
2310
|
-
viewBox="0 0 13 13"
|
|
2311
|
-
fill="none"
|
|
2312
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
2313
|
-
>
|
|
2314
|
-
<path
|
|
2315
|
-
fill-rule="evenodd"
|
|
2316
|
-
clip-rule="evenodd"
|
|
2451
|
+
return o(), { container: e, refresh: o };
|
|
2452
|
+
}, dt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2453
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2317
2454
|
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"
|
|
2318
|
-
fill="#919EAB"
|
|
2319
|
-
|
|
2455
|
+
fill="#919EAB"/>
|
|
2456
|
+
</svg>`, zt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2457
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2458
|
+
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.29156Z"
|
|
2459
|
+
fill="#353C47"/>
|
|
2460
|
+
</svg>`, qt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2461
|
+
<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"/>
|
|
2462
|
+
</svg>`, jt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2463
|
+
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2320
2464
|
</svg>`;
|
|
2321
|
-
class
|
|
2465
|
+
class Ut {
|
|
2322
2466
|
constructor(t, e = "gradient") {
|
|
2323
|
-
this.isOpen = !1, this.
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2467
|
+
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2468
|
+
if (!this.isOpen) return;
|
|
2469
|
+
const s = i.target;
|
|
2470
|
+
if (document.querySelector(".gradient-popover"), this.element.contains(s)) return;
|
|
2471
|
+
const n = document.querySelectorAll(".gstop-color-input");
|
|
2472
|
+
Array.from(n).some(
|
|
2473
|
+
(a) => a.contains(s)
|
|
2474
|
+
) || (i.preventDefault(), i.stopPropagation(), this.close(!1));
|
|
2475
|
+
}, this.keyDown = (i) => {
|
|
2327
2476
|
if (this.isOpen) {
|
|
2328
2477
|
if (i.key === "Escape")
|
|
2329
2478
|
i.preventDefault(), this.close(!0);
|
|
2330
2479
|
else if (i.key === "Enter") {
|
|
2331
2480
|
const s = i.target;
|
|
2332
|
-
if (s && (s.tagName === "
|
|
2333
|
-
return;
|
|
2481
|
+
if (s && (s.tagName === "INPUT" || s.tagName === "TEXTAREA")) return;
|
|
2334
2482
|
i.preventDefault(), this.close(!0);
|
|
2335
2483
|
}
|
|
2336
2484
|
}
|
|
2337
|
-
}, this.
|
|
2485
|
+
}, this.onChange = t, this.recentScope = e, this.element = this.build(), this.backdrop = this.createBackdrop();
|
|
2338
2486
|
}
|
|
2339
|
-
|
|
2487
|
+
build() {
|
|
2340
2488
|
const t = document.createElement("div");
|
|
2341
2489
|
t.className = "custom-color-picker", t.style.display = "none";
|
|
2342
2490
|
const e = document.createElement("div");
|
|
@@ -2344,7 +2492,7 @@ class ht {
|
|
|
2344
2492
|
const i = document.createElement("span");
|
|
2345
2493
|
i.textContent = "Color";
|
|
2346
2494
|
const s = document.createElement("button");
|
|
2347
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2495
|
+
s.className = "color-picker-close", s.innerHTML = dt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), Dt(e, t);
|
|
2348
2496
|
const n = document.createElement("div");
|
|
2349
2497
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2350
2498
|
const o = document.createElement("div");
|
|
@@ -2352,451 +2500,625 @@ class ht {
|
|
|
2352
2500
|
const a = document.createElement("div");
|
|
2353
2501
|
a.className = "color-picker-hue-container";
|
|
2354
2502
|
const l = document.createElement("button");
|
|
2355
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2356
|
-
<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"/>
|
|
2357
|
-
</svg>`;
|
|
2503
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = zt;
|
|
2358
2504
|
const r = document.createElement("div");
|
|
2359
2505
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2360
|
-
const c = document.createElement("div");
|
|
2361
|
-
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2362
2506
|
const h = document.createElement("div");
|
|
2363
|
-
h.className = "color-picker-
|
|
2507
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, r.appendChild(h), a.appendChild(l), a.appendChild(r);
|
|
2508
|
+
const p = document.createElement("div");
|
|
2509
|
+
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
2364
2510
|
const d = document.createElement("div");
|
|
2365
|
-
d.className = "color-picker-opacity-marker", this.opacityMarker = d,
|
|
2366
|
-
const
|
|
2367
|
-
|
|
2511
|
+
d.className = "color-picker-opacity-marker", this.opacityMarker = d, p.appendChild(d);
|
|
2512
|
+
const g = Wt((T) => {
|
|
2513
|
+
var F, G;
|
|
2514
|
+
this.setColor(T), (F = this.onChange) == null || F.call(this, T, this.currentOpacity), N.addColor(T, this.recentScope), (G = this.recentSectionRefresh) == null || G.call(this);
|
|
2368
2515
|
}, this.recentScope);
|
|
2369
|
-
this.
|
|
2516
|
+
this.recentSectionRefresh = g.refresh;
|
|
2370
2517
|
const u = document.createElement("div");
|
|
2371
2518
|
u.className = "color-picker-format-section";
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2519
|
+
const m = document.createElement("select");
|
|
2520
|
+
m.className = "color-picker-format-select", this.select = m;
|
|
2521
|
+
const f = document.createElement("option");
|
|
2522
|
+
f.value = "hex", f.textContent = "HEX";
|
|
2376
2523
|
const b = document.createElement("option");
|
|
2377
2524
|
b.value = "rgb", b.textContent = "RGB";
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2384
|
-
const
|
|
2385
|
-
return
|
|
2386
|
-
|
|
2525
|
+
const L = document.createElement("option");
|
|
2526
|
+
L.value = "hsl", L.textContent = "HSL", m.appendChild(f), m.appendChild(b), m.appendChild(L);
|
|
2527
|
+
const C = document.createElement("input");
|
|
2528
|
+
C.type = "text", C.className = "color-picker-color-input", C.value = this.currentColor, this.input = C;
|
|
2529
|
+
const O = document.createElement("div");
|
|
2530
|
+
O.className = "color-picker-input-container";
|
|
2531
|
+
const k = document.createElement("button");
|
|
2532
|
+
return k.className = "color-picker-copy-inside", k.textContent = "Copy", O.appendChild(C), O.appendChild(k), u.appendChild(m), u.appendChild(O), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", (T) => T.stopPropagation()), this.bind(n, r, p, C, m, k, l), t;
|
|
2533
|
+
}
|
|
2534
|
+
createBackdrop() {
|
|
2535
|
+
const t = document.createElement("div");
|
|
2536
|
+
return t.className = "color-picker-backdrop", t.style.display = "none", t.addEventListener("click", (e) => {
|
|
2537
|
+
e.preventDefault(), e.stopPropagation(), this.close(!1);
|
|
2387
2538
|
}), t;
|
|
2388
2539
|
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
}), this.hueSlider.addEventListener("mousedown", (t) => this.startHueDrag(t)), this.hueSlider.addEventListener("click", (t) => {
|
|
2406
|
-
t.stopPropagation();
|
|
2407
|
-
}), this.formatSelect.addEventListener("change", () => this.updateColorInput()), this.hexInput.addEventListener(
|
|
2408
|
-
"input",
|
|
2409
|
-
(t) => this.updateColorFromInput(t)
|
|
2410
|
-
), this.hexInput.addEventListener("blur", (t) => {
|
|
2411
|
-
this.validateColorInput(t), this.queueRecentColor(this.currentColor);
|
|
2412
|
-
}), this.hexInput.addEventListener("keydown", (t) => {
|
|
2413
|
-
t.key === "Enter" && (t.preventDefault(), this.validateColorInput(t), this.queueRecentColor(this.currentColor), this.close(!0));
|
|
2414
|
-
}), this.opacitySlider.addEventListener(
|
|
2415
|
-
"mousedown",
|
|
2416
|
-
(t) => this.startOpacityDrag(t)
|
|
2417
|
-
), this.opacitySlider.addEventListener("click", (t) => {
|
|
2418
|
-
t.stopPropagation();
|
|
2419
|
-
});
|
|
2420
|
-
}
|
|
2421
|
-
startColorDrag(t) {
|
|
2422
|
-
t.preventDefault(), t.stopPropagation(), this.isColorDragging = !0, this.updateColorFromArea(t);
|
|
2423
|
-
const e = (s) => this.updateColorFromArea(s), i = () => {
|
|
2424
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i), this.isColorDragging = !1, this.queueRecentColor(this.currentColor);
|
|
2540
|
+
bind(t, e, i, s, n, o, a) {
|
|
2541
|
+
const l = (p) => {
|
|
2542
|
+
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), u = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
2543
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
2544
|
+
const f = parseFloat(this.hueMarker.style.left || "0%") / 100 * 360, b = W(f, g, 1 - u);
|
|
2545
|
+
this.setColor(b);
|
|
2546
|
+
}, r = (p) => {
|
|
2547
|
+
const d = e.getBoundingClientRect();
|
|
2548
|
+
let g = Math.max(1e-3, Math.min(0.999, (p.clientX - d.left) / d.width));
|
|
2549
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
2550
|
+
const u = g * 360, m = parseFloat(this.colorMarker.style.left || "0%") / 100, f = parseFloat(this.colorMarker.style.top || "0%") / 100, b = W(u, m, 1 - f);
|
|
2551
|
+
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.setColor(b);
|
|
2552
|
+
}, h = (p) => {
|
|
2553
|
+
var u;
|
|
2554
|
+
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2555
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (u = this.onChange) == null || u.call(this, this.currentColor, this.currentOpacity);
|
|
2425
2556
|
};
|
|
2426
|
-
|
|
2557
|
+
t.addEventListener("mousedown", (p) => {
|
|
2558
|
+
p.preventDefault(), l(p);
|
|
2559
|
+
const d = (u) => l(u), g = () => {
|
|
2560
|
+
var u;
|
|
2561
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2562
|
+
};
|
|
2563
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2564
|
+
}), e.addEventListener("mousedown", (p) => {
|
|
2565
|
+
p.preventDefault(), r(p);
|
|
2566
|
+
const d = (u) => r(u), g = () => {
|
|
2567
|
+
var u;
|
|
2568
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2569
|
+
};
|
|
2570
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2571
|
+
}), i.addEventListener("mousedown", (p) => {
|
|
2572
|
+
p.preventDefault(), h(p);
|
|
2573
|
+
const d = (u) => h(u), g = () => {
|
|
2574
|
+
var u;
|
|
2575
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), N.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2576
|
+
};
|
|
2577
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2578
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
|
|
2579
|
+
p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
|
|
2580
|
+
}), o.addEventListener("click", async () => {
|
|
2581
|
+
try {
|
|
2582
|
+
await navigator.clipboard.writeText(s.value);
|
|
2583
|
+
} catch {
|
|
2584
|
+
s.select(), document.execCommand("copy");
|
|
2585
|
+
}
|
|
2586
|
+
}), a.addEventListener("click", async () => {
|
|
2587
|
+
var p, d;
|
|
2588
|
+
if (!("EyeDropper" in window)) {
|
|
2589
|
+
alert("EyeDropper API is not supported in this browser.");
|
|
2590
|
+
return;
|
|
2591
|
+
}
|
|
2592
|
+
try {
|
|
2593
|
+
const g = new window.EyeDropper(), { sRGBHex: u } = await g.open();
|
|
2594
|
+
this.setColor(u), (p = this.onChange) == null || p.call(this, u, this.currentOpacity), N.addColor(u, this.recentScope), (d = this.recentSectionRefresh) == null || d.call(this);
|
|
2595
|
+
} catch {
|
|
2596
|
+
}
|
|
2597
|
+
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
2598
|
+
() => document.addEventListener("click", this.outsideClick, !0),
|
|
2599
|
+
0
|
|
2600
|
+
);
|
|
2427
2601
|
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
};
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
hueValue: i * 360,
|
|
2446
|
-
percent: i * 100
|
|
2447
|
-
}), this.hueMarker.style.left = `${i * 100}%`;
|
|
2448
|
-
const s = i * 360;
|
|
2449
|
-
this.updateHue(s), this.isUpdatingHue = !1;
|
|
2450
|
-
}
|
|
2451
|
-
updateColorFromSV(t, e) {
|
|
2452
|
-
const i = this.getCurrentHue(), s = this.hsvToHex(i, t, e);
|
|
2453
|
-
this.setColor(s);
|
|
2454
|
-
}
|
|
2455
|
-
updateHue(t) {
|
|
2456
|
-
const e = t;
|
|
2457
|
-
t = Math.max(0.5, Math.min(358.5, t)), console.log("UpdateHue:", { originalHue: e, clampedHue: t }), this.colorArea.getBoundingClientRect();
|
|
2458
|
-
const i = parseFloat(this.colorMarker.style.left || "50%") / 100, s = parseFloat(this.colorMarker.style.top || "50%") / 100;
|
|
2459
|
-
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`;
|
|
2460
|
-
const n = i, o = 1 - s, a = this.hsvToHex(t, n, o);
|
|
2461
|
-
this.setColor(a);
|
|
2462
|
-
}
|
|
2463
|
-
getCurrentHue() {
|
|
2464
|
-
const t = parseFloat(this.hueMarker.style.left || "0%") / 100, e = t * 360;
|
|
2465
|
-
return console.log("GetCurrentHue:", { huePosition: t, hueValue: e }), Math.max(0.5, Math.min(358.5, e));
|
|
2466
|
-
}
|
|
2467
|
-
updateColorInput() {
|
|
2468
|
-
const t = this.formatSelect.value, { h: e, s: i, v: s } = this.hexToHsv(this.currentColor);
|
|
2469
|
-
switch (t) {
|
|
2470
|
-
case "hex":
|
|
2471
|
-
this.hexInput.value = this.currentColor;
|
|
2472
|
-
break;
|
|
2473
|
-
case "rgb":
|
|
2474
|
-
const { r: n, g: o, b: a } = this.hexToRgb(this.currentColor);
|
|
2475
|
-
this.hexInput.value = `rgb(${n}, ${o}, ${a})`;
|
|
2476
|
-
break;
|
|
2477
|
-
case "hsl":
|
|
2478
|
-
const { hue: l, sat: r, lightness: c } = this.hsvToHsl(e, i, s);
|
|
2479
|
-
this.hexInput.value = `hsl(${Math.round(l)}, ${Math.round(
|
|
2480
|
-
r * 100
|
|
2481
|
-
)}%, ${Math.round(c * 100)}%)`;
|
|
2482
|
-
break;
|
|
2602
|
+
setColor(t) {
|
|
2603
|
+
var n;
|
|
2604
|
+
this.currentColor = t;
|
|
2605
|
+
const { h: e, s: i, v: s } = $(t);
|
|
2606
|
+
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.syncInput(), this.updateOpacityBg(), (n = this.onChange) == null || n.call(this, t, this.currentOpacity);
|
|
2607
|
+
}
|
|
2608
|
+
syncInput() {
|
|
2609
|
+
const t = this.select.value, { h: e, s: i, v: s } = $(this.currentColor);
|
|
2610
|
+
if (t === "hex") this.input.value = this.currentColor;
|
|
2611
|
+
else if (t === "rgb") {
|
|
2612
|
+
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
2613
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2614
|
+
} else {
|
|
2615
|
+
const { hue: n, sat: o, lightness: a } = Rt(e, i, s);
|
|
2616
|
+
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2617
|
+
o * 100
|
|
2618
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
2483
2619
|
}
|
|
2484
2620
|
}
|
|
2485
|
-
|
|
2486
|
-
const
|
|
2487
|
-
let
|
|
2488
|
-
if (
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
const o = parseInt(n[1]), a = parseInt(n[2]) / 100, l = parseInt(n[3]) / 100;
|
|
2500
|
-
if (o <= 360 && a <= 1 && l <= 1) {
|
|
2501
|
-
const r = l + a * Math.min(l, 1 - l), c = r === 0 ? 0 : 2 * (1 - l / r);
|
|
2502
|
-
s = this.hsvToHex(o, c, r);
|
|
2621
|
+
applyFromInput() {
|
|
2622
|
+
const t = this.input.value.trim();
|
|
2623
|
+
let e = "";
|
|
2624
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(t)) e = t;
|
|
2625
|
+
else {
|
|
2626
|
+
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2627
|
+
if (i) {
|
|
2628
|
+
const s = parseInt(i[1]), n = parseInt(i[2]), o = parseInt(i[3]);
|
|
2629
|
+
s <= 255 && n <= 255 && o <= 255 && (e = `#${[s, n, o].map((a) => a.toString(16).padStart(2, "0")).join("")}`);
|
|
2630
|
+
} else {
|
|
2631
|
+
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2632
|
+
if (s) {
|
|
2633
|
+
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);
|
|
2634
|
+
e = W(n, r, l);
|
|
2503
2635
|
}
|
|
2504
2636
|
}
|
|
2505
2637
|
}
|
|
2506
|
-
|
|
2507
|
-
}
|
|
2508
|
-
validateColorInput(t) {
|
|
2509
|
-
this.updateColorInput();
|
|
2510
|
-
}
|
|
2511
|
-
startOpacityDrag(t) {
|
|
2512
|
-
t.preventDefault(), t.stopPropagation(), this.isOpacityDragging = !0, this.updateOpacityFromSlider(t);
|
|
2513
|
-
const e = (s) => this.updateOpacityFromSlider(s), i = () => {
|
|
2514
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i), this.isOpacityDragging = !1, this.queueRecentColor(this.currentColor);
|
|
2515
|
-
};
|
|
2516
|
-
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2638
|
+
e && this.setColor(e);
|
|
2517
2639
|
}
|
|
2518
|
-
|
|
2519
|
-
const
|
|
2520
|
-
this.opacityMarker.style.left = `${i * 100}%`, this.currentOpacity = Math.round(i * 100), this.onColorChange && this.onColorChange(this.currentColor, this.currentOpacity);
|
|
2521
|
-
}
|
|
2522
|
-
updateOpacityBackground() {
|
|
2523
|
-
const { r: t, g: e, b: i } = this.hexToRgb(this.currentColor);
|
|
2640
|
+
updateOpacityBg() {
|
|
2641
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
2524
2642
|
this.opacitySlider.style.setProperty(
|
|
2525
2643
|
"--base-color",
|
|
2526
2644
|
`rgb(${t}, ${e}, ${i})`
|
|
2527
2645
|
);
|
|
2528
2646
|
}
|
|
2529
|
-
|
|
2530
|
-
|
|
2647
|
+
open(t, e, i) {
|
|
2648
|
+
var C;
|
|
2649
|
+
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2650
|
+
const { h: s, s: n, v: o } = $(t);
|
|
2651
|
+
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}%`, (C = this.recentSectionRefresh) == null || C.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);
|
|
2652
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2653
|
+
let g = r.right + 8, u = r.top;
|
|
2654
|
+
const m = h - r.right, f = r.left;
|
|
2655
|
+
m >= a + d ? g = r.right + 8 : f >= a + d ? g = r.left - a - 8 : g = Math.max(d, (h - a) / 2);
|
|
2656
|
+
const b = p - r.bottom, L = r.top;
|
|
2657
|
+
b >= l + d ? u = r.bottom + 8 : L >= l + d ? u = r.top - l - 8 : b > L ? (u = r.bottom + 8, u + l > p - d && (u = p - l - d)) : (u = r.top - l - 8, u < d && (u = d)), this.element.style.left = `${g}px`, this.element.style.top = `${u}px`;
|
|
2658
|
+
}
|
|
2659
|
+
close(t) {
|
|
2660
|
+
var e;
|
|
2661
|
+
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 && (N.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2531
2662
|
}
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
2535
|
-
let a = 0, l = 0, r = 0;
|
|
2536
|
-
return t < 60 ? (a = s, l = n, r = 0) : t < 120 ? (a = n, l = s, r = 0) : t < 180 ? (a = 0, l = s, r = n) : t < 240 ? (a = 0, l = n, r = s) : t < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), a = Math.round((a + o) * 255), l = Math.round((l + o) * 255), r = Math.round((r + o) * 255), `#${a.toString(16).padStart(2, "0")}${l.toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}`;
|
|
2663
|
+
getElement() {
|
|
2664
|
+
return this.element;
|
|
2537
2665
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2666
|
+
}
|
|
2667
|
+
class _t {
|
|
2668
|
+
constructor(t) {
|
|
2669
|
+
this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.container = this.createContainer(), this.initializePicker();
|
|
2540
2670
|
}
|
|
2541
|
-
|
|
2542
|
-
const
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2671
|
+
createContainer() {
|
|
2672
|
+
const t = document.createElement("div");
|
|
2673
|
+
return t.className = "embedded-color-picker-content", t.innerHTML = `
|
|
2674
|
+
<div class="color-picker-area embedded">
|
|
2675
|
+
<div class="color-picker-marker"></div>
|
|
2676
|
+
</div>
|
|
2677
|
+
<div class="color-picker-hue-container">
|
|
2678
|
+
<button class="color-picker-eyedropper">
|
|
2679
|
+
<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2680
|
+
<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"/>
|
|
2681
|
+
</svg>
|
|
2682
|
+
</button>
|
|
2683
|
+
<div class="color-picker-hue embedded">
|
|
2684
|
+
<div class="color-picker-hue-marker"></div>
|
|
2685
|
+
</div>
|
|
2686
|
+
</div>
|
|
2687
|
+
<div class="color-picker-opacity embedded">
|
|
2688
|
+
<div class="color-picker-opacity-marker"></div>
|
|
2689
|
+
</div>
|
|
2690
|
+
<div class="color-picker-format-section embedded">
|
|
2691
|
+
<select class="color-picker-format-select">
|
|
2692
|
+
<option value="hex">HEX</option>
|
|
2693
|
+
<option value="rgb">RGB</option>
|
|
2694
|
+
<option value="hsl">HSL</option>
|
|
2695
|
+
</select>
|
|
2696
|
+
<div class="color-picker-input-container">
|
|
2697
|
+
<input type="text" class="color-picker-color-input" />
|
|
2698
|
+
<button class="color-picker-copy-inside">Copy</button>
|
|
2699
|
+
</div>
|
|
2700
|
+
</div>
|
|
2701
|
+
`, t;
|
|
2702
|
+
}
|
|
2703
|
+
initializePicker() {
|
|
2704
|
+
const t = this.container.querySelector(
|
|
2705
|
+
".color-picker-area"
|
|
2706
|
+
), e = this.container.querySelector(
|
|
2707
|
+
".color-picker-marker"
|
|
2708
|
+
), i = this.container.querySelector(
|
|
2709
|
+
".color-picker-hue"
|
|
2710
|
+
), s = this.container.querySelector(
|
|
2711
|
+
".color-picker-hue-marker"
|
|
2712
|
+
), n = this.container.querySelector(
|
|
2713
|
+
".color-picker-opacity"
|
|
2714
|
+
), o = this.container.querySelector(
|
|
2715
|
+
".color-picker-opacity-marker"
|
|
2716
|
+
), a = this.container.querySelector(
|
|
2717
|
+
".color-picker-format-select"
|
|
2718
|
+
), l = this.container.querySelector(
|
|
2719
|
+
".color-picker-color-input"
|
|
2720
|
+
), r = this.container.querySelector(
|
|
2721
|
+
".color-picker-copy-inside"
|
|
2722
|
+
), { h, s: p, v: d } = $(this.currentColor);
|
|
2723
|
+
s.style.left = `${h / 360 * 100}%`, e.style.left = `${p * 100}%`, e.style.top = `${(1 - d) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`, o.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(n), this.updateColorInput(a, l), this.setupColorAreaEvents(t, e, s), this.setupHueSliderEvents(
|
|
2724
|
+
i,
|
|
2725
|
+
s,
|
|
2726
|
+
t,
|
|
2727
|
+
e,
|
|
2728
|
+
a,
|
|
2729
|
+
l,
|
|
2730
|
+
n
|
|
2731
|
+
), this.setupOpacitySliderEvents(n, o), this.setupFormatEvents(a, l, r);
|
|
2732
|
+
}
|
|
2733
|
+
updateOpacityBackground(t) {
|
|
2734
|
+
const e = S(this.currentColor);
|
|
2735
|
+
t.style.setProperty(
|
|
2736
|
+
"--base-color",
|
|
2737
|
+
`rgb(${e.r}, ${e.g}, ${e.b})`
|
|
2738
|
+
);
|
|
2739
|
+
}
|
|
2740
|
+
updateColorInput(t, e) {
|
|
2741
|
+
switch (t.value) {
|
|
2742
|
+
case "hex":
|
|
2743
|
+
e.value = this.currentColor;
|
|
2744
|
+
break;
|
|
2745
|
+
case "rgb":
|
|
2746
|
+
const s = S(this.currentColor);
|
|
2747
|
+
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2748
|
+
break;
|
|
2749
|
+
case "hsl":
|
|
2750
|
+
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);
|
|
2751
|
+
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2752
|
+
r * 100
|
|
2753
|
+
)}%, ${Math.round(l * 100)}%)`;
|
|
2754
|
+
break;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
setupColorAreaEvents(t, e, i) {
|
|
2758
|
+
const s = (n) => {
|
|
2759
|
+
const o = t.getBoundingClientRect(), a = Math.max(0, Math.min(1, (n.clientX - o.left) / o.width)), l = Math.max(0, Math.min(1, (n.clientY - o.top) / o.height));
|
|
2760
|
+
e.style.left = `${a * 100}%`, e.style.top = `${l * 100}%`;
|
|
2761
|
+
const r = parseFloat(i.style.left || "0%") / 100 * 360, h = W(r, a, 1 - l);
|
|
2762
|
+
this.currentColor = h;
|
|
2763
|
+
const p = this.container.querySelector(
|
|
2764
|
+
".color-picker-format-select"
|
|
2765
|
+
), d = this.container.querySelector(
|
|
2766
|
+
".color-picker-color-input"
|
|
2767
|
+
), g = this.container.querySelector(
|
|
2768
|
+
".color-picker-opacity"
|
|
2769
|
+
);
|
|
2770
|
+
this.updateColorInput(p, d), this.updateOpacityBackground(g), this.triggerChange();
|
|
2554
2771
|
};
|
|
2555
|
-
t.addEventListener("
|
|
2772
|
+
t.addEventListener("mousedown", (n) => {
|
|
2773
|
+
n.preventDefault(), s(n);
|
|
2774
|
+
const o = (l) => s(l), a = () => {
|
|
2775
|
+
document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", a);
|
|
2776
|
+
};
|
|
2777
|
+
document.addEventListener("mousemove", o), document.addEventListener("mouseup", a);
|
|
2778
|
+
});
|
|
2556
2779
|
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2780
|
+
setupHueSliderEvents(t, e, i, s, n, o, a) {
|
|
2781
|
+
const l = (r) => {
|
|
2782
|
+
const h = t.getBoundingClientRect();
|
|
2783
|
+
let p = (r.clientX - h.left) / h.width;
|
|
2784
|
+
p = Math.max(1e-3, Math.min(0.999, p)), e.style.left = `${p * 100}%`;
|
|
2785
|
+
const d = p * 360, g = parseFloat(s.style.left || "50%") / 100, u = parseFloat(s.style.top || "50%") / 100;
|
|
2786
|
+
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2787
|
+
const m = W(d, g, 1 - u);
|
|
2788
|
+
this.currentColor = m, this.updateColorInput(n, o), this.updateOpacityBackground(a), this.triggerChange();
|
|
2789
|
+
};
|
|
2790
|
+
t.addEventListener("mousedown", (r) => {
|
|
2791
|
+
r.preventDefault(), l(r);
|
|
2792
|
+
const h = (d) => l(d), p = () => {
|
|
2793
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", p);
|
|
2794
|
+
};
|
|
2795
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", p);
|
|
2796
|
+
});
|
|
2559
2797
|
}
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2798
|
+
setupOpacitySliderEvents(t, e) {
|
|
2799
|
+
const i = (s) => {
|
|
2800
|
+
const n = t.getBoundingClientRect(), o = Math.max(0, Math.min(1, (s.clientX - n.left) / n.width));
|
|
2801
|
+
e.style.left = `${o * 100}%`, this.currentOpacity = Math.round(o * 100), this.triggerChange();
|
|
2802
|
+
};
|
|
2803
|
+
t.addEventListener("mousedown", (s) => {
|
|
2804
|
+
s.preventDefault(), i(s);
|
|
2805
|
+
const n = (a) => i(a), o = () => {
|
|
2806
|
+
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", o);
|
|
2807
|
+
};
|
|
2808
|
+
document.addEventListener("mousemove", n), document.addEventListener("mouseup", o);
|
|
2563
2809
|
});
|
|
2564
2810
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
},
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
}
|
|
2578
|
-
hexToHsv(t) {
|
|
2579
|
-
const e = parseInt(t.slice(1, 3), 16) / 255, i = parseInt(t.slice(3, 5), 16) / 255, s = parseInt(t.slice(5, 7), 16) / 255, n = Math.max(e, i, s), o = Math.min(e, i, s), a = n - o;
|
|
2580
|
-
let l = 0;
|
|
2581
|
-
const r = n === 0 ? 0 : a / n, c = n;
|
|
2582
|
-
return a !== 0 && (n === e ? l = (i - s) / a % 6 : n === i ? l = (s - e) / a + 2 : l = (e - i) / a + 4), { h: l * 60, s: r, v: c };
|
|
2811
|
+
setupFormatEvents(t, e, i) {
|
|
2812
|
+
t.addEventListener("change", () => {
|
|
2813
|
+
this.updateColorInput(t, e);
|
|
2814
|
+
}), i.addEventListener("click", () => {
|
|
2815
|
+
navigator.clipboard.writeText(e.value).catch(() => {
|
|
2816
|
+
e.select(), document.execCommand("copy");
|
|
2817
|
+
});
|
|
2818
|
+
}), e.addEventListener("input", () => {
|
|
2819
|
+
this.handleManualColorInput(e.value, t);
|
|
2820
|
+
}), e.addEventListener("blur", () => {
|
|
2821
|
+
this.updateColorInput(t, e);
|
|
2822
|
+
});
|
|
2583
2823
|
}
|
|
2584
|
-
|
|
2585
|
-
const
|
|
2586
|
-
|
|
2824
|
+
handleManualColorInput(t, e) {
|
|
2825
|
+
const i = t.trim();
|
|
2826
|
+
let s = null;
|
|
2827
|
+
switch (e.value) {
|
|
2828
|
+
case "hex":
|
|
2829
|
+
s = this.parseHexInput(i);
|
|
2830
|
+
break;
|
|
2831
|
+
case "rgb":
|
|
2832
|
+
s = this.parseRgbInput(i);
|
|
2833
|
+
break;
|
|
2834
|
+
case "hsl":
|
|
2835
|
+
s = this.parseHslInput(i);
|
|
2836
|
+
break;
|
|
2837
|
+
}
|
|
2838
|
+
s || (s = this.autoDetectColorFormat(i)), s && (this.currentColor = s, this.updatePickerVisualState(), this.triggerChange());
|
|
2587
2839
|
}
|
|
2588
|
-
|
|
2589
|
-
const
|
|
2590
|
-
return
|
|
2840
|
+
parseHexInput(t) {
|
|
2841
|
+
const e = t.startsWith("#") ? t : `#${t}`;
|
|
2842
|
+
return R(e);
|
|
2591
2843
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
}
|
|
2601
|
-
|
|
2602
|
-
h.preventDefault(), h.stopPropagation();
|
|
2603
|
-
const d = h.clientX - s, C = h.clientY - n;
|
|
2604
|
-
let u = o + d, f = a + C;
|
|
2605
|
-
const v = window.innerWidth, b = window.innerHeight, m = e.offsetWidth, L = e.offsetHeight;
|
|
2606
|
-
u = Math.max(8, Math.min(v - m - 8, u)), f = Math.max(8, Math.min(b - L - 8, f)), e.style.left = `${u}px`, e.style.top = `${f}px`;
|
|
2607
|
-
}, c = (h) => {
|
|
2608
|
-
i && (i = !1, h.preventDefault(), h.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2609
|
-
};
|
|
2610
|
-
t.addEventListener("mousedown", l);
|
|
2844
|
+
parseRgbInput(t) {
|
|
2845
|
+
const e = t.match(
|
|
2846
|
+
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/
|
|
2847
|
+
);
|
|
2848
|
+
if (e) {
|
|
2849
|
+
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
2850
|
+
if (i <= 255 && s <= 255 && n <= 255)
|
|
2851
|
+
return D(i, s, n);
|
|
2852
|
+
}
|
|
2853
|
+
return null;
|
|
2611
2854
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2855
|
+
parseHslInput(t) {
|
|
2856
|
+
const e = t.match(
|
|
2857
|
+
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\s*\)/
|
|
2858
|
+
);
|
|
2859
|
+
if (e) {
|
|
2860
|
+
const i = parseFloat(e[1]), s = parseFloat(e[2]) / 100, n = parseFloat(e[3]) / 100;
|
|
2861
|
+
if (i >= 0 && i <= 360 && s >= 0 && s <= 1 && n >= 0 && n <= 1) {
|
|
2862
|
+
const o = J(i, s, n);
|
|
2863
|
+
return D(o.r, o.g, o.b);
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
return null;
|
|
2867
|
+
}
|
|
2868
|
+
autoDetectColorFormat(t) {
|
|
2869
|
+
const e = this.parseHexInput(t);
|
|
2870
|
+
if (e) return e;
|
|
2871
|
+
const i = this.parseRgbInput(t);
|
|
2872
|
+
if (i) return i;
|
|
2873
|
+
const s = this.parseHslInput(t);
|
|
2874
|
+
return s || null;
|
|
2875
|
+
}
|
|
2876
|
+
updatePickerVisualState() {
|
|
2877
|
+
const t = this.container.querySelector(
|
|
2878
|
+
".color-picker-area"
|
|
2879
|
+
), e = this.container.querySelector(
|
|
2880
|
+
".color-picker-marker"
|
|
2881
|
+
), i = this.container.querySelector(
|
|
2882
|
+
".color-picker-hue-marker"
|
|
2883
|
+
), s = this.container.querySelector(
|
|
2884
|
+
".color-picker-opacity"
|
|
2885
|
+
);
|
|
2886
|
+
this.container.querySelector(
|
|
2887
|
+
".color-picker-format-select"
|
|
2888
|
+
), this.container.querySelector(
|
|
2889
|
+
".color-picker-color-input"
|
|
2890
|
+
);
|
|
2891
|
+
const { h: n, s: o, v: a } = $(this.currentColor);
|
|
2892
|
+
i.style.left = `${n / 360 * 100}%`, e.style.left = `${o * 100}%`, e.style.top = `${(1 - a) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.updateOpacityBackground(s);
|
|
2893
|
+
}
|
|
2894
|
+
triggerChange() {
|
|
2895
|
+
this.onColorChange(this.currentColor, this.currentOpacity);
|
|
2614
2896
|
}
|
|
2615
2897
|
getElement() {
|
|
2616
|
-
return this.
|
|
2898
|
+
return this.container;
|
|
2899
|
+
}
|
|
2900
|
+
updateColor(t, e) {
|
|
2901
|
+
this.currentColor = t, this.currentOpacity = e;
|
|
2902
|
+
const i = this.container.querySelector(
|
|
2903
|
+
".color-picker-area"
|
|
2904
|
+
), s = this.container.querySelector(
|
|
2905
|
+
".color-picker-marker"
|
|
2906
|
+
), n = this.container.querySelector(
|
|
2907
|
+
".color-picker-hue-marker"
|
|
2908
|
+
), o = this.container.querySelector(
|
|
2909
|
+
".color-picker-opacity-marker"
|
|
2910
|
+
), a = this.container.querySelector(
|
|
2911
|
+
".color-picker-opacity"
|
|
2912
|
+
), l = this.container.querySelector(
|
|
2913
|
+
".color-picker-format-select"
|
|
2914
|
+
), r = this.container.querySelector(
|
|
2915
|
+
".color-picker-color-input"
|
|
2916
|
+
), { h, s: p, v: d } = $(t);
|
|
2917
|
+
n.style.left = `${h / 360 * 100}%`, s.style.left = `${p * 100}%`, s.style.top = `${(1 - d) * 100}%`, i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`, o.style.left = `${e}%`, this.updateOpacityBackground(a), this.updateColorInput(l, r);
|
|
2617
2918
|
}
|
|
2618
2919
|
}
|
|
2619
|
-
|
|
2920
|
+
const nt = (c) => {
|
|
2921
|
+
const t = [];
|
|
2922
|
+
let e = "", i = 0;
|
|
2923
|
+
for (let s = 0; s < c.length; s++) {
|
|
2924
|
+
const n = c[s];
|
|
2925
|
+
if (n === "(") i++;
|
|
2926
|
+
else if (n === ")") i--;
|
|
2927
|
+
else if (n === "," && i === 0) {
|
|
2928
|
+
t.push(e.trim()), e = "";
|
|
2929
|
+
continue;
|
|
2930
|
+
}
|
|
2931
|
+
e += n;
|
|
2932
|
+
}
|
|
2933
|
+
return e.trim() && t.push(e.trim()), t;
|
|
2934
|
+
}, ot = (c, t) => {
|
|
2935
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2936
|
+
if (!i) return null;
|
|
2937
|
+
const s = i.index + i[0].length;
|
|
2938
|
+
let n = 1, o = s;
|
|
2939
|
+
for (let a = s; a < c.length && n > 0; a++)
|
|
2940
|
+
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2941
|
+
return n === 0 ? c.substring(s, o) : null;
|
|
2942
|
+
}, Jt = (c) => {
|
|
2943
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2944
|
+
return [
|
|
2945
|
+
"circle",
|
|
2946
|
+
"ellipse",
|
|
2947
|
+
"closest-side",
|
|
2948
|
+
"closest-corner",
|
|
2949
|
+
"farthest-side",
|
|
2950
|
+
"farthest-corner",
|
|
2951
|
+
"at",
|
|
2952
|
+
"contain",
|
|
2953
|
+
"cover"
|
|
2954
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Ft(t);
|
|
2955
|
+
}, at = (c) => {
|
|
2956
|
+
const t = [];
|
|
2957
|
+
return c.forEach((e, i) => {
|
|
2958
|
+
const s = e.trim();
|
|
2959
|
+
if (!s) return;
|
|
2960
|
+
let n = "", o = 0;
|
|
2961
|
+
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2962
|
+
a && ht(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2963
|
+
const l = pt(n);
|
|
2964
|
+
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2965
|
+
}), t;
|
|
2966
|
+
}, A = (c) => {
|
|
2967
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2968
|
+
return {
|
|
2969
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2970
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2971
|
+
stops: t.map((e, i) => ({
|
|
2972
|
+
color: e.color || "#000000",
|
|
2973
|
+
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2974
|
+
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2975
|
+
}))
|
|
2976
|
+
};
|
|
2977
|
+
}, Y = (c) => {
|
|
2978
|
+
const t = c.replace(/;$/, "").trim();
|
|
2979
|
+
if (Gt(t)) {
|
|
2980
|
+
const s = pt(t);
|
|
2981
|
+
return A({ type: "solid", angle: 0, stops: [s] });
|
|
2982
|
+
}
|
|
2983
|
+
const e = ot(t, "linear-gradient");
|
|
2984
|
+
if (e) {
|
|
2985
|
+
const s = nt(e);
|
|
2986
|
+
let n = 90, o = s;
|
|
2987
|
+
const a = s[0];
|
|
2988
|
+
if (a.includes("deg")) {
|
|
2989
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2990
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2991
|
+
} else a.includes("to ") && (n = {
|
|
2992
|
+
"to right": 90,
|
|
2993
|
+
"to left": 270,
|
|
2994
|
+
"to bottom": 180,
|
|
2995
|
+
"to top": 0,
|
|
2996
|
+
"to bottom right": 135,
|
|
2997
|
+
"to bottom left": 225,
|
|
2998
|
+
"to top right": 45,
|
|
2999
|
+
"to top left": 315
|
|
3000
|
+
}[a] ?? 90, o = s.slice(1));
|
|
3001
|
+
const l = at(o);
|
|
3002
|
+
return l.length ? A({ type: "linear", angle: n, stops: l }) : null;
|
|
3003
|
+
}
|
|
3004
|
+
const i = ot(t, "radial-gradient");
|
|
3005
|
+
if (i) {
|
|
3006
|
+
const s = nt(i), n = s[0] && !Jt(s[0]) ? s.slice(1) : s, o = at(n);
|
|
3007
|
+
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
3008
|
+
}
|
|
3009
|
+
return null;
|
|
3010
|
+
}, H = (c) => {
|
|
3011
|
+
if (c.type === "solid") {
|
|
3012
|
+
const e = c.stops[0], i = e.opacity ?? 100, s = e.color.replace("#", ""), n = Math.round(i / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3013
|
+
return `#${s}${n}`;
|
|
3014
|
+
}
|
|
3015
|
+
const t = c.stops.map(
|
|
3016
|
+
(e) => `${ct(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
3017
|
+
).join(", ");
|
|
3018
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
3019
|
+
}, K = (c) => {
|
|
3020
|
+
if (c.type === "solid") {
|
|
3021
|
+
const t = c.stops[0];
|
|
3022
|
+
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
3023
|
+
}
|
|
3024
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
3025
|
+
};
|
|
3026
|
+
class Ce extends E {
|
|
2620
3027
|
constructor(t = {}) {
|
|
3028
|
+
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
2621
3029
|
super({
|
|
2622
3030
|
...t,
|
|
2623
3031
|
title: t.title || "Gradient",
|
|
2624
|
-
default:
|
|
2625
|
-
type: "linear",
|
|
2626
|
-
angle: 90,
|
|
2627
|
-
stops: [
|
|
2628
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2629
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2630
|
-
]
|
|
2631
|
-
}
|
|
3032
|
+
default: e
|
|
2632
3033
|
}), this.inputType = {
|
|
2633
3034
|
type: "text",
|
|
2634
3035
|
angle: "number",
|
|
2635
3036
|
stops: "text"
|
|
2636
|
-
}, this.element = null, this.
|
|
2637
|
-
var
|
|
2638
|
-
if (!this.
|
|
2639
|
-
const
|
|
2640
|
-
|
|
2641
|
-
);
|
|
2642
|
-
!
|
|
2643
|
-
}, this.detectChange = t.detectChange, this.forText = t.forText || !1;
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
const t = this.
|
|
3037
|
+
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.onBackgroundClick = (i) => {
|
|
3038
|
+
var p;
|
|
3039
|
+
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3040
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((d) => d.contains(s)), r = s.closest(
|
|
3041
|
+
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3042
|
+
), h = s.classList.contains("color-picker-backdrop");
|
|
3043
|
+
!n && !o && !l && !r && !h && this.closePopover();
|
|
3044
|
+
}, this.detectChange = t.detectChange, this.forText = t.forText || !1, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3045
|
+
}
|
|
3046
|
+
defaultValue() {
|
|
3047
|
+
const t = this.originalDefault;
|
|
3048
|
+
if (typeof t == "string") {
|
|
3049
|
+
const i = Y(t);
|
|
3050
|
+
if (i)
|
|
3051
|
+
return A(i);
|
|
3052
|
+
}
|
|
3053
|
+
return A(t && typeof t == "object" ? t : {
|
|
2647
3054
|
type: "linear",
|
|
2648
3055
|
angle: 90,
|
|
2649
3056
|
stops: [
|
|
2650
3057
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2651
3058
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2652
3059
|
]
|
|
2653
|
-
};
|
|
2654
|
-
return this.normalizeGradientValue(t);
|
|
2655
|
-
}
|
|
2656
|
-
normalizeGradientValue(t) {
|
|
2657
|
-
const e = t.stops && t.stops.length > 0 ? t.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2658
|
-
return {
|
|
2659
|
-
type: t.type && ["linear", "radial", "solid"].includes(t.type) ? t.type : "linear",
|
|
2660
|
-
angle: typeof t.angle == "number" ? t.angle : 90,
|
|
2661
|
-
stops: e.map((i, s) => ({
|
|
2662
|
-
color: i.color || "#000000",
|
|
2663
|
-
position: typeof i.position == "number" ? i.position : e.length === 1 ? 0 : Math.round(s / (e.length - 1) * 100),
|
|
2664
|
-
opacity: i.opacity === void 0 || Number.isNaN(i.opacity) ? 100 : i.opacity
|
|
2665
|
-
}))
|
|
2666
|
-
};
|
|
2667
|
-
}
|
|
2668
|
-
resolveValueFromString(t) {
|
|
2669
|
-
const e = (t || "").trim();
|
|
2670
|
-
if (!e)
|
|
2671
|
-
return null;
|
|
2672
|
-
const i = this.parseGradientCSS(e);
|
|
2673
|
-
return i ? this.normalizeGradientValue(i) : null;
|
|
3060
|
+
});
|
|
2674
3061
|
}
|
|
2675
3062
|
setValue(t) {
|
|
3063
|
+
var i, s;
|
|
2676
3064
|
let e = null;
|
|
2677
|
-
typeof t == "string" ? e =
|
|
3065
|
+
typeof t == "string" ? e = Y(t) : t && typeof t == "object" && (e = A(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);
|
|
2678
3066
|
}
|
|
2679
3067
|
updateUI() {
|
|
2680
|
-
if (this.
|
|
3068
|
+
if (this.previewEl && this.value)
|
|
2681
3069
|
if (this.value.type === "solid") {
|
|
2682
|
-
const t = this.value.stops
|
|
2683
|
-
|
|
2684
|
-
const e = t.opacity !== void 0 ? t.opacity : 100;
|
|
2685
|
-
this.previewElement.style.background = this.addOpacityToColor(
|
|
2686
|
-
t.color,
|
|
2687
|
-
e
|
|
2688
|
-
);
|
|
2689
|
-
}
|
|
3070
|
+
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3071
|
+
this.previewEl.style.background = ct(t.color, e);
|
|
2690
3072
|
} else
|
|
2691
|
-
this.
|
|
2692
|
-
this.
|
|
2693
|
-
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
return t.type === "linear" ? `${e} ${t.angle}°` : `${e} Gradient`;
|
|
3073
|
+
this.previewEl.style.background = H(this.value);
|
|
3074
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = K(this.value));
|
|
3075
|
+
}
|
|
3076
|
+
cssForTextValue() {
|
|
3077
|
+
return this.value ? {
|
|
3078
|
+
background: H(this.value),
|
|
3079
|
+
"-webkit-background-clip": "text",
|
|
3080
|
+
"background-clip": "text",
|
|
3081
|
+
color: "transparent",
|
|
3082
|
+
"-webkit-text-fill-color": "transparent"
|
|
3083
|
+
} : {};
|
|
2703
3084
|
}
|
|
2704
3085
|
draw() {
|
|
2705
3086
|
const t = document.createElement("div");
|
|
2706
3087
|
if (t.className = "gradient-setting-wrapper", this.props.title) {
|
|
2707
|
-
const
|
|
2708
|
-
|
|
2709
|
-
const
|
|
2710
|
-
|
|
3088
|
+
const i = document.createElement("div");
|
|
3089
|
+
i.className = "icon-container";
|
|
3090
|
+
const s = document.createElement("span");
|
|
3091
|
+
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
2711
3092
|
}
|
|
2712
3093
|
const e = document.createElement("div");
|
|
2713
|
-
e.className = "gradient-input-wrapper", this.
|
|
2714
|
-
|
|
2715
|
-
}), this.
|
|
2716
|
-
this.
|
|
2717
|
-
}), this.
|
|
3094
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? H(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("mousedown", (i) => {
|
|
3095
|
+
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3096
|
+
}), 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 ? K(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3097
|
+
this.isEditing = !0, this.value && (this.inputEl.value = H(this.value));
|
|
3098
|
+
}), this.inputEl.addEventListener("blur", () => {
|
|
3099
|
+
this.isEditing = !1, this.value && (this.inputEl.value = K(this.value));
|
|
3100
|
+
}), this.inputEl.addEventListener(
|
|
2718
3101
|
"paste",
|
|
2719
|
-
(
|
|
2720
|
-
), this.
|
|
2721
|
-
"
|
|
2722
|
-
|
|
2723
|
-
), this.textInputElement.addEventListener("keydown", (s) => {
|
|
2724
|
-
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.value)), this.textInputElement.blur());
|
|
2725
|
-
});
|
|
2726
|
-
const i = document.createElement("div");
|
|
2727
|
-
return i.className = "gradient-input-placeholder-trigger", i.textContent = this.textInputElement.placeholder || "", i.style.display = this.textInputElement.value ? "none" : "flex", i.addEventListener("click", (s) => {
|
|
2728
|
-
s.stopPropagation(), this.openPopover();
|
|
2729
|
-
}), e.appendChild(this.previewElement), e.appendChild(this.textInputElement), e.appendChild(i), this.placeholderTrigger = i, t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
2730
|
-
}
|
|
2731
|
-
generateCSS(t) {
|
|
2732
|
-
if (!t) return "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2733
|
-
if (t.type === "solid") {
|
|
2734
|
-
const i = t.stops && t.stops.length > 0 ? t.stops[0] : null;
|
|
2735
|
-
if (!i) return "#000000";
|
|
2736
|
-
const s = i.opacity !== void 0 ? i.opacity : 100, n = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2737
|
-
return `#${i.color.replace("#", "")}${n}`;
|
|
2738
|
-
}
|
|
2739
|
-
const e = t.stops.map((i) => {
|
|
2740
|
-
const s = i.opacity !== void 0 ? i.opacity : 100;
|
|
2741
|
-
return `${this.addOpacityToColor(i.color, s)} ${i.position}%`;
|
|
2742
|
-
}).join(", ");
|
|
2743
|
-
return t.type === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${t.angle}deg, ${e})`;
|
|
2744
|
-
}
|
|
2745
|
-
addOpacityToColor(t, e) {
|
|
2746
|
-
const i = e / 100;
|
|
2747
|
-
if (t.startsWith("#")) {
|
|
2748
|
-
const s = t.slice(1), n = parseInt(s.substr(0, 2), 16), o = parseInt(s.substr(2, 2), 16), a = parseInt(s.substr(4, 2), 16);
|
|
2749
|
-
return `rgba(${n}, ${o}, ${a}, ${i})`;
|
|
2750
|
-
}
|
|
2751
|
-
if (t.startsWith("rgb("))
|
|
2752
|
-
return t.replace("rgb(", "rgba(").replace(")", `, ${i})`);
|
|
2753
|
-
if (t.startsWith("rgba("))
|
|
2754
|
-
return t.replace(/,\s*[\d.]+\)$/, `, ${i})`);
|
|
2755
|
-
if (t.startsWith("hsl(")) {
|
|
2756
|
-
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2757
|
-
if (s) {
|
|
2758
|
-
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, { r: l, g: r, b: c } = this.hslToRgb(n, o, a);
|
|
2759
|
-
return `rgba(${l}, ${r}, ${c}, ${i})`;
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
if (t.startsWith("hsla(")) {
|
|
2763
|
-
const s = t.match(
|
|
2764
|
-
/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/
|
|
2765
|
-
);
|
|
2766
|
-
if (s) {
|
|
2767
|
-
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, { r: l, g: r, b: c } = this.hslToRgb(n, o, a);
|
|
2768
|
-
return `rgba(${l}, ${r}, ${c}, ${i})`;
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
try {
|
|
2772
|
-
const s = t.replace("#", "");
|
|
2773
|
-
if (/^[0-9A-Fa-f]{6}$/.test(s)) {
|
|
2774
|
-
const n = parseInt(s.substr(0, 2), 16), o = parseInt(s.substr(2, 2), 16), a = parseInt(s.substr(4, 2), 16);
|
|
2775
|
-
return `rgba(${n}, ${o}, ${a}, ${i})`;
|
|
2776
|
-
}
|
|
2777
|
-
} catch {
|
|
2778
|
-
}
|
|
2779
|
-
return t;
|
|
2780
|
-
}
|
|
2781
|
-
hexToRgb(t) {
|
|
2782
|
-
const e = t.replace("#", ""), i = e.length === 3 ? e.split("").map((a) => a + a).join("") : e, s = parseInt(i.slice(0, 2), 16), n = parseInt(i.slice(2, 4), 16), o = parseInt(i.slice(4, 6), 16);
|
|
2783
|
-
return { r: s, g: n, b: o };
|
|
3102
|
+
(i) => this.handlePaste(i)
|
|
3103
|
+
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3104
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = H(this.value)), this.inputEl.blur());
|
|
3105
|
+
}), e.appendChild(this.previewEl), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
2784
3106
|
}
|
|
2785
3107
|
createPopover() {
|
|
2786
|
-
if (this.
|
|
2787
|
-
this.
|
|
3108
|
+
if (this.popoverEl) return;
|
|
3109
|
+
this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none";
|
|
2788
3110
|
const t = document.createElement("div");
|
|
2789
3111
|
t.className = "gradient-popover-header";
|
|
2790
3112
|
const e = document.createElement("span");
|
|
2791
3113
|
e.textContent = "Fill";
|
|
2792
3114
|
const i = document.createElement("button");
|
|
2793
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3115
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = dt, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
2794
3116
|
const s = document.createElement("div");
|
|
2795
3117
|
s.className = "gradient-editor";
|
|
2796
3118
|
const n = this.createTypeTabs();
|
|
2797
3119
|
s.appendChild(n);
|
|
2798
3120
|
const o = document.createElement("div");
|
|
2799
|
-
o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.
|
|
3121
|
+
o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.popoverEl);
|
|
2800
3122
|
}
|
|
2801
3123
|
createTypeTabs() {
|
|
2802
3124
|
var s, n;
|
|
@@ -2812,399 +3134,35 @@ class he extends T {
|
|
|
2812
3134
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
2813
3135
|
}
|
|
2814
3136
|
switchType(t) {
|
|
2815
|
-
var
|
|
3137
|
+
var i;
|
|
2816
3138
|
if (!this.value) return;
|
|
2817
|
-
this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3139
|
+
if (this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
2818
3140
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2819
3141
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2820
|
-
])
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
);
|
|
2828
|
-
i == null || i.forEach((l, r) => {
|
|
2829
|
-
l.classList.remove("active"), (r === 0 && t === "linear" || r === 1 && t === "radial") && l.classList.add("active");
|
|
2830
|
-
});
|
|
2831
|
-
const s = (a = this.popoverElement) == null ? void 0 : a.querySelector(
|
|
2832
|
-
".gradient-editor-content"
|
|
2833
|
-
);
|
|
2834
|
-
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
3142
|
+
]), this.popoverEl) {
|
|
3143
|
+
const s = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3144
|
+
s.forEach((a) => a.classList.remove("active"));
|
|
3145
|
+
const n = s[0], o = s[1];
|
|
3146
|
+
t === "solid" ? n == null || n.classList.add("active") : o == null || o.classList.add("active");
|
|
3147
|
+
}
|
|
3148
|
+
const e = (i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-editor-content");
|
|
3149
|
+
e && (this.updatePopoverContent(e), this.repositionPopover()), this.updateUI(), this.triggerChange();
|
|
2835
3150
|
}
|
|
2836
3151
|
updatePopoverContent(t) {
|
|
2837
|
-
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.
|
|
2838
|
-
}
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
{ color: i, position: 0, opacity: s }
|
|
2847
|
-
]);
|
|
2848
|
-
}, o = document.createElement("div");
|
|
2849
|
-
o.className = "gstop-row solid-row";
|
|
2850
|
-
const a = document.createElement("div");
|
|
2851
|
-
a.className = "gstop-color-container";
|
|
2852
|
-
const l = document.createElement("div");
|
|
2853
|
-
l.className = "gstop-color-preview", l.style.backgroundColor = i;
|
|
2854
|
-
const r = document.createElement("input");
|
|
2855
|
-
r.type = "text", r.className = "gstop-color-input", r.value = i.toUpperCase(), r.placeholder = "#000000";
|
|
2856
|
-
const c = document.createElement("button");
|
|
2857
|
-
c.type = "button", c.className = "gstop-color-copy", c.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2858
|
-
<path d="M14.5896 19.3033L13.4111 20.4818C11.7839 22.109 9.14575 22.109 7.51856 20.4818C5.89138 18.8546 5.89138 16.2164 7.51856 14.5892L8.69708 13.4107M19.3037 14.5892L20.4822 13.4107C22.1094 11.7835 22.1094 9.14535 20.4822 7.51816C18.855 5.89098 16.2168 5.89098 14.5896 7.51816L13.4111 8.69668M11.0837 16.9166L16.917 11.0833" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2859
|
-
</svg>`, a.appendChild(l), a.appendChild(r), a.appendChild(c), o.appendChild(a), e.appendChild(o);
|
|
2860
|
-
const h = document.createElement("div");
|
|
2861
|
-
h.className = "gstop-opacity-row";
|
|
2862
|
-
const d = document.createElement("span");
|
|
2863
|
-
d.className = "gstop-opacity-label", d.textContent = "Opacity";
|
|
2864
|
-
const C = document.createElement("div");
|
|
2865
|
-
C.className = "gstop-opacity-group";
|
|
2866
|
-
const u = document.createElement("input");
|
|
2867
|
-
u.type = "range", u.className = "gstop-opacity-slider", u.min = "0", u.max = "100", u.value = s.toString();
|
|
2868
|
-
const f = (y) => {
|
|
2869
|
-
const E = this.hexToRgb(y);
|
|
2870
|
-
u.style.setProperty(
|
|
2871
|
-
"--slider-color",
|
|
2872
|
-
`rgb(${E.r}, ${E.g}, ${E.b})`
|
|
2873
|
-
);
|
|
2874
|
-
};
|
|
2875
|
-
f(i);
|
|
2876
|
-
const v = document.createElement("span");
|
|
2877
|
-
v.className = "gstop-opacity-value", v.textContent = `${s}%`, C.appendChild(u), C.appendChild(v), h.appendChild(d), h.appendChild(C), e.appendChild(h), t.appendChild(e);
|
|
2878
|
-
const b = (y, E) => {
|
|
2879
|
-
i = y, s = Math.round(E), n(), r.value = y.toUpperCase(), l.style.backgroundColor = y, u.value = s.toString(), v.textContent = `${s}%`, f(y), this.value && this.value.stops && this.value.stops[0] && (this.value.stops[0].color = y, this.value.stops[0].opacity = s), this.updateUI(), this.triggerChange();
|
|
2880
|
-
};
|
|
2881
|
-
let m = null;
|
|
2882
|
-
const L = new ht(
|
|
2883
|
-
(y, E) => {
|
|
2884
|
-
m = null, b(y, E ?? s);
|
|
2885
|
-
},
|
|
2886
|
-
"solid"
|
|
2887
|
-
);
|
|
2888
|
-
c.addEventListener("click", async (y) => {
|
|
2889
|
-
y.stopPropagation();
|
|
2890
|
-
const E = r.value.startsWith("#") ? r.value : `#${r.value}`;
|
|
2891
|
-
try {
|
|
2892
|
-
await navigator.clipboard.writeText(E);
|
|
2893
|
-
const O = c.innerHTML;
|
|
2894
|
-
c.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2895
|
-
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2896
|
-
</svg>`, setTimeout(() => {
|
|
2897
|
-
c.innerHTML = O;
|
|
2898
|
-
}, 1e3);
|
|
2899
|
-
} catch (O) {
|
|
2900
|
-
console.warn("Failed to copy color to clipboard:", O);
|
|
3152
|
+
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.renderSolid(t) : this.renderGradient(t));
|
|
3153
|
+
}
|
|
3154
|
+
renderSolid(t) {
|
|
3155
|
+
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3156
|
+
const e = this.value.stops[0], i = new _t({
|
|
3157
|
+
initialColor: e.color,
|
|
3158
|
+
initialOpacity: e.opacity ?? 100,
|
|
3159
|
+
onColorChange: (s, n) => {
|
|
3160
|
+
this.value && (this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange());
|
|
2901
3161
|
}
|
|
2902
3162
|
});
|
|
2903
|
-
|
|
2904
|
-
m && (J.addColor(m, "solid"), m = null);
|
|
2905
|
-
};
|
|
2906
|
-
r.addEventListener("click", (y) => {
|
|
2907
|
-
y.stopPropagation(), L.open(i, r, s);
|
|
2908
|
-
}), r.addEventListener("input", (y) => {
|
|
2909
|
-
const E = y.target.value.trim(), O = E.startsWith("#") ? E : `#${E}`;
|
|
2910
|
-
/^#[0-9A-Fa-f]{6}$/.test(O) && (m = O, b(O, s));
|
|
2911
|
-
}), r.addEventListener("blur", M), r.addEventListener("keydown", (y) => {
|
|
2912
|
-
y.key === "Enter" && (y.preventDefault(), M(), r.blur());
|
|
2913
|
-
}), u.addEventListener("input", (y) => {
|
|
2914
|
-
const E = parseInt(y.target.value, 10);
|
|
2915
|
-
isNaN(E) || (s = Math.max(0, Math.min(100, E)), v.textContent = `${s}%`, n(), this.value && this.value.stops && this.value.stops[0] && (this.value.stops[0].opacity = s), this.updateUI(), this.triggerChange());
|
|
2916
|
-
});
|
|
3163
|
+
t.appendChild(i.getElement());
|
|
2917
3164
|
}
|
|
2918
|
-
|
|
2919
|
-
const s = document.createElement("div");
|
|
2920
|
-
s.className = "embedded-color-picker-content";
|
|
2921
|
-
const n = document.createElement("div");
|
|
2922
|
-
n.className = "color-picker-area embedded";
|
|
2923
|
-
const o = document.createElement("div");
|
|
2924
|
-
o.className = "color-picker-marker", n.appendChild(o);
|
|
2925
|
-
const a = document.createElement("div");
|
|
2926
|
-
a.className = "color-picker-hue-container";
|
|
2927
|
-
const l = document.createElement("button");
|
|
2928
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2929
|
-
<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"/>
|
|
2930
|
-
</svg>`;
|
|
2931
|
-
const r = document.createElement("div");
|
|
2932
|
-
r.className = "color-picker-hue embedded";
|
|
2933
|
-
const c = document.createElement("div");
|
|
2934
|
-
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2935
|
-
const h = document.createElement("div");
|
|
2936
|
-
h.className = "color-picker-opacity embedded";
|
|
2937
|
-
const d = document.createElement("div");
|
|
2938
|
-
d.className = "color-picker-opacity-marker", h.appendChild(d);
|
|
2939
|
-
const C = document.createElement("div");
|
|
2940
|
-
C.className = "color-picker-format-section embedded";
|
|
2941
|
-
const u = document.createElement("select");
|
|
2942
|
-
u.className = "color-picker-format-select";
|
|
2943
|
-
const f = document.createElement("option");
|
|
2944
|
-
f.value = "hex", f.textContent = "HEX";
|
|
2945
|
-
const v = document.createElement("option");
|
|
2946
|
-
v.value = "rgb", v.textContent = "RGB";
|
|
2947
|
-
const b = document.createElement("option");
|
|
2948
|
-
b.value = "hsl", b.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(b);
|
|
2949
|
-
const m = document.createElement("input");
|
|
2950
|
-
m.type = "text", m.className = "color-picker-color-input", m.value = t;
|
|
2951
|
-
const L = document.createElement("div");
|
|
2952
|
-
L.className = "color-picker-input-container";
|
|
2953
|
-
const M = document.createElement("button");
|
|
2954
|
-
M.className = "color-picker-copy-inside", M.textContent = "Copy", L.appendChild(m), L.appendChild(M), C.appendChild(u), C.appendChild(L), s.appendChild(n), s.appendChild(a), s.appendChild(h);
|
|
2955
|
-
let y, E;
|
|
2956
|
-
const O = this.setupEmbeddedColorPicker(
|
|
2957
|
-
n,
|
|
2958
|
-
o,
|
|
2959
|
-
r,
|
|
2960
|
-
c,
|
|
2961
|
-
u,
|
|
2962
|
-
m,
|
|
2963
|
-
M,
|
|
2964
|
-
l,
|
|
2965
|
-
t,
|
|
2966
|
-
e,
|
|
2967
|
-
i,
|
|
2968
|
-
{
|
|
2969
|
-
onColorChanged: () => {
|
|
2970
|
-
E == null || E();
|
|
2971
|
-
},
|
|
2972
|
-
onColorApplied: () => {
|
|
2973
|
-
y == null || y(), E == null || E();
|
|
2974
|
-
}
|
|
2975
|
-
},
|
|
2976
|
-
"solid"
|
|
2977
|
-
), q = lt((w) => {
|
|
2978
|
-
O.applyColor(w);
|
|
2979
|
-
}, "solid");
|
|
2980
|
-
y = () => q.refresh(), s.appendChild(q.container), s.appendChild(C);
|
|
2981
|
-
const S = this.setupOpacitySlider(
|
|
2982
|
-
h,
|
|
2983
|
-
d,
|
|
2984
|
-
O
|
|
2985
|
-
);
|
|
2986
|
-
return E = () => S.refresh(), s;
|
|
2987
|
-
}
|
|
2988
|
-
createEmbeddedColorPicker(t, e, i) {
|
|
2989
|
-
const s = document.createElement("div");
|
|
2990
|
-
s.className = "embedded-color-picker-content";
|
|
2991
|
-
const n = document.createElement("div");
|
|
2992
|
-
n.className = "color-picker-area embedded";
|
|
2993
|
-
const o = document.createElement("div");
|
|
2994
|
-
o.className = "color-picker-marker", n.appendChild(o);
|
|
2995
|
-
const a = document.createElement("div");
|
|
2996
|
-
a.className = "color-picker-hue-container";
|
|
2997
|
-
const l = document.createElement("button");
|
|
2998
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2999
|
-
<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"/>
|
|
3000
|
-
</svg>`;
|
|
3001
|
-
const r = document.createElement("div");
|
|
3002
|
-
r.className = "color-picker-hue embedded";
|
|
3003
|
-
const c = document.createElement("div");
|
|
3004
|
-
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
3005
|
-
const h = document.createElement("div");
|
|
3006
|
-
h.className = "color-picker-format-section embedded";
|
|
3007
|
-
const d = document.createElement("select");
|
|
3008
|
-
d.className = "color-picker-format-select";
|
|
3009
|
-
const C = document.createElement("option");
|
|
3010
|
-
C.value = "hex", C.textContent = "HEX";
|
|
3011
|
-
const u = document.createElement("option");
|
|
3012
|
-
u.value = "rgb", u.textContent = "RGB";
|
|
3013
|
-
const f = document.createElement("option");
|
|
3014
|
-
f.value = "hsl", f.textContent = "HSL", d.appendChild(C), d.appendChild(u), d.appendChild(f);
|
|
3015
|
-
const v = document.createElement("input");
|
|
3016
|
-
v.type = "text", v.className = "color-picker-color-input", v.value = t;
|
|
3017
|
-
const b = document.createElement("div");
|
|
3018
|
-
b.className = "color-picker-input-container";
|
|
3019
|
-
const m = document.createElement("button");
|
|
3020
|
-
m.className = "color-picker-copy-inside", m.textContent = "Copy", b.appendChild(v), b.appendChild(m), h.appendChild(d), h.appendChild(b), s.appendChild(n), s.appendChild(a);
|
|
3021
|
-
let L;
|
|
3022
|
-
const M = this.setupEmbeddedColorPicker(
|
|
3023
|
-
n,
|
|
3024
|
-
o,
|
|
3025
|
-
r,
|
|
3026
|
-
c,
|
|
3027
|
-
d,
|
|
3028
|
-
v,
|
|
3029
|
-
m,
|
|
3030
|
-
l,
|
|
3031
|
-
t,
|
|
3032
|
-
e,
|
|
3033
|
-
i,
|
|
3034
|
-
{
|
|
3035
|
-
onColorApplied: () => {
|
|
3036
|
-
L == null || L();
|
|
3037
|
-
}
|
|
3038
|
-
},
|
|
3039
|
-
"gradient"
|
|
3040
|
-
), y = lt((E) => {
|
|
3041
|
-
M.applyColor(E);
|
|
3042
|
-
}, "gradient");
|
|
3043
|
-
return L = () => y.refresh(), s.appendChild(y.container), s.appendChild(h), s;
|
|
3044
|
-
}
|
|
3045
|
-
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, h, d, C = "gradient") {
|
|
3046
|
-
let u = r;
|
|
3047
|
-
const { h: f, s: v, v: b } = this.hexToHsv(r);
|
|
3048
|
-
let m = c;
|
|
3049
|
-
s.style.left = `${f / 360 * 100}%`, e.style.left = `${v * 100}%`, e.style.top = `${(1 - b) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`;
|
|
3050
|
-
const L = () => {
|
|
3051
|
-
var g;
|
|
3052
|
-
(g = d == null ? void 0 : d.onColorChanged) == null || g.call(d);
|
|
3053
|
-
}, M = () => {
|
|
3054
|
-
var g;
|
|
3055
|
-
J.addColor(u, C), (g = d == null ? void 0 : d.onColorApplied) == null || g.call(d);
|
|
3056
|
-
}, y = (g, x = m) => {
|
|
3057
|
-
u = g, m = Math.round(x), E(), h(g, m), L();
|
|
3058
|
-
}, E = () => {
|
|
3059
|
-
const g = n.value, { h: x, s: k, v: I } = this.hexToHsv(u);
|
|
3060
|
-
switch (g) {
|
|
3061
|
-
case "hex":
|
|
3062
|
-
o.value = u;
|
|
3063
|
-
break;
|
|
3064
|
-
case "rgb":
|
|
3065
|
-
const { r: $, g: R, b: _ } = this.hexToRgb(u);
|
|
3066
|
-
o.value = `rgb(${$}, ${R}, ${_})`;
|
|
3067
|
-
break;
|
|
3068
|
-
case "hsl":
|
|
3069
|
-
const { hue: G, sat: Z, lightness: st } = this.hsvToHsl(x, k, I);
|
|
3070
|
-
o.value = `hsl(${Math.round(G)}, ${Math.round(
|
|
3071
|
-
Z * 100
|
|
3072
|
-
)}%, ${Math.round(st * 100)}%)`;
|
|
3073
|
-
break;
|
|
3074
|
-
}
|
|
3075
|
-
}, O = (g) => {
|
|
3076
|
-
if (!/^#[0-9A-Fa-f]{6}$/.test(g))
|
|
3077
|
-
return;
|
|
3078
|
-
const { h: x, s: k, v: I } = this.hexToHsv(g);
|
|
3079
|
-
s.style.left = `${x / 360 * 100}%`, e.style.left = `${k * 100}%`, e.style.top = `${(1 - I) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${x}, 100%, 50%))`, y(g, m);
|
|
3080
|
-
}, q = () => parseFloat(s.style.left || "0%") / 100 * 360, S = (g, x) => {
|
|
3081
|
-
const k = q(), I = this.hsvToHex(k, g, x);
|
|
3082
|
-
y(I, m);
|
|
3083
|
-
}, w = (g) => {
|
|
3084
|
-
g = Math.max(0.1, Math.min(358.9, g));
|
|
3085
|
-
const x = parseFloat(e.style.left || "50%") / 100, k = parseFloat(e.style.top || "50%") / 100;
|
|
3086
|
-
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`;
|
|
3087
|
-
const I = x, $ = 1 - k, R = this.hsvToHex(g, I, $);
|
|
3088
|
-
y(R, m);
|
|
3089
|
-
}, N = (g) => {
|
|
3090
|
-
const x = t.getBoundingClientRect(), k = Math.max(0, Math.min(1, (g.clientX - x.left) / x.width)), I = Math.max(0, Math.min(1, (g.clientY - x.top) / x.height));
|
|
3091
|
-
e.style.left = `${k * 100}%`, e.style.top = `${I * 100}%`, S(k, 1 - I);
|
|
3092
|
-
}, D = (g) => {
|
|
3093
|
-
g.preventDefault(), g.stopPropagation(), N(g);
|
|
3094
|
-
const x = (I) => N(I), k = () => {
|
|
3095
|
-
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", k), M();
|
|
3096
|
-
};
|
|
3097
|
-
document.addEventListener("mousemove", x), document.addEventListener("mouseup", k);
|
|
3098
|
-
}, A = (g) => {
|
|
3099
|
-
const x = i.getBoundingClientRect();
|
|
3100
|
-
let k = (g.clientX - x.left) / x.width;
|
|
3101
|
-
k = Math.max(1e-3, Math.min(0.998, k)), s.style.left = `${k * 100}%`;
|
|
3102
|
-
const I = k * 360;
|
|
3103
|
-
w(I);
|
|
3104
|
-
}, P = (g) => {
|
|
3105
|
-
g.preventDefault(), g.stopPropagation(), A(g);
|
|
3106
|
-
const x = (I) => A(I), k = () => {
|
|
3107
|
-
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", k), M();
|
|
3108
|
-
};
|
|
3109
|
-
document.addEventListener("mousemove", x), document.addEventListener("mouseup", k);
|
|
3110
|
-
}, V = (g) => {
|
|
3111
|
-
const x = g.target.value, k = n.value;
|
|
3112
|
-
let I = "";
|
|
3113
|
-
if (k === "hex" && /^#[0-9A-Fa-f]{6}$/.test(x))
|
|
3114
|
-
I = x;
|
|
3115
|
-
else if (k === "rgb") {
|
|
3116
|
-
const $ = x.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3117
|
-
if ($) {
|
|
3118
|
-
const R = parseInt($[1]), _ = parseInt($[2]), G = parseInt($[3]);
|
|
3119
|
-
R <= 255 && _ <= 255 && G <= 255 && (I = `#${R.toString(16).padStart(2, "0")}${_.toString(16).padStart(2, "0")}${G.toString(16).padStart(2, "0")}`);
|
|
3120
|
-
}
|
|
3121
|
-
} else if (k === "hsl") {
|
|
3122
|
-
const $ = x.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3123
|
-
if ($) {
|
|
3124
|
-
const R = parseInt($[1]), _ = parseInt($[2]) / 100, G = parseInt($[3]) / 100;
|
|
3125
|
-
if (R <= 360 && _ <= 1 && G <= 1) {
|
|
3126
|
-
const Z = G + _ * Math.min(G, 1 - G), st = Z === 0 ? 0 : 2 * (1 - G / Z);
|
|
3127
|
-
I = this.hsvToHex(R, st, Z);
|
|
3128
|
-
}
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
I && O(I);
|
|
3132
|
-
}, F = () => {
|
|
3133
|
-
E(), M();
|
|
3134
|
-
}, B = () => {
|
|
3135
|
-
E();
|
|
3136
|
-
}, gt = () => {
|
|
3137
|
-
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3138
|
-
o.select(), document.execCommand("copy");
|
|
3139
|
-
});
|
|
3140
|
-
};
|
|
3141
|
-
E(), t.addEventListener("mousedown", D), t.addEventListener("click", (g) => g.stopPropagation()), i.addEventListener("mousedown", P), i.addEventListener("click", (g) => g.stopPropagation()), n.addEventListener("change", B), o.addEventListener("input", V), o.addEventListener("blur", F), o.addEventListener("keydown", (g) => {
|
|
3142
|
-
g.key === "Enter" && (g.preventDefault(), F(), o.blur());
|
|
3143
|
-
}), a.addEventListener("click", gt);
|
|
3144
|
-
const mt = async () => {
|
|
3145
|
-
if ("EyeDropper" in window)
|
|
3146
|
-
try {
|
|
3147
|
-
const k = (await new window.EyeDropper().open()).sRGBHex, { h: I, s: $, v: R } = this.hexToHsv(k);
|
|
3148
|
-
s.style.left = `${I / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - R) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${I}, 100%, 50%))`, y(k, m), M();
|
|
3149
|
-
} catch (g) {
|
|
3150
|
-
console.log("User cancelled eyedropper or error occurred:", g);
|
|
3151
|
-
}
|
|
3152
|
-
else
|
|
3153
|
-
alert(
|
|
3154
|
-
"EyeDropper API is not supported in this browser. Try using Chrome 95+ or Edge 95+."
|
|
3155
|
-
);
|
|
3156
|
-
};
|
|
3157
|
-
return l.addEventListener("click", mt), {
|
|
3158
|
-
applyColor: (g) => {
|
|
3159
|
-
O(g), M();
|
|
3160
|
-
},
|
|
3161
|
-
getCurrentColor: () => u,
|
|
3162
|
-
getCurrentOpacity: () => m,
|
|
3163
|
-
setOpacity: (g) => {
|
|
3164
|
-
m = Math.max(0, Math.min(100, Math.round(g))), h(u, m), L();
|
|
3165
|
-
}
|
|
3166
|
-
};
|
|
3167
|
-
}
|
|
3168
|
-
hsvToHex(t, e, i) {
|
|
3169
|
-
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
3170
|
-
let a = 0, l = 0, r = 0;
|
|
3171
|
-
return t >= 0 && t < 60 ? (a = s, l = n, r = 0) : t >= 60 && t < 120 ? (a = n, l = s, r = 0) : t >= 120 && t < 180 ? (a = 0, l = s, r = n) : t >= 180 && t < 240 ? (a = 0, l = n, r = s) : t >= 240 && t < 300 ? (a = n, l = 0, r = s) : t >= 300 && t < 360 && (a = s, l = 0, r = n), a = Math.round((a + o) * 255), l = Math.round((l + o) * 255), r = Math.round((r + o) * 255), `#${a.toString(16).padStart(2, "0")}${l.toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}`;
|
|
3172
|
-
}
|
|
3173
|
-
setupOpacitySlider(t, e, i) {
|
|
3174
|
-
const s = () => {
|
|
3175
|
-
const { r, g: c, b: h } = this.hexToRgb(i.getCurrentColor());
|
|
3176
|
-
t.style.setProperty("--color-rgb", `${r}, ${c}, ${h}`);
|
|
3177
|
-
}, n = () => {
|
|
3178
|
-
e.style.left = `${i.getCurrentOpacity()}%`;
|
|
3179
|
-
}, o = () => {
|
|
3180
|
-
s(), n();
|
|
3181
|
-
};
|
|
3182
|
-
o();
|
|
3183
|
-
let a = !1;
|
|
3184
|
-
const l = (r) => {
|
|
3185
|
-
const c = t.getBoundingClientRect(), h = r.clientX - c.left, d = Math.max(0, Math.min(100, h / c.width * 100)), C = Math.round(d);
|
|
3186
|
-
i.setOpacity(C), n();
|
|
3187
|
-
};
|
|
3188
|
-
return t.addEventListener("mousedown", (r) => {
|
|
3189
|
-
a = !0, l(r);
|
|
3190
|
-
}), document.addEventListener("mousemove", (r) => {
|
|
3191
|
-
a && l(r);
|
|
3192
|
-
}), document.addEventListener("mouseup", () => {
|
|
3193
|
-
a = !1;
|
|
3194
|
-
}), { refresh: o };
|
|
3195
|
-
}
|
|
3196
|
-
hexToHsv(t) {
|
|
3197
|
-
const e = parseInt(t.slice(1, 3), 16) / 255, i = parseInt(t.slice(3, 5), 16) / 255, s = parseInt(t.slice(5, 7), 16) / 255, n = Math.max(e, i, s), o = Math.min(e, i, s), a = n - o;
|
|
3198
|
-
let l = 0;
|
|
3199
|
-
const r = n === 0 ? 0 : a / n, c = n;
|
|
3200
|
-
return a !== 0 && (n === e ? l = (i - s) / a % 6 : n === i ? l = (s - e) / a + 2 : l = (e - i) / a + 4), { h: l * 60, s: r, v: c };
|
|
3201
|
-
}
|
|
3202
|
-
hsvToHsl(t, e, i) {
|
|
3203
|
-
const s = i * (1 - e / 2), n = s === 0 || s === 1 ? 0 : (i - s) / Math.min(s, 1 - s);
|
|
3204
|
-
return { hue: t, sat: n, lightness: s };
|
|
3205
|
-
}
|
|
3206
|
-
createGradientEditor(t) {
|
|
3207
|
-
if (!this.value) return;
|
|
3165
|
+
renderGradient(t) {
|
|
3208
3166
|
const e = document.createElement("div");
|
|
3209
3167
|
e.className = "gradient-subtype-inline";
|
|
3210
3168
|
const i = document.createElement("select");
|
|
@@ -3214,246 +3172,172 @@ class he extends T {
|
|
|
3214
3172
|
const n = document.createElement("option");
|
|
3215
3173
|
n.value = "radial", n.textContent = "Radial", i.appendChild(s), i.appendChild(n), i.value = this.value.type === "radial" ? "radial" : "linear";
|
|
3216
3174
|
const o = document.createElement("input");
|
|
3217
|
-
o.type = "text", o.inputMode = "numeric", o.className = "gradient-degree-input";
|
|
3218
|
-
const a =
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
isNaN(m) && (m = ((L = this.value) == null ? void 0 : L.angle) ?? 0), m = Math.max(0, Math.min(360, m)), this.value && (this.value.angle = m), b.value = `${m}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3242
|
-
}), l.addEventListener("click", () => {
|
|
3243
|
-
this.value && (this.value.stops = this.value.stops.map((v) => ({
|
|
3244
|
-
...v,
|
|
3245
|
-
position: 100 - v.position
|
|
3246
|
-
})), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3247
|
-
}), e.appendChild(i), e.appendChild(o), e.appendChild(l), t.appendChild(e), (() => {
|
|
3248
|
-
var v;
|
|
3249
|
-
((v = this.value) == null ? void 0 : v.type) === "radial" ? (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "1");
|
|
3250
|
-
})();
|
|
3251
|
-
const c = document.createElement("div");
|
|
3252
|
-
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3175
|
+
o.type = "text", o.inputMode = "numeric", o.className = "gradient-degree-input", o.value = `${this.value.angle ?? 0}°`, o.style.width = "75px", o.style.textAlign = "center";
|
|
3176
|
+
const a = document.createElement("button");
|
|
3177
|
+
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML = qt, i.addEventListener("change", () => {
|
|
3178
|
+
this.switchType(i.value === "radial" ? "radial" : "linear"), this.updateDegreeVisibility(o);
|
|
3179
|
+
}), o.addEventListener("focus", (u) => {
|
|
3180
|
+
const m = u.target;
|
|
3181
|
+
m.value = m.value.replace(/[^0-9-]/g, ""), setTimeout(() => m.select(), 0);
|
|
3182
|
+
}), o.addEventListener("input", (u) => {
|
|
3183
|
+
const m = parseInt(u.target.value);
|
|
3184
|
+
!Number.isNaN(m) && this.value && (this.value.angle = Math.max(0, Math.min(360, m)), this.updateGradientPreview(), this.triggerChange());
|
|
3185
|
+
}), o.addEventListener("blur", (u) => {
|
|
3186
|
+
var b;
|
|
3187
|
+
const m = u.target;
|
|
3188
|
+
let f = parseInt(m.value);
|
|
3189
|
+
Number.isNaN(f) && (f = ((b = this.value) == null ? void 0 : b.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), m.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3190
|
+
}), a.addEventListener("click", () => {
|
|
3191
|
+
!this.value || !this.value.stops || (this.value.stops.forEach((u) => {
|
|
3192
|
+
u.position = 100 - u.position;
|
|
3193
|
+
}), this.value.stops.sort((u, m) => u.position - m.position), this.updateGradientPreview(l), this.createHandles(r, l), this.updateStopsList(g), this.updateUI(), this.triggerChange());
|
|
3194
|
+
}), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.updateDegreeVisibility(o);
|
|
3195
|
+
const l = document.createElement("div");
|
|
3196
|
+
l.className = "gradient-preview", this.updateGradientPreview(l);
|
|
3197
|
+
const r = document.createElement("div");
|
|
3198
|
+
r.className = "gradient-handles", l.appendChild(r), t.appendChild(l), this.createHandles(r, l);
|
|
3253
3199
|
const h = document.createElement("div");
|
|
3254
|
-
h.className = "gradient-
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3257
|
-
const
|
|
3258
|
-
|
|
3259
|
-
const
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
f.className = "gradient-stops", t.appendChild(d), t.appendChild(f), this.updateStopsList(f), u.addEventListener("click", () => {
|
|
3263
|
-
this.addGradientStop(), this.updateStopsList(f), this.updateGradientPreview(c), this.createGradientHandles(h, c), this.updateUI();
|
|
3200
|
+
h.className = "gradient-stops-header";
|
|
3201
|
+
const p = document.createElement("span");
|
|
3202
|
+
p.textContent = "Stops";
|
|
3203
|
+
const d = document.createElement("button");
|
|
3204
|
+
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3205
|
+
const g = document.createElement("div");
|
|
3206
|
+
g.className = "gradient-stops", t.appendChild(h), t.appendChild(g), this.updateStopsList(g), d.addEventListener("click", () => {
|
|
3207
|
+
this.addStop(), this.updateStopsList(g), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), this.repositionPopover(), this.triggerChange();
|
|
3264
3208
|
});
|
|
3265
3209
|
}
|
|
3210
|
+
updateDegreeVisibility(t) {
|
|
3211
|
+
var e;
|
|
3212
|
+
((e = this.value) == null ? void 0 : e.type) === "radial" ? (t.disabled = !0, t.style.opacity = "0.5") : (t.disabled = !1, t.style.opacity = "1");
|
|
3213
|
+
}
|
|
3266
3214
|
updateGradientPreview(t) {
|
|
3267
3215
|
var i;
|
|
3268
|
-
const e = t || ((i = this.
|
|
3269
|
-
e && this.value && (e.style.background =
|
|
3216
|
+
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3217
|
+
e && this.value && (e.style.background = H(this.value));
|
|
3270
3218
|
}
|
|
3271
|
-
|
|
3219
|
+
createHandles(t, e) {
|
|
3272
3220
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3273
3221
|
const n = document.createElement("div");
|
|
3274
|
-
n.className = "gstop-handle", n.style.left = `${i.position}
|
|
3222
|
+
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3275
3223
|
const o = document.createElement("div");
|
|
3276
|
-
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o)
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
const C = e.getBoundingClientRect(), f = (l(d) - n) / C.width * 100;
|
|
3290
|
-
let v = o + f;
|
|
3291
|
-
v = Math.max(0, Math.min(100, v)), this.value.stops[i].position = Math.round(v), t.style.left = `${v}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
3292
|
-
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3293
|
-
}), d.preventDefault();
|
|
3294
|
-
}, h = () => {
|
|
3295
|
-
s && (s = !1, t.classList.remove("selected"), a && (cancelAnimationFrame(a), a = null), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange(), document.removeEventListener("pointermove", c), document.removeEventListener("pointerup", h), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", h), document.removeEventListener("touchmove", c), document.removeEventListener("touchend", h));
|
|
3296
|
-
};
|
|
3297
|
-
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3298
|
-
passive: !1
|
|
3224
|
+
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o);
|
|
3225
|
+
let a = !1, l = 0, r = 0;
|
|
3226
|
+
const h = (g) => {
|
|
3227
|
+
a = !0, l = g.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", p), document.addEventListener("mouseup", d), g.preventDefault(), g.stopPropagation();
|
|
3228
|
+
}, p = (g) => {
|
|
3229
|
+
if (!a || !this.value) return;
|
|
3230
|
+
const u = e.getBoundingClientRect(), m = g.clientX - l;
|
|
3231
|
+
let f = r + m / u.width * 100;
|
|
3232
|
+
f = Math.max(0, Math.min(100, f)), this.value.stops[s].position = Math.round(f), n.style.left = `${f}%`, this.updateGradientPreview(), this.updateUI();
|
|
3233
|
+
}, d = () => {
|
|
3234
|
+
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((g, u) => g.position - u.position), this.createHandles(t, e)), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3235
|
+
};
|
|
3236
|
+
n.addEventListener("mousedown", h), t.appendChild(n);
|
|
3299
3237
|
});
|
|
3300
3238
|
}
|
|
3301
3239
|
updateStopsList(t) {
|
|
3302
|
-
var
|
|
3303
|
-
const e = t || ((
|
|
3304
|
-
!e || !this.value || this.value.type === "solid" || !this.value.stops
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
const
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
const
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
if (isNaN(D))
|
|
3345
|
-
w.value = `${((P = (A = this.value) == null ? void 0 : A.stops[n]) == null ? void 0 : P.position) || 0}%`;
|
|
3346
|
-
else {
|
|
3347
|
-
const V = Math.max(0, Math.min(100, D));
|
|
3348
|
-
w.value = `${V}%`, this.value && (this.value.stops[n].position = V, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3349
|
-
}
|
|
3350
|
-
});
|
|
3351
|
-
const u = new ht(
|
|
3352
|
-
(S, w) => {
|
|
3353
|
-
var N, D, A;
|
|
3354
|
-
if (h.value = S.replace("#", "").toUpperCase(), c.style.backgroundColor = S, f = null, this.value) {
|
|
3355
|
-
this.value.stops[n].color = S, w !== void 0 && (this.value.stops[n].opacity = w);
|
|
3356
|
-
const P = (N = o.parentElement) == null ? void 0 : N.querySelector(
|
|
3357
|
-
".gstop-opacity-slider"
|
|
3358
|
-
);
|
|
3359
|
-
if (P) {
|
|
3360
|
-
const B = this.hexToRgb(S);
|
|
3361
|
-
P.style.setProperty(
|
|
3362
|
-
"--slider-color",
|
|
3363
|
-
`rgb(${B.r}, ${B.g}, ${B.b})`
|
|
3364
|
-
);
|
|
3365
|
-
}
|
|
3366
|
-
if (w !== void 0) {
|
|
3367
|
-
const B = (D = o.parentElement) == null ? void 0 : D.querySelector(
|
|
3368
|
-
".gstop-opacity-value"
|
|
3369
|
-
);
|
|
3370
|
-
B && (B.textContent = `${w}%`), P && (P.value = w.toString());
|
|
3371
|
-
}
|
|
3372
|
-
const V = (A = this.popoverElement) == null ? void 0 : A.querySelector(
|
|
3373
|
-
".gradient-preview"
|
|
3374
|
-
), F = V == null ? void 0 : V.querySelector(
|
|
3375
|
-
".gradient-handles"
|
|
3376
|
-
);
|
|
3377
|
-
V && F && this.createGradientHandles(F, V), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3378
|
-
}
|
|
3379
|
-
},
|
|
3380
|
-
"gradient"
|
|
3240
|
+
var s;
|
|
3241
|
+
const e = t || ((s = this.popoverEl) == null ? void 0 : s.querySelector(".gradient-stops"));
|
|
3242
|
+
if (!e || !this.value || this.value.type === "solid" || !this.value.stops)
|
|
3243
|
+
return;
|
|
3244
|
+
e.innerHTML = "";
|
|
3245
|
+
const i = [...this.value.stops].sort(
|
|
3246
|
+
(n, o) => n.position - o.position
|
|
3247
|
+
);
|
|
3248
|
+
i.forEach((n, o) => {
|
|
3249
|
+
var F, G;
|
|
3250
|
+
const a = this.value.stops.findIndex(
|
|
3251
|
+
(v, y) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, y).filter(
|
|
3252
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3253
|
+
).length === i.slice(0, o).filter(
|
|
3254
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3255
|
+
).length
|
|
3256
|
+
), l = a !== -1 ? a : o, r = document.createElement("div");
|
|
3257
|
+
r.className = "gstop-row";
|
|
3258
|
+
const h = document.createElement("div");
|
|
3259
|
+
h.className = "gstop-position-group";
|
|
3260
|
+
const p = document.createElement("input");
|
|
3261
|
+
p.type = "text", p.className = "gstop-position-input", p.value = `${n.position}%`, p.style.width = "60px", h.appendChild(p);
|
|
3262
|
+
const d = document.createElement("div");
|
|
3263
|
+
d.className = "gstop-color-container";
|
|
3264
|
+
const g = document.createElement("div");
|
|
3265
|
+
g.className = "gstop-color-preview", g.style.backgroundColor = n.color;
|
|
3266
|
+
const u = document.createElement("input");
|
|
3267
|
+
u.type = "text", u.className = "gstop-color-input", u.value = n.color.replace("#", "").toUpperCase();
|
|
3268
|
+
const m = document.createElement("button");
|
|
3269
|
+
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(g), d.appendChild(u), d.appendChild(m);
|
|
3270
|
+
const f = document.createElement("button");
|
|
3271
|
+
f.type = "button", f.className = "gstop-del", f.innerHTML = jt, f.disabled = (((G = (F = this.value) == null ? void 0 : F.stops) == null ? void 0 : G.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
|
|
3272
|
+
const b = document.createElement("span");
|
|
3273
|
+
b.className = "gstop-opacity-label", b.textContent = "Opacity";
|
|
3274
|
+
const L = document.createElement("div");
|
|
3275
|
+
L.className = "gstop-opacity-group";
|
|
3276
|
+
const C = document.createElement("input");
|
|
3277
|
+
C.type = "range", C.className = "gstop-opacity-slider", C.min = "0", C.max = "100", C.value = String(n.opacity ?? 100);
|
|
3278
|
+
const O = S(n.color);
|
|
3279
|
+
C.style.setProperty(
|
|
3280
|
+
"--slider-color",
|
|
3281
|
+
`rgb(${O.r}, ${O.g}, ${O.b})`
|
|
3381
3282
|
);
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
)
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
"
|
|
3404
|
-
|
|
3405
|
-
|
|
3283
|
+
const k = document.createElement("span");
|
|
3284
|
+
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, L.appendChild(C), L.appendChild(k);
|
|
3285
|
+
const T = new Ut((v, y) => {
|
|
3286
|
+
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v, y !== void 0 && (this.value.stops[l].opacity = y, C.value = String(y), k.textContent = `${y}%`);
|
|
3287
|
+
const w = S(v);
|
|
3288
|
+
C.style.setProperty(
|
|
3289
|
+
"--slider-color",
|
|
3290
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3291
|
+
), this.updateGradientPreview(), this.createHandles(
|
|
3292
|
+
this.popoverEl.querySelector(".gradient-handles"),
|
|
3293
|
+
this.popoverEl.querySelector(".gradient-preview")
|
|
3294
|
+
), this.updateUI(), this.triggerChange();
|
|
3295
|
+
}, "gradient");
|
|
3296
|
+
u.addEventListener("click", (v) => {
|
|
3297
|
+
v.preventDefault(), v.stopPropagation(), T.open(n.color, u, n.opacity ?? 100);
|
|
3298
|
+
}), u.addEventListener("input", () => {
|
|
3299
|
+
const v = u.value.trim(), y = v.startsWith("#") ? v : `#${v}`;
|
|
3300
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(y)) {
|
|
3301
|
+
this.value.stops[l].color = y, g.style.backgroundColor = y;
|
|
3302
|
+
const w = S(y);
|
|
3303
|
+
C.style.setProperty(
|
|
3304
|
+
"--slider-color",
|
|
3305
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3306
|
+
), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3406
3307
|
}
|
|
3407
|
-
})
|
|
3408
|
-
|
|
3409
|
-
f && (J.addColor(f, "gradient"), f = null);
|
|
3410
|
-
};
|
|
3411
|
-
h.addEventListener("blur", v), h.addEventListener("keydown", (S) => {
|
|
3412
|
-
S.key === "Enter" && (S.preventDefault(), v(), h.blur());
|
|
3413
|
-
}), d.addEventListener("click", async (S) => {
|
|
3414
|
-
S.stopPropagation();
|
|
3415
|
-
const w = `#${h.value}`;
|
|
3308
|
+
}), m.addEventListener("click", async (v) => {
|
|
3309
|
+
v.stopPropagation();
|
|
3416
3310
|
try {
|
|
3417
|
-
await navigator.clipboard.writeText(
|
|
3418
|
-
|
|
3419
|
-
d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3420
|
-
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3421
|
-
</svg>`, setTimeout(() => {
|
|
3422
|
-
d.innerHTML = N;
|
|
3423
|
-
}, 1e3);
|
|
3424
|
-
} catch (N) {
|
|
3425
|
-
console.warn("Failed to copy color to clipboard:", N);
|
|
3311
|
+
await navigator.clipboard.writeText(`#${u.value}`);
|
|
3312
|
+
} catch {
|
|
3426
3313
|
}
|
|
3427
|
-
}),
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3314
|
+
}), p.addEventListener("focus", (v) => {
|
|
3315
|
+
const y = v.target;
|
|
3316
|
+
y.value = y.value.replace("%", ""), y.select();
|
|
3317
|
+
}), p.addEventListener("input", (v) => {
|
|
3318
|
+
const y = v.target, w = parseInt(y.value.replace(/[^\d]/g, ""), 10);
|
|
3319
|
+
if (!Number.isNaN(w)) {
|
|
3320
|
+
const et = Math.max(0, Math.min(100, w));
|
|
3321
|
+
this.value.stops[l].position = et, y.value = `${et}%`, this.updateGradientPreview(), this.createHandles(
|
|
3322
|
+
this.popoverEl.querySelector(".gradient-handles"),
|
|
3323
|
+
this.popoverEl.querySelector(".gradient-preview")
|
|
3324
|
+
), this.updateUI(), this.triggerChange();
|
|
3437
3325
|
}
|
|
3438
|
-
}),
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
);
|
|
3452
|
-
const E = document.createElement("span");
|
|
3453
|
-
E.className = "gstop-opacity-value", E.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
3454
|
-
}));
|
|
3326
|
+
}), p.addEventListener("blur", (v) => {
|
|
3327
|
+
const y = v.target, w = parseInt(y.value.replace(/[^\d]/g, ""), 10);
|
|
3328
|
+
Number.isNaN(w) ? y.value = `${this.value.stops[l].position}%` : y.value = `${Math.max(0, Math.min(100, w))}%`;
|
|
3329
|
+
}), f.addEventListener("click", () => {
|
|
3330
|
+
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(l, 1), this.createHandles(
|
|
3331
|
+
this.popoverEl.querySelector(".gradient-handles"),
|
|
3332
|
+
this.popoverEl.querySelector(".gradient-preview")
|
|
3333
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.repositionPopover(), this.triggerChange());
|
|
3334
|
+
}), C.addEventListener("input", () => {
|
|
3335
|
+
const v = parseInt(C.value, 10);
|
|
3336
|
+
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3337
|
+
});
|
|
3338
|
+
});
|
|
3455
3339
|
}
|
|
3456
|
-
|
|
3340
|
+
addStop() {
|
|
3457
3341
|
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3458
3342
|
const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
|
|
3459
3343
|
let e = 50, i = 0;
|
|
@@ -3461,290 +3345,117 @@ class he extends T {
|
|
|
3461
3345
|
const a = t[o + 1] - t[o];
|
|
3462
3346
|
a > i && (i = a, e = t[o] + a / 2);
|
|
3463
3347
|
}
|
|
3464
|
-
const s = this.value.stops.reduce(
|
|
3348
|
+
const s = this.value.stops.reduce(
|
|
3349
|
+
(o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o
|
|
3350
|
+
), n = {
|
|
3465
3351
|
position: Math.round(e),
|
|
3466
3352
|
color: s.color,
|
|
3467
|
-
opacity: s.opacity
|
|
3353
|
+
opacity: s.opacity ?? 100
|
|
3468
3354
|
};
|
|
3469
3355
|
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3470
3356
|
}
|
|
3471
3357
|
openPopover() {
|
|
3472
|
-
if (!(!this.
|
|
3473
|
-
if (this.isPopoverOpen = !0, this.
|
|
3358
|
+
if (!(!this.popoverEl || this.isPopoverOpen)) {
|
|
3359
|
+
if (this.isPopoverOpen = !0, this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3474
3360
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3475
|
-
this.
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3361
|
+
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3362
|
+
const o = this.popoverEl.offsetHeight;
|
|
3363
|
+
let a = t.right + 8, l = t.top;
|
|
3364
|
+
const r = i - t.right, h = t.left, p = e + n;
|
|
3365
|
+
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3366
|
+
const d = s - t.bottom, g = t.top;
|
|
3367
|
+
d >= o + n ? l = t.bottom + 8 : g >= o + n ? l = t.top - o - 8 : d > g ? (l = t.bottom + 8, l + o > s - n && (l = s - o - n)) : (l = t.top - o - 8, l < n && (l = n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`;
|
|
3479
3368
|
}
|
|
3480
|
-
setTimeout(
|
|
3481
|
-
document.addEventListener("click", this.
|
|
3482
|
-
|
|
3369
|
+
setTimeout(
|
|
3370
|
+
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
3371
|
+
0
|
|
3372
|
+
);
|
|
3483
3373
|
}
|
|
3484
3374
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3375
|
+
repositionPopover() {
|
|
3376
|
+
!this.popoverEl || !this.isPopoverOpen || !this.element || requestAnimationFrame(() => {
|
|
3377
|
+
if (!this.popoverEl || !this.element) return;
|
|
3378
|
+
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3379
|
+
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3380
|
+
const o = this.popoverEl.offsetHeight;
|
|
3381
|
+
let a = t.right + 8, l = t.top;
|
|
3382
|
+
const r = i - t.right, h = t.left, p = e + n;
|
|
3383
|
+
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3384
|
+
const d = s - t.bottom, g = t.top;
|
|
3385
|
+
d >= o + n ? l = t.bottom + 8 : g >= o + n ? l = t.top - o - 8 : d > g ? (l = t.bottom + 8, l + o > s - n && (l = s - o - n)) : (l = t.top - o - 8, l < n && (l = n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`;
|
|
3490
3386
|
});
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3387
|
+
}
|
|
3388
|
+
refreshPopoverContent() {
|
|
3389
|
+
var n;
|
|
3390
|
+
if (!this.popoverEl) return;
|
|
3391
|
+
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3392
|
+
t.forEach((o) => o.classList.remove("active"));
|
|
3393
|
+
const e = t[0], i = t[1];
|
|
3394
|
+
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : i.classList.add("active"), this.popoverEl.offsetHeight;
|
|
3395
|
+
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3396
|
+
s && this.updatePopoverContent(s);
|
|
3495
3397
|
}
|
|
3496
3398
|
closePopover() {
|
|
3497
|
-
!this.
|
|
3399
|
+
!this.popoverEl || !this.isPopoverOpen || (this.isPopoverOpen = !1, this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0));
|
|
3498
3400
|
}
|
|
3499
3401
|
handlePaste(t) {
|
|
3500
3402
|
var i;
|
|
3501
3403
|
t.preventDefault();
|
|
3502
3404
|
const e = ((i = t.clipboardData) == null ? void 0 : i.getData("text")) || "";
|
|
3503
|
-
this.
|
|
3405
|
+
this.parseAndSet(e);
|
|
3504
3406
|
}
|
|
3505
|
-
|
|
3407
|
+
handleTextInput(t) {
|
|
3506
3408
|
const e = t.target;
|
|
3507
|
-
this.
|
|
3409
|
+
this.parseAndSet(e.value);
|
|
3508
3410
|
}
|
|
3509
|
-
|
|
3510
|
-
const e = t.trim();
|
|
3511
|
-
|
|
3512
|
-
try {
|
|
3513
|
-
const i = this.parseGradientCSS(e);
|
|
3514
|
-
i && this.setValue(i);
|
|
3515
|
-
} catch (i) {
|
|
3516
|
-
console.warn("Failed to parse gradient/color:", i);
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
parseGradientCSS(t) {
|
|
3520
|
-
const e = t.replace(/;$/, "").trim();
|
|
3521
|
-
if (this.isValidColor(e))
|
|
3522
|
-
return {
|
|
3523
|
-
type: "solid",
|
|
3524
|
-
angle: 0,
|
|
3525
|
-
stops: [this.parseColorWithOpacity(e)]
|
|
3526
|
-
};
|
|
3527
|
-
const i = this.extractGradientParams(e, "linear-gradient");
|
|
3528
|
-
if (i)
|
|
3529
|
-
return this.parseLinearGradient(i);
|
|
3530
|
-
const s = this.extractGradientParams(e, "radial-gradient");
|
|
3531
|
-
return s ? this.parseRadialGradient(s) : null;
|
|
3532
|
-
}
|
|
3533
|
-
extractGradientParams(t, e) {
|
|
3534
|
-
const i = new RegExp(`${e}\\s*\\(`, "i"), s = t.match(i);
|
|
3535
|
-
if (!s) return null;
|
|
3536
|
-
const n = s.index + s[0].length;
|
|
3537
|
-
let o = 1, a = n;
|
|
3538
|
-
for (let l = n; l < t.length && o > 0; l++)
|
|
3539
|
-
t[l] === "(" ? o++ : t[l] === ")" && o--, a = l;
|
|
3540
|
-
return o === 0 ? t.substring(n, a) : null;
|
|
3541
|
-
}
|
|
3542
|
-
isValidColor(t) {
|
|
3543
|
-
const e = document.createElement("div");
|
|
3544
|
-
return e.style.color = t, e.style.color !== "";
|
|
3545
|
-
}
|
|
3546
|
-
parseColorWithOpacity(t) {
|
|
3547
|
-
const e = t.trim();
|
|
3548
|
-
if (/^#[0-9A-Fa-f]{8}$/.test(e)) {
|
|
3549
|
-
const n = e.slice(1);
|
|
3550
|
-
parseInt(n.substr(0, 2), 16), parseInt(n.substr(2, 2), 16), parseInt(n.substr(4, 2), 16);
|
|
3551
|
-
const a = parseInt(n.substr(6, 2), 16) / 255 * 100;
|
|
3552
|
-
return { color: `#${n.substr(0, 6)}`, position: 0, opacity: a };
|
|
3553
|
-
}
|
|
3554
|
-
const i = e.match(
|
|
3555
|
-
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3556
|
-
);
|
|
3557
|
-
if (i) {
|
|
3558
|
-
const n = parseInt(i[1]), o = parseInt(i[2]), a = parseInt(i[3]), l = i[4] ? parseFloat(i[4]) : 1;
|
|
3559
|
-
return { color: `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3560
|
-
}
|
|
3561
|
-
const s = e.match(
|
|
3562
|
-
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3563
|
-
);
|
|
3564
|
-
if (s) {
|
|
3565
|
-
const n = parseFloat(s[1]), o = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, l = s[4] ? parseFloat(s[4]) : 1, { r, g: c, b: h } = this.hslToRgb(n, o, a);
|
|
3566
|
-
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${h.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3567
|
-
}
|
|
3568
|
-
return { color: e, position: 0, opacity: 100 };
|
|
3569
|
-
}
|
|
3570
|
-
hslToRgb(t, e, i) {
|
|
3571
|
-
const s = (1 - Math.abs(2 * i - 1)) * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s / 2;
|
|
3572
|
-
let a = 0, l = 0, r = 0;
|
|
3573
|
-
return t >= 0 && t < 60 ? (a = s, l = n, r = 0) : t >= 60 && t < 120 ? (a = n, l = s, r = 0) : t >= 120 && t < 180 ? (a = 0, l = s, r = n) : t >= 180 && t < 240 ? (a = 0, l = n, r = s) : t >= 240 && t < 300 ? (a = n, l = 0, r = s) : t >= 300 && t < 360 && (a = s, l = 0, r = n), {
|
|
3574
|
-
r: Math.round((a + o) * 255),
|
|
3575
|
-
g: Math.round((l + o) * 255),
|
|
3576
|
-
b: Math.round((r + o) * 255)
|
|
3577
|
-
};
|
|
3578
|
-
}
|
|
3579
|
-
smartSplit(t) {
|
|
3580
|
-
const e = [];
|
|
3581
|
-
let i = "", s = 0;
|
|
3582
|
-
for (let n = 0; n < t.length; n++) {
|
|
3583
|
-
const o = t[n];
|
|
3584
|
-
if (o === "(")
|
|
3585
|
-
s++;
|
|
3586
|
-
else if (o === ")")
|
|
3587
|
-
s--;
|
|
3588
|
-
else if (o === "," && s === 0) {
|
|
3589
|
-
e.push(i.trim()), i = "";
|
|
3590
|
-
continue;
|
|
3591
|
-
}
|
|
3592
|
-
i += o;
|
|
3593
|
-
}
|
|
3594
|
-
return i.trim() && e.push(i.trim()), e;
|
|
3595
|
-
}
|
|
3596
|
-
parseLinearGradient(t) {
|
|
3597
|
-
const e = this.smartSplit(t);
|
|
3598
|
-
let i = 90, s = [];
|
|
3599
|
-
const n = e[0];
|
|
3600
|
-
if (n.includes("deg")) {
|
|
3601
|
-
const a = n.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
3602
|
-
a ? (i = parseFloat(a[1]), s = e.slice(1)) : s = e;
|
|
3603
|
-
} else n.includes("to ") ? (i = {
|
|
3604
|
-
"to right": 90,
|
|
3605
|
-
"to left": 270,
|
|
3606
|
-
"to bottom": 180,
|
|
3607
|
-
"to top": 0,
|
|
3608
|
-
"to bottom right": 135,
|
|
3609
|
-
"to bottom left": 225,
|
|
3610
|
-
"to top right": 45,
|
|
3611
|
-
"to top left": 315
|
|
3612
|
-
}[n] || 90, s = e.slice(1)) : s = e;
|
|
3613
|
-
const o = this.parseColorStops(s);
|
|
3614
|
-
return o.length === 0 ? null : {
|
|
3615
|
-
type: "linear",
|
|
3616
|
-
angle: i,
|
|
3617
|
-
stops: o
|
|
3618
|
-
};
|
|
3619
|
-
}
|
|
3620
|
-
parseRadialGradient(t) {
|
|
3621
|
-
const e = this.smartSplit(t);
|
|
3622
|
-
let i = [];
|
|
3623
|
-
e[0] && !this.isColorStop(e[0]) ? i = e.slice(1) : i = e;
|
|
3624
|
-
const s = this.parseColorStops(i);
|
|
3625
|
-
return s.length === 0 ? null : {
|
|
3626
|
-
type: "radial",
|
|
3627
|
-
angle: 0,
|
|
3628
|
-
stops: s
|
|
3629
|
-
};
|
|
3630
|
-
}
|
|
3631
|
-
isColorStop(t) {
|
|
3632
|
-
const e = t.split(" ")[0].toLowerCase();
|
|
3633
|
-
return [
|
|
3634
|
-
"circle",
|
|
3635
|
-
"ellipse",
|
|
3636
|
-
"closest-side",
|
|
3637
|
-
"closest-corner",
|
|
3638
|
-
"farthest-side",
|
|
3639
|
-
"farthest-corner",
|
|
3640
|
-
"at"
|
|
3641
|
-
].includes(e) || ["contain", "cover"].includes(e) ? !1 : /^#[0-9a-f]{3,8}$/i.test(e) || /^rgb/i.test(t) || /^hsl/i.test(t) || this.isValidColorName(e);
|
|
3642
|
-
}
|
|
3643
|
-
isValidColorName(t) {
|
|
3644
|
-
return [
|
|
3645
|
-
"red",
|
|
3646
|
-
"green",
|
|
3647
|
-
"blue",
|
|
3648
|
-
"yellow",
|
|
3649
|
-
"orange",
|
|
3650
|
-
"purple",
|
|
3651
|
-
"pink",
|
|
3652
|
-
"brown",
|
|
3653
|
-
"black",
|
|
3654
|
-
"white",
|
|
3655
|
-
"gray",
|
|
3656
|
-
"grey",
|
|
3657
|
-
"cyan",
|
|
3658
|
-
"magenta",
|
|
3659
|
-
"lime",
|
|
3660
|
-
"navy",
|
|
3661
|
-
"maroon",
|
|
3662
|
-
"olive",
|
|
3663
|
-
"aqua",
|
|
3664
|
-
"silver",
|
|
3665
|
-
"teal",
|
|
3666
|
-
"fuchsia",
|
|
3667
|
-
"transparent"
|
|
3668
|
-
].includes(t.toLowerCase());
|
|
3669
|
-
}
|
|
3670
|
-
parseColorStops(t) {
|
|
3671
|
-
const e = [];
|
|
3672
|
-
return t.forEach((i, s) => {
|
|
3673
|
-
const n = i.trim();
|
|
3674
|
-
if (!n) return;
|
|
3675
|
-
let o = "", a = 0;
|
|
3676
|
-
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3677
|
-
if (l) {
|
|
3678
|
-
const c = l[1].trim(), h = parseFloat(l[2]);
|
|
3679
|
-
this.isValidColorFormat(c) ? (o = c, a = h) : (o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100);
|
|
3680
|
-
} else
|
|
3681
|
-
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3682
|
-
const r = this.parseColorWithOpacity(o);
|
|
3683
|
-
r.position = Math.round(a), e.push(r);
|
|
3684
|
-
}), e;
|
|
3685
|
-
}
|
|
3686
|
-
isValidColorFormat(t) {
|
|
3687
|
-
return [
|
|
3688
|
-
/^#[0-9a-fA-F]{3,8}$/,
|
|
3689
|
-
// hex colors
|
|
3690
|
-
/^rgba?\s*\([^)]+\)$/,
|
|
3691
|
-
// rgb/rgba functions
|
|
3692
|
-
/^hsla?\s*\([^)]+\)$/,
|
|
3693
|
-
// hsl/hsla functions
|
|
3694
|
-
/^[a-zA-Z]+$/
|
|
3695
|
-
// named colors
|
|
3696
|
-
].some((i) => i.test(t.trim())) || this.isValidColor(t);
|
|
3411
|
+
parseAndSet(t) {
|
|
3412
|
+
const e = Y(t.trim());
|
|
3413
|
+
e && this.setValue(e);
|
|
3697
3414
|
}
|
|
3698
3415
|
triggerChange() {
|
|
3699
|
-
|
|
3416
|
+
var t, e;
|
|
3417
|
+
this.value && ((t = this.onChange) == null || t.call(this, this.value), (e = this.detectChange) == null || e.call(this, this.value));
|
|
3700
3418
|
}
|
|
3701
3419
|
getElement() {
|
|
3702
3420
|
return this.element;
|
|
3703
3421
|
}
|
|
3704
3422
|
getValue() {
|
|
3705
|
-
return this.value ? this.forText ? {
|
|
3706
|
-
background: this.generateCSS(this.value),
|
|
3707
|
-
"-webkit-background-clip": "text",
|
|
3708
|
-
"background-clip": "text",
|
|
3709
|
-
color: "transparent",
|
|
3710
|
-
"-webkit-text-fill-color": "transparent"
|
|
3711
|
-
} : this.generateCSS(this.value) : this.forText ? {} : "";
|
|
3423
|
+
return this.value ? this.forText ? this.cssForTextValue() : H(this.value) : this.forText ? {} : "";
|
|
3712
3424
|
}
|
|
3713
3425
|
getCSSValue() {
|
|
3714
|
-
return this.value ?
|
|
3426
|
+
return this.value ? H(this.value) : "";
|
|
3715
3427
|
}
|
|
3716
|
-
// Add method to get the raw object value if needed
|
|
3717
3428
|
getRawValue() {
|
|
3718
3429
|
return this.value;
|
|
3719
3430
|
}
|
|
3720
3431
|
}
|
|
3721
|
-
const
|
|
3432
|
+
const Zt = `
|
|
3722
3433
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3723
3434
|
<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"/>
|
|
3724
3435
|
</svg>
|
|
3725
|
-
`,
|
|
3436
|
+
`, Xt = `
|
|
3726
3437
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3727
3438
|
<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"/>
|
|
3728
3439
|
</svg>
|
|
3729
3440
|
`;
|
|
3730
|
-
class
|
|
3441
|
+
class ye extends V {
|
|
3731
3442
|
constructor(t) {
|
|
3732
3443
|
super({
|
|
3733
3444
|
title: "Border",
|
|
3734
3445
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3735
3446
|
settings: {
|
|
3736
|
-
size: new
|
|
3447
|
+
size: new I({
|
|
3737
3448
|
title: "Size",
|
|
3738
|
-
icon:
|
|
3449
|
+
icon: Xt,
|
|
3739
3450
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3740
3451
|
suffix: "px"
|
|
3741
3452
|
}),
|
|
3742
|
-
color: new
|
|
3453
|
+
color: new P({
|
|
3743
3454
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3744
3455
|
}),
|
|
3745
|
-
radius: new
|
|
3456
|
+
radius: new I({
|
|
3746
3457
|
title: "Radius",
|
|
3747
|
-
icon:
|
|
3458
|
+
icon: Zt,
|
|
3748
3459
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3749
3460
|
suffix: "px"
|
|
3750
3461
|
})
|
|
@@ -3763,20 +3474,20 @@ class de extends U {
|
|
|
3763
3474
|
`;
|
|
3764
3475
|
}
|
|
3765
3476
|
}
|
|
3766
|
-
const
|
|
3477
|
+
const Yt = `
|
|
3767
3478
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3768
3479
|
<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"/>
|
|
3769
3480
|
</svg>
|
|
3770
|
-
`,
|
|
3481
|
+
`, Kt = `
|
|
3771
3482
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3772
3483
|
<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"/>
|
|
3773
3484
|
</svg>
|
|
3774
|
-
`,
|
|
3485
|
+
`, Qt = `
|
|
3775
3486
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3776
3487
|
<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"/>
|
|
3777
3488
|
</svg>
|
|
3778
3489
|
`;
|
|
3779
|
-
class
|
|
3490
|
+
class Ee extends V {
|
|
3780
3491
|
constructor(t = {}) {
|
|
3781
3492
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3782
3493
|
super({
|
|
@@ -3784,12 +3495,12 @@ class pe extends U {
|
|
|
3784
3495
|
collapsed: i.collapsed,
|
|
3785
3496
|
settings: (() => {
|
|
3786
3497
|
const s = {
|
|
3787
|
-
color: new
|
|
3498
|
+
color: new P({
|
|
3788
3499
|
default: i.colorDefault ?? "0, 0, 30"
|
|
3789
3500
|
}),
|
|
3790
|
-
fontFamily: new
|
|
3501
|
+
fontFamily: new tt({
|
|
3791
3502
|
title: "Font",
|
|
3792
|
-
icon:
|
|
3503
|
+
icon: Yt,
|
|
3793
3504
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3794
3505
|
options: i.fontFamilyOptions ?? [
|
|
3795
3506
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3800,9 +3511,9 @@ class pe extends U {
|
|
|
3800
3511
|
getOptions: i.fontFamilyGetOptions,
|
|
3801
3512
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3802
3513
|
}),
|
|
3803
|
-
fontWeight: new
|
|
3514
|
+
fontWeight: new tt({
|
|
3804
3515
|
title: "Weight",
|
|
3805
|
-
icon:
|
|
3516
|
+
icon: Kt,
|
|
3806
3517
|
default: i.fontWeightDefault ?? "400",
|
|
3807
3518
|
options: i.fontWeightOptions ?? [
|
|
3808
3519
|
{ name: "Regular", value: "400" },
|
|
@@ -3812,9 +3523,9 @@ class pe extends U {
|
|
|
3812
3523
|
getOptions: i.fontWeightGetOptions,
|
|
3813
3524
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3814
3525
|
}),
|
|
3815
|
-
fontSize: new
|
|
3526
|
+
fontSize: new I({
|
|
3816
3527
|
title: "Size",
|
|
3817
|
-
icon:
|
|
3528
|
+
icon: Qt,
|
|
3818
3529
|
default: i.fontSizeDefault ?? 12,
|
|
3819
3530
|
suffix: "px",
|
|
3820
3531
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3822,7 +3533,7 @@ class pe extends U {
|
|
|
3822
3533
|
};
|
|
3823
3534
|
return e ? {
|
|
3824
3535
|
...s,
|
|
3825
|
-
align: new
|
|
3536
|
+
align: new Mt({
|
|
3826
3537
|
title: "Align",
|
|
3827
3538
|
default: i.alignDefault ?? "center"
|
|
3828
3539
|
})
|
|
@@ -3842,7 +3553,7 @@ class pe extends U {
|
|
|
3842
3553
|
`;
|
|
3843
3554
|
}
|
|
3844
3555
|
}
|
|
3845
|
-
class
|
|
3556
|
+
class j extends E {
|
|
3846
3557
|
constructor(t) {
|
|
3847
3558
|
super({
|
|
3848
3559
|
...t,
|
|
@@ -3853,8 +3564,8 @@ class Q extends T {
|
|
|
3853
3564
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
3854
3565
|
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", () => {
|
|
3855
3566
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3856
|
-
let
|
|
3857
|
-
|
|
3567
|
+
let h = Number(a.value);
|
|
3568
|
+
h < l && (h = l), h > r && (h = r), a.value = String(h);
|
|
3858
3569
|
}));
|
|
3859
3570
|
}, i = this.createInput({
|
|
3860
3571
|
value: this.value,
|
|
@@ -3888,33 +3599,33 @@ class Q extends T {
|
|
|
3888
3599
|
}), i;
|
|
3889
3600
|
}
|
|
3890
3601
|
}
|
|
3891
|
-
class
|
|
3602
|
+
class be extends V {
|
|
3892
3603
|
constructor(t) {
|
|
3893
3604
|
super({
|
|
3894
3605
|
title: "Margins",
|
|
3895
3606
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3896
3607
|
settings: {
|
|
3897
|
-
marginTop: new
|
|
3608
|
+
marginTop: new j({
|
|
3898
3609
|
title: "Top",
|
|
3899
|
-
icon:
|
|
3610
|
+
icon: te,
|
|
3900
3611
|
suffix: "px",
|
|
3901
3612
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3902
3613
|
}),
|
|
3903
|
-
marginRight: new
|
|
3614
|
+
marginRight: new j({
|
|
3904
3615
|
title: "Right",
|
|
3905
|
-
icon:
|
|
3616
|
+
icon: ee,
|
|
3906
3617
|
suffix: "px",
|
|
3907
3618
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3908
3619
|
}),
|
|
3909
|
-
marginBottom: new
|
|
3620
|
+
marginBottom: new j({
|
|
3910
3621
|
title: "Bottom",
|
|
3911
|
-
icon:
|
|
3622
|
+
icon: ie,
|
|
3912
3623
|
suffix: "px",
|
|
3913
3624
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3914
3625
|
}),
|
|
3915
|
-
marginLeft: new
|
|
3626
|
+
marginLeft: new j({
|
|
3916
3627
|
title: "Left",
|
|
3917
|
-
icon:
|
|
3628
|
+
icon: se,
|
|
3918
3629
|
suffix: "px",
|
|
3919
3630
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
3920
3631
|
})
|
|
@@ -3931,29 +3642,29 @@ class ue extends U {
|
|
|
3931
3642
|
`;
|
|
3932
3643
|
}
|
|
3933
3644
|
}
|
|
3934
|
-
const
|
|
3645
|
+
const te = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3935
3646
|
<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"/>
|
|
3936
|
-
</svg>`,
|
|
3647
|
+
</svg>`, ee = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3937
3648
|
<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"/>
|
|
3938
|
-
</svg>`,
|
|
3649
|
+
</svg>`, ie = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3939
3650
|
<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"/>
|
|
3940
|
-
</svg>`,
|
|
3651
|
+
</svg>`, se = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3941
3652
|
<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"/>
|
|
3942
3653
|
</svg>`;
|
|
3943
|
-
class
|
|
3654
|
+
class we extends V {
|
|
3944
3655
|
constructor(t) {
|
|
3945
3656
|
super({
|
|
3946
3657
|
title: "Background Image",
|
|
3947
3658
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3948
3659
|
settings: {
|
|
3949
|
-
backgroundImage: new
|
|
3660
|
+
backgroundImage: new rt({
|
|
3950
3661
|
...t == null ? void 0 : t.uploadProps,
|
|
3951
3662
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3952
3663
|
}),
|
|
3953
|
-
opacity: new
|
|
3664
|
+
opacity: new Lt({
|
|
3954
3665
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3955
3666
|
}),
|
|
3956
|
-
backgroundColor: new
|
|
3667
|
+
backgroundColor: new P({
|
|
3957
3668
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3958
3669
|
})
|
|
3959
3670
|
}
|
|
@@ -3980,40 +3691,40 @@ class ge extends U {
|
|
|
3980
3691
|
}
|
|
3981
3692
|
}
|
|
3982
3693
|
export {
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
3694
|
+
Mt as AlignSetting,
|
|
3695
|
+
ve as AnimationSetting,
|
|
3696
|
+
we as BackgroundSettingSet,
|
|
3697
|
+
ye as BorderSettingSet,
|
|
3698
|
+
le as ButtonSetting,
|
|
3699
|
+
M as ColorSetting,
|
|
3700
|
+
P as ColorWithOpacitySetting,
|
|
3701
|
+
re as DimensionSetting,
|
|
3702
|
+
ue as GapSetting,
|
|
3703
|
+
Ce as GradientSetting,
|
|
3704
|
+
Ee as HeaderTypographySettingSet,
|
|
3705
|
+
ce as HeightSetting,
|
|
3706
|
+
ae as HtmlSetting,
|
|
3707
|
+
ge as MarginBottomSetting,
|
|
3708
|
+
be as MarginSettingGroup,
|
|
3709
|
+
me as MarginTopSetting,
|
|
3710
|
+
fe as MultiLanguageSetting,
|
|
3711
|
+
I as NumberSetting,
|
|
3712
|
+
Lt as OpacitySetting,
|
|
3713
|
+
pe as SelectApiSettings,
|
|
3714
|
+
tt as SelectSetting,
|
|
3715
|
+
E as Setting,
|
|
3716
|
+
V as SettingGroup,
|
|
3717
|
+
Et as StringSetting,
|
|
3718
|
+
Ct as TabSettingGroup,
|
|
3719
|
+
Ct as TabsSettingGroup,
|
|
3720
|
+
de as Toggle,
|
|
3721
|
+
rt as UploadSetting,
|
|
3722
|
+
he as WidthSetting,
|
|
3723
|
+
oe as asSettingGroupWithSettings,
|
|
3724
|
+
yt as createSettingGroup,
|
|
3725
|
+
ne as createTabSettingGroup,
|
|
3726
|
+
B as isSetting,
|
|
3727
|
+
st as isSettingChild,
|
|
3728
|
+
x as isSettingGroup,
|
|
3729
|
+
q as iterateSettings
|
|
4019
3730
|
};
|