builder-settings-types 0.0.283 → 0.0.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +45 -43
- package/dist/builder-settings-types.es.js +361 -329
- package/dist/index.css +1 -1
- package/dist/transparency-pattern.svg +11 -0
- package/package.json +1 -1
|
@@ -11,14 +11,14 @@ function Ct(c) {
|
|
|
11
11
|
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function X(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
16
|
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function it(c, t = 0) {
|
|
19
19
|
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
X(s, n), it(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const yt = {
|
|
@@ -112,14 +112,14 @@ class Et {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const ot = new Et();
|
|
115
|
-
function
|
|
115
|
+
function K(c) {
|
|
116
116
|
if (c === null || typeof c != "object") return c;
|
|
117
117
|
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
-
if (c instanceof Array) return c.map((t) =>
|
|
118
|
+
if (c instanceof Array) return c.map((t) => K(t));
|
|
119
119
|
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
121
|
for (const e in c)
|
|
122
|
-
Object.prototype.hasOwnProperty.call(c, e) && (t[e] =
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = K(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return c;
|
|
@@ -142,15 +142,15 @@ function bt(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class b {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || ht(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, b.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, b.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -171,8 +171,8 @@ class w {
|
|
|
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 = K(this.props), i = new t(e);
|
|
175
|
+
return i.value = K(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -233,30 +233,30 @@ class w {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return c instanceof
|
|
236
|
+
function F(c) {
|
|
237
|
+
return c instanceof b;
|
|
238
238
|
}
|
|
239
239
|
function L(c) {
|
|
240
|
-
return c instanceof
|
|
240
|
+
return c instanceof T;
|
|
241
241
|
}
|
|
242
242
|
function at(c) {
|
|
243
|
-
return
|
|
243
|
+
return F(c) || L(c);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function _(c, t) {
|
|
246
246
|
for (const e in c)
|
|
247
247
|
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
248
248
|
const i = c[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const tt = class tt {
|
|
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
255
|
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || ht(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
259
|
+
_(this.settings, (e, i) => {
|
|
260
260
|
L(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
|
+
_(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(L(e) ||
|
|
278
|
+
(L(e) || F(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), it(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -328,7 +328,7 @@ const Y = class Y {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
331
|
+
_(this.settings, (s, n) => {
|
|
332
332
|
const o = String(s);
|
|
333
333
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
334
334
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -355,7 +355,7 @@ const Y = class Y {
|
|
|
355
355
|
setMobileValues(t) {
|
|
356
356
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
357
357
|
const s = this.settings[e];
|
|
358
|
-
s && (L(s) ||
|
|
358
|
+
s && (L(s) || F(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
359
359
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
360
360
|
}
|
|
361
361
|
getMobileValues(t) {
|
|
@@ -391,14 +391,14 @@ const Y = class Y {
|
|
|
391
391
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
392
392
|
}, 50));
|
|
393
393
|
};
|
|
394
|
-
return this.changeHandlers.clear(),
|
|
394
|
+
return this.changeHandlers.clear(), _(this.settings, (i, s) => {
|
|
395
395
|
var n;
|
|
396
396
|
if (L(s))
|
|
397
397
|
s.setOnChange(() => {
|
|
398
398
|
const o = this.getValues();
|
|
399
399
|
this.initialValues = o, t(o);
|
|
400
400
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
401
|
-
else if (
|
|
401
|
+
else if (F(s)) {
|
|
402
402
|
const o = () => e();
|
|
403
403
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
404
404
|
} else {
|
|
@@ -424,7 +424,7 @@ const Y = class Y {
|
|
|
424
424
|
at(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (L(n) ||
|
|
427
|
+
n && (L(n) || F(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
428
|
}), setTimeout(() => {
|
|
429
429
|
this.forceChildUIRefresh();
|
|
430
430
|
}, 0);
|
|
@@ -438,7 +438,7 @@ const Y = class Y {
|
|
|
438
438
|
const s = this.getValues();
|
|
439
439
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
440
|
};
|
|
441
|
-
L(t) ? t.setOnChange(() => e()) :
|
|
441
|
+
L(t) ? t.setOnChange(() => e()) : F(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
442
442
|
}
|
|
443
443
|
addSetting(t, e) {
|
|
444
444
|
var s, n;
|
|
@@ -454,7 +454,7 @@ const Y = class Y {
|
|
|
454
454
|
p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
|
|
455
455
|
}
|
|
456
456
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
457
|
-
r ? o.insertBefore(a, r) : o.appendChild(a), ot.trackElement(a),
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), ot.trackElement(a), X(a, this.nestingLevel + 1), it(a, this.nestingLevel + 1);
|
|
458
458
|
const h = a.style.display;
|
|
459
459
|
a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
|
|
460
460
|
}
|
|
@@ -705,7 +705,7 @@ const Y = class Y {
|
|
|
705
705
|
}
|
|
706
706
|
draw() {
|
|
707
707
|
const t = document.createElement("div");
|
|
708
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
708
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, tt.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), X(t, this.nestingLevel);
|
|
709
709
|
const e = document.createElement("div");
|
|
710
710
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
711
711
|
"aria-expanded",
|
|
@@ -762,8 +762,8 @@ const Y = class Y {
|
|
|
762
762
|
d.stopPropagation(), d.preventDefault();
|
|
763
763
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
764
764
|
if (at(g)) {
|
|
765
|
-
const
|
|
766
|
-
this.addSetting(
|
|
765
|
+
const f = `${this.addItemCfg.keyPrefix}${u}`;
|
|
766
|
+
this.addSetting(f, g);
|
|
767
767
|
}
|
|
768
768
|
}), a.appendChild(h);
|
|
769
769
|
}
|
|
@@ -809,12 +809,12 @@ const Y = class Y {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
let
|
|
814
|
-
function
|
|
812
|
+
tt.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
|
+
let T = tt;
|
|
814
|
+
function re(c) {
|
|
815
815
|
return new wt(c);
|
|
816
816
|
}
|
|
817
|
-
class wt extends
|
|
817
|
+
class wt extends T {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super(t);
|
|
820
820
|
const e = Object.keys(this.settings)[0];
|
|
@@ -866,12 +866,12 @@ class wt extends P {
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
function xt(c) {
|
|
869
|
-
return new
|
|
869
|
+
return new T(c);
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function ce(c) {
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
class Lt extends
|
|
874
|
+
class Lt extends b {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -892,17 +892,17 @@ class Lt extends w {
|
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
const kt = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
895
|
-
class
|
|
895
|
+
class I extends Lt {
|
|
896
896
|
constructor(t) {
|
|
897
897
|
super({
|
|
898
898
|
...t,
|
|
899
899
|
icon: t.icon || kt,
|
|
900
900
|
title: t.title || "Color",
|
|
901
|
-
default: t.default ?
|
|
901
|
+
default: t.default ? I.normalizeColorValue(t.default) : "#000000"
|
|
902
902
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
903
903
|
}
|
|
904
904
|
static normalizeColorValue(t) {
|
|
905
|
-
return t.startsWith("#") ?
|
|
905
|
+
return t.startsWith("#") ? I.normalizeHexValue(t) : t.includes(",") ? I.rgbToHexStatic(t) : I.normalizeHexValue(t);
|
|
906
906
|
}
|
|
907
907
|
static normalizeHexValue(t) {
|
|
908
908
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
@@ -923,7 +923,7 @@ class M extends Lt {
|
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
if (typeof t == "string") {
|
|
926
|
-
const e =
|
|
926
|
+
const e = I.normalizeColorValue(t);
|
|
927
927
|
this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
|
|
928
928
|
} else
|
|
929
929
|
this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
|
|
@@ -966,16 +966,16 @@ class M extends Lt {
|
|
|
966
966
|
var h, p;
|
|
967
967
|
let r = l.target.value.trim();
|
|
968
968
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
969
|
-
const d =
|
|
969
|
+
const d = I.normalizeColorValue(r);
|
|
970
970
|
this.value = d, (h = this.onChange) == null || h.call(this, d), (p = this.detectChange) == null || p.call(this, d), this.colorInputEl && (this.colorInputEl.value = d), n.style.backgroundColor = d;
|
|
971
971
|
}
|
|
972
972
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
973
973
|
var p, d;
|
|
974
|
-
const r = l.target.value, h =
|
|
974
|
+
const r = l.target.value, h = I.normalizeColorValue(r);
|
|
975
975
|
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h, e.classList.remove("error");
|
|
976
976
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
977
977
|
var p, d;
|
|
978
|
-
const r = l.target.value, h =
|
|
978
|
+
const r = l.target.value, h = I.normalizeColorValue(r);
|
|
979
979
|
this.value = h, (p = this.onChange) == null || p.call(this, h), (d = this.detectChange) == null || d.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h;
|
|
980
980
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
981
981
|
}
|
|
@@ -984,7 +984,7 @@ class M extends Lt {
|
|
|
984
984
|
}
|
|
985
985
|
// Helper method to get normalized hex value
|
|
986
986
|
getNormalizedValue() {
|
|
987
|
-
return this.value ?
|
|
987
|
+
return this.value ? I.normalizeColorValue(this.value) : "#000000";
|
|
988
988
|
}
|
|
989
989
|
// Helper method to check if current value is valid hex
|
|
990
990
|
isValidHex() {
|
|
@@ -1001,14 +1001,14 @@ const Mt = `
|
|
|
1001
1001
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1002
1002
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1003
1003
|
</svg>`;
|
|
1004
|
-
class
|
|
1004
|
+
class G extends b {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
1008
|
icon: t.icon || Mt,
|
|
1009
1009
|
title: t.title || "Color & Opacity",
|
|
1010
1010
|
default: t.default || "#000000FF"
|
|
1011
|
-
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value =
|
|
1011
|
+
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = G.normalizeHexWithOpacity(this.value));
|
|
1012
1012
|
}
|
|
1013
1013
|
static normalizeHexWithOpacity(t) {
|
|
1014
1014
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -1026,7 +1026,7 @@ class R extends w {
|
|
|
1026
1026
|
return `#${i}${n}`;
|
|
1027
1027
|
}
|
|
1028
1028
|
setValue(t) {
|
|
1029
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1029
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = G.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1030
1030
|
}
|
|
1031
1031
|
updateInputElements() {
|
|
1032
1032
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1037,7 +1037,7 @@ class R extends w {
|
|
|
1037
1037
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1038
1038
|
}
|
|
1039
1039
|
handleColorChange(t) {
|
|
1040
|
-
const e = this.getOpacityPercent(), i =
|
|
1040
|
+
const e = this.getOpacityPercent(), i = G.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class R extends w {
|
|
|
1048
1048
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1049
1049
|
}
|
|
1050
1050
|
handleOpacityChange(t) {
|
|
1051
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1051
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = G.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1123,7 +1123,7 @@ class R extends w {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class
|
|
1126
|
+
class he extends b {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class ce extends w {
|
|
|
1155
1155
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
class
|
|
1158
|
+
class N extends b {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1161
|
}
|
|
@@ -1219,7 +1219,7 @@ const St = `
|
|
|
1219
1219
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1220
1220
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1221
1221
|
</svg>`;
|
|
1222
|
-
class It extends
|
|
1222
|
+
class It extends N {
|
|
1223
1223
|
constructor(t = {}) {
|
|
1224
1224
|
const e = {
|
|
1225
1225
|
title: "Opacity",
|
|
@@ -1245,7 +1245,7 @@ const Nt = `
|
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class
|
|
1248
|
+
class st extends b {
|
|
1249
1249
|
constructor(t = {}) {
|
|
1250
1250
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1251
1251
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1352,7 +1352,7 @@ class it extends w {
|
|
|
1352
1352
|
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();
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
class Vt extends
|
|
1355
|
+
class Vt extends b {
|
|
1356
1356
|
constructor(t = {}) {
|
|
1357
1357
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1358
1358
|
}
|
|
@@ -1408,7 +1408,7 @@ class Vt extends w {
|
|
|
1408
1408
|
}), t.appendChild(i), t;
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
class
|
|
1411
|
+
class pe extends b {
|
|
1412
1412
|
constructor(t) {
|
|
1413
1413
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1414
1414
|
}
|
|
@@ -1437,21 +1437,21 @@ class he extends w {
|
|
|
1437
1437
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
class
|
|
1440
|
+
class de extends b {
|
|
1441
1441
|
constructor(t = {}) {
|
|
1442
1442
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1443
1443
|
const e = t.width || 0, i = t.height || 0;
|
|
1444
1444
|
this.value || (this.value = {
|
|
1445
1445
|
width: e,
|
|
1446
1446
|
height: i
|
|
1447
|
-
}), 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
|
|
1447
|
+
}), 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 N({
|
|
1448
1448
|
title: "Width",
|
|
1449
1449
|
default: this.value.width,
|
|
1450
1450
|
suffix: "px",
|
|
1451
1451
|
minValue: this.minWidth,
|
|
1452
1452
|
maxValue: this.maxWidth,
|
|
1453
1453
|
icon: Pt
|
|
1454
|
-
}), this.heightSetting = new
|
|
1454
|
+
}), this.heightSetting = new N({
|
|
1455
1455
|
title: "Height",
|
|
1456
1456
|
default: this.value.height,
|
|
1457
1457
|
suffix: "px",
|
|
@@ -1555,7 +1555,7 @@ const Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1555
1555
|
<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"/>
|
|
1556
1556
|
</svg>`, Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1557
1557
|
<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"/>
|
|
1558
|
-
</svg>`,
|
|
1558
|
+
</svg>`, et = `
|
|
1559
1559
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1560
1560
|
<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"/>
|
|
1561
1561
|
</svg>
|
|
@@ -1588,7 +1588,7 @@ const Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1588
1588
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1589
1589
|
</svg>
|
|
1590
1590
|
`;
|
|
1591
|
-
class pt extends
|
|
1591
|
+
class pt extends b {
|
|
1592
1592
|
constructor(t = {}) {
|
|
1593
1593
|
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();
|
|
1594
1594
|
}
|
|
@@ -1641,7 +1641,7 @@ class pt extends w {
|
|
|
1641
1641
|
);
|
|
1642
1642
|
if (t && t !== "") {
|
|
1643
1643
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1644
|
-
<span class="upload-icon">${
|
|
1644
|
+
<span class="upload-icon">${et}</span>
|
|
1645
1645
|
<span class="upload-label">Replace</span>
|
|
1646
1646
|
`);
|
|
1647
1647
|
const n = () => {
|
|
@@ -1652,7 +1652,7 @@ class pt extends w {
|
|
|
1652
1652
|
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1653
1653
|
} else
|
|
1654
1654
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1655
|
-
<span class="upload-icon">${
|
|
1655
|
+
<span class="upload-icon">${et}</span>
|
|
1656
1656
|
<span class="upload-label">Upload</span>
|
|
1657
1657
|
`);
|
|
1658
1658
|
}
|
|
@@ -1695,7 +1695,7 @@ class pt extends w {
|
|
|
1695
1695
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1696
1696
|
const o = document.createElement("button");
|
|
1697
1697
|
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1698
|
-
<span class="upload-icon">${
|
|
1698
|
+
<span class="upload-icon">${et}</span>
|
|
1699
1699
|
<span class="upload-label">Upload</span>
|
|
1700
1700
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1701
1701
|
window.postMessage(
|
|
@@ -1708,7 +1708,7 @@ class pt extends w {
|
|
|
1708
1708
|
}, t;
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
|
-
class
|
|
1711
|
+
class ue extends N {
|
|
1712
1712
|
constructor(t = {}) {
|
|
1713
1713
|
super({
|
|
1714
1714
|
...t,
|
|
@@ -1729,7 +1729,7 @@ class de extends I {
|
|
|
1729
1729
|
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1730
1730
|
<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"/>
|
|
1731
1731
|
</svg>`;
|
|
1732
|
-
class
|
|
1732
|
+
class ge extends N {
|
|
1733
1733
|
constructor(t = {}) {
|
|
1734
1734
|
super({
|
|
1735
1735
|
...t,
|
|
@@ -1754,7 +1754,7 @@ const Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1754
1754
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1755
1755
|
</svg>
|
|
1756
1756
|
`;
|
|
1757
|
-
class
|
|
1757
|
+
class me extends b {
|
|
1758
1758
|
constructor(t = {}) {
|
|
1759
1759
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1760
1760
|
const e = this._options.findIndex(
|
|
@@ -1901,7 +1901,7 @@ class ge extends w {
|
|
|
1901
1901
|
), this.updateButtonText();
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
|
-
class
|
|
1904
|
+
class fe extends b {
|
|
1905
1905
|
constructor(t) {
|
|
1906
1906
|
var e, i;
|
|
1907
1907
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
@@ -1954,7 +1954,7 @@ class me extends w {
|
|
|
1954
1954
|
const Rt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1955
1955
|
<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"/>
|
|
1956
1956
|
</svg>`;
|
|
1957
|
-
class
|
|
1957
|
+
class ve extends b {
|
|
1958
1958
|
// Store mobile value
|
|
1959
1959
|
constructor(t = {}) {
|
|
1960
1960
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Rt, 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);
|
|
@@ -2011,7 +2011,7 @@ class fe extends w {
|
|
|
2011
2011
|
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2012
2012
|
<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"/>
|
|
2013
2013
|
</svg>`;
|
|
2014
|
-
class
|
|
2014
|
+
class Ce extends N {
|
|
2015
2015
|
constructor(t = {}) {
|
|
2016
2016
|
super({
|
|
2017
2017
|
...t,
|
|
@@ -2024,26 +2024,26 @@ class ve extends I {
|
|
|
2024
2024
|
}), this.inputType = "number";
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
2027
|
-
const
|
|
2027
|
+
const Gt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2028
2028
|
<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"
|
|
2029
2029
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2030
2030
|
</svg>`;
|
|
2031
|
-
class
|
|
2031
|
+
class ye extends N {
|
|
2032
2032
|
constructor(t = {}) {
|
|
2033
2033
|
super({
|
|
2034
2034
|
...t,
|
|
2035
2035
|
minValue: t.minValue ?? 0,
|
|
2036
2036
|
maxValue: t.maxValue ?? 1e3,
|
|
2037
|
-
icon: t.icon ||
|
|
2037
|
+
icon: t.icon || Gt,
|
|
2038
2038
|
title: t.title || "Margin Top",
|
|
2039
2039
|
default: t.default ?? 20,
|
|
2040
2040
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2041
2041
|
}), this.inputType = "number";
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
|
-
class
|
|
2044
|
+
class Ee extends b {
|
|
2045
2045
|
constructor(t) {
|
|
2046
|
-
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(
|
|
2046
|
+
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(b.DefaultLanguage) ? b.DefaultLanguage : t.languages[0];
|
|
2047
2047
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2048
2048
|
t.languages.forEach((i) => {
|
|
2049
2049
|
var s, n;
|
|
@@ -2076,8 +2076,8 @@ class ye extends w {
|
|
|
2076
2076
|
const h = "...";
|
|
2077
2077
|
let p = 0, d = e.length, u = 0;
|
|
2078
2078
|
for (; p <= d; ) {
|
|
2079
|
-
const
|
|
2080
|
-
this.measureTextWidth(
|
|
2079
|
+
const f = Math.floor((p + d) / 2), m = e.slice(0, f).trimEnd() + h;
|
|
2080
|
+
this.measureTextWidth(m, i) <= l ? (u = f, p = f + 1) : d = f - 1;
|
|
2081
2081
|
}
|
|
2082
2082
|
const g = e.slice(0, u).trimEnd() + h;
|
|
2083
2083
|
t.placeholder = g;
|
|
@@ -2188,7 +2188,7 @@ class ye extends w {
|
|
|
2188
2188
|
});
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
class
|
|
2191
|
+
class be extends b {
|
|
2192
2192
|
constructor(t = {}) {
|
|
2193
2193
|
super(t), this.inputType = "select";
|
|
2194
2194
|
const e = [
|
|
@@ -2199,7 +2199,7 @@ class Ee extends w {
|
|
|
2199
2199
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2200
2200
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2201
2201
|
];
|
|
2202
|
-
this.selectSetting = new
|
|
2202
|
+
this.selectSetting = new st({
|
|
2203
2203
|
title: this.title || "Animation",
|
|
2204
2204
|
options: e,
|
|
2205
2205
|
default: this.props.default || "none"
|
|
@@ -2224,42 +2224,42 @@ const dt = (c, t) => {
|
|
|
2224
2224
|
n = p.left, o = p.top, document.addEventListener("mousemove", l), document.addEventListener("mouseup", r), document.body.style.userSelect = "none";
|
|
2225
2225
|
}, l = (h) => {
|
|
2226
2226
|
if (!e) return;
|
|
2227
|
-
const p = h.clientX - i, d = h.clientY - s, u = window.innerWidth, g = window.innerHeight,
|
|
2227
|
+
const p = h.clientX - i, d = h.clientY - s, u = window.innerWidth, g = window.innerHeight, f = t.offsetWidth, m = t.offsetHeight;
|
|
2228
2228
|
let C = n + p, y = o + d;
|
|
2229
|
-
C = Math.max(8, Math.min(u -
|
|
2229
|
+
C = Math.max(8, Math.min(u - f - 8, C)), y = Math.max(8, Math.min(g - m - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`;
|
|
2230
2230
|
}, r = () => {
|
|
2231
2231
|
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2232
2232
|
};
|
|
2233
2233
|
c.addEventListener("mousedown", a);
|
|
2234
|
-
},
|
|
2234
|
+
}, B = (c) => {
|
|
2235
2235
|
if (!c) return null;
|
|
2236
2236
|
let t = c.trim();
|
|
2237
2237
|
return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
|
|
2238
|
-
},
|
|
2238
|
+
}, U = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, k = (c) => {
|
|
2239
2239
|
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2240
2240
|
return {
|
|
2241
2241
|
r: parseInt(e.slice(0, 2), 16),
|
|
2242
2242
|
g: parseInt(e.slice(2, 4), 16),
|
|
2243
2243
|
b: parseInt(e.slice(4, 6), 16)
|
|
2244
2244
|
};
|
|
2245
|
-
},
|
|
2246
|
-
const { r: t, g: e, b: i } =
|
|
2245
|
+
}, $ = (c) => {
|
|
2246
|
+
const { r: t, g: e, b: i } = k(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2247
2247
|
let h = 0;
|
|
2248
2248
|
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4), h < 0 && (h += 6);
|
|
2249
2249
|
const p = a === 0 ? 0 : r / a, d = a;
|
|
2250
2250
|
return { h: h * 60, s: p, v: d };
|
|
2251
|
-
},
|
|
2251
|
+
}, q = (c, t, e) => {
|
|
2252
2252
|
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2253
2253
|
let a = 0, l = 0, r = 0;
|
|
2254
|
-
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n),
|
|
2254
|
+
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), U(
|
|
2255
2255
|
Math.round((a + o) * 255),
|
|
2256
2256
|
Math.round((l + o) * 255),
|
|
2257
2257
|
Math.round((r + o) * 255)
|
|
2258
2258
|
);
|
|
2259
|
-
},
|
|
2259
|
+
}, Ut = (c, t, e) => {
|
|
2260
2260
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2261
2261
|
return { hue: c, sat: s, lightness: i };
|
|
2262
|
-
},
|
|
2262
|
+
}, Y = (c, t, e) => {
|
|
2263
2263
|
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2264
2264
|
let o = 0, a = 0, l = 0;
|
|
2265
2265
|
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
@@ -2270,7 +2270,7 @@ const dt = (c, t) => {
|
|
|
2270
2270
|
}, ut = (c, t) => {
|
|
2271
2271
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2272
2272
|
if (c.startsWith("#")) {
|
|
2273
|
-
const { r: s, g: n, b: o } =
|
|
2273
|
+
const { r: s, g: n, b: o } = k(c);
|
|
2274
2274
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2275
2275
|
}
|
|
2276
2276
|
if (c.startsWith("rgba("))
|
|
@@ -2280,7 +2280,7 @@ const dt = (c, t) => {
|
|
|
2280
2280
|
if (c.startsWith("hsl(")) {
|
|
2281
2281
|
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2282
2282
|
if (s) {
|
|
2283
|
-
const { r: n, g: o, b: a } =
|
|
2283
|
+
const { r: n, g: o, b: a } = Y(
|
|
2284
2284
|
parseInt(s[1]),
|
|
2285
2285
|
parseInt(s[2]) / 100,
|
|
2286
2286
|
parseInt(s[3]) / 100
|
|
@@ -2291,7 +2291,7 @@ const dt = (c, t) => {
|
|
|
2291
2291
|
if (c.startsWith("hsla(")) {
|
|
2292
2292
|
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2293
2293
|
if (s) {
|
|
2294
|
-
const { r: n, g: o, b: a } =
|
|
2294
|
+
const { r: n, g: o, b: a } = Y(
|
|
2295
2295
|
parseInt(s[1]),
|
|
2296
2296
|
parseInt(s[2]) / 100,
|
|
2297
2297
|
parseInt(s[3]) / 100
|
|
@@ -2299,9 +2299,9 @@ const dt = (c, t) => {
|
|
|
2299
2299
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
-
const i =
|
|
2302
|
+
const i = B(c);
|
|
2303
2303
|
if (i) {
|
|
2304
|
-
const { r: s, g: n, b: o } =
|
|
2304
|
+
const { r: s, g: n, b: o } = k(i);
|
|
2305
2305
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2306
2306
|
}
|
|
2307
2307
|
return c;
|
|
@@ -2336,7 +2336,7 @@ const dt = (c, t) => {
|
|
|
2336
2336
|
/^[a-zA-Z]+$/
|
|
2337
2337
|
].some((e) => e.test(c.trim())), Wt = (c) => {
|
|
2338
2338
|
if (typeof document > "u")
|
|
2339
|
-
return gt(c) || !!
|
|
2339
|
+
return gt(c) || !!B(c);
|
|
2340
2340
|
const t = document.createElement("div");
|
|
2341
2341
|
return t.style.color = c, t.style.color !== "";
|
|
2342
2342
|
}, mt = (c) => {
|
|
@@ -2344,7 +2344,7 @@ const dt = (c, t) => {
|
|
|
2344
2344
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2345
2345
|
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2346
2346
|
return {
|
|
2347
|
-
color:
|
|
2347
|
+
color: U(o, a, l),
|
|
2348
2348
|
position: 0,
|
|
2349
2349
|
opacity: Math.round(r / 255 * 100)
|
|
2350
2350
|
};
|
|
@@ -2355,7 +2355,7 @@ const dt = (c, t) => {
|
|
|
2355
2355
|
if (e) {
|
|
2356
2356
|
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2357
2357
|
return {
|
|
2358
|
-
color:
|
|
2358
|
+
color: U(n, o, a),
|
|
2359
2359
|
position: 0,
|
|
2360
2360
|
opacity: Math.round(l * 100)
|
|
2361
2361
|
};
|
|
@@ -2364,18 +2364,18 @@ const dt = (c, t) => {
|
|
|
2364
2364
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2365
2365
|
);
|
|
2366
2366
|
if (i) {
|
|
2367
|
-
const { r: n, g: o, b: a } =
|
|
2367
|
+
const { r: n, g: o, b: a } = Y(
|
|
2368
2368
|
parseFloat(i[1]),
|
|
2369
2369
|
parseFloat(i[2]) / 100,
|
|
2370
2370
|
parseFloat(i[3]) / 100
|
|
2371
2371
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2372
2372
|
return {
|
|
2373
|
-
color:
|
|
2373
|
+
color: U(n, o, a),
|
|
2374
2374
|
position: 0,
|
|
2375
2375
|
opacity: Math.round(l * 100)
|
|
2376
2376
|
};
|
|
2377
2377
|
}
|
|
2378
|
-
return { color:
|
|
2378
|
+
return { color: B(t) || t, position: 0, opacity: 100 };
|
|
2379
2379
|
}, lt = (c) => {
|
|
2380
2380
|
const t = [];
|
|
2381
2381
|
let e = "", i = 0;
|
|
@@ -2422,7 +2422,7 @@ const dt = (c, t) => {
|
|
|
2422
2422
|
const l = mt(n);
|
|
2423
2423
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2424
2424
|
}), t;
|
|
2425
|
-
},
|
|
2425
|
+
}, A = (c) => {
|
|
2426
2426
|
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2427
2427
|
return {
|
|
2428
2428
|
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
@@ -2437,7 +2437,7 @@ const dt = (c, t) => {
|
|
|
2437
2437
|
const t = c.replace(/;$/, "").trim();
|
|
2438
2438
|
if (Wt(t)) {
|
|
2439
2439
|
const s = mt(t);
|
|
2440
|
-
return
|
|
2440
|
+
return A({ type: "solid", angle: 0, stops: [s] });
|
|
2441
2441
|
}
|
|
2442
2442
|
const e = rt(t, "linear-gradient");
|
|
2443
2443
|
if (e) {
|
|
@@ -2458,15 +2458,15 @@ const dt = (c, t) => {
|
|
|
2458
2458
|
"to top left": 315
|
|
2459
2459
|
}[a] ?? 90, o = s.slice(1));
|
|
2460
2460
|
const l = ct(o);
|
|
2461
|
-
return l.length ?
|
|
2461
|
+
return l.length ? A({ type: "linear", angle: n, stops: l }) : null;
|
|
2462
2462
|
}
|
|
2463
2463
|
const i = rt(t, "radial-gradient");
|
|
2464
2464
|
if (i) {
|
|
2465
2465
|
const s = lt(i), n = s[0] && !qt(s[0]) ? s.slice(1) : s, o = ct(n);
|
|
2466
|
-
return o.length ?
|
|
2466
|
+
return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
|
|
2467
2467
|
}
|
|
2468
2468
|
return null;
|
|
2469
|
-
},
|
|
2469
|
+
}, V = (c) => {
|
|
2470
2470
|
if (c.type === "solid") {
|
|
2471
2471
|
const e = c.stops[0], i = e.opacity ?? 100, s = e.color.replace("#", ""), n = Math.round(i / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2472
2472
|
return `#${s}${n}`;
|
|
@@ -2475,7 +2475,7 @@ const dt = (c, t) => {
|
|
|
2475
2475
|
(e) => `${ut(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2476
2476
|
).join(", ");
|
|
2477
2477
|
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
2478
|
-
}, jt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"),
|
|
2478
|
+
}, jt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), Z = (c) => {
|
|
2479
2479
|
if (c.type === "solid") {
|
|
2480
2480
|
const t = c.stops[0];
|
|
2481
2481
|
if (t) {
|
|
@@ -2490,7 +2490,7 @@ const dt = (c, t) => {
|
|
|
2490
2490
|
return "#000000";
|
|
2491
2491
|
}
|
|
2492
2492
|
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
2493
|
-
},
|
|
2493
|
+
}, j = class j {
|
|
2494
2494
|
static defaults() {
|
|
2495
2495
|
return {
|
|
2496
2496
|
solid: [],
|
|
@@ -2500,7 +2500,7 @@ const dt = (c, t) => {
|
|
|
2500
2500
|
static normalizeList(t) {
|
|
2501
2501
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2502
2502
|
return t.forEach((s) => {
|
|
2503
|
-
let n =
|
|
2503
|
+
let n = B(s);
|
|
2504
2504
|
n || O(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2505
2505
|
}), i.slice(0, this.MAX_COLORS);
|
|
2506
2506
|
}
|
|
@@ -2544,7 +2544,7 @@ const dt = (c, t) => {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
static addColor(t, e) {
|
|
2546
2546
|
if (!t) return;
|
|
2547
|
-
let i =
|
|
2547
|
+
let i = B(t), s = "solid";
|
|
2548
2548
|
if (i)
|
|
2549
2549
|
s = "solid";
|
|
2550
2550
|
else {
|
|
@@ -2556,42 +2556,69 @@ const dt = (c, t) => {
|
|
|
2556
2556
|
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2557
2557
|
}
|
|
2558
2558
|
};
|
|
2559
|
-
|
|
2560
|
-
let
|
|
2561
|
-
const
|
|
2559
|
+
j.STORAGE_KEY = "settingsLib_recentColors", j.MAX_COLORS = 12, j.colors = null;
|
|
2560
|
+
let D = j;
|
|
2561
|
+
const nt = (c, t) => {
|
|
2562
2562
|
const e = document.createElement("div");
|
|
2563
2563
|
e.className = "color-picker-recent-section";
|
|
2564
2564
|
const i = document.createElement("div");
|
|
2565
|
-
i.className = "color-picker-recent-title", i.textContent = "Recently Used
|
|
2565
|
+
i.className = "color-picker-recent-title", i.textContent = "Recently Used";
|
|
2566
2566
|
const s = document.createElement("div");
|
|
2567
2567
|
s.className = "color-picker-recent-grid";
|
|
2568
2568
|
const n = document.createElement("div");
|
|
2569
2569
|
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2570
2570
|
const o = () => {
|
|
2571
2571
|
s.innerHTML = "";
|
|
2572
|
-
const a =
|
|
2572
|
+
const a = D.getColors(t);
|
|
2573
2573
|
if (a.length === 0) {
|
|
2574
2574
|
s.style.display = "none", n.style.display = "block";
|
|
2575
2575
|
return;
|
|
2576
2576
|
}
|
|
2577
2577
|
s.style.display = "grid", n.style.display = "none", a.forEach((l) => {
|
|
2578
2578
|
const r = document.createElement("button");
|
|
2579
|
-
r.type = "button", r.className = "color-picker-recent-swatch"
|
|
2579
|
+
r.type = "button", r.className = "color-picker-recent-swatch";
|
|
2580
|
+
const h = _t(l);
|
|
2581
|
+
r.title = h, r.setAttribute("aria-label", `Use color: ${h}`), r.style.background = l, r.style.borderColor = l;
|
|
2582
|
+
const p = document.createElement("div");
|
|
2583
|
+
p.className = "color-picker-tooltip", p.textContent = h, p.style.display = "none", document.body.appendChild(p), r.addEventListener("mouseenter", (d) => {
|
|
2584
|
+
const u = r.getBoundingClientRect();
|
|
2585
|
+
p.style.display = "block", p.style.left = `${u.left + u.width / 2}px`, p.style.top = `${u.bottom + 8}px`;
|
|
2586
|
+
}), r.addEventListener("mouseleave", () => {
|
|
2587
|
+
p.style.display = "none", r.style.boxShadow = "";
|
|
2588
|
+
}), r.addEventListener("mousedown", () => {
|
|
2589
|
+
r.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
2590
|
+
}), r.addEventListener("mouseup", () => {
|
|
2591
|
+
setTimeout(() => {
|
|
2592
|
+
r.style.boxShadow = "";
|
|
2593
|
+
}, 150);
|
|
2594
|
+
}), r.addEventListener("click", () => c(l)), r.addEventListener("DOMNodeRemoved", () => {
|
|
2595
|
+
p.parentNode && p.parentNode.removeChild(p);
|
|
2596
|
+
}), s.appendChild(r);
|
|
2580
2597
|
});
|
|
2581
2598
|
};
|
|
2582
2599
|
return o(), { container: e, refresh: o };
|
|
2600
|
+
}, _t = (c) => {
|
|
2601
|
+
const t = O(c);
|
|
2602
|
+
if (t)
|
|
2603
|
+
return Z(t);
|
|
2604
|
+
const e = B(c);
|
|
2605
|
+
if (e) {
|
|
2606
|
+
const i = k(e);
|
|
2607
|
+
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2608
|
+
}
|
|
2609
|
+
return c;
|
|
2583
2610
|
}, ft = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2584
2611
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2585
2612
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2586
2613
|
fill="#919EAB"/>
|
|
2587
|
-
</svg>`,
|
|
2614
|
+
</svg>`, Jt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2588
2615
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2589
|
-
</svg>`,
|
|
2616
|
+
</svg>`, Xt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2590
2617
|
<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"/>
|
|
2591
|
-
</svg>`,
|
|
2618
|
+
</svg>`, Zt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2592
2619
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2593
2620
|
</svg>`;
|
|
2594
|
-
class
|
|
2621
|
+
class Kt {
|
|
2595
2622
|
constructor(t, e = "gradient") {
|
|
2596
2623
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2597
2624
|
if (!this.isOpen) return;
|
|
@@ -2631,38 +2658,40 @@ class Zt {
|
|
|
2631
2658
|
const o = document.createElement("div");
|
|
2632
2659
|
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
2633
2660
|
const a = document.createElement("div");
|
|
2634
|
-
a.className = "color-picker-
|
|
2661
|
+
a.className = "color-picker-sliders-container";
|
|
2635
2662
|
const l = document.createElement("button");
|
|
2636
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2663
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Jt;
|
|
2637
2664
|
const r = document.createElement("div");
|
|
2638
|
-
r.className = "color-picker-
|
|
2665
|
+
r.className = "color-picker-sliders-group";
|
|
2639
2666
|
const h = document.createElement("div");
|
|
2640
|
-
h.className = "color-picker-hue
|
|
2667
|
+
h.className = "color-picker-hue", this.hueSlider = h;
|
|
2641
2668
|
const p = document.createElement("div");
|
|
2642
|
-
p.className = "color-picker-
|
|
2669
|
+
p.className = "color-picker-hue-marker", this.hueMarker = p, h.appendChild(p);
|
|
2643
2670
|
const d = document.createElement("div");
|
|
2644
|
-
d.className = "color-picker-opacity
|
|
2645
|
-
const u =
|
|
2646
|
-
|
|
2647
|
-
|
|
2671
|
+
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2672
|
+
const u = document.createElement("div");
|
|
2673
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(h), r.appendChild(d), a.appendChild(l), a.appendChild(r);
|
|
2674
|
+
const g = nt((H) => {
|
|
2675
|
+
var z;
|
|
2676
|
+
this.setColor(H), (z = this.onChange) == null || z.call(this, H, this.currentOpacity);
|
|
2648
2677
|
}, this.recentScope);
|
|
2649
|
-
this.recentSectionRefresh =
|
|
2650
|
-
const
|
|
2651
|
-
|
|
2678
|
+
this.recentSectionRefresh = g.refresh;
|
|
2679
|
+
const f = document.createElement("div");
|
|
2680
|
+
f.className = "color-picker-format-section";
|
|
2652
2681
|
const m = document.createElement("select");
|
|
2653
2682
|
m.className = "color-picker-format-select", this.select = m;
|
|
2654
|
-
const f = document.createElement("option");
|
|
2655
|
-
f.value = "hex", f.textContent = "HEX";
|
|
2656
2683
|
const C = document.createElement("option");
|
|
2657
|
-
C.value = "
|
|
2684
|
+
C.value = "hex", C.textContent = "HEX";
|
|
2658
2685
|
const y = document.createElement("option");
|
|
2659
|
-
y.value = "
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2664
|
-
const
|
|
2665
|
-
|
|
2686
|
+
y.value = "rgb", y.textContent = "RGB";
|
|
2687
|
+
const x = document.createElement("option");
|
|
2688
|
+
x.value = "hsl", x.textContent = "HSL", m.appendChild(C), m.appendChild(y), m.appendChild(x);
|
|
2689
|
+
const M = document.createElement("input");
|
|
2690
|
+
M.type = "text", M.className = "color-picker-color-input", M.value = this.currentColor, this.input = M;
|
|
2691
|
+
const S = document.createElement("div");
|
|
2692
|
+
S.className = "color-picker-input-container";
|
|
2693
|
+
const R = document.createElement("button");
|
|
2694
|
+
return R.className = "color-picker-copy-inside", R.textContent = "Copy", S.appendChild(M), S.appendChild(R), f.appendChild(m), f.appendChild(S), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(g.container), t.appendChild(f), t.addEventListener("click", (H) => H.stopPropagation()), this.bind(n, h, d, M, m, R, l), t;
|
|
2666
2695
|
}
|
|
2667
2696
|
createBackdrop() {
|
|
2668
2697
|
const t = document.createElement("div");
|
|
@@ -2675,14 +2704,14 @@ class Zt {
|
|
|
2675
2704
|
var y;
|
|
2676
2705
|
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
2677
2706
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2678
|
-
const
|
|
2707
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C = q(m, u, 1 - g);
|
|
2679
2708
|
this.currentColor = C, this.syncInput(), this.updateOpacityBg(), (y = this.onChange) == null || y.call(this, C, this.currentOpacity);
|
|
2680
2709
|
}, r = (p) => {
|
|
2681
2710
|
var y;
|
|
2682
2711
|
const d = e.getBoundingClientRect();
|
|
2683
2712
|
let u = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2684
2713
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2685
|
-
const g = u * 360,
|
|
2714
|
+
const g = u * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), C = q(g, f, 1 - m);
|
|
2686
2715
|
this.currentColor = C, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (y = this.onChange) == null || y.call(this, C, this.currentOpacity);
|
|
2687
2716
|
}, h = (p) => {
|
|
2688
2717
|
var g;
|
|
@@ -2734,17 +2763,17 @@ class Zt {
|
|
|
2734
2763
|
setColor(t) {
|
|
2735
2764
|
var o;
|
|
2736
2765
|
this.currentColor = t;
|
|
2737
|
-
const { h: e, s: i, v: s } =
|
|
2766
|
+
const { h: e, s: i, v: s } = $(t), n = e >= 360 ? e % 360 : e;
|
|
2738
2767
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2739
2768
|
}
|
|
2740
2769
|
syncInput() {
|
|
2741
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2770
|
+
const t = this.select.value, { h: e, s: i, v: s } = $(this.currentColor);
|
|
2742
2771
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2743
2772
|
else if (t === "rgb") {
|
|
2744
|
-
const { r: n, g: o, b: a } =
|
|
2773
|
+
const { r: n, g: o, b: a } = k(this.currentColor);
|
|
2745
2774
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2746
2775
|
} else {
|
|
2747
|
-
const { hue: n, sat: o, lightness: a } =
|
|
2776
|
+
const { hue: n, sat: o, lightness: a } = Ut(e, i, s);
|
|
2748
2777
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2749
2778
|
o * 100
|
|
2750
2779
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -2763,40 +2792,40 @@ class Zt {
|
|
|
2763
2792
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2764
2793
|
if (s) {
|
|
2765
2794
|
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
2766
|
-
e =
|
|
2795
|
+
e = q(n, r, l);
|
|
2767
2796
|
}
|
|
2768
2797
|
}
|
|
2769
2798
|
}
|
|
2770
2799
|
e && this.setColor(e);
|
|
2771
2800
|
}
|
|
2772
2801
|
updateOpacityBg() {
|
|
2773
|
-
const { r: t, g: e, b: i } =
|
|
2802
|
+
const { r: t, g: e, b: i } = k(this.currentColor);
|
|
2774
2803
|
this.opacitySlider.style.setProperty(
|
|
2775
2804
|
"--base-color",
|
|
2776
2805
|
`rgb(${t}, ${e}, ${i})`
|
|
2777
2806
|
);
|
|
2778
2807
|
}
|
|
2779
2808
|
open(t, e, i) {
|
|
2780
|
-
var
|
|
2809
|
+
var x;
|
|
2781
2810
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2782
|
-
const { h: s, s: n, v: o } =
|
|
2783
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (
|
|
2811
|
+
const { h: s, s: n, v: o } = $(t);
|
|
2812
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (x = this.recentSectionRefresh) == null || x.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2784
2813
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2785
2814
|
let u = r.right + 8, g = r.top;
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2815
|
+
const f = h - r.right, m = r.left;
|
|
2816
|
+
f >= a + d ? u = r.right + 8 : m >= a + d ? u = r.left - a - 8 : u = Math.max(d, (h - a) / 2);
|
|
2788
2817
|
const C = p - r.bottom, y = r.top;
|
|
2789
2818
|
C >= l + d ? g = r.bottom + 8 : y >= l + d ? g = r.top - l - 8 : C > y ? (g = r.bottom + 8, g + l > p - d && (g = p - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2790
2819
|
}
|
|
2791
2820
|
close(t) {
|
|
2792
2821
|
var e;
|
|
2793
|
-
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.recentScope
|
|
2822
|
+
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (D.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2794
2823
|
}
|
|
2795
2824
|
getElement() {
|
|
2796
2825
|
return this.element;
|
|
2797
2826
|
}
|
|
2798
2827
|
}
|
|
2799
|
-
class
|
|
2828
|
+
class Yt {
|
|
2800
2829
|
constructor(t) {
|
|
2801
2830
|
this.recentScope = "all", this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, t.scope && (this.recentScope = t.scope), this.container = this.createContainer(), this.initializePicker();
|
|
2802
2831
|
}
|
|
@@ -2806,19 +2835,21 @@ class Kt {
|
|
|
2806
2835
|
<div class="color-picker-area embedded">
|
|
2807
2836
|
<div class="color-picker-marker"></div>
|
|
2808
2837
|
</div>
|
|
2809
|
-
<div class="color-picker-
|
|
2838
|
+
<div class="color-picker-sliders-container embedded">
|
|
2810
2839
|
<button class="color-picker-eyedropper">
|
|
2811
2840
|
<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2812
2841
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2813
2842
|
</svg>
|
|
2814
2843
|
</button>
|
|
2815
|
-
<div class="color-picker-
|
|
2816
|
-
<div class="color-picker-hue
|
|
2844
|
+
<div class="color-picker-sliders-group">
|
|
2845
|
+
<div class="color-picker-hue embedded">
|
|
2846
|
+
<div class="color-picker-hue-marker"></div>
|
|
2847
|
+
</div>
|
|
2848
|
+
<div class="color-picker-opacity embedded">
|
|
2849
|
+
<div class="color-picker-opacity-marker"></div>
|
|
2850
|
+
</div>
|
|
2817
2851
|
</div>
|
|
2818
2852
|
</div>
|
|
2819
|
-
<div class="color-picker-opacity embedded">
|
|
2820
|
-
<div class="color-picker-opacity-marker"></div>
|
|
2821
|
-
</div>
|
|
2822
2853
|
<div class="color-picker-format-section embedded">
|
|
2823
2854
|
<select class="color-picker-format-select">
|
|
2824
2855
|
<option value="hex">HEX</option>
|
|
@@ -2831,7 +2862,7 @@ class Kt {
|
|
|
2831
2862
|
</div>
|
|
2832
2863
|
</div>
|
|
2833
2864
|
`;
|
|
2834
|
-
const e =
|
|
2865
|
+
const e = nt((i) => {
|
|
2835
2866
|
this.applyRecentColor(i);
|
|
2836
2867
|
}, this.recentScope);
|
|
2837
2868
|
return this.recentSectionRefresh = e.refresh, t.appendChild(e.container), t;
|
|
@@ -2855,7 +2886,7 @@ class Kt {
|
|
|
2855
2886
|
".color-picker-color-input"
|
|
2856
2887
|
), r = this.container.querySelector(
|
|
2857
2888
|
".color-picker-copy-inside"
|
|
2858
|
-
), { h, s: p, v: d } =
|
|
2889
|
+
), { h, s: p, v: d } = $(this.currentColor);
|
|
2859
2890
|
s.style.left = `${h / 360 * 100}%`, e.style.left = `${p * 100}%`, e.style.top = `${(1 - d) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`, o.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(n), this.updateColorInput(a, l), this.setupColorAreaEvents(t, e, s), this.setupHueSliderEvents(
|
|
2860
2891
|
i,
|
|
2861
2892
|
s,
|
|
@@ -2867,7 +2898,7 @@ class Kt {
|
|
|
2867
2898
|
), this.setupOpacitySliderEvents(n, o), this.setupFormatEvents(a, l, r);
|
|
2868
2899
|
}
|
|
2869
2900
|
updateOpacityBackground(t) {
|
|
2870
|
-
const e =
|
|
2901
|
+
const e = k(this.currentColor);
|
|
2871
2902
|
t.style.setProperty(
|
|
2872
2903
|
"--base-color",
|
|
2873
2904
|
`rgb(${e.r}, ${e.g}, ${e.b})`
|
|
@@ -2879,11 +2910,11 @@ class Kt {
|
|
|
2879
2910
|
e.value = this.currentColor;
|
|
2880
2911
|
break;
|
|
2881
2912
|
case "rgb":
|
|
2882
|
-
const s =
|
|
2913
|
+
const s = k(this.currentColor);
|
|
2883
2914
|
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2884
2915
|
break;
|
|
2885
2916
|
case "hsl":
|
|
2886
|
-
const { h: n, s: o, v: a } =
|
|
2917
|
+
const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
|
|
2887
2918
|
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2888
2919
|
r * 100
|
|
2889
2920
|
)}%, ${Math.round(l * 100)}%)`;
|
|
@@ -2904,13 +2935,13 @@ class Kt {
|
|
|
2904
2935
|
}
|
|
2905
2936
|
commitRecentColor() {
|
|
2906
2937
|
var t;
|
|
2907
|
-
|
|
2938
|
+
D.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
|
|
2908
2939
|
}
|
|
2909
2940
|
setupColorAreaEvents(t, e, i) {
|
|
2910
2941
|
const s = (n) => {
|
|
2911
2942
|
const o = t.getBoundingClientRect(), a = Math.max(0, Math.min(1, (n.clientX - o.left) / o.width)), l = Math.max(0, Math.min(1, (n.clientY - o.top) / o.height));
|
|
2912
2943
|
e.style.left = `${a * 100}%`, e.style.top = `${l * 100}%`;
|
|
2913
|
-
const r = parseFloat(i.style.left || "0%") / 100 * 360, h =
|
|
2944
|
+
const r = parseFloat(i.style.left || "0%") / 100 * 360, h = q(r, a, 1 - l);
|
|
2914
2945
|
this.currentColor = h;
|
|
2915
2946
|
const p = this.container.querySelector(
|
|
2916
2947
|
".color-picker-format-select"
|
|
@@ -2936,8 +2967,8 @@ class Kt {
|
|
|
2936
2967
|
p = Math.max(0, Math.min(1, p)), e.style.left = `${p * 100}%`;
|
|
2937
2968
|
const d = p * 360, u = parseFloat(s.style.left || "50%") / 100, g = parseFloat(s.style.top || "50%") / 100;
|
|
2938
2969
|
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2939
|
-
const
|
|
2940
|
-
this.currentColor =
|
|
2970
|
+
const f = q(d, u, 1 - g);
|
|
2971
|
+
this.currentColor = f, this.updateColorInput(n, o), this.updateOpacityBackground(a), this.triggerChange();
|
|
2941
2972
|
};
|
|
2942
2973
|
t.addEventListener("mousedown", (r) => {
|
|
2943
2974
|
r.preventDefault(), l(r);
|
|
@@ -2991,7 +3022,7 @@ class Kt {
|
|
|
2991
3022
|
}
|
|
2992
3023
|
parseHexInput(t) {
|
|
2993
3024
|
const e = t.startsWith("#") ? t : `#${t}`;
|
|
2994
|
-
return
|
|
3025
|
+
return B(e);
|
|
2995
3026
|
}
|
|
2996
3027
|
parseRgbInput(t) {
|
|
2997
3028
|
const e = t.match(
|
|
@@ -3000,7 +3031,7 @@ class Kt {
|
|
|
3000
3031
|
if (e) {
|
|
3001
3032
|
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
3002
3033
|
if (i <= 255 && s <= 255 && n <= 255)
|
|
3003
|
-
return
|
|
3034
|
+
return U(i, s, n);
|
|
3004
3035
|
}
|
|
3005
3036
|
return null;
|
|
3006
3037
|
}
|
|
@@ -3011,8 +3042,8 @@ class Kt {
|
|
|
3011
3042
|
if (e) {
|
|
3012
3043
|
const i = parseFloat(e[1]), s = parseFloat(e[2]) / 100, n = parseFloat(e[3]) / 100;
|
|
3013
3044
|
if (i >= 0 && i <= 360 && s >= 0 && s <= 1 && n >= 0 && n <= 1) {
|
|
3014
|
-
const o =
|
|
3015
|
-
return
|
|
3045
|
+
const o = Y(i, s, n);
|
|
3046
|
+
return U(o.r, o.g, o.b);
|
|
3016
3047
|
}
|
|
3017
3048
|
}
|
|
3018
3049
|
return null;
|
|
@@ -3034,7 +3065,7 @@ class Kt {
|
|
|
3034
3065
|
".color-picker-hue-marker"
|
|
3035
3066
|
), s = this.container.querySelector(
|
|
3036
3067
|
".color-picker-opacity"
|
|
3037
|
-
), { h: n, s: o, v: a } =
|
|
3068
|
+
), { h: n, s: o, v: a } = $(this.currentColor);
|
|
3038
3069
|
i.style.left = `${n / 360 * 100}%`, e.style.left = `${o * 100}%`, e.style.top = `${(1 - a) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.updateOpacityBackground(s);
|
|
3039
3070
|
}
|
|
3040
3071
|
triggerChange() {
|
|
@@ -3059,11 +3090,11 @@ class Kt {
|
|
|
3059
3090
|
".color-picker-format-select"
|
|
3060
3091
|
), r = this.container.querySelector(
|
|
3061
3092
|
".color-picker-color-input"
|
|
3062
|
-
), { h, s: p, v: d } =
|
|
3093
|
+
), { h, s: p, v: d } = $(t), u = h >= 360 ? h % 360 : h;
|
|
3063
3094
|
n.style.left = `${u / 360 * 100}%`, s.style.left = `${p * 100}%`, s.style.top = `${(1 - d) * 100}%`, i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, o.style.left = `${e}%`, this.updateOpacityBackground(a), this.updateColorInput(l, r);
|
|
3064
3095
|
}
|
|
3065
3096
|
}
|
|
3066
|
-
const
|
|
3097
|
+
const P = class P extends b {
|
|
3067
3098
|
constructor(t = {}) {
|
|
3068
3099
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3069
3100
|
super({
|
|
@@ -3105,9 +3136,9 @@ const V = class V extends w {
|
|
|
3105
3136
|
if (typeof t == "string") {
|
|
3106
3137
|
const i = O(t);
|
|
3107
3138
|
if (i)
|
|
3108
|
-
return
|
|
3139
|
+
return A(i);
|
|
3109
3140
|
}
|
|
3110
|
-
return
|
|
3141
|
+
return A(t && typeof t == "object" ? t : {
|
|
3111
3142
|
type: "linear",
|
|
3112
3143
|
angle: 90,
|
|
3113
3144
|
stops: [
|
|
@@ -3119,7 +3150,7 @@ const V = class V extends w {
|
|
|
3119
3150
|
setValue(t) {
|
|
3120
3151
|
var i, s;
|
|
3121
3152
|
let e = null;
|
|
3122
|
-
typeof t == "string" ? e = O(t) : t && typeof t == "object" && (e =
|
|
3153
|
+
typeof t == "string" ? e = O(t) : t && typeof t == "object" && (e = A(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null;
|
|
3123
3154
|
}
|
|
3124
3155
|
updateUI() {
|
|
3125
3156
|
if (this.previewEl && this.value)
|
|
@@ -3127,12 +3158,12 @@ const V = class V extends w {
|
|
|
3127
3158
|
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3128
3159
|
this.previewEl.style.background = ut(t.color, e);
|
|
3129
3160
|
} else
|
|
3130
|
-
this.previewEl.style.background =
|
|
3131
|
-
this.inputEl && this.value && !this.isEditing && (this.inputEl.value =
|
|
3161
|
+
this.previewEl.style.background = V(this.value);
|
|
3162
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = Z(this.value));
|
|
3132
3163
|
}
|
|
3133
3164
|
cssForTextValue() {
|
|
3134
3165
|
return this.value ? {
|
|
3135
|
-
background:
|
|
3166
|
+
background: V(this.value),
|
|
3136
3167
|
"-webkit-background-clip": "text",
|
|
3137
3168
|
"background-clip": "text",
|
|
3138
3169
|
color: "transparent",
|
|
@@ -3148,9 +3179,9 @@ const V = class V extends w {
|
|
|
3148
3179
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3149
3180
|
}
|
|
3150
3181
|
const e = document.createElement("div");
|
|
3151
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3182
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? V(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
3152
3183
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3153
|
-
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ?
|
|
3184
|
+
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? Z(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3154
3185
|
if (this.isEditing = !0, this.value)
|
|
3155
3186
|
if (this.value.type === "solid") {
|
|
3156
3187
|
const i = this.value.stops[0];
|
|
@@ -3164,14 +3195,14 @@ const V = class V extends w {
|
|
|
3164
3195
|
}
|
|
3165
3196
|
}
|
|
3166
3197
|
} else
|
|
3167
|
-
this.inputEl.value =
|
|
3198
|
+
this.inputEl.value = V(this.value);
|
|
3168
3199
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3169
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3200
|
+
this.isEditing = !1, this.value && (this.inputEl.value = Z(this.value));
|
|
3170
3201
|
}), this.inputEl.addEventListener(
|
|
3171
3202
|
"paste",
|
|
3172
3203
|
(i) => this.handlePaste(i)
|
|
3173
3204
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3174
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3205
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = V(this.value)), this.inputEl.blur());
|
|
3175
3206
|
}), e.appendChild(this.previewEl), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
3176
3207
|
}
|
|
3177
3208
|
createPopover() {
|
|
@@ -3227,7 +3258,7 @@ const V = class V extends w {
|
|
|
3227
3258
|
}
|
|
3228
3259
|
renderSolid(t) {
|
|
3229
3260
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3230
|
-
const e = this.value.stops[0], i = new
|
|
3261
|
+
const e = this.value.stops[0], i = new Yt({
|
|
3231
3262
|
initialColor: e.color,
|
|
3232
3263
|
initialOpacity: e.opacity ?? 100,
|
|
3233
3264
|
onColorChange: (s, n) => {
|
|
@@ -3256,24 +3287,24 @@ const V = class V extends w {
|
|
|
3256
3287
|
const o = document.createElement("input");
|
|
3257
3288
|
o.type = "text", o.inputMode = "numeric", o.className = "gradient-degree-input", o.value = `${this.value.angle ?? 90}°`, o.style.width = "75px", o.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, o.value = "90°");
|
|
3258
3289
|
const a = document.createElement("button");
|
|
3259
|
-
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML =
|
|
3290
|
+
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML = Xt, i.addEventListener("change", () => {
|
|
3260
3291
|
this.switchType(i.value === "radial" ? "radial" : "linear"), this.updateDegreeVisibility(o);
|
|
3261
|
-
}), o.addEventListener("focus", (
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
}), o.addEventListener("input", (
|
|
3265
|
-
const
|
|
3266
|
-
!Number.isNaN(
|
|
3267
|
-
}), o.addEventListener("blur", (
|
|
3292
|
+
}), o.addEventListener("focus", (f) => {
|
|
3293
|
+
const m = f.target;
|
|
3294
|
+
m.value = m.value.replace(/[^0-9-]/g, ""), setTimeout(() => m.select(), 0);
|
|
3295
|
+
}), o.addEventListener("input", (f) => {
|
|
3296
|
+
const m = parseInt(f.target.value);
|
|
3297
|
+
!Number.isNaN(m) && this.value && (this.value.angle = Math.max(0, Math.min(360, m)), this.debouncedPreviewUpdate());
|
|
3298
|
+
}), o.addEventListener("blur", (f) => {
|
|
3268
3299
|
var y;
|
|
3269
3300
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3270
|
-
const
|
|
3271
|
-
let C = parseInt(
|
|
3272
|
-
Number.isNaN(C) && (C = ((y = this.value) == null ? void 0 : y.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C),
|
|
3301
|
+
const m = f.target;
|
|
3302
|
+
let C = parseInt(m.value);
|
|
3303
|
+
Number.isNaN(C) && (C = ((y = this.value) == null ? void 0 : y.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C), m.value = `${C}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3273
3304
|
}), a.addEventListener("click", () => {
|
|
3274
|
-
!this.value || !this.value.stops || (this.value.stops.forEach((
|
|
3275
|
-
|
|
3276
|
-
}), this.value.stops.sort((
|
|
3305
|
+
!this.value || !this.value.stops || (this.value.stops.forEach((f) => {
|
|
3306
|
+
f.position = 100 - f.position;
|
|
3307
|
+
}), this.value.stops.sort((f, m) => f.position - m.position), this.updateGradientPreview(l), this.createHandles(r, l), this.updateStopsList(u), this.updateUI(), this.triggerChange());
|
|
3277
3308
|
}), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.updateDegreeVisibility(o);
|
|
3278
3309
|
const l = document.createElement("div");
|
|
3279
3310
|
l.className = "gradient-preview", this.updateGradientPreview(l);
|
|
@@ -3287,13 +3318,13 @@ const V = class V extends w {
|
|
|
3287
3318
|
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3288
3319
|
const u = document.createElement("div");
|
|
3289
3320
|
u.className = "gradient-stops", t.appendChild(h), t.appendChild(u), this.updateStopsList(u);
|
|
3290
|
-
const g =
|
|
3291
|
-
const
|
|
3292
|
-
|
|
3321
|
+
const g = nt((f) => {
|
|
3322
|
+
const m = O(f);
|
|
3323
|
+
m && (this.value = m, this.switchType(m.type), this.updateUI(), this.triggerChange());
|
|
3293
3324
|
}, "all");
|
|
3294
3325
|
this.recentGradientRefresh = g.refresh, t.appendChild(g.container), d.addEventListener("click", () => {
|
|
3295
|
-
var
|
|
3296
|
-
this.addStop(), this.updateStopsList(u), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), ((
|
|
3326
|
+
var f;
|
|
3327
|
+
this.addStop(), this.updateStopsList(u), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), ((f = document.activeElement) == null ? void 0 : f.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3297
3328
|
});
|
|
3298
3329
|
}
|
|
3299
3330
|
updateDegreeVisibility(t) {
|
|
@@ -3303,7 +3334,7 @@ const V = class V extends w {
|
|
|
3303
3334
|
updateGradientPreview(t) {
|
|
3304
3335
|
var i;
|
|
3305
3336
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3306
|
-
e && this.value && (e.style.background =
|
|
3337
|
+
e && this.value && (e.style.background = V(this.value));
|
|
3307
3338
|
}
|
|
3308
3339
|
debouncedPreviewUpdate(t) {
|
|
3309
3340
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3321,9 +3352,9 @@ const V = class V extends w {
|
|
|
3321
3352
|
a = !0, l = u.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", p), document.addEventListener("mouseup", d), u.preventDefault(), u.stopPropagation();
|
|
3322
3353
|
}, p = (u) => {
|
|
3323
3354
|
if (!a || !this.value) return;
|
|
3324
|
-
const g = e.getBoundingClientRect(),
|
|
3325
|
-
let
|
|
3326
|
-
|
|
3355
|
+
const g = e.getBoundingClientRect(), f = u.clientX - l;
|
|
3356
|
+
let m = r + f / g.width * 100;
|
|
3357
|
+
m = Math.max(0, Math.min(100, m)), this.value.stops[s].position = Math.round(m), n.style.left = `${m}%`, this.updateGradientPreview(), this.updateUI();
|
|
3327
3358
|
}, d = () => {
|
|
3328
3359
|
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((u, g) => u.position - g.position), this.createHandles(t, e)), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3329
3360
|
};
|
|
@@ -3340,12 +3371,12 @@ const V = class V extends w {
|
|
|
3340
3371
|
(n, o) => n.position - o.position
|
|
3341
3372
|
);
|
|
3342
3373
|
i.forEach((n, o) => {
|
|
3343
|
-
var
|
|
3374
|
+
var H, z;
|
|
3344
3375
|
const a = this.value.stops.findIndex(
|
|
3345
|
-
(v,
|
|
3346
|
-
(
|
|
3376
|
+
(v, E) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, E).filter(
|
|
3377
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3347
3378
|
).length === i.slice(0, o).filter(
|
|
3348
|
-
(
|
|
3379
|
+
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3349
3380
|
).length
|
|
3350
3381
|
), l = a !== -1 ? a : o, r = document.createElement("div");
|
|
3351
3382
|
r.className = "gstop-row";
|
|
@@ -3359,86 +3390,86 @@ const V = class V extends w {
|
|
|
3359
3390
|
u.className = "gstop-color-preview", u.style.backgroundColor = n.color;
|
|
3360
3391
|
const g = document.createElement("input");
|
|
3361
3392
|
g.type = "text", g.className = "gstop-color-input", g.value = n.color.replace("#", "").toUpperCase();
|
|
3362
|
-
const m = document.createElement("button");
|
|
3363
|
-
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(u), d.appendChild(g), d.appendChild(m);
|
|
3364
3393
|
const f = document.createElement("button");
|
|
3365
|
-
f.type = "button", f.className = "gstop-
|
|
3394
|
+
f.type = "button", f.className = "gstop-color-copy", f.textContent = "Copy", d.appendChild(u), d.appendChild(g), d.appendChild(f);
|
|
3395
|
+
const m = document.createElement("button");
|
|
3396
|
+
m.type = "button", m.className = "gstop-del", m.innerHTML = Zt, m.disabled = (((z = (H = this.value) == null ? void 0 : H.stops) == null ? void 0 : z.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(m), e.appendChild(r);
|
|
3366
3397
|
const C = document.createElement("span");
|
|
3367
3398
|
C.className = "gstop-opacity-label", C.textContent = "Opacity";
|
|
3368
3399
|
const y = document.createElement("div");
|
|
3369
3400
|
y.className = "gstop-opacity-group";
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
const
|
|
3373
|
-
|
|
3401
|
+
const x = document.createElement("input");
|
|
3402
|
+
x.type = "range", x.className = "gstop-opacity-slider", x.min = "0", x.max = "100", x.value = String(n.opacity ?? 100);
|
|
3403
|
+
const M = k(n.color);
|
|
3404
|
+
x.style.setProperty(
|
|
3374
3405
|
"--slider-color",
|
|
3375
|
-
`rgb(${
|
|
3406
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3376
3407
|
);
|
|
3377
|
-
const
|
|
3378
|
-
|
|
3379
|
-
const
|
|
3380
|
-
g.value = v.replace("#", "").toUpperCase(), u.style.backgroundColor = v, this.value.stops[l].color = v,
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3408
|
+
const S = document.createElement("span");
|
|
3409
|
+
S.className = "gstop-opacity-value", S.textContent = `${n.opacity ?? 100}%`, y.appendChild(x), y.appendChild(S);
|
|
3410
|
+
const R = new Kt((v, E) => {
|
|
3411
|
+
g.value = v.replace("#", "").toUpperCase(), u.style.backgroundColor = v, this.value.stops[l].color = v, E !== void 0 && (this.value.stops[l].opacity = E, x.value = String(E), S.textContent = `${E}%`);
|
|
3412
|
+
const w = k(v);
|
|
3413
|
+
x.style.setProperty(
|
|
3383
3414
|
"--slider-color",
|
|
3384
|
-
`rgb(${
|
|
3415
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3385
3416
|
), this.updateGradientPreview(), this.createHandles(
|
|
3386
3417
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3387
3418
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3388
3419
|
), this.updateUI(), this.triggerChange();
|
|
3389
3420
|
}, "solid");
|
|
3390
3421
|
g.addEventListener("click", (v) => {
|
|
3391
|
-
v.preventDefault(), v.stopPropagation(),
|
|
3422
|
+
v.preventDefault(), v.stopPropagation(), R.open(n.color, g, n.opacity ?? 100);
|
|
3392
3423
|
}), g.addEventListener("input", () => {
|
|
3393
|
-
const v = g.value.trim(),
|
|
3394
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3395
|
-
this.value.stops[l].color =
|
|
3396
|
-
const
|
|
3397
|
-
|
|
3424
|
+
const v = g.value.trim(), E = v.startsWith("#") ? v : `#${v}`;
|
|
3425
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3426
|
+
this.value.stops[l].color = E, u.style.backgroundColor = E;
|
|
3427
|
+
const w = k(E);
|
|
3428
|
+
x.style.setProperty(
|
|
3398
3429
|
"--slider-color",
|
|
3399
|
-
`rgb(${
|
|
3430
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3400
3431
|
), this.debouncedPreviewUpdate();
|
|
3401
3432
|
}
|
|
3402
3433
|
}), g.addEventListener("blur", () => {
|
|
3403
3434
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3404
|
-
}),
|
|
3435
|
+
}), f.addEventListener("click", async (v) => {
|
|
3405
3436
|
v.stopPropagation();
|
|
3406
3437
|
try {
|
|
3407
3438
|
await navigator.clipboard.writeText(`#${g.value}`);
|
|
3408
3439
|
} catch {
|
|
3409
3440
|
}
|
|
3410
3441
|
}), p.addEventListener("focus", (v) => {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3442
|
+
const E = v.target;
|
|
3443
|
+
E.value = E.value.replace("%", ""), E.select();
|
|
3413
3444
|
}), p.addEventListener("input", (v) => {
|
|
3414
|
-
const
|
|
3415
|
-
if (!Number.isNaN(
|
|
3416
|
-
const
|
|
3417
|
-
this.value.stops[l].position =
|
|
3445
|
+
const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3446
|
+
if (!Number.isNaN(w)) {
|
|
3447
|
+
const W = Math.max(0, Math.min(100, w));
|
|
3448
|
+
this.value.stops[l].position = W, E.value = `${W}%`, this.debouncedPreviewUpdate();
|
|
3418
3449
|
}
|
|
3419
3450
|
}), p.addEventListener("blur", (v) => {
|
|
3420
3451
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3421
|
-
const
|
|
3422
|
-
if (Number.isNaN(
|
|
3423
|
-
|
|
3452
|
+
const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3453
|
+
if (Number.isNaN(w))
|
|
3454
|
+
E.value = `${this.value.stops[l].position}%`;
|
|
3424
3455
|
else {
|
|
3425
|
-
const
|
|
3426
|
-
this.value.stops[l].position =
|
|
3456
|
+
const W = Math.max(0, Math.min(100, w));
|
|
3457
|
+
this.value.stops[l].position = W, E.value = `${W}%`;
|
|
3427
3458
|
}
|
|
3428
3459
|
this.updateGradientPreview(), this.createHandles(
|
|
3429
3460
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3430
3461
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3431
3462
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3432
|
-
}),
|
|
3463
|
+
}), m.addEventListener("click", () => {
|
|
3433
3464
|
var v;
|
|
3434
3465
|
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(l, 1), this.createHandles(
|
|
3435
3466
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3436
3467
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3437
3468
|
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((v = document.activeElement) == null ? void 0 : v.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3438
|
-
}),
|
|
3439
|
-
const v = parseInt(
|
|
3440
|
-
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)),
|
|
3441
|
-
}),
|
|
3469
|
+
}), x.addEventListener("input", () => {
|
|
3470
|
+
const v = parseInt(x.value, 10);
|
|
3471
|
+
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), S.textContent = `${this.value.stops[l].opacity}%`, this.debouncedPreviewUpdate();
|
|
3472
|
+
}), x.addEventListener("change", () => {
|
|
3442
3473
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3443
3474
|
});
|
|
3444
3475
|
});
|
|
@@ -3461,8 +3492,8 @@ const V = class V extends w {
|
|
|
3461
3492
|
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3462
3493
|
}
|
|
3463
3494
|
openPopover() {
|
|
3464
|
-
if (this.popoverEl && (
|
|
3465
|
-
if (this.isPopoverOpen = !0,
|
|
3495
|
+
if (this.popoverEl && (P.openInstance && P.openInstance !== this && P.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3496
|
+
if (this.isPopoverOpen = !0, P.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3466
3497
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3467
3498
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3468
3499
|
const o = this.popoverEl.offsetHeight;
|
|
@@ -3509,16 +3540,17 @@ const V = class V extends w {
|
|
|
3509
3540
|
s && this.updatePopoverContent(s);
|
|
3510
3541
|
}
|
|
3511
3542
|
closePopover() {
|
|
3543
|
+
var t;
|
|
3512
3544
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3513
3545
|
if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
|
|
3514
|
-
const
|
|
3515
|
-
|
|
3546
|
+
const e = V(this.value);
|
|
3547
|
+
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3516
3548
|
}
|
|
3517
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3549
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), P.openInstance === this && (P.openInstance = null);
|
|
3518
3550
|
}
|
|
3519
3551
|
}
|
|
3520
3552
|
commitPendingSolidColor() {
|
|
3521
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
3553
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : D.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3522
3554
|
}
|
|
3523
3555
|
handlePaste(t) {
|
|
3524
3556
|
var i;
|
|
@@ -3542,10 +3574,10 @@ const V = class V extends w {
|
|
|
3542
3574
|
return this.element;
|
|
3543
3575
|
}
|
|
3544
3576
|
getValue() {
|
|
3545
|
-
return this.value ?
|
|
3577
|
+
return this.value ? V(this.value) : "";
|
|
3546
3578
|
}
|
|
3547
3579
|
getCSSValue() {
|
|
3548
|
-
return this.value ?
|
|
3580
|
+
return this.value ? V(this.value) : "";
|
|
3549
3581
|
}
|
|
3550
3582
|
getCSSForText() {
|
|
3551
3583
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3554,36 +3586,36 @@ const V = class V extends w {
|
|
|
3554
3586
|
return this.value;
|
|
3555
3587
|
}
|
|
3556
3588
|
};
|
|
3557
|
-
|
|
3558
|
-
let
|
|
3559
|
-
const
|
|
3589
|
+
P.openInstance = null;
|
|
3590
|
+
let Q = P;
|
|
3591
|
+
const Qt = `
|
|
3560
3592
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3561
3593
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3562
3594
|
</svg>
|
|
3563
|
-
`,
|
|
3595
|
+
`, te = `
|
|
3564
3596
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3565
3597
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3566
3598
|
</svg>
|
|
3567
3599
|
`;
|
|
3568
|
-
class
|
|
3600
|
+
class we extends T {
|
|
3569
3601
|
constructor(t) {
|
|
3570
3602
|
super({
|
|
3571
3603
|
title: "Border",
|
|
3572
3604
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3573
3605
|
settings: {
|
|
3574
|
-
size: new
|
|
3606
|
+
size: new N({
|
|
3575
3607
|
title: "Size",
|
|
3576
|
-
icon:
|
|
3608
|
+
icon: te,
|
|
3577
3609
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3578
3610
|
suffix: "px"
|
|
3579
3611
|
}),
|
|
3580
|
-
color: new
|
|
3612
|
+
color: new Q({
|
|
3581
3613
|
title: "Border Color",
|
|
3582
3614
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3583
3615
|
}),
|
|
3584
|
-
radius: new
|
|
3616
|
+
radius: new N({
|
|
3585
3617
|
title: "Radius",
|
|
3586
|
-
icon:
|
|
3618
|
+
icon: Qt,
|
|
3587
3619
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3588
3620
|
suffix: "px"
|
|
3589
3621
|
})
|
|
@@ -3607,20 +3639,20 @@ class be extends P {
|
|
|
3607
3639
|
`;
|
|
3608
3640
|
}
|
|
3609
3641
|
}
|
|
3610
|
-
const
|
|
3642
|
+
const ee = `
|
|
3611
3643
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3612
3644
|
<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"/>
|
|
3613
3645
|
</svg>
|
|
3614
|
-
`,
|
|
3646
|
+
`, ie = `
|
|
3615
3647
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3616
3648
|
<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"/>
|
|
3617
3649
|
</svg>
|
|
3618
|
-
`,
|
|
3650
|
+
`, se = `
|
|
3619
3651
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3620
3652
|
<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"/>
|
|
3621
3653
|
</svg>
|
|
3622
3654
|
`;
|
|
3623
|
-
class
|
|
3655
|
+
class xe extends T {
|
|
3624
3656
|
constructor(t = {}) {
|
|
3625
3657
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3626
3658
|
super({
|
|
@@ -3628,13 +3660,13 @@ class we extends P {
|
|
|
3628
3660
|
collapsed: i.collapsed,
|
|
3629
3661
|
settings: (() => {
|
|
3630
3662
|
const s = {
|
|
3631
|
-
color: new
|
|
3663
|
+
color: new Q({
|
|
3632
3664
|
title: "Color",
|
|
3633
3665
|
default: i.colorDefault ?? "#001E1E"
|
|
3634
3666
|
}),
|
|
3635
|
-
fontFamily: new
|
|
3667
|
+
fontFamily: new st({
|
|
3636
3668
|
title: "Font",
|
|
3637
|
-
icon:
|
|
3669
|
+
icon: ee,
|
|
3638
3670
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3639
3671
|
options: i.fontFamilyOptions ?? [
|
|
3640
3672
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3645,9 +3677,9 @@ class we extends P {
|
|
|
3645
3677
|
getOptions: i.fontFamilyGetOptions,
|
|
3646
3678
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3647
3679
|
}),
|
|
3648
|
-
fontWeight: new
|
|
3680
|
+
fontWeight: new st({
|
|
3649
3681
|
title: "Weight",
|
|
3650
|
-
icon:
|
|
3682
|
+
icon: ie,
|
|
3651
3683
|
default: i.fontWeightDefault ?? "400",
|
|
3652
3684
|
options: i.fontWeightOptions ?? [
|
|
3653
3685
|
{ name: "Regular", value: "400" },
|
|
@@ -3657,9 +3689,9 @@ class we extends P {
|
|
|
3657
3689
|
getOptions: i.fontWeightGetOptions,
|
|
3658
3690
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3659
3691
|
}),
|
|
3660
|
-
fontSize: new
|
|
3692
|
+
fontSize: new N({
|
|
3661
3693
|
title: "Size",
|
|
3662
|
-
icon:
|
|
3694
|
+
icon: se,
|
|
3663
3695
|
default: i.fontSizeDefault ?? 12,
|
|
3664
3696
|
suffix: "px",
|
|
3665
3697
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3699,7 +3731,7 @@ class we extends P {
|
|
|
3699
3731
|
`;
|
|
3700
3732
|
}
|
|
3701
3733
|
}
|
|
3702
|
-
class
|
|
3734
|
+
class J extends b {
|
|
3703
3735
|
constructor(t) {
|
|
3704
3736
|
super({
|
|
3705
3737
|
...t,
|
|
@@ -3745,33 +3777,33 @@ class _ extends w {
|
|
|
3745
3777
|
}), i;
|
|
3746
3778
|
}
|
|
3747
3779
|
}
|
|
3748
|
-
class
|
|
3780
|
+
class Le extends T {
|
|
3749
3781
|
constructor(t) {
|
|
3750
3782
|
super({
|
|
3751
3783
|
title: "Margins",
|
|
3752
3784
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3753
3785
|
settings: {
|
|
3754
|
-
marginTop: new
|
|
3786
|
+
marginTop: new J({
|
|
3755
3787
|
title: "Top",
|
|
3756
|
-
icon:
|
|
3788
|
+
icon: ne,
|
|
3757
3789
|
suffix: "px",
|
|
3758
3790
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3759
3791
|
}),
|
|
3760
|
-
marginRight: new
|
|
3792
|
+
marginRight: new J({
|
|
3761
3793
|
title: "Right",
|
|
3762
|
-
icon:
|
|
3794
|
+
icon: oe,
|
|
3763
3795
|
suffix: "px",
|
|
3764
3796
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3765
3797
|
}),
|
|
3766
|
-
marginBottom: new
|
|
3798
|
+
marginBottom: new J({
|
|
3767
3799
|
title: "Bottom",
|
|
3768
|
-
icon:
|
|
3800
|
+
icon: ae,
|
|
3769
3801
|
suffix: "px",
|
|
3770
3802
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3771
3803
|
}),
|
|
3772
|
-
marginLeft: new
|
|
3804
|
+
marginLeft: new J({
|
|
3773
3805
|
title: "Left",
|
|
3774
|
-
icon:
|
|
3806
|
+
icon: le,
|
|
3775
3807
|
suffix: "px",
|
|
3776
3808
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
3777
3809
|
})
|
|
@@ -3788,16 +3820,16 @@ class xe extends P {
|
|
|
3788
3820
|
`;
|
|
3789
3821
|
}
|
|
3790
3822
|
}
|
|
3791
|
-
const
|
|
3823
|
+
const ne = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3792
3824
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3793
|
-
</svg>`, ne = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3794
|
-
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3795
3825
|
</svg>`, oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3796
|
-
<path d="
|
|
3826
|
+
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3797
3827
|
</svg>`, ae = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3828
|
+
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3829
|
+
</svg>`, le = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3798
3830
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3799
3831
|
</svg>`;
|
|
3800
|
-
class
|
|
3832
|
+
class ke extends T {
|
|
3801
3833
|
constructor(t) {
|
|
3802
3834
|
super({
|
|
3803
3835
|
title: "Background Image",
|
|
@@ -3810,7 +3842,7 @@ class Le extends P {
|
|
|
3810
3842
|
opacity: new It({
|
|
3811
3843
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3812
3844
|
}),
|
|
3813
|
-
backgroundColor: new
|
|
3845
|
+
backgroundColor: new G({
|
|
3814
3846
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3815
3847
|
})
|
|
3816
3848
|
}
|
|
@@ -3838,39 +3870,39 @@ class Le extends P {
|
|
|
3838
3870
|
}
|
|
3839
3871
|
export {
|
|
3840
3872
|
Vt as AlignSetting,
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3873
|
+
be as AnimationSetting,
|
|
3874
|
+
ke as BackgroundSettingSet,
|
|
3875
|
+
we as BorderSettingSet,
|
|
3876
|
+
pe as ButtonSetting,
|
|
3877
|
+
I as ColorSetting,
|
|
3878
|
+
G as ColorWithOpacitySetting,
|
|
3879
|
+
de as DimensionSetting,
|
|
3880
|
+
ve as GapSetting,
|
|
3881
|
+
Q as GradientSetting,
|
|
3882
|
+
xe as HeaderTypographySettingSet,
|
|
3883
|
+
ue as HeightSetting,
|
|
3884
|
+
he as HtmlSetting,
|
|
3885
|
+
Ce as MarginBottomSetting,
|
|
3886
|
+
Le as MarginSettingGroup,
|
|
3887
|
+
ye as MarginTopSetting,
|
|
3888
|
+
Ee as MultiLanguageSetting,
|
|
3889
|
+
N as NumberSetting,
|
|
3858
3890
|
It as OpacitySetting,
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3891
|
+
me as SelectApiSettings,
|
|
3892
|
+
st as SelectSetting,
|
|
3893
|
+
b as Setting,
|
|
3894
|
+
T as SettingGroup,
|
|
3863
3895
|
Lt as StringSetting,
|
|
3864
3896
|
wt as TabSettingGroup,
|
|
3865
3897
|
wt as TabsSettingGroup,
|
|
3866
|
-
|
|
3898
|
+
fe as Toggle,
|
|
3867
3899
|
pt as UploadSetting,
|
|
3868
|
-
|
|
3869
|
-
|
|
3900
|
+
ge as WidthSetting,
|
|
3901
|
+
ce as asSettingGroupWithSettings,
|
|
3870
3902
|
xt as createSettingGroup,
|
|
3871
|
-
|
|
3872
|
-
|
|
3903
|
+
re as createTabSettingGroup,
|
|
3904
|
+
F as isSetting,
|
|
3873
3905
|
at as isSettingChild,
|
|
3874
3906
|
L as isSettingGroup,
|
|
3875
|
-
|
|
3907
|
+
_ as iterateSettings
|
|
3876
3908
|
};
|