builder-settings-types 0.0.69 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +42 -28
- package/dist/builder-settings-types.es.js +333 -235
- package/dist/chevron-down.svg +5 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +31 -1
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
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];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
for (const e in
|
|
10
|
-
if (
|
|
11
|
-
const i =
|
|
8
|
+
function T(r, t) {
|
|
9
|
+
for (const e in r)
|
|
10
|
+
if (r.hasOwnProperty(e)) {
|
|
11
|
+
const i = r[e];
|
|
12
12
|
t(e, i);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class C {
|
|
16
16
|
constructor(t) {
|
|
17
|
-
this.id = t.id ||
|
|
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);
|
|
18
18
|
}
|
|
19
19
|
setOnChange(t) {
|
|
20
|
-
return this.onChange = t,
|
|
20
|
+
return this.onChange = t, T(this.settings, (e, i) => {
|
|
21
21
|
i.setOnChange(t);
|
|
22
22
|
}), this;
|
|
23
23
|
}
|
|
@@ -31,12 +31,12 @@ class m {
|
|
|
31
31
|
for (const i in this.settings)
|
|
32
32
|
if (this.settings.hasOwnProperty(i)) {
|
|
33
33
|
const n = this.settings[i];
|
|
34
|
-
n instanceof
|
|
34
|
+
n instanceof C ? e[i] = n.getValues() : e[i] = n.value;
|
|
35
35
|
}
|
|
36
36
|
return e;
|
|
37
37
|
} else {
|
|
38
38
|
const e = this.settings[t];
|
|
39
|
-
return e ? e instanceof
|
|
39
|
+
return e ? e instanceof C ? e.getValues() : e.value : void 0;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
draw() {
|
|
@@ -56,16 +56,16 @@ class m {
|
|
|
56
56
|
s.className = "setting-group-content", this.isCollapsed && (s.classList.add("collapsed"), n.classList.add("rotated")), e.onclick = () => {
|
|
57
57
|
this.isCollapsed = !this.isCollapsed, s.classList.toggle("collapsed"), n.classList.toggle("rotated");
|
|
58
58
|
}, e.appendChild(i), e.appendChild(n);
|
|
59
|
-
for (const
|
|
60
|
-
if (this.settings.hasOwnProperty(
|
|
61
|
-
const
|
|
62
|
-
s.appendChild(
|
|
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
63
|
}
|
|
64
|
-
return t.appendChild(e), t.appendChild(s), t;
|
|
64
|
+
return t.appendChild(e), t.appendChild(s), this.isMain && (t.classList.add("main-group"), s.classList.add("main-content")), t;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
switch (
|
|
67
|
+
function O(r) {
|
|
68
|
+
switch (r) {
|
|
69
69
|
case "number":
|
|
70
70
|
return 0;
|
|
71
71
|
case "text":
|
|
@@ -82,9 +82,9 @@ function T(l) {
|
|
|
82
82
|
return "";
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
class
|
|
85
|
+
class u {
|
|
86
86
|
constructor(t = {}) {
|
|
87
|
-
this.props = t, this.id = t.id ||
|
|
87
|
+
this.props = t, this.id = t.id || S(), this.value = this.props.default, this.title = t.title || "";
|
|
88
88
|
}
|
|
89
89
|
setOnChange(t) {
|
|
90
90
|
return this.onChange = t, this;
|
|
@@ -98,22 +98,22 @@ class g {
|
|
|
98
98
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
99
99
|
const s = document.createElement("div");
|
|
100
100
|
if (s.className = "icon-container", t.icon) {
|
|
101
|
-
const
|
|
102
|
-
s.appendChild(
|
|
101
|
+
const o = this.createIcon(t.icon, t.iconClassName);
|
|
102
|
+
s.appendChild(o);
|
|
103
103
|
}
|
|
104
104
|
if (t.title) {
|
|
105
|
-
const
|
|
106
|
-
s.appendChild(
|
|
105
|
+
const o = this.createLabel(t.title, t.labelClassName);
|
|
106
|
+
s.appendChild(o);
|
|
107
107
|
}
|
|
108
108
|
e.appendChild(s);
|
|
109
109
|
}
|
|
110
110
|
const i = document.createElement("div");
|
|
111
111
|
i.className = t.wrapperClassName || "";
|
|
112
112
|
const n = document.createElement("input");
|
|
113
|
-
return this.inputEl = n, n.value = String(t.value ||
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
t.inputType === "number" ?
|
|
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) => {
|
|
114
|
+
const o = s.target;
|
|
115
|
+
let a = o.value;
|
|
116
|
+
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);
|
|
117
117
|
}, t.inputCustomizer && t.inputCustomizer(n), i.appendChild(n), e.appendChild(i), e;
|
|
118
118
|
}
|
|
119
119
|
createLabel(t, e) {
|
|
@@ -125,7 +125,7 @@ class g {
|
|
|
125
125
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class y extends u {
|
|
129
129
|
constructor(t = {}) {
|
|
130
130
|
super(t), this.inputType = "text";
|
|
131
131
|
}
|
|
@@ -146,7 +146,7 @@ class k extends g {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
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
|
|
149
|
+
class L extends y {
|
|
150
150
|
constructor(t) {
|
|
151
151
|
super({
|
|
152
152
|
...t,
|
|
@@ -160,11 +160,11 @@ class y extends k {
|
|
|
160
160
|
return `${e}, ${i}, ${n}`;
|
|
161
161
|
}
|
|
162
162
|
rgbToHex(t) {
|
|
163
|
-
const [e, i, n] = t.split(",").map((
|
|
163
|
+
const [e, i, n] = t.split(",").map((o) => parseInt(o.trim()));
|
|
164
164
|
if (isNaN(e) || isNaN(i) || isNaN(n)) return "#000000";
|
|
165
|
-
const s = (
|
|
166
|
-
const
|
|
167
|
-
return
|
|
165
|
+
const s = (o) => {
|
|
166
|
+
const a = o.toString(16);
|
|
167
|
+
return a.length === 1 ? "0" + a : a;
|
|
168
168
|
};
|
|
169
169
|
return `#${s(e)}${s(i)}${s(n)}`;
|
|
170
170
|
}
|
|
@@ -177,44 +177,44 @@ class y extends k {
|
|
|
177
177
|
e.appendChild(i), e.appendChild(n);
|
|
178
178
|
const s = document.createElement("div");
|
|
179
179
|
s.className = "color-input-wrapper";
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
return
|
|
184
|
-
const [p, f,
|
|
185
|
-
return
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
const
|
|
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;
|
|
186
|
+
}, a = document.createElement("div");
|
|
187
|
+
a.className = "color-preview", a.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
188
|
+
const l = this.createInput({
|
|
189
189
|
value: this.value,
|
|
190
190
|
inputType: "text",
|
|
191
191
|
inputClassName: "color-text-input"
|
|
192
|
-
}), c =
|
|
192
|
+
}), c = l.querySelector("input"), d = this.createInput({
|
|
193
193
|
value: this.value ? this.rgbToHex(this.value) : "",
|
|
194
194
|
inputType: this.inputType,
|
|
195
195
|
inputClassName: "color-picker"
|
|
196
|
-
}),
|
|
197
|
-
return c.oninput = (
|
|
196
|
+
}), m = d.querySelector("input");
|
|
197
|
+
return c.oninput = (g) => {
|
|
198
198
|
var p;
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
},
|
|
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
202
|
var f;
|
|
203
|
-
const
|
|
204
|
-
this.value = p, (f = this.onChange) == null || f.call(this, p), c.value = p,
|
|
205
|
-
}, s.appendChild(
|
|
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;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
class
|
|
208
|
+
class w extends u {
|
|
209
209
|
constructor(t = {}) {
|
|
210
210
|
super(t), this.inputType = "number";
|
|
211
211
|
}
|
|
212
212
|
draw() {
|
|
213
213
|
const t = (s) => {
|
|
214
214
|
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
|
-
const
|
|
216
|
-
let
|
|
217
|
-
|
|
215
|
+
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);
|
|
218
218
|
});
|
|
219
219
|
}, e = this.createInput({
|
|
220
220
|
value: this.value,
|
|
@@ -236,7 +236,7 @@ class v extends g {
|
|
|
236
236
|
return n.className = "suffix-label", n.textContent = this.props.suffix, e.appendChild(n), e;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class b extends w {
|
|
240
240
|
constructor(t) {
|
|
241
241
|
super({
|
|
242
242
|
...t,
|
|
@@ -255,52 +255,64 @@ const I = `
|
|
|
255
255
|
<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
256
|
<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
257
|
</svg>
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
`, B = `
|
|
259
|
+
<svg xmlns="http://www.w3.org/2000/svg" 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
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
261
|
+
</svg>
|
|
262
|
+
`;
|
|
263
|
+
class N extends u {
|
|
260
264
|
constructor(t = {}) {
|
|
261
|
-
super(t), this.inputType = "select", this._options = [], t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && t.getOptionsAsync().then((e) => {
|
|
262
|
-
this._options.push(...e)
|
|
263
|
-
const s = this._options.length - e.length + n;
|
|
264
|
-
this.selectNode.appendChild(this.createOption(i, s));
|
|
265
|
-
});
|
|
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);
|
|
266
267
|
}).catch((e) => {
|
|
267
268
|
console.error("Failed to fetch async options:", e);
|
|
268
|
-
})
|
|
269
|
+
}), this.value !== void 0) {
|
|
270
|
+
const e = this._options.findIndex((i) => i.value === this.value);
|
|
271
|
+
e >= 0 && (this.selectedOptionIndex = e);
|
|
272
|
+
}
|
|
273
|
+
this.optionsListEl = this.optionsListEl, this.svgContainer = this.svgContainer;
|
|
269
274
|
}
|
|
270
275
|
createOption(t, e) {
|
|
271
|
-
const i = document.createElement("
|
|
272
|
-
return i.
|
|
276
|
+
const i = document.createElement("li");
|
|
277
|
+
return i.classList.add("select-option"), i.textContent = t.name, i.dataset.index = String(e), i;
|
|
273
278
|
}
|
|
274
279
|
draw() {
|
|
275
280
|
const t = document.createElement("div");
|
|
276
281
|
if (t.classList.add("select-container"), this.props.icon || this.props.title) {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
282
|
+
const s = document.createElement("div");
|
|
283
|
+
if (s.className = "icon-container", this.props.icon) {
|
|
284
|
+
const o = this.createIcon(this.props.icon);
|
|
285
|
+
s.appendChild(o);
|
|
281
286
|
}
|
|
282
287
|
if (this.props.title) {
|
|
283
|
-
const
|
|
284
|
-
|
|
288
|
+
const o = this.createLabel(this.props.title);
|
|
289
|
+
s.appendChild(o);
|
|
285
290
|
}
|
|
286
|
-
t.appendChild(
|
|
287
|
-
}
|
|
288
|
-
const e = document.createElement("select");
|
|
289
|
-
if (this.selectNode = e, e.classList.add("select"), this._options.forEach((i, n) => {
|
|
290
|
-
const s = this.createOption(i, n);
|
|
291
|
-
e.appendChild(s);
|
|
292
|
-
}), this.value !== void 0) {
|
|
293
|
-
const i = this._options.findIndex((n) => n.value === this.value);
|
|
294
|
-
i >= 0 && (e.value = String(i));
|
|
291
|
+
t.appendChild(s);
|
|
295
292
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, t.appendChild(e)
|
|
293
|
+
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 = () => {
|
|
295
|
+
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);
|
|
298
|
+
const i = document.createElement("ul");
|
|
299
|
+
i.classList.add("select-options"), this._options.forEach((s, o) => {
|
|
300
|
+
const a = this.createOption(s, o);
|
|
301
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
302
|
+
}), t.appendChild(i);
|
|
303
|
+
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;
|
|
308
|
+
}
|
|
309
|
+
selectOption(t, e, i) {
|
|
310
|
+
var s, o, a;
|
|
311
|
+
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"));
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
|
-
class
|
|
315
|
+
class $ extends u {
|
|
304
316
|
constructor(t = {}) {
|
|
305
317
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
306
318
|
}
|
|
@@ -345,15 +357,15 @@ class B extends g {
|
|
|
345
357
|
`
|
|
346
358
|
}
|
|
347
359
|
].forEach((s) => {
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
var
|
|
351
|
-
i.querySelectorAll(".align-option-button").forEach((
|
|
352
|
-
}), i.appendChild(
|
|
360
|
+
const o = document.createElement("button");
|
|
361
|
+
o.className = "align-option-button", o.innerHTML = s.icon, this.value === s.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
362
|
+
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);
|
|
364
|
+
}), i.appendChild(o);
|
|
353
365
|
}), t.appendChild(i), t;
|
|
354
366
|
}
|
|
355
367
|
}
|
|
356
|
-
class
|
|
368
|
+
class tt extends u {
|
|
357
369
|
constructor(t) {
|
|
358
370
|
super(t), this.inputType = "button";
|
|
359
371
|
}
|
|
@@ -366,24 +378,24 @@ class Y extends g {
|
|
|
366
378
|
return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
|
|
367
379
|
}
|
|
368
380
|
}
|
|
369
|
-
class
|
|
381
|
+
class et extends u {
|
|
370
382
|
constructor(t = {}) {
|
|
371
|
-
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
|
|
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({
|
|
372
384
|
title: "Width",
|
|
373
385
|
default: this.value.width,
|
|
374
386
|
suffix: "px",
|
|
375
387
|
// Display "px" as the unit.
|
|
376
|
-
minValue: t.minWidth ??
|
|
388
|
+
minValue: t.minWidth ?? 0,
|
|
377
389
|
maxValue: t.maxWidth,
|
|
378
|
-
icon:
|
|
390
|
+
icon: R
|
|
379
391
|
// SVG icon defined at the bottom.
|
|
380
|
-
}), this.heightSetting = new
|
|
392
|
+
}), this.heightSetting = new w({
|
|
381
393
|
title: "Height",
|
|
382
394
|
default: this.value.height,
|
|
383
395
|
suffix: "px",
|
|
384
|
-
minValue: t.minHeight ??
|
|
385
|
-
maxValue: t.maxHeight,
|
|
386
|
-
icon:
|
|
396
|
+
minValue: t.minHeight ?? 0,
|
|
397
|
+
maxValue: t.maxHeight ?? 0,
|
|
398
|
+
icon: j
|
|
387
399
|
}), this.widthSetting.setOnChange((e) => {
|
|
388
400
|
var s;
|
|
389
401
|
if (this.isUpdating || isNaN(e) || e < 1) return;
|
|
@@ -439,15 +451,15 @@ class K extends g {
|
|
|
439
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;
|
|
440
452
|
}
|
|
441
453
|
}
|
|
442
|
-
const
|
|
454
|
+
const R = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
443
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"/>
|
|
444
|
-
</svg>`,
|
|
456
|
+
</svg>`, j = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
445
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"/>
|
|
446
|
-
</svg>`,
|
|
458
|
+
</svg>`, E = `
|
|
447
459
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
448
460
|
<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"/>
|
|
449
461
|
</svg>
|
|
450
|
-
`,
|
|
462
|
+
`, A = `
|
|
451
463
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
452
464
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
453
465
|
<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"/>
|
|
@@ -457,67 +469,89 @@ const $ = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
457
469
|
<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"/>
|
|
458
470
|
</svg>
|
|
459
471
|
`;
|
|
460
|
-
class
|
|
472
|
+
class _ extends u {
|
|
461
473
|
constructor(t = {}) {
|
|
462
474
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl);
|
|
463
475
|
}
|
|
464
476
|
updatePreviewState(t = null) {
|
|
465
|
-
!this.previewWrapper || !this.previewEl || !this.emptyStateEl
|
|
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");
|
|
466
487
|
}
|
|
467
488
|
draw() {
|
|
468
489
|
const t = document.createElement("div");
|
|
469
|
-
t.className = "upload-setting-wrapper", this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper"
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
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);
|
|
499
|
+
}
|
|
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);
|
|
475
501
|
const n = document.createElement("button");
|
|
476
|
-
n.className = "
|
|
477
|
-
|
|
502
|
+
n.className = "delete-button", n.type = "button", n.title = "Delete image", n.innerHTML = W, 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">Upload</span>
|
|
507
|
+
`, n.onclick = (a) => {
|
|
508
|
+
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>
|
|
478
511
|
<span class="upload-label">Upload</span>
|
|
479
512
|
`;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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];
|
|
486
520
|
if (a)
|
|
487
521
|
try {
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
if (!
|
|
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)
|
|
492
526
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
493
|
-
const
|
|
494
|
-
method:
|
|
495
|
-
body:
|
|
496
|
-
headers:
|
|
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
|
|
497
531
|
})).json();
|
|
498
|
-
let
|
|
532
|
+
let v;
|
|
499
533
|
if (this.props.parseResponse)
|
|
500
|
-
|
|
501
|
-
else if (
|
|
534
|
+
v = this.props.parseResponse(M);
|
|
535
|
+
else if (v = (c = M == null ? void 0 : M.data) == null ? void 0 : c.url, !v)
|
|
502
536
|
throw new Error(
|
|
503
537
|
"No URL found in response. Provide a parseResponse if needed."
|
|
504
538
|
);
|
|
505
|
-
this.value =
|
|
506
|
-
} catch (
|
|
507
|
-
console.error("Error uploading file:",
|
|
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);
|
|
508
542
|
}
|
|
509
|
-
}, t.appendChild(this.previewWrapper), t.appendChild(
|
|
543
|
+
}, t.appendChild(this.previewWrapper), t.appendChild(s), t.appendChild(o), t;
|
|
510
544
|
}
|
|
511
545
|
}
|
|
512
|
-
class
|
|
546
|
+
class it extends u {
|
|
513
547
|
constructor(t = {}) {
|
|
514
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
548
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
|
|
515
549
|
title: "Height",
|
|
516
550
|
default: this.value,
|
|
517
551
|
suffix: "px",
|
|
518
552
|
minValue: t.minHeight ?? 1,
|
|
519
553
|
maxValue: t.maxHeight,
|
|
520
|
-
icon:
|
|
554
|
+
icon: F
|
|
521
555
|
}), this.numberSetting.setOnChange((e) => {
|
|
522
556
|
var i;
|
|
523
557
|
isNaN(e) || e < 1 || (this.value = e, (i = this.onChange) == null || i.call(this, this.value));
|
|
@@ -527,16 +561,16 @@ class tt extends g {
|
|
|
527
561
|
return this.numberSetting.draw();
|
|
528
562
|
}
|
|
529
563
|
}
|
|
530
|
-
const
|
|
564
|
+
const F = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
531
565
|
<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"/>
|
|
532
566
|
</svg>`;
|
|
533
|
-
class
|
|
567
|
+
class nt extends u {
|
|
534
568
|
constructor(t = {}) {
|
|
535
|
-
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new
|
|
569
|
+
super(t), this.inputType = "number", this.value = this.value ?? 100, this.numberSetting = new w({
|
|
536
570
|
title: "Width",
|
|
537
571
|
default: this.value,
|
|
538
572
|
suffix: "px",
|
|
539
|
-
minValue: t.minWidth ??
|
|
573
|
+
minValue: t.minWidth ?? 0,
|
|
540
574
|
maxValue: t.maxWidth,
|
|
541
575
|
icon: G
|
|
542
576
|
}), this.numberSetting.setOnChange((e) => {
|
|
@@ -550,40 +584,103 @@ class et extends g {
|
|
|
550
584
|
}
|
|
551
585
|
const G = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
552
586
|
<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"/>
|
|
553
|
-
</svg>`,
|
|
587
|
+
</svg>`, Z = `
|
|
588
|
+
<svg xmlns="http://www.w3.org/2000/svg" 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">
|
|
589
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
590
|
+
</svg>
|
|
591
|
+
`;
|
|
592
|
+
class st extends u {
|
|
593
|
+
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);
|
|
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;
|
|
603
|
+
}
|
|
604
|
+
createOption(t, e) {
|
|
605
|
+
const i = document.createElement("li");
|
|
606
|
+
i.classList.add("select-api-option"), i.textContent = t.name, i.dataset.index = String(e);
|
|
607
|
+
const n = document.createElement("input");
|
|
608
|
+
return n.type = "radio", n.classList.add("select-api-radio"), n.name = "select-api-radio-group", i.appendChild(n), this.selectedOptionIndex === e && (n.checked = !0), i;
|
|
609
|
+
}
|
|
610
|
+
draw() {
|
|
611
|
+
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
|
+
}
|
|
624
|
+
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 = () => {
|
|
626
|
+
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);
|
|
629
|
+
const i = document.createElement("ul");
|
|
630
|
+
i.classList.add("select-api-options"), this._options.forEach((s, o) => {
|
|
631
|
+
const a = this.createOption(s, o);
|
|
632
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
633
|
+
}), t.appendChild(i);
|
|
634
|
+
const n = document.createElement("div");
|
|
635
|
+
return n.classList.add("svg-container"), n.innerHTML = Z, t.appendChild(n), n.onclick = () => {
|
|
636
|
+
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;
|
|
639
|
+
}
|
|
640
|
+
selectApiOption(t, e, i) {
|
|
641
|
+
var s, o, a;
|
|
642
|
+
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
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
const z = `
|
|
554
651
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
555
652
|
<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"/>
|
|
556
653
|
</svg>
|
|
557
|
-
`,
|
|
654
|
+
`, U = `
|
|
558
655
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
559
656
|
<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"/>
|
|
560
657
|
</svg>
|
|
561
658
|
`;
|
|
562
|
-
class
|
|
659
|
+
class ot extends C {
|
|
563
660
|
constructor(t) {
|
|
564
661
|
super({
|
|
565
662
|
title: "Border",
|
|
566
663
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
567
664
|
settings: {
|
|
568
|
-
|
|
665
|
+
size: new w({
|
|
666
|
+
title: "Size",
|
|
667
|
+
icon: U,
|
|
668
|
+
default: (t == null ? void 0 : t.size) ?? 0,
|
|
669
|
+
suffix: "px"
|
|
670
|
+
}),
|
|
671
|
+
color: new L({
|
|
569
672
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
570
673
|
}),
|
|
571
|
-
opacity: new
|
|
674
|
+
opacity: new b({
|
|
572
675
|
default: (t == null ? void 0 : t.opacity) ?? 100,
|
|
573
676
|
minValue: 0,
|
|
574
677
|
maxValue: 100
|
|
575
678
|
}),
|
|
576
|
-
radius: new
|
|
679
|
+
radius: new w({
|
|
577
680
|
title: "Radius",
|
|
578
|
-
icon:
|
|
681
|
+
icon: z,
|
|
579
682
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
580
683
|
suffix: "px"
|
|
581
|
-
}),
|
|
582
|
-
size: new v({
|
|
583
|
-
title: "Size",
|
|
584
|
-
icon: Z,
|
|
585
|
-
default: (t == null ? void 0 : t.size) ?? 0,
|
|
586
|
-
suffix: "px"
|
|
587
684
|
})
|
|
588
685
|
}
|
|
589
686
|
});
|
|
@@ -601,34 +698,34 @@ class it extends m {
|
|
|
601
698
|
`;
|
|
602
699
|
}
|
|
603
700
|
}
|
|
604
|
-
const
|
|
701
|
+
const q = `
|
|
605
702
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
606
703
|
<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"/>
|
|
607
704
|
</svg>
|
|
608
|
-
`,
|
|
705
|
+
`, D = `
|
|
609
706
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
610
707
|
<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"/>
|
|
611
708
|
</svg>
|
|
612
|
-
`,
|
|
709
|
+
`, P = `
|
|
613
710
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
614
711
|
<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"/>
|
|
615
712
|
</svg>
|
|
616
713
|
`;
|
|
617
|
-
class
|
|
714
|
+
class at extends C {
|
|
618
715
|
constructor(t = {}) {
|
|
619
716
|
super({
|
|
620
717
|
title: t.title || "Typography",
|
|
621
718
|
collapsed: t.collapsed,
|
|
622
719
|
settings: {
|
|
623
|
-
color: new
|
|
720
|
+
color: new L({
|
|
624
721
|
default: t.colorDefault ?? "0, 0, 30"
|
|
625
722
|
}),
|
|
626
|
-
opacity: new
|
|
723
|
+
opacity: new b({
|
|
627
724
|
default: t.colorOpacityDefault ?? 100
|
|
628
725
|
}),
|
|
629
|
-
fontFamily: new
|
|
726
|
+
fontFamily: new N({
|
|
630
727
|
title: "Font",
|
|
631
|
-
icon:
|
|
728
|
+
icon: q,
|
|
632
729
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
633
730
|
options: t.fontFamilyOptions ?? [
|
|
634
731
|
{ name: "Satoshi", value: "Satoshi" },
|
|
@@ -638,9 +735,9 @@ class nt extends m {
|
|
|
638
735
|
getOptions: t.fontFamilyGetOptions,
|
|
639
736
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
640
737
|
}),
|
|
641
|
-
fontWeight: new
|
|
738
|
+
fontWeight: new N({
|
|
642
739
|
title: "Weight",
|
|
643
|
-
icon:
|
|
740
|
+
icon: D,
|
|
644
741
|
default: t.fontWeightDefault ?? "bold",
|
|
645
742
|
options: t.fontWeightOptions ?? [
|
|
646
743
|
{ name: "Regular", value: "400" },
|
|
@@ -650,13 +747,13 @@ class nt extends m {
|
|
|
650
747
|
getOptions: t.fontWeightGetOptions,
|
|
651
748
|
getOptionsAsync: t.fontWeightGetOptionsAsync
|
|
652
749
|
}),
|
|
653
|
-
fontSize: new
|
|
750
|
+
fontSize: new w({
|
|
654
751
|
title: "Size",
|
|
655
|
-
icon:
|
|
752
|
+
icon: P,
|
|
656
753
|
default: t.fontSizeDefault ?? 12,
|
|
657
754
|
suffix: "px"
|
|
658
755
|
}),
|
|
659
|
-
align: new
|
|
756
|
+
align: new $({
|
|
660
757
|
title: "Align",
|
|
661
758
|
default: t.alignDefault ?? "center"
|
|
662
759
|
})
|
|
@@ -664,18 +761,18 @@ class nt extends m {
|
|
|
664
761
|
});
|
|
665
762
|
}
|
|
666
763
|
getCssCode() {
|
|
667
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", n = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12,
|
|
764
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, i = this.settings.fontFamily.value ?? "Satoshi", n = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, o = this.settings.align.value ?? "left";
|
|
668
765
|
return `
|
|
669
766
|
color: ${t};
|
|
670
767
|
opacity: ${e / 100};
|
|
671
768
|
font-family: ${i};
|
|
672
769
|
font-weight: ${n};
|
|
673
770
|
font-size: ${s}px;
|
|
674
|
-
text-align: ${
|
|
771
|
+
text-align: ${o};
|
|
675
772
|
`;
|
|
676
773
|
}
|
|
677
774
|
}
|
|
678
|
-
class
|
|
775
|
+
class x extends u {
|
|
679
776
|
constructor(t) {
|
|
680
777
|
super({
|
|
681
778
|
...t,
|
|
@@ -683,11 +780,11 @@ class b extends g {
|
|
|
683
780
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
684
781
|
}
|
|
685
782
|
draw() {
|
|
686
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
687
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
688
|
-
const
|
|
689
|
-
let
|
|
690
|
-
|
|
783
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
784
|
+
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 l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, c = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
786
|
+
let d = Number(a.value);
|
|
787
|
+
d < l && (d = l), d > c && (d = c), a.value = String(d);
|
|
691
788
|
}));
|
|
692
789
|
}, i = this.createInput({
|
|
693
790
|
value: this.value,
|
|
@@ -708,45 +805,45 @@ class b extends g {
|
|
|
708
805
|
n && (n.style.paddingRight = "35px");
|
|
709
806
|
const s = document.createElement("span");
|
|
710
807
|
s.className = "suffix-label", s.textContent = this.props.suffix, i.appendChild(s);
|
|
711
|
-
const
|
|
712
|
-
return
|
|
713
|
-
const
|
|
714
|
-
if (
|
|
808
|
+
const o = i.querySelector("input");
|
|
809
|
+
return o && (o.oninput = (a) => {
|
|
810
|
+
const l = a.target.value.trim();
|
|
811
|
+
if (l.toLowerCase() === "auto")
|
|
715
812
|
this.value = "auto";
|
|
716
813
|
else {
|
|
717
|
-
const c = Number(
|
|
814
|
+
const c = Number(l);
|
|
718
815
|
isNaN(c) || (this.value = c);
|
|
719
816
|
}
|
|
720
817
|
this.onChange && this.onChange(this.value);
|
|
721
818
|
}), i;
|
|
722
819
|
}
|
|
723
820
|
}
|
|
724
|
-
class
|
|
821
|
+
class lt extends C {
|
|
725
822
|
constructor(t) {
|
|
726
823
|
super({
|
|
727
824
|
title: "Margins",
|
|
728
825
|
settings: {
|
|
729
|
-
marginTop: new
|
|
826
|
+
marginTop: new x({
|
|
730
827
|
title: "Top",
|
|
731
|
-
icon:
|
|
828
|
+
icon: X,
|
|
732
829
|
suffix: "px",
|
|
733
830
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
734
831
|
}),
|
|
735
|
-
marginRight: new
|
|
832
|
+
marginRight: new x({
|
|
736
833
|
title: "Right",
|
|
737
|
-
icon:
|
|
834
|
+
icon: J,
|
|
738
835
|
suffix: "px",
|
|
739
836
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
740
837
|
}),
|
|
741
|
-
marginBottom: new
|
|
838
|
+
marginBottom: new x({
|
|
742
839
|
title: "Bottom",
|
|
743
|
-
icon:
|
|
840
|
+
icon: Q,
|
|
744
841
|
suffix: "px",
|
|
745
842
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
746
843
|
}),
|
|
747
|
-
marginLeft: new
|
|
844
|
+
marginLeft: new x({
|
|
748
845
|
title: "Left",
|
|
749
|
-
icon:
|
|
846
|
+
icon: Y,
|
|
750
847
|
suffix: "px",
|
|
751
848
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
752
849
|
})
|
|
@@ -763,25 +860,25 @@ class st extends m {
|
|
|
763
860
|
`;
|
|
764
861
|
}
|
|
765
862
|
}
|
|
766
|
-
const
|
|
863
|
+
const X = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
767
864
|
<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"/>
|
|
768
|
-
</svg>`,
|
|
865
|
+
</svg>`, J = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
769
866
|
<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"/>
|
|
770
|
-
</svg>`,
|
|
867
|
+
</svg>`, Q = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
771
868
|
<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"/>
|
|
772
|
-
</svg>`,
|
|
869
|
+
</svg>`, Y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
773
870
|
<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"/>
|
|
774
871
|
</svg>`;
|
|
775
|
-
class
|
|
872
|
+
class K extends C {
|
|
776
873
|
constructor(t, e) {
|
|
777
874
|
super({
|
|
778
875
|
title: `Tab ${t + 1}`,
|
|
779
876
|
settings: {
|
|
780
|
-
name: new
|
|
877
|
+
name: new y({
|
|
781
878
|
title: "Tab Name",
|
|
782
879
|
default: `Tab ${t + 1}`
|
|
783
880
|
}),
|
|
784
|
-
content: new
|
|
881
|
+
content: new y({
|
|
785
882
|
title: "Content",
|
|
786
883
|
default: ""
|
|
787
884
|
})
|
|
@@ -805,23 +902,23 @@ class Q extends m {
|
|
|
805
902
|
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path>
|
|
806
903
|
</svg>
|
|
807
904
|
`, s.onclick = () => {
|
|
808
|
-
var
|
|
809
|
-
return (
|
|
905
|
+
var a;
|
|
906
|
+
return (a = this.onDeleteCallback) == null ? void 0 : a.call(this);
|
|
810
907
|
}, n.appendChild(s);
|
|
811
|
-
const
|
|
812
|
-
|
|
908
|
+
const o = i.querySelector("h3");
|
|
909
|
+
o ? o.insertAdjacentElement("afterend", n) : i.appendChild(n);
|
|
813
910
|
}
|
|
814
911
|
return t;
|
|
815
912
|
}
|
|
816
913
|
}
|
|
817
|
-
class
|
|
914
|
+
class rt extends C {
|
|
818
915
|
// Store the rendered element
|
|
819
916
|
constructor() {
|
|
820
917
|
super({ title: "Tabs", settings: {} }), this.tabs = [], this._el = null, this.addTab();
|
|
821
918
|
}
|
|
822
919
|
/** Adds a new tab. */
|
|
823
920
|
addTab() {
|
|
824
|
-
const t = this.tabs.length, e = new
|
|
921
|
+
const t = this.tabs.length, e = new K(t, () => this.removeTab(e));
|
|
825
922
|
this.tabs.push(e), this.settings[`Tab ${t + 1}`] = e;
|
|
826
923
|
}
|
|
827
924
|
/** Removes a specific tab. */
|
|
@@ -874,7 +971,7 @@ class at extends m {
|
|
|
874
971
|
}));
|
|
875
972
|
}
|
|
876
973
|
}
|
|
877
|
-
class
|
|
974
|
+
class ct extends C {
|
|
878
975
|
/**
|
|
879
976
|
* Constructs a new BackgroundSettingSet.
|
|
880
977
|
*
|
|
@@ -904,17 +1001,17 @@ class ot extends m {
|
|
|
904
1001
|
title: "Background Image",
|
|
905
1002
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
906
1003
|
settings: {
|
|
907
|
-
backgroundImage: new
|
|
1004
|
+
backgroundImage: new _({
|
|
908
1005
|
...t == null ? void 0 : t.uploadProps,
|
|
909
1006
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
910
1007
|
}),
|
|
911
|
-
opacity: new
|
|
1008
|
+
opacity: new b({
|
|
912
1009
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
913
1010
|
}),
|
|
914
|
-
backgroundColor: new
|
|
1011
|
+
backgroundColor: new L({
|
|
915
1012
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
916
1013
|
}),
|
|
917
|
-
opacityBG: new
|
|
1014
|
+
opacityBG: new b({
|
|
918
1015
|
default: (t == null ? void 0 : t.opacityBG) ?? 100
|
|
919
1016
|
})
|
|
920
1017
|
}
|
|
@@ -926,10 +1023,10 @@ class ot extends m {
|
|
|
926
1023
|
draw() {
|
|
927
1024
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
928
1025
|
if (!e) return t;
|
|
929
|
-
const i = Array.from(e.children), [n, s,
|
|
1026
|
+
const i = Array.from(e.children), [n, s, o, a] = i;
|
|
930
1027
|
e.innerHTML = "", e.appendChild(n), e.appendChild(s);
|
|
931
|
-
const
|
|
932
|
-
return
|
|
1028
|
+
const l = document.createElement("div");
|
|
1029
|
+
return l.className = "bgset-or-label", l.textContent = "OR", e.appendChild(l), e.appendChild(o), e.appendChild(a), t;
|
|
933
1030
|
}
|
|
934
1031
|
/**
|
|
935
1032
|
* Helper method to generate CSS based on the current settings.
|
|
@@ -948,23 +1045,24 @@ class ot extends m {
|
|
|
948
1045
|
}
|
|
949
1046
|
}
|
|
950
1047
|
export {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1048
|
+
$ as AlignSetting,
|
|
1049
|
+
ct as BackgroundSettingSet,
|
|
1050
|
+
ot as BorderSettingSet,
|
|
1051
|
+
tt as ButtonSetting,
|
|
1052
|
+
L as ColorSetting,
|
|
1053
|
+
et as DimensionSetting,
|
|
1054
|
+
at as HeaderTypographySettingSet,
|
|
1055
|
+
it as HeightSetting,
|
|
1056
|
+
lt as MarginSettingGroup,
|
|
1057
|
+
w as NumberSetting,
|
|
1058
|
+
b as OpacitySetting,
|
|
1059
|
+
st as SelectApiSettings,
|
|
1060
|
+
N as SelectSetting,
|
|
1061
|
+
u as Setting,
|
|
1062
|
+
C as SettingGroup,
|
|
1063
|
+
y as StringSetting,
|
|
1064
|
+
rt as TabsContainerGroup,
|
|
1065
|
+
_ as UploadSetting,
|
|
1066
|
+
nt as WidthSetting,
|
|
1067
|
+
T as iterateSettings
|
|
970
1068
|
};
|