builder-settings-types 0.0.278 → 0.0.280
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 +39 -31
- package/dist/builder-settings-types.es.js +481 -436
- package/dist/groups/borderSettingsSet.d.ts +7 -5
- package/dist/groups/headerTypographySettingsSet.d.ts +3 -2
- package/dist/settings/gradient-settings/GradientSetting.d.ts +1 -1
- package/dist/settings/gradient-settings/components/EmbeddedColorPicker.d.ts +2 -0
- package/dist/settings/gradient-settings/recent/RecentColorManager.d.ts +3 -3
- package/dist/settings/gradient-settings/recent/createRecentColorsSection.d.ts +2 -2
- package/dist/settings/gradient-settings/utils/types.d.ts +1 -1
- package/dist/settings/select-settings/selectSettings.d.ts +0 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const ft = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let
|
|
2
|
+
let ht = (c = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
4
|
for (; c--; )
|
|
5
5
|
t += ft[e[c] & 63];
|
|
@@ -11,14 +11,14 @@ function vt(c) {
|
|
|
11
11
|
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function J(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 et(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
|
+
J(s, n), et(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const Ct = {
|
|
@@ -111,15 +111,15 @@ class yt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
114
|
+
const ot = new yt();
|
|
115
|
+
function X(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) => X(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] = X(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return c;
|
|
@@ -142,15 +142,15 @@ function Et(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class w {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
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, w.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, w.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -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 = X(this.props), i = new t(e);
|
|
175
|
+
return i.value = X(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -233,30 +233,30 @@ class b {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return c instanceof
|
|
236
|
+
function D(c) {
|
|
237
|
+
return c instanceof w;
|
|
238
238
|
}
|
|
239
239
|
function L(c) {
|
|
240
|
-
return c instanceof
|
|
240
|
+
return c instanceof T;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function at(c) {
|
|
243
|
+
return D(c) || L(c);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function j(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 Y = class Y {
|
|
253
253
|
constructor(t) {
|
|
254
254
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
|
|
255
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id ||
|
|
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
|
+
j(this.settings, (e, i) => {
|
|
260
260
|
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
@@ -273,13 +273,13 @@ const Z = class Z {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
j(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(L(e) ||
|
|
278
|
+
(L(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (J(this.elementRef, this.nestingLevel), et(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -328,7 +328,7 @@ const Z = class Z {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
331
|
+
j(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 Z = class Z {
|
|
|
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) || D(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 Z = class Z {
|
|
|
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(), j(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 (D(s)) {
|
|
402
402
|
const o = () => e();
|
|
403
403
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
404
404
|
} else {
|
|
@@ -421,10 +421,10 @@ const Z = class Z {
|
|
|
421
421
|
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
422
422
|
if (Number.isFinite(a)) {
|
|
423
423
|
const l = this.addItemCfg.createItem(a);
|
|
424
|
-
|
|
424
|
+
at(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (L(n) ||
|
|
427
|
+
n && (L(n) || D(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
428
|
}), setTimeout(() => {
|
|
429
429
|
this.forceChildUIRefresh();
|
|
430
430
|
}, 0);
|
|
@@ -438,7 +438,7 @@ const Z = class Z {
|
|
|
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()) : D(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 Z = class Z {
|
|
|
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),
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), ot.trackElement(a), J(a, this.nestingLevel + 1), et(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 Z = class Z {
|
|
|
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}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), J(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",
|
|
@@ -760,14 +760,14 @@ const Z = class Z {
|
|
|
760
760
|
</svg>`;
|
|
761
761
|
h.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (d) => {
|
|
762
762
|
d.stopPropagation(), d.preventDefault();
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const m = `${this.addItemCfg.keyPrefix}${
|
|
766
|
-
this.addSetting(m,
|
|
763
|
+
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
764
|
+
if (at(g)) {
|
|
765
|
+
const m = `${this.addItemCfg.keyPrefix}${u}`;
|
|
766
|
+
this.addSetting(m, g);
|
|
767
767
|
}
|
|
768
768
|
}), a.appendChild(h);
|
|
769
769
|
}
|
|
770
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t,
|
|
770
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, ot.trackElement(t), setTimeout(() => {
|
|
771
771
|
this.updateNestingStyles();
|
|
772
772
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
773
773
|
}
|
|
@@ -809,12 +809,12 @@ const Z = class Z {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
let
|
|
812
|
+
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
|
+
let T = Y;
|
|
814
814
|
function ae(c) {
|
|
815
815
|
return new bt(c);
|
|
816
816
|
}
|
|
817
|
-
class bt extends
|
|
817
|
+
class bt extends T {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super(t);
|
|
820
820
|
const e = Object.keys(this.settings)[0];
|
|
@@ -866,12 +866,12 @@ class bt extends V {
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
function wt(c) {
|
|
869
|
-
return new
|
|
869
|
+
return new T(c);
|
|
870
870
|
}
|
|
871
871
|
function le(c) {
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
class xt extends
|
|
874
|
+
class xt extends w {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -1001,14 +1001,14 @@ const kt = `
|
|
|
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 R extends w {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
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 = R.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 P 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 = R.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 P 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 = R.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class P 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 = R.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1123,7 +1123,7 @@ class P extends b {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class re extends
|
|
1126
|
+
class re extends w {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class re extends b {
|
|
|
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 I extends
|
|
1158
|
+
class I extends w {
|
|
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
|
}
|
|
@@ -1245,7 +1245,7 @@ const It = `
|
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class
|
|
1248
|
+
class it extends w {
|
|
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);
|
|
@@ -1300,9 +1300,6 @@ class et extends b {
|
|
|
1300
1300
|
this.isOpen && this.checkDropdownPosition();
|
|
1301
1301
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
1302
1302
|
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Check if dropdown should be positioned above the button
|
|
1305
|
-
*/
|
|
1306
1303
|
checkDropdownPosition() {
|
|
1307
1304
|
if (!this.optionsListEl || !this.buttonEl || !this.container) return;
|
|
1308
1305
|
const t = this.buttonEl.getBoundingClientRect();
|
|
@@ -1323,9 +1320,6 @@ class et extends b {
|
|
|
1323
1320
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1324
1321
|
}));
|
|
1325
1322
|
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Clean up dropdown positioning when closed
|
|
1328
|
-
*/
|
|
1329
1323
|
cleanupDropdownPosition() {
|
|
1330
1324
|
this.optionsListEl && (this.optionsListEl.style.position = "", this.optionsListEl.style.top = "", this.optionsListEl.style.bottom = "", this.optionsListEl.style.left = "", this.optionsListEl.style.right = "", this.optionsListEl.style.width = "");
|
|
1331
1325
|
}
|
|
@@ -1358,7 +1352,7 @@ class et extends b {
|
|
|
1358
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();
|
|
1359
1353
|
}
|
|
1360
1354
|
}
|
|
1361
|
-
class Nt extends
|
|
1355
|
+
class Nt extends w {
|
|
1362
1356
|
constructor(t = {}) {
|
|
1363
1357
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1358
|
}
|
|
@@ -1414,7 +1408,7 @@ class Nt extends b {
|
|
|
1414
1408
|
}), t.appendChild(i), t;
|
|
1415
1409
|
}
|
|
1416
1410
|
}
|
|
1417
|
-
class ce extends
|
|
1411
|
+
class ce extends w {
|
|
1418
1412
|
constructor(t) {
|
|
1419
1413
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1420
1414
|
}
|
|
@@ -1443,7 +1437,7 @@ class ce extends b {
|
|
|
1443
1437
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1444
1438
|
}
|
|
1445
1439
|
}
|
|
1446
|
-
class he extends
|
|
1440
|
+
class he extends w {
|
|
1447
1441
|
constructor(t = {}) {
|
|
1448
1442
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1449
1443
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1561,7 +1555,7 @@ const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1561
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"/>
|
|
1562
1556
|
</svg>`, Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1563
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"/>
|
|
1564
|
-
</svg>`,
|
|
1558
|
+
</svg>`, Q = `
|
|
1565
1559
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1566
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"/>
|
|
1567
1561
|
</svg>
|
|
@@ -1594,7 +1588,7 @@ const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1594
1588
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1595
1589
|
</svg>
|
|
1596
1590
|
`;
|
|
1597
|
-
class
|
|
1591
|
+
class pt extends w {
|
|
1598
1592
|
constructor(t = {}) {
|
|
1599
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();
|
|
1600
1594
|
}
|
|
@@ -1647,7 +1641,7 @@ class ht extends b {
|
|
|
1647
1641
|
);
|
|
1648
1642
|
if (t && t !== "") {
|
|
1649
1643
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1650
|
-
<span class="upload-icon">${
|
|
1644
|
+
<span class="upload-icon">${Q}</span>
|
|
1651
1645
|
<span class="upload-label">Replace</span>
|
|
1652
1646
|
`);
|
|
1653
1647
|
const n = () => {
|
|
@@ -1658,7 +1652,7 @@ class ht extends b {
|
|
|
1658
1652
|
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1659
1653
|
} else
|
|
1660
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 = `
|
|
1661
|
-
<span class="upload-icon">${
|
|
1655
|
+
<span class="upload-icon">${Q}</span>
|
|
1662
1656
|
<span class="upload-label">Upload</span>
|
|
1663
1657
|
`);
|
|
1664
1658
|
}
|
|
@@ -1701,7 +1695,7 @@ class ht extends b {
|
|
|
1701
1695
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1702
1696
|
const o = document.createElement("button");
|
|
1703
1697
|
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1704
|
-
<span class="upload-icon">${
|
|
1698
|
+
<span class="upload-icon">${Q}</span>
|
|
1705
1699
|
<span class="upload-label">Upload</span>
|
|
1706
1700
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1707
1701
|
window.postMessage(
|
|
@@ -1760,7 +1754,7 @@ const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1760
1754
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1755
|
</svg>
|
|
1762
1756
|
`;
|
|
1763
|
-
class ue extends
|
|
1757
|
+
class ue extends w {
|
|
1764
1758
|
constructor(t = {}) {
|
|
1765
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) {
|
|
1766
1760
|
const e = this._options.findIndex(
|
|
@@ -1907,7 +1901,7 @@ class ue extends b {
|
|
|
1907
1901
|
), this.updateButtonText();
|
|
1908
1902
|
}
|
|
1909
1903
|
}
|
|
1910
|
-
class ge extends
|
|
1904
|
+
class ge extends w {
|
|
1911
1905
|
constructor(t) {
|
|
1912
1906
|
var e, i;
|
|
1913
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;
|
|
@@ -1960,7 +1954,7 @@ class ge extends b {
|
|
|
1960
1954
|
const Dt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
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"/>
|
|
1962
1956
|
</svg>`;
|
|
1963
|
-
class me extends
|
|
1957
|
+
class me extends w {
|
|
1964
1958
|
// Store mobile value
|
|
1965
1959
|
constructor(t = {}) {
|
|
1966
1960
|
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);
|
|
@@ -2047,9 +2041,9 @@ class ve extends I {
|
|
|
2047
2041
|
}), this.inputType = "number";
|
|
2048
2042
|
}
|
|
2049
2043
|
}
|
|
2050
|
-
class Ce extends
|
|
2044
|
+
class Ce extends w {
|
|
2051
2045
|
constructor(t) {
|
|
2052
|
-
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(w.DefaultLanguage) ? w.DefaultLanguage : t.languages[0];
|
|
2053
2047
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2054
2048
|
t.languages.forEach((i) => {
|
|
2055
2049
|
var s, n;
|
|
@@ -2080,13 +2074,13 @@ class Ce extends b {
|
|
|
2080
2074
|
return;
|
|
2081
2075
|
}
|
|
2082
2076
|
const h = "...";
|
|
2083
|
-
let p = 0, d = e.length,
|
|
2077
|
+
let p = 0, d = e.length, u = 0;
|
|
2084
2078
|
for (; p <= d; ) {
|
|
2085
2079
|
const m = Math.floor((p + d) / 2), f = e.slice(0, m).trimEnd() + h;
|
|
2086
|
-
this.measureTextWidth(f, i) <= l ? (
|
|
2080
|
+
this.measureTextWidth(f, i) <= l ? (u = m, p = m + 1) : d = m - 1;
|
|
2087
2081
|
}
|
|
2088
|
-
const
|
|
2089
|
-
t.placeholder =
|
|
2082
|
+
const g = e.slice(0, u).trimEnd() + h;
|
|
2083
|
+
t.placeholder = g;
|
|
2090
2084
|
}
|
|
2091
2085
|
autosizeTextarea(t, e = 3) {
|
|
2092
2086
|
t.style.height = "auto";
|
|
@@ -2098,7 +2092,7 @@ class Ce extends b {
|
|
|
2098
2092
|
i.classList.add("simple-multi-language-row");
|
|
2099
2093
|
const s = document.createElement("label");
|
|
2100
2094
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2101
|
-
const n = new
|
|
2095
|
+
const n = new pt({
|
|
2102
2096
|
defaultUrl: e || "",
|
|
2103
2097
|
title: "",
|
|
2104
2098
|
id: `${this.id}_upload_${t}`
|
|
@@ -2194,7 +2188,7 @@ class Ce extends b {
|
|
|
2194
2188
|
});
|
|
2195
2189
|
}
|
|
2196
2190
|
}
|
|
2197
|
-
class ye extends
|
|
2191
|
+
class ye extends w {
|
|
2198
2192
|
constructor(t = {}) {
|
|
2199
2193
|
super(t), this.inputType = "select";
|
|
2200
2194
|
const e = [
|
|
@@ -2205,7 +2199,7 @@ class ye extends b {
|
|
|
2205
2199
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2206
2200
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2207
2201
|
];
|
|
2208
|
-
this.selectSetting = new
|
|
2202
|
+
this.selectSetting = new it({
|
|
2209
2203
|
title: this.title || "Animation",
|
|
2210
2204
|
options: e,
|
|
2211
2205
|
default: this.props.default || "none"
|
|
@@ -2221,7 +2215,7 @@ class ye extends b {
|
|
|
2221
2215
|
this.selectSetting.destroy(), super.destroy();
|
|
2222
2216
|
}
|
|
2223
2217
|
}
|
|
2224
|
-
const
|
|
2218
|
+
const Gt = (c, t) => {
|
|
2225
2219
|
let e = !1, i = 0, s = 0, n = 0, o = 0;
|
|
2226
2220
|
const a = (h) => {
|
|
2227
2221
|
if (h.target.closest("button")) return;
|
|
@@ -2230,18 +2224,18 @@ const Ut = (c, t) => {
|
|
|
2230
2224
|
n = p.left, o = p.top, document.addEventListener("mousemove", l), document.addEventListener("mouseup", r), document.body.style.userSelect = "none";
|
|
2231
2225
|
}, l = (h) => {
|
|
2232
2226
|
if (!e) return;
|
|
2233
|
-
const p = h.clientX - i, d = h.clientY - s,
|
|
2234
|
-
let C = n + p,
|
|
2235
|
-
C = Math.max(8, Math.min(
|
|
2227
|
+
const p = h.clientX - i, d = h.clientY - s, u = window.innerWidth, g = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2228
|
+
let C = n + p, y = o + d;
|
|
2229
|
+
C = Math.max(8, Math.min(u - m - 8, C)), y = Math.max(8, Math.min(g - f - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`;
|
|
2236
2230
|
}, r = () => {
|
|
2237
2231
|
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2238
2232
|
};
|
|
2239
2233
|
c.addEventListener("mousedown", a);
|
|
2240
|
-
},
|
|
2234
|
+
}, G = (c) => {
|
|
2241
2235
|
if (!c) return null;
|
|
2242
2236
|
let t = c.trim();
|
|
2243
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()}`;
|
|
2244
|
-
},
|
|
2238
|
+
}, F = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (c) => {
|
|
2245
2239
|
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2246
2240
|
return {
|
|
2247
2241
|
r: parseInt(e.slice(0, 2), 16),
|
|
@@ -2254,18 +2248,18 @@ const Ut = (c, t) => {
|
|
|
2254
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);
|
|
2255
2249
|
const p = a === 0 ? 0 : r / a, d = a;
|
|
2256
2250
|
return { h: h * 60, s: p, v: d };
|
|
2257
|
-
},
|
|
2251
|
+
}, W = (c, t, e) => {
|
|
2258
2252
|
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2259
2253
|
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),
|
|
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), F(
|
|
2261
2255
|
Math.round((a + o) * 255),
|
|
2262
2256
|
Math.round((l + o) * 255),
|
|
2263
2257
|
Math.round((r + o) * 255)
|
|
2264
2258
|
);
|
|
2265
|
-
},
|
|
2259
|
+
}, Ut = (c, t, e) => {
|
|
2266
2260
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2267
2261
|
return { hue: c, sat: s, lightness: i };
|
|
2268
|
-
},
|
|
2262
|
+
}, Z = (c, t, e) => {
|
|
2269
2263
|
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2270
2264
|
let o = 0, a = 0, l = 0;
|
|
2271
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), {
|
|
@@ -2273,7 +2267,7 @@ const Ut = (c, t) => {
|
|
|
2273
2267
|
g: Math.round((a + n) * 255),
|
|
2274
2268
|
b: Math.round((l + n) * 255)
|
|
2275
2269
|
};
|
|
2276
|
-
},
|
|
2270
|
+
}, dt = (c, t) => {
|
|
2277
2271
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2278
2272
|
if (c.startsWith("#")) {
|
|
2279
2273
|
const { r: s, g: n, b: o } = S(c);
|
|
@@ -2286,7 +2280,7 @@ const Ut = (c, t) => {
|
|
|
2286
2280
|
if (c.startsWith("hsl(")) {
|
|
2287
2281
|
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2288
2282
|
if (s) {
|
|
2289
|
-
const { r: n, g: o, b: a } =
|
|
2283
|
+
const { r: n, g: o, b: a } = Z(
|
|
2290
2284
|
parseInt(s[1]),
|
|
2291
2285
|
parseInt(s[2]) / 100,
|
|
2292
2286
|
parseInt(s[3]) / 100
|
|
@@ -2297,7 +2291,7 @@ const Ut = (c, t) => {
|
|
|
2297
2291
|
if (c.startsWith("hsla(")) {
|
|
2298
2292
|
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2299
2293
|
if (s) {
|
|
2300
|
-
const { r: n, g: o, b: a } =
|
|
2294
|
+
const { r: n, g: o, b: a } = Z(
|
|
2301
2295
|
parseInt(s[1]),
|
|
2302
2296
|
parseInt(s[2]) / 100,
|
|
2303
2297
|
parseInt(s[3]) / 100
|
|
@@ -2305,13 +2299,13 @@ const Ut = (c, t) => {
|
|
|
2305
2299
|
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2306
2300
|
}
|
|
2307
2301
|
}
|
|
2308
|
-
const i =
|
|
2302
|
+
const i = G(c);
|
|
2309
2303
|
if (i) {
|
|
2310
2304
|
const { r: s, g: n, b: o } = S(i);
|
|
2311
2305
|
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2312
2306
|
}
|
|
2313
2307
|
return c;
|
|
2314
|
-
},
|
|
2308
|
+
}, zt = (c) => [
|
|
2315
2309
|
"red",
|
|
2316
2310
|
"green",
|
|
2317
2311
|
"blue",
|
|
@@ -2335,22 +2329,22 @@ const Ut = (c, t) => {
|
|
|
2335
2329
|
"teal",
|
|
2336
2330
|
"fuchsia",
|
|
2337
2331
|
"transparent"
|
|
2338
|
-
].includes(c.toLowerCase()),
|
|
2332
|
+
].includes(c.toLowerCase()), ut = (c) => [
|
|
2339
2333
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2340
2334
|
/^rgba?\s*\([^)]+\)$/,
|
|
2341
2335
|
/^hsla?\s*\([^)]+\)$/,
|
|
2342
2336
|
/^[a-zA-Z]+$/
|
|
2343
2337
|
].some((e) => e.test(c.trim())), Wt = (c) => {
|
|
2344
2338
|
if (typeof document > "u")
|
|
2345
|
-
return
|
|
2339
|
+
return ut(c) || !!G(c);
|
|
2346
2340
|
const t = document.createElement("div");
|
|
2347
2341
|
return t.style.color = c, t.style.color !== "";
|
|
2348
|
-
},
|
|
2342
|
+
}, gt = (c) => {
|
|
2349
2343
|
const t = c.trim();
|
|
2350
2344
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2351
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);
|
|
2352
2346
|
return {
|
|
2353
|
-
color:
|
|
2347
|
+
color: F(o, a, l),
|
|
2354
2348
|
position: 0,
|
|
2355
2349
|
opacity: Math.round(r / 255 * 100)
|
|
2356
2350
|
};
|
|
@@ -2361,7 +2355,7 @@ const Ut = (c, t) => {
|
|
|
2361
2355
|
if (e) {
|
|
2362
2356
|
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2363
2357
|
return {
|
|
2364
|
-
color:
|
|
2358
|
+
color: F(n, o, a),
|
|
2365
2359
|
position: 0,
|
|
2366
2360
|
opacity: Math.round(l * 100)
|
|
2367
2361
|
};
|
|
@@ -2370,27 +2364,135 @@ const Ut = (c, t) => {
|
|
|
2370
2364
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2371
2365
|
);
|
|
2372
2366
|
if (i) {
|
|
2373
|
-
const { r: n, g: o, b: a } =
|
|
2367
|
+
const { r: n, g: o, b: a } = Z(
|
|
2374
2368
|
parseFloat(i[1]),
|
|
2375
2369
|
parseFloat(i[2]) / 100,
|
|
2376
2370
|
parseFloat(i[3]) / 100
|
|
2377
2371
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2378
2372
|
return {
|
|
2379
|
-
color:
|
|
2373
|
+
color: F(n, o, a),
|
|
2380
2374
|
position: 0,
|
|
2381
2375
|
opacity: Math.round(l * 100)
|
|
2382
2376
|
};
|
|
2383
2377
|
}
|
|
2384
|
-
return { color:
|
|
2385
|
-
},
|
|
2378
|
+
return { color: G(t) || t, position: 0, opacity: 100 };
|
|
2379
|
+
}, lt = (c) => {
|
|
2380
|
+
const t = [];
|
|
2381
|
+
let e = "", i = 0;
|
|
2382
|
+
for (let s = 0; s < c.length; s++) {
|
|
2383
|
+
const n = c[s];
|
|
2384
|
+
if (n === "(") i++;
|
|
2385
|
+
else if (n === ")") i--;
|
|
2386
|
+
else if (n === "," && i === 0) {
|
|
2387
|
+
t.push(e.trim()), e = "";
|
|
2388
|
+
continue;
|
|
2389
|
+
}
|
|
2390
|
+
e += n;
|
|
2391
|
+
}
|
|
2392
|
+
return e.trim() && t.push(e.trim()), t;
|
|
2393
|
+
}, rt = (c, t) => {
|
|
2394
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2395
|
+
if (!i) return null;
|
|
2396
|
+
const s = i.index + i[0].length;
|
|
2397
|
+
let n = 1, o = s;
|
|
2398
|
+
for (let a = s; a < c.length && n > 0; a++)
|
|
2399
|
+
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2400
|
+
return n === 0 ? c.substring(s, o) : null;
|
|
2401
|
+
}, qt = (c) => {
|
|
2402
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2403
|
+
return [
|
|
2404
|
+
"circle",
|
|
2405
|
+
"ellipse",
|
|
2406
|
+
"closest-side",
|
|
2407
|
+
"closest-corner",
|
|
2408
|
+
"farthest-side",
|
|
2409
|
+
"farthest-corner",
|
|
2410
|
+
"at",
|
|
2411
|
+
"contain",
|
|
2412
|
+
"cover"
|
|
2413
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || zt(t);
|
|
2414
|
+
}, ct = (c) => {
|
|
2415
|
+
const t = [];
|
|
2416
|
+
return c.forEach((e, i) => {
|
|
2417
|
+
const s = e.trim();
|
|
2418
|
+
if (!s) return;
|
|
2419
|
+
let n = "", o = 0;
|
|
2420
|
+
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2421
|
+
a && ut(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2422
|
+
const l = gt(n);
|
|
2423
|
+
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2424
|
+
}), t;
|
|
2425
|
+
}, $ = (c) => {
|
|
2426
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2427
|
+
return {
|
|
2428
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2429
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2430
|
+
stops: t.map((e, i) => ({
|
|
2431
|
+
color: e.color || "#000000",
|
|
2432
|
+
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2433
|
+
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2434
|
+
}))
|
|
2435
|
+
};
|
|
2436
|
+
}, P = (c) => {
|
|
2437
|
+
const t = c.replace(/;$/, "").trim();
|
|
2438
|
+
if (Wt(t)) {
|
|
2439
|
+
const s = gt(t);
|
|
2440
|
+
return $({ type: "solid", angle: 0, stops: [s] });
|
|
2441
|
+
}
|
|
2442
|
+
const e = rt(t, "linear-gradient");
|
|
2443
|
+
if (e) {
|
|
2444
|
+
const s = lt(e);
|
|
2445
|
+
let n = 90, o = s;
|
|
2446
|
+
const a = s[0];
|
|
2447
|
+
if (a.includes("deg")) {
|
|
2448
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2449
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2450
|
+
} else a.includes("to ") && (n = {
|
|
2451
|
+
"to right": 90,
|
|
2452
|
+
"to left": 270,
|
|
2453
|
+
"to bottom": 180,
|
|
2454
|
+
"to top": 0,
|
|
2455
|
+
"to bottom right": 135,
|
|
2456
|
+
"to bottom left": 225,
|
|
2457
|
+
"to top right": 45,
|
|
2458
|
+
"to top left": 315
|
|
2459
|
+
}[a] ?? 90, o = s.slice(1));
|
|
2460
|
+
const l = ct(o);
|
|
2461
|
+
return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
|
|
2462
|
+
}
|
|
2463
|
+
const i = rt(t, "radial-gradient");
|
|
2464
|
+
if (i) {
|
|
2465
|
+
const s = lt(i), n = s[0] && !qt(s[0]) ? s.slice(1) : s, o = ct(n);
|
|
2466
|
+
return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
|
|
2467
|
+
}
|
|
2468
|
+
return null;
|
|
2469
|
+
}, N = (c) => {
|
|
2470
|
+
if (c.type === "solid") {
|
|
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
|
+
return `#${s}${n}`;
|
|
2473
|
+
}
|
|
2474
|
+
const t = c.stops.map(
|
|
2475
|
+
(e) => `${dt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2476
|
+
).join(", ");
|
|
2477
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
2478
|
+
}, tt = (c) => {
|
|
2479
|
+
if (c.type === "solid") {
|
|
2480
|
+
const t = c.stops[0];
|
|
2481
|
+
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
2482
|
+
}
|
|
2483
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
2484
|
+
}, q = class q {
|
|
2386
2485
|
static defaults() {
|
|
2387
|
-
return
|
|
2486
|
+
return {
|
|
2487
|
+
solid: [],
|
|
2488
|
+
gradient: []
|
|
2489
|
+
};
|
|
2388
2490
|
}
|
|
2389
2491
|
static normalizeList(t) {
|
|
2390
2492
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2391
2493
|
return t.forEach((s) => {
|
|
2392
|
-
|
|
2393
|
-
n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2494
|
+
let n = G(s);
|
|
2495
|
+
n || P(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2394
2496
|
}), i.slice(0, this.MAX_COLORS);
|
|
2395
2497
|
}
|
|
2396
2498
|
static ensureLoaded() {
|
|
@@ -2401,13 +2503,10 @@ const Ut = (c, t) => {
|
|
|
2401
2503
|
if (!e) return;
|
|
2402
2504
|
const i = JSON.parse(e);
|
|
2403
2505
|
if (Array.isArray(i))
|
|
2404
|
-
this.colors = this.normalizeList(i);
|
|
2506
|
+
this.colors.solid = this.normalizeList(i);
|
|
2405
2507
|
else if (i && typeof i == "object") {
|
|
2406
|
-
const s =
|
|
2407
|
-
|
|
2408
|
-
const o = i, a = Array.isArray(o[n]) ? o[n] : [];
|
|
2409
|
-
s.push(...a);
|
|
2410
|
-
}), this.colors = this.normalizeList(s);
|
|
2508
|
+
const s = i;
|
|
2509
|
+
s.solid && (this.colors.solid = this.normalizeList(s.solid)), s.gradient && (this.colors.gradient = this.normalizeList(s.gradient));
|
|
2411
2510
|
}
|
|
2412
2511
|
} catch {
|
|
2413
2512
|
this.colors = this.defaults();
|
|
@@ -2425,21 +2524,32 @@ const Ut = (c, t) => {
|
|
|
2425
2524
|
}
|
|
2426
2525
|
}
|
|
2427
2526
|
static list(t) {
|
|
2428
|
-
return this.ensureLoaded(), this.colors || (this.colors = this.defaults()), this.colors;
|
|
2527
|
+
return this.ensureLoaded(), this.colors || (this.colors = this.defaults()), this.colors[t];
|
|
2429
2528
|
}
|
|
2430
2529
|
static getColors(t) {
|
|
2530
|
+
if (t === "all") {
|
|
2531
|
+
const e = this.list("solid"), i = this.list("gradient"), s = [...e, ...i];
|
|
2532
|
+
return this.normalizeList(s);
|
|
2533
|
+
}
|
|
2431
2534
|
return [...this.list(t)];
|
|
2432
2535
|
}
|
|
2433
2536
|
static addColor(t, e) {
|
|
2434
|
-
|
|
2537
|
+
if (!t) return;
|
|
2538
|
+
let i = G(t), s = "solid";
|
|
2539
|
+
if (i)
|
|
2540
|
+
s = "solid";
|
|
2541
|
+
else {
|
|
2542
|
+
const l = P(t);
|
|
2543
|
+
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2544
|
+
}
|
|
2435
2545
|
if (!i) return;
|
|
2436
|
-
const s = this.list(
|
|
2437
|
-
|
|
2546
|
+
const n = e === "all" ? s : e, o = this.list(n), a = o.indexOf(i);
|
|
2547
|
+
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2438
2548
|
}
|
|
2439
2549
|
};
|
|
2440
|
-
|
|
2441
|
-
let
|
|
2442
|
-
const
|
|
2550
|
+
q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
|
|
2551
|
+
let A = q;
|
|
2552
|
+
const st = (c, t) => {
|
|
2443
2553
|
const e = document.createElement("div");
|
|
2444
2554
|
e.className = "color-picker-recent-section";
|
|
2445
2555
|
const i = document.createElement("div");
|
|
@@ -2450,7 +2560,7 @@ const gt = (c, t) => {
|
|
|
2450
2560
|
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2451
2561
|
const o = () => {
|
|
2452
2562
|
s.innerHTML = "";
|
|
2453
|
-
const a =
|
|
2563
|
+
const a = A.getColors(t);
|
|
2454
2564
|
if (a.length === 0) {
|
|
2455
2565
|
s.style.display = "none", n.style.display = "block";
|
|
2456
2566
|
return;
|
|
@@ -2465,16 +2575,16 @@ const gt = (c, t) => {
|
|
|
2465
2575
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2466
2576
|
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"
|
|
2467
2577
|
fill="#919EAB"/>
|
|
2468
|
-
</svg>`,
|
|
2578
|
+
</svg>`, jt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2469
2579
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2470
2580
|
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.29156Z"
|
|
2471
2581
|
fill="#353C47"/>
|
|
2472
|
-
</svg>`,
|
|
2582
|
+
</svg>`, _t = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2473
2583
|
<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"/>
|
|
2474
|
-
</svg>`,
|
|
2584
|
+
</svg>`, Jt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2475
2585
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2476
2586
|
</svg>`;
|
|
2477
|
-
class
|
|
2587
|
+
class Xt {
|
|
2478
2588
|
constructor(t, e = "gradient") {
|
|
2479
2589
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2480
2590
|
if (!this.isOpen) return;
|
|
@@ -2508,7 +2618,7 @@ class Jt {
|
|
|
2508
2618
|
const i = document.createElement("span");
|
|
2509
2619
|
i.textContent = "Color";
|
|
2510
2620
|
const s = document.createElement("button");
|
|
2511
|
-
s.className = "color-picker-close", s.innerHTML = mt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s),
|
|
2621
|
+
s.className = "color-picker-close", s.innerHTML = mt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), Gt(e, t);
|
|
2512
2622
|
const n = document.createElement("div");
|
|
2513
2623
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2514
2624
|
const o = document.createElement("div");
|
|
@@ -2516,7 +2626,7 @@ class Jt {
|
|
|
2516
2626
|
const a = document.createElement("div");
|
|
2517
2627
|
a.className = "color-picker-hue-container";
|
|
2518
2628
|
const l = document.createElement("button");
|
|
2519
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2629
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = jt;
|
|
2520
2630
|
const r = document.createElement("div");
|
|
2521
2631
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2522
2632
|
const h = document.createElement("div");
|
|
@@ -2525,27 +2635,27 @@ class Jt {
|
|
|
2525
2635
|
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
2526
2636
|
const d = document.createElement("div");
|
|
2527
2637
|
d.className = "color-picker-opacity-marker", this.opacityMarker = d, p.appendChild(d);
|
|
2528
|
-
const
|
|
2638
|
+
const u = st((B) => {
|
|
2529
2639
|
var U;
|
|
2530
|
-
this.setColor(
|
|
2640
|
+
this.setColor(B), (U = this.onChange) == null || U.call(this, B, this.currentOpacity);
|
|
2531
2641
|
}, this.recentScope);
|
|
2532
|
-
this.recentSectionRefresh =
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2642
|
+
this.recentSectionRefresh = u.refresh;
|
|
2643
|
+
const g = document.createElement("div");
|
|
2644
|
+
g.className = "color-picker-format-section";
|
|
2535
2645
|
const m = document.createElement("select");
|
|
2536
2646
|
m.className = "color-picker-format-select", this.select = m;
|
|
2537
2647
|
const f = document.createElement("option");
|
|
2538
2648
|
f.value = "hex", f.textContent = "HEX";
|
|
2539
2649
|
const C = document.createElement("option");
|
|
2540
2650
|
C.value = "rgb", C.textContent = "RGB";
|
|
2541
|
-
const
|
|
2542
|
-
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2651
|
+
const y = document.createElement("option");
|
|
2652
|
+
y.value = "hsl", y.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(y);
|
|
2653
|
+
const E = document.createElement("input");
|
|
2654
|
+
E.type = "text", E.className = "color-picker-color-input", E.value = this.currentColor, this.input = E;
|
|
2655
|
+
const O = document.createElement("div");
|
|
2656
|
+
O.className = "color-picker-input-container";
|
|
2547
2657
|
const k = document.createElement("button");
|
|
2548
|
-
return k.className = "color-picker-copy-inside", k.textContent = "Copy",
|
|
2658
|
+
return k.className = "color-picker-copy-inside", k.textContent = "Copy", O.appendChild(E), O.appendChild(k), g.appendChild(m), g.appendChild(O), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(u.container), t.appendChild(g), t.addEventListener("click", (B) => B.stopPropagation()), this.bind(n, r, p, E, m, k, l), t;
|
|
2549
2659
|
}
|
|
2550
2660
|
createBackdrop() {
|
|
2551
2661
|
const t = document.createElement("div");
|
|
@@ -2555,41 +2665,41 @@ class Jt {
|
|
|
2555
2665
|
}
|
|
2556
2666
|
bind(t, e, i, s, n, o, a) {
|
|
2557
2667
|
const l = (p) => {
|
|
2558
|
-
var
|
|
2559
|
-
const d = t.getBoundingClientRect(),
|
|
2560
|
-
this.colorMarker.style.left = `${
|
|
2561
|
-
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C =
|
|
2562
|
-
this.currentColor = C, this.syncInput(), this.updateOpacityBg(), (
|
|
2668
|
+
var y;
|
|
2669
|
+
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));
|
|
2670
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2671
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C = W(f, u, 1 - g);
|
|
2672
|
+
this.currentColor = C, this.syncInput(), this.updateOpacityBg(), (y = this.onChange) == null || y.call(this, C, this.currentOpacity);
|
|
2563
2673
|
}, r = (p) => {
|
|
2564
|
-
var
|
|
2674
|
+
var y;
|
|
2565
2675
|
const d = e.getBoundingClientRect();
|
|
2566
|
-
let
|
|
2567
|
-
this.hueMarker.style.left = `${
|
|
2568
|
-
const
|
|
2569
|
-
this.currentColor = C, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${
|
|
2676
|
+
let u = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2677
|
+
this.hueMarker.style.left = `${u * 100}%`;
|
|
2678
|
+
const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), C = W(g, m, 1 - f);
|
|
2679
|
+
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);
|
|
2570
2680
|
}, h = (p) => {
|
|
2571
|
-
var
|
|
2572
|
-
const d = i.getBoundingClientRect(),
|
|
2573
|
-
this.opacityMarker.style.left = `${
|
|
2681
|
+
var g;
|
|
2682
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2683
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
|
|
2574
2684
|
};
|
|
2575
2685
|
t.addEventListener("mousedown", (p) => {
|
|
2576
2686
|
p.preventDefault(), l(p);
|
|
2577
|
-
const d = (
|
|
2578
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2687
|
+
const d = (g) => l(g), u = () => {
|
|
2688
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2579
2689
|
};
|
|
2580
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2690
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2581
2691
|
}), e.addEventListener("mousedown", (p) => {
|
|
2582
2692
|
p.preventDefault(), r(p);
|
|
2583
|
-
const d = (
|
|
2584
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2693
|
+
const d = (g) => r(g), u = () => {
|
|
2694
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2585
2695
|
};
|
|
2586
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2696
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2587
2697
|
}), i.addEventListener("mousedown", (p) => {
|
|
2588
2698
|
p.preventDefault(), h(p);
|
|
2589
|
-
const d = (
|
|
2590
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2699
|
+
const d = (g) => h(g), u = () => {
|
|
2700
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2591
2701
|
};
|
|
2592
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2702
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2593
2703
|
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
|
|
2594
2704
|
p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
|
|
2595
2705
|
}), o.addEventListener("click", async () => {
|
|
@@ -2605,8 +2715,8 @@ class Jt {
|
|
|
2605
2715
|
return;
|
|
2606
2716
|
}
|
|
2607
2717
|
try {
|
|
2608
|
-
const d = new window.EyeDropper(), { sRGBHex:
|
|
2609
|
-
this.setColor(
|
|
2718
|
+
const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
|
|
2719
|
+
this.setColor(u), (p = this.onChange) == null || p.call(this, u, this.currentOpacity);
|
|
2610
2720
|
} catch {
|
|
2611
2721
|
}
|
|
2612
2722
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2627,7 +2737,7 @@ class Jt {
|
|
|
2627
2737
|
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
2628
2738
|
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2629
2739
|
} else {
|
|
2630
|
-
const { hue: n, sat: o, lightness: a } =
|
|
2740
|
+
const { hue: n, sat: o, lightness: a } = Ut(e, i, s);
|
|
2631
2741
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2632
2742
|
o * 100
|
|
2633
2743
|
)}%, ${Math.round(a * 100)}%)`;
|
|
@@ -2646,7 +2756,7 @@ class Jt {
|
|
|
2646
2756
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2647
2757
|
if (s) {
|
|
2648
2758
|
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);
|
|
2649
|
-
e =
|
|
2759
|
+
e = W(n, r, l);
|
|
2650
2760
|
}
|
|
2651
2761
|
}
|
|
2652
2762
|
}
|
|
@@ -2660,28 +2770,28 @@ class Jt {
|
|
|
2660
2770
|
);
|
|
2661
2771
|
}
|
|
2662
2772
|
open(t, e, i) {
|
|
2663
|
-
var
|
|
2773
|
+
var E;
|
|
2664
2774
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2665
2775
|
const { h: s, s: n, v: o } = H(t);
|
|
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}%`, (
|
|
2776
|
+
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}%`, (E = this.recentSectionRefresh) == null || E.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);
|
|
2667
2777
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2668
|
-
let
|
|
2778
|
+
let u = r.right + 8, g = r.top;
|
|
2669
2779
|
const m = h - r.right, f = r.left;
|
|
2670
|
-
m >= a + d ?
|
|
2671
|
-
const C = p - r.bottom,
|
|
2672
|
-
C >= l + d ?
|
|
2780
|
+
m >= a + d ? u = r.right + 8 : f >= a + d ? u = r.left - a - 8 : u = Math.max(d, (h - a) / 2);
|
|
2781
|
+
const C = p - r.bottom, y = r.top;
|
|
2782
|
+
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`;
|
|
2673
2783
|
}
|
|
2674
2784
|
close(t) {
|
|
2675
2785
|
var e;
|
|
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 && (
|
|
2786
|
+
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 !== "gradient" && (A.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2677
2787
|
}
|
|
2678
2788
|
getElement() {
|
|
2679
2789
|
return this.element;
|
|
2680
2790
|
}
|
|
2681
2791
|
}
|
|
2682
|
-
class
|
|
2792
|
+
class Zt {
|
|
2683
2793
|
constructor(t) {
|
|
2684
|
-
this.recentScope = "
|
|
2794
|
+
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();
|
|
2685
2795
|
}
|
|
2686
2796
|
createContainer() {
|
|
2687
2797
|
const t = document.createElement("div");
|
|
@@ -2714,7 +2824,7 @@ class Xt {
|
|
|
2714
2824
|
</div>
|
|
2715
2825
|
</div>
|
|
2716
2826
|
`;
|
|
2717
|
-
const e =
|
|
2827
|
+
const e = st((i) => {
|
|
2718
2828
|
this.applyRecentColor(i);
|
|
2719
2829
|
}, this.recentScope);
|
|
2720
2830
|
return this.recentSectionRefresh = e.refresh, t.appendChild(e.container), t;
|
|
@@ -2774,32 +2884,35 @@ class Xt {
|
|
|
2774
2884
|
}
|
|
2775
2885
|
}
|
|
2776
2886
|
applyRecentColor(t) {
|
|
2777
|
-
this.currentColor = t,
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2887
|
+
if (this.currentColor = t, !(t.includes("gradient") || t.includes("radial"))) {
|
|
2888
|
+
this.updatePickerVisualState();
|
|
2889
|
+
const i = this.container.querySelector(
|
|
2890
|
+
".color-picker-format-select"
|
|
2891
|
+
), s = this.container.querySelector(
|
|
2892
|
+
".color-picker-color-input"
|
|
2893
|
+
);
|
|
2894
|
+
this.updateColorInput(i, s);
|
|
2895
|
+
}
|
|
2896
|
+
this.triggerChange();
|
|
2784
2897
|
}
|
|
2785
2898
|
commitRecentColor() {
|
|
2786
2899
|
var t;
|
|
2787
|
-
|
|
2900
|
+
A.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
|
|
2788
2901
|
}
|
|
2789
2902
|
setupColorAreaEvents(t, e, i) {
|
|
2790
2903
|
const s = (n) => {
|
|
2791
2904
|
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));
|
|
2792
2905
|
e.style.left = `${a * 100}%`, e.style.top = `${l * 100}%`;
|
|
2793
|
-
const r = parseFloat(i.style.left || "0%") / 100 * 360, h =
|
|
2906
|
+
const r = parseFloat(i.style.left || "0%") / 100 * 360, h = W(r, a, 1 - l);
|
|
2794
2907
|
this.currentColor = h;
|
|
2795
2908
|
const p = this.container.querySelector(
|
|
2796
2909
|
".color-picker-format-select"
|
|
2797
2910
|
), d = this.container.querySelector(
|
|
2798
2911
|
".color-picker-color-input"
|
|
2799
|
-
),
|
|
2912
|
+
), u = this.container.querySelector(
|
|
2800
2913
|
".color-picker-opacity"
|
|
2801
2914
|
);
|
|
2802
|
-
this.updateColorInput(p, d), this.updateOpacityBackground(
|
|
2915
|
+
this.updateColorInput(p, d), this.updateOpacityBackground(u), this.triggerChange();
|
|
2803
2916
|
};
|
|
2804
2917
|
t.addEventListener("mousedown", (n) => {
|
|
2805
2918
|
n.preventDefault(), s(n);
|
|
@@ -2814,9 +2927,9 @@ class Xt {
|
|
|
2814
2927
|
const h = t.getBoundingClientRect();
|
|
2815
2928
|
let p = (r.clientX - h.left) / h.width;
|
|
2816
2929
|
p = Math.max(0, Math.min(1, p)), e.style.left = `${p * 100}%`;
|
|
2817
|
-
const d = p * 360,
|
|
2930
|
+
const d = p * 360, u = parseFloat(s.style.left || "50%") / 100, g = parseFloat(s.style.top || "50%") / 100;
|
|
2818
2931
|
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2819
|
-
const m =
|
|
2932
|
+
const m = W(d, u, 1 - g);
|
|
2820
2933
|
this.currentColor = m, this.updateColorInput(n, o), this.updateOpacityBackground(a), this.triggerChange();
|
|
2821
2934
|
};
|
|
2822
2935
|
t.addEventListener("mousedown", (r) => {
|
|
@@ -2871,7 +2984,7 @@ class Xt {
|
|
|
2871
2984
|
}
|
|
2872
2985
|
parseHexInput(t) {
|
|
2873
2986
|
const e = t.startsWith("#") ? t : `#${t}`;
|
|
2874
|
-
return
|
|
2987
|
+
return G(e);
|
|
2875
2988
|
}
|
|
2876
2989
|
parseRgbInput(t) {
|
|
2877
2990
|
const e = t.match(
|
|
@@ -2880,7 +2993,7 @@ class Xt {
|
|
|
2880
2993
|
if (e) {
|
|
2881
2994
|
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
2882
2995
|
if (i <= 255 && s <= 255 && n <= 255)
|
|
2883
|
-
return
|
|
2996
|
+
return F(i, s, n);
|
|
2884
2997
|
}
|
|
2885
2998
|
return null;
|
|
2886
2999
|
}
|
|
@@ -2891,8 +3004,8 @@ class Xt {
|
|
|
2891
3004
|
if (e) {
|
|
2892
3005
|
const i = parseFloat(e[1]), s = parseFloat(e[2]) / 100, n = parseFloat(e[3]) / 100;
|
|
2893
3006
|
if (i >= 0 && i <= 360 && s >= 0 && s <= 1 && n >= 0 && n <= 1) {
|
|
2894
|
-
const o =
|
|
2895
|
-
return
|
|
3007
|
+
const o = Z(i, s, n);
|
|
3008
|
+
return F(o.r, o.g, o.b);
|
|
2896
3009
|
}
|
|
2897
3010
|
}
|
|
2898
3011
|
return null;
|
|
@@ -2939,116 +3052,11 @@ class Xt {
|
|
|
2939
3052
|
".color-picker-format-select"
|
|
2940
3053
|
), r = this.container.querySelector(
|
|
2941
3054
|
".color-picker-color-input"
|
|
2942
|
-
), { h, s: p, v: d } = H(t),
|
|
2943
|
-
n.style.left = `${
|
|
3055
|
+
), { h, s: p, v: d } = H(t), u = h >= 360 ? h % 360 : h;
|
|
3056
|
+
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);
|
|
2944
3057
|
}
|
|
2945
3058
|
}
|
|
2946
|
-
const
|
|
2947
|
-
const t = [];
|
|
2948
|
-
let e = "", i = 0;
|
|
2949
|
-
for (let s = 0; s < c.length; s++) {
|
|
2950
|
-
const n = c[s];
|
|
2951
|
-
if (n === "(") i++;
|
|
2952
|
-
else if (n === ")") i--;
|
|
2953
|
-
else if (n === "," && i === 0) {
|
|
2954
|
-
t.push(e.trim()), e = "";
|
|
2955
|
-
continue;
|
|
2956
|
-
}
|
|
2957
|
-
e += n;
|
|
2958
|
-
}
|
|
2959
|
-
return e.trim() && t.push(e.trim()), t;
|
|
2960
|
-
}, at = (c, t) => {
|
|
2961
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2962
|
-
if (!i) return null;
|
|
2963
|
-
const s = i.index + i[0].length;
|
|
2964
|
-
let n = 1, o = s;
|
|
2965
|
-
for (let a = s; a < c.length && n > 0; a++)
|
|
2966
|
-
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2967
|
-
return n === 0 ? c.substring(s, o) : null;
|
|
2968
|
-
}, Zt = (c) => {
|
|
2969
|
-
const t = c.split(" ")[0].toLowerCase();
|
|
2970
|
-
return [
|
|
2971
|
-
"circle",
|
|
2972
|
-
"ellipse",
|
|
2973
|
-
"closest-side",
|
|
2974
|
-
"closest-corner",
|
|
2975
|
-
"farthest-side",
|
|
2976
|
-
"farthest-corner",
|
|
2977
|
-
"at",
|
|
2978
|
-
"contain",
|
|
2979
|
-
"cover"
|
|
2980
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Gt(t);
|
|
2981
|
-
}, lt = (c) => {
|
|
2982
|
-
const t = [];
|
|
2983
|
-
return c.forEach((e, i) => {
|
|
2984
|
-
const s = e.trim();
|
|
2985
|
-
if (!s) return;
|
|
2986
|
-
let n = "", o = 0;
|
|
2987
|
-
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2988
|
-
a && dt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2989
|
-
const l = ut(n);
|
|
2990
|
-
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2991
|
-
}), t;
|
|
2992
|
-
}, $ = (c) => {
|
|
2993
|
-
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2994
|
-
return {
|
|
2995
|
-
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2996
|
-
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2997
|
-
stops: t.map((e, i) => ({
|
|
2998
|
-
color: e.color || "#000000",
|
|
2999
|
-
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
3000
|
-
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
3001
|
-
}))
|
|
3002
|
-
};
|
|
3003
|
-
}, Y = (c) => {
|
|
3004
|
-
const t = c.replace(/;$/, "").trim();
|
|
3005
|
-
if (Wt(t)) {
|
|
3006
|
-
const s = ut(t);
|
|
3007
|
-
return $({ type: "solid", angle: 0, stops: [s] });
|
|
3008
|
-
}
|
|
3009
|
-
const e = at(t, "linear-gradient");
|
|
3010
|
-
if (e) {
|
|
3011
|
-
const s = ot(e);
|
|
3012
|
-
let n = 90, o = s;
|
|
3013
|
-
const a = s[0];
|
|
3014
|
-
if (a.includes("deg")) {
|
|
3015
|
-
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
3016
|
-
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
3017
|
-
} else a.includes("to ") && (n = {
|
|
3018
|
-
"to right": 90,
|
|
3019
|
-
"to left": 270,
|
|
3020
|
-
"to bottom": 180,
|
|
3021
|
-
"to top": 0,
|
|
3022
|
-
"to bottom right": 135,
|
|
3023
|
-
"to bottom left": 225,
|
|
3024
|
-
"to top right": 45,
|
|
3025
|
-
"to top left": 315
|
|
3026
|
-
}[a] ?? 90, o = s.slice(1));
|
|
3027
|
-
const l = lt(o);
|
|
3028
|
-
return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
|
|
3029
|
-
}
|
|
3030
|
-
const i = at(t, "radial-gradient");
|
|
3031
|
-
if (i) {
|
|
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;
|
|
3034
|
-
}
|
|
3035
|
-
return null;
|
|
3036
|
-
}, O = (c) => {
|
|
3037
|
-
if (c.type === "solid") {
|
|
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");
|
|
3039
|
-
return `#${s}${n}`;
|
|
3040
|
-
}
|
|
3041
|
-
const t = c.stops.map(
|
|
3042
|
-
(e) => `${pt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
3043
|
-
).join(", ");
|
|
3044
|
-
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
3045
|
-
}, Q = (c) => {
|
|
3046
|
-
if (c.type === "solid") {
|
|
3047
|
-
const t = c.stops[0];
|
|
3048
|
-
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
3049
|
-
}
|
|
3050
|
-
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
3051
|
-
}, N = class N extends b {
|
|
3059
|
+
const V = class V extends w {
|
|
3052
3060
|
constructor(t = {}) {
|
|
3053
3061
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3054
3062
|
super({
|
|
@@ -3079,12 +3087,12 @@ const ot = (c) => {
|
|
|
3079
3087
|
i.preventDefault(), this.closePopover();
|
|
3080
3088
|
}
|
|
3081
3089
|
}
|
|
3082
|
-
}, this.detectChange = t.detectChange, this.
|
|
3090
|
+
}, this.detectChange = t.detectChange, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3083
3091
|
}
|
|
3084
3092
|
defaultValue() {
|
|
3085
3093
|
const t = this.originalDefault;
|
|
3086
3094
|
if (typeof t == "string") {
|
|
3087
|
-
const i =
|
|
3095
|
+
const i = P(t);
|
|
3088
3096
|
if (i)
|
|
3089
3097
|
return $(i);
|
|
3090
3098
|
}
|
|
@@ -3100,20 +3108,20 @@ const ot = (c) => {
|
|
|
3100
3108
|
setValue(t) {
|
|
3101
3109
|
var i, s;
|
|
3102
3110
|
let e = null;
|
|
3103
|
-
typeof t == "string" ? e =
|
|
3111
|
+
typeof t == "string" ? e = P(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;
|
|
3104
3112
|
}
|
|
3105
3113
|
updateUI() {
|
|
3106
3114
|
if (this.previewEl && this.value)
|
|
3107
3115
|
if (this.value.type === "solid") {
|
|
3108
3116
|
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3109
|
-
this.previewEl.style.background =
|
|
3117
|
+
this.previewEl.style.background = dt(t.color, e);
|
|
3110
3118
|
} else
|
|
3111
|
-
this.previewEl.style.background =
|
|
3112
|
-
this.inputEl && this.value && !this.isEditing && (this.inputEl.value =
|
|
3119
|
+
this.previewEl.style.background = N(this.value);
|
|
3120
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = tt(this.value));
|
|
3113
3121
|
}
|
|
3114
3122
|
cssForTextValue() {
|
|
3115
3123
|
return this.value ? {
|
|
3116
|
-
background:
|
|
3124
|
+
background: N(this.value),
|
|
3117
3125
|
"-webkit-background-clip": "text",
|
|
3118
3126
|
"background-clip": "text",
|
|
3119
3127
|
color: "transparent",
|
|
@@ -3129,17 +3137,17 @@ const ot = (c) => {
|
|
|
3129
3137
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3130
3138
|
}
|
|
3131
3139
|
const e = document.createElement("div");
|
|
3132
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3140
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? N(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("mousedown", (i) => {
|
|
3133
3141
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
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 ?
|
|
3135
|
-
this.isEditing = !0, this.value && (this.inputEl.value =
|
|
3142
|
+
}), 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 ? tt(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3143
|
+
this.isEditing = !0, this.value && (this.inputEl.value = N(this.value));
|
|
3136
3144
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3137
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3145
|
+
this.isEditing = !1, this.value && (this.inputEl.value = tt(this.value));
|
|
3138
3146
|
}), this.inputEl.addEventListener(
|
|
3139
3147
|
"paste",
|
|
3140
3148
|
(i) => this.handlePaste(i)
|
|
3141
3149
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3142
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3150
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = N(this.value)), this.inputEl.blur());
|
|
3143
3151
|
}), e.appendChild(this.previewEl), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
3144
3152
|
}
|
|
3145
3153
|
createPopover() {
|
|
@@ -3191,11 +3199,18 @@ const ot = (c) => {
|
|
|
3191
3199
|
}
|
|
3192
3200
|
renderSolid(t) {
|
|
3193
3201
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3194
|
-
const e = this.value.stops[0], i = new
|
|
3202
|
+
const e = this.value.stops[0], i = new Zt({
|
|
3195
3203
|
initialColor: e.color,
|
|
3196
3204
|
initialOpacity: e.opacity ?? 100,
|
|
3197
3205
|
onColorChange: (s, n) => {
|
|
3198
|
-
|
|
3206
|
+
if (this.value) {
|
|
3207
|
+
const o = P(s);
|
|
3208
|
+
if (o && o.type !== "solid") {
|
|
3209
|
+
this.value = o, this.switchType(o.type);
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s;
|
|
3213
|
+
}
|
|
3199
3214
|
}
|
|
3200
3215
|
});
|
|
3201
3216
|
this.solidPicker = i, t.appendChild(i.getElement());
|
|
@@ -3213,24 +3228,24 @@ const ot = (c) => {
|
|
|
3213
3228
|
const o = document.createElement("input");
|
|
3214
3229
|
o.type = "text", o.inputMode = "numeric", o.className = "gradient-degree-input", o.value = `${this.value.angle ?? 0}°`, o.style.width = "75px", o.style.textAlign = "center";
|
|
3215
3230
|
const a = document.createElement("button");
|
|
3216
|
-
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML =
|
|
3231
|
+
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML = _t, i.addEventListener("change", () => {
|
|
3217
3232
|
this.switchType(i.value === "radial" ? "radial" : "linear"), this.updateDegreeVisibility(o);
|
|
3218
|
-
}), o.addEventListener("focus", (
|
|
3219
|
-
const
|
|
3220
|
-
|
|
3221
|
-
}), o.addEventListener("input", (
|
|
3222
|
-
const
|
|
3223
|
-
!Number.isNaN(
|
|
3224
|
-
}), o.addEventListener("blur", (
|
|
3225
|
-
var
|
|
3233
|
+
}), o.addEventListener("focus", (m) => {
|
|
3234
|
+
const f = m.target;
|
|
3235
|
+
f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
|
|
3236
|
+
}), o.addEventListener("input", (m) => {
|
|
3237
|
+
const f = parseInt(m.target.value);
|
|
3238
|
+
!Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
|
|
3239
|
+
}), o.addEventListener("blur", (m) => {
|
|
3240
|
+
var y;
|
|
3226
3241
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3227
|
-
const
|
|
3228
|
-
let
|
|
3229
|
-
Number.isNaN(
|
|
3242
|
+
const f = m.target;
|
|
3243
|
+
let C = parseInt(f.value);
|
|
3244
|
+
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), f.value = `${C}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3230
3245
|
}), a.addEventListener("click", () => {
|
|
3231
|
-
!this.value || !this.value.stops || (this.value.stops.forEach((
|
|
3232
|
-
|
|
3233
|
-
}), this.value.stops.sort((
|
|
3246
|
+
!this.value || !this.value.stops || (this.value.stops.forEach((m) => {
|
|
3247
|
+
m.position = 100 - m.position;
|
|
3248
|
+
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(l), this.createHandles(r, l), this.updateStopsList(u), this.updateUI(), this.triggerChange());
|
|
3234
3249
|
}), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.updateDegreeVisibility(o);
|
|
3235
3250
|
const l = document.createElement("div");
|
|
3236
3251
|
l.className = "gradient-preview", this.updateGradientPreview(l);
|
|
@@ -3242,10 +3257,15 @@ const ot = (c) => {
|
|
|
3242
3257
|
p.textContent = "Stops";
|
|
3243
3258
|
const d = document.createElement("button");
|
|
3244
3259
|
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3245
|
-
const
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3260
|
+
const u = document.createElement("div");
|
|
3261
|
+
u.className = "gradient-stops", t.appendChild(h), t.appendChild(u), this.updateStopsList(u);
|
|
3262
|
+
const g = st((m) => {
|
|
3263
|
+
const f = P(m);
|
|
3264
|
+
f && (this.value = f, this.switchType(f.type), this.updateUI(), this.triggerChange());
|
|
3265
|
+
}, "all");
|
|
3266
|
+
this.recentGradientRefresh = g.refresh, t.appendChild(g.container), d.addEventListener("click", () => {
|
|
3267
|
+
var m;
|
|
3268
|
+
this.addStop(), this.updateStopsList(u), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), ((m = document.activeElement) == null ? void 0 : m.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3249
3269
|
});
|
|
3250
3270
|
}
|
|
3251
3271
|
updateDegreeVisibility(t) {
|
|
@@ -3255,7 +3275,7 @@ const ot = (c) => {
|
|
|
3255
3275
|
updateGradientPreview(t) {
|
|
3256
3276
|
var i;
|
|
3257
3277
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3258
|
-
e && this.value && (e.style.background =
|
|
3278
|
+
e && this.value && (e.style.background = N(this.value));
|
|
3259
3279
|
}
|
|
3260
3280
|
debouncedPreviewUpdate(t) {
|
|
3261
3281
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3269,15 +3289,15 @@ const ot = (c) => {
|
|
|
3269
3289
|
const o = document.createElement("div");
|
|
3270
3290
|
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o);
|
|
3271
3291
|
let a = !1, l = 0, r = 0;
|
|
3272
|
-
const h = (
|
|
3273
|
-
a = !0, l =
|
|
3274
|
-
}, p = (
|
|
3292
|
+
const h = (u) => {
|
|
3293
|
+
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();
|
|
3294
|
+
}, p = (u) => {
|
|
3275
3295
|
if (!a || !this.value) return;
|
|
3276
|
-
const
|
|
3277
|
-
let f = r + m /
|
|
3296
|
+
const g = e.getBoundingClientRect(), m = u.clientX - l;
|
|
3297
|
+
let f = r + m / g.width * 100;
|
|
3278
3298
|
f = Math.max(0, Math.min(100, f)), this.value.stops[s].position = Math.round(f), n.style.left = `${f}%`, this.updateGradientPreview(), this.updateUI();
|
|
3279
3299
|
}, d = () => {
|
|
3280
|
-
a && (a = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((
|
|
3300
|
+
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());
|
|
3281
3301
|
};
|
|
3282
3302
|
n.addEventListener("mousedown", h), t.appendChild(n);
|
|
3283
3303
|
});
|
|
@@ -3292,12 +3312,12 @@ const ot = (c) => {
|
|
|
3292
3312
|
(n, o) => n.position - o.position
|
|
3293
3313
|
);
|
|
3294
3314
|
i.forEach((n, o) => {
|
|
3295
|
-
var U,
|
|
3315
|
+
var U, nt;
|
|
3296
3316
|
const a = this.value.stops.findIndex(
|
|
3297
|
-
(v,
|
|
3298
|
-
(
|
|
3317
|
+
(v, b) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, b).filter(
|
|
3318
|
+
(x) => x.position === n.position && x.color === n.color && x.opacity === n.opacity
|
|
3299
3319
|
).length === i.slice(0, o).filter(
|
|
3300
|
-
(
|
|
3320
|
+
(x) => x.position === n.position && x.color === n.color && x.opacity === n.opacity
|
|
3301
3321
|
).length
|
|
3302
3322
|
), l = a !== -1 ? a : o, r = document.createElement("div");
|
|
3303
3323
|
r.className = "gstop-row";
|
|
@@ -3307,75 +3327,75 @@ const ot = (c) => {
|
|
|
3307
3327
|
p.type = "text", p.className = "gstop-position-input", p.value = `${n.position}%`, p.style.width = "60px", h.appendChild(p);
|
|
3308
3328
|
const d = document.createElement("div");
|
|
3309
3329
|
d.className = "gstop-color-container";
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3312
|
-
const
|
|
3313
|
-
|
|
3330
|
+
const u = document.createElement("div");
|
|
3331
|
+
u.className = "gstop-color-preview", u.style.backgroundColor = n.color;
|
|
3332
|
+
const g = document.createElement("input");
|
|
3333
|
+
g.type = "text", g.className = "gstop-color-input", g.value = n.color.replace("#", "").toUpperCase();
|
|
3314
3334
|
const m = document.createElement("button");
|
|
3315
|
-
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(
|
|
3335
|
+
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(u), d.appendChild(g), d.appendChild(m);
|
|
3316
3336
|
const f = document.createElement("button");
|
|
3317
|
-
f.type = "button", f.className = "gstop-del", f.innerHTML =
|
|
3337
|
+
f.type = "button", f.className = "gstop-del", f.innerHTML = Jt, f.disabled = (((nt = (U = this.value) == null ? void 0 : U.stops) == null ? void 0 : nt.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
|
|
3318
3338
|
const C = document.createElement("span");
|
|
3319
3339
|
C.className = "gstop-opacity-label", C.textContent = "Opacity";
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3322
|
-
const
|
|
3323
|
-
|
|
3324
|
-
const
|
|
3325
|
-
|
|
3340
|
+
const y = document.createElement("div");
|
|
3341
|
+
y.className = "gstop-opacity-group";
|
|
3342
|
+
const E = document.createElement("input");
|
|
3343
|
+
E.type = "range", E.className = "gstop-opacity-slider", E.min = "0", E.max = "100", E.value = String(n.opacity ?? 100);
|
|
3344
|
+
const O = S(n.color);
|
|
3345
|
+
E.style.setProperty(
|
|
3326
3346
|
"--slider-color",
|
|
3327
|
-
`rgb(${
|
|
3347
|
+
`rgb(${O.r}, ${O.g}, ${O.b})`
|
|
3328
3348
|
);
|
|
3329
3349
|
const k = document.createElement("span");
|
|
3330
|
-
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`,
|
|
3331
|
-
const
|
|
3332
|
-
|
|
3333
|
-
const
|
|
3334
|
-
|
|
3350
|
+
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, y.appendChild(E), y.appendChild(k);
|
|
3351
|
+
const B = new Xt((v, b) => {
|
|
3352
|
+
g.value = v.replace("#", "").toUpperCase(), u.style.backgroundColor = v, this.value.stops[l].color = v, b !== void 0 && (this.value.stops[l].opacity = b, E.value = String(b), k.textContent = `${b}%`);
|
|
3353
|
+
const x = S(v);
|
|
3354
|
+
E.style.setProperty(
|
|
3335
3355
|
"--slider-color",
|
|
3336
|
-
`rgb(${
|
|
3356
|
+
`rgb(${x.r}, ${x.g}, ${x.b})`
|
|
3337
3357
|
), this.updateGradientPreview(), this.createHandles(
|
|
3338
3358
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3339
3359
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3340
3360
|
), this.updateUI(), this.triggerChange();
|
|
3341
|
-
}, "
|
|
3342
|
-
|
|
3343
|
-
v.preventDefault(), v.stopPropagation(),
|
|
3344
|
-
}),
|
|
3345
|
-
const v =
|
|
3346
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3347
|
-
this.value.stops[l].color =
|
|
3348
|
-
const
|
|
3349
|
-
|
|
3361
|
+
}, "solid");
|
|
3362
|
+
g.addEventListener("click", (v) => {
|
|
3363
|
+
v.preventDefault(), v.stopPropagation(), B.open(n.color, g, n.opacity ?? 100);
|
|
3364
|
+
}), g.addEventListener("input", () => {
|
|
3365
|
+
const v = g.value.trim(), b = v.startsWith("#") ? v : `#${v}`;
|
|
3366
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(b)) {
|
|
3367
|
+
this.value.stops[l].color = b, u.style.backgroundColor = b;
|
|
3368
|
+
const x = S(b);
|
|
3369
|
+
E.style.setProperty(
|
|
3350
3370
|
"--slider-color",
|
|
3351
|
-
`rgb(${
|
|
3371
|
+
`rgb(${x.r}, ${x.g}, ${x.b})`
|
|
3352
3372
|
), this.debouncedPreviewUpdate();
|
|
3353
3373
|
}
|
|
3354
|
-
}),
|
|
3374
|
+
}), g.addEventListener("blur", () => {
|
|
3355
3375
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3356
3376
|
}), m.addEventListener("click", async (v) => {
|
|
3357
3377
|
v.stopPropagation();
|
|
3358
3378
|
try {
|
|
3359
|
-
await navigator.clipboard.writeText(`#${
|
|
3379
|
+
await navigator.clipboard.writeText(`#${g.value}`);
|
|
3360
3380
|
} catch {
|
|
3361
3381
|
}
|
|
3362
3382
|
}), p.addEventListener("focus", (v) => {
|
|
3363
|
-
const
|
|
3364
|
-
|
|
3383
|
+
const b = v.target;
|
|
3384
|
+
b.value = b.value.replace("%", ""), b.select();
|
|
3365
3385
|
}), p.addEventListener("input", (v) => {
|
|
3366
|
-
const
|
|
3367
|
-
if (!Number.isNaN(
|
|
3368
|
-
const z = Math.max(0, Math.min(100,
|
|
3369
|
-
this.value.stops[l].position = z,
|
|
3386
|
+
const b = v.target, x = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3387
|
+
if (!Number.isNaN(x)) {
|
|
3388
|
+
const z = Math.max(0, Math.min(100, x));
|
|
3389
|
+
this.value.stops[l].position = z, b.value = `${z}%`, this.debouncedPreviewUpdate();
|
|
3370
3390
|
}
|
|
3371
3391
|
}), p.addEventListener("blur", (v) => {
|
|
3372
3392
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3373
|
-
const
|
|
3374
|
-
if (Number.isNaN(
|
|
3375
|
-
|
|
3393
|
+
const b = v.target, x = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3394
|
+
if (Number.isNaN(x))
|
|
3395
|
+
b.value = `${this.value.stops[l].position}%`;
|
|
3376
3396
|
else {
|
|
3377
|
-
const z = Math.max(0, Math.min(100,
|
|
3378
|
-
this.value.stops[l].position = z,
|
|
3397
|
+
const z = Math.max(0, Math.min(100, x));
|
|
3398
|
+
this.value.stops[l].position = z, b.value = `${z}%`;
|
|
3379
3399
|
}
|
|
3380
3400
|
this.updateGradientPreview(), this.createHandles(
|
|
3381
3401
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
@@ -3387,10 +3407,10 @@ const ot = (c) => {
|
|
|
3387
3407
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3388
3408
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3389
3409
|
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((v = document.activeElement) == null ? void 0 : v.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3390
|
-
}),
|
|
3391
|
-
const v = parseInt(
|
|
3410
|
+
}), E.addEventListener("input", () => {
|
|
3411
|
+
const v = parseInt(E.value, 10);
|
|
3392
3412
|
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.debouncedPreviewUpdate();
|
|
3393
|
-
}),
|
|
3413
|
+
}), E.addEventListener("change", () => {
|
|
3394
3414
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3395
3415
|
});
|
|
3396
3416
|
});
|
|
@@ -3413,16 +3433,16 @@ const ot = (c) => {
|
|
|
3413
3433
|
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3414
3434
|
}
|
|
3415
3435
|
openPopover() {
|
|
3416
|
-
if (this.popoverEl && (
|
|
3417
|
-
if (this.isPopoverOpen = !0,
|
|
3436
|
+
if (this.popoverEl && (V.openInstance && V.openInstance !== this && V.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3437
|
+
if (this.isPopoverOpen = !0, V.openInstance = this, this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3418
3438
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3419
3439
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3420
3440
|
const o = this.popoverEl.offsetHeight;
|
|
3421
3441
|
let a = t.right + 8, l = t.top;
|
|
3422
3442
|
const r = i - t.right, h = t.left, p = e + n;
|
|
3423
3443
|
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3424
|
-
const d = s - t.bottom,
|
|
3425
|
-
|
|
3444
|
+
const d = s - t.bottom, u = t.top;
|
|
3445
|
+
u >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : u > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`;
|
|
3426
3446
|
}
|
|
3427
3447
|
setTimeout(
|
|
3428
3448
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3440,25 +3460,31 @@ const ot = (c) => {
|
|
|
3440
3460
|
let l = e.right + 8, r = e.top;
|
|
3441
3461
|
const h = s - e.right, p = e.left, d = i + o;
|
|
3442
3462
|
h < d && p > h + 100 && (l = e.left - i - 8);
|
|
3443
|
-
const
|
|
3444
|
-
|
|
3463
|
+
const u = n - e.bottom, g = e.top;
|
|
3464
|
+
g >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : g > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3445
3465
|
});
|
|
3446
3466
|
}
|
|
3447
3467
|
refreshPopoverContent() {
|
|
3448
|
-
var n;
|
|
3468
|
+
var n, o;
|
|
3449
3469
|
if (!this.popoverEl) return;
|
|
3450
3470
|
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3451
|
-
t.forEach((
|
|
3471
|
+
t.forEach((a) => a.classList.remove("active"));
|
|
3452
3472
|
const e = t[0], i = t[1];
|
|
3453
|
-
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : i.classList.add("active"), this.popoverEl.offsetHeight;
|
|
3473
|
+
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (o = this.recentGradientRefresh) == null || o.call(this)), this.popoverEl.offsetHeight;
|
|
3454
3474
|
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3455
3475
|
s && this.updatePopoverContent(s);
|
|
3456
3476
|
}
|
|
3457
3477
|
closePopover() {
|
|
3458
|
-
|
|
3478
|
+
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3479
|
+
if (this.isPopoverOpen = !1, 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") {
|
|
3480
|
+
const t = N(this.value);
|
|
3481
|
+
A.addColor(t, "gradient");
|
|
3482
|
+
}
|
|
3483
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
|
|
3484
|
+
}
|
|
3459
3485
|
}
|
|
3460
3486
|
commitPendingSolidColor() {
|
|
3461
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
3487
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : A.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3462
3488
|
}
|
|
3463
3489
|
handlePaste(t) {
|
|
3464
3490
|
var i;
|
|
@@ -3471,7 +3497,7 @@ const ot = (c) => {
|
|
|
3471
3497
|
this.parseAndSet(e.value);
|
|
3472
3498
|
}
|
|
3473
3499
|
parseAndSet(t) {
|
|
3474
|
-
const e =
|
|
3500
|
+
const e = P(t.trim());
|
|
3475
3501
|
e && this.setValue(e);
|
|
3476
3502
|
}
|
|
3477
3503
|
triggerChange() {
|
|
@@ -3482,10 +3508,10 @@ const ot = (c) => {
|
|
|
3482
3508
|
return this.element;
|
|
3483
3509
|
}
|
|
3484
3510
|
getValue() {
|
|
3485
|
-
return this.value ?
|
|
3511
|
+
return this.value ? N(this.value) : "";
|
|
3486
3512
|
}
|
|
3487
3513
|
getCSSValue() {
|
|
3488
|
-
return this.value ?
|
|
3514
|
+
return this.value ? N(this.value) : "";
|
|
3489
3515
|
}
|
|
3490
3516
|
getCSSForText() {
|
|
3491
3517
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3494,8 +3520,8 @@ const ot = (c) => {
|
|
|
3494
3520
|
return this.value;
|
|
3495
3521
|
}
|
|
3496
3522
|
};
|
|
3497
|
-
|
|
3498
|
-
let
|
|
3523
|
+
V.openInstance = null;
|
|
3524
|
+
let K = V;
|
|
3499
3525
|
const Kt = `
|
|
3500
3526
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3501
3527
|
<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"/>
|
|
@@ -3505,7 +3531,7 @@ const Kt = `
|
|
|
3505
3531
|
<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"/>
|
|
3506
3532
|
</svg>
|
|
3507
3533
|
`;
|
|
3508
|
-
class Ee extends
|
|
3534
|
+
class Ee extends T {
|
|
3509
3535
|
constructor(t) {
|
|
3510
3536
|
super({
|
|
3511
3537
|
title: "Border",
|
|
@@ -3517,8 +3543,9 @@ class Ee extends V {
|
|
|
3517
3543
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3518
3544
|
suffix: "px"
|
|
3519
3545
|
}),
|
|
3520
|
-
color: new
|
|
3521
|
-
|
|
3546
|
+
color: new K({
|
|
3547
|
+
title: "Border Color",
|
|
3548
|
+
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3522
3549
|
}),
|
|
3523
3550
|
radius: new I({
|
|
3524
3551
|
title: "Radius",
|
|
@@ -3529,15 +3556,20 @@ class Ee extends V {
|
|
|
3529
3556
|
}
|
|
3530
3557
|
});
|
|
3531
3558
|
}
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3559
|
+
getValues() {
|
|
3560
|
+
const t = super.getValues(), e = this.settings.color.getValue();
|
|
3561
|
+
return {
|
|
3562
|
+
...t,
|
|
3563
|
+
color: e ? `${e} 1` : t.color
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3535
3566
|
getCssCode() {
|
|
3536
|
-
const t = this.settings.color.
|
|
3567
|
+
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.radius.value ?? 0, i = this.settings.size.value ?? 0;
|
|
3537
3568
|
return `
|
|
3538
|
-
border-
|
|
3569
|
+
border-image: ${t} 1;
|
|
3539
3570
|
border-width: ${i}px;
|
|
3540
3571
|
border-radius: ${e}px;
|
|
3572
|
+
border-style: solid;
|
|
3541
3573
|
`;
|
|
3542
3574
|
}
|
|
3543
3575
|
}
|
|
@@ -3554,7 +3586,7 @@ const Qt = `
|
|
|
3554
3586
|
<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"/>
|
|
3555
3587
|
</svg>
|
|
3556
3588
|
`;
|
|
3557
|
-
class be extends
|
|
3589
|
+
class be extends T {
|
|
3558
3590
|
constructor(t = {}) {
|
|
3559
3591
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3560
3592
|
super({
|
|
@@ -3562,10 +3594,11 @@ class be extends V {
|
|
|
3562
3594
|
collapsed: i.collapsed,
|
|
3563
3595
|
settings: (() => {
|
|
3564
3596
|
const s = {
|
|
3565
|
-
color: new
|
|
3566
|
-
|
|
3597
|
+
color: new K({
|
|
3598
|
+
title: "Color",
|
|
3599
|
+
default: i.colorDefault ?? "#001E1E"
|
|
3567
3600
|
}),
|
|
3568
|
-
fontFamily: new
|
|
3601
|
+
fontFamily: new it({
|
|
3569
3602
|
title: "Font",
|
|
3570
3603
|
icon: Qt,
|
|
3571
3604
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
@@ -3578,7 +3611,7 @@ class be extends V {
|
|
|
3578
3611
|
getOptions: i.fontFamilyGetOptions,
|
|
3579
3612
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3580
3613
|
}),
|
|
3581
|
-
fontWeight: new
|
|
3614
|
+
fontWeight: new it({
|
|
3582
3615
|
title: "Weight",
|
|
3583
3616
|
icon: te,
|
|
3584
3617
|
default: i.fontWeightDefault ?? "400",
|
|
@@ -3610,7 +3643,7 @@ class be extends V {
|
|
|
3610
3643
|
}
|
|
3611
3644
|
getCssCode() {
|
|
3612
3645
|
var o;
|
|
3613
|
-
const t = this.settings.color.
|
|
3646
|
+
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((o = this.settings.align) == null ? void 0 : o.value) ?? "left";
|
|
3614
3647
|
return `
|
|
3615
3648
|
color: ${t};
|
|
3616
3649
|
font-family: ${e};
|
|
@@ -3619,8 +3652,20 @@ class be extends V {
|
|
|
3619
3652
|
text-align: ${n};
|
|
3620
3653
|
`;
|
|
3621
3654
|
}
|
|
3655
|
+
getTextGradientCss() {
|
|
3656
|
+
var a;
|
|
3657
|
+
const t = this.settings.color.getCSSForText(), e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((a = this.settings.align) == null ? void 0 : a.value) ?? "left";
|
|
3658
|
+
return `
|
|
3659
|
+
${Object.entries(t).map(([l, r]) => `${l}: ${r};`).join(`
|
|
3660
|
+
`)}
|
|
3661
|
+
font-family: ${e};
|
|
3662
|
+
font-weight: ${i};
|
|
3663
|
+
font-size: ${s}px;
|
|
3664
|
+
text-align: ${n};
|
|
3665
|
+
`;
|
|
3666
|
+
}
|
|
3622
3667
|
}
|
|
3623
|
-
class
|
|
3668
|
+
class _ extends w {
|
|
3624
3669
|
constructor(t) {
|
|
3625
3670
|
super({
|
|
3626
3671
|
...t,
|
|
@@ -3666,31 +3711,31 @@ class j extends b {
|
|
|
3666
3711
|
}), i;
|
|
3667
3712
|
}
|
|
3668
3713
|
}
|
|
3669
|
-
class we extends
|
|
3714
|
+
class we extends T {
|
|
3670
3715
|
constructor(t) {
|
|
3671
3716
|
super({
|
|
3672
3717
|
title: "Margins",
|
|
3673
3718
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3674
3719
|
settings: {
|
|
3675
|
-
marginTop: new
|
|
3720
|
+
marginTop: new _({
|
|
3676
3721
|
title: "Top",
|
|
3677
3722
|
icon: ie,
|
|
3678
3723
|
suffix: "px",
|
|
3679
3724
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3680
3725
|
}),
|
|
3681
|
-
marginRight: new
|
|
3726
|
+
marginRight: new _({
|
|
3682
3727
|
title: "Right",
|
|
3683
3728
|
icon: se,
|
|
3684
3729
|
suffix: "px",
|
|
3685
3730
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3686
3731
|
}),
|
|
3687
|
-
marginBottom: new
|
|
3732
|
+
marginBottom: new _({
|
|
3688
3733
|
title: "Bottom",
|
|
3689
3734
|
icon: ne,
|
|
3690
3735
|
suffix: "px",
|
|
3691
3736
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3692
3737
|
}),
|
|
3693
|
-
marginLeft: new
|
|
3738
|
+
marginLeft: new _({
|
|
3694
3739
|
title: "Left",
|
|
3695
3740
|
icon: oe,
|
|
3696
3741
|
suffix: "px",
|
|
@@ -3718,20 +3763,20 @@ const ie = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
3718
3763
|
</svg>`, oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3719
3764
|
<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"/>
|
|
3720
3765
|
</svg>`;
|
|
3721
|
-
class xe extends
|
|
3766
|
+
class xe extends T {
|
|
3722
3767
|
constructor(t) {
|
|
3723
3768
|
super({
|
|
3724
3769
|
title: "Background Image",
|
|
3725
3770
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3726
3771
|
settings: {
|
|
3727
|
-
backgroundImage: new
|
|
3772
|
+
backgroundImage: new pt({
|
|
3728
3773
|
...t == null ? void 0 : t.uploadProps,
|
|
3729
3774
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3730
3775
|
}),
|
|
3731
3776
|
opacity: new St({
|
|
3732
3777
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3733
3778
|
}),
|
|
3734
|
-
backgroundColor: new
|
|
3779
|
+
backgroundColor: new R({
|
|
3735
3780
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3736
3781
|
})
|
|
3737
3782
|
}
|
|
@@ -3764,10 +3809,10 @@ export {
|
|
|
3764
3809
|
Ee as BorderSettingSet,
|
|
3765
3810
|
ce as ButtonSetting,
|
|
3766
3811
|
M as ColorSetting,
|
|
3767
|
-
|
|
3812
|
+
R as ColorWithOpacitySetting,
|
|
3768
3813
|
he as DimensionSetting,
|
|
3769
3814
|
me as GapSetting,
|
|
3770
|
-
|
|
3815
|
+
K as GradientSetting,
|
|
3771
3816
|
be as HeaderTypographySettingSet,
|
|
3772
3817
|
pe as HeightSetting,
|
|
3773
3818
|
re as HtmlSetting,
|
|
@@ -3778,20 +3823,20 @@ export {
|
|
|
3778
3823
|
I as NumberSetting,
|
|
3779
3824
|
St as OpacitySetting,
|
|
3780
3825
|
ue as SelectApiSettings,
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3826
|
+
it as SelectSetting,
|
|
3827
|
+
w as Setting,
|
|
3828
|
+
T as SettingGroup,
|
|
3784
3829
|
xt as StringSetting,
|
|
3785
3830
|
bt as TabSettingGroup,
|
|
3786
3831
|
bt as TabsSettingGroup,
|
|
3787
3832
|
ge as Toggle,
|
|
3788
|
-
|
|
3833
|
+
pt as UploadSetting,
|
|
3789
3834
|
de as WidthSetting,
|
|
3790
3835
|
le as asSettingGroupWithSettings,
|
|
3791
3836
|
wt as createSettingGroup,
|
|
3792
3837
|
ae as createTabSettingGroup,
|
|
3793
|
-
|
|
3794
|
-
|
|
3838
|
+
D as isSetting,
|
|
3839
|
+
at as isSettingChild,
|
|
3795
3840
|
L as isSettingGroup,
|
|
3796
|
-
|
|
3841
|
+
j as iterateSettings
|
|
3797
3842
|
};
|