builder-settings-types 0.0.92 → 0.0.94
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 +28 -28
- package/dist/builder-settings-types.es.js +255 -207
- package/dist/index.css +1 -1
- package/dist/index.d.ts +32 -0
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
let I = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const B = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let I = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += B[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
for (const e in
|
|
10
|
-
if (
|
|
11
|
-
const i =
|
|
8
|
+
function R(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
|
}
|
|
15
|
-
const
|
|
15
|
+
const x = class x {
|
|
16
16
|
constructor(t) {
|
|
17
|
-
this.elementRef = null, this.isHidden = !1, this.id = t.id || I(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.hideCondition = t.hideCondition, Object.assign(this, t.settings);
|
|
17
|
+
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.id = t.id || I(), this.title = t.title, this.settings = t.settings, this.description = t.description, this.icon = t.icon, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.hideCondition = t.hideCondition, this.onBlur = t.onBlur, Object.assign(this, t.settings);
|
|
18
18
|
}
|
|
19
19
|
static hide() {
|
|
20
20
|
this.hiddenElements.forEach((t) => {
|
|
@@ -27,12 +27,15 @@ const b = class b {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
setOnChange(t) {
|
|
30
|
-
return this.onChange = t,
|
|
30
|
+
return this.onChange = t, R(this.settings, (e, i) => {
|
|
31
31
|
i.setOnChange((n) => {
|
|
32
32
|
t(n), this.updateVisibility();
|
|
33
33
|
});
|
|
34
34
|
}), this;
|
|
35
35
|
}
|
|
36
|
+
setOnBlur(t) {
|
|
37
|
+
return this.onBlur = t, this;
|
|
38
|
+
}
|
|
36
39
|
hide() {
|
|
37
40
|
this.elementRef && (this.elementRef.style.display = "none", this.isHidden = !0);
|
|
38
41
|
}
|
|
@@ -45,17 +48,17 @@ const b = class b {
|
|
|
45
48
|
for (const i in this.settings)
|
|
46
49
|
if (this.settings.hasOwnProperty(i)) {
|
|
47
50
|
const n = this.settings[i];
|
|
48
|
-
n instanceof
|
|
51
|
+
n instanceof x ? e[i] = n.getValues() : e[i] = n.value;
|
|
49
52
|
}
|
|
50
53
|
return e;
|
|
51
54
|
} else {
|
|
52
55
|
const e = this.settings[t];
|
|
53
|
-
return e ? e instanceof
|
|
56
|
+
return e ? e instanceof x ? e.getValues() : e.value : void 0;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
draw() {
|
|
57
60
|
const t = document.createElement("div");
|
|
58
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
61
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, x.hiddenElements.add(t), this.hideCondition && this.hideCondition() && (t.style.display = "none"), this.isMain && t.classList.add("main-group");
|
|
59
62
|
const e = document.createElement("div");
|
|
60
63
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
61
64
|
"aria-expanded",
|
|
@@ -63,75 +66,78 @@ const b = class b {
|
|
|
63
66
|
), e.setAttribute("tabindex", "0");
|
|
64
67
|
const i = document.createElement("div");
|
|
65
68
|
if (i.className = "title-section", this.icon) {
|
|
66
|
-
const
|
|
67
|
-
|
|
69
|
+
const h = document.createElement("span");
|
|
70
|
+
h.className = "group-icon", h.innerHTML = this.icon, i.appendChild(h);
|
|
68
71
|
}
|
|
72
|
+
this.custom && t.classList.add("custom_class");
|
|
69
73
|
const n = document.createElement("h3");
|
|
70
74
|
n.textContent = this.title, i.appendChild(n);
|
|
71
75
|
const s = document.createElement("div");
|
|
72
76
|
if (s.className = "actions-section", this.description && this.isCollapsed) {
|
|
73
|
-
const
|
|
74
|
-
|
|
77
|
+
const h = document.createElement("span");
|
|
78
|
+
h.className = "info-marker", h.innerHTML = `
|
|
75
79
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
76
80
|
<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"
|
|
77
81
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
78
82
|
</svg>
|
|
79
|
-
`,
|
|
83
|
+
`, h.title = this.description, s.appendChild(h);
|
|
80
84
|
}
|
|
81
|
-
const
|
|
82
|
-
|
|
85
|
+
const a = document.createElement("span");
|
|
86
|
+
a.className = "setting-group-arrow", a.innerHTML = `
|
|
83
87
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
84
88
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
85
89
|
</svg>
|
|
86
|
-
`, this.isCollapsed &&
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
|
|
90
|
+
`, this.isCollapsed && a.classList.add("rotated"), s.appendChild(a);
|
|
91
|
+
const o = document.createElement("div");
|
|
92
|
+
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) {
|
|
93
|
+
const h = document.createElement("div");
|
|
94
|
+
h.className = "setting-group-description", h.textContent = this.description, o.appendChild(h);
|
|
91
95
|
}
|
|
92
96
|
const l = () => {
|
|
93
|
-
this.isCollapsed = !this.isCollapsed,
|
|
97
|
+
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
98
|
"aria-expanded",
|
|
95
99
|
(!this.isCollapsed).toString()
|
|
96
100
|
);
|
|
97
|
-
const
|
|
101
|
+
const h = o.querySelector(
|
|
98
102
|
".setting-group-description"
|
|
99
103
|
), u = s.querySelector(".info-marker");
|
|
100
104
|
if (this.description)
|
|
101
105
|
if (this.isCollapsed) {
|
|
102
|
-
if (
|
|
106
|
+
if (h && h.remove(), !u) {
|
|
103
107
|
const p = document.createElement("span");
|
|
104
108
|
p.className = "info-marker", p.innerHTML = `
|
|
105
109
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
106
110
|
<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
111
|
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
108
112
|
</svg>
|
|
109
|
-
`, p.title = this.description, s.insertBefore(p,
|
|
113
|
+
`, p.title = this.description, s.insertBefore(p, a);
|
|
110
114
|
}
|
|
111
115
|
} else {
|
|
112
|
-
if (!
|
|
116
|
+
if (!h) {
|
|
113
117
|
const p = document.createElement("div");
|
|
114
|
-
p.className = "setting-group-description", p.textContent = this.description,
|
|
118
|
+
p.className = "setting-group-description", p.textContent = this.description, o.insertBefore(
|
|
115
119
|
p,
|
|
116
|
-
|
|
120
|
+
o.firstChild
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
u && u.remove();
|
|
120
124
|
}
|
|
121
125
|
};
|
|
122
|
-
if (e.onclick = l, e.onkeydown = (
|
|
123
|
-
(
|
|
126
|
+
if (e.onclick = l, e.onkeydown = (h) => {
|
|
127
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), l());
|
|
124
128
|
}, Object.keys(this.settings).length > 0) {
|
|
125
|
-
for (const
|
|
126
|
-
if (this.settings.hasOwnProperty(
|
|
127
|
-
const u = this.settings[
|
|
128
|
-
|
|
129
|
+
for (const h in this.settings)
|
|
130
|
+
if (this.settings.hasOwnProperty(h)) {
|
|
131
|
+
const u = this.settings[h];
|
|
132
|
+
o.appendChild(u.draw());
|
|
129
133
|
}
|
|
130
134
|
} else {
|
|
131
|
-
const
|
|
132
|
-
|
|
135
|
+
const h = document.createElement("div");
|
|
136
|
+
h.className = "setting-group-empty", h.textContent = "No settings in this group", o.appendChild(h);
|
|
133
137
|
}
|
|
134
|
-
return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(
|
|
138
|
+
return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(o), this.elementRef = t, this.onBlur && t.addEventListener("mouseleave", () => {
|
|
139
|
+
this.onBlur && this.onBlur();
|
|
140
|
+
}), t;
|
|
135
141
|
}
|
|
136
142
|
collapse() {
|
|
137
143
|
if (!this.elementRef || this.isCollapsed) return;
|
|
@@ -158,10 +164,10 @@ const b = class b {
|
|
|
158
164
|
this.isHidden ? this.show() : this.hide();
|
|
159
165
|
}
|
|
160
166
|
};
|
|
161
|
-
|
|
162
|
-
let v =
|
|
163
|
-
function W(
|
|
164
|
-
switch (
|
|
167
|
+
x.hiddenElements = /* @__PURE__ */ new Set();
|
|
168
|
+
let v = x;
|
|
169
|
+
function W(c) {
|
|
170
|
+
switch (c) {
|
|
165
171
|
case "number":
|
|
166
172
|
return 0;
|
|
167
173
|
case "text":
|
|
@@ -195,45 +201,45 @@ class C {
|
|
|
195
201
|
t = { ...this.props.inputProps, ...t };
|
|
196
202
|
const e = document.createElement("div");
|
|
197
203
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
|
|
204
|
+
const a = document.createElement("div");
|
|
205
|
+
if (a.className = "icon-container", t.icon) {
|
|
206
|
+
const o = this.createIcon(t.icon, t.iconClassName);
|
|
207
|
+
a.appendChild(o);
|
|
202
208
|
}
|
|
203
209
|
if (t.title) {
|
|
204
|
-
const
|
|
205
|
-
|
|
210
|
+
const o = this.createLabel(t.title, t.labelClassName);
|
|
211
|
+
a.appendChild(o);
|
|
206
212
|
}
|
|
207
|
-
e.appendChild(
|
|
213
|
+
e.appendChild(a);
|
|
208
214
|
}
|
|
209
215
|
const i = document.createElement("div");
|
|
210
216
|
i.className = t.wrapperClassName || "";
|
|
211
217
|
const n = document.createElement("input");
|
|
212
218
|
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 =
|
|
219
|
+
const s = (a) => {
|
|
220
|
+
const o = a.target;
|
|
221
|
+
let l = o.value;
|
|
216
222
|
switch (t.inputType) {
|
|
217
223
|
case "number":
|
|
218
|
-
l = Number(
|
|
224
|
+
l = Number(o.value);
|
|
219
225
|
break;
|
|
220
226
|
case "color":
|
|
221
|
-
l =
|
|
227
|
+
l = o.value;
|
|
222
228
|
break;
|
|
223
229
|
case "date":
|
|
224
|
-
l =
|
|
230
|
+
l = o.value;
|
|
225
231
|
break;
|
|
226
232
|
case "select":
|
|
227
|
-
l =
|
|
233
|
+
l = o.value;
|
|
228
234
|
break;
|
|
229
235
|
case "text":
|
|
230
|
-
l =
|
|
236
|
+
l = o.value;
|
|
231
237
|
break;
|
|
232
238
|
case "button":
|
|
233
|
-
l =
|
|
239
|
+
l = o.value;
|
|
234
240
|
break;
|
|
235
241
|
default:
|
|
236
|
-
l =
|
|
242
|
+
l = o.value;
|
|
237
243
|
}
|
|
238
244
|
this.value = l, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
239
245
|
};
|
|
@@ -283,11 +289,11 @@ class S extends H {
|
|
|
283
289
|
return `${e}, ${i}, ${n}`;
|
|
284
290
|
}
|
|
285
291
|
rgbToHex(t) {
|
|
286
|
-
const [e, i, n] = t.split(",").map((
|
|
292
|
+
const [e, i, n] = t.split(",").map((a) => parseInt(a.trim()));
|
|
287
293
|
if (isNaN(e) || isNaN(i) || isNaN(n)) return "#000000";
|
|
288
|
-
const s = (
|
|
289
|
-
const
|
|
290
|
-
return
|
|
294
|
+
const s = (a) => {
|
|
295
|
+
const o = a.toString(16);
|
|
296
|
+
return o.length === 1 ? "0" + o : o;
|
|
291
297
|
};
|
|
292
298
|
return `#${s(e)}${s(i)}${s(n)}`;
|
|
293
299
|
}
|
|
@@ -300,36 +306,36 @@ class S extends H {
|
|
|
300
306
|
e.appendChild(i), e.appendChild(n);
|
|
301
307
|
const s = document.createElement("div");
|
|
302
308
|
s.className = "color-input-wrapper";
|
|
303
|
-
const
|
|
309
|
+
const a = (p) => {
|
|
304
310
|
const g = p.value.split(",").map((N) => parseInt(N.trim()));
|
|
305
311
|
if (g.length !== 3 || g.some(isNaN))
|
|
306
312
|
return p.style.border = "1px solid red", !1;
|
|
307
313
|
const [d, m, f] = g, L = d >= 0 && d <= 255 && m >= 0 && m <= 255 && f >= 0 && f <= 255;
|
|
308
314
|
return p.style.border = L ? "" : "1px solid red", L;
|
|
309
|
-
},
|
|
310
|
-
|
|
315
|
+
}, o = document.createElement("div");
|
|
316
|
+
o.className = "color-preview", o.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
311
317
|
const l = this.createInput({
|
|
312
318
|
value: this.value,
|
|
313
319
|
inputType: "text",
|
|
314
320
|
inputClassName: "color-text-input"
|
|
315
|
-
}),
|
|
321
|
+
}), r = l.querySelector("input"), h = this.createInput({
|
|
316
322
|
value: this.value ? this.rgbToHex(this.value) : "",
|
|
317
323
|
inputType: this.inputType,
|
|
318
324
|
inputClassName: "color-picker"
|
|
319
|
-
}), u =
|
|
320
|
-
return
|
|
325
|
+
}), u = h.querySelector("input");
|
|
326
|
+
return r.oninput = (p) => {
|
|
321
327
|
var d;
|
|
322
328
|
let g = p.target.value.trim();
|
|
323
|
-
|
|
329
|
+
a(r) && (this.value = g, (d = this.onChange) == null || d.call(this, g), u.value = this.rgbToHex(g), o.style.backgroundColor = `rgb(${g})`);
|
|
324
330
|
}, u.oninput = (p) => {
|
|
325
331
|
var m, f;
|
|
326
332
|
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),
|
|
333
|
+
this.value = d, (m = this.onChange) == null || m.call(this, d), (f = this.detectChange) == null || f.call(this, d), r.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
328
334
|
}, u.onchange = (p) => {
|
|
329
335
|
var m, f;
|
|
330
336
|
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),
|
|
332
|
-
}, s.appendChild(
|
|
337
|
+
this.value = d, (m = this.onChange) == null || m.call(this, d), (f = this.detectChange) == null || f.call(this, d), r.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
338
|
+
}, s.appendChild(o), s.appendChild(h), s.appendChild(l), t.appendChild(e), t.appendChild(s), this.value && (r.value = this.value, u.value = this.rgbToHex(this.value), o.style.backgroundColor = `rgb(${this.value})`), t;
|
|
333
339
|
}
|
|
334
340
|
}
|
|
335
341
|
class w extends C {
|
|
@@ -339,9 +345,9 @@ class w extends C {
|
|
|
339
345
|
draw() {
|
|
340
346
|
const t = (s) => {
|
|
341
347
|
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", () => {
|
|
342
|
-
const
|
|
348
|
+
const a = this.props.minValue ?? Number.MIN_SAFE_INTEGER, o = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
343
349
|
let l = Number(s.value);
|
|
344
|
-
l <
|
|
350
|
+
l < a && (l = a), l > o && (l = o), s.value = String(l);
|
|
345
351
|
});
|
|
346
352
|
}, e = this.createInput({
|
|
347
353
|
value: this.value,
|
|
@@ -387,7 +393,7 @@ const A = `
|
|
|
387
393
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
388
394
|
</svg>
|
|
389
395
|
`;
|
|
390
|
-
class
|
|
396
|
+
class T extends C {
|
|
391
397
|
constructor(t = {}) {
|
|
392
398
|
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) {
|
|
393
399
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -403,12 +409,12 @@ class V extends C {
|
|
|
403
409
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
404
410
|
const s = document.createElement("div");
|
|
405
411
|
if (s.className = "icon-container", this.props.icon) {
|
|
406
|
-
const
|
|
407
|
-
s.appendChild(
|
|
412
|
+
const a = this.createIcon(this.props.icon);
|
|
413
|
+
s.appendChild(a);
|
|
408
414
|
}
|
|
409
415
|
if (this.props.title) {
|
|
410
|
-
const
|
|
411
|
-
s.appendChild(
|
|
416
|
+
const a = this.createLabel(this.props.title);
|
|
417
|
+
s.appendChild(a);
|
|
412
418
|
}
|
|
413
419
|
t.appendChild(s);
|
|
414
420
|
} else {
|
|
@@ -417,13 +423,13 @@ class V extends C {
|
|
|
417
423
|
}
|
|
418
424
|
const e = document.createElement("div");
|
|
419
425
|
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 = () => {
|
|
420
|
-
var s,
|
|
421
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
426
|
+
var s, a;
|
|
427
|
+
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));
|
|
422
428
|
}, t.appendChild(e), this.buttonEl = e;
|
|
423
429
|
const i = document.createElement("ul");
|
|
424
|
-
i.classList.add("select-options"), this._options.forEach((s,
|
|
425
|
-
const
|
|
426
|
-
|
|
430
|
+
i.classList.add("select-options"), this._options.forEach((s, a) => {
|
|
431
|
+
const o = this.createOption(s, a);
|
|
432
|
+
o.onclick = (l) => this.selectOption(l, a, e), i.appendChild(o);
|
|
427
433
|
}), t.appendChild(i);
|
|
428
434
|
const n = document.createElement("div");
|
|
429
435
|
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) => {
|
|
@@ -431,15 +437,15 @@ class V extends C {
|
|
|
431
437
|
}).catch((s) => {
|
|
432
438
|
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
433
439
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (s) => {
|
|
434
|
-
var
|
|
435
|
-
this.isOpen && !t.contains(s.target) && (this.isOpen = !1, (
|
|
440
|
+
var a, o;
|
|
441
|
+
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"));
|
|
436
442
|
}, document.addEventListener("click", this.clickOutsideListener), t;
|
|
437
443
|
}
|
|
438
444
|
selectOption(t, e, i) {
|
|
439
|
-
var s,
|
|
445
|
+
var s, a, o;
|
|
440
446
|
const n = this._options[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, (
|
|
442
|
-
|
|
447
|
+
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((r, h) => {
|
|
448
|
+
h === e ? r.classList.add("selected") : r.classList.remove("selected");
|
|
443
449
|
}));
|
|
444
450
|
}
|
|
445
451
|
updateOptionsList() {
|
|
@@ -516,11 +522,11 @@ class _ extends C {
|
|
|
516
522
|
`
|
|
517
523
|
}
|
|
518
524
|
].forEach((s) => {
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
var
|
|
522
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
523
|
-
}), i.appendChild(
|
|
525
|
+
const a = document.createElement("button");
|
|
526
|
+
a.className = "align-option-button", a.innerHTML = s.icon, this.value === s.name && a.classList.add("selected"), a.addEventListener("click", () => {
|
|
527
|
+
var o;
|
|
528
|
+
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);
|
|
529
|
+
}), i.appendChild(a);
|
|
524
530
|
}), t.appendChild(i), t;
|
|
525
531
|
}
|
|
526
532
|
}
|
|
@@ -537,7 +543,7 @@ class nt extends C {
|
|
|
537
543
|
return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
|
|
538
544
|
}
|
|
539
545
|
}
|
|
540
|
-
class
|
|
546
|
+
class at extends C {
|
|
541
547
|
constructor(t = {}) {
|
|
542
548
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
543
549
|
const e = t.width || 100, i = t.height || 100;
|
|
@@ -625,8 +631,8 @@ class ot extends C {
|
|
|
625
631
|
return s.className = "dimension-lock-icon", s.setAttribute("type", "button"), s.setAttribute("aria-pressed", String(this.locked)), s.setAttribute(
|
|
626
632
|
"aria-label",
|
|
627
633
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
628
|
-
), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (
|
|
629
|
-
|
|
634
|
+
), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (a) => {
|
|
635
|
+
a.preventDefault(), this.toggleLock(s);
|
|
630
636
|
}, n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
|
|
631
637
|
}
|
|
632
638
|
isLocked() {
|
|
@@ -657,7 +663,7 @@ const j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
657
663
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
658
664
|
<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"/>
|
|
659
665
|
</svg>
|
|
660
|
-
`,
|
|
666
|
+
`, V = `
|
|
661
667
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
662
668
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
663
669
|
<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"/>
|
|
@@ -689,44 +695,44 @@ class F extends C {
|
|
|
689
695
|
t.className = "upload-setting-wrapper";
|
|
690
696
|
const e = !!(this.props.title || this.props.icon);
|
|
691
697
|
if (e || t.classList.add("no-label"), e) {
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
const
|
|
695
|
-
|
|
698
|
+
const r = document.createElement("div");
|
|
699
|
+
if (r.className = "icon-title-container", this.props.icon) {
|
|
700
|
+
const h = this.createIcon(this.props.icon);
|
|
701
|
+
r.appendChild(h);
|
|
696
702
|
}
|
|
697
703
|
if (this.props.title) {
|
|
698
|
-
const
|
|
699
|
-
|
|
704
|
+
const h = this.createLabel(this.props.title);
|
|
705
|
+
r.appendChild(h);
|
|
700
706
|
}
|
|
701
|
-
t.appendChild(
|
|
707
|
+
t.appendChild(r);
|
|
702
708
|
}
|
|
703
709
|
const i = document.createElement("div");
|
|
704
710
|
i.className = "preview-button-container";
|
|
705
711
|
const n = this.value && this.value !== "";
|
|
706
712
|
n || i.classList.add("no-image");
|
|
707
713
|
const s = document.createElement("div");
|
|
708
|
-
s.className = "preview-placeholder", s.innerHTML =
|
|
709
|
-
const o = document.createElement("button");
|
|
710
|
-
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);
|
|
714
|
+
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";
|
|
711
715
|
const a = document.createElement("button");
|
|
712
|
-
a.className = "
|
|
716
|
+
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);
|
|
717
|
+
const o = document.createElement("button");
|
|
718
|
+
o.className = "upload-button", o.innerHTML = `
|
|
713
719
|
<span class="upload-icon">${y}</span>
|
|
714
720
|
<span class="upload-label">Upload</span>
|
|
715
721
|
`;
|
|
716
722
|
const l = document.createElement("input");
|
|
717
|
-
return l.type = "file", l.accept = "image/*", l.style.display = "none", i.appendChild(s), i.appendChild(this.previewWrapper), i.appendChild(
|
|
718
|
-
var
|
|
719
|
-
|
|
720
|
-
},
|
|
723
|
+
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 = (r) => {
|
|
724
|
+
var h;
|
|
725
|
+
r.stopPropagation(), this.value = "", this.updatePreviewState(null), (h = this.onChange) == null || h.call(this, "");
|
|
726
|
+
}, o.onclick = () => {
|
|
721
727
|
l.click();
|
|
722
728
|
}, l.onchange = async () => {
|
|
723
|
-
var
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
729
|
+
var h, u, p;
|
|
730
|
+
const r = (h = l.files) == null ? void 0 : h[0];
|
|
731
|
+
if (r)
|
|
726
732
|
try {
|
|
727
|
-
|
|
733
|
+
o.classList.add("loading"), o.disabled = !0;
|
|
728
734
|
const g = new FormData(), d = this.props.formFieldName || "file";
|
|
729
|
-
g.append(d,
|
|
735
|
+
g.append(d, r, r.name);
|
|
730
736
|
const m = this.props.uploadUrl;
|
|
731
737
|
if (!m)
|
|
732
738
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
@@ -735,23 +741,23 @@ class F extends C {
|
|
|
735
741
|
body: g,
|
|
736
742
|
headers: L
|
|
737
743
|
})).json();
|
|
738
|
-
let
|
|
744
|
+
let b;
|
|
739
745
|
if (this.props.parseResponse)
|
|
740
|
-
|
|
741
|
-
else if (
|
|
746
|
+
b = this.props.parseResponse(E);
|
|
747
|
+
else if (b = (u = E == null ? void 0 : E.data) == null ? void 0 : u.url, !b)
|
|
742
748
|
throw new Error(
|
|
743
749
|
"No URL found in response. Provide a parseResponse if needed."
|
|
744
750
|
);
|
|
745
|
-
this.value =
|
|
751
|
+
this.value = b, this.updatePreviewState(b), (p = this.onChange) == null || p.call(this, b);
|
|
746
752
|
} catch (g) {
|
|
747
753
|
console.error("Error uploading file:", g), this.updatePreviewState(null);
|
|
748
754
|
} finally {
|
|
749
|
-
|
|
755
|
+
o.classList.remove("loading"), o.disabled = !1;
|
|
750
756
|
}
|
|
751
757
|
}, t;
|
|
752
758
|
}
|
|
753
759
|
}
|
|
754
|
-
class
|
|
760
|
+
class ot extends C {
|
|
755
761
|
constructor(t = {}) {
|
|
756
762
|
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
|
|
757
763
|
title: "Height",
|
|
@@ -797,7 +803,7 @@ const U = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
797
803
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
798
804
|
</svg>
|
|
799
805
|
`;
|
|
800
|
-
class
|
|
806
|
+
class ht extends C {
|
|
801
807
|
constructor(t = {}) {
|
|
802
808
|
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(
|
|
803
809
|
(e) => JSON.stringify(e.value) === JSON.stringify(t.default)
|
|
@@ -822,34 +828,34 @@ class rt extends C {
|
|
|
822
828
|
e.classList.add("has-label");
|
|
823
829
|
const s = document.createElement("div");
|
|
824
830
|
s.className = "select-label", s.textContent = this.props.title, e.appendChild(s);
|
|
825
|
-
const
|
|
826
|
-
|
|
831
|
+
const a = document.createElement("span");
|
|
832
|
+
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);
|
|
827
833
|
} else {
|
|
828
834
|
const s = document.createElement("span");
|
|
829
835
|
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);
|
|
830
836
|
}
|
|
831
837
|
e.onclick = () => {
|
|
832
|
-
var s,
|
|
833
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
838
|
+
var s, a;
|
|
839
|
+
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));
|
|
834
840
|
}, t.appendChild(e), this.buttonEl = e;
|
|
835
841
|
const i = document.createElement("ul");
|
|
836
|
-
i.classList.add("select-api-options"), this._options.forEach((s,
|
|
837
|
-
const
|
|
838
|
-
|
|
842
|
+
i.classList.add("select-api-options"), this._options.forEach((s, a) => {
|
|
843
|
+
const o = this.createOption(s, a);
|
|
844
|
+
o.onclick = (l) => this.selectApiOption(l, a, e), i.appendChild(o);
|
|
839
845
|
}), t.appendChild(i);
|
|
840
846
|
const n = document.createElement("div");
|
|
841
847
|
return n.classList.add("svg-container"), n.innerHTML = D, t.appendChild(n), n.onclick = () => {
|
|
842
|
-
var s,
|
|
843
|
-
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (
|
|
848
|
+
var s, a;
|
|
849
|
+
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));
|
|
844
850
|
}, this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
845
851
|
this._options.push(...s), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
846
|
-
(
|
|
852
|
+
(a) => JSON.stringify(a.value) === JSON.stringify(this.value)
|
|
847
853
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
848
854
|
}).catch((s) => {
|
|
849
855
|
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
850
856
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
851
|
-
const
|
|
852
|
-
this._options.push(...
|
|
857
|
+
const a = new Set(this._options.map((l) => JSON.stringify(l.value))), o = s.filter((l) => !a.has(JSON.stringify(l.value)));
|
|
858
|
+
this._options.push(...o), this.isLoading = !1, this.value !== void 0 && this.selectedOptionIndex === null && (this.selectedOptionIndex = this._options.findIndex(
|
|
853
859
|
(l) => JSON.stringify(l.value) === JSON.stringify(this.value)
|
|
854
860
|
)), this.updateOptionsList(), this.updateButtonText();
|
|
855
861
|
}).catch((s) => {
|
|
@@ -857,14 +863,14 @@ class rt extends C {
|
|
|
857
863
|
})), t;
|
|
858
864
|
}
|
|
859
865
|
selectApiOption(t, e, i) {
|
|
860
|
-
var s,
|
|
866
|
+
var s, a;
|
|
861
867
|
const n = this._options[e];
|
|
862
868
|
if (n) {
|
|
863
|
-
const
|
|
864
|
-
this.value =
|
|
869
|
+
const o = n.value;
|
|
870
|
+
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(
|
|
865
871
|
".select-api-radio"
|
|
866
|
-
).forEach((
|
|
867
|
-
|
|
872
|
+
).forEach((r, h) => {
|
|
873
|
+
r.checked = h === e;
|
|
868
874
|
});
|
|
869
875
|
}
|
|
870
876
|
}
|
|
@@ -890,17 +896,17 @@ class rt extends C {
|
|
|
890
896
|
const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"), n = this.buttonEl.querySelector(".select-label");
|
|
891
897
|
if (this.isLoading) {
|
|
892
898
|
this.buttonEl.classList.add("loading");
|
|
893
|
-
const
|
|
899
|
+
const a = this.props.loadingText || "Loading options...";
|
|
894
900
|
if (e)
|
|
895
|
-
e.textContent =
|
|
901
|
+
e.textContent = a;
|
|
896
902
|
else if (i && this.props.title && !n) {
|
|
897
903
|
this.buttonEl.innerHTML = "";
|
|
898
|
-
const
|
|
899
|
-
|
|
904
|
+
const o = document.createElement("div");
|
|
905
|
+
o.className = "select-label", o.textContent = this.props.title, this.buttonEl.appendChild(o);
|
|
900
906
|
const l = document.createElement("span");
|
|
901
|
-
l.className = "select-value", l.textContent =
|
|
907
|
+
l.className = "select-value", l.textContent = a, this.buttonEl.appendChild(l);
|
|
902
908
|
} else
|
|
903
|
-
this.buttonEl.textContent =
|
|
909
|
+
this.buttonEl.textContent = a;
|
|
904
910
|
return;
|
|
905
911
|
}
|
|
906
912
|
this.buttonEl.classList.remove("loading", "error");
|
|
@@ -909,10 +915,10 @@ class rt extends C {
|
|
|
909
915
|
e.textContent = s;
|
|
910
916
|
else if (i && this.props.title && !n) {
|
|
911
917
|
this.buttonEl.innerHTML = "";
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
918
|
+
const a = document.createElement("div");
|
|
919
|
+
a.className = "select-label", a.textContent = this.props.title, this.buttonEl.appendChild(a);
|
|
920
|
+
const o = document.createElement("span");
|
|
921
|
+
o.className = "select-value", o.textContent = s, this.buttonEl.appendChild(o);
|
|
916
922
|
} else
|
|
917
923
|
this.buttonEl.textContent = s;
|
|
918
924
|
}
|
|
@@ -920,7 +926,7 @@ class rt extends C {
|
|
|
920
926
|
this.detectChangeCallback = t;
|
|
921
927
|
}
|
|
922
928
|
}
|
|
923
|
-
class
|
|
929
|
+
class rt extends C {
|
|
924
930
|
constructor(t) {
|
|
925
931
|
super(t), this.inputType = "text", this.value = t.default ?? !1;
|
|
926
932
|
}
|
|
@@ -929,12 +935,12 @@ class ht extends C {
|
|
|
929
935
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
930
936
|
const e = document.createElement("div");
|
|
931
937
|
if (e.className = "toggle-label", this.props.icon) {
|
|
932
|
-
const
|
|
933
|
-
|
|
938
|
+
const a = document.createElement("span");
|
|
939
|
+
a.className = "toggle-icon", a.innerHTML = this.props.icon, e.appendChild(a);
|
|
934
940
|
}
|
|
935
941
|
if (this.props.title) {
|
|
936
|
-
const
|
|
937
|
-
|
|
942
|
+
const a = document.createElement("span");
|
|
943
|
+
a.textContent = this.props.title, e.appendChild(a);
|
|
938
944
|
}
|
|
939
945
|
t.appendChild(e);
|
|
940
946
|
const i = document.createElement("label");
|
|
@@ -988,9 +994,9 @@ class ct extends C {
|
|
|
988
994
|
n.classList.add("gap-label-container");
|
|
989
995
|
const s = document.createElement("div");
|
|
990
996
|
s.classList.add("gap-setting-icon"), s.innerHTML = this.props.icon || Z, n.appendChild(s);
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
const
|
|
997
|
+
const a = document.createElement("label");
|
|
998
|
+
a.classList.add("gap-input-label"), a.textContent = t, n.appendChild(a), i.appendChild(n);
|
|
999
|
+
const o = (u) => {
|
|
994
1000
|
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", () => {
|
|
995
1001
|
var m;
|
|
996
1002
|
const p = this.props.minValue ?? 0, g = this.props.maxValue ?? 100;
|
|
@@ -1002,15 +1008,56 @@ class ct extends C {
|
|
|
1002
1008
|
inputType: this.inputType,
|
|
1003
1009
|
inputClassName: "gap-setting-input " + (this.props.inputClassName || ""),
|
|
1004
1010
|
wrapperClassName: "gap-setting-inner-wrapper " + (this.props.wrapperClassName || ""),
|
|
1005
|
-
inputCustomizer:
|
|
1011
|
+
inputCustomizer: o
|
|
1006
1012
|
});
|
|
1007
1013
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
1008
1014
|
return i.appendChild(l), i;
|
|
1009
1015
|
l.classList.add("suffix-wrapper");
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
return
|
|
1016
|
+
const r = l.querySelector("input.gap-setting-input");
|
|
1017
|
+
r && (r.style.paddingRight = "35px");
|
|
1018
|
+
const h = document.createElement("span");
|
|
1019
|
+
return h.className = "suffix-label", h.textContent = this.props.suffix, l.appendChild(h), i.appendChild(l), i;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
class dt extends C {
|
|
1023
|
+
constructor(t) {
|
|
1024
|
+
var e;
|
|
1025
|
+
if (!t.tabs)
|
|
1026
|
+
throw new Error("Tabs array is required for TabsSettings");
|
|
1027
|
+
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);
|
|
1028
|
+
}
|
|
1029
|
+
draw() {
|
|
1030
|
+
const t = document.createElement("div");
|
|
1031
|
+
t.classList.add("tabs-settings-container"), this.props.className && t.classList.add(this.props.className);
|
|
1032
|
+
const e = document.createElement("div");
|
|
1033
|
+
e.classList.add("tabs-header"), this.tabsContainer = e, this.tabs.forEach((n) => {
|
|
1034
|
+
const s = document.createElement("button");
|
|
1035
|
+
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);
|
|
1036
|
+
}), t.appendChild(e);
|
|
1037
|
+
const i = document.createElement("div");
|
|
1038
|
+
return i.classList.add("tab-content"), this.contentContainer = i, this.tabs.forEach((n) => {
|
|
1039
|
+
const s = document.createElement("div");
|
|
1040
|
+
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);
|
|
1041
|
+
}), t.appendChild(i), t;
|
|
1042
|
+
}
|
|
1043
|
+
handleTabClick(t) {
|
|
1044
|
+
var i, n;
|
|
1045
|
+
if (t === this.activeTabId) return;
|
|
1046
|
+
this.previousTabId = this.activeTabId, this.activeTabId = t;
|
|
1047
|
+
const e = (i = this.tabsContainer) == null ? void 0 : i.querySelectorAll(".tab-button");
|
|
1048
|
+
if (e == null || e.forEach((s) => {
|
|
1049
|
+
var a;
|
|
1050
|
+
s instanceof HTMLElement && s.classList.toggle("active", s.textContent === ((a = this.tabs.find((o) => o.id === t)) == null ? void 0 : a.label));
|
|
1051
|
+
}), this.contentContainer) {
|
|
1052
|
+
const s = this.contentContainer.querySelectorAll(".tab-panel"), a = this.tabs.findIndex((l) => l.id === this.previousTabId), o = this.tabs.findIndex((l) => l.id === t);
|
|
1053
|
+
s.forEach((l, r) => {
|
|
1054
|
+
l instanceof HTMLElement && (r === o ? (l.classList.add("active"), l.classList.remove("slide-left", "slide-right")) : r === a ? (l.classList.remove("active"), l.classList.add(o > a ? "slide-left" : "slide-right")) : l.classList.remove("active", "slide-left", "slide-right"));
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
(n = this.onChangeCallback) == null || n.call(this, t);
|
|
1058
|
+
}
|
|
1059
|
+
setOnChange(t) {
|
|
1060
|
+
return this.onChangeCallback = t, this;
|
|
1014
1061
|
}
|
|
1015
1062
|
}
|
|
1016
1063
|
const J = `
|
|
@@ -1022,7 +1069,7 @@ const J = `
|
|
|
1022
1069
|
<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"/>
|
|
1023
1070
|
</svg>
|
|
1024
1071
|
`;
|
|
1025
|
-
class
|
|
1072
|
+
class pt extends v {
|
|
1026
1073
|
constructor(t) {
|
|
1027
1074
|
super({
|
|
1028
1075
|
title: "Border",
|
|
@@ -1078,7 +1125,7 @@ const X = `
|
|
|
1078
1125
|
<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"/>
|
|
1079
1126
|
</svg>
|
|
1080
1127
|
`;
|
|
1081
|
-
class
|
|
1128
|
+
class ut extends v {
|
|
1082
1129
|
constructor(t = {}) {
|
|
1083
1130
|
super({
|
|
1084
1131
|
title: t.title || "Typography",
|
|
@@ -1091,7 +1138,7 @@ class pt extends v {
|
|
|
1091
1138
|
opacity: new M({
|
|
1092
1139
|
default: t.colorOpacityDefault ?? 100
|
|
1093
1140
|
}),
|
|
1094
|
-
fontFamily: new
|
|
1141
|
+
fontFamily: new T({
|
|
1095
1142
|
title: "Font",
|
|
1096
1143
|
icon: X,
|
|
1097
1144
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
@@ -1103,7 +1150,7 @@ class pt extends v {
|
|
|
1103
1150
|
getOptions: t.fontFamilyGetOptions,
|
|
1104
1151
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
1105
1152
|
}),
|
|
1106
|
-
fontWeight: new
|
|
1153
|
+
fontWeight: new T({
|
|
1107
1154
|
title: "Weight",
|
|
1108
1155
|
icon: Q,
|
|
1109
1156
|
default: t.fontWeightDefault ?? "400",
|
|
@@ -1129,14 +1176,14 @@ class pt extends v {
|
|
|
1129
1176
|
});
|
|
1130
1177
|
}
|
|
1131
1178
|
getCssCode() {
|
|
1132
|
-
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,
|
|
1179
|
+
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";
|
|
1133
1180
|
return `
|
|
1134
1181
|
color: ${t};
|
|
1135
1182
|
opacity: ${e / 100};
|
|
1136
1183
|
font-family: ${i};
|
|
1137
1184
|
font-weight: ${n};
|
|
1138
1185
|
font-size: ${s}px;
|
|
1139
|
-
text-align: ${
|
|
1186
|
+
text-align: ${a};
|
|
1140
1187
|
`;
|
|
1141
1188
|
}
|
|
1142
1189
|
}
|
|
@@ -1148,11 +1195,11 @@ class k extends C {
|
|
|
1148
1195
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
1149
1196
|
}
|
|
1150
1197
|
draw() {
|
|
1151
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
1152
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
1153
|
-
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER,
|
|
1154
|
-
let
|
|
1155
|
-
|
|
1198
|
+
const t = this.value === "auto" ? "text" : "number", e = (o) => {
|
|
1199
|
+
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", () => {
|
|
1200
|
+
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1201
|
+
let h = Number(o.value);
|
|
1202
|
+
h < l && (h = l), h > r && (h = r), o.value = String(h);
|
|
1156
1203
|
}));
|
|
1157
1204
|
}, i = this.createInput({
|
|
1158
1205
|
value: this.value,
|
|
@@ -1173,20 +1220,20 @@ class k extends C {
|
|
|
1173
1220
|
n && (n.style.paddingRight = "35px");
|
|
1174
1221
|
const s = document.createElement("span");
|
|
1175
1222
|
s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
|
|
1176
|
-
const
|
|
1177
|
-
return
|
|
1178
|
-
const l =
|
|
1223
|
+
const a = i.querySelector("input");
|
|
1224
|
+
return a && (a.oninput = (o) => {
|
|
1225
|
+
const l = o.target.value.trim();
|
|
1179
1226
|
if (l.toLowerCase() === "auto")
|
|
1180
1227
|
this.value = "auto";
|
|
1181
1228
|
else {
|
|
1182
|
-
const
|
|
1183
|
-
isNaN(
|
|
1229
|
+
const r = Number(l);
|
|
1230
|
+
isNaN(r) || (this.value = r);
|
|
1184
1231
|
}
|
|
1185
1232
|
this.onChange && this.onChange(this.value);
|
|
1186
1233
|
}), i;
|
|
1187
1234
|
}
|
|
1188
1235
|
}
|
|
1189
|
-
class
|
|
1236
|
+
class gt extends v {
|
|
1190
1237
|
constructor(t) {
|
|
1191
1238
|
super({
|
|
1192
1239
|
title: "Margins",
|
|
@@ -1274,16 +1321,16 @@ class st extends v {
|
|
|
1274
1321
|
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
|
|
1275
1322
|
</svg>
|
|
1276
1323
|
`, s.onclick = () => {
|
|
1277
|
-
var
|
|
1278
|
-
return (
|
|
1324
|
+
var o;
|
|
1325
|
+
return (o = this.onDeleteCallback) == null ? void 0 : o.call(this);
|
|
1279
1326
|
}, n.appendChild(s);
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1327
|
+
const a = i.querySelector("h3");
|
|
1328
|
+
a ? a.insertAdjacentElement("afterend", n) : i.appendChild(n);
|
|
1282
1329
|
}
|
|
1283
1330
|
return t;
|
|
1284
1331
|
}
|
|
1285
1332
|
}
|
|
1286
|
-
class
|
|
1333
|
+
class mt extends v {
|
|
1287
1334
|
// Store the rendered element
|
|
1288
1335
|
constructor(t) {
|
|
1289
1336
|
super({
|
|
@@ -1352,7 +1399,7 @@ class gt extends v {
|
|
|
1352
1399
|
}));
|
|
1353
1400
|
}
|
|
1354
1401
|
}
|
|
1355
|
-
class
|
|
1402
|
+
class Ct extends v {
|
|
1356
1403
|
/**
|
|
1357
1404
|
* Constructs a new BackgroundSettingSet.
|
|
1358
1405
|
*
|
|
@@ -1405,10 +1452,10 @@ class mt extends v {
|
|
|
1405
1452
|
draw() {
|
|
1406
1453
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
1407
1454
|
if (!e) return t;
|
|
1408
|
-
const i = Array.from(e.children), [n, s,
|
|
1455
|
+
const i = Array.from(e.children), [n, s, a, o] = i;
|
|
1409
1456
|
e.innerHTML = "", e.appendChild(n), e.appendChild(s);
|
|
1410
1457
|
const l = document.createElement("div");
|
|
1411
|
-
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(
|
|
1458
|
+
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(a), e.appendChild(o), t;
|
|
1412
1459
|
}
|
|
1413
1460
|
/**
|
|
1414
1461
|
* Helper method to generate CSS based on the current settings.
|
|
@@ -1428,25 +1475,26 @@ class mt extends v {
|
|
|
1428
1475
|
}
|
|
1429
1476
|
export {
|
|
1430
1477
|
_ as AlignSetting,
|
|
1431
|
-
|
|
1432
|
-
|
|
1478
|
+
Ct as BackgroundSettingSet,
|
|
1479
|
+
pt as BorderSettingSet,
|
|
1433
1480
|
nt as ButtonSetting,
|
|
1434
1481
|
S as ColorSetting,
|
|
1435
|
-
|
|
1482
|
+
at as DimensionSetting,
|
|
1436
1483
|
ct as GapSetting,
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1484
|
+
ut as HeaderTypographySettingSet,
|
|
1485
|
+
ot as HeightSetting,
|
|
1486
|
+
gt as MarginSettingGroup,
|
|
1440
1487
|
w as NumberSetting,
|
|
1441
1488
|
M as OpacitySetting,
|
|
1442
|
-
|
|
1443
|
-
|
|
1489
|
+
ht as SelectApiSettings,
|
|
1490
|
+
T as SelectSetting,
|
|
1444
1491
|
C as Setting,
|
|
1445
1492
|
v as SettingGroup,
|
|
1446
1493
|
H as StringSetting,
|
|
1447
|
-
|
|
1448
|
-
|
|
1494
|
+
mt as TabsContainerGroup,
|
|
1495
|
+
dt as TabsSettings,
|
|
1496
|
+
rt as Toggle,
|
|
1449
1497
|
F as UploadSetting,
|
|
1450
1498
|
lt as WidthSetting,
|
|
1451
|
-
|
|
1499
|
+
R as iterateSettings
|
|
1452
1500
|
};
|