builder-settings-types 0.0.239 → 0.0.241
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/base/settings-group/settingsGroup.d.ts +6 -0
- package/dist/base/settings.d.ts +3 -0
- package/dist/builder-settings-types.cjs.js +20 -20
- package/dist/builder-settings-types.es.js +194 -152
- package/dist/types/index.d.ts +20 -63
- package/dist/utils/settingsTypes.d.ts +3 -6
- package/package.json +2 -2
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
const T = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
-
let N = (
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t += T[e[
|
|
2
|
+
let N = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += T[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function P(c) {
|
|
9
|
+
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function x(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function V(
|
|
19
|
-
|
|
18
|
+
function V(c, t = 0) {
|
|
19
|
+
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
x(s, n), V(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const A = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class B {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...A, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class $ {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = P(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class $ {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const S = new
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
114
|
+
const S = new B();
|
|
115
|
+
function y(c) {
|
|
116
|
+
if (c === null || typeof c != "object") return c;
|
|
117
|
+
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
+
if (c instanceof Array) return c.map((t) => y(t));
|
|
119
|
+
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in c)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = y(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return c;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function D(c) {
|
|
128
|
+
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -144,7 +144,7 @@ function R(h) {
|
|
|
144
144
|
}
|
|
145
145
|
class g {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.id = t.id || N(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || N(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
150
|
globalThis.DefaultUploadUrl = t, g.DefaultUploadUrl = t;
|
|
@@ -158,12 +158,18 @@ class g {
|
|
|
158
158
|
setOnBlur(t) {
|
|
159
159
|
return this.onBlur = t, this;
|
|
160
160
|
}
|
|
161
|
+
setDataPropsPath(t) {
|
|
162
|
+
this.dataPropsPath = t;
|
|
163
|
+
}
|
|
164
|
+
getDataPropsPath() {
|
|
165
|
+
return this.dataPropsPath;
|
|
166
|
+
}
|
|
161
167
|
setValue(t) {
|
|
162
168
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
163
169
|
}
|
|
164
170
|
clone() {
|
|
165
|
-
const t = this.constructor, e =
|
|
166
|
-
return i.value =
|
|
171
|
+
const t = this.constructor, e = y(this.props), i = new t(e);
|
|
172
|
+
return i.value = y(this.value), i;
|
|
167
173
|
}
|
|
168
174
|
createInput(t) {
|
|
169
175
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -183,7 +189,7 @@ class g {
|
|
|
183
189
|
const i = document.createElement("div");
|
|
184
190
|
i.className = t.wrapperClassName || "";
|
|
185
191
|
const s = document.createElement("input");
|
|
186
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
192
|
+
this.inputEl = s, s.value = String(t.value || D(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
187
193
|
const n = (o) => {
|
|
188
194
|
const l = o.target;
|
|
189
195
|
let r = l.value;
|
|
@@ -224,30 +230,30 @@ class g {
|
|
|
224
230
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
225
231
|
}
|
|
226
232
|
}
|
|
227
|
-
function w(
|
|
228
|
-
return
|
|
233
|
+
function w(c) {
|
|
234
|
+
return c instanceof g;
|
|
229
235
|
}
|
|
230
|
-
function p(
|
|
231
|
-
return
|
|
236
|
+
function p(c) {
|
|
237
|
+
return c instanceof v;
|
|
232
238
|
}
|
|
233
|
-
function ft(
|
|
234
|
-
return w(
|
|
239
|
+
function ft(c) {
|
|
240
|
+
return w(c) || p(c);
|
|
235
241
|
}
|
|
236
|
-
function
|
|
237
|
-
for (const e in
|
|
238
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
239
|
-
const i =
|
|
242
|
+
function b(c, t) {
|
|
243
|
+
for (const e in c)
|
|
244
|
+
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
245
|
+
const i = c[e];
|
|
240
246
|
t(e, i);
|
|
241
247
|
}
|
|
242
248
|
}
|
|
243
249
|
const L = class L {
|
|
244
250
|
constructor(t) {
|
|
245
251
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
|
|
246
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.id = t.id || N(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel();
|
|
252
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.id = t.id || N(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
247
253
|
}
|
|
248
254
|
propagateNestingLevel() {
|
|
249
255
|
const t = this.nestingLevel + 1;
|
|
250
|
-
|
|
256
|
+
b(this.settings, (e, i) => {
|
|
251
257
|
p(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
252
258
|
});
|
|
253
259
|
}
|
|
@@ -257,8 +263,20 @@ const L = class L {
|
|
|
257
263
|
setNestingLevel(t) {
|
|
258
264
|
this.nestingLevel = t, this.propagateNestingLevel(), this.elementRef && this.updateNestingStyles();
|
|
259
265
|
}
|
|
266
|
+
getDataPropsPath() {
|
|
267
|
+
return this.dataPropsPath;
|
|
268
|
+
}
|
|
269
|
+
setDataPropsPath(t) {
|
|
270
|
+
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
271
|
+
}
|
|
272
|
+
propagateDataPropsPath() {
|
|
273
|
+
b(this.settings, (t, e) => {
|
|
274
|
+
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
275
|
+
(p(e) || w(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
260
278
|
updateNestingStyles() {
|
|
261
|
-
this.elementRef && (
|
|
279
|
+
this.elementRef && (x(this.elementRef, this.nestingLevel), V(this.elementRef, this.nestingLevel));
|
|
262
280
|
}
|
|
263
281
|
forceChildUIRefresh() {
|
|
264
282
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -307,7 +325,7 @@ const L = class L {
|
|
|
307
325
|
}
|
|
308
326
|
clone() {
|
|
309
327
|
const t = {};
|
|
310
|
-
|
|
328
|
+
b(this.settings, (s, n) => {
|
|
311
329
|
const a = String(s);
|
|
312
330
|
typeof n.clone == "function" ? t[a] = n.clone() : (console.warn(
|
|
313
331
|
`Setting with key '${a}' does not have a clone method. Copying reference.`
|
|
@@ -321,8 +339,9 @@ const L = class L {
|
|
|
321
339
|
custom: this.custom,
|
|
322
340
|
includeGetJson: this.includeGetJson,
|
|
323
341
|
addItem: this.addItemCfg,
|
|
324
|
-
deleteItem: this.deleteItemCfg
|
|
325
|
-
|
|
342
|
+
deleteItem: this.deleteItemCfg,
|
|
343
|
+
dataProps: this.dataProps
|
|
344
|
+
}, i = R(e);
|
|
326
345
|
return i.initialValues = this.getValues(), i;
|
|
327
346
|
}
|
|
328
347
|
resetDefault() {
|
|
@@ -368,7 +387,7 @@ const L = class L {
|
|
|
368
387
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
369
388
|
}, 50));
|
|
370
389
|
};
|
|
371
|
-
return this.changeHandlers.clear(),
|
|
390
|
+
return this.changeHandlers.clear(), b(this.settings, (i, s) => {
|
|
372
391
|
var n;
|
|
373
392
|
if (p(s))
|
|
374
393
|
s.setOnChange(() => {
|
|
@@ -431,9 +450,9 @@ const L = class L {
|
|
|
431
450
|
d && t.startsWith(d) && this.addDeleteButtonToElement(o, t);
|
|
432
451
|
}
|
|
433
452
|
const r = a.querySelector(".sg-add-button-bottom");
|
|
434
|
-
r ? a.insertBefore(o, r) : a.appendChild(o), S.trackElement(o),
|
|
435
|
-
const
|
|
436
|
-
o.style.display = "none", o.offsetHeight, o.style.display =
|
|
453
|
+
r ? a.insertBefore(o, r) : a.appendChild(o), S.trackElement(o), x(o, this.nestingLevel + 1), V(o, this.nestingLevel + 1);
|
|
454
|
+
const h = o.style.display;
|
|
455
|
+
o.style.display = "none", o.offsetHeight, o.style.display = h, this.updateNestingStyles();
|
|
437
456
|
}
|
|
438
457
|
}
|
|
439
458
|
const i = this.getValues();
|
|
@@ -450,9 +469,9 @@ const L = class L {
|
|
|
450
469
|
const r = Array.from(
|
|
451
470
|
t.querySelectorAll(".setting-group-title")
|
|
452
471
|
);
|
|
453
|
-
for (const
|
|
454
|
-
if (
|
|
455
|
-
s =
|
|
472
|
+
for (const h of r)
|
|
473
|
+
if (h.closest(".setting-group") === t) {
|
|
474
|
+
s = h;
|
|
456
475
|
break;
|
|
457
476
|
}
|
|
458
477
|
s || (s = r[0] ?? null);
|
|
@@ -485,8 +504,8 @@ const L = class L {
|
|
|
485
504
|
}), a.addEventListener("mouseleave", () => {
|
|
486
505
|
a.style.backgroundColor = "transparent";
|
|
487
506
|
}), a.addEventListener("click", (r) => {
|
|
488
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
489
|
-
|
|
507
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((h) => {
|
|
508
|
+
h && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
490
509
|
});
|
|
491
510
|
});
|
|
492
511
|
const l = n.querySelector(".setting-group-arrow");
|
|
@@ -583,10 +602,10 @@ const L = class L {
|
|
|
583
602
|
}), e.addEventListener("click", (d) => {
|
|
584
603
|
d.target === e && (r(), t(!1));
|
|
585
604
|
});
|
|
586
|
-
const
|
|
587
|
-
d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown",
|
|
605
|
+
const h = (d) => {
|
|
606
|
+
d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", h));
|
|
588
607
|
};
|
|
589
|
-
document.addEventListener("keydown",
|
|
608
|
+
document.addEventListener("keydown", h), a.appendChild(o), a.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(a), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
590
609
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
591
610
|
}), setTimeout(() => l.focus(), 100);
|
|
592
611
|
});
|
|
@@ -672,7 +691,7 @@ const L = class L {
|
|
|
672
691
|
}
|
|
673
692
|
draw() {
|
|
674
693
|
const t = document.createElement("div");
|
|
675
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`, L.hiddenElements.add(t), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"),
|
|
694
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, L.hiddenElements.add(t), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), x(t, this.nestingLevel);
|
|
676
695
|
const e = document.createElement("div");
|
|
677
696
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
678
697
|
"aria-expanded",
|
|
@@ -698,38 +717,38 @@ const L = class L {
|
|
|
698
717
|
(!this.isCollapsed).toString()
|
|
699
718
|
);
|
|
700
719
|
};
|
|
701
|
-
if (e.onclick = l, e.onkeydown = (
|
|
702
|
-
(
|
|
720
|
+
if (e.onclick = l, e.onkeydown = (h) => {
|
|
721
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), l());
|
|
703
722
|
}, Object.keys(this.settings).length > 0) {
|
|
704
|
-
for (const
|
|
705
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
706
|
-
const d = this.settings[
|
|
723
|
+
for (const h in this.settings)
|
|
724
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
|
|
725
|
+
const d = this.settings[h];
|
|
707
726
|
p(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
|
|
708
727
|
const u = d.draw();
|
|
709
728
|
p(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
|
|
710
729
|
u,
|
|
711
|
-
|
|
730
|
+
h,
|
|
712
731
|
d
|
|
713
732
|
), o.appendChild(u);
|
|
714
733
|
}
|
|
715
734
|
} else {
|
|
716
|
-
const
|
|
717
|
-
|
|
735
|
+
const h = document.createElement("div");
|
|
736
|
+
h.className = "setting-group-empty", h.textContent = "No settings in this group", o.appendChild(h);
|
|
718
737
|
}
|
|
719
738
|
if (this.addItemCfg) {
|
|
720
|
-
const
|
|
721
|
-
|
|
739
|
+
const h = document.createElement("button");
|
|
740
|
+
h.type = "button", h.className = "sg-add-button-bottom", h.style.marginTop = "8px";
|
|
722
741
|
const d = `
|
|
723
742
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
724
743
|
xmlns="http://www.w3.org/2000/svg">
|
|
725
744
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
726
745
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
727
746
|
</svg>`;
|
|
728
|
-
|
|
747
|
+
h.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (u) => {
|
|
729
748
|
u.stopPropagation(), u.preventDefault();
|
|
730
|
-
const
|
|
749
|
+
const k = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), O = this.addItemCfg.createItem(k), H = `${this.addItemCfg.keyPrefix}${k}`;
|
|
731
750
|
this.addSetting(H, O);
|
|
732
|
-
}), o.appendChild(
|
|
751
|
+
}), o.appendChild(h);
|
|
733
752
|
}
|
|
734
753
|
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(o), this.elementRef = t, S.trackElement(t), setTimeout(() => {
|
|
735
754
|
this.updateNestingStyles();
|
|
@@ -775,10 +794,10 @@ const L = class L {
|
|
|
775
794
|
};
|
|
776
795
|
L.hiddenElements = /* @__PURE__ */ new Set();
|
|
777
796
|
let v = L;
|
|
778
|
-
function vt(
|
|
779
|
-
return new
|
|
797
|
+
function vt(c) {
|
|
798
|
+
return new $(c);
|
|
780
799
|
}
|
|
781
|
-
class
|
|
800
|
+
class $ extends v {
|
|
782
801
|
constructor(t) {
|
|
783
802
|
super(t);
|
|
784
803
|
const e = Object.keys(this.settings)[0];
|
|
@@ -816,12 +835,12 @@ class F extends v {
|
|
|
816
835
|
if (a.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((o, l) => {
|
|
817
836
|
const r = document.createElement("button");
|
|
818
837
|
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", o), r.textContent = o, r.addEventListener("click", () => this.switchToTab(o)), n.appendChild(r);
|
|
819
|
-
const
|
|
820
|
-
|
|
838
|
+
const h = document.createElement("div");
|
|
839
|
+
h.className = "tab-panel", this.contentContainers[o] = h;
|
|
821
840
|
const d = this.settings[o];
|
|
822
|
-
d && (p(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1),
|
|
841
|
+
d && (p(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
|
|
823
842
|
d.draw()
|
|
824
|
-
)), a.appendChild(
|
|
843
|
+
)), a.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = o);
|
|
825
844
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(a), !this.activeTabId) {
|
|
826
845
|
const o = Object.keys(this.settings)[0];
|
|
827
846
|
this.activeTabId = o || "";
|
|
@@ -829,13 +848,13 @@ class F extends v {
|
|
|
829
848
|
return this.updateTabUI(), t;
|
|
830
849
|
}
|
|
831
850
|
}
|
|
832
|
-
function
|
|
833
|
-
return new v(
|
|
851
|
+
function R(c) {
|
|
852
|
+
return new v(c);
|
|
834
853
|
}
|
|
835
|
-
function Ct(
|
|
836
|
-
return
|
|
854
|
+
function Ct(c) {
|
|
855
|
+
return c;
|
|
837
856
|
}
|
|
838
|
-
class
|
|
857
|
+
class F extends g {
|
|
839
858
|
constructor(t = {}) {
|
|
840
859
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
841
860
|
}
|
|
@@ -855,12 +874,12 @@ class P extends g {
|
|
|
855
874
|
});
|
|
856
875
|
}
|
|
857
876
|
}
|
|
858
|
-
const
|
|
859
|
-
class m extends
|
|
877
|
+
const z = "<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>";
|
|
878
|
+
class m extends F {
|
|
860
879
|
constructor(t) {
|
|
861
880
|
super({
|
|
862
881
|
...t,
|
|
863
|
-
icon: t.icon ||
|
|
882
|
+
icon: t.icon || z,
|
|
864
883
|
title: t.title || "Color",
|
|
865
884
|
default: t.default ? m.normalizeColorValue(t.default) : "#000000"
|
|
866
885
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
@@ -872,11 +891,11 @@ class m extends P {
|
|
|
872
891
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
873
892
|
}
|
|
874
893
|
static rgbToHexStatic(t) {
|
|
875
|
-
const e = t.split(",").map((
|
|
894
|
+
const e = t.split(",").map((h) => parseInt(h.trim()));
|
|
876
895
|
if (e.length !== 3 || e.some(isNaN))
|
|
877
896
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
878
|
-
const [i, s, n] = e, a = Math.max(0, Math.min(255, i)), o = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (
|
|
879
|
-
const d =
|
|
897
|
+
const [i, s, n] = e, a = Math.max(0, Math.min(255, i)), o = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (h) => {
|
|
898
|
+
const d = h.toString(16);
|
|
880
899
|
return d.length === 1 ? "0" + d : d;
|
|
881
900
|
};
|
|
882
901
|
return `#${r(a)}${r(o)}${r(l)}`;
|
|
@@ -920,27 +939,27 @@ class m extends P {
|
|
|
920
939
|
const d = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
921
940
|
return d ? e.classList.remove("error") : e.classList.add("error"), d;
|
|
922
941
|
}, s = document.createElement("input");
|
|
923
|
-
s.type = "color", s.className = "color-picker", s.value = this.value || "#000000", s.setAttribute("aria-label", "Choose color"), s.setAttribute("title", "Click to open color picker"), this.colorInputEl = s;
|
|
942
|
+
s.type = "color", s.className = "color-picker", s.value = this.value || "#000000", s.setAttribute("aria-label", "Choose color"), s.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = s;
|
|
924
943
|
const n = document.createElement("div");
|
|
925
944
|
n.className = "color-preview";
|
|
926
945
|
const a = this.value || "#000000";
|
|
927
946
|
n.style.backgroundColor = a;
|
|
928
947
|
const o = document.createElement("input");
|
|
929
|
-
return o.type = "text", o.className = "color-text-input", o.value = this.value || "", o.placeholder = "#000000", o.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), o.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), o.setAttribute("aria-label", "Hex color value"), o.setAttribute("maxlength", "7"), this.textInputEl = o, this.textInputEl.addEventListener("input", (l) => {
|
|
930
|
-
var
|
|
948
|
+
return o.type = "text", o.className = "color-text-input", o.value = this.value || "", o.placeholder = "#000000", o.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), o.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), o.setAttribute("aria-label", "Hex color value"), o.setAttribute("maxlength", "7"), this.getDataPropsPath() && o.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = o, this.textInputEl.addEventListener("input", (l) => {
|
|
949
|
+
var h, d;
|
|
931
950
|
let r = l.target.value.trim();
|
|
932
951
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
933
952
|
const u = m.normalizeColorValue(r);
|
|
934
|
-
this.value = u, (
|
|
953
|
+
this.value = u, (h = this.onChange) == null || h.call(this, u), (d = this.detectChange) == null || d.call(this, u), this.colorInputEl && (this.colorInputEl.value = u), n.style.backgroundColor = u;
|
|
935
954
|
}
|
|
936
955
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
937
956
|
var d, u;
|
|
938
|
-
const r = l.target.value,
|
|
939
|
-
this.value =
|
|
957
|
+
const r = l.target.value, h = m.normalizeColorValue(r);
|
|
958
|
+
this.value = h, (d = this.onChange) == null || d.call(this, h), (u = this.detectChange) == null || u.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h, e.classList.remove("error");
|
|
940
959
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
941
960
|
var d, u;
|
|
942
|
-
const r = l.target.value,
|
|
943
|
-
this.value =
|
|
961
|
+
const r = l.target.value, h = m.normalizeColorValue(r);
|
|
962
|
+
this.value = h, (d = this.onChange) == null || d.call(this, h), (u = this.detectChange) == null || u.call(this, h), this.textInputEl && (this.textInputEl.value = h), n.style.backgroundColor = h;
|
|
944
963
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(o), t.appendChild(e), this.element = t, t;
|
|
945
964
|
}
|
|
946
965
|
getElement() {
|
|
@@ -959,7 +978,7 @@ class m extends P {
|
|
|
959
978
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
960
979
|
}
|
|
961
980
|
}
|
|
962
|
-
const
|
|
981
|
+
const G = `
|
|
963
982
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
964
983
|
<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"/>
|
|
965
984
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
@@ -969,7 +988,7 @@ class C extends g {
|
|
|
969
988
|
constructor(t = {}) {
|
|
970
989
|
super({
|
|
971
990
|
...t,
|
|
972
|
-
icon: t.icon ||
|
|
991
|
+
icon: t.icon || G,
|
|
973
992
|
title: t.title || "Color & Opacity",
|
|
974
993
|
default: t.default || "#000000FF"
|
|
975
994
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = C.normalizeHexWithOpacity(this.value));
|
|
@@ -1001,7 +1020,10 @@ class C extends g {
|
|
|
1001
1020
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
1002
1021
|
}
|
|
1003
1022
|
handleColorChange(t) {
|
|
1004
|
-
const e = this.getOpacityPercent(), i = C.combineColorOpacity(
|
|
1023
|
+
const e = this.getOpacityPercent(), i = C.combineColorOpacity(
|
|
1024
|
+
t,
|
|
1025
|
+
e
|
|
1026
|
+
);
|
|
1005
1027
|
this.setValue(i);
|
|
1006
1028
|
}
|
|
1007
1029
|
handleTextInput(t) {
|
|
@@ -1009,7 +1031,10 @@ class C extends g {
|
|
|
1009
1031
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1010
1032
|
}
|
|
1011
1033
|
handleOpacityChange(t) {
|
|
1012
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = C.combineColorOpacity(
|
|
1034
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = C.combineColorOpacity(
|
|
1035
|
+
e,
|
|
1036
|
+
i
|
|
1037
|
+
);
|
|
1013
1038
|
this.setValue(s);
|
|
1014
1039
|
}
|
|
1015
1040
|
draw() {
|
|
@@ -1027,7 +1052,13 @@ class C extends g {
|
|
|
1027
1052
|
t.appendChild(a);
|
|
1028
1053
|
}
|
|
1029
1054
|
const e = document.createElement("div");
|
|
1030
|
-
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.
|
|
1055
|
+
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.getDataPropsPath() && this.colorInputEl.setAttribute(
|
|
1056
|
+
"data-test-id",
|
|
1057
|
+
`${this.getDataPropsPath()}_color`
|
|
1058
|
+
), this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.getDataPropsPath() && this.textInputEl.setAttribute(
|
|
1059
|
+
"data-test-id",
|
|
1060
|
+
`${this.getDataPropsPath()}_text`
|
|
1061
|
+
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (a) => {
|
|
1031
1062
|
const o = a.target;
|
|
1032
1063
|
this.handleColorChange(o.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1033
1064
|
}), this.textInputEl.addEventListener("input", (a) => {
|
|
@@ -1041,7 +1072,10 @@ class C extends g {
|
|
|
1041
1072
|
(a = this.colorInputEl) == null || a.click();
|
|
1042
1073
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1043
1074
|
const i = document.createElement("div");
|
|
1044
|
-
i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100"
|
|
1075
|
+
i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
|
|
1076
|
+
"data-test-id",
|
|
1077
|
+
`${this.getDataPropsPath()}_opacity`
|
|
1078
|
+
);
|
|
1045
1079
|
const s = document.createElement("span");
|
|
1046
1080
|
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (a) => {
|
|
1047
1081
|
const o = a.target, l = parseFloat(o.value);
|
|
@@ -1094,7 +1128,7 @@ class wt extends g {
|
|
|
1094
1128
|
t.appendChild(n);
|
|
1095
1129
|
}
|
|
1096
1130
|
const e = document.createElement("textarea");
|
|
1097
|
-
this.textareaEl = e, e.value = this.value || "", e.placeholder = this.props.placeholder || "Paste your HTML here...", e.className = "html-setting-textarea " + (this.props.textareaClassName || ""), e.rows = this.props.rows || 6, this.props.maxLength !== void 0 && (e.maxLength = this.props.maxLength), this.props.className && e.classList.add(this.props.className);
|
|
1131
|
+
this.textareaEl = e, e.value = this.value || "", e.placeholder = this.props.placeholder || "Paste your HTML here...", e.className = "html-setting-textarea " + (this.props.textareaClassName || ""), e.rows = this.props.rows || 6, this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.props.maxLength !== void 0 && (e.maxLength = this.props.maxLength), this.props.className && e.classList.add(this.props.className);
|
|
1098
1132
|
const i = (n) => {
|
|
1099
1133
|
const o = n.target.value;
|
|
1100
1134
|
this.value = o, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
@@ -1125,7 +1159,7 @@ class f extends g {
|
|
|
1125
1159
|
const e = document.createElement("div");
|
|
1126
1160
|
e.className = "number-setting-input-container";
|
|
1127
1161
|
const i = document.createElement("input");
|
|
1128
|
-
if (i.type = "number", i.className = "number-setting-input " + (this.props.inputClassName || ""), i.value = String(this.value ?? ""), i.placeholder = this.props.placeholder || "", this.props.minValue !== void 0 && (i.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (i.max = String(this.props.maxValue)), this.props.step !== void 0 && (i.step = String(this.props.step)), i.addEventListener("input", () => {
|
|
1162
|
+
if (i.type = "number", i.className = "number-setting-input " + (this.props.inputClassName || ""), i.value = String(this.value ?? ""), i.placeholder = this.props.placeholder || "", this.getDataPropsPath() && i.setAttribute("data-test-id", this.getDataPropsPath()), this.props.minValue !== void 0 && (i.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (i.max = String(this.props.maxValue)), this.props.step !== void 0 && (i.step = String(this.props.step)), i.addEventListener("input", () => {
|
|
1129
1163
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1130
1164
|
let a = Number(i.value);
|
|
1131
1165
|
a < s && (a = s), a > n && (a = n), String(a) !== i.value && (i.value = String(a)), this.setValue(a);
|
|
@@ -1163,12 +1197,12 @@ class f extends g {
|
|
|
1163
1197
|
);
|
|
1164
1198
|
}
|
|
1165
1199
|
}
|
|
1166
|
-
const
|
|
1200
|
+
const j = `
|
|
1167
1201
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1168
1202
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1169
1203
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1170
1204
|
</svg>`;
|
|
1171
|
-
class
|
|
1205
|
+
class W extends f {
|
|
1172
1206
|
constructor(t = {}) {
|
|
1173
1207
|
const e = {
|
|
1174
1208
|
title: "Opacity",
|
|
@@ -1177,7 +1211,7 @@ class D extends f {
|
|
|
1177
1211
|
maxValue: 100,
|
|
1178
1212
|
step: 1,
|
|
1179
1213
|
default: t.default ?? 100,
|
|
1180
|
-
icon:
|
|
1214
|
+
icon: j,
|
|
1181
1215
|
...t
|
|
1182
1216
|
};
|
|
1183
1217
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1228,7 +1262,7 @@ class I extends g {
|
|
|
1228
1262
|
t.appendChild(n);
|
|
1229
1263
|
}
|
|
1230
1264
|
const e = document.createElement("div");
|
|
1231
|
-
e.classList.add("select-button"), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
1265
|
+
e.classList.add("select-button"), this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
1232
1266
|
var n, a;
|
|
1233
1267
|
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
1234
1268
|
}, t.appendChild(e), this.buttonEl = e;
|
|
@@ -1268,8 +1302,8 @@ class I extends g {
|
|
|
1268
1302
|
selectOption(t, e, i) {
|
|
1269
1303
|
var n, a, o;
|
|
1270
1304
|
const s = this._options[e];
|
|
1271
|
-
s && (this.value = s.value, (n = this.onChange) == null || n.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (a = this.optionsListEl) == null || a.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((r,
|
|
1272
|
-
|
|
1305
|
+
s && (this.value = s.value, (n = this.onChange) == null || n.call(this, this.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (a = this.optionsListEl) == null || a.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((r, h) => {
|
|
1306
|
+
h === e ? r.classList.add("selected") : r.classList.remove("selected");
|
|
1273
1307
|
}));
|
|
1274
1308
|
}
|
|
1275
1309
|
/**
|
|
@@ -1353,20 +1387,23 @@ class J extends g {
|
|
|
1353
1387
|
}
|
|
1354
1388
|
].forEach((n) => {
|
|
1355
1389
|
const a = document.createElement("button");
|
|
1356
|
-
a.className = "align-option-button", a.innerHTML = n.icon, this.
|
|
1390
|
+
a.className = "align-option-button", a.innerHTML = n.icon, this.getDataPropsPath() && a.setAttribute(
|
|
1391
|
+
"data-test-id",
|
|
1392
|
+
`${this.getDataPropsPath()}_${n.name}`
|
|
1393
|
+
), this.value === n.name && a.classList.add("selected"), a.addEventListener("click", () => {
|
|
1357
1394
|
var o;
|
|
1358
1395
|
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), a.classList.add("selected"), this.value = n.name, (o = this.onChange) == null || o.call(this, this.value);
|
|
1359
1396
|
}), i.appendChild(a);
|
|
1360
1397
|
}), t.appendChild(i), t;
|
|
1361
1398
|
}
|
|
1362
1399
|
}
|
|
1363
|
-
class
|
|
1400
|
+
class bt extends g {
|
|
1364
1401
|
constructor(t) {
|
|
1365
1402
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1366
1403
|
}
|
|
1367
1404
|
draw() {
|
|
1368
1405
|
const t = document.createElement("button");
|
|
1369
|
-
t.className = "button-setting " + (this.props.className || ""), t.textContent = this.props.label, t.style.borderColor = this.props.borderColor || "rgba(145, 158, 171, 0.32)";
|
|
1406
|
+
t.className = "button-setting " + (this.props.className || ""), t.textContent = this.props.label, t.style.borderColor = this.props.borderColor || "rgba(145, 158, 171, 0.32)", this.getDataPropsPath() && t.setAttribute("data-test-id", this.getDataPropsPath());
|
|
1370
1407
|
const e = this.props.backgroundColor || "rgba(0,0,0,0)", i = this.props.textColor || "black";
|
|
1371
1408
|
t.style.backgroundColor = e, t.style.color = i;
|
|
1372
1409
|
let s = e;
|
|
@@ -1374,8 +1411,8 @@ class Et extends g {
|
|
|
1374
1411
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1375
1412
|
);
|
|
1376
1413
|
if (n) {
|
|
1377
|
-
let o = +n[1], l = +n[2], r = +n[3],
|
|
1378
|
-
|
|
1414
|
+
let o = +n[1], l = +n[2], r = +n[3], h = +n[4];
|
|
1415
|
+
h >= 1 ? (o = Math.round(o * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : h = Math.min(1, h + 0.12), s = `rgba(${o},${l},${r},${h})`;
|
|
1379
1416
|
}
|
|
1380
1417
|
t.addEventListener("mouseenter", () => {
|
|
1381
1418
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
@@ -1389,7 +1426,7 @@ class Et extends g {
|
|
|
1389
1426
|
return a.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), a.appendChild(t), a;
|
|
1390
1427
|
}
|
|
1391
1428
|
}
|
|
1392
|
-
class
|
|
1429
|
+
class Et extends g {
|
|
1393
1430
|
constructor(t = {}) {
|
|
1394
1431
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1395
1432
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1643,7 +1680,7 @@ class Q extends g {
|
|
|
1643
1680
|
}
|
|
1644
1681
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1645
1682
|
const a = document.createElement("button");
|
|
1646
|
-
return a.className = "upload-button", a.innerHTML = `
|
|
1683
|
+
return a.className = "upload-button", this.getDataPropsPath() && a.setAttribute("data-test-id", this.getDataPropsPath()), a.innerHTML = `
|
|
1647
1684
|
<span class="upload-icon">${M}</span>
|
|
1648
1685
|
<span class="upload-label">Upload</span>
|
|
1649
1686
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(a), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), a.onclick = () => {
|
|
@@ -1678,7 +1715,7 @@ class xt extends f {
|
|
|
1678
1715
|
const Y = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1679
1716
|
<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"/>
|
|
1680
1717
|
</svg>`;
|
|
1681
|
-
class
|
|
1718
|
+
class yt extends f {
|
|
1682
1719
|
constructor(t = {}) {
|
|
1683
1720
|
super({
|
|
1684
1721
|
...t,
|
|
@@ -1703,7 +1740,7 @@ const tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1703
1740
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1704
1741
|
</svg>
|
|
1705
1742
|
`;
|
|
1706
|
-
class
|
|
1743
|
+
class Lt extends g {
|
|
1707
1744
|
constructor(t = {}) {
|
|
1708
1745
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1709
1746
|
const e = this._options.findIndex(
|
|
@@ -1726,7 +1763,7 @@ class yt extends g {
|
|
|
1726
1763
|
const t = document.createElement("div");
|
|
1727
1764
|
t.classList.add("select-api-container"), this.container = t;
|
|
1728
1765
|
const e = document.createElement("div");
|
|
1729
|
-
if (e.classList.add("select-api-button"), this.props.title) {
|
|
1766
|
+
if (e.classList.add("select-api-button"), this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.props.title) {
|
|
1730
1767
|
e.classList.add("has-label");
|
|
1731
1768
|
const n = document.createElement("div");
|
|
1732
1769
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
@@ -1805,7 +1842,7 @@ class yt extends g {
|
|
|
1805
1842
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1806
1843
|
}
|
|
1807
1844
|
selectApiOption(t, e, i) {
|
|
1808
|
-
var l, r,
|
|
1845
|
+
var l, r, h, d;
|
|
1809
1846
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1810
1847
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1811
1848
|
const a = this._options[e].value;
|
|
@@ -1817,7 +1854,7 @@ class yt extends g {
|
|
|
1817
1854
|
const u = i.firstChild;
|
|
1818
1855
|
u && u.tagName === "SPAN" && (u.textContent = this._options[e].name);
|
|
1819
1856
|
}
|
|
1820
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (
|
|
1857
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (h = this.svgContainer) == null || h.classList.remove("open"), (d = this.onChange) == null || d.call(this, a), this.detectChangeCallback && this.detectChangeCallback(a);
|
|
1821
1858
|
}
|
|
1822
1859
|
updateOptionsList() {
|
|
1823
1860
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1872,20 +1909,20 @@ class kt extends g {
|
|
|
1872
1909
|
const i = document.createElement("label");
|
|
1873
1910
|
i.className = "toggle-switch";
|
|
1874
1911
|
const s = document.createElement("input");
|
|
1875
|
-
s.type = "checkbox", s.checked = ((o = (a = this.props.options) == null ? void 0 : a.find((l) => l.value === this.value)) == null ? void 0 : o.status) ?? !1, s.addEventListener("change", () => {
|
|
1876
|
-
var r,
|
|
1877
|
-
const l = ((
|
|
1912
|
+
s.type = "checkbox", s.checked = ((o = (a = this.props.options) == null ? void 0 : a.find((l) => l.value === this.value)) == null ? void 0 : o.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
1913
|
+
var r, h;
|
|
1914
|
+
const l = ((h = (r = this.props.options) == null ? void 0 : r.find((d) => d.status === s.checked)) == null ? void 0 : h.value) ?? "";
|
|
1878
1915
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1879
1916
|
});
|
|
1880
1917
|
const n = document.createElement("span");
|
|
1881
1918
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1882
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
1919
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", h = this.props.inactiveColor || "#ccc";
|
|
1883
1920
|
l.textContent = `
|
|
1884
1921
|
.toggle-switch input:checked + .toggle-slider {
|
|
1885
1922
|
background-color: ${r};
|
|
1886
1923
|
}
|
|
1887
1924
|
.toggle-switch .toggle-slider {
|
|
1888
|
-
background-color: ${
|
|
1925
|
+
background-color: ${h};
|
|
1889
1926
|
}
|
|
1890
1927
|
`, document.head.appendChild(l);
|
|
1891
1928
|
}
|
|
@@ -1924,7 +1961,7 @@ class Mt extends g {
|
|
|
1924
1961
|
const i = document.createElement("div");
|
|
1925
1962
|
i.className = "gap-input-wrapper";
|
|
1926
1963
|
const s = document.createElement("input");
|
|
1927
|
-
if (s.type = "number", s.className = `gap-input gap-${t}-input ${this.props.inputClassName || ""}`, s.id = `${this.id}-${t}-input`, s.min = String(this.props.minValue ?? 0), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), s.step = String(this.props.step ?? 1), s.value = String(this.inputValues[t] ?? this.value), s.title = e, s.addEventListener("input", (n) => {
|
|
1964
|
+
if (s.type = "number", s.className = `gap-input gap-${t}-input ${this.props.inputClassName || ""}`, s.id = `${this.id}-${t}-input`, s.min = String(this.props.minValue ?? 0), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), s.step = String(this.props.step ?? 1), s.value = String(this.inputValues[t] ?? this.value), s.title = e, this.getDataPropsPath() && s.setAttribute("data-test-id", `${this.getDataPropsPath()}_${t}`), s.addEventListener("input", (n) => {
|
|
1928
1965
|
const a = n.target;
|
|
1929
1966
|
let o = parseFloat(a.value);
|
|
1930
1967
|
o = this.validateValue(o), String(o) !== a.value && (a.value = String(o)), this.inputValues[t] = o, this.setValue(o);
|
|
@@ -2041,7 +2078,10 @@ class St extends g {
|
|
|
2041
2078
|
const n = document.createElement("div");
|
|
2042
2079
|
n.classList.add("language-input-group");
|
|
2043
2080
|
const a = document.createElement("input");
|
|
2044
|
-
a.type = "text", a.classList.add("language-input"), a.value = e || "", a.placeholder = this.props.placeholder || "Enter text...",
|
|
2081
|
+
a.type = "text", a.classList.add("language-input"), a.value = e || "", a.placeholder = this.props.placeholder || "Enter text...", this.getDataPropsPath() && a.setAttribute(
|
|
2082
|
+
"data-test-id",
|
|
2083
|
+
`${this.getDataPropsPath()}_${t}`
|
|
2084
|
+
), a.addEventListener("input", (l) => {
|
|
2045
2085
|
const r = l.target;
|
|
2046
2086
|
this.updateLanguageValue(t, r.value);
|
|
2047
2087
|
});
|
|
@@ -2057,7 +2097,9 @@ class St extends g {
|
|
|
2057
2097
|
var i;
|
|
2058
2098
|
if (!this.value) return;
|
|
2059
2099
|
delete this.value[t], this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
2060
|
-
const e = (i = this.languagesContainer) == null ? void 0 : i.querySelector(
|
|
2100
|
+
const e = (i = this.languagesContainer) == null ? void 0 : i.querySelector(
|
|
2101
|
+
`[data-language="${t}"]`
|
|
2102
|
+
);
|
|
2061
2103
|
e && e.remove(), this.updateAddLanguageSelect();
|
|
2062
2104
|
}
|
|
2063
2105
|
addLanguage(t) {
|
|
@@ -2179,11 +2221,11 @@ class Ot extends v {
|
|
|
2179
2221
|
`;
|
|
2180
2222
|
}
|
|
2181
2223
|
}
|
|
2182
|
-
const
|
|
2224
|
+
const ht = `
|
|
2183
2225
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
2184
2226
|
<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"/>
|
|
2185
2227
|
</svg>
|
|
2186
|
-
`,
|
|
2228
|
+
`, ct = `
|
|
2187
2229
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2188
2230
|
<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"/>
|
|
2189
2231
|
</svg>
|
|
@@ -2205,7 +2247,7 @@ class Ht extends v {
|
|
|
2205
2247
|
}),
|
|
2206
2248
|
fontFamily: new I({
|
|
2207
2249
|
title: "Font",
|
|
2208
|
-
icon:
|
|
2250
|
+
icon: ht,
|
|
2209
2251
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
2210
2252
|
options: i.fontFamilyOptions ?? [
|
|
2211
2253
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -2218,7 +2260,7 @@ class Ht extends v {
|
|
|
2218
2260
|
}),
|
|
2219
2261
|
fontWeight: new I({
|
|
2220
2262
|
title: "Weight",
|
|
2221
|
-
icon:
|
|
2263
|
+
icon: ct,
|
|
2222
2264
|
default: i.fontWeightDefault ?? "400",
|
|
2223
2265
|
options: i.fontWeightOptions ?? [
|
|
2224
2266
|
{ name: "Regular", value: "400" },
|
|
@@ -2269,8 +2311,8 @@ class E extends g {
|
|
|
2269
2311
|
const t = this.value === "auto" ? "text" : "number", e = (o) => {
|
|
2270
2312
|
this.value !== "auto" && (this.props.minValue !== void 0 && (o.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (o.max = String(this.props.maxValue)), this.props.className && o.classList.add(this.props.className), o.addEventListener("input", () => {
|
|
2271
2313
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
2272
|
-
let
|
|
2273
|
-
|
|
2314
|
+
let h = Number(o.value);
|
|
2315
|
+
h < l && (h = l), h > r && (h = r), o.value = String(h);
|
|
2274
2316
|
}));
|
|
2275
2317
|
}, i = this.createInput({
|
|
2276
2318
|
value: this.value,
|
|
@@ -2356,7 +2398,7 @@ const ut = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
2356
2398
|
</svg>`, mt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2357
2399
|
<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"/>
|
|
2358
2400
|
</svg>`;
|
|
2359
|
-
class
|
|
2401
|
+
class Pt extends v {
|
|
2360
2402
|
constructor(t) {
|
|
2361
2403
|
super({
|
|
2362
2404
|
title: "Background Image",
|
|
@@ -2366,7 +2408,7 @@ class At extends v {
|
|
|
2366
2408
|
...t == null ? void 0 : t.uploadProps,
|
|
2367
2409
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
2368
2410
|
}),
|
|
2369
|
-
opacity: new
|
|
2411
|
+
opacity: new W({
|
|
2370
2412
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
2371
2413
|
}),
|
|
2372
2414
|
backgroundColor: new C({
|
|
@@ -2398,12 +2440,12 @@ class At extends v {
|
|
|
2398
2440
|
export {
|
|
2399
2441
|
J as AlignSetting,
|
|
2400
2442
|
Nt as AnimationSetting,
|
|
2401
|
-
|
|
2443
|
+
Pt as BackgroundSettingSet,
|
|
2402
2444
|
Ot as BorderSettingSet,
|
|
2403
|
-
|
|
2445
|
+
bt as ButtonSetting,
|
|
2404
2446
|
m as ColorSetting,
|
|
2405
2447
|
C as ColorWithOpacitySetting,
|
|
2406
|
-
|
|
2448
|
+
Et as DimensionSetting,
|
|
2407
2449
|
Mt as GapSetting,
|
|
2408
2450
|
Ht as HeaderTypographySettingSet,
|
|
2409
2451
|
xt as HeightSetting,
|
|
@@ -2413,22 +2455,22 @@ export {
|
|
|
2413
2455
|
It as MarginTopSetting,
|
|
2414
2456
|
St as MultiLanguageSetting,
|
|
2415
2457
|
f as NumberSetting,
|
|
2416
|
-
|
|
2417
|
-
|
|
2458
|
+
W as OpacitySetting,
|
|
2459
|
+
Lt as SelectApiSettings,
|
|
2418
2460
|
I as SelectSetting,
|
|
2419
2461
|
g as Setting,
|
|
2420
2462
|
v as SettingGroup,
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2463
|
+
F as StringSetting,
|
|
2464
|
+
$ as TabSettingGroup,
|
|
2465
|
+
$ as TabsSettingGroup,
|
|
2424
2466
|
kt as Toggle,
|
|
2425
2467
|
Q as UploadSetting,
|
|
2426
|
-
|
|
2468
|
+
yt as WidthSetting,
|
|
2427
2469
|
Ct as asSettingGroupWithSettings,
|
|
2428
|
-
|
|
2470
|
+
R as createSettingGroup,
|
|
2429
2471
|
vt as createTabSettingGroup,
|
|
2430
2472
|
w as isSetting,
|
|
2431
2473
|
ft as isSettingChild,
|
|
2432
2474
|
p as isSettingGroup,
|
|
2433
|
-
|
|
2475
|
+
b as iterateSettings
|
|
2434
2476
|
};
|