builder-settings-types 0.0.258 → 0.0.261
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const rt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let ot = (p = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(p |= 0));
|
|
4
4
|
for (; p--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += rt[e[p] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function ct(p) {
|
|
9
9
|
let t = 0, e = p.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
11
|
e.classList.contains("setting-group") && e !== p && t++, e = e.parentElement;
|
|
@@ -21,7 +21,7 @@ function tt(p, t = 0) {
|
|
|
21
21
|
Z(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,
|
|
@@ -29,7 +29,7 @@ const ct = {
|
|
|
29
29
|
};
|
|
30
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
|
|
@@ -63,7 +63,7 @@ class ht {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = ct(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -124,7 +124,7 @@ function X(p) {
|
|
|
124
124
|
}
|
|
125
125
|
return p;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function pt(p) {
|
|
128
128
|
switch (p) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
@@ -144,7 +144,7 @@ function dt(p) {
|
|
|
144
144
|
}
|
|
145
145
|
class S {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || ot(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
150
|
globalThis.DefaultUploadUrl = t, S.DefaultUploadUrl = t;
|
|
@@ -192,7 +192,7 @@ class S {
|
|
|
192
192
|
const i = document.createElement("div");
|
|
193
193
|
i.className = t.wrapperClassName || "";
|
|
194
194
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
195
|
+
this.inputEl = s, s.value = String(t.value || pt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
196
|
const n = (a) => {
|
|
197
197
|
const l = a.target;
|
|
198
198
|
let r = l.value;
|
|
@@ -252,7 +252,7 @@ function q(p, t) {
|
|
|
252
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 ||
|
|
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();
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
@@ -344,7 +344,7 @@ const Y = class Y {
|
|
|
344
344
|
addItem: this.addItemCfg,
|
|
345
345
|
deleteItem: this.deleteItemCfg,
|
|
346
346
|
dataProps: this.dataProps
|
|
347
|
-
}, i =
|
|
347
|
+
}, i = gt(e);
|
|
348
348
|
return i.initialValues = this.getValues(), i;
|
|
349
349
|
}
|
|
350
350
|
resetDefault() {
|
|
@@ -449,8 +449,8 @@ const Y = class Y {
|
|
|
449
449
|
N(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
450
450
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
451
451
|
if (l) {
|
|
452
|
-
const
|
|
453
|
-
|
|
452
|
+
const d = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
453
|
+
d && t.startsWith(d) && this.addDeleteButtonToElement(a, t);
|
|
454
454
|
}
|
|
455
455
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
456
456
|
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), Z(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
@@ -602,11 +602,11 @@ const Y = class Y {
|
|
|
602
602
|
r(), t(!1);
|
|
603
603
|
}), l.addEventListener("click", () => {
|
|
604
604
|
r(), t(!0);
|
|
605
|
-
}), e.addEventListener("click", (
|
|
606
|
-
|
|
605
|
+
}), e.addEventListener("click", (d) => {
|
|
606
|
+
d.target === e && (r(), t(!1));
|
|
607
607
|
});
|
|
608
|
-
const c = (
|
|
609
|
-
|
|
608
|
+
const c = (d) => {
|
|
609
|
+
d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
610
610
|
};
|
|
611
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(() => {
|
|
612
612
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -734,14 +734,14 @@ const Y = class Y {
|
|
|
734
734
|
}, Object.keys(this.settings).length > 0) {
|
|
735
735
|
for (const c in this.settings)
|
|
736
736
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
737
|
-
const
|
|
738
|
-
N(
|
|
739
|
-
const
|
|
740
|
-
N(
|
|
741
|
-
|
|
737
|
+
const d = this.settings[c];
|
|
738
|
+
N(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
|
|
739
|
+
const h = d.draw();
|
|
740
|
+
N(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
|
|
741
|
+
h,
|
|
742
742
|
c,
|
|
743
|
-
|
|
744
|
-
), a.appendChild(
|
|
743
|
+
d
|
|
744
|
+
), a.appendChild(h);
|
|
745
745
|
}
|
|
746
746
|
} else {
|
|
747
747
|
const c = document.createElement("div");
|
|
@@ -750,14 +750,14 @@ const Y = class Y {
|
|
|
750
750
|
if (this.addItemCfg) {
|
|
751
751
|
const c = document.createElement("button");
|
|
752
752
|
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
753
|
-
const
|
|
753
|
+
const d = `
|
|
754
754
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
755
755
|
xmlns="http://www.w3.org/2000/svg">
|
|
756
756
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
757
757
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
758
758
|
</svg>`;
|
|
759
|
-
c.innerHTML = `${
|
|
760
|
-
|
|
759
|
+
c.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (h) => {
|
|
760
|
+
h.stopPropagation(), h.preventDefault();
|
|
761
761
|
const m = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), u = this.addItemCfg.createItem(m);
|
|
762
762
|
if (st(u)) {
|
|
763
763
|
const g = `${this.addItemCfg.keyPrefix}${m}`;
|
|
@@ -810,9 +810,9 @@ const Y = class Y {
|
|
|
810
810
|
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
811
811
|
let G = Y;
|
|
812
812
|
function Ut(p) {
|
|
813
|
-
return new
|
|
813
|
+
return new ut(p);
|
|
814
814
|
}
|
|
815
|
-
class
|
|
815
|
+
class ut extends G {
|
|
816
816
|
constructor(t) {
|
|
817
817
|
super(t);
|
|
818
818
|
const e = Object.keys(this.settings)[0];
|
|
@@ -852,9 +852,9 @@ class pt extends G {
|
|
|
852
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);
|
|
853
853
|
const c = document.createElement("div");
|
|
854
854
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
855
|
+
const d = this.settings[a];
|
|
856
|
+
d && (N(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
857
|
+
d.draw()
|
|
858
858
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
859
859
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
860
860
|
const a = Object.keys(this.settings)[0];
|
|
@@ -863,13 +863,13 @@ class pt extends G {
|
|
|
863
863
|
return this.updateTabUI(), t;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function gt(p) {
|
|
867
867
|
return new G(p);
|
|
868
868
|
}
|
|
869
869
|
function jt(p) {
|
|
870
870
|
return p;
|
|
871
871
|
}
|
|
872
|
-
class
|
|
872
|
+
class mt extends S {
|
|
873
873
|
constructor(t = {}) {
|
|
874
874
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
875
875
|
}
|
|
@@ -889,18 +889,18 @@ class gt extends S {
|
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
const
|
|
893
|
-
class
|
|
892
|
+
const ft = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
893
|
+
class F extends mt {
|
|
894
894
|
constructor(t) {
|
|
895
895
|
super({
|
|
896
896
|
...t,
|
|
897
|
-
icon: t.icon ||
|
|
897
|
+
icon: t.icon || ft,
|
|
898
898
|
title: t.title || "Color",
|
|
899
|
-
default: t.default ?
|
|
899
|
+
default: t.default ? F.normalizeColorValue(t.default) : "#000000"
|
|
900
900
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
901
901
|
}
|
|
902
902
|
static normalizeColorValue(t) {
|
|
903
|
-
return t.startsWith("#") ?
|
|
903
|
+
return t.startsWith("#") ? F.normalizeHexValue(t) : t.includes(",") ? F.rgbToHexStatic(t) : F.normalizeHexValue(t);
|
|
904
904
|
}
|
|
905
905
|
static normalizeHexValue(t) {
|
|
906
906
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
@@ -910,8 +910,8 @@ class D extends gt {
|
|
|
910
910
|
if (e.length !== 3 || e.some(isNaN))
|
|
911
911
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
912
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) => {
|
|
913
|
-
const
|
|
914
|
-
return
|
|
913
|
+
const d = c.toString(16);
|
|
914
|
+
return d.length === 1 ? "0" + d : d;
|
|
915
915
|
};
|
|
916
916
|
return `#${r(o)}${r(a)}${r(l)}`;
|
|
917
917
|
}
|
|
@@ -921,7 +921,7 @@ class D extends gt {
|
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
923
|
if (typeof t == "string") {
|
|
924
|
-
const e =
|
|
924
|
+
const e = F.normalizeColorValue(t);
|
|
925
925
|
this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
|
|
926
926
|
} else
|
|
927
927
|
this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
|
|
@@ -951,8 +951,8 @@ class D extends gt {
|
|
|
951
951
|
const r = l.value.trim();
|
|
952
952
|
if (!r)
|
|
953
953
|
return e.classList.remove("error"), !0;
|
|
954
|
-
const
|
|
955
|
-
return
|
|
954
|
+
const d = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
955
|
+
return d ? e.classList.remove("error") : e.classList.add("error"), d;
|
|
956
956
|
}, s = document.createElement("input");
|
|
957
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;
|
|
958
958
|
const n = document.createElement("div");
|
|
@@ -961,20 +961,20 @@ class D extends gt {
|
|
|
961
961
|
n.style.backgroundColor = o;
|
|
962
962
|
const a = document.createElement("input");
|
|
963
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) => {
|
|
964
|
-
var c,
|
|
964
|
+
var c, d;
|
|
965
965
|
let r = l.target.value.trim();
|
|
966
966
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
967
|
-
const
|
|
968
|
-
this.value =
|
|
967
|
+
const h = F.normalizeColorValue(r);
|
|
968
|
+
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
969
|
}
|
|
970
970
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
971
|
-
var
|
|
972
|
-
const r = l.target.value, c =
|
|
973
|
-
this.value = c, (
|
|
971
|
+
var d, h;
|
|
972
|
+
const r = l.target.value, c = F.normalizeColorValue(r);
|
|
973
|
+
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
974
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
975
|
-
var
|
|
976
|
-
const r = l.target.value, c =
|
|
977
|
-
this.value = c, (
|
|
975
|
+
var d, h;
|
|
976
|
+
const r = l.target.value, c = F.normalizeColorValue(r);
|
|
977
|
+
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
978
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
979
979
|
}
|
|
980
980
|
getElement() {
|
|
@@ -982,7 +982,7 @@ class D extends gt {
|
|
|
982
982
|
}
|
|
983
983
|
// Helper method to get normalized hex value
|
|
984
984
|
getNormalizedValue() {
|
|
985
|
-
return this.value ?
|
|
985
|
+
return this.value ? F.normalizeColorValue(this.value) : "#000000";
|
|
986
986
|
}
|
|
987
987
|
// Helper method to check if current value is valid hex
|
|
988
988
|
isValidHex() {
|
|
@@ -993,7 +993,7 @@ class D extends gt {
|
|
|
993
993
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
|
-
const
|
|
996
|
+
const vt = `
|
|
997
997
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
998
998
|
<path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
999
999
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
@@ -1003,7 +1003,7 @@ class W extends S {
|
|
|
1003
1003
|
constructor(t = {}) {
|
|
1004
1004
|
super({
|
|
1005
1005
|
...t,
|
|
1006
|
-
icon: t.icon ||
|
|
1006
|
+
icon: t.icon || vt,
|
|
1007
1007
|
title: t.title || "Color & Opacity",
|
|
1008
1008
|
default: t.default || "#000000FF"
|
|
1009
1009
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = W.normalizeHexWithOpacity(this.value));
|
|
@@ -1153,7 +1153,7 @@ class _t extends S {
|
|
|
1153
1153
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
|
-
class
|
|
1156
|
+
class D extends S {
|
|
1157
1157
|
constructor(t) {
|
|
1158
1158
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1159
1159
|
}
|
|
@@ -1212,12 +1212,12 @@ class F extends S {
|
|
|
1212
1212
|
);
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1215
|
+
const Ct = `
|
|
1216
1216
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1217
1217
|
<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
1218
|
<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
1219
|
</svg>`;
|
|
1220
|
-
class
|
|
1220
|
+
class yt extends D {
|
|
1221
1221
|
constructor(t = {}) {
|
|
1222
1222
|
const e = {
|
|
1223
1223
|
title: "Opacity",
|
|
@@ -1226,7 +1226,7 @@ class Ct extends F {
|
|
|
1226
1226
|
maxValue: 100,
|
|
1227
1227
|
step: 1,
|
|
1228
1228
|
default: t.default ?? 100,
|
|
1229
|
-
icon:
|
|
1229
|
+
icon: Ct,
|
|
1230
1230
|
...t
|
|
1231
1231
|
};
|
|
1232
1232
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1356,7 +1356,7 @@ class et extends S {
|
|
|
1356
1356
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
-
class
|
|
1359
|
+
class bt extends S {
|
|
1360
1360
|
constructor(t = {}) {
|
|
1361
1361
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1362
1362
|
}
|
|
@@ -1448,14 +1448,14 @@ class Jt extends S {
|
|
|
1448
1448
|
this.value || (this.value = {
|
|
1449
1449
|
width: e,
|
|
1450
1450
|
height: i
|
|
1451
|
-
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
1451
|
+
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new D({
|
|
1452
1452
|
title: "Width",
|
|
1453
1453
|
default: this.value.width,
|
|
1454
1454
|
suffix: "px",
|
|
1455
1455
|
minValue: this.minWidth,
|
|
1456
1456
|
maxValue: this.maxWidth,
|
|
1457
|
-
icon:
|
|
1458
|
-
}), this.heightSetting = new
|
|
1457
|
+
icon: xt
|
|
1458
|
+
}), this.heightSetting = new D({
|
|
1459
1459
|
title: "Height",
|
|
1460
1460
|
default: this.value.height,
|
|
1461
1461
|
suffix: "px",
|
|
@@ -1555,7 +1555,7 @@ class Jt extends S {
|
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
const
|
|
1558
|
+
const xt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1559
1559
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1560
1560
|
</svg>`, wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1561
1561
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -1563,16 +1563,16 @@ const bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1563
1563
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1564
1564
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1565
1565
|
</svg>
|
|
1566
|
-
`,
|
|
1566
|
+
`, Lt = `
|
|
1567
1567
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1568
1568
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1569
1569
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1570
1570
|
</svg>
|
|
1571
|
-
`,
|
|
1571
|
+
`, kt = `
|
|
1572
1572
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1573
1573
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1574
1574
|
</svg>
|
|
1575
|
-
`,
|
|
1575
|
+
`, Mt = `
|
|
1576
1576
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1577
1577
|
<!-- Top dot -->
|
|
1578
1578
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1592,7 +1592,7 @@ const bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1592
1592
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1593
1593
|
</svg>
|
|
1594
1594
|
`;
|
|
1595
|
-
class
|
|
1595
|
+
class at extends S {
|
|
1596
1596
|
constructor(t = {}) {
|
|
1597
1597
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1598
1598
|
}
|
|
@@ -1689,9 +1689,9 @@ class ot extends S {
|
|
|
1689
1689
|
const s = this.value && this.value !== "";
|
|
1690
1690
|
s || i.classList.add("no-image");
|
|
1691
1691
|
const n = document.createElement("div");
|
|
1692
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1692
|
+
if (n.className = "preview-placeholder", n.innerHTML = Lt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Mt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1693
1693
|
const a = document.createElement("button");
|
|
1694
|
-
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML =
|
|
1694
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = kt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1695
1695
|
var r;
|
|
1696
1696
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1697
1697
|
};
|
|
@@ -1712,14 +1712,14 @@ class ot extends S {
|
|
|
1712
1712
|
}, t;
|
|
1713
1713
|
}
|
|
1714
1714
|
}
|
|
1715
|
-
class Zt extends
|
|
1715
|
+
class Zt extends D {
|
|
1716
1716
|
constructor(t = {}) {
|
|
1717
1717
|
super({
|
|
1718
1718
|
...t,
|
|
1719
1719
|
title: t.title || "Height",
|
|
1720
1720
|
suffix: t.suffix || "px",
|
|
1721
1721
|
minValue: t.minValue ?? 0,
|
|
1722
|
-
icon: t.icon ||
|
|
1722
|
+
icon: t.icon || St,
|
|
1723
1723
|
default: t.default ?? 100
|
|
1724
1724
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1725
1725
|
}
|
|
@@ -1730,17 +1730,17 @@ class Zt extends F {
|
|
|
1730
1730
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
const
|
|
1733
|
+
const St = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1734
1734
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1735
1735
|
</svg>`;
|
|
1736
|
-
class Xt extends
|
|
1736
|
+
class Xt extends D {
|
|
1737
1737
|
constructor(t = {}) {
|
|
1738
1738
|
super({
|
|
1739
1739
|
...t,
|
|
1740
1740
|
title: t.title || "Width",
|
|
1741
1741
|
suffix: t.suffix || "px",
|
|
1742
1742
|
minValue: t.minValue ?? 0,
|
|
1743
|
-
icon: t.icon ||
|
|
1743
|
+
icon: t.icon || It,
|
|
1744
1744
|
default: t.default ?? 100
|
|
1745
1745
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1746
1746
|
}
|
|
@@ -1751,9 +1751,9 @@ class Xt extends F {
|
|
|
1751
1751
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1752
1752
|
}
|
|
1753
1753
|
}
|
|
1754
|
-
const
|
|
1754
|
+
const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1755
1755
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1756
|
-
</svg>`,
|
|
1756
|
+
</svg>`, Nt = `
|
|
1757
1757
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1758
1758
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1759
1759
|
</svg>
|
|
@@ -1813,7 +1813,7 @@ class Yt extends S {
|
|
|
1813
1813
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1814
1814
|
}), t.appendChild(i);
|
|
1815
1815
|
const s = document.createElement("div");
|
|
1816
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1816
|
+
return s.classList.add("svg-container"), s.innerHTML = Nt, t.appendChild(s), s.onclick = () => {
|
|
1817
1817
|
var n, o;
|
|
1818
1818
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1819
1819
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1860,7 +1860,7 @@ class Yt extends S {
|
|
|
1860
1860
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1861
1861
|
}
|
|
1862
1862
|
selectApiOption(t, e, i) {
|
|
1863
|
-
var l, r, c,
|
|
1863
|
+
var l, r, c, d;
|
|
1864
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"));
|
|
1865
1865
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1866
1866
|
const o = this._options[e].value;
|
|
@@ -1869,10 +1869,10 @@ class Yt extends S {
|
|
|
1869
1869
|
if (a)
|
|
1870
1870
|
a.textContent = this._options[e].name;
|
|
1871
1871
|
else {
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1872
|
+
const h = i.firstChild;
|
|
1873
|
+
h && h.tagName === "SPAN" && (h.textContent = this._options[e].name);
|
|
1874
1874
|
}
|
|
1875
|
-
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"), (d = this.onChange) == null || d.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1876
1876
|
}
|
|
1877
1877
|
updateOptionsList() {
|
|
1878
1878
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1929,7 +1929,7 @@ class Kt extends S {
|
|
|
1929
1929
|
const s = document.createElement("input");
|
|
1930
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", () => {
|
|
1931
1931
|
var r, c;
|
|
1932
|
-
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((d) => d.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
1933
1933
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1934
1934
|
});
|
|
1935
1935
|
const n = document.createElement("span");
|
|
@@ -1955,13 +1955,13 @@ class Kt extends S {
|
|
|
1955
1955
|
this.detectChangeCallback = t;
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
1958
|
-
const
|
|
1958
|
+
const Vt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1959
1959
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1960
1960
|
</svg>`;
|
|
1961
1961
|
class Qt extends S {
|
|
1962
1962
|
// Store mobile value
|
|
1963
1963
|
constructor(t = {}) {
|
|
1964
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
1964
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Vt, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
1965
1965
|
}
|
|
1966
1966
|
draw() {
|
|
1967
1967
|
const t = document.createElement("div");
|
|
@@ -2012,33 +2012,33 @@ class Qt extends S {
|
|
|
2012
2012
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2013
2013
|
}
|
|
2014
2014
|
}
|
|
2015
|
-
const
|
|
2015
|
+
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2016
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"/>
|
|
2017
2017
|
</svg>`;
|
|
2018
|
-
class te extends
|
|
2018
|
+
class te extends D {
|
|
2019
2019
|
constructor(t = {}) {
|
|
2020
2020
|
super({
|
|
2021
2021
|
...t,
|
|
2022
2022
|
minValue: t.minValue ?? 0,
|
|
2023
2023
|
maxValue: t.maxValue ?? 1e3,
|
|
2024
|
-
icon: t.icon ||
|
|
2024
|
+
icon: t.icon || Ht,
|
|
2025
2025
|
title: t.title || "Margin Bottom",
|
|
2026
2026
|
default: t.default ?? 20,
|
|
2027
2027
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2028
2028
|
}), this.inputType = "number";
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
const
|
|
2031
|
+
const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2032
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"
|
|
2033
2033
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2034
2034
|
</svg>`;
|
|
2035
|
-
class ee extends
|
|
2035
|
+
class ee extends D {
|
|
2036
2036
|
constructor(t = {}) {
|
|
2037
2037
|
super({
|
|
2038
2038
|
...t,
|
|
2039
2039
|
minValue: t.minValue ?? 0,
|
|
2040
2040
|
maxValue: t.maxValue ?? 1e3,
|
|
2041
|
-
icon: t.icon ||
|
|
2041
|
+
icon: t.icon || Tt,
|
|
2042
2042
|
title: t.title || "Margin Top",
|
|
2043
2043
|
default: t.default ?? 20,
|
|
2044
2044
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
@@ -2078,10 +2078,10 @@ class ie extends S {
|
|
|
2078
2078
|
return;
|
|
2079
2079
|
}
|
|
2080
2080
|
const c = "...";
|
|
2081
|
-
let
|
|
2082
|
-
for (;
|
|
2083
|
-
const g = Math.floor((
|
|
2084
|
-
this.measureTextWidth(f, i) <= l ? (m = g,
|
|
2081
|
+
let d = 0, h = e.length, m = 0;
|
|
2082
|
+
for (; d <= h; ) {
|
|
2083
|
+
const g = Math.floor((d + h) / 2), f = e.slice(0, g).trimEnd() + c;
|
|
2084
|
+
this.measureTextWidth(f, i) <= l ? (m = g, d = g + 1) : h = g - 1;
|
|
2085
2085
|
}
|
|
2086
2086
|
const u = e.slice(0, m).trimEnd() + c;
|
|
2087
2087
|
t.placeholder = u;
|
|
@@ -2096,7 +2096,7 @@ class ie extends S {
|
|
|
2096
2096
|
i.classList.add("simple-multi-language-row");
|
|
2097
2097
|
const s = document.createElement("label");
|
|
2098
2098
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2099
|
-
const n = new
|
|
2099
|
+
const n = new at({
|
|
2100
2100
|
defaultUrl: e || "",
|
|
2101
2101
|
title: "",
|
|
2102
2102
|
id: `${this.id}_upload_${t}`
|
|
@@ -2219,7 +2219,7 @@ class se extends S {
|
|
|
2219
2219
|
this.selectSetting.destroy(), super.destroy();
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
const
|
|
2222
|
+
const lt = `<svg
|
|
2223
2223
|
width="13"
|
|
2224
2224
|
height="13"
|
|
2225
2225
|
viewBox="0 0 13 13"
|
|
@@ -2233,7 +2233,7 @@ const at = `<svg
|
|
|
2233
2233
|
fill="#919EAB"
|
|
2234
2234
|
/>
|
|
2235
2235
|
</svg>`;
|
|
2236
|
-
function
|
|
2236
|
+
function nt(p) {
|
|
2237
2237
|
try {
|
|
2238
2238
|
const t = p.match(/linear-gradient\(([^)]+)\)/);
|
|
2239
2239
|
if (t) {
|
|
@@ -2252,18 +2252,18 @@ function Tt(p) {
|
|
|
2252
2252
|
for (let r = 0; r < n.length; r++) {
|
|
2253
2253
|
const c = n[r];
|
|
2254
2254
|
if (c.includes("deg") || c.includes("to ")) continue;
|
|
2255
|
-
let
|
|
2255
|
+
let d = "", h = 0, m = 100;
|
|
2256
2256
|
const u = c.match(/rgba?\(([^)]+)\)(?:\s*(\d+)%)?/);
|
|
2257
2257
|
if (u) {
|
|
2258
|
-
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]),
|
|
2259
|
-
|
|
2258
|
+
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), y = parseInt(g[1]), v = parseInt(g[2]), x = g[3] ? parseFloat(g[3]) : 1;
|
|
2259
|
+
d = `#${f.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(x * 100), u[2] ? h = parseInt(u[2]) : h = Math.round(r / Math.max(n.length - 2, 1) * 100);
|
|
2260
2260
|
} else {
|
|
2261
2261
|
const g = c.match(/#([a-fA-F0-9]{3,8})(?:\s*(\d+)%)?/);
|
|
2262
|
-
g && (
|
|
2262
|
+
g && (d = `#${g[1]}`, g[2] ? h = parseInt(g[2]) : h = Math.round(r / Math.max(n.length - 2, 1) * 100));
|
|
2263
2263
|
}
|
|
2264
|
-
|
|
2265
|
-
color:
|
|
2266
|
-
position:
|
|
2264
|
+
d && l.push({
|
|
2265
|
+
color: d,
|
|
2266
|
+
position: h,
|
|
2267
2267
|
opacity: m
|
|
2268
2268
|
});
|
|
2269
2269
|
}
|
|
@@ -2274,25 +2274,25 @@ function Tt(p) {
|
|
|
2274
2274
|
const r = e.match(
|
|
2275
2275
|
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2276
2276
|
);
|
|
2277
|
-
r && r.forEach((c,
|
|
2278
|
-
let
|
|
2277
|
+
r && r.forEach((c, d) => {
|
|
2278
|
+
let h = "", m = 100;
|
|
2279
2279
|
if (c.startsWith("#"))
|
|
2280
|
-
|
|
2280
|
+
h = c;
|
|
2281
2281
|
else {
|
|
2282
2282
|
const u = c.match(/rgba?\(([^)]+)\)/);
|
|
2283
2283
|
if (u) {
|
|
2284
|
-
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]),
|
|
2285
|
-
|
|
2284
|
+
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), y = parseInt(g[1]), v = parseInt(g[2]), x = g[3] ? parseFloat(g[3]) : 1;
|
|
2285
|
+
h = `#${f.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(x * 100);
|
|
2286
2286
|
}
|
|
2287
2287
|
}
|
|
2288
|
-
if (
|
|
2288
|
+
if (h) {
|
|
2289
2289
|
const u = Math.round(
|
|
2290
|
-
|
|
2290
|
+
d / Math.max(r.length - 1, 1) * 100
|
|
2291
2291
|
);
|
|
2292
2292
|
console.log(
|
|
2293
|
-
`Auto-positioned stop: ${
|
|
2293
|
+
`Auto-positioned stop: ${h} at ${u}% with ${m}% opacity`
|
|
2294
2294
|
), l.push({
|
|
2295
|
-
color:
|
|
2295
|
+
color: h,
|
|
2296
2296
|
position: u,
|
|
2297
2297
|
opacity: m
|
|
2298
2298
|
});
|
|
@@ -2325,7 +2325,7 @@ class Pt {
|
|
|
2325
2325
|
const i = document.createElement("span");
|
|
2326
2326
|
i.textContent = "Color";
|
|
2327
2327
|
const s = document.createElement("button");
|
|
2328
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2328
|
+
s.className = "color-picker-close", s.innerHTML = lt, s.addEventListener("click", () => this.close()), e.appendChild(i), e.appendChild(s), this.makeDraggable(e, t);
|
|
2329
2329
|
const n = document.createElement("div");
|
|
2330
2330
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2331
2331
|
const o = document.createElement("div");
|
|
@@ -2340,10 +2340,10 @@ class Pt {
|
|
|
2340
2340
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2341
2341
|
const c = document.createElement("div");
|
|
2342
2342
|
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2343
|
-
const h = document.createElement("div");
|
|
2344
|
-
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2345
2343
|
const d = document.createElement("div");
|
|
2346
|
-
d.className = "color-picker-opacity
|
|
2344
|
+
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2345
|
+
const h = document.createElement("div");
|
|
2346
|
+
h.className = "color-picker-opacity-marker", this.opacityMarker = h, d.appendChild(h);
|
|
2347
2347
|
const m = document.createElement("div");
|
|
2348
2348
|
m.className = "color-picker-format-section";
|
|
2349
2349
|
const u = document.createElement("select");
|
|
@@ -2352,14 +2352,14 @@ class Pt {
|
|
|
2352
2352
|
g.value = "hex", g.textContent = "HEX";
|
|
2353
2353
|
const f = document.createElement("option");
|
|
2354
2354
|
f.value = "rgb", f.textContent = "RGB";
|
|
2355
|
-
const
|
|
2356
|
-
|
|
2355
|
+
const y = document.createElement("option");
|
|
2356
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(g), u.appendChild(f), u.appendChild(y);
|
|
2357
2357
|
const v = document.createElement("input");
|
|
2358
2358
|
v.type = "text", v.className = "color-picker-color-input", v.value = this.currentColor, this.hexInput = v;
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2359
|
+
const x = document.createElement("div");
|
|
2360
|
+
x.className = "color-picker-input-container";
|
|
2361
2361
|
const V = document.createElement("button");
|
|
2362
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()),
|
|
2362
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), x.appendChild(v), x.appendChild(V), m.appendChild(u), m.appendChild(x), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(d), t.appendChild(m), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (z) => {
|
|
2363
2363
|
z.stopPropagation();
|
|
2364
2364
|
}), t;
|
|
2365
2365
|
}
|
|
@@ -2551,21 +2551,21 @@ class Pt {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
makeDraggable(t, e) {
|
|
2553
2553
|
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2554
|
-
const l = (
|
|
2555
|
-
if (
|
|
2554
|
+
const l = (d) => {
|
|
2555
|
+
if (d.target.closest("button"))
|
|
2556
2556
|
return;
|
|
2557
|
-
|
|
2558
|
-
const
|
|
2559
|
-
o =
|
|
2560
|
-
}, r = (
|
|
2557
|
+
d.preventDefault(), d.stopPropagation(), i = !0, s = d.clientX, n = d.clientY;
|
|
2558
|
+
const h = e.getBoundingClientRect();
|
|
2559
|
+
o = h.left, a = h.top, e.classList.add("dragging"), document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
2560
|
+
}, r = (d) => {
|
|
2561
2561
|
if (!i) return;
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
let u = o +
|
|
2565
|
-
const f = window.innerWidth,
|
|
2566
|
-
u = Math.max(8, Math.min(f - v - 8, u)), g = Math.max(8, Math.min(
|
|
2567
|
-
}, c = (
|
|
2568
|
-
i && (i = !1,
|
|
2562
|
+
d.preventDefault(), d.stopPropagation();
|
|
2563
|
+
const h = d.clientX - s, m = d.clientY - n;
|
|
2564
|
+
let u = o + h, g = a + m;
|
|
2565
|
+
const f = window.innerWidth, y = window.innerHeight, v = e.offsetWidth, x = e.offsetHeight;
|
|
2566
|
+
u = Math.max(8, Math.min(f - v - 8, u)), g = Math.max(8, Math.min(y - x - 8, g)), e.style.left = `${u}px`, e.style.top = `${g}px`;
|
|
2567
|
+
}, c = (d) => {
|
|
2568
|
+
i && (i = !1, d.preventDefault(), d.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2569
2569
|
};
|
|
2570
2570
|
t.addEventListener("mousedown", l);
|
|
2571
2571
|
}
|
|
@@ -2592,7 +2592,7 @@ class Ot extends S {
|
|
|
2592
2592
|
stops: [{ color: i, position: 0, opacity: s }]
|
|
2593
2593
|
};
|
|
2594
2594
|
} else
|
|
2595
|
-
e =
|
|
2595
|
+
e = nt(t.default) || {
|
|
2596
2596
|
type: "linear",
|
|
2597
2597
|
angle: 90,
|
|
2598
2598
|
stops: [
|
|
@@ -2626,9 +2626,75 @@ class Ot extends S {
|
|
|
2626
2626
|
!n && !o && !l && this.closePopover();
|
|
2627
2627
|
}, this.detectChange = t.detectChange, this.forText = t.forText || !1;
|
|
2628
2628
|
}
|
|
2629
|
+
// Safe getter for the value property
|
|
2630
|
+
getSafeValue() {
|
|
2631
|
+
return !this.value || !this.isValidGradientValue(this.value) ? (console.warn("Invalid value detected, returning default:", this.value), {
|
|
2632
|
+
type: "linear",
|
|
2633
|
+
angle: 90,
|
|
2634
|
+
stops: [
|
|
2635
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2636
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2637
|
+
]
|
|
2638
|
+
}) : this.value;
|
|
2639
|
+
}
|
|
2629
2640
|
setValue(t) {
|
|
2630
2641
|
let e;
|
|
2631
|
-
|
|
2642
|
+
if (!t)
|
|
2643
|
+
console.warn("Undefined value in setValue, using default"), e = {
|
|
2644
|
+
type: "linear",
|
|
2645
|
+
angle: 90,
|
|
2646
|
+
stops: [
|
|
2647
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2648
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2649
|
+
]
|
|
2650
|
+
};
|
|
2651
|
+
else if (typeof t == "string")
|
|
2652
|
+
if (t.match(/^#[a-fA-F0-9]{3,8}$/)) {
|
|
2653
|
+
let i = t, s = 100;
|
|
2654
|
+
if (i.length === 9) {
|
|
2655
|
+
const n = parseInt(i.slice(-2), 16);
|
|
2656
|
+
s = Math.round(n / 255 * 100), i = i.slice(0, 7);
|
|
2657
|
+
}
|
|
2658
|
+
e = {
|
|
2659
|
+
type: "solid",
|
|
2660
|
+
angle: 90,
|
|
2661
|
+
stops: [{ color: i, position: 0, opacity: s }]
|
|
2662
|
+
};
|
|
2663
|
+
} else {
|
|
2664
|
+
const i = nt(t);
|
|
2665
|
+
i ? e = i : (console.warn(
|
|
2666
|
+
"Failed to parse string value, using default:",
|
|
2667
|
+
t
|
|
2668
|
+
), e = {
|
|
2669
|
+
type: "linear",
|
|
2670
|
+
angle: 90,
|
|
2671
|
+
stops: [
|
|
2672
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2673
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2674
|
+
]
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
else if (typeof t == "object" && t.background) {
|
|
2678
|
+
console.warn(
|
|
2679
|
+
"Received CSS style object, extracting background value:",
|
|
2680
|
+
t
|
|
2681
|
+
);
|
|
2682
|
+
const i = t.background;
|
|
2683
|
+
if (typeof i == "string") {
|
|
2684
|
+
this.setValue(i);
|
|
2685
|
+
return;
|
|
2686
|
+
} else
|
|
2687
|
+
e = {
|
|
2688
|
+
type: "linear",
|
|
2689
|
+
angle: 90,
|
|
2690
|
+
stops: [
|
|
2691
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2692
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2693
|
+
]
|
|
2694
|
+
};
|
|
2695
|
+
} else this.isValidGradientValue(t) ? (e = t, e.stops && e.stops.forEach((i) => {
|
|
2696
|
+
i.opacity === void 0 && (i.opacity = 100);
|
|
2697
|
+
})) : (console.warn(
|
|
2632
2698
|
"Invalid gradient value in setValue, using default:",
|
|
2633
2699
|
t
|
|
2634
2700
|
), e = {
|
|
@@ -2638,9 +2704,8 @@ class Ot extends S {
|
|
|
2638
2704
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2639
2705
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2640
2706
|
]
|
|
2641
|
-
})
|
|
2642
|
-
|
|
2643
|
-
})), super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2707
|
+
});
|
|
2708
|
+
super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2644
2709
|
}
|
|
2645
2710
|
updateUI() {
|
|
2646
2711
|
if (this.previewElement && this.value)
|
|
@@ -2654,7 +2719,9 @@ class Ot extends S {
|
|
|
2654
2719
|
);
|
|
2655
2720
|
}
|
|
2656
2721
|
} else
|
|
2657
|
-
this.previewElement.style.background = this.generateCSS(
|
|
2722
|
+
this.previewElement.style.background = this.generateCSS(
|
|
2723
|
+
this.getSafeValue()
|
|
2724
|
+
);
|
|
2658
2725
|
this.textInputElement && this.value && !this.isUserEditing && (this.textInputElement.value = this.generateDisplayText(this.value));
|
|
2659
2726
|
}
|
|
2660
2727
|
generateDisplayText(t) {
|
|
@@ -2676,8 +2743,8 @@ class Ot extends S {
|
|
|
2676
2743
|
n.className = "input-label", n.textContent = this.props.title, s.appendChild(n), t.appendChild(s);
|
|
2677
2744
|
}
|
|
2678
2745
|
const e = document.createElement("div");
|
|
2679
|
-
e.className = "gradient-input-wrapper", this.previewElement = document.createElement("div"), this.previewElement.className = "gradient-mini-preview", this.previewElement.style.background = this.value ? this.generateCSS(this.
|
|
2680
|
-
this.isUserEditing = !0, this.value && (this.textInputElement.value = this.generateCSS(this.
|
|
2746
|
+
e.className = "gradient-input-wrapper", this.previewElement = document.createElement("div"), this.previewElement.className = "gradient-mini-preview", this.previewElement.style.background = this.value ? this.generateCSS(this.getSafeValue()) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.textInputElement = document.createElement("input"), this.textInputElement.type = "text", this.textInputElement.className = "gradient-text-input", this.textInputElement.placeholder = "Enter gradient CSS or paste color...", this.textInputElement.value = this.value ? this.generateDisplayText(this.value) : "", this.textInputElement.readOnly = !1, this.previewElement.addEventListener("click", () => this.openPopover()), this.textInputElement.addEventListener("focus", () => {
|
|
2747
|
+
this.isUserEditing = !0, this.value && (this.textInputElement.value = this.generateCSS(this.getSafeValue()));
|
|
2681
2748
|
}), this.textInputElement.addEventListener("blur", () => {
|
|
2682
2749
|
this.isUserEditing = !1, this.value && (this.textInputElement.value = this.generateDisplayText(this.value)), this.placeholderTrigger && (this.placeholderTrigger.style.display = this.textInputElement.value ? "none" : "flex");
|
|
2683
2750
|
}), this.textInputElement.addEventListener(
|
|
@@ -2687,7 +2754,7 @@ class Ot extends S {
|
|
|
2687
2754
|
"input",
|
|
2688
2755
|
(s) => this.handleInput(s)
|
|
2689
2756
|
), this.textInputElement.addEventListener("keydown", (s) => {
|
|
2690
|
-
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.
|
|
2757
|
+
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.getSafeValue())), this.textInputElement.blur());
|
|
2691
2758
|
});
|
|
2692
2759
|
const i = document.createElement("div");
|
|
2693
2760
|
return i.className = "gradient-input-placeholder-trigger", i.textContent = this.textInputElement.placeholder || "", i.style.display = this.textInputElement.value ? "none" : "flex", i.addEventListener("click", (s) => {
|
|
@@ -2701,7 +2768,7 @@ class Ot extends S {
|
|
|
2701
2768
|
}
|
|
2702
2769
|
generateCSS(t) {
|
|
2703
2770
|
if (!t || !this.isValidGradientValue(t))
|
|
2704
|
-
return console.warn("Invalid gradient value passed to generateCSS:", t), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2771
|
+
return console.warn("Invalid gradient value passed to generateCSS:", t), console.trace("Stack trace for invalid gradient value"), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2705
2772
|
if (t.type === "solid") {
|
|
2706
2773
|
const i = t.stops && t.stops.length > 0 ? t.stops[0] : null;
|
|
2707
2774
|
if (!i) return "#000000";
|
|
@@ -2764,7 +2831,7 @@ class Ot extends S {
|
|
|
2764
2831
|
const e = document.createElement("span");
|
|
2765
2832
|
e.textContent = "Fill";
|
|
2766
2833
|
const i = document.createElement("button");
|
|
2767
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
2834
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = lt, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
2768
2835
|
const s = document.createElement("div");
|
|
2769
2836
|
s.className = "gradient-editor";
|
|
2770
2837
|
const n = this.createTypeTabs();
|
|
@@ -2811,14 +2878,14 @@ class Ot extends S {
|
|
|
2811
2878
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2812
2879
|
}
|
|
2813
2880
|
createSolidEditor(t) {
|
|
2814
|
-
var o, a, l, r, c,
|
|
2881
|
+
var o, a, l, r, c, d;
|
|
2815
2882
|
const e = document.createElement("div");
|
|
2816
2883
|
e.className = "gradient-solid-picker embedded-color-picker";
|
|
2817
|
-
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((
|
|
2884
|
+
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((d = (c = (r = this.value) == null ? void 0 : r.stops) == null ? void 0 : c[0]) == null ? void 0 : d.opacity) || 100, n = this.createEmbeddedColorPickerWithOpacity(
|
|
2818
2885
|
i,
|
|
2819
2886
|
s,
|
|
2820
|
-
(
|
|
2821
|
-
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color:
|
|
2887
|
+
(h, m) => {
|
|
2888
|
+
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color: h, position: 0, opacity: m }] : (this.value.stops[0].color = h, this.value.stops[0].opacity = m), this.updateUI(), this.triggerChange());
|
|
2822
2889
|
}
|
|
2823
2890
|
);
|
|
2824
2891
|
e.appendChild(n), t.appendChild(e);
|
|
@@ -2840,10 +2907,10 @@ class Ot extends S {
|
|
|
2840
2907
|
r.className = "color-picker-hue embedded";
|
|
2841
2908
|
const c = document.createElement("div");
|
|
2842
2909
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2843
|
-
const h = document.createElement("div");
|
|
2844
|
-
h.className = "color-picker-opacity embedded";
|
|
2845
2910
|
const d = document.createElement("div");
|
|
2846
|
-
d.className = "color-picker-opacity
|
|
2911
|
+
d.className = "color-picker-opacity embedded";
|
|
2912
|
+
const h = document.createElement("div");
|
|
2913
|
+
h.className = "color-picker-opacity-marker", d.appendChild(h);
|
|
2847
2914
|
const m = document.createElement("div");
|
|
2848
2915
|
m.className = "color-picker-format-section embedded";
|
|
2849
2916
|
const u = document.createElement("select");
|
|
@@ -2852,14 +2919,14 @@ class Ot extends S {
|
|
|
2852
2919
|
g.value = "hex", g.textContent = "HEX";
|
|
2853
2920
|
const f = document.createElement("option");
|
|
2854
2921
|
f.value = "rgb", f.textContent = "RGB";
|
|
2855
|
-
const
|
|
2856
|
-
|
|
2922
|
+
const y = document.createElement("option");
|
|
2923
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(g), u.appendChild(f), u.appendChild(y);
|
|
2857
2924
|
const v = document.createElement("input");
|
|
2858
2925
|
v.type = "text", v.className = "color-picker-color-input", v.value = t;
|
|
2859
|
-
const
|
|
2860
|
-
|
|
2926
|
+
const x = document.createElement("div");
|
|
2927
|
+
x.className = "color-picker-input-container";
|
|
2861
2928
|
const V = document.createElement("button");
|
|
2862
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy",
|
|
2929
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", x.appendChild(v), x.appendChild(V), m.appendChild(u), m.appendChild(x), s.appendChild(n), s.appendChild(a), s.appendChild(d), s.appendChild(m), this.setupEmbeddedColorPicker(
|
|
2863
2930
|
n,
|
|
2864
2931
|
o,
|
|
2865
2932
|
r,
|
|
@@ -2872,8 +2939,8 @@ class Ot extends S {
|
|
|
2872
2939
|
e,
|
|
2873
2940
|
i
|
|
2874
2941
|
), this.setupOpacitySlider(
|
|
2875
|
-
h,
|
|
2876
2942
|
d,
|
|
2943
|
+
h,
|
|
2877
2944
|
t,
|
|
2878
2945
|
e,
|
|
2879
2946
|
i
|
|
@@ -2896,27 +2963,27 @@ class Ot extends S {
|
|
|
2896
2963
|
r.className = "color-picker-hue embedded";
|
|
2897
2964
|
const c = document.createElement("div");
|
|
2898
2965
|
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2899
|
-
const
|
|
2900
|
-
|
|
2901
|
-
const
|
|
2902
|
-
|
|
2966
|
+
const d = document.createElement("div");
|
|
2967
|
+
d.className = "color-picker-format-section embedded";
|
|
2968
|
+
const h = document.createElement("select");
|
|
2969
|
+
h.className = "color-picker-format-select";
|
|
2903
2970
|
const m = document.createElement("option");
|
|
2904
2971
|
m.value = "hex", m.textContent = "HEX";
|
|
2905
2972
|
const u = document.createElement("option");
|
|
2906
2973
|
u.value = "rgb", u.textContent = "RGB";
|
|
2907
2974
|
const g = document.createElement("option");
|
|
2908
|
-
g.value = "hsl", g.textContent = "HSL",
|
|
2975
|
+
g.value = "hsl", g.textContent = "HSL", h.appendChild(m), h.appendChild(u), h.appendChild(g);
|
|
2909
2976
|
const f = document.createElement("input");
|
|
2910
2977
|
f.type = "text", f.className = "color-picker-color-input", f.value = t;
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2978
|
+
const y = document.createElement("div");
|
|
2979
|
+
y.className = "color-picker-input-container";
|
|
2913
2980
|
const v = document.createElement("button");
|
|
2914
|
-
return v.className = "color-picker-copy-inside", v.textContent = "Copy",
|
|
2981
|
+
return v.className = "color-picker-copy-inside", v.textContent = "Copy", y.appendChild(f), y.appendChild(v), d.appendChild(h), d.appendChild(y), s.appendChild(n), s.appendChild(a), s.appendChild(d), this.setupEmbeddedColorPicker(
|
|
2915
2982
|
n,
|
|
2916
2983
|
o,
|
|
2917
2984
|
r,
|
|
2918
2985
|
c,
|
|
2919
|
-
|
|
2986
|
+
h,
|
|
2920
2987
|
f,
|
|
2921
2988
|
v,
|
|
2922
2989
|
l,
|
|
@@ -2925,74 +2992,74 @@ class Ot extends S {
|
|
|
2925
2992
|
i
|
|
2926
2993
|
), s;
|
|
2927
2994
|
}
|
|
2928
|
-
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c,
|
|
2929
|
-
let
|
|
2995
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, d) {
|
|
2996
|
+
let h = r;
|
|
2930
2997
|
const { h: m, s: u, v: g } = this.hexToHsv(r);
|
|
2931
2998
|
let f = c;
|
|
2932
2999
|
s.style.left = `${m / 360 * 100}%`, e.style.left = `${u * 100}%`, e.style.top = `${(1 - g) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${m}, 100%, 50%))`;
|
|
2933
|
-
const
|
|
2934
|
-
|
|
3000
|
+
const y = (C, b = f) => {
|
|
3001
|
+
h = C, f = Math.round(b), v(), d(C, f);
|
|
2935
3002
|
}, v = () => {
|
|
2936
|
-
const C = n.value, { h: b, s:
|
|
3003
|
+
const C = n.value, { h: b, s: w, v: L } = this.hexToHsv(h);
|
|
2937
3004
|
switch (C) {
|
|
2938
3005
|
case "hex":
|
|
2939
|
-
o.value =
|
|
3006
|
+
o.value = h;
|
|
2940
3007
|
break;
|
|
2941
3008
|
case "rgb":
|
|
2942
|
-
const { r: H, g: $, b: R } = this.hexToRgb(
|
|
3009
|
+
const { r: H, g: $, b: R } = this.hexToRgb(h);
|
|
2943
3010
|
o.value = `rgb(${H}, ${$}, ${R})`;
|
|
2944
3011
|
break;
|
|
2945
3012
|
case "hsl":
|
|
2946
|
-
const { hue: B, sat: _, lightness: K } = this.hsvToHsl(b,
|
|
3013
|
+
const { hue: B, sat: _, lightness: K } = this.hsvToHsl(b, w, L);
|
|
2947
3014
|
o.value = `hsl(${Math.round(B)}, ${Math.round(
|
|
2948
3015
|
_ * 100
|
|
2949
3016
|
)}%, ${Math.round(K * 100)}%)`;
|
|
2950
3017
|
break;
|
|
2951
3018
|
}
|
|
2952
|
-
},
|
|
2953
|
-
const
|
|
2954
|
-
|
|
3019
|
+
}, x = () => parseFloat(s.style.left || "0%") / 100 * 360, V = (C, b) => {
|
|
3020
|
+
const w = x(), L = this.hsvToHex(w, C, b);
|
|
3021
|
+
y(L, f);
|
|
2955
3022
|
}, z = (C) => {
|
|
2956
3023
|
C = Math.max(0.1, Math.min(358.9, C));
|
|
2957
|
-
const b = parseFloat(e.style.left || "50%") / 100,
|
|
3024
|
+
const b = parseFloat(e.style.left || "50%") / 100, w = parseFloat(e.style.top || "50%") / 100;
|
|
2958
3025
|
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`;
|
|
2959
|
-
const L = b, H = 1 -
|
|
2960
|
-
|
|
3026
|
+
const L = b, H = 1 - w, $ = this.hsvToHex(C, L, H);
|
|
3027
|
+
y($, f);
|
|
2961
3028
|
}, U = (C) => {
|
|
2962
3029
|
C.stopPropagation();
|
|
2963
|
-
const b = t.getBoundingClientRect(),
|
|
2964
|
-
e.style.left = `${
|
|
3030
|
+
const b = t.getBoundingClientRect(), w = Math.max(0, Math.min(1, (C.clientX - b.left) / b.width)), L = Math.max(0, Math.min(1, (C.clientY - b.top) / b.height));
|
|
3031
|
+
e.style.left = `${w * 100}%`, e.style.top = `${L * 100}%`, V(w, 1 - L);
|
|
2965
3032
|
}, I = (C) => {
|
|
2966
3033
|
C.preventDefault(), C.stopPropagation(), U(C);
|
|
2967
|
-
const b = (L) => U(L),
|
|
2968
|
-
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup",
|
|
3034
|
+
const b = (L) => U(L), w = () => {
|
|
3035
|
+
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", w);
|
|
2969
3036
|
};
|
|
2970
|
-
document.addEventListener("mousemove", b), document.addEventListener("mouseup",
|
|
2971
|
-
},
|
|
3037
|
+
document.addEventListener("mousemove", b), document.addEventListener("mouseup", w);
|
|
3038
|
+
}, E = (C) => {
|
|
2972
3039
|
C.stopPropagation();
|
|
2973
3040
|
const b = i.getBoundingClientRect();
|
|
2974
|
-
let
|
|
2975
|
-
|
|
2976
|
-
const L =
|
|
3041
|
+
let w = (C.clientX - b.left) / b.width;
|
|
3042
|
+
w = Math.max(1e-3, Math.min(0.998, w)), s.style.left = `${w * 100}%`;
|
|
3043
|
+
const L = w * 360;
|
|
2977
3044
|
z(L);
|
|
2978
3045
|
}, k = (C) => {
|
|
2979
|
-
C.preventDefault(), C.stopPropagation(),
|
|
2980
|
-
const b = (L) =>
|
|
2981
|
-
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup",
|
|
3046
|
+
C.preventDefault(), C.stopPropagation(), E(C);
|
|
3047
|
+
const b = (L) => E(L), w = () => {
|
|
3048
|
+
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", w);
|
|
2982
3049
|
};
|
|
2983
|
-
document.addEventListener("mousemove", b), document.addEventListener("mouseup",
|
|
3050
|
+
document.addEventListener("mousemove", b), document.addEventListener("mouseup", w);
|
|
2984
3051
|
}, P = (C) => {
|
|
2985
|
-
const b = C.target.value,
|
|
3052
|
+
const b = C.target.value, w = n.value;
|
|
2986
3053
|
let L = "";
|
|
2987
|
-
if (
|
|
3054
|
+
if (w === "hex" && /^#[0-9A-Fa-f]{6}$/.test(b))
|
|
2988
3055
|
L = b;
|
|
2989
|
-
else if (
|
|
3056
|
+
else if (w === "rgb") {
|
|
2990
3057
|
const H = b.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2991
3058
|
if (H) {
|
|
2992
3059
|
const $ = parseInt(H[1]), R = parseInt(H[2]), B = parseInt(H[3]);
|
|
2993
3060
|
$ <= 255 && R <= 255 && B <= 255 && (L = `#${$.toString(16).padStart(2, "0")}${R.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`);
|
|
2994
3061
|
}
|
|
2995
|
-
} else if (
|
|
3062
|
+
} else if (w === "hsl") {
|
|
2996
3063
|
const H = b.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2997
3064
|
if (H) {
|
|
2998
3065
|
const $ = parseInt(H[1]), R = parseInt(H[2]) / 100, B = parseInt(H[3]) / 100;
|
|
@@ -3004,7 +3071,7 @@ class Ot extends S {
|
|
|
3004
3071
|
}
|
|
3005
3072
|
if (L) {
|
|
3006
3073
|
const { h: H, s: $, v: R } = this.hexToHsv(L);
|
|
3007
|
-
s.style.left = `${H / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - R) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${H}, 100%, 50%))`,
|
|
3074
|
+
s.style.left = `${H / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - R) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${H}, 100%, 50%))`, y(L, f);
|
|
3008
3075
|
}
|
|
3009
3076
|
}, O = (C) => {
|
|
3010
3077
|
v();
|
|
@@ -3015,12 +3082,12 @@ class Ot extends S {
|
|
|
3015
3082
|
o.select(), document.execCommand("copy");
|
|
3016
3083
|
});
|
|
3017
3084
|
};
|
|
3018
|
-
v(), t.addEventListener("mousedown", I), t.addEventListener("click", U), i.addEventListener("mousedown", k), i.addEventListener("click",
|
|
3085
|
+
v(), t.addEventListener("mousedown", I), t.addEventListener("click", U), i.addEventListener("mousedown", k), i.addEventListener("click", E), n.addEventListener("change", T), o.addEventListener("input", P), o.addEventListener("blur", O), a.addEventListener("click", M);
|
|
3019
3086
|
const A = async () => {
|
|
3020
3087
|
if ("EyeDropper" in window)
|
|
3021
3088
|
try {
|
|
3022
|
-
const
|
|
3023
|
-
s.style.left = `${L / 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(${L}, 100%, 50%))`,
|
|
3089
|
+
const w = (await new window.EyeDropper().open()).sRGBHex, { h: L, s: H, v: $ } = this.hexToHsv(w);
|
|
3090
|
+
s.style.left = `${L / 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(${L}, 100%, 50%))`, y(w, f);
|
|
3024
3091
|
} catch (C) {
|
|
3025
3092
|
console.log("User cancelled eyedropper or error occurred:", C);
|
|
3026
3093
|
}
|
|
@@ -3038,15 +3105,15 @@ class Ot extends S {
|
|
|
3038
3105
|
}
|
|
3039
3106
|
setupOpacitySlider(t, e, i, s, n) {
|
|
3040
3107
|
const o = () => {
|
|
3041
|
-
const { r: c, g:
|
|
3042
|
-
t.style.setProperty("--color-rgb", `${c}, ${
|
|
3108
|
+
const { r: c, g: d, b: h } = this.hexToRgb(i);
|
|
3109
|
+
t.style.setProperty("--color-rgb", `${c}, ${d}, ${h}`);
|
|
3043
3110
|
}, a = () => {
|
|
3044
3111
|
e.style.left = `${s}%`;
|
|
3045
3112
|
};
|
|
3046
3113
|
o(), a();
|
|
3047
3114
|
let l = !1;
|
|
3048
3115
|
const r = (c) => {
|
|
3049
|
-
const
|
|
3116
|
+
const d = t.getBoundingClientRect(), h = c.clientX - d.left, m = Math.max(0, Math.min(100, h / d.width * 100)), u = Math.round(m);
|
|
3050
3117
|
s = u, a(), n(i, u);
|
|
3051
3118
|
};
|
|
3052
3119
|
t.addEventListener("mousedown", (c) => {
|
|
@@ -3087,22 +3154,22 @@ class Ot extends S {
|
|
|
3087
3154
|
<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"/>
|
|
3088
3155
|
</svg>
|
|
3089
3156
|
`, l.title = "Flip gradient", i.addEventListener("change", (f) => {
|
|
3090
|
-
const
|
|
3091
|
-
this.switchType(
|
|
3157
|
+
const y = f.target.value;
|
|
3158
|
+
this.switchType(y === "radial" ? "radial" : "linear");
|
|
3092
3159
|
}), o.addEventListener("input", (f) => {
|
|
3093
|
-
const
|
|
3160
|
+
const y = f.target.value, v = parseInt(y);
|
|
3094
3161
|
if (this.value && !isNaN(v)) {
|
|
3095
|
-
const
|
|
3096
|
-
this.value.angle =
|
|
3162
|
+
const x = Math.max(0, Math.min(360, v));
|
|
3163
|
+
this.value.angle = x, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3097
3164
|
}
|
|
3098
3165
|
}), o.addEventListener("focus", (f) => {
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3166
|
+
const y = f.target;
|
|
3167
|
+
y.value = y.value.replace(/[^0-9-]/g, ""), setTimeout(() => y.select(), 0);
|
|
3101
3168
|
}), o.addEventListener("blur", (f) => {
|
|
3102
|
-
var
|
|
3103
|
-
const
|
|
3104
|
-
let v = parseInt(
|
|
3105
|
-
isNaN(v) && (v = ((
|
|
3169
|
+
var x;
|
|
3170
|
+
const y = f.target;
|
|
3171
|
+
let v = parseInt(y.value);
|
|
3172
|
+
isNaN(v) && (v = ((x = this.value) == null ? void 0 : x.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), y.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3106
3173
|
}), l.addEventListener("click", () => {
|
|
3107
3174
|
this.value && (this.value.stops = this.value.stops.map((f) => ({
|
|
3108
3175
|
...f,
|
|
@@ -3114,17 +3181,17 @@ class Ot extends S {
|
|
|
3114
3181
|
})();
|
|
3115
3182
|
const c = document.createElement("div");
|
|
3116
3183
|
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3117
|
-
const h = document.createElement("div");
|
|
3118
|
-
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3119
3184
|
const d = document.createElement("div");
|
|
3120
|
-
d.className = "gradient-
|
|
3185
|
+
d.className = "gradient-handles", this.createGradientHandles(d, c), c.appendChild(d), t.appendChild(c);
|
|
3186
|
+
const h = document.createElement("div");
|
|
3187
|
+
h.className = "gradient-stops-header";
|
|
3121
3188
|
const m = document.createElement("span");
|
|
3122
3189
|
m.textContent = "Stops";
|
|
3123
3190
|
const u = document.createElement("button");
|
|
3124
|
-
u.type = "button", u.className = "gradient-add-stop", u.textContent = "+",
|
|
3191
|
+
u.type = "button", u.className = "gradient-add-stop", u.textContent = "+", h.appendChild(m), h.appendChild(u);
|
|
3125
3192
|
const g = document.createElement("div");
|
|
3126
|
-
g.className = "gradient-stops", t.appendChild(
|
|
3127
|
-
this.addGradientStop(), this.updateStopsList(g), this.updateGradientPreview(c), this.createGradientHandles(
|
|
3193
|
+
g.className = "gradient-stops", t.appendChild(h), t.appendChild(g), this.updateStopsList(g), u.addEventListener("click", () => {
|
|
3194
|
+
this.addGradientStop(), this.updateStopsList(g), this.updateGradientPreview(c), this.createGradientHandles(d, c), this.updateUI();
|
|
3128
3195
|
});
|
|
3129
3196
|
}
|
|
3130
3197
|
updateGradientPreview(t) {
|
|
@@ -3142,21 +3209,21 @@ class Ot extends S {
|
|
|
3142
3209
|
}
|
|
3143
3210
|
makeDraggable(t, e, i) {
|
|
3144
3211
|
let s = !1, n = 0, o = 0, a = null;
|
|
3145
|
-
const l = (
|
|
3212
|
+
const l = (h) => "touches" in h && h.touches.length > 0 ? h.touches[0].clientX : h.clientX, r = (h) => {
|
|
3146
3213
|
var m, u, g;
|
|
3147
|
-
s = !0, n = l(
|
|
3214
|
+
s = !0, n = l(h), o = ((g = (u = (m = this.value) == null ? void 0 : m.stops) == null ? void 0 : u[i]) == null ? void 0 : g.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, {
|
|
3148
3215
|
passive: !1
|
|
3149
|
-
}), document.addEventListener("touchend",
|
|
3150
|
-
}, c = (
|
|
3151
|
-
var
|
|
3152
|
-
if (!s || !((v = (
|
|
3153
|
-
const m = e.getBoundingClientRect(), g = (l(
|
|
3216
|
+
}), document.addEventListener("touchend", d), h.preventDefault();
|
|
3217
|
+
}, c = (h) => {
|
|
3218
|
+
var y, v;
|
|
3219
|
+
if (!s || !((v = (y = this.value) == null ? void 0 : y.stops) != null && v[i])) return;
|
|
3220
|
+
const m = e.getBoundingClientRect(), g = (l(h) - n) / m.width * 100;
|
|
3154
3221
|
let f = o + g;
|
|
3155
3222
|
f = Math.max(0, Math.min(100, f)), this.value.stops[i].position = Math.round(f), t.style.left = `${f}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
3156
3223
|
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3157
|
-
}),
|
|
3158
|
-
},
|
|
3159
|
-
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",
|
|
3224
|
+
}), h.preventDefault();
|
|
3225
|
+
}, d = () => {
|
|
3226
|
+
s && (s = !1, t.classList.remove("selected"), a && (cancelAnimationFrame(a), a = null), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange(), document.removeEventListener("pointermove", c), document.removeEventListener("pointerup", d), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", d), document.removeEventListener("touchmove", c), document.removeEventListener("touchend", d));
|
|
3160
3227
|
};
|
|
3161
3228
|
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3162
3229
|
passive: !1
|
|
@@ -3177,21 +3244,21 @@ class Ot extends S {
|
|
|
3177
3244
|
r.className = "gstop-color-container";
|
|
3178
3245
|
const c = document.createElement("div");
|
|
3179
3246
|
c.className = "gstop-color-preview", c.style.backgroundColor = s.color;
|
|
3180
|
-
const
|
|
3181
|
-
|
|
3182
|
-
const
|
|
3183
|
-
|
|
3247
|
+
const d = document.createElement("input");
|
|
3248
|
+
d.type = "text", d.className = "gstop-color-input", d.value = s.color.replace("#", "").toUpperCase();
|
|
3249
|
+
const h = document.createElement("button");
|
|
3250
|
+
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">
|
|
3184
3251
|
<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"/>
|
|
3185
|
-
</svg>`, r.appendChild(c), r.appendChild(
|
|
3252
|
+
</svg>`, r.appendChild(c), r.appendChild(d), r.appendChild(h);
|
|
3186
3253
|
const m = document.createElement("button");
|
|
3187
3254
|
m.type = "button", m.className = "gstop-del", m.innerHTML = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3188
3255
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3189
3256
|
</svg>`, m.disabled = (((U = (z = this.value) == null ? void 0 : z.stops) == null ? void 0 : U.length) || 0) <= 2, l.addEventListener("input", (I) => {
|
|
3190
3257
|
var O;
|
|
3191
|
-
const
|
|
3258
|
+
const E = I.target, k = E.value.replace(/[^\d]/g, ""), P = parseInt(k);
|
|
3192
3259
|
if (this.value && !isNaN(P)) {
|
|
3193
3260
|
const T = Math.max(0, Math.min(100, P));
|
|
3194
|
-
this.value.stops[n].position = T,
|
|
3261
|
+
this.value.stops[n].position = T, E.value = `${T}%`;
|
|
3195
3262
|
const M = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3196
3263
|
".gradient-preview"
|
|
3197
3264
|
), A = M == null ? void 0 : M.querySelector(
|
|
@@ -3200,23 +3267,23 @@ class Ot extends S {
|
|
|
3200
3267
|
M && A && this.createGradientHandles(A, M), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3201
3268
|
}
|
|
3202
3269
|
}), l.addEventListener("focus", (I) => {
|
|
3203
|
-
const
|
|
3204
|
-
|
|
3270
|
+
const E = I.target, k = E.value.replace("%", "");
|
|
3271
|
+
E.value = k, E.select();
|
|
3205
3272
|
}), l.addEventListener("blur", (I) => {
|
|
3206
3273
|
var O, T;
|
|
3207
|
-
const
|
|
3274
|
+
const E = I.target, k = E.value.replace(/[^\d]/g, ""), P = parseInt(k);
|
|
3208
3275
|
if (isNaN(P))
|
|
3209
|
-
|
|
3276
|
+
E.value = `${((T = (O = this.value) == null ? void 0 : O.stops[n]) == null ? void 0 : T.position) || 0}%`;
|
|
3210
3277
|
else {
|
|
3211
3278
|
const M = Math.max(0, Math.min(100, P));
|
|
3212
|
-
|
|
3279
|
+
E.value = `${M}%`, this.value && (this.value.stops[n].position = M, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3213
3280
|
}
|
|
3214
3281
|
});
|
|
3215
3282
|
const u = new Pt(
|
|
3216
|
-
(I,
|
|
3283
|
+
(I, E) => {
|
|
3217
3284
|
var k, P, O;
|
|
3218
|
-
if (
|
|
3219
|
-
this.value.stops[n].color = I,
|
|
3285
|
+
if (d.value = I.replace("#", "").toUpperCase(), c.style.backgroundColor = I, this.value) {
|
|
3286
|
+
this.value.stops[n].color = I, E !== void 0 && (this.value.stops[n].opacity = E);
|
|
3220
3287
|
const T = (k = o.parentElement) == null ? void 0 : k.querySelector(
|
|
3221
3288
|
".gstop-opacity-slider"
|
|
3222
3289
|
);
|
|
@@ -3227,11 +3294,11 @@ class Ot extends S {
|
|
|
3227
3294
|
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3228
3295
|
);
|
|
3229
3296
|
}
|
|
3230
|
-
if (
|
|
3297
|
+
if (E !== void 0) {
|
|
3231
3298
|
const C = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3232
3299
|
".gstop-opacity-value"
|
|
3233
3300
|
);
|
|
3234
|
-
C && (C.textContent = `${
|
|
3301
|
+
C && (C.textContent = `${E}%`), T && (T.value = E.toString());
|
|
3235
3302
|
}
|
|
3236
3303
|
const M = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3237
3304
|
".gradient-preview"
|
|
@@ -3242,11 +3309,11 @@ class Ot extends S {
|
|
|
3242
3309
|
}
|
|
3243
3310
|
}
|
|
3244
3311
|
);
|
|
3245
|
-
|
|
3246
|
-
I.stopPropagation(), u.open(s.color,
|
|
3247
|
-
}),
|
|
3312
|
+
d.addEventListener("click", (I) => {
|
|
3313
|
+
I.stopPropagation(), u.open(s.color, d, s.opacity || 100);
|
|
3314
|
+
}), d.addEventListener("input", (I) => {
|
|
3248
3315
|
var P, O;
|
|
3249
|
-
const
|
|
3316
|
+
const E = I.target.value.trim(), k = E.startsWith("#") ? E : `#${E}`;
|
|
3250
3317
|
if (/^#[0-9A-Fa-f]{6}$/.test(k) && (c.style.backgroundColor = k, this.value)) {
|
|
3251
3318
|
this.value.stops[n].color = k;
|
|
3252
3319
|
const T = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
@@ -3266,16 +3333,16 @@ class Ot extends S {
|
|
|
3266
3333
|
);
|
|
3267
3334
|
M && A && this.createGradientHandles(A, M), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3268
3335
|
}
|
|
3269
|
-
}),
|
|
3336
|
+
}), h.addEventListener("click", async (I) => {
|
|
3270
3337
|
I.stopPropagation();
|
|
3271
|
-
const
|
|
3338
|
+
const E = `#${d.value}`;
|
|
3272
3339
|
try {
|
|
3273
|
-
await navigator.clipboard.writeText(
|
|
3274
|
-
const k =
|
|
3275
|
-
|
|
3340
|
+
await navigator.clipboard.writeText(E);
|
|
3341
|
+
const k = h.innerHTML;
|
|
3342
|
+
h.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3276
3343
|
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3277
3344
|
</svg>`, setTimeout(() => {
|
|
3278
|
-
|
|
3345
|
+
h.innerHTML = k;
|
|
3279
3346
|
}, 1e3);
|
|
3280
3347
|
} catch (k) {
|
|
3281
3348
|
console.warn("Failed to copy color to clipboard:", k);
|
|
@@ -3284,26 +3351,26 @@ class Ot extends S {
|
|
|
3284
3351
|
var I;
|
|
3285
3352
|
if (this.value && this.value.stops.length > 2) {
|
|
3286
3353
|
this.value.stops.splice(n, 1);
|
|
3287
|
-
const
|
|
3354
|
+
const E = (I = this.popoverElement) == null ? void 0 : I.querySelector(
|
|
3288
3355
|
".gradient-preview"
|
|
3289
|
-
), k =
|
|
3356
|
+
), k = E == null ? void 0 : E.querySelector(
|
|
3290
3357
|
".gradient-handles"
|
|
3291
3358
|
);
|
|
3292
|
-
|
|
3359
|
+
E && k && this.createGradientHandles(k, E), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3293
3360
|
}
|
|
3294
3361
|
}), o.appendChild(a), o.appendChild(r), o.appendChild(m), e.appendChild(o);
|
|
3295
3362
|
const g = document.createElement("div");
|
|
3296
3363
|
g.className = "gstop-opacity-row";
|
|
3297
3364
|
const f = document.createElement("span");
|
|
3298
3365
|
f.className = "gstop-opacity-label", f.textContent = "Opacity";
|
|
3299
|
-
const
|
|
3300
|
-
|
|
3366
|
+
const y = document.createElement("div");
|
|
3367
|
+
y.className = "gstop-opacity-group";
|
|
3301
3368
|
const v = document.createElement("input");
|
|
3302
3369
|
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = (s.opacity !== void 0 ? s.opacity : 100).toString();
|
|
3303
|
-
const
|
|
3370
|
+
const x = this.hexToRgb(s.color);
|
|
3304
3371
|
v.style.setProperty(
|
|
3305
3372
|
"--slider-color",
|
|
3306
|
-
`rgb(${
|
|
3373
|
+
`rgb(${x.r}, ${x.g}, ${x.b})`
|
|
3307
3374
|
);
|
|
3308
3375
|
const V = document.createElement("span");
|
|
3309
3376
|
V.className = "gstop-opacity-value", V.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
@@ -3418,8 +3485,8 @@ class Ot extends S {
|
|
|
3418
3485
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3419
3486
|
);
|
|
3420
3487
|
if (s) {
|
|
3421
|
-
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:
|
|
3422
|
-
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${
|
|
3488
|
+
const n = parseFloat(s[1]), o = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, l = s[4] ? parseFloat(s[4]) : 1, { r, g: c, b: d } = this.hslToRgb(n, o, a);
|
|
3489
|
+
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) };
|
|
3423
3490
|
}
|
|
3424
3491
|
return { color: e, position: 0, opacity: 100 };
|
|
3425
3492
|
}
|
|
@@ -3531,8 +3598,8 @@ class Ot extends S {
|
|
|
3531
3598
|
let o = "", a = 0;
|
|
3532
3599
|
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3533
3600
|
if (l) {
|
|
3534
|
-
const c = l[1].trim(),
|
|
3535
|
-
this.isValidColorFormat(c) ? (o = c, a =
|
|
3601
|
+
const c = l[1].trim(), d = parseFloat(l[2]);
|
|
3602
|
+
this.isValidColorFormat(c) ? (o = c, a = d) : (o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100);
|
|
3536
3603
|
} else
|
|
3537
3604
|
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3538
3605
|
const r = this.parseColorWithOpacity(o);
|
|
@@ -3589,7 +3656,7 @@ class ne extends G {
|
|
|
3589
3656
|
title: "Border",
|
|
3590
3657
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3591
3658
|
settings: {
|
|
3592
|
-
size: new
|
|
3659
|
+
size: new D({
|
|
3593
3660
|
title: "Size",
|
|
3594
3661
|
icon: At,
|
|
3595
3662
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
@@ -3598,7 +3665,7 @@ class ne extends G {
|
|
|
3598
3665
|
color: new W({
|
|
3599
3666
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3600
3667
|
}),
|
|
3601
|
-
radius: new
|
|
3668
|
+
radius: new D({
|
|
3602
3669
|
title: "Radius",
|
|
3603
3670
|
icon: $t,
|
|
3604
3671
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
@@ -3623,11 +3690,11 @@ const Bt = `
|
|
|
3623
3690
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3624
3691
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3625
3692
|
</svg>
|
|
3626
|
-
`,
|
|
3693
|
+
`, Ft = `
|
|
3627
3694
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3628
3695
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3629
3696
|
</svg>
|
|
3630
|
-
`,
|
|
3697
|
+
`, Dt = `
|
|
3631
3698
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3632
3699
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3633
3700
|
</svg>
|
|
@@ -3659,7 +3726,7 @@ class oe extends G {
|
|
|
3659
3726
|
}),
|
|
3660
3727
|
fontWeight: new et({
|
|
3661
3728
|
title: "Weight",
|
|
3662
|
-
icon:
|
|
3729
|
+
icon: Ft,
|
|
3663
3730
|
default: i.fontWeightDefault ?? "400",
|
|
3664
3731
|
options: i.fontWeightOptions ?? [
|
|
3665
3732
|
{ name: "Regular", value: "400" },
|
|
@@ -3669,9 +3736,9 @@ class oe extends G {
|
|
|
3669
3736
|
getOptions: i.fontWeightGetOptions,
|
|
3670
3737
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3671
3738
|
}),
|
|
3672
|
-
fontSize: new
|
|
3739
|
+
fontSize: new D({
|
|
3673
3740
|
title: "Size",
|
|
3674
|
-
icon:
|
|
3741
|
+
icon: Dt,
|
|
3675
3742
|
default: i.fontSizeDefault ?? 12,
|
|
3676
3743
|
suffix: "px",
|
|
3677
3744
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3679,7 +3746,7 @@ class oe extends G {
|
|
|
3679
3746
|
};
|
|
3680
3747
|
return e ? {
|
|
3681
3748
|
...n,
|
|
3682
|
-
align: new
|
|
3749
|
+
align: new bt({
|
|
3683
3750
|
title: "Align",
|
|
3684
3751
|
default: i.alignDefault ?? "center"
|
|
3685
3752
|
})
|
|
@@ -3812,11 +3879,11 @@ class le extends G {
|
|
|
3812
3879
|
title: "Background Image",
|
|
3813
3880
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3814
3881
|
settings: {
|
|
3815
|
-
backgroundImage: new
|
|
3882
|
+
backgroundImage: new at({
|
|
3816
3883
|
...t == null ? void 0 : t.uploadProps,
|
|
3817
3884
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3818
3885
|
}),
|
|
3819
|
-
opacity: new
|
|
3886
|
+
opacity: new yt({
|
|
3820
3887
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3821
3888
|
}),
|
|
3822
3889
|
backgroundColor: new W({
|
|
@@ -3846,12 +3913,12 @@ class le extends G {
|
|
|
3846
3913
|
}
|
|
3847
3914
|
}
|
|
3848
3915
|
export {
|
|
3849
|
-
|
|
3916
|
+
bt as AlignSetting,
|
|
3850
3917
|
se as AnimationSetting,
|
|
3851
3918
|
le as BackgroundSettingSet,
|
|
3852
3919
|
ne as BorderSettingSet,
|
|
3853
3920
|
qt as ButtonSetting,
|
|
3854
|
-
|
|
3921
|
+
F as ColorSetting,
|
|
3855
3922
|
W as ColorWithOpacitySetting,
|
|
3856
3923
|
Jt as DimensionSetting,
|
|
3857
3924
|
Qt as GapSetting,
|
|
@@ -3863,20 +3930,20 @@ export {
|
|
|
3863
3930
|
ae as MarginSettingGroup,
|
|
3864
3931
|
ee as MarginTopSetting,
|
|
3865
3932
|
ie as MultiLanguageSetting,
|
|
3866
|
-
|
|
3867
|
-
|
|
3933
|
+
D as NumberSetting,
|
|
3934
|
+
yt as OpacitySetting,
|
|
3868
3935
|
Yt as SelectApiSettings,
|
|
3869
3936
|
et as SelectSetting,
|
|
3870
3937
|
S as Setting,
|
|
3871
3938
|
G as SettingGroup,
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3939
|
+
mt as StringSetting,
|
|
3940
|
+
ut as TabSettingGroup,
|
|
3941
|
+
ut as TabsSettingGroup,
|
|
3875
3942
|
Kt as Toggle,
|
|
3876
|
-
|
|
3943
|
+
at as UploadSetting,
|
|
3877
3944
|
Xt as WidthSetting,
|
|
3878
3945
|
jt as asSettingGroupWithSettings,
|
|
3879
|
-
|
|
3946
|
+
gt as createSettingGroup,
|
|
3880
3947
|
Ut as createTabSettingGroup,
|
|
3881
3948
|
j as isSetting,
|
|
3882
3949
|
st as isSettingChild,
|