builder-settings-types 0.0.264 → 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 +25 -25
- package/dist/builder-settings-types.es.js +244 -234
- 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/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;
|
|
@@ -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 = 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 };
|
|
@@ -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 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,14 +760,14 @@ 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
|
-
|
|
769
|
+
c.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (h) => {
|
|
770
|
+
h.stopPropagation(), h.preventDefault();
|
|
761
771
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
762
772
|
if (st(g)) {
|
|
763
773
|
const C = `${this.addItemCfg.keyPrefix}${u}`;
|
|
@@ -807,8 +817,8 @@ const Y = class Y {
|
|
|
807
817
|
}
|
|
808
818
|
}
|
|
809
819
|
};
|
|
810
|
-
|
|
811
|
-
let z =
|
|
820
|
+
_.hiddenElements = /* @__PURE__ */ new Set();
|
|
821
|
+
let z = _;
|
|
812
822
|
function zt(p) {
|
|
813
823
|
return new ut(p);
|
|
814
824
|
}
|
|
@@ -852,9 +862,9 @@ class ut extends z {
|
|
|
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];
|
|
@@ -910,8 +920,8 @@ class R 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
|
}
|
|
@@ -951,8 +961,8 @@ class R 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 R 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
|
|
981
|
+
var d, h;
|
|
972
982
|
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
973
|
-
this.value = c, (
|
|
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
|
|
985
|
+
var d, h;
|
|
976
986
|
const r = l.target.value, c = R.normalizeColorValue(r);
|
|
977
|
-
this.value = c, (
|
|
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() {
|
|
@@ -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
|
|
1230
|
+
class yt extends G {
|
|
1221
1231
|
constructor(t = {}) {
|
|
1222
1232
|
const e = {
|
|
1223
1233
|
title: "Opacity",
|
|
@@ -1238,7 +1248,7 @@ class Et extends G {
|
|
|
1238
1248
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1239
1249
|
}
|
|
1240
1250
|
}
|
|
1241
|
-
const
|
|
1251
|
+
const Et = `
|
|
1242
1252
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1243
1253
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1244
1254
|
</svg>
|
|
@@ -1287,7 +1297,7 @@ class et extends I {
|
|
|
1287
1297
|
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1288
1298
|
}), document.body.appendChild(i);
|
|
1289
1299
|
const s = document.createElement("div");
|
|
1290
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1300
|
+
return s.classList.add("svg-container"), s.innerHTML = Et, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1291
1301
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1292
1302
|
}).catch((n) => {
|
|
1293
1303
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1860,7 +1870,7 @@ class Xt extends I {
|
|
|
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 I {
|
|
|
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) => {
|
|
@@ -1929,7 +1939,7 @@ class Yt extends I {
|
|
|
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");
|
|
@@ -2012,7 +2022,7 @@ class Kt extends I {
|
|
|
2012
2022
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2013
2023
|
}
|
|
2014
2024
|
}
|
|
2015
|
-
const
|
|
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
2028
|
class Qt extends G {
|
|
@@ -2021,14 +2031,14 @@ class Qt extends G {
|
|
|
2021
2031
|
...t,
|
|
2022
2032
|
minValue: t.minValue ?? 0,
|
|
2023
2033
|
maxValue: t.maxValue ?? 1e3,
|
|
2024
|
-
icon: t.icon ||
|
|
2034
|
+
icon: t.icon || Ht,
|
|
2025
2035
|
title: t.title || "Margin Bottom",
|
|
2026
2036
|
default: t.default ?? 20,
|
|
2027
2037
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2028
2038
|
}), this.inputType = "number";
|
|
2029
2039
|
}
|
|
2030
2040
|
}
|
|
2031
|
-
const
|
|
2041
|
+
const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
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>`;
|
|
@@ -2038,7 +2048,7 @@ class te extends G {
|
|
|
2038
2048
|
...t,
|
|
2039
2049
|
minValue: t.minValue ?? 0,
|
|
2040
2050
|
maxValue: t.maxValue ?? 1e3,
|
|
2041
|
-
icon: t.icon ||
|
|
2051
|
+
icon: t.icon || Tt,
|
|
2042
2052
|
title: t.title || "Margin Top",
|
|
2043
2053
|
default: t.default ?? 20,
|
|
2044
2054
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
@@ -2078,10 +2088,10 @@ class ee extends I {
|
|
|
2078
2088
|
return;
|
|
2079
2089
|
}
|
|
2080
2090
|
const c = "...";
|
|
2081
|
-
let
|
|
2082
|
-
for (;
|
|
2083
|
-
const C = Math.floor((
|
|
2084
|
-
this.measureTextWidth(m, i) <= l ? (u = C,
|
|
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
2096
|
const g = e.slice(0, u).trimEnd() + c;
|
|
2087
2097
|
t.placeholder = g;
|
|
@@ -2253,62 +2263,62 @@ function nt(p) {
|
|
|
2253
2263
|
g === "(" && c++, g === ")" && c--, g === "," && c === 0 ? (l.push(r.trim()), r = "") : r += g;
|
|
2254
2264
|
}
|
|
2255
2265
|
r.trim() && l.push(r.trim());
|
|
2256
|
-
const
|
|
2257
|
-
let
|
|
2266
|
+
const d = [];
|
|
2267
|
+
let h = [];
|
|
2258
2268
|
for (let u = 0; u < l.length; u++) {
|
|
2259
2269
|
const g = l[u];
|
|
2260
|
-
g.includes("deg") || g.includes("to ") ||
|
|
2270
|
+
g.includes("deg") || g.includes("to ") || h.push(g);
|
|
2261
2271
|
}
|
|
2262
|
-
for (let u = 0; u <
|
|
2263
|
-
const g =
|
|
2264
|
-
let C = "", m = 0,
|
|
2272
|
+
for (let u = 0; u < h.length; u++) {
|
|
2273
|
+
const g = h[u];
|
|
2274
|
+
let C = "", m = 0, y = 100;
|
|
2265
2275
|
const f = g.match(
|
|
2266
2276
|
/rgba?\(([^)]+)\)(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2267
2277
|
);
|
|
2268
2278
|
if (f) {
|
|
2269
|
-
const
|
|
2270
|
-
C = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`,
|
|
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);
|
|
2271
2281
|
} else {
|
|
2272
|
-
const
|
|
2282
|
+
const E = g.match(
|
|
2273
2283
|
/#([a-fA-F0-9]{3,8})(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2274
2284
|
);
|
|
2275
|
-
|
|
2285
|
+
E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m = h.length === 1 ? 0 : Math.round(u / (h.length - 1) * 100));
|
|
2276
2286
|
}
|
|
2277
|
-
C &&
|
|
2287
|
+
C && d.push({
|
|
2278
2288
|
color: C,
|
|
2279
2289
|
position: m,
|
|
2280
|
-
opacity:
|
|
2290
|
+
opacity: y
|
|
2281
2291
|
});
|
|
2282
2292
|
}
|
|
2283
|
-
if (
|
|
2293
|
+
if (d.length === 0) {
|
|
2284
2294
|
const u = n.match(
|
|
2285
2295
|
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2286
2296
|
);
|
|
2287
2297
|
u && u.forEach((g, C) => {
|
|
2288
|
-
let m = "",
|
|
2298
|
+
let m = "", y = 100;
|
|
2289
2299
|
if (g.startsWith("#"))
|
|
2290
2300
|
m = g;
|
|
2291
2301
|
else {
|
|
2292
2302
|
const f = g.match(/rgba?\(([^)]+)\)/);
|
|
2293
2303
|
if (f) {
|
|
2294
|
-
const
|
|
2295
|
-
m = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`,
|
|
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);
|
|
2296
2306
|
}
|
|
2297
2307
|
}
|
|
2298
2308
|
if (m) {
|
|
2299
2309
|
const f = u.length === 1 ? 0 : Math.round(C / (u.length - 1) * 100);
|
|
2300
|
-
|
|
2310
|
+
d.push({
|
|
2301
2311
|
color: m,
|
|
2302
2312
|
position: f,
|
|
2303
|
-
opacity:
|
|
2313
|
+
opacity: y
|
|
2304
2314
|
});
|
|
2305
2315
|
}
|
|
2306
2316
|
});
|
|
2307
2317
|
}
|
|
2308
|
-
return console.log("Color stops found:",
|
|
2318
|
+
return console.log("Color stops found:", d), {
|
|
2309
2319
|
type: "linear",
|
|
2310
2320
|
angle: o,
|
|
2311
|
-
stops:
|
|
2321
|
+
stops: d
|
|
2312
2322
|
};
|
|
2313
2323
|
}
|
|
2314
2324
|
}
|
|
@@ -2347,10 +2357,10 @@ class Pt {
|
|
|
2347
2357
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2348
2358
|
const c = document.createElement("div");
|
|
2349
2359
|
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2350
|
-
const h = document.createElement("div");
|
|
2351
|
-
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2352
2360
|
const d = document.createElement("div");
|
|
2353
|
-
d.className = "color-picker-opacity
|
|
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);
|
|
2354
2364
|
const u = document.createElement("div");
|
|
2355
2365
|
u.className = "color-picker-format-section";
|
|
2356
2366
|
const g = document.createElement("select");
|
|
@@ -2359,14 +2369,14 @@ class Pt {
|
|
|
2359
2369
|
C.value = "hex", C.textContent = "HEX";
|
|
2360
2370
|
const m = document.createElement("option");
|
|
2361
2371
|
m.value = "rgb", m.textContent = "RGB";
|
|
2362
|
-
const
|
|
2363
|
-
|
|
2372
|
+
const y = document.createElement("option");
|
|
2373
|
+
y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
|
|
2364
2374
|
const f = document.createElement("input");
|
|
2365
2375
|
f.type = "text", f.className = "color-picker-color-input", f.value = this.currentColor, this.hexInput = f;
|
|
2366
|
-
const
|
|
2367
|
-
|
|
2376
|
+
const E = document.createElement("div");
|
|
2377
|
+
E.className = "color-picker-input-container";
|
|
2368
2378
|
const V = document.createElement("button");
|
|
2369
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()),
|
|
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) => {
|
|
2370
2380
|
A.stopPropagation();
|
|
2371
2381
|
}), t;
|
|
2372
2382
|
}
|
|
@@ -2553,21 +2563,21 @@ class Pt {
|
|
|
2553
2563
|
}
|
|
2554
2564
|
makeDraggable(t, e) {
|
|
2555
2565
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2556
|
-
const l = (
|
|
2557
|
-
if (
|
|
2566
|
+
const l = (d) => {
|
|
2567
|
+
if (d.target.closest("button"))
|
|
2558
2568
|
return;
|
|
2559
|
-
|
|
2560
|
-
const
|
|
2561
|
-
o =
|
|
2562
|
-
}, 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) => {
|
|
2563
2573
|
if (!i) return;
|
|
2564
|
-
|
|
2565
|
-
const
|
|
2566
|
-
let g = o +
|
|
2567
|
-
const m = window.innerWidth,
|
|
2568
|
-
g = Math.max(8, Math.min(m - f - 8, g)), C = Math.max(8, Math.min(
|
|
2569
|
-
}, c = (
|
|
2570
|
-
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 = "");
|
|
2571
2581
|
};
|
|
2572
2582
|
t.addEventListener("mousedown", l);
|
|
2573
2583
|
}
|
|
@@ -2861,14 +2871,14 @@ class se extends I {
|
|
|
2861
2871
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2862
2872
|
}
|
|
2863
2873
|
createSolidEditor(t) {
|
|
2864
|
-
var o, a, l, r, c,
|
|
2874
|
+
var o, a, l, r, c, d;
|
|
2865
2875
|
const e = document.createElement("div");
|
|
2866
2876
|
e.className = "gradient-solid-picker embedded-color-picker";
|
|
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 = ((
|
|
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(
|
|
2868
2878
|
i,
|
|
2869
2879
|
s,
|
|
2870
|
-
(
|
|
2871
|
-
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());
|
|
2872
2882
|
}
|
|
2873
2883
|
);
|
|
2874
2884
|
e.appendChild(n), t.appendChild(e);
|
|
@@ -2890,10 +2900,10 @@ class se extends I {
|
|
|
2890
2900
|
r.className = "color-picker-hue embedded";
|
|
2891
2901
|
const c = document.createElement("div");
|
|
2892
2902
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2893
|
-
const h = document.createElement("div");
|
|
2894
|
-
h.className = "color-picker-opacity embedded";
|
|
2895
2903
|
const d = document.createElement("div");
|
|
2896
|
-
d.className = "color-picker-opacity
|
|
2904
|
+
d.className = "color-picker-opacity embedded";
|
|
2905
|
+
const h = document.createElement("div");
|
|
2906
|
+
h.className = "color-picker-opacity-marker", d.appendChild(h);
|
|
2897
2907
|
const u = document.createElement("div");
|
|
2898
2908
|
u.className = "color-picker-format-section embedded";
|
|
2899
2909
|
const g = document.createElement("select");
|
|
@@ -2902,14 +2912,14 @@ class se extends I {
|
|
|
2902
2912
|
C.value = "hex", C.textContent = "HEX";
|
|
2903
2913
|
const m = document.createElement("option");
|
|
2904
2914
|
m.value = "rgb", m.textContent = "RGB";
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2915
|
+
const y = document.createElement("option");
|
|
2916
|
+
y.value = "hsl", y.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(y);
|
|
2907
2917
|
const f = document.createElement("input");
|
|
2908
2918
|
f.type = "text", f.className = "color-picker-color-input", f.value = t;
|
|
2909
|
-
const
|
|
2910
|
-
|
|
2919
|
+
const E = document.createElement("div");
|
|
2920
|
+
E.className = "color-picker-input-container";
|
|
2911
2921
|
const V = document.createElement("button");
|
|
2912
|
-
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(
|
|
2913
2923
|
n,
|
|
2914
2924
|
o,
|
|
2915
2925
|
r,
|
|
@@ -2922,8 +2932,8 @@ class se extends I {
|
|
|
2922
2932
|
e,
|
|
2923
2933
|
i
|
|
2924
2934
|
), this.setupOpacitySlider(
|
|
2925
|
-
h,
|
|
2926
2935
|
d,
|
|
2936
|
+
h,
|
|
2927
2937
|
t,
|
|
2928
2938
|
e,
|
|
2929
2939
|
i
|
|
@@ -2946,27 +2956,27 @@ class se extends I {
|
|
|
2946
2956
|
r.className = "color-picker-hue embedded";
|
|
2947
2957
|
const c = document.createElement("div");
|
|
2948
2958
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2951
|
-
const
|
|
2952
|
-
|
|
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";
|
|
2953
2963
|
const u = document.createElement("option");
|
|
2954
2964
|
u.value = "hex", u.textContent = "HEX";
|
|
2955
2965
|
const g = document.createElement("option");
|
|
2956
2966
|
g.value = "rgb", g.textContent = "RGB";
|
|
2957
2967
|
const C = document.createElement("option");
|
|
2958
|
-
C.value = "hsl", C.textContent = "HSL",
|
|
2968
|
+
C.value = "hsl", C.textContent = "HSL", h.appendChild(u), h.appendChild(g), h.appendChild(C);
|
|
2959
2969
|
const m = document.createElement("input");
|
|
2960
2970
|
m.type = "text", m.className = "color-picker-color-input", m.value = t;
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2971
|
+
const y = document.createElement("div");
|
|
2972
|
+
y.className = "color-picker-input-container";
|
|
2963
2973
|
const f = document.createElement("button");
|
|
2964
|
-
return f.className = "color-picker-copy-inside", f.textContent = "Copy",
|
|
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(
|
|
2965
2975
|
n,
|
|
2966
2976
|
o,
|
|
2967
2977
|
r,
|
|
2968
2978
|
c,
|
|
2969
|
-
|
|
2979
|
+
h,
|
|
2970
2980
|
m,
|
|
2971
2981
|
f,
|
|
2972
2982
|
l,
|
|
@@ -2975,39 +2985,39 @@ class se extends I {
|
|
|
2975
2985
|
i
|
|
2976
2986
|
), s;
|
|
2977
2987
|
}
|
|
2978
|
-
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c,
|
|
2979
|
-
let
|
|
2988
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, d) {
|
|
2989
|
+
let h = r;
|
|
2980
2990
|
const { h: u, s: g, v: C } = this.hexToHsv(r);
|
|
2981
2991
|
let m = c;
|
|
2982
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%))`;
|
|
2983
|
-
const
|
|
2984
|
-
|
|
2993
|
+
const y = (v, w = m) => {
|
|
2994
|
+
h = v, m = Math.round(w), f(), d(v, m);
|
|
2985
2995
|
}, f = () => {
|
|
2986
|
-
const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(
|
|
2996
|
+
const v = n.value, { h: w, s: x, v: k } = this.hexToHsv(h);
|
|
2987
2997
|
switch (v) {
|
|
2988
2998
|
case "hex":
|
|
2989
|
-
o.value =
|
|
2999
|
+
o.value = h;
|
|
2990
3000
|
break;
|
|
2991
3001
|
case "rgb":
|
|
2992
|
-
const { r:
|
|
2993
|
-
o.value = `rgb(${
|
|
3002
|
+
const { r: H, g: $, b: W } = this.hexToRgb(h);
|
|
3003
|
+
o.value = `rgb(${H}, ${$}, ${W})`;
|
|
2994
3004
|
break;
|
|
2995
3005
|
case "hsl":
|
|
2996
|
-
const { hue: F, sat:
|
|
3006
|
+
const { hue: F, sat: q, lightness: K } = this.hsvToHsl(w, x, k);
|
|
2997
3007
|
o.value = `hsl(${Math.round(F)}, ${Math.round(
|
|
2998
|
-
|
|
3008
|
+
q * 100
|
|
2999
3009
|
)}%, ${Math.round(K * 100)}%)`;
|
|
3000
3010
|
break;
|
|
3001
3011
|
}
|
|
3002
|
-
},
|
|
3003
|
-
const x =
|
|
3004
|
-
|
|
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);
|
|
3005
3015
|
}, A = (v) => {
|
|
3006
3016
|
v = Math.max(0.1, Math.min(358.9, v));
|
|
3007
3017
|
const w = parseFloat(e.style.left || "50%") / 100, x = parseFloat(e.style.top || "50%") / 100;
|
|
3008
3018
|
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${v}, 100%, 50%))`;
|
|
3009
|
-
const k = w,
|
|
3010
|
-
|
|
3019
|
+
const k = w, H = 1 - x, $ = this.hsvToHex(v, k, H);
|
|
3020
|
+
y($, m);
|
|
3011
3021
|
}, B = (v) => {
|
|
3012
3022
|
v.stopPropagation();
|
|
3013
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));
|
|
@@ -3037,40 +3047,40 @@ class se extends I {
|
|
|
3037
3047
|
if (x === "hex" && /^#[0-9A-Fa-f]{6}$/.test(w))
|
|
3038
3048
|
k = w;
|
|
3039
3049
|
else if (x === "rgb") {
|
|
3040
|
-
const
|
|
3041
|
-
if (
|
|
3042
|
-
const $ = parseInt(
|
|
3050
|
+
const H = w.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3051
|
+
if (H) {
|
|
3052
|
+
const $ = parseInt(H[1]), W = parseInt(H[2]), F = parseInt(H[3]);
|
|
3043
3053
|
$ <= 255 && W <= 255 && F <= 255 && (k = `#${$.toString(16).padStart(2, "0")}${W.toString(16).padStart(2, "0")}${F.toString(16).padStart(2, "0")}`);
|
|
3044
3054
|
}
|
|
3045
3055
|
} else if (x === "hsl") {
|
|
3046
|
-
const
|
|
3047
|
-
if (
|
|
3048
|
-
const $ = parseInt(
|
|
3056
|
+
const H = w.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3057
|
+
if (H) {
|
|
3058
|
+
const $ = parseInt(H[1]), W = parseInt(H[2]) / 100, F = parseInt(H[3]) / 100;
|
|
3049
3059
|
if ($ <= 360 && W <= 1 && F <= 1) {
|
|
3050
|
-
const
|
|
3051
|
-
k = this.hsvToHex($, K,
|
|
3060
|
+
const q = F + W * Math.min(F, 1 - F), K = q === 0 ? 0 : 2 * (1 - F / q);
|
|
3061
|
+
k = this.hsvToHex($, K, q);
|
|
3052
3062
|
}
|
|
3053
3063
|
}
|
|
3054
3064
|
}
|
|
3055
3065
|
if (k) {
|
|
3056
|
-
const { h:
|
|
3057
|
-
s.style.left = `${
|
|
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);
|
|
3058
3068
|
}
|
|
3059
3069
|
}, O = (v) => {
|
|
3060
3070
|
f();
|
|
3061
|
-
},
|
|
3071
|
+
}, T = () => {
|
|
3062
3072
|
f();
|
|
3063
3073
|
}, S = () => {
|
|
3064
3074
|
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3065
3075
|
o.select(), document.execCommand("copy");
|
|
3066
3076
|
});
|
|
3067
3077
|
};
|
|
3068
|
-
f(), t.addEventListener("mousedown", L), t.addEventListener("click", B), i.addEventListener("mousedown", M), i.addEventListener("click", b), n.addEventListener("change",
|
|
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);
|
|
3069
3079
|
const D = async () => {
|
|
3070
3080
|
if ("EyeDropper" in window)
|
|
3071
3081
|
try {
|
|
3072
|
-
const x = (await new window.EyeDropper().open()).sRGBHex, { h: k, s:
|
|
3073
|
-
s.style.left = `${k / 360 * 100}%`, e.style.left = `${
|
|
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);
|
|
3074
3084
|
} catch (v) {
|
|
3075
3085
|
console.log("User cancelled eyedropper or error occurred:", v);
|
|
3076
3086
|
}
|
|
@@ -3088,15 +3098,15 @@ class se extends I {
|
|
|
3088
3098
|
}
|
|
3089
3099
|
setupOpacitySlider(t, e, i, s, n) {
|
|
3090
3100
|
const o = () => {
|
|
3091
|
-
const { r: c, g:
|
|
3092
|
-
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}`);
|
|
3093
3103
|
}, a = () => {
|
|
3094
3104
|
e.style.left = `${s}%`;
|
|
3095
3105
|
};
|
|
3096
3106
|
o(), a();
|
|
3097
3107
|
let l = !1;
|
|
3098
3108
|
const r = (c) => {
|
|
3099
|
-
const
|
|
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);
|
|
3100
3110
|
s = g, a(), n(i, g);
|
|
3101
3111
|
};
|
|
3102
3112
|
t.addEventListener("mousedown", (c) => {
|
|
@@ -3137,22 +3147,22 @@ class se extends I {
|
|
|
3137
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"/>
|
|
3138
3148
|
</svg>
|
|
3139
3149
|
`, l.title = "Flip gradient", i.addEventListener("change", (m) => {
|
|
3140
|
-
const
|
|
3141
|
-
this.switchType(
|
|
3150
|
+
const y = m.target.value;
|
|
3151
|
+
this.switchType(y === "radial" ? "radial" : "linear");
|
|
3142
3152
|
}), o.addEventListener("input", (m) => {
|
|
3143
|
-
const
|
|
3153
|
+
const y = m.target.value, f = parseInt(y);
|
|
3144
3154
|
if (this.value && !isNaN(f)) {
|
|
3145
|
-
const
|
|
3146
|
-
this.value.angle =
|
|
3155
|
+
const E = Math.max(0, Math.min(360, f));
|
|
3156
|
+
this.value.angle = E, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3147
3157
|
}
|
|
3148
3158
|
}), o.addEventListener("focus", (m) => {
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3159
|
+
const y = m.target;
|
|
3160
|
+
y.value = y.value.replace(/[^0-9-]/g, ""), setTimeout(() => y.select(), 0);
|
|
3151
3161
|
}), o.addEventListener("blur", (m) => {
|
|
3152
|
-
var
|
|
3153
|
-
const
|
|
3154
|
-
let f = parseInt(
|
|
3155
|
-
isNaN(f) && (f = ((
|
|
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();
|
|
3156
3166
|
}), l.addEventListener("click", () => {
|
|
3157
3167
|
this.value && (this.value.stops = this.value.stops.map((m) => ({
|
|
3158
3168
|
...m,
|
|
@@ -3164,17 +3174,17 @@ class se extends I {
|
|
|
3164
3174
|
})();
|
|
3165
3175
|
const c = document.createElement("div");
|
|
3166
3176
|
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3167
|
-
const h = document.createElement("div");
|
|
3168
|
-
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3169
3177
|
const d = document.createElement("div");
|
|
3170
|
-
d.className = "gradient-
|
|
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";
|
|
3171
3181
|
const u = document.createElement("span");
|
|
3172
3182
|
u.textContent = "Stops";
|
|
3173
3183
|
const g = document.createElement("button");
|
|
3174
|
-
g.type = "button", g.className = "gradient-add-stop", g.textContent = "+",
|
|
3184
|
+
g.type = "button", g.className = "gradient-add-stop", g.textContent = "+", h.appendChild(u), h.appendChild(g);
|
|
3175
3185
|
const C = document.createElement("div");
|
|
3176
|
-
C.className = "gradient-stops", t.appendChild(
|
|
3177
|
-
this.addGradientStop(), this.updateStopsList(C), this.updateGradientPreview(c), this.createGradientHandles(
|
|
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();
|
|
3178
3188
|
});
|
|
3179
3189
|
}
|
|
3180
3190
|
updateGradientPreview(t) {
|
|
@@ -3192,21 +3202,21 @@ class se extends I {
|
|
|
3192
3202
|
}
|
|
3193
3203
|
makeDraggable(t, e, i) {
|
|
3194
3204
|
let s = !1, n = 0, o = 0, a = null;
|
|
3195
|
-
const l = (
|
|
3205
|
+
const l = (h) => "touches" in h && h.touches.length > 0 ? h.touches[0].clientX : h.clientX, r = (h) => {
|
|
3196
3206
|
var u, g, C;
|
|
3197
|
-
s = !0, n = l(
|
|
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, {
|
|
3198
3208
|
passive: !1
|
|
3199
|
-
}), document.addEventListener("touchend",
|
|
3200
|
-
}, c = (
|
|
3201
|
-
var
|
|
3202
|
-
if (!s || !((f = (
|
|
3203
|
-
const u = e.getBoundingClientRect(), C = (l(
|
|
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;
|
|
3204
3214
|
let m = o + C;
|
|
3205
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(() => {
|
|
3206
3216
|
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3207
|
-
}),
|
|
3208
|
-
},
|
|
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",
|
|
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));
|
|
3210
3220
|
};
|
|
3211
3221
|
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3212
3222
|
passive: !1
|
|
@@ -3227,12 +3237,12 @@ class se extends I {
|
|
|
3227
3237
|
r.className = "gstop-color-container";
|
|
3228
3238
|
const c = document.createElement("div");
|
|
3229
3239
|
c.className = "gstop-color-preview", c.style.backgroundColor = s.color;
|
|
3230
|
-
const
|
|
3231
|
-
|
|
3232
|
-
const
|
|
3233
|
-
|
|
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">
|
|
3234
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"/>
|
|
3235
|
-
</svg>`, r.appendChild(c), r.appendChild(
|
|
3245
|
+
</svg>`, r.appendChild(c), r.appendChild(d), r.appendChild(h);
|
|
3236
3246
|
const u = document.createElement("button");
|
|
3237
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">
|
|
3238
3248
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -3240,8 +3250,8 @@ class se extends I {
|
|
|
3240
3250
|
var O;
|
|
3241
3251
|
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3242
3252
|
if (this.value && !isNaN(P)) {
|
|
3243
|
-
const
|
|
3244
|
-
this.value.stops[n].position =
|
|
3253
|
+
const T = Math.max(0, Math.min(100, P));
|
|
3254
|
+
this.value.stops[n].position = T, b.value = `${T}%`;
|
|
3245
3255
|
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3246
3256
|
".gradient-preview"
|
|
3247
3257
|
), D = S == null ? void 0 : S.querySelector(
|
|
@@ -3253,10 +3263,10 @@ class se extends I {
|
|
|
3253
3263
|
const b = L.target, M = b.value.replace("%", "");
|
|
3254
3264
|
b.value = M, b.select();
|
|
3255
3265
|
}), l.addEventListener("blur", (L) => {
|
|
3256
|
-
var O,
|
|
3266
|
+
var O, T;
|
|
3257
3267
|
const b = L.target, M = b.value.replace(/[^\d]/g, ""), P = parseInt(M);
|
|
3258
3268
|
if (isNaN(P))
|
|
3259
|
-
b.value = `${((
|
|
3269
|
+
b.value = `${((T = (O = this.value) == null ? void 0 : O.stops[n]) == null ? void 0 : T.position) || 0}%`;
|
|
3260
3270
|
else {
|
|
3261
3271
|
const S = Math.max(0, Math.min(100, P));
|
|
3262
3272
|
b.value = `${S}%`, this.value && (this.value.stops[n].position = S, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
@@ -3265,14 +3275,14 @@ class se extends I {
|
|
|
3265
3275
|
const g = new Pt(
|
|
3266
3276
|
(L, b) => {
|
|
3267
3277
|
var M, P, O;
|
|
3268
|
-
if (
|
|
3278
|
+
if (d.value = L.replace("#", "").toUpperCase(), c.style.backgroundColor = L, this.value) {
|
|
3269
3279
|
this.value.stops[n].color = L, b !== void 0 && (this.value.stops[n].opacity = b);
|
|
3270
|
-
const
|
|
3280
|
+
const T = (M = o.parentElement) == null ? void 0 : M.querySelector(
|
|
3271
3281
|
".gstop-opacity-slider"
|
|
3272
3282
|
);
|
|
3273
|
-
if (
|
|
3283
|
+
if (T) {
|
|
3274
3284
|
const v = this.hexToRgb(L);
|
|
3275
|
-
|
|
3285
|
+
T.style.setProperty(
|
|
3276
3286
|
"--slider-color",
|
|
3277
3287
|
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3278
3288
|
);
|
|
@@ -3281,7 +3291,7 @@ class se extends I {
|
|
|
3281
3291
|
const v = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3282
3292
|
".gstop-opacity-value"
|
|
3283
3293
|
);
|
|
3284
|
-
v && (v.textContent = `${b}%`),
|
|
3294
|
+
v && (v.textContent = `${b}%`), T && (T.value = b.toString());
|
|
3285
3295
|
}
|
|
3286
3296
|
const S = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3287
3297
|
".gradient-preview"
|
|
@@ -3292,19 +3302,19 @@ class se extends I {
|
|
|
3292
3302
|
}
|
|
3293
3303
|
}
|
|
3294
3304
|
);
|
|
3295
|
-
|
|
3296
|
-
L.stopPropagation(), g.open(s.color,
|
|
3297
|
-
}),
|
|
3305
|
+
d.addEventListener("click", (L) => {
|
|
3306
|
+
L.stopPropagation(), g.open(s.color, d, s.opacity || 100);
|
|
3307
|
+
}), d.addEventListener("input", (L) => {
|
|
3298
3308
|
var P, O;
|
|
3299
3309
|
const b = L.target.value.trim(), M = b.startsWith("#") ? b : `#${b}`;
|
|
3300
3310
|
if (/^#[0-9A-Fa-f]{6}$/.test(M) && (c.style.backgroundColor = M, this.value)) {
|
|
3301
3311
|
this.value.stops[n].color = M;
|
|
3302
|
-
const
|
|
3312
|
+
const T = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3303
3313
|
".gstop-opacity-slider"
|
|
3304
3314
|
);
|
|
3305
|
-
if (
|
|
3315
|
+
if (T) {
|
|
3306
3316
|
const v = this.hexToRgb(M);
|
|
3307
|
-
|
|
3317
|
+
T.style.setProperty(
|
|
3308
3318
|
"--slider-color",
|
|
3309
3319
|
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3310
3320
|
);
|
|
@@ -3316,16 +3326,16 @@ class se extends I {
|
|
|
3316
3326
|
);
|
|
3317
3327
|
S && D && this.createGradientHandles(D, S), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3318
3328
|
}
|
|
3319
|
-
}),
|
|
3329
|
+
}), h.addEventListener("click", async (L) => {
|
|
3320
3330
|
L.stopPropagation();
|
|
3321
|
-
const b = `#${
|
|
3331
|
+
const b = `#${d.value}`;
|
|
3322
3332
|
try {
|
|
3323
3333
|
await navigator.clipboard.writeText(b);
|
|
3324
|
-
const M =
|
|
3325
|
-
|
|
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">
|
|
3326
3336
|
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3327
3337
|
</svg>`, setTimeout(() => {
|
|
3328
|
-
|
|
3338
|
+
h.innerHTML = M;
|
|
3329
3339
|
}, 1e3);
|
|
3330
3340
|
} catch (M) {
|
|
3331
3341
|
console.warn("Failed to copy color to clipboard:", M);
|
|
@@ -3346,14 +3356,14 @@ class se extends I {
|
|
|
3346
3356
|
C.className = "gstop-opacity-row";
|
|
3347
3357
|
const m = document.createElement("span");
|
|
3348
3358
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3349
|
-
const
|
|
3350
|
-
|
|
3359
|
+
const y = document.createElement("div");
|
|
3360
|
+
y.className = "gstop-opacity-group";
|
|
3351
3361
|
const f = document.createElement("input");
|
|
3352
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();
|
|
3353
|
-
const
|
|
3363
|
+
const E = this.hexToRgb(s.color);
|
|
3354
3364
|
f.style.setProperty(
|
|
3355
3365
|
"--slider-color",
|
|
3356
|
-
`rgb(${
|
|
3366
|
+
`rgb(${E.r}, ${E.g}, ${E.b})`
|
|
3357
3367
|
);
|
|
3358
3368
|
const V = document.createElement("span");
|
|
3359
3369
|
V.className = "gstop-opacity-value", V.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
@@ -3468,8 +3478,8 @@ class se extends I {
|
|
|
3468
3478
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3469
3479
|
);
|
|
3470
3480
|
if (s) {
|
|
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:
|
|
3472
|
-
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) };
|
|
3473
3483
|
}
|
|
3474
3484
|
return { color: e, position: 0, opacity: 100 };
|
|
3475
3485
|
}
|
|
@@ -3581,8 +3591,8 @@ class se extends I {
|
|
|
3581
3591
|
let o = "", a = 0;
|
|
3582
3592
|
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3583
3593
|
if (l) {
|
|
3584
|
-
const c = l[1].trim(),
|
|
3585
|
-
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);
|
|
3586
3596
|
} else
|
|
3587
3597
|
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3588
3598
|
const r = this.parseColorWithOpacity(o);
|
|
@@ -3756,7 +3766,7 @@ class oe extends z {
|
|
|
3756
3766
|
`;
|
|
3757
3767
|
}
|
|
3758
3768
|
}
|
|
3759
|
-
class
|
|
3769
|
+
class Z extends I {
|
|
3760
3770
|
constructor(t) {
|
|
3761
3771
|
super({
|
|
3762
3772
|
...t,
|
|
@@ -3808,25 +3818,25 @@ class ae extends z {
|
|
|
3808
3818
|
title: "Margins",
|
|
3809
3819
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3810
3820
|
settings: {
|
|
3811
|
-
marginTop: new
|
|
3821
|
+
marginTop: new Z({
|
|
3812
3822
|
title: "Top",
|
|
3813
3823
|
icon: Ft,
|
|
3814
3824
|
suffix: "px",
|
|
3815
3825
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3816
3826
|
}),
|
|
3817
|
-
marginRight: new
|
|
3827
|
+
marginRight: new Z({
|
|
3818
3828
|
title: "Right",
|
|
3819
3829
|
icon: Rt,
|
|
3820
3830
|
suffix: "px",
|
|
3821
3831
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3822
3832
|
}),
|
|
3823
|
-
marginBottom: new
|
|
3833
|
+
marginBottom: new Z({
|
|
3824
3834
|
title: "Bottom",
|
|
3825
3835
|
icon: Gt,
|
|
3826
3836
|
suffix: "px",
|
|
3827
3837
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3828
3838
|
}),
|
|
3829
|
-
marginLeft: new
|
|
3839
|
+
marginLeft: new Z({
|
|
3830
3840
|
title: "Left",
|
|
3831
3841
|
icon: Wt,
|
|
3832
3842
|
suffix: "px",
|
|
@@ -3864,7 +3874,7 @@ class le extends z {
|
|
|
3864
3874
|
...t == null ? void 0 : t.uploadProps,
|
|
3865
3875
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3866
3876
|
}),
|
|
3867
|
-
opacity: new
|
|
3877
|
+
opacity: new yt({
|
|
3868
3878
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3869
3879
|
}),
|
|
3870
3880
|
backgroundColor: new U({
|
|
@@ -3912,7 +3922,7 @@ export {
|
|
|
3912
3922
|
te as MarginTopSetting,
|
|
3913
3923
|
ee as MultiLanguageSetting,
|
|
3914
3924
|
G as NumberSetting,
|
|
3915
|
-
|
|
3925
|
+
yt as OpacitySetting,
|
|
3916
3926
|
Xt as SelectApiSettings,
|
|
3917
3927
|
et as SelectSetting,
|
|
3918
3928
|
I as Setting,
|
|
@@ -3929,5 +3939,5 @@ export {
|
|
|
3929
3939
|
j as isSetting,
|
|
3930
3940
|
st as isSettingChild,
|
|
3931
3941
|
N as isSettingGroup,
|
|
3932
|
-
|
|
3942
|
+
J as iterateSettings
|
|
3933
3943
|
};
|