builder-settings-types 0.0.76 → 0.0.78
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/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +56 -48
- package/dist/builder-settings-types.es.js +533 -294
- package/dist/colors.svg +3 -3
- package/dist/index.css +1 -1
- package/dist/index.d.ts +61 -5
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/package.json +36 -36
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const I = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let V = (h = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
|
+
for (; h--; )
|
|
5
|
+
t += I[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
for (const e in
|
|
10
|
-
if (
|
|
11
|
-
const i =
|
|
8
|
+
function R(h, t) {
|
|
9
|
+
for (const e in h)
|
|
10
|
+
if (h.hasOwnProperty(e)) {
|
|
11
|
+
const i = h[e];
|
|
12
12
|
t(e, i);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
class C {
|
|
16
|
+
// Store reference to the rendered element
|
|
16
17
|
constructor(t) {
|
|
17
|
-
this.id = t.id ||
|
|
18
|
+
this.elementRef = null, this.id = t.id || V(), 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, Object.assign(this, t.settings);
|
|
18
19
|
}
|
|
19
20
|
setOnChange(t) {
|
|
20
|
-
return this.onChange = t,
|
|
21
|
+
return this.onChange = t, R(this.settings, (e, i) => {
|
|
21
22
|
i.setOnChange(t);
|
|
22
23
|
}), this;
|
|
23
24
|
}
|
|
@@ -39,33 +40,121 @@ class C {
|
|
|
39
40
|
return e ? e instanceof C ? e.getValues() : e.value : void 0;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
// Update the draw method to match the new styling requirements
|
|
42
44
|
draw() {
|
|
43
45
|
const t = document.createElement("div");
|
|
44
|
-
t.className = "setting-group";
|
|
46
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, this.isMain && t.classList.add("main-group");
|
|
45
47
|
const e = document.createElement("div");
|
|
46
|
-
e.className = "setting-group-title"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
49
|
+
"aria-expanded",
|
|
50
|
+
(!this.isCollapsed).toString()
|
|
51
|
+
), e.setAttribute("tabindex", "0");
|
|
52
|
+
const i = document.createElement("div");
|
|
53
|
+
if (i.className = "title-section", this.icon) {
|
|
54
|
+
const l = document.createElement("span");
|
|
55
|
+
l.className = "group-icon", l.innerHTML = this.icon, i.appendChild(l);
|
|
56
|
+
}
|
|
57
|
+
const n = document.createElement("h3");
|
|
58
|
+
n.textContent = this.title, i.appendChild(n);
|
|
55
59
|
const s = document.createElement("div");
|
|
56
|
-
s.className = "
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
if (s.className = "actions-section", this.description && this.isCollapsed) {
|
|
61
|
+
const l = document.createElement("span");
|
|
62
|
+
l.className = "info-marker", l.innerHTML = `
|
|
63
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
64
|
+
<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"
|
|
65
|
+
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
66
|
+
</svg>
|
|
67
|
+
`, l.title = this.description, s.appendChild(l);
|
|
68
|
+
}
|
|
69
|
+
const o = document.createElement("span");
|
|
70
|
+
o.className = "setting-group-arrow", o.innerHTML = `
|
|
71
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
72
|
+
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
73
|
+
</svg>
|
|
74
|
+
`, this.isCollapsed && o.classList.add("rotated"), s.appendChild(o);
|
|
75
|
+
const a = document.createElement("div");
|
|
76
|
+
if (a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content"), this.description && !this.isCollapsed) {
|
|
77
|
+
const l = document.createElement("div");
|
|
78
|
+
l.className = "setting-group-description", l.textContent = this.description, a.appendChild(l);
|
|
79
|
+
}
|
|
80
|
+
const r = () => {
|
|
81
|
+
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
82
|
+
"aria-expanded",
|
|
83
|
+
(!this.isCollapsed).toString()
|
|
84
|
+
);
|
|
85
|
+
const l = a.querySelector(
|
|
86
|
+
".setting-group-description"
|
|
87
|
+
), u = s.querySelector(".info-marker");
|
|
88
|
+
if (this.description)
|
|
89
|
+
if (this.isCollapsed) {
|
|
90
|
+
if (l && l.remove(), !u) {
|
|
91
|
+
const d = document.createElement("span");
|
|
92
|
+
d.className = "info-marker", d.innerHTML = `
|
|
93
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
94
|
+
<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"
|
|
95
|
+
stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
96
|
+
</svg>
|
|
97
|
+
`, d.title = this.description, s.insertBefore(d, o);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
if (!l) {
|
|
101
|
+
const d = document.createElement("div");
|
|
102
|
+
d.className = "setting-group-description", d.textContent = this.description, a.insertBefore(
|
|
103
|
+
d,
|
|
104
|
+
a.firstChild
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
u && u.remove();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
if (e.onclick = r, e.onkeydown = (l) => {
|
|
111
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), r());
|
|
112
|
+
}, Object.keys(this.settings).length > 0) {
|
|
113
|
+
for (const l in this.settings)
|
|
114
|
+
if (this.settings.hasOwnProperty(l)) {
|
|
115
|
+
const u = this.settings[l];
|
|
116
|
+
a.appendChild(u.draw());
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
const l = document.createElement("div");
|
|
120
|
+
l.className = "setting-group-empty", l.textContent = "No settings in this group", a.appendChild(l);
|
|
121
|
+
}
|
|
122
|
+
return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(a), this.elementRef = t, t;
|
|
123
|
+
}
|
|
124
|
+
// Add helper methods for controlling the group programmatically
|
|
125
|
+
/**
|
|
126
|
+
* Collapse the setting group
|
|
127
|
+
*/
|
|
128
|
+
collapse() {
|
|
129
|
+
if (!this.elementRef || this.isCollapsed) return;
|
|
130
|
+
const t = this.elementRef.querySelector(
|
|
131
|
+
".setting-group-content"
|
|
132
|
+
), e = this.elementRef.querySelector(".setting-group-arrow"), i = this.elementRef.querySelector(
|
|
133
|
+
".setting-group-title"
|
|
134
|
+
);
|
|
135
|
+
t && e && i && (this.isCollapsed = !0, t.classList.add("collapsed"), e.classList.add("rotated"), i.setAttribute("aria-expanded", "false"));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Expand the setting group
|
|
139
|
+
*/
|
|
140
|
+
expand() {
|
|
141
|
+
if (!this.elementRef || !this.isCollapsed) return;
|
|
142
|
+
const t = this.elementRef.querySelector(
|
|
143
|
+
".setting-group-content"
|
|
144
|
+
), e = this.elementRef.querySelector(".setting-group-arrow"), i = this.elementRef.querySelector(
|
|
145
|
+
".setting-group-title"
|
|
146
|
+
);
|
|
147
|
+
t && e && i && (this.isCollapsed = !1, t.classList.remove("collapsed"), e.classList.remove("rotated"), i.setAttribute("aria-expanded", "true"));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Toggle the collapsed state
|
|
151
|
+
*/
|
|
152
|
+
toggle() {
|
|
153
|
+
this.isCollapsed ? this.expand() : this.collapse();
|
|
65
154
|
}
|
|
66
155
|
}
|
|
67
|
-
function
|
|
68
|
-
switch (
|
|
156
|
+
function B(h) {
|
|
157
|
+
switch (h) {
|
|
69
158
|
case "number":
|
|
70
159
|
return 0;
|
|
71
160
|
case "text":
|
|
@@ -82,9 +171,12 @@ function O(r) {
|
|
|
82
171
|
return "";
|
|
83
172
|
}
|
|
84
173
|
}
|
|
85
|
-
class
|
|
174
|
+
class m {
|
|
86
175
|
constructor(t = {}) {
|
|
87
|
-
this.props = t, this.id = t.id ||
|
|
176
|
+
this.props = t, this.id = t.id || V(), this.value = this.props.default, this.title = t.title || "";
|
|
177
|
+
}
|
|
178
|
+
destroy() {
|
|
179
|
+
throw new Error("Method not implemented.");
|
|
88
180
|
}
|
|
89
181
|
setOnChange(t) {
|
|
90
182
|
return this.onChange = t, this;
|
|
@@ -110,7 +202,7 @@ class u {
|
|
|
110
202
|
const i = document.createElement("div");
|
|
111
203
|
i.className = t.wrapperClassName || "";
|
|
112
204
|
const n = document.createElement("input");
|
|
113
|
-
return this.inputEl = n, n.value = String(t.value ||
|
|
205
|
+
return this.inputEl = n, n.value = String(t.value || B(t.inputType)), n.type = t.inputType, n.placeholder = t.placeholder || "", n.className = t.inputClassName || "", n.oninput = (s) => {
|
|
114
206
|
const o = s.target;
|
|
115
207
|
let a = o.value;
|
|
116
208
|
t.inputType === "number" ? a = Number(o.value) : (t.inputType === "color" || t.inputType === "date") && (a = o.value), this.value = a, this.onChange && this.onChange(this.value);
|
|
@@ -125,7 +217,7 @@ class u {
|
|
|
125
217
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
126
218
|
}
|
|
127
219
|
}
|
|
128
|
-
class y extends
|
|
220
|
+
class y extends m {
|
|
129
221
|
constructor(t = {}) {
|
|
130
222
|
super(t), this.inputType = "text";
|
|
131
223
|
}
|
|
@@ -145,12 +237,12 @@ class y extends u {
|
|
|
145
237
|
});
|
|
146
238
|
}
|
|
147
239
|
}
|
|
148
|
-
const
|
|
149
|
-
class
|
|
240
|
+
const N = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
241
|
+
class H extends y {
|
|
150
242
|
constructor(t) {
|
|
151
243
|
super({
|
|
152
244
|
...t,
|
|
153
|
-
icon: t.icon ||
|
|
245
|
+
icon: t.icon || N,
|
|
154
246
|
title: t.title || "Color"
|
|
155
247
|
}), this.inputType = "color";
|
|
156
248
|
}
|
|
@@ -173,39 +265,39 @@ class L extends y {
|
|
|
173
265
|
t.className = "color-setting-wrapper";
|
|
174
266
|
const e = document.createElement("div");
|
|
175
267
|
e.className = "icon-container";
|
|
176
|
-
const i = this.createIcon(this.props.icon ||
|
|
268
|
+
const i = this.createIcon(this.props.icon || N), n = this.createLabel(this.title || "Color");
|
|
177
269
|
e.appendChild(i), e.appendChild(n);
|
|
178
270
|
const s = document.createElement("div");
|
|
179
271
|
s.className = "color-input-wrapper";
|
|
180
|
-
const o = (
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
return
|
|
184
|
-
const [
|
|
185
|
-
return
|
|
272
|
+
const o = (d) => {
|
|
273
|
+
const p = d.value.split(",").map((S) => parseInt(S.trim()));
|
|
274
|
+
if (p.length !== 3 || p.some(isNaN))
|
|
275
|
+
return d.style.border = "1px solid red", !1;
|
|
276
|
+
const [g, v, x] = p, b = g >= 0 && g <= 255 && v >= 0 && v <= 255 && x >= 0 && x <= 255;
|
|
277
|
+
return d.style.border = b ? "" : "1px solid red", b;
|
|
186
278
|
}, a = document.createElement("div");
|
|
187
279
|
a.className = "color-preview", a.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
188
|
-
const
|
|
280
|
+
const r = this.createInput({
|
|
189
281
|
value: this.value,
|
|
190
282
|
inputType: "text",
|
|
191
283
|
inputClassName: "color-text-input"
|
|
192
|
-
}), c =
|
|
284
|
+
}), c = r.querySelector("input"), l = this.createInput({
|
|
193
285
|
value: this.value ? this.rgbToHex(this.value) : "",
|
|
194
286
|
inputType: this.inputType,
|
|
195
287
|
inputClassName: "color-picker"
|
|
196
|
-
}),
|
|
197
|
-
return c.oninput = (
|
|
198
|
-
var
|
|
199
|
-
let
|
|
200
|
-
o(c) && (this.value =
|
|
201
|
-
},
|
|
202
|
-
var
|
|
203
|
-
const
|
|
204
|
-
this.value =
|
|
205
|
-
}, s.appendChild(a), s.appendChild(
|
|
288
|
+
}), u = l.querySelector("input");
|
|
289
|
+
return c.oninput = (d) => {
|
|
290
|
+
var g;
|
|
291
|
+
let p = d.target.value.trim();
|
|
292
|
+
o(c) && (this.value = p, (g = this.onChange) == null || g.call(this, p), u.value = this.rgbToHex(p), a.style.backgroundColor = `rgb(${p})`);
|
|
293
|
+
}, u.oninput = (d) => {
|
|
294
|
+
var v;
|
|
295
|
+
const p = d.target.value, g = this.hexToRgb(p);
|
|
296
|
+
this.value = g, (v = this.onChange) == null || v.call(this, g), c.value = g, a.style.backgroundColor = `rgb(${g})`;
|
|
297
|
+
}, s.appendChild(a), s.appendChild(l), s.appendChild(r), t.appendChild(e), t.appendChild(s), this.value && (c.value = this.value, u.value = this.rgbToHex(this.value), a.style.backgroundColor = `rgb(${this.value})`), t;
|
|
206
298
|
}
|
|
207
299
|
}
|
|
208
|
-
class
|
|
300
|
+
class f extends m {
|
|
209
301
|
constructor(t = {}) {
|
|
210
302
|
super(t), this.inputType = "number";
|
|
211
303
|
}
|
|
@@ -213,8 +305,8 @@ class w extends u {
|
|
|
213
305
|
const t = (s) => {
|
|
214
306
|
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", () => {
|
|
215
307
|
const o = this.props.minValue ?? Number.MIN_SAFE_INTEGER, a = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
216
|
-
let
|
|
217
|
-
|
|
308
|
+
let r = Number(s.value);
|
|
309
|
+
r < o && (r = o), r > a && (r = a), s.value = String(r);
|
|
218
310
|
});
|
|
219
311
|
}, e = this.createInput({
|
|
220
312
|
value: this.value,
|
|
@@ -236,18 +328,18 @@ class w extends u {
|
|
|
236
328
|
return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
|
|
237
329
|
}
|
|
238
330
|
}
|
|
239
|
-
class
|
|
331
|
+
class k extends f {
|
|
240
332
|
constructor(t) {
|
|
241
333
|
super({
|
|
242
334
|
...t,
|
|
243
335
|
minValue: 0,
|
|
244
336
|
maxValue: 100,
|
|
245
|
-
icon: t.icon ||
|
|
337
|
+
icon: t.icon || W,
|
|
246
338
|
title: t.title || "Opacity"
|
|
247
339
|
}), this.inputType = "number";
|
|
248
340
|
}
|
|
249
341
|
}
|
|
250
|
-
const
|
|
342
|
+
const W = `
|
|
251
343
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
252
344
|
<path d="M3.69749 15.365C3.54749 15.365 3.40502 15.305 3.30002 15.2C1.77752 13.6775 0.9375 11.6525 0.9375 9.5C0.9375 5.0525 4.5525 1.4375 9 1.4375C11.1525 1.4375 13.1775 2.2775 14.7 3.8C14.805 3.905 14.865 4.0475 14.865 4.1975C14.865 4.3475 14.805 4.49 14.7 4.595L4.09502 15.2C3.99002 15.305 3.84749 15.365 3.69749 15.365ZM9 2.5625C5.175 2.5625 2.0625 5.675 2.0625 9.5C2.0625 11.165 2.64751 12.74 3.71251 13.9925L13.4925 4.2125C12.24 3.1475 10.665 2.5625 9 2.5625Z" fill="#667085"/>
|
|
253
345
|
<path d="M9.00014 17.5623C6.84764 17.5623 4.82266 16.7223 3.30016 15.1998C3.19516 15.0948 3.13513 14.9523 3.13513 14.8023C3.13513 14.6523 3.19516 14.5098 3.30016 14.4048L13.9051 3.79984C14.1226 3.58234 14.4826 3.58234 14.7001 3.79984C16.2226 5.32234 17.0626 7.34734 17.0626 9.49984C17.0626 13.9473 13.4476 17.5623 9.00014 17.5623ZM4.50764 14.7873C5.76014 15.8523 7.33514 16.4373 9.00014 16.4373C12.8251 16.4373 15.9376 13.3248 15.9376 9.49984C15.9376 7.83484 15.3526 6.25984 14.2876 5.00734L4.50764 14.7873Z" fill="#667085"/>
|
|
@@ -255,30 +347,25 @@ const I = `
|
|
|
255
347
|
<path d="M13.4025 15.5225C13.26 15.5225 13.1175 15.47 13.005 15.3575L8.06999 10.4225C7.85249 10.205 7.85249 9.84498 8.06999 9.62748C8.28749 9.40998 8.64748 9.40998 8.86498 9.62748L13.8 14.5625C14.0175 14.78 14.0175 15.14 13.8 15.3575C13.6875 15.47 13.545 15.5225 13.4025 15.5225Z" fill="#667085"/>
|
|
256
348
|
<path d="M15.84 12.6648C15.6975 12.6648 15.555 12.6123 15.4425 12.4998L10.725 7.78234C10.5075 7.56484 10.5075 7.20484 10.725 6.98734C10.9425 6.76984 11.3025 6.76984 11.52 6.98734L16.2375 11.7048C16.455 11.9223 16.455 12.2823 16.2375 12.4998C16.1325 12.6048 15.99 12.6648 15.84 12.6648Z" fill="#667085"/>
|
|
257
349
|
</svg>
|
|
258
|
-
`,
|
|
350
|
+
`, A = `
|
|
259
351
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
260
352
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
261
353
|
</svg>
|
|
262
354
|
`;
|
|
263
|
-
class
|
|
355
|
+
class O extends m {
|
|
264
356
|
constructor(t = {}) {
|
|
265
|
-
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync &&
|
|
266
|
-
this._options.push(...e);
|
|
267
|
-
}).catch((e) => {
|
|
268
|
-
console.error("Failed to fetch async options:", e);
|
|
269
|
-
}), this.value !== void 0) {
|
|
357
|
+
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) {
|
|
270
358
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
271
359
|
e >= 0 && (this.selectedOptionIndex = e);
|
|
272
360
|
}
|
|
273
|
-
this.optionsListEl = this.optionsListEl, this.svgContainer = this.svgContainer;
|
|
274
361
|
}
|
|
275
362
|
createOption(t, e) {
|
|
276
363
|
const i = document.createElement("li");
|
|
277
|
-
return i.classList.add("select-option"), i.textContent = t.name, i.dataset.index = String(e), i;
|
|
364
|
+
return i.classList.add("select-option"), i.textContent = t.name, i.dataset.index = String(e), this.selectedOptionIndex === e && i.classList.add("selected"), i;
|
|
278
365
|
}
|
|
279
366
|
draw() {
|
|
280
367
|
const t = document.createElement("div");
|
|
281
|
-
if (t.classList.add("select-container"), this.props.icon || this.props.title) {
|
|
368
|
+
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
282
369
|
const s = document.createElement("div");
|
|
283
370
|
if (s.className = "icon-container", this.props.icon) {
|
|
284
371
|
const o = this.createIcon(this.props.icon);
|
|
@@ -289,30 +376,67 @@ class N extends u {
|
|
|
289
376
|
s.appendChild(o);
|
|
290
377
|
}
|
|
291
378
|
t.appendChild(s);
|
|
379
|
+
} else {
|
|
380
|
+
const s = document.createElement("div");
|
|
381
|
+
t.appendChild(s);
|
|
292
382
|
}
|
|
293
383
|
const e = document.createElement("div");
|
|
294
|
-
e.classList.add("select-button"), e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.onclick = () => {
|
|
384
|
+
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 = () => {
|
|
295
385
|
var s, o;
|
|
296
|
-
this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen);
|
|
297
|
-
}, t.appendChild(e);
|
|
386
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
387
|
+
}, t.appendChild(e), this.buttonEl = e;
|
|
298
388
|
const i = document.createElement("ul");
|
|
299
389
|
i.classList.add("select-options"), this._options.forEach((s, o) => {
|
|
300
390
|
const a = this.createOption(s, o);
|
|
301
|
-
a.onclick = (
|
|
391
|
+
a.onclick = (r) => this.selectOption(r, o, e), i.appendChild(a);
|
|
302
392
|
}), t.appendChild(i);
|
|
303
393
|
const n = document.createElement("div");
|
|
304
|
-
return n.classList.add("svg-container"), n.innerHTML =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
394
|
+
return n.classList.add("svg-container"), n.innerHTML = A, t.appendChild(n), this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
395
|
+
this._options.push(...s), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
396
|
+
}).catch((s) => {
|
|
397
|
+
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
398
|
+
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (s) => {
|
|
399
|
+
var o, a;
|
|
400
|
+
this.isOpen && !t.contains(s.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"));
|
|
401
|
+
}, document.addEventListener("click", this.clickOutsideListener), t;
|
|
308
402
|
}
|
|
309
403
|
selectOption(t, e, i) {
|
|
310
404
|
var s, o, a;
|
|
311
405
|
const n = this._options[e];
|
|
312
|
-
n && (this.value = n.value, (s = this.onChange) == null || s.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = n.name, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"))
|
|
406
|
+
n && (this.value = n.value, (s = this.onChange) == null || s.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = n.name, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((c, l) => {
|
|
407
|
+
l === e ? c.classList.add("selected") : c.classList.remove("selected");
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
updateOptionsList() {
|
|
411
|
+
if (this.optionsListEl) {
|
|
412
|
+
if (this.optionsListEl.innerHTML = "", this._options.length === 0) {
|
|
413
|
+
const t = document.createElement("li");
|
|
414
|
+
t.classList.add("select-option", "empty-message"), t.textContent = "No options available", this.optionsListEl.appendChild(t);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
this._options.forEach((t, e) => {
|
|
418
|
+
const i = this.createOption(t, e);
|
|
419
|
+
i.onclick = (n) => {
|
|
420
|
+
this.buttonEl && this.selectOption(n, e, this.buttonEl);
|
|
421
|
+
}, this.optionsListEl.appendChild(i);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
updateButtonText(t) {
|
|
426
|
+
if (!this.buttonEl) return;
|
|
427
|
+
if (this.isLoading) {
|
|
428
|
+
this.buttonEl.classList.add("loading"), this.buttonEl.textContent = this.props.loadingText || "Loading options...";
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
this.buttonEl.classList.remove("loading", "error");
|
|
432
|
+
let e;
|
|
433
|
+
t ? ((t.includes("Failed") || t.includes("Error")) && this.buttonEl.classList.add("error"), e = t) : this.selectedOptionIndex !== null && this._options[this.selectedOptionIndex] ? e = this._options[this.selectedOptionIndex].name : e = this.props.placeholder || "Select an option", this.buttonEl.textContent = e;
|
|
434
|
+
}
|
|
435
|
+
destroy() {
|
|
436
|
+
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), super.destroy();
|
|
313
437
|
}
|
|
314
438
|
}
|
|
315
|
-
class $ extends
|
|
439
|
+
class $ extends m {
|
|
316
440
|
constructor(t = {}) {
|
|
317
441
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
318
442
|
}
|
|
@@ -360,12 +484,12 @@ class $ extends u {
|
|
|
360
484
|
const o = document.createElement("button");
|
|
361
485
|
o.className = "align-option-button", o.innerHTML = s.icon, this.value === s.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
362
486
|
var a;
|
|
363
|
-
i.querySelectorAll(".align-option-button").forEach((
|
|
487
|
+
i.querySelectorAll(".align-option-button").forEach((r) => r.classList.remove("selected")), o.classList.add("selected"), this.value = s.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
364
488
|
}), i.appendChild(o);
|
|
365
489
|
}), t.appendChild(i), t;
|
|
366
490
|
}
|
|
367
491
|
}
|
|
368
|
-
class
|
|
492
|
+
class it extends m {
|
|
369
493
|
constructor(t) {
|
|
370
494
|
super(t), this.inputType = "button";
|
|
371
495
|
}
|
|
@@ -378,174 +502,248 @@ class tt extends u {
|
|
|
378
502
|
return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
|
|
379
503
|
}
|
|
380
504
|
}
|
|
381
|
-
class
|
|
505
|
+
class st extends m {
|
|
382
506
|
constructor(t = {}) {
|
|
383
|
-
super(t), this.inputType = { width: "number", height: "number" }, this.
|
|
507
|
+
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
508
|
+
const e = t.width || 100, i = t.height || 100;
|
|
509
|
+
this.value || (this.value = {
|
|
510
|
+
width: e,
|
|
511
|
+
height: i
|
|
512
|
+
}), 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 f({
|
|
384
513
|
title: "Width",
|
|
385
514
|
default: this.value.width,
|
|
386
515
|
suffix: "px",
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
// SVG icon defined at the bottom.
|
|
392
|
-
}), this.heightSetting = new w({
|
|
516
|
+
minValue: this.minWidth,
|
|
517
|
+
maxValue: this.maxWidth,
|
|
518
|
+
icon: j
|
|
519
|
+
}), this.heightSetting = new f({
|
|
393
520
|
title: "Height",
|
|
394
521
|
default: this.value.height,
|
|
395
522
|
suffix: "px",
|
|
396
|
-
minValue:
|
|
397
|
-
maxValue:
|
|
398
|
-
icon:
|
|
399
|
-
}), this.widthSetting.setOnChange((
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
523
|
+
minValue: this.minHeight,
|
|
524
|
+
maxValue: this.maxHeight,
|
|
525
|
+
icon: _
|
|
526
|
+
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Handle width changes with improved validation and aspect ratio preservation
|
|
530
|
+
*/
|
|
531
|
+
handleWidthChange(t) {
|
|
532
|
+
if (!this.isUpdating) {
|
|
533
|
+
(isNaN(t) || t < this.minWidth) && (t = this.minWidth), this.maxWidth && t > this.maxWidth && (t = this.maxWidth), this.isUpdating = !0;
|
|
534
|
+
try {
|
|
535
|
+
let e = t, i = this.value.height;
|
|
536
|
+
this.locked && this.aspectRatio > 0 && (i = Math.round(e / this.aspectRatio), i < this.minHeight ? (i = this.minHeight, e = Math.round(i * this.aspectRatio), e < this.minWidth ? (e = this.minWidth, i > 0 && (this.aspectRatio = e / i)) : this.maxWidth && e > this.maxWidth && (e = this.maxWidth, i > 0 && (this.aspectRatio = e / i))) : this.maxHeight && i > this.maxHeight && (i = this.maxHeight, e = Math.round(i * this.aspectRatio), e < this.minWidth ? (e = this.minWidth, i > 0 && (this.aspectRatio = e / i)) : this.maxWidth && e > this.maxWidth && (e = this.maxWidth, i > 0 && (this.aspectRatio = e / i)))), this.value = { width: e, height: i }, this.widthSetting.setValue(e), this.locked && this.heightSetting.setValue(i), this.onChange && this.onChange(this.value);
|
|
537
|
+
} finally {
|
|
538
|
+
this.isUpdating = !1;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Handle height changes with improved validation and aspect ratio preservation
|
|
544
|
+
*/
|
|
545
|
+
handleHeightChange(t) {
|
|
546
|
+
if (!this.isUpdating) {
|
|
547
|
+
(isNaN(t) || t < this.minHeight) && (t = this.minHeight), this.maxHeight && t > this.maxHeight && (t = this.maxHeight), this.isUpdating = !0;
|
|
548
|
+
try {
|
|
549
|
+
let e = t, i = this.value.width;
|
|
550
|
+
this.locked && this.aspectRatio > 0 && (i = Math.round(e * this.aspectRatio), i < this.minWidth ? (i = this.minWidth, e = Math.round(i / this.aspectRatio), e < this.minHeight ? (e = this.minHeight, e > 0 && (this.aspectRatio = i / e)) : this.maxHeight && e > this.maxHeight && (e = this.maxHeight, e > 0 && (this.aspectRatio = i / e))) : this.maxWidth && i > this.maxWidth && (i = this.maxWidth, e = Math.round(i / this.aspectRatio), e < this.minHeight ? (e = this.minHeight, e > 0 && (this.aspectRatio = i / e)) : this.maxHeight && e > this.maxHeight && (e = this.maxHeight, e > 0 && (this.aspectRatio = i / e)))), this.value = { width: i, height: e }, this.locked && this.widthSetting.setValue(i), this.heightSetting.setValue(e), this.onChange && this.onChange(this.value);
|
|
551
|
+
} finally {
|
|
552
|
+
this.isUpdating = !1;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
412
555
|
}
|
|
413
556
|
/**
|
|
414
557
|
* Toggles the locked state. When locking, it recalculates the aspect ratio
|
|
415
558
|
* based on the current width and height. Updates the lock icon accordingly.
|
|
416
|
-
* @param lockIcon The HTMLElement containing the lock icon SVG.
|
|
417
559
|
*/
|
|
418
560
|
toggleLock(t) {
|
|
419
|
-
if (this.locked = !this.locked, this.locked) {
|
|
420
|
-
const
|
|
421
|
-
|
|
561
|
+
if (this.locked = !this.locked, this.locked && this.value) {
|
|
562
|
+
const { width: i, height: n } = this.value;
|
|
563
|
+
n > 0 && (this.aspectRatio = i / n);
|
|
422
564
|
}
|
|
423
|
-
t.innerHTML = this.getLockSVG(this.locked);
|
|
565
|
+
t.innerHTML = this.getLockSVG(this.locked), t.setAttribute("aria-pressed", String(this.locked)), t.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio";
|
|
566
|
+
const e = t.closest(".dimension-setting-container");
|
|
567
|
+
e && (this.locked ? e.classList.add("aspect-locked") : e.classList.remove("aspect-locked"));
|
|
424
568
|
}
|
|
425
569
|
/**
|
|
426
570
|
* Returns the appropriate SVG string for the lock icon based on lock state.
|
|
427
|
-
* @param isLocked Whether the dimension is currently locked.
|
|
428
571
|
*/
|
|
429
572
|
getLockSVG(t) {
|
|
430
573
|
return t ? `
|
|
431
574
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
432
|
-
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25C6.00786 1.25 6.84859 1.96573 7.04162 2.91667M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="
|
|
433
|
-
</svg
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
575
|
+
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25C6.00786 1.25 6.84859 1.96573 7.04162 2.91667M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
576
|
+
</svg>` : `
|
|
577
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
578
|
+
<path d="M2.91663 4.58333V3.33333C2.91663 2.18274 3.84937 1.25 4.99996 1.25M3.66663 8.75H6.33329C7.03336 8.75 7.38339 8.75 7.65078 8.61376C7.88598 8.49392 8.07721 8.30269 8.19705 8.06749C8.33329 7.8001 8.33329 7.45007 8.33329 6.75V6.58333C8.33329 5.88327 8.33329 5.53323 8.19705 5.26584C8.07721 5.03064 7.88598 4.83942 7.65078 4.71958C7.38339 4.58333 7.03336 4.58333 6.33329 4.58333H3.66663C2.96656 4.58333 2.61653 4.58333 2.34914 4.71958C2.11394 4.83942 1.92271 5.03064 1.80287 5.26584C1.66663 5.53323 1.66663 5.88327 1.66663 6.58333V6.75C1.66663 7.45007 1.66663 7.8001 1.80287 8.06749C1.92271 8.30269 2.11394 8.49392 2.34914 8.61376C2.61653 8.75 2.96656 8.75 3.66663 8.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
579
|
+
</svg>`;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Programmatically update both width and height values
|
|
583
|
+
*/
|
|
584
|
+
setValue(t) {
|
|
585
|
+
if (t && typeof t.width == "number" && typeof t.height == "number") {
|
|
586
|
+
let e = Math.max(this.minWidth, t.width);
|
|
587
|
+
this.maxWidth && (e = Math.min(this.maxWidth, e));
|
|
588
|
+
let i = Math.max(this.minHeight, t.height);
|
|
589
|
+
this.maxHeight && (i = Math.min(this.maxHeight, i)), this.value = {
|
|
590
|
+
width: e,
|
|
591
|
+
height: i
|
|
592
|
+
}, this.locked && this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.isUpdating = !0;
|
|
593
|
+
try {
|
|
594
|
+
this.widthSetting.setValue(this.value.width), this.heightSetting.setValue(this.value.height);
|
|
595
|
+
} finally {
|
|
596
|
+
this.isUpdating = !1;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
439
599
|
}
|
|
440
600
|
/**
|
|
441
601
|
* Renders the DimensionSetting component.
|
|
442
|
-
* It arranges the width and height NumberSettings with a bracket containing a lock icon.
|
|
443
|
-
* @returns {HTMLElement} The container element with the complete dimension control.
|
|
444
602
|
*/
|
|
445
603
|
draw() {
|
|
446
604
|
const t = document.createElement("div");
|
|
447
|
-
t.className = "dimension-setting-container";
|
|
605
|
+
t.className = "dimension-setting-container", this.locked && t.classList.add("aspect-locked");
|
|
448
606
|
const e = this.widthSetting.draw(), i = this.heightSetting.draw(), n = document.createElement("div");
|
|
449
607
|
n.className = "dimension-bracket";
|
|
450
|
-
const s = document.createElement("
|
|
451
|
-
return s.className = "dimension-lock-icon", s.
|
|
608
|
+
const s = document.createElement("button");
|
|
609
|
+
return s.className = "dimension-lock-icon", s.setAttribute("type", "button"), s.setAttribute("aria-pressed", String(this.locked)), s.setAttribute(
|
|
610
|
+
"aria-label",
|
|
611
|
+
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
612
|
+
), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (o) => {
|
|
613
|
+
o.preventDefault(), this.toggleLock(s);
|
|
614
|
+
}, n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Allow for external access to the locked state
|
|
618
|
+
*/
|
|
619
|
+
isLocked() {
|
|
620
|
+
return this.locked;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Allow for external control of the locked state
|
|
624
|
+
*/
|
|
625
|
+
setLocked(t) {
|
|
626
|
+
if (this.locked !== t) {
|
|
627
|
+
if (this.locked = t, this.locked && this.value) {
|
|
628
|
+
const { width: i, height: n } = this.value;
|
|
629
|
+
n > 0 && (this.aspectRatio = i / n);
|
|
630
|
+
}
|
|
631
|
+
const e = document.querySelector(
|
|
632
|
+
".dimension-setting-container .dimension-lock-icon"
|
|
633
|
+
);
|
|
634
|
+
if (e instanceof HTMLElement) {
|
|
635
|
+
e.innerHTML = this.getLockSVG(this.locked), e.setAttribute("aria-pressed", String(this.locked)), e.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio";
|
|
636
|
+
const i = e.closest(".dimension-setting-container");
|
|
637
|
+
i && (this.locked ? i.classList.add("aspect-locked") : i.classList.remove("aspect-locked"));
|
|
638
|
+
}
|
|
639
|
+
}
|
|
452
640
|
}
|
|
453
641
|
}
|
|
454
|
-
const
|
|
455
|
-
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="
|
|
456
|
-
</svg>`,
|
|
457
|
-
<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="
|
|
458
|
-
</svg>`,
|
|
642
|
+
const j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
643
|
+
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
644
|
+
</svg>`, _ = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
645
|
+
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
646
|
+
</svg>`, M = `
|
|
459
647
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
460
648
|
<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"/>
|
|
461
649
|
</svg>
|
|
462
|
-
`,
|
|
650
|
+
`, T = `
|
|
463
651
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
464
652
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
465
653
|
<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"/>
|
|
466
654
|
</svg>
|
|
467
|
-
`,
|
|
655
|
+
`, q = `
|
|
468
656
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
469
657
|
<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"/>
|
|
470
658
|
</svg>
|
|
471
659
|
`;
|
|
472
|
-
class
|
|
660
|
+
class U extends m {
|
|
473
661
|
constructor(t = {}) {
|
|
474
662
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl);
|
|
475
663
|
}
|
|
476
664
|
updatePreviewState(t = null) {
|
|
477
|
-
if (!
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
665
|
+
if (!this.previewWrapper || !this.previewEl || !this.emptyStateEl) return;
|
|
666
|
+
const e = this.previewWrapper.parentElement, i = e == null ? void 0 : e.querySelector(".upload-button"), n = e == null ? void 0 : e.querySelector(
|
|
667
|
+
".preview-placeholder"
|
|
668
|
+
);
|
|
669
|
+
t && t !== "" ? (this.previewWrapper.classList.add("has-image"), this.previewEl.src = t, this.previewWrapper.style.display = "block", n && n instanceof HTMLElement && (n.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
670
|
+
<span class="upload-icon">${M}</span>
|
|
671
|
+
<span class="upload-label">Replace</span>
|
|
672
|
+
`)) : (this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewWrapper.style.display = "none", n && n instanceof HTMLElement && (n.style.display = "none"), i && (i.innerHTML = `
|
|
673
|
+
<span class="upload-icon">${M}</span>
|
|
674
|
+
<span class="upload-label">Upload</span>
|
|
675
|
+
`));
|
|
487
676
|
}
|
|
488
677
|
draw() {
|
|
489
678
|
const t = document.createElement("div");
|
|
490
|
-
t.className = "upload-setting-wrapper"
|
|
491
|
-
const e =
|
|
492
|
-
if (e
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
679
|
+
t.className = "upload-setting-wrapper";
|
|
680
|
+
const e = !!(this.props.title || this.props.icon);
|
|
681
|
+
if (e || t.classList.add("no-label"), e) {
|
|
682
|
+
const c = document.createElement("div");
|
|
683
|
+
if (c.className = "icon-title-container", this.props.icon) {
|
|
684
|
+
const l = this.createIcon(this.props.icon);
|
|
685
|
+
c.appendChild(l);
|
|
686
|
+
}
|
|
687
|
+
if (this.props.title) {
|
|
688
|
+
const l = this.createLabel(this.props.title);
|
|
689
|
+
c.appendChild(l);
|
|
690
|
+
}
|
|
691
|
+
t.appendChild(c);
|
|
499
692
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
n
|
|
503
|
-
|
|
504
|
-
s
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
693
|
+
const i = document.createElement("div");
|
|
694
|
+
i.className = "preview-button-container";
|
|
695
|
+
const n = this.value && this.value !== "";
|
|
696
|
+
n || i.classList.add("no-image");
|
|
697
|
+
const s = document.createElement("div");
|
|
698
|
+
s.className = "preview-placeholder", s.innerHTML = T, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.emptyStateEl = document.createElement("div"), this.emptyStateEl.className = "empty-state", this.emptyStateEl.innerHTML = T, this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview";
|
|
699
|
+
const o = document.createElement("button");
|
|
700
|
+
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);
|
|
701
|
+
const a = document.createElement("button");
|
|
702
|
+
a.className = "upload-button", a.innerHTML = `
|
|
703
|
+
<span class="upload-icon">${M}</span>
|
|
704
|
+
<span class="upload-label">Upload</span>
|
|
705
|
+
`;
|
|
706
|
+
const r = document.createElement("input");
|
|
707
|
+
return r.type = "file", r.accept = "image/*", r.style.display = "none", i.appendChild(s), i.appendChild(this.previewWrapper), i.appendChild(a), t.appendChild(i), t.appendChild(r), n ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = (c) => {
|
|
508
708
|
var l;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
o.click();
|
|
517
|
-
}, o.onchange = async () => {
|
|
518
|
-
var l, c, d;
|
|
519
|
-
const a = (l = o.files) == null ? void 0 : l[0];
|
|
520
|
-
if (a)
|
|
709
|
+
c.stopPropagation(), this.value = "", this.updatePreviewState(null), (l = this.onChange) == null || l.call(this, "");
|
|
710
|
+
}, a.onclick = () => {
|
|
711
|
+
r.click();
|
|
712
|
+
}, r.onchange = async () => {
|
|
713
|
+
var l, u, d;
|
|
714
|
+
const c = (l = r.files) == null ? void 0 : l[0];
|
|
715
|
+
if (c)
|
|
521
716
|
try {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
717
|
+
a.classList.add("loading"), a.disabled = !0;
|
|
718
|
+
const p = new FormData(), g = this.props.formFieldName || "file";
|
|
719
|
+
p.append(g, c, c.name);
|
|
720
|
+
const v = this.props.uploadUrl;
|
|
721
|
+
if (!v)
|
|
526
722
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
527
|
-
const
|
|
528
|
-
method:
|
|
529
|
-
body:
|
|
530
|
-
headers:
|
|
723
|
+
const x = this.props.requestMethod || "POST", b = { ...this.props.requestHeaders || {} }, L = await (await fetch(v, {
|
|
724
|
+
method: x,
|
|
725
|
+
body: p,
|
|
726
|
+
headers: b
|
|
531
727
|
})).json();
|
|
532
|
-
let
|
|
728
|
+
let w;
|
|
533
729
|
if (this.props.parseResponse)
|
|
534
|
-
|
|
535
|
-
else if (
|
|
730
|
+
w = this.props.parseResponse(L);
|
|
731
|
+
else if (w = (u = L == null ? void 0 : L.data) == null ? void 0 : u.url, !w)
|
|
536
732
|
throw new Error(
|
|
537
733
|
"No URL found in response. Provide a parseResponse if needed."
|
|
538
734
|
);
|
|
539
|
-
this.value =
|
|
540
|
-
} catch (
|
|
541
|
-
console.error("Error uploading file:",
|
|
735
|
+
this.value = w, this.updatePreviewState(w), (d = this.onChange) == null || d.call(this, w);
|
|
736
|
+
} catch (p) {
|
|
737
|
+
console.error("Error uploading file:", p), this.updatePreviewState(null);
|
|
738
|
+
} finally {
|
|
739
|
+
a.classList.remove("loading"), a.disabled = !1;
|
|
542
740
|
}
|
|
543
|
-
}, t
|
|
741
|
+
}, t;
|
|
544
742
|
}
|
|
545
743
|
}
|
|
546
|
-
class
|
|
744
|
+
class nt extends m {
|
|
547
745
|
constructor(t = {}) {
|
|
548
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
746
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new f({
|
|
549
747
|
title: "Height",
|
|
550
748
|
default: this.value,
|
|
551
749
|
suffix: "px",
|
|
@@ -564,9 +762,9 @@ class it extends u {
|
|
|
564
762
|
const F = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
565
763
|
<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"/>
|
|
566
764
|
</svg>`;
|
|
567
|
-
class
|
|
765
|
+
class ot extends m {
|
|
568
766
|
constructor(t = {}) {
|
|
569
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
767
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new f({
|
|
570
768
|
title: "Width",
|
|
571
769
|
default: this.value,
|
|
572
770
|
suffix: "px",
|
|
@@ -589,17 +787,9 @@ const G = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
589
787
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
590
788
|
</svg>
|
|
591
789
|
`;
|
|
592
|
-
class
|
|
790
|
+
class at extends m {
|
|
593
791
|
constructor(t = {}) {
|
|
594
|
-
|
|
595
|
-
this._options.push(...e);
|
|
596
|
-
}).catch((e) => {
|
|
597
|
-
console.error("Failed to fetch async options:", e);
|
|
598
|
-
}), this.value !== void 0) {
|
|
599
|
-
const e = this._options.findIndex((i) => i.value === this.value);
|
|
600
|
-
e >= 0 && (this.selectedOptionIndex = e);
|
|
601
|
-
}
|
|
602
|
-
this.optionsListEl = this.optionsListEl, this.svgContainer = this.svgContainer;
|
|
792
|
+
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, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0);
|
|
603
793
|
}
|
|
604
794
|
createOption(t, e) {
|
|
605
795
|
const i = document.createElement("li");
|
|
@@ -609,76 +799,125 @@ class st extends u {
|
|
|
609
799
|
}
|
|
610
800
|
draw() {
|
|
611
801
|
const t = document.createElement("div");
|
|
612
|
-
|
|
613
|
-
const s = document.createElement("div");
|
|
614
|
-
if (s.className = "icon-container", this.props.icon) {
|
|
615
|
-
const o = this.createIcon(this.props.icon);
|
|
616
|
-
s.appendChild(o);
|
|
617
|
-
}
|
|
618
|
-
if (this.props.title) {
|
|
619
|
-
const o = this.createLabel(this.props.title);
|
|
620
|
-
s.appendChild(o);
|
|
621
|
-
}
|
|
622
|
-
t.appendChild(s);
|
|
623
|
-
}
|
|
802
|
+
t.classList.add("select-api-container"), this.container = t;
|
|
624
803
|
const e = document.createElement("div");
|
|
625
|
-
e.classList.add("select-api-button"),
|
|
804
|
+
if (e.classList.add("select-api-button"), this.props.title) {
|
|
805
|
+
e.classList.add("has-label");
|
|
806
|
+
const s = document.createElement("div");
|
|
807
|
+
s.className = "select-label", s.textContent = this.props.title, e.appendChild(s);
|
|
808
|
+
const o = document.createElement("span");
|
|
809
|
+
o.className = "select-value", this.isLoading ? o.textContent = this.props.loadingText || "Loading options..." : o.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.appendChild(o);
|
|
810
|
+
} else
|
|
811
|
+
this.isLoading ? e.textContent = this.props.loadingText || "Loading options..." : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option";
|
|
812
|
+
e.onclick = () => {
|
|
626
813
|
var s, o;
|
|
627
|
-
this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen);
|
|
628
|
-
}, t.appendChild(e);
|
|
814
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
815
|
+
}, t.appendChild(e), this.buttonEl = e;
|
|
629
816
|
const i = document.createElement("ul");
|
|
630
817
|
i.classList.add("select-api-options"), this._options.forEach((s, o) => {
|
|
631
818
|
const a = this.createOption(s, o);
|
|
632
|
-
a.onclick = (
|
|
819
|
+
a.onclick = (r) => this.selectApiOption(r, o, e), i.appendChild(a);
|
|
633
820
|
}), t.appendChild(i);
|
|
634
821
|
const n = document.createElement("div");
|
|
635
822
|
return n.classList.add("svg-container"), n.innerHTML = Z, t.appendChild(n), n.onclick = () => {
|
|
636
823
|
var s, o;
|
|
637
|
-
this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen);
|
|
638
|
-
}, this.optionsListEl = i, this.svgContainer = n,
|
|
824
|
+
this.isLoading || (this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
825
|
+
}, this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
|
|
826
|
+
this._options.push(...s), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
827
|
+
}).catch((s) => {
|
|
828
|
+
console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
829
|
+
})), t;
|
|
639
830
|
}
|
|
640
831
|
selectApiOption(t, e, i) {
|
|
641
832
|
var s, o, a;
|
|
642
833
|
const n = this._options[e];
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
834
|
+
n && (this.value = n.value, (s = this.onChange) == null || s.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, this.updateButtonText(), (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.optionsListEl && this.optionsListEl.querySelectorAll(
|
|
835
|
+
".select-api-radio"
|
|
836
|
+
).forEach((c, l) => {
|
|
837
|
+
c.checked = l === e;
|
|
838
|
+
}));
|
|
839
|
+
}
|
|
840
|
+
updateOptionsList() {
|
|
841
|
+
if (this.optionsListEl) {
|
|
842
|
+
if (this.optionsListEl.innerHTML = "", this._options.length === 0) {
|
|
843
|
+
const t = document.createElement("li");
|
|
844
|
+
t.classList.add("select-api-option", "empty-message"), t.textContent = "No options available", this.optionsListEl.appendChild(t);
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
this._options.forEach((t, e) => {
|
|
848
|
+
const i = this.createOption(t, e);
|
|
849
|
+
this.selectedOptionIndex === e && i.classList.add("selected"), i.onclick = (n) => {
|
|
850
|
+
this.buttonEl && this.selectApiOption(n, e, this.buttonEl);
|
|
851
|
+
}, i.tabIndex = 0, i.addEventListener("keydown", (n) => {
|
|
852
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), this.buttonEl && this.selectApiOption(n, e, this.buttonEl));
|
|
853
|
+
}), this.optionsListEl.appendChild(i);
|
|
854
|
+
});
|
|
647
855
|
}
|
|
648
856
|
}
|
|
857
|
+
updateButtonText(t) {
|
|
858
|
+
if (!this.buttonEl) return;
|
|
859
|
+
const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"), n = this.buttonEl.querySelector(".select-label");
|
|
860
|
+
if (this.isLoading) {
|
|
861
|
+
this.buttonEl.classList.add("loading");
|
|
862
|
+
const o = this.props.loadingText || "Loading options...";
|
|
863
|
+
if (e)
|
|
864
|
+
e.textContent = o;
|
|
865
|
+
else if (i && this.props.title && !n) {
|
|
866
|
+
this.buttonEl.innerHTML = "";
|
|
867
|
+
const a = document.createElement("div");
|
|
868
|
+
a.className = "select-label", a.textContent = this.props.title, this.buttonEl.appendChild(a);
|
|
869
|
+
const r = document.createElement("span");
|
|
870
|
+
r.className = "select-value", r.textContent = o, this.buttonEl.appendChild(r);
|
|
871
|
+
} else
|
|
872
|
+
this.buttonEl.textContent = o;
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
this.buttonEl.classList.remove("loading", "error");
|
|
876
|
+
let s;
|
|
877
|
+
if (t ? ((t.includes("Failed") || t.includes("Error")) && this.buttonEl.classList.add("error"), s = t) : this.selectedOptionIndex !== null && this._options[this.selectedOptionIndex] ? s = this._options[this.selectedOptionIndex].name : s = "Select an option", e)
|
|
878
|
+
e.textContent = s;
|
|
879
|
+
else if (i && this.props.title && !n) {
|
|
880
|
+
this.buttonEl.innerHTML = "";
|
|
881
|
+
const o = document.createElement("div");
|
|
882
|
+
o.className = "select-label", o.textContent = this.props.title, this.buttonEl.appendChild(o);
|
|
883
|
+
const a = document.createElement("span");
|
|
884
|
+
a.className = "select-value", a.textContent = s, this.buttonEl.appendChild(a);
|
|
885
|
+
} else
|
|
886
|
+
this.buttonEl.textContent = s;
|
|
887
|
+
}
|
|
649
888
|
}
|
|
650
|
-
const
|
|
889
|
+
const D = `
|
|
651
890
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
652
891
|
<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"/>
|
|
653
892
|
</svg>
|
|
654
|
-
`,
|
|
893
|
+
`, z = `
|
|
655
894
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
656
895
|
<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"/>
|
|
657
896
|
</svg>
|
|
658
897
|
`;
|
|
659
|
-
class
|
|
898
|
+
class lt extends C {
|
|
660
899
|
constructor(t) {
|
|
661
900
|
super({
|
|
662
901
|
title: "Border",
|
|
663
902
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
664
903
|
settings: {
|
|
665
|
-
size: new
|
|
904
|
+
size: new f({
|
|
666
905
|
title: "Size",
|
|
667
|
-
icon:
|
|
906
|
+
icon: z,
|
|
668
907
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
669
908
|
suffix: "px"
|
|
670
909
|
}),
|
|
671
|
-
color: new
|
|
910
|
+
color: new H({
|
|
672
911
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
673
912
|
}),
|
|
674
|
-
opacity: new
|
|
913
|
+
opacity: new k({
|
|
675
914
|
default: (t == null ? void 0 : t.opacity) ?? 100,
|
|
676
915
|
minValue: 0,
|
|
677
916
|
maxValue: 100
|
|
678
917
|
}),
|
|
679
|
-
radius: new
|
|
918
|
+
radius: new f({
|
|
680
919
|
title: "Radius",
|
|
681
|
-
icon:
|
|
920
|
+
icon: D,
|
|
682
921
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
683
922
|
suffix: "px"
|
|
684
923
|
})
|
|
@@ -698,34 +937,34 @@ class ot extends C {
|
|
|
698
937
|
`;
|
|
699
938
|
}
|
|
700
939
|
}
|
|
701
|
-
const
|
|
940
|
+
const P = `
|
|
702
941
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
703
942
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
704
943
|
</svg>
|
|
705
|
-
`,
|
|
944
|
+
`, X = `
|
|
706
945
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
707
946
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
708
947
|
</svg>
|
|
709
|
-
`,
|
|
948
|
+
`, J = `
|
|
710
949
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
711
950
|
<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"/>
|
|
712
951
|
</svg>
|
|
713
952
|
`;
|
|
714
|
-
class
|
|
953
|
+
class rt extends C {
|
|
715
954
|
constructor(t = {}) {
|
|
716
955
|
super({
|
|
717
956
|
title: t.title || "Typography",
|
|
718
957
|
collapsed: t.collapsed,
|
|
719
958
|
settings: {
|
|
720
|
-
color: new
|
|
959
|
+
color: new H({
|
|
721
960
|
default: t.colorDefault ?? "0, 0, 30"
|
|
722
961
|
}),
|
|
723
|
-
opacity: new
|
|
962
|
+
opacity: new k({
|
|
724
963
|
default: t.colorOpacityDefault ?? 100
|
|
725
964
|
}),
|
|
726
|
-
fontFamily: new
|
|
965
|
+
fontFamily: new O({
|
|
727
966
|
title: "Font",
|
|
728
|
-
icon:
|
|
967
|
+
icon: P,
|
|
729
968
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
730
969
|
options: t.fontFamilyOptions ?? [
|
|
731
970
|
{ name: "Satoshi", value: "Satoshi" },
|
|
@@ -735,9 +974,9 @@ class at extends C {
|
|
|
735
974
|
getOptions: t.fontFamilyGetOptions,
|
|
736
975
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
737
976
|
}),
|
|
738
|
-
fontWeight: new
|
|
977
|
+
fontWeight: new O({
|
|
739
978
|
title: "Weight",
|
|
740
|
-
icon:
|
|
979
|
+
icon: X,
|
|
741
980
|
default: t.fontWeightDefault ?? "bold",
|
|
742
981
|
options: t.fontWeightOptions ?? [
|
|
743
982
|
{ name: "Regular", value: "400" },
|
|
@@ -747,9 +986,9 @@ class at extends C {
|
|
|
747
986
|
getOptions: t.fontWeightGetOptions,
|
|
748
987
|
getOptionsAsync: t.fontWeightGetOptionsAsync
|
|
749
988
|
}),
|
|
750
|
-
fontSize: new
|
|
989
|
+
fontSize: new f({
|
|
751
990
|
title: "Size",
|
|
752
|
-
icon:
|
|
991
|
+
icon: J,
|
|
753
992
|
default: t.fontSizeDefault ?? 12,
|
|
754
993
|
suffix: "px"
|
|
755
994
|
}),
|
|
@@ -772,7 +1011,7 @@ class at extends C {
|
|
|
772
1011
|
`;
|
|
773
1012
|
}
|
|
774
1013
|
}
|
|
775
|
-
class
|
|
1014
|
+
class E extends m {
|
|
776
1015
|
constructor(t) {
|
|
777
1016
|
super({
|
|
778
1017
|
...t,
|
|
@@ -782,9 +1021,9 @@ class x extends u {
|
|
|
782
1021
|
draw() {
|
|
783
1022
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
784
1023
|
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
785
|
-
const
|
|
786
|
-
let
|
|
787
|
-
|
|
1024
|
+
const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER, c = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1025
|
+
let l = Number(a.value);
|
|
1026
|
+
l < r && (l = r), l > c && (l = c), a.value = String(l);
|
|
788
1027
|
}));
|
|
789
1028
|
}, i = this.createInput({
|
|
790
1029
|
value: this.value,
|
|
@@ -807,43 +1046,43 @@ class x extends u {
|
|
|
807
1046
|
s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
|
|
808
1047
|
const o = i.querySelector("input");
|
|
809
1048
|
return o && (o.oninput = (a) => {
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
1049
|
+
const r = a.target.value.trim();
|
|
1050
|
+
if (r.toLowerCase() === "auto")
|
|
812
1051
|
this.value = "auto";
|
|
813
1052
|
else {
|
|
814
|
-
const c = Number(
|
|
1053
|
+
const c = Number(r);
|
|
815
1054
|
isNaN(c) || (this.value = c);
|
|
816
1055
|
}
|
|
817
1056
|
this.onChange && this.onChange(this.value);
|
|
818
1057
|
}), i;
|
|
819
1058
|
}
|
|
820
1059
|
}
|
|
821
|
-
class
|
|
1060
|
+
class ht extends C {
|
|
822
1061
|
constructor(t) {
|
|
823
1062
|
super({
|
|
824
1063
|
title: "Margins",
|
|
825
1064
|
settings: {
|
|
826
|
-
marginTop: new
|
|
1065
|
+
marginTop: new E({
|
|
827
1066
|
title: "Top",
|
|
828
|
-
icon:
|
|
1067
|
+
icon: Q,
|
|
829
1068
|
suffix: "px",
|
|
830
1069
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
831
1070
|
}),
|
|
832
|
-
marginRight: new
|
|
1071
|
+
marginRight: new E({
|
|
833
1072
|
title: "Right",
|
|
834
|
-
icon:
|
|
1073
|
+
icon: Y,
|
|
835
1074
|
suffix: "px",
|
|
836
1075
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
837
1076
|
}),
|
|
838
|
-
marginBottom: new
|
|
1077
|
+
marginBottom: new E({
|
|
839
1078
|
title: "Bottom",
|
|
840
|
-
icon:
|
|
1079
|
+
icon: K,
|
|
841
1080
|
suffix: "px",
|
|
842
1081
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
843
1082
|
}),
|
|
844
|
-
marginLeft: new
|
|
1083
|
+
marginLeft: new E({
|
|
845
1084
|
title: "Left",
|
|
846
|
-
icon:
|
|
1085
|
+
icon: tt,
|
|
847
1086
|
suffix: "px",
|
|
848
1087
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
849
1088
|
})
|
|
@@ -860,16 +1099,16 @@ class lt extends C {
|
|
|
860
1099
|
`;
|
|
861
1100
|
}
|
|
862
1101
|
}
|
|
863
|
-
const
|
|
1102
|
+
const Q = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
864
1103
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
865
|
-
</svg>`,
|
|
1104
|
+
</svg>`, Y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
866
1105
|
<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.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
867
|
-
</svg>`,
|
|
1106
|
+
</svg>`, K = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
868
1107
|
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
869
|
-
</svg>`,
|
|
1108
|
+
</svg>`, tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
870
1109
|
<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"/>
|
|
871
1110
|
</svg>`;
|
|
872
|
-
class
|
|
1111
|
+
class et extends C {
|
|
873
1112
|
constructor(t, e) {
|
|
874
1113
|
super({
|
|
875
1114
|
title: `Tab ${t + 1}`,
|
|
@@ -911,14 +1150,14 @@ class K extends C {
|
|
|
911
1150
|
return t;
|
|
912
1151
|
}
|
|
913
1152
|
}
|
|
914
|
-
class
|
|
1153
|
+
class ct extends C {
|
|
915
1154
|
// Store the rendered element
|
|
916
1155
|
constructor() {
|
|
917
1156
|
super({ title: "Tabs", settings: {} }), this.tabs = [], this._el = null, this.addTab();
|
|
918
1157
|
}
|
|
919
1158
|
/** Adds a new tab. */
|
|
920
1159
|
addTab() {
|
|
921
|
-
const t = this.tabs.length, e = new
|
|
1160
|
+
const t = this.tabs.length, e = new et(t, () => this.removeTab(e));
|
|
922
1161
|
this.tabs.push(e), this.settings[`Tab ${t + 1}`] = e;
|
|
923
1162
|
}
|
|
924
1163
|
/** Removes a specific tab. */
|
|
@@ -971,7 +1210,7 @@ class rt extends C {
|
|
|
971
1210
|
}));
|
|
972
1211
|
}
|
|
973
1212
|
}
|
|
974
|
-
class
|
|
1213
|
+
class dt extends C {
|
|
975
1214
|
/**
|
|
976
1215
|
* Constructs a new BackgroundSettingSet.
|
|
977
1216
|
*
|
|
@@ -1001,17 +1240,17 @@ class ct extends C {
|
|
|
1001
1240
|
title: "Background Image",
|
|
1002
1241
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
1003
1242
|
settings: {
|
|
1004
|
-
backgroundImage: new
|
|
1243
|
+
backgroundImage: new U({
|
|
1005
1244
|
...t == null ? void 0 : t.uploadProps,
|
|
1006
1245
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
1007
1246
|
}),
|
|
1008
|
-
opacity: new
|
|
1247
|
+
opacity: new k({
|
|
1009
1248
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
1010
1249
|
}),
|
|
1011
|
-
backgroundColor: new
|
|
1250
|
+
backgroundColor: new H({
|
|
1012
1251
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
1013
1252
|
}),
|
|
1014
|
-
opacityBG: new
|
|
1253
|
+
opacityBG: new k({
|
|
1015
1254
|
default: (t == null ? void 0 : t.opacityBG) ?? 100
|
|
1016
1255
|
})
|
|
1017
1256
|
}
|
|
@@ -1025,8 +1264,8 @@ class ct extends C {
|
|
|
1025
1264
|
if (!e) return t;
|
|
1026
1265
|
const i = Array.from(e.children), [n, s, o, a] = i;
|
|
1027
1266
|
e.innerHTML = "", e.appendChild(n), e.appendChild(s);
|
|
1028
|
-
const
|
|
1029
|
-
return
|
|
1267
|
+
const r = document.createElement("div");
|
|
1268
|
+
return r.className = "bgset-or-label", r.textContent = "OR", e.appendChild(r), e.appendChild(o), e.appendChild(a), t;
|
|
1030
1269
|
}
|
|
1031
1270
|
/**
|
|
1032
1271
|
* Helper method to generate CSS based on the current settings.
|
|
@@ -1046,23 +1285,23 @@ class ct extends C {
|
|
|
1046
1285
|
}
|
|
1047
1286
|
export {
|
|
1048
1287
|
$ as AlignSetting,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1288
|
+
dt as BackgroundSettingSet,
|
|
1289
|
+
lt as BorderSettingSet,
|
|
1290
|
+
it as ButtonSetting,
|
|
1291
|
+
H as ColorSetting,
|
|
1292
|
+
st as DimensionSetting,
|
|
1293
|
+
rt as HeaderTypographySettingSet,
|
|
1294
|
+
nt as HeightSetting,
|
|
1295
|
+
ht as MarginSettingGroup,
|
|
1296
|
+
f as NumberSetting,
|
|
1297
|
+
k as OpacitySetting,
|
|
1298
|
+
at as SelectApiSettings,
|
|
1299
|
+
O as SelectSetting,
|
|
1300
|
+
m as Setting,
|
|
1062
1301
|
C as SettingGroup,
|
|
1063
1302
|
y as StringSetting,
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1303
|
+
ct as TabsContainerGroup,
|
|
1304
|
+
U as UploadSetting,
|
|
1305
|
+
ot as WidthSetting,
|
|
1306
|
+
R as iterateSettings
|
|
1068
1307
|
};
|