builder-settings-types 0.0.265 → 0.0.267
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.
|
@@ -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 Z(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
|
+
Z(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const ht = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class dt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...ht, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -111,15 +111,15 @@ class ht {
|
|
|
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 dt();
|
|
115
|
+
function X(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) => X(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] = X(p[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return p;
|
|
@@ -171,8 +171,8 @@ class I {
|
|
|
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 = X(this.props), i = new t(e);
|
|
175
|
+
return i.value = X(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -242,21 +242,21 @@ function N(p) {
|
|
|
242
242
|
function st(p) {
|
|
243
243
|
return j(p) || N(p);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function q(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 Y = class Y {
|
|
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 || "", this.
|
|
255
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, 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.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
259
|
+
q(this.settings, (e, i) => {
|
|
260
260
|
N(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
@@ -273,13 +273,13 @@ const _ = class _ {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
q(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
278
|
(N(e) || j(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (Z(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -323,21 +323,12 @@ const _ = class _ {
|
|
|
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
|
-
}
|
|
332
326
|
updateVisibility() {
|
|
333
|
-
this.elementRef
|
|
327
|
+
this.elementRef;
|
|
334
328
|
}
|
|
335
|
-
// public updateVisibility(): void {
|
|
336
|
-
// if (!this.elementRef) return;
|
|
337
|
-
// }
|
|
338
329
|
clone() {
|
|
339
330
|
const t = {};
|
|
340
|
-
|
|
331
|
+
q(this.settings, (s, n) => {
|
|
341
332
|
const o = String(s);
|
|
342
333
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
343
334
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -352,8 +343,7 @@ const _ = class _ {
|
|
|
352
343
|
includeGetJson: this.includeGetJson,
|
|
353
344
|
addItem: this.addItemCfg,
|
|
354
345
|
deleteItem: this.deleteItemCfg,
|
|
355
|
-
dataProps: this.dataProps
|
|
356
|
-
hidden: this.isHidden
|
|
346
|
+
dataProps: this.dataProps
|
|
357
347
|
}, i = gt(e);
|
|
358
348
|
return i.initialValues = this.getValues(), i;
|
|
359
349
|
}
|
|
@@ -400,7 +390,7 @@ const _ = class _ {
|
|
|
400
390
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
401
391
|
}, 50));
|
|
402
392
|
};
|
|
403
|
-
return this.changeHandlers.clear(),
|
|
393
|
+
return this.changeHandlers.clear(), q(this.settings, (i, s) => {
|
|
404
394
|
var n;
|
|
405
395
|
if (N(s))
|
|
406
396
|
s.setOnChange(() => {
|
|
@@ -459,11 +449,11 @@ const _ = class _ {
|
|
|
459
449
|
N(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
460
450
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
461
451
|
if (l) {
|
|
462
|
-
const
|
|
463
|
-
|
|
452
|
+
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
453
|
+
h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
|
|
464
454
|
}
|
|
465
455
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
466
|
-
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a),
|
|
456
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), Z(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
467
457
|
const c = a.style.display;
|
|
468
458
|
a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
|
|
469
459
|
}
|
|
@@ -612,11 +602,11 @@ const _ = class _ {
|
|
|
612
602
|
r(), t(!1);
|
|
613
603
|
}), l.addEventListener("click", () => {
|
|
614
604
|
r(), t(!0);
|
|
615
|
-
}), e.addEventListener("click", (
|
|
616
|
-
|
|
605
|
+
}), e.addEventListener("click", (h) => {
|
|
606
|
+
h.target === e && (r(), t(!1));
|
|
617
607
|
});
|
|
618
|
-
const c = (
|
|
619
|
-
|
|
608
|
+
const c = (h) => {
|
|
609
|
+
h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
620
610
|
};
|
|
621
611
|
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(() => {
|
|
622
612
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -677,7 +667,7 @@ const _ = class _ {
|
|
|
677
667
|
n.includeGetJson !== !1 && (e[i] = n.value);
|
|
678
668
|
}
|
|
679
669
|
}
|
|
680
|
-
return e;
|
|
670
|
+
return this.hide && (e.hide = !0), e;
|
|
681
671
|
} else {
|
|
682
672
|
const e = this.settings[t];
|
|
683
673
|
if (!e) return;
|
|
@@ -713,7 +703,7 @@ const _ = class _ {
|
|
|
713
703
|
}
|
|
714
704
|
draw() {
|
|
715
705
|
const t = document.createElement("div");
|
|
716
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
706
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), Z(t, this.nestingLevel);
|
|
717
707
|
const e = document.createElement("div");
|
|
718
708
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
719
709
|
"aria-expanded",
|
|
@@ -744,14 +734,14 @@ const _ = class _ {
|
|
|
744
734
|
}, Object.keys(this.settings).length > 0) {
|
|
745
735
|
for (const c in this.settings)
|
|
746
736
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
747
|
-
const
|
|
748
|
-
N(
|
|
749
|
-
const
|
|
750
|
-
N(
|
|
751
|
-
|
|
737
|
+
const h = this.settings[c];
|
|
738
|
+
N(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
739
|
+
const d = h.draw();
|
|
740
|
+
N(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
741
|
+
d,
|
|
752
742
|
c,
|
|
753
|
-
|
|
754
|
-
), a.appendChild(
|
|
743
|
+
h
|
|
744
|
+
), a.appendChild(d);
|
|
755
745
|
}
|
|
756
746
|
} else {
|
|
757
747
|
const c = document.createElement("div");
|
|
@@ -760,14 +750,14 @@ const _ = class _ {
|
|
|
760
750
|
if (this.addItemCfg) {
|
|
761
751
|
const c = document.createElement("button");
|
|
762
752
|
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
763
|
-
const
|
|
753
|
+
const h = `
|
|
764
754
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
765
755
|
xmlns="http://www.w3.org/2000/svg">
|
|
766
756
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
767
757
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
768
758
|
</svg>`;
|
|
769
|
-
c.innerHTML = `${
|
|
770
|
-
|
|
759
|
+
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
|
|
760
|
+
d.stopPropagation(), d.preventDefault();
|
|
771
761
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
772
762
|
if (st(g)) {
|
|
773
763
|
const C = `${this.addItemCfg.keyPrefix}${u}`;
|
|
@@ -817,8 +807,8 @@ const _ = class _ {
|
|
|
817
807
|
}
|
|
818
808
|
}
|
|
819
809
|
};
|
|
820
|
-
|
|
821
|
-
let z =
|
|
810
|
+
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
811
|
+
let z = Y;
|
|
822
812
|
function zt(p) {
|
|
823
813
|
return new ut(p);
|
|
824
814
|
}
|
|
@@ -862,9 +852,9 @@ class ut extends z {
|
|
|
862
852
|
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);
|
|
863
853
|
const c = document.createElement("div");
|
|
864
854
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
855
|
+
const h = this.settings[a];
|
|
856
|
+
h && (N(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
857
|
+
h.draw()
|
|
868
858
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
869
859
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
870
860
|
const a = Object.keys(this.settings)[0];
|
|
@@ -920,8 +910,8 @@ class R extends mt {
|
|
|
920
910
|
if (e.length !== 3 || e.some(isNaN))
|
|
921
911
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
922
912
|
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) => {
|
|
923
|
-
const
|
|
924
|
-
return
|
|
913
|
+
const h = c.toString(16);
|
|
914
|
+
return h.length === 1 ? "0" + h : h;
|
|
925
915
|
};
|
|
926
916
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
927
917
|
}
|
|
@@ -961,8 +951,8 @@ class R extends mt {
|
|
|
961
951
|
const r = l.value.trim();
|
|
962
952
|
if (!r)
|
|
963
953
|
return e.classList.remove("error"), !0;
|
|
964
|
-
const
|
|
965
|
-
return
|
|
954
|
+
const h = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
955
|
+
return h ? e.classList.remove("error") : e.classList.add("error"), h;
|
|
966
956
|
}, s = document.createElement("input");
|
|
967
957
|
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;
|
|
968
958
|
const n = document.createElement("div");
|
|
@@ -971,20 +961,20 @@ class R extends mt {
|
|
|
971
961
|
n.style.backgroundColor = o;
|
|
972
962
|
const a = document.createElement("input");
|
|
973
963
|
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) => {
|
|
974
|
-
var c,
|
|
964
|
+
var c, h;
|
|
975
965
|
let r = l.target.value.trim();
|
|
976
966
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
977
|
-
const
|
|
978
|
-
this.value =
|
|
967
|
+
const d = R.normalizeColorValue(r);
|
|
968
|
+
this.value = d, (c = this.onChange) == null || c.call(this, d), (h = this.detectChange) == null || h.call(this, d), this.colorInputEl && (this.colorInputEl.value = d), n.style.backgroundColor = d;
|
|
979
969
|
}
|
|
980
970
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
981
|
-
var
|
|
971
|
+
var h, d;
|
|
982
972
|
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
983
|
-
this.value = c, (
|
|
973
|
+
this.value = c, (h = this.onChange) == null || h.call(this, c), (d = this.detectChange) == null || d.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c, e.classList.remove("error");
|
|
984
974
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
985
|
-
var
|
|
975
|
+
var h, d;
|
|
986
976
|
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
987
|
-
this.value = c, (
|
|
977
|
+
this.value = c, (h = this.onChange) == null || h.call(this, c), (d = this.detectChange) == null || d.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c;
|
|
988
978
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
989
979
|
}
|
|
990
980
|
getElement() {
|
|
@@ -1870,7 +1860,7 @@ class Xt extends I {
|
|
|
1870
1860
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1871
1861
|
}
|
|
1872
1862
|
selectApiOption(t, e, i) {
|
|
1873
|
-
var l, r, c,
|
|
1863
|
+
var l, r, c, h;
|
|
1874
1864
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1875
1865
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1876
1866
|
const o = this._options[e].value;
|
|
@@ -1879,10 +1869,10 @@ class Xt extends I {
|
|
|
1879
1869
|
if (a)
|
|
1880
1870
|
a.textContent = this._options[e].name;
|
|
1881
1871
|
else {
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1872
|
+
const d = i.firstChild;
|
|
1873
|
+
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1884
1874
|
}
|
|
1885
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (c = this.svgContainer) == null || c.classList.remove("open"), (
|
|
1875
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (c = this.svgContainer) == null || c.classList.remove("open"), (h = this.onChange) == null || h.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1886
1876
|
}
|
|
1887
1877
|
updateOptionsList() {
|
|
1888
1878
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1939,7 +1929,7 @@ class Yt extends I {
|
|
|
1939
1929
|
const s = document.createElement("input");
|
|
1940
1930
|
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", () => {
|
|
1941
1931
|
var r, c;
|
|
1942
|
-
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((
|
|
1932
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
1943
1933
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1944
1934
|
});
|
|
1945
1935
|
const n = document.createElement("span");
|
|
@@ -2022,7 +2012,7 @@ class Kt extends I {
|
|
|
2022
2012
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2023
2013
|
}
|
|
2024
2014
|
}
|
|
2025
|
-
const
|
|
2015
|
+
const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2026
2016
|
<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"/>
|
|
2027
2017
|
</svg>`;
|
|
2028
2018
|
class Qt extends G {
|
|
@@ -2031,14 +2021,14 @@ class Qt extends G {
|
|
|
2031
2021
|
...t,
|
|
2032
2022
|
minValue: t.minValue ?? 0,
|
|
2033
2023
|
maxValue: t.maxValue ?? 1e3,
|
|
2034
|
-
icon: t.icon ||
|
|
2024
|
+
icon: t.icon || Tt,
|
|
2035
2025
|
title: t.title || "Margin Bottom",
|
|
2036
2026
|
default: t.default ?? 20,
|
|
2037
2027
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2038
2028
|
}), this.inputType = "number";
|
|
2039
2029
|
}
|
|
2040
2030
|
}
|
|
2041
|
-
const
|
|
2031
|
+
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2042
2032
|
<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"
|
|
2043
2033
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2044
2034
|
</svg>`;
|
|
@@ -2048,7 +2038,7 @@ class te extends G {
|
|
|
2048
2038
|
...t,
|
|
2049
2039
|
minValue: t.minValue ?? 0,
|
|
2050
2040
|
maxValue: t.maxValue ?? 1e3,
|
|
2051
|
-
icon: t.icon ||
|
|
2041
|
+
icon: t.icon || Ht,
|
|
2052
2042
|
title: t.title || "Margin Top",
|
|
2053
2043
|
default: t.default ?? 20,
|
|
2054
2044
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
@@ -2088,10 +2078,10 @@ class ee extends I {
|
|
|
2088
2078
|
return;
|
|
2089
2079
|
}
|
|
2090
2080
|
const c = "...";
|
|
2091
|
-
let
|
|
2092
|
-
for (;
|
|
2093
|
-
const C = Math.floor((
|
|
2094
|
-
this.measureTextWidth(m, i) <= l ? (u = C,
|
|
2081
|
+
let h = 0, d = e.length, u = 0;
|
|
2082
|
+
for (; h <= d; ) {
|
|
2083
|
+
const C = Math.floor((h + d) / 2), m = e.slice(0, C).trimEnd() + c;
|
|
2084
|
+
this.measureTextWidth(m, i) <= l ? (u = C, h = C + 1) : d = C - 1;
|
|
2095
2085
|
}
|
|
2096
2086
|
const g = e.slice(0, u).trimEnd() + c;
|
|
2097
2087
|
t.placeholder = g;
|
|
@@ -2263,34 +2253,34 @@ function nt(p) {
|
|
|
2263
2253
|
g === "(" && c++, g === ")" && c--, g === "," && c === 0 ? (l.push(r.trim()), r = "") : r += g;
|
|
2264
2254
|
}
|
|
2265
2255
|
r.trim() && l.push(r.trim());
|
|
2266
|
-
const
|
|
2267
|
-
let
|
|
2256
|
+
const h = [];
|
|
2257
|
+
let d = [];
|
|
2268
2258
|
for (let u = 0; u < l.length; u++) {
|
|
2269
2259
|
const g = l[u];
|
|
2270
|
-
g.includes("deg") || g.includes("to ") ||
|
|
2260
|
+
g.includes("deg") || g.includes("to ") || d.push(g);
|
|
2271
2261
|
}
|
|
2272
|
-
for (let u = 0; u <
|
|
2273
|
-
const g =
|
|
2262
|
+
for (let u = 0; u < d.length; u++) {
|
|
2263
|
+
const g = d[u];
|
|
2274
2264
|
let C = "", m = 0, y = 100;
|
|
2275
2265
|
const f = g.match(
|
|
2276
2266
|
/rgba?\(([^)]+)\)(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2277
2267
|
);
|
|
2278
2268
|
if (f) {
|
|
2279
2269
|
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 =
|
|
2270
|
+
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 = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100);
|
|
2281
2271
|
} else {
|
|
2282
2272
|
const E = g.match(
|
|
2283
2273
|
/#([a-fA-F0-9]{3,8})(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2284
2274
|
);
|
|
2285
|
-
E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m =
|
|
2275
|
+
E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100));
|
|
2286
2276
|
}
|
|
2287
|
-
C &&
|
|
2277
|
+
C && h.push({
|
|
2288
2278
|
color: C,
|
|
2289
2279
|
position: m,
|
|
2290
2280
|
opacity: y
|
|
2291
2281
|
});
|
|
2292
2282
|
}
|
|
2293
|
-
if (
|
|
2283
|
+
if (h.length === 0) {
|
|
2294
2284
|
const u = n.match(
|
|
2295
2285
|
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2296
2286
|
);
|
|
@@ -2307,7 +2297,7 @@ function nt(p) {
|
|
|
2307
2297
|
}
|
|
2308
2298
|
if (m) {
|
|
2309
2299
|
const f = u.length === 1 ? 0 : Math.round(C / (u.length - 1) * 100);
|
|
2310
|
-
|
|
2300
|
+
h.push({
|
|
2311
2301
|
color: m,
|
|
2312
2302
|
position: f,
|
|
2313
2303
|
opacity: y
|
|
@@ -2315,10 +2305,10 @@ function nt(p) {
|
|
|
2315
2305
|
}
|
|
2316
2306
|
});
|
|
2317
2307
|
}
|
|
2318
|
-
return console.log("Color stops found:",
|
|
2308
|
+
return console.log("Color stops found:", h), {
|
|
2319
2309
|
type: "linear",
|
|
2320
2310
|
angle: o,
|
|
2321
|
-
stops:
|
|
2311
|
+
stops: h
|
|
2322
2312
|
};
|
|
2323
2313
|
}
|
|
2324
2314
|
}
|
|
@@ -2357,10 +2347,10 @@ class Pt {
|
|
|
2357
2347
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2358
2348
|
const c = document.createElement("div");
|
|
2359
2349
|
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2360
|
-
const d = document.createElement("div");
|
|
2361
|
-
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2362
2350
|
const h = document.createElement("div");
|
|
2363
|
-
h.className = "color-picker-opacity
|
|
2351
|
+
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2352
|
+
const d = document.createElement("div");
|
|
2353
|
+
d.className = "color-picker-opacity-marker", this.opacityMarker = d, h.appendChild(d);
|
|
2364
2354
|
const u = document.createElement("div");
|
|
2365
2355
|
u.className = "color-picker-format-section";
|
|
2366
2356
|
const g = document.createElement("select");
|
|
@@ -2376,7 +2366,7 @@ class Pt {
|
|
|
2376
2366
|
const E = document.createElement("div");
|
|
2377
2367
|
E.className = "color-picker-input-container";
|
|
2378
2368
|
const V = document.createElement("button");
|
|
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(
|
|
2369
|
+
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(h), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (A) => {
|
|
2380
2370
|
A.stopPropagation();
|
|
2381
2371
|
}), t;
|
|
2382
2372
|
}
|
|
@@ -2563,21 +2553,21 @@ class Pt {
|
|
|
2563
2553
|
}
|
|
2564
2554
|
makeDraggable(t, e) {
|
|
2565
2555
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2566
|
-
const l = (
|
|
2567
|
-
if (
|
|
2556
|
+
const l = (h) => {
|
|
2557
|
+
if (h.target.closest("button"))
|
|
2568
2558
|
return;
|
|
2569
|
-
|
|
2570
|
-
const
|
|
2571
|
-
o =
|
|
2572
|
-
}, r = (
|
|
2559
|
+
h.preventDefault(), h.stopPropagation(), i = !0, s = h.clientX, n = h.clientY;
|
|
2560
|
+
const d = e.getBoundingClientRect();
|
|
2561
|
+
o = d.left, a = d.top, e.classList.add("dragging"), document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
2562
|
+
}, r = (h) => {
|
|
2573
2563
|
if (!i) return;
|
|
2574
|
-
|
|
2575
|
-
const
|
|
2576
|
-
let g = o +
|
|
2564
|
+
h.preventDefault(), h.stopPropagation();
|
|
2565
|
+
const d = h.clientX - s, u = h.clientY - n;
|
|
2566
|
+
let g = o + d, C = a + u;
|
|
2577
2567
|
const m = window.innerWidth, y = window.innerHeight, f = e.offsetWidth, E = e.offsetHeight;
|
|
2578
2568
|
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 = (
|
|
2580
|
-
i && (i = !1,
|
|
2569
|
+
}, c = (h) => {
|
|
2570
|
+
i && (i = !1, h.preventDefault(), h.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2581
2571
|
};
|
|
2582
2572
|
t.addEventListener("mousedown", l);
|
|
2583
2573
|
}
|
|
@@ -2871,14 +2861,14 @@ class se extends I {
|
|
|
2871
2861
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2872
2862
|
}
|
|
2873
2863
|
createSolidEditor(t) {
|
|
2874
|
-
var o, a, l, r, c,
|
|
2864
|
+
var o, a, l, r, c, h;
|
|
2875
2865
|
const e = document.createElement("div");
|
|
2876
2866
|
e.className = "gradient-solid-picker embedded-color-picker";
|
|
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 = ((
|
|
2867
|
+
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((h = (c = (r = this.value) == null ? void 0 : r.stops) == null ? void 0 : c[0]) == null ? void 0 : h.opacity) || 100, n = this.createEmbeddedColorPickerWithOpacity(
|
|
2878
2868
|
i,
|
|
2879
2869
|
s,
|
|
2880
|
-
(
|
|
2881
|
-
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color:
|
|
2870
|
+
(d, u) => {
|
|
2871
|
+
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color: d, position: 0, opacity: u }] : (this.value.stops[0].color = d, this.value.stops[0].opacity = u), this.updateUI(), this.triggerChange());
|
|
2882
2872
|
}
|
|
2883
2873
|
);
|
|
2884
2874
|
e.appendChild(n), t.appendChild(e);
|
|
@@ -2900,10 +2890,10 @@ class se extends I {
|
|
|
2900
2890
|
r.className = "color-picker-hue embedded";
|
|
2901
2891
|
const c = document.createElement("div");
|
|
2902
2892
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2903
|
-
const d = document.createElement("div");
|
|
2904
|
-
d.className = "color-picker-opacity embedded";
|
|
2905
2893
|
const h = document.createElement("div");
|
|
2906
|
-
h.className = "color-picker-opacity
|
|
2894
|
+
h.className = "color-picker-opacity embedded";
|
|
2895
|
+
const d = document.createElement("div");
|
|
2896
|
+
d.className = "color-picker-opacity-marker", h.appendChild(d);
|
|
2907
2897
|
const u = document.createElement("div");
|
|
2908
2898
|
u.className = "color-picker-format-section embedded";
|
|
2909
2899
|
const g = document.createElement("select");
|
|
@@ -2919,7 +2909,7 @@ class se extends I {
|
|
|
2919
2909
|
const E = document.createElement("div");
|
|
2920
2910
|
E.className = "color-picker-input-container";
|
|
2921
2911
|
const V = document.createElement("button");
|
|
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(
|
|
2912
|
+
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(h), s.appendChild(u), this.setupEmbeddedColorPicker(
|
|
2923
2913
|
n,
|
|
2924
2914
|
o,
|
|
2925
2915
|
r,
|
|
@@ -2932,8 +2922,8 @@ class se extends I {
|
|
|
2932
2922
|
e,
|
|
2933
2923
|
i
|
|
2934
2924
|
), this.setupOpacitySlider(
|
|
2935
|
-
d,
|
|
2936
2925
|
h,
|
|
2926
|
+
d,
|
|
2937
2927
|
t,
|
|
2938
2928
|
e,
|
|
2939
2929
|
i
|
|
@@ -2956,27 +2946,27 @@ class se extends I {
|
|
|
2956
2946
|
r.className = "color-picker-hue embedded";
|
|
2957
2947
|
const c = document.createElement("div");
|
|
2958
2948
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2959
|
-
const
|
|
2960
|
-
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2949
|
+
const h = document.createElement("div");
|
|
2950
|
+
h.className = "color-picker-format-section embedded";
|
|
2951
|
+
const d = document.createElement("select");
|
|
2952
|
+
d.className = "color-picker-format-select";
|
|
2963
2953
|
const u = document.createElement("option");
|
|
2964
2954
|
u.value = "hex", u.textContent = "HEX";
|
|
2965
2955
|
const g = document.createElement("option");
|
|
2966
2956
|
g.value = "rgb", g.textContent = "RGB";
|
|
2967
2957
|
const C = document.createElement("option");
|
|
2968
|
-
C.value = "hsl", C.textContent = "HSL",
|
|
2958
|
+
C.value = "hsl", C.textContent = "HSL", d.appendChild(u), d.appendChild(g), d.appendChild(C);
|
|
2969
2959
|
const m = document.createElement("input");
|
|
2970
2960
|
m.type = "text", m.className = "color-picker-color-input", m.value = t;
|
|
2971
2961
|
const y = document.createElement("div");
|
|
2972
2962
|
y.className = "color-picker-input-container";
|
|
2973
2963
|
const f = document.createElement("button");
|
|
2974
|
-
return f.className = "color-picker-copy-inside", f.textContent = "Copy", y.appendChild(m), y.appendChild(f),
|
|
2964
|
+
return f.className = "color-picker-copy-inside", f.textContent = "Copy", y.appendChild(m), y.appendChild(f), h.appendChild(d), h.appendChild(y), s.appendChild(n), s.appendChild(a), s.appendChild(h), this.setupEmbeddedColorPicker(
|
|
2975
2965
|
n,
|
|
2976
2966
|
o,
|
|
2977
2967
|
r,
|
|
2978
2968
|
c,
|
|
2979
|
-
|
|
2969
|
+
d,
|
|
2980
2970
|
m,
|
|
2981
2971
|
f,
|
|
2982
2972
|
l,
|
|
@@ -2985,27 +2975,27 @@ class se extends I {
|
|
|
2985
2975
|
i
|
|
2986
2976
|
), s;
|
|
2987
2977
|
}
|
|
2988
|
-
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c,
|
|
2989
|
-
let
|
|
2978
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, h) {
|
|
2979
|
+
let d = r;
|
|
2990
2980
|
const { h: u, s: g, v: C } = this.hexToHsv(r);
|
|
2991
2981
|
let m = c;
|
|
2992
2982
|
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
2983
|
const y = (v, w = m) => {
|
|
2994
|
-
|
|
2984
|
+
d = v, m = Math.round(w), f(), h(v, m);
|
|
2995
2985
|
}, f = () => {
|
|
2996
|
-
const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(
|
|
2986
|
+
const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(d);
|
|
2997
2987
|
switch (v) {
|
|
2998
2988
|
case "hex":
|
|
2999
|
-
o.value =
|
|
2989
|
+
o.value = d;
|
|
3000
2990
|
break;
|
|
3001
2991
|
case "rgb":
|
|
3002
|
-
const { r:
|
|
3003
|
-
o.value = `rgb(${
|
|
2992
|
+
const { r: T, g: $, b: W } = this.hexToRgb(d);
|
|
2993
|
+
o.value = `rgb(${T}, ${$}, ${W})`;
|
|
3004
2994
|
break;
|
|
3005
2995
|
case "hsl":
|
|
3006
|
-
const { hue: F, sat:
|
|
2996
|
+
const { hue: F, sat: _, lightness: K } = this.hsvToHsl(w, x, k);
|
|
3007
2997
|
o.value = `hsl(${Math.round(F)}, ${Math.round(
|
|
3008
|
-
|
|
2998
|
+
_ * 100
|
|
3009
2999
|
)}%, ${Math.round(K * 100)}%)`;
|
|
3010
3000
|
break;
|
|
3011
3001
|
}
|
|
@@ -3016,7 +3006,7 @@ class se extends I {
|
|
|
3016
3006
|
v = Math.max(0.1, Math.min(358.9, v));
|
|
3017
3007
|
const w = parseFloat(e.style.left || "50%") / 100, x = parseFloat(e.style.top || "50%") / 100;
|
|
3018
3008
|
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`;
|
|
3019
|
-
const k = w,
|
|
3009
|
+
const k = w, T = 1 - x, $ = this.hsvToHex(v, k, T);
|
|
3020
3010
|
y($, m);
|
|
3021
3011
|
}, B = (v) => {
|
|
3022
3012
|
v.stopPropagation();
|
|
@@ -3047,40 +3037,40 @@ class se extends I {
|
|
|
3047
3037
|
if (x === "hex" && /^#[0-9A-Fa-f]{6}$/.test(w))
|
|
3048
3038
|
k = w;
|
|
3049
3039
|
else if (x === "rgb") {
|
|
3050
|
-
const
|
|
3051
|
-
if (
|
|
3052
|
-
const $ = parseInt(
|
|
3040
|
+
const T = w.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3041
|
+
if (T) {
|
|
3042
|
+
const $ = parseInt(T[1]), W = parseInt(T[2]), F = parseInt(T[3]);
|
|
3053
3043
|
$ <= 255 && W <= 255 && F <= 255 && (k = `#${$.toString(16).padStart(2, "0")}${W.toString(16).padStart(2, "0")}${F.toString(16).padStart(2, "0")}`);
|
|
3054
3044
|
}
|
|
3055
3045
|
} else if (x === "hsl") {
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
const $ = parseInt(
|
|
3046
|
+
const T = w.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3047
|
+
if (T) {
|
|
3048
|
+
const $ = parseInt(T[1]), W = parseInt(T[2]) / 100, F = parseInt(T[3]) / 100;
|
|
3059
3049
|
if ($ <= 360 && W <= 1 && F <= 1) {
|
|
3060
|
-
const
|
|
3061
|
-
k = this.hsvToHex($, K,
|
|
3050
|
+
const _ = F + W * Math.min(F, 1 - F), K = _ === 0 ? 0 : 2 * (1 - F / _);
|
|
3051
|
+
k = this.hsvToHex($, K, _);
|
|
3062
3052
|
}
|
|
3063
3053
|
}
|
|
3064
3054
|
}
|
|
3065
3055
|
if (k) {
|
|
3066
|
-
const { h:
|
|
3067
|
-
s.style.left = `${
|
|
3056
|
+
const { h: T, s: $, v: W } = this.hexToHsv(k);
|
|
3057
|
+
s.style.left = `${T / 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(${T}, 100%, 50%))`, y(k, m);
|
|
3068
3058
|
}
|
|
3069
3059
|
}, O = (v) => {
|
|
3070
3060
|
f();
|
|
3071
|
-
},
|
|
3061
|
+
}, H = () => {
|
|
3072
3062
|
f();
|
|
3073
3063
|
}, S = () => {
|
|
3074
3064
|
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3075
3065
|
o.select(), document.execCommand("copy");
|
|
3076
3066
|
});
|
|
3077
3067
|
};
|
|
3078
|
-
f(), t.addEventListener("mousedown", L), t.addEventListener("click", B), i.addEventListener("mousedown", M), i.addEventListener("click", b), n.addEventListener("change",
|
|
3068
|
+
f(), t.addEventListener("mousedown", L), t.addEventListener("click", B), i.addEventListener("mousedown", M), i.addEventListener("click", b), n.addEventListener("change", H), o.addEventListener("input", P), o.addEventListener("blur", O), a.addEventListener("click", S);
|
|
3079
3069
|
const D = async () => {
|
|
3080
3070
|
if ("EyeDropper" in window)
|
|
3081
3071
|
try {
|
|
3082
|
-
const x = (await new window.EyeDropper().open()).sRGBHex, { h: k, s:
|
|
3083
|
-
s.style.left = `${k / 360 * 100}%`, e.style.left = `${
|
|
3072
|
+
const x = (await new window.EyeDropper().open()).sRGBHex, { h: k, s: T, v: $ } = this.hexToHsv(x);
|
|
3073
|
+
s.style.left = `${k / 360 * 100}%`, e.style.left = `${T * 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
3074
|
} catch (v) {
|
|
3085
3075
|
console.log("User cancelled eyedropper or error occurred:", v);
|
|
3086
3076
|
}
|
|
@@ -3098,15 +3088,15 @@ class se extends I {
|
|
|
3098
3088
|
}
|
|
3099
3089
|
setupOpacitySlider(t, e, i, s, n) {
|
|
3100
3090
|
const o = () => {
|
|
3101
|
-
const { r: c, g:
|
|
3102
|
-
t.style.setProperty("--color-rgb", `${c}, ${
|
|
3091
|
+
const { r: c, g: h, b: d } = this.hexToRgb(i);
|
|
3092
|
+
t.style.setProperty("--color-rgb", `${c}, ${h}, ${d}`);
|
|
3103
3093
|
}, a = () => {
|
|
3104
3094
|
e.style.left = `${s}%`;
|
|
3105
3095
|
};
|
|
3106
3096
|
o(), a();
|
|
3107
3097
|
let l = !1;
|
|
3108
3098
|
const r = (c) => {
|
|
3109
|
-
const
|
|
3099
|
+
const h = t.getBoundingClientRect(), d = c.clientX - h.left, u = Math.max(0, Math.min(100, d / h.width * 100)), g = Math.round(u);
|
|
3110
3100
|
s = g, a(), n(i, g);
|
|
3111
3101
|
};
|
|
3112
3102
|
t.addEventListener("mousedown", (c) => {
|
|
@@ -3174,17 +3164,17 @@ class se extends I {
|
|
|
3174
3164
|
})();
|
|
3175
3165
|
const c = document.createElement("div");
|
|
3176
3166
|
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3177
|
-
const d = document.createElement("div");
|
|
3178
|
-
d.className = "gradient-handles", this.createGradientHandles(d, c), c.appendChild(d), t.appendChild(c);
|
|
3179
3167
|
const h = document.createElement("div");
|
|
3180
|
-
h.className = "gradient-
|
|
3168
|
+
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3169
|
+
const d = document.createElement("div");
|
|
3170
|
+
d.className = "gradient-stops-header";
|
|
3181
3171
|
const u = document.createElement("span");
|
|
3182
3172
|
u.textContent = "Stops";
|
|
3183
3173
|
const g = document.createElement("button");
|
|
3184
|
-
g.type = "button", g.className = "gradient-add-stop", g.textContent = "+",
|
|
3174
|
+
g.type = "button", g.className = "gradient-add-stop", g.textContent = "+", d.appendChild(u), d.appendChild(g);
|
|
3185
3175
|
const C = document.createElement("div");
|
|
3186
|
-
C.className = "gradient-stops", t.appendChild(
|
|
3187
|
-
this.addGradientStop(), this.updateStopsList(C), this.updateGradientPreview(c), this.createGradientHandles(
|
|
3176
|
+
C.className = "gradient-stops", t.appendChild(d), t.appendChild(C), this.updateStopsList(C), g.addEventListener("click", () => {
|
|
3177
|
+
this.addGradientStop(), this.updateStopsList(C), this.updateGradientPreview(c), this.createGradientHandles(h, c), this.updateUI();
|
|
3188
3178
|
});
|
|
3189
3179
|
}
|
|
3190
3180
|
updateGradientPreview(t) {
|
|
@@ -3202,21 +3192,21 @@ class se extends I {
|
|
|
3202
3192
|
}
|
|
3203
3193
|
makeDraggable(t, e, i) {
|
|
3204
3194
|
let s = !1, n = 0, o = 0, a = null;
|
|
3205
|
-
const l = (
|
|
3195
|
+
const l = (d) => "touches" in d && d.touches.length > 0 ? d.touches[0].clientX : d.clientX, r = (d) => {
|
|
3206
3196
|
var u, g, C;
|
|
3207
|
-
s = !0, n = l(
|
|
3197
|
+
s = !0, n = l(d), 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", h), document.addEventListener("mousemove", c, { passive: !1 }), document.addEventListener("mouseup", h), document.addEventListener("touchmove", c, {
|
|
3208
3198
|
passive: !1
|
|
3209
|
-
}), document.addEventListener("touchend",
|
|
3210
|
-
}, c = (
|
|
3199
|
+
}), document.addEventListener("touchend", h), d.preventDefault();
|
|
3200
|
+
}, c = (d) => {
|
|
3211
3201
|
var y, f;
|
|
3212
3202
|
if (!s || !((f = (y = this.value) == null ? void 0 : y.stops) != null && f[i])) return;
|
|
3213
|
-
const u = e.getBoundingClientRect(), C = (l(
|
|
3203
|
+
const u = e.getBoundingClientRect(), C = (l(d) - n) / u.width * 100;
|
|
3214
3204
|
let m = o + C;
|
|
3215
3205
|
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(() => {
|
|
3216
3206
|
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3217
|
-
}),
|
|
3218
|
-
},
|
|
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",
|
|
3207
|
+
}), d.preventDefault();
|
|
3208
|
+
}, h = () => {
|
|
3209
|
+
s && (s = !1, t.classList.remove("selected"), a && (cancelAnimationFrame(a), a = null), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange(), document.removeEventListener("pointermove", c), document.removeEventListener("pointerup", h), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", h), document.removeEventListener("touchmove", c), document.removeEventListener("touchend", h));
|
|
3220
3210
|
};
|
|
3221
3211
|
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3222
3212
|
passive: !1
|
|
@@ -3237,12 +3227,12 @@ class se extends I {
|
|
|
3237
3227
|
r.className = "gstop-color-container";
|
|
3238
3228
|
const c = document.createElement("div");
|
|
3239
3229
|
c.className = "gstop-color-preview", c.style.backgroundColor = s.color;
|
|
3240
|
-
const
|
|
3241
|
-
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3230
|
+
const h = document.createElement("input");
|
|
3231
|
+
h.type = "text", h.className = "gstop-color-input", h.value = s.color.replace("#", "").toUpperCase();
|
|
3232
|
+
const d = document.createElement("button");
|
|
3233
|
+
d.type = "button", d.className = "gstop-color-copy", d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3244
3234
|
<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"/>
|
|
3245
|
-
</svg>`, r.appendChild(c), r.appendChild(
|
|
3235
|
+
</svg>`, r.appendChild(c), r.appendChild(h), r.appendChild(d);
|
|
3246
3236
|
const u = document.createElement("button");
|
|
3247
3237
|
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">
|
|
3248
3238
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -3250,8 +3240,8 @@ class se extends I {
|
|
|
3250
3240
|
var O;
|
|
3251
3241
|
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3252
3242
|
if (this.value && !isNaN(P)) {
|
|
3253
|
-
const
|
|
3254
|
-
this.value.stops[n].position =
|
|
3243
|
+
const H = Math.max(0, Math.min(100, P));
|
|
3244
|
+
this.value.stops[n].position = H, b.value = `${H}%`;
|
|
3255
3245
|
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3256
3246
|
".gradient-preview"
|
|
3257
3247
|
), D = S == null ? void 0 : S.querySelector(
|
|
@@ -3263,10 +3253,10 @@ class se extends I {
|
|
|
3263
3253
|
const b = L.target, M = b.value.replace("%", "");
|
|
3264
3254
|
b.value = M, b.select();
|
|
3265
3255
|
}), l.addEventListener("blur", (L) => {
|
|
3266
|
-
var O,
|
|
3256
|
+
var O, H;
|
|
3267
3257
|
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3268
3258
|
if (isNaN(P))
|
|
3269
|
-
b.value = `${((
|
|
3259
|
+
b.value = `${((H = (O = this.value) == null ? void 0 : O.stops[n]) == null ? void 0 : H.position) || 0}%`;
|
|
3270
3260
|
else {
|
|
3271
3261
|
const S = Math.max(0, Math.min(100, P));
|
|
3272
3262
|
b.value = `${S}%`, this.value && (this.value.stops[n].position = S, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
@@ -3275,14 +3265,14 @@ class se extends I {
|
|
|
3275
3265
|
const g = new Pt(
|
|
3276
3266
|
(L, b) => {
|
|
3277
3267
|
var M, P, O;
|
|
3278
|
-
if (
|
|
3268
|
+
if (h.value = L.replace("#", "").toUpperCase(), c.style.backgroundColor = L, this.value) {
|
|
3279
3269
|
this.value.stops[n].color = L, b !== void 0 && (this.value.stops[n].opacity = b);
|
|
3280
|
-
const
|
|
3270
|
+
const H = (M = o.parentElement) == null ? void 0 : M.querySelector(
|
|
3281
3271
|
".gstop-opacity-slider"
|
|
3282
3272
|
);
|
|
3283
|
-
if (
|
|
3273
|
+
if (H) {
|
|
3284
3274
|
const v = this.hexToRgb(L);
|
|
3285
|
-
|
|
3275
|
+
H.style.setProperty(
|
|
3286
3276
|
"--slider-color",
|
|
3287
3277
|
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3288
3278
|
);
|
|
@@ -3291,7 +3281,7 @@ class se extends I {
|
|
|
3291
3281
|
const v = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3292
3282
|
".gstop-opacity-value"
|
|
3293
3283
|
);
|
|
3294
|
-
v && (v.textContent = `${b}%`),
|
|
3284
|
+
v && (v.textContent = `${b}%`), H && (H.value = b.toString());
|
|
3295
3285
|
}
|
|
3296
3286
|
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3297
3287
|
".gradient-preview"
|
|
@@ -3302,19 +3292,19 @@ class se extends I {
|
|
|
3302
3292
|
}
|
|
3303
3293
|
}
|
|
3304
3294
|
);
|
|
3305
|
-
|
|
3306
|
-
L.stopPropagation(), g.open(s.color,
|
|
3307
|
-
}),
|
|
3295
|
+
h.addEventListener("click", (L) => {
|
|
3296
|
+
L.stopPropagation(), g.open(s.color, h, s.opacity || 100);
|
|
3297
|
+
}), h.addEventListener("input", (L) => {
|
|
3308
3298
|
var P, O;
|
|
3309
3299
|
const b = L.target.value.trim(), M = b.startsWith("#") ? b : `#${b}`;
|
|
3310
3300
|
if (/^#[0-9A-Fa-f]{6}$/.test(M) && (c.style.backgroundColor = M, this.value)) {
|
|
3311
3301
|
this.value.stops[n].color = M;
|
|
3312
|
-
const
|
|
3302
|
+
const H = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3313
3303
|
".gstop-opacity-slider"
|
|
3314
3304
|
);
|
|
3315
|
-
if (
|
|
3305
|
+
if (H) {
|
|
3316
3306
|
const v = this.hexToRgb(M);
|
|
3317
|
-
|
|
3307
|
+
H.style.setProperty(
|
|
3318
3308
|
"--slider-color",
|
|
3319
3309
|
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3320
3310
|
);
|
|
@@ -3326,16 +3316,16 @@ class se extends I {
|
|
|
3326
3316
|
);
|
|
3327
3317
|
S && D && this.createGradientHandles(D, S), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3328
3318
|
}
|
|
3329
|
-
}),
|
|
3319
|
+
}), d.addEventListener("click", async (L) => {
|
|
3330
3320
|
L.stopPropagation();
|
|
3331
|
-
const b = `#${
|
|
3321
|
+
const b = `#${h.value}`;
|
|
3332
3322
|
try {
|
|
3333
3323
|
await navigator.clipboard.writeText(b);
|
|
3334
|
-
const M =
|
|
3335
|
-
|
|
3324
|
+
const M = d.innerHTML;
|
|
3325
|
+
d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3336
3326
|
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3337
3327
|
</svg>`, setTimeout(() => {
|
|
3338
|
-
|
|
3328
|
+
d.innerHTML = M;
|
|
3339
3329
|
}, 1e3);
|
|
3340
3330
|
} catch (M) {
|
|
3341
3331
|
console.warn("Failed to copy color to clipboard:", M);
|
|
@@ -3478,8 +3468,8 @@ class se extends I {
|
|
|
3478
3468
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3479
3469
|
);
|
|
3480
3470
|
if (s) {
|
|
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:
|
|
3482
|
-
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${
|
|
3471
|
+
const n = parseFloat(s[1]), o = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, l = s[4] ? parseFloat(s[4]) : 1, { r, g: c, b: h } = this.hslToRgb(n, o, a);
|
|
3472
|
+
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${h.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3483
3473
|
}
|
|
3484
3474
|
return { color: e, position: 0, opacity: 100 };
|
|
3485
3475
|
}
|
|
@@ -3591,8 +3581,8 @@ class se extends I {
|
|
|
3591
3581
|
let o = "", a = 0;
|
|
3592
3582
|
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3593
3583
|
if (l) {
|
|
3594
|
-
const c = l[1].trim(),
|
|
3595
|
-
this.isValidColorFormat(c) ? (o = c, a =
|
|
3584
|
+
const c = l[1].trim(), h = parseFloat(l[2]);
|
|
3585
|
+
this.isValidColorFormat(c) ? (o = c, a = h) : (o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100);
|
|
3596
3586
|
} else
|
|
3597
3587
|
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3598
3588
|
const r = this.parseColorWithOpacity(o);
|
|
@@ -3766,7 +3756,7 @@ class oe extends z {
|
|
|
3766
3756
|
`;
|
|
3767
3757
|
}
|
|
3768
3758
|
}
|
|
3769
|
-
class
|
|
3759
|
+
class J extends I {
|
|
3770
3760
|
constructor(t) {
|
|
3771
3761
|
super({
|
|
3772
3762
|
...t,
|
|
@@ -3818,25 +3808,25 @@ class ae extends z {
|
|
|
3818
3808
|
title: "Margins",
|
|
3819
3809
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3820
3810
|
settings: {
|
|
3821
|
-
marginTop: new
|
|
3811
|
+
marginTop: new J({
|
|
3822
3812
|
title: "Top",
|
|
3823
3813
|
icon: Ft,
|
|
3824
3814
|
suffix: "px",
|
|
3825
3815
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3826
3816
|
}),
|
|
3827
|
-
marginRight: new
|
|
3817
|
+
marginRight: new J({
|
|
3828
3818
|
title: "Right",
|
|
3829
3819
|
icon: Rt,
|
|
3830
3820
|
suffix: "px",
|
|
3831
3821
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3832
3822
|
}),
|
|
3833
|
-
marginBottom: new
|
|
3823
|
+
marginBottom: new J({
|
|
3834
3824
|
title: "Bottom",
|
|
3835
3825
|
icon: Gt,
|
|
3836
3826
|
suffix: "px",
|
|
3837
3827
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3838
3828
|
}),
|
|
3839
|
-
marginLeft: new
|
|
3829
|
+
marginLeft: new J({
|
|
3840
3830
|
title: "Left",
|
|
3841
3831
|
icon: Wt,
|
|
3842
3832
|
suffix: "px",
|
|
@@ -3939,5 +3929,5 @@ export {
|
|
|
3939
3929
|
j as isSetting,
|
|
3940
3930
|
st as isSettingChild,
|
|
3941
3931
|
N as isSettingGroup,
|
|
3942
|
-
|
|
3932
|
+
q as iterateSettings
|
|
3943
3933
|
};
|