builder-settings-types 0.0.77 → 0.0.79

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.
@@ -1,30 +1,26 @@
1
- const V = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
- let S = (r = 21) => {
3
- let t = "", e = crypto.getRandomValues(new Uint8Array(r |= 0));
4
- for (; r--; )
5
- t += V[e[r] & 63];
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 T(r, t) {
9
- for (const e in r)
10
- if (r.hasOwnProperty(e)) {
11
- const i = r[e];
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
16
  constructor(t) {
17
- this.id = t.id || S(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, Object.assign(this, t.settings);
17
+ 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
18
  }
19
19
  setOnChange(t) {
20
- return this.onChange = t, T(this.settings, (e, i) => {
20
+ return this.onChange = t, R(this.settings, (e, i) => {
21
21
  i.setOnChange(t);
22
22
  }), this;
23
23
  }
24
- /**
25
- * Returns all values if called with no arguments,
26
- * or returns only the values for a single child if a key is provided.
27
- */
28
24
  getValues(t) {
29
25
  if (t === void 0) {
30
26
  const e = {};
@@ -41,31 +37,108 @@ class C {
41
37
  }
42
38
  draw() {
43
39
  const t = document.createElement("div");
44
- t.className = "setting-group";
40
+ t.className = "setting-group", t.id = `setting-group-${this.id}`, this.isMain && t.classList.add("main-group");
45
41
  const e = document.createElement("div");
46
- e.className = "setting-group-title";
47
- const i = document.createElement("h3");
48
- i.textContent = this.title;
49
- const n = document.createElement("span");
50
- n.className = "setting-group-arrow", n.innerHTML = `
51
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
52
- <path d="M5 7.5L10 12.5L15 7.5" stroke="#344054" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
53
- </svg>
54
- `;
42
+ e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
43
+ "aria-expanded",
44
+ (!this.isCollapsed).toString()
45
+ ), e.setAttribute("tabindex", "0");
46
+ const i = document.createElement("div");
47
+ if (i.className = "title-section", this.icon) {
48
+ const l = document.createElement("span");
49
+ l.className = "group-icon", l.innerHTML = this.icon, i.appendChild(l);
50
+ }
51
+ const n = document.createElement("h3");
52
+ n.textContent = this.title, i.appendChild(n);
55
53
  const s = document.createElement("div");
56
- s.className = "setting-group-content", this.isCollapsed && (s.classList.add("collapsed"), n.classList.add("rotated")), e.onclick = () => {
57
- this.isCollapsed = !this.isCollapsed, s.classList.toggle("collapsed"), n.classList.toggle("rotated");
58
- }, e.appendChild(i), e.appendChild(n);
59
- for (const o in this.settings)
60
- if (this.settings.hasOwnProperty(o)) {
61
- const a = this.settings[o];
62
- s.appendChild(a.draw());
63
- }
64
- return t.appendChild(e), t.appendChild(s), this.isMain && (t.classList.add("main-group"), s.classList.add("main-content")), t;
54
+ if (s.className = "actions-section", this.description && this.isCollapsed) {
55
+ const l = document.createElement("span");
56
+ l.className = "info-marker", l.innerHTML = `
57
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
58
+ <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"
59
+ stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
60
+ </svg>
61
+ `, l.title = this.description, s.appendChild(l);
62
+ }
63
+ const o = document.createElement("span");
64
+ o.className = "setting-group-arrow", o.innerHTML = `
65
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
66
+ <path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
67
+ </svg>
68
+ `, this.isCollapsed && o.classList.add("rotated"), s.appendChild(o);
69
+ const a = document.createElement("div");
70
+ 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) {
71
+ const l = document.createElement("div");
72
+ l.className = "setting-group-description", l.textContent = this.description, a.appendChild(l);
73
+ }
74
+ const r = () => {
75
+ 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(
76
+ "aria-expanded",
77
+ (!this.isCollapsed).toString()
78
+ );
79
+ const l = a.querySelector(
80
+ ".setting-group-description"
81
+ ), u = s.querySelector(".info-marker");
82
+ if (this.description)
83
+ if (this.isCollapsed) {
84
+ if (l && l.remove(), !u) {
85
+ const d = document.createElement("span");
86
+ d.className = "info-marker", d.innerHTML = `
87
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
88
+ <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"
89
+ stroke="currentColor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
90
+ </svg>
91
+ `, d.title = this.description, s.insertBefore(d, o);
92
+ }
93
+ } else {
94
+ if (!l) {
95
+ const d = document.createElement("div");
96
+ d.className = "setting-group-description", d.textContent = this.description, a.insertBefore(
97
+ d,
98
+ a.firstChild
99
+ );
100
+ }
101
+ u && u.remove();
102
+ }
103
+ };
104
+ if (e.onclick = r, e.onkeydown = (l) => {
105
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), r());
106
+ }, Object.keys(this.settings).length > 0) {
107
+ for (const l in this.settings)
108
+ if (this.settings.hasOwnProperty(l)) {
109
+ const u = this.settings[l];
110
+ a.appendChild(u.draw());
111
+ }
112
+ } else {
113
+ const l = document.createElement("div");
114
+ l.className = "setting-group-empty", l.textContent = "No settings in this group", a.appendChild(l);
115
+ }
116
+ return e.appendChild(i), e.appendChild(s), t.appendChild(e), t.appendChild(a), this.elementRef = t, t;
117
+ }
118
+ collapse() {
119
+ if (!this.elementRef || this.isCollapsed) return;
120
+ const t = this.elementRef.querySelector(
121
+ ".setting-group-content"
122
+ ), e = this.elementRef.querySelector(".setting-group-arrow"), i = this.elementRef.querySelector(
123
+ ".setting-group-title"
124
+ );
125
+ t && e && i && (this.isCollapsed = !0, t.classList.add("collapsed"), e.classList.add("rotated"), i.setAttribute("aria-expanded", "false"));
126
+ }
127
+ expand() {
128
+ if (!this.elementRef || !this.isCollapsed) return;
129
+ const t = this.elementRef.querySelector(
130
+ ".setting-group-content"
131
+ ), e = this.elementRef.querySelector(".setting-group-arrow"), i = this.elementRef.querySelector(
132
+ ".setting-group-title"
133
+ );
134
+ t && e && i && (this.isCollapsed = !1, t.classList.remove("collapsed"), e.classList.remove("rotated"), i.setAttribute("aria-expanded", "true"));
135
+ }
136
+ toggle() {
137
+ this.isCollapsed ? this.expand() : this.collapse();
65
138
  }
66
139
  }
67
- function O(r) {
68
- switch (r) {
140
+ function B(h) {
141
+ switch (h) {
69
142
  case "number":
70
143
  return 0;
71
144
  case "text":
@@ -82,9 +155,12 @@ function O(r) {
82
155
  return "";
83
156
  }
84
157
  }
85
- class u {
158
+ class m {
86
159
  constructor(t = {}) {
87
- this.props = t, this.id = t.id || S(), this.value = this.props.default, this.title = t.title || "";
160
+ this.props = t, this.id = t.id || V(), this.value = this.props.default, this.title = t.title || "";
161
+ }
162
+ destroy() {
163
+ throw new Error("Method not implemented.");
88
164
  }
89
165
  setOnChange(t) {
90
166
  return this.onChange = t, this;
@@ -110,7 +186,7 @@ class u {
110
186
  const i = document.createElement("div");
111
187
  i.className = t.wrapperClassName || "";
112
188
  const n = document.createElement("input");
113
- return this.inputEl = n, n.value = String(t.value || O(t.inputType)), n.type = t.inputType, n.placeholder = t.placeholder || "", n.className = t.inputClassName || "", n.oninput = (s) => {
189
+ 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
190
  const o = s.target;
115
191
  let a = o.value;
116
192
  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 +201,7 @@ class u {
125
201
  return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
126
202
  }
127
203
  }
128
- class L extends u {
204
+ class y extends m {
129
205
  constructor(t = {}) {
130
206
  super(t), this.inputType = "text";
131
207
  }
@@ -145,12 +221,12 @@ class L extends u {
145
221
  });
146
222
  }
147
223
  }
148
- const H = "<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>";
149
- class y extends L {
224
+ 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>";
225
+ class H extends y {
150
226
  constructor(t) {
151
227
  super({
152
228
  ...t,
153
- icon: t.icon || H,
229
+ icon: t.icon || N,
154
230
  title: t.title || "Color"
155
231
  }), this.inputType = "color";
156
232
  }
@@ -173,39 +249,39 @@ class y extends L {
173
249
  t.className = "color-setting-wrapper";
174
250
  const e = document.createElement("div");
175
251
  e.className = "icon-container";
176
- const i = this.createIcon(this.props.icon || H), n = this.createLabel(this.title || "Color");
252
+ const i = this.createIcon(this.props.icon || N), n = this.createLabel(this.title || "Color");
177
253
  e.appendChild(i), e.appendChild(n);
178
254
  const s = document.createElement("div");
179
255
  s.className = "color-input-wrapper";
180
- const o = (g) => {
181
- const h = g.value.split(",").map((v) => parseInt(v.trim()));
182
- if (h.length !== 3 || h.some(isNaN))
183
- return g.style.border = "1px solid red", !1;
184
- const [p, f, k] = h, M = p >= 0 && p <= 255 && f >= 0 && f <= 255 && k >= 0 && k <= 255;
185
- return g.style.border = M ? "" : "1px solid red", M;
256
+ const o = (d) => {
257
+ const p = d.value.split(",").map((S) => parseInt(S.trim()));
258
+ if (p.length !== 3 || p.some(isNaN))
259
+ return d.style.border = "1px solid red", !1;
260
+ const [g, v, x] = p, b = g >= 0 && g <= 255 && v >= 0 && v <= 255 && x >= 0 && x <= 255;
261
+ return d.style.border = b ? "" : "1px solid red", b;
186
262
  }, a = document.createElement("div");
187
263
  a.className = "color-preview", a.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
188
- const l = this.createInput({
264
+ const r = this.createInput({
189
265
  value: this.value,
190
266
  inputType: "text",
191
267
  inputClassName: "color-text-input"
192
- }), c = l.querySelector("input"), d = this.createInput({
268
+ }), c = r.querySelector("input"), l = this.createInput({
193
269
  value: this.value ? this.rgbToHex(this.value) : "",
194
270
  inputType: this.inputType,
195
271
  inputClassName: "color-picker"
196
- }), m = d.querySelector("input");
197
- return c.oninput = (g) => {
198
- var p;
199
- let h = g.target.value.trim();
200
- o(c) && (this.value = h, (p = this.onChange) == null || p.call(this, h), m.value = this.rgbToHex(h), a.style.backgroundColor = `rgb(${h})`);
201
- }, m.oninput = (g) => {
202
- var f;
203
- const h = g.target.value, p = this.hexToRgb(h);
204
- this.value = p, (f = this.onChange) == null || f.call(this, p), c.value = p, a.style.backgroundColor = `rgb(${p})`;
205
- }, s.appendChild(a), s.appendChild(d), s.appendChild(l), t.appendChild(e), t.appendChild(s), this.value && (c.value = this.value, m.value = this.rgbToHex(this.value), a.style.backgroundColor = `rgb(${this.value})`), t;
272
+ }), u = l.querySelector("input");
273
+ return c.oninput = (d) => {
274
+ var g;
275
+ let p = d.target.value.trim();
276
+ o(c) && (this.value = p, (g = this.onChange) == null || g.call(this, p), u.value = this.rgbToHex(p), a.style.backgroundColor = `rgb(${p})`);
277
+ }, u.oninput = (d) => {
278
+ var v;
279
+ const p = d.target.value, g = this.hexToRgb(p);
280
+ this.value = g, (v = this.onChange) == null || v.call(this, g), c.value = g, a.style.backgroundColor = `rgb(${g})`;
281
+ }, 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
282
  }
207
283
  }
208
- class w extends u {
284
+ class f extends m {
209
285
  constructor(t = {}) {
210
286
  super(t), this.inputType = "number";
211
287
  }
@@ -213,8 +289,8 @@ class w extends u {
213
289
  const t = (s) => {
214
290
  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
291
  const o = this.props.minValue ?? Number.MIN_SAFE_INTEGER, a = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
216
- let l = Number(s.value);
217
- l < o && (l = o), l > a && (l = a), s.value = String(l);
292
+ let r = Number(s.value);
293
+ r < o && (r = o), r > a && (r = a), s.value = String(r);
218
294
  });
219
295
  }, e = this.createInput({
220
296
  value: this.value,
@@ -236,18 +312,18 @@ class w extends u {
236
312
  return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
237
313
  }
238
314
  }
239
- class x extends w {
315
+ class k extends f {
240
316
  constructor(t) {
241
317
  super({
242
318
  ...t,
243
319
  minValue: 0,
244
320
  maxValue: 100,
245
- icon: t.icon || I,
321
+ icon: t.icon || W,
246
322
  title: t.title || "Opacity"
247
323
  }), this.inputType = "number";
248
324
  }
249
325
  }
250
- const I = `
326
+ const W = `
251
327
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
252
328
  <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
329
  <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 +331,25 @@ const I = `
255
331
  <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
332
  <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
333
  </svg>
258
- `, B = `
334
+ `, A = `
259
335
  <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
336
  <polyline points="6 9 12 15 18 9"></polyline>
261
337
  </svg>
262
338
  `;
263
- class N extends u {
339
+ class O extends m {
264
340
  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 && t.getOptionsAsync().then((e) => {
266
- this._options.push(...e);
267
- }).catch((e) => {
268
- console.error("Failed to fetch async options:", e);
269
- }), this.value !== void 0) {
341
+ 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
342
  const e = this._options.findIndex((i) => i.value === this.value);
271
343
  e >= 0 && (this.selectedOptionIndex = e);
272
344
  }
273
- this.optionsListEl = this.optionsListEl, this.svgContainer = this.svgContainer;
274
345
  }
275
346
  createOption(t, e) {
276
347
  const i = document.createElement("li");
277
- return i.classList.add("select-option"), i.textContent = t.name, i.dataset.index = String(e), i;
348
+ return i.classList.add("select-option"), i.textContent = t.name, i.dataset.index = String(e), this.selectedOptionIndex === e && i.classList.add("selected"), i;
278
349
  }
279
350
  draw() {
280
351
  const t = document.createElement("div");
281
- if (t.classList.add("select-container"), this.props.icon || this.props.title) {
352
+ if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
282
353
  const s = document.createElement("div");
283
354
  if (s.className = "icon-container", this.props.icon) {
284
355
  const o = this.createIcon(this.props.icon);
@@ -289,30 +360,67 @@ class N extends u {
289
360
  s.appendChild(o);
290
361
  }
291
362
  t.appendChild(s);
363
+ } else {
364
+ const s = document.createElement("div");
365
+ t.appendChild(s);
292
366
  }
293
367
  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 = () => {
368
+ 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
369
  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);
370
+ 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));
371
+ }, t.appendChild(e), this.buttonEl = e;
298
372
  const i = document.createElement("ul");
299
373
  i.classList.add("select-options"), this._options.forEach((s, o) => {
300
374
  const a = this.createOption(s, o);
301
- a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
375
+ a.onclick = (r) => this.selectOption(r, o, e), i.appendChild(a);
302
376
  }), t.appendChild(i);
303
377
  const n = document.createElement("div");
304
- return n.classList.add("svg-container"), n.innerHTML = B, t.appendChild(n), n.onclick = () => {
305
- var s, o;
306
- this.isOpen = !this.isOpen, (s = this.optionsListEl) == null || s.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen);
307
- }, this.optionsListEl = i, this.svgContainer = n, t;
378
+ 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) => {
379
+ this._options.push(...s), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
380
+ }).catch((s) => {
381
+ console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
382
+ })), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (s) => {
383
+ var o, a;
384
+ 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"));
385
+ }, document.addEventListener("click", this.clickOutsideListener), t;
308
386
  }
309
387
  selectOption(t, e, i) {
310
388
  var s, o, a;
311
389
  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"));
390
+ 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) => {
391
+ l === e ? c.classList.add("selected") : c.classList.remove("selected");
392
+ }));
393
+ }
394
+ updateOptionsList() {
395
+ if (this.optionsListEl) {
396
+ if (this.optionsListEl.innerHTML = "", this._options.length === 0) {
397
+ const t = document.createElement("li");
398
+ t.classList.add("select-option", "empty-message"), t.textContent = "No options available", this.optionsListEl.appendChild(t);
399
+ return;
400
+ }
401
+ this._options.forEach((t, e) => {
402
+ const i = this.createOption(t, e);
403
+ i.onclick = (n) => {
404
+ this.buttonEl && this.selectOption(n, e, this.buttonEl);
405
+ }, this.optionsListEl.appendChild(i);
406
+ });
407
+ }
408
+ }
409
+ updateButtonText(t) {
410
+ if (!this.buttonEl) return;
411
+ if (this.isLoading) {
412
+ this.buttonEl.classList.add("loading"), this.buttonEl.textContent = this.props.loadingText || "Loading options...";
413
+ return;
414
+ }
415
+ this.buttonEl.classList.remove("loading", "error");
416
+ let e;
417
+ 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;
418
+ }
419
+ destroy() {
420
+ this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), super.destroy();
313
421
  }
314
422
  }
315
- class $ extends u {
423
+ class $ extends m {
316
424
  constructor(t = {}) {
317
425
  super(t), this.inputType = "button", this.value || (this.value = "center");
318
426
  }
@@ -360,12 +468,12 @@ class $ extends u {
360
468
  const o = document.createElement("button");
361
469
  o.className = "align-option-button", o.innerHTML = s.icon, this.value === s.name && o.classList.add("selected"), o.addEventListener("click", () => {
362
470
  var a;
363
- i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = s.name, (a = this.onChange) == null || a.call(this, this.value);
471
+ 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
472
  }), i.appendChild(o);
365
473
  }), t.appendChild(i), t;
366
474
  }
367
475
  }
368
- class tt extends u {
476
+ class it extends m {
369
477
  constructor(t) {
370
478
  super(t), this.inputType = "button";
371
479
  }
@@ -378,174 +486,223 @@ class tt extends u {
378
486
  return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
379
487
  }
380
488
  }
381
- class et extends u {
489
+ class st extends m {
382
490
  constructor(t = {}) {
383
- super(t), this.inputType = { width: "number", height: "number" }, this.isUpdating = !1, this.value || (this.value = { width: 100, height: 100 }), this.locked = t.locked ?? !1, this.value.height === 0 && (this.value.height = 1), this.aspectRatio = this.value.width / this.value.height, this.widthSetting = new w({
491
+ super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
492
+ const e = t.width || 100, i = t.height || 100;
493
+ this.value || (this.value = {
494
+ width: e,
495
+ height: i
496
+ }), 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
497
  title: "Width",
385
498
  default: this.value.width,
386
499
  suffix: "px",
387
- // Display "px" as the unit.
388
- minValue: t.minWidth ?? 0,
389
- maxValue: t.maxWidth,
390
- icon: R
391
- // SVG icon defined at the bottom.
392
- }), this.heightSetting = new w({
500
+ minValue: this.minWidth,
501
+ maxValue: this.maxWidth,
502
+ icon: j
503
+ }), this.heightSetting = new f({
393
504
  title: "Height",
394
505
  default: this.value.height,
395
506
  suffix: "px",
396
- minValue: t.minHeight ?? 0,
397
- maxValue: t.maxHeight ?? 0,
398
- icon: j
399
- }), this.widthSetting.setOnChange((e) => {
400
- var s;
401
- if (this.isUpdating || isNaN(e) || e < 1) return;
402
- this.isUpdating = !0;
403
- let i = e, n = this.value.height;
404
- this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (n = Math.round(i / this.aspectRatio), n < 1 && (n = 1)), this.value = { width: i, height: n }, n !== 0 && (this.aspectRatio = i / n), (s = this.onChange) == null || s.call(this, this.value), this.heightSetting.setValue(n), this.isUpdating = !1;
405
- }), this.heightSetting.setOnChange((e) => {
406
- var s;
407
- if (this.isUpdating || isNaN(e) || e < 1) return;
408
- this.isUpdating = !0;
409
- let i = e, n = this.value.width;
410
- this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (n = Math.round(i * this.aspectRatio), n < 1 && (n = 1)), this.value = { width: n, height: i }, i !== 0 && (this.aspectRatio = n / i), (s = this.onChange) == null || s.call(this, this.value), this.widthSetting.setValue(n), this.isUpdating = !1;
411
- });
507
+ minValue: this.minHeight,
508
+ maxValue: this.maxHeight,
509
+ icon: _
510
+ }), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
511
+ }
512
+ handleWidthChange(t) {
513
+ if (!this.isUpdating) {
514
+ (isNaN(t) || t < this.minWidth) && (t = this.minWidth), this.maxWidth && t > this.maxWidth && (t = this.maxWidth), this.isUpdating = !0;
515
+ try {
516
+ let e = t, i = this.value.height;
517
+ 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);
518
+ } finally {
519
+ this.isUpdating = !1;
520
+ }
521
+ }
522
+ }
523
+ handleHeightChange(t) {
524
+ if (!this.isUpdating) {
525
+ (isNaN(t) || t < this.minHeight) && (t = this.minHeight), this.maxHeight && t > this.maxHeight && (t = this.maxHeight), this.isUpdating = !0;
526
+ try {
527
+ let e = t, i = this.value.width;
528
+ 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);
529
+ } finally {
530
+ this.isUpdating = !1;
531
+ }
532
+ }
412
533
  }
413
- /**
414
- * Toggles the locked state. When locking, it recalculates the aspect ratio
415
- * based on the current width and height. Updates the lock icon accordingly.
416
- * @param lockIcon The HTMLElement containing the lock icon SVG.
417
- */
418
534
  toggleLock(t) {
419
- if (this.locked = !this.locked, this.locked) {
420
- const e = this.value.width, i = this.value.height;
421
- i !== 0 && (this.aspectRatio = e / i);
535
+ if (this.locked = !this.locked, this.locked && this.value) {
536
+ const { width: i, height: n } = this.value;
537
+ n > 0 && (this.aspectRatio = i / n);
422
538
  }
423
- t.innerHTML = this.getLockSVG(this.locked);
539
+ t.innerHTML = this.getLockSVG(this.locked), t.setAttribute("aria-pressed", String(this.locked)), t.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio";
540
+ const e = t.closest(".dimension-setting-container");
541
+ e && (this.locked ? e.classList.add("aspect-locked") : e.classList.remove("aspect-locked"));
424
542
  }
425
- /**
426
- * Returns the appropriate SVG string for the lock icon based on lock state.
427
- * @param isLocked Whether the dimension is currently locked.
428
- */
429
543
  getLockSVG(t) {
430
544
  return t ? `
431
545
  <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="#667085" stroke-linecap="round" stroke-linejoin="round"/>
433
- </svg>
434
- ` : `
435
- <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
436
- <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="#667085" stroke-linecap="round" stroke-linejoin="round"/>
437
- </svg>
438
- `;
546
+ <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"/>
547
+ </svg>` : `
548
+ <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
549
+ <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"/>
550
+ </svg>`;
551
+ }
552
+ setValue(t) {
553
+ if (t && typeof t.width == "number" && typeof t.height == "number") {
554
+ let e = Math.max(this.minWidth, t.width);
555
+ this.maxWidth && (e = Math.min(this.maxWidth, e));
556
+ let i = Math.max(this.minHeight, t.height);
557
+ this.maxHeight && (i = Math.min(this.maxHeight, i)), this.value = {
558
+ width: e,
559
+ height: i
560
+ }, this.locked && this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.isUpdating = !0;
561
+ try {
562
+ this.widthSetting.setValue(this.value.width), this.heightSetting.setValue(this.value.height);
563
+ } finally {
564
+ this.isUpdating = !1;
565
+ }
566
+ }
439
567
  }
440
- /**
441
- * 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
- */
445
568
  draw() {
446
569
  const t = document.createElement("div");
447
- t.className = "dimension-setting-container";
570
+ t.className = "dimension-setting-container", this.locked && t.classList.add("aspect-locked");
448
571
  const e = this.widthSetting.draw(), i = this.heightSetting.draw(), n = document.createElement("div");
449
572
  n.className = "dimension-bracket";
450
- const s = document.createElement("span");
451
- return s.className = "dimension-lock-icon", s.innerHTML = this.getLockSVG(this.locked), s.onclick = () => this.toggleLock(s), n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
573
+ const s = document.createElement("button");
574
+ return s.className = "dimension-lock-icon", s.setAttribute("type", "button"), s.setAttribute("aria-pressed", String(this.locked)), s.setAttribute(
575
+ "aria-label",
576
+ this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
577
+ ), s.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", s.innerHTML = this.getLockSVG(this.locked), s.onclick = (o) => {
578
+ o.preventDefault(), this.toggleLock(s);
579
+ }, n.appendChild(s), t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
580
+ }
581
+ isLocked() {
582
+ return this.locked;
583
+ }
584
+ setLocked(t) {
585
+ if (this.locked !== t) {
586
+ if (this.locked = t, this.locked && this.value) {
587
+ const { width: i, height: n } = this.value;
588
+ n > 0 && (this.aspectRatio = i / n);
589
+ }
590
+ const e = document.querySelector(
591
+ ".dimension-setting-container .dimension-lock-icon"
592
+ );
593
+ if (e instanceof HTMLElement) {
594
+ e.innerHTML = this.getLockSVG(this.locked), e.setAttribute("aria-pressed", String(this.locked)), e.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio";
595
+ const i = e.closest(".dimension-setting-container");
596
+ i && (this.locked ? i.classList.add("aspect-locked") : i.classList.remove("aspect-locked"));
597
+ }
598
+ }
452
599
  }
453
600
  }
454
- const R = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
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="#667085" stroke-linecap="round" stroke-linejoin="round"/>
456
- </svg>`, j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
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="#667085" stroke-linecap="round" stroke-linejoin="round"/>
458
- </svg>`, E = `
601
+ const j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
602
+ <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"/>
603
+ </svg>`, _ = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
604
+ <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"/>
605
+ </svg>`, M = `
459
606
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
460
607
  <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
608
  </svg>
462
- `, A = `
609
+ `, T = `
463
610
  <svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
464
611
  <rect width="91" height="71" rx="4" fill="#F2F4F7"/>
465
612
  <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
613
  </svg>
467
- `, _ = `
614
+ `, q = `
468
615
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
469
616
  <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
617
  </svg>
471
618
  `;
472
- class W extends u {
619
+ class U extends m {
473
620
  constructor(t = {}) {
474
621
  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
622
  }
476
623
  updatePreviewState(t = null) {
477
- if (!(!this.previewWrapper || !this.previewEl || !this.emptyStateEl))
478
- if (t && t !== "") {
479
- this.previewEl.style.display = "block", this.emptyStateEl.style.display = "none";
480
- const e = document.querySelector(".upload-setting-wrapper"), i = document.querySelector(".upload-button");
481
- e && (e.style.gridTemplateColumns = "1fr 1fr"), i && (i.innerHTML = `
482
- <span class="upload-icon">${E}</span>
483
- <span class="upload-label">Replace</span>
484
- `), this.previewEl.src = t, this.previewWrapper.classList.add("has-image");
485
- } else
486
- this.previewEl.style.display = "none", this.emptyStateEl.style.display = "block", this.previewEl.src = "", this.previewWrapper.classList.remove("has-image");
624
+ if (!this.previewWrapper || !this.previewEl || !this.emptyStateEl) return;
625
+ const e = this.previewWrapper.parentElement, i = e == null ? void 0 : e.querySelector(".upload-button"), n = e == null ? void 0 : e.querySelector(
626
+ ".preview-placeholder"
627
+ );
628
+ 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 = `
629
+ <span class="upload-icon">${M}</span>
630
+ <span class="upload-label">Replace</span>
631
+ `)) : (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 = `
632
+ <span class="upload-icon">${M}</span>
633
+ <span class="upload-label">Upload</span>
634
+ `));
487
635
  }
488
636
  draw() {
489
637
  const t = document.createElement("div");
490
- t.className = "upload-setting-wrapper", this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper";
491
- const e = document.createElement("div");
492
- if (e.className = "icon-title-container", this.props.icon) {
493
- const a = this.createIcon(this.props.icon);
494
- e.appendChild(a);
495
- }
496
- if (this.props.title) {
497
- const a = this.createLabel(this.props.title);
498
- e.appendChild(a);
638
+ t.className = "upload-setting-wrapper";
639
+ const e = !!(this.props.title || this.props.icon);
640
+ if (e || t.classList.add("no-label"), e) {
641
+ const c = document.createElement("div");
642
+ if (c.className = "icon-title-container", this.props.icon) {
643
+ const l = this.createIcon(this.props.icon);
644
+ c.appendChild(l);
645
+ }
646
+ if (this.props.title) {
647
+ const l = this.createLabel(this.props.title);
648
+ c.appendChild(l);
649
+ }
650
+ t.appendChild(c);
499
651
  }
500
- t.appendChild(e), this.emptyStateEl = document.createElement("div"), this.emptyStateEl.className = "empty-state", this.emptyStateEl.innerHTML = A, this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.value && this.value !== "" ? this.updatePreviewState(this.value) : this.updatePreviewState(null);
501
- const n = document.createElement("button");
502
- n.className = "delete-button", n.type = "button", n.title = "Delete image", n.innerHTML = _, this.previewWrapper.appendChild(this.emptyStateEl), this.previewWrapper.appendChild(this.previewEl), this.previewWrapper.appendChild(n);
503
- const s = document.createElement("button");
504
- s.className = "upload-button", s.innerHTML = `
505
- <span class="upload-icon">${E}</span>
506
- <span class="upload-label">Replace</span>
507
- `, n.onclick = (a) => {
652
+ const i = document.createElement("div");
653
+ i.className = "preview-button-container";
654
+ const n = this.value && this.value !== "";
655
+ n || i.classList.add("no-image");
656
+ const s = document.createElement("div");
657
+ 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";
658
+ const o = document.createElement("button");
659
+ 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);
660
+ const a = document.createElement("button");
661
+ a.className = "upload-button", a.innerHTML = `
662
+ <span class="upload-icon">${M}</span>
663
+ <span class="upload-label">Upload</span>
664
+ `;
665
+ const r = document.createElement("input");
666
+ 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
667
  var l;
509
- a.stopPropagation(), this.value = "", this.updatePreviewState(null), (l = this.onChange) == null || l.call(this, ""), t.style.gridTemplateColumns = "1fr", s.innerHTML = `
510
- <span class="upload-icon">${E}</span>
511
- <span class="upload-label">Upload</span>
512
- `;
513
- };
514
- const o = document.createElement("input");
515
- return o.type = "file", o.accept = "image/*", o.style.display = "none", s.onclick = () => {
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)
668
+ c.stopPropagation(), this.value = "", this.updatePreviewState(null), (l = this.onChange) == null || l.call(this, "");
669
+ }, a.onclick = () => {
670
+ r.click();
671
+ }, r.onchange = async () => {
672
+ var l, u, d;
673
+ const c = (l = r.files) == null ? void 0 : l[0];
674
+ if (c)
521
675
  try {
522
- const m = new FormData(), g = this.props.formFieldName || "file";
523
- m.append(g, a, a.name);
524
- const h = this.props.uploadUrl;
525
- if (!h)
676
+ a.classList.add("loading"), a.disabled = !0;
677
+ const p = new FormData(), g = this.props.formFieldName || "file";
678
+ p.append(g, c, c.name);
679
+ const v = this.props.uploadUrl;
680
+ if (!v)
526
681
  throw new Error("No uploadUrl provided to UploadSetting.");
527
- const p = this.props.requestMethod || "POST", f = { ...this.props.requestHeaders || {} }, M = await (await fetch(h, {
528
- method: p,
529
- body: m,
530
- headers: f
682
+ const x = this.props.requestMethod || "POST", b = { ...this.props.requestHeaders || {} }, L = await (await fetch(v, {
683
+ method: x,
684
+ body: p,
685
+ headers: b
531
686
  })).json();
532
- let v;
687
+ let w;
533
688
  if (this.props.parseResponse)
534
- v = this.props.parseResponse(M);
535
- else if (v = (c = M == null ? void 0 : M.data) == null ? void 0 : c.url, !v)
689
+ w = this.props.parseResponse(L);
690
+ else if (w = (u = L == null ? void 0 : L.data) == null ? void 0 : u.url, !w)
536
691
  throw new Error(
537
692
  "No URL found in response. Provide a parseResponse if needed."
538
693
  );
539
- this.value = v, this.updatePreviewState(v), (d = this.onChange) == null || d.call(this, v);
540
- } catch (m) {
541
- console.error("Error uploading file:", m), this.updatePreviewState(null);
694
+ this.value = w, this.updatePreviewState(w), (d = this.onChange) == null || d.call(this, w);
695
+ } catch (p) {
696
+ console.error("Error uploading file:", p), this.updatePreviewState(null);
697
+ } finally {
698
+ a.classList.remove("loading"), a.disabled = !1;
542
699
  }
543
- }, t.appendChild(this.previewWrapper), t.appendChild(s), t.appendChild(o), t;
700
+ }, t;
544
701
  }
545
702
  }
546
- class it extends u {
703
+ class nt extends m {
547
704
  constructor(t = {}) {
548
- super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
705
+ super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new f({
549
706
  title: "Height",
550
707
  default: this.value,
551
708
  suffix: "px",
@@ -564,9 +721,9 @@ class it extends u {
564
721
  const F = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
565
722
  <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
723
  </svg>`;
567
- class nt extends u {
724
+ class ot extends m {
568
725
  constructor(t = {}) {
569
- super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
726
+ super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new f({
570
727
  title: "Width",
571
728
  default: this.value,
572
729
  suffix: "px",
@@ -589,17 +746,9 @@ const G = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
589
746
  <polyline points="6 9 12 15 18 9"></polyline>
590
747
  </svg>
591
748
  `;
592
- class st extends u {
749
+ class at extends m {
593
750
  constructor(t = {}) {
594
- 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 && t.getOptionsAsync().then((e) => {
595
- this._options.push(...e), this.updateOptionsList();
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;
751
+ 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
752
  }
604
753
  createOption(t, e) {
605
754
  const i = document.createElement("li");
@@ -609,82 +758,125 @@ class st extends u {
609
758
  }
610
759
  draw() {
611
760
  const t = document.createElement("div");
612
- if (t.classList.add("select-api-container"), this.props.icon || this.props.title) {
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
- }
761
+ t.classList.add("select-api-container"), this.container = t;
624
762
  const e = document.createElement("div");
625
- e.classList.add("select-api-button"), e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option", e.onclick = () => {
763
+ if (e.classList.add("select-api-button"), this.props.title) {
764
+ e.classList.add("has-label");
765
+ const s = document.createElement("div");
766
+ s.className = "select-label", s.textContent = this.props.title, e.appendChild(s);
767
+ const o = document.createElement("span");
768
+ 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);
769
+ } else
770
+ this.isLoading ? e.textContent = this.props.loadingText || "Loading options..." : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : "Select an option";
771
+ e.onclick = () => {
626
772
  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);
773
+ 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));
774
+ }, t.appendChild(e), this.buttonEl = e;
629
775
  const i = document.createElement("ul");
630
776
  i.classList.add("select-api-options"), this._options.forEach((s, o) => {
631
777
  const a = this.createOption(s, o);
632
- a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
778
+ a.onclick = (r) => this.selectApiOption(r, o, e), i.appendChild(a);
633
779
  }), t.appendChild(i);
634
780
  const n = document.createElement("div");
635
781
  return n.classList.add("svg-container"), n.innerHTML = Z, t.appendChild(n), n.onclick = () => {
636
782
  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, t;
783
+ 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));
784
+ }, this.optionsListEl = i, this.svgContainer = n, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((s) => {
785
+ this._options.push(...s), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
786
+ }).catch((s) => {
787
+ console.error("Failed to fetch async options:", s), this.isLoading = !1, this.updateButtonText("Failed to load options");
788
+ })), t;
639
789
  }
640
790
  selectApiOption(t, e, i) {
641
791
  var s, o, a;
642
792
  const n = this._options[e];
643
- if (n) {
644
- console.log("selectedOption", 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");
645
- const l = t.currentTarget.querySelector(".select-api-radio");
646
- l && (l.checked = !0);
647
- }
793
+ 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(
794
+ ".select-api-radio"
795
+ ).forEach((c, l) => {
796
+ c.checked = l === e;
797
+ }));
648
798
  }
649
799
  updateOptionsList() {
650
- this.optionsListEl && (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
651
- const i = this.createOption(t, e);
652
- i.onclick = (n) => this.selectApiOption(n, e, this.optionsListEl), this.optionsListEl.appendChild(i);
653
- }));
800
+ if (this.optionsListEl) {
801
+ if (this.optionsListEl.innerHTML = "", this._options.length === 0) {
802
+ const t = document.createElement("li");
803
+ t.classList.add("select-api-option", "empty-message"), t.textContent = "No options available", this.optionsListEl.appendChild(t);
804
+ return;
805
+ }
806
+ this._options.forEach((t, e) => {
807
+ const i = this.createOption(t, e);
808
+ this.selectedOptionIndex === e && i.classList.add("selected"), i.onclick = (n) => {
809
+ this.buttonEl && this.selectApiOption(n, e, this.buttonEl);
810
+ }, i.tabIndex = 0, i.addEventListener("keydown", (n) => {
811
+ (n.key === "Enter" || n.key === " ") && (n.preventDefault(), this.buttonEl && this.selectApiOption(n, e, this.buttonEl));
812
+ }), this.optionsListEl.appendChild(i);
813
+ });
814
+ }
815
+ }
816
+ updateButtonText(t) {
817
+ if (!this.buttonEl) return;
818
+ const e = this.buttonEl.querySelector(".select-value"), i = this.buttonEl.classList.contains("has-label"), n = this.buttonEl.querySelector(".select-label");
819
+ if (this.isLoading) {
820
+ this.buttonEl.classList.add("loading");
821
+ const o = this.props.loadingText || "Loading options...";
822
+ if (e)
823
+ e.textContent = o;
824
+ else if (i && this.props.title && !n) {
825
+ this.buttonEl.innerHTML = "";
826
+ const a = document.createElement("div");
827
+ a.className = "select-label", a.textContent = this.props.title, this.buttonEl.appendChild(a);
828
+ const r = document.createElement("span");
829
+ r.className = "select-value", r.textContent = o, this.buttonEl.appendChild(r);
830
+ } else
831
+ this.buttonEl.textContent = o;
832
+ return;
833
+ }
834
+ this.buttonEl.classList.remove("loading", "error");
835
+ let s;
836
+ 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)
837
+ e.textContent = s;
838
+ else if (i && this.props.title && !n) {
839
+ this.buttonEl.innerHTML = "";
840
+ const o = document.createElement("div");
841
+ o.className = "select-label", o.textContent = this.props.title, this.buttonEl.appendChild(o);
842
+ const a = document.createElement("span");
843
+ a.className = "select-value", a.textContent = s, this.buttonEl.appendChild(a);
844
+ } else
845
+ this.buttonEl.textContent = s;
654
846
  }
655
847
  }
656
- const z = `
848
+ const D = `
657
849
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
658
850
  <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"/>
659
851
  </svg>
660
- `, q = `
852
+ `, z = `
661
853
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
662
854
  <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"/>
663
855
  </svg>
664
856
  `;
665
- class ot extends C {
857
+ class lt extends C {
666
858
  constructor(t) {
667
859
  super({
668
860
  title: "Border",
669
861
  collapsed: t == null ? void 0 : t.collapsed,
670
862
  settings: {
671
- size: new w({
863
+ size: new f({
672
864
  title: "Size",
673
- icon: q,
865
+ icon: z,
674
866
  default: (t == null ? void 0 : t.size) ?? 0,
675
867
  suffix: "px"
676
868
  }),
677
- color: new y({
869
+ color: new H({
678
870
  default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
679
871
  }),
680
- opacity: new x({
872
+ opacity: new k({
681
873
  default: (t == null ? void 0 : t.opacity) ?? 100,
682
874
  minValue: 0,
683
875
  maxValue: 100
684
876
  }),
685
- radius: new w({
877
+ radius: new f({
686
878
  title: "Radius",
687
- icon: z,
879
+ icon: D,
688
880
  default: (t == null ? void 0 : t.radius) ?? 12,
689
881
  suffix: "px"
690
882
  })
@@ -704,34 +896,34 @@ class ot extends C {
704
896
  `;
705
897
  }
706
898
  }
