builder-settings-types 0.0.263 → 0.0.265
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/base/settings-group/settingsGroup.d.ts +3 -0
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +26 -26
- package/dist/builder-settings-types.es.js +521 -520
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/settings/gradient-settings/gradientSettings.d.ts +3 -1
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/package.json +1 -1
|
@@ -11,25 +11,25 @@ function ct(p) {
|
|
|
11
11
|
e.classList.contains("setting-group") && e !== p && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function X(p, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
16
|
p.setAttribute("data-nesting-level", e.toString()), e > 0 ? p.style.setProperty("--visual-indent", `${e * 2}px`) : (p.style.removeProperty("--visual-indent"), p.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
18
|
function tt(p, t = 0) {
|
|
19
19
|
p.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
X(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const dt = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class ht {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...dt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -111,15 +111,15 @@ class dt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const it = new
|
|
115
|
-
function
|
|
114
|
+
const it = new ht();
|
|
115
|
+
function Y(p) {
|
|
116
116
|
if (p === null || typeof p != "object") return p;
|
|
117
117
|
if (p instanceof Date) return new Date(p.getTime());
|
|
118
|
-
if (p instanceof Array) return p.map((t) =>
|
|
118
|
+
if (p instanceof Array) return p.map((t) => Y(t));
|
|
119
119
|
if (typeof p == "object") {
|
|
120
120
|
const t = {};
|
|
121
121
|
for (const e in p)
|
|
122
|
-
Object.prototype.hasOwnProperty.call(p, e) && (t[e] =
|
|
122
|
+
Object.prototype.hasOwnProperty.call(p, e) && (t[e] = Y(p[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return p;
|
|
@@ -142,15 +142,15 @@ function pt(p) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class I {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || ot(), 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, I.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, I.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -171,8 +171,8 @@ class S {
|
|
|
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 = Y(this.props), i = new t(e);
|
|
175
|
+
return i.value = Y(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -234,29 +234,29 @@ class S {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
function j(p) {
|
|
237
|
-
return p instanceof
|
|
237
|
+
return p instanceof I;
|
|
238
238
|
}
|
|
239
239
|
function N(p) {
|
|
240
|
-
return p instanceof
|
|
240
|
+
return p instanceof z;
|
|
241
241
|
}
|
|
242
242
|
function st(p) {
|
|
243
243
|
return j(p) || N(p);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function J(p, t) {
|
|
246
246
|
for (const e in p)
|
|
247
247
|
if (Object.prototype.hasOwnProperty.call(p, e)) {
|
|
248
248
|
const i = p[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const _ = class _ {
|
|
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.id = t.id || ot(), 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 || "", Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
255
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.id = t.id || ot(), 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.isHidden = t.hidden ?? !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
|
-
|
|
259
|
+
J(this.settings, (e, i) => {
|
|
260
260
|
N(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
@@ -273,13 +273,13 @@ const Y = class Y {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
J(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
278
|
(N(e) || j(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (X(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -323,12 +323,21 @@ const Y = class Y {
|
|
|
323
323
|
const i = this.getValues();
|
|
324
324
|
this.initialValues = i, (s = this.onChange) == null || s.call(this, i);
|
|
325
325
|
}
|
|
326
|
+
getHidden() {
|
|
327
|
+
return this.isHidden;
|
|
328
|
+
}
|
|
329
|
+
setHidden(t) {
|
|
330
|
+
this.isHidden = t ?? !1, this.updateVisibility();
|
|
331
|
+
}
|
|
326
332
|
updateVisibility() {
|
|
327
|
-
this.elementRef;
|
|
333
|
+
this.elementRef && (this.isHidden ? (this.elementRef.style.display = "none", this.elementRef.setAttribute("aria-hidden", "true"), _.hiddenElements.add(this.elementRef)) : (this.elementRef.style.display = "", this.elementRef.removeAttribute("aria-hidden"), _.hiddenElements.delete(this.elementRef)));
|
|
328
334
|
}
|
|
335
|
+
// public updateVisibility(): void {
|
|
336
|
+
// if (!this.elementRef) return;
|
|
337
|
+
// }
|
|
329
338
|
clone() {
|
|
330
339
|
const t = {};
|
|
331
|
-
|
|
340
|
+
J(this.settings, (s, n) => {
|
|
332
341
|
const o = String(s);
|
|
333
342
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
334
343
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -343,7 +352,8 @@ const Y = class Y {
|
|
|
343
352
|
includeGetJson: this.includeGetJson,
|
|
344
353
|
addItem: this.addItemCfg,
|
|
345
354
|
deleteItem: this.deleteItemCfg,
|
|
346
|
-
dataProps: this.dataProps
|
|
355
|
+
dataProps: this.dataProps,
|
|
356
|
+
hidden: this.isHidden
|
|
347
357
|
}, i = gt(e);
|
|
348
358
|
return i.initialValues = this.getValues(), i;
|
|
349
359
|
}
|
|
@@ -390,7 +400,7 @@ const Y = class Y {
|
|
|
390
400
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
391
401
|
}, 50));
|
|
392
402
|
};
|
|
393
|
-
return this.changeHandlers.clear(),
|
|
403
|
+
return this.changeHandlers.clear(), J(this.settings, (i, s) => {
|
|
394
404
|
var n;
|
|
395
405
|
if (N(s))
|
|
396
406
|
s.setOnChange(() => {
|
|
@@ -449,11 +459,11 @@ const Y = class Y {
|
|
|
449
459
|
N(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
450
460
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
451
461
|
if (l) {
|
|
452
|
-
const
|
|
453
|
-
|
|
462
|
+
const d = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
463
|
+
d && t.startsWith(d) && this.addDeleteButtonToElement(a, t);
|
|
454
464
|
}
|
|
455
465
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
456
|
-
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a),
|
|
466
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), X(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
457
467
|
const c = a.style.display;
|
|
458
468
|
a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
|
|
459
469
|
}
|
|
@@ -602,11 +612,11 @@ const Y = class Y {
|
|
|
602
612
|
r(), t(!1);
|
|
603
613
|
}), l.addEventListener("click", () => {
|
|
604
614
|
r(), t(!0);
|
|
605
|
-
}), e.addEventListener("click", (
|
|
606
|
-
|
|
615
|
+
}), e.addEventListener("click", (d) => {
|
|
616
|
+
d.target === e && (r(), t(!1));
|
|
607
617
|
});
|
|
608
|
-
const c = (
|
|
609
|
-
|
|
618
|
+
const c = (d) => {
|
|
619
|
+
d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
610
620
|
};
|
|
611
621
|
document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
612
622
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -703,7 +713,7 @@ const Y = class Y {
|
|
|
703
713
|
}
|
|
704
714
|
draw() {
|
|
705
715
|
const t = document.createElement("div");
|
|
706
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
716
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, _.hiddenElements.add(t), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), X(t, this.nestingLevel);
|
|
707
717
|
const e = document.createElement("div");
|
|
708
718
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
709
719
|
"aria-expanded",
|
|
@@ -734,14 +744,14 @@ const Y = class Y {
|
|
|
734
744
|
}, Object.keys(this.settings).length > 0) {
|
|
735
745
|
for (const c in this.settings)
|
|
736
746
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
737
|
-
const
|
|
738
|
-
N(
|
|
739
|
-
const
|
|
740
|
-
N(
|
|
741
|
-
|
|
747
|
+
const d = this.settings[c];
|
|
748
|
+
N(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
|
|
749
|
+
const h = d.draw();
|
|
750
|
+
N(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
|
|
751
|
+
h,
|
|
742
752
|
c,
|
|
743
|
-
|
|
744
|
-
), a.appendChild(
|
|
753
|
+
d
|
|
754
|
+
), a.appendChild(h);
|
|
745
755
|
}
|
|
746
756
|
} else {
|
|
747
757
|
const c = document.createElement("div");
|
|
@@ -750,18 +760,18 @@ const Y = class Y {
|
|
|
750
760
|
if (this.addItemCfg) {
|
|
751
761
|
const c = document.createElement("button");
|
|
752
762
|
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
753
|
-
const
|
|
763
|
+
const d = `
|
|
754
764
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
755
765
|
xmlns="http://www.w3.org/2000/svg">
|
|
756
766
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
757
767
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
758
768
|
</svg>`;
|
|
759
|
-
c.innerHTML = `${
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
if (st(
|
|
763
|
-
const
|
|
764
|
-
this.addSetting(
|
|
769
|
+
c.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (h) => {
|
|
770
|
+
h.stopPropagation(), h.preventDefault();
|
|
771
|
+
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
772
|
+
if (st(g)) {
|
|
773
|
+
const C = `${this.addItemCfg.keyPrefix}${u}`;
|
|
774
|
+
this.addSetting(C, g);
|
|
765
775
|
}
|
|
766
776
|
}), a.appendChild(c);
|
|
767
777
|
}
|
|
@@ -807,12 +817,12 @@ const Y = class Y {
|
|
|
807
817
|
}
|
|
808
818
|
}
|
|
809
819
|
};
|
|
810
|
-
|
|
811
|
-
let
|
|
820
|
+
_.hiddenElements = /* @__PURE__ */ new Set();
|
|
821
|
+
let z = _;
|
|
812
822
|
function zt(p) {
|
|
813
823
|
return new ut(p);
|
|
814
824
|
}
|
|
815
|
-
class ut extends
|
|
825
|
+
class ut extends z {
|
|
816
826
|
constructor(t) {
|
|
817
827
|
super(t);
|
|
818
828
|
const e = Object.keys(this.settings)[0];
|
|
@@ -852,9 +862,9 @@ class ut extends G {
|
|
|
852
862
|
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);
|
|
853
863
|
const c = document.createElement("div");
|
|
854
864
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
865
|
+
const d = this.settings[a];
|
|
866
|
+
d && (N(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
867
|
+
d.draw()
|
|
858
868
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
859
869
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
860
870
|
const a = Object.keys(this.settings)[0];
|
|
@@ -864,12 +874,12 @@ class ut extends G {
|
|
|
864
874
|
}
|
|
865
875
|
}
|
|
866
876
|
function gt(p) {
|
|
867
|
-
return new
|
|
877
|
+
return new z(p);
|
|
868
878
|
}
|
|
869
879
|
function Ut(p) {
|
|
870
880
|
return p;
|
|
871
881
|
}
|
|
872
|
-
class mt extends
|
|
882
|
+
class mt extends I {
|
|
873
883
|
constructor(t = {}) {
|
|
874
884
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
875
885
|
}
|
|
@@ -890,17 +900,17 @@ class mt extends S {
|
|
|
890
900
|
}
|
|
891
901
|
}
|
|
892
902
|
const ft = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
893
|
-
class
|
|
903
|
+
class R extends mt {
|
|
894
904
|
constructor(t) {
|
|
895
905
|
super({
|
|
896
906
|
...t,
|
|
897
907
|
icon: t.icon || ft,
|
|
898
908
|
title: t.title || "Color",
|
|
899
|
-
default: t.default ?
|
|
909
|
+
default: t.default ? R.normalizeColorValue(t.default) : "#000000"
|
|
900
910
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
901
911
|
}
|
|
902
912
|
static normalizeColorValue(t) {
|
|
903
|
-
return t.startsWith("#") ?
|
|
913
|
+
return t.startsWith("#") ? R.normalizeHexValue(t) : t.includes(",") ? R.rgbToHexStatic(t) : R.normalizeHexValue(t);
|
|
904
914
|
}
|
|
905
915
|
static normalizeHexValue(t) {
|
|
906
916
|
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");
|
|
@@ -910,8 +920,8 @@ class F extends mt {
|
|
|
910
920
|
if (e.length !== 3 || e.some(isNaN))
|
|
911
921
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
912
922
|
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (c) => {
|
|
913
|
-
const
|
|
914
|
-
return
|
|
923
|
+
const d = c.toString(16);
|
|
924
|
+
return d.length === 1 ? "0" + d : d;
|
|
915
925
|
};
|
|
916
926
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
917
927
|
}
|
|
@@ -921,7 +931,7 @@ class F extends mt {
|
|
|
921
931
|
return;
|
|
922
932
|
}
|
|
923
933
|
if (typeof t == "string") {
|
|
924
|
-
const e =
|
|
934
|
+
const e = R.normalizeColorValue(t);
|
|
925
935
|
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);
|
|
926
936
|
} else
|
|
927
937
|
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");
|
|
@@ -951,8 +961,8 @@ class F extends mt {
|
|
|
951
961
|
const r = l.value.trim();
|
|
952
962
|
if (!r)
|
|
953
963
|
return e.classList.remove("error"), !0;
|
|
954
|
-
const
|
|
955
|
-
return
|
|
964
|
+
const d = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
965
|
+
return d ? e.classList.remove("error") : e.classList.add("error"), d;
|
|
956
966
|
}, s = document.createElement("input");
|
|
957
967
|
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;
|
|
958
968
|
const n = document.createElement("div");
|
|
@@ -961,20 +971,20 @@ class F extends mt {
|
|
|
961
971
|
n.style.backgroundColor = o;
|
|
962
972
|
const a = document.createElement("input");
|
|
963
973
|
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) => {
|
|
964
|
-
var c,
|
|
974
|
+
var c, d;
|
|
965
975
|
let r = l.target.value.trim();
|
|
966
976
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
967
|
-
const
|
|
968
|
-
this.value =
|
|
977
|
+
const h = R.normalizeColorValue(r);
|
|
978
|
+
this.value = h, (c = this.onChange) == null || c.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.colorInputEl && (this.colorInputEl.value = h), n.style.backgroundColor = h;
|
|
969
979
|
}
|
|
970
980
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
971
|
-
var
|
|
972
|
-
const r = l.target.value, c =
|
|
973
|
-
this.value = c, (
|
|
981
|
+
var d, h;
|
|
982
|
+
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
983
|
+
this.value = c, (d = this.onChange) == null || d.call(this, c), (h = this.detectChange) == null || h.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c, e.classList.remove("error");
|
|
974
984
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
975
|
-
var
|
|
976
|
-
const r = l.target.value, c =
|
|
977
|
-
this.value = c, (
|
|
985
|
+
var d, h;
|
|
986
|
+
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
987
|
+
this.value = c, (d = this.onChange) == null || d.call(this, c), (h = this.detectChange) == null || h.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c;
|
|
978
988
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
979
989
|
}
|
|
980
990
|
getElement() {
|
|
@@ -982,7 +992,7 @@ class F extends mt {
|
|
|
982
992
|
}
|
|
983
993
|
// Helper method to get normalized hex value
|
|
984
994
|
getNormalizedValue() {
|
|
985
|
-
return this.value ?
|
|
995
|
+
return this.value ? R.normalizeColorValue(this.value) : "#000000";
|
|
986
996
|
}
|
|
987
997
|
// Helper method to check if current value is valid hex
|
|
988
998
|
isValidHex() {
|
|
@@ -999,14 +1009,14 @@ const vt = `
|
|
|
999
1009
|
<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"/>
|
|
1000
1010
|
<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"/>
|
|
1001
1011
|
</svg>`;
|
|
1002
|
-
class
|
|
1012
|
+
class U extends I {
|
|
1003
1013
|
constructor(t = {}) {
|
|
1004
1014
|
super({
|
|
1005
1015
|
...t,
|
|
1006
1016
|
icon: t.icon || vt,
|
|
1007
1017
|
title: t.title || "Color & Opacity",
|
|
1008
1018
|
default: t.default || "#000000FF"
|
|
1009
|
-
}), 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 =
|
|
1019
|
+
}), 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 = U.normalizeHexWithOpacity(this.value));
|
|
1010
1020
|
}
|
|
1011
1021
|
static normalizeHexWithOpacity(t) {
|
|
1012
1022
|
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");
|
|
@@ -1024,7 +1034,7 @@ class W extends S {
|
|
|
1024
1034
|
return `#${i}${n}`;
|
|
1025
1035
|
}
|
|
1026
1036
|
setValue(t) {
|
|
1027
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1037
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = U.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1028
1038
|
}
|
|
1029
1039
|
updateInputElements() {
|
|
1030
1040
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1035,7 +1045,7 @@ class W extends S {
|
|
|
1035
1045
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1036
1046
|
}
|
|
1037
1047
|
handleColorChange(t) {
|
|
1038
|
-
const e = this.getOpacityPercent(), i =
|
|
1048
|
+
const e = this.getOpacityPercent(), i = U.combineColorOpacity(
|
|
1039
1049
|
t,
|
|
1040
1050
|
e
|
|
1041
1051
|
);
|
|
@@ -1046,7 +1056,7 @@ class W extends S {
|
|
|
1046
1056
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1047
1057
|
}
|
|
1048
1058
|
handleOpacityChange(t) {
|
|
1049
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1059
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = U.combineColorOpacity(
|
|
1050
1060
|
e,
|
|
1051
1061
|
i
|
|
1052
1062
|
);
|
|
@@ -1121,7 +1131,7 @@ class W extends S {
|
|
|
1121
1131
|
};
|
|
1122
1132
|
}
|
|
1123
1133
|
}
|
|
1124
|
-
class jt extends
|
|
1134
|
+
class jt extends I {
|
|
1125
1135
|
constructor(t = {}) {
|
|
1126
1136
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1127
1137
|
}
|
|
@@ -1153,7 +1163,7 @@ class jt extends S {
|
|
|
1153
1163
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1154
1164
|
}
|
|
1155
1165
|
}
|
|
1156
|
-
class
|
|
1166
|
+
class G extends I {
|
|
1157
1167
|
constructor(t) {
|
|
1158
1168
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1159
1169
|
}
|
|
@@ -1217,7 +1227,7 @@ const Ct = `
|
|
|
1217
1227
|
<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"/>
|
|
1218
1228
|
<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"/>
|
|
1219
1229
|
</svg>`;
|
|
1220
|
-
class yt extends
|
|
1230
|
+
class yt extends G {
|
|
1221
1231
|
constructor(t = {}) {
|
|
1222
1232
|
const e = {
|
|
1223
1233
|
title: "Opacity",
|
|
@@ -1243,7 +1253,7 @@ const Et = `
|
|
|
1243
1253
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1244
1254
|
</svg>
|
|
1245
1255
|
`;
|
|
1246
|
-
class et extends
|
|
1256
|
+
class et extends I {
|
|
1247
1257
|
constructor(t = {}) {
|
|
1248
1258
|
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) {
|
|
1249
1259
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1356,7 +1366,7 @@ class et extends S {
|
|
|
1356
1366
|
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();
|
|
1357
1367
|
}
|
|
1358
1368
|
}
|
|
1359
|
-
class bt extends
|
|
1369
|
+
class bt extends I {
|
|
1360
1370
|
constructor(t = {}) {
|
|
1361
1371
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1362
1372
|
}
|
|
@@ -1412,7 +1422,7 @@ class bt extends S {
|
|
|
1412
1422
|
}), t.appendChild(i), t;
|
|
1413
1423
|
}
|
|
1414
1424
|
}
|
|
1415
|
-
class _t extends
|
|
1425
|
+
class _t extends I {
|
|
1416
1426
|
constructor(t) {
|
|
1417
1427
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1418
1428
|
}
|
|
@@ -1441,21 +1451,21 @@ class _t extends S {
|
|
|
1441
1451
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1442
1452
|
}
|
|
1443
1453
|
}
|
|
1444
|
-
class qt extends
|
|
1454
|
+
class qt extends I {
|
|
1445
1455
|
constructor(t = {}) {
|
|
1446
1456
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1447
1457
|
const e = t.width || 0, i = t.height || 0;
|
|
1448
1458
|
this.value || (this.value = {
|
|
1449
1459
|
width: e,
|
|
1450
1460
|
height: i
|
|
1451
|
-
}), 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
|
|
1461
|
+
}), 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 G({
|
|
1452
1462
|
title: "Width",
|
|
1453
1463
|
default: this.value.width,
|
|
1454
1464
|
suffix: "px",
|
|
1455
1465
|
minValue: this.minWidth,
|
|
1456
1466
|
maxValue: this.maxWidth,
|
|
1457
1467
|
icon: wt
|
|
1458
|
-
}), this.heightSetting = new
|
|
1468
|
+
}), this.heightSetting = new G({
|
|
1459
1469
|
title: "Height",
|
|
1460
1470
|
default: this.value.height,
|
|
1461
1471
|
suffix: "px",
|
|
@@ -1592,7 +1602,7 @@ const wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1592
1602
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1593
1603
|
</svg>
|
|
1594
1604
|
`;
|
|
1595
|
-
class at extends
|
|
1605
|
+
class at extends I {
|
|
1596
1606
|
constructor(t = {}) {
|
|
1597
1607
|
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();
|
|
1598
1608
|
}
|
|
@@ -1712,7 +1722,7 @@ class at extends S {
|
|
|
1712
1722
|
}, t;
|
|
1713
1723
|
}
|
|
1714
1724
|
}
|
|
1715
|
-
class Jt extends
|
|
1725
|
+
class Jt extends G {
|
|
1716
1726
|
constructor(t = {}) {
|
|
1717
1727
|
super({
|
|
1718
1728
|
...t,
|
|
@@ -1733,7 +1743,7 @@ class Jt extends D {
|
|
|
1733
1743
|
const St = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1734
1744
|
<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"/>
|
|
1735
1745
|
</svg>`;
|
|
1736
|
-
class Zt extends
|
|
1746
|
+
class Zt extends G {
|
|
1737
1747
|
constructor(t = {}) {
|
|
1738
1748
|
super({
|
|
1739
1749
|
...t,
|
|
@@ -1758,7 +1768,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1758
1768
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1759
1769
|
</svg>
|
|
1760
1770
|
`;
|
|
1761
|
-
class Xt extends
|
|
1771
|
+
class Xt extends I {
|
|
1762
1772
|
constructor(t = {}) {
|
|
1763
1773
|
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) {
|
|
1764
1774
|
const e = this._options.findIndex(
|
|
@@ -1860,7 +1870,7 @@ class Xt extends S {
|
|
|
1860
1870
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1861
1871
|
}
|
|
1862
1872
|
selectApiOption(t, e, i) {
|
|
1863
|
-
var l, r, c,
|
|
1873
|
+
var l, r, c, d;
|
|
1864
1874
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1865
1875
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1866
1876
|
const o = this._options[e].value;
|
|
@@ -1869,10 +1879,10 @@ class Xt extends S {
|
|
|
1869
1879
|
if (a)
|
|
1870
1880
|
a.textContent = this._options[e].name;
|
|
1871
1881
|
else {
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1882
|
+
const h = i.firstChild;
|
|
1883
|
+
h && h.tagName === "SPAN" && (h.textContent = this._options[e].name);
|
|
1874
1884
|
}
|
|
1875
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (c = this.svgContainer) == null || c.classList.remove("open"), (
|
|
1885
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (c = this.svgContainer) == null || c.classList.remove("open"), (d = this.onChange) == null || d.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1876
1886
|
}
|
|
1877
1887
|
updateOptionsList() {
|
|
1878
1888
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1905,7 +1915,7 @@ class Xt extends S {
|
|
|
1905
1915
|
), this.updateButtonText();
|
|
1906
1916
|
}
|
|
1907
1917
|
}
|
|
1908
|
-
class Yt extends
|
|
1918
|
+
class Yt extends I {
|
|
1909
1919
|
constructor(t) {
|
|
1910
1920
|
var e, i;
|
|
1911
1921
|
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;
|
|
@@ -1929,7 +1939,7 @@ class Yt extends S {
|
|
|
1929
1939
|
const s = document.createElement("input");
|
|
1930
1940
|
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", () => {
|
|
1931
1941
|
var r, c;
|
|
1932
|
-
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((
|
|
1942
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((d) => d.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
1933
1943
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1934
1944
|
});
|
|
1935
1945
|
const n = document.createElement("span");
|
|
@@ -1958,7 +1968,7 @@ class Yt extends S {
|
|
|
1958
1968
|
const Vt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1959
1969
|
<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"/>
|
|
1960
1970
|
</svg>`;
|
|
1961
|
-
class Kt extends
|
|
1971
|
+
class Kt extends I {
|
|
1962
1972
|
// Store mobile value
|
|
1963
1973
|
constructor(t = {}) {
|
|
1964
1974
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Vt, 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);
|
|
@@ -2015,7 +2025,7 @@ class Kt extends S {
|
|
|
2015
2025
|
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2016
2026
|
<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"/>
|
|
2017
2027
|
</svg>`;
|
|
2018
|
-
class Qt extends
|
|
2028
|
+
class Qt extends G {
|
|
2019
2029
|
constructor(t = {}) {
|
|
2020
2030
|
super({
|
|
2021
2031
|
...t,
|
|
@@ -2032,7 +2042,7 @@ const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
2032
2042
|
<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"
|
|
2033
2043
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2034
2044
|
</svg>`;
|
|
2035
|
-
class te extends
|
|
2045
|
+
class te extends G {
|
|
2036
2046
|
constructor(t = {}) {
|
|
2037
2047
|
super({
|
|
2038
2048
|
...t,
|
|
@@ -2045,9 +2055,9 @@ class te extends D {
|
|
|
2045
2055
|
}), this.inputType = "number";
|
|
2046
2056
|
}
|
|
2047
2057
|
}
|
|
2048
|
-
class ee extends
|
|
2058
|
+
class ee extends I {
|
|
2049
2059
|
constructor(t) {
|
|
2050
|
-
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(
|
|
2060
|
+
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(I.DefaultLanguage) ? I.DefaultLanguage : t.languages[0];
|
|
2051
2061
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2052
2062
|
t.languages.forEach((i) => {
|
|
2053
2063
|
var s, n;
|
|
@@ -2078,13 +2088,13 @@ class ee extends S {
|
|
|
2078
2088
|
return;
|
|
2079
2089
|
}
|
|
2080
2090
|
const c = "...";
|
|
2081
|
-
let
|
|
2082
|
-
for (;
|
|
2083
|
-
const
|
|
2084
|
-
this.measureTextWidth(
|
|
2091
|
+
let d = 0, h = e.length, u = 0;
|
|
2092
|
+
for (; d <= h; ) {
|
|
2093
|
+
const C = Math.floor((d + h) / 2), m = e.slice(0, C).trimEnd() + c;
|
|
2094
|
+
this.measureTextWidth(m, i) <= l ? (u = C, d = C + 1) : h = C - 1;
|
|
2085
2095
|
}
|
|
2086
|
-
const
|
|
2087
|
-
t.placeholder =
|
|
2096
|
+
const g = e.slice(0, u).trimEnd() + c;
|
|
2097
|
+
t.placeholder = g;
|
|
2088
2098
|
}
|
|
2089
2099
|
autosizeTextarea(t, e = 3) {
|
|
2090
2100
|
t.style.height = "auto";
|
|
@@ -2192,7 +2202,7 @@ class ee extends S {
|
|
|
2192
2202
|
});
|
|
2193
2203
|
}
|
|
2194
2204
|
}
|
|
2195
|
-
class ie extends
|
|
2205
|
+
class ie extends I {
|
|
2196
2206
|
constructor(t = {}) {
|
|
2197
2207
|
super(t), this.inputType = "select";
|
|
2198
2208
|
const e = [
|
|
@@ -2235,75 +2245,82 @@ const lt = `<svg
|
|
|
2235
2245
|
</svg>`;
|
|
2236
2246
|
function nt(p) {
|
|
2237
2247
|
try {
|
|
2238
|
-
const t = p.match(/linear-gradient\(
|
|
2248
|
+
const t = p.match(/linear-gradient\s*\(/);
|
|
2239
2249
|
if (t) {
|
|
2240
|
-
const e = t[
|
|
2241
|
-
let i =
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
if (c.includes("deg") || c.includes("to ")) continue;
|
|
2255
|
-
let h = "", d = 0, m = 100;
|
|
2256
|
-
const u = c.match(/rgba?\(([^)]+)\)(?:\s*(\d+)%)?/);
|
|
2257
|
-
if (u) {
|
|
2258
|
-
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), y = parseInt(g[1]), v = parseInt(g[2]), w = g[3] ? parseFloat(g[3]) : 1;
|
|
2259
|
-
h = `#${f.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(w * 100), u[2] ? d = parseInt(u[2]) : d = Math.round(r / Math.max(n.length - 2, 1) * 100);
|
|
2260
|
-
} else {
|
|
2261
|
-
const g = c.match(/#([a-fA-F0-9]{3,8})(?:\s*(\d+)%)?/);
|
|
2262
|
-
g && (h = `#${g[1]}`, g[2] ? d = parseInt(g[2]) : d = Math.round(r / Math.max(n.length - 2, 1) * 100));
|
|
2250
|
+
const e = t.index + t[0].length;
|
|
2251
|
+
let i = 1, s = e;
|
|
2252
|
+
for (let n = e; n < p.length && i > 0; n++)
|
|
2253
|
+
p[n] === "(" ? i++ : p[n] === ")" && i--, s = n;
|
|
2254
|
+
if (i === 0) {
|
|
2255
|
+
const n = p.substring(e, s).trim();
|
|
2256
|
+
let o = 90;
|
|
2257
|
+
const a = n.match(/(\d+)deg/);
|
|
2258
|
+
a ? o = parseInt(a[1]) : n.includes("to right") ? o = 90 : n.includes("to left") ? o = 270 : n.includes("to top") ? o = 0 : n.includes("to bottom") ? o = 180 : n.includes("to top right") ? o = 45 : n.includes("to top left") ? o = 315 : n.includes("to bottom right") ? o = 135 : n.includes("to bottom left") && (o = 225);
|
|
2259
|
+
const l = [];
|
|
2260
|
+
let r = "", c = 0;
|
|
2261
|
+
for (let u = 0; u < n.length; u++) {
|
|
2262
|
+
const g = n[u];
|
|
2263
|
+
g === "(" && c++, g === ")" && c--, g === "," && c === 0 ? (l.push(r.trim()), r = "") : r += g;
|
|
2263
2264
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
if (u) {
|
|
2284
|
-
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), y = parseInt(g[1]), v = parseInt(g[2]), w = g[3] ? parseFloat(g[3]) : 1;
|
|
2285
|
-
d = `#${f.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(w * 100);
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
if (d) {
|
|
2289
|
-
const u = Math.round(
|
|
2290
|
-
h / Math.max(r.length - 1, 1) * 100
|
|
2265
|
+
r.trim() && l.push(r.trim());
|
|
2266
|
+
const d = [];
|
|
2267
|
+
let h = [];
|
|
2268
|
+
for (let u = 0; u < l.length; u++) {
|
|
2269
|
+
const g = l[u];
|
|
2270
|
+
g.includes("deg") || g.includes("to ") || h.push(g);
|
|
2271
|
+
}
|
|
2272
|
+
for (let u = 0; u < h.length; u++) {
|
|
2273
|
+
const g = h[u];
|
|
2274
|
+
let C = "", m = 0, y = 100;
|
|
2275
|
+
const f = g.match(
|
|
2276
|
+
/rgba?\(([^)]+)\)(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2277
|
+
);
|
|
2278
|
+
if (f) {
|
|
2279
|
+
const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
|
|
2280
|
+
C = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100), f[2] ? m = parseFloat(f[2]) : m = h.length === 1 ? 0 : Math.round(u / (h.length - 1) * 100);
|
|
2281
|
+
} else {
|
|
2282
|
+
const E = g.match(
|
|
2283
|
+
/#([a-fA-F0-9]{3,8})(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2291
2284
|
);
|
|
2292
|
-
|
|
2293
|
-
`Auto-positioned stop: ${d} at ${u}% with ${m}% opacity`
|
|
2294
|
-
), l.push({
|
|
2295
|
-
color: d,
|
|
2296
|
-
position: u,
|
|
2297
|
-
opacity: m
|
|
2298
|
-
});
|
|
2285
|
+
E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m = h.length === 1 ? 0 : Math.round(u / (h.length - 1) * 100));
|
|
2299
2286
|
}
|
|
2300
|
-
|
|
2287
|
+
C && d.push({
|
|
2288
|
+
color: C,
|
|
2289
|
+
position: m,
|
|
2290
|
+
opacity: y
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
if (d.length === 0) {
|
|
2294
|
+
const u = n.match(
|
|
2295
|
+
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2296
|
+
);
|
|
2297
|
+
u && u.forEach((g, C) => {
|
|
2298
|
+
let m = "", y = 100;
|
|
2299
|
+
if (g.startsWith("#"))
|
|
2300
|
+
m = g;
|
|
2301
|
+
else {
|
|
2302
|
+
const f = g.match(/rgba?\(([^)]+)\)/);
|
|
2303
|
+
if (f) {
|
|
2304
|
+
const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
|
|
2305
|
+
m = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
if (m) {
|
|
2309
|
+
const f = u.length === 1 ? 0 : Math.round(C / (u.length - 1) * 100);
|
|
2310
|
+
d.push({
|
|
2311
|
+
color: m,
|
|
2312
|
+
position: f,
|
|
2313
|
+
opacity: y
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
return console.log("Color stops found:", d), {
|
|
2319
|
+
type: "linear",
|
|
2320
|
+
angle: o,
|
|
2321
|
+
stops: d
|
|
2322
|
+
};
|
|
2301
2323
|
}
|
|
2302
|
-
return {
|
|
2303
|
-
type: "linear",
|
|
2304
|
-
angle: i,
|
|
2305
|
-
stops: l
|
|
2306
|
-
};
|
|
2307
2324
|
}
|
|
2308
2325
|
return null;
|
|
2309
2326
|
} catch (t) {
|
|
@@ -2340,27 +2357,27 @@ class Pt {
|
|
|
2340
2357
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2341
2358
|
const c = document.createElement("div");
|
|
2342
2359
|
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2343
|
-
const h = document.createElement("div");
|
|
2344
|
-
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2345
2360
|
const d = document.createElement("div");
|
|
2346
|
-
d.className = "color-picker-opacity
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2349
|
-
const u = document.createElement("
|
|
2350
|
-
u.className = "color-picker-format-
|
|
2351
|
-
const g = document.createElement("
|
|
2352
|
-
g.
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2361
|
+
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2362
|
+
const h = document.createElement("div");
|
|
2363
|
+
h.className = "color-picker-opacity-marker", this.opacityMarker = h, d.appendChild(h);
|
|
2364
|
+
const u = document.createElement("div");
|
|
2365
|
+
u.className = "color-picker-format-section";
|
|
2366
|
+
const g = document.createElement("select");
|
|
2367
|
+
g.className = "color-picker-format-select", this.formatSelect = g;
|
|
2368
|
+
const C = document.createElement("option");
|
|
2369
|
+
C.value = "hex", C.textContent = "HEX";
|
|
2370
|
+
const m = document.createElement("option");
|
|
2371
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
2355
2372
|
const y = document.createElement("option");
|
|
2356
|
-
y.value = "hsl", y.textContent = "HSL",
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2373
|
+
y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
|
|
2374
|
+
const f = document.createElement("input");
|
|
2375
|
+
f.type = "text", f.className = "color-picker-color-input", f.value = this.currentColor, this.hexInput = f;
|
|
2376
|
+
const E = document.createElement("div");
|
|
2377
|
+
E.className = "color-picker-input-container";
|
|
2361
2378
|
const V = document.createElement("button");
|
|
2362
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()),
|
|
2363
|
-
|
|
2379
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), E.appendChild(f), E.appendChild(V), u.appendChild(g), u.appendChild(E), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(d), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (A) => {
|
|
2380
|
+
A.stopPropagation();
|
|
2364
2381
|
}), t;
|
|
2365
2382
|
}
|
|
2366
2383
|
setupEventListeners() {
|
|
@@ -2400,11 +2417,7 @@ class Pt {
|
|
|
2400
2417
|
this.isUpdatingHue = !0;
|
|
2401
2418
|
const e = this.hueSlider.getBoundingClientRect();
|
|
2402
2419
|
let i = (t.clientX - e.left) / e.width;
|
|
2403
|
-
i = Math.max(2e-3, Math.min(0.996, i)),
|
|
2404
|
-
x: i,
|
|
2405
|
-
hueValue: i * 360,
|
|
2406
|
-
percent: i * 100
|
|
2407
|
-
}), this.hueMarker.style.left = `${i * 100}%`;
|
|
2420
|
+
i = Math.max(2e-3, Math.min(0.996, i)), this.hueMarker.style.left = `${i * 100}%`;
|
|
2408
2421
|
const s = i * 360;
|
|
2409
2422
|
this.updateHue(s), this.isUpdatingHue = !1;
|
|
2410
2423
|
}
|
|
@@ -2413,16 +2426,15 @@ class Pt {
|
|
|
2413
2426
|
this.setColor(s);
|
|
2414
2427
|
}
|
|
2415
2428
|
updateHue(t) {
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
const i = parseFloat(this.colorMarker.style.left || "50%") / 100, s = parseFloat(this.colorMarker.style.top || "50%") / 100;
|
|
2429
|
+
t = Math.max(0.5, Math.min(358.5, t)), this.colorArea.getBoundingClientRect();
|
|
2430
|
+
const e = parseFloat(this.colorMarker.style.left || "50%") / 100, i = parseFloat(this.colorMarker.style.top || "50%") / 100;
|
|
2419
2431
|
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`;
|
|
2420
|
-
const
|
|
2421
|
-
this.setColor(
|
|
2432
|
+
const s = e, n = 1 - i, o = this.hsvToHex(t, s, n);
|
|
2433
|
+
this.setColor(o);
|
|
2422
2434
|
}
|
|
2423
2435
|
getCurrentHue() {
|
|
2424
|
-
const
|
|
2425
|
-
return
|
|
2436
|
+
const e = parseFloat(this.hueMarker.style.left || "0%") / 100 * 360;
|
|
2437
|
+
return Math.max(0.5, Math.min(358.5, e));
|
|
2426
2438
|
}
|
|
2427
2439
|
updateColorInput() {
|
|
2428
2440
|
const t = this.formatSelect.value, { h: e, s: i, v: s } = this.hexToHsv(this.currentColor);
|
|
@@ -2490,7 +2502,7 @@ class Pt {
|
|
|
2490
2502
|
return /^#[0-9A-Fa-f]{6}$/.test(t);
|
|
2491
2503
|
}
|
|
2492
2504
|
hsvToHex(t, e, i) {
|
|
2493
|
-
t = Math.max(0, Math.min(359.9, t)), e = Math.max(0, Math.min(1, e)), i = Math.max(0, Math.min(1, i))
|
|
2505
|
+
t = Math.max(0, Math.min(359.9, t)), e = Math.max(0, Math.min(1, e)), i = Math.max(0, Math.min(1, i));
|
|
2494
2506
|
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
2495
2507
|
let a = 0, l = 0, r = 0;
|
|
2496
2508
|
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")}`;
|
|
@@ -2551,21 +2563,21 @@ class Pt {
|
|
|
2551
2563
|
}
|
|
2552
2564
|
makeDraggable(t, e) {
|
|
2553
2565
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2554
|
-
const l = (
|
|
2555
|
-
if (
|
|
2566
|
+
const l = (d) => {
|
|
2567
|
+
if (d.target.closest("button"))
|
|
2556
2568
|
return;
|
|
2557
|
-
|
|
2558
|
-
const
|
|
2559
|
-
o =
|
|
2560
|
-
}, r = (
|
|
2569
|
+
d.preventDefault(), d.stopPropagation(), i = !0, s = d.clientX, n = d.clientY;
|
|
2570
|
+
const h = e.getBoundingClientRect();
|
|
2571
|
+
o = h.left, a = h.top, e.classList.add("dragging"), document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
2572
|
+
}, r = (d) => {
|
|
2561
2573
|
if (!i) return;
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
let
|
|
2565
|
-
const
|
|
2566
|
-
|
|
2567
|
-
}, c = (
|
|
2568
|
-
i && (i = !1,
|
|
2574
|
+
d.preventDefault(), d.stopPropagation();
|
|
2575
|
+
const h = d.clientX - s, u = d.clientY - n;
|
|
2576
|
+
let g = o + h, C = a + u;
|
|
2577
|
+
const m = window.innerWidth, y = window.innerHeight, f = e.offsetWidth, E = e.offsetHeight;
|
|
2578
|
+
g = Math.max(8, Math.min(m - f - 8, g)), C = Math.max(8, Math.min(y - E - 8, C)), e.style.left = `${g}px`, e.style.top = `${C}px`;
|
|
2579
|
+
}, c = (d) => {
|
|
2580
|
+
i && (i = !1, d.preventDefault(), d.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2569
2581
|
};
|
|
2570
2582
|
t.addEventListener("mousedown", l);
|
|
2571
2583
|
}
|
|
@@ -2576,7 +2588,7 @@ class Pt {
|
|
|
2576
2588
|
return this.element;
|
|
2577
2589
|
}
|
|
2578
2590
|
}
|
|
2579
|
-
class se extends
|
|
2591
|
+
class se extends I {
|
|
2580
2592
|
constructor(t = {}) {
|
|
2581
2593
|
let e;
|
|
2582
2594
|
if (typeof t.default == "string")
|
|
@@ -2609,7 +2621,10 @@ class se extends S {
|
|
|
2609
2621
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2610
2622
|
]
|
|
2611
2623
|
};
|
|
2612
|
-
|
|
2624
|
+
(!e.stops || e.stops.length === 0) && (e.stops = [
|
|
2625
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2626
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2627
|
+
]), super({
|
|
2613
2628
|
...t,
|
|
2614
2629
|
title: t.title || "Gradient",
|
|
2615
2630
|
default: e
|
|
@@ -2628,26 +2643,12 @@ class se extends S {
|
|
|
2628
2643
|
}
|
|
2629
2644
|
// Safe getter for the value property
|
|
2630
2645
|
getSafeValue() {
|
|
2631
|
-
return !this.value || !this.isValidGradientValue(this.value) ? (console.warn("Invalid value detected, returning default:", this.value),
|
|
2632
|
-
type: "linear",
|
|
2633
|
-
angle: 90,
|
|
2634
|
-
stops: [
|
|
2635
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2636
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2637
|
-
]
|
|
2638
|
-
}) : this.value;
|
|
2646
|
+
return !this.value || !this.isValidGradientValue(this.value) ? (console.warn("Invalid value detected, returning default:", this.value), this.getDefaultGradientValue()) : this.value;
|
|
2639
2647
|
}
|
|
2640
2648
|
setValue(t) {
|
|
2641
2649
|
let e;
|
|
2642
2650
|
if (!t)
|
|
2643
|
-
console.warn("Undefined value in setValue, using default"), e =
|
|
2644
|
-
type: "linear",
|
|
2645
|
-
angle: 90,
|
|
2646
|
-
stops: [
|
|
2647
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2648
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2649
|
-
]
|
|
2650
|
-
};
|
|
2651
|
+
console.warn("Undefined value in setValue, using default"), e = this.getDefaultGradientValue();
|
|
2651
2652
|
else if (typeof t == "string")
|
|
2652
2653
|
if (t.match(/^#[a-fA-F0-9]{3,8}$/)) {
|
|
2653
2654
|
let i = t, s = 100;
|
|
@@ -2662,17 +2663,10 @@ class se extends S {
|
|
|
2662
2663
|
};
|
|
2663
2664
|
} else {
|
|
2664
2665
|
const i = nt(t);
|
|
2665
|
-
i ? e = i : (console.warn(
|
|
2666
|
+
i && this.isValidGradientValue(i) ? e = i : (console.warn(
|
|
2666
2667
|
"Failed to parse string value, using default:",
|
|
2667
2668
|
t
|
|
2668
|
-
), e =
|
|
2669
|
-
type: "linear",
|
|
2670
|
-
angle: 90,
|
|
2671
|
-
stops: [
|
|
2672
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2673
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2674
|
-
]
|
|
2675
|
-
});
|
|
2669
|
+
), e = this.getDefaultGradientValue());
|
|
2676
2670
|
}
|
|
2677
2671
|
else if (typeof t == "object" && t.background) {
|
|
2678
2672
|
console.warn(
|
|
@@ -2684,28 +2678,27 @@ class se extends S {
|
|
|
2684
2678
|
this.setValue(i);
|
|
2685
2679
|
return;
|
|
2686
2680
|
} else
|
|
2687
|
-
e =
|
|
2688
|
-
|
|
2689
|
-
angle: 90,
|
|
2690
|
-
stops: [
|
|
2691
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2692
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2693
|
-
]
|
|
2694
|
-
};
|
|
2695
|
-
} else this.isValidGradientValue(t) ? (e = t, e.stops && e.stops.forEach((i) => {
|
|
2681
|
+
e = this.getDefaultGradientValue();
|
|
2682
|
+
} else this.isValidGradientValue(t) ? (e = t, e.stops && e.stops.length > 0 ? e.stops.forEach((i) => {
|
|
2696
2683
|
i.opacity === void 0 && (i.opacity = 100);
|
|
2697
|
-
})
|
|
2684
|
+
}) : e.stops = [
|
|
2685
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2686
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2687
|
+
]) : (console.warn(
|
|
2698
2688
|
"Invalid gradient value in setValue, using default:",
|
|
2699
2689
|
t
|
|
2700
|
-
), e =
|
|
2690
|
+
), e = this.getDefaultGradientValue());
|
|
2691
|
+
super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2692
|
+
}
|
|
2693
|
+
getDefaultGradientValue() {
|
|
2694
|
+
return this.props && this.props.default && this.isValidGradientValue(this.props.default) ? this.props.default : {
|
|
2701
2695
|
type: "linear",
|
|
2702
2696
|
angle: 90,
|
|
2703
2697
|
stops: [
|
|
2704
2698
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2705
2699
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2706
2700
|
]
|
|
2707
|
-
}
|
|
2708
|
-
super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2701
|
+
};
|
|
2709
2702
|
}
|
|
2710
2703
|
updateUI() {
|
|
2711
2704
|
if (this.previewElement && this.value)
|
|
@@ -2878,14 +2871,14 @@ class se extends S {
|
|
|
2878
2871
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2879
2872
|
}
|
|
2880
2873
|
createSolidEditor(t) {
|
|
2881
|
-
var o, a, l, r, c,
|
|
2874
|
+
var o, a, l, r, c, d;
|
|
2882
2875
|
const e = document.createElement("div");
|
|
2883
2876
|
e.className = "gradient-solid-picker embedded-color-picker";
|
|
2884
|
-
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((
|
|
2877
|
+
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((d = (c = (r = this.value) == null ? void 0 : r.stops) == null ? void 0 : c[0]) == null ? void 0 : d.opacity) || 100, n = this.createEmbeddedColorPickerWithOpacity(
|
|
2885
2878
|
i,
|
|
2886
2879
|
s,
|
|
2887
|
-
(
|
|
2888
|
-
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color:
|
|
2880
|
+
(h, u) => {
|
|
2881
|
+
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color: h, position: 0, opacity: u }] : (this.value.stops[0].color = h, this.value.stops[0].opacity = u), this.updateUI(), this.triggerChange());
|
|
2889
2882
|
}
|
|
2890
2883
|
);
|
|
2891
2884
|
e.appendChild(n), t.appendChild(e);
|
|
@@ -2907,40 +2900,40 @@ class se extends S {
|
|
|
2907
2900
|
r.className = "color-picker-hue embedded";
|
|
2908
2901
|
const c = document.createElement("div");
|
|
2909
2902
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2910
|
-
const h = document.createElement("div");
|
|
2911
|
-
h.className = "color-picker-opacity embedded";
|
|
2912
2903
|
const d = document.createElement("div");
|
|
2913
|
-
d.className = "color-picker-opacity
|
|
2914
|
-
const
|
|
2915
|
-
|
|
2916
|
-
const u = document.createElement("
|
|
2917
|
-
u.className = "color-picker-format-
|
|
2918
|
-
const g = document.createElement("
|
|
2919
|
-
g.
|
|
2920
|
-
const
|
|
2921
|
-
|
|
2904
|
+
d.className = "color-picker-opacity embedded";
|
|
2905
|
+
const h = document.createElement("div");
|
|
2906
|
+
h.className = "color-picker-opacity-marker", d.appendChild(h);
|
|
2907
|
+
const u = document.createElement("div");
|
|
2908
|
+
u.className = "color-picker-format-section embedded";
|
|
2909
|
+
const g = document.createElement("select");
|
|
2910
|
+
g.className = "color-picker-format-select";
|
|
2911
|
+
const C = document.createElement("option");
|
|
2912
|
+
C.value = "hex", C.textContent = "HEX";
|
|
2913
|
+
const m = document.createElement("option");
|
|
2914
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
2922
2915
|
const y = document.createElement("option");
|
|
2923
|
-
y.value = "hsl", y.textContent = "HSL",
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
const
|
|
2927
|
-
|
|
2916
|
+
y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
|
|
2917
|
+
const f = document.createElement("input");
|
|
2918
|
+
f.type = "text", f.className = "color-picker-color-input", f.value = t;
|
|
2919
|
+
const E = document.createElement("div");
|
|
2920
|
+
E.className = "color-picker-input-container";
|
|
2928
2921
|
const V = document.createElement("button");
|
|
2929
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy",
|
|
2922
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", E.appendChild(f), E.appendChild(V), u.appendChild(g), u.appendChild(E), s.appendChild(n), s.appendChild(a), s.appendChild(d), s.appendChild(u), this.setupEmbeddedColorPicker(
|
|
2930
2923
|
n,
|
|
2931
2924
|
o,
|
|
2932
2925
|
r,
|
|
2933
2926
|
c,
|
|
2934
|
-
|
|
2935
|
-
|
|
2927
|
+
g,
|
|
2928
|
+
f,
|
|
2936
2929
|
V,
|
|
2937
2930
|
l,
|
|
2938
2931
|
t,
|
|
2939
2932
|
e,
|
|
2940
2933
|
i
|
|
2941
2934
|
), this.setupOpacitySlider(
|
|
2942
|
-
h,
|
|
2943
2935
|
d,
|
|
2936
|
+
h,
|
|
2944
2937
|
t,
|
|
2945
2938
|
e,
|
|
2946
2939
|
i
|
|
@@ -2963,140 +2956,140 @@ class se extends S {
|
|
|
2963
2956
|
r.className = "color-picker-hue embedded";
|
|
2964
2957
|
const c = document.createElement("div");
|
|
2965
2958
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2966
|
-
const
|
|
2967
|
-
|
|
2968
|
-
const
|
|
2969
|
-
|
|
2970
|
-
const m = document.createElement("option");
|
|
2971
|
-
m.value = "hex", m.textContent = "HEX";
|
|
2959
|
+
const d = document.createElement("div");
|
|
2960
|
+
d.className = "color-picker-format-section embedded";
|
|
2961
|
+
const h = document.createElement("select");
|
|
2962
|
+
h.className = "color-picker-format-select";
|
|
2972
2963
|
const u = document.createElement("option");
|
|
2973
|
-
u.value = "
|
|
2964
|
+
u.value = "hex", u.textContent = "HEX";
|
|
2974
2965
|
const g = document.createElement("option");
|
|
2975
|
-
g.value = "
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2966
|
+
g.value = "rgb", g.textContent = "RGB";
|
|
2967
|
+
const C = document.createElement("option");
|
|
2968
|
+
C.value = "hsl", C.textContent = "HSL", h.appendChild(u), h.appendChild(g), h.appendChild(C);
|
|
2969
|
+
const m = document.createElement("input");
|
|
2970
|
+
m.type = "text", m.className = "color-picker-color-input", m.value = t;
|
|
2978
2971
|
const y = document.createElement("div");
|
|
2979
2972
|
y.className = "color-picker-input-container";
|
|
2980
|
-
const
|
|
2981
|
-
return
|
|
2973
|
+
const f = document.createElement("button");
|
|
2974
|
+
return f.className = "color-picker-copy-inside", f.textContent = "Copy", y.appendChild(m), y.appendChild(f), d.appendChild(h), d.appendChild(y), s.appendChild(n), s.appendChild(a), s.appendChild(d), this.setupEmbeddedColorPicker(
|
|
2982
2975
|
n,
|
|
2983
2976
|
o,
|
|
2984
2977
|
r,
|
|
2985
2978
|
c,
|
|
2986
|
-
|
|
2979
|
+
h,
|
|
2980
|
+
m,
|
|
2987
2981
|
f,
|
|
2988
|
-
v,
|
|
2989
2982
|
l,
|
|
2990
2983
|
t,
|
|
2991
2984
|
e,
|
|
2992
2985
|
i
|
|
2993
2986
|
), s;
|
|
2994
2987
|
}
|
|
2995
|
-
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c,
|
|
2996
|
-
let
|
|
2997
|
-
const { h:
|
|
2998
|
-
let
|
|
2999
|
-
s.style.left = `${
|
|
3000
|
-
const y = (
|
|
3001
|
-
|
|
3002
|
-
},
|
|
3003
|
-
const
|
|
3004
|
-
switch (
|
|
2988
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, d) {
|
|
2989
|
+
let h = r;
|
|
2990
|
+
const { h: u, s: g, v: C } = this.hexToHsv(r);
|
|
2991
|
+
let m = c;
|
|
2992
|
+
s.style.left = `${u / 360 * 100}%`, e.style.left = `${g * 100}%`, e.style.top = `${(1 - C) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`;
|
|
2993
|
+
const y = (v, w = m) => {
|
|
2994
|
+
h = v, m = Math.round(w), f(), d(v, m);
|
|
2995
|
+
}, f = () => {
|
|
2996
|
+
const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(h);
|
|
2997
|
+
switch (v) {
|
|
3005
2998
|
case "hex":
|
|
3006
|
-
o.value =
|
|
2999
|
+
o.value = h;
|
|
3007
3000
|
break;
|
|
3008
3001
|
case "rgb":
|
|
3009
|
-
const { r: H, g: $, b:
|
|
3010
|
-
o.value = `rgb(${H}, ${$}, ${
|
|
3002
|
+
const { r: H, g: $, b: W } = this.hexToRgb(h);
|
|
3003
|
+
o.value = `rgb(${H}, ${$}, ${W})`;
|
|
3011
3004
|
break;
|
|
3012
3005
|
case "hsl":
|
|
3013
|
-
const { hue:
|
|
3014
|
-
o.value = `hsl(${Math.round(
|
|
3015
|
-
|
|
3006
|
+
const { hue: F, sat: q, lightness: K } = this.hsvToHsl(w, x, k);
|
|
3007
|
+
o.value = `hsl(${Math.round(F)}, ${Math.round(
|
|
3008
|
+
q * 100
|
|
3016
3009
|
)}%, ${Math.round(K * 100)}%)`;
|
|
3017
3010
|
break;
|
|
3018
3011
|
}
|
|
3019
|
-
},
|
|
3020
|
-
const x =
|
|
3021
|
-
y(
|
|
3022
|
-
},
|
|
3023
|
-
|
|
3024
|
-
const
|
|
3025
|
-
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${
|
|
3026
|
-
const
|
|
3027
|
-
y($,
|
|
3028
|
-
},
|
|
3029
|
-
|
|
3030
|
-
const
|
|
3031
|
-
e.style.left = `${x * 100}%`, e.style.top = `${
|
|
3032
|
-
},
|
|
3033
|
-
|
|
3034
|
-
const
|
|
3035
|
-
document.removeEventListener("mousemove",
|
|
3012
|
+
}, E = () => parseFloat(s.style.left || "0%") / 100 * 360, V = (v, w) => {
|
|
3013
|
+
const x = E(), k = this.hsvToHex(x, v, w);
|
|
3014
|
+
y(k, m);
|
|
3015
|
+
}, A = (v) => {
|
|
3016
|
+
v = Math.max(0.1, Math.min(358.9, v));
|
|
3017
|
+
const w = parseFloat(e.style.left || "50%") / 100, x = parseFloat(e.style.top || "50%") / 100;
|
|
3018
|
+
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`;
|
|
3019
|
+
const k = w, H = 1 - x, $ = this.hsvToHex(v, k, H);
|
|
3020
|
+
y($, m);
|
|
3021
|
+
}, B = (v) => {
|
|
3022
|
+
v.stopPropagation();
|
|
3023
|
+
const w = t.getBoundingClientRect(), x = Math.max(0, Math.min(1, (v.clientX - w.left) / w.width)), k = Math.max(0, Math.min(1, (v.clientY - w.top) / w.height));
|
|
3024
|
+
e.style.left = `${x * 100}%`, e.style.top = `${k * 100}%`, V(x, 1 - k);
|
|
3025
|
+
}, L = (v) => {
|
|
3026
|
+
v.preventDefault(), v.stopPropagation(), B(v);
|
|
3027
|
+
const w = (k) => B(k), x = () => {
|
|
3028
|
+
document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", x);
|
|
3036
3029
|
};
|
|
3037
|
-
document.addEventListener("mousemove",
|
|
3038
|
-
},
|
|
3039
|
-
|
|
3040
|
-
const
|
|
3041
|
-
let x = (
|
|
3030
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", x);
|
|
3031
|
+
}, b = (v) => {
|
|
3032
|
+
v.stopPropagation();
|
|
3033
|
+
const w = i.getBoundingClientRect();
|
|
3034
|
+
let x = (v.clientX - w.left) / w.width;
|
|
3042
3035
|
x = Math.max(1e-3, Math.min(0.998, x)), s.style.left = `${x * 100}%`;
|
|
3043
|
-
const
|
|
3044
|
-
|
|
3045
|
-
},
|
|
3046
|
-
|
|
3047
|
-
const
|
|
3048
|
-
document.removeEventListener("mousemove",
|
|
3036
|
+
const k = x * 360;
|
|
3037
|
+
A(k);
|
|
3038
|
+
}, M = (v) => {
|
|
3039
|
+
v.preventDefault(), v.stopPropagation(), b(v);
|
|
3040
|
+
const w = (k) => b(k), x = () => {
|
|
3041
|
+
document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", x);
|
|
3049
3042
|
};
|
|
3050
|
-
document.addEventListener("mousemove",
|
|
3051
|
-
}, P = (
|
|
3052
|
-
const
|
|
3053
|
-
let
|
|
3054
|
-
if (x === "hex" && /^#[0-9A-Fa-f]{6}$/.test(
|
|
3055
|
-
|
|
3043
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", x);
|
|
3044
|
+
}, P = (v) => {
|
|
3045
|
+
const w = v.target.value, x = n.value;
|
|
3046
|
+
let k = "";
|
|
3047
|
+
if (x === "hex" && /^#[0-9A-Fa-f]{6}$/.test(w))
|
|
3048
|
+
k = w;
|
|
3056
3049
|
else if (x === "rgb") {
|
|
3057
|
-
const H =
|
|
3050
|
+
const H = w.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3058
3051
|
if (H) {
|
|
3059
|
-
const $ = parseInt(H[1]),
|
|
3060
|
-
$ <= 255 &&
|
|
3052
|
+
const $ = parseInt(H[1]), W = parseInt(H[2]), F = parseInt(H[3]);
|
|
3053
|
+
$ <= 255 && W <= 255 && F <= 255 && (k = `#${$.toString(16).padStart(2, "0")}${W.toString(16).padStart(2, "0")}${F.toString(16).padStart(2, "0")}`);
|
|
3061
3054
|
}
|
|
3062
3055
|
} else if (x === "hsl") {
|
|
3063
|
-
const H =
|
|
3056
|
+
const H = w.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3064
3057
|
if (H) {
|
|
3065
|
-
const $ = parseInt(H[1]),
|
|
3066
|
-
if ($ <= 360 &&
|
|
3067
|
-
const
|
|
3068
|
-
|
|
3058
|
+
const $ = parseInt(H[1]), W = parseInt(H[2]) / 100, F = parseInt(H[3]) / 100;
|
|
3059
|
+
if ($ <= 360 && W <= 1 && F <= 1) {
|
|
3060
|
+
const q = F + W * Math.min(F, 1 - F), K = q === 0 ? 0 : 2 * (1 - F / q);
|
|
3061
|
+
k = this.hsvToHex($, K, q);
|
|
3069
3062
|
}
|
|
3070
3063
|
}
|
|
3071
3064
|
}
|
|
3072
|
-
if (
|
|
3073
|
-
const { h: H, s: $, v:
|
|
3074
|
-
s.style.left = `${H / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 -
|
|
3065
|
+
if (k) {
|
|
3066
|
+
const { h: H, s: $, v: W } = this.hexToHsv(k);
|
|
3067
|
+
s.style.left = `${H / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - W) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${H}, 100%, 50%))`, y(k, m);
|
|
3075
3068
|
}
|
|
3076
|
-
}, O = (
|
|
3077
|
-
|
|
3069
|
+
}, O = (v) => {
|
|
3070
|
+
f();
|
|
3078
3071
|
}, T = () => {
|
|
3079
|
-
|
|
3080
|
-
},
|
|
3072
|
+
f();
|
|
3073
|
+
}, S = () => {
|
|
3081
3074
|
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3082
3075
|
o.select(), document.execCommand("copy");
|
|
3083
3076
|
});
|
|
3084
3077
|
};
|
|
3085
|
-
|
|
3086
|
-
const
|
|
3078
|
+
f(), t.addEventListener("mousedown", L), t.addEventListener("click", B), i.addEventListener("mousedown", M), i.addEventListener("click", b), n.addEventListener("change", T), o.addEventListener("input", P), o.addEventListener("blur", O), a.addEventListener("click", S);
|
|
3079
|
+
const D = async () => {
|
|
3087
3080
|
if ("EyeDropper" in window)
|
|
3088
3081
|
try {
|
|
3089
|
-
const x = (await new window.EyeDropper().open()).sRGBHex, { h:
|
|
3090
|
-
s.style.left = `${
|
|
3091
|
-
} catch (
|
|
3092
|
-
console.log("User cancelled eyedropper or error occurred:",
|
|
3082
|
+
const x = (await new window.EyeDropper().open()).sRGBHex, { h: k, s: H, v: $ } = this.hexToHsv(x);
|
|
3083
|
+
s.style.left = `${k / 360 * 100}%`, e.style.left = `${H * 100}%`, e.style.top = `${(1 - $) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${k}, 100%, 50%))`, y(x, m);
|
|
3084
|
+
} catch (v) {
|
|
3085
|
+
console.log("User cancelled eyedropper or error occurred:", v);
|
|
3093
3086
|
}
|
|
3094
3087
|
else
|
|
3095
3088
|
alert(
|
|
3096
3089
|
"EyeDropper API is not supported in this browser. Try using Chrome 95+ or Edge 95+."
|
|
3097
3090
|
);
|
|
3098
3091
|
};
|
|
3099
|
-
l.addEventListener("click",
|
|
3092
|
+
l.addEventListener("click", D);
|
|
3100
3093
|
}
|
|
3101
3094
|
hsvToHex(t, e, i) {
|
|
3102
3095
|
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
@@ -3105,16 +3098,16 @@ class se extends S {
|
|
|
3105
3098
|
}
|
|
3106
3099
|
setupOpacitySlider(t, e, i, s, n) {
|
|
3107
3100
|
const o = () => {
|
|
3108
|
-
const { r: c, g:
|
|
3109
|
-
t.style.setProperty("--color-rgb", `${c}, ${
|
|
3101
|
+
const { r: c, g: d, b: h } = this.hexToRgb(i);
|
|
3102
|
+
t.style.setProperty("--color-rgb", `${c}, ${d}, ${h}`);
|
|
3110
3103
|
}, a = () => {
|
|
3111
3104
|
e.style.left = `${s}%`;
|
|
3112
3105
|
};
|
|
3113
3106
|
o(), a();
|
|
3114
3107
|
let l = !1;
|
|
3115
3108
|
const r = (c) => {
|
|
3116
|
-
const
|
|
3117
|
-
s =
|
|
3109
|
+
const d = t.getBoundingClientRect(), h = c.clientX - d.left, u = Math.max(0, Math.min(100, h / d.width * 100)), g = Math.round(u);
|
|
3110
|
+
s = g, a(), n(i, g);
|
|
3118
3111
|
};
|
|
3119
3112
|
t.addEventListener("mousedown", (c) => {
|
|
3120
3113
|
l = !0, r(c);
|
|
@@ -3153,45 +3146,45 @@ class se extends S {
|
|
|
3153
3146
|
<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3154
3147
|
<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"/>
|
|
3155
3148
|
</svg>
|
|
3156
|
-
`, l.title = "Flip gradient", i.addEventListener("change", (
|
|
3157
|
-
const y =
|
|
3149
|
+
`, l.title = "Flip gradient", i.addEventListener("change", (m) => {
|
|
3150
|
+
const y = m.target.value;
|
|
3158
3151
|
this.switchType(y === "radial" ? "radial" : "linear");
|
|
3159
|
-
}), o.addEventListener("input", (
|
|
3160
|
-
const y =
|
|
3161
|
-
if (this.value && !isNaN(
|
|
3162
|
-
const
|
|
3163
|
-
this.value.angle =
|
|
3152
|
+
}), o.addEventListener("input", (m) => {
|
|
3153
|
+
const y = m.target.value, f = parseInt(y);
|
|
3154
|
+
if (this.value && !isNaN(f)) {
|
|
3155
|
+
const E = Math.max(0, Math.min(360, f));
|
|
3156
|
+
this.value.angle = E, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3164
3157
|
}
|
|
3165
|
-
}), o.addEventListener("focus", (
|
|
3166
|
-
const y =
|
|
3158
|
+
}), o.addEventListener("focus", (m) => {
|
|
3159
|
+
const y = m.target;
|
|
3167
3160
|
y.value = y.value.replace(/[^0-9-]/g, ""), setTimeout(() => y.select(), 0);
|
|
3168
|
-
}), o.addEventListener("blur", (
|
|
3169
|
-
var
|
|
3170
|
-
const y =
|
|
3171
|
-
let
|
|
3172
|
-
isNaN(
|
|
3161
|
+
}), o.addEventListener("blur", (m) => {
|
|
3162
|
+
var E;
|
|
3163
|
+
const y = m.target;
|
|
3164
|
+
let f = parseInt(y.value);
|
|
3165
|
+
isNaN(f) && (f = ((E = this.value) == null ? void 0 : E.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), y.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3173
3166
|
}), l.addEventListener("click", () => {
|
|
3174
|
-
this.value && (this.value.stops = this.value.stops.map((
|
|
3175
|
-
...
|
|
3176
|
-
position: 100 -
|
|
3167
|
+
this.value && (this.value.stops = this.value.stops.map((m) => ({
|
|
3168
|
+
...m,
|
|
3169
|
+
position: 100 - m.position
|
|
3177
3170
|
})), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3178
3171
|
}), e.appendChild(i), e.appendChild(o), e.appendChild(l), t.appendChild(e), (() => {
|
|
3179
|
-
var
|
|
3180
|
-
((
|
|
3172
|
+
var m;
|
|
3173
|
+
((m = this.value) == null ? void 0 : m.type) === "radial" ? (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "1");
|
|
3181
3174
|
})();
|
|
3182
3175
|
const c = document.createElement("div");
|
|
3183
3176
|
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3184
|
-
const h = document.createElement("div");
|
|
3185
|
-
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3186
3177
|
const d = document.createElement("div");
|
|
3187
|
-
d.className = "gradient-
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
const u = document.createElement("
|
|
3191
|
-
u.
|
|
3192
|
-
const g = document.createElement("
|
|
3193
|
-
g.className = "gradient-
|
|
3194
|
-
|
|
3178
|
+
d.className = "gradient-handles", this.createGradientHandles(d, c), c.appendChild(d), t.appendChild(c);
|
|
3179
|
+
const h = document.createElement("div");
|
|
3180
|
+
h.className = "gradient-stops-header";
|
|
3181
|
+
const u = document.createElement("span");
|
|
3182
|
+
u.textContent = "Stops";
|
|
3183
|
+
const g = document.createElement("button");
|
|
3184
|
+
g.type = "button", g.className = "gradient-add-stop", g.textContent = "+", h.appendChild(u), h.appendChild(g);
|
|
3185
|
+
const C = document.createElement("div");
|
|
3186
|
+
C.className = "gradient-stops", t.appendChild(h), t.appendChild(C), this.updateStopsList(C), g.addEventListener("click", () => {
|
|
3187
|
+
this.addGradientStop(), this.updateStopsList(C), this.updateGradientPreview(c), this.createGradientHandles(d, c), this.updateUI();
|
|
3195
3188
|
});
|
|
3196
3189
|
}
|
|
3197
3190
|
updateGradientPreview(t) {
|
|
@@ -3209,21 +3202,21 @@ class se extends S {
|
|
|
3209
3202
|
}
|
|
3210
3203
|
makeDraggable(t, e, i) {
|
|
3211
3204
|
let s = !1, n = 0, o = 0, a = null;
|
|
3212
|
-
const l = (
|
|
3213
|
-
var
|
|
3214
|
-
s = !0, n = l(
|
|
3205
|
+
const l = (h) => "touches" in h && h.touches.length > 0 ? h.touches[0].clientX : h.clientX, r = (h) => {
|
|
3206
|
+
var u, g, C;
|
|
3207
|
+
s = !0, n = l(h), o = ((C = (g = (u = this.value) == null ? void 0 : u.stops) == null ? void 0 : g[i]) == null ? void 0 : C.position) || 0, t.classList.add("selected"), document.addEventListener("pointermove", c, { passive: !1 }), document.addEventListener("pointerup", d), document.addEventListener("mousemove", c, { passive: !1 }), document.addEventListener("mouseup", d), document.addEventListener("touchmove", c, {
|
|
3215
3208
|
passive: !1
|
|
3216
|
-
}), document.addEventListener("touchend",
|
|
3217
|
-
}, c = (
|
|
3218
|
-
var y,
|
|
3219
|
-
if (!s || !((
|
|
3220
|
-
const
|
|
3221
|
-
let
|
|
3222
|
-
|
|
3209
|
+
}), document.addEventListener("touchend", d), h.preventDefault();
|
|
3210
|
+
}, c = (h) => {
|
|
3211
|
+
var y, f;
|
|
3212
|
+
if (!s || !((f = (y = this.value) == null ? void 0 : y.stops) != null && f[i])) return;
|
|
3213
|
+
const u = e.getBoundingClientRect(), C = (l(h) - n) / u.width * 100;
|
|
3214
|
+
let m = o + C;
|
|
3215
|
+
m = Math.max(0, Math.min(100, m)), this.value.stops[i].position = Math.round(m), t.style.left = `${m}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
3223
3216
|
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3224
|
-
}),
|
|
3225
|
-
},
|
|
3226
|
-
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",
|
|
3217
|
+
}), h.preventDefault();
|
|
3218
|
+
}, d = () => {
|
|
3219
|
+
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", d), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", d), document.removeEventListener("touchmove", c), document.removeEventListener("touchend", d));
|
|
3227
3220
|
};
|
|
3228
3221
|
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3229
3222
|
passive: !1
|
|
@@ -3233,7 +3226,7 @@ class se extends S {
|
|
|
3233
3226
|
var i;
|
|
3234
3227
|
const e = t || ((i = this.popoverElement) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3235
3228
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3236
|
-
var
|
|
3229
|
+
var A, B;
|
|
3237
3230
|
const o = document.createElement("div");
|
|
3238
3231
|
o.className = "gstop-row";
|
|
3239
3232
|
const a = document.createElement("div");
|
|
@@ -3244,133 +3237,133 @@ class se extends S {
|
|
|
3244
3237
|
r.className = "gstop-color-container";
|
|
3245
3238
|
const c = document.createElement("div");
|
|
3246
3239
|
c.className = "gstop-color-preview", c.style.backgroundColor = s.color;
|
|
3247
|
-
const
|
|
3248
|
-
|
|
3249
|
-
const
|
|
3250
|
-
|
|
3240
|
+
const d = document.createElement("input");
|
|
3241
|
+
d.type = "text", d.className = "gstop-color-input", d.value = s.color.replace("#", "").toUpperCase();
|
|
3242
|
+
const h = document.createElement("button");
|
|
3243
|
+
h.type = "button", h.className = "gstop-color-copy", h.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3251
3244
|
<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"/>
|
|
3252
|
-
</svg>`, r.appendChild(c), r.appendChild(
|
|
3253
|
-
const
|
|
3254
|
-
|
|
3245
|
+
</svg>`, r.appendChild(c), r.appendChild(d), r.appendChild(h);
|
|
3246
|
+
const u = document.createElement("button");
|
|
3247
|
+
u.type = "button", u.className = "gstop-del", u.innerHTML = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3255
3248
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3256
|
-
</svg>`,
|
|
3249
|
+
</svg>`, u.disabled = (((B = (A = this.value) == null ? void 0 : A.stops) == null ? void 0 : B.length) || 0) <= 2, l.addEventListener("input", (L) => {
|
|
3257
3250
|
var O;
|
|
3258
|
-
const
|
|
3251
|
+
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3259
3252
|
if (this.value && !isNaN(P)) {
|
|
3260
3253
|
const T = Math.max(0, Math.min(100, P));
|
|
3261
|
-
this.value.stops[n].position = T,
|
|
3262
|
-
const
|
|
3254
|
+
this.value.stops[n].position = T, b.value = `${T}%`;
|
|
3255
|
+
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3263
3256
|
".gradient-preview"
|
|
3264
|
-
),
|
|
3257
|
+
), D = S == null ? void 0 : S.querySelector(
|
|
3265
3258
|
".gradient-handles"
|
|
3266
3259
|
);
|
|
3267
|
-
|
|
3260
|
+
S && D && this.createGradientHandles(D, S), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3268
3261
|
}
|
|
3269
|
-
}), l.addEventListener("focus", (
|
|
3270
|
-
const
|
|
3271
|
-
|
|
3272
|
-
}), l.addEventListener("blur", (
|
|
3262
|
+
}), l.addEventListener("focus", (L) => {
|
|
3263
|
+
const b = L.target, M = b.value.replace("%", "");
|
|
3264
|
+
b.value = M, b.select();
|
|
3265
|
+
}), l.addEventListener("blur", (L) => {
|
|
3273
3266
|
var O, T;
|
|
3274
|
-
const
|
|
3267
|
+
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3275
3268
|
if (isNaN(P))
|
|
3276
|
-
|
|
3269
|
+
b.value = `${((T = (O = this.value) == null ? void 0 : O.stops[n]) == null ? void 0 : T.position) || 0}%`;
|
|
3277
3270
|
else {
|
|
3278
|
-
const
|
|
3279
|
-
|
|
3271
|
+
const S = Math.max(0, Math.min(100, P));
|
|
3272
|
+
b.value = `${S}%`, this.value && (this.value.stops[n].position = S, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3280
3273
|
}
|
|
3281
3274
|
});
|
|
3282
|
-
const
|
|
3283
|
-
(
|
|
3284
|
-
var
|
|
3285
|
-
if (
|
|
3286
|
-
this.value.stops[n].color =
|
|
3287
|
-
const T = (
|
|
3275
|
+
const g = new Pt(
|
|
3276
|
+
(L, b) => {
|
|
3277
|
+
var M, P, O;
|
|
3278
|
+
if (d.value = L.replace("#", "").toUpperCase(), c.style.backgroundColor = L, this.value) {
|
|
3279
|
+
this.value.stops[n].color = L, b !== void 0 && (this.value.stops[n].opacity = b);
|
|
3280
|
+
const T = (M = o.parentElement) == null ? void 0 : M.querySelector(
|
|
3288
3281
|
".gstop-opacity-slider"
|
|
3289
3282
|
);
|
|
3290
3283
|
if (T) {
|
|
3291
|
-
const
|
|
3284
|
+
const v = this.hexToRgb(L);
|
|
3292
3285
|
T.style.setProperty(
|
|
3293
3286
|
"--slider-color",
|
|
3294
|
-
`rgb(${
|
|
3287
|
+
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3295
3288
|
);
|
|
3296
3289
|
}
|
|
3297
|
-
if (
|
|
3298
|
-
const
|
|
3290
|
+
if (b !== void 0) {
|
|
3291
|
+
const v = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3299
3292
|
".gstop-opacity-value"
|
|
3300
3293
|
);
|
|
3301
|
-
|
|
3294
|
+
v && (v.textContent = `${b}%`), T && (T.value = b.toString());
|
|
3302
3295
|
}
|
|
3303
|
-
const
|
|
3296
|
+
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3304
3297
|
".gradient-preview"
|
|
3305
|
-
),
|
|
3298
|
+
), D = S == null ? void 0 : S.querySelector(
|
|
3306
3299
|
".gradient-handles"
|
|
3307
3300
|
);
|
|
3308
|
-
|
|
3301
|
+
S && D && this.createGradientHandles(D, S), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3309
3302
|
}
|
|
3310
3303
|
}
|
|
3311
3304
|
);
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
}),
|
|
3305
|
+
d.addEventListener("click", (L) => {
|
|
3306
|
+
L.stopPropagation(), g.open(s.color, d, s.opacity || 100);
|
|
3307
|
+
}), d.addEventListener("input", (L) => {
|
|
3315
3308
|
var P, O;
|
|
3316
|
-
const
|
|
3317
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3318
|
-
this.value.stops[n].color =
|
|
3309
|
+
const b = L.target.value.trim(), M = b.startsWith("#") ? b : `#${b}`;
|
|
3310
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(M) && (c.style.backgroundColor = M, this.value)) {
|
|
3311
|
+
this.value.stops[n].color = M;
|
|
3319
3312
|
const T = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3320
3313
|
".gstop-opacity-slider"
|
|
3321
3314
|
);
|
|
3322
3315
|
if (T) {
|
|
3323
|
-
const
|
|
3316
|
+
const v = this.hexToRgb(M);
|
|
3324
3317
|
T.style.setProperty(
|
|
3325
3318
|
"--slider-color",
|
|
3326
|
-
`rgb(${
|
|
3319
|
+
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3327
3320
|
);
|
|
3328
3321
|
}
|
|
3329
|
-
const
|
|
3322
|
+
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3330
3323
|
".gradient-preview"
|
|
3331
|
-
),
|
|
3324
|
+
), D = S == null ? void 0 : S.querySelector(
|
|
3332
3325
|
".gradient-handles"
|
|
3333
3326
|
);
|
|
3334
|
-
|
|
3327
|
+
S && D && this.createGradientHandles(D, S), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3335
3328
|
}
|
|
3336
|
-
}),
|
|
3337
|
-
|
|
3338
|
-
const
|
|
3329
|
+
}), h.addEventListener("click", async (L) => {
|
|
3330
|
+
L.stopPropagation();
|
|
3331
|
+
const b = `#${d.value}`;
|
|
3339
3332
|
try {
|
|
3340
|
-
await navigator.clipboard.writeText(
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3333
|
+
await navigator.clipboard.writeText(b);
|
|
3334
|
+
const M = h.innerHTML;
|
|
3335
|
+
h.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3343
3336
|
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3344
3337
|
</svg>`, setTimeout(() => {
|
|
3345
|
-
|
|
3338
|
+
h.innerHTML = M;
|
|
3346
3339
|
}, 1e3);
|
|
3347
|
-
} catch (
|
|
3348
|
-
console.warn("Failed to copy color to clipboard:",
|
|
3340
|
+
} catch (M) {
|
|
3341
|
+
console.warn("Failed to copy color to clipboard:", M);
|
|
3349
3342
|
}
|
|
3350
|
-
}),
|
|
3351
|
-
var
|
|
3343
|
+
}), u.addEventListener("click", () => {
|
|
3344
|
+
var L;
|
|
3352
3345
|
if (this.value && this.value.stops.length > 2) {
|
|
3353
3346
|
this.value.stops.splice(n, 1);
|
|
3354
|
-
const
|
|
3347
|
+
const b = (L = this.popoverElement) == null ? void 0 : L.querySelector(
|
|
3355
3348
|
".gradient-preview"
|
|
3356
|
-
),
|
|
3349
|
+
), M = b == null ? void 0 : b.querySelector(
|
|
3357
3350
|
".gradient-handles"
|
|
3358
3351
|
);
|
|
3359
|
-
|
|
3352
|
+
b && M && this.createGradientHandles(M, b), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3360
3353
|
}
|
|
3361
|
-
}), o.appendChild(a), o.appendChild(r), o.appendChild(
|
|
3362
|
-
const
|
|
3363
|
-
|
|
3364
|
-
const
|
|
3365
|
-
|
|
3354
|
+
}), o.appendChild(a), o.appendChild(r), o.appendChild(u), e.appendChild(o);
|
|
3355
|
+
const C = document.createElement("div");
|
|
3356
|
+
C.className = "gstop-opacity-row";
|
|
3357
|
+
const m = document.createElement("span");
|
|
3358
|
+
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3366
3359
|
const y = document.createElement("div");
|
|
3367
3360
|
y.className = "gstop-opacity-group";
|
|
3368
|
-
const
|
|
3369
|
-
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3361
|
+
const f = document.createElement("input");
|
|
3362
|
+
f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = (s.opacity !== void 0 ? s.opacity : 100).toString();
|
|
3363
|
+
const E = this.hexToRgb(s.color);
|
|
3364
|
+
f.style.setProperty(
|
|
3372
3365
|
"--slider-color",
|
|
3373
|
-
`rgb(${
|
|
3366
|
+
`rgb(${E.r}, ${E.g}, ${E.b})`
|
|
3374
3367
|
);
|
|
3375
3368
|
const V = document.createElement("span");
|
|
3376
3369
|
V.className = "gstop-opacity-value", V.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
@@ -3485,8 +3478,8 @@ class se extends S {
|
|
|
3485
3478
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3486
3479
|
);
|
|
3487
3480
|
if (s) {
|
|
3488
|
-
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:
|
|
3489
|
-
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${
|
|
3481
|
+
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: d } = this.hslToRgb(n, o, a);
|
|
3482
|
+
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${d.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3490
3483
|
}
|
|
3491
3484
|
return { color: e, position: 0, opacity: 100 };
|
|
3492
3485
|
}
|
|
@@ -3598,8 +3591,8 @@ class se extends S {
|
|
|
3598
3591
|
let o = "", a = 0;
|
|
3599
3592
|
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3600
3593
|
if (l) {
|
|
3601
|
-
const c = l[1].trim(),
|
|
3602
|
-
this.isValidColorFormat(c) ? (o = c, a =
|
|
3594
|
+
const c = l[1].trim(), d = parseFloat(l[2]);
|
|
3595
|
+
this.isValidColorFormat(c) ? (o = c, a = d) : (o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100);
|
|
3603
3596
|
} else
|
|
3604
3597
|
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3605
3598
|
const r = this.parseColorWithOpacity(o);
|
|
@@ -3625,16 +3618,24 @@ class se extends S {
|
|
|
3625
3618
|
return this.element;
|
|
3626
3619
|
}
|
|
3627
3620
|
getValue() {
|
|
3628
|
-
return this.value ? this.
|
|
3629
|
-
|
|
3621
|
+
return this.value ? this.generateCSS(this.getSafeValue()) : "";
|
|
3622
|
+
}
|
|
3623
|
+
getCSSValue() {
|
|
3624
|
+
return this.value ? this.generateCSS(this.getSafeValue()) : "";
|
|
3625
|
+
}
|
|
3626
|
+
// Method to get CSS properties object for text gradients
|
|
3627
|
+
getTextCSSProperties() {
|
|
3628
|
+
if (!this.value) return {};
|
|
3629
|
+
const t = this.generateCSS(this.getSafeValue());
|
|
3630
|
+
return t.includes("gradient") ? {
|
|
3631
|
+
background: t,
|
|
3630
3632
|
"-webkit-background-clip": "text",
|
|
3631
3633
|
"background-clip": "text",
|
|
3632
3634
|
color: "transparent",
|
|
3633
3635
|
"-webkit-text-fill-color": "transparent"
|
|
3634
|
-
} :
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
return this.value ? this.generateCSS(this.getSafeValue()) : "";
|
|
3636
|
+
} : {
|
|
3637
|
+
color: t
|
|
3638
|
+
};
|
|
3638
3639
|
}
|
|
3639
3640
|
// Add method to get the raw object value if needed
|
|
3640
3641
|
getRawValue() {
|
|
@@ -3650,22 +3651,22 @@ const Ot = `
|
|
|
3650
3651
|
<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"/>
|
|
3651
3652
|
</svg>
|
|
3652
3653
|
`;
|
|
3653
|
-
class ne extends
|
|
3654
|
+
class ne extends z {
|
|
3654
3655
|
constructor(t) {
|
|
3655
3656
|
super({
|
|
3656
3657
|
title: "Border",
|
|
3657
3658
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3658
3659
|
settings: {
|
|
3659
|
-
size: new
|
|
3660
|
+
size: new G({
|
|
3660
3661
|
title: "Size",
|
|
3661
3662
|
icon: $t,
|
|
3662
3663
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3663
3664
|
suffix: "px"
|
|
3664
3665
|
}),
|
|
3665
|
-
color: new
|
|
3666
|
+
color: new U({
|
|
3666
3667
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3667
3668
|
}),
|
|
3668
|
-
radius: new
|
|
3669
|
+
radius: new G({
|
|
3669
3670
|
title: "Radius",
|
|
3670
3671
|
icon: Ot,
|
|
3671
3672
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
@@ -3694,12 +3695,12 @@ const At = `
|
|
|
3694
3695
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3695
3696
|
<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"/>
|
|
3696
3697
|
</svg>
|
|
3697
|
-
`,
|
|
3698
|
+
`, Dt = `
|
|
3698
3699
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3699
3700
|
<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"/>
|
|
3700
3701
|
</svg>
|
|
3701
3702
|
`;
|
|
3702
|
-
class oe extends
|
|
3703
|
+
class oe extends z {
|
|
3703
3704
|
constructor(t = {}) {
|
|
3704
3705
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3705
3706
|
super({
|
|
@@ -3707,7 +3708,7 @@ class oe extends G {
|
|
|
3707
3708
|
collapsed: i.collapsed,
|
|
3708
3709
|
settings: (() => {
|
|
3709
3710
|
const s = {
|
|
3710
|
-
color: new
|
|
3711
|
+
color: new U({
|
|
3711
3712
|
default: i.colorDefault ?? "0, 0, 30"
|
|
3712
3713
|
}),
|
|
3713
3714
|
fontFamily: new et({
|
|
@@ -3735,9 +3736,9 @@ class oe extends G {
|
|
|
3735
3736
|
getOptions: i.fontWeightGetOptions,
|
|
3736
3737
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3737
3738
|
}),
|
|
3738
|
-
fontSize: new
|
|
3739
|
+
fontSize: new G({
|
|
3739
3740
|
title: "Size",
|
|
3740
|
-
icon:
|
|
3741
|
+
icon: Dt,
|
|
3741
3742
|
default: i.fontSizeDefault ?? 12,
|
|
3742
3743
|
suffix: "px",
|
|
3743
3744
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3765,7 +3766,7 @@ class oe extends G {
|
|
|
3765
3766
|
`;
|
|
3766
3767
|
}
|
|
3767
3768
|
}
|
|
3768
|
-
class
|
|
3769
|
+
class Z extends I {
|
|
3769
3770
|
constructor(t) {
|
|
3770
3771
|
super({
|
|
3771
3772
|
...t,
|
|
@@ -3811,31 +3812,31 @@ class J extends S {
|
|
|
3811
3812
|
}), i;
|
|
3812
3813
|
}
|
|
3813
3814
|
}
|
|
3814
|
-
class ae extends
|
|
3815
|
+
class ae extends z {
|
|
3815
3816
|
constructor(t) {
|
|
3816
3817
|
super({
|
|
3817
3818
|
title: "Margins",
|
|
3818
3819
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3819
3820
|
settings: {
|
|
3820
|
-
marginTop: new
|
|
3821
|
+
marginTop: new Z({
|
|
3821
3822
|
title: "Top",
|
|
3822
|
-
icon:
|
|
3823
|
+
icon: Ft,
|
|
3823
3824
|
suffix: "px",
|
|
3824
3825
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3825
3826
|
}),
|
|
3826
|
-
marginRight: new
|
|
3827
|
+
marginRight: new Z({
|
|
3827
3828
|
title: "Right",
|
|
3828
3829
|
icon: Rt,
|
|
3829
3830
|
suffix: "px",
|
|
3830
3831
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3831
3832
|
}),
|
|
3832
|
-
marginBottom: new
|
|
3833
|
+
marginBottom: new Z({
|
|
3833
3834
|
title: "Bottom",
|
|
3834
3835
|
icon: Gt,
|
|
3835
3836
|
suffix: "px",
|
|
3836
3837
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3837
3838
|
}),
|
|
3838
|
-
marginLeft: new
|
|
3839
|
+
marginLeft: new Z({
|
|
3839
3840
|
title: "Left",
|
|
3840
3841
|
icon: Wt,
|
|
3841
3842
|
suffix: "px",
|
|
@@ -3854,7 +3855,7 @@ class ae extends G {
|
|
|
3854
3855
|
`;
|
|
3855
3856
|
}
|
|
3856
3857
|
}
|
|
3857
|
-
const
|
|
3858
|
+
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3858
3859
|
<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"/>
|
|
3859
3860
|
</svg>`, Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3860
3861
|
<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"/>
|
|
@@ -3863,7 +3864,7 @@ const Dt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
3863
3864
|
</svg>`, Wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3864
3865
|
<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"/>
|
|
3865
3866
|
</svg>`;
|
|
3866
|
-
class le extends
|
|
3867
|
+
class le extends z {
|
|
3867
3868
|
constructor(t) {
|
|
3868
3869
|
super({
|
|
3869
3870
|
title: "Background Image",
|
|
@@ -3876,7 +3877,7 @@ class le extends G {
|
|
|
3876
3877
|
opacity: new yt({
|
|
3877
3878
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3878
3879
|
}),
|
|
3879
|
-
backgroundColor: new
|
|
3880
|
+
backgroundColor: new U({
|
|
3880
3881
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3881
3882
|
})
|
|
3882
3883
|
}
|
|
@@ -3908,8 +3909,8 @@ export {
|
|
|
3908
3909
|
le as BackgroundSettingSet,
|
|
3909
3910
|
ne as BorderSettingSet,
|
|
3910
3911
|
_t as ButtonSetting,
|
|
3911
|
-
|
|
3912
|
-
|
|
3912
|
+
R as ColorSetting,
|
|
3913
|
+
U as ColorWithOpacitySetting,
|
|
3913
3914
|
qt as DimensionSetting,
|
|
3914
3915
|
Kt as GapSetting,
|
|
3915
3916
|
se as GradientSetting,
|
|
@@ -3920,12 +3921,12 @@ export {
|
|
|
3920
3921
|
ae as MarginSettingGroup,
|
|
3921
3922
|
te as MarginTopSetting,
|
|
3922
3923
|
ee as MultiLanguageSetting,
|
|
3923
|
-
|
|
3924
|
+
G as NumberSetting,
|
|
3924
3925
|
yt as OpacitySetting,
|
|
3925
3926
|
Xt as SelectApiSettings,
|
|
3926
3927
|
et as SelectSetting,
|
|
3927
|
-
|
|
3928
|
-
|
|
3928
|
+
I as Setting,
|
|
3929
|
+
z as SettingGroup,
|
|
3929
3930
|
mt as StringSetting,
|
|
3930
3931
|
ut as TabSettingGroup,
|
|
3931
3932
|
ut as TabsSettingGroup,
|
|
@@ -3938,5 +3939,5 @@ export {
|
|
|
3938
3939
|
j as isSetting,
|
|
3939
3940
|
st as isSettingChild,
|
|
3940
3941
|
N as isSettingGroup,
|
|
3941
|
-
|
|
3942
|
+
J as iterateSettings
|
|
3942
3943
|
};
|