builder-settings-types 0.0.277 → 0.0.278
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 +33 -33
- package/dist/builder-settings-types.es.js +266 -220
- package/dist/settings/gradient-settings/GradientSetting.d.ts +6 -1
- package/dist/settings/gradient-settings/components/EmbeddedColorPicker.d.ts +4 -0
- package/dist/settings/gradient-settings/recent/RecentColorManager.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ft = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
2
|
let ct = (c = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
4
|
for (; c--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += ft[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function vt(c) {
|
|
9
9
|
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
11
|
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function _(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 tt(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
|
+
_(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const Ct = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class yt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...Ct, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class Ct {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = vt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,20 +111,20 @@ class Ct {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const st = new
|
|
115
|
-
function
|
|
114
|
+
const st = new yt();
|
|
115
|
+
function J(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) => J(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] = J(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return c;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Et(c) {
|
|
128
128
|
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
@@ -171,8 +171,8 @@ class b {
|
|
|
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 = J(this.props), i = new t(e);
|
|
175
|
+
return i.value = J(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -192,7 +192,7 @@ class b {
|
|
|
192
192
|
const i = document.createElement("div");
|
|
193
193
|
i.className = t.wrapperClassName || "";
|
|
194
194
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
195
|
+
this.inputEl = s, s.value = String(t.value || Et(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
196
|
const n = (a) => {
|
|
197
197
|
const l = a.target;
|
|
198
198
|
let r = l.value;
|
|
@@ -233,30 +233,30 @@ class b {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function B(c) {
|
|
237
237
|
return c instanceof b;
|
|
238
238
|
}
|
|
239
239
|
function L(c) {
|
|
240
|
-
return c instanceof
|
|
240
|
+
return c instanceof V;
|
|
241
241
|
}
|
|
242
242
|
function nt(c) {
|
|
243
|
-
return
|
|
243
|
+
return B(c) || L(c);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function q(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 Z = class Z {
|
|
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 || ct(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
259
|
+
q(this.settings, (e, i) => {
|
|
260
260
|
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
|
+
q(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(L(e) ||
|
|
278
|
+
(L(e) || B(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (_(this.elementRef, this.nestingLevel), tt(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
|
+
q(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.`
|
|
@@ -345,7 +345,7 @@ const Y = class Y {
|
|
|
345
345
|
deleteItem: this.deleteItemCfg,
|
|
346
346
|
dataProps: this.dataProps,
|
|
347
347
|
hide: this.hide
|
|
348
|
-
}, i =
|
|
348
|
+
}, i = wt(e);
|
|
349
349
|
return i.initialValues = this.getValues(), i;
|
|
350
350
|
}
|
|
351
351
|
resetDefault() {
|
|
@@ -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) || B(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(), q(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 (B(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
|
nt(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (L(n) ||
|
|
427
|
+
n && (L(n) || B(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()) : B(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), st.trackElement(a),
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), st.trackElement(a), _(a, this.nestingLevel + 1), tt(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}`, Z.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), _(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",
|
|
@@ -809,12 +809,12 @@ const Y = class Y {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
let
|
|
812
|
+
Z.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
|
+
let V = Z;
|
|
814
814
|
function ae(c) {
|
|
815
|
-
return new
|
|
815
|
+
return new bt(c);
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class bt extends V {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super(t);
|
|
820
820
|
const e = Object.keys(this.settings)[0];
|
|
@@ -865,13 +865,13 @@ class Et extends T {
|
|
|
865
865
|
return this.updateTabUI(), t;
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
function
|
|
869
|
-
return new
|
|
868
|
+
function wt(c) {
|
|
869
|
+
return new V(c);
|
|
870
870
|
}
|
|
871
871
|
function le(c) {
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
class
|
|
874
|
+
class xt extends b {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -891,12 +891,12 @@ class wt extends b {
|
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
const
|
|
895
|
-
class M extends
|
|
894
|
+
const Lt = "<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 M extends xt {
|
|
896
896
|
constructor(t) {
|
|
897
897
|
super({
|
|
898
898
|
...t,
|
|
899
|
-
icon: t.icon ||
|
|
899
|
+
icon: t.icon || Lt,
|
|
900
900
|
title: t.title || "Color",
|
|
901
901
|
default: t.default ? M.normalizeColorValue(t.default) : "#000000"
|
|
902
902
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
@@ -995,20 +995,20 @@ class M extends wt {
|
|
|
995
995
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
const
|
|
998
|
+
const kt = `
|
|
999
999
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1000
1000
|
<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"/>
|
|
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 P extends b {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
|
-
icon: t.icon ||
|
|
1008
|
+
icon: t.icon || kt,
|
|
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 = P.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 H extends b {
|
|
|
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 = P.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 H extends b {
|
|
|
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 = P.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class H extends b {
|
|
|
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 = P.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1214,12 +1214,12 @@ class I extends b {
|
|
|
1214
1214
|
);
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
const
|
|
1217
|
+
const Mt = `
|
|
1218
1218
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
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
|
|
1222
|
+
class St extends I {
|
|
1223
1223
|
constructor(t = {}) {
|
|
1224
1224
|
const e = {
|
|
1225
1225
|
title: "Opacity",
|
|
@@ -1228,7 +1228,7 @@ class Mt extends I {
|
|
|
1228
1228
|
maxValue: 100,
|
|
1229
1229
|
step: 1,
|
|
1230
1230
|
default: t.default ?? 100,
|
|
1231
|
-
icon:
|
|
1231
|
+
icon: Mt,
|
|
1232
1232
|
...t
|
|
1233
1233
|
};
|
|
1234
1234
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1240,12 +1240,12 @@ class Mt extends I {
|
|
|
1240
1240
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
const
|
|
1243
|
+
const It = `
|
|
1244
1244
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class
|
|
1248
|
+
class et 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);
|
|
@@ -1289,7 +1289,7 @@ class it extends b {
|
|
|
1289
1289
|
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1290
1290
|
}), document.body.appendChild(i);
|
|
1291
1291
|
const s = document.createElement("div");
|
|
1292
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1292
|
+
return s.classList.add("svg-container"), s.innerHTML = It, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1293
1293
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1294
1294
|
}).catch((n) => {
|
|
1295
1295
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1358,7 +1358,7 @@ class it extends b {
|
|
|
1358
1358
|
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();
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class
|
|
1361
|
+
class Nt extends b {
|
|
1362
1362
|
constructor(t = {}) {
|
|
1363
1363
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1364
|
}
|
|
@@ -1456,14 +1456,14 @@ class he extends b {
|
|
|
1456
1456
|
suffix: "px",
|
|
1457
1457
|
minValue: this.minWidth,
|
|
1458
1458
|
maxValue: this.maxWidth,
|
|
1459
|
-
icon:
|
|
1459
|
+
icon: Vt
|
|
1460
1460
|
}), this.heightSetting = new I({
|
|
1461
1461
|
title: "Height",
|
|
1462
1462
|
default: this.value.height,
|
|
1463
1463
|
suffix: "px",
|
|
1464
1464
|
minValue: this.minHeight,
|
|
1465
1465
|
maxValue: this.maxHeight,
|
|
1466
|
-
icon:
|
|
1466
|
+
icon: Tt
|
|
1467
1467
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1468
1468
|
}
|
|
1469
1469
|
handleWidthChange(t) {
|
|
@@ -1557,24 +1557,24 @@ class he extends b {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
const
|
|
1560
|
+
const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1561
1561
|
<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"/>
|
|
1562
|
-
</svg>`,
|
|
1562
|
+
</svg>`, Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1563
1563
|
<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"/>
|
|
1564
1564
|
</svg>`, K = `
|
|
1565
1565
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1566
1566
|
<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"/>
|
|
1567
1567
|
</svg>
|
|
1568
|
-
`,
|
|
1568
|
+
`, Ot = `
|
|
1569
1569
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1570
1570
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1571
1571
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1572
1572
|
</svg>
|
|
1573
|
-
`,
|
|
1573
|
+
`, Pt = `
|
|
1574
1574
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1575
1575
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1576
1576
|
</svg>
|
|
1577
|
-
`,
|
|
1577
|
+
`, Ht = `
|
|
1578
1578
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1579
1579
|
<!-- Top dot -->
|
|
1580
1580
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1691,9 +1691,9 @@ class ht extends b {
|
|
|
1691
1691
|
const s = this.value && this.value !== "";
|
|
1692
1692
|
s || i.classList.add("no-image");
|
|
1693
1693
|
const n = document.createElement("div");
|
|
1694
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1694
|
+
if (n.className = "preview-placeholder", n.innerHTML = Ot, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Ht, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1695
1695
|
const a = document.createElement("button");
|
|
1696
|
-
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML =
|
|
1696
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Pt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1697
1697
|
var r;
|
|
1698
1698
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1699
1699
|
};
|
|
@@ -1721,7 +1721,7 @@ class pe extends I {
|
|
|
1721
1721
|
title: t.title || "Height",
|
|
1722
1722
|
suffix: t.suffix || "px",
|
|
1723
1723
|
minValue: t.minValue ?? 0,
|
|
1724
|
-
icon: t.icon ||
|
|
1724
|
+
icon: t.icon || $t,
|
|
1725
1725
|
default: t.default ?? 100
|
|
1726
1726
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1727
1727
|
}
|
|
@@ -1732,7 +1732,7 @@ class pe extends I {
|
|
|
1732
1732
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const $t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1736
1736
|
<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"/>
|
|
1737
1737
|
</svg>`;
|
|
1738
1738
|
class de extends I {
|
|
@@ -1742,7 +1742,7 @@ class de extends I {
|
|
|
1742
1742
|
title: t.title || "Width",
|
|
1743
1743
|
suffix: t.suffix || "px",
|
|
1744
1744
|
minValue: t.minValue ?? 0,
|
|
1745
|
-
icon: t.icon ||
|
|
1745
|
+
icon: t.icon || At,
|
|
1746
1746
|
default: t.default ?? 100
|
|
1747
1747
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1748
1748
|
}
|
|
@@ -1753,9 +1753,9 @@ class de extends I {
|
|
|
1753
1753
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
const
|
|
1756
|
+
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1757
1757
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1758
|
-
</svg>`,
|
|
1758
|
+
</svg>`, Bt = `
|
|
1759
1759
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1760
1760
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1761
|
</svg>
|
|
@@ -1815,7 +1815,7 @@ class ue extends b {
|
|
|
1815
1815
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1816
1816
|
}), t.appendChild(i);
|
|
1817
1817
|
const s = document.createElement("div");
|
|
1818
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1818
|
+
return s.classList.add("svg-container"), s.innerHTML = Bt, t.appendChild(s), s.onclick = () => {
|
|
1819
1819
|
var n, o;
|
|
1820
1820
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1821
1821
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1957,13 +1957,13 @@ class ge extends b {
|
|
|
1957
1957
|
this.detectChangeCallback = t;
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
|
-
const
|
|
1960
|
+
const Dt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
1961
|
<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"/>
|
|
1962
1962
|
</svg>`;
|
|
1963
1963
|
class me extends b {
|
|
1964
1964
|
// Store mobile value
|
|
1965
1965
|
constructor(t = {}) {
|
|
1966
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
1966
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Dt, 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);
|
|
1967
1967
|
}
|
|
1968
1968
|
draw() {
|
|
1969
1969
|
const t = document.createElement("div");
|
|
@@ -2014,7 +2014,7 @@ class me extends b {
|
|
|
2014
2014
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
const
|
|
2017
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2018
2018
|
<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"/>
|
|
2019
2019
|
</svg>`;
|
|
2020
2020
|
class fe extends I {
|
|
@@ -2023,14 +2023,14 @@ class fe extends I {
|
|
|
2023
2023
|
...t,
|
|
2024
2024
|
minValue: t.minValue ?? 0,
|
|
2025
2025
|
maxValue: t.maxValue ?? 1e3,
|
|
2026
|
-
icon: t.icon ||
|
|
2026
|
+
icon: t.icon || Rt,
|
|
2027
2027
|
title: t.title || "Margin Bottom",
|
|
2028
2028
|
default: t.default ?? 20,
|
|
2029
2029
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2030
2030
|
}), this.inputType = "number";
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
|
-
const
|
|
2033
|
+
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2034
2034
|
<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"
|
|
2035
2035
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2036
2036
|
</svg>`;
|
|
@@ -2040,7 +2040,7 @@ class ve extends I {
|
|
|
2040
2040
|
...t,
|
|
2041
2041
|
minValue: t.minValue ?? 0,
|
|
2042
2042
|
maxValue: t.maxValue ?? 1e3,
|
|
2043
|
-
icon: t.icon ||
|
|
2043
|
+
icon: t.icon || Ft,
|
|
2044
2044
|
title: t.title || "Margin Top",
|
|
2045
2045
|
default: t.default ?? 20,
|
|
2046
2046
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
@@ -2205,7 +2205,7 @@ class ye extends b {
|
|
|
2205
2205
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2206
2206
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2207
2207
|
];
|
|
2208
|
-
this.selectSetting = new
|
|
2208
|
+
this.selectSetting = new et({
|
|
2209
2209
|
title: this.title || "Animation",
|
|
2210
2210
|
options: e,
|
|
2211
2211
|
default: this.props.default || "none"
|
|
@@ -2221,7 +2221,7 @@ class ye extends b {
|
|
|
2221
2221
|
this.selectSetting.destroy(), super.destroy();
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
const
|
|
2224
|
+
const Ut = (c, t) => {
|
|
2225
2225
|
let e = !1, i = 0, s = 0, n = 0, o = 0;
|
|
2226
2226
|
const a = (h) => {
|
|
2227
2227
|
if (h.target.closest("button")) return;
|
|
@@ -2237,32 +2237,32 @@ const Ft = (c, t) => {
|
|
|
2237
2237
|
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2238
2238
|
};
|
|
2239
2239
|
c.addEventListener("mousedown", a);
|
|
2240
|
-
},
|
|
2240
|
+
}, R = (c) => {
|
|
2241
2241
|
if (!c) return null;
|
|
2242
2242
|
let t = c.trim();
|
|
2243
2243
|
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()}`;
|
|
2244
|
-
},
|
|
2244
|
+
}, D = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (c) => {
|
|
2245
2245
|
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2246
2246
|
return {
|
|
2247
2247
|
r: parseInt(e.slice(0, 2), 16),
|
|
2248
2248
|
g: parseInt(e.slice(2, 4), 16),
|
|
2249
2249
|
b: parseInt(e.slice(4, 6), 16)
|
|
2250
2250
|
};
|
|
2251
|
-
},
|
|
2251
|
+
}, H = (c) => {
|
|
2252
2252
|
const { r: t, g: e, b: i } = S(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;
|
|
2253
2253
|
let h = 0;
|
|
2254
2254
|
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);
|
|
2255
2255
|
const p = a === 0 ? 0 : r / a, d = a;
|
|
2256
2256
|
return { h: h * 60, s: p, v: d };
|
|
2257
|
-
},
|
|
2257
|
+
}, G = (c, t, e) => {
|
|
2258
2258
|
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2259
2259
|
let a = 0, l = 0, r = 0;
|
|
2260
|
-
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),
|
|
2260
|
+
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), D(
|
|
2261
2261
|
Math.round((a + o) * 255),
|
|
2262
2262
|
Math.round((l + o) * 255),
|
|
2263
2263
|
Math.round((r + o) * 255)
|
|
2264
2264
|
);
|
|
2265
|
-
},
|
|
2265
|
+
}, zt = (c, t, e) => {
|
|
2266
2266
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2267
2267
|
return { hue: c, sat: s, lightness: i };
|
|
2268
2268
|
}, X = (c, t, e) => {
|
|
@@ -2305,7 +2305,7 @@ const Ft = (c, t) => {
|
|
|
2305
2305
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2306
2306
|
}
|
|
2307
2307
|
}
|
|
2308
|
-
const i =
|
|
2308
|
+
const i = R(c);
|
|
2309
2309
|
if (i) {
|
|
2310
2310
|
const { r: s, g: n, b: o } = S(i);
|
|
2311
2311
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
@@ -2342,7 +2342,7 @@ const Ft = (c, t) => {
|
|
|
2342
2342
|
/^[a-zA-Z]+$/
|
|
2343
2343
|
].some((e) => e.test(c.trim())), Wt = (c) => {
|
|
2344
2344
|
if (typeof document > "u")
|
|
2345
|
-
return dt(c) || !!
|
|
2345
|
+
return dt(c) || !!R(c);
|
|
2346
2346
|
const t = document.createElement("div");
|
|
2347
2347
|
return t.style.color = c, t.style.color !== "";
|
|
2348
2348
|
}, ut = (c) => {
|
|
@@ -2350,7 +2350,7 @@ const Ft = (c, t) => {
|
|
|
2350
2350
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2351
2351
|
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);
|
|
2352
2352
|
return {
|
|
2353
|
-
color:
|
|
2353
|
+
color: D(o, a, l),
|
|
2354
2354
|
position: 0,
|
|
2355
2355
|
opacity: Math.round(r / 255 * 100)
|
|
2356
2356
|
};
|
|
@@ -2361,7 +2361,7 @@ const Ft = (c, t) => {
|
|
|
2361
2361
|
if (e) {
|
|
2362
2362
|
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2363
2363
|
return {
|
|
2364
|
-
color:
|
|
2364
|
+
color: D(n, o, a),
|
|
2365
2365
|
position: 0,
|
|
2366
2366
|
opacity: Math.round(l * 100)
|
|
2367
2367
|
};
|
|
@@ -2376,15 +2376,22 @@ const Ft = (c, t) => {
|
|
|
2376
2376
|
parseFloat(i[3]) / 100
|
|
2377
2377
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2378
2378
|
return {
|
|
2379
|
-
color:
|
|
2379
|
+
color: D(n, o, a),
|
|
2380
2380
|
position: 0,
|
|
2381
2381
|
opacity: Math.round(l * 100)
|
|
2382
2382
|
};
|
|
2383
2383
|
}
|
|
2384
|
-
return { color:
|
|
2385
|
-
},
|
|
2384
|
+
return { color: R(t) || t, position: 0, opacity: 100 };
|
|
2385
|
+
}, W = class W {
|
|
2386
2386
|
static defaults() {
|
|
2387
|
-
return
|
|
2387
|
+
return [];
|
|
2388
|
+
}
|
|
2389
|
+
static normalizeList(t) {
|
|
2390
|
+
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2391
|
+
return t.forEach((s) => {
|
|
2392
|
+
const n = R(s);
|
|
2393
|
+
n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2394
|
+
}), i.slice(0, this.MAX_COLORS);
|
|
2388
2395
|
}
|
|
2389
2396
|
static ensureLoaded() {
|
|
2390
2397
|
var t;
|
|
@@ -2393,10 +2400,15 @@ const Ft = (c, t) => {
|
|
|
2393
2400
|
const e = (t = window.sessionStorage) == null ? void 0 : t.getItem(this.STORAGE_KEY);
|
|
2394
2401
|
if (!e) return;
|
|
2395
2402
|
const i = JSON.parse(e);
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2403
|
+
if (Array.isArray(i))
|
|
2404
|
+
this.colors = this.normalizeList(i);
|
|
2405
|
+
else if (i && typeof i == "object") {
|
|
2406
|
+
const s = [];
|
|
2407
|
+
["gradient", "solid"].forEach((n) => {
|
|
2408
|
+
const o = i, a = Array.isArray(o[n]) ? o[n] : [];
|
|
2409
|
+
s.push(...a);
|
|
2410
|
+
}), this.colors = this.normalizeList(s);
|
|
2411
|
+
}
|
|
2400
2412
|
} catch {
|
|
2401
2413
|
this.colors = this.defaults();
|
|
2402
2414
|
}
|
|
@@ -2413,21 +2425,21 @@ const Ft = (c, t) => {
|
|
|
2413
2425
|
}
|
|
2414
2426
|
}
|
|
2415
2427
|
static list(t) {
|
|
2416
|
-
return this.ensureLoaded(), this.colors || (this.colors = this.defaults()), this.colors
|
|
2428
|
+
return this.ensureLoaded(), this.colors || (this.colors = this.defaults()), this.colors;
|
|
2417
2429
|
}
|
|
2418
2430
|
static getColors(t) {
|
|
2419
2431
|
return [...this.list(t)];
|
|
2420
2432
|
}
|
|
2421
2433
|
static addColor(t, e) {
|
|
2422
|
-
const i =
|
|
2434
|
+
const i = R(t);
|
|
2423
2435
|
if (!i) return;
|
|
2424
2436
|
const s = this.list(e), n = s.indexOf(i);
|
|
2425
2437
|
n !== -1 && s.splice(n, 1), s.unshift(i), s.length > this.MAX_COLORS && (s.length = this.MAX_COLORS), this.persist();
|
|
2426
2438
|
}
|
|
2427
2439
|
};
|
|
2428
|
-
|
|
2429
|
-
let
|
|
2430
|
-
const
|
|
2440
|
+
W.STORAGE_KEY = "settingsLib_recentColors", W.MAX_COLORS = 12, W.colors = null;
|
|
2441
|
+
let F = W;
|
|
2442
|
+
const gt = (c, t) => {
|
|
2431
2443
|
const e = document.createElement("div");
|
|
2432
2444
|
e.className = "color-picker-recent-section";
|
|
2433
2445
|
const i = document.createElement("div");
|
|
@@ -2438,7 +2450,7 @@ const zt = (c, t) => {
|
|
|
2438
2450
|
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2439
2451
|
const o = () => {
|
|
2440
2452
|
s.innerHTML = "";
|
|
2441
|
-
const a =
|
|
2453
|
+
const a = F.getColors(t);
|
|
2442
2454
|
if (a.length === 0) {
|
|
2443
2455
|
s.style.display = "none", n.style.display = "block";
|
|
2444
2456
|
return;
|
|
@@ -2449,7 +2461,7 @@ const zt = (c, t) => {
|
|
|
2449
2461
|
});
|
|
2450
2462
|
};
|
|
2451
2463
|
return o(), { container: e, refresh: o };
|
|
2452
|
-
},
|
|
2464
|
+
}, mt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2453
2465
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2454
2466
|
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"
|
|
2455
2467
|
fill="#919EAB"/>
|
|
@@ -2471,7 +2483,7 @@ class Jt {
|
|
|
2471
2483
|
const n = document.querySelectorAll(".gstop-color-input");
|
|
2472
2484
|
Array.from(n).some(
|
|
2473
2485
|
(a) => a.contains(s)
|
|
2474
|
-
) || (i.preventDefault(), i.stopPropagation(), this.close(!
|
|
2486
|
+
) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2475
2487
|
}, this.keyDown = (i) => {
|
|
2476
2488
|
if (this.isOpen) {
|
|
2477
2489
|
if (i.key === "Escape")
|
|
@@ -2496,7 +2508,7 @@ class Jt {
|
|
|
2496
2508
|
const i = document.createElement("span");
|
|
2497
2509
|
i.textContent = "Color";
|
|
2498
2510
|
const s = document.createElement("button");
|
|
2499
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2511
|
+
s.className = "color-picker-close", s.innerHTML = mt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), Ut(e, t);
|
|
2500
2512
|
const n = document.createElement("div");
|
|
2501
2513
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2502
2514
|
const o = document.createElement("div");
|
|
@@ -2513,9 +2525,9 @@ class Jt {
|
|
|
2513
2525
|
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
2514
2526
|
const d = document.createElement("div");
|
|
2515
2527
|
d.className = "color-picker-opacity-marker", this.opacityMarker = d, p.appendChild(d);
|
|
2516
|
-
const g =
|
|
2517
|
-
var U
|
|
2518
|
-
this.setColor(
|
|
2528
|
+
const g = gt((A) => {
|
|
2529
|
+
var U;
|
|
2530
|
+
this.setColor(A), (U = this.onChange) == null || U.call(this, A, this.currentOpacity);
|
|
2519
2531
|
}, this.recentScope);
|
|
2520
2532
|
this.recentSectionRefresh = g.refresh;
|
|
2521
2533
|
const u = document.createElement("div");
|
|
@@ -2530,15 +2542,15 @@ class Jt {
|
|
|
2530
2542
|
x.value = "hsl", x.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(x);
|
|
2531
2543
|
const y = document.createElement("input");
|
|
2532
2544
|
y.type = "text", y.className = "color-picker-color-input", y.value = this.currentColor, this.input = y;
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2545
|
+
const T = document.createElement("div");
|
|
2546
|
+
T.className = "color-picker-input-container";
|
|
2535
2547
|
const k = document.createElement("button");
|
|
2536
|
-
return k.className = "color-picker-copy-inside", k.textContent = "Copy",
|
|
2548
|
+
return k.className = "color-picker-copy-inside", k.textContent = "Copy", T.appendChild(y), T.appendChild(k), u.appendChild(m), u.appendChild(T), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", (A) => A.stopPropagation()), this.bind(n, r, p, y, m, k, l), t;
|
|
2537
2549
|
}
|
|
2538
2550
|
createBackdrop() {
|
|
2539
2551
|
const t = document.createElement("div");
|
|
2540
2552
|
return t.className = "color-picker-backdrop", t.style.display = "none", t.addEventListener("click", (e) => {
|
|
2541
|
-
e.preventDefault(), e.stopPropagation(), this.close(!
|
|
2553
|
+
e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
2542
2554
|
}), t;
|
|
2543
2555
|
}
|
|
2544
2556
|
bind(t, e, i, s, n, o, a) {
|
|
@@ -2546,14 +2558,14 @@ class Jt {
|
|
|
2546
2558
|
var x;
|
|
2547
2559
|
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), u = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
2548
2560
|
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
2549
|
-
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C =
|
|
2561
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C = G(f, g, 1 - u);
|
|
2550
2562
|
this.currentColor = C, this.syncInput(), this.updateOpacityBg(), (x = this.onChange) == null || x.call(this, C, this.currentOpacity);
|
|
2551
2563
|
}, r = (p) => {
|
|
2552
2564
|
var x;
|
|
2553
2565
|
const d = e.getBoundingClientRect();
|
|
2554
2566
|
let g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2555
2567
|
this.hueMarker.style.left = `${g * 100}%`;
|
|
2556
|
-
const u = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), C =
|
|
2568
|
+
const u = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), C = G(u, m, 1 - f);
|
|
2557
2569
|
this.currentColor = C, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (x = this.onChange) == null || x.call(this, C, this.currentOpacity);
|
|
2558
2570
|
}, h = (p) => {
|
|
2559
2571
|
var u;
|
|
@@ -2563,22 +2575,19 @@ class Jt {
|
|
|
2563
2575
|
t.addEventListener("mousedown", (p) => {
|
|
2564
2576
|
p.preventDefault(), l(p);
|
|
2565
2577
|
const d = (u) => l(u), g = () => {
|
|
2566
|
-
|
|
2567
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), V.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2578
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2568
2579
|
};
|
|
2569
2580
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2570
2581
|
}), e.addEventListener("mousedown", (p) => {
|
|
2571
2582
|
p.preventDefault(), r(p);
|
|
2572
2583
|
const d = (u) => r(u), g = () => {
|
|
2573
|
-
|
|
2574
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), V.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2584
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2575
2585
|
};
|
|
2576
2586
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2577
2587
|
}), i.addEventListener("mousedown", (p) => {
|
|
2578
2588
|
p.preventDefault(), h(p);
|
|
2579
2589
|
const d = (u) => h(u), g = () => {
|
|
2580
|
-
|
|
2581
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), V.addColor(this.currentColor, this.recentScope), (u = this.recentSectionRefresh) == null || u.call(this);
|
|
2590
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2582
2591
|
};
|
|
2583
2592
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2584
2593
|
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
|
|
@@ -2590,14 +2599,14 @@ class Jt {
|
|
|
2590
2599
|
s.select(), document.execCommand("copy");
|
|
2591
2600
|
}
|
|
2592
2601
|
}), a.addEventListener("click", async () => {
|
|
2593
|
-
var p
|
|
2602
|
+
var p;
|
|
2594
2603
|
if (!("EyeDropper" in window)) {
|
|
2595
2604
|
alert("EyeDropper API is not supported in this browser.");
|
|
2596
2605
|
return;
|
|
2597
2606
|
}
|
|
2598
2607
|
try {
|
|
2599
|
-
const
|
|
2600
|
-
this.setColor(
|
|
2608
|
+
const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
|
|
2609
|
+
this.setColor(g), (p = this.onChange) == null || p.call(this, g, this.currentOpacity);
|
|
2601
2610
|
} catch {
|
|
2602
2611
|
}
|
|
2603
2612
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2608,17 +2617,17 @@ class Jt {
|
|
|
2608
2617
|
setColor(t) {
|
|
2609
2618
|
var o;
|
|
2610
2619
|
this.currentColor = t;
|
|
2611
|
-
const { h: e, s: i, v: s } =
|
|
2620
|
+
const { h: e, s: i, v: s } = H(t), n = e >= 360 ? e % 360 : e;
|
|
2612
2621
|
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);
|
|
2613
2622
|
}
|
|
2614
2623
|
syncInput() {
|
|
2615
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2624
|
+
const t = this.select.value, { h: e, s: i, v: s } = H(this.currentColor);
|
|
2616
2625
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2617
2626
|
else if (t === "rgb") {
|
|
2618
2627
|
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
2619
2628
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2620
2629
|
} else {
|
|
2621
|
-
const { hue: n, sat: o, lightness: a } =
|
|
2630
|
+
const { hue: n, sat: o, lightness: a } = zt(e, i, s);
|
|
2622
2631
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2623
2632
|
o * 100
|
|
2624
2633
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -2637,7 +2646,7 @@ class Jt {
|
|
|
2637
2646
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2638
2647
|
if (s) {
|
|
2639
2648
|
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);
|
|
2640
|
-
e =
|
|
2649
|
+
e = G(n, r, l);
|
|
2641
2650
|
}
|
|
2642
2651
|
}
|
|
2643
2652
|
}
|
|
@@ -2653,7 +2662,7 @@ class Jt {
|
|
|
2653
2662
|
open(t, e, i) {
|
|
2654
2663
|
var y;
|
|
2655
2664
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2656
|
-
const { h: s, s: n, v: o } =
|
|
2665
|
+
const { h: s, s: n, v: o } = H(t);
|
|
2657
2666
|
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}%`, (y = this.recentSectionRefresh) == null || y.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);
|
|
2658
2667
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2659
2668
|
let g = r.right + 8, u = r.top;
|
|
@@ -2664,19 +2673,19 @@ class Jt {
|
|
|
2664
2673
|
}
|
|
2665
2674
|
close(t) {
|
|
2666
2675
|
var e;
|
|
2667
|
-
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 && (
|
|
2676
|
+
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 && (F.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2668
2677
|
}
|
|
2669
2678
|
getElement() {
|
|
2670
2679
|
return this.element;
|
|
2671
2680
|
}
|
|
2672
2681
|
}
|
|
2673
|
-
class
|
|
2682
|
+
class Xt {
|
|
2674
2683
|
constructor(t) {
|
|
2675
|
-
this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.container = this.createContainer(), this.initializePicker();
|
|
2684
|
+
this.recentScope = "solid", this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.container = this.createContainer(), this.initializePicker();
|
|
2676
2685
|
}
|
|
2677
2686
|
createContainer() {
|
|
2678
2687
|
const t = document.createElement("div");
|
|
2679
|
-
|
|
2688
|
+
t.className = "embedded-color-picker-content", t.innerHTML = `
|
|
2680
2689
|
<div class="color-picker-area embedded">
|
|
2681
2690
|
<div class="color-picker-marker"></div>
|
|
2682
2691
|
</div>
|
|
@@ -2704,7 +2713,11 @@ class Zt {
|
|
|
2704
2713
|
<button class="color-picker-copy-inside">Copy</button>
|
|
2705
2714
|
</div>
|
|
2706
2715
|
</div>
|
|
2707
|
-
|
|
2716
|
+
`;
|
|
2717
|
+
const e = gt((i) => {
|
|
2718
|
+
this.applyRecentColor(i);
|
|
2719
|
+
}, this.recentScope);
|
|
2720
|
+
return this.recentSectionRefresh = e.refresh, t.appendChild(e.container), t;
|
|
2708
2721
|
}
|
|
2709
2722
|
initializePicker() {
|
|
2710
2723
|
const t = this.container.querySelector(
|
|
@@ -2725,7 +2738,7 @@ class Zt {
|
|
|
2725
2738
|
".color-picker-color-input"
|
|
2726
2739
|
), r = this.container.querySelector(
|
|
2727
2740
|
".color-picker-copy-inside"
|
|
2728
|
-
), { h, s: p, v: d } =
|
|
2741
|
+
), { h, s: p, v: d } = H(this.currentColor);
|
|
2729
2742
|
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(
|
|
2730
2743
|
i,
|
|
2731
2744
|
s,
|
|
@@ -2753,18 +2766,31 @@ class Zt {
|
|
|
2753
2766
|
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2754
2767
|
break;
|
|
2755
2768
|
case "hsl":
|
|
2756
|
-
const { h: n, s: o, v: a } =
|
|
2769
|
+
const { h: n, s: o, v: a } = H(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
|
|
2757
2770
|
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2758
2771
|
r * 100
|
|
2759
2772
|
)}%, ${Math.round(l * 100)}%)`;
|
|
2760
2773
|
break;
|
|
2761
2774
|
}
|
|
2762
2775
|
}
|
|
2776
|
+
applyRecentColor(t) {
|
|
2777
|
+
this.currentColor = t, this.updatePickerVisualState();
|
|
2778
|
+
const e = this.container.querySelector(
|
|
2779
|
+
".color-picker-format-select"
|
|
2780
|
+
), i = this.container.querySelector(
|
|
2781
|
+
".color-picker-color-input"
|
|
2782
|
+
);
|
|
2783
|
+
this.updateColorInput(e, i), this.triggerChange();
|
|
2784
|
+
}
|
|
2785
|
+
commitRecentColor() {
|
|
2786
|
+
var t;
|
|
2787
|
+
F.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
|
|
2788
|
+
}
|
|
2763
2789
|
setupColorAreaEvents(t, e, i) {
|
|
2764
2790
|
const s = (n) => {
|
|
2765
2791
|
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));
|
|
2766
2792
|
e.style.left = `${a * 100}%`, e.style.top = `${l * 100}%`;
|
|
2767
|
-
const r = parseFloat(i.style.left || "0%") / 100 * 360, h =
|
|
2793
|
+
const r = parseFloat(i.style.left || "0%") / 100 * 360, h = G(r, a, 1 - l);
|
|
2768
2794
|
this.currentColor = h;
|
|
2769
2795
|
const p = this.container.querySelector(
|
|
2770
2796
|
".color-picker-format-select"
|
|
@@ -2790,7 +2816,7 @@ class Zt {
|
|
|
2790
2816
|
p = Math.max(0, Math.min(1, p)), e.style.left = `${p * 100}%`;
|
|
2791
2817
|
const d = p * 360, g = parseFloat(s.style.left || "50%") / 100, u = parseFloat(s.style.top || "50%") / 100;
|
|
2792
2818
|
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2793
|
-
const m =
|
|
2819
|
+
const m = G(d, g, 1 - u);
|
|
2794
2820
|
this.currentColor = m, this.updateColorInput(n, o), this.updateOpacityBackground(a), this.triggerChange();
|
|
2795
2821
|
};
|
|
2796
2822
|
t.addEventListener("mousedown", (r) => {
|
|
@@ -2845,7 +2871,7 @@ class Zt {
|
|
|
2845
2871
|
}
|
|
2846
2872
|
parseHexInput(t) {
|
|
2847
2873
|
const e = t.startsWith("#") ? t : `#${t}`;
|
|
2848
|
-
return
|
|
2874
|
+
return R(e);
|
|
2849
2875
|
}
|
|
2850
2876
|
parseRgbInput(t) {
|
|
2851
2877
|
const e = t.match(
|
|
@@ -2854,7 +2880,7 @@ class Zt {
|
|
|
2854
2880
|
if (e) {
|
|
2855
2881
|
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
2856
2882
|
if (i <= 255 && s <= 255 && n <= 255)
|
|
2857
|
-
return
|
|
2883
|
+
return D(i, s, n);
|
|
2858
2884
|
}
|
|
2859
2885
|
return null;
|
|
2860
2886
|
}
|
|
@@ -2866,7 +2892,7 @@ class Zt {
|
|
|
2866
2892
|
const i = parseFloat(e[1]), s = parseFloat(e[2]) / 100, n = parseFloat(e[3]) / 100;
|
|
2867
2893
|
if (i >= 0 && i <= 360 && s >= 0 && s <= 1 && n >= 0 && n <= 1) {
|
|
2868
2894
|
const o = X(i, s, n);
|
|
2869
|
-
return
|
|
2895
|
+
return D(o.r, o.g, o.b);
|
|
2870
2896
|
}
|
|
2871
2897
|
}
|
|
2872
2898
|
return null;
|
|
@@ -2888,7 +2914,7 @@ class Zt {
|
|
|
2888
2914
|
".color-picker-hue-marker"
|
|
2889
2915
|
), s = this.container.querySelector(
|
|
2890
2916
|
".color-picker-opacity"
|
|
2891
|
-
), { h: n, s: o, v: a } =
|
|
2917
|
+
), { h: n, s: o, v: a } = H(this.currentColor);
|
|
2892
2918
|
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);
|
|
2893
2919
|
}
|
|
2894
2920
|
triggerChange() {
|
|
@@ -2913,7 +2939,7 @@ class Zt {
|
|
|
2913
2939
|
".color-picker-format-select"
|
|
2914
2940
|
), r = this.container.querySelector(
|
|
2915
2941
|
".color-picker-color-input"
|
|
2916
|
-
), { h, s: p, v: d } =
|
|
2942
|
+
), { h, s: p, v: d } = H(t), g = h >= 360 ? h % 360 : h;
|
|
2917
2943
|
n.style.left = `${g / 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(${g}, 100%, 50%))`, o.style.left = `${e}%`, this.updateOpacityBackground(a), this.updateColorInput(l, r);
|
|
2918
2944
|
}
|
|
2919
2945
|
}
|
|
@@ -2939,7 +2965,7 @@ const ot = (c) => {
|
|
|
2939
2965
|
for (let a = s; a < c.length && n > 0; a++)
|
|
2940
2966
|
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2941
2967
|
return n === 0 ? c.substring(s, o) : null;
|
|
2942
|
-
},
|
|
2968
|
+
}, Zt = (c) => {
|
|
2943
2969
|
const t = c.split(" ")[0].toLowerCase();
|
|
2944
2970
|
return [
|
|
2945
2971
|
"circle",
|
|
@@ -2963,7 +2989,7 @@ const ot = (c) => {
|
|
|
2963
2989
|
const l = ut(n);
|
|
2964
2990
|
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2965
2991
|
}), t;
|
|
2966
|
-
},
|
|
2992
|
+
}, $ = (c) => {
|
|
2967
2993
|
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2968
2994
|
return {
|
|
2969
2995
|
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
@@ -2974,11 +3000,11 @@ const ot = (c) => {
|
|
|
2974
3000
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2975
3001
|
}))
|
|
2976
3002
|
};
|
|
2977
|
-
},
|
|
3003
|
+
}, Y = (c) => {
|
|
2978
3004
|
const t = c.replace(/;$/, "").trim();
|
|
2979
3005
|
if (Wt(t)) {
|
|
2980
3006
|
const s = ut(t);
|
|
2981
|
-
return
|
|
3007
|
+
return $({ type: "solid", angle: 0, stops: [s] });
|
|
2982
3008
|
}
|
|
2983
3009
|
const e = at(t, "linear-gradient");
|
|
2984
3010
|
if (e) {
|
|
@@ -2999,15 +3025,15 @@ const ot = (c) => {
|
|
|
2999
3025
|
"to top left": 315
|
|
3000
3026
|
}[a] ?? 90, o = s.slice(1));
|
|
3001
3027
|
const l = lt(o);
|
|
3002
|
-
return l.length ?
|
|
3028
|
+
return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
|
|
3003
3029
|
}
|
|
3004
3030
|
const i = at(t, "radial-gradient");
|
|
3005
3031
|
if (i) {
|
|
3006
|
-
const s = ot(i), n = s[0] && !
|
|
3007
|
-
return o.length ?
|
|
3032
|
+
const s = ot(i), n = s[0] && !Zt(s[0]) ? s.slice(1) : s, o = lt(n);
|
|
3033
|
+
return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
|
|
3008
3034
|
}
|
|
3009
3035
|
return null;
|
|
3010
|
-
},
|
|
3036
|
+
}, O = (c) => {
|
|
3011
3037
|
if (c.type === "solid") {
|
|
3012
3038
|
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");
|
|
3013
3039
|
return `#${s}${n}`;
|
|
@@ -3016,7 +3042,7 @@ const ot = (c) => {
|
|
|
3016
3042
|
(e) => `${pt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
3017
3043
|
).join(", ");
|
|
3018
3044
|
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
3019
|
-
},
|
|
3045
|
+
}, Q = (c) => {
|
|
3020
3046
|
if (c.type === "solid") {
|
|
3021
3047
|
const t = c.stops[0];
|
|
3022
3048
|
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
@@ -3033,23 +3059,36 @@ const ot = (c) => {
|
|
|
3033
3059
|
type: "text",
|
|
3034
3060
|
angle: "number",
|
|
3035
3061
|
stops: "text"
|
|
3036
|
-
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.previewUpdateTimeout = null, this.onBackgroundClick = (i) => {
|
|
3062
|
+
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.onBackgroundClick = (i) => {
|
|
3037
3063
|
var p;
|
|
3038
3064
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3039
3065
|
const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((d) => d.contains(s)), r = s.closest(
|
|
3040
3066
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3041
3067
|
), h = s.classList.contains("color-picker-backdrop");
|
|
3042
3068
|
!n && !o && !l && !r && !h && this.closePopover();
|
|
3069
|
+
}, this.handlePopoverKeydown = (i) => {
|
|
3070
|
+
if (this.isPopoverOpen) {
|
|
3071
|
+
if (i.key === "Escape") {
|
|
3072
|
+
i.preventDefault(), this.closePopover();
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
if (i.key === "Enter") {
|
|
3076
|
+
const s = i.target;
|
|
3077
|
+
if (s && (s.tagName === "INPUT" || s.tagName === "TEXTAREA"))
|
|
3078
|
+
return;
|
|
3079
|
+
i.preventDefault(), this.closePopover();
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3043
3082
|
}, this.detectChange = t.detectChange, this.forText = t.forText || !1, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3044
3083
|
}
|
|
3045
3084
|
defaultValue() {
|
|
3046
3085
|
const t = this.originalDefault;
|
|
3047
3086
|
if (typeof t == "string") {
|
|
3048
|
-
const i =
|
|
3087
|
+
const i = Y(t);
|
|
3049
3088
|
if (i)
|
|
3050
|
-
return
|
|
3089
|
+
return $(i);
|
|
3051
3090
|
}
|
|
3052
|
-
return
|
|
3091
|
+
return $(t && typeof t == "object" ? t : {
|
|
3053
3092
|
type: "linear",
|
|
3054
3093
|
angle: 90,
|
|
3055
3094
|
stops: [
|
|
@@ -3061,7 +3100,7 @@ const ot = (c) => {
|
|
|
3061
3100
|
setValue(t) {
|
|
3062
3101
|
var i, s;
|
|
3063
3102
|
let e = null;
|
|
3064
|
-
typeof t == "string" ? e =
|
|
3103
|
+
typeof t == "string" ? e = Y(t) : t && typeof t == "object" && (e = $(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;
|
|
3065
3104
|
}
|
|
3066
3105
|
updateUI() {
|
|
3067
3106
|
if (this.previewEl && this.value)
|
|
@@ -3069,12 +3108,12 @@ const ot = (c) => {
|
|
|
3069
3108
|
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3070
3109
|
this.previewEl.style.background = pt(t.color, e);
|
|
3071
3110
|
} else
|
|
3072
|
-
this.previewEl.style.background =
|
|
3073
|
-
this.inputEl && this.value && !this.isEditing && (this.inputEl.value =
|
|
3111
|
+
this.previewEl.style.background = O(this.value);
|
|
3112
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = Q(this.value));
|
|
3074
3113
|
}
|
|
3075
3114
|
cssForTextValue() {
|
|
3076
3115
|
return this.value ? {
|
|
3077
|
-
background:
|
|
3116
|
+
background: O(this.value),
|
|
3078
3117
|
"-webkit-background-clip": "text",
|
|
3079
3118
|
"background-clip": "text",
|
|
3080
3119
|
color: "transparent",
|
|
@@ -3090,17 +3129,17 @@ const ot = (c) => {
|
|
|
3090
3129
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3091
3130
|
}
|
|
3092
3131
|
const e = document.createElement("div");
|
|
3093
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3132
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? O(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("mousedown", (i) => {
|
|
3094
3133
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3095
|
-
}), 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 ?
|
|
3096
|
-
this.isEditing = !0, this.value && (this.inputEl.value =
|
|
3134
|
+
}), 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 ? Q(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3135
|
+
this.isEditing = !0, this.value && (this.inputEl.value = O(this.value));
|
|
3097
3136
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3098
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3137
|
+
this.isEditing = !1, this.value && (this.inputEl.value = Q(this.value));
|
|
3099
3138
|
}), this.inputEl.addEventListener(
|
|
3100
3139
|
"paste",
|
|
3101
3140
|
(i) => this.handlePaste(i)
|
|
3102
3141
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3103
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3142
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = O(this.value)), this.inputEl.blur());
|
|
3104
3143
|
}), e.appendChild(this.previewEl), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
3105
3144
|
}
|
|
3106
3145
|
createPopover() {
|
|
@@ -3111,7 +3150,7 @@ const ot = (c) => {
|
|
|
3111
3150
|
const e = document.createElement("span");
|
|
3112
3151
|
e.textContent = "Fill";
|
|
3113
3152
|
const i = document.createElement("button");
|
|
3114
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3153
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = mt, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
3115
3154
|
const s = document.createElement("div");
|
|
3116
3155
|
s.className = "gradient-editor";
|
|
3117
3156
|
const n = this.createTypeTabs();
|
|
@@ -3152,16 +3191,17 @@ const ot = (c) => {
|
|
|
3152
3191
|
}
|
|
3153
3192
|
renderSolid(t) {
|
|
3154
3193
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3155
|
-
const e = this.value.stops[0], i = new
|
|
3194
|
+
const e = this.value.stops[0], i = new Xt({
|
|
3156
3195
|
initialColor: e.color,
|
|
3157
3196
|
initialOpacity: e.opacity ?? 100,
|
|
3158
3197
|
onColorChange: (s, n) => {
|
|
3159
|
-
this.value && (this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange());
|
|
3198
|
+
this.value && (this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s);
|
|
3160
3199
|
}
|
|
3161
3200
|
});
|
|
3162
|
-
t.appendChild(i.getElement());
|
|
3201
|
+
this.solidPicker = i, t.appendChild(i.getElement());
|
|
3163
3202
|
}
|
|
3164
3203
|
renderGradient(t) {
|
|
3204
|
+
this.solidPicker = null;
|
|
3165
3205
|
const e = document.createElement("div");
|
|
3166
3206
|
e.className = "gradient-subtype-inline";
|
|
3167
3207
|
const i = document.createElement("select");
|
|
@@ -3215,7 +3255,7 @@ const ot = (c) => {
|
|
|
3215
3255
|
updateGradientPreview(t) {
|
|
3216
3256
|
var i;
|
|
3217
3257
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3218
|
-
e && this.value && (e.style.background =
|
|
3258
|
+
e && this.value && (e.style.background = O(this.value));
|
|
3219
3259
|
}
|
|
3220
3260
|
debouncedPreviewUpdate(t) {
|
|
3221
3261
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3252,7 +3292,7 @@ const ot = (c) => {
|
|
|
3252
3292
|
(n, o) => n.position - o.position
|
|
3253
3293
|
);
|
|
3254
3294
|
i.forEach((n, o) => {
|
|
3255
|
-
var U,
|
|
3295
|
+
var U, it;
|
|
3256
3296
|
const a = this.value.stops.findIndex(
|
|
3257
3297
|
(v, E) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, E).filter(
|
|
3258
3298
|
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
@@ -3274,21 +3314,21 @@ const ot = (c) => {
|
|
|
3274
3314
|
const m = document.createElement("button");
|
|
3275
3315
|
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(g), d.appendChild(u), d.appendChild(m);
|
|
3276
3316
|
const f = document.createElement("button");
|
|
3277
|
-
f.type = "button", f.className = "gstop-del", f.innerHTML = _t, f.disabled = (((
|
|
3317
|
+
f.type = "button", f.className = "gstop-del", f.innerHTML = _t, f.disabled = (((it = (U = this.value) == null ? void 0 : U.stops) == null ? void 0 : it.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
|
|
3278
3318
|
const C = document.createElement("span");
|
|
3279
3319
|
C.className = "gstop-opacity-label", C.textContent = "Opacity";
|
|
3280
3320
|
const x = document.createElement("div");
|
|
3281
3321
|
x.className = "gstop-opacity-group";
|
|
3282
3322
|
const y = document.createElement("input");
|
|
3283
3323
|
y.type = "range", y.className = "gstop-opacity-slider", y.min = "0", y.max = "100", y.value = String(n.opacity ?? 100);
|
|
3284
|
-
const
|
|
3324
|
+
const T = S(n.color);
|
|
3285
3325
|
y.style.setProperty(
|
|
3286
3326
|
"--slider-color",
|
|
3287
|
-
`rgb(${
|
|
3327
|
+
`rgb(${T.r}, ${T.g}, ${T.b})`
|
|
3288
3328
|
);
|
|
3289
3329
|
const k = document.createElement("span");
|
|
3290
3330
|
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, x.appendChild(y), x.appendChild(k);
|
|
3291
|
-
const
|
|
3331
|
+
const A = new Jt((v, E) => {
|
|
3292
3332
|
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v, E !== void 0 && (this.value.stops[l].opacity = E, y.value = String(E), k.textContent = `${E}%`);
|
|
3293
3333
|
const w = S(v);
|
|
3294
3334
|
y.style.setProperty(
|
|
@@ -3300,7 +3340,7 @@ const ot = (c) => {
|
|
|
3300
3340
|
), this.updateUI(), this.triggerChange();
|
|
3301
3341
|
}, "gradient");
|
|
3302
3342
|
u.addEventListener("click", (v) => {
|
|
3303
|
-
v.preventDefault(), v.stopPropagation(),
|
|
3343
|
+
v.preventDefault(), v.stopPropagation(), A.open(n.color, u, n.opacity ?? 100);
|
|
3304
3344
|
}), u.addEventListener("input", () => {
|
|
3305
3345
|
const v = u.value.trim(), E = v.startsWith("#") ? v : `#${v}`;
|
|
3306
3346
|
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
@@ -3325,8 +3365,8 @@ const ot = (c) => {
|
|
|
3325
3365
|
}), p.addEventListener("input", (v) => {
|
|
3326
3366
|
const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3327
3367
|
if (!Number.isNaN(w)) {
|
|
3328
|
-
const
|
|
3329
|
-
this.value.stops[l].position =
|
|
3368
|
+
const z = Math.max(0, Math.min(100, w));
|
|
3369
|
+
this.value.stops[l].position = z, E.value = `${z}%`, this.debouncedPreviewUpdate();
|
|
3330
3370
|
}
|
|
3331
3371
|
}), p.addEventListener("blur", (v) => {
|
|
3332
3372
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
@@ -3334,8 +3374,8 @@ const ot = (c) => {
|
|
|
3334
3374
|
if (Number.isNaN(w))
|
|
3335
3375
|
E.value = `${this.value.stops[l].position}%`;
|
|
3336
3376
|
else {
|
|
3337
|
-
const
|
|
3338
|
-
this.value.stops[l].position =
|
|
3377
|
+
const z = Math.max(0, Math.min(100, w));
|
|
3378
|
+
this.value.stops[l].position = z, E.value = `${z}%`;
|
|
3339
3379
|
}
|
|
3340
3380
|
this.updateGradientPreview(), this.createHandles(
|
|
3341
3381
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
@@ -3387,7 +3427,7 @@ const ot = (c) => {
|
|
|
3387
3427
|
setTimeout(
|
|
3388
3428
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
3389
3429
|
0
|
|
3390
|
-
);
|
|
3430
|
+
), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
3391
3431
|
}
|
|
3392
3432
|
}
|
|
3393
3433
|
repositionPopover() {
|
|
@@ -3415,7 +3455,10 @@ const ot = (c) => {
|
|
|
3415
3455
|
s && this.updatePopoverContent(s);
|
|
3416
3456
|
}
|
|
3417
3457
|
closePopover() {
|
|
3418
|
-
!this.popoverEl || !this.isPopoverOpen || (this.isPopoverOpen = !1, this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), N.openInstance === this && (N.openInstance = null));
|
|
3458
|
+
!this.popoverEl || !this.isPopoverOpen || (this.isPopoverOpen = !1, this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), N.openInstance === this && (N.openInstance = null));
|
|
3459
|
+
}
|
|
3460
|
+
commitPendingSolidColor() {
|
|
3461
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : F.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3419
3462
|
}
|
|
3420
3463
|
handlePaste(t) {
|
|
3421
3464
|
var i;
|
|
@@ -3428,7 +3471,7 @@ const ot = (c) => {
|
|
|
3428
3471
|
this.parseAndSet(e.value);
|
|
3429
3472
|
}
|
|
3430
3473
|
parseAndSet(t) {
|
|
3431
|
-
const e =
|
|
3474
|
+
const e = Y(t.trim());
|
|
3432
3475
|
e && this.setValue(e);
|
|
3433
3476
|
}
|
|
3434
3477
|
triggerChange() {
|
|
@@ -3439,10 +3482,13 @@ const ot = (c) => {
|
|
|
3439
3482
|
return this.element;
|
|
3440
3483
|
}
|
|
3441
3484
|
getValue() {
|
|
3442
|
-
return this.value ?
|
|
3485
|
+
return this.value ? O(this.value) : "";
|
|
3443
3486
|
}
|
|
3444
3487
|
getCSSValue() {
|
|
3445
|
-
return this.value ?
|
|
3488
|
+
return this.value ? O(this.value) : "";
|
|
3489
|
+
}
|
|
3490
|
+
getCSSForText() {
|
|
3491
|
+
return this.value ? this.cssForTextValue() : {};
|
|
3446
3492
|
}
|
|
3447
3493
|
getRawValue() {
|
|
3448
3494
|
return this.value;
|
|
@@ -3450,16 +3496,16 @@ const ot = (c) => {
|
|
|
3450
3496
|
};
|
|
3451
3497
|
N.openInstance = null;
|
|
3452
3498
|
let rt = N;
|
|
3453
|
-
const
|
|
3499
|
+
const Kt = `
|
|
3454
3500
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3455
3501
|
<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"/>
|
|
3456
3502
|
</svg>
|
|
3457
|
-
`,
|
|
3503
|
+
`, Yt = `
|
|
3458
3504
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3459
3505
|
<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"/>
|
|
3460
3506
|
</svg>
|
|
3461
3507
|
`;
|
|
3462
|
-
class Ee extends
|
|
3508
|
+
class Ee extends V {
|
|
3463
3509
|
constructor(t) {
|
|
3464
3510
|
super({
|
|
3465
3511
|
title: "Border",
|
|
@@ -3467,16 +3513,16 @@ class Ee extends T {
|
|
|
3467
3513
|
settings: {
|
|
3468
3514
|
size: new I({
|
|
3469
3515
|
title: "Size",
|
|
3470
|
-
icon:
|
|
3516
|
+
icon: Yt,
|
|
3471
3517
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3472
3518
|
suffix: "px"
|
|
3473
3519
|
}),
|
|
3474
|
-
color: new
|
|
3520
|
+
color: new P({
|
|
3475
3521
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3476
3522
|
}),
|
|
3477
3523
|
radius: new I({
|
|
3478
3524
|
title: "Radius",
|
|
3479
|
-
icon:
|
|
3525
|
+
icon: Kt,
|
|
3480
3526
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3481
3527
|
suffix: "px"
|
|
3482
3528
|
})
|
|
@@ -3508,7 +3554,7 @@ const Qt = `
|
|
|
3508
3554
|
<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"/>
|
|
3509
3555
|
</svg>
|
|
3510
3556
|
`;
|
|
3511
|
-
class be extends
|
|
3557
|
+
class be extends V {
|
|
3512
3558
|
constructor(t = {}) {
|
|
3513
3559
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3514
3560
|
super({
|
|
@@ -3516,10 +3562,10 @@ class be extends T {
|
|
|
3516
3562
|
collapsed: i.collapsed,
|
|
3517
3563
|
settings: (() => {
|
|
3518
3564
|
const s = {
|
|
3519
|
-
color: new
|
|
3565
|
+
color: new P({
|
|
3520
3566
|
default: i.colorDefault ?? "0, 0, 30"
|
|
3521
3567
|
}),
|
|
3522
|
-
fontFamily: new
|
|
3568
|
+
fontFamily: new et({
|
|
3523
3569
|
title: "Font",
|
|
3524
3570
|
icon: Qt,
|
|
3525
3571
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
@@ -3532,7 +3578,7 @@ class be extends T {
|
|
|
3532
3578
|
getOptions: i.fontFamilyGetOptions,
|
|
3533
3579
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3534
3580
|
}),
|
|
3535
|
-
fontWeight: new
|
|
3581
|
+
fontWeight: new et({
|
|
3536
3582
|
title: "Weight",
|
|
3537
3583
|
icon: te,
|
|
3538
3584
|
default: i.fontWeightDefault ?? "400",
|
|
@@ -3554,7 +3600,7 @@ class be extends T {
|
|
|
3554
3600
|
};
|
|
3555
3601
|
return e ? {
|
|
3556
3602
|
...s,
|
|
3557
|
-
align: new
|
|
3603
|
+
align: new Nt({
|
|
3558
3604
|
title: "Align",
|
|
3559
3605
|
default: i.alignDefault ?? "center"
|
|
3560
3606
|
})
|
|
@@ -3574,7 +3620,7 @@ class be extends T {
|
|
|
3574
3620
|
`;
|
|
3575
3621
|
}
|
|
3576
3622
|
}
|
|
3577
|
-
class
|
|
3623
|
+
class j extends b {
|
|
3578
3624
|
constructor(t) {
|
|
3579
3625
|
super({
|
|
3580
3626
|
...t,
|
|
@@ -3620,31 +3666,31 @@ class _ extends b {
|
|
|
3620
3666
|
}), i;
|
|
3621
3667
|
}
|
|
3622
3668
|
}
|
|
3623
|
-
class we extends
|
|
3669
|
+
class we extends V {
|
|
3624
3670
|
constructor(t) {
|
|
3625
3671
|
super({
|
|
3626
3672
|
title: "Margins",
|
|
3627
3673
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3628
3674
|
settings: {
|
|
3629
|
-
marginTop: new
|
|
3675
|
+
marginTop: new j({
|
|
3630
3676
|
title: "Top",
|
|
3631
3677
|
icon: ie,
|
|
3632
3678
|
suffix: "px",
|
|
3633
3679
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3634
3680
|
}),
|
|
3635
|
-
marginRight: new
|
|
3681
|
+
marginRight: new j({
|
|
3636
3682
|
title: "Right",
|
|
3637
3683
|
icon: se,
|
|
3638
3684
|
suffix: "px",
|
|
3639
3685
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3640
3686
|
}),
|
|
3641
|
-
marginBottom: new
|
|
3687
|
+
marginBottom: new j({
|
|
3642
3688
|
title: "Bottom",
|
|
3643
3689
|
icon: ne,
|
|
3644
3690
|
suffix: "px",
|
|
3645
3691
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3646
3692
|
}),
|
|
3647
|
-
marginLeft: new
|
|
3693
|
+
marginLeft: new j({
|
|
3648
3694
|
title: "Left",
|
|
3649
3695
|
icon: oe,
|
|
3650
3696
|
suffix: "px",
|
|
@@ -3672,7 +3718,7 @@ const ie = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
3672
3718
|
</svg>`, oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3673
3719
|
<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"/>
|
|
3674
3720
|
</svg>`;
|
|
3675
|
-
class xe extends
|
|
3721
|
+
class xe extends V {
|
|
3676
3722
|
constructor(t) {
|
|
3677
3723
|
super({
|
|
3678
3724
|
title: "Background Image",
|
|
@@ -3682,10 +3728,10 @@ class xe extends T {
|
|
|
3682
3728
|
...t == null ? void 0 : t.uploadProps,
|
|
3683
3729
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3684
3730
|
}),
|
|
3685
|
-
opacity: new
|
|
3731
|
+
opacity: new St({
|
|
3686
3732
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3687
3733
|
}),
|
|
3688
|
-
backgroundColor: new
|
|
3734
|
+
backgroundColor: new P({
|
|
3689
3735
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3690
3736
|
})
|
|
3691
3737
|
}
|
|
@@ -3712,13 +3758,13 @@ class xe extends T {
|
|
|
3712
3758
|
}
|
|
3713
3759
|
}
|
|
3714
3760
|
export {
|
|
3715
|
-
|
|
3761
|
+
Nt as AlignSetting,
|
|
3716
3762
|
ye as AnimationSetting,
|
|
3717
3763
|
xe as BackgroundSettingSet,
|
|
3718
3764
|
Ee as BorderSettingSet,
|
|
3719
3765
|
ce as ButtonSetting,
|
|
3720
3766
|
M as ColorSetting,
|
|
3721
|
-
|
|
3767
|
+
P as ColorWithOpacitySetting,
|
|
3722
3768
|
he as DimensionSetting,
|
|
3723
3769
|
me as GapSetting,
|
|
3724
3770
|
rt as GradientSetting,
|
|
@@ -3730,22 +3776,22 @@ export {
|
|
|
3730
3776
|
ve as MarginTopSetting,
|
|
3731
3777
|
Ce as MultiLanguageSetting,
|
|
3732
3778
|
I as NumberSetting,
|
|
3733
|
-
|
|
3779
|
+
St as OpacitySetting,
|
|
3734
3780
|
ue as SelectApiSettings,
|
|
3735
|
-
|
|
3781
|
+
et as SelectSetting,
|
|
3736
3782
|
b as Setting,
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3783
|
+
V as SettingGroup,
|
|
3784
|
+
xt as StringSetting,
|
|
3785
|
+
bt as TabSettingGroup,
|
|
3786
|
+
bt as TabsSettingGroup,
|
|
3741
3787
|
ge as Toggle,
|
|
3742
3788
|
ht as UploadSetting,
|
|
3743
3789
|
de as WidthSetting,
|
|
3744
3790
|
le as asSettingGroupWithSettings,
|
|
3745
|
-
|
|
3791
|
+
wt as createSettingGroup,
|
|
3746
3792
|
ae as createTabSettingGroup,
|
|
3747
|
-
|
|
3793
|
+
B as isSetting,
|
|
3748
3794
|
nt as isSettingChild,
|
|
3749
3795
|
L as isSettingGroup,
|
|
3750
|
-
|
|
3796
|
+
q as iterateSettings
|
|
3751
3797
|
};
|