707
- const U = `
899
+ const P = `
708
900
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
709
901
  <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"/>
710
902
  </svg>
711
- `, D = `
903
+ `, X = `
712
904
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
713
905
  <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"/>
714
906
  </svg>
715
- `, P = `
907
+ `, J = `
716
908
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
717
909
  <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"/>
718
910
  </svg>
719
911
  `;
720
- class at extends C {
912
+ class rt extends C {
721
913
  constructor(t = {}) {
722
914
  super({
723
915
  title: t.title || "Typography",
724
916
  collapsed: t.collapsed,
725
917
  settings: {
726
- color: new y({
918
+ color: new H({
727
919
  default: t.colorDefault ?? "0, 0, 30"
728
920
  }),
729
- opacity: new x({
921
+ opacity: new k({
730
922
  default: t.colorOpacityDefault ?? 100
731
923
  }),
732
- fontFamily: new N({
924
+ fontFamily: new O({
733
925
  title: "Font",
734
- icon: U,
926
+ icon: P,
735
927
  default: t.fontFamilyDefault ?? "Satoshi",
736
928
  options: t.fontFamilyOptions ?? [
737
929
  { name: "Satoshi", value: "Satoshi" },
@@ -741,10 +933,10 @@ class at extends C {
741
933
  getOptions: t.fontFamilyGetOptions,
742
934
  getOptionsAsync: t.fontFamilyGetOptionsAsync
743
935
  }),
744
- fontWeight: new N({
936
+ fontWeight: new O({
745
937
  title: "Weight",
746
- icon: D,
747
- default: t.fontWeightDefault ?? "bold",
938
+ icon: X,
939
+ default: t.fontWeightDefault ?? "400",
748
940
  options: t.fontWeightOptions ?? [
749
941
  { name: "Regular", value: "400" },
750
942
  { name: "Medium", value: "500" },
@@ -753,9 +945,9 @@ class at extends C {
753
945
  getOptions: t.fontWeightGetOptions,
754
946
  getOptionsAsync: t.fontWeightGetOptionsAsync
755
947
  }),
756
- fontSize: new w({
948
+ fontSize: new f({
757
949
  title: "Size",
758
- icon: P,
950
+ icon: J,
759
951
  default: t.fontSizeDefault ?? 12,
760
952
  suffix: "px"
761
953
  }),
@@ -778,7 +970,7 @@ class at extends C {
778
970
  `;
