builder-settings-types 0.0.256 → 0.0.258
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 +89 -51
- package/dist/builder-settings-types.es.js +1904 -530
- package/dist/groups/headerTypographySettingsSet.d.ts +4 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/settings/gradient-settings/gradientSettings.d.ts +85 -0
- package/dist/settings/gradient-settings/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const lt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let nt = (p = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(p |= 0));
|
|
4
|
+
for (; p--; )
|
|
5
|
+
t += lt[e[p] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function rt(p) {
|
|
9
|
+
let t = 0, e = p.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== p && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Z(p, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
p.setAttribute("data-nesting-level", e.toString()), e > 0 ? p.style.setProperty("--visual-indent", `${e * 2}px`) : (p.style.removeProperty("--visual-indent"), p.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function tt(p, t = 0) {
|
|
19
|
+
p.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
Z(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const ct = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class ht {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...ct, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class F {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = rt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class F {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
114
|
+
const it = new ht();
|
|
115
|
+
function X(p) {
|
|
116
|
+
if (p === null || typeof p != "object") return p;
|
|
117
|
+
if (p instanceof Date) return new Date(p.getTime());
|
|
118
|
+
if (p instanceof Array) return p.map((t) => X(t));
|
|
119
|
+
if (typeof p == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in p)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(p, e) && (t[e] = X(p[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return p;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function dt(p) {
|
|
128
|
+
switch (p) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,15 +142,15 @@ function R(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class S {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || nt(), 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
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, S.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, S.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -171,30 +171,30 @@ class p {
|
|
|
171
171
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
172
172
|
}
|
|
173
173
|
clone() {
|
|
174
|
-
const t = this.constructor, e =
|
|
175
|
-
return i.value =
|
|
174
|
+
const t = this.constructor, e = X(this.props), i = new t(e);
|
|
175
|
+
return i.value = X(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
179
179
|
const e = document.createElement("div");
|
|
180
180
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
181
|
+
const a = document.createElement("div");
|
|
182
|
+
if (a.className = "icon-container", t.icon) {
|
|
183
183
|
const l = this.createIcon(t.icon, t.iconClassName);
|
|
184
|
-
|
|
184
|
+
a.appendChild(l);
|
|
185
185
|
}
|
|
186
186
|
if (t.title) {
|
|
187
187
|
const l = this.createLabel(t.title, t.labelClassName);
|
|
188
|
-
|
|
188
|
+
a.appendChild(l);
|
|
189
189
|
}
|
|
190
|
-
e.appendChild(
|
|
190
|
+
e.appendChild(a);
|
|
191
191
|
}
|
|
192
192
|
const i = document.createElement("div");
|
|
193
193
|
i.className = t.wrapperClassName || "";
|
|
194
194
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
196
|
-
const n = (
|
|
197
|
-
const l =
|
|
195
|
+
this.inputEl = s, s.value = String(t.value || dt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
|
+
const n = (a) => {
|
|
197
|
+
const l = a.target;
|
|
198
198
|
let r = l.value;
|
|
199
199
|
switch (t.inputType) {
|
|
200
200
|
case "number":
|
|
@@ -219,10 +219,10 @@ class p {
|
|
|
219
219
|
r = l.value;
|
|
220
220
|
}
|
|
221
221
|
this.value = r, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
222
|
-
},
|
|
223
|
-
|
|
222
|
+
}, o = (a) => {
|
|
223
|
+
a.target, this.onBlur && this.onBlur(this.value);
|
|
224
224
|
};
|
|
225
|
-
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur",
|
|
225
|
+
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur", o), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
226
226
|
}
|
|
227
227
|
createLabel(t, e) {
|
|
228
228
|
const i = document.createElement("span");
|
|
@@ -233,31 +233,31 @@ class p {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
236
|
+
function j(p) {
|
|
237
|
+
return p instanceof S;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
239
|
+
function N(p) {
|
|
240
|
+
return p instanceof G;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function st(p) {
|
|
243
|
+
return j(p) || N(p);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
for (const e in
|
|
247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
248
|
-
const i =
|
|
245
|
+
function q(p, t) {
|
|
246
|
+
for (const e in p)
|
|
247
|
+
if (Object.prototype.hasOwnProperty.call(p, e)) {
|
|
248
|
+
const i = p[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const Y = class Y {
|
|
253
253
|
constructor(t) {
|
|
254
254
|
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 = () => {
|
|
255
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.id = t.id ||
|
|
255
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.id = t.id || nt(), 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();
|
|
256
256
|
}
|
|
257
257
|
propagateNestingLevel() {
|
|
258
258
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
q(this.settings, (e, i) => {
|
|
260
|
+
N(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -273,18 +273,18 @@ const V = class V {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
q(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(N(e) || j(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (Z(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
|
|
283
283
|
}
|
|
284
284
|
forceChildUIRefresh() {
|
|
285
285
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
286
|
try {
|
|
287
|
-
if (
|
|
287
|
+
if (N(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -307,13 +307,13 @@ const V = class V {
|
|
|
307
307
|
".setting-group-content"
|
|
308
308
|
);
|
|
309
309
|
if (n) {
|
|
310
|
-
const
|
|
310
|
+
const o = Array.from(
|
|
311
311
|
n.querySelectorAll(".setting-group, .setting")
|
|
312
312
|
);
|
|
313
|
-
for (const
|
|
314
|
-
const l =
|
|
313
|
+
for (const a of o) {
|
|
314
|
+
const l = a.id;
|
|
315
315
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
316
|
-
|
|
316
|
+
a.remove();
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -328,11 +328,11 @@ const V = class V {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
typeof n.clone == "function" ? t[
|
|
334
|
-
`Setting with key '${
|
|
335
|
-
), t[
|
|
331
|
+
q(this.settings, (s, n) => {
|
|
332
|
+
const o = String(s);
|
|
333
|
+
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
334
|
+
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
335
|
+
), t[o] = n);
|
|
336
336
|
});
|
|
337
337
|
const e = {
|
|
338
338
|
title: this.title,
|
|
@@ -344,7 +344,7 @@ const V = class V {
|
|
|
344
344
|
addItem: this.addItemCfg,
|
|
345
345
|
deleteItem: this.deleteItemCfg,
|
|
346
346
|
dataProps: this.dataProps
|
|
347
|
-
}, i =
|
|
347
|
+
}, i = ut(e);
|
|
348
348
|
return i.initialValues = this.getValues(), i;
|
|
349
349
|
}
|
|
350
350
|
resetDefault() {
|
|
@@ -354,7 +354,7 @@ const V = class V {
|
|
|
354
354
|
setMobileValues(t) {
|
|
355
355
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
356
356
|
const s = this.settings[e];
|
|
357
|
-
s && (
|
|
357
|
+
s && (N(s) || j(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
358
358
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
359
359
|
}
|
|
360
360
|
getMobileValues(t) {
|
|
@@ -363,7 +363,7 @@ const V = class V {
|
|
|
363
363
|
for (const i in this.settings)
|
|
364
364
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
365
365
|
const s = this.settings[i];
|
|
366
|
-
if (
|
|
366
|
+
if (N(s))
|
|
367
367
|
e[i] = s.getMobileValues();
|
|
368
368
|
else {
|
|
369
369
|
const n = s;
|
|
@@ -374,7 +374,7 @@ const V = class V {
|
|
|
374
374
|
} else {
|
|
375
375
|
const e = this.settings[t];
|
|
376
376
|
if (!e) return;
|
|
377
|
-
if (
|
|
377
|
+
if (N(e)) return e.getMobileValues();
|
|
378
378
|
const i = e;
|
|
379
379
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
380
380
|
}
|
|
@@ -390,19 +390,19 @@ const V = class V {
|
|
|
390
390
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
391
391
|
}, 50));
|
|
392
392
|
};
|
|
393
|
-
return this.changeHandlers.clear(),
|
|
393
|
+
return this.changeHandlers.clear(), q(this.settings, (i, s) => {
|
|
394
394
|
var n;
|
|
395
|
-
if (
|
|
395
|
+
if (N(s))
|
|
396
396
|
s.setOnChange(() => {
|
|
397
|
-
const
|
|
398
|
-
this.initialValues =
|
|
397
|
+
const o = this.getValues();
|
|
398
|
+
this.initialValues = o, t(o);
|
|
399
399
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
400
|
-
else if (
|
|
401
|
-
const
|
|
402
|
-
this.changeHandlers.add(
|
|
400
|
+
else if (j(s)) {
|
|
401
|
+
const o = () => e();
|
|
402
|
+
this.changeHandlers.add(o), s.setOnChange(o);
|
|
403
403
|
} else {
|
|
404
|
-
const
|
|
405
|
-
this.changeHandlers.add(
|
|
404
|
+
const o = () => e();
|
|
405
|
+
this.changeHandlers.add(o), (n = s.setOnChange) == null || n.call(s, o);
|
|
406
406
|
}
|
|
407
407
|
}), this;
|
|
408
408
|
}
|
|
@@ -417,13 +417,13 @@ const V = class V {
|
|
|
417
417
|
Object.entries(t).forEach(([i, s]) => {
|
|
418
418
|
let n = this.settings[i];
|
|
419
419
|
if (!n && this.addItemCfg && i.startsWith(this.addItemCfg.keyPrefix)) {
|
|
420
|
-
const
|
|
421
|
-
if (Number.isFinite(
|
|
422
|
-
const l = this.addItemCfg.createItem(
|
|
423
|
-
|
|
420
|
+
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
421
|
+
if (Number.isFinite(a)) {
|
|
422
|
+
const l = this.addItemCfg.createItem(a);
|
|
423
|
+
st(l) && (this.addSetting(i, l), n = l);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
n && (
|
|
426
|
+
n && (N(n) || j(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
427
427
|
}), setTimeout(() => {
|
|
428
428
|
this.forceChildUIRefresh();
|
|
429
429
|
}, 0);
|
|
@@ -437,25 +437,25 @@ const V = class V {
|
|
|
437
437
|
const s = this.getValues();
|
|
438
438
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
439
439
|
};
|
|
440
|
-
|
|
440
|
+
N(t) ? t.setOnChange(() => e()) : j(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
441
441
|
}
|
|
442
442
|
addSetting(t, e) {
|
|
443
443
|
var s, n;
|
|
444
444
|
if (this.settings[t] = e, this.wireChild(e), this.elementRef) {
|
|
445
|
-
const
|
|
445
|
+
const o = this.elementRef.querySelector(
|
|
446
446
|
".setting-group-content"
|
|
447
447
|
);
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
const
|
|
448
|
+
if (o) {
|
|
449
|
+
N(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
450
|
+
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
451
451
|
if (l) {
|
|
452
|
-
const
|
|
453
|
-
|
|
452
|
+
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
453
|
+
h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
|
|
454
454
|
}
|
|
455
|
-
const r =
|
|
456
|
-
r ?
|
|
457
|
-
const
|
|
458
|
-
|
|
455
|
+
const r = o.querySelector(".sg-add-button-bottom");
|
|
456
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), it.trackElement(a), Z(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
457
|
+
const c = a.style.display;
|
|
458
|
+
a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
const i = this.getValues();
|
|
@@ -472,9 +472,9 @@ const V = class V {
|
|
|
472
472
|
const r = Array.from(
|
|
473
473
|
t.querySelectorAll(".setting-group-title")
|
|
474
474
|
);
|
|
475
|
-
for (const
|
|
476
|
-
if (
|
|
477
|
-
s =
|
|
475
|
+
for (const c of r)
|
|
476
|
+
if (c.closest(".setting-group") === t) {
|
|
477
|
+
s = c;
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
s || (s = r[0] ?? null);
|
|
@@ -482,8 +482,8 @@ const V = class V {
|
|
|
482
482
|
if (!s) return;
|
|
483
483
|
const n = s.querySelector(".actions-section");
|
|
484
484
|
if (!n) return;
|
|
485
|
-
const
|
|
486
|
-
|
|
485
|
+
const o = document.createElement("button");
|
|
486
|
+
o.type = "button", o.className = "sg-delete-button", i ? i.deleteItemCfg : this.deleteItemCfg ?? this.addItemCfg, o.title = "Delete", o.style.cssText = `
|
|
487
487
|
background: none;
|
|
488
488
|
border: none;
|
|
489
489
|
cursor: pointer;
|
|
@@ -496,23 +496,23 @@ const V = class V {
|
|
|
496
496
|
border-radius: 4px;
|
|
497
497
|
transition: background-color 0.2s;
|
|
498
498
|
`;
|
|
499
|
-
const
|
|
499
|
+
const a = `
|
|
500
500
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
501
501
|
<path d="M2 4h12M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.333 1.333 0 0 1 1.334 1.334V4m2 0v9.333a1.333 1.333 0 0 1-1.334 1.334H4.667a1.333 1.333 0 0 1-1.334-1.334V4h8.667Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
502
502
|
<path d="M6.667 7.333v4M9.333 7.333v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
503
503
|
</svg>
|
|
504
504
|
`;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}),
|
|
508
|
-
|
|
509
|
-
}),
|
|
510
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
511
|
-
|
|
505
|
+
o.innerHTML = a, o.addEventListener("mouseenter", () => {
|
|
506
|
+
o.style.backgroundColor = "#fef2f2";
|
|
507
|
+
}), o.addEventListener("mouseleave", () => {
|
|
508
|
+
o.style.backgroundColor = "transparent";
|
|
509
|
+
}), o.addEventListener("click", (r) => {
|
|
510
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((c) => {
|
|
511
|
+
c && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
512
512
|
});
|
|
513
513
|
});
|
|
514
514
|
const l = n.querySelector(".setting-group-arrow");
|
|
515
|
-
l ? n.insertBefore(
|
|
515
|
+
l ? n.insertBefore(o, l) : n.appendChild(o);
|
|
516
516
|
}
|
|
517
517
|
showDeleteConfirmation() {
|
|
518
518
|
return new Promise((t) => {
|
|
@@ -555,14 +555,14 @@ const V = class V {
|
|
|
555
555
|
font-size: 14px;
|
|
556
556
|
line-height: 1.5;
|
|
557
557
|
`;
|
|
558
|
-
const
|
|
559
|
-
|
|
558
|
+
const o = document.createElement("div");
|
|
559
|
+
o.style.cssText = `
|
|
560
560
|
display: flex;
|
|
561
561
|
gap: 12px;
|
|
562
562
|
justify-content: flex-end;
|
|
563
563
|
`;
|
|
564
|
-
const
|
|
565
|
-
|
|
564
|
+
const a = document.createElement("button");
|
|
565
|
+
a.textContent = "Cancel", a.type = "button", a.style.cssText = `
|
|
566
566
|
padding: 8px 16px;
|
|
567
567
|
border: 1px solid #d1d5db;
|
|
568
568
|
background: white;
|
|
@@ -584,10 +584,10 @@ const V = class V {
|
|
|
584
584
|
font-weight: 500;
|
|
585
585
|
cursor: pointer;
|
|
586
586
|
transition: all 0.2s;
|
|
587
|
-
`,
|
|
588
|
-
|
|
589
|
-
}),
|
|
590
|
-
|
|
587
|
+
`, a.addEventListener("mouseenter", () => {
|
|
588
|
+
a.style.backgroundColor = "#f9fafb", a.style.borderColor = "#9ca3af";
|
|
589
|
+
}), a.addEventListener("mouseleave", () => {
|
|
590
|
+
a.style.backgroundColor = "white", a.style.borderColor = "#d1d5db";
|
|
591
591
|
}), l.addEventListener("mouseenter", () => {
|
|
592
592
|
l.style.backgroundColor = "#dc2626";
|
|
593
593
|
}), l.addEventListener("mouseleave", () => {
|
|
@@ -598,17 +598,17 @@ const V = class V {
|
|
|
598
598
|
e.parentNode && e.parentNode.removeChild(e);
|
|
599
599
|
}, 200);
|
|
600
600
|
};
|
|
601
|
-
|
|
601
|
+
a.addEventListener("click", () => {
|
|
602
602
|
r(), t(!1);
|
|
603
603
|
}), l.addEventListener("click", () => {
|
|
604
604
|
r(), t(!0);
|
|
605
|
-
}), e.addEventListener("click", (
|
|
606
|
-
|
|
605
|
+
}), e.addEventListener("click", (h) => {
|
|
606
|
+
h.target === e && (r(), t(!1));
|
|
607
607
|
});
|
|
608
|
-
const
|
|
609
|
-
|
|
608
|
+
const c = (h) => {
|
|
609
|
+
h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
610
610
|
};
|
|
611
|
-
document.addEventListener("keydown",
|
|
611
|
+
document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
612
612
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
613
613
|
}), setTimeout(() => l.focus(), 100);
|
|
614
614
|
});
|
|
@@ -626,8 +626,8 @@ const V = class V {
|
|
|
626
626
|
...Object.keys(t),
|
|
627
627
|
...Object.keys(e)
|
|
628
628
|
])).forEach((n) => {
|
|
629
|
-
const
|
|
630
|
-
JSON.stringify(
|
|
629
|
+
const o = t[n], a = e[n];
|
|
630
|
+
JSON.stringify(o) !== JSON.stringify(a) && (i[n] = { from: o, to: a });
|
|
631
631
|
}), i;
|
|
632
632
|
}
|
|
633
633
|
getValues(t) {
|
|
@@ -636,12 +636,20 @@ const V = class V {
|
|
|
636
636
|
for (const i in this.settings)
|
|
637
637
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
638
638
|
const s = this.settings[i];
|
|
639
|
-
|
|
639
|
+
if (N(s))
|
|
640
|
+
e[i] = s.getValues();
|
|
641
|
+
else {
|
|
642
|
+
const n = s;
|
|
643
|
+
e[i] = n.getValue ? n.getValue() : n.value;
|
|
644
|
+
}
|
|
640
645
|
}
|
|
641
646
|
return e;
|
|
642
647
|
} else {
|
|
643
648
|
const e = this.settings[t];
|
|
644
|
-
|
|
649
|
+
if (!e) return;
|
|
650
|
+
if (N(e)) return e.getValues();
|
|
651
|
+
const i = e;
|
|
652
|
+
return i.getValue ? i.getValue() : i.value;
|
|
645
653
|
}
|
|
646
654
|
}
|
|
647
655
|
getValuesForJson(t) {
|
|
@@ -651,7 +659,7 @@ const V = class V {
|
|
|
651
659
|
for (const i in this.settings)
|
|
652
660
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
653
661
|
const s = this.settings[i];
|
|
654
|
-
if (
|
|
662
|
+
if (N(s)) {
|
|
655
663
|
const n = s.getValuesForJson();
|
|
656
664
|
n !== null && (e[i] = n);
|
|
657
665
|
} else {
|
|
@@ -663,7 +671,7 @@ const V = class V {
|
|
|
663
671
|
} else {
|
|
664
672
|
const e = this.settings[t];
|
|
665
673
|
if (!e) return;
|
|
666
|
-
if (
|
|
674
|
+
if (N(e))
|
|
667
675
|
return e.includeGetJson === !1 ? null : e.getValuesForJson();
|
|
668
676
|
{
|
|
669
677
|
const i = e;
|
|
@@ -677,7 +685,7 @@ const V = class V {
|
|
|
677
685
|
for (const i in this.settings)
|
|
678
686
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
679
687
|
const s = this.settings[i];
|
|
680
|
-
if (
|
|
688
|
+
if (N(s))
|
|
681
689
|
e[i] = s.getDefaultValues();
|
|
682
690
|
else {
|
|
683
691
|
const n = s;
|
|
@@ -688,14 +696,14 @@ const V = class V {
|
|
|
688
696
|
} else {
|
|
689
697
|
const e = this.settings[t];
|
|
690
698
|
if (!e) return;
|
|
691
|
-
if (
|
|
699
|
+
if (N(e)) return e.getDefaultValues();
|
|
692
700
|
const i = e;
|
|
693
701
|
return i.default !== void 0 ? i.default : i.value;
|
|
694
702
|
}
|
|
695
703
|
}
|
|
696
704
|
draw() {
|
|
697
705
|
const t = document.createElement("div");
|
|
698
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
706
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), Z(t, this.nestingLevel);
|
|
699
707
|
const e = document.createElement("div");
|
|
700
708
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
701
709
|
"aria-expanded",
|
|
@@ -707,57 +715,57 @@ const V = class V {
|
|
|
707
715
|
s.textContent = this.title, i.appendChild(s);
|
|
708
716
|
const n = document.createElement("div");
|
|
709
717
|
n.className = "actions-section";
|
|
710
|
-
const
|
|
711
|
-
|
|
718
|
+
const o = document.createElement("span");
|
|
719
|
+
o.className = "setting-group-arrow", o.innerHTML = `
|
|
712
720
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
713
721
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
714
722
|
</svg>
|
|
715
|
-
`, this.isCollapsed &&
|
|
716
|
-
const
|
|
717
|
-
|
|
723
|
+
`, this.isCollapsed && o.classList.add("rotated"), n.appendChild(o);
|
|
724
|
+
const a = document.createElement("div");
|
|
725
|
+
a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content");
|
|
718
726
|
const l = () => {
|
|
719
|
-
this.isCollapsed = !this.isCollapsed,
|
|
727
|
+
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
720
728
|
"aria-expanded",
|
|
721
729
|
(!this.isCollapsed).toString()
|
|
722
730
|
);
|
|
723
731
|
};
|
|
724
|
-
if (e.onclick = l, e.onkeydown = (
|
|
725
|
-
(
|
|
732
|
+
if (e.onclick = l, e.onkeydown = (c) => {
|
|
733
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), l());
|
|
726
734
|
}, Object.keys(this.settings).length > 0) {
|
|
727
|
-
for (const
|
|
728
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
),
|
|
735
|
+
for (const c in this.settings)
|
|
736
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
737
|
+
const h = this.settings[c];
|
|
738
|
+
N(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
739
|
+
const d = h.draw();
|
|
740
|
+
N(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
741
|
+
d,
|
|
742
|
+
c,
|
|
743
|
+
h
|
|
744
|
+
), a.appendChild(d);
|
|
737
745
|
}
|
|
738
746
|
} else {
|
|
739
|
-
const
|
|
740
|
-
|
|
747
|
+
const c = document.createElement("div");
|
|
748
|
+
c.className = "setting-group-empty", c.textContent = "No settings in this group", a.appendChild(c);
|
|
741
749
|
}
|
|
742
750
|
if (this.addItemCfg) {
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
const
|
|
751
|
+
const c = document.createElement("button");
|
|
752
|
+
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
753
|
+
const h = `
|
|
746
754
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
747
755
|
xmlns="http://www.w3.org/2000/svg">
|
|
748
756
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
749
757
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
750
758
|
</svg>`;
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const
|
|
754
|
-
if (
|
|
755
|
-
const
|
|
756
|
-
this.addSetting(
|
|
759
|
+
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
|
|
760
|
+
d.stopPropagation(), d.preventDefault();
|
|
761
|
+
const m = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), u = this.addItemCfg.createItem(m);
|
|
762
|
+
if (st(u)) {
|
|
763
|
+
const g = `${this.addItemCfg.keyPrefix}${m}`;
|
|
764
|
+
this.addSetting(g, u);
|
|
757
765
|
}
|
|
758
|
-
}),
|
|
766
|
+
}), a.appendChild(c);
|
|
759
767
|
}
|
|
760
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(
|
|
768
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, it.trackElement(t), setTimeout(() => {
|
|
761
769
|
this.updateNestingStyles();
|
|
762
770
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
763
771
|
}
|
|
@@ -788,10 +796,10 @@ const V = class V {
|
|
|
788
796
|
let i = e;
|
|
789
797
|
const s = Object.keys(this.settings), n = Object.keys(e);
|
|
790
798
|
if (!s.some(
|
|
791
|
-
(
|
|
799
|
+
(a) => n.includes(a)
|
|
792
800
|
) && n.length === 1) {
|
|
793
|
-
const
|
|
794
|
-
i = e[
|
|
801
|
+
const a = n[0];
|
|
802
|
+
i = e[a];
|
|
795
803
|
}
|
|
796
804
|
this.setValue(i);
|
|
797
805
|
} catch (e) {
|
|
@@ -799,12 +807,12 @@ const V = class V {
|
|
|
799
807
|
}
|
|
800
808
|
}
|
|
801
809
|
};
|
|
802
|
-
|
|
803
|
-
let
|
|
804
|
-
function
|
|
805
|
-
return new
|
|
810
|
+
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
811
|
+
let G = Y;
|
|
812
|
+
function Ut(p) {
|
|
813
|
+
return new pt(p);
|
|
806
814
|
}
|
|
807
|
-
class
|
|
815
|
+
class pt extends G {
|
|
808
816
|
constructor(t) {
|
|
809
817
|
super(t);
|
|
810
818
|
const e = Object.keys(this.settings)[0];
|
|
@@ -838,30 +846,30 @@ class z extends v {
|
|
|
838
846
|
s.textContent = this.title, i.appendChild(s);
|
|
839
847
|
const n = document.createElement("div");
|
|
840
848
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
849
|
+
const o = document.createElement("div");
|
|
850
|
+
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
843
851
|
const r = document.createElement("button");
|
|
844
|
-
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id",
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
)),
|
|
851
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
852
|
-
const
|
|
853
|
-
this.activeTabId =
|
|
852
|
+
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
|
|
853
|
+
const c = document.createElement("div");
|
|
854
|
+
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
855
|
+
const h = this.settings[a];
|
|
856
|
+
h && (N(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
857
|
+
h.draw()
|
|
858
|
+
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
859
|
+
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
860
|
+
const a = Object.keys(this.settings)[0];
|
|
861
|
+
this.activeTabId = a || "";
|
|
854
862
|
}
|
|
855
863
|
return this.updateTabUI(), t;
|
|
856
864
|
}
|
|
857
865
|
}
|
|
858
|
-
function
|
|
859
|
-
return new
|
|
866
|
+
function ut(p) {
|
|
867
|
+
return new G(p);
|
|
860
868
|
}
|
|
861
|
-
function
|
|
862
|
-
return
|
|
869
|
+
function jt(p) {
|
|
870
|
+
return p;
|
|
863
871
|
}
|
|
864
|
-
class
|
|
872
|
+
class gt extends S {
|
|
865
873
|
constructor(t = {}) {
|
|
866
874
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
867
875
|
}
|
|
@@ -881,31 +889,31 @@ class G extends p {
|
|
|
881
889
|
});
|
|
882
890
|
}
|
|
883
891
|
}
|
|
884
|
-
const
|
|
885
|
-
class
|
|
892
|
+
const mt = "<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>";
|
|
893
|
+
class D extends gt {
|
|
886
894
|
constructor(t) {
|
|
887
895
|
super({
|
|
888
896
|
...t,
|
|
889
|
-
icon: t.icon ||
|
|
897
|
+
icon: t.icon || mt,
|
|
890
898
|
title: t.title || "Color",
|
|
891
|
-
default: t.default ?
|
|
899
|
+
default: t.default ? D.normalizeColorValue(t.default) : "#000000"
|
|
892
900
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
893
901
|
}
|
|
894
902
|
static normalizeColorValue(t) {
|
|
895
|
-
return t.startsWith("#") ?
|
|
903
|
+
return t.startsWith("#") ? D.normalizeHexValue(t) : t.includes(",") ? D.rgbToHexStatic(t) : D.normalizeHexValue(t);
|
|
896
904
|
}
|
|
897
905
|
static normalizeHexValue(t) {
|
|
898
906
|
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");
|
|
899
907
|
}
|
|
900
908
|
static rgbToHexStatic(t) {
|
|
901
|
-
const e = t.split(",").map((
|
|
909
|
+
const e = t.split(",").map((c) => parseInt(c.trim()));
|
|
902
910
|
if (e.length !== 3 || e.some(isNaN))
|
|
903
911
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
904
|
-
const [i, s, n] = e,
|
|
905
|
-
const
|
|
906
|
-
return
|
|
912
|
+
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (c) => {
|
|
913
|
+
const h = c.toString(16);
|
|
914
|
+
return h.length === 1 ? "0" + h : h;
|
|
907
915
|
};
|
|
908
|
-
return `#${r(
|
|
916
|
+
return `#${r(o)}${r(a)}${r(l)}`;
|
|
909
917
|
}
|
|
910
918
|
setValue(t) {
|
|
911
919
|
if (t === void 0) {
|
|
@@ -913,7 +921,7 @@ class m extends G {
|
|
|
913
921
|
return;
|
|
914
922
|
}
|
|
915
923
|
if (typeof t == "string") {
|
|
916
|
-
const e =
|
|
924
|
+
const e = D.normalizeColorValue(t);
|
|
917
925
|
this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
|
|
918
926
|
} else
|
|
919
927
|
this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
|
|
@@ -943,38 +951,38 @@ class m extends G {
|
|
|
943
951
|
const r = l.value.trim();
|
|
944
952
|
if (!r)
|
|
945
953
|
return e.classList.remove("error"), !0;
|
|
946
|
-
const
|
|
947
|
-
return
|
|
954
|
+
const h = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(r);
|
|
955
|
+
return h ? e.classList.remove("error") : e.classList.add("error"), h;
|
|
948
956
|
}, s = document.createElement("input");
|
|
949
957
|
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;
|
|
950
958
|
const n = document.createElement("div");
|
|
951
959
|
n.className = "color-preview";
|
|
952
|
-
const
|
|
953
|
-
n.style.backgroundColor =
|
|
954
|
-
const
|
|
955
|
-
return
|
|
956
|
-
var
|
|
960
|
+
const o = this.value || "#000000";
|
|
961
|
+
n.style.backgroundColor = o;
|
|
962
|
+
const a = document.createElement("input");
|
|
963
|
+
return a.type = "text", a.className = "color-text-input", a.value = this.value || "", a.placeholder = "#000000", a.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), a.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), a.setAttribute("aria-label", "Hex color value"), a.setAttribute("maxlength", "7"), this.getDataPropsPath() && a.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = a, this.textInputEl.addEventListener("input", (l) => {
|
|
964
|
+
var c, h;
|
|
957
965
|
let r = l.target.value.trim();
|
|
958
966
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
959
|
-
const
|
|
960
|
-
this.value =
|
|
967
|
+
const d = D.normalizeColorValue(r);
|
|
968
|
+
this.value = d, (c = this.onChange) == null || c.call(this, d), (h = this.detectChange) == null || h.call(this, d), this.colorInputEl && (this.colorInputEl.value = d), n.style.backgroundColor = d;
|
|
961
969
|
}
|
|
962
970
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
963
|
-
var
|
|
964
|
-
const r = l.target.value,
|
|
965
|
-
this.value =
|
|
971
|
+
var h, d;
|
|
972
|
+
const r = l.target.value, c = D.normalizeColorValue(r);
|
|
973
|
+
this.value = c, (h = this.onChange) == null || h.call(this, c), (d = this.detectChange) == null || d.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c, e.classList.remove("error");
|
|
966
974
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
967
|
-
var
|
|
968
|
-
const r = l.target.value,
|
|
969
|
-
this.value =
|
|
970
|
-
}), e.appendChild(s), e.appendChild(n), e.appendChild(
|
|
975
|
+
var h, d;
|
|
976
|
+
const r = l.target.value, c = D.normalizeColorValue(r);
|
|
977
|
+
this.value = c, (h = this.onChange) == null || h.call(this, c), (d = this.detectChange) == null || d.call(this, c), this.textInputEl && (this.textInputEl.value = c), n.style.backgroundColor = c;
|
|
978
|
+
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
971
979
|
}
|
|
972
980
|
getElement() {
|
|
973
981
|
return this.element;
|
|
974
982
|
}
|
|
975
983
|
// Helper method to get normalized hex value
|
|
976
984
|
getNormalizedValue() {
|
|
977
|
-
return this.value ?
|
|
985
|
+
return this.value ? D.normalizeColorValue(this.value) : "#000000";
|
|
978
986
|
}
|
|
979
987
|
// Helper method to check if current value is valid hex
|
|
980
988
|
isValidHex() {
|
|
@@ -985,20 +993,20 @@ class m extends G {
|
|
|
985
993
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
986
994
|
}
|
|
987
995
|
}
|
|
988
|
-
const
|
|
996
|
+
const ft = `
|
|
989
997
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
990
998
|
<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"/>
|
|
991
999
|
<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"/>
|
|
992
1000
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
993
1001
|
</svg>`;
|
|
994
|
-
class
|
|
1002
|
+
class W extends S {
|
|
995
1003
|
constructor(t = {}) {
|
|
996
1004
|
super({
|
|
997
1005
|
...t,
|
|
998
|
-
icon: t.icon ||
|
|
1006
|
+
icon: t.icon || ft,
|
|
999
1007
|
title: t.title || "Color & Opacity",
|
|
1000
1008
|
default: t.default || "#000000FF"
|
|
1001
|
-
}), 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 =
|
|
1009
|
+
}), 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 = W.normalizeHexWithOpacity(this.value));
|
|
1002
1010
|
}
|
|
1003
1011
|
static normalizeHexWithOpacity(t) {
|
|
1004
1012
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -1016,18 +1024,18 @@ class C extends p {
|
|
|
1016
1024
|
return `#${i}${n}`;
|
|
1017
1025
|
}
|
|
1018
1026
|
setValue(t) {
|
|
1019
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1027
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = W.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1020
1028
|
}
|
|
1021
1029
|
updateInputElements() {
|
|
1022
1030
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
1023
1031
|
}
|
|
1024
1032
|
updateColorPreview() {
|
|
1025
1033
|
if (!this.colorPreviewEl || !this.value) return;
|
|
1026
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1027
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
1034
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1035
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1028
1036
|
}
|
|
1029
1037
|
handleColorChange(t) {
|
|
1030
|
-
const e = this.getOpacityPercent(), i =
|
|
1038
|
+
const e = this.getOpacityPercent(), i = W.combineColorOpacity(
|
|
1031
1039
|
t,
|
|
1032
1040
|
e
|
|
1033
1041
|
);
|
|
@@ -1038,7 +1046,7 @@ class C extends p {
|
|
|
1038
1046
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1039
1047
|
}
|
|
1040
1048
|
handleOpacityChange(t) {
|
|
1041
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1049
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = W.combineColorOpacity(
|
|
1042
1050
|
e,
|
|
1043
1051
|
i
|
|
1044
1052
|
);
|
|
@@ -1047,16 +1055,16 @@ class C extends p {
|
|
|
1047
1055
|
draw() {
|
|
1048
1056
|
const t = document.createElement("div");
|
|
1049
1057
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1058
|
+
const o = document.createElement("div");
|
|
1059
|
+
if (o.className = "icon-container", this.props.icon) {
|
|
1060
|
+
const a = document.createElement("span");
|
|
1061
|
+
a.className = "input-icon", a.innerHTML = this.props.icon, o.appendChild(a);
|
|
1054
1062
|
}
|
|
1055
1063
|
if (this.props.title) {
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1064
|
+
const a = document.createElement("span");
|
|
1065
|
+
a.className = "input-label", a.textContent = this.props.title, o.appendChild(a);
|
|
1058
1066
|
}
|
|
1059
|
-
t.appendChild(
|
|
1067
|
+
t.appendChild(o);
|
|
1060
1068
|
}
|
|
1061
1069
|
const e = document.createElement("div");
|
|
1062
1070
|
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(
|
|
@@ -1065,18 +1073,18 @@ class C extends p {
|
|
|
1065
1073
|
), 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(
|
|
1066
1074
|
"data-test-id",
|
|
1067
1075
|
`${this.getDataPropsPath()}_text`
|
|
1068
|
-
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (
|
|
1069
|
-
const
|
|
1070
|
-
this.handleColorChange(
|
|
1071
|
-
}), this.textInputEl.addEventListener("input", (
|
|
1072
|
-
const
|
|
1073
|
-
this.handleTextInput(
|
|
1074
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1076
|
+
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (o) => {
|
|
1077
|
+
const a = o.target;
|
|
1078
|
+
this.handleColorChange(a.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1079
|
+
}), this.textInputEl.addEventListener("input", (o) => {
|
|
1080
|
+
const a = o.target;
|
|
1081
|
+
this.handleTextInput(a.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : a.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
|
|
1082
|
+
}), this.textInputEl.addEventListener("blur", (o) => {
|
|
1083
|
+
const a = o.target;
|
|
1084
|
+
a.value.trim() === "" && (a.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1077
1085
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1078
|
-
var
|
|
1079
|
-
(
|
|
1086
|
+
var o;
|
|
1087
|
+
(o = this.colorInputEl) == null || o.click();
|
|
1080
1088
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1081
1089
|
const i = document.createElement("div");
|
|
1082
1090
|
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(
|
|
@@ -1084,13 +1092,13 @@ class C extends p {
|
|
|
1084
1092
|
`${this.getDataPropsPath()}_opacity`
|
|
1085
1093
|
);
|
|
1086
1094
|
const s = document.createElement("span");
|
|
1087
|
-
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
1088
|
-
const
|
|
1095
|
+
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
|
|
1096
|
+
const a = o.target, l = parseFloat(a.value);
|
|
1089
1097
|
isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1090
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1091
|
-
const
|
|
1092
|
-
let l = parseFloat(
|
|
1093
|
-
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)),
|
|
1098
|
+
}), this.opacityInputEl.addEventListener("blur", (o) => {
|
|
1099
|
+
const a = o.target;
|
|
1100
|
+
let l = parseFloat(a.value);
|
|
1101
|
+
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), a.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1094
1102
|
}), i.appendChild(this.opacityInputEl), i.appendChild(s);
|
|
1095
1103
|
const n = document.createElement("div");
|
|
1096
1104
|
return n.className = "color-with-opacity-controls-wrapper", n.appendChild(e), n.appendChild(i), t.appendChild(n), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
@@ -1103,8 +1111,8 @@ class C extends p {
|
|
|
1103
1111
|
}
|
|
1104
1112
|
getRgbaValue() {
|
|
1105
1113
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
1106
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1107
|
-
return `rgba(${s}, ${n}, ${
|
|
1114
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1115
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1108
1116
|
}
|
|
1109
1117
|
getColorAndOpacity() {
|
|
1110
1118
|
return {
|
|
@@ -1113,7 +1121,7 @@ class C extends p {
|
|
|
1113
1121
|
};
|
|
1114
1122
|
}
|
|
1115
1123
|
}
|
|
1116
|
-
class
|
|
1124
|
+
class _t extends S {
|
|
1117
1125
|
constructor(t = {}) {
|
|
1118
1126
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1119
1127
|
}
|
|
@@ -1125,27 +1133,27 @@ class wt extends p {
|
|
|
1125
1133
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1126
1134
|
const n = document.createElement("div");
|
|
1127
1135
|
if (n.className = "icon-container", this.props.icon) {
|
|
1128
|
-
const
|
|
1129
|
-
n.appendChild(
|
|
1136
|
+
const o = this.createIcon(this.props.icon);
|
|
1137
|
+
n.appendChild(o);
|
|
1130
1138
|
}
|
|
1131
1139
|
if (this.props.title) {
|
|
1132
|
-
const
|
|
1133
|
-
n.appendChild(
|
|
1140
|
+
const o = this.createLabel(this.props.title);
|
|
1141
|
+
n.appendChild(o);
|
|
1134
1142
|
}
|
|
1135
1143
|
t.appendChild(n);
|
|
1136
1144
|
}
|
|
1137
1145
|
const e = document.createElement("textarea");
|
|
1138
1146
|
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);
|
|
1139
1147
|
const i = (n) => {
|
|
1140
|
-
const
|
|
1141
|
-
this.value =
|
|
1148
|
+
const a = n.target.value;
|
|
1149
|
+
this.value = a, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
1142
1150
|
}, s = (n) => {
|
|
1143
1151
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
1144
1152
|
};
|
|
1145
1153
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1146
1154
|
}
|
|
1147
1155
|
}
|
|
1148
|
-
class
|
|
1156
|
+
class F extends S {
|
|
1149
1157
|
constructor(t) {
|
|
1150
1158
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1151
1159
|
}
|
|
@@ -1168,12 +1176,12 @@ class f extends p {
|
|
|
1168
1176
|
const i = document.createElement("input");
|
|
1169
1177
|
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", () => {
|
|
1170
1178
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1171
|
-
let
|
|
1172
|
-
|
|
1179
|
+
let o = Number(i.value);
|
|
1180
|
+
o < s && (o = s), o > n && (o = n), String(o) !== i.value && (i.value = String(o)), this.setValue(o);
|
|
1173
1181
|
}), i.addEventListener("blur", () => {
|
|
1174
|
-
var n,
|
|
1182
|
+
var n, o;
|
|
1175
1183
|
const s = this.validateValue(Number(i.value));
|
|
1176
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
1184
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (o = (n = this.props).onBlur) == null || o.call(n);
|
|
1177
1185
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
1178
1186
|
const s = document.createElement("span");
|
|
1179
1187
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1204,12 +1212,12 @@ class f extends p {
|
|
|
1204
1212
|
);
|
|
1205
1213
|
}
|
|
1206
1214
|
}
|
|
1207
|
-
const
|
|
1215
|
+
const vt = `
|
|
1208
1216
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1209
1217
|
<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"/>
|
|
1210
1218
|
<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"/>
|
|
1211
1219
|
</svg>`;
|
|
1212
|
-
class
|
|
1220
|
+
class Ct extends F {
|
|
1213
1221
|
constructor(t = {}) {
|
|
1214
1222
|
const e = {
|
|
1215
1223
|
title: "Opacity",
|
|
@@ -1218,7 +1226,7 @@ class J extends f {
|
|
|
1218
1226
|
maxValue: 100,
|
|
1219
1227
|
step: 1,
|
|
1220
1228
|
default: t.default ?? 100,
|
|
1221
|
-
icon:
|
|
1229
|
+
icon: vt,
|
|
1222
1230
|
...t
|
|
1223
1231
|
};
|
|
1224
1232
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1230,12 +1238,12 @@ class J extends f {
|
|
|
1230
1238
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1231
1239
|
}
|
|
1232
1240
|
}
|
|
1233
|
-
const
|
|
1241
|
+
const Et = `
|
|
1234
1242
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1235
1243
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1236
1244
|
</svg>
|
|
1237
1245
|
`;
|
|
1238
|
-
class
|
|
1246
|
+
class et extends S {
|
|
1239
1247
|
constructor(t = {}) {
|
|
1240
1248
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1241
1249
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1256,12 +1264,12 @@ class N extends p {
|
|
|
1256
1264
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1257
1265
|
const n = document.createElement("div");
|
|
1258
1266
|
if (n.className = "icon-container", this.props.icon) {
|
|
1259
|
-
const
|
|
1260
|
-
n.appendChild(
|
|
1267
|
+
const o = this.createIcon(this.props.icon);
|
|
1268
|
+
n.appendChild(o);
|
|
1261
1269
|
}
|
|
1262
1270
|
if (this.props.title) {
|
|
1263
|
-
const
|
|
1264
|
-
n.appendChild(
|
|
1271
|
+
const o = this.createLabel(this.props.title);
|
|
1272
|
+
n.appendChild(o);
|
|
1265
1273
|
}
|
|
1266
1274
|
t.appendChild(n);
|
|
1267
1275
|
} else {
|
|
@@ -1270,22 +1278,22 @@ class N extends p {
|
|
|
1270
1278
|
}
|
|
1271
1279
|
const e = document.createElement("div");
|
|
1272
1280
|
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 = () => {
|
|
1273
|
-
var n,
|
|
1274
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1281
|
+
var n, o;
|
|
1282
|
+
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1275
1283
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1276
1284
|
const i = document.createElement("ul");
|
|
1277
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1285
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
1286
|
+
const a = this.createOption(n, o);
|
|
1287
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1280
1288
|
}), document.body.appendChild(i);
|
|
1281
1289
|
const s = document.createElement("div");
|
|
1282
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1290
|
+
return s.classList.add("svg-container"), s.innerHTML = Et, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1283
1291
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1284
1292
|
}).catch((n) => {
|
|
1285
1293
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1286
1294
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1287
|
-
var
|
|
1288
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1295
|
+
var o, a;
|
|
1296
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition());
|
|
1289
1297
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1290
1298
|
this.isOpen && this.checkDropdownPosition();
|
|
1291
1299
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1307,9 +1315,9 @@ class N extends p {
|
|
|
1307
1315
|
}
|
|
1308
1316
|
}
|
|
1309
1317
|
selectOption(t, e, i) {
|
|
1310
|
-
var n,
|
|
1318
|
+
var n, o;
|
|
1311
1319
|
const s = this._options[e];
|
|
1312
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (
|
|
1320
|
+
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l, r) => {
|
|
1313
1321
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1314
1322
|
}));
|
|
1315
1323
|
}
|
|
@@ -1348,7 +1356,7 @@ class N extends p {
|
|
|
1348
1356
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1349
1357
|
}
|
|
1350
1358
|
}
|
|
1351
|
-
class
|
|
1359
|
+
class yt extends S {
|
|
1352
1360
|
constructor(t = {}) {
|
|
1353
1361
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1354
1362
|
}
|
|
@@ -1393,18 +1401,18 @@ class Z extends p {
|
|
|
1393
1401
|
`
|
|
1394
1402
|
}
|
|
1395
1403
|
].forEach((n) => {
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1404
|
+
const o = document.createElement("button");
|
|
1405
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.getDataPropsPath() && o.setAttribute(
|
|
1398
1406
|
"data-test-id",
|
|
1399
1407
|
`${this.getDataPropsPath()}_${n.name}`
|
|
1400
|
-
), this.value === n.name &&
|
|
1401
|
-
var
|
|
1402
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1403
|
-
}), i.appendChild(
|
|
1408
|
+
), this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
1409
|
+
var a;
|
|
1410
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = n.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
1411
|
+
}), i.appendChild(o);
|
|
1404
1412
|
}), t.appendChild(i), t;
|
|
1405
1413
|
}
|
|
1406
1414
|
}
|
|
1407
|
-
class
|
|
1415
|
+
class qt extends S {
|
|
1408
1416
|
constructor(t) {
|
|
1409
1417
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1410
1418
|
}
|
|
@@ -1418,42 +1426,42 @@ class bt extends p {
|
|
|
1418
1426
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1419
1427
|
);
|
|
1420
1428
|
if (n) {
|
|
1421
|
-
let
|
|
1422
|
-
|
|
1429
|
+
let a = +n[1], l = +n[2], r = +n[3], c = +n[4];
|
|
1430
|
+
c >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : c = Math.min(1, c + 0.12), s = `rgba(${a},${l},${r},${c})`;
|
|
1423
1431
|
}
|
|
1424
1432
|
t.addEventListener("mouseenter", () => {
|
|
1425
1433
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1426
1434
|
}), t.addEventListener("mouseleave", () => {
|
|
1427
1435
|
t.style.setProperty("background-color", e, "important");
|
|
1428
1436
|
}), t.addEventListener("click", () => {
|
|
1429
|
-
var
|
|
1430
|
-
return (l = (
|
|
1437
|
+
var a, l;
|
|
1438
|
+
return (l = (a = this.props).onClick) == null ? void 0 : l.call(a);
|
|
1431
1439
|
});
|
|
1432
|
-
const
|
|
1433
|
-
return
|
|
1440
|
+
const o = document.createElement("div");
|
|
1441
|
+
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1434
1442
|
}
|
|
1435
1443
|
}
|
|
1436
|
-
class
|
|
1444
|
+
class Jt extends S {
|
|
1437
1445
|
constructor(t = {}) {
|
|
1438
1446
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1439
1447
|
const e = t.width || 0, i = t.height || 0;
|
|
1440
1448
|
this.value || (this.value = {
|
|
1441
1449
|
width: e,
|
|
1442
1450
|
height: i
|
|
1443
|
-
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
1451
|
+
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new F({
|
|
1444
1452
|
title: "Width",
|
|
1445
1453
|
default: this.value.width,
|
|
1446
1454
|
suffix: "px",
|
|
1447
1455
|
minValue: this.minWidth,
|
|
1448
1456
|
maxValue: this.maxWidth,
|
|
1449
|
-
icon:
|
|
1450
|
-
}), this.heightSetting = new
|
|
1457
|
+
icon: bt
|
|
1458
|
+
}), this.heightSetting = new F({
|
|
1451
1459
|
title: "Height",
|
|
1452
1460
|
default: this.value.height,
|
|
1453
1461
|
suffix: "px",
|
|
1454
1462
|
minValue: this.minHeight,
|
|
1455
1463
|
maxValue: this.maxHeight,
|
|
1456
|
-
icon:
|
|
1464
|
+
icon: wt
|
|
1457
1465
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1458
1466
|
}
|
|
1459
1467
|
handleWidthChange(t) {
|
|
@@ -1523,8 +1531,8 @@ class Et extends p {
|
|
|
1523
1531
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1524
1532
|
"aria-label",
|
|
1525
1533
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1526
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1527
|
-
|
|
1534
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
1535
|
+
o.preventDefault(), this.toggleLock(n);
|
|
1528
1536
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1529
1537
|
}
|
|
1530
1538
|
isLocked() {
|
|
@@ -1547,24 +1555,24 @@ class Et extends p {
|
|
|
1547
1555
|
}
|
|
1548
1556
|
}
|
|
1549
1557
|
}
|
|
1550
|
-
const
|
|
1558
|
+
const bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1551
1559
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1552
|
-
</svg>`,
|
|
1560
|
+
</svg>`, wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1553
1561
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1554
|
-
</svg>`,
|
|
1562
|
+
</svg>`, Q = `
|
|
1555
1563
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1556
1564
|
<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"/>
|
|
1557
1565
|
</svg>
|
|
1558
|
-
`,
|
|
1566
|
+
`, xt = `
|
|
1559
1567
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1560
1568
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1561
1569
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1562
1570
|
</svg>
|
|
1563
|
-
`,
|
|
1571
|
+
`, Lt = `
|
|
1564
1572
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1565
1573
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1566
1574
|
</svg>
|
|
1567
|
-
`,
|
|
1575
|
+
`, kt = `
|
|
1568
1576
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1569
1577
|
<!-- Top dot -->
|
|
1570
1578
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1584,7 +1592,7 @@ const K = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBo
|
|
|
1584
1592
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1585
1593
|
</svg>
|
|
1586
1594
|
`;
|
|
1587
|
-
class
|
|
1595
|
+
class ot extends S {
|
|
1588
1596
|
constructor(t = {}) {
|
|
1589
1597
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1590
1598
|
}
|
|
@@ -1637,18 +1645,18 @@ class P extends p {
|
|
|
1637
1645
|
);
|
|
1638
1646
|
if (t && t !== "") {
|
|
1639
1647
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1640
|
-
<span class="upload-icon">${
|
|
1648
|
+
<span class="upload-icon">${Q}</span>
|
|
1641
1649
|
<span class="upload-label">Replace</span>
|
|
1642
1650
|
`);
|
|
1643
1651
|
const n = () => {
|
|
1644
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1645
|
-
},
|
|
1646
|
-
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1652
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1653
|
+
}, o = () => {
|
|
1654
|
+
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1647
1655
|
};
|
|
1648
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1656
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1649
1657
|
} else
|
|
1650
1658
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1651
|
-
<span class="upload-icon">${
|
|
1659
|
+
<span class="upload-icon">${Q}</span>
|
|
1652
1660
|
<span class="upload-label">Upload</span>
|
|
1653
1661
|
`);
|
|
1654
1662
|
}
|
|
@@ -1656,24 +1664,24 @@ class P extends p {
|
|
|
1656
1664
|
const t = document.createElement("div");
|
|
1657
1665
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1658
1666
|
"focusout",
|
|
1659
|
-
(
|
|
1667
|
+
(a) => {
|
|
1660
1668
|
var l;
|
|
1661
|
-
|
|
1669
|
+
a.relatedTarget && t.contains(a.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1662
1670
|
},
|
|
1663
1671
|
!0
|
|
1664
1672
|
);
|
|
1665
1673
|
const e = !!(this.props.title || this.props.icon);
|
|
1666
1674
|
if (e || t.classList.add("no-label"), e) {
|
|
1667
|
-
const
|
|
1668
|
-
if (
|
|
1675
|
+
const a = document.createElement("div");
|
|
1676
|
+
if (a.className = "icon-title-container", this.props.icon) {
|
|
1669
1677
|
const l = this.createIcon(this.props.icon);
|
|
1670
|
-
|
|
1678
|
+
a.appendChild(l);
|
|
1671
1679
|
}
|
|
1672
1680
|
if (this.props.title) {
|
|
1673
1681
|
const l = this.createLabel(this.props.title);
|
|
1674
|
-
|
|
1682
|
+
a.appendChild(l);
|
|
1675
1683
|
}
|
|
1676
|
-
t.appendChild(
|
|
1684
|
+
t.appendChild(a);
|
|
1677
1685
|
}
|
|
1678
1686
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1679
1687
|
const i = document.createElement("div");
|
|
@@ -1681,19 +1689,19 @@ class P extends p {
|
|
|
1681
1689
|
const s = this.value && this.value !== "";
|
|
1682
1690
|
s || i.classList.add("no-image");
|
|
1683
1691
|
const n = document.createElement("div");
|
|
1684
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1692
|
+
if (n.className = "preview-placeholder", n.innerHTML = xt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = kt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1693
|
+
const a = document.createElement("button");
|
|
1694
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Lt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1687
1695
|
var r;
|
|
1688
1696
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1689
1697
|
};
|
|
1690
1698
|
}
|
|
1691
1699
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1692
|
-
const
|
|
1693
|
-
return
|
|
1694
|
-
<span class="upload-icon">${
|
|
1700
|
+
const o = document.createElement("button");
|
|
1701
|
+
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1702
|
+
<span class="upload-icon">${Q}</span>
|
|
1695
1703
|
<span class="upload-label">Upload</span>
|
|
1696
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1704
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1697
1705
|
window.postMessage(
|
|
1698
1706
|
{
|
|
1699
1707
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1704,14 +1712,14 @@ class P extends p {
|
|
|
1704
1712
|
}, t;
|
|
1705
1713
|
}
|
|
1706
1714
|
}
|
|
1707
|
-
class
|
|
1715
|
+
class Zt extends F {
|
|
1708
1716
|
constructor(t = {}) {
|
|
1709
1717
|
super({
|
|
1710
1718
|
...t,
|
|
1711
1719
|
title: t.title || "Height",
|
|
1712
1720
|
suffix: t.suffix || "px",
|
|
1713
1721
|
minValue: t.minValue ?? 0,
|
|
1714
|
-
icon: t.icon ||
|
|
1722
|
+
icon: t.icon || Mt,
|
|
1715
1723
|
default: t.default ?? 100
|
|
1716
1724
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1717
1725
|
}
|
|
@@ -1722,17 +1730,17 @@ class xt extends f {
|
|
|
1722
1730
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1723
1731
|
}
|
|
1724
1732
|
}
|
|
1725
|
-
const
|
|
1733
|
+
const Mt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1726
1734
|
<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"/>
|
|
1727
1735
|
</svg>`;
|
|
1728
|
-
class
|
|
1736
|
+
class Xt extends F {
|
|
1729
1737
|
constructor(t = {}) {
|
|
1730
1738
|
super({
|
|
1731
1739
|
...t,
|
|
1732
1740
|
title: t.title || "Width",
|
|
1733
1741
|
suffix: t.suffix || "px",
|
|
1734
1742
|
minValue: t.minValue ?? 0,
|
|
1735
|
-
icon: t.icon ||
|
|
1743
|
+
icon: t.icon || St,
|
|
1736
1744
|
default: t.default ?? 100
|
|
1737
1745
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1738
1746
|
}
|
|
@@ -1743,14 +1751,14 @@ class yt extends f {
|
|
|
1743
1751
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1744
1752
|
}
|
|
1745
1753
|
}
|
|
1746
|
-
const
|
|
1754
|
+
const St = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1747
1755
|
<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"/>
|
|
1748
|
-
</svg>`,
|
|
1756
|
+
</svg>`, It = `
|
|
1749
1757
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1750
1758
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1751
1759
|
</svg>
|
|
1752
1760
|
`;
|
|
1753
|
-
class
|
|
1761
|
+
class Yt extends S {
|
|
1754
1762
|
constructor(t = {}) {
|
|
1755
1763
|
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) {
|
|
1756
1764
|
const e = this._options.findIndex(
|
|
@@ -1777,44 +1785,44 @@ class Lt extends p {
|
|
|
1777
1785
|
e.classList.add("has-label");
|
|
1778
1786
|
const n = document.createElement("div");
|
|
1779
1787
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1780
|
-
const
|
|
1781
|
-
if (
|
|
1782
|
-
|
|
1788
|
+
const o = document.createElement("span");
|
|
1789
|
+
if (o.className = "select-value", this.isLoading)
|
|
1790
|
+
o.textContent = this.props.loadingText || "Loading options...";
|
|
1783
1791
|
else {
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1792
|
+
const a = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, l = a && typeof a.name == "string" ? a.name : "Select an option";
|
|
1793
|
+
o.textContent = l;
|
|
1786
1794
|
}
|
|
1787
|
-
e.appendChild(
|
|
1795
|
+
e.appendChild(o);
|
|
1788
1796
|
} else {
|
|
1789
1797
|
const n = document.createElement("span");
|
|
1790
1798
|
if (this.isLoading)
|
|
1791
1799
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1792
1800
|
else {
|
|
1793
|
-
const
|
|
1794
|
-
n.textContent =
|
|
1801
|
+
const o = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, a = o && typeof o.name == "string" ? o.name : "Select an option";
|
|
1802
|
+
n.textContent = a;
|
|
1795
1803
|
}
|
|
1796
1804
|
e.appendChild(n);
|
|
1797
1805
|
}
|
|
1798
1806
|
e.onclick = () => {
|
|
1799
|
-
var n,
|
|
1800
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1807
|
+
var n, o;
|
|
1808
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1801
1809
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1802
1810
|
const i = document.createElement("ul");
|
|
1803
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1804
|
-
const
|
|
1805
|
-
|
|
1811
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
1812
|
+
const a = this.createOption(n, o);
|
|
1813
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1806
1814
|
}), t.appendChild(i);
|
|
1807
1815
|
const s = document.createElement("div");
|
|
1808
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1809
|
-
var n,
|
|
1810
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1816
|
+
return s.classList.add("svg-container"), s.innerHTML = It, t.appendChild(s), s.onclick = () => {
|
|
1817
|
+
var n, o;
|
|
1818
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1811
1819
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1812
|
-
const
|
|
1820
|
+
const o = new Set(
|
|
1813
1821
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1814
|
-
),
|
|
1815
|
-
(l) => !
|
|
1822
|
+
), a = n.filter(
|
|
1823
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1816
1824
|
);
|
|
1817
|
-
if (this._options.push(...
|
|
1825
|
+
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1818
1826
|
const l = this._options.findIndex(
|
|
1819
1827
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1820
1828
|
);
|
|
@@ -1828,12 +1836,12 @@ class Lt extends p {
|
|
|
1828
1836
|
!0
|
|
1829
1837
|
);
|
|
1830
1838
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1831
|
-
const
|
|
1839
|
+
const o = new Set(
|
|
1832
1840
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1833
|
-
),
|
|
1834
|
-
(l) => !
|
|
1841
|
+
), a = n.filter(
|
|
1842
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1835
1843
|
);
|
|
1836
|
-
if (this._options.push(...
|
|
1844
|
+
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1837
1845
|
const l = this._options.findIndex(
|
|
1838
1846
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1839
1847
|
);
|
|
@@ -1852,19 +1860,19 @@ class Lt extends p {
|
|
|
1852
1860
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1853
1861
|
}
|
|
1854
1862
|
selectApiOption(t, e, i) {
|
|
1855
|
-
var l, r,
|
|
1863
|
+
var l, r, c, h;
|
|
1856
1864
|
const s = t.target, n = s.querySelector(".select-api-radio") || ((l = s.closest(".select-api-option")) == null ? void 0 : l.querySelector(".select-api-radio"));
|
|
1857
1865
|
n && (n.checked = !0), this.selectedOptionIndex = e;
|
|
1858
|
-
const
|
|
1859
|
-
this.value =
|
|
1860
|
-
const
|
|
1861
|
-
if (
|
|
1862
|
-
|
|
1866
|
+
const o = this._options[e].value;
|
|
1867
|
+
this.value = o;
|
|
1868
|
+
const a = i.querySelector(".select-value");
|
|
1869
|
+
if (a)
|
|
1870
|
+
a.textContent = this._options[e].name;
|
|
1863
1871
|
else {
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1872
|
+
const d = i.firstChild;
|
|
1873
|
+
d && d.tagName === "SPAN" && (d.textContent = this._options[e].name);
|
|
1866
1874
|
}
|
|
1867
|
-
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (
|
|
1875
|
+
this.isOpen = !1, (r = this.optionsListEl) == null || r.classList.remove("open"), (c = this.svgContainer) == null || c.classList.remove("open"), (h = this.onChange) == null || h.call(this, o), this.detectChangeCallback && this.detectChangeCallback(o);
|
|
1868
1876
|
}
|
|
1869
1877
|
updateOptionsList() {
|
|
1870
1878
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1897,13 +1905,13 @@ class Lt extends p {
|
|
|
1897
1905
|
), this.updateButtonText();
|
|
1898
1906
|
}
|
|
1899
1907
|
}
|
|
1900
|
-
class
|
|
1908
|
+
class Kt extends S {
|
|
1901
1909
|
constructor(t) {
|
|
1902
1910
|
var e, i;
|
|
1903
1911
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
1904
1912
|
}
|
|
1905
1913
|
draw() {
|
|
1906
|
-
var
|
|
1914
|
+
var o, a;
|
|
1907
1915
|
const t = document.createElement("div");
|
|
1908
1916
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
1909
1917
|
const e = document.createElement("div");
|
|
@@ -1919,20 +1927,20 @@ class kt extends p {
|
|
|
1919
1927
|
const i = document.createElement("label");
|
|
1920
1928
|
i.className = "toggle-switch";
|
|
1921
1929
|
const s = document.createElement("input");
|
|
1922
|
-
s.type = "checkbox", s.checked = ((
|
|
1923
|
-
var r,
|
|
1924
|
-
const l = ((
|
|
1930
|
+
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
1931
|
+
var r, c;
|
|
1932
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
1925
1933
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1926
1934
|
});
|
|
1927
1935
|
const n = document.createElement("span");
|
|
1928
1936
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1929
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
1937
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", c = this.props.inactiveColor || "#ccc";
|
|
1930
1938
|
l.textContent = `
|
|
1931
1939
|
.toggle-switch input:checked + .toggle-slider {
|
|
1932
1940
|
background-color: ${r};
|
|
1933
1941
|
}
|
|
1934
1942
|
.toggle-switch .toggle-slider {
|
|
1935
|
-
background-color: ${
|
|
1943
|
+
background-color: ${c};
|
|
1936
1944
|
}
|
|
1937
1945
|
`, document.head.appendChild(l);
|
|
1938
1946
|
}
|
|
@@ -1947,13 +1955,13 @@ class kt extends p {
|
|
|
1947
1955
|
this.detectChangeCallback = t;
|
|
1948
1956
|
}
|
|
1949
1957
|
}
|
|
1950
|
-
const
|
|
1958
|
+
const Nt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1951
1959
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1952
1960
|
</svg>`;
|
|
1953
|
-
class
|
|
1961
|
+
class Qt extends S {
|
|
1954
1962
|
// Store mobile value
|
|
1955
1963
|
constructor(t = {}) {
|
|
1956
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
1964
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Nt, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
1957
1965
|
}
|
|
1958
1966
|
draw() {
|
|
1959
1967
|
const t = document.createElement("div");
|
|
@@ -1964,27 +1972,27 @@ class Mt extends p {
|
|
|
1964
1972
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
1965
1973
|
const s = document.createElement("span");
|
|
1966
1974
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1975
|
+
const a = document.createElement("span");
|
|
1976
|
+
a.className = "setting-icon", a.innerHTML = this.props.icon, i.insertBefore(a, s);
|
|
1969
1977
|
}
|
|
1970
1978
|
const n = document.createElement("div");
|
|
1971
1979
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
1972
|
-
const
|
|
1973
|
-
return
|
|
1980
|
+
const o = document.createElement("div");
|
|
1981
|
+
return o.className = "gap-inputs-container", this.props.rowGap && o.appendChild(this.createGapInput("row", "Row")), this.props.columnGap && o.appendChild(this.createGapInput("column", "Col")), n.appendChild(o), e.appendChild(i), e.appendChild(n), t.appendChild(e), t;
|
|
1974
1982
|
}
|
|
1975
1983
|
createGapInput(t, e) {
|
|
1976
1984
|
const i = document.createElement("div");
|
|
1977
1985
|
i.className = "gap-input-wrapper";
|
|
1978
1986
|
const s = document.createElement("input");
|
|
1979
1987
|
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) => {
|
|
1980
|
-
const
|
|
1981
|
-
let
|
|
1982
|
-
|
|
1988
|
+
const o = n.target;
|
|
1989
|
+
let a = parseFloat(o.value);
|
|
1990
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
1983
1991
|
}), s.addEventListener("blur", (n) => {
|
|
1984
1992
|
var l, r;
|
|
1985
|
-
const
|
|
1986
|
-
let
|
|
1987
|
-
|
|
1993
|
+
const o = n.target;
|
|
1994
|
+
let a = parseFloat(o.value);
|
|
1995
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (r = (l = this.props).onBlur) == null || r.call(l);
|
|
1988
1996
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
1989
1997
|
const n = document.createElement("span");
|
|
1990
1998
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2004,42 +2012,42 @@ class Mt extends p {
|
|
|
2004
2012
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2005
2013
|
}
|
|
2006
2014
|
}
|
|
2007
|
-
const
|
|
2015
|
+
const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2008
2016
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.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.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.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2009
2017
|
</svg>`;
|
|
2010
|
-
class
|
|
2018
|
+
class te extends F {
|
|
2011
2019
|
constructor(t = {}) {
|
|
2012
2020
|
super({
|
|
2013
2021
|
...t,
|
|
2014
2022
|
minValue: t.minValue ?? 0,
|
|
2015
2023
|
maxValue: t.maxValue ?? 1e3,
|
|
2016
|
-
icon: t.icon ||
|
|
2024
|
+
icon: t.icon || Vt,
|
|
2017
2025
|
title: t.title || "Margin Bottom",
|
|
2018
2026
|
default: t.default ?? 20,
|
|
2019
2027
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2020
2028
|
}), this.inputType = "number";
|
|
2021
2029
|
}
|
|
2022
2030
|
}
|
|
2023
|
-
const
|
|
2031
|
+
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2024
2032
|
<path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
|
|
2025
2033
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2026
2034
|
</svg>`;
|
|
2027
|
-
class
|
|
2035
|
+
class ee extends F {
|
|
2028
2036
|
constructor(t = {}) {
|
|
2029
2037
|
super({
|
|
2030
2038
|
...t,
|
|
2031
2039
|
minValue: t.minValue ?? 0,
|
|
2032
2040
|
maxValue: t.maxValue ?? 1e3,
|
|
2033
|
-
icon: t.icon ||
|
|
2041
|
+
icon: t.icon || Ht,
|
|
2034
2042
|
title: t.title || "Margin Top",
|
|
2035
2043
|
default: t.default ?? 20,
|
|
2036
2044
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2037
2045
|
}), this.inputType = "number";
|
|
2038
2046
|
}
|
|
2039
2047
|
}
|
|
2040
|
-
class
|
|
2048
|
+
class ie extends S {
|
|
2041
2049
|
constructor(t) {
|
|
2042
|
-
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(
|
|
2050
|
+
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(S.DefaultLanguage) ? S.DefaultLanguage : t.languages[0];
|
|
2043
2051
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2044
2052
|
t.languages.forEach((i) => {
|
|
2045
2053
|
var s, n;
|
|
@@ -2057,9 +2065,9 @@ class St extends p {
|
|
|
2057
2065
|
return i.font = s, i.measureText(t).width;
|
|
2058
2066
|
}
|
|
2059
2067
|
adaptPlaceholderToSingleLine(t, e) {
|
|
2060
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0,
|
|
2068
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0, o = parseFloat(i.borderLeftWidth) || 0, a = parseFloat(i.borderRightWidth) || 0, l = Math.max(
|
|
2061
2069
|
0,
|
|
2062
|
-
t.clientWidth - s - n -
|
|
2070
|
+
t.clientWidth - s - n - o - a
|
|
2063
2071
|
);
|
|
2064
2072
|
if (l <= 0) {
|
|
2065
2073
|
t.placeholder = e;
|
|
@@ -2069,50 +2077,50 @@ class St extends p {
|
|
|
2069
2077
|
t.placeholder = e;
|
|
2070
2078
|
return;
|
|
2071
2079
|
}
|
|
2072
|
-
const
|
|
2073
|
-
let
|
|
2074
|
-
for (;
|
|
2075
|
-
const
|
|
2076
|
-
this.measureTextWidth(
|
|
2080
|
+
const c = "...";
|
|
2081
|
+
let h = 0, d = e.length, m = 0;
|
|
2082
|
+
for (; h <= d; ) {
|
|
2083
|
+
const g = Math.floor((h + d) / 2), f = e.slice(0, g).trimEnd() + c;
|
|
2084
|
+
this.measureTextWidth(f, i) <= l ? (m = g, h = g + 1) : d = g - 1;
|
|
2077
2085
|
}
|
|
2078
|
-
const
|
|
2079
|
-
t.placeholder =
|
|
2086
|
+
const u = e.slice(0, m).trimEnd() + c;
|
|
2087
|
+
t.placeholder = u;
|
|
2080
2088
|
}
|
|
2081
2089
|
autosizeTextarea(t, e = 3) {
|
|
2082
2090
|
t.style.height = "auto";
|
|
2083
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom),
|
|
2084
|
-
t.style.height = `${l}px`, t.scrollHeight >
|
|
2091
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom), o = parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth), a = s * e + n + o, l = Math.min(t.scrollHeight || 44, a);
|
|
2092
|
+
t.style.height = `${l}px`, t.scrollHeight > a ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
2085
2093
|
}
|
|
2086
2094
|
createTextareaRow(t, e) {
|
|
2087
2095
|
const i = document.createElement("div");
|
|
2088
2096
|
i.classList.add("simple-multi-language-row");
|
|
2089
2097
|
const s = document.createElement("label");
|
|
2090
2098
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2091
|
-
const n = new
|
|
2099
|
+
const n = new ot({
|
|
2092
2100
|
defaultUrl: e || "",
|
|
2093
2101
|
title: "",
|
|
2094
2102
|
id: `${this.id}_upload_${t}`
|
|
2095
2103
|
});
|
|
2096
|
-
n.setOnChange((
|
|
2097
|
-
this.updateLanguageValue(t,
|
|
2104
|
+
n.setOnChange((a) => {
|
|
2105
|
+
this.updateLanguageValue(t, a), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(a);
|
|
2098
2106
|
}), this.uploadSettings.set(t, n);
|
|
2099
|
-
const
|
|
2100
|
-
|
|
2107
|
+
const o = n.draw();
|
|
2108
|
+
o.classList.add("simple-language-upload"), i.appendChild(o);
|
|
2101
2109
|
} else {
|
|
2102
2110
|
const n = document.createElement("textarea");
|
|
2103
2111
|
n.id = `textarea-${t}`, n.classList.add("simple-language-textarea"), n.value = e || "", n.rows = 1, n.style.overflowY = "hidden";
|
|
2104
|
-
let
|
|
2105
|
-
|
|
2112
|
+
let o = this.props.placeholder || "Enter text in {language}...";
|
|
2113
|
+
o.includes("{language}") && (o = o.replace(
|
|
2106
2114
|
"{language}",
|
|
2107
2115
|
t.toUpperCase()
|
|
2108
|
-
)), n.setAttribute("data-full-placeholder",
|
|
2116
|
+
)), n.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(n, o), this.getDataPropsPath() && n.setAttribute(
|
|
2109
2117
|
"data-test-id",
|
|
2110
2118
|
`${this.getDataPropsPath()}_${t}`
|
|
2111
2119
|
), n.addEventListener("input", (l) => {
|
|
2112
2120
|
const r = l.target;
|
|
2113
2121
|
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2122
|
+
const c = n.getAttribute("data-full-placeholder") || "";
|
|
2123
|
+
c && this.adaptPlaceholderToSingleLine(n, c);
|
|
2116
2124
|
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2117
2125
|
this.autosizeTextarea(n, 3);
|
|
2118
2126
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
@@ -2134,11 +2142,11 @@ class St extends p {
|
|
|
2134
2142
|
`#textarea-${e}`
|
|
2135
2143
|
);
|
|
2136
2144
|
if (i && (!i.value || i.value.trim() === "")) {
|
|
2137
|
-
const
|
|
2145
|
+
const o = t || ((n = this.props.placeholder) == null ? void 0 : n.replace(
|
|
2138
2146
|
"{language}",
|
|
2139
2147
|
e.toUpperCase()
|
|
2140
2148
|
)) || `Enter text in ${e.toUpperCase()}...`;
|
|
2141
|
-
i.setAttribute("data-full-placeholder",
|
|
2149
|
+
i.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(i, o);
|
|
2142
2150
|
}
|
|
2143
2151
|
});
|
|
2144
2152
|
}
|
|
@@ -2150,17 +2158,17 @@ class St extends p {
|
|
|
2150
2158
|
}
|
|
2151
2159
|
const e = document.createElement("div");
|
|
2152
2160
|
e.classList.add("simple-multi-language-content"), this.props.languages.forEach((s) => {
|
|
2153
|
-
var
|
|
2154
|
-
const n = ((
|
|
2155
|
-
e.appendChild(
|
|
2161
|
+
var a;
|
|
2162
|
+
const n = ((a = this.value) == null ? void 0 : a[s]) || "", o = this.createTextareaRow(s, n);
|
|
2163
|
+
e.appendChild(o);
|
|
2156
2164
|
}), t.appendChild(e), this.container = t;
|
|
2157
2165
|
const i = () => {
|
|
2158
2166
|
if (!this.container) return;
|
|
2159
2167
|
this.container.querySelectorAll(
|
|
2160
2168
|
".simple-language-textarea"
|
|
2161
2169
|
).forEach((n) => {
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2170
|
+
const o = n.getAttribute("data-full-placeholder") || "";
|
|
2171
|
+
o && this.adaptPlaceholderToSingleLine(n, o);
|
|
2164
2172
|
});
|
|
2165
2173
|
};
|
|
2166
2174
|
return window.addEventListener("resize", i), t;
|
|
@@ -2184,7 +2192,7 @@ class St extends p {
|
|
|
2184
2192
|
});
|
|
2185
2193
|
}
|
|
2186
2194
|
}
|
|
2187
|
-
class
|
|
2195
|
+
class se extends S {
|
|
2188
2196
|
constructor(t = {}) {
|
|
2189
2197
|
super(t), this.inputType = "select";
|
|
2190
2198
|
const e = [
|
|
@@ -2195,7 +2203,7 @@ class Nt extends p {
|
|
|
2195
2203
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2196
2204
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2197
2205
|
];
|
|
2198
|
-
this.selectSetting = new
|
|
2206
|
+
this.selectSetting = new et({
|
|
2199
2207
|
title: this.title || "Animation",
|
|
2200
2208
|
options: e,
|
|
2201
2209
|
default: this.props.default || "none"
|
|
@@ -2211,33 +2219,1388 @@ class Nt extends p {
|
|
|
2211
2219
|
this.selectSetting.destroy(), super.destroy();
|
|
2212
2220
|
}
|
|
2213
2221
|
}
|
|
2214
|
-
const
|
|
2222
|
+
const at = `<svg
|
|
2223
|
+
width="13"
|
|
2224
|
+
height="13"
|
|
2225
|
+
viewBox="0 0 13 13"
|
|
2226
|
+
fill="none"
|
|
2227
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
2228
|
+
>
|
|
2229
|
+
<path
|
|
2230
|
+
fill-rule="evenodd"
|
|
2231
|
+
clip-rule="evenodd"
|
|
2232
|
+
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2233
|
+
fill="#919EAB"
|
|
2234
|
+
/>
|
|
2235
|
+
</svg>`;
|
|
2236
|
+
function Tt(p) {
|
|
2237
|
+
try {
|
|
2238
|
+
const t = p.match(/linear-gradient\(([^)]+)\)/);
|
|
2239
|
+
if (t) {
|
|
2240
|
+
const e = t[1].trim();
|
|
2241
|
+
let i = 90;
|
|
2242
|
+
const s = e.match(/(\d+)deg/);
|
|
2243
|
+
s ? i = parseInt(s[1]) : e.includes("to right") ? i = 90 : e.includes("to left") ? i = 270 : e.includes("to top") ? i = 0 : e.includes("to bottom") ? i = 180 : e.includes("to top right") ? i = 45 : e.includes("to top left") ? i = 315 : e.includes("to bottom right") ? i = 135 : e.includes("to bottom left") && (i = 225);
|
|
2244
|
+
const n = [];
|
|
2245
|
+
let o = "", a = 0;
|
|
2246
|
+
for (let r = 0; r < e.length; r++) {
|
|
2247
|
+
const c = e[r];
|
|
2248
|
+
c === "(" && a++, c === ")" && a--, c === "," && a === 0 ? (n.push(o.trim()), o = "") : o += c;
|
|
2249
|
+
}
|
|
2250
|
+
o.trim() && n.push(o.trim());
|
|
2251
|
+
const l = [];
|
|
2252
|
+
for (let r = 0; r < n.length; r++) {
|
|
2253
|
+
const c = n[r];
|
|
2254
|
+
if (c.includes("deg") || c.includes("to ")) continue;
|
|
2255
|
+
let h = "", d = 0, m = 100;
|
|
2256
|
+
const u = c.match(/rgba?\(([^)]+)\)(?:\s*(\d+)%)?/);
|
|
2257
|
+
if (u) {
|
|
2258
|
+
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), E = parseInt(g[1]), v = parseInt(g[2]), w = g[3] ? parseFloat(g[3]) : 1;
|
|
2259
|
+
h = `#${f.toString(16).padStart(2, "0")}${E.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(w * 100), u[2] ? d = parseInt(u[2]) : d = Math.round(r / Math.max(n.length - 2, 1) * 100);
|
|
2260
|
+
} else {
|
|
2261
|
+
const g = c.match(/#([a-fA-F0-9]{3,8})(?:\s*(\d+)%)?/);
|
|
2262
|
+
g && (h = `#${g[1]}`, g[2] ? d = parseInt(g[2]) : d = Math.round(r / Math.max(n.length - 2, 1) * 100));
|
|
2263
|
+
}
|
|
2264
|
+
h && l.push({
|
|
2265
|
+
color: h,
|
|
2266
|
+
position: d,
|
|
2267
|
+
opacity: m
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
if (l.length === 0) {
|
|
2271
|
+
console.log(
|
|
2272
|
+
"No positioned stops found, trying to extract colors without positions"
|
|
2273
|
+
);
|
|
2274
|
+
const r = e.match(
|
|
2275
|
+
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2276
|
+
);
|
|
2277
|
+
r && r.forEach((c, h) => {
|
|
2278
|
+
let d = "", m = 100;
|
|
2279
|
+
if (c.startsWith("#"))
|
|
2280
|
+
d = c;
|
|
2281
|
+
else {
|
|
2282
|
+
const u = c.match(/rgba?\(([^)]+)\)/);
|
|
2283
|
+
if (u) {
|
|
2284
|
+
const g = u[1].split(",").map((V) => V.trim()), f = parseInt(g[0]), E = parseInt(g[1]), v = parseInt(g[2]), w = g[3] ? parseFloat(g[3]) : 1;
|
|
2285
|
+
d = `#${f.toString(16).padStart(2, "0")}${E.toString(16).padStart(2, "0")}${v.toString(16).padStart(2, "0")}`, m = Math.round(w * 100);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
if (d) {
|
|
2289
|
+
const u = Math.round(
|
|
2290
|
+
h / Math.max(r.length - 1, 1) * 100
|
|
2291
|
+
);
|
|
2292
|
+
console.log(
|
|
2293
|
+
`Auto-positioned stop: ${d} at ${u}% with ${m}% opacity`
|
|
2294
|
+
), l.push({
|
|
2295
|
+
color: d,
|
|
2296
|
+
position: u,
|
|
2297
|
+
opacity: m
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
return {
|
|
2303
|
+
type: "linear",
|
|
2304
|
+
angle: i,
|
|
2305
|
+
stops: l
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
return null;
|
|
2309
|
+
} catch (t) {
|
|
2310
|
+
return console.warn("Failed to parse CSS gradient:", p, t), null;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
class Pt {
|
|
2314
|
+
constructor(t) {
|
|
2315
|
+
this.isOpen = !1, this.currentColor = "#ff0000", this.currentOpacity = 100, this.isUpdatingHue = !1, this.handleOutsideClick = (e) => {
|
|
2316
|
+
const i = document.querySelector(".gradient-popover");
|
|
2317
|
+
i && i.contains(e.target) || this.element.contains(e.target) || (e.stopPropagation(), this.close());
|
|
2318
|
+
}, this.onColorChange = t, this.element = this.createColorPicker();
|
|
2319
|
+
}
|
|
2320
|
+
createColorPicker() {
|
|
2321
|
+
const t = document.createElement("div");
|
|
2322
|
+
t.className = "custom-color-picker", t.style.display = "none";
|
|
2323
|
+
const e = document.createElement("div");
|
|
2324
|
+
e.className = "color-picker-header", e.style.cursor = "move";
|
|
2325
|
+
const i = document.createElement("span");
|
|
2326
|
+
i.textContent = "Color";
|
|
2327
|
+
const s = document.createElement("button");
|
|
2328
|
+
s.className = "color-picker-close", s.innerHTML = at, s.addEventListener("click", () => this.close()), e.appendChild(i), e.appendChild(s), this.makeDraggable(e, t);
|
|
2329
|
+
const n = document.createElement("div");
|
|
2330
|
+
n.className = "color-picker-area", this.colorArea = n;
|
|
2331
|
+
const o = document.createElement("div");
|
|
2332
|
+
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
2333
|
+
const a = document.createElement("div");
|
|
2334
|
+
a.className = "color-picker-hue-container";
|
|
2335
|
+
const l = document.createElement("button");
|
|
2336
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2337
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2338
|
+
</svg>`;
|
|
2339
|
+
const r = document.createElement("div");
|
|
2340
|
+
r.className = "color-picker-hue", this.hueSlider = r;
|
|
2341
|
+
const c = document.createElement("div");
|
|
2342
|
+
c.className = "color-picker-hue-marker", this.hueMarker = c, r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2343
|
+
const h = document.createElement("div");
|
|
2344
|
+
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2345
|
+
const d = document.createElement("div");
|
|
2346
|
+
d.className = "color-picker-opacity-marker", this.opacityMarker = d, h.appendChild(d);
|
|
2347
|
+
const m = document.createElement("div");
|
|
2348
|
+
m.className = "color-picker-format-section";
|
|
2349
|
+
const u = document.createElement("select");
|
|
2350
|
+
u.className = "color-picker-format-select", this.formatSelect = u;
|
|
2351
|
+
const g = document.createElement("option");
|
|
2352
|
+
g.value = "hex", g.textContent = "HEX";
|
|
2353
|
+
const f = document.createElement("option");
|
|
2354
|
+
f.value = "rgb", f.textContent = "RGB";
|
|
2355
|
+
const E = document.createElement("option");
|
|
2356
|
+
E.value = "hsl", E.textContent = "HSL", u.appendChild(g), u.appendChild(f), u.appendChild(E);
|
|
2357
|
+
const v = document.createElement("input");
|
|
2358
|
+
v.type = "text", v.className = "color-picker-color-input", v.value = this.currentColor, this.hexInput = v;
|
|
2359
|
+
const w = document.createElement("div");
|
|
2360
|
+
w.className = "color-picker-input-container";
|
|
2361
|
+
const V = document.createElement("button");
|
|
2362
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), w.appendChild(v), w.appendChild(V), m.appendChild(u), m.appendChild(w), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(h), t.appendChild(m), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (z) => {
|
|
2363
|
+
z.stopPropagation();
|
|
2364
|
+
}), t;
|
|
2365
|
+
}
|
|
2366
|
+
setupEventListeners() {
|
|
2367
|
+
this.colorArea.addEventListener("mousedown", (t) => this.startColorDrag(t)), this.colorArea.addEventListener("click", (t) => {
|
|
2368
|
+
t.stopPropagation(), this.updateColorFromArea(t);
|
|
2369
|
+
}), this.hueSlider.addEventListener("mousedown", (t) => this.startHueDrag(t)), this.hueSlider.addEventListener("click", (t) => {
|
|
2370
|
+
t.stopPropagation(), this.updateHueFromSlider(t);
|
|
2371
|
+
}), this.formatSelect.addEventListener("change", () => this.updateColorInput()), this.hexInput.addEventListener(
|
|
2372
|
+
"input",
|
|
2373
|
+
(t) => this.updateColorFromInput(t)
|
|
2374
|
+
), this.hexInput.addEventListener("blur", (t) => this.validateColorInput(t)), this.opacitySlider.addEventListener(
|
|
2375
|
+
"mousedown",
|
|
2376
|
+
(t) => this.startOpacityDrag(t)
|
|
2377
|
+
), this.opacitySlider.addEventListener("click", (t) => {
|
|
2378
|
+
t.stopPropagation(), this.updateOpacityFromSlider(t);
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
startColorDrag(t) {
|
|
2382
|
+
t.preventDefault(), t.stopPropagation(), this.updateColorFromArea(t);
|
|
2383
|
+
const e = (s) => this.updateColorFromArea(s), i = () => {
|
|
2384
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2385
|
+
};
|
|
2386
|
+
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2387
|
+
}
|
|
2388
|
+
startHueDrag(t) {
|
|
2389
|
+
t.preventDefault(), t.stopPropagation(), this.updateHueFromSlider(t);
|
|
2390
|
+
const e = (s) => this.updateHueFromSlider(s), i = () => {
|
|
2391
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2392
|
+
};
|
|
2393
|
+
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2394
|
+
}
|
|
2395
|
+
updateColorFromArea(t) {
|
|
2396
|
+
const e = this.colorArea.getBoundingClientRect(), i = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width)), s = Math.max(0, Math.min(1, (t.clientY - e.top) / e.height));
|
|
2397
|
+
this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${s * 100}%`, this.updateColorFromSV(i, 1 - s);
|
|
2398
|
+
}
|
|
2399
|
+
updateHueFromSlider(t) {
|
|
2400
|
+
this.isUpdatingHue = !0;
|
|
2401
|
+
const e = this.hueSlider.getBoundingClientRect();
|
|
2402
|
+
let i = (t.clientX - e.left) / e.width;
|
|
2403
|
+
i = Math.max(2e-3, Math.min(0.996, i)), console.log("Hue slider click:", {
|
|
2404
|
+
x: i,
|
|
2405
|
+
hueValue: i * 360,
|
|
2406
|
+
percent: i * 100
|
|
2407
|
+
}), this.hueMarker.style.left = `${i * 100}%`;
|
|
2408
|
+
const s = i * 360;
|
|
2409
|
+
this.updateHue(s), this.isUpdatingHue = !1;
|
|
2410
|
+
}
|
|
2411
|
+
updateColorFromSV(t, e) {
|
|
2412
|
+
const i = this.getCurrentHue(), s = this.hsvToHex(i, t, e);
|
|
2413
|
+
this.setColor(s);
|
|
2414
|
+
}
|
|
2415
|
+
updateHue(t) {
|
|
2416
|
+
const e = t;
|
|
2417
|
+
t = Math.max(0.5, Math.min(358.5, t)), console.log("UpdateHue:", { originalHue: e, clampedHue: t }), this.colorArea.getBoundingClientRect();
|
|
2418
|
+
const i = parseFloat(this.colorMarker.style.left || "50%") / 100, s = parseFloat(this.colorMarker.style.top || "50%") / 100;
|
|
2419
|
+
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`;
|
|
2420
|
+
const n = i, o = 1 - s, a = this.hsvToHex(t, n, o);
|
|
2421
|
+
this.setColor(a);
|
|
2422
|
+
}
|
|
2423
|
+
getCurrentHue() {
|
|
2424
|
+
const t = parseFloat(this.hueMarker.style.left || "0%") / 100, e = t * 360;
|
|
2425
|
+
return console.log("GetCurrentHue:", { huePosition: t, hueValue: e }), Math.max(0.5, Math.min(358.5, e));
|
|
2426
|
+
}
|
|
2427
|
+
updateColorInput() {
|
|
2428
|
+
const t = this.formatSelect.value, { h: e, s: i, v: s } = this.hexToHsv(this.currentColor);
|
|
2429
|
+
switch (t) {
|
|
2430
|
+
case "hex":
|
|
2431
|
+
this.hexInput.value = this.currentColor;
|
|
2432
|
+
break;
|
|
2433
|
+
case "rgb":
|
|
2434
|
+
const { r: n, g: o, b: a } = this.hexToRgb(this.currentColor);
|
|
2435
|
+
this.hexInput.value = `rgb(${n}, ${o}, ${a})`;
|
|
2436
|
+
break;
|
|
2437
|
+
case "hsl":
|
|
2438
|
+
const { hue: l, sat: r, lightness: c } = this.hsvToHsl(e, i, s);
|
|
2439
|
+
this.hexInput.value = `hsl(${Math.round(l)}, ${Math.round(
|
|
2440
|
+
r * 100
|
|
2441
|
+
)}%, ${Math.round(c * 100)}%)`;
|
|
2442
|
+
break;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
updateColorFromInput(t) {
|
|
2446
|
+
const e = t.target.value, i = this.formatSelect.value;
|
|
2447
|
+
let s = "";
|
|
2448
|
+
if (i === "hex" && /^#[0-9A-Fa-f]{6}$/.test(e))
|
|
2449
|
+
s = e;
|
|
2450
|
+
else if (i === "rgb") {
|
|
2451
|
+
const n = e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2452
|
+
if (n) {
|
|
2453
|
+
const o = parseInt(n[1]), a = parseInt(n[2]), l = parseInt(n[3]);
|
|
2454
|
+
o <= 255 && a <= 255 && l <= 255 && (s = `#${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${l.toString(16).padStart(2, "0")}`);
|
|
2455
|
+
}
|
|
2456
|
+
} else if (i === "hsl") {
|
|
2457
|
+
const n = e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2458
|
+
if (n) {
|
|
2459
|
+
const o = parseInt(n[1]), a = parseInt(n[2]) / 100, l = parseInt(n[3]) / 100;
|
|
2460
|
+
if (o <= 360 && a <= 1 && l <= 1) {
|
|
2461
|
+
const r = l + a * Math.min(l, 1 - l), c = r === 0 ? 0 : 2 * (1 - l / r);
|
|
2462
|
+
s = this.hsvToHex(o, c, r);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
s && this.setColor(s);
|
|
2467
|
+
}
|
|
2468
|
+
validateColorInput(t) {
|
|
2469
|
+
this.updateColorInput();
|
|
2470
|
+
}
|
|
2471
|
+
startOpacityDrag(t) {
|
|
2472
|
+
t.preventDefault(), t.stopPropagation(), this.updateOpacityFromSlider(t);
|
|
2473
|
+
const e = (s) => this.updateOpacityFromSlider(s), i = () => {
|
|
2474
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2475
|
+
};
|
|
2476
|
+
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2477
|
+
}
|
|
2478
|
+
updateOpacityFromSlider(t) {
|
|
2479
|
+
const e = this.opacitySlider.getBoundingClientRect(), i = Math.max(0, Math.min(1, (t.clientX - e.left) / e.width));
|
|
2480
|
+
this.opacityMarker.style.left = `${i * 100}%`, this.currentOpacity = Math.round(i * 100), this.onColorChange && this.onColorChange(this.currentColor, this.currentOpacity);
|
|
2481
|
+
}
|
|
2482
|
+
updateOpacityBackground() {
|
|
2483
|
+
const { r: t, g: e, b: i } = this.hexToRgb(this.currentColor);
|
|
2484
|
+
this.opacitySlider.style.setProperty(
|
|
2485
|
+
"--base-color",
|
|
2486
|
+
`rgb(${t}, ${e}, ${i})`
|
|
2487
|
+
);
|
|
2488
|
+
}
|
|
2489
|
+
isValidHex(t) {
|
|
2490
|
+
return /^#[0-9A-Fa-f]{6}$/.test(t);
|
|
2491
|
+
}
|
|
2492
|
+
hsvToHex(t, e, i) {
|
|
2493
|
+
t = Math.max(0, Math.min(359.9, t)), e = Math.max(0, Math.min(1, e)), i = Math.max(0, Math.min(1, i)), console.log("CustomColorPicker HsvToHex:", { h: t, s: e, v: i });
|
|
2494
|
+
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
2495
|
+
let a = 0, l = 0, r = 0;
|
|
2496
|
+
return t < 60 ? (a = s, l = n, r = 0) : t < 120 ? (a = n, l = s, r = 0) : t < 180 ? (a = 0, l = s, r = n) : t < 240 ? (a = 0, l = n, r = s) : t < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), a = Math.round((a + o) * 255), l = Math.round((l + o) * 255), r = Math.round((r + o) * 255), `#${a.toString(16).padStart(2, "0")}${l.toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}`;
|
|
2497
|
+
}
|
|
2498
|
+
setColor(t) {
|
|
2499
|
+
this.currentColor = t, this.updatePickerFromColor(t), this.updateColorInput(), this.updateOpacityBackground(), this.onColorChange && this.onColorChange(t, this.currentOpacity);
|
|
2500
|
+
}
|
|
2501
|
+
setupEyedropper(t) {
|
|
2502
|
+
const e = async () => {
|
|
2503
|
+
if ("EyeDropper" in window)
|
|
2504
|
+
try {
|
|
2505
|
+
const n = (await new window.EyeDropper().open()).sRGBHex;
|
|
2506
|
+
this.currentColor = n, this.updateColorInput(), this.updateColorAreaFromHex(n), this.onColorChange && this.onColorChange(n);
|
|
2507
|
+
} catch (i) {
|
|
2508
|
+
console.log("User cancelled eyedropper or error occurred:", i);
|
|
2509
|
+
}
|
|
2510
|
+
else
|
|
2511
|
+
alert(
|
|
2512
|
+
"EyeDropper API is not supported in this browser. Try using Chrome 95+ or Edge 95+."
|
|
2513
|
+
);
|
|
2514
|
+
};
|
|
2515
|
+
t.addEventListener("click", e);
|
|
2516
|
+
}
|
|
2517
|
+
updateColorAreaFromHex(t) {
|
|
2518
|
+
this.hexInput.value = t;
|
|
2519
|
+
}
|
|
2520
|
+
copyToClipboard() {
|
|
2521
|
+
navigator.clipboard.writeText(this.currentColor).catch(() => {
|
|
2522
|
+
this.hexInput.select(), document.execCommand("copy");
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
open(t, e, i) {
|
|
2526
|
+
this.currentColor = t, this.currentOpacity = i ?? 100, this.updateColorInput(), this.updatePickerFromColor(t), this.updateOpacityBackground(), this.opacityMarker.style.left = `${this.currentOpacity}%`, this.isOpen = !0, this.element.style.display = "block";
|
|
2527
|
+
const s = e.getBoundingClientRect(), n = window.innerWidth, o = window.innerHeight;
|
|
2528
|
+
this.element.style.position = "fixed", this.element.style.zIndex = "10002";
|
|
2529
|
+
let a = s.right + 8, l = s.top;
|
|
2530
|
+
a + 408 > n && (a = s.left - 408 - 8), a < 8 && (a = Math.max(8, (n - 408) / 2)), l + 500 > o && (l = Math.max(8, o - 500 - 8)), this.element.style.left = `${a}px`, this.element.style.top = `${l}px`, this.element.parentElement || document.body.appendChild(this.element), this.updatePickerFromColor(t), setTimeout(() => {
|
|
2531
|
+
document.addEventListener("click", this.handleOutsideClick, !0);
|
|
2532
|
+
}, 50);
|
|
2533
|
+
}
|
|
2534
|
+
updatePickerFromColor(t) {
|
|
2535
|
+
const { h: e, s: i, v: s } = this.hexToHsv(t);
|
|
2536
|
+
this.isUpdatingHue || (this.hueMarker.style.left = `${e / 360 * 100}%`), this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${e}, 100%, 50%))`;
|
|
2537
|
+
}
|
|
2538
|
+
hexToHsv(t) {
|
|
2539
|
+
const e = parseInt(t.slice(1, 3), 16) / 255, i = parseInt(t.slice(3, 5), 16) / 255, s = parseInt(t.slice(5, 7), 16) / 255, n = Math.max(e, i, s), o = Math.min(e, i, s), a = n - o;
|
|
2540
|
+
let l = 0;
|
|
2541
|
+
const r = n === 0 ? 0 : a / n, c = n;
|
|
2542
|
+
return a !== 0 && (n === e ? l = (i - s) / a % 6 : n === i ? l = (s - e) / a + 2 : l = (e - i) / a + 4), { h: l * 60, s: r, v: c };
|
|
2543
|
+
}
|
|
2544
|
+
hexToRgb(t) {
|
|
2545
|
+
const e = parseInt(t.slice(1, 3), 16), i = parseInt(t.slice(3, 5), 16), s = parseInt(t.slice(5, 7), 16);
|
|
2546
|
+
return { r: e, g: i, b: s };
|
|
2547
|
+
}
|
|
2548
|
+
hsvToHsl(t, e, i) {
|
|
2549
|
+
const s = i * (1 - e / 2), n = s === 0 || s === 1 ? 0 : (i - s) / Math.min(s, 1 - s);
|
|
2550
|
+
return { hue: t, sat: n, lightness: s };
|
|
2551
|
+
}
|
|
2552
|
+
makeDraggable(t, e) {
|
|
2553
|
+
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2554
|
+
const l = (h) => {
|
|
2555
|
+
if (h.target.closest("button"))
|
|
2556
|
+
return;
|
|
2557
|
+
h.preventDefault(), h.stopPropagation(), i = !0, s = h.clientX, n = h.clientY;
|
|
2558
|
+
const d = e.getBoundingClientRect();
|
|
2559
|
+
o = d.left, a = d.top, e.classList.add("dragging"), document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
2560
|
+
}, r = (h) => {
|
|
2561
|
+
if (!i) return;
|
|
2562
|
+
h.preventDefault(), h.stopPropagation();
|
|
2563
|
+
const d = h.clientX - s, m = h.clientY - n;
|
|
2564
|
+
let u = o + d, g = a + m;
|
|
2565
|
+
const f = window.innerWidth, E = window.innerHeight, v = e.offsetWidth, w = e.offsetHeight;
|
|
2566
|
+
u = Math.max(8, Math.min(f - v - 8, u)), g = Math.max(8, Math.min(E - w - 8, g)), e.style.left = `${u}px`, e.style.top = `${g}px`;
|
|
2567
|
+
}, c = (h) => {
|
|
2568
|
+
i && (i = !1, h.preventDefault(), h.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2569
|
+
};
|
|
2570
|
+
t.addEventListener("mousedown", l);
|
|
2571
|
+
}
|
|
2572
|
+
close() {
|
|
2573
|
+
this.isOpen = !1, this.element.style.display = "none", document.removeEventListener("click", this.handleOutsideClick, !0);
|
|
2574
|
+
}
|
|
2575
|
+
getElement() {
|
|
2576
|
+
return this.element;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
class Ot extends S {
|
|
2580
|
+
constructor(t = {}) {
|
|
2581
|
+
let e;
|
|
2582
|
+
if (typeof t.default == "string")
|
|
2583
|
+
if (t.default.match(/^#[a-fA-F0-9]{3,8}$/)) {
|
|
2584
|
+
let i = t.default, s = 100;
|
|
2585
|
+
if (i.length === 9) {
|
|
2586
|
+
const n = parseInt(i.slice(-2), 16);
|
|
2587
|
+
s = Math.round(n / 255 * 100), i = i.slice(0, 7);
|
|
2588
|
+
}
|
|
2589
|
+
e = {
|
|
2590
|
+
type: "solid",
|
|
2591
|
+
angle: 90,
|
|
2592
|
+
stops: [{ color: i, position: 0, opacity: s }]
|
|
2593
|
+
};
|
|
2594
|
+
} else
|
|
2595
|
+
e = Tt(t.default) || {
|
|
2596
|
+
type: "linear",
|
|
2597
|
+
angle: 90,
|
|
2598
|
+
stops: [
|
|
2599
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2600
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2601
|
+
]
|
|
2602
|
+
};
|
|
2603
|
+
else
|
|
2604
|
+
e = t.default || {
|
|
2605
|
+
type: "linear",
|
|
2606
|
+
angle: 90,
|
|
2607
|
+
stops: [
|
|
2608
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2609
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2610
|
+
]
|
|
2611
|
+
};
|
|
2612
|
+
super({
|
|
2613
|
+
...t,
|
|
2614
|
+
title: t.title || "Gradient",
|
|
2615
|
+
default: e
|
|
2616
|
+
}), this.inputType = {
|
|
2617
|
+
type: "text",
|
|
2618
|
+
angle: "number",
|
|
2619
|
+
stops: "text"
|
|
2620
|
+
}, this.element = null, this.previewElement = null, this.textInputElement = null, this.popoverElement = null, this.placeholderTrigger = null, this.isPopoverOpen = !1, this.isUserEditing = !1, this.handleBackgroundClick = (i) => {
|
|
2621
|
+
var r;
|
|
2622
|
+
if (!this.popoverElement || !this.isPopoverOpen) return;
|
|
2623
|
+
const s = i.target, n = this.popoverElement.contains(s), o = (r = this.element) == null ? void 0 : r.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some(
|
|
2624
|
+
(c) => c.contains(s)
|
|
2625
|
+
);
|
|
2626
|
+
!n && !o && !l && this.closePopover();
|
|
2627
|
+
}, this.detectChange = t.detectChange, this.forText = t.forText || !1;
|
|
2628
|
+
}
|
|
2629
|
+
setValue(t) {
|
|
2630
|
+
let e;
|
|
2631
|
+
!t || !this.isValidGradientValue(t) ? (console.warn(
|
|
2632
|
+
"Invalid gradient value in setValue, using default:",
|
|
2633
|
+
t
|
|
2634
|
+
), e = {
|
|
2635
|
+
type: "linear",
|
|
2636
|
+
angle: 90,
|
|
2637
|
+
stops: [
|
|
2638
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2639
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2640
|
+
]
|
|
2641
|
+
}) : (e = t, e.stops && e.stops.forEach((i) => {
|
|
2642
|
+
i.opacity === void 0 && (i.opacity = 100);
|
|
2643
|
+
})), super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2644
|
+
}
|
|
2645
|
+
updateUI() {
|
|
2646
|
+
if (this.previewElement && this.value)
|
|
2647
|
+
if (this.value.type === "solid") {
|
|
2648
|
+
const t = this.value.stops && this.value.stops.length > 0 ? this.value.stops[0] : null;
|
|
2649
|
+
if (t) {
|
|
2650
|
+
const e = t.opacity !== void 0 ? t.opacity : 100;
|
|
2651
|
+
this.previewElement.style.background = this.addOpacityToColor(
|
|
2652
|
+
t.color,
|
|
2653
|
+
e
|
|
2654
|
+
);
|
|
2655
|
+
}
|
|
2656
|
+
} else
|
|
2657
|
+
this.previewElement.style.background = this.generateCSS(this.value);
|
|
2658
|
+
this.textInputElement && this.value && !this.isUserEditing && (this.textInputElement.value = this.generateDisplayText(this.value));
|
|
2659
|
+
}
|
|
2660
|
+
generateDisplayText(t) {
|
|
2661
|
+
if (!t) return "";
|
|
2662
|
+
if (t.type === "solid") {
|
|
2663
|
+
const i = t.stops && t.stops.length > 0 ? t.stops[0] : null;
|
|
2664
|
+
return i ? i.color.replace("#", "").toUpperCase() : "Color";
|
|
2665
|
+
}
|
|
2666
|
+
t.stops && t.stops.length;
|
|
2667
|
+
const e = t.type === "linear" ? "Linear" : "Radial";
|
|
2668
|
+
return t.type === "linear" ? `${e} ${t.angle}°` : `${e} Gradient`;
|
|
2669
|
+
}
|
|
2670
|
+
draw() {
|
|
2671
|
+
const t = document.createElement("div");
|
|
2672
|
+
if (t.className = "gradient-setting-wrapper", this.props.title) {
|
|
2673
|
+
const s = document.createElement("div");
|
|
2674
|
+
s.className = "icon-container";
|
|
2675
|
+
const n = document.createElement("span");
|
|
2676
|
+
n.className = "input-label", n.textContent = this.props.title, s.appendChild(n), t.appendChild(s);
|
|
2677
|
+
}
|
|
2678
|
+
const e = document.createElement("div");
|
|
2679
|
+
e.className = "gradient-input-wrapper", this.previewElement = document.createElement("div"), this.previewElement.className = "gradient-mini-preview", this.previewElement.style.background = this.value ? this.generateCSS(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.textInputElement = document.createElement("input"), this.textInputElement.type = "text", this.textInputElement.className = "gradient-text-input", this.textInputElement.placeholder = "Enter gradient CSS or paste color...", this.textInputElement.value = this.value ? this.generateDisplayText(this.value) : "", this.textInputElement.readOnly = !1, this.previewElement.addEventListener("click", () => this.openPopover()), this.textInputElement.addEventListener("focus", () => {
|
|
2680
|
+
this.isUserEditing = !0, this.value && (this.textInputElement.value = this.generateCSS(this.value));
|
|
2681
|
+
}), this.textInputElement.addEventListener("blur", () => {
|
|
2682
|
+
this.isUserEditing = !1, this.value && (this.textInputElement.value = this.generateDisplayText(this.value)), this.placeholderTrigger && (this.placeholderTrigger.style.display = this.textInputElement.value ? "none" : "flex");
|
|
2683
|
+
}), this.textInputElement.addEventListener(
|
|
2684
|
+
"paste",
|
|
2685
|
+
(s) => this.handlePaste(s)
|
|
2686
|
+
), this.textInputElement.addEventListener(
|
|
2687
|
+
"input",
|
|
2688
|
+
(s) => this.handleInput(s)
|
|
2689
|
+
), this.textInputElement.addEventListener("keydown", (s) => {
|
|
2690
|
+
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.value)), this.textInputElement.blur());
|
|
2691
|
+
});
|
|
2692
|
+
const i = document.createElement("div");
|
|
2693
|
+
return i.className = "gradient-input-placeholder-trigger", i.textContent = this.textInputElement.placeholder || "", i.style.display = this.textInputElement.value ? "none" : "flex", i.addEventListener("click", (s) => {
|
|
2694
|
+
s.stopPropagation(), this.openPopover();
|
|
2695
|
+
}), e.appendChild(this.previewElement), e.appendChild(this.textInputElement), e.appendChild(i), this.placeholderTrigger = i, t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
2696
|
+
}
|
|
2697
|
+
isValidGradientValue(t) {
|
|
2698
|
+
return !t || typeof t != "object" || !t.type || !["linear", "radial", "solid"].includes(t.type) || t.type !== "solid" && typeof t.angle != "number" || !Array.isArray(t.stops) || t.stops.length === 0 ? !1 : t.stops.every(
|
|
2699
|
+
(e) => e && typeof e.color == "string" && typeof e.position == "number"
|
|
2700
|
+
);
|
|
2701
|
+
}
|
|
2702
|
+
generateCSS(t) {
|
|
2703
|
+
if (!t || !this.isValidGradientValue(t))
|
|
2704
|
+
return console.warn("Invalid gradient value passed to generateCSS:", t), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2705
|
+
if (t.type === "solid") {
|
|
2706
|
+
const i = t.stops && t.stops.length > 0 ? t.stops[0] : null;
|
|
2707
|
+
if (!i) return "#000000";
|
|
2708
|
+
const s = i.opacity !== void 0 ? i.opacity : 100, n = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2709
|
+
return `#${i.color.replace("#", "")}${n}`;
|
|
2710
|
+
}
|
|
2711
|
+
if (!t.stops || !Array.isArray(t.stops) || t.stops.length === 0)
|
|
2712
|
+
return console.warn("Invalid gradient stops in generateCSS:", t), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2713
|
+
const e = t.stops.map((i) => {
|
|
2714
|
+
const s = i.opacity !== void 0 ? i.opacity : 100;
|
|
2715
|
+
return `${this.addOpacityToColor(i.color, s)} ${i.position}%`;
|
|
2716
|
+
}).join(", ");
|
|
2717
|
+
return t.type === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${t.angle}deg, ${e})`;
|
|
2718
|
+
}
|
|
2719
|
+
addOpacityToColor(t, e) {
|
|
2720
|
+
const i = e / 100;
|
|
2721
|
+
if (t.startsWith("#")) {
|
|
2722
|
+
const s = t.slice(1), n = parseInt(s.substr(0, 2), 16), o = parseInt(s.substr(2, 2), 16), a = parseInt(s.substr(4, 2), 16);
|
|
2723
|
+
return `rgba(${n}, ${o}, ${a}, ${i})`;
|
|
2724
|
+
}
|
|
2725
|
+
if (t.startsWith("rgb("))
|
|
2726
|
+
return t.replace("rgb(", "rgba(").replace(")", `, ${i})`);
|
|
2727
|
+
if (t.startsWith("rgba("))
|
|
2728
|
+
return t.replace(/,\s*[\d.]+\)$/, `, ${i})`);
|
|
2729
|
+
if (t.startsWith("hsl(")) {
|
|
2730
|
+
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2731
|
+
if (s) {
|
|
2732
|
+
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, { r: l, g: r, b: c } = this.hslToRgb(n, o, a);
|
|
2733
|
+
return `rgba(${l}, ${r}, ${c}, ${i})`;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
if (t.startsWith("hsla(")) {
|
|
2737
|
+
const s = t.match(
|
|
2738
|
+
/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/
|
|
2739
|
+
);
|
|
2740
|
+
if (s) {
|
|
2741
|
+
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, { r: l, g: r, b: c } = this.hslToRgb(n, o, a);
|
|
2742
|
+
return `rgba(${l}, ${r}, ${c}, ${i})`;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
try {
|
|
2746
|
+
const s = t.replace("#", "");
|
|
2747
|
+
if (/^[0-9A-Fa-f]{6}$/.test(s)) {
|
|
2748
|
+
const n = parseInt(s.substr(0, 2), 16), o = parseInt(s.substr(2, 2), 16), a = parseInt(s.substr(4, 2), 16);
|
|
2749
|
+
return `rgba(${n}, ${o}, ${a}, ${i})`;
|
|
2750
|
+
}
|
|
2751
|
+
} catch {
|
|
2752
|
+
}
|
|
2753
|
+
return t;
|
|
2754
|
+
}
|
|
2755
|
+
hexToRgb(t) {
|
|
2756
|
+
const e = t.replace("#", ""), i = e.length === 3 ? e.split("").map((a) => a + a).join("") : e, s = parseInt(i.slice(0, 2), 16), n = parseInt(i.slice(2, 4), 16), o = parseInt(i.slice(4, 6), 16);
|
|
2757
|
+
return { r: s, g: n, b: o };
|
|
2758
|
+
}
|
|
2759
|
+
createPopover() {
|
|
2760
|
+
if (this.popoverElement) return;
|
|
2761
|
+
this.popoverElement = document.createElement("div"), this.popoverElement.className = "gradient-popover", this.popoverElement.style.display = "none";
|
|
2762
|
+
const t = document.createElement("div");
|
|
2763
|
+
t.className = "gradient-popover-header";
|
|
2764
|
+
const e = document.createElement("span");
|
|
2765
|
+
e.textContent = "Fill";
|
|
2766
|
+
const i = document.createElement("button");
|
|
2767
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = at, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
2768
|
+
const s = document.createElement("div");
|
|
2769
|
+
s.className = "gradient-editor";
|
|
2770
|
+
const n = this.createTypeTabs();
|
|
2771
|
+
s.appendChild(n);
|
|
2772
|
+
const o = document.createElement("div");
|
|
2773
|
+
o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.popoverElement.appendChild(t), this.popoverElement.appendChild(s), document.body.appendChild(this.popoverElement);
|
|
2774
|
+
}
|
|
2775
|
+
createTypeTabs() {
|
|
2776
|
+
var s, n;
|
|
2777
|
+
const t = document.createElement("div");
|
|
2778
|
+
t.className = "gradient-type-tabs";
|
|
2779
|
+
const e = document.createElement("button");
|
|
2780
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.textContent = "Solid", e.addEventListener("click", () => this.switchType("solid"));
|
|
2781
|
+
const i = document.createElement("button");
|
|
2782
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.textContent = "Gradient", i.addEventListener("click", () => {
|
|
2783
|
+
var a, l;
|
|
2784
|
+
const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
2785
|
+
this.switchType(o);
|
|
2786
|
+
}), t.appendChild(e), t.appendChild(i), t;
|
|
2787
|
+
}
|
|
2788
|
+
switchType(t) {
|
|
2789
|
+
var n, o, a;
|
|
2790
|
+
if (!this.value) return;
|
|
2791
|
+
this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
2792
|
+
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2793
|
+
{ color: "#786666", position: 100, opacity: 100 }
|
|
2794
|
+
]);
|
|
2795
|
+
const e = (n = this.popoverElement) == null ? void 0 : n.querySelectorAll(".gradient-type-tab");
|
|
2796
|
+
e == null || e.forEach((l, r) => {
|
|
2797
|
+
l.classList.remove("active"), (r === 0 && t === "solid" || r === 1 && t !== "solid") && l.classList.add("active");
|
|
2798
|
+
});
|
|
2799
|
+
const i = (o = this.popoverElement) == null ? void 0 : o.querySelectorAll(
|
|
2800
|
+
".gradient-subtype-tab"
|
|
2801
|
+
);
|
|
2802
|
+
i == null || i.forEach((l, r) => {
|
|
2803
|
+
l.classList.remove("active"), (r === 0 && t === "linear" || r === 1 && t === "radial") && l.classList.add("active");
|
|
2804
|
+
});
|
|
2805
|
+
const s = (a = this.popoverElement) == null ? void 0 : a.querySelector(
|
|
2806
|
+
".gradient-editor-content"
|
|
2807
|
+
);
|
|
2808
|
+
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
2809
|
+
}
|
|
2810
|
+
updatePopoverContent(t) {
|
|
2811
|
+
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2812
|
+
}
|
|
2813
|
+
createSolidEditor(t) {
|
|
2814
|
+
var o, a, l, r, c, h;
|
|
2815
|
+
const e = document.createElement("div");
|
|
2816
|
+
e.className = "gradient-solid-picker embedded-color-picker";
|
|
2817
|
+
const i = ((l = (a = (o = this.value) == null ? void 0 : o.stops) == null ? void 0 : a[0]) == null ? void 0 : l.color) || "#000000", s = ((h = (c = (r = this.value) == null ? void 0 : r.stops) == null ? void 0 : c[0]) == null ? void 0 : h.opacity) || 100, n = this.createEmbeddedColorPickerWithOpacity(
|
|
2818
|
+
i,
|
|
2819
|
+
s,
|
|
2820
|
+
(d, m) => {
|
|
2821
|
+
this.value && (!this.value.stops || this.value.stops.length === 0 ? this.value.stops = [{ color: d, position: 0, opacity: m }] : (this.value.stops[0].color = d, this.value.stops[0].opacity = m), this.updateUI(), this.triggerChange());
|
|
2822
|
+
}
|
|
2823
|
+
);
|
|
2824
|
+
e.appendChild(n), t.appendChild(e);
|
|
2825
|
+
}
|
|
2826
|
+
createEmbeddedColorPickerWithOpacity(t, e, i) {
|
|
2827
|
+
const s = document.createElement("div");
|
|
2828
|
+
s.className = "embedded-color-picker-content";
|
|
2829
|
+
const n = document.createElement("div");
|
|
2830
|
+
n.className = "color-picker-area embedded";
|
|
2831
|
+
const o = document.createElement("div");
|
|
2832
|
+
o.className = "color-picker-marker", n.appendChild(o);
|
|
2833
|
+
const a = document.createElement("div");
|
|
2834
|
+
a.className = "color-picker-hue-container";
|
|
2835
|
+
const l = document.createElement("button");
|
|
2836
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2837
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2838
|
+
</svg>`;
|
|
2839
|
+
const r = document.createElement("div");
|
|
2840
|
+
r.className = "color-picker-hue embedded";
|
|
2841
|
+
const c = document.createElement("div");
|
|
2842
|
+
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2843
|
+
const h = document.createElement("div");
|
|
2844
|
+
h.className = "color-picker-opacity embedded";
|
|
2845
|
+
const d = document.createElement("div");
|
|
2846
|
+
d.className = "color-picker-opacity-marker", h.appendChild(d);
|
|
2847
|
+
const m = document.createElement("div");
|
|
2848
|
+
m.className = "color-picker-format-section embedded";
|
|
2849
|
+
const u = document.createElement("select");
|
|
2850
|
+
u.className = "color-picker-format-select";
|
|
2851
|
+
const g = document.createElement("option");
|
|
2852
|
+
g.value = "hex", g.textContent = "HEX";
|
|
2853
|
+
const f = document.createElement("option");
|
|
2854
|
+
f.value = "rgb", f.textContent = "RGB";
|
|
2855
|
+
const E = document.createElement("option");
|
|
2856
|
+
E.value = "hsl", E.textContent = "HSL", u.appendChild(g), u.appendChild(f), u.appendChild(E);
|
|
2857
|
+
const v = document.createElement("input");
|
|
2858
|
+
v.type = "text", v.className = "color-picker-color-input", v.value = t;
|
|
2859
|
+
const w = document.createElement("div");
|
|
2860
|
+
w.className = "color-picker-input-container";
|
|
2861
|
+
const V = document.createElement("button");
|
|
2862
|
+
return V.className = "color-picker-copy-inside", V.textContent = "Copy", w.appendChild(v), w.appendChild(V), m.appendChild(u), m.appendChild(w), s.appendChild(n), s.appendChild(a), s.appendChild(h), s.appendChild(m), this.setupEmbeddedColorPicker(
|
|
2863
|
+
n,
|
|
2864
|
+
o,
|
|
2865
|
+
r,
|
|
2866
|
+
c,
|
|
2867
|
+
u,
|
|
2868
|
+
v,
|
|
2869
|
+
V,
|
|
2870
|
+
l,
|
|
2871
|
+
t,
|
|
2872
|
+
e,
|
|
2873
|
+
i
|
|
2874
|
+
), this.setupOpacitySlider(
|
|
2875
|
+
h,
|
|
2876
|
+
d,
|
|
2877
|
+
t,
|
|
2878
|
+
e,
|
|
2879
|
+
i
|
|
2880
|
+
), s;
|
|
2881
|
+
}
|
|
2882
|
+
createEmbeddedColorPicker(t, e, i) {
|
|
2883
|
+
const s = document.createElement("div");
|
|
2884
|
+
s.className = "embedded-color-picker-content";
|
|
2885
|
+
const n = document.createElement("div");
|
|
2886
|
+
n.className = "color-picker-area embedded";
|
|
2887
|
+
const o = document.createElement("div");
|
|
2888
|
+
o.className = "color-picker-marker", n.appendChild(o);
|
|
2889
|
+
const a = document.createElement("div");
|
|
2890
|
+
a.className = "color-picker-hue-container";
|
|
2891
|
+
const l = document.createElement("button");
|
|
2892
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2893
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2894
|
+
</svg>`;
|
|
2895
|
+
const r = document.createElement("div");
|
|
2896
|
+
r.className = "color-picker-hue embedded";
|
|
2897
|
+
const c = document.createElement("div");
|
|
2898
|
+
c.className = "color-picker-hue-marker", r.appendChild(c), a.appendChild(l), a.appendChild(r);
|
|
2899
|
+
const h = document.createElement("div");
|
|
2900
|
+
h.className = "color-picker-format-section embedded";
|
|
2901
|
+
const d = document.createElement("select");
|
|
2902
|
+
d.className = "color-picker-format-select";
|
|
2903
|
+
const m = document.createElement("option");
|
|
2904
|
+
m.value = "hex", m.textContent = "HEX";
|
|
2905
|
+
const u = document.createElement("option");
|
|
2906
|
+
u.value = "rgb", u.textContent = "RGB";
|
|
2907
|
+
const g = document.createElement("option");
|
|
2908
|
+
g.value = "hsl", g.textContent = "HSL", d.appendChild(m), d.appendChild(u), d.appendChild(g);
|
|
2909
|
+
const f = document.createElement("input");
|
|
2910
|
+
f.type = "text", f.className = "color-picker-color-input", f.value = t;
|
|
2911
|
+
const E = document.createElement("div");
|
|
2912
|
+
E.className = "color-picker-input-container";
|
|
2913
|
+
const v = document.createElement("button");
|
|
2914
|
+
return v.className = "color-picker-copy-inside", v.textContent = "Copy", E.appendChild(f), E.appendChild(v), h.appendChild(d), h.appendChild(E), s.appendChild(n), s.appendChild(a), s.appendChild(h), this.setupEmbeddedColorPicker(
|
|
2915
|
+
n,
|
|
2916
|
+
o,
|
|
2917
|
+
r,
|
|
2918
|
+
c,
|
|
2919
|
+
d,
|
|
2920
|
+
f,
|
|
2921
|
+
v,
|
|
2922
|
+
l,
|
|
2923
|
+
t,
|
|
2924
|
+
e,
|
|
2925
|
+
i
|
|
2926
|
+
), s;
|
|
2927
|
+
}
|
|
2928
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, h) {
|
|
2929
|
+
let d = r;
|
|
2930
|
+
const { h: m, s: u, v: g } = this.hexToHsv(r);
|
|
2931
|
+
let f = c;
|
|
2932
|
+
s.style.left = `${m / 360 * 100}%`, e.style.left = `${u * 100}%`, e.style.top = `${(1 - g) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${m}, 100%, 50%))`;
|
|
2933
|
+
const E = (C, b = f) => {
|
|
2934
|
+
d = C, f = Math.round(b), v(), h(C, f);
|
|
2935
|
+
}, v = () => {
|
|
2936
|
+
const C = n.value, { h: b, s: x, v: L } = this.hexToHsv(d);
|
|
2937
|
+
switch (C) {
|
|
2938
|
+
case "hex":
|
|
2939
|
+
o.value = d;
|
|
2940
|
+
break;
|
|
2941
|
+
case "rgb":
|
|
2942
|
+
const { r: H, g: $, b: R } = this.hexToRgb(d);
|
|
2943
|
+
o.value = `rgb(${H}, ${$}, ${R})`;
|
|
2944
|
+
break;
|
|
2945
|
+
case "hsl":
|
|
2946
|
+
const { hue: B, sat: _, lightness: K } = this.hsvToHsl(b, x, L);
|
|
2947
|
+
o.value = `hsl(${Math.round(B)}, ${Math.round(
|
|
2948
|
+
_ * 100
|
|
2949
|
+
)}%, ${Math.round(K * 100)}%)`;
|
|
2950
|
+
break;
|
|
2951
|
+
}
|
|
2952
|
+
}, w = () => parseFloat(s.style.left || "0%") / 100 * 360, V = (C, b) => {
|
|
2953
|
+
const x = w(), L = this.hsvToHex(x, C, b);
|
|
2954
|
+
E(L, f);
|
|
2955
|
+
}, z = (C) => {
|
|
2956
|
+
C = Math.max(0.1, Math.min(358.9, C));
|
|
2957
|
+
const b = parseFloat(e.style.left || "50%") / 100, x = parseFloat(e.style.top || "50%") / 100;
|
|
2958
|
+
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`;
|
|
2959
|
+
const L = b, H = 1 - x, $ = this.hsvToHex(C, L, H);
|
|
2960
|
+
E($, f);
|
|
2961
|
+
}, U = (C) => {
|
|
2962
|
+
C.stopPropagation();
|
|
2963
|
+
const b = t.getBoundingClientRect(), x = Math.max(0, Math.min(1, (C.clientX - b.left) / b.width)), L = Math.max(0, Math.min(1, (C.clientY - b.top) / b.height));
|
|
2964
|
+
e.style.left = `${x * 100}%`, e.style.top = `${L * 100}%`, V(x, 1 - L);
|
|
2965
|
+
}, I = (C) => {
|
|
2966
|
+
C.preventDefault(), C.stopPropagation(), U(C);
|
|
2967
|
+
const b = (L) => U(L), x = () => {
|
|
2968
|
+
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", x);
|
|
2969
|
+
};
|
|
2970
|
+
document.addEventListener("mousemove", b), document.addEventListener("mouseup", x);
|
|
2971
|
+
}, y = (C) => {
|
|
2972
|
+
C.stopPropagation();
|
|
2973
|
+
const b = i.getBoundingClientRect();
|
|
2974
|
+
let x = (C.clientX - b.left) / b.width;
|
|
2975
|
+
x = Math.max(1e-3, Math.min(0.998, x)), s.style.left = `${x * 100}%`;
|
|
2976
|
+
const L = x * 360;
|
|
2977
|
+
z(L);
|
|
2978
|
+
}, k = (C) => {
|
|
2979
|
+
C.preventDefault(), C.stopPropagation(), y(C);
|
|
2980
|
+
const b = (L) => y(L), x = () => {
|
|
2981
|
+
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", x);
|
|
2982
|
+
};
|
|
2983
|
+
document.addEventListener("mousemove", b), document.addEventListener("mouseup", x);
|
|
2984
|
+
}, P = (C) => {
|
|
2985
|
+
const b = C.target.value, x = n.value;
|
|
2986
|
+
let L = "";
|
|
2987
|
+
if (x === "hex" && /^#[0-9A-Fa-f]{6}$/.test(b))
|
|
2988
|
+
L = b;
|
|
2989
|
+
else if (x === "rgb") {
|
|
2990
|
+
const H = b.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2991
|
+
if (H) {
|
|
2992
|
+
const $ = parseInt(H[1]), R = parseInt(H[2]), B = parseInt(H[3]);
|
|
2993
|
+
$ <= 255 && R <= 255 && B <= 255 && (L = `#${$.toString(16).padStart(2, "0")}${R.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`);
|
|
2994
|
+
}
|
|
2995
|
+
} else if (x === "hsl") {
|
|
2996
|
+
const H = b.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2997
|
+
if (H) {
|
|
2998
|
+
const $ = parseInt(H[1]), R = parseInt(H[2]) / 100, B = parseInt(H[3]) / 100;
|
|
2999
|
+
if ($ <= 360 && R <= 1 && B <= 1) {
|
|
3000
|
+
const _ = B + R * Math.min(B, 1 - B), K = _ === 0 ? 0 : 2 * (1 - B / _);
|
|
3001
|
+
L = this.hsvToHex($, K, _);
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
if (L) {
|
|
3006
|
+
const { h: H, s: $, v: R } = this.hexToHsv(L);
|
|
3007
|
+
s.style.left = `${H / 360 * 100}%`, e.style.left = `${$ * 100}%`, e.style.top = `${(1 - R) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${H}, 100%, 50%))`, E(L, f);
|
|
3008
|
+
}
|
|
3009
|
+
}, O = (C) => {
|
|
3010
|
+
v();
|
|
3011
|
+
}, T = () => {
|
|
3012
|
+
v();
|
|
3013
|
+
}, M = () => {
|
|
3014
|
+
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3015
|
+
o.select(), document.execCommand("copy");
|
|
3016
|
+
});
|
|
3017
|
+
};
|
|
3018
|
+
v(), t.addEventListener("mousedown", I), t.addEventListener("click", U), i.addEventListener("mousedown", k), i.addEventListener("click", y), n.addEventListener("change", T), o.addEventListener("input", P), o.addEventListener("blur", O), a.addEventListener("click", M);
|
|
3019
|
+
const A = async () => {
|
|
3020
|
+
if ("EyeDropper" in window)
|
|
3021
|
+
try {
|
|
3022
|
+
const x = (await new window.EyeDropper().open()).sRGBHex, { h: L, s: H, v: $ } = this.hexToHsv(x);
|
|
3023
|
+
s.style.left = `${L / 360 * 100}%`, e.style.left = `${H * 100}%`, e.style.top = `${(1 - $) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${L}, 100%, 50%))`, E(x, f);
|
|
3024
|
+
} catch (C) {
|
|
3025
|
+
console.log("User cancelled eyedropper or error occurred:", C);
|
|
3026
|
+
}
|
|
3027
|
+
else
|
|
3028
|
+
alert(
|
|
3029
|
+
"EyeDropper API is not supported in this browser. Try using Chrome 95+ or Edge 95+."
|
|
3030
|
+
);
|
|
3031
|
+
};
|
|
3032
|
+
l.addEventListener("click", A);
|
|
3033
|
+
}
|
|
3034
|
+
hsvToHex(t, e, i) {
|
|
3035
|
+
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
3036
|
+
let a = 0, l = 0, r = 0;
|
|
3037
|
+
return t >= 0 && t < 60 ? (a = s, l = n, r = 0) : t >= 60 && t < 120 ? (a = n, l = s, r = 0) : t >= 120 && t < 180 ? (a = 0, l = s, r = n) : t >= 180 && t < 240 ? (a = 0, l = n, r = s) : t >= 240 && t < 300 ? (a = n, l = 0, r = s) : t >= 300 && t < 360 && (a = s, l = 0, r = n), a = Math.round((a + o) * 255), l = Math.round((l + o) * 255), r = Math.round((r + o) * 255), `#${a.toString(16).padStart(2, "0")}${l.toString(16).padStart(2, "0")}${r.toString(16).padStart(2, "0")}`;
|
|
3038
|
+
}
|
|
3039
|
+
setupOpacitySlider(t, e, i, s, n) {
|
|
3040
|
+
const o = () => {
|
|
3041
|
+
const { r: c, g: h, b: d } = this.hexToRgb(i);
|
|
3042
|
+
t.style.setProperty("--color-rgb", `${c}, ${h}, ${d}`);
|
|
3043
|
+
}, a = () => {
|
|
3044
|
+
e.style.left = `${s}%`;
|
|
3045
|
+
};
|
|
3046
|
+
o(), a();
|
|
3047
|
+
let l = !1;
|
|
3048
|
+
const r = (c) => {
|
|
3049
|
+
const h = t.getBoundingClientRect(), d = c.clientX - h.left, m = Math.max(0, Math.min(100, d / h.width * 100)), u = Math.round(m);
|
|
3050
|
+
s = u, a(), n(i, u);
|
|
3051
|
+
};
|
|
3052
|
+
t.addEventListener("mousedown", (c) => {
|
|
3053
|
+
l = !0, r(c);
|
|
3054
|
+
}), document.addEventListener("mousemove", (c) => {
|
|
3055
|
+
l && r(c);
|
|
3056
|
+
}), document.addEventListener("mouseup", () => {
|
|
3057
|
+
l = !1;
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
hexToHsv(t) {
|
|
3061
|
+
const e = parseInt(t.slice(1, 3), 16) / 255, i = parseInt(t.slice(3, 5), 16) / 255, s = parseInt(t.slice(5, 7), 16) / 255, n = Math.max(e, i, s), o = Math.min(e, i, s), a = n - o;
|
|
3062
|
+
let l = 0;
|
|
3063
|
+
const r = n === 0 ? 0 : a / n, c = n;
|
|
3064
|
+
return a !== 0 && (n === e ? l = (i - s) / a % 6 : n === i ? l = (s - e) / a + 2 : l = (e - i) / a + 4), { h: l * 60, s: r, v: c };
|
|
3065
|
+
}
|
|
3066
|
+
hsvToHsl(t, e, i) {
|
|
3067
|
+
const s = i * (1 - e / 2), n = s === 0 || s === 1 ? 0 : (i - s) / Math.min(s, 1 - s);
|
|
3068
|
+
return { hue: t, sat: n, lightness: s };
|
|
3069
|
+
}
|
|
3070
|
+
createGradientEditor(t) {
|
|
3071
|
+
if (!this.value) return;
|
|
3072
|
+
const e = document.createElement("div");
|
|
3073
|
+
e.className = "gradient-subtype-inline";
|
|
3074
|
+
const i = document.createElement("select");
|
|
3075
|
+
i.className = "gradient-subtype-select";
|
|
3076
|
+
const s = document.createElement("option");
|
|
3077
|
+
s.value = "linear", s.textContent = "Linear";
|
|
3078
|
+
const n = document.createElement("option");
|
|
3079
|
+
n.value = "radial", n.textContent = "Radial", i.appendChild(s), i.appendChild(n), i.value = this.value.type === "radial" ? "radial" : "linear";
|
|
3080
|
+
const o = document.createElement("input");
|
|
3081
|
+
o.type = "text", o.inputMode = "numeric", o.className = "gradient-degree-input";
|
|
3082
|
+
const a = this.value.angle !== void 0 ? this.value.angle : 0;
|
|
3083
|
+
o.value = `${a}°`, o.setAttribute("data-min", "0"), o.setAttribute("data-max", "360"), o.style.width = "75px", o.style.textAlign = "center";
|
|
3084
|
+
const l = document.createElement("button");
|
|
3085
|
+
l.type = "button", l.className = "gradient-flip-btn", l.innerHTML = `
|
|
3086
|
+
<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3087
|
+
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3088
|
+
</svg>
|
|
3089
|
+
`, l.title = "Flip gradient", i.addEventListener("change", (f) => {
|
|
3090
|
+
const E = f.target.value;
|
|
3091
|
+
this.switchType(E === "radial" ? "radial" : "linear");
|
|
3092
|
+
}), o.addEventListener("input", (f) => {
|
|
3093
|
+
const E = f.target.value, v = parseInt(E);
|
|
3094
|
+
if (this.value && !isNaN(v)) {
|
|
3095
|
+
const w = Math.max(0, Math.min(360, v));
|
|
3096
|
+
this.value.angle = w, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3097
|
+
}
|
|
3098
|
+
}), o.addEventListener("focus", (f) => {
|
|
3099
|
+
const E = f.target;
|
|
3100
|
+
E.value = E.value.replace(/[^0-9-]/g, ""), setTimeout(() => E.select(), 0);
|
|
3101
|
+
}), o.addEventListener("blur", (f) => {
|
|
3102
|
+
var w;
|
|
3103
|
+
const E = f.target;
|
|
3104
|
+
let v = parseInt(E.value);
|
|
3105
|
+
isNaN(v) && (v = ((w = this.value) == null ? void 0 : w.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), E.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3106
|
+
}), l.addEventListener("click", () => {
|
|
3107
|
+
this.value && (this.value.stops = this.value.stops.map((f) => ({
|
|
3108
|
+
...f,
|
|
3109
|
+
position: 100 - f.position
|
|
3110
|
+
})), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3111
|
+
}), e.appendChild(i), e.appendChild(o), e.appendChild(l), t.appendChild(e), (() => {
|
|
3112
|
+
var f;
|
|
3113
|
+
((f = this.value) == null ? void 0 : f.type) === "radial" ? (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "1");
|
|
3114
|
+
})();
|
|
3115
|
+
const c = document.createElement("div");
|
|
3116
|
+
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
3117
|
+
const h = document.createElement("div");
|
|
3118
|
+
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3119
|
+
const d = document.createElement("div");
|
|
3120
|
+
d.className = "gradient-stops-header";
|
|
3121
|
+
const m = document.createElement("span");
|
|
3122
|
+
m.textContent = "Stops";
|
|
3123
|
+
const u = document.createElement("button");
|
|
3124
|
+
u.type = "button", u.className = "gradient-add-stop", u.textContent = "+", d.appendChild(m), d.appendChild(u);
|
|
3125
|
+
const g = document.createElement("div");
|
|
3126
|
+
g.className = "gradient-stops", t.appendChild(d), t.appendChild(g), this.updateStopsList(g), u.addEventListener("click", () => {
|
|
3127
|
+
this.addGradientStop(), this.updateStopsList(g), this.updateGradientPreview(c), this.createGradientHandles(h, c), this.updateUI();
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
updateGradientPreview(t) {
|
|
3131
|
+
var i;
|
|
3132
|
+
const e = t || ((i = this.popoverElement) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3133
|
+
e && this.value && (e.style.background = this.generateCSS(this.value));
|
|
3134
|
+
}
|
|
3135
|
+
createGradientHandles(t, e) {
|
|
3136
|
+
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3137
|
+
const n = document.createElement("div");
|
|
3138
|
+
n.className = "gstop-handle", n.style.left = `${i.position}%`;
|
|
3139
|
+
const o = document.createElement("div");
|
|
3140
|
+
o.className = "gstop-chip", o.style.backgroundColor = i.color, n.appendChild(o), this.makeDraggable(n, e, s), t.appendChild(n);
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
makeDraggable(t, e, i) {
|
|
3144
|
+
let s = !1, n = 0, o = 0, a = null;
|
|
3145
|
+
const l = (d) => "touches" in d && d.touches.length > 0 ? d.touches[0].clientX : d.clientX, r = (d) => {
|
|
3146
|
+
var m, u, g;
|
|
3147
|
+
s = !0, n = l(d), o = ((g = (u = (m = this.value) == null ? void 0 : m.stops) == null ? void 0 : u[i]) == null ? void 0 : g.position) || 0, t.classList.add("selected"), document.addEventListener("pointermove", c, { passive: !1 }), document.addEventListener("pointerup", h), document.addEventListener("mousemove", c, { passive: !1 }), document.addEventListener("mouseup", h), document.addEventListener("touchmove", c, {
|
|
3148
|
+
passive: !1
|
|
3149
|
+
}), document.addEventListener("touchend", h), d.preventDefault();
|
|
3150
|
+
}, c = (d) => {
|
|
3151
|
+
var E, v;
|
|
3152
|
+
if (!s || !((v = (E = this.value) == null ? void 0 : E.stops) != null && v[i])) return;
|
|
3153
|
+
const m = e.getBoundingClientRect(), g = (l(d) - n) / m.width * 100;
|
|
3154
|
+
let f = o + g;
|
|
3155
|
+
f = Math.max(0, Math.min(100, f)), this.value.stops[i].position = Math.round(f), t.style.left = `${f}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
3156
|
+
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3157
|
+
}), d.preventDefault();
|
|
3158
|
+
}, h = () => {
|
|
3159
|
+
s && (s = !1, t.classList.remove("selected"), a && (cancelAnimationFrame(a), a = null), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange(), document.removeEventListener("pointermove", c), document.removeEventListener("pointerup", h), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", h), document.removeEventListener("touchmove", c), document.removeEventListener("touchend", h));
|
|
3160
|
+
};
|
|
3161
|
+
t.addEventListener("pointerdown", r), t.addEventListener("mousedown", r), t.addEventListener("touchstart", r, {
|
|
3162
|
+
passive: !1
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
updateStopsList(t) {
|
|
3166
|
+
var i;
|
|
3167
|
+
const e = t || ((i = this.popoverElement) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3168
|
+
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3169
|
+
var z, U;
|
|
3170
|
+
const o = document.createElement("div");
|
|
3171
|
+
o.className = "gstop-row";
|
|
3172
|
+
const a = document.createElement("div");
|
|
3173
|
+
a.className = "gstop-position-group";
|
|
3174
|
+
const l = document.createElement("input");
|
|
3175
|
+
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
3176
|
+
const r = document.createElement("div");
|
|
3177
|
+
r.className = "gstop-color-container";
|
|
3178
|
+
const c = document.createElement("div");
|
|
3179
|
+
c.className = "gstop-color-preview", c.style.backgroundColor = s.color;
|
|
3180
|
+
const h = document.createElement("input");
|
|
3181
|
+
h.type = "text", h.className = "gstop-color-input", h.value = s.color.replace("#", "").toUpperCase();
|
|
3182
|
+
const d = document.createElement("button");
|
|
3183
|
+
d.type = "button", d.className = "gstop-color-copy", d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3184
|
+
<path d="M14.5896 19.3033L13.4111 20.4818C11.7839 22.109 9.14575 22.109 7.51856 20.4818C5.89138 18.8546 5.89138 16.2164 7.51856 14.5892L8.69708 13.4107M19.3037 14.5892L20.4822 13.4107C22.1094 11.7835 22.1094 9.14535 20.4822 7.51816C18.855 5.89098 16.2168 5.89098 14.5896 7.51816L13.4111 8.69668M11.0837 16.9166L16.917 11.0833" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3185
|
+
</svg>`, r.appendChild(c), r.appendChild(h), r.appendChild(d);
|
|
3186
|
+
const m = document.createElement("button");
|
|
3187
|
+
m.type = "button", m.className = "gstop-del", m.innerHTML = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3188
|
+
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3189
|
+
</svg>`, m.disabled = (((U = (z = this.value) == null ? void 0 : z.stops) == null ? void 0 : U.length) || 0) <= 2, l.addEventListener("input", (I) => {
|
|
3190
|
+
var O;
|
|
3191
|
+
const y = I.target, k = y.value.replace(/[^\d]/g, ""), P = parseInt(k);
|
|
3192
|
+
if (this.value && !isNaN(P)) {
|
|
3193
|
+
const T = Math.max(0, Math.min(100, P));
|
|
3194
|
+
this.value.stops[n].position = T, y.value = `${T}%`;
|
|
3195
|
+
const M = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3196
|
+
".gradient-preview"
|
|
3197
|
+
), A = M == null ? void 0 : M.querySelector(
|
|
3198
|
+
".gradient-handles"
|
|
3199
|
+
);
|
|
3200
|
+
M && A && this.createGradientHandles(A, M), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3201
|
+
}
|
|
3202
|
+
}), l.addEventListener("focus", (I) => {
|
|
3203
|
+
const y = I.target, k = y.value.replace("%", "");
|
|
3204
|
+
y.value = k, y.select();
|
|
3205
|
+
}), l.addEventListener("blur", (I) => {
|
|
3206
|
+
var O, T;
|
|
3207
|
+
const y = I.target, k = y.value.replace(/[^\d]/g, ""), P = parseInt(k);
|
|
3208
|
+
if (isNaN(P))
|
|
3209
|
+
y.value = `${((T = (O = this.value) == null ? void 0 : O.stops[n]) == null ? void 0 : T.position) || 0}%`;
|
|
3210
|
+
else {
|
|
3211
|
+
const M = Math.max(0, Math.min(100, P));
|
|
3212
|
+
y.value = `${M}%`, this.value && (this.value.stops[n].position = M, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3213
|
+
}
|
|
3214
|
+
});
|
|
3215
|
+
const u = new Pt(
|
|
3216
|
+
(I, y) => {
|
|
3217
|
+
var k, P, O;
|
|
3218
|
+
if (h.value = I.replace("#", "").toUpperCase(), c.style.backgroundColor = I, this.value) {
|
|
3219
|
+
this.value.stops[n].color = I, y !== void 0 && (this.value.stops[n].opacity = y);
|
|
3220
|
+
const T = (k = o.parentElement) == null ? void 0 : k.querySelector(
|
|
3221
|
+
".gstop-opacity-slider"
|
|
3222
|
+
);
|
|
3223
|
+
if (T) {
|
|
3224
|
+
const C = this.hexToRgb(I);
|
|
3225
|
+
T.style.setProperty(
|
|
3226
|
+
"--slider-color",
|
|
3227
|
+
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3228
|
+
);
|
|
3229
|
+
}
|
|
3230
|
+
if (y !== void 0) {
|
|
3231
|
+
const C = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3232
|
+
".gstop-opacity-value"
|
|
3233
|
+
);
|
|
3234
|
+
C && (C.textContent = `${y}%`), T && (T.value = y.toString());
|
|
3235
|
+
}
|
|
3236
|
+
const M = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3237
|
+
".gradient-preview"
|
|
3238
|
+
), A = M == null ? void 0 : M.querySelector(
|
|
3239
|
+
".gradient-handles"
|
|
3240
|
+
);
|
|
3241
|
+
M && A && this.createGradientHandles(A, M), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
);
|
|
3245
|
+
h.addEventListener("click", (I) => {
|
|
3246
|
+
I.stopPropagation(), u.open(s.color, h, s.opacity || 100);
|
|
3247
|
+
}), h.addEventListener("input", (I) => {
|
|
3248
|
+
var P, O;
|
|
3249
|
+
const y = I.target.value.trim(), k = y.startsWith("#") ? y : `#${y}`;
|
|
3250
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(k) && (c.style.backgroundColor = k, this.value)) {
|
|
3251
|
+
this.value.stops[n].color = k;
|
|
3252
|
+
const T = (P = o.parentElement) == null ? void 0 : P.querySelector(
|
|
3253
|
+
".gstop-opacity-slider"
|
|
3254
|
+
);
|
|
3255
|
+
if (T) {
|
|
3256
|
+
const C = this.hexToRgb(k);
|
|
3257
|
+
T.style.setProperty(
|
|
3258
|
+
"--slider-color",
|
|
3259
|
+
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
const M = (O = this.popoverElement) == null ? void 0 : O.querySelector(
|
|
3263
|
+
".gradient-preview"
|
|
3264
|
+
), A = M == null ? void 0 : M.querySelector(
|
|
3265
|
+
".gradient-handles"
|
|
3266
|
+
);
|
|
3267
|
+
M && A && this.createGradientHandles(A, M), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3268
|
+
}
|
|
3269
|
+
}), d.addEventListener("click", async (I) => {
|
|
3270
|
+
I.stopPropagation();
|
|
3271
|
+
const y = `#${h.value}`;
|
|
3272
|
+
try {
|
|
3273
|
+
await navigator.clipboard.writeText(y);
|
|
3274
|
+
const k = d.innerHTML;
|
|
3275
|
+
d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3276
|
+
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3277
|
+
</svg>`, setTimeout(() => {
|
|
3278
|
+
d.innerHTML = k;
|
|
3279
|
+
}, 1e3);
|
|
3280
|
+
} catch (k) {
|
|
3281
|
+
console.warn("Failed to copy color to clipboard:", k);
|
|
3282
|
+
}
|
|
3283
|
+
}), m.addEventListener("click", () => {
|
|
3284
|
+
var I;
|
|
3285
|
+
if (this.value && this.value.stops.length > 2) {
|
|
3286
|
+
this.value.stops.splice(n, 1);
|
|
3287
|
+
const y = (I = this.popoverElement) == null ? void 0 : I.querySelector(
|
|
3288
|
+
".gradient-preview"
|
|
3289
|
+
), k = y == null ? void 0 : y.querySelector(
|
|
3290
|
+
".gradient-handles"
|
|
3291
|
+
);
|
|
3292
|
+
y && k && this.createGradientHandles(k, y), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3293
|
+
}
|
|
3294
|
+
}), o.appendChild(a), o.appendChild(r), o.appendChild(m), e.appendChild(o);
|
|
3295
|
+
const g = document.createElement("div");
|
|
3296
|
+
g.className = "gstop-opacity-row";
|
|
3297
|
+
const f = document.createElement("span");
|
|
3298
|
+
f.className = "gstop-opacity-label", f.textContent = "Opacity";
|
|
3299
|
+
const E = document.createElement("div");
|
|
3300
|
+
E.className = "gstop-opacity-group";
|
|
3301
|
+
const v = document.createElement("input");
|
|
3302
|
+
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = (s.opacity !== void 0 ? s.opacity : 100).toString();
|
|
3303
|
+
const w = this.hexToRgb(s.color);
|
|
3304
|
+
v.style.setProperty(
|
|
3305
|
+
"--slider-color",
|
|
3306
|
+
`rgb(${w.r}, ${w.g}, ${w.b})`
|
|
3307
|
+
);
|
|
3308
|
+
const V = document.createElement("span");
|
|
3309
|
+
V.className = "gstop-opacity-value", V.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
3310
|
+
}));
|
|
3311
|
+
}
|
|
3312
|
+
addGradientStop() {
|
|
3313
|
+
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3314
|
+
const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
|
|
3315
|
+
let e = 50, i = 0;
|
|
3316
|
+
for (let o = 0; o < t.length - 1; o++) {
|
|
3317
|
+
const a = t[o + 1] - t[o];
|
|
3318
|
+
a > i && (i = a, e = t[o] + a / 2);
|
|
3319
|
+
}
|
|
3320
|
+
const s = this.value.stops.reduce((o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o), n = {
|
|
3321
|
+
position: Math.round(e),
|
|
3322
|
+
color: s.color,
|
|
3323
|
+
opacity: s.opacity !== void 0 ? s.opacity : 100
|
|
3324
|
+
};
|
|
3325
|
+
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3326
|
+
}
|
|
3327
|
+
openPopover() {
|
|
3328
|
+
if (!(!this.popoverElement || this.isPopoverOpen)) {
|
|
3329
|
+
if (this.isPopoverOpen = !0, this.popoverElement.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3330
|
+
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3331
|
+
this.popoverElement.style.position = "fixed", this.popoverElement.style.zIndex = "10000";
|
|
3332
|
+
let o = t.right + 8, a = t.top;
|
|
3333
|
+
const l = i - t.right, r = t.left, c = e + n;
|
|
3334
|
+
l < c && r > l + 100 && (o = t.left - e - 8), a + 400 > s && (a = Math.max(8, s - 400 - 8)), this.popoverElement.style.left = `${o}px`, this.popoverElement.style.top = `${a}px`;
|
|
3335
|
+
}
|
|
3336
|
+
setTimeout(() => {
|
|
3337
|
+
document.addEventListener("click", this.handleBackgroundClick, !0);
|
|
3338
|
+
}, 0);
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
refreshPopoverContent() {
|
|
3342
|
+
if (!this.popoverElement) return;
|
|
3343
|
+
this.popoverElement.querySelectorAll(".gradient-type-tab").forEach((i, s) => {
|
|
3344
|
+
var n, o;
|
|
3345
|
+
i.classList.remove("active"), (s === 0 && ((n = this.value) == null ? void 0 : n.type) === "solid" || s === 1 && ((o = this.value) == null ? void 0 : o.type) !== "solid") && i.classList.add("active");
|
|
3346
|
+
});
|
|
3347
|
+
const e = this.popoverElement.querySelector(
|
|
3348
|
+
".gradient-editor-content"
|
|
3349
|
+
);
|
|
3350
|
+
e && this.updatePopoverContent(e);
|
|
3351
|
+
}
|
|
3352
|
+
closePopover() {
|
|
3353
|
+
!this.popoverElement || !this.isPopoverOpen || (this.isPopoverOpen = !1, this.popoverElement.style.display = "none", document.removeEventListener("click", this.handleBackgroundClick, !0));
|
|
3354
|
+
}
|
|
3355
|
+
handlePaste(t) {
|
|
3356
|
+
var i;
|
|
3357
|
+
t.preventDefault();
|
|
3358
|
+
const e = ((i = t.clipboardData) == null ? void 0 : i.getData("text")) || "";
|
|
3359
|
+
this.parseAndSetValue(e);
|
|
3360
|
+
}
|
|
3361
|
+
handleInput(t) {
|
|
3362
|
+
const e = t.target;
|
|
3363
|
+
this.parseAndSetValue(e.value);
|
|
3364
|
+
}
|
|
3365
|
+
parseAndSetValue(t) {
|
|
3366
|
+
const e = t.trim();
|
|
3367
|
+
if (e)
|
|
3368
|
+
try {
|
|
3369
|
+
const i = this.parseGradientCSS(e);
|
|
3370
|
+
i && this.setValue(i);
|
|
3371
|
+
} catch (i) {
|
|
3372
|
+
console.warn("Failed to parse gradient/color:", i);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
parseGradientCSS(t) {
|
|
3376
|
+
const e = t.replace(/;$/, "").trim();
|
|
3377
|
+
if (this.isValidColor(e))
|
|
3378
|
+
return {
|
|
3379
|
+
type: "solid",
|
|
3380
|
+
angle: 0,
|
|
3381
|
+
stops: [this.parseColorWithOpacity(e)]
|
|
3382
|
+
};
|
|
3383
|
+
const i = this.extractGradientParams(e, "linear-gradient");
|
|
3384
|
+
if (i)
|
|
3385
|
+
return this.parseLinearGradient(i);
|
|
3386
|
+
const s = this.extractGradientParams(e, "radial-gradient");
|
|
3387
|
+
return s ? this.parseRadialGradient(s) : null;
|
|
3388
|
+
}
|
|
3389
|
+
extractGradientParams(t, e) {
|
|
3390
|
+
const i = new RegExp(`${e}\\s*\\(`, "i"), s = t.match(i);
|
|
3391
|
+
if (!s) return null;
|
|
3392
|
+
const n = s.index + s[0].length;
|
|
3393
|
+
let o = 1, a = n;
|
|
3394
|
+
for (let l = n; l < t.length && o > 0; l++)
|
|
3395
|
+
t[l] === "(" ? o++ : t[l] === ")" && o--, a = l;
|
|
3396
|
+
return o === 0 ? t.substring(n, a) : null;
|
|
3397
|
+
}
|
|
3398
|
+
isValidColor(t) {
|
|
3399
|
+
const e = document.createElement("div");
|
|
3400
|
+
return e.style.color = t, e.style.color !== "";
|
|
3401
|
+
}
|
|
3402
|
+
parseColorWithOpacity(t) {
|
|
3403
|
+
const e = t.trim();
|
|
3404
|
+
if (/^#[0-9A-Fa-f]{8}$/.test(e)) {
|
|
3405
|
+
const n = e.slice(1);
|
|
3406
|
+
parseInt(n.substr(0, 2), 16), parseInt(n.substr(2, 2), 16), parseInt(n.substr(4, 2), 16);
|
|
3407
|
+
const a = parseInt(n.substr(6, 2), 16) / 255 * 100;
|
|
3408
|
+
return { color: `#${n.substr(0, 6)}`, position: 0, opacity: a };
|
|
3409
|
+
}
|
|
3410
|
+
const i = e.match(
|
|
3411
|
+
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3412
|
+
);
|
|
3413
|
+
if (i) {
|
|
3414
|
+
const n = parseInt(i[1]), o = parseInt(i[2]), a = parseInt(i[3]), l = i[4] ? parseFloat(i[4]) : 1;
|
|
3415
|
+
return { color: `#${n.toString(16).padStart(2, "0")}${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3416
|
+
}
|
|
3417
|
+
const s = e.match(
|
|
3418
|
+
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+))?\s*\)/
|
|
3419
|
+
);
|
|
3420
|
+
if (s) {
|
|
3421
|
+
const n = parseFloat(s[1]), o = parseFloat(s[2]) / 100, a = parseFloat(s[3]) / 100, l = s[4] ? parseFloat(s[4]) : 1, { r, g: c, b: h } = this.hslToRgb(n, o, a);
|
|
3422
|
+
return { color: `#${r.toString(16).padStart(2, "0")}${c.toString(16).padStart(2, "0")}${h.toString(16).padStart(2, "0")}`, position: 0, opacity: Math.round(l * 100) };
|
|
3423
|
+
}
|
|
3424
|
+
return { color: e, position: 0, opacity: 100 };
|
|
3425
|
+
}
|
|
3426
|
+
hslToRgb(t, e, i) {
|
|
3427
|
+
const s = (1 - Math.abs(2 * i - 1)) * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s / 2;
|
|
3428
|
+
let a = 0, l = 0, r = 0;
|
|
3429
|
+
return t >= 0 && t < 60 ? (a = s, l = n, r = 0) : t >= 60 && t < 120 ? (a = n, l = s, r = 0) : t >= 120 && t < 180 ? (a = 0, l = s, r = n) : t >= 180 && t < 240 ? (a = 0, l = n, r = s) : t >= 240 && t < 300 ? (a = n, l = 0, r = s) : t >= 300 && t < 360 && (a = s, l = 0, r = n), {
|
|
3430
|
+
r: Math.round((a + o) * 255),
|
|
3431
|
+
g: Math.round((l + o) * 255),
|
|
3432
|
+
b: Math.round((r + o) * 255)
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
smartSplit(t) {
|
|
3436
|
+
const e = [];
|
|
3437
|
+
let i = "", s = 0;
|
|
3438
|
+
for (let n = 0; n < t.length; n++) {
|
|
3439
|
+
const o = t[n];
|
|
3440
|
+
if (o === "(")
|
|
3441
|
+
s++;
|
|
3442
|
+
else if (o === ")")
|
|
3443
|
+
s--;
|
|
3444
|
+
else if (o === "," && s === 0) {
|
|
3445
|
+
e.push(i.trim()), i = "";
|
|
3446
|
+
continue;
|
|
3447
|
+
}
|
|
3448
|
+
i += o;
|
|
3449
|
+
}
|
|
3450
|
+
return i.trim() && e.push(i.trim()), e;
|
|
3451
|
+
}
|
|
3452
|
+
parseLinearGradient(t) {
|
|
3453
|
+
const e = this.smartSplit(t);
|
|
3454
|
+
let i = 90, s = [];
|
|
3455
|
+
const n = e[0];
|
|
3456
|
+
if (n.includes("deg")) {
|
|
3457
|
+
const a = n.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
3458
|
+
a ? (i = parseFloat(a[1]), s = e.slice(1)) : s = e;
|
|
3459
|
+
} else n.includes("to ") ? (i = {
|
|
3460
|
+
"to right": 90,
|
|
3461
|
+
"to left": 270,
|
|
3462
|
+
"to bottom": 180,
|
|
3463
|
+
"to top": 0,
|
|
3464
|
+
"to bottom right": 135,
|
|
3465
|
+
"to bottom left": 225,
|
|
3466
|
+
"to top right": 45,
|
|
3467
|
+
"to top left": 315
|
|
3468
|
+
}[n] || 90, s = e.slice(1)) : s = e;
|
|
3469
|
+
const o = this.parseColorStops(s);
|
|
3470
|
+
return o.length === 0 ? null : {
|
|
3471
|
+
type: "linear",
|
|
3472
|
+
angle: i,
|
|
3473
|
+
stops: o
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
parseRadialGradient(t) {
|
|
3477
|
+
const e = this.smartSplit(t);
|
|
3478
|
+
let i = [];
|
|
3479
|
+
e[0] && !this.isColorStop(e[0]) ? i = e.slice(1) : i = e;
|
|
3480
|
+
const s = this.parseColorStops(i);
|
|
3481
|
+
return s.length === 0 ? null : {
|
|
3482
|
+
type: "radial",
|
|
3483
|
+
angle: 0,
|
|
3484
|
+
stops: s
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
isColorStop(t) {
|
|
3488
|
+
const e = t.split(" ")[0].toLowerCase();
|
|
3489
|
+
return [
|
|
3490
|
+
"circle",
|
|
3491
|
+
"ellipse",
|
|
3492
|
+
"closest-side",
|
|
3493
|
+
"closest-corner",
|
|
3494
|
+
"farthest-side",
|
|
3495
|
+
"farthest-corner",
|
|
3496
|
+
"at"
|
|
3497
|
+
].includes(e) || ["contain", "cover"].includes(e) ? !1 : /^#[0-9a-f]{3,8}$/i.test(e) || /^rgb/i.test(t) || /^hsl/i.test(t) || this.isValidColorName(e);
|
|
3498
|
+
}
|
|
3499
|
+
isValidColorName(t) {
|
|
3500
|
+
return [
|
|
3501
|
+
"red",
|
|
3502
|
+
"green",
|
|
3503
|
+
"blue",
|
|
3504
|
+
"yellow",
|
|
3505
|
+
"orange",
|
|
3506
|
+
"purple",
|
|
3507
|
+
"pink",
|
|
3508
|
+
"brown",
|
|
3509
|
+
"black",
|
|
3510
|
+
"white",
|
|
3511
|
+
"gray",
|
|
3512
|
+
"grey",
|
|
3513
|
+
"cyan",
|
|
3514
|
+
"magenta",
|
|
3515
|
+
"lime",
|
|
3516
|
+
"navy",
|
|
3517
|
+
"maroon",
|
|
3518
|
+
"olive",
|
|
3519
|
+
"aqua",
|
|
3520
|
+
"silver",
|
|
3521
|
+
"teal",
|
|
3522
|
+
"fuchsia",
|
|
3523
|
+
"transparent"
|
|
3524
|
+
].includes(t.toLowerCase());
|
|
3525
|
+
}
|
|
3526
|
+
parseColorStops(t) {
|
|
3527
|
+
const e = [];
|
|
3528
|
+
return t.forEach((i, s) => {
|
|
3529
|
+
const n = i.trim();
|
|
3530
|
+
if (!n) return;
|
|
3531
|
+
let o = "", a = 0;
|
|
3532
|
+
const l = n.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
3533
|
+
if (l) {
|
|
3534
|
+
const c = l[1].trim(), h = parseFloat(l[2]);
|
|
3535
|
+
this.isValidColorFormat(c) ? (o = c, a = h) : (o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100);
|
|
3536
|
+
} else
|
|
3537
|
+
o = n, a = t.length === 1 ? 0 : s / (t.length - 1) * 100;
|
|
3538
|
+
const r = this.parseColorWithOpacity(o);
|
|
3539
|
+
r.position = Math.round(a), e.push(r);
|
|
3540
|
+
}), e;
|
|
3541
|
+
}
|
|
3542
|
+
isValidColorFormat(t) {
|
|
3543
|
+
return [
|
|
3544
|
+
/^#[0-9a-fA-F]{3,8}$/,
|
|
3545
|
+
// hex colors
|
|
3546
|
+
/^rgba?\s*\([^)]+\)$/,
|
|
3547
|
+
// rgb/rgba functions
|
|
3548
|
+
/^hsla?\s*\([^)]+\)$/,
|
|
3549
|
+
// hsl/hsla functions
|
|
3550
|
+
/^[a-zA-Z]+$/
|
|
3551
|
+
// named colors
|
|
3552
|
+
].some((i) => i.test(t.trim())) || this.isValidColor(t);
|
|
3553
|
+
}
|
|
3554
|
+
triggerChange() {
|
|
3555
|
+
this.onChange && this.value && this.onChange(this.value), this.detectChange && this.value && this.detectChange(this.value);
|
|
3556
|
+
}
|
|
3557
|
+
getElement() {
|
|
3558
|
+
return this.element;
|
|
3559
|
+
}
|
|
3560
|
+
getValue() {
|
|
3561
|
+
return this.value ? this.forText ? {
|
|
3562
|
+
background: this.generateCSS(this.value),
|
|
3563
|
+
"-webkit-background-clip": "text",
|
|
3564
|
+
"background-clip": "text",
|
|
3565
|
+
color: "transparent",
|
|
3566
|
+
"-webkit-text-fill-color": "transparent"
|
|
3567
|
+
} : this.generateCSS(this.value) : this.forText ? {} : "";
|
|
3568
|
+
}
|
|
3569
|
+
getCSSValue() {
|
|
3570
|
+
return this.value ? this.generateCSS(this.value) : "";
|
|
3571
|
+
}
|
|
3572
|
+
// Add method to get the raw object value if needed
|
|
3573
|
+
getRawValue() {
|
|
3574
|
+
return this.value;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
const $t = `
|
|
2215
3578
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2216
3579
|
<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"/>
|
|
2217
3580
|
</svg>
|
|
2218
|
-
`,
|
|
3581
|
+
`, At = `
|
|
2219
3582
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2220
3583
|
<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"/>
|
|
2221
3584
|
</svg>
|
|
2222
3585
|
`;
|
|
2223
|
-
class
|
|
3586
|
+
class ne extends G {
|
|
2224
3587
|
constructor(t) {
|
|
2225
3588
|
super({
|
|
2226
3589
|
title: "Border",
|
|
2227
3590
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
2228
3591
|
settings: {
|
|
2229
|
-
size: new
|
|
3592
|
+
size: new F({
|
|
2230
3593
|
title: "Size",
|
|
2231
|
-
icon:
|
|
3594
|
+
icon: At,
|
|
2232
3595
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
2233
3596
|
suffix: "px"
|
|
2234
3597
|
}),
|
|
2235
|
-
color: new
|
|
3598
|
+
color: new W({
|
|
2236
3599
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
2237
3600
|
}),
|
|
2238
|
-
radius: new
|
|
3601
|
+
radius: new F({
|
|
2239
3602
|
title: "Radius",
|
|
2240
|
-
icon:
|
|
3603
|
+
icon: $t,
|
|
2241
3604
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
2242
3605
|
suffix: "px"
|
|
2243
3606
|
})
|
|
@@ -2256,33 +3619,34 @@ class Ot extends v {
|
|
|
2256
3619
|
`;
|
|
2257
3620
|
}
|
|
2258
3621
|
}
|
|
2259
|
-
const
|
|
3622
|
+
const Bt = `
|
|
2260
3623
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
2261
3624
|
<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"/>
|
|
2262
3625
|
</svg>
|
|
2263
|
-
`,
|
|
3626
|
+
`, Dt = `
|
|
2264
3627
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2265
3628
|
<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"/>
|
|
2266
3629
|
</svg>
|
|
2267
|
-
`,
|
|
3630
|
+
`, Ft = `
|
|
2268
3631
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2269
3632
|
<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"/>
|
|
2270
3633
|
</svg>
|
|
2271
3634
|
`;
|
|
2272
|
-
class
|
|
3635
|
+
class oe extends G {
|
|
2273
3636
|
constructor(t = {}) {
|
|
2274
3637
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
2275
3638
|
super({
|
|
2276
3639
|
title: i.title || "Typography",
|
|
2277
3640
|
collapsed: i.collapsed,
|
|
2278
3641
|
settings: (() => {
|
|
2279
|
-
const s = {
|
|
2280
|
-
color: new
|
|
2281
|
-
|
|
3642
|
+
const s = i.gradientDefault || i.colorDefault, n = {
|
|
3643
|
+
color: new Ot({
|
|
3644
|
+
forText: !0,
|
|
3645
|
+
default: s
|
|
2282
3646
|
}),
|
|
2283
|
-
fontFamily: new
|
|
3647
|
+
fontFamily: new et({
|
|
2284
3648
|
title: "Font",
|
|
2285
|
-
icon:
|
|
3649
|
+
icon: Bt,
|
|
2286
3650
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
2287
3651
|
options: i.fontFamilyOptions ?? [
|
|
2288
3652
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -2293,9 +3657,9 @@ class Ht extends v {
|
|
|
2293
3657
|
getOptions: i.fontFamilyGetOptions,
|
|
2294
3658
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
2295
3659
|
}),
|
|
2296
|
-
fontWeight: new
|
|
3660
|
+
fontWeight: new et({
|
|
2297
3661
|
title: "Weight",
|
|
2298
|
-
icon:
|
|
3662
|
+
icon: Dt,
|
|
2299
3663
|
default: i.fontWeightDefault ?? "400",
|
|
2300
3664
|
options: i.fontWeightOptions ?? [
|
|
2301
3665
|
{ name: "Regular", value: "400" },
|
|
@@ -2305,37 +3669,46 @@ class Ht extends v {
|
|
|
2305
3669
|
getOptions: i.fontWeightGetOptions,
|
|
2306
3670
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
2307
3671
|
}),
|
|
2308
|
-
fontSize: new
|
|
3672
|
+
fontSize: new F({
|
|
2309
3673
|
title: "Size",
|
|
2310
|
-
icon:
|
|
3674
|
+
icon: Ft,
|
|
2311
3675
|
default: i.fontSizeDefault ?? 12,
|
|
2312
3676
|
suffix: "px",
|
|
2313
3677
|
mobile: i.fontSizeMobileDefault
|
|
2314
3678
|
})
|
|
2315
3679
|
};
|
|
2316
3680
|
return e ? {
|
|
2317
|
-
...
|
|
2318
|
-
align: new
|
|
3681
|
+
...n,
|
|
3682
|
+
align: new yt({
|
|
2319
3683
|
title: "Align",
|
|
2320
3684
|
default: i.alignDefault ?? "center"
|
|
2321
3685
|
})
|
|
2322
|
-
} :
|
|
3686
|
+
} : n;
|
|
2323
3687
|
})()
|
|
2324
3688
|
});
|
|
2325
3689
|
}
|
|
2326
3690
|
getCssCode() {
|
|
2327
3691
|
var a;
|
|
2328
|
-
const t = this.settings.color.
|
|
2329
|
-
return `
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
3692
|
+
const t = this.settings.color.getCSSValue() ?? "rgba(0, 0, 0, 1)", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "400", s = this.settings.fontSize.value ?? 12, n = ((a = this.settings.align) == null ? void 0 : a.value) ?? "left";
|
|
3693
|
+
return t.includes("gradient") ? `
|
|
3694
|
+
background: ${t};
|
|
3695
|
+
-webkit-background-clip: text;
|
|
3696
|
+
-webkit-text-fill-color: transparent;
|
|
3697
|
+
background-clip: text;
|
|
3698
|
+
font-family: ${e};
|
|
3699
|
+
font-weight: ${i};
|
|
3700
|
+
font-size: ${s}px;
|
|
3701
|
+
text-align: ${n};
|
|
3702
|
+
` : `
|
|
3703
|
+
color: ${t};
|
|
3704
|
+
font-family: ${e};
|
|
3705
|
+
font-weight: ${i};
|
|
3706
|
+
font-size: ${s}px;
|
|
3707
|
+
text-align: ${n};
|
|
3708
|
+
`;
|
|
2336
3709
|
}
|
|
2337
3710
|
}
|
|
2338
|
-
class
|
|
3711
|
+
class J extends S {
|
|
2339
3712
|
constructor(t) {
|
|
2340
3713
|
super({
|
|
2341
3714
|
...t,
|
|
@@ -2343,11 +3716,11 @@ class L extends p {
|
|
|
2343
3716
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
2344
3717
|
}
|
|
2345
3718
|
draw() {
|
|
2346
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
2347
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
3719
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
3720
|
+
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", () => {
|
|
2348
3721
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
2349
|
-
let
|
|
2350
|
-
|
|
3722
|
+
let c = Number(a.value);
|
|
3723
|
+
c < l && (c = l), c > r && (c = r), a.value = String(c);
|
|
2351
3724
|
}));
|
|
2352
3725
|
}, i = this.createInput({
|
|
2353
3726
|
value: this.value,
|
|
@@ -2368,9 +3741,9 @@ class L extends p {
|
|
|
2368
3741
|
s && (s.style.paddingRight = "35px");
|
|
2369
3742
|
const n = document.createElement("span");
|
|
2370
3743
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
2371
|
-
const
|
|
2372
|
-
return
|
|
2373
|
-
const l =
|
|
3744
|
+
const o = i.querySelector("input");
|
|
3745
|
+
return o && (o.oninput = (a) => {
|
|
3746
|
+
const l = a.target.value.trim();
|
|
2374
3747
|
if (l.toLowerCase() === "auto")
|
|
2375
3748
|
this.value = "auto";
|
|
2376
3749
|
else {
|
|
@@ -2381,33 +3754,33 @@ class L extends p {
|
|
|
2381
3754
|
}), i;
|
|
2382
3755
|
}
|
|
2383
3756
|
}
|
|
2384
|
-
class
|
|
3757
|
+
class ae extends G {
|
|
2385
3758
|
constructor(t) {
|
|
2386
3759
|
super({
|
|
2387
3760
|
title: "Margins",
|
|
2388
3761
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
2389
3762
|
settings: {
|
|
2390
|
-
marginTop: new
|
|
3763
|
+
marginTop: new J({
|
|
2391
3764
|
title: "Top",
|
|
2392
|
-
icon:
|
|
3765
|
+
icon: Rt,
|
|
2393
3766
|
suffix: "px",
|
|
2394
3767
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
2395
3768
|
}),
|
|
2396
|
-
marginRight: new
|
|
3769
|
+
marginRight: new J({
|
|
2397
3770
|
title: "Right",
|
|
2398
|
-
icon:
|
|
3771
|
+
icon: Gt,
|
|
2399
3772
|
suffix: "px",
|
|
2400
3773
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
2401
3774
|
}),
|
|
2402
|
-
marginBottom: new
|
|
3775
|
+
marginBottom: new J({
|
|
2403
3776
|
title: "Bottom",
|
|
2404
|
-
icon:
|
|
3777
|
+
icon: Wt,
|
|
2405
3778
|
suffix: "px",
|
|
2406
3779
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
2407
3780
|
}),
|
|
2408
|
-
marginLeft: new
|
|
3781
|
+
marginLeft: new J({
|
|
2409
3782
|
title: "Left",
|
|
2410
|
-
icon:
|
|
3783
|
+
icon: zt,
|
|
2411
3784
|
suffix: "px",
|
|
2412
3785
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
2413
3786
|
})
|
|
@@ -2424,29 +3797,29 @@ class Tt extends v {
|
|
|
2424
3797
|
`;
|
|
2425
3798
|
}
|
|
2426
3799
|
}
|
|
2427
|
-
const
|
|
3800
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2428
3801
|
<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"/>
|
|
2429
|
-
</svg>`,
|
|
3802
|
+
</svg>`, Gt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2430
3803
|
<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"/>
|
|
2431
|
-
</svg>`,
|
|
3804
|
+
</svg>`, Wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2432
3805
|
<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"/>
|
|
2433
|
-
</svg>`,
|
|
3806
|
+
</svg>`, zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2434
3807
|
<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"/>
|
|
2435
3808
|
</svg>`;
|
|
2436
|
-
class
|
|
3809
|
+
class le extends G {
|
|
2437
3810
|
constructor(t) {
|
|
2438
3811
|
super({
|
|
2439
3812
|
title: "Background Image",
|
|
2440
3813
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
2441
3814
|
settings: {
|
|
2442
|
-
backgroundImage: new
|
|
3815
|
+
backgroundImage: new ot({
|
|
2443
3816
|
...t == null ? void 0 : t.uploadProps,
|
|
2444
3817
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
2445
3818
|
}),
|
|
2446
|
-
opacity: new
|
|
3819
|
+
opacity: new Ct({
|
|
2447
3820
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
2448
3821
|
}),
|
|
2449
|
-
backgroundColor: new
|
|
3822
|
+
backgroundColor: new W({
|
|
2450
3823
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
2451
3824
|
})
|
|
2452
3825
|
}
|
|
@@ -2455,10 +3828,10 @@ class Pt extends v {
|
|
|
2455
3828
|
draw() {
|
|
2456
3829
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
2457
3830
|
if (!e) return t;
|
|
2458
|
-
const i = Array.from(e.children), [s, n,
|
|
3831
|
+
const i = Array.from(e.children), [s, n, o] = i;
|
|
2459
3832
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
2460
|
-
const
|
|
2461
|
-
return
|
|
3833
|
+
const a = document.createElement("div");
|
|
3834
|
+
return a.className = "bgset-or-label", a.textContent = "OR", e.appendChild(a), e.appendChild(o), t;
|
|
2462
3835
|
}
|
|
2463
3836
|
getCssCode() {
|
|
2464
3837
|
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
@@ -2473,39 +3846,40 @@ class Pt extends v {
|
|
|
2473
3846
|
}
|
|
2474
3847
|
}
|
|
2475
3848
|
export {
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
G as
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
3849
|
+
yt as AlignSetting,
|
|
3850
|
+
se as AnimationSetting,
|
|
3851
|
+
le as BackgroundSettingSet,
|
|
3852
|
+
ne as BorderSettingSet,
|
|
3853
|
+
qt as ButtonSetting,
|
|
3854
|
+
D as ColorSetting,
|
|
3855
|
+
W as ColorWithOpacitySetting,
|
|
3856
|
+
Jt as DimensionSetting,
|
|
3857
|
+
Qt as GapSetting,
|
|
3858
|
+
Ot as GradientSetting,
|
|
3859
|
+
oe as HeaderTypographySettingSet,
|
|
3860
|
+
Zt as HeightSetting,
|
|
3861
|
+
_t as HtmlSetting,
|
|
3862
|
+
te as MarginBottomSetting,
|
|
3863
|
+
ae as MarginSettingGroup,
|
|
3864
|
+
ee as MarginTopSetting,
|
|
3865
|
+
ie as MultiLanguageSetting,
|
|
3866
|
+
F as NumberSetting,
|
|
3867
|
+
Ct as OpacitySetting,
|
|
3868
|
+
Yt as SelectApiSettings,
|
|
3869
|
+
et as SelectSetting,
|
|
3870
|
+
S as Setting,
|
|
3871
|
+
G as SettingGroup,
|
|
3872
|
+
gt as StringSetting,
|
|
3873
|
+
pt as TabSettingGroup,
|
|
3874
|
+
pt as TabsSettingGroup,
|
|
3875
|
+
Kt as Toggle,
|
|
3876
|
+
ot as UploadSetting,
|
|
3877
|
+
Xt as WidthSetting,
|
|
3878
|
+
jt as asSettingGroupWithSettings,
|
|
3879
|
+
ut as createSettingGroup,
|
|
3880
|
+
Ut as createTabSettingGroup,
|
|
3881
|
+
j as isSetting,
|
|
3882
|
+
st as isSettingChild,
|
|
3883
|
+
N as isSettingGroup,
|
|
3884
|
+
q as iterateSettings
|
|
2511
3885
|
};
|