builder-settings-types 0.0.86 → 0.0.87
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 +24 -24
- package/dist/builder-settings-types.es.js +246 -211
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -18,18 +18,26 @@ class v {
|
|
|
18
18
|
}
|
|
19
19
|
setOnChange(t) {
|
|
20
20
|
return this.onChange = t, R(this.settings, (e, i) => {
|
|
21
|
-
i.setOnChange((
|
|
22
|
-
t(
|
|
21
|
+
i.setOnChange((s) => {
|
|
22
|
+
t(s), this.updateVisibility();
|
|
23
23
|
});
|
|
24
24
|
}), this;
|
|
25
25
|
}
|
|
26
|
+
// hide(): void {
|
|
27
|
+
// if (this.elementRef){
|
|
28
|
+
// console.log(this.elementRef);
|
|
29
|
+
// }else{
|
|
30
|
+
// this.draw()
|
|
31
|
+
// }
|
|
32
|
+
// console.log(this.elementRef)
|
|
33
|
+
// }
|
|
26
34
|
getValues(t) {
|
|
27
35
|
if (t === void 0) {
|
|
28
36
|
const e = {};
|
|
29
37
|
for (const i in this.settings)
|
|
30
38
|
if (this.settings.hasOwnProperty(i)) {
|
|
31
|
-
const
|
|
32
|
-
|
|
39
|
+
const s = this.settings[i];
|
|
40
|
+
s instanceof v ? e[i] = s.getValues() : e[i] = s.value;
|
|
33
41
|
}
|
|
34
42
|
return e;
|
|
35
43
|
} else {
|
|
@@ -47,53 +55,53 @@ class v {
|
|
|
47
55
|
), e.setAttribute("tabindex", "0");
|
|
48
56
|
const i = document.createElement("div");
|
|
49
57
|
if (i.className = "title-section", this.icon) {
|
|
50
|
-
const
|
|
51
|
-
|
|
58
|
+
const r = document.createElement("span");
|
|
59
|
+
r.className = "group-icon", r.innerHTML = this.icon, i.appendChild(r);
|
|
52
60
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
61
|
+
const s = document.createElement("h3");
|
|
62
|
+
s.textContent = this.title, i.appendChild(s);
|
|
63
|
+
const n = document.createElement("div");
|
|
64
|
+
if (n.className = "actions-section", this.description && this.isCollapsed) {
|
|
65
|
+
const r = document.createElement("span");
|
|
66
|
+
r.className = "info-marker", r.innerHTML = `
|
|
59
67
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
60
68
|
<path d="M8 5.33333V8M8 10.6667H8.00667M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
|
|
61
69
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
62
70
|
</svg>
|
|
63
|
-
`,
|
|
71
|
+
`, r.title = this.description, n.appendChild(r);
|
|
64
72
|
}
|
|
65
73
|
const o = document.createElement("span");
|
|
66
74
|
o.className = "setting-group-arrow", o.innerHTML = `
|
|
67
75
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
68
76
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
69
77
|
</svg>
|
|
70
|
-
`, this.isCollapsed && o.classList.add("rotated"),
|
|
78
|
+
`, this.isCollapsed && o.classList.add("rotated"), n.appendChild(o);
|
|
71
79
|
const a = document.createElement("div");
|
|
72
80
|
if (a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content"), this.description && !this.isCollapsed) {
|
|
73
|
-
const
|
|
74
|
-
|
|
81
|
+
const r = document.createElement("div");
|
|
82
|
+
r.className = "setting-group-description", r.textContent = this.description, a.appendChild(r);
|
|
75
83
|
}
|
|
76
|
-
const
|
|
84
|
+
const l = () => {
|
|
77
85
|
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
78
86
|
"aria-expanded",
|
|
79
87
|
(!this.isCollapsed).toString()
|
|
80
88
|
);
|
|
81
|
-
const
|
|
89
|
+
const r = a.querySelector(
|
|
82
90
|
".setting-group-description"
|
|
83
|
-
), u =
|
|
91
|
+
), u = n.querySelector(".info-marker");
|
|
84
92
|
if (this.description)
|
|
85
93
|
if (this.isCollapsed) {
|
|
86
|
-
if (
|
|
94
|
+
if (r && r.remove(), !u) {
|
|
87
95
|
const d = document.createElement("span");
|
|
88
96
|
d.className = "info-marker", d.innerHTML = `
|
|
89
97
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
90
98
|
<path d="M8 5.33333V8M8 10.6667H8.00667M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
|
|
91
99
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
92
100
|
</svg>
|
|
93
|
-
`, d.title = this.description,
|
|
101
|
+
`, d.title = this.description, n.insertBefore(d, o);
|
|
94
102
|
}
|
|
95
103
|
} else {
|
|
96
|
-
if (!
|
|
104
|
+
if (!r) {
|
|
97
105
|
const d = document.createElement("div");
|
|
98
106
|
d.className = "setting-group-description", d.textContent = this.description, a.insertBefore(
|
|
99
107
|
d,
|
|
@@ -103,19 +111,19 @@ class v {
|
|
|
103
111
|
u && u.remove();
|
|
104
112
|
}
|
|
105
113
|
};
|
|
106
|
-
if (e.onclick =
|
|
107
|
-
(
|
|
114
|
+
if (e.onclick = l, e.onkeydown = (r) => {
|
|
115
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), l());
|
|
108
116
|
}, Object.keys(this.settings).length > 0) {
|
|
109
|
-
for (const
|
|
110
|
-
if (this.settings.hasOwnProperty(
|
|
111
|
-
const u = this.settings[
|
|
117
|
+
for (const r in this.settings)
|
|
118
|
+
if (this.settings.hasOwnProperty(r)) {
|
|
119
|
+
const u = this.settings[r];
|
|
112
120
|
a.appendChild(u.draw());
|
|
113
121
|
}
|
|
114
122
|
} else {
|
|
115
|
-
const
|
|
116
|
-
|
|
123
|
+
const r = document.createElement("div");
|
|
124
|
+
r.className = "setting-group-empty", r.textContent = "No settings in this group", a.appendChild(r);
|
|
117
125
|
}
|
|
118
|
-
return e.appendChild(i), e.appendChild(
|
|
126
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, t;
|
|
119
127
|
}
|
|
120
128
|
collapse() {
|
|
121
129
|
if (!this.elementRef || this.isCollapsed) return;
|
|
@@ -177,25 +185,49 @@ class m {
|
|
|
177
185
|
t = { ...this.props.inputProps, ...t };
|
|
178
186
|
const e = document.createElement("div");
|
|
179
187
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
|
|
188
|
+
const o = document.createElement("div");
|
|
189
|
+
if (o.className = "icon-container", t.icon) {
|
|
190
|
+
const a = this.createIcon(t.icon, t.iconClassName);
|
|
191
|
+
o.appendChild(a);
|
|
184
192
|
}
|
|
185
193
|
if (t.title) {
|
|
186
|
-
const
|
|
187
|
-
|
|
194
|
+
const a = this.createLabel(t.title, t.labelClassName);
|
|
195
|
+
o.appendChild(a);
|
|
188
196
|
}
|
|
189
|
-
e.appendChild(
|
|
197
|
+
e.appendChild(o);
|
|
190
198
|
}
|
|
191
199
|
const i = document.createElement("div");
|
|
192
200
|
i.className = t.wrapperClassName || "";
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
const s = document.createElement("input");
|
|
202
|
+
this.inputEl = s, s.value = String(t.value || B(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "";
|
|
203
|
+
const n = (o) => {
|
|
204
|
+
const a = o.target;
|
|
205
|
+
let l = a.value;
|
|
206
|
+
switch (t.inputType) {
|
|
207
|
+
case "number":
|
|
208
|
+
l = Number(a.value);
|
|
209
|
+
break;
|
|
210
|
+
case "color":
|
|
211
|
+
l = a.value;
|
|
212
|
+
break;
|
|
213
|
+
case "date":
|
|
214
|
+
l = a.value;
|
|
215
|
+
break;
|
|
216
|
+
case "select":
|
|
217
|
+
l = a.value;
|
|
218
|
+
break;
|
|
219
|
+
case "text":
|
|
220
|
+
l = a.value;
|
|
221
|
+
break;
|
|
222
|
+
case "button":
|
|
223
|
+
l = a.value;
|
|
224
|
+
break;
|
|
225
|
+
default:
|
|
226
|
+
l = a.value;
|
|
227
|
+
}
|
|
228
|
+
this.value = l, this.onChange && this.onChange(this.value);
|
|
229
|
+
};
|
|
230
|
+
return s.addEventListener("input", n), s.addEventListener("change", n), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
199
231
|
}
|
|
200
232
|
createLabel(t, e) {
|
|
201
233
|
const i = document.createElement("span");
|
|
@@ -208,7 +240,7 @@ class m {
|
|
|
208
240
|
}
|
|
209
241
|
class y extends m {
|
|
210
242
|
constructor(t = {}) {
|
|
211
|
-
super(t), this.inputType = "text";
|
|
243
|
+
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
212
244
|
}
|
|
213
245
|
draw() {
|
|
214
246
|
const t = (e) => {
|
|
@@ -237,27 +269,27 @@ class H extends y {
|
|
|
237
269
|
}
|
|
238
270
|
hexToRgb(t) {
|
|
239
271
|
t = t.replace("#", "");
|
|
240
|
-
const e = parseInt(t.substring(0, 2), 16), i = parseInt(t.substring(2, 4), 16),
|
|
241
|
-
return `${e}, ${i}, ${
|
|
272
|
+
const e = parseInt(t.substring(0, 2), 16), i = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
|
|
273
|
+
return `${e}, ${i}, ${s}`;
|
|
242
274
|
}
|
|
243
275
|
rgbToHex(t) {
|
|
244
|
-
const [e, i,
|
|
245
|
-
if (isNaN(e) || isNaN(i) || isNaN(
|
|
246
|
-
const
|
|
276
|
+
const [e, i, s] = t.split(",").map((o) => parseInt(o.trim()));
|
|
277
|
+
if (isNaN(e) || isNaN(i) || isNaN(s)) return "#000000";
|
|
278
|
+
const n = (o) => {
|
|
247
279
|
const a = o.toString(16);
|
|
248
280
|
return a.length === 1 ? "0" + a : a;
|
|
249
281
|
};
|
|
250
|
-
return `#${
|
|
282
|
+
return `#${n(e)}${n(i)}${n(s)}`;
|
|
251
283
|
}
|
|
252
284
|
draw() {
|
|
253
285
|
const t = document.createElement("div");
|
|
254
286
|
t.className = "color-setting-wrapper";
|
|
255
287
|
const e = document.createElement("div");
|
|
256
288
|
e.className = "icon-container";
|
|
257
|
-
const i = this.createIcon(this.props.icon || N),
|
|
258
|
-
e.appendChild(i), e.appendChild(
|
|
259
|
-
const
|
|
260
|
-
|
|
289
|
+
const i = this.createIcon(this.props.icon || N), s = this.createLabel(this.title || "Color");
|
|
290
|
+
e.appendChild(i), e.appendChild(s);
|
|
291
|
+
const n = document.createElement("div");
|
|
292
|
+
n.className = "color-input-wrapper";
|
|
261
293
|
const o = (d) => {
|
|
262
294
|
const g = d.value.split(",").map((S) => parseInt(S.trim()));
|
|
263
295
|
if (g.length !== 3 || g.some(isNaN))
|
|
@@ -266,15 +298,15 @@ class H extends y {
|
|
|
266
298
|
return d.style.border = b ? "" : "1px solid red", b;
|
|
267
299
|
}, a = document.createElement("div");
|
|
268
300
|
a.className = "color-preview", a.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
269
|
-
const
|
|
301
|
+
const l = this.createInput({
|
|
270
302
|
value: this.value,
|
|
271
303
|
inputType: "text",
|
|
272
304
|
inputClassName: "color-text-input"
|
|
273
|
-
}), c =
|
|
305
|
+
}), c = l.querySelector("input"), r = this.createInput({
|
|
274
306
|
value: this.value ? this.rgbToHex(this.value) : "",
|
|
275
307
|
inputType: this.inputType,
|
|
276
308
|
inputClassName: "color-picker"
|
|
277
|
-
}), u =
|
|
309
|
+
}), u = r.querySelector("input");
|
|
278
310
|
return c.oninput = (d) => {
|
|
279
311
|
var p;
|
|
280
312
|
let g = d.target.value.trim();
|
|
@@ -283,7 +315,7 @@ class H extends y {
|
|
|
283
315
|
var C;
|
|
284
316
|
const g = d.target.value, p = this.hexToRgb(g);
|
|
285
317
|
this.value = p, (C = this.onChange) == null || C.call(this, p), c.value = p, a.style.backgroundColor = `rgb(${p})`;
|
|
286
|
-
},
|
|
318
|
+
}, n.appendChild(a), n.appendChild(r), n.appendChild(l), t.appendChild(e), t.appendChild(n), this.value && (c.value = this.value, u.value = this.rgbToHex(this.value), a.style.backgroundColor = `rgb(${this.value})`), t;
|
|
287
319
|
}
|
|
288
320
|
}
|
|
289
321
|
class f extends m {
|
|
@@ -291,11 +323,11 @@ class f extends m {
|
|
|
291
323
|
super(t), this.inputType = "number";
|
|
292
324
|
}
|
|
293
325
|
draw() {
|
|
294
|
-
const t = (
|
|
295
|
-
this.props.minValue !== void 0 && (
|
|
326
|
+
const t = (n) => {
|
|
327
|
+
this.props.minValue !== void 0 && (n.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (n.max = String(this.props.maxValue)), this.props.className && n.classList.add(this.props.className), n.addEventListener("input", () => {
|
|
296
328
|
const o = this.props.minValue ?? Number.MIN_SAFE_INTEGER, a = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
297
|
-
let
|
|
298
|
-
|
|
329
|
+
let l = Number(n.value);
|
|
330
|
+
l < o && (l = o), l > a && (l = a), n.value = String(l);
|
|
299
331
|
});
|
|
300
332
|
}, e = this.createInput({
|
|
301
333
|
value: this.value,
|
|
@@ -313,8 +345,8 @@ class f extends m {
|
|
|
313
345
|
"input.number-setting-input"
|
|
314
346
|
);
|
|
315
347
|
i && (i.style.paddingRight = "35px");
|
|
316
|
-
const
|
|
317
|
-
return
|
|
348
|
+
const s = document.createElement("span");
|
|
349
|
+
return s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s), e;
|
|
318
350
|
}
|
|
319
351
|
}
|
|
320
352
|
class k extends f {
|
|
@@ -355,45 +387,45 @@ class O extends m {
|
|
|
355
387
|
draw() {
|
|
356
388
|
const t = document.createElement("div");
|
|
357
389
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
390
|
+
const n = document.createElement("div");
|
|
391
|
+
if (n.className = "icon-container", this.props.icon) {
|
|
360
392
|
const o = this.createIcon(this.props.icon);
|
|
361
|
-
|
|
393
|
+
n.appendChild(o);
|
|
362
394
|
}
|
|
363
395
|
if (this.props.title) {
|
|
364
396
|
const o = this.createLabel(this.props.title);
|
|
365
|
-
|
|
397
|
+
n.appendChild(o);
|
|
366
398
|
}
|
|
367
|
-
t.appendChild(
|
|
399
|
+
t.appendChild(n);
|
|
368
400
|
} else {
|
|
369
|
-
const
|
|
370
|
-
t.appendChild(
|
|
401
|
+
const n = document.createElement("div");
|
|
402
|
+
t.appendChild(n);
|
|
371
403
|
}
|
|
372
404
|
const e = document.createElement("div");
|
|
373
405
|
e.classList.add("select-button"), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
374
|
-
var
|
|
375
|
-
this.isLoading || (this.isOpen = !this.isOpen, (
|
|
406
|
+
var n, o;
|
|
407
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
376
408
|
}, t.appendChild(e), this.buttonEl = e;
|
|
377
409
|
const i = document.createElement("ul");
|
|
378
|
-
i.classList.add("select-options"), this._options.forEach((
|
|
379
|
-
const a = this.createOption(
|
|
380
|
-
a.onclick = (
|
|
410
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
411
|
+
const a = this.createOption(n, o);
|
|
412
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
381
413
|
}), t.appendChild(i);
|
|
382
|
-
const
|
|
383
|
-
return
|
|
384
|
-
this._options.push(...
|
|
385
|
-
}).catch((
|
|
386
|
-
console.error("Failed to fetch async options:",
|
|
387
|
-
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (
|
|
414
|
+
const s = document.createElement("div");
|
|
415
|
+
return s.classList.add("svg-container"), s.innerHTML = A, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
416
|
+
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
417
|
+
}).catch((n) => {
|
|
418
|
+
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
419
|
+
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
388
420
|
var o, a;
|
|
389
|
-
this.isOpen && !t.contains(
|
|
421
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"));
|
|
390
422
|
}, document.addEventListener("click", this.clickOutsideListener), t;
|
|
391
423
|
}
|
|
392
424
|
selectOption(t, e, i) {
|
|
393
|
-
var
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
var n, o, a;
|
|
426
|
+
const s = this._options[e];
|
|
427
|
+
s && (this.value = s.value, (n = this.onChange) == null || n.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((c, r) => {
|
|
428
|
+
r === e ? c.classList.add("selected") : c.classList.remove("selected");
|
|
397
429
|
}));
|
|
398
430
|
}
|
|
399
431
|
updateOptionsList() {
|
|
@@ -405,8 +437,8 @@ class O extends m {
|
|
|
405
437
|
}
|
|
406
438
|
this._options.forEach((t, e) => {
|
|
407
439
|
const i = this.createOption(t, e);
|
|
408
|
-
i.onclick = (
|
|
409
|
-
this.buttonEl && this.selectOption(
|
|
440
|
+
i.onclick = (s) => {
|
|
441
|
+
this.buttonEl && this.selectOption(s, e, this.buttonEl);
|
|
410
442
|
}, this.optionsListEl.appendChild(i);
|
|
411
443
|
});
|
|
412
444
|
}
|
|
@@ -469,11 +501,11 @@ class _ extends m {
|
|
|
469
501
|
</svg>
|
|
470
502
|
`
|
|
471
503
|
}
|
|
472
|
-
].forEach((
|
|
504
|
+
].forEach((n) => {
|
|
473
505
|
const o = document.createElement("button");
|
|
474
|
-
o.className = "align-option-button", o.innerHTML =
|
|
506
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
475
507
|
var a;
|
|
476
|
-
i.querySelectorAll(".align-option-button").forEach((
|
|
508
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = n.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
477
509
|
}), i.appendChild(o);
|
|
478
510
|
}), t.appendChild(i), t;
|
|
479
511
|
}
|
|
@@ -538,8 +570,8 @@ class nt extends m {
|
|
|
538
570
|
}
|
|
539
571
|
toggleLock(t) {
|
|
540
572
|
if (this.locked = !this.locked, this.locked && this.value) {
|
|
541
|
-
const { width: i, height:
|
|
542
|
-
|
|
573
|
+
const { width: i, height: s } = this.value;
|
|
574
|
+
s > 0 && (this.aspectRatio = i / s);
|
|
543
575
|
}
|
|
544
576
|
t.innerHTML = this.getLockSVG(this.locked), t.setAttribute("aria-pressed", String(this.locked)), t.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio";
|
|
545
577
|
const e = t.closest(".dimension-setting-container");
|
|
@@ -573,15 +605,15 @@ class nt extends m {
|
|
|
573
605
|
draw() {
|
|
574
606
|
const t = document.createElement("div");
|
|
575
607
|
t.className = "dimension-setting-container", this.locked && t.classList.add("aspect-locked");
|
|
576
|
-
const e = this.widthSetting.draw(), i = this.heightSetting.draw(),
|
|
577
|
-
|
|
578
|
-
const
|
|
579
|
-
return
|
|
608
|
+
const e = this.widthSetting.draw(), i = this.heightSetting.draw(), s = document.createElement("div");
|
|
609
|
+
s.className = "dimension-bracket";
|
|
610
|
+
const n = document.createElement("button");
|
|
611
|
+
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
580
612
|
"aria-label",
|
|
581
613
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
582
|
-
),
|
|
583
|
-
o.preventDefault(), this.toggleLock(
|
|
584
|
-
},
|
|
614
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
615
|
+
o.preventDefault(), this.toggleLock(n);
|
|
616
|
+
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
585
617
|
}
|
|
586
618
|
isLocked() {
|
|
587
619
|
return this.locked;
|
|
@@ -589,8 +621,8 @@ class nt extends m {
|
|
|
589
621
|
setLocked(t) {
|
|
590
622
|
if (this.locked !== t) {
|
|
591
623
|
if (this.locked = t, this.locked && this.value) {
|
|
592
|
-
const { width: i, height:
|
|
593
|
-
|
|
624
|
+
const { width: i, height: s } = this.value;
|
|
625
|
+
s > 0 && (this.aspectRatio = i / s);
|
|
594
626
|
}
|
|
595
627
|
const e = document.querySelector(
|
|
596
628
|
".dimension-setting-container .dimension-lock-icon"
|
|
@@ -627,13 +659,13 @@ class q extends m {
|
|
|
627
659
|
}
|
|
628
660
|
updatePreviewState(t = null) {
|
|
629
661
|
if (!this.previewWrapper || !this.previewEl || !this.emptyStateEl) return;
|
|
630
|
-
const e = this.previewWrapper.parentElement, i = e == null ? void 0 : e.querySelector(".upload-button"),
|
|
662
|
+
const e = this.previewWrapper.parentElement, i = e == null ? void 0 : e.querySelector(".upload-button"), s = e == null ? void 0 : e.querySelector(
|
|
631
663
|
".preview-placeholder"
|
|
632
664
|
);
|
|
633
|
-
t && t !== "" ? (this.previewWrapper.classList.add("has-image"), this.previewEl.src = t, this.previewWrapper.style.display = "block",
|
|
665
|
+
t && t !== "" ? (this.previewWrapper.classList.add("has-image"), this.previewEl.src = t, this.previewWrapper.style.display = "block", s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
634
666
|
<span class="upload-icon">${M}</span>
|
|
635
667
|
<span class="upload-label">Replace</span>
|
|
636
|
-
`)) : (this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewWrapper.style.display = "none",
|
|
668
|
+
`)) : (this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "none"), i && (i.innerHTML = `
|
|
637
669
|
<span class="upload-icon">${M}</span>
|
|
638
670
|
<span class="upload-label">Upload</span>
|
|
639
671
|
`));
|
|
@@ -645,21 +677,21 @@ class q extends m {
|
|
|
645
677
|
if (e || t.classList.add("no-label"), e) {
|
|
646
678
|
const c = document.createElement("div");
|
|
647
679
|
if (c.className = "icon-title-container", this.props.icon) {
|
|
648
|
-
const
|
|
649
|
-
c.appendChild(
|
|
680
|
+
const r = this.createIcon(this.props.icon);
|
|
681
|
+
c.appendChild(r);
|
|
650
682
|
}
|
|
651
683
|
if (this.props.title) {
|
|
652
|
-
const
|
|
653
|
-
c.appendChild(
|
|
684
|
+
const r = this.createLabel(this.props.title);
|
|
685
|
+
c.appendChild(r);
|
|
654
686
|
}
|
|
655
687
|
t.appendChild(c);
|
|
656
688
|
}
|
|
657
689
|
const i = document.createElement("div");
|
|
658
690
|
i.className = "preview-button-container";
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
691
|
+
const s = this.value && this.value !== "";
|
|
692
|
+
s || i.classList.add("no-image");
|
|
693
|
+
const n = document.createElement("div");
|
|
694
|
+
n.className = "preview-placeholder", n.innerHTML = V, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.emptyStateEl = document.createElement("div"), this.emptyStateEl.className = "empty-state", this.emptyStateEl.innerHTML = V, this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview";
|
|
663
695
|
const o = document.createElement("button");
|
|
664
696
|
o.className = "delete-button", o.type = "button", o.title = "Delete image", o.innerHTML = j, this.previewWrapper.appendChild(this.emptyStateEl), this.previewWrapper.appendChild(this.previewEl), this.previewWrapper.appendChild(o);
|
|
665
697
|
const a = document.createElement("button");
|
|
@@ -667,15 +699,15 @@ class q extends m {
|
|
|
667
699
|
<span class="upload-icon">${M}</span>
|
|
668
700
|
<span class="upload-label">Upload</span>
|
|
669
701
|
`;
|
|
670
|
-
const
|
|
671
|
-
return
|
|
672
|
-
var
|
|
673
|
-
c.stopPropagation(), this.value = "", this.updatePreviewState(null), (
|
|
702
|
+
const l = document.createElement("input");
|
|
703
|
+
return l.type = "file", l.accept = "image/*", l.style.display = "none", i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(a), t.appendChild(i), t.appendChild(l), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = (c) => {
|
|
704
|
+
var r;
|
|
705
|
+
c.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, "");
|
|
674
706
|
}, a.onclick = () => {
|
|
675
|
-
|
|
676
|
-
},
|
|
677
|
-
var
|
|
678
|
-
const c = (
|
|
707
|
+
l.click();
|
|
708
|
+
}, l.onchange = async () => {
|
|
709
|
+
var r, u, d;
|
|
710
|
+
const c = (r = l.files) == null ? void 0 : r[0];
|
|
679
711
|
if (c)
|
|
680
712
|
try {
|
|
681
713
|
a.classList.add("loading"), a.disabled = !0;
|
|
@@ -755,7 +787,7 @@ class lt extends m {
|
|
|
755
787
|
constructor(t = {}) {
|
|
756
788
|
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.initializeOptions(t), t.default !== void 0 && (this.value = t.default, this.selectedOptionIndex = this._options.findIndex(
|
|
757
789
|
(e) => JSON.stringify(e.value) === JSON.stringify(t.default)
|
|
758
|
-
));
|
|
790
|
+
)), t.onChange && this.setOnChange(t.onChange);
|
|
759
791
|
}
|
|
760
792
|
initializeOptions(t) {
|
|
761
793
|
this.hasInitializedOptions || (this._options = [], t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync ? (this.isLoading = !0, t.default !== void 0 && (this.value = t.default)) : t.default !== void 0 && (this.selectedOptionIndex = this._options.findIndex(
|
|
@@ -765,8 +797,8 @@ class lt extends m {
|
|
|
765
797
|
createOption(t, e) {
|
|
766
798
|
const i = document.createElement("li");
|
|
767
799
|
i.classList.add("select-api-option"), i.textContent = t.name, i.dataset.index = String(e);
|
|
768
|
-
const
|
|
769
|
-
return
|
|
800
|
+
const s = document.createElement("input");
|
|
801
|
+
return s.type = "radio", s.classList.add("select-api-radio"), s.name = "select-api-radio-group", i.appendChild(s), this.selectedOptionIndex === e && (s.checked = !0), i;
|
|
770
802
|
}
|
|
771
803
|
draw() {
|
|
772
804
|
const t = document.createElement("div");
|
|
@@ -774,48 +806,51 @@ class lt extends m {
|
|
|
774
806
|
const e = document.createElement("div");
|
|
775
807
|
if (e.classList.add("select-api-button"), this.props.title) {
|
|
776
808
|
e.classList.add("has-label");
|
|
777
|
-
const
|
|
778
|
-
|
|
809
|
+
const n = document.createElement("div");
|
|
810
|
+
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
779
811
|
const o = document.createElement("span");
|
|
780
812
|
o.className = "select-value", this.isLoading ? o.textContent = this.props.loadingText || "Loading options..." : o.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.appendChild(o);
|
|
781
813
|
} else
|
|
782
814
|
this.isLoading ? e.textContent = this.props.loadingText || "Loading options..." : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option";
|
|
783
815
|
e.onclick = () => {
|
|
784
|
-
var
|
|
785
|
-
this.isLoading || (this.isOpen = !this.isOpen, (
|
|
816
|
+
var n, o;
|
|
817
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
786
818
|
}, t.appendChild(e), this.buttonEl = e;
|
|
787
819
|
const i = document.createElement("ul");
|
|
788
|
-
i.classList.add("select-api-options"), this._options.forEach((
|
|
789
|
-
const a = this.createOption(
|
|
790
|
-
a.onclick = (
|
|
820
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
821
|
+
const a = this.createOption(n, o);
|
|
822
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
791
823
|
}), t.appendChild(i);
|
|
792
|
-
const
|
|
793
|
-
return
|
|
794
|
-
var
|
|
795
|
-
this.isLoading || (this.isOpen = !this.isOpen, (
|
|
796
|
-
}, this.optionsListEl = i, this.svgContainer =
|
|
797
|
-
this._options.push(...
|
|
824
|
+
const s = document.createElement("div");
|
|
825
|
+
return s.classList.add("svg-container"), s.innerHTML = U, t.appendChild(s), s.onclick = () => {
|
|
826
|
+
var n, o;
|
|
827
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
828
|
+
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
829
|
+
this._options.push(...n), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
798
830
|
(o) => JSON.stringify(o.value) === JSON.stringify(this.value)
|
|
799
831
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
800
|
-
}).catch((
|
|
801
|
-
console.error("Failed to fetch async options:",
|
|
802
|
-
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((
|
|
803
|
-
const o = new Set(this._options.map((
|
|
832
|
+
}).catch((n) => {
|
|
833
|
+
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
834
|
+
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
835
|
+
const o = new Set(this._options.map((l) => JSON.stringify(l.value))), a = n.filter((l) => !o.has(JSON.stringify(l.value)));
|
|
804
836
|
this._options.push(...a), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
805
|
-
(
|
|
837
|
+
(l) => JSON.stringify(l.value) === JSON.stringify(this.value)
|
|
806
838
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
807
|
-
}).catch((
|
|
808
|
-
console.error("Failed to fetch async options:",
|
|
839
|
+
}).catch((n) => {
|
|
840
|
+
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
809
841
|
})), t;
|
|
810
842
|
}
|
|
811
843
|
selectApiOption(t, e, i) {
|
|
812
|
-
var
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
844
|
+
var n, o;
|
|
845
|
+
const s = this._options[e];
|
|
846
|
+
if (s) {
|
|
847
|
+
const a = s.value;
|
|
848
|
+
this.value = a, this.onChange && this.onChange(a), this.selectedOptionIndex = e, this.isOpen = !1, this.updateButtonText(), (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(
|
|
849
|
+
".select-api-radio"
|
|
850
|
+
).forEach((c, r) => {
|
|
851
|
+
c.checked = r === e;
|
|
852
|
+
});
|
|
853
|
+
}
|
|
819
854
|
}
|
|
820
855
|
updateOptionsList() {
|
|
821
856
|
if (this.optionsListEl) {
|
|
@@ -826,44 +861,44 @@ class lt extends m {
|
|
|
826
861
|
}
|
|
827
862
|
this._options.forEach((t, e) => {
|
|
828
863
|
const i = this.createOption(t, e);
|
|
829
|
-
this.selectedOptionIndex === e && i.classList.add("selected"), i.onclick = (
|
|
830
|
-
this.buttonEl && this.selectApiOption(
|
|
831
|
-
}, i.tabIndex = 0, i.addEventListener("keydown", (
|
|
832
|
-
(
|
|
864
|
+
this.selectedOptionIndex === e && i.classList.add("selected"), i.onclick = (s) => {
|
|
865
|
+
this.buttonEl && this.selectApiOption(s, e, this.buttonEl);
|
|
866
|
+
}, i.tabIndex = 0, i.addEventListener("keydown", (s) => {
|
|
867
|
+
(s.key === "Enter" || s.key === " ") && (s.preventDefault(), this.buttonEl && this.selectApiOption(s, e, this.buttonEl));
|
|
833
868
|
}), this.optionsListEl.appendChild(i);
|
|
834
869
|
});
|
|
835
870
|
}
|
|
836
871
|
}
|
|
837
872
|
updateButtonText(t) {
|
|
838
873
|
if (!this.buttonEl) return;
|
|
839
|
-
const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"),
|
|
874
|
+
const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"), s = this.buttonEl.querySelector(".select-label");
|
|
840
875
|
if (this.isLoading) {
|
|
841
876
|
this.buttonEl.classList.add("loading");
|
|
842
877
|
const o = this.props.loadingText || "Loading options...";
|
|
843
878
|
if (e)
|
|
844
879
|
e.textContent = o;
|
|
845
|
-
else if (i && this.props.title && !
|
|
880
|
+
else if (i && this.props.title && !s) {
|
|
846
881
|
this.buttonEl.innerHTML = "";
|
|
847
882
|
const a = document.createElement("div");
|
|
848
883
|
a.className = "select-label", a.textContent = this.props.title, this.buttonEl.appendChild(a);
|
|
849
|
-
const
|
|
850
|
-
|
|
884
|
+
const l = document.createElement("span");
|
|
885
|
+
l.className = "select-value", l.textContent = o, this.buttonEl.appendChild(l);
|
|
851
886
|
} else
|
|
852
887
|
this.buttonEl.textContent = o;
|
|
853
888
|
return;
|
|
854
889
|
}
|
|
855
890
|
this.buttonEl.classList.remove("loading", "error");
|
|
856
|
-
let
|
|
857
|
-
if (t ? ((t.includes("Failed") || t.includes("Error")) && this.buttonEl.classList.add("error"),
|
|
858
|
-
e.textContent =
|
|
859
|
-
else if (i && this.props.title && !
|
|
891
|
+
let n;
|
|
892
|
+
if (t ? ((t.includes("Failed") || t.includes("Error")) && this.buttonEl.classList.add("error"), n = t) : this.selectedOptionIndex !== null && this._options[this.selectedOptionIndex] ? n = this._options[this.selectedOptionIndex].name : n = "Select an option", e)
|
|
893
|
+
e.textContent = n;
|
|
894
|
+
else if (i && this.props.title && !s) {
|
|
860
895
|
this.buttonEl.innerHTML = "";
|
|
861
896
|
const o = document.createElement("div");
|
|
862
897
|
o.className = "select-label", o.textContent = this.props.title, this.buttonEl.appendChild(o);
|
|
863
898
|
const a = document.createElement("span");
|
|
864
|
-
a.className = "select-value", a.textContent =
|
|
899
|
+
a.className = "select-value", a.textContent = n, this.buttonEl.appendChild(a);
|
|
865
900
|
} else
|
|
866
|
-
this.buttonEl.textContent =
|
|
901
|
+
this.buttonEl.textContent = n;
|
|
867
902
|
}
|
|
868
903
|
}
|
|
869
904
|
class rt extends m {
|
|
@@ -885,12 +920,12 @@ class rt extends m {
|
|
|
885
920
|
t.appendChild(e);
|
|
886
921
|
const i = document.createElement("label");
|
|
887
922
|
i.className = "toggle-switch";
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
this.value =
|
|
923
|
+
const s = document.createElement("input");
|
|
924
|
+
s.type = "checkbox", s.checked = this.value ?? !1, s.addEventListener("change", () => {
|
|
925
|
+
this.value = s.checked, this.onChange && this.onChange(this.value);
|
|
891
926
|
});
|
|
892
|
-
const
|
|
893
|
-
return
|
|
927
|
+
const n = document.createElement("span");
|
|
928
|
+
return n.className = "toggle-slider", i.appendChild(s), i.appendChild(n), t.appendChild(i), t;
|
|
894
929
|
}
|
|
895
930
|
}
|
|
896
931
|
const Z = `<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -930,12 +965,12 @@ class ht extends m {
|
|
|
930
965
|
createGapInput(t, e) {
|
|
931
966
|
const i = document.createElement("div");
|
|
932
967
|
i.classList.add("gap-input-wrapper");
|
|
933
|
-
const n = document.createElement("div");
|
|
934
|
-
n.classList.add("gap-label-container");
|
|
935
968
|
const s = document.createElement("div");
|
|
936
|
-
s.classList.add("gap-
|
|
969
|
+
s.classList.add("gap-label-container");
|
|
970
|
+
const n = document.createElement("div");
|
|
971
|
+
n.classList.add("gap-setting-icon"), n.innerHTML = this.props.icon || Z, s.appendChild(n);
|
|
937
972
|
const o = document.createElement("label");
|
|
938
|
-
o.classList.add("gap-input-label"), o.textContent = t,
|
|
973
|
+
o.classList.add("gap-input-label"), o.textContent = t, s.appendChild(o), i.appendChild(s);
|
|
939
974
|
const a = (u) => {
|
|
940
975
|
this.props.minValue !== void 0 && (u.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (u.max = String(this.props.maxValue)), this.props.className && u.classList.add(this.props.className), u.addEventListener("input", () => {
|
|
941
976
|
var C;
|
|
@@ -943,7 +978,7 @@ class ht extends m {
|
|
|
943
978
|
let p = Number(u.value);
|
|
944
979
|
p < d && (p = d), p > g && (p = g), u.value = String(p), this.value = p, this.inputValues[t] = p, console.log(`Gap Setting (${t}): ${p}${this.props.suffix || ""}`), (C = this.onChange) == null || C.call(this, p);
|
|
945
980
|
});
|
|
946
|
-
},
|
|
981
|
+
}, l = this.createInput({
|
|
947
982
|
value: e,
|
|
948
983
|
inputType: this.inputType,
|
|
949
984
|
inputClassName: "gap-setting-input " + (this.props.inputClassName || ""),
|
|
@@ -951,12 +986,12 @@ class ht extends m {
|
|
|
951
986
|
inputCustomizer: a
|
|
952
987
|
});
|
|
953
988
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
954
|
-
return i.appendChild(
|
|
955
|
-
|
|
956
|
-
const c =
|
|
989
|
+
return i.appendChild(l), i;
|
|
990
|
+
l.classList.add("suffix-wrapper");
|
|
991
|
+
const c = l.querySelector("input.gap-setting-input");
|
|
957
992
|
c && (c.style.paddingRight = "35px");
|
|
958
|
-
const
|
|
959
|
-
return
|
|
993
|
+
const r = document.createElement("span");
|
|
994
|
+
return r.className = "suffix-label", r.textContent = this.props.suffix, l.appendChild(r), i.appendChild(l), i;
|
|
960
995
|
}
|
|
961
996
|
}
|
|
962
997
|
const D = `
|
|
@@ -1002,10 +1037,10 @@ class ct extends v {
|
|
|
1002
1037
|
* Optional helper to generate CSS from the current settings.
|
|
1003
1038
|
*/
|
|
1004
1039
|
getCssCode() {
|
|
1005
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.radius.value ?? 0,
|
|
1040
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.radius.value ?? 0, s = this.settings.size.value ?? 0;
|
|
1006
1041
|
return `
|
|
1007
1042
|
border-color: ${t};
|
|
1008
|
-
border-width: ${
|
|
1043
|
+
border-width: ${s}px;
|
|
1009
1044
|
border-radius: ${i}px;
|
|
1010
1045
|
opacity: ${e / 100};
|
|
1011
1046
|
`;
|
|
@@ -1075,13 +1110,13 @@ class dt extends v {
|
|
|
1075
1110
|
});
|
|
1076
1111
|
}
|
|
1077
1112
|
getCssCode() {
|
|
1078
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi",
|
|
1113
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", s = this.settings.fontWeight.value ?? "bold", n = this.settings.fontSize.value ?? 12, o = this.settings.align.value ?? "left";
|
|
1079
1114
|
return `
|
|
1080
1115
|
color: ${t};
|
|
1081
1116
|
opacity: ${e / 100};
|
|
1082
1117
|
font-family: ${i};
|
|
1083
|
-
font-weight: ${
|
|
1084
|
-
font-size: ${
|
|
1118
|
+
font-weight: ${s};
|
|
1119
|
+
font-size: ${n}px;
|
|
1085
1120
|
text-align: ${o};
|
|
1086
1121
|
`;
|
|
1087
1122
|
}
|
|
@@ -1096,9 +1131,9 @@ class E extends m {
|
|
|
1096
1131
|
draw() {
|
|
1097
1132
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
1098
1133
|
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
1099
|
-
const
|
|
1100
|
-
let
|
|
1101
|
-
|
|
1134
|
+
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, c = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1135
|
+
let r = Number(a.value);
|
|
1136
|
+
r < l && (r = l), r > c && (r = c), a.value = String(r);
|
|
1102
1137
|
}));
|
|
1103
1138
|
}, i = this.createInput({
|
|
1104
1139
|
value: this.value,
|
|
@@ -1113,19 +1148,19 @@ class E extends m {
|
|
|
1113
1148
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
1114
1149
|
return i;
|
|
1115
1150
|
i.classList.add("suffix-wrapper");
|
|
1116
|
-
const
|
|
1151
|
+
const s = i.querySelector(
|
|
1117
1152
|
"input.number-setting-input"
|
|
1118
1153
|
);
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1154
|
+
s && (s.style.paddingRight = "35px");
|
|
1155
|
+
const n = document.createElement("span");
|
|
1156
|
+
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
1122
1157
|
const o = i.querySelector("input");
|
|
1123
1158
|
return o && (o.oninput = (a) => {
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1159
|
+
const l = a.target.value.trim();
|
|
1160
|
+
if (l.toLowerCase() === "auto")
|
|
1126
1161
|
this.value = "auto";
|
|
1127
1162
|
else {
|
|
1128
|
-
const c = Number(
|
|
1163
|
+
const c = Number(l);
|
|
1129
1164
|
isNaN(c) || (this.value = c);
|
|
1130
1165
|
}
|
|
1131
1166
|
this.onChange && this.onChange(this.value);
|
|
@@ -1167,12 +1202,12 @@ class pt extends v {
|
|
|
1167
1202
|
});
|
|
1168
1203
|
}
|
|
1169
1204
|
getCssCode() {
|
|
1170
|
-
const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value, i = typeof this.settings.marginBottom.value == "number" ? `${this.settings.marginBottom.value}px` : this.settings.marginBottom.value,
|
|
1205
|
+
const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value, i = typeof this.settings.marginBottom.value == "number" ? `${this.settings.marginBottom.value}px` : this.settings.marginBottom.value, s = typeof this.settings.marginLeft.value == "number" ? `${this.settings.marginLeft.value}px` : this.settings.marginLeft.value;
|
|
1171
1206
|
return `
|
|
1172
1207
|
margin-top: ${t};
|
|
1173
1208
|
margin-right: ${e};
|
|
1174
1209
|
margin-bottom: ${i};
|
|
1175
|
-
margin-left: ${
|
|
1210
|
+
margin-left: ${s};
|
|
1176
1211
|
`;
|
|
1177
1212
|
}
|
|
1178
1213
|
}
|
|
@@ -1208,10 +1243,10 @@ class it extends v {
|
|
|
1208
1243
|
e && e.parentElement && e.parentElement.removeChild(e);
|
|
1209
1244
|
const i = t.querySelector(".setting-group-title");
|
|
1210
1245
|
if (i) {
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1246
|
+
const s = document.createElement("div");
|
|
1247
|
+
s.className = "tab-delete-container";
|
|
1248
|
+
const n = document.createElement("button");
|
|
1249
|
+
n.className = "tab-delete-button", n.innerHTML = `
|
|
1215
1250
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="trash-icon">
|
|
1216
1251
|
<polyline points="3 6 5 6 21 6"></polyline>
|
|
1217
1252
|
<path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path>
|
|
@@ -1219,12 +1254,12 @@ class it extends v {
|
|
|
1219
1254
|
<path d="M14 11v6"></path>
|
|
1220
1255
|
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
|
|
1221
1256
|
</svg>
|
|
1222
|
-
`,
|
|
1257
|
+
`, n.onclick = () => {
|
|
1223
1258
|
var a;
|
|
1224
1259
|
return (a = this.onDeleteCallback) == null ? void 0 : a.call(this);
|
|
1225
|
-
},
|
|
1260
|
+
}, s.appendChild(n);
|
|
1226
1261
|
const o = i.querySelector("h3");
|
|
1227
|
-
o ? o.insertAdjacentElement("afterend",
|
|
1262
|
+
o ? o.insertAdjacentElement("afterend", s) : i.appendChild(s);
|
|
1228
1263
|
}
|
|
1229
1264
|
return t;
|
|
1230
1265
|
}
|
|
@@ -1351,16 +1386,16 @@ class gt extends v {
|
|
|
1351
1386
|
draw() {
|
|
1352
1387
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
1353
1388
|
if (!e) return t;
|
|
1354
|
-
const i = Array.from(e.children), [
|
|
1355
|
-
e.innerHTML = "", e.appendChild(
|
|
1356
|
-
const
|
|
1357
|
-
return
|
|
1389
|
+
const i = Array.from(e.children), [s, n, o, a] = i;
|
|
1390
|
+
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
1391
|
+
const l = document.createElement("div");
|
|
1392
|
+
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(o), e.appendChild(a), t;
|
|
1358
1393
|
}
|
|
1359
1394
|
/**
|
|
1360
1395
|
* Helper method to generate CSS based on the current settings.
|
|
1361
1396
|
*/
|
|
1362
1397
|
getCssCode() {
|
|
1363
|
-
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "0, 0, 30",
|
|
1398
|
+
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "0, 0, 30", s = this.settings.opacityBG.value ?? 100;
|
|
1364
1399
|
return t ? `
|
|
1365
1400
|
background-image: url("${t}");
|
|
1366
1401
|
background-size: cover;
|
|
@@ -1368,7 +1403,7 @@ class gt extends v {
|
|
|
1368
1403
|
opacity: ${e / 100};
|
|
1369
1404
|
` : `
|
|
1370
1405
|
background-color: ${i};
|
|
1371
|
-
opacity: ${
|
|
1406
|
+
opacity: ${s / 100};
|
|
1372
1407
|
`;
|
|
1373
1408
|
}
|
|
1374
1409
|
}
|