builder-settings-types 0.0.58 → 0.0.59
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 +38 -38
- package/dist/builder-settings-types.es.js +259 -231
- package/dist/index.d.ts +38 -5
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const N = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let E = (l = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(l |= 0));
|
|
4
4
|
for (; l--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += N[e[l] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function L(l, t) {
|
|
9
9
|
for (const e in l)
|
|
10
10
|
if (l.hasOwnProperty(e)) {
|
|
11
|
-
const
|
|
12
|
-
t(e,
|
|
11
|
+
const n = l[e];
|
|
12
|
+
t(e, n);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class g {
|
|
16
16
|
constructor(t) {
|
|
17
|
-
this.id = t.id ||
|
|
17
|
+
this.id = t.id || E(), this.title = t.title, this.settings = t.settings, Object.assign(this, t.settings);
|
|
18
18
|
}
|
|
19
19
|
setOnChange(t) {
|
|
20
|
-
return this.onChange = t,
|
|
21
|
-
|
|
20
|
+
return this.onChange = t, L(this.settings, (e, n) => {
|
|
21
|
+
n.setOnChange(t);
|
|
22
22
|
}), this;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -28,15 +28,15 @@ class d {
|
|
|
28
28
|
getValues(t) {
|
|
29
29
|
if (t === void 0) {
|
|
30
30
|
const e = {};
|
|
31
|
-
for (const
|
|
32
|
-
if (this.settings.hasOwnProperty(
|
|
33
|
-
const
|
|
34
|
-
|
|
31
|
+
for (const n in this.settings)
|
|
32
|
+
if (this.settings.hasOwnProperty(n)) {
|
|
33
|
+
const i = this.settings[n];
|
|
34
|
+
i instanceof g ? e[n] = i.getValues() : e[n] = i.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 g ? e.getValues() : e.value : void 0;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
draw() {
|
|
@@ -44,17 +44,17 @@ class d {
|
|
|
44
44
|
t.className = "setting-group";
|
|
45
45
|
const e = document.createElement("div");
|
|
46
46
|
e.className = "setting-group-title";
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
47
|
+
const n = document.createElement("h3");
|
|
48
|
+
n.textContent = this.title;
|
|
49
|
+
const i = document.createElement("span");
|
|
50
|
+
i.className = "setting-group-arrow", i.innerHTML = `
|
|
51
51
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
52
52
|
<path d="M5 7.5L10 12.5L15 7.5" stroke="#344054" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
|
|
53
53
|
</svg>
|
|
54
54
|
`, e.onclick = () => {
|
|
55
55
|
const o = t.querySelector(".setting-group-content");
|
|
56
|
-
o && (o.classList.toggle("collapsed"),
|
|
57
|
-
}, e.appendChild(
|
|
56
|
+
o && (o.classList.toggle("collapsed"), i.classList.toggle("rotated"));
|
|
57
|
+
}, e.appendChild(n), e.appendChild(i);
|
|
58
58
|
const s = document.createElement("div");
|
|
59
59
|
s.className = "setting-group-content";
|
|
60
60
|
for (const o in this.settings)
|
|
@@ -65,7 +65,7 @@ class d {
|
|
|
65
65
|
return t.appendChild(e), t.appendChild(s), t;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function S(l) {
|
|
69
69
|
switch (l) {
|
|
70
70
|
case "number":
|
|
71
71
|
return 0;
|
|
@@ -83,9 +83,9 @@ function L(l) {
|
|
|
83
83
|
return "";
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
class
|
|
86
|
+
class C {
|
|
87
87
|
constructor(t = {}) {
|
|
88
|
-
this.props = t, this.id = t.id ||
|
|
88
|
+
this.props = t, this.id = t.id || E(), this.value = this.props.default, this.title = t.title || "";
|
|
89
89
|
}
|
|
90
90
|
setOnChange(t) {
|
|
91
91
|
return this.onChange = t, this;
|
|
@@ -108,25 +108,25 @@ class g {
|
|
|
108
108
|
}
|
|
109
109
|
e.appendChild(s);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
return this.inputEl =
|
|
111
|
+
const n = document.createElement("div");
|
|
112
|
+
n.className = t.wrapperClassName || "";
|
|
113
|
+
const i = document.createElement("input");
|
|
114
|
+
return this.inputEl = i, i.value = String(t.value || S(t.inputType)), i.type = t.inputType, i.placeholder = t.placeholder || "", i.className = t.inputClassName || "", i.oninput = (s) => {
|
|
115
115
|
const o = s.target;
|
|
116
116
|
let a = o.value;
|
|
117
117
|
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);
|
|
118
|
-
}, t.inputCustomizer && t.inputCustomizer(
|
|
118
|
+
}, t.inputCustomizer && t.inputCustomizer(i), n.appendChild(i), e.appendChild(n), e;
|
|
119
119
|
}
|
|
120
120
|
createLabel(t, e) {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
121
|
+
const n = document.createElement("span");
|
|
122
|
+
return n.textContent = t, n.className = "input-label " + (e || ""), n;
|
|
123
123
|
}
|
|
124
124
|
createIcon(t, e) {
|
|
125
|
-
const
|
|
126
|
-
return
|
|
125
|
+
const n = document.createElement("span");
|
|
126
|
+
return n.className = "input-icon " + (e || ""), n.innerHTML = t, n;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class b extends C {
|
|
130
130
|
constructor(t = {}) {
|
|
131
131
|
super(t), this.inputType = "text";
|
|
132
132
|
}
|
|
@@ -146,12 +146,12 @@ class x extends g {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
const
|
|
150
|
-
class
|
|
149
|
+
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>";
|
|
150
|
+
class k extends b {
|
|
151
151
|
constructor(t) {
|
|
152
152
|
super({
|
|
153
153
|
...t,
|
|
154
|
-
icon: t.icon ||
|
|
154
|
+
icon: t.icon || H,
|
|
155
155
|
title: t.title || "Color"
|
|
156
156
|
}), this.inputType = "color";
|
|
157
157
|
}
|
|
@@ -160,40 +160,40 @@ class b extends x {
|
|
|
160
160
|
t.className = "color-setting-wrapper";
|
|
161
161
|
const e = document.createElement("div");
|
|
162
162
|
e.className = "icon-container";
|
|
163
|
-
const
|
|
164
|
-
e.appendChild(
|
|
163
|
+
const n = this.createIcon(this.props.icon || H), i = this.createLabel(this.title || "Color");
|
|
164
|
+
e.appendChild(n), e.appendChild(i);
|
|
165
165
|
const s = document.createElement("div");
|
|
166
166
|
s.className = "color-input-wrapper";
|
|
167
|
-
const o = /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, a = (
|
|
168
|
-
const c =
|
|
169
|
-
return o.test(c) ? (
|
|
167
|
+
const o = /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, a = (d) => {
|
|
168
|
+
const c = d.value.startsWith("#") ? d.value.slice(1) : d.value;
|
|
169
|
+
return o.test(c) ? (d.style.border = "", !0) : (d.style.border = "1px solid red", !1);
|
|
170
170
|
}, r = document.createElement("div");
|
|
171
171
|
r.className = "color-preview", r.style.backgroundColor = this.value || "";
|
|
172
|
-
const
|
|
172
|
+
const h = this.createInput({
|
|
173
173
|
value: this.value,
|
|
174
174
|
inputType: "text",
|
|
175
175
|
inputClassName: "color-text-input"
|
|
176
|
-
}),
|
|
176
|
+
}), u = h.querySelector(
|
|
177
177
|
"input"
|
|
178
|
-
),
|
|
178
|
+
), w = this.createInput({
|
|
179
179
|
value: this.value,
|
|
180
180
|
inputType: this.inputType,
|
|
181
181
|
inputClassName: "color-picker"
|
|
182
|
-
}),
|
|
182
|
+
}), f = w.querySelector(
|
|
183
183
|
"input"
|
|
184
184
|
);
|
|
185
|
-
return
|
|
186
|
-
var
|
|
187
|
-
let c =
|
|
188
|
-
c.charAt(0) !== "#" && (c = "#" + c,
|
|
189
|
-
},
|
|
190
|
-
var
|
|
191
|
-
let c =
|
|
192
|
-
c.charAt(0) !== "#" && (c = "#" + c,
|
|
193
|
-
}, s.appendChild(r), s.appendChild(
|
|
185
|
+
return u.oninput = (d) => {
|
|
186
|
+
var p;
|
|
187
|
+
let c = d.target.value.trim();
|
|
188
|
+
c.charAt(0) !== "#" && (c = "#" + c, u.value = c), a(u) && (this.value = c, (p = this.onChange) == null || p.call(this, c), f.value = c, r.style.backgroundColor = c);
|
|
189
|
+
}, f.oninput = (d) => {
|
|
190
|
+
var p;
|
|
191
|
+
let c = d.target.value;
|
|
192
|
+
c.charAt(0) !== "#" && (c = "#" + c, f.value = c), this.value = c, (p = this.onChange) == null || p.call(this, c), u.value = c, r.style.backgroundColor = c, a(u);
|
|
193
|
+
}, s.appendChild(r), s.appendChild(w), s.appendChild(h), t.appendChild(e), t.appendChild(s), t;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
class v extends
|
|
196
|
+
class v extends C {
|
|
197
197
|
constructor(t = {}) {
|
|
198
198
|
super(t), this.inputType = "number";
|
|
199
199
|
}
|
|
@@ -216,15 +216,15 @@ class v extends g {
|
|
|
216
216
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
217
217
|
return e;
|
|
218
218
|
e.classList.add("suffix-wrapper");
|
|
219
|
-
const
|
|
219
|
+
const n = e.querySelector(
|
|
220
220
|
"input.number-setting-input"
|
|
221
221
|
);
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
return
|
|
222
|
+
n && (n.style.paddingRight = "35px");
|
|
223
|
+
const i = document.createElement("span");
|
|
224
|
+
return i.className = "suffix-label", i.textContent = this.props.suffix, e.appendChild(i), e;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
class
|
|
227
|
+
class x extends v {
|
|
228
228
|
constructor(t) {
|
|
229
229
|
super({
|
|
230
230
|
...t,
|
|
@@ -244,51 +244,51 @@ const V = `
|
|
|
244
244
|
<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"/>
|
|
245
245
|
</svg>
|
|
246
246
|
`;
|
|
247
|
-
class
|
|
247
|
+
class y extends C {
|
|
248
248
|
constructor(t = {}) {
|
|
249
249
|
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) => {
|
|
250
|
-
this._options.push(...e), this.selectNode && e.forEach((
|
|
251
|
-
const s = this._options.length - e.length +
|
|
252
|
-
this.selectNode.appendChild(this.createOption(
|
|
250
|
+
this._options.push(...e), this.selectNode && e.forEach((n, i) => {
|
|
251
|
+
const s = this._options.length - e.length + i;
|
|
252
|
+
this.selectNode.appendChild(this.createOption(n, s));
|
|
253
253
|
});
|
|
254
254
|
}).catch((e) => {
|
|
255
255
|
console.error("Failed to fetch async options:", e);
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
258
|
createOption(t, e) {
|
|
259
|
-
const
|
|
260
|
-
return
|
|
259
|
+
const n = document.createElement("option");
|
|
260
|
+
return n.value = String(e), n.textContent = t.name, n;
|
|
261
261
|
}
|
|
262
262
|
draw() {
|
|
263
263
|
const t = document.createElement("div");
|
|
264
264
|
if (t.classList.add("select-container"), this.props.icon || this.props.title) {
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
268
|
-
|
|
265
|
+
const n = document.createElement("div");
|
|
266
|
+
if (n.className = "icon-container", this.props.icon) {
|
|
267
|
+
const i = this.createIcon(this.props.icon);
|
|
268
|
+
n.appendChild(i);
|
|
269
269
|
}
|
|
270
270
|
if (this.props.title) {
|
|
271
|
-
const
|
|
272
|
-
|
|
271
|
+
const i = this.createLabel(this.props.title);
|
|
272
|
+
n.appendChild(i);
|
|
273
273
|
}
|
|
274
|
-
t.appendChild(
|
|
274
|
+
t.appendChild(n);
|
|
275
275
|
}
|
|
276
276
|
const e = document.createElement("select");
|
|
277
|
-
if (this.selectNode = e, e.classList.add("select"), this._options.forEach((
|
|
278
|
-
const s = this.createOption(
|
|
277
|
+
if (this.selectNode = e, e.classList.add("select"), this._options.forEach((n, i) => {
|
|
278
|
+
const s = this.createOption(n, i);
|
|
279
279
|
e.appendChild(s);
|
|
280
280
|
}), this.value !== void 0) {
|
|
281
|
-
const
|
|
282
|
-
|
|
281
|
+
const n = this._options.findIndex((i) => i.value === this.value);
|
|
282
|
+
n >= 0 && (e.value = String(n));
|
|
283
283
|
}
|
|
284
|
-
return e.onchange = (
|
|
284
|
+
return e.onchange = (n) => {
|
|
285
285
|
var o;
|
|
286
|
-
const
|
|
286
|
+
const i = Number(n.target.value), s = this._options[i];
|
|
287
287
|
s && (this.value = s.value, (o = this.onChange) == null || o.call(this, this.value));
|
|
288
288
|
}, t.appendChild(e), t;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
class
|
|
291
|
+
class T extends C {
|
|
292
292
|
constructor(t = {}) {
|
|
293
293
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
294
294
|
}
|
|
@@ -297,8 +297,8 @@ class S extends g {
|
|
|
297
297
|
t.className = "align-setting-wrapper";
|
|
298
298
|
const e = document.createElement("label");
|
|
299
299
|
e.className = "align-setting-label", e.textContent = this.title || "Align", t.appendChild(e);
|
|
300
|
-
const
|
|
301
|
-
return
|
|
300
|
+
const n = document.createElement("div");
|
|
301
|
+
return n.className = "align-options-container", [
|
|
302
302
|
{
|
|
303
303
|
name: "left",
|
|
304
304
|
icon: `
|
|
@@ -336,12 +336,12 @@ class S extends g {
|
|
|
336
336
|
const o = document.createElement("button");
|
|
337
337
|
o.className = "align-option-button", o.innerHTML = s.icon, this.value === s.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
338
338
|
var a;
|
|
339
|
-
|
|
340
|
-
}),
|
|
341
|
-
}), t.appendChild(
|
|
339
|
+
n.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);
|
|
340
|
+
}), n.appendChild(o);
|
|
341
|
+
}), t.appendChild(n), t;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
class
|
|
344
|
+
class q extends C {
|
|
345
345
|
constructor(t) {
|
|
346
346
|
super(t), this.inputType = "button";
|
|
347
347
|
}
|
|
@@ -354,7 +354,7 @@ class D extends g {
|
|
|
354
354
|
return e.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), e.appendChild(t), e;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
class
|
|
357
|
+
class D extends C {
|
|
358
358
|
constructor(t = {}) {
|
|
359
359
|
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 v({
|
|
360
360
|
title: "Width",
|
|
@@ -363,7 +363,7 @@ class U extends g {
|
|
|
363
363
|
// Display "px" as the unit.
|
|
364
364
|
minValue: t.minWidth ?? 1,
|
|
365
365
|
maxValue: t.maxWidth,
|
|
366
|
-
icon:
|
|
366
|
+
icon: I
|
|
367
367
|
// SVG icon defined at the bottom.
|
|
368
368
|
}), this.heightSetting = new v({
|
|
369
369
|
title: "Height",
|
|
@@ -371,19 +371,19 @@ class U extends g {
|
|
|
371
371
|
suffix: "px",
|
|
372
372
|
minValue: t.minHeight ?? 1,
|
|
373
373
|
maxValue: t.maxHeight,
|
|
374
|
-
icon:
|
|
374
|
+
icon: B
|
|
375
375
|
}), this.widthSetting.setOnChange((e) => {
|
|
376
376
|
var s;
|
|
377
377
|
if (this.isUpdating || isNaN(e) || e < 1) return;
|
|
378
378
|
this.isUpdating = !0;
|
|
379
|
-
let
|
|
380
|
-
this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (
|
|
379
|
+
let n = e, i = this.value.height;
|
|
380
|
+
this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (i = Math.round(n / this.aspectRatio), i < 1 && (i = 1)), this.value = { width: n, height: i }, i !== 0 && (this.aspectRatio = n / i), (s = this.onChange) == null || s.call(this, this.value), this.heightSetting.setValue(i), this.isUpdating = !1;
|
|
381
381
|
}), this.heightSetting.setOnChange((e) => {
|
|
382
382
|
var s;
|
|
383
383
|
if (this.isUpdating || isNaN(e) || e < 1) return;
|
|
384
384
|
this.isUpdating = !0;
|
|
385
|
-
let
|
|
386
|
-
this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (
|
|
385
|
+
let n = e, i = this.value.width;
|
|
386
|
+
this.locked && isFinite(this.aspectRatio) && !isNaN(this.aspectRatio) && (i = Math.round(n * this.aspectRatio), i < 1 && (i = 1)), this.value = { width: i, height: n }, n !== 0 && (this.aspectRatio = i / n), (s = this.onChange) == null || s.call(this, this.value), this.widthSetting.setValue(i), this.isUpdating = !1;
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
@@ -393,8 +393,8 @@ class U extends g {
|
|
|
393
393
|
*/
|
|
394
394
|
toggleLock(t) {
|
|
395
395
|
if (this.locked = !this.locked, this.locked) {
|
|
396
|
-
const e = this.value.width,
|
|
397
|
-
|
|
396
|
+
const e = this.value.width, n = this.value.height;
|
|
397
|
+
n !== 0 && (this.aspectRatio = e / n);
|
|
398
398
|
}
|
|
399
399
|
t.innerHTML = this.getLockSVG(this.locked);
|
|
400
400
|
}
|
|
@@ -421,22 +421,22 @@ class U extends g {
|
|
|
421
421
|
draw() {
|
|
422
422
|
const t = document.createElement("div");
|
|
423
423
|
t.className = "dimension-setting-container";
|
|
424
|
-
const e = this.widthSetting.draw(),
|
|
425
|
-
|
|
424
|
+
const e = this.widthSetting.draw(), n = this.heightSetting.draw(), i = document.createElement("div");
|
|
425
|
+
i.className = "dimension-bracket";
|
|
426
426
|
const s = document.createElement("span");
|
|
427
|
-
return s.className = "dimension-lock-icon", s.innerHTML = this.getLockSVG(this.locked), s.onclick = () => this.toggleLock(s),
|
|
427
|
+
return s.className = "dimension-lock-icon", s.innerHTML = this.getLockSVG(this.locked), s.onclick = () => this.toggleLock(s), i.appendChild(s), t.appendChild(e), t.appendChild(i), t.appendChild(n), t;
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
const
|
|
430
|
+
const I = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
431
431
|
<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"/>
|
|
432
|
-
</svg>`,
|
|
432
|
+
</svg>`, B = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
433
433
|
<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"/>
|
|
434
434
|
</svg>`, O = `
|
|
435
435
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
436
436
|
<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"/>
|
|
437
437
|
</svg>
|
|
438
438
|
`;
|
|
439
|
-
class
|
|
439
|
+
class R extends C {
|
|
440
440
|
constructor(t = {}) {
|
|
441
441
|
super(t), this.inputType = "button", !this.value && t.defaultUrl && (this.value = t.defaultUrl);
|
|
442
442
|
}
|
|
@@ -445,44 +445,44 @@ class B extends g {
|
|
|
445
445
|
t.className = "upload-setting-wrapper";
|
|
446
446
|
const e = document.createElement("img");
|
|
447
447
|
e.className = "upload-preview", e.src = this.value || this.props.defaultUrl || "";
|
|
448
|
-
const
|
|
449
|
-
|
|
448
|
+
const n = document.createElement("button");
|
|
449
|
+
n.className = "upload-button", n.innerHTML = `
|
|
450
450
|
<span class="upload-icon">${O}</span>
|
|
451
451
|
<span class="upload-label">Upload</span>
|
|
452
452
|
`;
|
|
453
|
-
const
|
|
454
|
-
return
|
|
455
|
-
|
|
456
|
-
},
|
|
457
|
-
var o, a;
|
|
458
|
-
const s = (o =
|
|
453
|
+
const i = document.createElement("input");
|
|
454
|
+
return i.type = "file", i.accept = "image/*", i.style.display = "none", n.onclick = () => {
|
|
455
|
+
i.click();
|
|
456
|
+
}, i.onchange = async () => {
|
|
457
|
+
var o, a, r;
|
|
458
|
+
const s = (o = i.files) == null ? void 0 : o[0];
|
|
459
459
|
if (s)
|
|
460
460
|
try {
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if (m.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
} catch (
|
|
480
|
-
console.error("Error uploading file:",
|
|
461
|
+
const h = new FormData(), u = this.props.formFieldName || "file";
|
|
462
|
+
h.append(u, s, s.name);
|
|
463
|
+
const w = this.props.uploadUrl;
|
|
464
|
+
if (!w)
|
|
465
|
+
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
466
|
+
const f = this.props.requestMethod || "POST", d = { ...this.props.requestHeaders || {} }, p = await (await fetch(w, {
|
|
467
|
+
method: f,
|
|
468
|
+
body: h,
|
|
469
|
+
headers: d
|
|
470
|
+
})).json();
|
|
471
|
+
let m;
|
|
472
|
+
if (this.props.parseResponse)
|
|
473
|
+
m = this.props.parseResponse(p);
|
|
474
|
+
else if (m = (a = p == null ? void 0 : p.data) == null ? void 0 : a.url, !m)
|
|
475
|
+
throw new Error(
|
|
476
|
+
"No URL found in response. Provide a parseResponse if needed."
|
|
477
|
+
);
|
|
478
|
+
this.value = m, e.src = m, (r = this.onChange) == null || r.call(this, m);
|
|
479
|
+
} catch (h) {
|
|
480
|
+
console.error("Error uploading file:", h);
|
|
481
481
|
}
|
|
482
|
-
}, t.appendChild(e), t.appendChild(
|
|
482
|
+
}, t.appendChild(e), t.appendChild(n), t.appendChild(i), t;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
const
|
|
485
|
+
const $ = `
|
|
486
486
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
487
487
|
<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"/>
|
|
488
488
|
</svg>
|
|
@@ -491,22 +491,22 @@ const R = `
|
|
|
491
491
|
<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"/>
|
|
492
492
|
</svg>
|
|
493
493
|
`;
|
|
494
|
-
class
|
|
494
|
+
class P extends g {
|
|
495
495
|
constructor(t) {
|
|
496
496
|
super({
|
|
497
497
|
title: "Border",
|
|
498
498
|
settings: {
|
|
499
|
-
color: new
|
|
499
|
+
color: new k({
|
|
500
500
|
default: (t == null ? void 0 : t.color) ?? "#00141E"
|
|
501
501
|
}),
|
|
502
|
-
opacity: new
|
|
502
|
+
opacity: new x({
|
|
503
503
|
default: (t == null ? void 0 : t.opacity) ?? 100,
|
|
504
504
|
minValue: 0,
|
|
505
505
|
maxValue: 100
|
|
506
506
|
}),
|
|
507
507
|
radius: new v({
|
|
508
508
|
title: "Radius",
|
|
509
|
-
icon:
|
|
509
|
+
icon: $,
|
|
510
510
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
511
511
|
suffix: "px"
|
|
512
512
|
}),
|
|
@@ -523,11 +523,11 @@ class q extends d {
|
|
|
523
523
|
* Optional helper to generate CSS from the current settings.
|
|
524
524
|
*/
|
|
525
525
|
getCssCode() {
|
|
526
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100,
|
|
526
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, n = this.settings.radius.value ?? 0, i = this.settings.size.value ?? 0;
|
|
527
527
|
return `
|
|
528
528
|
border-color: ${t};
|
|
529
|
-
border-width: ${
|
|
530
|
-
border-radius: ${
|
|
529
|
+
border-width: ${i}px;
|
|
530
|
+
border-radius: ${n}px;
|
|
531
531
|
opacity: ${e / 100};
|
|
532
532
|
`;
|
|
533
533
|
}
|
|
@@ -536,27 +536,27 @@ const A = `
|
|
|
536
536
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
537
537
|
<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"/>
|
|
538
538
|
</svg>
|
|
539
|
-
`,
|
|
539
|
+
`, _ = `
|
|
540
540
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
541
541
|
<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"/>
|
|
542
542
|
</svg>
|
|
543
|
-
`,
|
|
543
|
+
`, G = `
|
|
544
544
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
545
545
|
<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"/>
|
|
546
546
|
</svg>
|
|
547
547
|
`;
|
|
548
|
-
class
|
|
548
|
+
class X extends g {
|
|
549
549
|
constructor(t = {}) {
|
|
550
550
|
super({
|
|
551
551
|
title: "Header Typography",
|
|
552
552
|
settings: {
|
|
553
|
-
color: new
|
|
553
|
+
color: new k({
|
|
554
554
|
default: t.colorDefault ?? "#00141E"
|
|
555
555
|
}),
|
|
556
|
-
opacity: new
|
|
556
|
+
opacity: new x({
|
|
557
557
|
default: t.colorOpacityDefault ?? 100
|
|
558
558
|
}),
|
|
559
|
-
fontFamily: new
|
|
559
|
+
fontFamily: new y({
|
|
560
560
|
title: "Font",
|
|
561
561
|
icon: A,
|
|
562
562
|
default: t.fontFamilyDefault ?? "Satoshi",
|
|
@@ -568,9 +568,9 @@ class J extends d {
|
|
|
568
568
|
getOptions: t.fontFamilyGetOptions,
|
|
569
569
|
getOptionsAsync: t.fontFamilyGetOptionsAsync
|
|
570
570
|
}),
|
|
571
|
-
fontWeight: new
|
|
571
|
+
fontWeight: new y({
|
|
572
572
|
title: "Weight",
|
|
573
|
-
icon:
|
|
573
|
+
icon: _,
|
|
574
574
|
default: t.fontWeightDefault ?? "bold",
|
|
575
575
|
options: t.fontWeightOptions ?? [
|
|
576
576
|
{ name: "Regular", value: "regular" },
|
|
@@ -582,11 +582,11 @@ class J extends d {
|
|
|
582
582
|
}),
|
|
583
583
|
fontSize: new v({
|
|
584
584
|
title: "Size",
|
|
585
|
-
icon:
|
|
585
|
+
icon: G,
|
|
586
586
|
default: t.fontSizeDefault ?? 12,
|
|
587
587
|
suffix: "px"
|
|
588
588
|
}),
|
|
589
|
-
align: new
|
|
589
|
+
align: new T({
|
|
590
590
|
title: "Align",
|
|
591
591
|
default: t.alignDefault ?? "center"
|
|
592
592
|
})
|
|
@@ -594,18 +594,18 @@ class J extends d {
|
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
596
|
getCssCode() {
|
|
597
|
-
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100,
|
|
597
|
+
const t = this.settings.color.value ?? "#000000", e = this.settings.opacity.value ?? 100, n = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, o = this.settings.align.value ?? "left";
|
|
598
598
|
return `
|
|
599
599
|
color: ${t};
|
|
600
600
|
opacity: ${e / 100};
|
|
601
|
-
font-family: ${
|
|
602
|
-
font-weight: ${
|
|
601
|
+
font-family: ${n};
|
|
602
|
+
font-weight: ${i};
|
|
603
603
|
font-size: ${s}px;
|
|
604
604
|
text-align: ${o};
|
|
605
605
|
`;
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
class
|
|
608
|
+
class M extends C {
|
|
609
609
|
constructor(t) {
|
|
610
610
|
super({
|
|
611
611
|
...t,
|
|
@@ -615,11 +615,11 @@ class f extends g {
|
|
|
615
615
|
draw() {
|
|
616
616
|
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
617
617
|
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", () => {
|
|
618
|
-
const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER,
|
|
619
|
-
let
|
|
620
|
-
|
|
618
|
+
const r = this.props.minValue ?? Number.MIN_SAFE_INTEGER, h = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
619
|
+
let u = Number(a.value);
|
|
620
|
+
u < r && (u = r), u > h && (u = h), a.value = String(u);
|
|
621
621
|
}));
|
|
622
|
-
},
|
|
622
|
+
}, n = this.createInput({
|
|
623
623
|
value: this.value,
|
|
624
624
|
inputType: t,
|
|
625
625
|
title: this.props.title,
|
|
@@ -630,51 +630,51 @@ class f extends g {
|
|
|
630
630
|
placeholder: this.value === "auto" ? "auto" : ""
|
|
631
631
|
});
|
|
632
632
|
if (!this.props.suffix || this.props.suffix === "none")
|
|
633
|
-
return
|
|
634
|
-
|
|
635
|
-
const
|
|
633
|
+
return n;
|
|
634
|
+
n.classList.add("suffix-wrapper");
|
|
635
|
+
const i = n.querySelector(
|
|
636
636
|
"input.number-setting-input"
|
|
637
637
|
);
|
|
638
|
-
|
|
638
|
+
i && (i.style.paddingRight = "35px");
|
|
639
639
|
const s = document.createElement("span");
|
|
640
|
-
s.className = "suffix-label", s.textContent = this.props.suffix,
|
|
641
|
-
const o =
|
|
640
|
+
s.className = "suffix-label", s.textContent = this.props.suffix, n.appendChild(s);
|
|
641
|
+
const o = n.querySelector("input");
|
|
642
642
|
return o && (o.oninput = (a) => {
|
|
643
643
|
const r = a.target.value.trim();
|
|
644
644
|
if (r.toLowerCase() === "auto")
|
|
645
645
|
this.value = "auto";
|
|
646
646
|
else {
|
|
647
|
-
const
|
|
648
|
-
isNaN(
|
|
647
|
+
const h = Number(r);
|
|
648
|
+
isNaN(h) || (this.value = h);
|
|
649
649
|
}
|
|
650
650
|
this.onChange && this.onChange(this.value);
|
|
651
|
-
}),
|
|
651
|
+
}), n;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
class
|
|
654
|
+
class J extends g {
|
|
655
655
|
constructor(t) {
|
|
656
656
|
super({
|
|
657
657
|
title: "Margins",
|
|
658
658
|
settings: {
|
|
659
|
-
marginTop: new
|
|
659
|
+
marginTop: new M({
|
|
660
660
|
title: "Top",
|
|
661
|
-
icon:
|
|
661
|
+
icon: F,
|
|
662
662
|
suffix: "px",
|
|
663
663
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
664
664
|
}),
|
|
665
|
-
marginRight: new
|
|
665
|
+
marginRight: new M({
|
|
666
666
|
title: "Right",
|
|
667
|
-
icon:
|
|
667
|
+
icon: U,
|
|
668
668
|
suffix: "px",
|
|
669
669
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
670
670
|
}),
|
|
671
|
-
marginBottom: new
|
|
671
|
+
marginBottom: new M({
|
|
672
672
|
title: "Bottom",
|
|
673
|
-
icon:
|
|
673
|
+
icon: W,
|
|
674
674
|
suffix: "px",
|
|
675
675
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
676
676
|
}),
|
|
677
|
-
marginLeft: new
|
|
677
|
+
marginLeft: new M({
|
|
678
678
|
title: "Left",
|
|
679
679
|
icon: Z,
|
|
680
680
|
suffix: "px",
|
|
@@ -684,34 +684,34 @@ class Y extends d {
|
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
686
|
getCssCode() {
|
|
687
|
-
const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value,
|
|
687
|
+
const t = typeof this.settings.marginTop.value == "number" ? `${this.settings.marginTop.value}px` : this.settings.marginTop.value, e = typeof this.settings.marginRight.value == "number" ? `${this.settings.marginRight.value}px` : this.settings.marginRight.value, n = typeof this.settings.marginBottom.value == "number" ? `${this.settings.marginBottom.value}px` : this.settings.marginBottom.value, i = typeof this.settings.marginLeft.value == "number" ? `${this.settings.marginLeft.value}px` : this.settings.marginLeft.value;
|
|
688
688
|
return `
|
|
689
689
|
margin-top: ${t};
|
|
690
690
|
margin-right: ${e};
|
|
691
|
-
margin-bottom: ${
|
|
692
|
-
margin-left: ${
|
|
691
|
+
margin-bottom: ${n};
|
|
692
|
+
margin-left: ${i};
|
|
693
693
|
`;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
|
-
const
|
|
696
|
+
const F = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
697
697
|
<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"/>
|
|
698
|
-
</svg>`,
|
|
698
|
+
</svg>`, U = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
699
699
|
<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"/>
|
|
700
|
-
</svg>`,
|
|
700
|
+
</svg>`, W = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
701
701
|
<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"/>
|
|
702
702
|
</svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
703
703
|
<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"/>
|
|
704
704
|
</svg>`;
|
|
705
|
-
class
|
|
705
|
+
class z extends g {
|
|
706
706
|
constructor(t, e) {
|
|
707
707
|
super({
|
|
708
708
|
title: `Tab ${t + 1}`,
|
|
709
709
|
settings: {
|
|
710
|
-
name: new
|
|
710
|
+
name: new b({
|
|
711
711
|
title: "Tab Name",
|
|
712
712
|
default: `Tab ${t + 1}`
|
|
713
713
|
}),
|
|
714
|
-
content: new
|
|
714
|
+
content: new b({
|
|
715
715
|
title: "Content",
|
|
716
716
|
default: ""
|
|
717
717
|
})
|
|
@@ -721,10 +721,10 @@ class _ extends d {
|
|
|
721
721
|
draw() {
|
|
722
722
|
const t = super.draw(), e = t.querySelector(".setting-group-arrow");
|
|
723
723
|
e && e.parentElement && e.parentElement.removeChild(e);
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
726
|
-
const
|
|
727
|
-
|
|
724
|
+
const n = t.querySelector(".setting-group-title");
|
|
725
|
+
if (n) {
|
|
726
|
+
const i = document.createElement("div");
|
|
727
|
+
i.className = "tab-delete-container";
|
|
728
728
|
const s = document.createElement("button");
|
|
729
729
|
s.className = "tab-delete-button", s.innerHTML = `
|
|
730
730
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#f87171" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="trash-icon">
|
|
@@ -737,21 +737,21 @@ class _ extends d {
|
|
|
737
737
|
`, s.onclick = () => {
|
|
738
738
|
var a;
|
|
739
739
|
return (a = this.onDeleteCallback) == null ? void 0 : a.call(this);
|
|
740
|
-
},
|
|
741
|
-
const o =
|
|
742
|
-
o ? o.insertAdjacentElement("afterend",
|
|
740
|
+
}, i.appendChild(s);
|
|
741
|
+
const o = n.querySelector("h3");
|
|
742
|
+
o ? o.insertAdjacentElement("afterend", i) : n.appendChild(i);
|
|
743
743
|
}
|
|
744
744
|
return t;
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
|
-
class
|
|
747
|
+
class Q extends g {
|
|
748
748
|
// Store the rendered element
|
|
749
749
|
constructor() {
|
|
750
750
|
super({ title: "Tabs", settings: {} }), this.tabs = [], this._el = null, this.addTab();
|
|
751
751
|
}
|
|
752
752
|
/** Adds a new tab. */
|
|
753
753
|
addTab() {
|
|
754
|
-
const t = this.tabs.length, e = new
|
|
754
|
+
const t = this.tabs.length, e = new z(t, () => this.removeTab(e));
|
|
755
755
|
this.tabs.push(e), this.settings[`Tab ${t + 1}`] = e;
|
|
756
756
|
}
|
|
757
757
|
/** Removes a specific tab. */
|
|
@@ -774,8 +774,8 @@ class X extends d {
|
|
|
774
774
|
this._el = t;
|
|
775
775
|
const e = document.createElement("div");
|
|
776
776
|
e.className = "tabs-add-btn-container";
|
|
777
|
-
const
|
|
778
|
-
return
|
|
777
|
+
const n = document.createElement("button");
|
|
778
|
+
return n.className = "tabs-add-button", n.innerHTML = `
|
|
779
779
|
<span class="add-icon">
|
|
780
780
|
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#667085">
|
|
781
781
|
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
|
@@ -788,9 +788,9 @@ class X extends d {
|
|
|
788
788
|
</svg>
|
|
789
789
|
</span>
|
|
790
790
|
<span class="add-label">Add Tab</span>
|
|
791
|
-
`,
|
|
791
|
+
`, n.onclick = () => {
|
|
792
792
|
this.addTab(), this.rerender();
|
|
793
|
-
}, e.appendChild(
|
|
793
|
+
}, e.appendChild(n), t.appendChild(e), t;
|
|
794
794
|
}
|
|
795
795
|
/**
|
|
796
796
|
* Re-renders the inner settings content based on the current tabs.
|
|
@@ -799,71 +799,99 @@ class X extends d {
|
|
|
799
799
|
if (!this._el) return;
|
|
800
800
|
const t = this._el.querySelector(".setting-group-content");
|
|
801
801
|
t && (t.innerHTML = "", Object.keys(this.settings).forEach((e) => {
|
|
802
|
-
const
|
|
803
|
-
t.appendChild(
|
|
802
|
+
const n = this.settings[e];
|
|
803
|
+
t.appendChild(n.draw());
|
|
804
804
|
}));
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
|
-
class
|
|
807
|
+
class Y extends g {
|
|
808
|
+
/**
|
|
809
|
+
* Constructs a new BackgroundSettingSet.
|
|
810
|
+
*
|
|
811
|
+
* @param props An object that may include default values for each setting and additional
|
|
812
|
+
* properties for the UploadSetting via `uploadProps`.
|
|
813
|
+
*
|
|
814
|
+
* Example:
|
|
815
|
+
* {
|
|
816
|
+
* backgroundImage: 'https://example.com/myimage.png',
|
|
817
|
+
* opacity: 80,
|
|
818
|
+
* backgroundColor: '#00141E',
|
|
819
|
+
* opacityBG: 90,
|
|
820
|
+
* uploadProps: {
|
|
821
|
+
* uploadUrl: 'https://st-admapi.onaim.io/api/File/UploadImage',
|
|
822
|
+
* requestMethod: 'POST',
|
|
823
|
+
* requestHeaders: {
|
|
824
|
+
* accept: 'text/plain',
|
|
825
|
+
* Authorization: 'bearer <your-token-here>',
|
|
826
|
+
* },
|
|
827
|
+
* formFieldName: 'File',
|
|
828
|
+
* parseResponse: (data) => data.data.url,
|
|
829
|
+
* }
|
|
830
|
+
* }
|
|
831
|
+
*/
|
|
808
832
|
constructor(t) {
|
|
809
833
|
super({
|
|
810
834
|
title: "Background Image",
|
|
811
835
|
settings: {
|
|
812
|
-
backgroundImage: new
|
|
836
|
+
backgroundImage: new R({
|
|
837
|
+
...t == null ? void 0 : t.uploadProps,
|
|
813
838
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
814
839
|
}),
|
|
815
|
-
opacity: new
|
|
840
|
+
opacity: new x({
|
|
816
841
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
817
842
|
}),
|
|
818
|
-
backgroundColor: new
|
|
843
|
+
backgroundColor: new k({
|
|
819
844
|
default: (t == null ? void 0 : t.backgroundColor) ?? "#00141E"
|
|
820
845
|
}),
|
|
821
|
-
opacityBG: new
|
|
846
|
+
opacityBG: new x({
|
|
822
847
|
default: (t == null ? void 0 : t.opacityBG) ?? 100
|
|
823
848
|
})
|
|
824
849
|
}
|
|
825
850
|
});
|
|
826
851
|
}
|
|
827
852
|
/**
|
|
828
|
-
* Override draw() to reorder the child settings and insert an "OR" label
|
|
853
|
+
* Override draw() to reorder the child settings and insert an "OR" label between the two sections.
|
|
829
854
|
*/
|
|
830
855
|
draw() {
|
|
831
856
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
832
857
|
if (!e) return t;
|
|
833
|
-
const
|
|
834
|
-
e.innerHTML = "", e.appendChild(
|
|
858
|
+
const n = Array.from(e.children), [i, s, o, a] = n;
|
|
859
|
+
e.innerHTML = "", e.appendChild(i), e.appendChild(s);
|
|
835
860
|
const r = document.createElement("div");
|
|
836
861
|
return r.className = "bgset-or-label", r.textContent = "OR", e.appendChild(r), e.appendChild(o), e.appendChild(a), t;
|
|
837
862
|
}
|
|
863
|
+
/**
|
|
864
|
+
* Helper method to generate CSS based on the current settings.
|
|
865
|
+
*/
|
|
838
866
|
getCssCode() {
|
|
839
|
-
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100,
|
|
867
|
+
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, n = this.settings.backgroundColor.value || "#00141E", i = this.settings.opacityBG.value ?? 100;
|
|
840
868
|
return t ? `
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
869
|
+
background-image: url("${t}");
|
|
870
|
+
background-size: cover;
|
|
871
|
+
background-position: center;
|
|
872
|
+
opacity: ${e / 100};
|
|
873
|
+
` : `
|
|
874
|
+
background-color: ${n};
|
|
875
|
+
opacity: ${i / 100};
|
|
876
|
+
`;
|
|
849
877
|
}
|
|
850
878
|
}
|
|
851
879
|
export {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
880
|
+
T as AlignSetting,
|
|
881
|
+
Y as BackgroundSettingSet,
|
|
882
|
+
P as BorderSettingSet,
|
|
883
|
+
q as ButtonSetting,
|
|
884
|
+
k as ColorSetting,
|
|
885
|
+
D as DimensionSetting,
|
|
886
|
+
X as HeaderTypographySettingSet,
|
|
887
|
+
J as MarginSettingGroup,
|
|
860
888
|
v as NumberSetting,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
889
|
+
x as OpacitySetting,
|
|
890
|
+
y as SelectSetting,
|
|
891
|
+
C as Setting,
|
|
892
|
+
g as SettingGroup,
|
|
893
|
+
b as StringSetting,
|
|
894
|
+
Q as TabsContainerGroup,
|
|
895
|
+
R as UploadSetting,
|
|
896
|
+
L as iterateSettings
|
|
869
897
|
};
|