779
971
  }
780
972
  }
781
- class b extends u {
973
+ class E extends m {
782
974
  constructor(t) {
783
975
  super({
784
976
  ...t,
@@ -788,9 +980,9 @@ class b extends u {
788
980
  draw() {
789
981
  const t = this.value === "auto" ? "text" : "number", e = (a) => {
790
982
  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", () => {
791
- const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, c = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
792
- let d = Number(a.value);
793
- d < l && (d = l), d > c && (d = c), a.value = String(d);
983
+ const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER, c = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
984
+ let l = Number(a.value);
985
+ l < r && (l = r), l > c && (l = c), a.value = String(l);
794
986
  }));
795
987
  }, i = this.createInput({
796
988
  value: this.value,
@@ -813,43 +1005,43 @@ class b extends u {
813
1005
  s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
814
1006
  const o = i.querySelector("input");
815
1007
  return o && (o.oninput = (a) => {
816
- const l = a.target.value.trim();
817
- if (l.toLowerCase() === "auto")
1008
+ const r = a.target.value.trim();
1009
+ if (r.toLowerCase() === "auto")
818
1010
  this.value = "auto";
819
1011
  else {
820
- const c = Number(l);
1012
+ const c = Number(r);
821
1013
  isNaN(c) || (this.value = c);
822
1014
  }
823
1015
  this.onChange && this.onChange(this.value);
824
1016
  }), i;
825
1017
  }
826
1018
  }
827
- class lt extends C {
1019
+ class ht extends C {
828
1020
  constructor(t) {
829
1021
  super({
830
1022
  title: "Margins",
831
1023
  settings: {
832
- marginTop: new b({
1024
+ marginTop: new E({
833
1025
  title: "Top",
834
- icon: X,
1026
+ icon: Q,
835
1027
  suffix: "px",
836
1028
  default: (t == null ? void 0 : t.marginTop) ?? "auto"
837
1029
  }),
838
- marginRight: new b({
1030
+ marginRight: new E({
839
1031
  title: "Right",
840
- icon: J,
1032
+ icon: Y,
841
1033
  suffix: "px",
842
1034
  default: (t == null ? void 0 : t.marginRight) ?? 0
843
1035
  }),
844
- marginBottom: new b({
1036
+ marginBottom: new E({
845
1037
  title: "Bottom",
846
- icon: Q,
1038
+ icon: K,
847
1039
  suffix: "px",
848
1040
  default: (t == null ? void 0 : t.marginBottom) ?? 0
849
1041
  }),
850
- marginLeft: new b({
1042
+ marginLeft: new E({
851
1043
  title: "Left",
852
- icon: Y,
1044
+ icon: tt,
853
1045
  suffix: "px",
854
1046
  default: (t == null ? void 0 : t.marginLeft) ?? 0
855
1047
  })
@@ -866,25 +1058,25 @@ class lt extends C {
866
1058
  `;
867
1059
  }
868
1060
  }
869
- const X = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1061
+ const Q = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
870
1062
  <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"/>
871
- </svg>`, J = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1063
+ </svg>`, Y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
872
1064
  <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"/>
873
- </svg>`, Q = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1065
+ </svg>`, K = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
874
1066
  <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"/>
875
- </svg>`, Y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
1067
+ </svg>`, tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
876
1068
  <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"/>
877
1069
  </svg>`;
878
- class K extends C {
1070
+ class et extends C {
879
1071
  constructor(t, e) {
880
1072
  super({
881
1073
  title: `Tab ${t + 1}`,
882
1074
  settings: {
883
- name: new L({
1075
+ name: new y({
884
1076
  title: "Tab Name",
885
1077
  default: `Tab ${t + 1}`
886
1078
  }),
887
- content: new L({
1079
+ content: new y({
888
1080
  title: "Content",
889
1081
  default: ""
890
1082
  })
@@ -917,14 +1109,14 @@ class K extends C {
917
1109
  return t;
918
1110
  }
919
1111
  }
920
- class rt extends C {
1112
+ class ct extends C {
921
1113
  // Store the rendered element
922
1114
  constructor() {
923
1115
  super({ title: "Tabs", settings: {} }), this.tabs = [], this._el = null, this.addTab();
924
1116
  }
925
1117
  /** Adds a new tab. */
926
1118
  addTab() {
927
- const t = this.tabs.length, e = new K(t, () => this.removeTab(e));
1119
+ const t = this.tabs.length, e = new et(t, () => this.removeTab(e));
928
1120
  this.tabs.push(e), this.settings[`Tab ${t + 1}`] = e;
929
1121
  }
930
1122
  /** Removes a specific tab. */
@@ -977,7 +1169,7 @@ class rt extends C {
977
1169
  }));
978
1170
  }
979
1171
  }
980
- class ct extends C {
1172
+ class dt extends C {
981
1173
  /**
982
1174
  * Constructs a new BackgroundSettingSet.
983
1175
  *
@@ -1007,17 +1199,17 @@ class ct extends C {
1007
1199
  title: "Background Image",
1008
1200
  collapsed: t == null ? void 0 : t.collapsed,
1009
1201
  settings: {
1010
- backgroundImage: new W({
1202
+ backgroundImage: new U({
1011
1203
  ...t == null ? void 0 : t.uploadProps,
1012
1204
  default: (t == null ? void 0 : t.backgroundImage) ?? ""
1013
1205
  }),
1014
- opacity: new x({
1206
+ opacity: new k({
1015
1207
  default: (t == null ? void 0 : t.opacity) ?? 100
1016
1208
  }),
1017
- backgroundColor: new y({
1209
+ backgroundColor: new H({
1018
1210
  default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
1019
1211
  }),
1020
- opacityBG: new x({
1212
+ opacityBG: new k({
1021
1213
  default: (t == null ? void 0 : t.opacityBG) ?? 100
1022
1214
  })
1023
1215
  }
@@ -1031,8 +1223,8 @@ class ct extends C {
1031
1223
  if (!e) return t;
1032
1224
  const i = Array.from(e.children), [n, s, o, a] = i;
1033
1225
  e.innerHTML = "", e.appendChild(n), e.appendChild(s);
1034
- const l = document.createElement("div");
1035
- return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(o), e.appendChild(a), t;
1226
+ const r = document.createElement("div");
1227
+ return r.className = "bgset-or-label", r.textContent = "OR", e.appendChild(r), e.appendChild(o), e.appendChild(a), t;
1036
1228
  }
1037
1229
  /**
1038
1230
  * Helper method to generate CSS based on the current settings.
@@ -1052,23 +1244,23 @@ class ct extends C {
1052
1244
  }
1053
1245
  export {
1054
1246
  $ as AlignSetting,
1055
- ct as BackgroundSettingSet,
1056
- ot as BorderSettingSet,
1057
- tt as ButtonSetting,
1058
- y as ColorSetting,
1059
- et as DimensionSetting,
1060
- at as HeaderTypographySettingSet,
1061
- it as HeightSetting,
1062
- lt as MarginSettingGroup,
1063
- w as NumberSetting,
1064
- x as OpacitySetting,
1065
- st as SelectApiSettings,
1066
- N as SelectSetting,
1067
- u as Setting,
1247
+ dt as BackgroundSettingSet,
1248
+ lt as BorderSettingSet,
1249
+ it as ButtonSetting,
1250
+ H as ColorSetting,
1251
+ st as DimensionSetting,
1252
+ rt as HeaderTypographySettingSet,
1253
+ nt as HeightSetting,
1254
+ ht as MarginSettingGroup,
1255
+ f as NumberSetting,
1256
+ k as OpacitySetting,
1257
+ at as SelectApiSettings,
1258
+ O as SelectSetting,
1259
+ m as Setting,
1068
1260
  C as SettingGroup,
1069
- L as StringSetting,
1070
- rt as TabsContainerGroup,
1071
- W as UploadSetting,
1072
- nt as WidthSetting,
1073
- T as iterateSettings
1261
+ y as StringSetting,
1262
+ ct as TabsContainerGroup,
1263
+ U as UploadSetting,
1264
+ ot as WidthSetting,
1265
+ R as iterateSettings
1074
1266
  };