builder-settings-types 0.0.268 → 0.0.270
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/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +52 -48
- package/dist/builder-settings-types.es.js +817 -733
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/index.css +1 -1
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/settings/gradient-settings/gradientSettings.d.ts +7 -11
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const ft = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let dt = (p = 21) => {
|
|
3
3
|
let t = "", e = crypto.getRandomValues(new Uint8Array(p |= 0));
|
|
4
4
|
for (; p--; )
|
|
5
|
-
t +=
|
|
5
|
+
t += ft[e[p] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function vt(p) {
|
|
9
9
|
let t = 0, e = p.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
11
|
e.classList.contains("setting-group") && e !== p && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function tt(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
|
|
18
|
+
function ot(p, t = 0) {
|
|
19
19
|
p.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
tt(s, n), ot(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 yt {
|
|
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 dt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = vt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,20 +111,20 @@ class dt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
114
|
+
const rt = new yt();
|
|
115
|
+
function et(p) {
|
|
116
116
|
if (p === null || typeof p != "object") return p;
|
|
117
117
|
if (p instanceof Date) return new Date(p.getTime());
|
|
118
|
-
if (p instanceof Array) return p.map((t) =>
|
|
118
|
+
if (p instanceof Array) return p.map((t) => et(t));
|
|
119
119
|
if (typeof p == "object") {
|
|
120
120
|
const t = {};
|
|
121
121
|
for (const e in p)
|
|
122
|
-
Object.prototype.hasOwnProperty.call(p, e) && (t[e] =
|
|
122
|
+
Object.prototype.hasOwnProperty.call(p, e) && (t[e] = et(p[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
125
|
return p;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Et(p) {
|
|
128
128
|
switch (p) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
@@ -142,15 +142,15 @@ function pt(p) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class T {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || dt(), 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, T.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, T.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
destroy() {
|
|
156
156
|
throw new Error("Method not implemented.");
|
|
@@ -171,8 +171,8 @@ class I {
|
|
|
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 = et(this.props), i = new t(e);
|
|
175
|
+
return i.value = et(this.value), i;
|
|
176
176
|
}
|
|
177
177
|
createInput(t) {
|
|
178
178
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -192,7 +192,7 @@ class I {
|
|
|
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 ||
|
|
195
|
+
this.inputEl = s, s.value = String(t.value || Et(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
196
196
|
const n = (a) => {
|
|
197
197
|
const l = a.target;
|
|
198
198
|
let r = l.value;
|
|
@@ -233,31 +233,31 @@ class I {
|
|
|
233
233
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return p instanceof
|
|
236
|
+
function X(p) {
|
|
237
|
+
return p instanceof T;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return p instanceof
|
|
239
|
+
function H(p) {
|
|
240
|
+
return p instanceof U;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function ct(p) {
|
|
243
|
+
return X(p) || H(p);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function K(p, t) {
|
|
246
246
|
for (const e in p)
|
|
247
247
|
if (Object.prototype.hasOwnProperty.call(p, e)) {
|
|
248
248
|
const i = p[e];
|
|
249
249
|
t(e, i);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const it = class it {
|
|
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.hide = !1, this.id = t.id ||
|
|
255
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || dt(), 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 || "", this.hide = t.hide ?? !1, 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
|
+
K(this.settings, (e, i) => {
|
|
260
|
+
H(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
getNestingLevel() {
|
|
@@ -273,18 +273,18 @@ const Y = class Y {
|
|
|
273
273
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
274
|
}
|
|
275
275
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
276
|
+
K(this.settings, (t, e) => {
|
|
277
277
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
278
|
+
(H(e) || X(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
updateNestingStyles() {
|
|
282
|
-
this.elementRef && (
|
|
282
|
+
this.elementRef && (tt(this.elementRef, this.nestingLevel), ot(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 (H(e)) {
|
|
288
288
|
const i = e.getValues();
|
|
289
289
|
e.setValue(i);
|
|
290
290
|
} else if (typeof e.setValue == "function") {
|
|
@@ -328,7 +328,7 @@ const Y = class Y {
|
|
|
328
328
|
}
|
|
329
329
|
clone() {
|
|
330
330
|
const t = {};
|
|
331
|
-
|
|
331
|
+
K(this.settings, (s, n) => {
|
|
332
332
|
const o = String(s);
|
|
333
333
|
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
334
334
|
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
@@ -345,7 +345,7 @@ const Y = class Y {
|
|
|
345
345
|
deleteItem: this.deleteItemCfg,
|
|
346
346
|
dataProps: this.dataProps,
|
|
347
347
|
hide: this.hide
|
|
348
|
-
}, i =
|
|
348
|
+
}, i = wt(e);
|
|
349
349
|
return i.initialValues = this.getValues(), i;
|
|
350
350
|
}
|
|
351
351
|
resetDefault() {
|
|
@@ -355,7 +355,7 @@ const Y = class Y {
|
|
|
355
355
|
setMobileValues(t) {
|
|
356
356
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
357
357
|
const s = this.settings[e];
|
|
358
|
-
s && (
|
|
358
|
+
s && (H(s) || X(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
359
359
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
360
360
|
}
|
|
361
361
|
getMobileValues(t) {
|
|
@@ -364,7 +364,7 @@ const Y = class Y {
|
|
|
364
364
|
for (const i in this.settings)
|
|
365
365
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
366
366
|
const s = this.settings[i];
|
|
367
|
-
if (
|
|
367
|
+
if (H(s))
|
|
368
368
|
e[i] = s.getMobileValues();
|
|
369
369
|
else {
|
|
370
370
|
const n = s;
|
|
@@ -375,7 +375,7 @@ const Y = class Y {
|
|
|
375
375
|
} else {
|
|
376
376
|
const e = this.settings[t];
|
|
377
377
|
if (!e) return;
|
|
378
|
-
if (
|
|
378
|
+
if (H(e)) return e.getMobileValues();
|
|
379
379
|
const i = e;
|
|
380
380
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
381
381
|
}
|
|
@@ -391,14 +391,14 @@ const Y = class Y {
|
|
|
391
391
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
392
392
|
}, 50));
|
|
393
393
|
};
|
|
394
|
-
return this.changeHandlers.clear(),
|
|
394
|
+
return this.changeHandlers.clear(), K(this.settings, (i, s) => {
|
|
395
395
|
var n;
|
|
396
|
-
if (
|
|
396
|
+
if (H(s))
|
|
397
397
|
s.setOnChange(() => {
|
|
398
398
|
const o = this.getValues();
|
|
399
399
|
this.initialValues = o, t(o);
|
|
400
400
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
401
|
-
else if (
|
|
401
|
+
else if (X(s)) {
|
|
402
402
|
const o = () => e();
|
|
403
403
|
this.changeHandlers.add(o), s.setOnChange(o);
|
|
404
404
|
} else {
|
|
@@ -421,10 +421,10 @@ const Y = class Y {
|
|
|
421
421
|
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
422
422
|
if (Number.isFinite(a)) {
|
|
423
423
|
const l = this.addItemCfg.createItem(a);
|
|
424
|
-
|
|
424
|
+
ct(l) && (this.addSetting(i, l), n = l);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
n && (
|
|
427
|
+
n && (H(n) || X(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
428
428
|
}), setTimeout(() => {
|
|
429
429
|
this.forceChildUIRefresh();
|
|
430
430
|
}, 0);
|
|
@@ -438,7 +438,7 @@ const Y = class Y {
|
|
|
438
438
|
const s = this.getValues();
|
|
439
439
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
440
440
|
};
|
|
441
|
-
|
|
441
|
+
H(t) ? t.setOnChange(() => e()) : X(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
442
442
|
}
|
|
443
443
|
addSetting(t, e) {
|
|
444
444
|
var s, n;
|
|
@@ -447,14 +447,14 @@ const Y = class Y {
|
|
|
447
447
|
".setting-group-content"
|
|
448
448
|
);
|
|
449
449
|
if (o) {
|
|
450
|
-
|
|
450
|
+
H(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
451
451
|
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
452
452
|
if (l) {
|
|
453
453
|
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
454
454
|
h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
|
|
455
455
|
}
|
|
456
456
|
const r = o.querySelector(".sg-add-button-bottom");
|
|
457
|
-
r ? o.insertBefore(a, r) : o.appendChild(a),
|
|
457
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), tt(a, this.nestingLevel + 1), ot(a, this.nestingLevel + 1);
|
|
458
458
|
const c = a.style.display;
|
|
459
459
|
a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
|
|
460
460
|
}
|
|
@@ -637,7 +637,7 @@ const Y = class Y {
|
|
|
637
637
|
for (const i in this.settings)
|
|
638
638
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
639
639
|
const s = this.settings[i];
|
|
640
|
-
if (
|
|
640
|
+
if (H(s))
|
|
641
641
|
e[i] = s.getValues();
|
|
642
642
|
else {
|
|
643
643
|
const n = s;
|
|
@@ -648,7 +648,7 @@ const Y = class Y {
|
|
|
648
648
|
} else {
|
|
649
649
|
const e = this.settings[t];
|
|
650
650
|
if (!e) return;
|
|
651
|
-
if (
|
|
651
|
+
if (H(e)) return e.getValues();
|
|
652
652
|
const i = e;
|
|
653
653
|
return i.getValue ? i.getValue() : i.value;
|
|
654
654
|
}
|
|
@@ -661,7 +661,7 @@ const Y = class Y {
|
|
|
661
661
|
for (const s in this.settings)
|
|
662
662
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
663
663
|
const n = this.settings[s];
|
|
664
|
-
if (
|
|
664
|
+
if (H(n)) {
|
|
665
665
|
const o = n.getValuesForJson();
|
|
666
666
|
o !== null && (i[s] = o);
|
|
667
667
|
} else {
|
|
@@ -673,7 +673,7 @@ const Y = class Y {
|
|
|
673
673
|
} else {
|
|
674
674
|
const i = this.settings[t];
|
|
675
675
|
if (!i) return;
|
|
676
|
-
if (
|
|
676
|
+
if (H(i))
|
|
677
677
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
678
678
|
{
|
|
679
679
|
const s = i;
|
|
@@ -687,7 +687,7 @@ const Y = class Y {
|
|
|
687
687
|
for (const i in this.settings)
|
|
688
688
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
689
689
|
const s = this.settings[i];
|
|
690
|
-
if (
|
|
690
|
+
if (H(s))
|
|
691
691
|
e[i] = s.getDefaultValues();
|
|
692
692
|
else {
|
|
693
693
|
const n = s;
|
|
@@ -698,14 +698,14 @@ const Y = class Y {
|
|
|
698
698
|
} else {
|
|
699
699
|
const e = this.settings[t];
|
|
700
700
|
if (!e) return;
|
|
701
|
-
if (
|
|
701
|
+
if (H(e)) return e.getDefaultValues();
|
|
702
702
|
const i = e;
|
|
703
703
|
return i.default !== void 0 ? i.default : i.value;
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
draw() {
|
|
707
707
|
const t = document.createElement("div");
|
|
708
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
708
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, it.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), tt(t, this.nestingLevel);
|
|
709
709
|
const e = document.createElement("div");
|
|
710
710
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
711
711
|
"aria-expanded",
|
|
@@ -737,9 +737,9 @@ const Y = class Y {
|
|
|
737
737
|
for (const c in this.settings)
|
|
738
738
|
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
739
739
|
const h = this.settings[c];
|
|
740
|
-
|
|
740
|
+
H(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
741
741
|
const d = h.draw();
|
|
742
|
-
|
|
742
|
+
H(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
743
743
|
d,
|
|
744
744
|
c,
|
|
745
745
|
h
|
|
@@ -760,14 +760,14 @@ const Y = class Y {
|
|
|
760
760
|
</svg>`;
|
|
761
761
|
c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
|
|
762
762
|
d.stopPropagation(), d.preventDefault();
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
this.addSetting(
|
|
763
|
+
const C = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), u = this.addItemCfg.createItem(C);
|
|
764
|
+
if (ct(u)) {
|
|
765
|
+
const f = `${this.addItemCfg.keyPrefix}${C}`;
|
|
766
|
+
this.addSetting(f, u);
|
|
767
767
|
}
|
|
768
768
|
}), a.appendChild(c);
|
|
769
769
|
}
|
|
770
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t,
|
|
770
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, rt.trackElement(t), setTimeout(() => {
|
|
771
771
|
this.updateNestingStyles();
|
|
772
772
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
773
773
|
}
|
|
@@ -809,12 +809,12 @@ const Y = class Y {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
|
|
813
|
-
let
|
|
814
|
-
function
|
|
815
|
-
return new
|
|
812
|
+
it.hiddenElements = /* @__PURE__ */ new Set();
|
|
813
|
+
let U = it;
|
|
814
|
+
function Zt(p) {
|
|
815
|
+
return new bt(p);
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class bt extends U {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super(t);
|
|
820
820
|
const e = Object.keys(this.settings)[0];
|
|
@@ -855,7 +855,7 @@ class ut extends z {
|
|
|
855
855
|
const c = document.createElement("div");
|
|
856
856
|
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
857
857
|
const h = this.settings[a];
|
|
858
|
-
h && (
|
|
858
|
+
h && (H(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
859
859
|
h.draw()
|
|
860
860
|
)), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
861
861
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
@@ -865,13 +865,13 @@ class ut extends z {
|
|
|
865
865
|
return this.updateTabUI(), t;
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
function
|
|
869
|
-
return new
|
|
868
|
+
function wt(p) {
|
|
869
|
+
return new U(p);
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function Yt(p) {
|
|
872
872
|
return p;
|
|
873
873
|
}
|
|
874
|
-
class
|
|
874
|
+
class xt extends T {
|
|
875
875
|
constructor(t = {}) {
|
|
876
876
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
877
877
|
}
|
|
@@ -891,18 +891,18 @@ class mt extends I {
|
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
const
|
|
895
|
-
class
|
|
894
|
+
const Lt = "<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>";
|
|
895
|
+
class W extends xt {
|
|
896
896
|
constructor(t) {
|
|
897
897
|
super({
|
|
898
898
|
...t,
|
|
899
|
-
icon: t.icon ||
|
|
899
|
+
icon: t.icon || Lt,
|
|
900
900
|
title: t.title || "Color",
|
|
901
|
-
default: t.default ?
|
|
901
|
+
default: t.default ? W.normalizeColorValue(t.default) : "#000000"
|
|
902
902
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
903
903
|
}
|
|
904
904
|
static normalizeColorValue(t) {
|
|
905
|
-
return t.startsWith("#") ?
|
|
905
|
+
return t.startsWith("#") ? W.normalizeHexValue(t) : t.includes(",") ? W.rgbToHexStatic(t) : W.normalizeHexValue(t);
|
|
906
906
|
}
|
|
907
907
|
static normalizeHexValue(t) {
|
|
908
908
|
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");
|
|
@@ -923,7 +923,7 @@ class R extends mt {
|
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
if (typeof t == "string") {
|
|
926
|
-
const e =
|
|
926
|
+
const e = W.normalizeColorValue(t);
|
|
927
927
|
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);
|
|
928
928
|
} else
|
|
929
929
|
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");
|
|
@@ -966,16 +966,16 @@ class R extends mt {
|
|
|
966
966
|
var c, h;
|
|
967
967
|
let r = l.target.value.trim();
|
|
968
968
|
if (this.textInputEl && i(this.textInputEl)) {
|
|
969
|
-
const d =
|
|
969
|
+
const d = W.normalizeColorValue(r);
|
|
970
970
|
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;
|
|
971
971
|
}
|
|
972
972
|
}), this.colorInputEl.addEventListener("input", (l) => {
|
|
973
973
|
var h, d;
|
|
974
|
-
const r = l.target.value, c =
|
|
974
|
+
const r = l.target.value, c = W.normalizeColorValue(r);
|
|
975
975
|
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");
|
|
976
976
|
}), this.colorInputEl.addEventListener("change", (l) => {
|
|
977
977
|
var h, d;
|
|
978
|
-
const r = l.target.value, c =
|
|
978
|
+
const r = l.target.value, c = W.normalizeColorValue(r);
|
|
979
979
|
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;
|
|
980
980
|
}), e.appendChild(s), e.appendChild(n), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
981
981
|
}
|
|
@@ -984,7 +984,7 @@ class R extends mt {
|
|
|
984
984
|
}
|
|
985
985
|
// Helper method to get normalized hex value
|
|
986
986
|
getNormalizedValue() {
|
|
987
|
-
return this.value ?
|
|
987
|
+
return this.value ? W.normalizeColorValue(this.value) : "#000000";
|
|
988
988
|
}
|
|
989
989
|
// Helper method to check if current value is valid hex
|
|
990
990
|
isValidHex() {
|
|
@@ -995,20 +995,20 @@ class R extends mt {
|
|
|
995
995
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
const
|
|
998
|
+
const kt = `
|
|
999
999
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1000
1000
|
<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"/>
|
|
1001
1001
|
<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"/>
|
|
1002
1002
|
<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"/>
|
|
1003
1003
|
</svg>`;
|
|
1004
|
-
class
|
|
1004
|
+
class j extends T {
|
|
1005
1005
|
constructor(t = {}) {
|
|
1006
1006
|
super({
|
|
1007
1007
|
...t,
|
|
1008
|
-
icon: t.icon ||
|
|
1008
|
+
icon: t.icon || kt,
|
|
1009
1009
|
title: t.title || "Color & Opacity",
|
|
1010
1010
|
default: t.default || "#000000FF"
|
|
1011
|
-
}), 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 =
|
|
1011
|
+
}), 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 = j.normalizeHexWithOpacity(this.value));
|
|
1012
1012
|
}
|
|
1013
1013
|
static normalizeHexWithOpacity(t) {
|
|
1014
1014
|
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");
|
|
@@ -1026,7 +1026,7 @@ class U extends I {
|
|
|
1026
1026
|
return `#${i}${n}`;
|
|
1027
1027
|
}
|
|
1028
1028
|
setValue(t) {
|
|
1029
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1029
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = j.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1030
1030
|
}
|
|
1031
1031
|
updateInputElements() {
|
|
1032
1032
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1037,7 +1037,7 @@ class U extends I {
|
|
|
1037
1037
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1038
1038
|
}
|
|
1039
1039
|
handleColorChange(t) {
|
|
1040
|
-
const e = this.getOpacityPercent(), i =
|
|
1040
|
+
const e = this.getOpacityPercent(), i = j.combineColorOpacity(
|
|
1041
1041
|
t,
|
|
1042
1042
|
e
|
|
1043
1043
|
);
|
|
@@ -1048,7 +1048,7 @@ class U extends I {
|
|
|
1048
1048
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1049
1049
|
}
|
|
1050
1050
|
handleOpacityChange(t) {
|
|
1051
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1051
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = j.combineColorOpacity(
|
|
1052
1052
|
e,
|
|
1053
1053
|
i
|
|
1054
1054
|
);
|
|
@@ -1123,7 +1123,7 @@ class U extends I {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class
|
|
1126
|
+
class Kt extends T {
|
|
1127
1127
|
constructor(t = {}) {
|
|
1128
1128
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1129
1129
|
}
|
|
@@ -1155,7 +1155,7 @@ class jt extends I {
|
|
|
1155
1155
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
class
|
|
1158
|
+
class z extends T {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1161
1161
|
}
|
|
@@ -1214,12 +1214,12 @@ class G extends I {
|
|
|
1214
1214
|
);
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
const
|
|
1217
|
+
const Mt = `
|
|
1218
1218
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1219
1219
|
<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"/>
|
|
1220
1220
|
<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"/>
|
|
1221
1221
|
</svg>`;
|
|
1222
|
-
class
|
|
1222
|
+
class St extends z {
|
|
1223
1223
|
constructor(t = {}) {
|
|
1224
1224
|
const e = {
|
|
1225
1225
|
title: "Opacity",
|
|
@@ -1228,7 +1228,7 @@ class yt extends G {
|
|
|
1228
1228
|
maxValue: 100,
|
|
1229
1229
|
step: 1,
|
|
1230
1230
|
default: t.default ?? 100,
|
|
1231
|
-
icon:
|
|
1231
|
+
icon: Mt,
|
|
1232
1232
|
...t
|
|
1233
1233
|
};
|
|
1234
1234
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1240,12 +1240,12 @@ class yt extends G {
|
|
|
1240
1240
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
const
|
|
1243
|
+
const It = `
|
|
1244
1244
|
<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">
|
|
1245
1245
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1246
1246
|
</svg>
|
|
1247
1247
|
`;
|
|
1248
|
-
class
|
|
1248
|
+
class at extends T {
|
|
1249
1249
|
constructor(t = {}) {
|
|
1250
1250
|
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) {
|
|
1251
1251
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1289,7 +1289,7 @@ class et extends I {
|
|
|
1289
1289
|
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1290
1290
|
}), document.body.appendChild(i);
|
|
1291
1291
|
const s = document.createElement("div");
|
|
1292
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1292
|
+
return s.classList.add("svg-container"), s.innerHTML = It, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1293
1293
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1294
1294
|
}).catch((n) => {
|
|
1295
1295
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1358,7 +1358,7 @@ class et extends I {
|
|
|
1358
1358
|
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();
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class
|
|
1361
|
+
class Nt extends T {
|
|
1362
1362
|
constructor(t = {}) {
|
|
1363
1363
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1364
1364
|
}
|
|
@@ -1414,7 +1414,7 @@ class bt extends I {
|
|
|
1414
1414
|
}), t.appendChild(i), t;
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
class
|
|
1417
|
+
class Qt extends T {
|
|
1418
1418
|
constructor(t) {
|
|
1419
1419
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1420
1420
|
}
|
|
@@ -1443,27 +1443,27 @@ class _t extends I {
|
|
|
1443
1443
|
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
class
|
|
1446
|
+
class te extends T {
|
|
1447
1447
|
constructor(t = {}) {
|
|
1448
1448
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1449
1449
|
const e = t.width || 0, i = t.height || 0;
|
|
1450
1450
|
this.value || (this.value = {
|
|
1451
1451
|
width: e,
|
|
1452
1452
|
height: i
|
|
1453
|
-
}), 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
|
|
1453
|
+
}), 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 z({
|
|
1454
1454
|
title: "Width",
|
|
1455
1455
|
default: this.value.width,
|
|
1456
1456
|
suffix: "px",
|
|
1457
1457
|
minValue: this.minWidth,
|
|
1458
1458
|
maxValue: this.maxWidth,
|
|
1459
|
-
icon:
|
|
1460
|
-
}), this.heightSetting = new
|
|
1459
|
+
icon: Vt
|
|
1460
|
+
}), this.heightSetting = new z({
|
|
1461
1461
|
title: "Height",
|
|
1462
1462
|
default: this.value.height,
|
|
1463
1463
|
suffix: "px",
|
|
1464
1464
|
minValue: this.minHeight,
|
|
1465
1465
|
maxValue: this.maxHeight,
|
|
1466
|
-
icon:
|
|
1466
|
+
icon: Tt
|
|
1467
1467
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1468
1468
|
}
|
|
1469
1469
|
handleWidthChange(t) {
|
|
@@ -1557,24 +1557,24 @@ class qt extends I {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
const
|
|
1560
|
+
const Vt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1561
1561
|
<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"/>
|
|
1562
|
-
</svg>`,
|
|
1562
|
+
</svg>`, Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1563
1563
|
<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"/>
|
|
1564
|
-
</svg>`,
|
|
1564
|
+
</svg>`, nt = `
|
|
1565
1565
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1566
1566
|
<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"/>
|
|
1567
1567
|
</svg>
|
|
1568
|
-
`,
|
|
1568
|
+
`, Ht = `
|
|
1569
1569
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1570
1570
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1571
1571
|
<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"/>
|
|
1572
1572
|
</svg>
|
|
1573
|
-
`,
|
|
1573
|
+
`, Ot = `
|
|
1574
1574
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1575
1575
|
<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"/>
|
|
1576
1576
|
</svg>
|
|
1577
|
-
`,
|
|
1577
|
+
`, Pt = `
|
|
1578
1578
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1579
1579
|
<!-- Top dot -->
|
|
1580
1580
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1594,7 +1594,7 @@ const wt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1594
1594
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1595
1595
|
</svg>
|
|
1596
1596
|
`;
|
|
1597
|
-
class
|
|
1597
|
+
class pt extends T {
|
|
1598
1598
|
constructor(t = {}) {
|
|
1599
1599
|
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();
|
|
1600
1600
|
}
|
|
@@ -1647,7 +1647,7 @@ class at extends I {
|
|
|
1647
1647
|
);
|
|
1648
1648
|
if (t && t !== "") {
|
|
1649
1649
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1650
|
-
<span class="upload-icon">${
|
|
1650
|
+
<span class="upload-icon">${nt}</span>
|
|
1651
1651
|
<span class="upload-label">Replace</span>
|
|
1652
1652
|
`);
|
|
1653
1653
|
const n = () => {
|
|
@@ -1658,7 +1658,7 @@ class at extends I {
|
|
|
1658
1658
|
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1659
1659
|
} else
|
|
1660
1660
|
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 = `
|
|
1661
|
-
<span class="upload-icon">${
|
|
1661
|
+
<span class="upload-icon">${nt}</span>
|
|
1662
1662
|
<span class="upload-label">Upload</span>
|
|
1663
1663
|
`);
|
|
1664
1664
|
}
|
|
@@ -1691,9 +1691,9 @@ class at extends I {
|
|
|
1691
1691
|
const s = this.value && this.value !== "";
|
|
1692
1692
|
s || i.classList.add("no-image");
|
|
1693
1693
|
const n = document.createElement("div");
|
|
1694
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1694
|
+
if (n.className = "preview-placeholder", n.innerHTML = Ht, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Pt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1695
1695
|
const a = document.createElement("button");
|
|
1696
|
-
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML =
|
|
1696
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Ot, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1697
1697
|
var r;
|
|
1698
1698
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1699
1699
|
};
|
|
@@ -1701,7 +1701,7 @@ class at extends I {
|
|
|
1701
1701
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1702
1702
|
const o = document.createElement("button");
|
|
1703
1703
|
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1704
|
-
<span class="upload-icon">${
|
|
1704
|
+
<span class="upload-icon">${nt}</span>
|
|
1705
1705
|
<span class="upload-label">Upload</span>
|
|
1706
1706
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1707
1707
|
window.postMessage(
|
|
@@ -1714,14 +1714,14 @@ class at extends I {
|
|
|
1714
1714
|
}, t;
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
|
-
class
|
|
1717
|
+
class ee extends z {
|
|
1718
1718
|
constructor(t = {}) {
|
|
1719
1719
|
super({
|
|
1720
1720
|
...t,
|
|
1721
1721
|
title: t.title || "Height",
|
|
1722
1722
|
suffix: t.suffix || "px",
|
|
1723
1723
|
minValue: t.minValue ?? 0,
|
|
1724
|
-
icon: t.icon ||
|
|
1724
|
+
icon: t.icon || $t,
|
|
1725
1725
|
default: t.default ?? 100
|
|
1726
1726
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1727
1727
|
}
|
|
@@ -1732,17 +1732,17 @@ class Jt extends G {
|
|
|
1732
1732
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const $t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1736
1736
|
<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"/>
|
|
1737
1737
|
</svg>`;
|
|
1738
|
-
class
|
|
1738
|
+
class ie extends z {
|
|
1739
1739
|
constructor(t = {}) {
|
|
1740
1740
|
super({
|
|
1741
1741
|
...t,
|
|
1742
1742
|
title: t.title || "Width",
|
|
1743
1743
|
suffix: t.suffix || "px",
|
|
1744
1744
|
minValue: t.minValue ?? 0,
|
|
1745
|
-
icon: t.icon ||
|
|
1745
|
+
icon: t.icon || At,
|
|
1746
1746
|
default: t.default ?? 100
|
|
1747
1747
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1748
1748
|
}
|
|
@@ -1753,14 +1753,14 @@ class Zt extends G {
|
|
|
1753
1753
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
const
|
|
1756
|
+
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1757
1757
|
<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"/>
|
|
1758
|
-
</svg>`,
|
|
1758
|
+
</svg>`, Dt = `
|
|
1759
1759
|
<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">
|
|
1760
1760
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1761
1761
|
</svg>
|
|
1762
1762
|
`;
|
|
1763
|
-
class
|
|
1763
|
+
class se extends T {
|
|
1764
1764
|
constructor(t = {}) {
|
|
1765
1765
|
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) {
|
|
1766
1766
|
const e = this._options.findIndex(
|
|
@@ -1815,7 +1815,7 @@ class Xt extends I {
|
|
|
1815
1815
|
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1816
1816
|
}), t.appendChild(i);
|
|
1817
1817
|
const s = document.createElement("div");
|
|
1818
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1818
|
+
return s.classList.add("svg-container"), s.innerHTML = Dt, t.appendChild(s), s.onclick = () => {
|
|
1819
1819
|
var n, o;
|
|
1820
1820
|
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));
|
|
1821
1821
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -1907,7 +1907,7 @@ class Xt extends I {
|
|
|
1907
1907
|
), this.updateButtonText();
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
|
-
class
|
|
1910
|
+
class ne extends T {
|
|
1911
1911
|
constructor(t) {
|
|
1912
1912
|
var e, i;
|
|
1913
1913
|
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;
|
|
@@ -1957,13 +1957,13 @@ class Yt extends I {
|
|
|
1957
1957
|
this.detectChangeCallback = t;
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
|
-
const
|
|
1960
|
+
const Bt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1961
1961
|
<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"/>
|
|
1962
1962
|
</svg>`;
|
|
1963
|
-
class
|
|
1963
|
+
class oe extends T {
|
|
1964
1964
|
// Store mobile value
|
|
1965
1965
|
constructor(t = {}) {
|
|
1966
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
1966
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Bt, 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);
|
|
1967
1967
|
}
|
|
1968
1968
|
draw() {
|
|
1969
1969
|
const t = document.createElement("div");
|
|
@@ -2014,42 +2014,42 @@ class Kt extends I {
|
|
|
2014
2014
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
const
|
|
2017
|
+
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2018
2018
|
<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"/>
|
|
2019
2019
|
</svg>`;
|
|
2020
|
-
class
|
|
2020
|
+
class ae extends z {
|
|
2021
2021
|
constructor(t = {}) {
|
|
2022
2022
|
super({
|
|
2023
2023
|
...t,
|
|
2024
2024
|
minValue: t.minValue ?? 0,
|
|
2025
2025
|
maxValue: t.maxValue ?? 1e3,
|
|
2026
|
-
icon: t.icon ||
|
|
2026
|
+
icon: t.icon || Ft,
|
|
2027
2027
|
title: t.title || "Margin Bottom",
|
|
2028
2028
|
default: t.default ?? 20,
|
|
2029
2029
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2030
2030
|
}), this.inputType = "number";
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
|
-
const
|
|
2033
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2034
2034
|
<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"
|
|
2035
2035
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2036
2036
|
</svg>`;
|
|
2037
|
-
class
|
|
2037
|
+
class le extends z {
|
|
2038
2038
|
constructor(t = {}) {
|
|
2039
2039
|
super({
|
|
2040
2040
|
...t,
|
|
2041
2041
|
minValue: t.minValue ?? 0,
|
|
2042
2042
|
maxValue: t.maxValue ?? 1e3,
|
|
2043
|
-
icon: t.icon ||
|
|
2043
|
+
icon: t.icon || Rt,
|
|
2044
2044
|
title: t.title || "Margin Top",
|
|
2045
2045
|
default: t.default ?? 20,
|
|
2046
2046
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2047
2047
|
}), this.inputType = "number";
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
class
|
|
2050
|
+
class re extends T {
|
|
2051
2051
|
constructor(t) {
|
|
2052
|
-
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(
|
|
2052
|
+
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(T.DefaultLanguage) ? T.DefaultLanguage : t.languages[0];
|
|
2053
2053
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2054
2054
|
t.languages.forEach((i) => {
|
|
2055
2055
|
var s, n;
|
|
@@ -2080,13 +2080,13 @@ class ee extends I {
|
|
|
2080
2080
|
return;
|
|
2081
2081
|
}
|
|
2082
2082
|
const c = "...";
|
|
2083
|
-
let h = 0, d = e.length,
|
|
2083
|
+
let h = 0, d = e.length, C = 0;
|
|
2084
2084
|
for (; h <= d; ) {
|
|
2085
|
-
const
|
|
2086
|
-
this.measureTextWidth(
|
|
2085
|
+
const f = Math.floor((h + d) / 2), v = e.slice(0, f).trimEnd() + c;
|
|
2086
|
+
this.measureTextWidth(v, i) <= l ? (C = f, h = f + 1) : d = f - 1;
|
|
2087
2087
|
}
|
|
2088
|
-
const
|
|
2089
|
-
t.placeholder =
|
|
2088
|
+
const u = e.slice(0, C).trimEnd() + c;
|
|
2089
|
+
t.placeholder = u;
|
|
2090
2090
|
}
|
|
2091
2091
|
autosizeTextarea(t, e = 3) {
|
|
2092
2092
|
t.style.height = "auto";
|
|
@@ -2098,7 +2098,7 @@ class ee extends I {
|
|
|
2098
2098
|
i.classList.add("simple-multi-language-row");
|
|
2099
2099
|
const s = document.createElement("label");
|
|
2100
2100
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2101
|
-
const n = new
|
|
2101
|
+
const n = new pt({
|
|
2102
2102
|
defaultUrl: e || "",
|
|
2103
2103
|
title: "",
|
|
2104
2104
|
id: `${this.id}_upload_${t}`
|
|
@@ -2194,7 +2194,7 @@ class ee extends I {
|
|
|
2194
2194
|
});
|
|
2195
2195
|
}
|
|
2196
2196
|
}
|
|
2197
|
-
class
|
|
2197
|
+
class ce extends T {
|
|
2198
2198
|
constructor(t = {}) {
|
|
2199
2199
|
super(t), this.inputType = "select";
|
|
2200
2200
|
const e = [
|
|
@@ -2205,7 +2205,7 @@ class ie extends I {
|
|
|
2205
2205
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2206
2206
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2207
2207
|
];
|
|
2208
|
-
this.selectSetting = new
|
|
2208
|
+
this.selectSetting = new at({
|
|
2209
2209
|
title: this.title || "Animation",
|
|
2210
2210
|
options: e,
|
|
2211
2211
|
default: this.props.default || "none"
|
|
@@ -2221,7 +2221,90 @@ class ie extends I {
|
|
|
2221
2221
|
this.selectSetting.destroy(), super.destroy();
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
const
|
|
2224
|
+
const Y = class Y {
|
|
2225
|
+
static getDefaultState() {
|
|
2226
|
+
return {
|
|
2227
|
+
solid: [],
|
|
2228
|
+
gradient: []
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
static ensureLoaded() {
|
|
2232
|
+
var t;
|
|
2233
|
+
if (this.colors === null && (this.colors = this.getDefaultState(), !(typeof window > "u")))
|
|
2234
|
+
try {
|
|
2235
|
+
const e = (t = window.sessionStorage) == null ? void 0 : t.getItem(this.STORAGE_KEY);
|
|
2236
|
+
if (e) {
|
|
2237
|
+
const i = JSON.parse(e);
|
|
2238
|
+
["solid", "gradient"].forEach((s) => {
|
|
2239
|
+
const n = Array.isArray(i == null ? void 0 : i[s]) ? i[s] : [];
|
|
2240
|
+
this.colors[s] = n.map((o) => this.normalize(o)).filter((o) => !!o);
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
} catch (e) {
|
|
2244
|
+
console.warn("Unable to load recent colors:", e), this.colors = this.getDefaultState();
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
static persist() {
|
|
2248
|
+
var t;
|
|
2249
|
+
if (!(typeof window > "u"))
|
|
2250
|
+
try {
|
|
2251
|
+
(t = window.sessionStorage) == null || t.setItem(
|
|
2252
|
+
this.STORAGE_KEY,
|
|
2253
|
+
JSON.stringify(this.colors || this.getDefaultState())
|
|
2254
|
+
);
|
|
2255
|
+
} catch (e) {
|
|
2256
|
+
console.warn("Unable to persist recent colors:", e);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
static normalize(t) {
|
|
2260
|
+
if (!t) return null;
|
|
2261
|
+
const e = t.trim();
|
|
2262
|
+
if (!e.startsWith("#")) return null;
|
|
2263
|
+
let i = e.slice(1);
|
|
2264
|
+
return i.length === 3 && (i = i.split("").map((s) => s + s).join("")), i.length !== 6 || !/^[0-9a-fA-F]{6}$/.test(i) ? null : `#${i.toUpperCase()}`;
|
|
2265
|
+
}
|
|
2266
|
+
static getScopeList(t) {
|
|
2267
|
+
return this.ensureLoaded(), this.colors || (this.colors = this.getDefaultState()), this.colors[t];
|
|
2268
|
+
}
|
|
2269
|
+
static getColors(t) {
|
|
2270
|
+
return [...this.getScopeList(t)];
|
|
2271
|
+
}
|
|
2272
|
+
static addColor(t, e) {
|
|
2273
|
+
const i = this.normalize(t);
|
|
2274
|
+
if (!i) return;
|
|
2275
|
+
const s = this.getScopeList(e), n = s.indexOf(i);
|
|
2276
|
+
n !== -1 && s.splice(n, 1), s.unshift(i), s.length > this.MAX_COLORS && (s.length = this.MAX_COLORS), this.persist();
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
Y.STORAGE_KEY = "settingsLib_recentColors", Y.MAX_COLORS = 12, Y.colors = null;
|
|
2280
|
+
let J = Y;
|
|
2281
|
+
function lt(p, t) {
|
|
2282
|
+
const e = document.createElement("div");
|
|
2283
|
+
e.className = "color-picker-recent-section";
|
|
2284
|
+
const i = document.createElement("div");
|
|
2285
|
+
i.className = "color-picker-recent-title", i.textContent = "Recently Used Colors";
|
|
2286
|
+
const s = document.createElement("div");
|
|
2287
|
+
s.className = "color-picker-recent-grid";
|
|
2288
|
+
const n = document.createElement("div");
|
|
2289
|
+
n.className = "color-picker-recent-placeholder", n.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(s), e.appendChild(n);
|
|
2290
|
+
const o = () => {
|
|
2291
|
+
s.innerHTML = "";
|
|
2292
|
+
const a = J.getColors(t);
|
|
2293
|
+
if (a.length === 0) {
|
|
2294
|
+
s.style.display = "none", n.style.display = "block";
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
s.style.display = "grid", n.style.display = "none", a.forEach((l) => {
|
|
2298
|
+
const r = document.createElement("button");
|
|
2299
|
+
r.type = "button", r.className = "color-picker-recent-swatch", r.title = l, r.setAttribute("aria-label", `Use color ${l}`), r.style.background = l, r.style.borderColor = l, r.addEventListener("click", () => p(l)), s.appendChild(r);
|
|
2300
|
+
});
|
|
2301
|
+
};
|
|
2302
|
+
return o(), {
|
|
2303
|
+
container: e,
|
|
2304
|
+
refresh: o
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
const ut = `<svg
|
|
2225
2308
|
width="13"
|
|
2226
2309
|
height="13"
|
|
2227
2310
|
viewBox="0 0 13 13"
|
|
@@ -2235,96 +2318,23 @@ const lt = `<svg
|
|
|
2235
2318
|
fill="#919EAB"
|
|
2236
2319
|
/>
|
|
2237
2320
|
</svg>`;
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
let r = "", c = 0;
|
|
2253
|
-
for (let u = 0; u < n.length; u++) {
|
|
2254
|
-
const g = n[u];
|
|
2255
|
-
g === "(" && c++, g === ")" && c--, g === "," && c === 0 ? (l.push(r.trim()), r = "") : r += g;
|
|
2256
|
-
}
|
|
2257
|
-
r.trim() && l.push(r.trim());
|
|
2258
|
-
const h = [];
|
|
2259
|
-
let d = [];
|
|
2260
|
-
for (let u = 0; u < l.length; u++) {
|
|
2261
|
-
const g = l[u];
|
|
2262
|
-
g.includes("deg") || g.includes("to ") || d.push(g);
|
|
2263
|
-
}
|
|
2264
|
-
for (let u = 0; u < d.length; u++) {
|
|
2265
|
-
const g = d[u];
|
|
2266
|
-
let C = "", m = 0, y = 100;
|
|
2267
|
-
const f = g.match(
|
|
2268
|
-
/rgba?\(([^)]+)\)(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2269
|
-
);
|
|
2270
|
-
if (f) {
|
|
2271
|
-
const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
|
|
2272
|
-
C = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100), f[2] ? m = parseFloat(f[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100);
|
|
2273
|
-
} else {
|
|
2274
|
-
const E = g.match(
|
|
2275
|
-
/#([a-fA-F0-9]{3,8})(?:\s*(\d+(?:\.\d+)?)%)?/
|
|
2276
|
-
);
|
|
2277
|
-
E && (C = `#${E[1]}`, E[2] ? m = parseFloat(E[2]) : m = d.length === 1 ? 0 : Math.round(u / (d.length - 1) * 100));
|
|
2278
|
-
}
|
|
2279
|
-
C && h.push({
|
|
2280
|
-
color: C,
|
|
2281
|
-
position: m,
|
|
2282
|
-
opacity: y
|
|
2283
|
-
});
|
|
2284
|
-
}
|
|
2285
|
-
if (h.length === 0) {
|
|
2286
|
-
const u = n.match(
|
|
2287
|
-
/(#[a-fA-F0-9]{3,8}|rgba?\([^)]+\))/g
|
|
2288
|
-
);
|
|
2289
|
-
u && u.forEach((g, C) => {
|
|
2290
|
-
let m = "", y = 100;
|
|
2291
|
-
if (g.startsWith("#"))
|
|
2292
|
-
m = g;
|
|
2293
|
-
else {
|
|
2294
|
-
const f = g.match(/rgba?\(([^)]+)\)/);
|
|
2295
|
-
if (f) {
|
|
2296
|
-
const E = f[1].split(",").map((b) => b.trim()), V = parseInt(E[0]), A = parseInt(E[1]), B = parseInt(E[2]), L = E[3] ? parseFloat(E[3]) : 1;
|
|
2297
|
-
m = `#${V.toString(16).padStart(2, "0")}${A.toString(16).padStart(2, "0")}${B.toString(16).padStart(2, "0")}`, y = Math.round(L * 100);
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
if (m) {
|
|
2301
|
-
const f = u.length === 1 ? 0 : Math.round(C / (u.length - 1) * 100);
|
|
2302
|
-
h.push({
|
|
2303
|
-
color: m,
|
|
2304
|
-
position: f,
|
|
2305
|
-
opacity: y
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
});
|
|
2321
|
+
class ht {
|
|
2322
|
+
constructor(t, e = "gradient") {
|
|
2323
|
+
this.isOpen = !1, this.isColorDragging = !1, this.isHueDragging = !1, this.isOpacityDragging = !1, this.pendingRecentColor = null, this.currentColor = "#ff0000", this.currentOpacity = 100, this.isUpdatingHue = !1, this.handleOutsideClick = (i) => {
|
|
2324
|
+
const s = document.querySelector(".gradient-popover");
|
|
2325
|
+
s && s.contains(i.target) || this.element.contains(i.target) || (i.stopPropagation(), this.close(!1));
|
|
2326
|
+
}, this.handleKeydown = (i) => {
|
|
2327
|
+
if (this.isOpen) {
|
|
2328
|
+
if (i.key === "Escape")
|
|
2329
|
+
i.preventDefault(), this.close(!0);
|
|
2330
|
+
else if (i.key === "Enter") {
|
|
2331
|
+
const s = i.target;
|
|
2332
|
+
if (s && (s.tagName === "TEXTAREA" || s.tagName === "INPUT"))
|
|
2333
|
+
return;
|
|
2334
|
+
i.preventDefault(), this.close(!0);
|
|
2309
2335
|
}
|
|
2310
|
-
return console.log("Color stops found:", h), {
|
|
2311
|
-
type: "linear",
|
|
2312
|
-
angle: o,
|
|
2313
|
-
stops: h
|
|
2314
|
-
};
|
|
2315
2336
|
}
|
|
2316
|
-
}
|
|
2317
|
-
return null;
|
|
2318
|
-
} catch (t) {
|
|
2319
|
-
return console.warn("Failed to parse CSS gradient:", p, t), null;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
class Pt {
|
|
2323
|
-
constructor(t) {
|
|
2324
|
-
this.isOpen = !1, this.currentColor = "#ff0000", this.currentOpacity = 100, this.isUpdatingHue = !1, this.handleOutsideClick = (e) => {
|
|
2325
|
-
const i = document.querySelector(".gradient-popover");
|
|
2326
|
-
i && i.contains(e.target) || this.element.contains(e.target) || (e.stopPropagation(), this.close());
|
|
2327
|
-
}, this.onColorChange = t, this.element = this.createColorPicker();
|
|
2337
|
+
}, this.onColorChange = t, this.recentScope = e, this.element = this.createColorPicker();
|
|
2328
2338
|
}
|
|
2329
2339
|
createColorPicker() {
|
|
2330
2340
|
const t = document.createElement("div");
|
|
@@ -2334,7 +2344,7 @@ class Pt {
|
|
|
2334
2344
|
const i = document.createElement("span");
|
|
2335
2345
|
i.textContent = "Color";
|
|
2336
2346
|
const s = document.createElement("button");
|
|
2337
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2347
|
+
s.className = "color-picker-close", s.innerHTML = ut, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), this.makeDraggable(e, t);
|
|
2338
2348
|
const n = document.createElement("div");
|
|
2339
2349
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2340
2350
|
const o = document.createElement("div");
|
|
@@ -2353,51 +2363,72 @@ class Pt {
|
|
|
2353
2363
|
h.className = "color-picker-opacity", this.opacitySlider = h;
|
|
2354
2364
|
const d = document.createElement("div");
|
|
2355
2365
|
d.className = "color-picker-opacity-marker", this.opacityMarker = d, h.appendChild(d);
|
|
2366
|
+
const C = lt((E) => {
|
|
2367
|
+
this.setColor(E), this.queueRecentColor(E);
|
|
2368
|
+
}, this.recentScope);
|
|
2369
|
+
this.recentColorsSection = C;
|
|
2356
2370
|
const u = document.createElement("div");
|
|
2357
2371
|
u.className = "color-picker-format-section";
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2372
|
+
const f = document.createElement("select");
|
|
2373
|
+
f.className = "color-picker-format-select", this.formatSelect = f;
|
|
2374
|
+
const v = document.createElement("option");
|
|
2375
|
+
v.value = "hex", v.textContent = "HEX";
|
|
2376
|
+
const b = document.createElement("option");
|
|
2377
|
+
b.value = "rgb", b.textContent = "RGB";
|
|
2362
2378
|
const m = document.createElement("option");
|
|
2363
|
-
m.value = "
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
const
|
|
2367
|
-
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
return V.className = "color-picker-copy-inside", V.textContent = "Copy", V.addEventListener("click", () => this.copyToClipboard()), E.appendChild(f), E.appendChild(V), u.appendChild(g), u.appendChild(E), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(h), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (A) => {
|
|
2372
|
-
A.stopPropagation();
|
|
2379
|
+
m.value = "hsl", m.textContent = "HSL", f.appendChild(v), f.appendChild(b), f.appendChild(m);
|
|
2380
|
+
const L = document.createElement("input");
|
|
2381
|
+
L.type = "text", L.className = "color-picker-color-input", L.value = this.currentColor, this.hexInput = L;
|
|
2382
|
+
const M = document.createElement("div");
|
|
2383
|
+
M.className = "color-picker-input-container";
|
|
2384
|
+
const y = document.createElement("button");
|
|
2385
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", y.addEventListener("click", () => this.copyToClipboard()), M.appendChild(L), M.appendChild(y), u.appendChild(f), u.appendChild(M), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(h), t.appendChild(C.container), t.appendChild(u), this.setupEyedropper(l), this.setupEventListeners(), t.addEventListener("click", (E) => {
|
|
2386
|
+
E.stopPropagation();
|
|
2373
2387
|
}), t;
|
|
2374
2388
|
}
|
|
2389
|
+
refreshRecentColors() {
|
|
2390
|
+
var t;
|
|
2391
|
+
(t = this.recentColorsSection) == null || t.refresh();
|
|
2392
|
+
}
|
|
2393
|
+
queueRecentColor(t) {
|
|
2394
|
+
this.pendingRecentColor = t;
|
|
2395
|
+
}
|
|
2396
|
+
flushRecentColor() {
|
|
2397
|
+
this.pendingRecentColor && (J.addColor(this.pendingRecentColor, this.recentScope), this.pendingRecentColor = null, this.refreshRecentColors());
|
|
2398
|
+
}
|
|
2399
|
+
discardPendingColor() {
|
|
2400
|
+
this.pendingRecentColor = null;
|
|
2401
|
+
}
|
|
2375
2402
|
setupEventListeners() {
|
|
2376
2403
|
this.colorArea.addEventListener("mousedown", (t) => this.startColorDrag(t)), this.colorArea.addEventListener("click", (t) => {
|
|
2377
|
-
t.stopPropagation()
|
|
2404
|
+
t.stopPropagation();
|
|
2378
2405
|
}), this.hueSlider.addEventListener("mousedown", (t) => this.startHueDrag(t)), this.hueSlider.addEventListener("click", (t) => {
|
|
2379
|
-
t.stopPropagation()
|
|
2406
|
+
t.stopPropagation();
|
|
2380
2407
|
}), this.formatSelect.addEventListener("change", () => this.updateColorInput()), this.hexInput.addEventListener(
|
|
2381
2408
|
"input",
|
|
2382
2409
|
(t) => this.updateColorFromInput(t)
|
|
2383
|
-
), this.hexInput.addEventListener("blur", (t) =>
|
|
2410
|
+
), this.hexInput.addEventListener("blur", (t) => {
|
|
2411
|
+
this.validateColorInput(t), this.queueRecentColor(this.currentColor);
|
|
2412
|
+
}), this.hexInput.addEventListener("keydown", (t) => {
|
|
2413
|
+
t.key === "Enter" && (t.preventDefault(), this.validateColorInput(t), this.queueRecentColor(this.currentColor), this.close(!0));
|
|
2414
|
+
}), this.opacitySlider.addEventListener(
|
|
2384
2415
|
"mousedown",
|
|
2385
2416
|
(t) => this.startOpacityDrag(t)
|
|
2386
2417
|
), this.opacitySlider.addEventListener("click", (t) => {
|
|
2387
|
-
t.stopPropagation()
|
|
2418
|
+
t.stopPropagation();
|
|
2388
2419
|
});
|
|
2389
2420
|
}
|
|
2390
2421
|
startColorDrag(t) {
|
|
2391
|
-
t.preventDefault(), t.stopPropagation(), this.updateColorFromArea(t);
|
|
2422
|
+
t.preventDefault(), t.stopPropagation(), this.isColorDragging = !0, this.updateColorFromArea(t);
|
|
2392
2423
|
const e = (s) => this.updateColorFromArea(s), i = () => {
|
|
2393
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2424
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i), this.isColorDragging = !1, this.queueRecentColor(this.currentColor);
|
|
2394
2425
|
};
|
|
2395
2426
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2396
2427
|
}
|
|
2397
2428
|
startHueDrag(t) {
|
|
2398
|
-
t.preventDefault(), t.stopPropagation(), this.updateHueFromSlider(t);
|
|
2429
|
+
t.preventDefault(), t.stopPropagation(), this.isHueDragging = !0, this.updateHueFromSlider(t);
|
|
2399
2430
|
const e = (s) => this.updateHueFromSlider(s), i = () => {
|
|
2400
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2431
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i), this.isHueDragging = !1, this.queueRecentColor(this.currentColor);
|
|
2401
2432
|
};
|
|
2402
2433
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2403
2434
|
}
|
|
@@ -2409,7 +2440,11 @@ class Pt {
|
|
|
2409
2440
|
this.isUpdatingHue = !0;
|
|
2410
2441
|
const e = this.hueSlider.getBoundingClientRect();
|
|
2411
2442
|
let i = (t.clientX - e.left) / e.width;
|
|
2412
|
-
i = Math.max(2e-3, Math.min(0.996, i)),
|
|
2443
|
+
i = Math.max(2e-3, Math.min(0.996, i)), console.log("Hue slider click:", {
|
|
2444
|
+
x: i,
|
|
2445
|
+
hueValue: i * 360,
|
|
2446
|
+
percent: i * 100
|
|
2447
|
+
}), this.hueMarker.style.left = `${i * 100}%`;
|
|
2413
2448
|
const s = i * 360;
|
|
2414
2449
|
this.updateHue(s), this.isUpdatingHue = !1;
|
|
2415
2450
|
}
|
|
@@ -2418,15 +2453,16 @@ class Pt {
|
|
|
2418
2453
|
this.setColor(s);
|
|
2419
2454
|
}
|
|
2420
2455
|
updateHue(t) {
|
|
2421
|
-
|
|
2422
|
-
|
|
2456
|
+
const e = t;
|
|
2457
|
+
t = Math.max(0.5, Math.min(358.5, t)), console.log("UpdateHue:", { originalHue: e, clampedHue: t }), this.colorArea.getBoundingClientRect();
|
|
2458
|
+
const i = parseFloat(this.colorMarker.style.left || "50%") / 100, s = parseFloat(this.colorMarker.style.top || "50%") / 100;
|
|
2423
2459
|
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${t}, 100%, 50%))`;
|
|
2424
|
-
const
|
|
2425
|
-
this.setColor(
|
|
2460
|
+
const n = i, o = 1 - s, a = this.hsvToHex(t, n, o);
|
|
2461
|
+
this.setColor(a);
|
|
2426
2462
|
}
|
|
2427
2463
|
getCurrentHue() {
|
|
2428
|
-
const
|
|
2429
|
-
return Math.max(0.5, Math.min(358.5, e));
|
|
2464
|
+
const t = parseFloat(this.hueMarker.style.left || "0%") / 100, e = t * 360;
|
|
2465
|
+
return console.log("GetCurrentHue:", { huePosition: t, hueValue: e }), Math.max(0.5, Math.min(358.5, e));
|
|
2430
2466
|
}
|
|
2431
2467
|
updateColorInput() {
|
|
2432
2468
|
const t = this.formatSelect.value, { h: e, s: i, v: s } = this.hexToHsv(this.currentColor);
|
|
@@ -2473,9 +2509,9 @@ class Pt {
|
|
|
2473
2509
|
this.updateColorInput();
|
|
2474
2510
|
}
|
|
2475
2511
|
startOpacityDrag(t) {
|
|
2476
|
-
t.preventDefault(), t.stopPropagation(), this.updateOpacityFromSlider(t);
|
|
2512
|
+
t.preventDefault(), t.stopPropagation(), this.isOpacityDragging = !0, this.updateOpacityFromSlider(t);
|
|
2477
2513
|
const e = (s) => this.updateOpacityFromSlider(s), i = () => {
|
|
2478
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i);
|
|
2514
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", i), this.isOpacityDragging = !1, this.queueRecentColor(this.currentColor);
|
|
2479
2515
|
};
|
|
2480
2516
|
document.addEventListener("mousemove", e), document.addEventListener("mouseup", i);
|
|
2481
2517
|
}
|
|
@@ -2494,20 +2530,20 @@ class Pt {
|
|
|
2494
2530
|
return /^#[0-9A-Fa-f]{6}$/.test(t);
|
|
2495
2531
|
}
|
|
2496
2532
|
hsvToHex(t, e, i) {
|
|
2497
|
-
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));
|
|
2533
|
+
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 });
|
|
2498
2534
|
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
2499
2535
|
let a = 0, l = 0, r = 0;
|
|
2500
2536
|
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")}`;
|
|
2501
2537
|
}
|
|
2502
2538
|
setColor(t) {
|
|
2503
|
-
this.currentColor = t, this.updatePickerFromColor(t), this.updateColorInput(), this.updateOpacityBackground(), this.onColorChange && this.onColorChange(t, this.currentOpacity);
|
|
2539
|
+
this.currentColor = t, this.updatePickerFromColor(t), this.updateColorInput(), this.updateOpacityBackground(), this.onColorChange && this.onColorChange(t, this.currentOpacity), this.queueRecentColor(t);
|
|
2504
2540
|
}
|
|
2505
2541
|
setupEyedropper(t) {
|
|
2506
2542
|
const e = async () => {
|
|
2507
2543
|
if ("EyeDropper" in window)
|
|
2508
2544
|
try {
|
|
2509
2545
|
const n = (await new window.EyeDropper().open()).sRGBHex;
|
|
2510
|
-
this.currentColor = n, this.updateColorInput(), this.updateColorAreaFromHex(n), this.onColorChange && this.onColorChange(n);
|
|
2546
|
+
this.currentColor = n, this.updateColorInput(), this.updateColorAreaFromHex(n), this.onColorChange && this.onColorChange(n), this.queueRecentColor(n);
|
|
2511
2547
|
} catch (i) {
|
|
2512
2548
|
console.log("User cancelled eyedropper or error occurred:", i);
|
|
2513
2549
|
}
|
|
@@ -2527,11 +2563,11 @@ class Pt {
|
|
|
2527
2563
|
});
|
|
2528
2564
|
}
|
|
2529
2565
|
open(t, e, i) {
|
|
2530
|
-
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";
|
|
2566
|
+
this.currentColor = t, this.currentOpacity = i ?? 100, this.updateColorInput(), this.updatePickerFromColor(t), this.refreshRecentColors(), this.updateOpacityBackground(), this.opacityMarker.style.left = `${this.currentOpacity}%`, this.pendingRecentColor = null, this.isOpen = !0, this.element.style.display = "block";
|
|
2531
2567
|
const s = e.getBoundingClientRect(), n = window.innerWidth, o = window.innerHeight;
|
|
2532
2568
|
this.element.style.position = "fixed", this.element.style.zIndex = "10002";
|
|
2533
2569
|
let a = s.right + 8, l = s.top;
|
|
2534
|
-
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(() => {
|
|
2570
|
+
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), document.addEventListener("keydown", this.handleKeydown, !0), setTimeout(() => {
|
|
2535
2571
|
document.addEventListener("click", this.handleOutsideClick, !0);
|
|
2536
2572
|
}, 50);
|
|
2537
2573
|
}
|
|
@@ -2564,126 +2600,50 @@ class Pt {
|
|
|
2564
2600
|
}, r = (h) => {
|
|
2565
2601
|
if (!i) return;
|
|
2566
2602
|
h.preventDefault(), h.stopPropagation();
|
|
2567
|
-
const d = h.clientX - s,
|
|
2568
|
-
let
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2603
|
+
const d = h.clientX - s, C = h.clientY - n;
|
|
2604
|
+
let u = o + d, f = a + C;
|
|
2605
|
+
const v = window.innerWidth, b = window.innerHeight, m = e.offsetWidth, L = e.offsetHeight;
|
|
2606
|
+
u = Math.max(8, Math.min(v - m - 8, u)), f = Math.max(8, Math.min(b - L - 8, f)), e.style.left = `${u}px`, e.style.top = `${f}px`;
|
|
2571
2607
|
}, c = (h) => {
|
|
2572
2608
|
i && (i = !1, h.preventDefault(), h.stopPropagation(), e.classList.remove("dragging"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "");
|
|
2573
2609
|
};
|
|
2574
2610
|
t.addEventListener("mousedown", l);
|
|
2575
2611
|
}
|
|
2576
|
-
close() {
|
|
2577
|
-
this.isOpen = !1, this.element.style.display = "none", document.removeEventListener("click", this.handleOutsideClick, !0);
|
|
2612
|
+
close(t = !1) {
|
|
2613
|
+
this.isOpen = !1, this.element.style.display = "none", document.removeEventListener("click", this.handleOutsideClick, !0), document.removeEventListener("keydown", this.handleKeydown, !0), t ? this.flushRecentColor() : this.discardPendingColor();
|
|
2578
2614
|
}
|
|
2579
2615
|
getElement() {
|
|
2580
2616
|
return this.element;
|
|
2581
2617
|
}
|
|
2582
2618
|
}
|
|
2583
|
-
class
|
|
2619
|
+
class he extends T {
|
|
2584
2620
|
constructor(t = {}) {
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
if (i.length === 9) {
|
|
2590
|
-
const n = parseInt(i.slice(-2), 16);
|
|
2591
|
-
s = Math.round(n / 255 * 100), i = i.slice(0, 7);
|
|
2592
|
-
}
|
|
2593
|
-
e = {
|
|
2594
|
-
type: "solid",
|
|
2595
|
-
angle: 90,
|
|
2596
|
-
stops: [{ color: i, position: 0, opacity: s }]
|
|
2597
|
-
};
|
|
2598
|
-
} else
|
|
2599
|
-
e = nt(t.default) || {
|
|
2600
|
-
type: "linear",
|
|
2601
|
-
angle: 90,
|
|
2602
|
-
stops: [
|
|
2603
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2604
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2605
|
-
]
|
|
2606
|
-
};
|
|
2607
|
-
else
|
|
2608
|
-
e = t.default || {
|
|
2621
|
+
super({
|
|
2622
|
+
...t,
|
|
2623
|
+
title: t.title || "Gradient",
|
|
2624
|
+
default: t.default || {
|
|
2609
2625
|
type: "linear",
|
|
2610
2626
|
angle: 90,
|
|
2611
2627
|
stops: [
|
|
2612
2628
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2613
2629
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2614
2630
|
]
|
|
2615
|
-
}
|
|
2616
|
-
(!e.stops || e.stops.length === 0) && (e.stops = [
|
|
2617
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2618
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2619
|
-
]), super({
|
|
2620
|
-
...t,
|
|
2621
|
-
title: t.title || "Gradient",
|
|
2622
|
-
default: e
|
|
2631
|
+
}
|
|
2623
2632
|
}), this.inputType = {
|
|
2624
2633
|
type: "text",
|
|
2625
2634
|
angle: "number",
|
|
2626
2635
|
stops: "text"
|
|
2627
|
-
}, this.element = null, this.previewElement = null, this.textInputElement = null, this.popoverElement = null, this.placeholderTrigger = null, this.isPopoverOpen = !1, this.isUserEditing = !1, this.handleBackgroundClick = (
|
|
2628
|
-
var
|
|
2636
|
+
}, this.element = null, this.previewElement = null, this.textInputElement = null, this.popoverElement = null, this.placeholderTrigger = null, this.isPopoverOpen = !1, this.isUserEditing = !1, this.handleBackgroundClick = (e) => {
|
|
2637
|
+
var l;
|
|
2629
2638
|
if (!this.popoverElement || !this.isPopoverOpen) return;
|
|
2630
|
-
const
|
|
2631
|
-
(
|
|
2639
|
+
const i = e.target, s = this.popoverElement.contains(i), n = (l = this.element) == null ? void 0 : l.contains(i), o = document.querySelectorAll(".custom-color-picker"), a = Array.from(o).some(
|
|
2640
|
+
(r) => r.contains(i)
|
|
2632
2641
|
);
|
|
2633
|
-
!
|
|
2642
|
+
!s && !n && !a && this.closePopover();
|
|
2634
2643
|
}, this.detectChange = t.detectChange, this.forText = t.forText || !1;
|
|
2635
2644
|
}
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
return !this.value || !this.isValidGradientValue(this.value) ? (console.warn("Invalid value detected, returning default:", this.value), this.getDefaultGradientValue()) : this.value;
|
|
2639
|
-
}
|
|
2640
|
-
setValue(t) {
|
|
2641
|
-
let e;
|
|
2642
|
-
if (!t)
|
|
2643
|
-
console.warn("Undefined value in setValue, using default"), e = this.getDefaultGradientValue();
|
|
2644
|
-
else if (typeof t == "string")
|
|
2645
|
-
if (t.match(/^#[a-fA-F0-9]{3,8}$/)) {
|
|
2646
|
-
let i = t, s = 100;
|
|
2647
|
-
if (i.length === 9) {
|
|
2648
|
-
const n = parseInt(i.slice(-2), 16);
|
|
2649
|
-
s = Math.round(n / 255 * 100), i = i.slice(0, 7);
|
|
2650
|
-
}
|
|
2651
|
-
e = {
|
|
2652
|
-
type: "solid",
|
|
2653
|
-
angle: 90,
|
|
2654
|
-
stops: [{ color: i, position: 0, opacity: s }]
|
|
2655
|
-
};
|
|
2656
|
-
} else {
|
|
2657
|
-
const i = nt(t);
|
|
2658
|
-
i && this.isValidGradientValue(i) ? e = i : (console.warn(
|
|
2659
|
-
"Failed to parse string value, using default:",
|
|
2660
|
-
t
|
|
2661
|
-
), e = this.getDefaultGradientValue());
|
|
2662
|
-
}
|
|
2663
|
-
else if (typeof t == "object" && t.background) {
|
|
2664
|
-
console.warn(
|
|
2665
|
-
"Received CSS style object, extracting background value:",
|
|
2666
|
-
t
|
|
2667
|
-
);
|
|
2668
|
-
const i = t.background;
|
|
2669
|
-
if (typeof i == "string") {
|
|
2670
|
-
this.setValue(i);
|
|
2671
|
-
return;
|
|
2672
|
-
} else
|
|
2673
|
-
e = this.getDefaultGradientValue();
|
|
2674
|
-
} else this.isValidGradientValue(t) ? (e = t, e.stops && e.stops.length > 0 ? e.stops.forEach((i) => {
|
|
2675
|
-
i.opacity === void 0 && (i.opacity = 100);
|
|
2676
|
-
}) : e.stops = [
|
|
2677
|
-
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
2678
|
-
{ color: "#786666", position: 100, opacity: 100 }
|
|
2679
|
-
]) : (console.warn(
|
|
2680
|
-
"Invalid gradient value in setValue, using default:",
|
|
2681
|
-
t
|
|
2682
|
-
), e = this.getDefaultGradientValue());
|
|
2683
|
-
super.setValue(e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
2684
|
-
}
|
|
2685
|
-
getDefaultGradientValue() {
|
|
2686
|
-
return this.props && this.props.default && this.isValidGradientValue(this.props.default) ? this.props.default : {
|
|
2645
|
+
getDefaultValue() {
|
|
2646
|
+
const t = this.props.default || {
|
|
2687
2647
|
type: "linear",
|
|
2688
2648
|
angle: 90,
|
|
2689
2649
|
stops: [
|
|
@@ -2691,6 +2651,30 @@ class se extends I {
|
|
|
2691
2651
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
2692
2652
|
]
|
|
2693
2653
|
};
|
|
2654
|
+
return this.normalizeGradientValue(t);
|
|
2655
|
+
}
|
|
2656
|
+
normalizeGradientValue(t) {
|
|
2657
|
+
const e = t.stops && t.stops.length > 0 ? t.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2658
|
+
return {
|
|
2659
|
+
type: t.type && ["linear", "radial", "solid"].includes(t.type) ? t.type : "linear",
|
|
2660
|
+
angle: typeof t.angle == "number" ? t.angle : 90,
|
|
2661
|
+
stops: e.map((i, s) => ({
|
|
2662
|
+
color: i.color || "#000000",
|
|
2663
|
+
position: typeof i.position == "number" ? i.position : e.length === 1 ? 0 : Math.round(s / (e.length - 1) * 100),
|
|
2664
|
+
opacity: i.opacity === void 0 || Number.isNaN(i.opacity) ? 100 : i.opacity
|
|
2665
|
+
}))
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
resolveValueFromString(t) {
|
|
2669
|
+
const e = (t || "").trim();
|
|
2670
|
+
if (!e)
|
|
2671
|
+
return null;
|
|
2672
|
+
const i = this.parseGradientCSS(e);
|
|
2673
|
+
return i ? this.normalizeGradientValue(i) : null;
|
|
2674
|
+
}
|
|
2675
|
+
setValue(t) {
|
|
2676
|
+
let e = null;
|
|
2677
|
+
typeof t == "string" ? e = this.resolveValueFromString(t) : t && (e = this.normalizeGradientValue(t)), e || (e = this.getDefaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
2694
2678
|
}
|
|
2695
2679
|
updateUI() {
|
|
2696
2680
|
if (this.previewElement && this.value)
|
|
@@ -2704,9 +2688,7 @@ class se extends I {
|
|
|
2704
2688
|
);
|
|
2705
2689
|
}
|
|
2706
2690
|
} else
|
|
2707
|
-
this.previewElement.style.background = this.generateCSS(
|
|
2708
|
-
this.getSafeValue()
|
|
2709
|
-
);
|
|
2691
|
+
this.previewElement.style.background = this.generateCSS(this.value);
|
|
2710
2692
|
this.textInputElement && this.value && !this.isUserEditing && (this.textInputElement.value = this.generateDisplayText(this.value));
|
|
2711
2693
|
}
|
|
2712
2694
|
generateDisplayText(t) {
|
|
@@ -2728,8 +2710,8 @@ class se extends I {
|
|
|
2728
2710
|
n.className = "input-label", n.textContent = this.props.title, s.appendChild(n), t.appendChild(s);
|
|
2729
2711
|
}
|
|
2730
2712
|
const e = document.createElement("div");
|
|
2731
|
-
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.
|
|
2732
|
-
this.isUserEditing = !0, this.value && (this.textInputElement.value = this.generateCSS(this.
|
|
2713
|
+
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", () => {
|
|
2714
|
+
this.isUserEditing = !0, this.value && (this.textInputElement.value = this.generateCSS(this.value));
|
|
2733
2715
|
}), this.textInputElement.addEventListener("blur", () => {
|
|
2734
2716
|
this.isUserEditing = !1, this.value && (this.textInputElement.value = this.generateDisplayText(this.value)), this.placeholderTrigger && (this.placeholderTrigger.style.display = this.textInputElement.value ? "none" : "flex");
|
|
2735
2717
|
}), this.textInputElement.addEventListener(
|
|
@@ -2739,29 +2721,21 @@ class se extends I {
|
|
|
2739
2721
|
"input",
|
|
2740
2722
|
(s) => this.handleInput(s)
|
|
2741
2723
|
), this.textInputElement.addEventListener("keydown", (s) => {
|
|
2742
|
-
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.
|
|
2724
|
+
s.key === "Enter" && (this.handleInput(s), this.textInputElement.blur()), s.key === "Escape" && (this.value && (this.textInputElement.value = this.generateCSS(this.value)), this.textInputElement.blur());
|
|
2743
2725
|
});
|
|
2744
2726
|
const i = document.createElement("div");
|
|
2745
2727
|
return i.className = "gradient-input-placeholder-trigger", i.textContent = this.textInputElement.placeholder || "", i.style.display = this.textInputElement.value ? "none" : "flex", i.addEventListener("click", (s) => {
|
|
2746
2728
|
s.stopPropagation(), this.openPopover();
|
|
2747
2729
|
}), e.appendChild(this.previewElement), e.appendChild(this.textInputElement), e.appendChild(i), this.placeholderTrigger = i, t.appendChild(e), this.createPopover(), this.element = t, t;
|
|
2748
2730
|
}
|
|
2749
|
-
isValidGradientValue(t) {
|
|
2750
|
-
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(
|
|
2751
|
-
(e) => e && typeof e.color == "string" && typeof e.position == "number"
|
|
2752
|
-
);
|
|
2753
|
-
}
|
|
2754
2731
|
generateCSS(t) {
|
|
2755
|
-
if (!t
|
|
2756
|
-
return console.warn("Invalid gradient value passed to generateCSS:", t), console.trace("Stack trace for invalid gradient value"), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2732
|
+
if (!t) return "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2757
2733
|
if (t.type === "solid") {
|
|
2758
2734
|
const i = t.stops && t.stops.length > 0 ? t.stops[0] : null;
|
|
2759
2735
|
if (!i) return "#000000";
|
|
2760
2736
|
const s = i.opacity !== void 0 ? i.opacity : 100, n = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2761
2737
|
return `#${i.color.replace("#", "")}${n}`;
|
|
2762
2738
|
}
|
|
2763
|
-
if (!t.stops || !Array.isArray(t.stops) || t.stops.length === 0)
|
|
2764
|
-
return console.warn("Invalid gradient stops in generateCSS:", t), "linear-gradient(90deg, #a84b4b 0%, #786666 100%)";
|
|
2765
2739
|
const e = t.stops.map((i) => {
|
|
2766
2740
|
const s = i.opacity !== void 0 ? i.opacity : 100;
|
|
2767
2741
|
return `${this.addOpacityToColor(i.color, s)} ${i.position}%`;
|
|
@@ -2816,7 +2790,7 @@ class se extends I {
|
|
|
2816
2790
|
const e = document.createElement("span");
|
|
2817
2791
|
e.textContent = "Fill";
|
|
2818
2792
|
const i = document.createElement("button");
|
|
2819
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
2793
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = ut, i.addEventListener("click", () => this.closePopover()), t.appendChild(e), t.appendChild(i);
|
|
2820
2794
|
const s = document.createElement("div");
|
|
2821
2795
|
s.className = "gradient-editor";
|
|
2822
2796
|
const n = this.createTypeTabs();
|
|
@@ -2863,17 +2837,83 @@ class se extends I {
|
|
|
2863
2837
|
t.innerHTML = "", this.value && (this.value.type === "solid" ? this.createSolidEditor(t) : this.createGradientEditor(t));
|
|
2864
2838
|
}
|
|
2865
2839
|
createSolidEditor(t) {
|
|
2866
|
-
var o, a, l, r, c, h;
|
|
2867
2840
|
const e = document.createElement("div");
|
|
2868
|
-
e.className = "gradient-solid-picker
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
(
|
|
2873
|
-
|
|
2874
|
-
|
|
2841
|
+
if (e.className = "gradient-solid-picker", !this.value) return;
|
|
2842
|
+
(!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
2843
|
+
let i = this.value.stops[0].color || "#000000", s = this.value.stops[0].opacity !== void 0 ? this.value.stops[0].opacity : 100;
|
|
2844
|
+
const n = () => {
|
|
2845
|
+
this.value && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
2846
|
+
{ color: i, position: 0, opacity: s }
|
|
2847
|
+
]);
|
|
2848
|
+
}, o = document.createElement("div");
|
|
2849
|
+
o.className = "gstop-row solid-row";
|
|
2850
|
+
const a = document.createElement("div");
|
|
2851
|
+
a.className = "gstop-color-container";
|
|
2852
|
+
const l = document.createElement("div");
|
|
2853
|
+
l.className = "gstop-color-preview", l.style.backgroundColor = i;
|
|
2854
|
+
const r = document.createElement("input");
|
|
2855
|
+
r.type = "text", r.className = "gstop-color-input", r.value = i.toUpperCase(), r.placeholder = "#000000";
|
|
2856
|
+
const c = document.createElement("button");
|
|
2857
|
+
c.type = "button", c.className = "gstop-color-copy", c.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2858
|
+
<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"/>
|
|
2859
|
+
</svg>`, a.appendChild(l), a.appendChild(r), a.appendChild(c), o.appendChild(a), e.appendChild(o);
|
|
2860
|
+
const h = document.createElement("div");
|
|
2861
|
+
h.className = "gstop-opacity-row";
|
|
2862
|
+
const d = document.createElement("span");
|
|
2863
|
+
d.className = "gstop-opacity-label", d.textContent = "Opacity";
|
|
2864
|
+
const C = document.createElement("div");
|
|
2865
|
+
C.className = "gstop-opacity-group";
|
|
2866
|
+
const u = document.createElement("input");
|
|
2867
|
+
u.type = "range", u.className = "gstop-opacity-slider", u.min = "0", u.max = "100", u.value = s.toString();
|
|
2868
|
+
const f = (y) => {
|
|
2869
|
+
const E = this.hexToRgb(y);
|
|
2870
|
+
u.style.setProperty(
|
|
2871
|
+
"--slider-color",
|
|
2872
|
+
`rgb(${E.r}, ${E.g}, ${E.b})`
|
|
2873
|
+
);
|
|
2874
|
+
};
|
|
2875
|
+
f(i);
|
|
2876
|
+
const v = document.createElement("span");
|
|
2877
|
+
v.className = "gstop-opacity-value", v.textContent = `${s}%`, C.appendChild(u), C.appendChild(v), h.appendChild(d), h.appendChild(C), e.appendChild(h), t.appendChild(e);
|
|
2878
|
+
const b = (y, E) => {
|
|
2879
|
+
i = y, s = Math.round(E), n(), r.value = y.toUpperCase(), l.style.backgroundColor = y, u.value = s.toString(), v.textContent = `${s}%`, f(y), this.value && this.value.stops && this.value.stops[0] && (this.value.stops[0].color = y, this.value.stops[0].opacity = s), this.updateUI(), this.triggerChange();
|
|
2880
|
+
};
|
|
2881
|
+
let m = null;
|
|
2882
|
+
const L = new ht(
|
|
2883
|
+
(y, E) => {
|
|
2884
|
+
m = null, b(y, E ?? s);
|
|
2885
|
+
},
|
|
2886
|
+
"solid"
|
|
2875
2887
|
);
|
|
2876
|
-
|
|
2888
|
+
c.addEventListener("click", async (y) => {
|
|
2889
|
+
y.stopPropagation();
|
|
2890
|
+
const E = r.value.startsWith("#") ? r.value : `#${r.value}`;
|
|
2891
|
+
try {
|
|
2892
|
+
await navigator.clipboard.writeText(E);
|
|
2893
|
+
const O = c.innerHTML;
|
|
2894
|
+
c.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2895
|
+
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2896
|
+
</svg>`, setTimeout(() => {
|
|
2897
|
+
c.innerHTML = O;
|
|
2898
|
+
}, 1e3);
|
|
2899
|
+
} catch (O) {
|
|
2900
|
+
console.warn("Failed to copy color to clipboard:", O);
|
|
2901
|
+
}
|
|
2902
|
+
});
|
|
2903
|
+
const M = () => {
|
|
2904
|
+
m && (J.addColor(m, "solid"), m = null);
|
|
2905
|
+
};
|
|
2906
|
+
r.addEventListener("click", (y) => {
|
|
2907
|
+
y.stopPropagation(), L.open(i, r, s);
|
|
2908
|
+
}), r.addEventListener("input", (y) => {
|
|
2909
|
+
const E = y.target.value.trim(), O = E.startsWith("#") ? E : `#${E}`;
|
|
2910
|
+
/^#[0-9A-Fa-f]{6}$/.test(O) && (m = O, b(O, s));
|
|
2911
|
+
}), r.addEventListener("blur", M), r.addEventListener("keydown", (y) => {
|
|
2912
|
+
y.key === "Enter" && (y.preventDefault(), M(), r.blur());
|
|
2913
|
+
}), u.addEventListener("input", (y) => {
|
|
2914
|
+
const E = parseInt(y.target.value, 10);
|
|
2915
|
+
isNaN(E) || (s = Math.max(0, Math.min(100, E)), v.textContent = `${s}%`, n(), this.value && this.value.stops && this.value.stops[0] && (this.value.stops[0].opacity = s), this.updateUI(), this.triggerChange());
|
|
2916
|
+
});
|
|
2877
2917
|
}
|
|
2878
2918
|
createEmbeddedColorPickerWithOpacity(t, e, i) {
|
|
2879
2919
|
const s = document.createElement("div");
|
|
@@ -2896,40 +2936,54 @@ class se extends I {
|
|
|
2896
2936
|
h.className = "color-picker-opacity embedded";
|
|
2897
2937
|
const d = document.createElement("div");
|
|
2898
2938
|
d.className = "color-picker-opacity-marker", h.appendChild(d);
|
|
2899
|
-
const
|
|
2900
|
-
|
|
2901
|
-
const
|
|
2902
|
-
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2907
|
-
const
|
|
2908
|
-
|
|
2909
|
-
const
|
|
2910
|
-
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2913
|
-
const
|
|
2914
|
-
|
|
2939
|
+
const C = document.createElement("div");
|
|
2940
|
+
C.className = "color-picker-format-section embedded";
|
|
2941
|
+
const u = document.createElement("select");
|
|
2942
|
+
u.className = "color-picker-format-select";
|
|
2943
|
+
const f = document.createElement("option");
|
|
2944
|
+
f.value = "hex", f.textContent = "HEX";
|
|
2945
|
+
const v = document.createElement("option");
|
|
2946
|
+
v.value = "rgb", v.textContent = "RGB";
|
|
2947
|
+
const b = document.createElement("option");
|
|
2948
|
+
b.value = "hsl", b.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(b);
|
|
2949
|
+
const m = document.createElement("input");
|
|
2950
|
+
m.type = "text", m.className = "color-picker-color-input", m.value = t;
|
|
2951
|
+
const L = document.createElement("div");
|
|
2952
|
+
L.className = "color-picker-input-container";
|
|
2953
|
+
const M = document.createElement("button");
|
|
2954
|
+
M.className = "color-picker-copy-inside", M.textContent = "Copy", L.appendChild(m), L.appendChild(M), C.appendChild(u), C.appendChild(L), s.appendChild(n), s.appendChild(a), s.appendChild(h);
|
|
2955
|
+
let y, E;
|
|
2956
|
+
const O = this.setupEmbeddedColorPicker(
|
|
2915
2957
|
n,
|
|
2916
2958
|
o,
|
|
2917
2959
|
r,
|
|
2918
2960
|
c,
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2961
|
+
u,
|
|
2962
|
+
m,
|
|
2963
|
+
M,
|
|
2922
2964
|
l,
|
|
2923
2965
|
t,
|
|
2924
2966
|
e,
|
|
2925
|
-
i
|
|
2926
|
-
|
|
2967
|
+
i,
|
|
2968
|
+
{
|
|
2969
|
+
onColorChanged: () => {
|
|
2970
|
+
E == null || E();
|
|
2971
|
+
},
|
|
2972
|
+
onColorApplied: () => {
|
|
2973
|
+
y == null || y(), E == null || E();
|
|
2974
|
+
}
|
|
2975
|
+
},
|
|
2976
|
+
"solid"
|
|
2977
|
+
), q = lt((w) => {
|
|
2978
|
+
O.applyColor(w);
|
|
2979
|
+
}, "solid");
|
|
2980
|
+
y = () => q.refresh(), s.appendChild(q.container), s.appendChild(C);
|
|
2981
|
+
const S = this.setupOpacitySlider(
|
|
2927
2982
|
h,
|
|
2928
2983
|
d,
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
), s;
|
|
2984
|
+
O
|
|
2985
|
+
);
|
|
2986
|
+
return E = () => S.refresh(), s;
|
|
2933
2987
|
}
|
|
2934
2988
|
createEmbeddedColorPicker(t, e, i) {
|
|
2935
2989
|
const s = document.createElement("div");
|
|
@@ -2952,162 +3006,192 @@ class se extends I {
|
|
|
2952
3006
|
h.className = "color-picker-format-section embedded";
|
|
2953
3007
|
const d = document.createElement("select");
|
|
2954
3008
|
d.className = "color-picker-format-select";
|
|
2955
|
-
const u = document.createElement("option");
|
|
2956
|
-
u.value = "hex", u.textContent = "HEX";
|
|
2957
|
-
const g = document.createElement("option");
|
|
2958
|
-
g.value = "rgb", g.textContent = "RGB";
|
|
2959
3009
|
const C = document.createElement("option");
|
|
2960
|
-
C.value = "
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2963
|
-
const
|
|
2964
|
-
|
|
2965
|
-
const
|
|
2966
|
-
|
|
3010
|
+
C.value = "hex", C.textContent = "HEX";
|
|
3011
|
+
const u = document.createElement("option");
|
|
3012
|
+
u.value = "rgb", u.textContent = "RGB";
|
|
3013
|
+
const f = document.createElement("option");
|
|
3014
|
+
f.value = "hsl", f.textContent = "HSL", d.appendChild(C), d.appendChild(u), d.appendChild(f);
|
|
3015
|
+
const v = document.createElement("input");
|
|
3016
|
+
v.type = "text", v.className = "color-picker-color-input", v.value = t;
|
|
3017
|
+
const b = document.createElement("div");
|
|
3018
|
+
b.className = "color-picker-input-container";
|
|
3019
|
+
const m = document.createElement("button");
|
|
3020
|
+
m.className = "color-picker-copy-inside", m.textContent = "Copy", b.appendChild(v), b.appendChild(m), h.appendChild(d), h.appendChild(b), s.appendChild(n), s.appendChild(a);
|
|
3021
|
+
let L;
|
|
3022
|
+
const M = this.setupEmbeddedColorPicker(
|
|
2967
3023
|
n,
|
|
2968
3024
|
o,
|
|
2969
3025
|
r,
|
|
2970
3026
|
c,
|
|
2971
3027
|
d,
|
|
3028
|
+
v,
|
|
2972
3029
|
m,
|
|
2973
|
-
f,
|
|
2974
3030
|
l,
|
|
2975
3031
|
t,
|
|
2976
3032
|
e,
|
|
2977
|
-
i
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
3033
|
+
i,
|
|
3034
|
+
{
|
|
3035
|
+
onColorApplied: () => {
|
|
3036
|
+
L == null || L();
|
|
3037
|
+
}
|
|
3038
|
+
},
|
|
3039
|
+
"gradient"
|
|
3040
|
+
), y = lt((E) => {
|
|
3041
|
+
M.applyColor(E);
|
|
3042
|
+
}, "gradient");
|
|
3043
|
+
return L = () => y.refresh(), s.appendChild(y.container), s.appendChild(h), s;
|
|
3044
|
+
}
|
|
3045
|
+
setupEmbeddedColorPicker(t, e, i, s, n, o, a, l, r, c, h, d, C = "gradient") {
|
|
3046
|
+
let u = r;
|
|
3047
|
+
const { h: f, s: v, v: b } = this.hexToHsv(r);
|
|
2983
3048
|
let m = c;
|
|
2984
|
-
s.style.left = `${
|
|
2985
|
-
const
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
3049
|
+
s.style.left = `${f / 360 * 100}%`, e.style.left = `${v * 100}%`, e.style.top = `${(1 - b) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`;
|
|
3050
|
+
const L = () => {
|
|
3051
|
+
var g;
|
|
3052
|
+
(g = d == null ? void 0 : d.onColorChanged) == null || g.call(d);
|
|
3053
|
+
}, M = () => {
|
|
3054
|
+
var g;
|
|
3055
|
+
J.addColor(u, C), (g = d == null ? void 0 : d.onColorApplied) == null || g.call(d);
|
|
3056
|
+
}, y = (g, x = m) => {
|
|
3057
|
+
u = g, m = Math.round(x), E(), h(g, m), L();
|
|
3058
|
+
}, E = () => {
|
|
3059
|
+
const g = n.value, { h: x, s: k, v: I } = this.hexToHsv(u);
|
|
3060
|
+
switch (g) {
|
|
2990
3061
|
case "hex":
|
|
2991
|
-
o.value =
|
|
3062
|
+
o.value = u;
|
|
2992
3063
|
break;
|
|
2993
3064
|
case "rgb":
|
|
2994
|
-
const { r:
|
|
2995
|
-
o.value = `rgb(${
|
|
3065
|
+
const { r: $, g: R, b: _ } = this.hexToRgb(u);
|
|
3066
|
+
o.value = `rgb(${$}, ${R}, ${_})`;
|
|
2996
3067
|
break;
|
|
2997
3068
|
case "hsl":
|
|
2998
|
-
const { hue:
|
|
2999
|
-
o.value = `hsl(${Math.round(
|
|
3000
|
-
|
|
3001
|
-
)}%, ${Math.round(
|
|
3069
|
+
const { hue: G, sat: Z, lightness: st } = this.hsvToHsl(x, k, I);
|
|
3070
|
+
o.value = `hsl(${Math.round(G)}, ${Math.round(
|
|
3071
|
+
Z * 100
|
|
3072
|
+
)}%, ${Math.round(st * 100)}%)`;
|
|
3002
3073
|
break;
|
|
3003
3074
|
}
|
|
3004
|
-
},
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
const
|
|
3020
|
-
|
|
3075
|
+
}, O = (g) => {
|
|
3076
|
+
if (!/^#[0-9A-Fa-f]{6}$/.test(g))
|
|
3077
|
+
return;
|
|
3078
|
+
const { h: x, s: k, v: I } = this.hexToHsv(g);
|
|
3079
|
+
s.style.left = `${x / 360 * 100}%`, e.style.left = `${k * 100}%`, e.style.top = `${(1 - I) * 100}%`, t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${x}, 100%, 50%))`, y(g, m);
|
|
3080
|
+
}, q = () => parseFloat(s.style.left || "0%") / 100 * 360, S = (g, x) => {
|
|
3081
|
+
const k = q(), I = this.hsvToHex(k, g, x);
|
|
3082
|
+
y(I, m);
|
|
3083
|
+
}, w = (g) => {
|
|
3084
|
+
g = Math.max(0.1, Math.min(358.9, g));
|
|
3085
|
+
const x = parseFloat(e.style.left || "50%") / 100, k = parseFloat(e.style.top || "50%") / 100;
|
|
3086
|
+
t.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`;
|
|
3087
|
+
const I = x, $ = 1 - k, R = this.hsvToHex(g, I, $);
|
|
3088
|
+
y(R, m);
|
|
3089
|
+
}, N = (g) => {
|
|
3090
|
+
const x = t.getBoundingClientRect(), k = Math.max(0, Math.min(1, (g.clientX - x.left) / x.width)), I = Math.max(0, Math.min(1, (g.clientY - x.top) / x.height));
|
|
3091
|
+
e.style.left = `${k * 100}%`, e.style.top = `${I * 100}%`, S(k, 1 - I);
|
|
3092
|
+
}, D = (g) => {
|
|
3093
|
+
g.preventDefault(), g.stopPropagation(), N(g);
|
|
3094
|
+
const x = (I) => N(I), k = () => {
|
|
3095
|
+
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", k), M();
|
|
3021
3096
|
};
|
|
3022
|
-
document.addEventListener("mousemove",
|
|
3023
|
-
},
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", x);
|
|
3097
|
+
document.addEventListener("mousemove", x), document.addEventListener("mouseup", k);
|
|
3098
|
+
}, A = (g) => {
|
|
3099
|
+
const x = i.getBoundingClientRect();
|
|
3100
|
+
let k = (g.clientX - x.left) / x.width;
|
|
3101
|
+
k = Math.max(1e-3, Math.min(0.998, k)), s.style.left = `${k * 100}%`;
|
|
3102
|
+
const I = k * 360;
|
|
3103
|
+
w(I);
|
|
3104
|
+
}, P = (g) => {
|
|
3105
|
+
g.preventDefault(), g.stopPropagation(), A(g);
|
|
3106
|
+
const x = (I) => A(I), k = () => {
|
|
3107
|
+
document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", k), M();
|
|
3034
3108
|
};
|
|
3035
|
-
document.addEventListener("mousemove",
|
|
3036
|
-
},
|
|
3037
|
-
const
|
|
3038
|
-
let
|
|
3039
|
-
if (
|
|
3040
|
-
|
|
3041
|
-
else if (
|
|
3042
|
-
const
|
|
3043
|
-
if (
|
|
3044
|
-
const
|
|
3045
|
-
|
|
3109
|
+
document.addEventListener("mousemove", x), document.addEventListener("mouseup", k);
|
|
3110
|
+
}, V = (g) => {
|
|
3111
|
+
const x = g.target.value, k = n.value;
|
|
3112
|
+
let I = "";
|
|
3113
|
+
if (k === "hex" && /^#[0-9A-Fa-f]{6}$/.test(x))
|
|
3114
|
+
I = x;
|
|
3115
|
+
else if (k === "rgb") {
|
|
3116
|
+
const $ = x.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3117
|
+
if ($) {
|
|
3118
|
+
const R = parseInt($[1]), _ = parseInt($[2]), G = parseInt($[3]);
|
|
3119
|
+
R <= 255 && _ <= 255 && G <= 255 && (I = `#${R.toString(16).padStart(2, "0")}${_.toString(16).padStart(2, "0")}${G.toString(16).padStart(2, "0")}`);
|
|
3046
3120
|
}
|
|
3047
|
-
} else if (
|
|
3048
|
-
const
|
|
3049
|
-
if (
|
|
3050
|
-
const
|
|
3051
|
-
if (
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3121
|
+
} else if (k === "hsl") {
|
|
3122
|
+
const $ = x.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3123
|
+
if ($) {
|
|
3124
|
+
const R = parseInt($[1]), _ = parseInt($[2]) / 100, G = parseInt($[3]) / 100;
|
|
3125
|
+
if (R <= 360 && _ <= 1 && G <= 1) {
|
|
3126
|
+
const Z = G + _ * Math.min(G, 1 - G), st = Z === 0 ? 0 : 2 * (1 - G / Z);
|
|
3127
|
+
I = this.hsvToHex(R, st, Z);
|
|
3054
3128
|
}
|
|
3055
3129
|
}
|
|
3056
3130
|
}
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
}, H = () => {
|
|
3064
|
-
f();
|
|
3065
|
-
}, S = () => {
|
|
3131
|
+
I && O(I);
|
|
3132
|
+
}, F = () => {
|
|
3133
|
+
E(), M();
|
|
3134
|
+
}, B = () => {
|
|
3135
|
+
E();
|
|
3136
|
+
}, gt = () => {
|
|
3066
3137
|
navigator.clipboard.writeText(o.value).catch(() => {
|
|
3067
3138
|
o.select(), document.execCommand("copy");
|
|
3068
3139
|
});
|
|
3069
3140
|
};
|
|
3070
|
-
|
|
3071
|
-
|
|
3141
|
+
E(), t.addEventListener("mousedown", D), t.addEventListener("click", (g) => g.stopPropagation()), i.addEventListener("mousedown", P), i.addEventListener("click", (g) => g.stopPropagation()), n.addEventListener("change", B), o.addEventListener("input", V), o.addEventListener("blur", F), o.addEventListener("keydown", (g) => {
|
|
3142
|
+
g.key === "Enter" && (g.preventDefault(), F(), o.blur());
|
|
3143
|
+
}), a.addEventListener("click", gt);
|
|
3144
|
+
const mt = async () => {
|
|
3072
3145
|
if ("EyeDropper" in window)
|
|
3073
3146
|
try {
|
|
3074
|
-
const
|
|
3075
|
-
s.style.left = `${
|
|
3076
|
-
} catch (
|
|
3077
|
-
console.log("User cancelled eyedropper or error occurred:",
|
|
3147
|
+
const k = (await new window.EyeDropper().open()).sRGBHex, { h: I, s: $, v: R } = this.hexToHsv(k);
|
|
3148
|
+
s.style.left = `${I / 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(${I}, 100%, 50%))`, y(k, m), M();
|
|
3149
|
+
} catch (g) {
|
|
3150
|
+
console.log("User cancelled eyedropper or error occurred:", g);
|
|
3078
3151
|
}
|
|
3079
3152
|
else
|
|
3080
3153
|
alert(
|
|
3081
3154
|
"EyeDropper API is not supported in this browser. Try using Chrome 95+ or Edge 95+."
|
|
3082
3155
|
);
|
|
3083
3156
|
};
|
|
3084
|
-
l.addEventListener("click",
|
|
3157
|
+
return l.addEventListener("click", mt), {
|
|
3158
|
+
applyColor: (g) => {
|
|
3159
|
+
O(g), M();
|
|
3160
|
+
},
|
|
3161
|
+
getCurrentColor: () => u,
|
|
3162
|
+
getCurrentOpacity: () => m,
|
|
3163
|
+
setOpacity: (g) => {
|
|
3164
|
+
m = Math.max(0, Math.min(100, Math.round(g))), h(u, m), L();
|
|
3165
|
+
}
|
|
3166
|
+
};
|
|
3085
3167
|
}
|
|
3086
3168
|
hsvToHex(t, e, i) {
|
|
3087
3169
|
const s = i * e, n = s * (1 - Math.abs(t / 60 % 2 - 1)), o = i - s;
|
|
3088
3170
|
let a = 0, l = 0, r = 0;
|
|
3089
3171
|
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")}`;
|
|
3090
3172
|
}
|
|
3091
|
-
setupOpacitySlider(t, e, i
|
|
3092
|
-
const
|
|
3093
|
-
const { r
|
|
3094
|
-
t.style.setProperty("--color-rgb", `${
|
|
3095
|
-
},
|
|
3096
|
-
e.style.left = `${
|
|
3173
|
+
setupOpacitySlider(t, e, i) {
|
|
3174
|
+
const s = () => {
|
|
3175
|
+
const { r, g: c, b: h } = this.hexToRgb(i.getCurrentColor());
|
|
3176
|
+
t.style.setProperty("--color-rgb", `${r}, ${c}, ${h}`);
|
|
3177
|
+
}, n = () => {
|
|
3178
|
+
e.style.left = `${i.getCurrentOpacity()}%`;
|
|
3179
|
+
}, o = () => {
|
|
3180
|
+
s(), n();
|
|
3097
3181
|
};
|
|
3098
|
-
o()
|
|
3099
|
-
let
|
|
3100
|
-
const
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3182
|
+
o();
|
|
3183
|
+
let a = !1;
|
|
3184
|
+
const l = (r) => {
|
|
3185
|
+
const c = t.getBoundingClientRect(), h = r.clientX - c.left, d = Math.max(0, Math.min(100, h / c.width * 100)), C = Math.round(d);
|
|
3186
|
+
i.setOpacity(C), n();
|
|
3103
3187
|
};
|
|
3104
|
-
t.addEventListener("mousedown", (
|
|
3105
|
-
|
|
3106
|
-
}), document.addEventListener("mousemove", (
|
|
3107
|
-
|
|
3188
|
+
return t.addEventListener("mousedown", (r) => {
|
|
3189
|
+
a = !0, l(r);
|
|
3190
|
+
}), document.addEventListener("mousemove", (r) => {
|
|
3191
|
+
a && l(r);
|
|
3108
3192
|
}), document.addEventListener("mouseup", () => {
|
|
3109
|
-
|
|
3110
|
-
});
|
|
3193
|
+
a = !1;
|
|
3194
|
+
}), { refresh: o };
|
|
3111
3195
|
}
|
|
3112
3196
|
hexToHsv(t) {
|
|
3113
3197
|
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;
|
|
@@ -3138,31 +3222,31 @@ class se extends I {
|
|
|
3138
3222
|
<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3139
3223
|
<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"/>
|
|
3140
3224
|
</svg>
|
|
3141
|
-
`, l.title = "Flip gradient", i.addEventListener("change", (
|
|
3142
|
-
const
|
|
3143
|
-
this.switchType(
|
|
3144
|
-
}), o.addEventListener("input", (
|
|
3145
|
-
const
|
|
3146
|
-
if (this.value && !isNaN(
|
|
3147
|
-
const
|
|
3148
|
-
this.value.angle =
|
|
3225
|
+
`, l.title = "Flip gradient", i.addEventListener("change", (v) => {
|
|
3226
|
+
const b = v.target.value;
|
|
3227
|
+
this.switchType(b === "radial" ? "radial" : "linear");
|
|
3228
|
+
}), o.addEventListener("input", (v) => {
|
|
3229
|
+
const b = v.target.value, m = parseInt(b);
|
|
3230
|
+
if (this.value && !isNaN(m)) {
|
|
3231
|
+
const L = Math.max(0, Math.min(360, m));
|
|
3232
|
+
this.value.angle = L, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3149
3233
|
}
|
|
3150
|
-
}), o.addEventListener("focus", (
|
|
3151
|
-
const
|
|
3152
|
-
|
|
3153
|
-
}), o.addEventListener("blur", (
|
|
3154
|
-
var
|
|
3155
|
-
const
|
|
3156
|
-
let
|
|
3157
|
-
isNaN(
|
|
3234
|
+
}), o.addEventListener("focus", (v) => {
|
|
3235
|
+
const b = v.target;
|
|
3236
|
+
b.value = b.value.replace(/[^0-9-]/g, ""), setTimeout(() => b.select(), 0);
|
|
3237
|
+
}), o.addEventListener("blur", (v) => {
|
|
3238
|
+
var L;
|
|
3239
|
+
const b = v.target;
|
|
3240
|
+
let m = parseInt(b.value);
|
|
3241
|
+
isNaN(m) && (m = ((L = this.value) == null ? void 0 : L.angle) ?? 0), m = Math.max(0, Math.min(360, m)), this.value && (this.value.angle = m), b.value = `${m}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3158
3242
|
}), l.addEventListener("click", () => {
|
|
3159
|
-
this.value && (this.value.stops = this.value.stops.map((
|
|
3160
|
-
...
|
|
3161
|
-
position: 100 -
|
|
3243
|
+
this.value && (this.value.stops = this.value.stops.map((v) => ({
|
|
3244
|
+
...v,
|
|
3245
|
+
position: 100 - v.position
|
|
3162
3246
|
})), this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3163
3247
|
}), e.appendChild(i), e.appendChild(o), e.appendChild(l), t.appendChild(e), (() => {
|
|
3164
|
-
var
|
|
3165
|
-
((
|
|
3248
|
+
var v;
|
|
3249
|
+
((v = this.value) == null ? void 0 : v.type) === "radial" ? (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "1");
|
|
3166
3250
|
})();
|
|
3167
3251
|
const c = document.createElement("div");
|
|
3168
3252
|
c.className = "gradient-preview", this.updateGradientPreview(c);
|
|
@@ -3170,19 +3254,19 @@ class se extends I {
|
|
|
3170
3254
|
h.className = "gradient-handles", this.createGradientHandles(h, c), c.appendChild(h), t.appendChild(c);
|
|
3171
3255
|
const d = document.createElement("div");
|
|
3172
3256
|
d.className = "gradient-stops-header";
|
|
3173
|
-
const
|
|
3174
|
-
|
|
3175
|
-
const
|
|
3176
|
-
|
|
3177
|
-
const
|
|
3178
|
-
|
|
3179
|
-
this.addGradientStop(), this.updateStopsList(
|
|
3257
|
+
const C = document.createElement("span");
|
|
3258
|
+
C.textContent = "Stops";
|
|
3259
|
+
const u = document.createElement("button");
|
|
3260
|
+
u.type = "button", u.className = "gradient-add-stop", u.textContent = "+", d.appendChild(C), d.appendChild(u);
|
|
3261
|
+
const f = document.createElement("div");
|
|
3262
|
+
f.className = "gradient-stops", t.appendChild(d), t.appendChild(f), this.updateStopsList(f), u.addEventListener("click", () => {
|
|
3263
|
+
this.addGradientStop(), this.updateStopsList(f), this.updateGradientPreview(c), this.createGradientHandles(h, c), this.updateUI();
|
|
3180
3264
|
});
|
|
3181
3265
|
}
|
|
3182
3266
|
updateGradientPreview(t) {
|
|
3183
3267
|
var i;
|
|
3184
3268
|
const e = t || ((i = this.popoverElement) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3185
|
-
e && this.value && (e.style.background = this.generateCSS(this.
|
|
3269
|
+
e && this.value && (e.style.background = this.generateCSS(this.value));
|
|
3186
3270
|
}
|
|
3187
3271
|
createGradientHandles(t, e) {
|
|
3188
3272
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
@@ -3195,16 +3279,16 @@ class se extends I {
|
|
|
3195
3279
|
makeDraggable(t, e, i) {
|
|
3196
3280
|
let s = !1, n = 0, o = 0, a = null;
|
|
3197
3281
|
const l = (d) => "touches" in d && d.touches.length > 0 ? d.touches[0].clientX : d.clientX, r = (d) => {
|
|
3198
|
-
var
|
|
3199
|
-
s = !0, n = l(d), o = ((
|
|
3282
|
+
var C, u, f;
|
|
3283
|
+
s = !0, n = l(d), o = ((f = (u = (C = this.value) == null ? void 0 : C.stops) == null ? void 0 : u[i]) == null ? void 0 : f.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, {
|
|
3200
3284
|
passive: !1
|
|
3201
3285
|
}), document.addEventListener("touchend", h), d.preventDefault();
|
|
3202
3286
|
}, c = (d) => {
|
|
3203
|
-
var
|
|
3204
|
-
if (!s || !((
|
|
3205
|
-
const
|
|
3206
|
-
let
|
|
3207
|
-
|
|
3287
|
+
var b, m;
|
|
3288
|
+
if (!s || !((m = (b = this.value) == null ? void 0 : b.stops) != null && m[i])) return;
|
|
3289
|
+
const C = e.getBoundingClientRect(), f = (l(d) - n) / C.width * 100;
|
|
3290
|
+
let v = o + f;
|
|
3291
|
+
v = Math.max(0, Math.min(100, v)), this.value.stops[i].position = Math.round(v), t.style.left = `${v}%`, a && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
3208
3292
|
this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), a = null;
|
|
3209
3293
|
}), d.preventDefault();
|
|
3210
3294
|
}, h = () => {
|
|
@@ -3218,7 +3302,7 @@ class se extends I {
|
|
|
3218
3302
|
var i;
|
|
3219
3303
|
const e = t || ((i = this.popoverElement) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3220
3304
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3221
|
-
var
|
|
3305
|
+
var O, q;
|
|
3222
3306
|
const o = document.createElement("div");
|
|
3223
3307
|
o.className = "gstop-row";
|
|
3224
3308
|
const a = document.createElement("div");
|
|
@@ -3235,130 +3319,138 @@ class se extends I {
|
|
|
3235
3319
|
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">
|
|
3236
3320
|
<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"/>
|
|
3237
3321
|
</svg>`, r.appendChild(c), r.appendChild(h), r.appendChild(d);
|
|
3238
|
-
const
|
|
3239
|
-
|
|
3322
|
+
const C = document.createElement("button");
|
|
3323
|
+
C.type = "button", C.className = "gstop-del", C.innerHTML = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3240
3324
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3241
|
-
</svg>`,
|
|
3242
|
-
var
|
|
3243
|
-
const
|
|
3244
|
-
if (this.value && !isNaN(
|
|
3245
|
-
const
|
|
3246
|
-
this.value.stops[n].position =
|
|
3247
|
-
const
|
|
3325
|
+
</svg>`, C.disabled = (((q = (O = this.value) == null ? void 0 : O.stops) == null ? void 0 : q.length) || 0) <= 2, l.addEventListener("input", (S) => {
|
|
3326
|
+
var A;
|
|
3327
|
+
const w = S.target, N = w.value.replace(/[^\d]/g, ""), D = parseInt(N);
|
|
3328
|
+
if (this.value && !isNaN(D)) {
|
|
3329
|
+
const P = Math.max(0, Math.min(100, D));
|
|
3330
|
+
this.value.stops[n].position = P, w.value = `${P}%`;
|
|
3331
|
+
const V = (A = this.popoverElement) == null ? void 0 : A.querySelector(
|
|
3248
3332
|
".gradient-preview"
|
|
3249
|
-
),
|
|
3333
|
+
), F = V == null ? void 0 : V.querySelector(
|
|
3250
3334
|
".gradient-handles"
|
|
3251
3335
|
);
|
|
3252
|
-
|
|
3336
|
+
V && F && this.createGradientHandles(F, V), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3253
3337
|
}
|
|
3254
|
-
}), l.addEventListener("focus", (
|
|
3255
|
-
const
|
|
3256
|
-
|
|
3257
|
-
}), l.addEventListener("blur", (
|
|
3258
|
-
var
|
|
3259
|
-
const
|
|
3260
|
-
if (isNaN(
|
|
3261
|
-
|
|
3338
|
+
}), l.addEventListener("focus", (S) => {
|
|
3339
|
+
const w = S.target, N = w.value.replace("%", "");
|
|
3340
|
+
w.value = N, w.select();
|
|
3341
|
+
}), l.addEventListener("blur", (S) => {
|
|
3342
|
+
var A, P;
|
|
3343
|
+
const w = S.target, N = w.value.replace(/[^\d]/g, ""), D = parseInt(N);
|
|
3344
|
+
if (isNaN(D))
|
|
3345
|
+
w.value = `${((P = (A = this.value) == null ? void 0 : A.stops[n]) == null ? void 0 : P.position) || 0}%`;
|
|
3262
3346
|
else {
|
|
3263
|
-
const
|
|
3264
|
-
|
|
3347
|
+
const V = Math.max(0, Math.min(100, D));
|
|
3348
|
+
w.value = `${V}%`, this.value && (this.value.stops[n].position = V, this.updateGradientPreview(), this.updateUI(), this.triggerChange());
|
|
3265
3349
|
}
|
|
3266
3350
|
});
|
|
3267
|
-
const
|
|
3268
|
-
(
|
|
3269
|
-
var
|
|
3270
|
-
if (h.value =
|
|
3271
|
-
this.value.stops[n].color =
|
|
3272
|
-
const
|
|
3351
|
+
const u = new ht(
|
|
3352
|
+
(S, w) => {
|
|
3353
|
+
var N, D, A;
|
|
3354
|
+
if (h.value = S.replace("#", "").toUpperCase(), c.style.backgroundColor = S, f = null, this.value) {
|
|
3355
|
+
this.value.stops[n].color = S, w !== void 0 && (this.value.stops[n].opacity = w);
|
|
3356
|
+
const P = (N = o.parentElement) == null ? void 0 : N.querySelector(
|
|
3273
3357
|
".gstop-opacity-slider"
|
|
3274
3358
|
);
|
|
3275
|
-
if (
|
|
3276
|
-
const
|
|
3277
|
-
|
|
3359
|
+
if (P) {
|
|
3360
|
+
const B = this.hexToRgb(S);
|
|
3361
|
+
P.style.setProperty(
|
|
3278
3362
|
"--slider-color",
|
|
3279
|
-
`rgb(${
|
|
3363
|
+
`rgb(${B.r}, ${B.g}, ${B.b})`
|
|
3280
3364
|
);
|
|
3281
3365
|
}
|
|
3282
|
-
if (
|
|
3283
|
-
const
|
|
3366
|
+
if (w !== void 0) {
|
|
3367
|
+
const B = (D = o.parentElement) == null ? void 0 : D.querySelector(
|
|
3284
3368
|
".gstop-opacity-value"
|
|
3285
3369
|
);
|
|
3286
|
-
|
|
3370
|
+
B && (B.textContent = `${w}%`), P && (P.value = w.toString());
|
|
3287
3371
|
}
|
|
3288
|
-
const
|
|
3372
|
+
const V = (A = this.popoverElement) == null ? void 0 : A.querySelector(
|
|
3289
3373
|
".gradient-preview"
|
|
3290
|
-
),
|
|
3374
|
+
), F = V == null ? void 0 : V.querySelector(
|
|
3291
3375
|
".gradient-handles"
|
|
3292
3376
|
);
|
|
3293
|
-
|
|
3377
|
+
V && F && this.createGradientHandles(F, V), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3294
3378
|
}
|
|
3295
|
-
}
|
|
3379
|
+
},
|
|
3380
|
+
"gradient"
|
|
3296
3381
|
);
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3382
|
+
let f = null;
|
|
3383
|
+
h.addEventListener("click", (S) => {
|
|
3384
|
+
S.stopPropagation(), u.open(s.color, h, s.opacity || 100);
|
|
3385
|
+
}), h.addEventListener("input", (S) => {
|
|
3386
|
+
var D, A;
|
|
3387
|
+
const w = S.target.value.trim(), N = w.startsWith("#") ? w : `#${w}`;
|
|
3388
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(N) && (c.style.backgroundColor = N, this.value)) {
|
|
3389
|
+
this.value.stops[n].color = N, f = N;
|
|
3390
|
+
const P = (D = o.parentElement) == null ? void 0 : D.querySelector(
|
|
3305
3391
|
".gstop-opacity-slider"
|
|
3306
3392
|
);
|
|
3307
|
-
if (
|
|
3308
|
-
const
|
|
3309
|
-
|
|
3393
|
+
if (P) {
|
|
3394
|
+
const B = this.hexToRgb(N);
|
|
3395
|
+
P.style.setProperty(
|
|
3310
3396
|
"--slider-color",
|
|
3311
|
-
`rgb(${
|
|
3397
|
+
`rgb(${B.r}, ${B.g}, ${B.b})`
|
|
3312
3398
|
);
|
|
3313
3399
|
}
|
|
3314
|
-
const
|
|
3400
|
+
const V = (A = this.popoverElement) == null ? void 0 : A.querySelector(
|
|
3315
3401
|
".gradient-preview"
|
|
3316
|
-
),
|
|
3402
|
+
), F = V == null ? void 0 : V.querySelector(
|
|
3317
3403
|
".gradient-handles"
|
|
3318
3404
|
);
|
|
3319
|
-
|
|
3405
|
+
V && F && this.createGradientHandles(F, V), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3320
3406
|
}
|
|
3321
|
-
})
|
|
3322
|
-
|
|
3323
|
-
|
|
3407
|
+
});
|
|
3408
|
+
const v = () => {
|
|
3409
|
+
f && (J.addColor(f, "gradient"), f = null);
|
|
3410
|
+
};
|
|
3411
|
+
h.addEventListener("blur", v), h.addEventListener("keydown", (S) => {
|
|
3412
|
+
S.key === "Enter" && (S.preventDefault(), v(), h.blur());
|
|
3413
|
+
}), d.addEventListener("click", async (S) => {
|
|
3414
|
+
S.stopPropagation();
|
|
3415
|
+
const w = `#${h.value}`;
|
|
3324
3416
|
try {
|
|
3325
|
-
await navigator.clipboard.writeText(
|
|
3326
|
-
const
|
|
3417
|
+
await navigator.clipboard.writeText(w);
|
|
3418
|
+
const N = d.innerHTML;
|
|
3327
3419
|
d.innerHTML = `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3328
3420
|
<path d="M9.3335 14L12.2502 16.9167L18.6668 10.5" stroke="#00A76F" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3329
3421
|
</svg>`, setTimeout(() => {
|
|
3330
|
-
d.innerHTML =
|
|
3422
|
+
d.innerHTML = N;
|
|
3331
3423
|
}, 1e3);
|
|
3332
|
-
} catch (
|
|
3333
|
-
console.warn("Failed to copy color to clipboard:",
|
|
3424
|
+
} catch (N) {
|
|
3425
|
+
console.warn("Failed to copy color to clipboard:", N);
|
|
3334
3426
|
}
|
|
3335
|
-
}),
|
|
3336
|
-
var
|
|
3427
|
+
}), C.addEventListener("click", () => {
|
|
3428
|
+
var S;
|
|
3337
3429
|
if (this.value && this.value.stops.length > 2) {
|
|
3338
3430
|
this.value.stops.splice(n, 1);
|
|
3339
|
-
const
|
|
3431
|
+
const w = (S = this.popoverElement) == null ? void 0 : S.querySelector(
|
|
3340
3432
|
".gradient-preview"
|
|
3341
|
-
),
|
|
3433
|
+
), N = w == null ? void 0 : w.querySelector(
|
|
3342
3434
|
".gradient-handles"
|
|
3343
3435
|
);
|
|
3344
|
-
|
|
3436
|
+
w && N && this.createGradientHandles(N, w), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3345
3437
|
}
|
|
3346
|
-
}), o.appendChild(a), o.appendChild(r), o.appendChild(
|
|
3347
|
-
const
|
|
3348
|
-
|
|
3438
|
+
}), o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
|
|
3439
|
+
const b = document.createElement("div");
|
|
3440
|
+
b.className = "gstop-opacity-row";
|
|
3349
3441
|
const m = document.createElement("span");
|
|
3350
3442
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3351
|
-
const
|
|
3352
|
-
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3355
|
-
const
|
|
3356
|
-
|
|
3443
|
+
const L = document.createElement("div");
|
|
3444
|
+
L.className = "gstop-opacity-group";
|
|
3445
|
+
const M = document.createElement("input");
|
|
3446
|
+
M.type = "range", M.className = "gstop-opacity-slider", M.min = "0", M.max = "100", M.value = (s.opacity !== void 0 ? s.opacity : 100).toString();
|
|
3447
|
+
const y = this.hexToRgb(s.color);
|
|
3448
|
+
M.style.setProperty(
|
|
3357
3449
|
"--slider-color",
|
|
3358
|
-
`rgb(${
|
|
3450
|
+
`rgb(${y.r}, ${y.g}, ${y.b})`
|
|
3359
3451
|
);
|
|
3360
|
-
const
|
|
3361
|
-
|
|
3452
|
+
const E = document.createElement("span");
|
|
3453
|
+
E.className = "gstop-opacity-value", E.textContent = `${s.opacity !== void 0 ? s.opacity : 100}%`;
|
|
3362
3454
|
}));
|
|
3363
3455
|
}
|
|
3364
3456
|
addGradientStop() {
|
|
@@ -3610,57 +3702,49 @@ class se extends I {
|
|
|
3610
3702
|
return this.element;
|
|
3611
3703
|
}
|
|
3612
3704
|
getValue() {
|
|
3613
|
-
return this.value ? this.
|
|
3614
|
-
|
|
3615
|
-
getCSSValue() {
|
|
3616
|
-
return this.value ? this.generateCSS(this.getSafeValue()) : "";
|
|
3617
|
-
}
|
|
3618
|
-
// Method to get CSS properties object for text gradients
|
|
3619
|
-
getTextCSSProperties() {
|
|
3620
|
-
if (!this.value) return {};
|
|
3621
|
-
const t = this.generateCSS(this.getSafeValue());
|
|
3622
|
-
return t.includes("gradient") ? {
|
|
3623
|
-
background: t,
|
|
3705
|
+
return this.value ? this.forText ? {
|
|
3706
|
+
background: this.generateCSS(this.value),
|
|
3624
3707
|
"-webkit-background-clip": "text",
|
|
3625
3708
|
"background-clip": "text",
|
|
3626
3709
|
color: "transparent",
|
|
3627
3710
|
"-webkit-text-fill-color": "transparent"
|
|
3628
|
-
} : {
|
|
3629
|
-
|
|
3630
|
-
|
|
3711
|
+
} : this.generateCSS(this.value) : this.forText ? {} : "";
|
|
3712
|
+
}
|
|
3713
|
+
getCSSValue() {
|
|
3714
|
+
return this.value ? this.generateCSS(this.value) : "";
|
|
3631
3715
|
}
|
|
3632
3716
|
// Add method to get the raw object value if needed
|
|
3633
3717
|
getRawValue() {
|
|
3634
3718
|
return this.value;
|
|
3635
3719
|
}
|
|
3636
3720
|
}
|
|
3637
|
-
const
|
|
3721
|
+
const Gt = `
|
|
3638
3722
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3639
3723
|
<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"/>
|
|
3640
3724
|
</svg>
|
|
3641
|
-
`,
|
|
3725
|
+
`, Wt = `
|
|
3642
3726
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3643
3727
|
<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"/>
|
|
3644
3728
|
</svg>
|
|
3645
3729
|
`;
|
|
3646
|
-
class
|
|
3730
|
+
class de extends U {
|
|
3647
3731
|
constructor(t) {
|
|
3648
3732
|
super({
|
|
3649
3733
|
title: "Border",
|
|
3650
3734
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3651
3735
|
settings: {
|
|
3652
|
-
size: new
|
|
3736
|
+
size: new z({
|
|
3653
3737
|
title: "Size",
|
|
3654
|
-
icon:
|
|
3738
|
+
icon: Wt,
|
|
3655
3739
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3656
3740
|
suffix: "px"
|
|
3657
3741
|
}),
|
|
3658
|
-
color: new
|
|
3742
|
+
color: new j({
|
|
3659
3743
|
default: (t == null ? void 0 : t.color) ?? "0, 0, 30"
|
|
3660
3744
|
}),
|
|
3661
|
-
radius: new
|
|
3745
|
+
radius: new z({
|
|
3662
3746
|
title: "Radius",
|
|
3663
|
-
icon:
|
|
3747
|
+
icon: Gt,
|
|
3664
3748
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3665
3749
|
suffix: "px"
|
|
3666
3750
|
})
|
|
@@ -3679,20 +3763,20 @@ class ne extends z {
|
|
|
3679
3763
|
`;
|
|
3680
3764
|
}
|
|
3681
3765
|
}
|
|
3682
|
-
const
|
|
3766
|
+
const zt = `
|
|
3683
3767
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3684
3768
|
<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"/>
|
|
3685
3769
|
</svg>
|
|
3686
|
-
`,
|
|
3770
|
+
`, Ut = `
|
|
3687
3771
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3688
3772
|
<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"/>
|
|
3689
3773
|
</svg>
|
|
3690
|
-
`,
|
|
3774
|
+
`, jt = `
|
|
3691
3775
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3692
3776
|
<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"/>
|
|
3693
3777
|
</svg>
|
|
3694
3778
|
`;
|
|
3695
|
-
class
|
|
3779
|
+
class pe extends U {
|
|
3696
3780
|
constructor(t = {}) {
|
|
3697
3781
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3698
3782
|
super({
|
|
@@ -3700,12 +3784,12 @@ class oe extends z {
|
|
|
3700
3784
|
collapsed: i.collapsed,
|
|
3701
3785
|
settings: (() => {
|
|
3702
3786
|
const s = {
|
|
3703
|
-
color: new
|
|
3787
|
+
color: new j({
|
|
3704
3788
|
default: i.colorDefault ?? "0, 0, 30"
|
|
3705
3789
|
}),
|
|
3706
|
-
fontFamily: new
|
|
3790
|
+
fontFamily: new at({
|
|
3707
3791
|
title: "Font",
|
|
3708
|
-
icon:
|
|
3792
|
+
icon: zt,
|
|
3709
3793
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3710
3794
|
options: i.fontFamilyOptions ?? [
|
|
3711
3795
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3716,9 +3800,9 @@ class oe extends z {
|
|
|
3716
3800
|
getOptions: i.fontFamilyGetOptions,
|
|
3717
3801
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3718
3802
|
}),
|
|
3719
|
-
fontWeight: new
|
|
3803
|
+
fontWeight: new at({
|
|
3720
3804
|
title: "Weight",
|
|
3721
|
-
icon:
|
|
3805
|
+
icon: Ut,
|
|
3722
3806
|
default: i.fontWeightDefault ?? "400",
|
|
3723
3807
|
options: i.fontWeightOptions ?? [
|
|
3724
3808
|
{ name: "Regular", value: "400" },
|
|
@@ -3728,9 +3812,9 @@ class oe extends z {
|
|
|
3728
3812
|
getOptions: i.fontWeightGetOptions,
|
|
3729
3813
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3730
3814
|
}),
|
|
3731
|
-
fontSize: new
|
|
3815
|
+
fontSize: new z({
|
|
3732
3816
|
title: "Size",
|
|
3733
|
-
icon:
|
|
3817
|
+
icon: jt,
|
|
3734
3818
|
default: i.fontSizeDefault ?? 12,
|
|
3735
3819
|
suffix: "px",
|
|
3736
3820
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3738,7 +3822,7 @@ class oe extends z {
|
|
|
3738
3822
|
};
|
|
3739
3823
|
return e ? {
|
|
3740
3824
|
...s,
|
|
3741
|
-
align: new
|
|
3825
|
+
align: new Nt({
|
|
3742
3826
|
title: "Align",
|
|
3743
3827
|
default: i.alignDefault ?? "center"
|
|
3744
3828
|
})
|
|
@@ -3758,7 +3842,7 @@ class oe extends z {
|
|
|
3758
3842
|
`;
|
|
3759
3843
|
}
|
|
3760
3844
|
}
|
|
3761
|
-
class
|
|
3845
|
+
class Q extends T {
|
|
3762
3846
|
constructor(t) {
|
|
3763
3847
|
super({
|
|
3764
3848
|
...t,
|
|
@@ -3804,33 +3888,33 @@ class J extends I {
|
|
|
3804
3888
|
}), i;
|
|
3805
3889
|
}
|
|
3806
3890
|
}
|
|
3807
|
-
class
|
|
3891
|
+
class ue extends U {
|
|
3808
3892
|
constructor(t) {
|
|
3809
3893
|
super({
|
|
3810
3894
|
title: "Margins",
|
|
3811
3895
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3812
3896
|
settings: {
|
|
3813
|
-
marginTop: new
|
|
3897
|
+
marginTop: new Q({
|
|
3814
3898
|
title: "Top",
|
|
3815
|
-
icon:
|
|
3899
|
+
icon: qt,
|
|
3816
3900
|
suffix: "px",
|
|
3817
3901
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3818
3902
|
}),
|
|
3819
|
-
marginRight: new
|
|
3903
|
+
marginRight: new Q({
|
|
3820
3904
|
title: "Right",
|
|
3821
|
-
icon:
|
|
3905
|
+
icon: _t,
|
|
3822
3906
|
suffix: "px",
|
|
3823
3907
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3824
3908
|
}),
|
|
3825
|
-
marginBottom: new
|
|
3909
|
+
marginBottom: new Q({
|
|
3826
3910
|
title: "Bottom",
|
|
3827
|
-
icon:
|
|
3911
|
+
icon: Jt,
|
|
3828
3912
|
suffix: "px",
|
|
3829
3913
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3830
3914
|
}),
|
|
3831
|
-
marginLeft: new
|
|
3915
|
+
marginLeft: new Q({
|
|
3832
3916
|
title: "Left",
|
|
3833
|
-
icon:
|
|
3917
|
+
icon: Xt,
|
|
3834
3918
|
suffix: "px",
|
|
3835
3919
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
3836
3920
|
})
|
|
@@ -3847,29 +3931,29 @@ class ae extends z {
|
|
|
3847
3931
|
`;
|
|
3848
3932
|
}
|
|
3849
3933
|
}
|
|
3850
|
-
const
|
|
3934
|
+
const qt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3851
3935
|
<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"/>
|
|
3852
|
-
</svg>`,
|
|
3936
|
+
</svg>`, _t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3853
3937
|
<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"/>
|
|
3854
|
-
</svg>`,
|
|
3938
|
+
</svg>`, Jt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3855
3939
|
<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"/>
|
|
3856
|
-
</svg>`,
|
|
3940
|
+
</svg>`, Xt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3857
3941
|
<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"/>
|
|
3858
3942
|
</svg>`;
|
|
3859
|
-
class
|
|
3943
|
+
class ge extends U {
|
|
3860
3944
|
constructor(t) {
|
|
3861
3945
|
super({
|
|
3862
3946
|
title: "Background Image",
|
|
3863
3947
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3864
3948
|
settings: {
|
|
3865
|
-
backgroundImage: new
|
|
3949
|
+
backgroundImage: new pt({
|
|
3866
3950
|
...t == null ? void 0 : t.uploadProps,
|
|
3867
3951
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3868
3952
|
}),
|
|
3869
|
-
opacity: new
|
|
3953
|
+
opacity: new St({
|
|
3870
3954
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3871
3955
|
}),
|
|
3872
|
-
backgroundColor: new
|
|
3956
|
+
backgroundColor: new j({
|
|
3873
3957
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
3874
3958
|
})
|
|
3875
3959
|
}
|
|
@@ -3896,40 +3980,40 @@ class le extends z {
|
|
|
3896
3980
|
}
|
|
3897
3981
|
}
|
|
3898
3982
|
export {
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3983
|
+
Nt as AlignSetting,
|
|
3984
|
+
ce as AnimationSetting,
|
|
3985
|
+
ge as BackgroundSettingSet,
|
|
3986
|
+
de as BorderSettingSet,
|
|
3987
|
+
Qt as ButtonSetting,
|
|
3988
|
+
W as ColorSetting,
|
|
3989
|
+
j as ColorWithOpacitySetting,
|
|
3990
|
+
te as DimensionSetting,
|
|
3991
|
+
oe as GapSetting,
|
|
3992
|
+
he as GradientSetting,
|
|
3993
|
+
pe as HeaderTypographySettingSet,
|
|
3994
|
+
ee as HeightSetting,
|
|
3995
|
+
Kt as HtmlSetting,
|
|
3996
|
+
ae as MarginBottomSetting,
|
|
3997
|
+
ue as MarginSettingGroup,
|
|
3998
|
+
le as MarginTopSetting,
|
|
3999
|
+
re as MultiLanguageSetting,
|
|
4000
|
+
z as NumberSetting,
|
|
4001
|
+
St as OpacitySetting,
|
|
4002
|
+
se as SelectApiSettings,
|
|
4003
|
+
at as SelectSetting,
|
|
4004
|
+
T as Setting,
|
|
4005
|
+
U as SettingGroup,
|
|
4006
|
+
xt as StringSetting,
|
|
4007
|
+
bt as TabSettingGroup,
|
|
4008
|
+
bt as TabsSettingGroup,
|
|
4009
|
+
ne as Toggle,
|
|
4010
|
+
pt as UploadSetting,
|
|
4011
|
+
ie as WidthSetting,
|
|
4012
|
+
Yt as asSettingGroupWithSettings,
|
|
4013
|
+
wt as createSettingGroup,
|
|
4014
|
+
Zt as createTabSettingGroup,
|
|
4015
|
+
X as isSetting,
|
|
4016
|
+
ct as isSettingChild,
|
|
4017
|
+
H as isSettingGroup,
|
|
4018
|
+
K as iterateSettings
|
|
3935
4019
|
};
|