builder-settings-types 0.0.273 → 0.0.274
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.
|
@@ -142,15 +142,15 @@ function yt(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class b {
|
|
146
146
|
constructor(t = {}) {
|
|
147
147
|
this.props = t, this.dataPropsPath = "", this.id = t.id || ct(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, b.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, b.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -234,15 +234,15 @@ class E {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
function D(c) {
|
|
237
|
-
return c instanceof
|
|
237
|
+
return c instanceof b;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function L(c) {
|
|
240
240
|
return c instanceof O;
|
|
241
241
|
}
|
|
242
242
|
function nt(c) {
|
|
243
|
-
return D(c) ||
|
|
243
|
+
return D(c) || L(c);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function U(c, t) {
|
|
246
246
|
for (const e in c)
|
|
247
247
|
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
248
248
|
const i = c[e];
|
|
@@ -256,8 +256,8 @@ const X = class X {
|
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
U(this.settings, (e, i) => {
|
|
260
|
+
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -273,9 +273,9 @@ const X = class X {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
U(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(L(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
@@ -284,7 +284,7 @@ const X = class X {
|
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
286
|
try {
|
|
287
|
-
if (
|
|
287
|
+
if (L(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -328,7 +328,7 @@ const X = class X {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
331
|
+
U(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 X = class X {
|
|
|
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 && (
|
|
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) {
|
|
@@ -364,7 +364,7 @@ const X = class X {
|
|
|
364
364
|
for (const i in this.settings)
|
|
365
365
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
366
366
|
const s = this.settings[i];
|
|
367
|
-
if (
|
|
367
|
+
if (L(s))
|
|
368
368
|
e[i] = s.getMobileValues();
|
|
369
369
|
else {
|
|
370
370
|
const n = s;
|
|
@@ -375,7 +375,7 @@ const X = class X {
|
|
|
375
375
|
} else {
|
|
376
376
|
const e = this.settings[t];
|
|
377
377
|
if (!e) return;
|
|
378
|
-
if (
|
|
378
|
+
if (L(e)) return e.getMobileValues();
|
|
379
379
|
const i = e;
|
|
380
380
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
381
381
|
}
|
|
@@ -391,9 +391,9 @@ const X = class X {
|
|
|
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(), U(this.settings, (i, s) => {
|
|
395
395
|
var n;
|
|
396
|
-
if (
|
|
396
|
+
if (L(s))
|
|
397
397
|
s.setOnChange(() => {
|
|
398
398
|
const o = this.getValues();
|
|
399
399
|
this.initialValues = o, t(o);
|
|
@@ -424,7 +424,7 @@ const X = class X {
|
|
|
424
424
|
nt(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
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 X = class X {
|
|
|
438
438
|
const s = this.getValues();
|
|
439
439
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
440
|
};
|
|
441
|
-
|
|
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;
|
|
@@ -447,7 +447,7 @@ const X = class X {
|
|
|
447
447
|
".setting-group-content"
|
|
448
448
|
);
|
|
449
449
|
if (o) {
|
|
450
|
-
|
|
450
|
+
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
451
451
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
452
452
|
if (l) {
|
|
453
453
|
const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
@@ -637,7 +637,7 @@ const X = class X {
|
|
|
637
637
|
for (const i in this.settings)
|
|
638
638
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
639
639
|
const s = this.settings[i];
|
|
640
|
-
if (
|
|
640
|
+
if (L(s))
|
|
641
641
|
e[i] = s.getValues();
|
|
642
642
|
else {
|
|
643
643
|
const n = s;
|
|
@@ -648,7 +648,7 @@ const X = class X {
|
|
|
648
648
|
} else {
|
|
649
649
|
const e = this.settings[t];
|
|
650
650
|
if (!e) return;
|
|
651
|
-
if (
|
|
651
|
+
if (L(e)) return e.getValues();
|
|
652
652
|
const i = e;
|
|
653
653
|
return i.getValue ? i.getValue() : i.value;
|
|
654
654
|
}
|
|
@@ -661,7 +661,7 @@ const X = class X {
|
|
|
661
661
|
for (const s in this.settings)
|
|
662
662
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
663
663
|
const n = this.settings[s];
|
|
664
|
-
if (
|
|
664
|
+
if (L(n)) {
|
|
665
665
|
const o = n.getValuesForJson();
|
|
666
666
|
o !== null && (i[s] = o);
|
|
667
667
|
} else {
|
|
@@ -673,7 +673,7 @@ const X = class X {
|
|
|
673
673
|
} else {
|
|
674
674
|
const i = this.settings[t];
|
|
675
675
|
if (!i) return;
|
|
676
|
-
if (
|
|
676
|
+
if (L(i))
|
|
677
677
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
678
678
|
{
|
|
679
679
|
const s = i;
|
|
@@ -687,7 +687,7 @@ const X = class X {
|
|
|
687
687
|
for (const i in this.settings)
|
|
688
688
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
689
689
|
const s = this.settings[i];
|
|
690
|
-
if (
|
|
690
|
+
if (L(s))
|
|
691
691
|
e[i] = s.getDefaultValues();
|
|
692
692
|
else {
|
|
693
693
|
const n = s;
|
|
@@ -698,7 +698,7 @@ const X = class X {
|
|
|
698
698
|
} else {
|
|
699
699
|
const e = this.settings[t];
|
|
700
700
|
if (!e) return;
|
|
701
|
-
if (
|
|
701
|
+
if (L(e)) return e.getDefaultValues();
|
|
702
702
|
const i = e;
|
|
703
703
|
return i.default !== void 0 ? i.default : i.value;
|
|
704
704
|
}
|
|
@@ -737,9 +737,9 @@ const X = class X {
|
|
|
737
737
|
for (const h in this.settings)
|
|
738
738
|
if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
|
|
739
739
|
const p = this.settings[h];
|
|
740
|
-
|
|
740
|
+
L(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
|
|
741
741
|
const d = p.draw();
|
|
742
|
-
|
|
742
|
+
L(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
|
|
743
743
|
d,
|
|
744
744
|
h,
|
|
745
745
|
p
|
|
@@ -855,7 +855,7 @@ class Et extends O {
|
|
|
855
855
|
const h = document.createElement("div");
|
|
856
856
|
h.className = "tab-panel", this.contentContainers[a] = h;
|
|
857
857
|
const p = this.settings[a];
|
|
858
|
-
p && (
|
|
858
|
+
p && (L(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
|
|
859
859
|
p.draw()
|
|
860
860
|
)), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
861
861
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
@@ -871,7 +871,7 @@ function bt(c) {
|
|
|
871
871
|
function le(c) {
|
|
872
872
|
return c;
|
|
873
873
|
}
|
|
874
|
-
class wt extends
|
|
874
|
+
class wt extends b {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -1001,7 +1001,7 @@ const Lt = `
|
|
|
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 T extends
|
|
1004
|
+
class T extends b {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
@@ -1123,7 +1123,7 @@ class T extends E {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class re extends
|
|
1126
|
+
class re extends b {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class re extends E {
|
|
|
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 b {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1161
|
}
|
|
@@ -1245,7 +1245,7 @@ const St = `
|
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class et extends
|
|
1248
|
+
class et extends b {
|
|
1249
1249
|
constructor(t = {}) {
|
|
1250
1250
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1251
1251
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1358,7 +1358,7 @@ class et extends E {
|
|
|
1358
1358
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class It extends
|
|
1361
|
+
class It extends b {
|
|
1362
1362
|
constructor(t = {}) {
|
|
1363
1363
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1364
|
}
|
|
@@ -1414,7 +1414,7 @@ class It extends E {
|
|
|
1414
1414
|
}), t.appendChild(i), t;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
class ce extends
|
|
1417
|
+
class ce extends b {
|
|
1418
1418
|
constructor(t) {
|
|
1419
1419
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1420
1420
|
}
|
|
@@ -1443,7 +1443,7 @@ class ce extends E {
|
|
|
1443
1443
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class he extends
|
|
1446
|
+
class he extends b {
|
|
1447
1447
|
constructor(t = {}) {
|
|
1448
1448
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1449
1449
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1594,7 +1594,7 @@ const Nt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1594
1594
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1595
1595
|
</svg>
|
|
1596
1596
|
`;
|
|
1597
|
-
class ht extends
|
|
1597
|
+
class ht extends b {
|
|
1598
1598
|
constructor(t = {}) {
|
|
1599
1599
|
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
1600
|
}
|
|
@@ -1760,7 +1760,7 @@ const $t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1760
1760
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1761
|
</svg>
|
|
1762
1762
|
`;
|
|
1763
|
-
class ue extends
|
|
1763
|
+
class ue extends b {
|
|
1764
1764
|
constructor(t = {}) {
|
|
1765
1765
|
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
1766
|
const e = this._options.findIndex(
|
|
@@ -1907,7 +1907,7 @@ class ue extends E {
|
|
|
1907
1907
|
), this.updateButtonText();
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
|
-
class ge extends
|
|
1910
|
+
class ge extends b {
|
|
1911
1911
|
constructor(t) {
|
|
1912
1912
|
var e, i;
|
|
1913
1913
|
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 +1960,7 @@ class ge extends E {
|
|
|
1960
1960
|
const Bt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
1961
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1962
1962
|
</svg>`;
|
|
1963
|
-
class me extends
|
|
1963
|
+
class me extends b {
|
|
1964
1964
|
// Store mobile value
|
|
1965
1965
|
constructor(t = {}) {
|
|
1966
1966
|
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Bt, 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 +2047,9 @@ class ve extends I {
|
|
|
2047
2047
|
}), this.inputType = "number";
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
class Ce extends
|
|
2050
|
+
class Ce extends b {
|
|
2051
2051
|
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(
|
|
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(b.DefaultLanguage) ? b.DefaultLanguage : t.languages[0];
|
|
2053
2053
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2054
2054
|
t.languages.forEach((i) => {
|
|
2055
2055
|
var s, n;
|
|
@@ -2194,7 +2194,7 @@ class Ce extends E {
|
|
|
2194
2194
|
});
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
2197
|
-
class ye extends
|
|
2197
|
+
class ye extends b {
|
|
2198
2198
|
constructor(t = {}) {
|
|
2199
2199
|
super(t), this.inputType = "select";
|
|
2200
2200
|
const e = [
|
|
@@ -2231,8 +2231,8 @@ const Ft = (c, t) => {
|
|
|
2231
2231
|
}, l = (h) => {
|
|
2232
2232
|
if (!e) return;
|
|
2233
2233
|
const p = h.clientX - i, d = h.clientY - s, g = window.innerWidth, u = window.innerHeight, m = t.offsetWidth, f = t.offsetHeight;
|
|
2234
|
-
let
|
|
2235
|
-
|
|
2234
|
+
let C = n + p, x = o + d;
|
|
2235
|
+
C = Math.max(8, Math.min(g - m - 8, C)), x = Math.max(8, Math.min(u - f - 8, x)), t.style.left = `${C}px`, t.style.top = `${x}px`;
|
|
2236
2236
|
}, r = () => {
|
|
2237
2237
|
e = !1, document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", r), document.body.style.userSelect = "";
|
|
2238
2238
|
};
|
|
@@ -2251,16 +2251,16 @@ const Ft = (c, t) => {
|
|
|
2251
2251
|
}, A = (c) => {
|
|
2252
2252
|
const { r: t, g: e, b: i } = S(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2253
2253
|
let h = 0;
|
|
2254
|
-
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4);
|
|
2254
|
+
r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4), h < 0 && (h += 6);
|
|
2255
2255
|
const p = a === 0 ? 0 : r / a, d = a;
|
|
2256
2256
|
return { h: h * 60, s: p, v: d };
|
|
2257
2257
|
}, z = (c, t, e) => {
|
|
2258
|
-
const i = e * t,
|
|
2259
|
-
let
|
|
2260
|
-
return
|
|
2261
|
-
Math.round((
|
|
2262
|
-
Math.round((
|
|
2263
|
-
Math.round((
|
|
2258
|
+
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2259
|
+
let a = 0, l = 0, r = 0;
|
|
2260
|
+
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), R(
|
|
2261
|
+
Math.round((a + o) * 255),
|
|
2262
|
+
Math.round((l + o) * 255),
|
|
2263
|
+
Math.round((r + o) * 255)
|
|
2264
2264
|
);
|
|
2265
2265
|
}, Gt = (c, t, e) => {
|
|
2266
2266
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
@@ -2453,11 +2453,11 @@ const qt = (c, t) => {
|
|
|
2453
2453
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2454
2454
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2455
2455
|
fill="#919EAB"/>
|
|
2456
|
-
</svg>`,
|
|
2456
|
+
</svg>`, Ut = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2457
2457
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2458
2458
|
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"
|
|
2459
2459
|
fill="#353C47"/>
|
|
2460
|
-
</svg>`,
|
|
2460
|
+
</svg>`, jt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2461
2461
|
<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"/>
|
|
2462
2462
|
</svg>`, _t = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2463
2463
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -2467,7 +2467,7 @@ class Jt {
|
|
|
2467
2467
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2468
2468
|
if (!this.isOpen) return;
|
|
2469
2469
|
const s = i.target;
|
|
2470
|
-
if (
|
|
2470
|
+
if (this.element.contains(s)) return;
|
|
2471
2471
|
const n = document.querySelectorAll(".gstop-color-input");
|
|
2472
2472
|
Array.from(n).some(
|
|
2473
2473
|
(a) => a.contains(s)
|
|
@@ -2484,6 +2484,10 @@ class Jt {
|
|
|
2484
2484
|
}
|
|
2485
2485
|
}, this.onChange = t, this.recentScope = e, this.element = this.build(), this.backdrop = this.createBackdrop();
|
|
2486
2486
|
}
|
|
2487
|
+
parsePercentage(t) {
|
|
2488
|
+
const e = parseFloat(t);
|
|
2489
|
+
return isNaN(e) ? 0 : e / 100;
|
|
2490
|
+
}
|
|
2487
2491
|
build() {
|
|
2488
2492
|
const t = document.createElement("div");
|
|
2489
2493
|
t.className = "custom-color-picker", t.style.display = "none";
|
|
@@ -2500,7 +2504,7 @@ class Jt {
|
|
|
2500
2504
|
const a = document.createElement("div");
|
|
2501
2505
|
a.className = "color-picker-hue-container";
|
|
2502
2506
|
const l = document.createElement("button");
|
|
2503
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2507
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Ut;
|
|
2504
2508
|
const r = document.createElement("div");
|
|
2505
2509
|
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2506
2510
|
const h = document.createElement("div");
|
|
@@ -2520,16 +2524,16 @@ class Jt {
|
|
|
2520
2524
|
m.className = "color-picker-format-select", this.select = m;
|
|
2521
2525
|
const f = document.createElement("option");
|
|
2522
2526
|
f.value = "hex", f.textContent = "HEX";
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
const
|
|
2526
|
-
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2527
|
+
const C = document.createElement("option");
|
|
2528
|
+
C.value = "rgb", C.textContent = "RGB";
|
|
2529
|
+
const x = document.createElement("option");
|
|
2530
|
+
x.value = "hsl", x.textContent = "HSL", m.appendChild(f), m.appendChild(C), m.appendChild(x);
|
|
2531
|
+
const y = document.createElement("input");
|
|
2532
|
+
y.type = "text", y.className = "color-picker-color-input", y.value = this.currentColor, this.input = y;
|
|
2529
2533
|
const H = document.createElement("div");
|
|
2530
2534
|
H.className = "color-picker-input-container";
|
|
2531
2535
|
const k = document.createElement("button");
|
|
2532
|
-
return k.className = "color-picker-copy-inside", k.textContent = "Copy", H.appendChild(
|
|
2536
|
+
return k.className = "color-picker-copy-inside", k.textContent = "Copy", H.appendChild(y), H.appendChild(k), u.appendChild(m), u.appendChild(H), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(p), t.appendChild(g.container), t.appendChild(u), t.addEventListener("click", ($) => $.stopPropagation()), this.bind(n, r, p, y, m, k, l), t;
|
|
2533
2537
|
}
|
|
2534
2538
|
createBackdrop() {
|
|
2535
2539
|
const t = document.createElement("div");
|
|
@@ -2539,16 +2543,18 @@ class Jt {
|
|
|
2539
2543
|
}
|
|
2540
2544
|
bind(t, e, i, s, n, o, a) {
|
|
2541
2545
|
const l = (p) => {
|
|
2546
|
+
var x;
|
|
2542
2547
|
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), u = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
|
|
2543
2548
|
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
|
|
2544
|
-
const f =
|
|
2545
|
-
this.
|
|
2549
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, C = z(f, g, 1 - u);
|
|
2550
|
+
this.currentColor = C, this.syncInput(), this.updateOpacityBg(), (x = this.onChange) == null || x.call(this, C, this.currentOpacity);
|
|
2546
2551
|
}, r = (p) => {
|
|
2552
|
+
var x;
|
|
2547
2553
|
const d = e.getBoundingClientRect();
|
|
2548
|
-
let g = Math.max(
|
|
2554
|
+
let g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
2549
2555
|
this.hueMarker.style.left = `${g * 100}%`;
|
|
2550
|
-
const u = g * 360, m =
|
|
2551
|
-
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.
|
|
2556
|
+
const u = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), C = z(u, m, 1 - f);
|
|
2557
|
+
this.currentColor = C, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (x = this.onChange) == null || x.call(this, C, this.currentOpacity);
|
|
2552
2558
|
}, h = (p) => {
|
|
2553
2559
|
var u;
|
|
2554
2560
|
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
|
|
@@ -2600,10 +2606,10 @@ class Jt {
|
|
|
2600
2606
|
);
|
|
2601
2607
|
}
|
|
2602
2608
|
setColor(t) {
|
|
2603
|
-
var
|
|
2609
|
+
var o;
|
|
2604
2610
|
this.currentColor = t;
|
|
2605
|
-
const { h: e, s: i, v: s } = A(t);
|
|
2606
|
-
this.hueMarker.style.left = `${
|
|
2611
|
+
const { h: e, s: i, v: s } = A(t), n = e >= 360 ? e % 360 : e;
|
|
2612
|
+
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2607
2613
|
}
|
|
2608
2614
|
syncInput() {
|
|
2609
2615
|
const t = this.select.value, { h: e, s: i, v: s } = A(this.currentColor);
|
|
@@ -2645,16 +2651,16 @@ class Jt {
|
|
|
2645
2651
|
);
|
|
2646
2652
|
}
|
|
2647
2653
|
open(t, e, i) {
|
|
2648
|
-
var
|
|
2654
|
+
var y;
|
|
2649
2655
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2650
2656
|
const { h: s, s: n, v: o } = A(t);
|
|
2651
|
-
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}%`, (
|
|
2657
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (y = this.recentSectionRefresh) == null || y.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2652
2658
|
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, p = window.innerHeight, d = 16;
|
|
2653
2659
|
let g = r.right + 8, u = r.top;
|
|
2654
2660
|
const m = h - r.right, f = r.left;
|
|
2655
2661
|
m >= a + d ? g = r.right + 8 : f >= a + d ? g = r.left - a - 8 : g = Math.max(d, (h - a) / 2);
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2662
|
+
const C = p - r.bottom, x = r.top;
|
|
2663
|
+
C >= l + d ? u = r.bottom + 8 : x >= l + d ? u = r.top - l - 8 : C > x ? (u = r.bottom + 8, u + l > p - d && (u = p - l - d)) : (u = r.top - l - 8, u < d && (u = d)), this.element.style.left = `${g}px`, this.element.style.top = `${u}px`;
|
|
2658
2664
|
}
|
|
2659
2665
|
close(t) {
|
|
2660
2666
|
var e;
|
|
@@ -2781,7 +2787,7 @@ class Zt {
|
|
|
2781
2787
|
const l = (r) => {
|
|
2782
2788
|
const h = t.getBoundingClientRect();
|
|
2783
2789
|
let p = (r.clientX - h.left) / h.width;
|
|
2784
|
-
p = Math.max(
|
|
2790
|
+
p = Math.max(0, Math.min(1, p)), e.style.left = `${p * 100}%`;
|
|
2785
2791
|
const d = p * 360, g = parseFloat(s.style.left || "50%") / 100, u = parseFloat(s.style.top || "50%") / 100;
|
|
2786
2792
|
i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${d}, 100%, 50%))`;
|
|
2787
2793
|
const m = z(d, g, 1 - u);
|
|
@@ -2882,13 +2888,7 @@ class Zt {
|
|
|
2882
2888
|
".color-picker-hue-marker"
|
|
2883
2889
|
), s = this.container.querySelector(
|
|
2884
2890
|
".color-picker-opacity"
|
|
2885
|
-
);
|
|
2886
|
-
this.container.querySelector(
|
|
2887
|
-
".color-picker-format-select"
|
|
2888
|
-
), this.container.querySelector(
|
|
2889
|
-
".color-picker-color-input"
|
|
2890
|
-
);
|
|
2891
|
-
const { h: n, s: o, v: a } = A(this.currentColor);
|
|
2891
|
+
), { h: n, s: o, v: a } = A(this.currentColor);
|
|
2892
2892
|
i.style.left = `${n / 360 * 100}%`, e.style.left = `${o * 100}%`, e.style.top = `${(1 - a) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.updateOpacityBackground(s);
|
|
2893
2893
|
}
|
|
2894
2894
|
triggerChange() {
|
|
@@ -2913,8 +2913,8 @@ class Zt {
|
|
|
2913
2913
|
".color-picker-format-select"
|
|
2914
2914
|
), r = this.container.querySelector(
|
|
2915
2915
|
".color-picker-color-input"
|
|
2916
|
-
), { h, s: p, v: d } = A(t);
|
|
2917
|
-
n.style.left = `${
|
|
2916
|
+
), { h, s: p, v: d } = A(t), g = h >= 360 ? h % 360 : h;
|
|
2917
|
+
n.style.left = `${g / 360 * 100}%`, s.style.left = `${p * 100}%`, s.style.top = `${(1 - d) * 100}%`, i.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, o.style.left = `${e}%`, this.updateOpacityBackground(a), this.updateColorInput(l, r);
|
|
2918
2918
|
}
|
|
2919
2919
|
}
|
|
2920
2920
|
const ot = (c) => {
|
|
@@ -3022,7 +3022,7 @@ const ot = (c) => {
|
|
|
3022
3022
|
return t ? t.color.replace("#", "").toUpperCase() : "Color";
|
|
3023
3023
|
}
|
|
3024
3024
|
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
3025
|
-
}, N = class N extends
|
|
3025
|
+
}, N = class N extends b {
|
|
3026
3026
|
constructor(t = {}) {
|
|
3027
3027
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3028
3028
|
super({
|
|
@@ -3133,19 +3133,19 @@ const ot = (c) => {
|
|
|
3133
3133
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3134
3134
|
}
|
|
3135
3135
|
switchType(t) {
|
|
3136
|
-
var i;
|
|
3136
|
+
var i, s;
|
|
3137
3137
|
if (!this.value) return;
|
|
3138
3138
|
if (this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3139
3139
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3140
3140
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3141
3141
|
]), this.popoverEl) {
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3144
|
-
const
|
|
3145
|
-
t === "solid" ?
|
|
3142
|
+
const n = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3143
|
+
n.forEach((l) => l.classList.remove("active"));
|
|
3144
|
+
const o = n[0], a = n[1];
|
|
3145
|
+
t === "solid" ? o == null || o.classList.add("active") : a == null || a.classList.add("active");
|
|
3146
3146
|
}
|
|
3147
3147
|
const e = (i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-editor-content");
|
|
3148
|
-
e && (this.updatePopoverContent(e), this.repositionPopover()), this.updateUI(), this.triggerChange();
|
|
3148
|
+
e && (this.updatePopoverContent(e), ((s = document.activeElement) == null ? void 0 : s.tagName) !== "INPUT" && this.repositionPopover()), this.updateUI(), this.triggerChange();
|
|
3149
3149
|
}
|
|
3150
3150
|
updatePopoverContent(t) {
|
|
3151
3151
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.renderSolid(t) : this.renderGradient(t));
|
|
@@ -3173,7 +3173,7 @@ const ot = (c) => {
|
|
|
3173
3173
|
const o = document.createElement("input");
|
|
3174
3174
|
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";
|
|
3175
3175
|
const a = document.createElement("button");
|
|
3176
|
-
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML =
|
|
3176
|
+
a.type = "button", a.className = "gradient-flip-btn", a.innerHTML = jt, i.addEventListener("change", () => {
|
|
3177
3177
|
this.switchType(i.value === "radial" ? "radial" : "linear"), this.updateDegreeVisibility(o);
|
|
3178
3178
|
}), o.addEventListener("focus", (u) => {
|
|
3179
3179
|
const m = u.target;
|
|
@@ -3182,10 +3182,10 @@ const ot = (c) => {
|
|
|
3182
3182
|
const m = parseInt(u.target.value);
|
|
3183
3183
|
!Number.isNaN(m) && this.value && (this.value.angle = Math.max(0, Math.min(360, m)), this.updateGradientPreview(), this.triggerChange());
|
|
3184
3184
|
}), o.addEventListener("blur", (u) => {
|
|
3185
|
-
var
|
|
3185
|
+
var C;
|
|
3186
3186
|
const m = u.target;
|
|
3187
3187
|
let f = parseInt(m.value);
|
|
3188
|
-
Number.isNaN(f) && (f = ((
|
|
3188
|
+
Number.isNaN(f) && (f = ((C = this.value) == null ? void 0 : C.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), m.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3189
3189
|
}), a.addEventListener("click", () => {
|
|
3190
3190
|
!this.value || !this.value.stops || (this.value.stops.forEach((u) => {
|
|
3191
3191
|
u.position = 100 - u.position;
|
|
@@ -3203,7 +3203,8 @@ const ot = (c) => {
|
|
|
3203
3203
|
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3204
3204
|
const g = document.createElement("div");
|
|
3205
3205
|
g.className = "gradient-stops", t.appendChild(h), t.appendChild(g), this.updateStopsList(g), d.addEventListener("click", () => {
|
|
3206
|
-
|
|
3206
|
+
var u;
|
|
3207
|
+
this.addStop(), this.updateStopsList(g), this.updateGradientPreview(l), this.createHandles(r, l), this.updateUI(), ((u = document.activeElement) == null ? void 0 : u.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3207
3208
|
});
|
|
3208
3209
|
}
|
|
3209
3210
|
updateDegreeVisibility(t) {
|
|
@@ -3247,7 +3248,7 @@ const ot = (c) => {
|
|
|
3247
3248
|
i.forEach((n, o) => {
|
|
3248
3249
|
var G, W;
|
|
3249
3250
|
const a = this.value.stops.findIndex(
|
|
3250
|
-
(v,
|
|
3251
|
+
(v, E) => v.position === n.position && v.color === n.color && v.opacity === n.opacity && this.value.stops.slice(0, E).filter(
|
|
3251
3252
|
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
3252
3253
|
).length === i.slice(0, o).filter(
|
|
3253
3254
|
(w) => w.position === n.position && w.color === n.color && w.opacity === n.opacity
|
|
@@ -3268,23 +3269,23 @@ const ot = (c) => {
|
|
|
3268
3269
|
m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", d.appendChild(g), d.appendChild(u), d.appendChild(m);
|
|
3269
3270
|
const f = document.createElement("button");
|
|
3270
3271
|
f.type = "button", f.className = "gstop-del", f.innerHTML = _t, f.disabled = (((W = (G = this.value) == null ? void 0 : G.stops) == null ? void 0 : W.length) || 0) <= 2, r.appendChild(h), r.appendChild(d), r.appendChild(f), e.appendChild(r);
|
|
3271
|
-
const
|
|
3272
|
-
|
|
3273
|
-
const
|
|
3274
|
-
|
|
3275
|
-
const
|
|
3276
|
-
|
|
3272
|
+
const C = document.createElement("span");
|
|
3273
|
+
C.className = "gstop-opacity-label", C.textContent = "Opacity";
|
|
3274
|
+
const x = document.createElement("div");
|
|
3275
|
+
x.className = "gstop-opacity-group";
|
|
3276
|
+
const y = document.createElement("input");
|
|
3277
|
+
y.type = "range", y.className = "gstop-opacity-slider", y.min = "0", y.max = "100", y.value = String(n.opacity ?? 100);
|
|
3277
3278
|
const H = S(n.color);
|
|
3278
|
-
|
|
3279
|
+
y.style.setProperty(
|
|
3279
3280
|
"--slider-color",
|
|
3280
3281
|
`rgb(${H.r}, ${H.g}, ${H.b})`
|
|
3281
3282
|
);
|
|
3282
3283
|
const k = document.createElement("span");
|
|
3283
|
-
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`,
|
|
3284
|
-
const $ = new Jt((v,
|
|
3285
|
-
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v,
|
|
3284
|
+
k.className = "gstop-opacity-value", k.textContent = `${n.opacity ?? 100}%`, x.appendChild(y), x.appendChild(k);
|
|
3285
|
+
const $ = new Jt((v, E) => {
|
|
3286
|
+
u.value = v.replace("#", "").toUpperCase(), g.style.backgroundColor = v, this.value.stops[l].color = v, E !== void 0 && (this.value.stops[l].opacity = E, y.value = String(E), k.textContent = `${E}%`);
|
|
3286
3287
|
const w = S(v);
|
|
3287
|
-
|
|
3288
|
+
y.style.setProperty(
|
|
3288
3289
|
"--slider-color",
|
|
3289
3290
|
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3290
3291
|
), this.updateGradientPreview(), this.createHandles(
|
|
@@ -3295,11 +3296,11 @@ const ot = (c) => {
|
|
|
3295
3296
|
u.addEventListener("click", (v) => {
|
|
3296
3297
|
v.preventDefault(), v.stopPropagation(), $.open(n.color, u, n.opacity ?? 100);
|
|
3297
3298
|
}), u.addEventListener("input", () => {
|
|
3298
|
-
const v = u.value.trim(),
|
|
3299
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3300
|
-
this.value.stops[l].color =
|
|
3301
|
-
const w = S(
|
|
3302
|
-
|
|
3299
|
+
const v = u.value.trim(), E = v.startsWith("#") ? v : `#${v}`;
|
|
3300
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3301
|
+
this.value.stops[l].color = E, g.style.backgroundColor = E;
|
|
3302
|
+
const w = S(E);
|
|
3303
|
+
y.style.setProperty(
|
|
3303
3304
|
"--slider-color",
|
|
3304
3305
|
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3305
3306
|
), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
@@ -3311,27 +3312,28 @@ const ot = (c) => {
|
|
|
3311
3312
|
} catch {
|
|
3312
3313
|
}
|
|
3313
3314
|
}), p.addEventListener("focus", (v) => {
|
|
3314
|
-
const
|
|
3315
|
-
|
|
3315
|
+
const E = v.target;
|
|
3316
|
+
E.value = E.value.replace("%", ""), E.select();
|
|
3316
3317
|
}), p.addEventListener("input", (v) => {
|
|
3317
|
-
const
|
|
3318
|
+
const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3318
3319
|
if (!Number.isNaN(w)) {
|
|
3319
3320
|
const it = Math.max(0, Math.min(100, w));
|
|
3320
|
-
this.value.stops[l].position = it,
|
|
3321
|
+
this.value.stops[l].position = it, E.value = `${it}%`, this.updateGradientPreview(), this.createHandles(
|
|
3321
3322
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3322
3323
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3323
3324
|
), this.updateUI(), this.triggerChange();
|
|
3324
3325
|
}
|
|
3325
3326
|
}), p.addEventListener("blur", (v) => {
|
|
3326
|
-
const
|
|
3327
|
-
Number.isNaN(w) ?
|
|
3327
|
+
const E = v.target, w = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3328
|
+
Number.isNaN(w) ? E.value = `${this.value.stops[l].position}%` : E.value = `${Math.max(0, Math.min(100, w))}%`;
|
|
3328
3329
|
}), f.addEventListener("click", () => {
|
|
3330
|
+
var v;
|
|
3329
3331
|
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(l, 1), this.createHandles(
|
|
3330
3332
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3331
3333
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3332
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.repositionPopover(), this.triggerChange());
|
|
3333
|
-
}),
|
|
3334
|
-
const v = parseInt(
|
|
3334
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((v = document.activeElement) == null ? void 0 : v.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3335
|
+
}), y.addEventListener("input", () => {
|
|
3336
|
+
const v = parseInt(y.value, 10);
|
|
3335
3337
|
this.value.stops[l].opacity = Math.max(0, Math.min(100, v)), k.textContent = `${this.value.stops[l].opacity}%`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3336
3338
|
});
|
|
3337
3339
|
});
|
|
@@ -3363,7 +3365,7 @@ const ot = (c) => {
|
|
|
3363
3365
|
const r = i - t.right, h = t.left, p = e + n;
|
|
3364
3366
|
r < p && h > r + 100 && (a = t.left - e - 8);
|
|
3365
3367
|
const d = s - t.bottom, g = t.top;
|
|
3366
|
-
|
|
3368
|
+
g >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : g > 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`;
|
|
3367
3369
|
}
|
|
3368
3370
|
setTimeout(
|
|
3369
3371
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3372,16 +3374,17 @@ const ot = (c) => {
|
|
|
3372
3374
|
}
|
|
3373
3375
|
}
|
|
3374
3376
|
repositionPopover() {
|
|
3375
|
-
|
|
3377
|
+
var t;
|
|
3378
|
+
!this.popoverEl || !this.isPopoverOpen || !this.element || ((t = document.activeElement) == null ? void 0 : t.tagName) !== "INPUT" && requestAnimationFrame(() => {
|
|
3376
3379
|
if (!this.popoverEl || !this.element) return;
|
|
3377
|
-
const
|
|
3380
|
+
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight, o = 16;
|
|
3378
3381
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3379
|
-
const
|
|
3380
|
-
let
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3383
|
-
const
|
|
3384
|
-
|
|
3382
|
+
const a = this.popoverEl.offsetHeight;
|
|
3383
|
+
let l = e.right + 8, r = e.top;
|
|
3384
|
+
const h = s - e.right, p = e.left, d = i + o;
|
|
3385
|
+
h < d && p > h + 100 && (l = e.left - i - 8);
|
|
3386
|
+
const g = n - e.bottom, u = e.top;
|
|
3387
|
+
u >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : u > g ? (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`;
|
|
3385
3388
|
});
|
|
3386
3389
|
}
|
|
3387
3390
|
refreshPopoverContent() {
|
|
@@ -3554,7 +3557,7 @@ class be extends O {
|
|
|
3554
3557
|
`;
|
|
3555
3558
|
}
|
|
3556
3559
|
}
|
|
3557
|
-
class
|
|
3560
|
+
class j extends b {
|
|
3558
3561
|
constructor(t) {
|
|
3559
3562
|
super({
|
|
3560
3563
|
...t,
|
|
@@ -3606,25 +3609,25 @@ class we extends O {
|
|
|
3606
3609
|
title: "Margins",
|
|
3607
3610
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3608
3611
|
settings: {
|
|
3609
|
-
marginTop: new
|
|
3612
|
+
marginTop: new j({
|
|
3610
3613
|
title: "Top",
|
|
3611
3614
|
icon: ie,
|
|
3612
3615
|
suffix: "px",
|
|
3613
3616
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3614
3617
|
}),
|
|
3615
|
-
marginRight: new
|
|
3618
|
+
marginRight: new j({
|
|
3616
3619
|
title: "Right",
|
|
3617
3620
|
icon: se,
|
|
3618
3621
|
suffix: "px",
|
|
3619
3622
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3620
3623
|
}),
|
|
3621
|
-
marginBottom: new
|
|
3624
|
+
marginBottom: new j({
|
|
3622
3625
|
title: "Bottom",
|
|
3623
3626
|
icon: ne,
|
|
3624
3627
|
suffix: "px",
|
|
3625
3628
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3626
3629
|
}),
|
|
3627
|
-
marginLeft: new
|
|
3630
|
+
marginLeft: new j({
|
|
3628
3631
|
title: "Left",
|
|
3629
3632
|
icon: oe,
|
|
3630
3633
|
suffix: "px",
|
|
@@ -3713,7 +3716,7 @@ export {
|
|
|
3713
3716
|
Mt as OpacitySetting,
|
|
3714
3717
|
ue as SelectApiSettings,
|
|
3715
3718
|
et as SelectSetting,
|
|
3716
|
-
|
|
3719
|
+
b as Setting,
|
|
3717
3720
|
O as SettingGroup,
|
|
3718
3721
|
wt as StringSetting,
|
|
3719
3722
|
Et as TabSettingGroup,
|
|
@@ -3726,6 +3729,6 @@ export {
|
|
|
3726
3729
|
ae as createTabSettingGroup,
|
|
3727
3730
|
D as isSetting,
|
|
3728
3731
|
nt as isSettingChild,
|
|
3729
|
-
|
|
3730
|
-
|
|
3732
|
+
L as isSettingGroup,
|
|
3733
|
+
U as iterateSettings
|
|
3731
3734
|
};
|