builder-settings-types 0.0.91 → 0.0.93
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 +27 -27
- package/dist/builder-settings-types.es.js +265 -219
- package/dist/index.css +1 -1
- package/dist/index.d.ts +29 -0
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const R = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let I = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t += R[e[
|
|
2
|
+
let I = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += R[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function B(
|
|
9
|
-
for (const e in
|
|
10
|
-
if (
|
|
11
|
-
const i =
|
|
8
|
+
function B(c, t) {
|
|
9
|
+
for (const e in c)
|
|
10
|
+
if (c.hasOwnProperty(e)) {
|
|
11
|
+
const i = c[e];
|
|
12
12
|
t(e, i);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -78,42 +78,42 @@ const x = class x {
|
|
|
78
78
|
</svg>
|
|
79
79
|
`, r.title = this.description, s.appendChild(r);
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
81
|
+
const a = document.createElement("span");
|
|
82
|
+
a.className = "setting-group-arrow", a.innerHTML = `
|
|
83
83
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
84
84
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
85
85
|
</svg>
|
|
86
|
-
`, this.isCollapsed &&
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
86
|
+
`, this.isCollapsed && a.classList.add("rotated"), s.appendChild(a);
|
|
87
|
+
const o = document.createElement("div");
|
|
88
|
+
if (o.className = "setting-group-content", this.isCollapsed && (o.classList.add("collapsed"), e.classList.add("collapsed-view"), a.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && o.classList.add("main-content"), this.description && !this.isCollapsed) {
|
|
89
89
|
const r = document.createElement("div");
|
|
90
|
-
r.className = "setting-group-description", r.textContent = this.description,
|
|
90
|
+
r.className = "setting-group-description", r.textContent = this.description, o.appendChild(r);
|
|
91
91
|
}
|
|
92
92
|
const l = () => {
|
|
93
|
-
this.isCollapsed = !this.isCollapsed,
|
|
93
|
+
this.isCollapsed = !this.isCollapsed, o.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), a.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
94
94
|
"aria-expanded",
|
|
95
95
|
(!this.isCollapsed).toString()
|
|
96
96
|
);
|
|
97
|
-
const r =
|
|
97
|
+
const r = o.querySelector(
|
|
98
98
|
".setting-group-description"
|
|
99
99
|
), u = s.querySelector(".info-marker");
|
|
100
100
|
if (this.description)
|
|
101
101
|
if (this.isCollapsed) {
|
|
102
102
|
if (r && r.remove(), !u) {
|
|
103
|
-
const
|
|
104
|
-
|
|
103
|
+
const p = document.createElement("span");
|
|
104
|
+
p.className = "info-marker", p.innerHTML = `
|
|
105
105
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
106
106
|
<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"
|
|
107
107
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
108
108
|
</svg>
|
|
109
|
-
`,
|
|
109
|
+
`, p.title = this.description, s.insertBefore(p, a);
|
|
110
110
|
}
|
|
111
111
|
} else {
|
|
112
112
|
if (!r) {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
const p = document.createElement("div");
|
|
114
|
+
p.className = "setting-group-description", p.textContent = this.description, o.insertBefore(
|
|
115
|
+
p,
|
|
116
|
+
o.firstChild
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
u && u.remove();
|
|
@@ -125,13 +125,13 @@ const x = class x {
|
|
|
125
125
|
for (const r in this.settings)
|
|
126
126
|
if (this.settings.hasOwnProperty(r)) {
|
|
127
127
|
const u = this.settings[r];
|
|
128
|
-
|
|
128
|
+
o.appendChild(u.draw());
|
|
129
129
|
}
|
|
130
130
|
} else {
|
|
131
131
|
const r = document.createElement("div");
|
|
132
|
-
r.className = "setting-group-empty", r.textContent = "No settings in this group",
|
|
132
|
+
r.className = "setting-group-empty", r.textContent = "No settings in this group", o.appendChild(r);
|
|
133
133
|
}
|
|
134
|
-
return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(
|
|
134
|
+
return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(o), this.elementRef = t, t;
|
|
135
135
|
}
|
|
136
136
|
collapse() {
|
|
137
137
|
if (!this.elementRef || this.isCollapsed) return;
|
|
@@ -159,9 +159,9 @@ const x = class x {
|
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
x.hiddenElements = /* @__PURE__ */ new Set();
|
|
162
|
-
let
|
|
163
|
-
function W(
|
|
164
|
-
switch (
|
|
162
|
+
let v = x;
|
|
163
|
+
function W(c) {
|
|
164
|
+
switch (c) {
|
|
165
165
|
case "number":
|
|
166
166
|
return 0;
|
|
167
167
|
case "text":
|
|
@@ -178,7 +178,7 @@ function W(h) {
|
|
|
178
178
|
return "";
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
class
|
|
181
|
+
class C {
|
|
182
182
|
constructor(t = {}) {
|
|
183
183
|
this.props = t, this.id = t.id || I(), this.value = this.props.default, this.title = t.title || "";
|
|
184
184
|
}
|
|
@@ -195,45 +195,45 @@ class m {
|
|
|
195
195
|
t = { ...this.props.inputProps, ...t };
|
|
196
196
|
const e = document.createElement("div");
|
|
197
197
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
|
|
198
|
+
const a = document.createElement("div");
|
|
199
|
+
if (a.className = "icon-container", t.icon) {
|
|
200
|
+
const o = this.createIcon(t.icon, t.iconClassName);
|
|
201
|
+
a.appendChild(o);
|
|
202
202
|
}
|
|
203
203
|
if (t.title) {
|
|
204
|
-
const
|
|
205
|
-
|
|
204
|
+
const o = this.createLabel(t.title, t.labelClassName);
|
|
205
|
+
a.appendChild(o);
|
|
206
206
|
}
|
|
207
|
-
e.appendChild(
|
|
207
|
+
e.appendChild(a);
|
|
208
208
|
}
|
|
209
209
|
const i = document.createElement("div");
|
|
210
210
|
i.className = t.wrapperClassName || "";
|
|
211
211
|
const n = document.createElement("input");
|
|
212
212
|
this.inputEl = n, n.value = String(t.value || W(t.inputType)), n.type = t.inputType, n.placeholder = t.placeholder || "", n.className = t.inputClassName || "";
|
|
213
|
-
const s = (
|
|
214
|
-
const
|
|
215
|
-
let l =
|
|
213
|
+
const s = (a) => {
|
|
214
|
+
const o = a.target;
|
|
215
|
+
let l = o.value;
|
|
216
216
|
switch (t.inputType) {
|
|
217
217
|
case "number":
|
|
218
|
-
l = Number(
|
|
218
|
+
l = Number(o.value);
|
|
219
219
|
break;
|
|
220
220
|
case "color":
|
|
221
|
-
l =
|
|
221
|
+
l = o.value;
|
|
222
222
|
break;
|
|
223
223
|
case "date":
|
|
224
|
-
l =
|
|
224
|
+
l = o.value;
|
|
225
225
|
break;
|
|
226
226
|
case "select":
|
|
227
|
-
l =
|
|
227
|
+
l = o.value;
|
|
228
228
|
break;
|
|
229
229
|
case "text":
|
|
230
|
-
l =
|
|
230
|
+
l = o.value;
|
|
231
231
|
break;
|
|
232
232
|
case "button":
|
|
233
|
-
l =
|
|
233
|
+
l = o.value;
|
|
234
234
|
break;
|
|
235
235
|
default:
|
|
236
|
-
l =
|
|
236
|
+
l = o.value;
|
|
237
237
|
}
|
|
238
238
|
this.value = l, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
239
239
|
};
|
|
@@ -248,7 +248,7 @@ class m {
|
|
|
248
248
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
class H extends
|
|
251
|
+
class H extends C {
|
|
252
252
|
constructor(t = {}) {
|
|
253
253
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
254
254
|
}
|
|
@@ -275,7 +275,7 @@ class S extends H {
|
|
|
275
275
|
...t,
|
|
276
276
|
icon: t.icon || O,
|
|
277
277
|
title: t.title || "Color"
|
|
278
|
-
}), this.inputType = "color";
|
|
278
|
+
}), this.inputType = "color", this.detectChange = t.detectChange;
|
|
279
279
|
}
|
|
280
280
|
hexToRgb(t) {
|
|
281
281
|
t = t.replace("#", "");
|
|
@@ -283,11 +283,11 @@ class S extends H {
|
|
|
283
283
|
return `${e}, ${i}, ${n}`;
|
|
284
284
|
}
|
|
285
285
|
rgbToHex(t) {
|
|
286
|
-
const [e, i, n] = t.split(",").map((
|
|
286
|
+
const [e, i, n] = t.split(",").map((a) => parseInt(a.trim()));
|
|
287
287
|
if (isNaN(e) || isNaN(i) || isNaN(n)) return "#000000";
|
|
288
|
-
const s = (
|
|
289
|
-
const
|
|
290
|
-
return
|
|
288
|
+
const s = (a) => {
|
|
289
|
+
const o = a.toString(16);
|
|
290
|
+
return o.length === 1 ? "0" + o : o;
|
|
291
291
|
};
|
|
292
292
|
return `#${s(e)}${s(i)}${s(n)}`;
|
|
293
293
|
}
|
|
@@ -300,44 +300,48 @@ class S extends H {
|
|
|
300
300
|
e.appendChild(i), e.appendChild(n);
|
|
301
301
|
const s = document.createElement("div");
|
|
302
302
|
s.className = "color-input-wrapper";
|
|
303
|
-
const
|
|
304
|
-
const g =
|
|
303
|
+
const a = (p) => {
|
|
304
|
+
const g = p.value.split(",").map((N) => parseInt(N.trim()));
|
|
305
305
|
if (g.length !== 3 || g.some(isNaN))
|
|
306
|
-
return
|
|
307
|
-
const [
|
|
308
|
-
return
|
|
309
|
-
},
|
|
310
|
-
|
|
306
|
+
return p.style.border = "1px solid red", !1;
|
|
307
|
+
const [d, m, f] = g, L = d >= 0 && d <= 255 && m >= 0 && m <= 255 && f >= 0 && f <= 255;
|
|
308
|
+
return p.style.border = L ? "" : "1px solid red", L;
|
|
309
|
+
}, o = document.createElement("div");
|
|
310
|
+
o.className = "color-preview", o.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
311
311
|
const l = this.createInput({
|
|
312
312
|
value: this.value,
|
|
313
313
|
inputType: "text",
|
|
314
314
|
inputClassName: "color-text-input"
|
|
315
|
-
}),
|
|
315
|
+
}), h = l.querySelector("input"), r = this.createInput({
|
|
316
316
|
value: this.value ? this.rgbToHex(this.value) : "",
|
|
317
317
|
inputType: this.inputType,
|
|
318
318
|
inputClassName: "color-picker"
|
|
319
319
|
}), u = r.querySelector("input");
|
|
320
|
-
return
|
|
321
|
-
var
|
|
322
|
-
let g =
|
|
323
|
-
|
|
324
|
-
}, u.oninput = (
|
|
325
|
-
var
|
|
326
|
-
const g =
|
|
327
|
-
this.value =
|
|
328
|
-
},
|
|
320
|
+
return h.oninput = (p) => {
|
|
321
|
+
var d;
|
|
322
|
+
let g = p.target.value.trim();
|
|
323
|
+
a(h) && (this.value = g, (d = this.onChange) == null || d.call(this, g), u.value = this.rgbToHex(g), o.style.backgroundColor = `rgb(${g})`);
|
|
324
|
+
}, u.oninput = (p) => {
|
|
325
|
+
var m, f;
|
|
326
|
+
const g = p.target.value, d = this.hexToRgb(g);
|
|
327
|
+
this.value = d, (m = this.onChange) == null || m.call(this, d), (f = this.detectChange) == null || f.call(this, d), h.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
328
|
+
}, u.onchange = (p) => {
|
|
329
|
+
var m, f;
|
|
330
|
+
const g = p.target.value, d = this.hexToRgb(g);
|
|
331
|
+
this.value = d, (m = this.onChange) == null || m.call(this, d), (f = this.detectChange) == null || f.call(this, d), h.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
332
|
+
}, s.appendChild(o), s.appendChild(r), s.appendChild(l), t.appendChild(e), t.appendChild(s), this.value && (h.value = this.value, u.value = this.rgbToHex(this.value), o.style.backgroundColor = `rgb(${this.value})`), t;
|
|
329
333
|
}
|
|
330
334
|
}
|
|
331
|
-
class
|
|
335
|
+
class w extends C {
|
|
332
336
|
constructor(t = {}) {
|
|
333
337
|
super(t), this.inputType = "number";
|
|
334
338
|
}
|
|
335
339
|
draw() {
|
|
336
340
|
const t = (s) => {
|
|
337
341
|
this.props.minValue !== void 0 && (s.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), this.props.className && s.classList.add(this.props.className), s.addEventListener("input", () => {
|
|
338
|
-
const
|
|
342
|
+
const a = this.props.minValue ?? Number.MIN_SAFE_INTEGER, o = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
339
343
|
let l = Number(s.value);
|
|
340
|
-
l <
|
|
344
|
+
l < a && (l = a), l > o && (l = o), s.value = String(l);
|
|
341
345
|
});
|
|
342
346
|
}, e = this.createInput({
|
|
343
347
|
value: this.value,
|
|
@@ -359,7 +363,7 @@ class v extends m {
|
|
|
359
363
|
return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
|
|
360
364
|
}
|
|
361
365
|
}
|
|
362
|
-
class M extends
|
|
366
|
+
class M extends w {
|
|
363
367
|
constructor(t) {
|
|
364
368
|
super({
|
|
365
369
|
...t,
|
|
@@ -383,7 +387,7 @@ const A = `
|
|
|
383
387
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
384
388
|
</svg>
|
|
385
389
|
`;
|
|
386
|
-
class
|
|
390
|
+
class T extends C {
|
|
387
391
|
constructor(t = {}) {
|
|
388
392
|
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, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
389
393
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -399,12 +403,12 @@ class V extends m {
|
|
|
399
403
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
400
404
|
const s = document.createElement("div");
|
|
401
405
|
if (s.className = "icon-container", this.props.icon) {
|
|
402
|
-
const
|
|
403
|
-
s.appendChild(
|
|
406
|
+
const a = this.createIcon(this.props.icon);
|
|
407
|
+
s.appendChild(a);
|
|
404
408
|
}
|
|
405
409
|
if (this.props.title) {
|
|
406
|
-
const
|
|
407
|
-
s.appendChild(
|
|
410
|
+
const a = this.createLabel(this.props.title);
|
|
411
|
+
s.appendChild(a);
|
|
408
412
|
}
|
|
409
413
|
t.appendChild(s);
|
|
410
414
|
} else {
|
|
@@ -413,13 +417,13 @@ class V extends m {
|
|
|
413
417
|
}
|
|
414
418
|
const e = document.createElement("div");
|
|
415
419
|
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 = () => {
|
|
416
|
-
var s,
|
|
417
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
420
|
+
var s, a;
|
|
421
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
418
422
|
}, t.appendChild(e), this.buttonEl = e;
|
|
419
423
|
const i = document.createElement("ul");
|
|
420
|
-
i.classList.add("select-options"), this._options.forEach((s,
|
|
421
|
-
const
|
|
422
|
-
|
|
424
|
+
i.classList.add("select-options"), this._options.forEach((s, a) => {
|
|
425
|
+
const o = this.createOption(s, a);
|
|
426
|
+
o.onclick = (l) => this.selectOption(l, a, e), i.appendChild(o);
|
|
423
427
|
}), t.appendChild(i);
|
|
424
428
|
const n = document.createElement("div");
|
|
425
429
|
return n.classList.add("svg-container"), n.innerHTML = $, t.appendChild(n), this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
@@ -427,15 +431,15 @@ class V extends m {
|
|
|
427
431
|
}).catch((s) => {
|
|
428
432
|
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
429
433
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (s) => {
|
|
430
|
-
var
|
|
431
|
-
this.isOpen && !t.contains(s.target) && (this.isOpen = !1, (
|
|
434
|
+
var a, o;
|
|
435
|
+
this.isOpen && !t.contains(s.target) && (this.isOpen = !1, (a = this.optionsListEl) == null || a.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"));
|
|
432
436
|
}, document.addEventListener("click", this.clickOutsideListener), t;
|
|
433
437
|
}
|
|
434
438
|
selectOption(t, e, i) {
|
|
435
|
-
var s,
|
|
439
|
+
var s, a, o;
|
|
436
440
|
const n = this._options[e];
|
|
437
|
-
n && (this.value = n.value, (s = this.onChange) == null || s.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = n.name, (
|
|
438
|
-
r === e ?
|
|
441
|
+
n && (this.value = n.value, (s = this.onChange) == null || s.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = n.name, (a = this.optionsListEl) == null || a.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((h, r) => {
|
|
442
|
+
r === e ? h.classList.add("selected") : h.classList.remove("selected");
|
|
439
443
|
}));
|
|
440
444
|
}
|
|
441
445
|
updateOptionsList() {
|
|
@@ -467,7 +471,7 @@ class V extends m {
|
|
|
467
471
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), super.destroy();
|
|
468
472
|
}
|
|
469
473
|
}
|
|
470
|
-
class _ extends
|
|
474
|
+
class _ extends C {
|
|
471
475
|
constructor(t = {}) {
|
|
472
476
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
473
477
|
}
|
|
@@ -512,15 +516,15 @@ class _ extends m {
|
|
|
512
516
|
`
|
|
513
517
|
}
|
|
514
518
|
].forEach((s) => {
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
var
|
|
518
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
519
|
-
}), i.appendChild(
|
|
519
|
+
const a = document.createElement("button");
|
|
520
|
+
a.className = "align-option-button", a.innerHTML = s.icon, this.value === s.name && a.classList.add("selected"), a.addEventListener("click", () => {
|
|
521
|
+
var o;
|
|
522
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), a.classList.add("selected"), this.value = s.name, (o = this.onChange) == null || o.call(this, this.value);
|
|
523
|
+
}), i.appendChild(a);
|
|
520
524
|
}), t.appendChild(i), t;
|
|
521
525
|
}
|
|
522
526
|
}
|
|
523
|
-
class nt extends
|
|
527
|
+
class nt extends C {
|
|
524
528
|
constructor(t) {
|
|
525
529
|
super(t), this.inputType = "button";
|
|
526
530
|
}
|
|
@@ -533,21 +537,21 @@ class nt extends m {
|
|
|
533
537
|
return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
|
|
534
538
|
}
|
|
535
539
|
}
|
|
536
|
-
class
|
|
540
|
+
class at extends C {
|
|
537
541
|
constructor(t = {}) {
|
|
538
542
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
539
543
|
const e = t.width || 100, i = t.height || 100;
|
|
540
544
|
this.value || (this.value = {
|
|
541
545
|
width: e,
|
|
542
546
|
height: i
|
|
543
|
-
}), this.minWidth = Math.max(1, t.minWidth || 1), this.maxWidth = t.maxWidth, this.minHeight = Math.max(1, t.minHeight || 1), this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, (!this.value.width || this.value.width < 1) && (this.value.width = 1), (!this.value.height || this.value.height < 1) && (this.value.height = 1), this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
547
|
+
}), this.minWidth = Math.max(1, t.minWidth || 1), this.maxWidth = t.maxWidth, this.minHeight = Math.max(1, t.minHeight || 1), this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, (!this.value.width || this.value.width < 1) && (this.value.width = 1), (!this.value.height || this.value.height < 1) && (this.value.height = 1), this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new w({
|
|
544
548
|
title: "Width",
|
|
545
549
|
default: this.value.width,
|
|
546
550
|
suffix: "px",
|
|
547
551
|
minValue: this.minWidth,
|
|
548
552
|
maxValue: this.maxWidth,
|
|
549
553
|
icon: j
|
|
550
|
-
}), this.heightSetting = new
|
|
554
|
+
}), this.heightSetting = new w({
|
|
551
555
|
title: "Height",
|
|
552
556
|
default: this.value.height,
|
|
553
557
|
suffix: "px",
|
|
@@ -621,8 +625,8 @@ class ot extends m {
|
|
|
621
625
|
return s.className = "dimension-lock-icon", s.setAttribute("type", "button"), s.setAttribute("aria-pressed", String(this.locked)), s.setAttribute(
|
|
622
626
|
"aria-label",
|
|
623
627
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
624
|
-
), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (
|
|
625
|
-
|
|
628
|
+
), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (a) => {
|
|
629
|
+
a.preventDefault(), this.toggleLock(s);
|
|
626
630
|
}, n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
|
|
627
631
|
}
|
|
628
632
|
isLocked() {
|
|
@@ -653,7 +657,7 @@ const j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
653
657
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
654
658
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
655
659
|
</svg>
|
|
656
|
-
`,
|
|
660
|
+
`, V = `
|
|
657
661
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
658
662
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
659
663
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -663,7 +667,7 @@ const j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
663
667
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
664
668
|
</svg>
|
|
665
669
|
`;
|
|
666
|
-
class F extends
|
|
670
|
+
class F extends C {
|
|
667
671
|
constructor(t = {}) {
|
|
668
672
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl);
|
|
669
673
|
}
|
|
@@ -685,71 +689,71 @@ class F extends m {
|
|
|
685
689
|
t.className = "upload-setting-wrapper";
|
|
686
690
|
const e = !!(this.props.title || this.props.icon);
|
|
687
691
|
if (e || t.classList.add("no-label"), e) {
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
692
|
+
const h = document.createElement("div");
|
|
693
|
+
if (h.className = "icon-title-container", this.props.icon) {
|
|
690
694
|
const r = this.createIcon(this.props.icon);
|
|
691
|
-
|
|
695
|
+
h.appendChild(r);
|
|
692
696
|
}
|
|
693
697
|
if (this.props.title) {
|
|
694
698
|
const r = this.createLabel(this.props.title);
|
|
695
|
-
|
|
699
|
+
h.appendChild(r);
|
|
696
700
|
}
|
|
697
|
-
t.appendChild(
|
|
701
|
+
t.appendChild(h);
|
|
698
702
|
}
|
|
699
703
|
const i = document.createElement("div");
|
|
700
704
|
i.className = "preview-button-container";
|
|
701
705
|
const n = this.value && this.value !== "";
|
|
702
706
|
n || i.classList.add("no-image");
|
|
703
707
|
const s = document.createElement("div");
|
|
704
|
-
s.className = "preview-placeholder", s.innerHTML =
|
|
705
|
-
const o = document.createElement("button");
|
|
706
|
-
o.className = "delete-button", o.type = "button", o.title = "Delete image", o.innerHTML = q, this.previewWrapper.appendChild(this.emptyStateEl), this.previewWrapper.appendChild(this.previewEl), this.previewWrapper.appendChild(o);
|
|
708
|
+
s.className = "preview-placeholder", s.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";
|
|
707
709
|
const a = document.createElement("button");
|
|
708
|
-
a.className = "
|
|
710
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = q, this.previewWrapper.appendChild(this.emptyStateEl), this.previewWrapper.appendChild(this.previewEl), this.previewWrapper.appendChild(a);
|
|
711
|
+
const o = document.createElement("button");
|
|
712
|
+
o.className = "upload-button", o.innerHTML = `
|
|
709
713
|
<span class="upload-icon">${y}</span>
|
|
710
714
|
<span class="upload-label">Upload</span>
|
|
711
715
|
`;
|
|
712
716
|
const l = document.createElement("input");
|
|
713
|
-
return l.type = "file", l.accept = "image/*", l.style.display = "none", i.appendChild(s), i.appendChild(this.previewWrapper), i.appendChild(
|
|
717
|
+
return l.type = "file", l.accept = "image/*", l.style.display = "none", i.appendChild(s), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), t.appendChild(l), n ? this.updatePreviewState(this.value) : this.updatePreviewState(null), a.onclick = (h) => {
|
|
714
718
|
var r;
|
|
715
|
-
|
|
716
|
-
},
|
|
719
|
+
h.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, "");
|
|
720
|
+
}, o.onclick = () => {
|
|
717
721
|
l.click();
|
|
718
722
|
}, l.onchange = async () => {
|
|
719
|
-
var r, u,
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
723
|
+
var r, u, p;
|
|
724
|
+
const h = (r = l.files) == null ? void 0 : r[0];
|
|
725
|
+
if (h)
|
|
722
726
|
try {
|
|
723
|
-
|
|
724
|
-
const g = new FormData(),
|
|
725
|
-
g.append(
|
|
726
|
-
const
|
|
727
|
-
if (!
|
|
727
|
+
o.classList.add("loading"), o.disabled = !0;
|
|
728
|
+
const g = new FormData(), d = this.props.formFieldName || "file";
|
|
729
|
+
g.append(d, h, h.name);
|
|
730
|
+
const m = this.props.uploadUrl;
|
|
731
|
+
if (!m)
|
|
728
732
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
729
|
-
const
|
|
730
|
-
method:
|
|
733
|
+
const f = this.props.requestMethod || "POST", L = { ...this.props.requestHeaders || {} }, E = await (await fetch(m, {
|
|
734
|
+
method: f,
|
|
731
735
|
body: g,
|
|
732
736
|
headers: L
|
|
733
737
|
})).json();
|
|
734
|
-
let
|
|
738
|
+
let b;
|
|
735
739
|
if (this.props.parseResponse)
|
|
736
|
-
|
|
737
|
-
else if (
|
|
740
|
+
b = this.props.parseResponse(E);
|
|
741
|
+
else if (b = (u = E == null ? void 0 : E.data) == null ? void 0 : u.url, !b)
|
|
738
742
|
throw new Error(
|
|
739
743
|
"No URL found in response. Provide a parseResponse if needed."
|
|
740
744
|
);
|
|
741
|
-
this.value =
|
|
745
|
+
this.value = b, this.updatePreviewState(b), (p = this.onChange) == null || p.call(this, b);
|
|
742
746
|
} catch (g) {
|
|
743
747
|
console.error("Error uploading file:", g), this.updatePreviewState(null);
|
|
744
748
|
} finally {
|
|
745
|
-
|
|
749
|
+
o.classList.remove("loading"), o.disabled = !1;
|
|
746
750
|
}
|
|
747
751
|
}, t;
|
|
748
752
|
}
|
|
749
753
|
}
|
|
750
|
-
class
|
|
754
|
+
class ot extends C {
|
|
751
755
|
constructor(t = {}) {
|
|
752
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
756
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
|
|
753
757
|
title: "Height",
|
|
754
758
|
default: this.value,
|
|
755
759
|
suffix: "px",
|
|
@@ -768,9 +772,9 @@ class at extends m {
|
|
|
768
772
|
const z = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
769
773
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
770
774
|
</svg>`;
|
|
771
|
-
class lt extends
|
|
775
|
+
class lt extends C {
|
|
772
776
|
constructor(t = {}) {
|
|
773
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
777
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
|
|
774
778
|
title: "Width",
|
|
775
779
|
default: this.value,
|
|
776
780
|
suffix: "px",
|
|
@@ -793,7 +797,7 @@ const U = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
793
797
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
794
798
|
</svg>
|
|
795
799
|
`;
|
|
796
|
-
class rt extends
|
|
800
|
+
class rt extends C {
|
|
797
801
|
constructor(t = {}) {
|
|
798
802
|
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(
|
|
799
803
|
(e) => JSON.stringify(e.value) === JSON.stringify(t.default)
|
|
@@ -818,34 +822,34 @@ class rt extends m {
|
|
|
818
822
|
e.classList.add("has-label");
|
|
819
823
|
const s = document.createElement("div");
|
|
820
824
|
s.className = "select-label", s.textContent = this.props.title, e.appendChild(s);
|
|
821
|
-
const
|
|
822
|
-
|
|
825
|
+
const a = document.createElement("span");
|
|
826
|
+
a.className = "select-value", this.isLoading ? a.textContent = this.props.loadingText || "Loading options..." : a.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.appendChild(a);
|
|
823
827
|
} else {
|
|
824
828
|
const s = document.createElement("span");
|
|
825
829
|
this.isLoading ? s.textContent = this.props.loadingText || "Loading options..." : s.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.appendChild(s);
|
|
826
830
|
}
|
|
827
831
|
e.onclick = () => {
|
|
828
|
-
var s,
|
|
829
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
832
|
+
var s, a;
|
|
833
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
830
834
|
}, t.appendChild(e), this.buttonEl = e;
|
|
831
835
|
const i = document.createElement("ul");
|
|
832
|
-
i.classList.add("select-api-options"), this._options.forEach((s,
|
|
833
|
-
const
|
|
834
|
-
|
|
836
|
+
i.classList.add("select-api-options"), this._options.forEach((s, a) => {
|
|
837
|
+
const o = this.createOption(s, a);
|
|
838
|
+
o.onclick = (l) => this.selectApiOption(l, a, e), i.appendChild(o);
|
|
835
839
|
}), t.appendChild(i);
|
|
836
840
|
const n = document.createElement("div");
|
|
837
841
|
return n.classList.add("svg-container"), n.innerHTML = D, t.appendChild(n), n.onclick = () => {
|
|
838
|
-
var s,
|
|
839
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
842
|
+
var s, a;
|
|
843
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
840
844
|
}, this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
841
845
|
this._options.push(...s), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
842
|
-
(
|
|
846
|
+
(a) => JSON.stringify(a.value) === JSON.stringify(this.value)
|
|
843
847
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
844
848
|
}).catch((s) => {
|
|
845
849
|
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
846
850
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
847
|
-
const
|
|
848
|
-
this._options.push(...
|
|
851
|
+
const a = new Set(this._options.map((l) => JSON.stringify(l.value))), o = s.filter((l) => !a.has(JSON.stringify(l.value)));
|
|
852
|
+
this._options.push(...o), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
849
853
|
(l) => JSON.stringify(l.value) === JSON.stringify(this.value)
|
|
850
854
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
851
855
|
}).catch((s) => {
|
|
@@ -853,14 +857,14 @@ class rt extends m {
|
|
|
853
857
|
})), t;
|
|
854
858
|
}
|
|
855
859
|
selectApiOption(t, e, i) {
|
|
856
|
-
var s,
|
|
860
|
+
var s, a;
|
|
857
861
|
const n = this._options[e];
|
|
858
862
|
if (n) {
|
|
859
|
-
const
|
|
860
|
-
this.value =
|
|
863
|
+
const o = n.value;
|
|
864
|
+
this.value = o, this.onChange && this.onChange(o), this.detectChangeCallback && this.detectChangeCallback(o), this.selectedOptionIndex = e, this.isOpen = !1, this.updateButtonText(), (s = this.optionsListEl) == null || s.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(
|
|
861
865
|
".select-api-radio"
|
|
862
|
-
).forEach((
|
|
863
|
-
|
|
866
|
+
).forEach((h, r) => {
|
|
867
|
+
h.checked = r === e;
|
|
864
868
|
});
|
|
865
869
|
}
|
|
866
870
|
}
|
|
@@ -886,17 +890,17 @@ class rt extends m {
|
|
|
886
890
|
const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"), n = this.buttonEl.querySelector(".select-label");
|
|
887
891
|
if (this.isLoading) {
|
|
888
892
|
this.buttonEl.classList.add("loading");
|
|
889
|
-
const
|
|
893
|
+
const a = this.props.loadingText || "Loading options...";
|
|
890
894
|
if (e)
|
|
891
|
-
e.textContent =
|
|
895
|
+
e.textContent = a;
|
|
892
896
|
else if (i && this.props.title && !n) {
|
|
893
897
|
this.buttonEl.innerHTML = "";
|
|
894
|
-
const
|
|
895
|
-
|
|
898
|
+
const o = document.createElement("div");
|
|
899
|
+
o.className = "select-label", o.textContent = this.props.title, this.buttonEl.appendChild(o);
|
|
896
900
|
const l = document.createElement("span");
|
|
897
|
-
l.className = "select-value", l.textContent =
|
|
901
|
+
l.className = "select-value", l.textContent = a, this.buttonEl.appendChild(l);
|
|
898
902
|
} else
|
|
899
|
-
this.buttonEl.textContent =
|
|
903
|
+
this.buttonEl.textContent = a;
|
|
900
904
|
return;
|
|
901
905
|
}
|
|
902
906
|
this.buttonEl.classList.remove("loading", "error");
|
|
@@ -905,10 +909,10 @@ class rt extends m {
|
|
|
905
909
|
e.textContent = s;
|
|
906
910
|
else if (i && this.props.title && !n) {
|
|
907
911
|
this.buttonEl.innerHTML = "";
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
+
const a = document.createElement("div");
|
|
913
|
+
a.className = "select-label", a.textContent = this.props.title, this.buttonEl.appendChild(a);
|
|
914
|
+
const o = document.createElement("span");
|
|
915
|
+
o.className = "select-value", o.textContent = s, this.buttonEl.appendChild(o);
|
|
912
916
|
} else
|
|
913
917
|
this.buttonEl.textContent = s;
|
|
914
918
|
}
|
|
@@ -916,7 +920,7 @@ class rt extends m {
|
|
|
916
920
|
this.detectChangeCallback = t;
|
|
917
921
|
}
|
|
918
922
|
}
|
|
919
|
-
class ht extends
|
|
923
|
+
class ht extends C {
|
|
920
924
|
constructor(t) {
|
|
921
925
|
super(t), this.inputType = "text", this.value = t.default ?? !1;
|
|
922
926
|
}
|
|
@@ -925,12 +929,12 @@ class ht extends m {
|
|
|
925
929
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
926
930
|
const e = document.createElement("div");
|
|
927
931
|
if (e.className = "toggle-label", this.props.icon) {
|
|
928
|
-
const
|
|
929
|
-
|
|
932
|
+
const a = document.createElement("span");
|
|
933
|
+
a.className = "toggle-icon", a.innerHTML = this.props.icon, e.appendChild(a);
|
|
930
934
|
}
|
|
931
935
|
if (this.props.title) {
|
|
932
|
-
const
|
|
933
|
-
|
|
936
|
+
const a = document.createElement("span");
|
|
937
|
+
a.textContent = this.props.title, e.appendChild(a);
|
|
934
938
|
}
|
|
935
939
|
t.appendChild(e);
|
|
936
940
|
const i = document.createElement("label");
|
|
@@ -946,7 +950,7 @@ class ht extends m {
|
|
|
946
950
|
const Z = `<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
947
951
|
<path d="M1.25 7.5H1.2575M4.625 7.5H4.6325M11.375 7.5H11.3825M8 7.5H8.0075M14.75 7.5H14.7575M14.75 14.25V13.65C14.75 12.8099 14.75 12.3899 14.5865 12.069C14.4427 11.7868 14.2132 11.5573 13.931 11.4135C13.6101 11.25 13.1901 11.25 12.35 11.25H3.65C2.80992 11.25 2.38988 11.25 2.06901 11.4135C1.78677 11.5573 1.5573 11.7868 1.41349 12.069C1.25 12.3899 1.25 12.8099 1.25 13.65V14.25M14.75 0.75V1.35C14.75 2.19008 14.75 2.61012 14.5865 2.93099C14.4427 3.21323 14.2132 3.4427 13.931 3.58651C13.6101 3.75 13.1901 3.75 12.35 3.75H3.65C2.80992 3.75 2.38988 3.75 2.06901 3.58651C1.78677 3.4427 1.5573 3.21323 1.41349 2.93099C1.25 2.61012 1.25 2.19008 1.25 1.35V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
948
952
|
</svg>`;
|
|
949
|
-
class ct extends
|
|
953
|
+
class ct extends C {
|
|
950
954
|
constructor(t = {}) {
|
|
951
955
|
super(t), this.inputType = "number", this.inputValues = {};
|
|
952
956
|
}
|
|
@@ -984,31 +988,72 @@ class ct extends m {
|
|
|
984
988
|
n.classList.add("gap-label-container");
|
|
985
989
|
const s = document.createElement("div");
|
|
986
990
|
s.classList.add("gap-setting-icon"), s.innerHTML = this.props.icon || Z, n.appendChild(s);
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
const
|
|
991
|
+
const a = document.createElement("label");
|
|
992
|
+
a.classList.add("gap-input-label"), a.textContent = t, n.appendChild(a), i.appendChild(n);
|
|
993
|
+
const o = (u) => {
|
|
990
994
|
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", () => {
|
|
991
|
-
var
|
|
992
|
-
const
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
+
var m;
|
|
996
|
+
const p = this.props.minValue ?? 0, g = this.props.maxValue ?? 100;
|
|
997
|
+
let d = Number(u.value);
|
|
998
|
+
d < p && (d = p), d > g && (d = g), u.value = String(d), this.value = d, this.inputValues[t] = d, console.log(`Gap Setting (${t}): ${d}${this.props.suffix || ""}`), (m = this.onChange) == null || m.call(this, d);
|
|
995
999
|
});
|
|
996
1000
|
}, l = this.createInput({
|
|
997
1001
|
value: e,
|
|
998
1002
|
inputType: this.inputType,
|
|
999
1003
|
inputClassName: "gap-setting-input " + (this.props.inputClassName || ""),
|
|
1000
1004
|
wrapperClassName: "gap-setting-inner-wrapper " + (this.props.wrapperClassName || ""),
|
|
1001
|
-
inputCustomizer:
|
|
1005
|
+
inputCustomizer: o
|
|
1002
1006
|
});
|
|
1003
1007
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
1004
1008
|
return i.appendChild(l), i;
|
|
1005
1009
|
l.classList.add("suffix-wrapper");
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1010
|
+
const h = l.querySelector("input.gap-setting-input");
|
|
1011
|
+
h && (h.style.paddingRight = "35px");
|
|
1008
1012
|
const r = document.createElement("span");
|
|
1009
1013
|
return r.className = "suffix-label", r.textContent = this.props.suffix, l.appendChild(r), i.appendChild(l), i;
|
|
1010
1014
|
}
|
|
1011
1015
|
}
|
|
1016
|
+
class dt extends C {
|
|
1017
|
+
constructor(t) {
|
|
1018
|
+
var e;
|
|
1019
|
+
if (!t.tabs)
|
|
1020
|
+
throw new Error("Tabs array is required for TabsSettings");
|
|
1021
|
+
super(t), this.inputType = "tabs", this.tabs = [], this.activeTabId = "", this.tabsContainer = null, this.contentContainer = null, this.previousTabId = "", this.tabs = t.tabs, this.activeTabId = t.activeTabId || ((e = this.tabs[0]) == null ? void 0 : e.id) || "", this.previousTabId = this.activeTabId, t.onChange && this.setOnChange(t.onChange);
|
|
1022
|
+
}
|
|
1023
|
+
draw() {
|
|
1024
|
+
const t = document.createElement("div");
|
|
1025
|
+
t.classList.add("tabs-settings-container"), this.props.className && t.classList.add(this.props.className);
|
|
1026
|
+
const e = document.createElement("div");
|
|
1027
|
+
e.classList.add("tabs-header"), this.tabsContainer = e, this.tabs.forEach((n) => {
|
|
1028
|
+
const s = document.createElement("button");
|
|
1029
|
+
s.classList.add("tab-button"), n.id === this.activeTabId && s.classList.add("active"), s.textContent = n.label, s.onclick = () => this.handleTabClick(n.id), e.appendChild(s);
|
|
1030
|
+
}), t.appendChild(e);
|
|
1031
|
+
const i = document.createElement("div");
|
|
1032
|
+
return i.classList.add("tab-content"), this.contentContainer = i, this.tabs.forEach((n) => {
|
|
1033
|
+
const s = document.createElement("div");
|
|
1034
|
+
s.classList.add("tab-panel"), n.id === this.activeTabId && s.classList.add("active"), n.content instanceof v ? s.appendChild(n.content.draw()) : s.appendChild(n.content), i.appendChild(s);
|
|
1035
|
+
}), t.appendChild(i), t;
|
|
1036
|
+
}
|
|
1037
|
+
handleTabClick(t) {
|
|
1038
|
+
var i, n;
|
|
1039
|
+
if (t === this.activeTabId) return;
|
|
1040
|
+
this.previousTabId = this.activeTabId, this.activeTabId = t;
|
|
1041
|
+
const e = (i = this.tabsContainer) == null ? void 0 : i.querySelectorAll(".tab-button");
|
|
1042
|
+
if (e == null || e.forEach((s) => {
|
|
1043
|
+
var a;
|
|
1044
|
+
s instanceof HTMLElement && s.classList.toggle("active", s.textContent === ((a = this.tabs.find((o) => o.id === t)) == null ? void 0 : a.label));
|
|
1045
|
+
}), this.contentContainer) {
|
|
1046
|
+
const s = this.contentContainer.querySelectorAll(".tab-panel"), a = this.tabs.findIndex((l) => l.id === this.previousTabId), o = this.tabs.findIndex((l) => l.id === t);
|
|
1047
|
+
s.forEach((l, h) => {
|
|
1048
|
+
l instanceof HTMLElement && (h === o ? (l.classList.add("active"), l.classList.remove("slide-left", "slide-right")) : h === a ? (l.classList.remove("active"), l.classList.add(o > a ? "slide-left" : "slide-right")) : l.classList.remove("active", "slide-left", "slide-right"));
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
(n = this.onChangeCallback) == null || n.call(this, t);
|
|
1052
|
+
}
|
|
1053
|
+
setOnChange(t) {
|
|
1054
|
+
return this.onChangeCallback = t, this;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1012
1057
|
const J = `
|
|
1013
1058
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1014
1059
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -1018,14 +1063,14 @@ const J = `
|
|
|
1018
1063
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1019
1064
|
</svg>
|
|
1020
1065
|
`;
|
|
1021
|
-
class
|
|
1066
|
+
class pt extends v {
|
|
1022
1067
|
constructor(t) {
|
|
1023
1068
|
super({
|
|
1024
1069
|
title: "Border",
|
|
1025
1070
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
1026
1071
|
hideCondition: t == null ? void 0 : t.hideCondition,
|
|
1027
1072
|
settings: {
|
|
1028
|
-
size: new
|
|
1073
|
+
size: new w({
|
|
1029
1074
|
title: "Size",
|
|
1030
1075
|
icon: P,
|
|
1031
1076
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
@@ -1039,7 +1084,7 @@ class dt extends f {
|
|
|
1039
1084
|
minValue: 0,
|
|
1040
1085
|
maxValue: 100
|
|
1041
1086
|
}),
|
|
1042
|
-
radius: new
|
|
1087
|
+
radius: new w({
|
|
1043
1088
|
title: "Radius",
|
|
1044
1089
|
icon: J,
|
|
1045
1090
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
@@ -1074,7 +1119,7 @@ const X = `
|
|
|
1074
1119
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1075
1120
|
</svg>
|
|
1076
1121
|
`;
|
|
1077
|
-
class
|
|
1122
|
+
class ut extends v {
|
|
1078
1123
|
constructor(t = {}) {
|
|
1079
1124
|
super({
|
|
1080
1125
|
title: t.title || "Typography",
|
|
@@ -1087,7 +1132,7 @@ class pt extends f {
|
|
|
1087
1132
|
opacity: new M({
|
|
1088
1133
|
default: t.colorOpacityDefault ?? 100
|
|
1089
1134
|
}),
|
|
1090
|
-
fontFamily: new
|
|
1135
|
+
fontFamily: new T({
|
|
1091
1136
|
title: "Font",
|
|
1092
1137
|
icon: X,
|
|
1093
1138
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
@@ -1099,7 +1144,7 @@ class pt extends f {
|
|
|
1099
1144
|
getOptions: t.fontFamilyGetOptions,
|
|
1100
1145
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
1101
1146
|
}),
|
|
1102
|
-
fontWeight: new
|
|
1147
|
+
fontWeight: new T({
|
|
1103
1148
|
title: "Weight",
|
|
1104
1149
|
icon: Q,
|
|
1105
1150
|
default: t.fontWeightDefault ?? "400",
|
|
@@ -1111,7 +1156,7 @@ class pt extends f {
|
|
|
1111
1156
|
getOptions: t.fontWeightGetOptions,
|
|
1112
1157
|
getOptionsAsync: t.fontWeightGetOptionsAsync
|
|
1113
1158
|
}),
|
|
1114
|
-
fontSize: new
|
|
1159
|
+
fontSize: new w({
|
|
1115
1160
|
title: "Size",
|
|
1116
1161
|
icon: Y,
|
|
1117
1162
|
default: t.fontSizeDefault ?? 12,
|
|
@@ -1125,18 +1170,18 @@ class pt extends f {
|
|
|
1125
1170
|
});
|
|
1126
1171
|
}
|
|
1127
1172
|
getCssCode() {
|
|
1128
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", n = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12,
|
|
1173
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", n = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, a = this.settings.align.value ?? "left";
|
|
1129
1174
|
return `
|
|
1130
1175
|
color: ${t};
|
|
1131
1176
|
opacity: ${e / 100};
|
|
1132
1177
|
font-family: ${i};
|
|
1133
1178
|
font-weight: ${n};
|
|
1134
1179
|
font-size: ${s}px;
|
|
1135
|
-
text-align: ${
|
|
1180
|
+
text-align: ${a};
|
|
1136
1181
|
`;
|
|
1137
1182
|
}
|
|
1138
1183
|
}
|
|
1139
|
-
class k extends
|
|
1184
|
+
class k extends C {
|
|
1140
1185
|
constructor(t) {
|
|
1141
1186
|
super({
|
|
1142
1187
|
...t,
|
|
@@ -1144,11 +1189,11 @@ class k extends m {
|
|
|
1144
1189
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
1145
1190
|
}
|
|
1146
1191
|
draw() {
|
|
1147
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
1148
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
1149
|
-
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER,
|
|
1150
|
-
let r = Number(
|
|
1151
|
-
r < l && (r = l), r >
|
|
1192
|
+
const t = this.value === "auto" ? "text" : "number", e = (o) => {
|
|
1193
|
+
this.value !== "auto" && (this.props.minValue !== void 0 && (o.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (o.max = String(this.props.maxValue)), this.props.className && o.classList.add(this.props.className), o.addEventListener("input", () => {
|
|
1194
|
+
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, h = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1195
|
+
let r = Number(o.value);
|
|
1196
|
+
r < l && (r = l), r > h && (r = h), o.value = String(r);
|
|
1152
1197
|
}));
|
|
1153
1198
|
}, i = this.createInput({
|
|
1154
1199
|
value: this.value,
|
|
@@ -1169,20 +1214,20 @@ class k extends m {
|
|
|
1169
1214
|
n && (n.style.paddingRight = "35px");
|
|
1170
1215
|
const s = document.createElement("span");
|
|
1171
1216
|
s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
|
|
1172
|
-
const
|
|
1173
|
-
return
|
|
1174
|
-
const l =
|
|
1217
|
+
const a = i.querySelector("input");
|
|
1218
|
+
return a && (a.oninput = (o) => {
|
|
1219
|
+
const l = o.target.value.trim();
|
|
1175
1220
|
if (l.toLowerCase() === "auto")
|
|
1176
1221
|
this.value = "auto";
|
|
1177
1222
|
else {
|
|
1178
|
-
const
|
|
1179
|
-
isNaN(
|
|
1223
|
+
const h = Number(l);
|
|
1224
|
+
isNaN(h) || (this.value = h);
|
|
1180
1225
|
}
|
|
1181
1226
|
this.onChange && this.onChange(this.value);
|
|
1182
1227
|
}), i;
|
|
1183
1228
|
}
|
|
1184
1229
|
}
|
|
1185
|
-
class
|
|
1230
|
+
class gt extends v {
|
|
1186
1231
|
constructor(t) {
|
|
1187
1232
|
super({
|
|
1188
1233
|
title: "Margins",
|
|
@@ -1235,7 +1280,7 @@ const K = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
1235
1280
|
</svg>`, it = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1236
1281
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1237
1282
|
</svg>`;
|
|
1238
|
-
class st extends
|
|
1283
|
+
class st extends v {
|
|
1239
1284
|
constructor(t, e, i) {
|
|
1240
1285
|
super({
|
|
1241
1286
|
title: `Tab ${t + 1}`,
|
|
@@ -1270,16 +1315,16 @@ class st extends f {
|
|
|
1270
1315
|
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
|
|
1271
1316
|
</svg>
|
|
1272
1317
|
`, s.onclick = () => {
|
|
1273
|
-
var
|
|
1274
|
-
return (
|
|
1318
|
+
var o;
|
|
1319
|
+
return (o = this.onDeleteCallback) == null ? void 0 : o.call(this);
|
|
1275
1320
|
}, n.appendChild(s);
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1321
|
+
const a = i.querySelector("h3");
|
|
1322
|
+
a ? a.insertAdjacentElement("afterend", n) : i.appendChild(n);
|
|
1278
1323
|
}
|
|
1279
1324
|
return t;
|
|
1280
1325
|
}
|
|
1281
1326
|
}
|
|
1282
|
-
class
|
|
1327
|
+
class mt extends v {
|
|
1283
1328
|
// Store the rendered element
|
|
1284
1329
|
constructor(t) {
|
|
1285
1330
|
super({
|
|
@@ -1348,7 +1393,7 @@ class gt extends f {
|
|
|
1348
1393
|
}));
|
|
1349
1394
|
}
|
|
1350
1395
|
}
|
|
1351
|
-
class
|
|
1396
|
+
class Ct extends v {
|
|
1352
1397
|
/**
|
|
1353
1398
|
* Constructs a new BackgroundSettingSet.
|
|
1354
1399
|
*
|
|
@@ -1401,10 +1446,10 @@ class mt extends f {
|
|
|
1401
1446
|
draw() {
|
|
1402
1447
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
1403
1448
|
if (!e) return t;
|
|
1404
|
-
const i = Array.from(e.children), [n, s,
|
|
1449
|
+
const i = Array.from(e.children), [n, s, a, o] = i;
|
|
1405
1450
|
e.innerHTML = "", e.appendChild(n), e.appendChild(s);
|
|
1406
1451
|
const l = document.createElement("div");
|
|
1407
|
-
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(
|
|
1452
|
+
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(a), e.appendChild(o), t;
|
|
1408
1453
|
}
|
|
1409
1454
|
/**
|
|
1410
1455
|
* Helper method to generate CSS based on the current settings.
|
|
@@ -1424,23 +1469,24 @@ class mt extends f {
|
|
|
1424
1469
|
}
|
|
1425
1470
|
export {
|
|
1426
1471
|
_ as AlignSetting,
|
|
1427
|
-
|
|
1428
|
-
|
|
1472
|
+
Ct as BackgroundSettingSet,
|
|
1473
|
+
pt as BorderSettingSet,
|
|
1429
1474
|
nt as ButtonSetting,
|
|
1430
1475
|
S as ColorSetting,
|
|
1431
|
-
|
|
1476
|
+
at as DimensionSetting,
|
|
1432
1477
|
ct as GapSetting,
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1478
|
+
ut as HeaderTypographySettingSet,
|
|
1479
|
+
ot as HeightSetting,
|
|
1480
|
+
gt as MarginSettingGroup,
|
|
1481
|
+
w as NumberSetting,
|
|
1437
1482
|
M as OpacitySetting,
|
|
1438
1483
|
rt as SelectApiSettings,
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1484
|
+
T as SelectSetting,
|
|
1485
|
+
C as Setting,
|
|
1486
|
+
v as SettingGroup,
|
|
1442
1487
|
H as StringSetting,
|
|
1443
|
-
|
|
1488
|
+
mt as TabsContainerGroup,
|
|
1489
|
+
dt as TabsSettings,
|
|
1444
1490
|
ht as Toggle,
|
|
1445
1491
|
F as UploadSetting,
|
|
1446
1492
|
lt as WidthSetting,
|