builder-settings-types 0.0.311 → 0.0.313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +50 -50
- package/dist/builder-settings-types.es.js +940 -815
- package/dist/groups/image-setting-set/imageSettingSet.d.ts +21 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/settings/gradient-settings/GradientSetting.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const yt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let pt = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += yt[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function bt(c) {
|
|
9
|
+
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function _(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function tt(c, t = 0) {
|
|
19
|
+
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
_(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const Et = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class wt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...Et, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class bt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = bt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class bt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
114
|
+
const at = new wt();
|
|
115
|
+
function X(c) {
|
|
116
|
+
if (c === null || typeof c != "object") return c;
|
|
117
|
+
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
+
if (c instanceof Array) return c.map((t) => X(t));
|
|
119
|
+
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in c)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = X(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return c;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function xt(c) {
|
|
128
|
+
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,18 +142,18 @@ function Et(h) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const G = class G {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || pt(), 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, G.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, G.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
static SetGlobalVariables(t) {
|
|
156
|
-
|
|
156
|
+
G.GlobalVariables = { ...G.GlobalVariables, ...t };
|
|
157
157
|
}
|
|
158
158
|
destroy() {
|
|
159
159
|
throw new Error("Method not implemented.");
|
|
@@ -174,8 +174,8 @@ const B = class B {
|
|
|
174
174
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
175
175
|
}
|
|
176
176
|
clone() {
|
|
177
|
-
const t = this.constructor, e =
|
|
178
|
-
return i.value =
|
|
177
|
+
const t = this.constructor, e = X(this.props), i = new t(e);
|
|
178
|
+
return i.value = X(this.value), i;
|
|
179
179
|
}
|
|
180
180
|
createInput(t) {
|
|
181
181
|
t = { ...this.props.inputProps, ...t };
|
|
@@ -195,7 +195,7 @@ const B = class B {
|
|
|
195
195
|
const i = document.createElement("div");
|
|
196
196
|
i.className = t.wrapperClassName || "";
|
|
197
197
|
const s = document.createElement("input");
|
|
198
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
198
|
+
this.inputEl = s, s.value = String(t.value || xt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
199
199
|
const n = (o) => {
|
|
200
200
|
const l = o.target;
|
|
201
201
|
let r = l.value;
|
|
@@ -236,7 +236,7 @@ const B = class B {
|
|
|
236
236
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
G.GlobalVariables = {
|
|
240
240
|
// Global Colors (each supports solid OR gradient)
|
|
241
241
|
primary: "#00141E",
|
|
242
242
|
secondary: "#00141E",
|
|
@@ -246,31 +246,31 @@ B.GlobalVariables = {
|
|
|
246
246
|
"text-dark": "#00141E",
|
|
247
247
|
"text-light": "#00141E"
|
|
248
248
|
};
|
|
249
|
-
let x =
|
|
250
|
-
function A(
|
|
251
|
-
return
|
|
249
|
+
let x = G;
|
|
250
|
+
function A(c) {
|
|
251
|
+
return c instanceof x;
|
|
252
252
|
}
|
|
253
|
-
function L(
|
|
254
|
-
return
|
|
253
|
+
function L(c) {
|
|
254
|
+
return c instanceof T;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return A(
|
|
256
|
+
function lt(c) {
|
|
257
|
+
return A(c) || L(c);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
for (const e in
|
|
261
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
262
|
-
const i =
|
|
259
|
+
function j(c, t) {
|
|
260
|
+
for (const e in c)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
262
|
+
const i = c[e];
|
|
263
263
|
t(e, i);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const Y = class Y {
|
|
267
267
|
constructor(t) {
|
|
268
268
|
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 = () => {
|
|
269
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id ||
|
|
269
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || pt(), 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();
|
|
270
270
|
}
|
|
271
271
|
propagateNestingLevel() {
|
|
272
272
|
const t = this.nestingLevel + 1;
|
|
273
|
-
|
|
273
|
+
j(this.settings, (e, i) => {
|
|
274
274
|
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
275
275
|
});
|
|
276
276
|
}
|
|
@@ -287,13 +287,13 @@ const K = class K {
|
|
|
287
287
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
288
288
|
}
|
|
289
289
|
propagateDataPropsPath() {
|
|
290
|
-
|
|
290
|
+
j(this.settings, (t, e) => {
|
|
291
291
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
292
292
|
(L(e) || A(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
updateNestingStyles() {
|
|
296
|
-
this.elementRef && (
|
|
296
|
+
this.elementRef && (_(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
|
|
297
297
|
}
|
|
298
298
|
forceChildUIRefresh() {
|
|
299
299
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -360,11 +360,11 @@ const K = class K {
|
|
|
360
360
|
var p;
|
|
361
361
|
const l = t[o], r = this.settings[o];
|
|
362
362
|
if (r !== l && (r && this.removeSetting(o), this.addSetting(o, l), o in s)) {
|
|
363
|
-
const
|
|
363
|
+
const h = s[o];
|
|
364
364
|
try {
|
|
365
365
|
L(l) ? l.setValue(
|
|
366
|
-
|
|
367
|
-
) : A(l) ? (p = l.setValue) == null || p.call(l,
|
|
366
|
+
h
|
|
367
|
+
) : A(l) ? (p = l.setValue) == null || p.call(l, h) : l.setValue && l.setValue(h);
|
|
368
368
|
} catch (d) {
|
|
369
369
|
console.warn(`Could not preserve value for setting ${o}:`, d);
|
|
370
370
|
}
|
|
@@ -375,7 +375,7 @@ const K = class K {
|
|
|
375
375
|
}
|
|
376
376
|
clone() {
|
|
377
377
|
const t = {};
|
|
378
|
-
|
|
378
|
+
j(this.settings, (s, n) => {
|
|
379
379
|
const a = String(s);
|
|
380
380
|
typeof n.clone == "function" ? t[a] = n.clone() : (console.warn(
|
|
381
381
|
`Setting with key '${a}' does not have a clone method. Copying reference.`
|
|
@@ -392,7 +392,7 @@ const K = class K {
|
|
|
392
392
|
deleteItem: this.deleteItemCfg,
|
|
393
393
|
dataProps: this.dataProps,
|
|
394
394
|
hide: this.hide
|
|
395
|
-
}, i =
|
|
395
|
+
}, i = kt(e);
|
|
396
396
|
return i.initialValues = this.getValues(), i;
|
|
397
397
|
}
|
|
398
398
|
resetDefault() {
|
|
@@ -438,7 +438,7 @@ const K = class K {
|
|
|
438
438
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
439
439
|
}, 50));
|
|
440
440
|
};
|
|
441
|
-
return this.changeHandlers.clear(),
|
|
441
|
+
return this.changeHandlers.clear(), j(this.settings, (i, s) => {
|
|
442
442
|
var n;
|
|
443
443
|
if (L(s))
|
|
444
444
|
s.setOnChange(() => {
|
|
@@ -468,7 +468,7 @@ const K = class K {
|
|
|
468
468
|
const a = i.slice(this.addItemCfg.keyPrefix.length), o = Number(a);
|
|
469
469
|
if (Number.isFinite(o)) {
|
|
470
470
|
const l = this.addItemCfg.createItem(o);
|
|
471
|
-
|
|
471
|
+
lt(l) && (this.addSetting(i, l), n = l);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
n && (L(n) || A(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
@@ -497,11 +497,11 @@ const K = class K {
|
|
|
497
497
|
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
498
498
|
const o = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
499
499
|
if (l) {
|
|
500
|
-
const
|
|
501
|
-
|
|
500
|
+
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
501
|
+
h && t.startsWith(h) && this.addDeleteButtonToElement(o, t);
|
|
502
502
|
}
|
|
503
503
|
const r = a.querySelector(".sg-add-button-bottom");
|
|
504
|
-
r ? a.insertBefore(o, r) : a.appendChild(o),
|
|
504
|
+
r ? a.insertBefore(o, r) : a.appendChild(o), at.trackElement(o), _(o, this.nestingLevel + 1), tt(o, this.nestingLevel + 1);
|
|
505
505
|
const p = o.style.display;
|
|
506
506
|
o.style.display = "none", o.offsetHeight, o.style.display = p, this.updateNestingStyles();
|
|
507
507
|
}
|
|
@@ -650,11 +650,11 @@ const K = class K {
|
|
|
650
650
|
r(), t(!1);
|
|
651
651
|
}), l.addEventListener("click", () => {
|
|
652
652
|
r(), t(!0);
|
|
653
|
-
}), e.addEventListener("click", (
|
|
654
|
-
|
|
653
|
+
}), e.addEventListener("click", (h) => {
|
|
654
|
+
h.target === e && (r(), t(!1));
|
|
655
655
|
});
|
|
656
|
-
const p = (
|
|
657
|
-
|
|
656
|
+
const p = (h) => {
|
|
657
|
+
h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", p));
|
|
658
658
|
};
|
|
659
659
|
document.addEventListener("keydown", p), a.appendChild(o), a.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(a), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
660
660
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
@@ -752,7 +752,7 @@ const K = class K {
|
|
|
752
752
|
}
|
|
753
753
|
draw() {
|
|
754
754
|
const t = document.createElement("div");
|
|
755
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
755
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), _(t, this.nestingLevel);
|
|
756
756
|
const e = document.createElement("div");
|
|
757
757
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
758
758
|
"aria-expanded",
|
|
@@ -783,13 +783,13 @@ const K = class K {
|
|
|
783
783
|
}, Object.keys(this.settings).length > 0) {
|
|
784
784
|
for (const p in this.settings)
|
|
785
785
|
if (Object.prototype.hasOwnProperty.call(this.settings, p)) {
|
|
786
|
-
const
|
|
787
|
-
L(
|
|
788
|
-
const d =
|
|
789
|
-
L(
|
|
786
|
+
const h = this.settings[p];
|
|
787
|
+
L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
788
|
+
const d = h.draw();
|
|
789
|
+
L(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
790
790
|
d,
|
|
791
791
|
p,
|
|
792
|
-
|
|
792
|
+
h
|
|
793
793
|
), o.appendChild(d);
|
|
794
794
|
}
|
|
795
795
|
} else {
|
|
@@ -799,22 +799,22 @@ const K = class K {
|
|
|
799
799
|
if (this.addItemCfg) {
|
|
800
800
|
const p = document.createElement("button");
|
|
801
801
|
p.type = "button", p.className = "sg-add-button-bottom", p.style.marginTop = "8px";
|
|
802
|
-
const
|
|
802
|
+
const h = `
|
|
803
803
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
804
804
|
xmlns="http://www.w3.org/2000/svg">
|
|
805
805
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
806
806
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
807
807
|
</svg>`;
|
|
808
|
-
p.innerHTML = `${
|
|
808
|
+
p.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, p.addEventListener("click", (d) => {
|
|
809
809
|
d.stopPropagation(), d.preventDefault();
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
const
|
|
813
|
-
this.addSetting(
|
|
810
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
|
|
811
|
+
if (lt(C)) {
|
|
812
|
+
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
813
|
+
this.addSetting(m, C);
|
|
814
814
|
}
|
|
815
815
|
}), o.appendChild(p);
|
|
816
816
|
}
|
|
817
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(o), this.elementRef = t,
|
|
817
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(o), this.elementRef = t, at.trackElement(t), setTimeout(() => {
|
|
818
818
|
this.updateNestingStyles();
|
|
819
819
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
820
820
|
}
|
|
@@ -856,12 +856,12 @@ const K = class K {
|
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
};
|
|
859
|
-
|
|
860
|
-
let
|
|
861
|
-
function
|
|
862
|
-
return new
|
|
859
|
+
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
860
|
+
let T = Y;
|
|
861
|
+
function pe(c) {
|
|
862
|
+
return new Lt(c);
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class Lt extends T {
|
|
865
865
|
constructor(t) {
|
|
866
866
|
super(t);
|
|
867
867
|
const e = Object.keys(this.settings)[0];
|
|
@@ -911,9 +911,9 @@ class wt extends H {
|
|
|
911
911
|
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", o), r.textContent = o, r.addEventListener("click", () => this.switchToTab(o)), n.appendChild(r);
|
|
912
912
|
const p = document.createElement("div");
|
|
913
913
|
p.className = "tab-panel", this.contentContainers[o] = p;
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
914
|
+
const h = this.settings[o];
|
|
915
|
+
h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
|
|
916
|
+
h.draw()
|
|
917
917
|
)), a.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = o);
|
|
918
918
|
}), e.appendChild(i), e.appendChild(n), e.appendChild(a), !this.activeTabId) {
|
|
919
919
|
const o = Object.keys(this.settings)[0];
|
|
@@ -922,13 +922,13 @@ class wt extends H {
|
|
|
922
922
|
return this.updateTabUI(), t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
function
|
|
926
|
-
return new
|
|
925
|
+
function kt(c) {
|
|
926
|
+
return new T(c);
|
|
927
927
|
}
|
|
928
|
-
function
|
|
929
|
-
return
|
|
928
|
+
function ue(c) {
|
|
929
|
+
return c;
|
|
930
930
|
}
|
|
931
|
-
class
|
|
931
|
+
class Mt extends x {
|
|
932
932
|
constructor(t = {}) {
|
|
933
933
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
934
934
|
}
|
|
@@ -948,18 +948,18 @@ class Lt extends x {
|
|
|
948
948
|
});
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
|
-
const
|
|
952
|
-
class
|
|
951
|
+
const St = "<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>";
|
|
952
|
+
class V extends Mt {
|
|
953
953
|
constructor(t) {
|
|
954
954
|
super({
|
|
955
955
|
...t,
|
|
956
|
-
icon: t.icon ||
|
|
956
|
+
icon: t.icon || St,
|
|
957
957
|
title: t.title || "Color",
|
|
958
|
-
default: t.default ?
|
|
958
|
+
default: t.default ? V.normalizeColorValue(t.default) : "#000000"
|
|
959
959
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
960
960
|
}
|
|
961
961
|
static normalizeColorValue(t) {
|
|
962
|
-
return t.startsWith("var(--") ? t : t.startsWith("#") ?
|
|
962
|
+
return t.startsWith("var(--") ? t : t.startsWith("#") ? V.normalizeHexValue(t) : t.includes(",") ? V.rgbToHexStatic(t) : V.normalizeHexValue(t);
|
|
963
963
|
}
|
|
964
964
|
static normalizeHexValue(t) {
|
|
965
965
|
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");
|
|
@@ -969,8 +969,8 @@ class N extends Lt {
|
|
|
969
969
|
if (e.length !== 3 || e.some(isNaN))
|
|
970
970
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
971
971
|
const [i, s, n] = e, a = Math.max(0, Math.min(255, i)), o = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (p) => {
|
|
972
|
-
const
|
|
973
|
-
return
|
|
972
|
+
const h = p.toString(16);
|
|
973
|
+
return h.length === 1 ? "0" + h : h;
|
|
974
974
|
};
|
|
975
975
|
return `#${r(a)}${r(o)}${r(l)}`;
|
|
976
976
|
}
|
|
@@ -980,7 +980,7 @@ class N extends Lt {
|
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
982
|
if (typeof t == "string") {
|
|
983
|
-
const e =
|
|
983
|
+
const e = V.normalizeColorValue(t);
|
|
984
984
|
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);
|
|
985
985
|
} else
|
|
986
986
|
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");
|
|
@@ -993,16 +993,16 @@ class N extends Lt {
|
|
|
993
993
|
draw() {
|
|
994
994
|
const t = document.createElement("div");
|
|
995
995
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
998
|
-
const
|
|
999
|
-
|
|
996
|
+
const m = document.createElement("div");
|
|
997
|
+
if (m.className = "icon-container", this.props.icon) {
|
|
998
|
+
const u = document.createElement("span");
|
|
999
|
+
u.className = "input-icon", u.innerHTML = this.props.icon, m.appendChild(u);
|
|
1000
1000
|
}
|
|
1001
1001
|
if (this.props.title) {
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1002
|
+
const u = document.createElement("span");
|
|
1003
|
+
u.className = "input-label", u.textContent = this.props.title, m.appendChild(u);
|
|
1004
1004
|
}
|
|
1005
|
-
t.appendChild(
|
|
1005
|
+
t.appendChild(m);
|
|
1006
1006
|
}
|
|
1007
1007
|
const e = document.createElement("div");
|
|
1008
1008
|
e.className = "color-input-wrapper";
|
|
@@ -1020,76 +1020,89 @@ class N extends Lt {
|
|
|
1020
1020
|
try {
|
|
1021
1021
|
if (console.log("ColorSetting: renderGlobalOptions called"), o.innerHTML = "", !x) {
|
|
1022
1022
|
console.error("ColorSetting: Setting class is undefined");
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1023
|
+
const u = document.createElement("div");
|
|
1024
|
+
u.textContent = "Error: System error (Setting undefined)", o.appendChild(u);
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
|
-
const
|
|
1028
|
-
if (console.log("ColorSetting: GlobalVariables:",
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1027
|
+
const m = x.GlobalVariables || {};
|
|
1028
|
+
if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
|
|
1029
|
+
const u = document.createElement("div");
|
|
1030
|
+
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", o.appendChild(u);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
Object.entries(
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
const w = `var(--${
|
|
1039
|
-
this.value = w, (
|
|
1040
|
-
|
|
1041
|
-
}),
|
|
1042
|
-
}), o.appendChild(
|
|
1033
|
+
Object.entries(m).forEach(([u, f]) => {
|
|
1034
|
+
const v = document.createElement("button");
|
|
1035
|
+
v.className = "global-color-btn", v.title = u, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = f, v.style.cursor = "pointer", this.value === `var(--${u})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (y) => {
|
|
1036
|
+
var k, S;
|
|
1037
|
+
y.preventDefault();
|
|
1038
|
+
const w = `var(--${u})`;
|
|
1039
|
+
this.value = w, (k = this.onChange) == null || k.call(this, w), (S = this.detectChange) == null || S.call(this, w), Array.from(o.children).forEach((b) => {
|
|
1040
|
+
b.style.border = "1px solid #ddd";
|
|
1041
|
+
}), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
|
|
1042
|
+
}), o.appendChild(v);
|
|
1043
1043
|
});
|
|
1044
|
-
} catch (
|
|
1045
|
-
console.error("ColorSetting: Error in renderGlobalOptions",
|
|
1044
|
+
} catch (m) {
|
|
1045
|
+
console.error("ColorSetting: Error in renderGlobalOptions", m), o.innerHTML = "Error loading global options";
|
|
1046
1046
|
}
|
|
1047
1047
|
};
|
|
1048
|
-
l(), s.addEventListener("click", (
|
|
1049
|
-
|
|
1050
|
-
}), n.addEventListener("click", (
|
|
1051
|
-
|
|
1048
|
+
l(), s.addEventListener("click", (m) => {
|
|
1049
|
+
m.preventDefault(), s.classList.add("active"), n.classList.remove("active"), a.style.display = "flex", o.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1050
|
+
}), n.addEventListener("click", (m) => {
|
|
1051
|
+
m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), a.style.display = "none", o.style.display = "grid", l();
|
|
1052
1052
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1053
|
-
const r = (
|
|
1054
|
-
const
|
|
1055
|
-
if (!
|
|
1053
|
+
const r = (m) => {
|
|
1054
|
+
const u = m.value.trim();
|
|
1055
|
+
if (!u)
|
|
1056
1056
|
return e.classList.remove("error"), !0;
|
|
1057
|
-
const
|
|
1058
|
-
return
|
|
1057
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
|
|
1058
|
+
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
1059
1059
|
}, p = document.createElement("input");
|
|
1060
1060
|
p.type = "color", p.className = "color-picker", p.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", p.setAttribute("aria-label", "Choose color"), p.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && p.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = p;
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1061
|
+
const h = document.createElement("div");
|
|
1062
|
+
h.className = "color-preview";
|
|
1063
1063
|
let d = this.value || "#000000";
|
|
1064
1064
|
if (d.startsWith("var(--")) {
|
|
1065
|
-
const
|
|
1066
|
-
d = (x.GlobalVariables || {})[
|
|
1065
|
+
const m = d.replace("var(--", "").replace(")", "");
|
|
1066
|
+
d = (x.GlobalVariables || {})[m] || "#000000";
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1068
|
+
h.style.backgroundColor = d;
|
|
1069
|
+
const g = document.createElement("input");
|
|
1070
|
+
g.type = "text", g.className = "color-text-input", g.value = this.value || "", g.placeholder = "#000000", g.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), g.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), g.setAttribute("aria-label", "Hex color value"), g.setAttribute("maxlength", "7"), this.getDataPropsPath() && g.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = g;
|
|
1071
|
+
const C = (m) => {
|
|
1072
|
+
var f, v;
|
|
1073
|
+
let u = m.trim();
|
|
1074
|
+
if (u && !u.startsWith("#") && !u.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(u) && (u = "#" + u, this.textInputEl && (this.textInputEl.value = u)), this.textInputEl && r(this.textInputEl)) {
|
|
1075
|
+
const y = V.normalizeColorValue(u);
|
|
1076
|
+
this.value = y, (f = this.onChange) == null || f.call(this, y), (v = this.detectChange) == null || v.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), h.style.backgroundColor = y;
|
|
1076
1077
|
}
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
}), this.
|
|
1082
|
-
var f
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1078
|
+
};
|
|
1079
|
+
return this.textInputEl.addEventListener("input", (m) => {
|
|
1080
|
+
const u = m.target.value;
|
|
1081
|
+
C(u);
|
|
1082
|
+
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
1083
|
+
var f;
|
|
1084
|
+
m.preventDefault();
|
|
1085
|
+
const u = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
|
|
1086
|
+
this.textInputEl && (this.textInputEl.value = u.trim(), C(u));
|
|
1087
|
+
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
1088
|
+
var u, f, v;
|
|
1089
|
+
m.key === "Enter" && (m.preventDefault(), C(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (f = this.textInputEl) == null || f.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (v = this.textInputEl) == null || v.blur(), e.classList.remove("error"));
|
|
1090
|
+
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
1091
|
+
var v, y;
|
|
1092
|
+
const u = m.target.value, f = V.normalizeColorValue(u);
|
|
1093
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f, e.classList.remove("error");
|
|
1094
|
+
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
1095
|
+
var v, y;
|
|
1096
|
+
const u = m.target.value, f = V.normalizeColorValue(u);
|
|
1097
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f;
|
|
1098
|
+
}), a.appendChild(p), a.appendChild(h), a.appendChild(g), e.appendChild(i), e.appendChild(a), e.appendChild(o), t.appendChild(e), this.element = t, t;
|
|
1086
1099
|
}
|
|
1087
1100
|
getElement() {
|
|
1088
1101
|
return this.element;
|
|
1089
1102
|
}
|
|
1090
1103
|
// Helper method to get normalized hex value
|
|
1091
1104
|
getNormalizedValue() {
|
|
1092
|
-
return this.value ?
|
|
1105
|
+
return this.value ? V.normalizeColorValue(this.value) : "#000000";
|
|
1093
1106
|
}
|
|
1094
1107
|
// Helper method to check if current value is valid hex
|
|
1095
1108
|
isValidHex() {
|
|
@@ -1100,20 +1113,20 @@ class N extends Lt {
|
|
|
1100
1113
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1101
1114
|
}
|
|
1102
1115
|
}
|
|
1103
|
-
const
|
|
1116
|
+
const It = `
|
|
1104
1117
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1105
1118
|
<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"/>
|
|
1106
1119
|
<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"/>
|
|
1107
1120
|
<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"/>
|
|
1108
1121
|
</svg>`;
|
|
1109
|
-
class
|
|
1122
|
+
class F extends x {
|
|
1110
1123
|
constructor(t = {}) {
|
|
1111
1124
|
super({
|
|
1112
1125
|
...t,
|
|
1113
|
-
icon: t.icon ||
|
|
1126
|
+
icon: t.icon || It,
|
|
1114
1127
|
title: t.title || "Color & Opacity",
|
|
1115
1128
|
default: t.default || "#000000FF"
|
|
1116
|
-
}), 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 =
|
|
1129
|
+
}), 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 = F.normalizeHexWithOpacity(this.value));
|
|
1117
1130
|
}
|
|
1118
1131
|
static normalizeHexWithOpacity(t) {
|
|
1119
1132
|
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");
|
|
@@ -1131,7 +1144,7 @@ class R extends x {
|
|
|
1131
1144
|
return `#${i}${n}`;
|
|
1132
1145
|
}
|
|
1133
1146
|
setValue(t) {
|
|
1134
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1147
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = F.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1135
1148
|
}
|
|
1136
1149
|
updateInputElements() {
|
|
1137
1150
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
@@ -1142,7 +1155,7 @@ class R extends x {
|
|
|
1142
1155
|
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
1143
1156
|
}
|
|
1144
1157
|
handleColorChange(t) {
|
|
1145
|
-
const e = this.getOpacityPercent(), i =
|
|
1158
|
+
const e = this.getOpacityPercent(), i = F.combineColorOpacity(
|
|
1146
1159
|
t,
|
|
1147
1160
|
e
|
|
1148
1161
|
);
|
|
@@ -1153,7 +1166,7 @@ class R extends x {
|
|
|
1153
1166
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1154
1167
|
}
|
|
1155
1168
|
handleOpacityChange(t) {
|
|
1156
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1169
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = F.combineColorOpacity(
|
|
1157
1170
|
e,
|
|
1158
1171
|
i
|
|
1159
1172
|
);
|
|
@@ -1162,16 +1175,16 @@ class R extends x {
|
|
|
1162
1175
|
draw() {
|
|
1163
1176
|
const t = document.createElement("div");
|
|
1164
1177
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1165
|
-
const
|
|
1166
|
-
if (
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1178
|
+
const o = document.createElement("div");
|
|
1179
|
+
if (o.className = "icon-container", this.props.icon) {
|
|
1180
|
+
const l = document.createElement("span");
|
|
1181
|
+
l.className = "input-icon", l.innerHTML = this.props.icon, o.appendChild(l);
|
|
1169
1182
|
}
|
|
1170
1183
|
if (this.props.title) {
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1184
|
+
const l = document.createElement("span");
|
|
1185
|
+
l.className = "input-label", l.textContent = this.props.title, o.appendChild(l);
|
|
1173
1186
|
}
|
|
1174
|
-
t.appendChild(
|
|
1187
|
+
t.appendChild(o);
|
|
1175
1188
|
}
|
|
1176
1189
|
const e = document.createElement("div");
|
|
1177
1190
|
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.getDataPropsPath() && this.colorInputEl.setAttribute(
|
|
@@ -1180,35 +1193,50 @@ class R extends x {
|
|
|
1180
1193
|
), this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.getDataPropsPath() && this.textInputEl.setAttribute(
|
|
1181
1194
|
"data-test-id",
|
|
1182
1195
|
`${this.getDataPropsPath()}_text`
|
|
1183
|
-
), this.updateInputElements(), this.updateColorPreview()
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1196
|
+
), this.updateInputElements(), this.updateColorPreview();
|
|
1197
|
+
const i = (o) => {
|
|
1198
|
+
let l = o.trim();
|
|
1199
|
+
l && !l.startsWith("#") && /^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(l) && (l = "#" + l, this.textInputEl && (this.textInputEl.value = l));
|
|
1200
|
+
const r = this.handleTextInput(l);
|
|
1201
|
+
return r ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : l === "" ? e.classList.remove("error") : e.classList.add("error"), r;
|
|
1202
|
+
};
|
|
1203
|
+
this.colorInputEl.addEventListener("input", (o) => {
|
|
1204
|
+
const l = o.target;
|
|
1205
|
+
this.handleColorChange(l.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1206
|
+
}), this.textInputEl.addEventListener("input", (o) => {
|
|
1207
|
+
const l = o.target;
|
|
1208
|
+
i(l.value);
|
|
1209
|
+
}), this.textInputEl.addEventListener("paste", (o) => {
|
|
1210
|
+
var r;
|
|
1211
|
+
o.preventDefault();
|
|
1212
|
+
const l = ((r = o.clipboardData) == null ? void 0 : r.getData("text")) || "";
|
|
1213
|
+
this.textInputEl && (this.textInputEl.value = l.trim(), i(l));
|
|
1214
|
+
}), this.textInputEl.addEventListener("keydown", (o) => {
|
|
1215
|
+
var l, r, p;
|
|
1216
|
+
o.key === "Enter" && (o.preventDefault(), i(((l = this.textInputEl) == null ? void 0 : l.value) || ""), (r = this.textInputEl) == null || r.blur()), o.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (p = this.textInputEl) == null || p.blur(), e.classList.remove("error"));
|
|
1217
|
+
}), this.textInputEl.addEventListener("blur", (o) => {
|
|
1218
|
+
const l = o.target;
|
|
1219
|
+
l.value.trim() === "" && (l.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1192
1220
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1193
|
-
var
|
|
1194
|
-
(
|
|
1221
|
+
var o;
|
|
1222
|
+
(o = this.colorInputEl) == null || o.click();
|
|
1195
1223
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1224
|
+
const s = document.createElement("div");
|
|
1225
|
+
s.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
|
|
1198
1226
|
"data-test-id",
|
|
1199
1227
|
`${this.getDataPropsPath()}_opacity`
|
|
1200
1228
|
);
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
const
|
|
1204
|
-
isNaN(
|
|
1205
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1206
|
-
const
|
|
1207
|
-
let
|
|
1208
|
-
isNaN(
|
|
1209
|
-
}),
|
|
1210
|
-
const
|
|
1211
|
-
return
|
|
1229
|
+
const n = document.createElement("span");
|
|
1230
|
+
n.className = "color-with-opacity-opacity-suffix", n.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
|
|
1231
|
+
const l = o.target, r = parseFloat(l.value);
|
|
1232
|
+
isNaN(r) || (this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1233
|
+
}), this.opacityInputEl.addEventListener("blur", (o) => {
|
|
1234
|
+
const l = o.target;
|
|
1235
|
+
let r = parseFloat(l.value);
|
|
1236
|
+
isNaN(r) && (r = this.getOpacityPercent()), r = Math.max(0, Math.min(100, r)), l.value = r.toString(), this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1237
|
+
}), s.appendChild(this.opacityInputEl), s.appendChild(n);
|
|
1238
|
+
const a = document.createElement("div");
|
|
1239
|
+
return a.className = "color-with-opacity-controls-wrapper", a.appendChild(e), a.appendChild(s), t.appendChild(a), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
1212
1240
|
}
|
|
1213
1241
|
getElement() {
|
|
1214
1242
|
return this.element;
|
|
@@ -1228,7 +1256,7 @@ class R extends x {
|
|
|
1228
1256
|
};
|
|
1229
1257
|
}
|
|
1230
1258
|
}
|
|
1231
|
-
class
|
|
1259
|
+
class ge extends x {
|
|
1232
1260
|
constructor(t = {}) {
|
|
1233
1261
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1234
1262
|
}
|
|
@@ -1260,7 +1288,7 @@ class de extends x {
|
|
|
1260
1288
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1261
1289
|
}
|
|
1262
1290
|
}
|
|
1263
|
-
class
|
|
1291
|
+
class P extends x {
|
|
1264
1292
|
constructor(t) {
|
|
1265
1293
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1266
1294
|
}
|
|
@@ -1319,12 +1347,12 @@ class V extends x {
|
|
|
1319
1347
|
);
|
|
1320
1348
|
}
|
|
1321
1349
|
}
|
|
1322
|
-
const
|
|
1350
|
+
const Nt = `
|
|
1323
1351
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1324
1352
|
<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"/>
|
|
1325
1353
|
<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"/>
|
|
1326
1354
|
</svg>`;
|
|
1327
|
-
class
|
|
1355
|
+
class Vt extends P {
|
|
1328
1356
|
constructor(t = {}) {
|
|
1329
1357
|
const e = {
|
|
1330
1358
|
title: "Opacity",
|
|
@@ -1333,7 +1361,7 @@ class Nt extends V {
|
|
|
1333
1361
|
maxValue: 100,
|
|
1334
1362
|
step: 1,
|
|
1335
1363
|
default: t.default ?? 100,
|
|
1336
|
-
icon:
|
|
1364
|
+
icon: Nt,
|
|
1337
1365
|
...t
|
|
1338
1366
|
};
|
|
1339
1367
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1345,12 +1373,12 @@ class Nt extends V {
|
|
|
1345
1373
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1346
1374
|
}
|
|
1347
1375
|
}
|
|
1348
|
-
const
|
|
1376
|
+
const Tt = `
|
|
1349
1377
|
<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">
|
|
1350
1378
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1351
1379
|
</svg>
|
|
1352
1380
|
`;
|
|
1353
|
-
class
|
|
1381
|
+
class et extends x {
|
|
1354
1382
|
constructor(t = {}) {
|
|
1355
1383
|
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) {
|
|
1356
1384
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1394,7 +1422,7 @@ class tt extends x {
|
|
|
1394
1422
|
o.onclick = (l) => this.selectOption(l, a, e), i.appendChild(o);
|
|
1395
1423
|
}), document.body.appendChild(i);
|
|
1396
1424
|
const s = document.createElement("div");
|
|
1397
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1425
|
+
return s.classList.add("svg-container"), s.innerHTML = Tt, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1398
1426
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1399
1427
|
}).catch((n) => {
|
|
1400
1428
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -1457,7 +1485,7 @@ class tt extends x {
|
|
|
1457
1485
|
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();
|
|
1458
1486
|
}
|
|
1459
1487
|
}
|
|
1460
|
-
class
|
|
1488
|
+
class Pt extends x {
|
|
1461
1489
|
constructor(t = {}) {
|
|
1462
1490
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1463
1491
|
}
|
|
@@ -1513,7 +1541,7 @@ class Vt extends x {
|
|
|
1513
1541
|
}), t.appendChild(i), t;
|
|
1514
1542
|
}
|
|
1515
1543
|
}
|
|
1516
|
-
class
|
|
1544
|
+
class me extends x {
|
|
1517
1545
|
constructor(t) {
|
|
1518
1546
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1519
1547
|
}
|
|
@@ -1542,27 +1570,27 @@ class pe extends x {
|
|
|
1542
1570
|
return a.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), a.appendChild(t), a;
|
|
1543
1571
|
}
|
|
1544
1572
|
}
|
|
1545
|
-
class
|
|
1573
|
+
class fe extends x {
|
|
1546
1574
|
constructor(t = {}) {
|
|
1547
1575
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1548
1576
|
const e = t.width || 0, i = t.height || 0;
|
|
1549
1577
|
this.value || (this.value = {
|
|
1550
1578
|
width: e,
|
|
1551
1579
|
height: i
|
|
1552
|
-
}), 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
|
|
1580
|
+
}), 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 P({
|
|
1553
1581
|
title: "Width",
|
|
1554
1582
|
default: this.value.width,
|
|
1555
1583
|
suffix: "px",
|
|
1556
1584
|
minValue: this.minWidth,
|
|
1557
1585
|
maxValue: this.maxWidth,
|
|
1558
|
-
icon:
|
|
1559
|
-
}), this.heightSetting = new
|
|
1586
|
+
icon: Ot
|
|
1587
|
+
}), this.heightSetting = new P({
|
|
1560
1588
|
title: "Height",
|
|
1561
1589
|
default: this.value.height,
|
|
1562
1590
|
suffix: "px",
|
|
1563
1591
|
minValue: this.minHeight,
|
|
1564
1592
|
maxValue: this.maxHeight,
|
|
1565
|
-
icon:
|
|
1593
|
+
icon: $t
|
|
1566
1594
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1567
1595
|
}
|
|
1568
1596
|
handleWidthChange(t) {
|
|
@@ -1656,24 +1684,24 @@ class ue extends x {
|
|
|
1656
1684
|
}
|
|
1657
1685
|
}
|
|
1658
1686
|
}
|
|
1659
|
-
const
|
|
1687
|
+
const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1660
1688
|
<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"/>
|
|
1661
|
-
</svg>`,
|
|
1689
|
+
</svg>`, $t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1662
1690
|
<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"/>
|
|
1663
|
-
</svg>`,
|
|
1691
|
+
</svg>`, Q = `
|
|
1664
1692
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1665
1693
|
<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"/>
|
|
1666
1694
|
</svg>
|
|
1667
|
-
`,
|
|
1695
|
+
`, Ht = `
|
|
1668
1696
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1669
1697
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1670
1698
|
<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"/>
|
|
1671
1699
|
</svg>
|
|
1672
|
-
`,
|
|
1700
|
+
`, Bt = `
|
|
1673
1701
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1674
1702
|
<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"/>
|
|
1675
1703
|
</svg>
|
|
1676
|
-
`,
|
|
1704
|
+
`, At = `
|
|
1677
1705
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1678
1706
|
<!-- Top dot -->
|
|
1679
1707
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1693,7 +1721,7 @@ const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1693
1721
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1694
1722
|
</svg>
|
|
1695
1723
|
`;
|
|
1696
|
-
class
|
|
1724
|
+
class nt extends x {
|
|
1697
1725
|
constructor(t = {}) {
|
|
1698
1726
|
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();
|
|
1699
1727
|
}
|
|
@@ -1746,7 +1774,7 @@ class ct extends x {
|
|
|
1746
1774
|
);
|
|
1747
1775
|
if (t && t !== "") {
|
|
1748
1776
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1749
|
-
<span class="upload-icon">${
|
|
1777
|
+
<span class="upload-icon">${Q}</span>
|
|
1750
1778
|
<span class="upload-label">Replace</span>
|
|
1751
1779
|
`);
|
|
1752
1780
|
const n = () => {
|
|
@@ -1757,7 +1785,7 @@ class ct extends x {
|
|
|
1757
1785
|
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", a), this.previewEl.src = t;
|
|
1758
1786
|
} else
|
|
1759
1787
|
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 = `
|
|
1760
|
-
<span class="upload-icon">${
|
|
1788
|
+
<span class="upload-icon">${Q}</span>
|
|
1761
1789
|
<span class="upload-label">Upload</span>
|
|
1762
1790
|
`);
|
|
1763
1791
|
}
|
|
@@ -1790,9 +1818,9 @@ class ct extends x {
|
|
|
1790
1818
|
const s = this.value && this.value !== "";
|
|
1791
1819
|
s || i.classList.add("no-image");
|
|
1792
1820
|
const n = document.createElement("div");
|
|
1793
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1821
|
+
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 = At, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1794
1822
|
const o = document.createElement("button");
|
|
1795
|
-
o.className = "delete-button", o.type = "button", o.title = "Delete image", o.innerHTML =
|
|
1823
|
+
o.className = "delete-button", o.type = "button", o.title = "Delete image", o.innerHTML = Bt, this.previewWrapper.appendChild(o), o.onclick = (l) => {
|
|
1796
1824
|
var r;
|
|
1797
1825
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1798
1826
|
};
|
|
@@ -1800,7 +1828,7 @@ class ct extends x {
|
|
|
1800
1828
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1801
1829
|
const a = document.createElement("button");
|
|
1802
1830
|
return a.className = "upload-button", this.getDataPropsPath() && a.setAttribute("data-test-id", this.getDataPropsPath()), a.innerHTML = `
|
|
1803
|
-
<span class="upload-icon">${
|
|
1831
|
+
<span class="upload-icon">${Q}</span>
|
|
1804
1832
|
<span class="upload-label">Upload</span>
|
|
1805
1833
|
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(a), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), a.onclick = () => {
|
|
1806
1834
|
window.postMessage(
|
|
@@ -1813,14 +1841,14 @@ class ct extends x {
|
|
|
1813
1841
|
}, t;
|
|
1814
1842
|
}
|
|
1815
1843
|
}
|
|
1816
|
-
class
|
|
1844
|
+
class Gt extends P {
|
|
1817
1845
|
constructor(t = {}) {
|
|
1818
1846
|
super({
|
|
1819
1847
|
...t,
|
|
1820
1848
|
title: t.title || "Height",
|
|
1821
1849
|
suffix: t.suffix || "px",
|
|
1822
1850
|
minValue: t.minValue ?? 0,
|
|
1823
|
-
icon: t.icon ||
|
|
1851
|
+
icon: t.icon || Dt,
|
|
1824
1852
|
default: t.default ?? 100
|
|
1825
1853
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1826
1854
|
}
|
|
@@ -1831,17 +1859,17 @@ class ge extends V {
|
|
|
1831
1859
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1832
1860
|
}
|
|
1833
1861
|
}
|
|
1834
|
-
const
|
|
1862
|
+
const Dt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1835
1863
|
<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"/>
|
|
1836
1864
|
</svg>`;
|
|
1837
|
-
class
|
|
1865
|
+
class Ft extends P {
|
|
1838
1866
|
constructor(t = {}) {
|
|
1839
1867
|
super({
|
|
1840
1868
|
...t,
|
|
1841
1869
|
title: t.title || "Width",
|
|
1842
1870
|
suffix: t.suffix || "px",
|
|
1843
1871
|
minValue: t.minValue ?? 0,
|
|
1844
|
-
icon: t.icon ||
|
|
1872
|
+
icon: t.icon || Rt,
|
|
1845
1873
|
default: t.default ?? 100
|
|
1846
1874
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1847
1875
|
}
|
|
@@ -1852,9 +1880,9 @@ class me extends V {
|
|
|
1852
1880
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1853
1881
|
}
|
|
1854
1882
|
}
|
|
1855
|
-
const
|
|
1883
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1856
1884
|
<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"/>
|
|
1857
|
-
</svg>`,
|
|
1885
|
+
</svg>`, Wt = `
|
|
1858
1886
|
<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">
|
|
1859
1887
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1860
1888
|
</svg>
|
|
@@ -1914,7 +1942,7 @@ class ve extends x {
|
|
|
1914
1942
|
o.onclick = (l) => this.selectApiOption(l, a, e), i.appendChild(o);
|
|
1915
1943
|
}), t.appendChild(i);
|
|
1916
1944
|
const s = document.createElement("div");
|
|
1917
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1945
|
+
return s.classList.add("svg-container"), s.innerHTML = Wt, t.appendChild(s), s.onclick = () => {
|
|
1918
1946
|
var n, a;
|
|
1919
1947
|
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
1920
1948
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
@@ -2008,7 +2036,7 @@ class ve extends x {
|
|
|
2008
2036
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
2009
2037
|
}
|
|
2010
2038
|
}
|
|
2011
|
-
class
|
|
2039
|
+
class Ce extends x {
|
|
2012
2040
|
constructor(t) {
|
|
2013
2041
|
var e, i;
|
|
2014
2042
|
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;
|
|
@@ -2032,7 +2060,7 @@ class fe extends x {
|
|
|
2032
2060
|
const s = document.createElement("input");
|
|
2033
2061
|
s.type = "checkbox", s.checked = ((o = (a = this.props.options) == null ? void 0 : a.find((l) => l.value === this.value)) == null ? void 0 : o.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
2034
2062
|
var r, p;
|
|
2035
|
-
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((
|
|
2063
|
+
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : p.value) ?? "";
|
|
2036
2064
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
2037
2065
|
});
|
|
2038
2066
|
const n = document.createElement("span");
|
|
@@ -2058,13 +2086,13 @@ class fe extends x {
|
|
|
2058
2086
|
this.detectChangeCallback = t;
|
|
2059
2087
|
}
|
|
2060
2088
|
}
|
|
2061
|
-
const
|
|
2089
|
+
const Ut = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2062
2090
|
<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"/>
|
|
2063
2091
|
</svg>`;
|
|
2064
|
-
class
|
|
2092
|
+
class ye extends x {
|
|
2065
2093
|
// Store mobile value
|
|
2066
2094
|
constructor(t = {}) {
|
|
2067
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2095
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Ut, 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);
|
|
2068
2096
|
}
|
|
2069
2097
|
draw() {
|
|
2070
2098
|
const t = document.createElement("div");
|
|
@@ -2115,40 +2143,40 @@ class Ce extends x {
|
|
|
2115
2143
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2116
2144
|
}
|
|
2117
2145
|
}
|
|
2118
|
-
const
|
|
2146
|
+
const zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2119
2147
|
<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"/>
|
|
2120
2148
|
</svg>`;
|
|
2121
|
-
class
|
|
2149
|
+
class be extends P {
|
|
2122
2150
|
constructor(t = {}) {
|
|
2123
2151
|
super({
|
|
2124
2152
|
...t,
|
|
2125
2153
|
minValue: t.minValue ?? 0,
|
|
2126
2154
|
maxValue: t.maxValue ?? 1e3,
|
|
2127
|
-
icon: t.icon ||
|
|
2155
|
+
icon: t.icon || zt,
|
|
2128
2156
|
title: t.title || "Margin Bottom",
|
|
2129
2157
|
default: t.default ?? 20,
|
|
2130
2158
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2131
2159
|
}), this.inputType = "number";
|
|
2132
2160
|
}
|
|
2133
2161
|
}
|
|
2134
|
-
const
|
|
2162
|
+
const jt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2135
2163
|
<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"
|
|
2136
2164
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2137
2165
|
</svg>`;
|
|
2138
|
-
class
|
|
2166
|
+
class Ee extends P {
|
|
2139
2167
|
constructor(t = {}) {
|
|
2140
2168
|
super({
|
|
2141
2169
|
...t,
|
|
2142
2170
|
minValue: t.minValue ?? 0,
|
|
2143
2171
|
maxValue: t.maxValue ?? 1e3,
|
|
2144
|
-
icon: t.icon ||
|
|
2172
|
+
icon: t.icon || jt,
|
|
2145
2173
|
title: t.title || "Margin Top",
|
|
2146
2174
|
default: t.default ?? 20,
|
|
2147
2175
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2148
2176
|
}), this.inputType = "number";
|
|
2149
2177
|
}
|
|
2150
2178
|
}
|
|
2151
|
-
class
|
|
2179
|
+
class we extends x {
|
|
2152
2180
|
constructor(t) {
|
|
2153
2181
|
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(x.DefaultLanguage) ? x.DefaultLanguage : t.languages[0];
|
|
2154
2182
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
@@ -2181,13 +2209,13 @@ class Ee extends x {
|
|
|
2181
2209
|
return;
|
|
2182
2210
|
}
|
|
2183
2211
|
const p = "...";
|
|
2184
|
-
let
|
|
2185
|
-
for (;
|
|
2186
|
-
const
|
|
2187
|
-
this.measureTextWidth(
|
|
2212
|
+
let h = 0, d = e.length, g = 0;
|
|
2213
|
+
for (; h <= d; ) {
|
|
2214
|
+
const m = Math.floor((h + d) / 2), u = e.slice(0, m).trimEnd() + p;
|
|
2215
|
+
this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : d = m - 1;
|
|
2188
2216
|
}
|
|
2189
|
-
const
|
|
2190
|
-
t.placeholder =
|
|
2217
|
+
const C = e.slice(0, g).trimEnd() + p;
|
|
2218
|
+
t.placeholder = C;
|
|
2191
2219
|
}
|
|
2192
2220
|
autosizeTextarea(t, e = 3) {
|
|
2193
2221
|
t.style.height = "auto";
|
|
@@ -2199,7 +2227,7 @@ class Ee extends x {
|
|
|
2199
2227
|
i.classList.add("simple-multi-language-row");
|
|
2200
2228
|
const s = document.createElement("label");
|
|
2201
2229
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2202
|
-
const n = new
|
|
2230
|
+
const n = new nt({
|
|
2203
2231
|
defaultUrl: e || "",
|
|
2204
2232
|
title: "",
|
|
2205
2233
|
id: `${this.id}_upload_${t}`
|
|
@@ -2295,7 +2323,7 @@ class Ee extends x {
|
|
|
2295
2323
|
});
|
|
2296
2324
|
}
|
|
2297
2325
|
}
|
|
2298
|
-
class
|
|
2326
|
+
class xe extends x {
|
|
2299
2327
|
constructor(t = {}) {
|
|
2300
2328
|
super(t), this.inputType = "select";
|
|
2301
2329
|
const e = [
|
|
@@ -2306,7 +2334,7 @@ class we extends x {
|
|
|
2306
2334
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2307
2335
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2308
2336
|
];
|
|
2309
|
-
this.selectSetting = new
|
|
2337
|
+
this.selectSetting = new et({
|
|
2310
2338
|
title: this.title || "Animation",
|
|
2311
2339
|
options: e,
|
|
2312
2340
|
default: this.props.default || "none"
|
|
@@ -2322,72 +2350,72 @@ class we extends x {
|
|
|
2322
2350
|
this.selectSetting.destroy(), super.destroy();
|
|
2323
2351
|
}
|
|
2324
2352
|
}
|
|
2325
|
-
const
|
|
2353
|
+
const ut = (c, t, e) => {
|
|
2326
2354
|
let i = !1, s = 0, n = 0, a = 0, o = 0;
|
|
2327
|
-
const l = (
|
|
2328
|
-
if (
|
|
2329
|
-
i = !0, s =
|
|
2355
|
+
const l = (h) => {
|
|
2356
|
+
if (h.target.closest("button")) return;
|
|
2357
|
+
i = !0, s = h.clientX, n = h.clientY;
|
|
2330
2358
|
const d = t.getBoundingClientRect();
|
|
2331
2359
|
a = d.left, o = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2332
|
-
}, r = (
|
|
2360
|
+
}, r = (h) => {
|
|
2333
2361
|
if (!i) return;
|
|
2334
|
-
const d =
|
|
2335
|
-
let
|
|
2336
|
-
|
|
2362
|
+
const d = h.clientX - s, g = h.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
|
|
2363
|
+
let v = a + d, y = o + g;
|
|
2364
|
+
v = Math.max(8, Math.min(C - u - 8, v)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
|
|
2337
2365
|
}, p = () => {
|
|
2338
2366
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2339
2367
|
};
|
|
2340
|
-
|
|
2341
|
-
},
|
|
2342
|
-
if (!
|
|
2343
|
-
let t =
|
|
2368
|
+
c.addEventListener("mousedown", l);
|
|
2369
|
+
}, U = (c) => {
|
|
2370
|
+
if (!c) return null;
|
|
2371
|
+
let t = c.trim();
|
|
2344
2372
|
return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
|
|
2345
|
-
},
|
|
2346
|
-
const t =
|
|
2373
|
+
}, J = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, N = (c) => {
|
|
2374
|
+
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2347
2375
|
return {
|
|
2348
2376
|
r: parseInt(e.slice(0, 2), 16),
|
|
2349
2377
|
g: parseInt(e.slice(2, 4), 16),
|
|
2350
2378
|
b: parseInt(e.slice(4, 6), 16)
|
|
2351
2379
|
};
|
|
2352
|
-
},
|
|
2353
|
-
const { r: t, g: e, b: i } =
|
|
2380
|
+
}, R = (c) => {
|
|
2381
|
+
const { r: t, g: e, b: i } = N(c), s = t / 255, n = e / 255, a = i / 255, o = Math.max(s, n, a), l = Math.min(s, n, a), r = o - l;
|
|
2354
2382
|
let p = 0;
|
|
2355
2383
|
r !== 0 && (o === s ? p = (n - a) / r % 6 : o === n ? p = (a - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
|
|
2356
|
-
const
|
|
2357
|
-
return { h: p * 60, s:
|
|
2358
|
-
},
|
|
2359
|
-
const i = (
|
|
2384
|
+
const h = o === 0 ? 0 : r / o, d = o;
|
|
2385
|
+
return { h: p * 60, s: h, v: d };
|
|
2386
|
+
}, W = (c, t, e) => {
|
|
2387
|
+
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), a = e - s;
|
|
2360
2388
|
let o = 0, l = 0, r = 0;
|
|
2361
|
-
return i < 60 ? (o = s, l = n, r = 0) : i < 120 ? (o = n, l = s, r = 0) : i < 180 ? (o = 0, l = s, r = n) : i < 240 ? (o = 0, l = n, r = s) : i < 300 ? (o = n, l = 0, r = s) : (o = s, l = 0, r = n),
|
|
2389
|
+
return i < 60 ? (o = s, l = n, r = 0) : i < 120 ? (o = n, l = s, r = 0) : i < 180 ? (o = 0, l = s, r = n) : i < 240 ? (o = 0, l = n, r = s) : i < 300 ? (o = n, l = 0, r = s) : (o = s, l = 0, r = n), J(
|
|
2362
2390
|
Math.round((o + a) * 255),
|
|
2363
2391
|
Math.round((l + a) * 255),
|
|
2364
2392
|
Math.round((r + a) * 255)
|
|
2365
2393
|
);
|
|
2366
|
-
},
|
|
2394
|
+
}, gt = (c, t, e) => {
|
|
2367
2395
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2368
|
-
return { hue:
|
|
2369
|
-
},
|
|
2370
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2396
|
+
return { hue: c, sat: s, lightness: i };
|
|
2397
|
+
}, it = (c, t, e) => {
|
|
2398
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2371
2399
|
let a = 0, o = 0, l = 0;
|
|
2372
|
-
return
|
|
2400
|
+
return c < 60 ? (a = i, o = s, l = 0) : c < 120 ? (a = s, o = i, l = 0) : c < 180 ? (a = 0, o = i, l = s) : c < 240 ? (a = 0, o = s, l = i) : c < 300 ? (a = s, o = 0, l = i) : (a = i, o = 0, l = s), {
|
|
2373
2401
|
r: Math.round((a + n) * 255),
|
|
2374
2402
|
g: Math.round((o + n) * 255),
|
|
2375
2403
|
b: Math.round((l + n) * 255)
|
|
2376
2404
|
};
|
|
2377
|
-
},
|
|
2405
|
+
}, st = (c, t) => {
|
|
2378
2406
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2379
|
-
if (
|
|
2380
|
-
const { r: s, g: n, b: a } =
|
|
2407
|
+
if (c.startsWith("#")) {
|
|
2408
|
+
const { r: s, g: n, b: a } = N(c);
|
|
2381
2409
|
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
2382
2410
|
}
|
|
2383
|
-
if (
|
|
2384
|
-
return
|
|
2385
|
-
if (
|
|
2386
|
-
return
|
|
2387
|
-
if (
|
|
2388
|
-
const s =
|
|
2411
|
+
if (c.startsWith("rgba("))
|
|
2412
|
+
return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2413
|
+
if (c.startsWith("rgb("))
|
|
2414
|
+
return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2415
|
+
if (c.startsWith("hsl(")) {
|
|
2416
|
+
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2389
2417
|
if (s) {
|
|
2390
|
-
const { r: n, g: a, b: o } =
|
|
2418
|
+
const { r: n, g: a, b: o } = it(
|
|
2391
2419
|
parseInt(s[1]),
|
|
2392
2420
|
parseInt(s[2]) / 100,
|
|
2393
2421
|
parseInt(s[3]) / 100
|
|
@@ -2395,10 +2423,10 @@ const ht = (h, t, e) => {
|
|
|
2395
2423
|
return `rgba(${n}, ${a}, ${o}, ${e})`;
|
|
2396
2424
|
}
|
|
2397
2425
|
}
|
|
2398
|
-
if (
|
|
2399
|
-
const s =
|
|
2426
|
+
if (c.startsWith("hsla(")) {
|
|
2427
|
+
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2400
2428
|
if (s) {
|
|
2401
|
-
const { r: n, g: a, b: o } =
|
|
2429
|
+
const { r: n, g: a, b: o } = it(
|
|
2402
2430
|
parseInt(s[1]),
|
|
2403
2431
|
parseInt(s[2]) / 100,
|
|
2404
2432
|
parseInt(s[3]) / 100
|
|
@@ -2406,13 +2434,13 @@ const ht = (h, t, e) => {
|
|
|
2406
2434
|
return `rgba(${n}, ${a}, ${o}, ${e})`;
|
|
2407
2435
|
}
|
|
2408
2436
|
}
|
|
2409
|
-
const i =
|
|
2437
|
+
const i = U(c);
|
|
2410
2438
|
if (i) {
|
|
2411
|
-
const { r: s, g: n, b: a } =
|
|
2439
|
+
const { r: s, g: n, b: a } = N(i);
|
|
2412
2440
|
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
2413
2441
|
}
|
|
2414
|
-
return
|
|
2415
|
-
},
|
|
2442
|
+
return c;
|
|
2443
|
+
}, qt = (c) => [
|
|
2416
2444
|
"red",
|
|
2417
2445
|
"green",
|
|
2418
2446
|
"blue",
|
|
@@ -2436,22 +2464,22 @@ const ht = (h, t, e) => {
|
|
|
2436
2464
|
"teal",
|
|
2437
2465
|
"fuchsia",
|
|
2438
2466
|
"transparent"
|
|
2439
|
-
].includes(
|
|
2467
|
+
].includes(c.toLowerCase()), mt = (c) => [
|
|
2440
2468
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2441
2469
|
/^rgba?\s*\([^)]+\)$/,
|
|
2442
2470
|
/^hsla?\s*\([^)]+\)$/,
|
|
2443
2471
|
/^[a-zA-Z]+$/
|
|
2444
|
-
].some((e) => e.test(
|
|
2472
|
+
].some((e) => e.test(c.trim())), _t = (c) => {
|
|
2445
2473
|
if (typeof document > "u")
|
|
2446
|
-
return
|
|
2474
|
+
return mt(c) || !!U(c);
|
|
2447
2475
|
const t = document.createElement("div");
|
|
2448
|
-
return t.style.color =
|
|
2449
|
-
},
|
|
2450
|
-
const t =
|
|
2476
|
+
return t.style.color = c, t.style.color !== "";
|
|
2477
|
+
}, ft = (c) => {
|
|
2478
|
+
const t = c.trim();
|
|
2451
2479
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2452
2480
|
const n = t.slice(1), a = parseInt(n.slice(0, 2), 16), o = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2453
2481
|
return {
|
|
2454
|
-
color:
|
|
2482
|
+
color: J(a, o, l),
|
|
2455
2483
|
position: 0,
|
|
2456
2484
|
opacity: Math.round(r / 255 * 100)
|
|
2457
2485
|
};
|
|
@@ -2462,7 +2490,7 @@ const ht = (h, t, e) => {
|
|
|
2462
2490
|
if (e) {
|
|
2463
2491
|
const n = parseInt(e[1]), a = parseInt(e[2]), o = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2464
2492
|
return {
|
|
2465
|
-
color:
|
|
2493
|
+
color: J(n, a, o),
|
|
2466
2494
|
position: 0,
|
|
2467
2495
|
opacity: Math.round(l * 100)
|
|
2468
2496
|
};
|
|
@@ -2471,23 +2499,23 @@ const ht = (h, t, e) => {
|
|
|
2471
2499
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2472
2500
|
);
|
|
2473
2501
|
if (i) {
|
|
2474
|
-
const { r: n, g: a, b: o } =
|
|
2502
|
+
const { r: n, g: a, b: o } = it(
|
|
2475
2503
|
parseFloat(i[1]),
|
|
2476
2504
|
parseFloat(i[2]) / 100,
|
|
2477
2505
|
parseFloat(i[3]) / 100
|
|
2478
2506
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2479
2507
|
return {
|
|
2480
|
-
color:
|
|
2508
|
+
color: J(n, a, o),
|
|
2481
2509
|
position: 0,
|
|
2482
2510
|
opacity: Math.round(l * 100)
|
|
2483
2511
|
};
|
|
2484
2512
|
}
|
|
2485
|
-
return { color:
|
|
2486
|
-
},
|
|
2513
|
+
return { color: U(t) || t, position: 0, opacity: 100 };
|
|
2514
|
+
}, rt = (c) => {
|
|
2487
2515
|
const t = [];
|
|
2488
2516
|
let e = "", i = 0;
|
|
2489
|
-
for (let s = 0; s <
|
|
2490
|
-
const n =
|
|
2517
|
+
for (let s = 0; s < c.length; s++) {
|
|
2518
|
+
const n = c[s];
|
|
2491
2519
|
if (n === "(") i++;
|
|
2492
2520
|
else if (n === ")") i--;
|
|
2493
2521
|
else if (n === "," && i === 0) {
|
|
@@ -2497,16 +2525,16 @@ const ht = (h, t, e) => {
|
|
|
2497
2525
|
e += n;
|
|
2498
2526
|
}
|
|
2499
2527
|
return e.trim() && t.push(e.trim()), t;
|
|
2500
|
-
},
|
|
2501
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2528
|
+
}, ct = (c, t) => {
|
|
2529
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2502
2530
|
if (!i) return null;
|
|
2503
2531
|
const s = i.index + i[0].length;
|
|
2504
2532
|
let n = 1, a = s;
|
|
2505
|
-
for (let o = s; o <
|
|
2506
|
-
|
|
2507
|
-
return n === 0 ?
|
|
2508
|
-
},
|
|
2509
|
-
const t =
|
|
2533
|
+
for (let o = s; o < c.length && n > 0; o++)
|
|
2534
|
+
c[o] === "(" ? n++ : c[o] === ")" && n--, a = o;
|
|
2535
|
+
return n === 0 ? c.substring(s, a) : null;
|
|
2536
|
+
}, Jt = (c) => {
|
|
2537
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2510
2538
|
return [
|
|
2511
2539
|
"circle",
|
|
2512
2540
|
"ellipse",
|
|
@@ -2517,38 +2545,38 @@ const ht = (h, t, e) => {
|
|
|
2517
2545
|
"at",
|
|
2518
2546
|
"contain",
|
|
2519
2547
|
"cover"
|
|
2520
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2521
|
-
},
|
|
2548
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || qt(t);
|
|
2549
|
+
}, ht = (c) => {
|
|
2522
2550
|
const t = [];
|
|
2523
|
-
return
|
|
2551
|
+
return c.forEach((e, i) => {
|
|
2524
2552
|
const s = e.trim();
|
|
2525
2553
|
if (!s) return;
|
|
2526
2554
|
let n = "", a = 0;
|
|
2527
2555
|
const o = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2528
|
-
o &&
|
|
2529
|
-
const l =
|
|
2556
|
+
o && mt(o[1].trim()) ? (n = o[1].trim(), a = parseFloat(o[2])) : (n = s, a = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2557
|
+
const l = ft(n);
|
|
2530
2558
|
l.position = Math.max(0, Math.min(100, Math.round(a))), t.push(l);
|
|
2531
2559
|
}), t;
|
|
2532
|
-
},
|
|
2533
|
-
const t =
|
|
2560
|
+
}, H = (c) => {
|
|
2561
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2534
2562
|
return {
|
|
2535
|
-
type:
|
|
2536
|
-
angle: typeof
|
|
2563
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2564
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2537
2565
|
stops: t.map((e, i) => ({
|
|
2538
2566
|
color: e.color || "#000000",
|
|
2539
2567
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2540
2568
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2541
2569
|
}))
|
|
2542
2570
|
};
|
|
2543
|
-
}, I = (
|
|
2544
|
-
const t =
|
|
2545
|
-
if (
|
|
2546
|
-
const s =
|
|
2547
|
-
return
|
|
2571
|
+
}, I = (c) => {
|
|
2572
|
+
const t = c.replace(/;$/, "").trim();
|
|
2573
|
+
if (_t(t)) {
|
|
2574
|
+
const s = ft(t);
|
|
2575
|
+
return H({ type: "solid", angle: 0, stops: [s] });
|
|
2548
2576
|
}
|
|
2549
|
-
const e =
|
|
2577
|
+
const e = ct(t, "linear-gradient");
|
|
2550
2578
|
if (e) {
|
|
2551
|
-
const s =
|
|
2579
|
+
const s = rt(e);
|
|
2552
2580
|
let n = 90, a = s;
|
|
2553
2581
|
const o = s[0];
|
|
2554
2582
|
if (o.includes("deg")) {
|
|
@@ -2564,30 +2592,30 @@ const ht = (h, t, e) => {
|
|
|
2564
2592
|
"to top right": 45,
|
|
2565
2593
|
"to top left": 315
|
|
2566
2594
|
}[o] ?? 90, a = s.slice(1));
|
|
2567
|
-
const l =
|
|
2568
|
-
return l.length ?
|
|
2595
|
+
const l = ht(a);
|
|
2596
|
+
return l.length ? H({ type: "linear", angle: n, stops: l }) : null;
|
|
2569
2597
|
}
|
|
2570
|
-
const i =
|
|
2598
|
+
const i = ct(t, "radial-gradient");
|
|
2571
2599
|
if (i) {
|
|
2572
|
-
const s =
|
|
2573
|
-
return a.length ?
|
|
2600
|
+
const s = rt(i), n = s[0] && !Jt(s[0]) ? s.slice(1) : s, a = ht(n);
|
|
2601
|
+
return a.length ? H({ type: "radial", angle: 0, stops: a }) : null;
|
|
2574
2602
|
}
|
|
2575
2603
|
return null;
|
|
2576
|
-
},
|
|
2577
|
-
if (
|
|
2578
|
-
const e =
|
|
2604
|
+
}, O = (c) => {
|
|
2605
|
+
if (c.type === "solid") {
|
|
2606
|
+
const e = c.stops[0], i = e.color;
|
|
2579
2607
|
if (i.startsWith("var(--"))
|
|
2580
2608
|
return i;
|
|
2581
2609
|
const s = e.opacity ?? 100, n = i.replace("#", ""), a = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2582
2610
|
return `#${n}${a}`;
|
|
2583
2611
|
}
|
|
2584
|
-
const t =
|
|
2585
|
-
(e) => `${
|
|
2612
|
+
const t = c.stops.map(
|
|
2613
|
+
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2586
2614
|
).join(", ");
|
|
2587
|
-
return
|
|
2588
|
-
},
|
|
2589
|
-
if (
|
|
2590
|
-
const t =
|
|
2615
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
2616
|
+
}, Zt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), Z = (c) => {
|
|
2617
|
+
if (c.type === "solid") {
|
|
2618
|
+
const t = c.stops[0];
|
|
2591
2619
|
if (t) {
|
|
2592
2620
|
const e = t.color;
|
|
2593
2621
|
if (e.startsWith("var(--"))
|
|
@@ -2597,14 +2625,14 @@ const ht = (h, t, e) => {
|
|
|
2597
2625
|
if (i === 100)
|
|
2598
2626
|
return e;
|
|
2599
2627
|
{
|
|
2600
|
-
const s =
|
|
2628
|
+
const s = Zt(i);
|
|
2601
2629
|
return `${e}${s}`;
|
|
2602
2630
|
}
|
|
2603
2631
|
}
|
|
2604
2632
|
return "#000000";
|
|
2605
2633
|
}
|
|
2606
|
-
return
|
|
2607
|
-
},
|
|
2634
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
2635
|
+
}, z = class z {
|
|
2608
2636
|
static defaults() {
|
|
2609
2637
|
return {
|
|
2610
2638
|
solid: [],
|
|
@@ -2614,7 +2642,7 @@ const ht = (h, t, e) => {
|
|
|
2614
2642
|
static normalizeList(t) {
|
|
2615
2643
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2616
2644
|
return t.forEach((s) => {
|
|
2617
|
-
let n =
|
|
2645
|
+
let n = U(s);
|
|
2618
2646
|
n || I(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2619
2647
|
}), i.slice(0, this.MAX_COLORS);
|
|
2620
2648
|
}
|
|
@@ -2651,14 +2679,16 @@ const ht = (h, t, e) => {
|
|
|
2651
2679
|
}
|
|
2652
2680
|
static getColors(t) {
|
|
2653
2681
|
if (t === "all") {
|
|
2654
|
-
const e = this.list("solid"), i = this.list("gradient"), s = [
|
|
2682
|
+
const e = this.list("solid"), i = this.list("gradient"), s = [], n = Math.max(e.length, i.length);
|
|
2683
|
+
for (let a = 0; a < n; a++)
|
|
2684
|
+
a < e.length && s.push(e[a]), a < i.length && s.push(i[a]);
|
|
2655
2685
|
return this.normalizeList(s);
|
|
2656
2686
|
}
|
|
2657
2687
|
return [...this.list(t)];
|
|
2658
2688
|
}
|
|
2659
2689
|
static addColor(t, e) {
|
|
2660
2690
|
if (!t) return;
|
|
2661
|
-
let i =
|
|
2691
|
+
let i = U(t), s = "solid";
|
|
2662
2692
|
if (i)
|
|
2663
2693
|
s = "solid";
|
|
2664
2694
|
else {
|
|
@@ -2670,9 +2700,9 @@ const ht = (h, t, e) => {
|
|
|
2670
2700
|
o !== -1 && a.splice(o, 1), a.unshift(i), a.length > this.MAX_COLORS && (a.length = this.MAX_COLORS), this.persist();
|
|
2671
2701
|
}
|
|
2672
2702
|
};
|
|
2673
|
-
|
|
2674
|
-
let D =
|
|
2675
|
-
const
|
|
2703
|
+
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2704
|
+
let D = z;
|
|
2705
|
+
const ot = (c, t) => {
|
|
2676
2706
|
const e = document.createElement("div");
|
|
2677
2707
|
e.className = "color-picker-recent-section";
|
|
2678
2708
|
const i = document.createElement("div");
|
|
@@ -2681,9 +2711,9 @@ const it = (h, t) => {
|
|
|
2681
2711
|
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2682
2712
|
const n = () => {
|
|
2683
2713
|
s.style.display = "none";
|
|
2684
|
-
}, a = (p,
|
|
2714
|
+
}, a = (p, h) => {
|
|
2685
2715
|
const d = p.getBoundingClientRect();
|
|
2686
|
-
s.textContent =
|
|
2716
|
+
s.textContent = h, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
2687
2717
|
}, o = document.createElement("div");
|
|
2688
2718
|
o.className = "color-picker-recent-grid";
|
|
2689
2719
|
const l = document.createElement("div");
|
|
@@ -2695,11 +2725,17 @@ const it = (h, t) => {
|
|
|
2695
2725
|
o.style.display = "none", l.style.display = "block";
|
|
2696
2726
|
return;
|
|
2697
2727
|
}
|
|
2698
|
-
o.style.display = "grid", l.style.display = "none", p.forEach((
|
|
2728
|
+
o.style.display = "grid", l.style.display = "none", p.forEach((h) => {
|
|
2699
2729
|
const d = document.createElement("button");
|
|
2700
2730
|
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
2701
|
-
const
|
|
2702
|
-
d.title =
|
|
2731
|
+
const g = Xt(h);
|
|
2732
|
+
if (d.title = g, d.setAttribute("aria-label", `Use color: ${g}`), h.includes("gradient(")) {
|
|
2733
|
+
d.style.backgroundImage = h, d.style.backgroundColor = "transparent";
|
|
2734
|
+
const m = I(h);
|
|
2735
|
+
m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
|
|
2736
|
+
} else
|
|
2737
|
+
d.style.backgroundColor = h, d.style.borderColor = h;
|
|
2738
|
+
d.addEventListener("mouseenter", () => a(d, g)), d.addEventListener("mouseleave", () => {
|
|
2703
2739
|
n(), d.style.boxShadow = "";
|
|
2704
2740
|
}), d.addEventListener("mousedown", () => {
|
|
2705
2741
|
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
@@ -2708,47 +2744,47 @@ const it = (h, t) => {
|
|
|
2708
2744
|
d.style.boxShadow = "";
|
|
2709
2745
|
}, 150);
|
|
2710
2746
|
}), d.addEventListener("click", () => {
|
|
2711
|
-
n(), h
|
|
2747
|
+
n(), c(h);
|
|
2712
2748
|
}), o.appendChild(d);
|
|
2713
2749
|
});
|
|
2714
2750
|
};
|
|
2715
2751
|
return r(), { container: e, refresh: r };
|
|
2716
|
-
},
|
|
2717
|
-
const t = I(
|
|
2752
|
+
}, Xt = (c) => {
|
|
2753
|
+
const t = I(c);
|
|
2718
2754
|
if (t)
|
|
2719
|
-
return
|
|
2720
|
-
const e =
|
|
2755
|
+
return Z(t);
|
|
2756
|
+
const e = U(c);
|
|
2721
2757
|
if (e) {
|
|
2722
|
-
const i =
|
|
2758
|
+
const i = N(e);
|
|
2723
2759
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2724
2760
|
}
|
|
2725
|
-
return
|
|
2726
|
-
},
|
|
2761
|
+
return c;
|
|
2762
|
+
}, vt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2727
2763
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2728
2764
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2729
2765
|
fill="#919EAB"/>
|
|
2730
|
-
</svg>`,
|
|
2766
|
+
</svg>`, Ct = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2731
2767
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2732
|
-
</svg>`,
|
|
2768
|
+
</svg>`, Kt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2733
2769
|
<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"/>
|
|
2734
|
-
</svg>`,
|
|
2770
|
+
</svg>`, Yt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2735
2771
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2736
|
-
</svg>`,
|
|
2772
|
+
</svg>`, Qt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2737
2773
|
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2738
2774
|
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2739
2775
|
</svg>
|
|
2740
2776
|
|
|
2741
|
-
`,
|
|
2777
|
+
`, te = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2742
2778
|
<path d="M4.5 21L19.5 21C19.8978 21 20.2794 20.842 20.5607 20.5607C20.842 20.2794 21 19.8978 21 19.5L21 4.5C21 4.10218 20.842 3.72065 20.5607 3.43934C20.2794 3.15804 19.8978 3 19.5 3L4.5 3C4.10218 3 3.72065 3.15804 3.43934 3.43934C3.15804 3.72064 3 4.10218 3 4.5L3 19.5C3 19.8978 3.15804 20.2794 3.43934 20.5607C3.72065 20.842 4.10218 21 4.5 21ZM7.5 4.5L7.5 7.5L10.5 7.5L10.5 4.5L13.5 4.5L13.5 7.5L16.5 7.5L16.5 10.5L13.5 10.5L13.5 13.5L16.5 13.5L16.5 16.5L13.5 16.5L13.5 19.5L10.5 19.5L10.5 16.5L7.5 16.5L7.5 19.5L4.5 19.5L4.5 4.5L7.5 4.5Z" fill="#637381"/>
|
|
2743
2779
|
<path d="M13.5 16.5L10.5 16.5L10.5 13.5L13.5 13.5L13.5 16.5ZM13.5 10.5L10.5 10.5L10.5 7.5L13.5 7.5L13.5 10.5ZM10.5 13.5L7.5 13.5L7.5 10.5L10.5 10.5L10.5 13.5Z" fill="#637381"/>
|
|
2744
2780
|
</svg>
|
|
2745
2781
|
|
|
2746
|
-
`,
|
|
2782
|
+
`, ee = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2747
2783
|
<path d="M20.6106 19.5062C20.6887 19.5843 20.6887 19.711 20.6106 19.7891L19.7896 20.6101C19.7115 20.6882 19.5848 20.6882 19.5067 20.6101L5.98957 7.09298C5.91146 7.01488 5.91146 6.88825 5.98957 6.81014L6.81063 5.98908C6.88873 5.91097 7.01537 5.91097 7.09347 5.98908L20.6106 19.5062Z" fill="#46525C"/>
|
|
2748
2784
|
<path d="M9.69583 12.2146C9.81298 12.3318 9.81298 12.5217 9.69583 12.6389L7.80151 14.5332C6.72071 15.614 6.6062 17.4365 7.80151 18.6318C8.99473 19.8267 10.8184 19.7123 11.8992 18.6318L13.7935 16.7366C13.9106 16.6194 14.1006 16.6194 14.2178 16.7366L14.816 17.3348C14.9331 17.4519 14.9332 17.6418 14.816 17.759L12.9216 19.6543C11.2241 21.3536 8.47364 21.3518 6.77417 19.6543C5.07483 17.9568 5.0749 15.2064 6.77417 13.5068L8.66848 11.6116C8.78563 11.4944 8.97562 11.4944 9.0928 11.6116L9.69583 12.2146ZM13.5085 6.77441C15.2061 5.07514 17.9565 5.07509 19.656 6.77441C21.3535 8.47388 21.3533 11.2243 19.656 12.9238L17.7607 14.8182C17.6436 14.9354 17.4536 14.9353 17.3365 14.8182L16.7344 14.2161C16.6172 14.0989 16.6172 13.9089 16.7344 13.7918L18.6296 11.8975C19.7101 10.8167 19.8245 8.99503 18.6296 7.7998C17.4363 6.60449 15.6118 6.719 14.531 7.7998L12.6367 9.69412C12.5195 9.81128 12.3296 9.81128 12.2124 9.69412L11.6123 9.09402C11.4952 8.97684 11.4952 8.78685 11.6124 8.6697L13.5085 6.77441Z" fill="#46525C"/>
|
|
2749
2785
|
</svg>
|
|
2750
2786
|
`;
|
|
2751
|
-
class
|
|
2787
|
+
class dt {
|
|
2752
2788
|
constructor(t, e = "gradient") {
|
|
2753
2789
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2754
2790
|
if (!this.isOpen) return;
|
|
@@ -2790,7 +2826,7 @@ class Yt {
|
|
|
2790
2826
|
const i = document.createElement("span");
|
|
2791
2827
|
i.textContent = "Color";
|
|
2792
2828
|
const s = document.createElement("button");
|
|
2793
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2829
|
+
s.className = "color-picker-close", s.innerHTML = vt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ut(e, t);
|
|
2794
2830
|
const n = document.createElement("div");
|
|
2795
2831
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2796
2832
|
const a = document.createElement("div");
|
|
@@ -2798,84 +2834,82 @@ class Yt {
|
|
|
2798
2834
|
const o = document.createElement("div");
|
|
2799
2835
|
o.className = "color-picker-sliders-container";
|
|
2800
2836
|
const l = document.createElement("button");
|
|
2801
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2837
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Ct;
|
|
2802
2838
|
const r = document.createElement("div");
|
|
2803
2839
|
r.className = "color-picker-sliders-group";
|
|
2804
2840
|
const p = document.createElement("div");
|
|
2805
2841
|
p.className = "color-picker-hue", this.hueSlider = p;
|
|
2806
|
-
const
|
|
2807
|
-
|
|
2842
|
+
const h = document.createElement("div");
|
|
2843
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, p.appendChild(h);
|
|
2808
2844
|
const d = document.createElement("div");
|
|
2809
2845
|
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2812
|
-
const
|
|
2813
|
-
var
|
|
2814
|
-
this.setColor(b), (
|
|
2846
|
+
const g = document.createElement("div");
|
|
2847
|
+
g.className = "color-picker-opacity-marker", this.opacityMarker = g, d.appendChild(g), r.appendChild(p), r.appendChild(d), o.appendChild(l), o.appendChild(r);
|
|
2848
|
+
const C = ot((b) => {
|
|
2849
|
+
var E;
|
|
2850
|
+
this.setColor(b), (E = this.onChange) == null || E.call(this, b, this.currentOpacity);
|
|
2815
2851
|
}, this.recentScope);
|
|
2816
|
-
this.recentSectionRefresh =
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2852
|
+
this.recentSectionRefresh = C.refresh;
|
|
2853
|
+
const m = document.createElement("div");
|
|
2854
|
+
m.className = "color-picker-format-section";
|
|
2855
|
+
const u = document.createElement("select");
|
|
2856
|
+
u.className = "color-picker-format-select", this.select = u;
|
|
2821
2857
|
const f = document.createElement("option");
|
|
2822
2858
|
f.value = "hex", f.textContent = "HEX";
|
|
2823
|
-
const
|
|
2824
|
-
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2829
|
-
const
|
|
2830
|
-
|
|
2831
|
-
const
|
|
2832
|
-
return
|
|
2859
|
+
const v = document.createElement("option");
|
|
2860
|
+
v.value = "rgb", v.textContent = "RGB";
|
|
2861
|
+
const y = document.createElement("option");
|
|
2862
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(y);
|
|
2863
|
+
const w = document.createElement("input");
|
|
2864
|
+
w.type = "text", w.className = "color-picker-color-input", w.value = this.currentColor, this.input = w;
|
|
2865
|
+
const k = document.createElement("div");
|
|
2866
|
+
k.className = "color-picker-input-container";
|
|
2867
|
+
const S = document.createElement("button");
|
|
2868
|
+
return S.className = "color-picker-copy-inside", S.textContent = "Copy", k.appendChild(w), k.appendChild(S), m.appendChild(u), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(o), t.appendChild(C.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, w, u, S, l), t;
|
|
2833
2869
|
}
|
|
2834
2870
|
createBackdrop() {
|
|
2835
2871
|
const t = document.createElement("div");
|
|
2836
|
-
return t.className = "color-picker-backdrop", t.style.display = "none", t.
|
|
2837
|
-
e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
2838
|
-
}), t;
|
|
2872
|
+
return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
|
|
2839
2873
|
}
|
|
2840
2874
|
bind(t, e, i, s, n, a, o) {
|
|
2841
|
-
const l = (
|
|
2842
|
-
var
|
|
2843
|
-
const d = t.getBoundingClientRect(),
|
|
2844
|
-
this.colorMarker.style.left = `${
|
|
2845
|
-
const
|
|
2846
|
-
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (
|
|
2847
|
-
}, r = (
|
|
2848
|
-
var
|
|
2875
|
+
const l = (h) => {
|
|
2876
|
+
var v;
|
|
2877
|
+
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
2878
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
2879
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - C);
|
|
2880
|
+
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
2881
|
+
}, r = (h) => {
|
|
2882
|
+
var v;
|
|
2849
2883
|
const d = e.getBoundingClientRect();
|
|
2850
|
-
let
|
|
2851
|
-
this.hueMarker.style.left = `${
|
|
2852
|
-
const
|
|
2853
|
-
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${
|
|
2854
|
-
}, p = (
|
|
2855
|
-
var
|
|
2856
|
-
const d = i.getBoundingClientRect(),
|
|
2857
|
-
this.opacityMarker.style.left = `${
|
|
2884
|
+
let g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2885
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
2886
|
+
const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
|
|
2887
|
+
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
2888
|
+
}, p = (h) => {
|
|
2889
|
+
var C;
|
|
2890
|
+
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2891
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
|
|
2858
2892
|
};
|
|
2859
|
-
t.addEventListener("mousedown", (
|
|
2860
|
-
|
|
2861
|
-
const d = (
|
|
2862
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2893
|
+
t.addEventListener("mousedown", (h) => {
|
|
2894
|
+
h.preventDefault(), l(h);
|
|
2895
|
+
const d = (C) => l(C), g = () => {
|
|
2896
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2863
2897
|
};
|
|
2864
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2865
|
-
}), e.addEventListener("mousedown", (
|
|
2866
|
-
|
|
2867
|
-
const d = (
|
|
2868
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2898
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2899
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
2900
|
+
h.preventDefault(), r(h);
|
|
2901
|
+
const d = (C) => r(C), g = () => {
|
|
2902
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2869
2903
|
};
|
|
2870
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2871
|
-
}), i.addEventListener("mousedown", (
|
|
2872
|
-
|
|
2873
|
-
const d = (
|
|
2874
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
2904
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2905
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
2906
|
+
h.preventDefault(), p(h);
|
|
2907
|
+
const d = (C) => p(C), g = () => {
|
|
2908
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
|
|
2875
2909
|
};
|
|
2876
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
2877
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2878
|
-
|
|
2910
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
2911
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
|
|
2912
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
2879
2913
|
}), a.addEventListener("click", async () => {
|
|
2880
2914
|
try {
|
|
2881
2915
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -2883,14 +2917,14 @@ class Yt {
|
|
|
2883
2917
|
s.select(), document.execCommand("copy");
|
|
2884
2918
|
}
|
|
2885
2919
|
}), o.addEventListener("click", async () => {
|
|
2886
|
-
var
|
|
2920
|
+
var h;
|
|
2887
2921
|
if (!("EyeDropper" in window)) {
|
|
2888
2922
|
alert("EyeDropper API is not supported in this browser.");
|
|
2889
2923
|
return;
|
|
2890
2924
|
}
|
|
2891
2925
|
try {
|
|
2892
|
-
const d = new window.EyeDropper(), { sRGBHex:
|
|
2893
|
-
this.setColor(
|
|
2926
|
+
const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
|
|
2927
|
+
this.setColor(g), (h = this.onChange) == null || h.call(this, g, this.currentOpacity);
|
|
2894
2928
|
} catch {
|
|
2895
2929
|
}
|
|
2896
2930
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2901,17 +2935,17 @@ class Yt {
|
|
|
2901
2935
|
setColor(t) {
|
|
2902
2936
|
var a;
|
|
2903
2937
|
this.currentColor = t;
|
|
2904
|
-
const { h: e, s: i, v: s } =
|
|
2938
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
2905
2939
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (a = this.onChange) == null || a.call(this, t, this.currentOpacity);
|
|
2906
2940
|
}
|
|
2907
2941
|
syncInput() {
|
|
2908
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2942
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
2909
2943
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2910
2944
|
else if (t === "rgb") {
|
|
2911
|
-
const { r: n, g: a, b: o } =
|
|
2945
|
+
const { r: n, g: a, b: o } = N(this.currentColor);
|
|
2912
2946
|
this.input.value = `rgb(${n}, ${a}, ${o})`;
|
|
2913
2947
|
} else {
|
|
2914
|
-
const { hue: n, sat: a, lightness: o } =
|
|
2948
|
+
const { hue: n, sat: a, lightness: o } = gt(e, i, s);
|
|
2915
2949
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2916
2950
|
a * 100
|
|
2917
2951
|
)}%, ${Math.round(o * 100)}%)`;
|
|
@@ -2930,30 +2964,30 @@ class Yt {
|
|
|
2930
2964
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2931
2965
|
if (s) {
|
|
2932
2966
|
const n = parseInt(s[1]), a = parseInt(s[2]) / 100, o = parseInt(s[3]) / 100, l = o + a * Math.min(o, 1 - o), r = l === 0 ? 0 : 2 * (1 - o / l);
|
|
2933
|
-
e =
|
|
2967
|
+
e = W(n, r, l);
|
|
2934
2968
|
}
|
|
2935
2969
|
}
|
|
2936
2970
|
}
|
|
2937
2971
|
e && this.setColor(e);
|
|
2938
2972
|
}
|
|
2939
2973
|
updateOpacityBg() {
|
|
2940
|
-
const { r: t, g: e, b: i } =
|
|
2974
|
+
const { r: t, g: e, b: i } = N(this.currentColor);
|
|
2941
2975
|
this.opacitySlider.style.setProperty(
|
|
2942
2976
|
"--base-color",
|
|
2943
2977
|
`rgb(${t}, ${e}, ${i})`
|
|
2944
2978
|
);
|
|
2945
2979
|
}
|
|
2946
2980
|
open(t, e, i) {
|
|
2947
|
-
var
|
|
2981
|
+
var y;
|
|
2948
2982
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2949
|
-
const { h: s, s: n, v: a } =
|
|
2950
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - a) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (
|
|
2951
|
-
const o = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth,
|
|
2952
|
-
let
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2955
|
-
const f =
|
|
2956
|
-
f >= l + d ?
|
|
2983
|
+
const { h: s, s: n, v: a } = R(t);
|
|
2984
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - a) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (y = this.recentSectionRefresh) == null || y.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2985
|
+
const o = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, h = window.innerHeight, d = 16;
|
|
2986
|
+
let g = r.right + 8, C = r.top;
|
|
2987
|
+
const m = p - r.right, u = r.left;
|
|
2988
|
+
m >= o + d ? g = r.right + 8 : u >= o + d ? g = r.left - o - 8 : g = Math.max(d, (p - o) / 2);
|
|
2989
|
+
const f = h - r.bottom, v = r.top;
|
|
2990
|
+
f >= l + d ? C = r.bottom + 8 : v >= l + d ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > h - d && (C = h - l - d)) : (C = r.top - l - 8, C < d && (C = d)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
|
|
2957
2991
|
}
|
|
2958
2992
|
close(t) {
|
|
2959
2993
|
var e;
|
|
@@ -2963,7 +2997,7 @@ class Yt {
|
|
|
2963
2997
|
return this.element;
|
|
2964
2998
|
}
|
|
2965
2999
|
}
|
|
2966
|
-
class
|
|
3000
|
+
class ie {
|
|
2967
3001
|
constructor(t) {
|
|
2968
3002
|
this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
|
|
2969
3003
|
}
|
|
@@ -2981,7 +3015,7 @@ class Qt {
|
|
|
2981
3015
|
const s = document.createElement("div");
|
|
2982
3016
|
s.className = "color-picker-sliders-container embedded";
|
|
2983
3017
|
const n = document.createElement("button");
|
|
2984
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
3018
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Ct;
|
|
2985
3019
|
const a = document.createElement("div");
|
|
2986
3020
|
a.className = "color-picker-sliders-group";
|
|
2987
3021
|
const o = document.createElement("div");
|
|
@@ -2992,70 +3026,70 @@ class Qt {
|
|
|
2992
3026
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
2993
3027
|
const p = document.createElement("div");
|
|
2994
3028
|
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), a.appendChild(o), a.appendChild(r), s.appendChild(n), s.appendChild(a);
|
|
2995
|
-
const
|
|
2996
|
-
const
|
|
2997
|
-
|
|
3029
|
+
const h = ot((w) => {
|
|
3030
|
+
const k = I(w);
|
|
3031
|
+
k && k.type !== "solid" ? this.onColorChange(w, this.currentOpacity) : (this.setColor(w), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
2998
3032
|
}, "all");
|
|
2999
|
-
this.recentSectionRefresh =
|
|
3033
|
+
this.recentSectionRefresh = h.refresh;
|
|
3000
3034
|
const d = document.createElement("div");
|
|
3001
3035
|
d.className = "color-picker-format-section embedded";
|
|
3002
|
-
const
|
|
3003
|
-
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3006
|
-
const v = document.createElement("option");
|
|
3007
|
-
v.value = "rgb", v.textContent = "RGB";
|
|
3036
|
+
const g = document.createElement("select");
|
|
3037
|
+
g.className = "color-picker-format-select", this.select = g;
|
|
3038
|
+
const C = document.createElement("option");
|
|
3039
|
+
C.value = "hex", C.textContent = "HEX";
|
|
3008
3040
|
const m = document.createElement("option");
|
|
3009
|
-
m.value = "
|
|
3041
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
3042
|
+
const u = document.createElement("option");
|
|
3043
|
+
u.value = "hsl", u.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(u);
|
|
3010
3044
|
const f = document.createElement("input");
|
|
3011
3045
|
f.type = "text", f.className = "color-picker-color-input", this.input = f;
|
|
3012
|
-
const
|
|
3013
|
-
|
|
3014
|
-
const
|
|
3015
|
-
return
|
|
3046
|
+
const v = document.createElement("div");
|
|
3047
|
+
v.className = "color-picker-input-container";
|
|
3048
|
+
const y = document.createElement("button");
|
|
3049
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), d.appendChild(g), d.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(h.container), this.bind(e, o, r, f, g, y, n), t;
|
|
3016
3050
|
}
|
|
3017
3051
|
bind(t, e, i, s, n, a, o) {
|
|
3018
|
-
const l = (
|
|
3019
|
-
const d = t.getBoundingClientRect(),
|
|
3020
|
-
this.colorMarker.style.left = `${
|
|
3021
|
-
const
|
|
3052
|
+
const l = (h) => {
|
|
3053
|
+
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
3054
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
3055
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - C);
|
|
3022
3056
|
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3023
|
-
}, r = (
|
|
3024
|
-
const d = e.getBoundingClientRect(),
|
|
3025
|
-
this.hueMarker.style.left = `${
|
|
3026
|
-
const
|
|
3057
|
+
}, r = (h) => {
|
|
3058
|
+
const d = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3059
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
3060
|
+
const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
|
|
3027
3061
|
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3028
|
-
linear-gradient(to right, #fff, hsl(${
|
|
3029
|
-
}, p = (
|
|
3030
|
-
const d = i.getBoundingClientRect(),
|
|
3031
|
-
this.opacityMarker.style.left = `${
|
|
3062
|
+
linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3063
|
+
}, p = (h) => {
|
|
3064
|
+
const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3065
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
|
|
3032
3066
|
};
|
|
3033
|
-
t.addEventListener("mousedown", (
|
|
3034
|
-
|
|
3035
|
-
const d = (
|
|
3036
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
3067
|
+
t.addEventListener("mousedown", (h) => {
|
|
3068
|
+
h.preventDefault(), this.isDragging = !0, l(h);
|
|
3069
|
+
const d = (C) => l(C), g = () => {
|
|
3070
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3037
3071
|
};
|
|
3038
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
3039
|
-
}), e.addEventListener("mousedown", (
|
|
3040
|
-
|
|
3041
|
-
const d = (
|
|
3042
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
3072
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
3073
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
3074
|
+
h.preventDefault(), this.isDragging = !0, r(h);
|
|
3075
|
+
const d = (C) => r(C), g = () => {
|
|
3076
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3043
3077
|
};
|
|
3044
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
3045
|
-
}), i.addEventListener("mousedown", (
|
|
3046
|
-
|
|
3047
|
-
const d = (
|
|
3048
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup",
|
|
3078
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
3079
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
3080
|
+
h.preventDefault(), this.isDragging = !0, p(h);
|
|
3081
|
+
const d = (C) => p(C), g = () => {
|
|
3082
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3049
3083
|
};
|
|
3050
|
-
document.addEventListener("mousemove", d), document.addEventListener("mouseup",
|
|
3084
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
|
|
3051
3085
|
}), n.addEventListener("change", () => {
|
|
3052
3086
|
this.syncInput();
|
|
3053
3087
|
}), s.addEventListener("input", () => {
|
|
3054
3088
|
this.applyFromInput();
|
|
3055
3089
|
}), s.addEventListener("blur", () => {
|
|
3056
3090
|
this.syncInput();
|
|
3057
|
-
}), s.addEventListener("keydown", (
|
|
3058
|
-
|
|
3091
|
+
}), s.addEventListener("keydown", (h) => {
|
|
3092
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
3059
3093
|
}), a.addEventListener("click", async () => {
|
|
3060
3094
|
try {
|
|
3061
3095
|
await navigator.clipboard.writeText(s.value);
|
|
@@ -3068,7 +3102,7 @@ class Qt {
|
|
|
3068
3102
|
return;
|
|
3069
3103
|
}
|
|
3070
3104
|
try {
|
|
3071
|
-
const
|
|
3105
|
+
const h = new window.EyeDropper(), { sRGBHex: d } = await h.open();
|
|
3072
3106
|
this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3073
3107
|
} catch {
|
|
3074
3108
|
}
|
|
@@ -3076,19 +3110,19 @@ class Qt {
|
|
|
3076
3110
|
}
|
|
3077
3111
|
setColor(t) {
|
|
3078
3112
|
this.currentColor = t;
|
|
3079
|
-
const { h: e, s: i, v: s } =
|
|
3113
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
3080
3114
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3081
3115
|
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3082
3116
|
}
|
|
3083
3117
|
syncInput() {
|
|
3084
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
3118
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
3085
3119
|
if (t === "hex")
|
|
3086
3120
|
this.input.value = this.currentColor;
|
|
3087
3121
|
else if (t === "rgb") {
|
|
3088
|
-
const { r: n, g: a, b: o } =
|
|
3122
|
+
const { r: n, g: a, b: o } = N(this.currentColor);
|
|
3089
3123
|
this.input.value = `rgb(${n}, ${a}, ${o})`;
|
|
3090
3124
|
} else {
|
|
3091
|
-
const { hue: n, sat: a, lightness: o } =
|
|
3125
|
+
const { hue: n, sat: a, lightness: o } = gt(e, i, s);
|
|
3092
3126
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3093
3127
|
a * 100
|
|
3094
3128
|
)}%, ${Math.round(o * 100)}%)`;
|
|
@@ -3108,14 +3142,14 @@ class Qt {
|
|
|
3108
3142
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3109
3143
|
if (s) {
|
|
3110
3144
|
const n = parseInt(s[1], 10), a = parseInt(s[2], 10) / 100, o = parseInt(s[3], 10) / 100, l = o + a * Math.min(o, 1 - o), r = l === 0 ? 0 : 2 * (1 - o / l);
|
|
3111
|
-
e =
|
|
3145
|
+
e = W(n, r, l);
|
|
3112
3146
|
}
|
|
3113
3147
|
}
|
|
3114
3148
|
}
|
|
3115
3149
|
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3116
3150
|
}
|
|
3117
3151
|
updateOpacityBg() {
|
|
3118
|
-
const { r: t, g: e, b: i } =
|
|
3152
|
+
const { r: t, g: e, b: i } = N(this.currentColor);
|
|
3119
3153
|
this.opacitySlider.style.setProperty(
|
|
3120
3154
|
"--base-color",
|
|
3121
3155
|
`rgb(${t}, ${e}, ${i})`
|
|
@@ -3137,7 +3171,7 @@ class Qt {
|
|
|
3137
3171
|
initFromColor(t, e) {
|
|
3138
3172
|
var o;
|
|
3139
3173
|
this.currentColor = t, this.currentOpacity = e;
|
|
3140
|
-
const { h: i, s, v: n } =
|
|
3174
|
+
const { h: i, s, v: n } = R(t), a = i >= 360 ? i % 360 : i;
|
|
3141
3175
|
this.hueMarker.style.left = `${a / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3142
3176
|
linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (o = this.recentSectionRefresh) == null || o.call(this);
|
|
3143
3177
|
}
|
|
@@ -3156,7 +3190,7 @@ class Qt {
|
|
|
3156
3190
|
this.initFromColor(t, e);
|
|
3157
3191
|
}
|
|
3158
3192
|
}
|
|
3159
|
-
const
|
|
3193
|
+
const $ = class $ extends x {
|
|
3160
3194
|
constructor(t = {}) {
|
|
3161
3195
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3162
3196
|
super({
|
|
@@ -3167,17 +3201,17 @@ const P = class P extends x {
|
|
|
3167
3201
|
type: "text",
|
|
3168
3202
|
angle: "number",
|
|
3169
3203
|
stops: "text"
|
|
3170
|
-
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
3204
|
+
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
3171
3205
|
var d;
|
|
3172
3206
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3173
|
-
const s = i.target, n = this.popoverEl.contains(s), a = (d = this.element) == null ? void 0 : d.contains(s), o = document.querySelectorAll(".custom-color-picker"), l = Array.from(o).some((
|
|
3207
|
+
const s = i.target, n = this.popoverEl.contains(s), a = (d = this.element) == null ? void 0 : d.contains(s), o = document.querySelectorAll(".custom-color-picker"), l = Array.from(o).some((g) => g.contains(s)), r = s.closest(
|
|
3174
3208
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3175
3209
|
), p = s.classList.contains(
|
|
3176
3210
|
"color-picker-backdrop"
|
|
3177
|
-
),
|
|
3211
|
+
), h = s.classList.contains(
|
|
3178
3212
|
"gradient-popover-backdrop"
|
|
3179
3213
|
);
|
|
3180
|
-
!n && !a && !l && !r && !p && !
|
|
3214
|
+
!n && !a && !l && !r && !p && !h && this.closePopover();
|
|
3181
3215
|
}, this.handlePopoverKeydown = (i) => {
|
|
3182
3216
|
if (this.isPopoverOpen) {
|
|
3183
3217
|
if (i.key === "Escape") {
|
|
@@ -3191,7 +3225,7 @@ const P = class P extends x {
|
|
|
3191
3225
|
i.preventDefault(), this.closePopover();
|
|
3192
3226
|
}
|
|
3193
3227
|
}
|
|
3194
|
-
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3228
|
+
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue(), this.setLinkedGlobalVariableFrom(this.originalDefault ?? this.value);
|
|
3195
3229
|
}
|
|
3196
3230
|
resolveGlobalVarColor(t) {
|
|
3197
3231
|
if (t.startsWith("var(--")) {
|
|
@@ -3200,33 +3234,46 @@ const P = class P extends x {
|
|
|
3200
3234
|
}
|
|
3201
3235
|
return t;
|
|
3202
3236
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
if (!e.startsWith("var(--"))
|
|
3208
|
-
return;
|
|
3209
|
-
const i = this.resolveGlobalVarColor(e);
|
|
3210
|
-
if (i === e) {
|
|
3211
|
-
console.warn(`Could not resolve global variable: ${e}`);
|
|
3237
|
+
setLinkedGlobalVariableFrom(t) {
|
|
3238
|
+
var i, s;
|
|
3239
|
+
if (!t) {
|
|
3240
|
+
this.linkedGlobalVariable = null;
|
|
3212
3241
|
return;
|
|
3213
3242
|
}
|
|
3214
|
-
|
|
3243
|
+
const e = typeof t == "string" ? t : ((s = (i = t.stops) == null ? void 0 : i[0]) == null ? void 0 : s.color) ?? null;
|
|
3244
|
+
this.linkedGlobalVariable = e && e.startsWith("var(--") ? e : null;
|
|
3245
|
+
}
|
|
3246
|
+
isBoundToGlobal() {
|
|
3247
|
+
return !!this.linkedGlobalVariable;
|
|
3248
|
+
}
|
|
3249
|
+
clearGlobalBindingForCustomChange() {
|
|
3250
|
+
var t, e;
|
|
3251
|
+
this.isBoundToGlobal() && ((e = (t = this.value) == null ? void 0 : t.stops) != null && e.length && (this.value.stops = this.value.stops.map((i) => ({
|
|
3252
|
+
...i,
|
|
3253
|
+
color: this.resolveGlobalVarColor(i.color)
|
|
3254
|
+
}))), this.linkedGlobalVariable = null, this.updateUnlinkButtonVisibility());
|
|
3255
|
+
}
|
|
3256
|
+
breakGlobalBinding() {
|
|
3257
|
+
var t;
|
|
3258
|
+
!this.isBoundToGlobal() || !this.value || ((t = this.value.stops) != null && t.length && (this.value.stops = this.value.stops.map((e) => ({
|
|
3259
|
+
...e,
|
|
3260
|
+
color: this.resolveGlobalVarColor(e.color)
|
|
3261
|
+
}))), this.linkedGlobalVariable = null, this.updateUI(), this.triggerChange(), this.isPopoverOpen && this.refreshPopoverContent());
|
|
3215
3262
|
}
|
|
3216
3263
|
defaultValue() {
|
|
3217
3264
|
const t = this.originalDefault;
|
|
3218
3265
|
if (typeof t == "string") {
|
|
3219
3266
|
if (t.startsWith("var(--"))
|
|
3220
|
-
return
|
|
3267
|
+
return H({
|
|
3221
3268
|
type: "solid",
|
|
3222
3269
|
angle: 0,
|
|
3223
3270
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3224
3271
|
});
|
|
3225
3272
|
const i = I(t);
|
|
3226
3273
|
if (i)
|
|
3227
|
-
return
|
|
3274
|
+
return H(i);
|
|
3228
3275
|
}
|
|
3229
|
-
return
|
|
3276
|
+
return H(t && typeof t == "object" ? t : {
|
|
3230
3277
|
type: "linear",
|
|
3231
3278
|
angle: 90,
|
|
3232
3279
|
stops: [
|
|
@@ -3236,24 +3283,29 @@ const P = class P extends x {
|
|
|
3236
3283
|
});
|
|
3237
3284
|
}
|
|
3238
3285
|
setValue(t) {
|
|
3239
|
-
var i, s;
|
|
3240
3286
|
let e = null;
|
|
3241
|
-
typeof t == "string" ? t.startsWith("var(--") ? e =
|
|
3287
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = H({
|
|
3242
3288
|
type: "solid",
|
|
3243
3289
|
angle: 0,
|
|
3244
3290
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3245
|
-
}) : e = I(t) : t && typeof t == "object" && (e =
|
|
3291
|
+
}) : e = I(t) : t && typeof t == "object" && (e = H(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
|
|
3246
3292
|
}
|
|
3247
3293
|
updateUI() {
|
|
3248
3294
|
if (this.previewEl && this.value)
|
|
3249
3295
|
if (this.value.type === "solid") {
|
|
3250
3296
|
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3251
|
-
this.previewEl.style.background =
|
|
3297
|
+
this.previewEl.style.background = st(i, e);
|
|
3252
3298
|
} else {
|
|
3253
3299
|
const t = this.resolveGradientGlobalVars(this.value);
|
|
3254
|
-
this.previewEl.style.background =
|
|
3300
|
+
this.previewEl.style.background = O(t);
|
|
3255
3301
|
}
|
|
3256
|
-
this.inputEl && this.value && !this.isEditing
|
|
3302
|
+
if (this.inputEl && this.value && !this.isEditing)
|
|
3303
|
+
if (this.isBoundToGlobal() && this.linkedGlobalVariable) {
|
|
3304
|
+
const e = this.linkedGlobalVariable.replace("var(--", "").replace(")", "").split("-").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
|
|
3305
|
+
this.inputEl.value = `Linked: ${e}`;
|
|
3306
|
+
} else
|
|
3307
|
+
this.inputEl.value = Z(this.value);
|
|
3308
|
+
this.updateUnlinkButtonVisibility();
|
|
3257
3309
|
}
|
|
3258
3310
|
resolveGradientGlobalVars(t) {
|
|
3259
3311
|
return {
|
|
@@ -3265,12 +3317,12 @@ const P = class P extends x {
|
|
|
3265
3317
|
};
|
|
3266
3318
|
}
|
|
3267
3319
|
updateUnlinkButtonVisibility() {
|
|
3268
|
-
if (!this.unlinkButton
|
|
3269
|
-
this.
|
|
3320
|
+
if (!this.unlinkButton) return;
|
|
3321
|
+
this.isBoundToGlobal() ? this.unlinkButton.classList.add("visible") : this.unlinkButton.classList.remove("visible");
|
|
3270
3322
|
}
|
|
3271
3323
|
cssForTextValue() {
|
|
3272
3324
|
return this.value ? {
|
|
3273
|
-
background:
|
|
3325
|
+
background: O(this.value),
|
|
3274
3326
|
"-webkit-background-clip": "text",
|
|
3275
3327
|
"background-clip": "text",
|
|
3276
3328
|
color: "transparent",
|
|
@@ -3286,9 +3338,9 @@ const P = class P extends x {
|
|
|
3286
3338
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3287
3339
|
}
|
|
3288
3340
|
const e = document.createElement("div");
|
|
3289
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3341
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? O(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
3290
3342
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3291
|
-
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ?
|
|
3343
|
+
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? Z(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3292
3344
|
if (this.isEditing = !0, this.value)
|
|
3293
3345
|
if (this.value.type === "solid") {
|
|
3294
3346
|
const i = this.value.stops[0];
|
|
@@ -3302,42 +3354,39 @@ const P = class P extends x {
|
|
|
3302
3354
|
}
|
|
3303
3355
|
}
|
|
3304
3356
|
} else
|
|
3305
|
-
this.inputEl.value =
|
|
3357
|
+
this.inputEl.value = O(this.value);
|
|
3306
3358
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3307
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3359
|
+
this.isEditing = !1, this.value && (this.inputEl.value = Z(this.value));
|
|
3308
3360
|
}), this.inputEl.addEventListener(
|
|
3309
3361
|
"paste",
|
|
3310
3362
|
(i) => this.handlePaste(i)
|
|
3311
3363
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3312
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3313
|
-
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML =
|
|
3364
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = O(this.value)), this.inputEl.blur());
|
|
3365
|
+
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = ee, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
3314
3366
|
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3315
3367
|
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3316
3368
|
}
|
|
3317
3369
|
createPopover() {
|
|
3318
|
-
var l, r, p;
|
|
3319
3370
|
if (this.popoverEl) return;
|
|
3320
|
-
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (
|
|
3321
|
-
|
|
3322
|
-
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (c) => {
|
|
3323
|
-
c.stopPropagation();
|
|
3371
|
+
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.style.pointerEvents = "none", this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (l) => {
|
|
3372
|
+
l.stopPropagation();
|
|
3324
3373
|
});
|
|
3325
3374
|
const t = document.createElement("div");
|
|
3326
3375
|
t.className = "gradient-popover-header", t.style.cursor = "move";
|
|
3327
3376
|
let e = null;
|
|
3328
3377
|
if (this.variant !== "global") {
|
|
3329
3378
|
e = document.createElement("div"), e.className = "color-setting-tabs header-tabs";
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3332
|
-
const
|
|
3333
|
-
|
|
3379
|
+
const l = document.createElement("button");
|
|
3380
|
+
l.className = "color-tab active", l.textContent = "Custom";
|
|
3381
|
+
const r = document.createElement("button");
|
|
3382
|
+
r.className = "color-tab", r.textContent = "Global", e.appendChild(l), e.appendChild(r), t.appendChild(e);
|
|
3334
3383
|
} else {
|
|
3335
|
-
const
|
|
3336
|
-
t.appendChild(
|
|
3384
|
+
const l = document.createElement("div");
|
|
3385
|
+
t.appendChild(l);
|
|
3337
3386
|
}
|
|
3338
3387
|
const i = document.createElement("button");
|
|
3339
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3340
|
-
this.popoverPosition = { left:
|
|
3388
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = vt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), ut(t, this.popoverEl, (l, r) => {
|
|
3389
|
+
this.popoverPosition = { left: l, top: r };
|
|
3341
3390
|
});
|
|
3342
3391
|
const s = document.createElement("div");
|
|
3343
3392
|
s.className = "gradient-editor";
|
|
@@ -3347,10 +3396,10 @@ const P = class P extends x {
|
|
|
3347
3396
|
n.appendChild(a), s.appendChild(n);
|
|
3348
3397
|
const o = document.createElement("div");
|
|
3349
3398
|
if (o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.variant !== "global" && e) {
|
|
3350
|
-
const
|
|
3351
|
-
this.currentMode =
|
|
3399
|
+
const l = e.children[0], r = e.children[1], p = (h) => {
|
|
3400
|
+
this.currentMode = h, h === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(o);
|
|
3352
3401
|
};
|
|
3353
|
-
|
|
3402
|
+
l.addEventListener("click", () => p("custom")), r.addEventListener("click", () => p("global")), this.isBoundToGlobal() ? (this.currentMode = "global", p("global")) : (this.currentMode = "custom", p("custom"));
|
|
3354
3403
|
}
|
|
3355
3404
|
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3356
3405
|
}
|
|
@@ -3359,25 +3408,26 @@ const P = class P extends x {
|
|
|
3359
3408
|
const t = document.createElement("div");
|
|
3360
3409
|
t.className = "gradient-type-tabs";
|
|
3361
3410
|
const e = document.createElement("button");
|
|
3362
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML =
|
|
3411
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = Qt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
|
|
3363
3412
|
const i = document.createElement("button");
|
|
3364
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML =
|
|
3413
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = te, i.style.minWidth = "32px", i.addEventListener("click", () => {
|
|
3365
3414
|
var o, l;
|
|
3366
3415
|
const a = ((o = this.value) == null ? void 0 : o.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3367
3416
|
this.switchType(a);
|
|
3368
3417
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3369
3418
|
}
|
|
3370
3419
|
switchType(t) {
|
|
3371
|
-
var
|
|
3420
|
+
var n;
|
|
3372
3421
|
if (!this.value) return;
|
|
3373
|
-
|
|
3422
|
+
const e = this.isBoundToGlobal(), i = this.linkedGlobalVariable;
|
|
3423
|
+
if (this.value.type = t, t !== "solid" && (this.pendingSolidColor = null), t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3374
3424
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3375
3425
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3376
3426
|
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3377
|
-
const
|
|
3378
|
-
if (
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3427
|
+
const o = this.value.stops[0].color;
|
|
3428
|
+
if (o.startsWith("var(--")) {
|
|
3429
|
+
const l = this.resolveGlobalVarColor(o), r = I(l);
|
|
3430
|
+
r && r.type !== "solid" && r.stops.length >= 2 ? (this.value.stops = r.stops, this.value.angle = r.angle, this.value.type = r.type) : (this.value.stops.push({
|
|
3381
3431
|
color: "#786666",
|
|
3382
3432
|
position: 100,
|
|
3383
3433
|
opacity: 100
|
|
@@ -3388,15 +3438,22 @@ const P = class P extends x {
|
|
|
3388
3438
|
position: 100,
|
|
3389
3439
|
opacity: 100
|
|
3390
3440
|
}), this.value.angle = 90;
|
|
3391
|
-
} else t !== "solid" && this.value.stops.length >= 2
|
|
3441
|
+
} else if (t !== "solid" && this.value.stops.length >= 2)
|
|
3442
|
+
this.value.angle || (this.value.angle = 90);
|
|
3443
|
+
else if (t === "solid" && e && i) {
|
|
3444
|
+
const a = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
3445
|
+
this.value.stops = [
|
|
3446
|
+
{ color: i, position: 0, opacity: a }
|
|
3447
|
+
], this.value.angle = 0;
|
|
3448
|
+
}
|
|
3392
3449
|
if (this.popoverEl) {
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3395
|
-
const
|
|
3396
|
-
t === "solid" ?
|
|
3450
|
+
const a = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3451
|
+
a.forEach((r) => r.classList.remove("active"));
|
|
3452
|
+
const o = a[0], l = a[1];
|
|
3453
|
+
t === "solid" ? o == null || o.classList.add("active") : l == null || l.classList.add("active");
|
|
3397
3454
|
}
|
|
3398
|
-
const
|
|
3399
|
-
|
|
3455
|
+
const s = (n = this.popoverEl) == null ? void 0 : n.querySelector(".gradient-editor-content");
|
|
3456
|
+
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
3400
3457
|
}
|
|
3401
3458
|
updatePopoverContent(t) {
|
|
3402
3459
|
if (t.innerHTML = "", !!this.value) {
|
|
@@ -3409,20 +3466,20 @@ const P = class P extends x {
|
|
|
3409
3466
|
}
|
|
3410
3467
|
renderGlobalColors(t) {
|
|
3411
3468
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3412
|
-
const e = this.value.stops[0], i = (
|
|
3413
|
-
|
|
3469
|
+
const e = this.value.stops[0], i = (h) => {
|
|
3470
|
+
h.innerHTML = "";
|
|
3414
3471
|
let d = {};
|
|
3415
3472
|
try {
|
|
3416
3473
|
d = x.GlobalVariables || {};
|
|
3417
|
-
} catch (
|
|
3418
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
3474
|
+
} catch (u) {
|
|
3475
|
+
console.warn("Could not access Setting.GlobalVariables", u);
|
|
3419
3476
|
}
|
|
3420
3477
|
if (!d || Object.keys(d).length === 0) {
|
|
3421
|
-
const
|
|
3422
|
-
|
|
3478
|
+
const u = document.createElement("div");
|
|
3479
|
+
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", h.appendChild(u);
|
|
3423
3480
|
return;
|
|
3424
3481
|
}
|
|
3425
|
-
const
|
|
3482
|
+
const g = [
|
|
3426
3483
|
{
|
|
3427
3484
|
title: "Global Colors",
|
|
3428
3485
|
keys: ["primary", "secondary", "tertiary", "accent", "background"]
|
|
@@ -3431,33 +3488,33 @@ const P = class P extends x {
|
|
|
3431
3488
|
title: "Text Color",
|
|
3432
3489
|
keys: ["text-dark", "text-light"]
|
|
3433
3490
|
}
|
|
3434
|
-
],
|
|
3435
|
-
let
|
|
3436
|
-
this.globalLayoutMode === "list" ? (
|
|
3437
|
-
const f = Object.entries(d).filter(([
|
|
3438
|
-
f.length !== 0 && f.forEach(([
|
|
3491
|
+
], C = this.globalSearchQuery.toLowerCase();
|
|
3492
|
+
let m;
|
|
3493
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), g.forEach((u) => {
|
|
3494
|
+
const f = Object.entries(d).filter(([v]) => !u.keys.includes(v) && u.title !== "Global Colors" ? !1 : u.keys.includes(v) && v.toLowerCase().includes(C));
|
|
3495
|
+
f.length !== 0 && f.forEach(([v, y]) => {
|
|
3439
3496
|
if (this.globalLayoutMode === "list") {
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3444
|
-
const
|
|
3445
|
-
|
|
3446
|
-
const
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
const
|
|
3450
|
-
this.setValue(
|
|
3451
|
-
}),
|
|
3497
|
+
const w = document.createElement("div");
|
|
3498
|
+
w.className = "global-color-row";
|
|
3499
|
+
const k = document.createElement("div");
|
|
3500
|
+
k.className = "global-color-circle";
|
|
3501
|
+
const S = this.resolveGlobalVarColor(y);
|
|
3502
|
+
k.style.background = S, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && k.classList.add("selected");
|
|
3503
|
+
const E = document.createElement("span");
|
|
3504
|
+
E.className = "global-color-label", E.textContent = v.split("-").map((M) => M.charAt(0).toUpperCase() + M.slice(1)).join(" "), w.appendChild(k), w.appendChild(E), w.addEventListener("click", (M) => {
|
|
3505
|
+
M.preventDefault();
|
|
3506
|
+
const B = `var(--${v})`;
|
|
3507
|
+
this.setValue(B), this.pendingSolidColor = B, i(h);
|
|
3508
|
+
}), m.appendChild(w);
|
|
3452
3509
|
} else {
|
|
3453
|
-
const
|
|
3454
|
-
|
|
3455
|
-
const
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
const
|
|
3459
|
-
this.setValue(
|
|
3460
|
-
}),
|
|
3510
|
+
const w = document.createElement("div");
|
|
3511
|
+
w.className = "global-color-circle";
|
|
3512
|
+
const k = this.resolveGlobalVarColor(y);
|
|
3513
|
+
w.style.background = k, w.title = v.split("-").map((b) => b.charAt(0).toUpperCase() + b.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && w.classList.add("selected"), w.addEventListener("click", (b) => {
|
|
3514
|
+
b.preventDefault();
|
|
3515
|
+
const E = `var(--${v})`;
|
|
3516
|
+
this.setValue(E), this.pendingSolidColor = E, i(h);
|
|
3517
|
+
}), m.appendChild(w);
|
|
3461
3518
|
}
|
|
3462
3519
|
});
|
|
3463
3520
|
});
|
|
@@ -3470,8 +3527,8 @@ const P = class P extends x {
|
|
|
3470
3527
|
const o = document.createElement("input");
|
|
3471
3528
|
o.type = "text", o.className = "global-search-input", o.placeholder = "Search", o.value = this.globalSearchQuery;
|
|
3472
3529
|
const l = document.createElement("div");
|
|
3473
|
-
o.addEventListener("input", (
|
|
3474
|
-
this.globalSearchQuery =
|
|
3530
|
+
o.addEventListener("input", (h) => {
|
|
3531
|
+
this.globalSearchQuery = h.target.value, i(l);
|
|
3475
3532
|
}), n.appendChild(a), n.appendChild(o);
|
|
3476
3533
|
const r = document.createElement("button");
|
|
3477
3534
|
r.className = "global-layout-toggle", r.type = "button";
|
|
@@ -3484,11 +3541,11 @@ const P = class P extends x {
|
|
|
3484
3541
|
}
|
|
3485
3542
|
renderSolid(t) {
|
|
3486
3543
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3487
|
-
const e = this.value.stops[0], i = new
|
|
3544
|
+
const e = this.value.stops[0], i = new ie({
|
|
3488
3545
|
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3489
3546
|
initialOpacity: e.opacity ?? 100,
|
|
3490
3547
|
onColorChange: (s, n) => {
|
|
3491
|
-
if (this.value) {
|
|
3548
|
+
if (this.clearGlobalBindingForCustomChange(), this.value) {
|
|
3492
3549
|
const a = I(s);
|
|
3493
3550
|
if (a && a.type !== "solid") {
|
|
3494
3551
|
this.value = a, this.switchType(a.type);
|
|
@@ -3502,57 +3559,57 @@ const P = class P extends x {
|
|
|
3502
3559
|
}
|
|
3503
3560
|
renderGradient(t) {
|
|
3504
3561
|
this.solidPicker = null;
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
d
|
|
3512
|
-
|
|
3513
|
-
u.value = "linear", u.textContent = "Linear";
|
|
3562
|
+
let e = null;
|
|
3563
|
+
{
|
|
3564
|
+
const p = document.createElement("div");
|
|
3565
|
+
p.className = "gradient-subtype-inline";
|
|
3566
|
+
const h = document.createElement("select");
|
|
3567
|
+
h.className = "gradient-subtype-select";
|
|
3568
|
+
const d = document.createElement("option");
|
|
3569
|
+
d.value = "linear", d.textContent = "Linear";
|
|
3514
3570
|
const g = document.createElement("option");
|
|
3515
|
-
g.value = "radial", g.textContent = "Radial",
|
|
3516
|
-
const
|
|
3517
|
-
|
|
3518
|
-
this.switchType(
|
|
3519
|
-
}),
|
|
3520
|
-
const
|
|
3521
|
-
|
|
3522
|
-
}),
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3571
|
+
g.value = "radial", g.textContent = "Radial", h.appendChild(d), h.appendChild(g), h.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
|
|
3572
|
+
const C = document.createElement("button");
|
|
3573
|
+
C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = Kt, h.addEventListener("change", () => {
|
|
3574
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
|
|
3575
|
+
}), e.addEventListener("focus", (m) => {
|
|
3576
|
+
const u = m.target;
|
|
3577
|
+
u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
|
|
3578
|
+
}), e.addEventListener("input", (m) => {
|
|
3579
|
+
this.clearGlobalBindingForCustomChange();
|
|
3580
|
+
const u = parseInt(m.target.value);
|
|
3581
|
+
!Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
|
|
3582
|
+
}), e.addEventListener("blur", (m) => {
|
|
3583
|
+
var v;
|
|
3527
3584
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3528
|
-
const
|
|
3529
|
-
let
|
|
3530
|
-
Number.isNaN(
|
|
3531
|
-
}),
|
|
3532
|
-
!this.value || !this.value.stops
|
|
3585
|
+
const u = m.target;
|
|
3586
|
+
let f = parseInt(u.value);
|
|
3587
|
+
Number.isNaN(f) && (f = ((v = this.value) == null ? void 0 : v.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), u.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3588
|
+
}), C.addEventListener("click", () => {
|
|
3589
|
+
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
3533
3590
|
m.position = 100 - m.position;
|
|
3534
|
-
}), this.value.stops.sort((m,
|
|
3535
|
-
}),
|
|
3591
|
+
}), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
3592
|
+
}), p.appendChild(h), p.appendChild(e), p.appendChild(C), t.appendChild(p), this.updateDegreeVisibility(e);
|
|
3536
3593
|
}
|
|
3594
|
+
const i = document.createElement("div");
|
|
3595
|
+
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
3537
3596
|
const s = document.createElement("div");
|
|
3538
|
-
s.className = "gradient-
|
|
3597
|
+
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i);
|
|
3539
3598
|
const n = document.createElement("div");
|
|
3540
|
-
n.className = "gradient-
|
|
3541
|
-
const a = document.createElement("
|
|
3542
|
-
a.
|
|
3543
|
-
const o = document.createElement("
|
|
3544
|
-
o.textContent = "
|
|
3545
|
-
const l = document.createElement("
|
|
3546
|
-
l.
|
|
3547
|
-
const r =
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
const d = I(c);
|
|
3551
|
-
d && (this.value = d, this.switchType(d.type), this.updateUI(), this.triggerChange());
|
|
3599
|
+
n.className = "gradient-stops-header";
|
|
3600
|
+
const a = document.createElement("span");
|
|
3601
|
+
a.textContent = "Stops";
|
|
3602
|
+
const o = document.createElement("button");
|
|
3603
|
+
o.type = "button", o.className = "gradient-add-stop", o.textContent = "+", n.appendChild(a), n.appendChild(o);
|
|
3604
|
+
const l = document.createElement("div");
|
|
3605
|
+
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
3606
|
+
const r = ot((p) => {
|
|
3607
|
+
const h = I(p);
|
|
3608
|
+
h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type), this.updateUI(), this.triggerChange());
|
|
3552
3609
|
}, "all");
|
|
3553
|
-
this.recentGradientRefresh =
|
|
3554
|
-
var
|
|
3555
|
-
this.addStop(), this.updateStopsList(
|
|
3610
|
+
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), o.addEventListener("click", () => {
|
|
3611
|
+
var p;
|
|
3612
|
+
this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((p = document.activeElement) == null ? void 0 : p.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3556
3613
|
});
|
|
3557
3614
|
}
|
|
3558
3615
|
updateDegreeVisibility(t) {
|
|
@@ -3562,7 +3619,15 @@ const P = class P extends x {
|
|
|
3562
3619
|
updateGradientPreview(t) {
|
|
3563
3620
|
var i;
|
|
3564
3621
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3565
|
-
|
|
3622
|
+
if (e && this.value)
|
|
3623
|
+
if (this.value.type === "solid")
|
|
3624
|
+
e.style.background = O(this.value);
|
|
3625
|
+
else {
|
|
3626
|
+
const s = this.value.stops.map(
|
|
3627
|
+
(n) => `${st(n.color, n.opacity ?? 100)} ${n.position}%`
|
|
3628
|
+
).join(", ");
|
|
3629
|
+
e.style.background = `linear-gradient(90deg, ${s})`;
|
|
3630
|
+
}
|
|
3566
3631
|
}
|
|
3567
3632
|
debouncedPreviewUpdate(t) {
|
|
3568
3633
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3574,26 +3639,46 @@ const P = class P extends x {
|
|
|
3574
3639
|
const n = document.createElement("div");
|
|
3575
3640
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3576
3641
|
const a = document.createElement("div");
|
|
3577
|
-
a.className = "gstop-chip"
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
},
|
|
3587
|
-
|
|
3642
|
+
a.className = "gstop-chip";
|
|
3643
|
+
const o = this.resolveGlobalVarColor(i.color);
|
|
3644
|
+
a.style.backgroundColor = o, n.appendChild(a);
|
|
3645
|
+
const l = new dt((u, f) => {
|
|
3646
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, f !== void 0 && (this.value.stops[s].opacity = f), a.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3647
|
+
}, "solid");
|
|
3648
|
+
let r = !1, p = !1, h = 0, d = 0;
|
|
3649
|
+
const g = (u) => {
|
|
3650
|
+
r = !0, p = !1, h = u.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
|
|
3651
|
+
}, C = (u) => {
|
|
3652
|
+
if (!r || !this.value) return;
|
|
3653
|
+
const f = u.clientX - h;
|
|
3654
|
+
if (Math.abs(f) > 3 && (p = !0), p) {
|
|
3655
|
+
this.clearGlobalBindingForCustomChange();
|
|
3656
|
+
const v = e.getBoundingClientRect();
|
|
3657
|
+
let y = d + f / v.width * 100;
|
|
3658
|
+
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
3659
|
+
}
|
|
3660
|
+
}, m = (u) => {
|
|
3661
|
+
var f;
|
|
3662
|
+
if (r)
|
|
3663
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), p)
|
|
3664
|
+
this.value && (this.value.stops.sort((v, y) => v.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
3665
|
+
else {
|
|
3666
|
+
u.stopPropagation();
|
|
3667
|
+
const v = (f = this.value) == null ? void 0 : f.stops[s];
|
|
3668
|
+
v && setTimeout(() => {
|
|
3669
|
+
const y = this.resolveGlobalVarColor(v.color);
|
|
3670
|
+
l.open(y, a, v.opacity ?? 100);
|
|
3671
|
+
}, 0);
|
|
3672
|
+
}
|
|
3588
3673
|
};
|
|
3589
|
-
n.addEventListener("mousedown",
|
|
3674
|
+
n.addEventListener("mousedown", g), t.appendChild(n);
|
|
3590
3675
|
});
|
|
3591
3676
|
}
|
|
3592
3677
|
updateStopsList(t) {
|
|
3593
3678
|
var i;
|
|
3594
3679
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3595
3680
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3596
|
-
var
|
|
3681
|
+
var k, S;
|
|
3597
3682
|
const a = document.createElement("div");
|
|
3598
3683
|
a.className = "gstop-row";
|
|
3599
3684
|
const o = document.createElement("div");
|
|
@@ -3602,91 +3687,96 @@ const P = class P extends x {
|
|
|
3602
3687
|
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", o.appendChild(l);
|
|
3603
3688
|
const r = document.createElement("div");
|
|
3604
3689
|
r.className = "gstop-color-container";
|
|
3605
|
-
const p = document.createElement("div");
|
|
3606
|
-
|
|
3607
|
-
const
|
|
3608
|
-
|
|
3609
|
-
const
|
|
3610
|
-
|
|
3611
|
-
const
|
|
3612
|
-
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3619
|
-
const
|
|
3620
|
-
|
|
3690
|
+
const p = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
|
|
3691
|
+
h.className = "gstop-color-preview", h.style.backgroundColor = p;
|
|
3692
|
+
const d = document.createElement("input");
|
|
3693
|
+
d.type = "text", d.className = "gstop-color-input", d.value = p.replace("#", "").toUpperCase();
|
|
3694
|
+
const g = document.createElement("button");
|
|
3695
|
+
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(d), r.appendChild(g);
|
|
3696
|
+
const C = document.createElement("button");
|
|
3697
|
+
C.type = "button", C.className = "gstop-del", C.innerHTML = Yt, C.disabled = (((S = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : S.length) || 0) <= 2, a.appendChild(o), a.appendChild(r), a.appendChild(C), e.appendChild(a);
|
|
3698
|
+
const m = document.createElement("span");
|
|
3699
|
+
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3700
|
+
const u = document.createElement("div");
|
|
3701
|
+
u.className = "gstop-opacity-group";
|
|
3702
|
+
const f = document.createElement("input");
|
|
3703
|
+
f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
|
|
3704
|
+
const v = N(p);
|
|
3705
|
+
f.style.setProperty(
|
|
3621
3706
|
"--slider-color",
|
|
3622
|
-
`rgb(${
|
|
3707
|
+
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3623
3708
|
);
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3626
|
-
const w = new
|
|
3627
|
-
|
|
3628
|
-
const
|
|
3629
|
-
|
|
3709
|
+
const y = document.createElement("span");
|
|
3710
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y);
|
|
3711
|
+
const w = new dt((b, E) => {
|
|
3712
|
+
this.clearGlobalBindingForCustomChange(), d.value = b.replace("#", "").toUpperCase(), h.style.backgroundColor = b, this.value.stops[n].color = b, E !== void 0 && (this.value.stops[n].opacity = E, f.value = String(E), y.textContent = `${E}%`);
|
|
3713
|
+
const M = N(b);
|
|
3714
|
+
f.style.setProperty(
|
|
3630
3715
|
"--slider-color",
|
|
3631
|
-
`rgb(${
|
|
3716
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3632
3717
|
), this.updateGradientPreview(), this.createHandles(
|
|
3633
3718
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3634
3719
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3635
3720
|
), this.updateUI(), this.triggerChange();
|
|
3636
3721
|
}, "solid");
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3722
|
+
d.addEventListener("click", (b) => {
|
|
3723
|
+
b.preventDefault(), b.stopPropagation();
|
|
3724
|
+
const E = this.resolveGlobalVarColor(s.color);
|
|
3725
|
+
w.open(E, d, s.opacity ?? 100);
|
|
3726
|
+
}), d.addEventListener("input", () => {
|
|
3727
|
+
this.clearGlobalBindingForCustomChange();
|
|
3728
|
+
const b = d.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
|
|
3729
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3730
|
+
this.value.stops[n].color = E, h.style.backgroundColor = E;
|
|
3731
|
+
const M = N(E);
|
|
3732
|
+
f.style.setProperty(
|
|
3645
3733
|
"--slider-color",
|
|
3646
|
-
`rgb(${
|
|
3734
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3647
3735
|
), this.debouncedPreviewUpdate();
|
|
3648
3736
|
}
|
|
3649
|
-
}),
|
|
3737
|
+
}), d.addEventListener("blur", () => {
|
|
3650
3738
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3651
|
-
}),
|
|
3652
|
-
|
|
3739
|
+
}), g.addEventListener("click", async (b) => {
|
|
3740
|
+
b.stopPropagation();
|
|
3653
3741
|
try {
|
|
3654
|
-
await navigator.clipboard.writeText(`#${
|
|
3742
|
+
await navigator.clipboard.writeText(`#${d.value}`);
|
|
3655
3743
|
} catch {
|
|
3656
3744
|
}
|
|
3657
|
-
}), l.addEventListener("focus", (
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3660
|
-
}), l.addEventListener("input", (
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3745
|
+
}), l.addEventListener("focus", (b) => {
|
|
3746
|
+
const E = b.target;
|
|
3747
|
+
E.value = E.value.replace("%", ""), E.select();
|
|
3748
|
+
}), l.addEventListener("input", (b) => {
|
|
3749
|
+
this.clearGlobalBindingForCustomChange();
|
|
3750
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3751
|
+
if (!Number.isNaN(M)) {
|
|
3752
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3753
|
+
this.value.stops[n].position = B, E.value = `${B}%`, this.debouncedPreviewUpdate();
|
|
3665
3754
|
}
|
|
3666
|
-
}), l.addEventListener("blur", (
|
|
3755
|
+
}), l.addEventListener("blur", (b) => {
|
|
3667
3756
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3668
|
-
const
|
|
3669
|
-
if (Number.isNaN(
|
|
3670
|
-
|
|
3757
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3758
|
+
if (Number.isNaN(M))
|
|
3759
|
+
E.value = `${this.value.stops[n].position}%`;
|
|
3671
3760
|
else {
|
|
3672
|
-
const
|
|
3673
|
-
this.value.stops[n].position =
|
|
3761
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3762
|
+
this.value.stops[n].position = B, E.value = `${B}%`;
|
|
3674
3763
|
}
|
|
3675
3764
|
this.updateGradientPreview(), this.createHandles(
|
|
3676
3765
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3677
3766
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3678
3767
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3679
|
-
}),
|
|
3680
|
-
var
|
|
3681
|
-
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(n, 1), this.createHandles(
|
|
3768
|
+
}), C.addEventListener("click", () => {
|
|
3769
|
+
var b;
|
|
3770
|
+
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
3682
3771
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3683
3772
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3684
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
3685
|
-
}),
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3773
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((b = document.activeElement) == null ? void 0 : b.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3774
|
+
}), f.addEventListener("input", () => {
|
|
3775
|
+
this.clearGlobalBindingForCustomChange();
|
|
3776
|
+
const b = parseInt(f.value, 10);
|
|
3777
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, b)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3778
|
+
}), f.addEventListener("change", () => {
|
|
3779
|
+
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3690
3780
|
});
|
|
3691
3781
|
}));
|
|
3692
3782
|
}
|
|
@@ -3708,16 +3798,16 @@ const P = class P extends x {
|
|
|
3708
3798
|
this.value.stops.push(n), this.value.stops.sort((a, o) => a.position - o.position);
|
|
3709
3799
|
}
|
|
3710
3800
|
openPopover() {
|
|
3711
|
-
if (this.popoverEl && (
|
|
3712
|
-
if (this.isPopoverOpen = !0,
|
|
3801
|
+
if (this.popoverEl && ($.openInstance && $.openInstance !== this && $.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3802
|
+
if (this.isPopoverOpen = !0, $.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3713
3803
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3714
3804
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3715
3805
|
const a = this.popoverEl.offsetHeight;
|
|
3716
3806
|
let o = t.right + 8, l = t.top;
|
|
3717
|
-
const r = i - t.right, p = t.left,
|
|
3718
|
-
r <
|
|
3719
|
-
const d = s - t.bottom,
|
|
3720
|
-
|
|
3807
|
+
const r = i - t.right, p = t.left, h = e + n;
|
|
3808
|
+
r < h && p > r + 100 && (o = t.left - e - 8);
|
|
3809
|
+
const d = s - t.bottom, g = t.top;
|
|
3810
|
+
g >= a + n ? l = t.top - a - 8 : d >= a + n ? l = t.bottom + 8 : g > d ? (l = t.top - a - 8, l < n && (l = n)) : (l = t.bottom + 8, l + a > s - n && (l = s - a - n)), this.popoverEl.style.left = `${o}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: o, top: l };
|
|
3721
3811
|
}
|
|
3722
3812
|
setTimeout(
|
|
3723
3813
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3738,10 +3828,10 @@ const P = class P extends x {
|
|
|
3738
3828
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3739
3829
|
const o = this.popoverEl.offsetHeight;
|
|
3740
3830
|
let l = e.right + 8, r = e.top;
|
|
3741
|
-
const p = s - e.right,
|
|
3742
|
-
p < d &&
|
|
3743
|
-
const
|
|
3744
|
-
|
|
3831
|
+
const p = s - e.right, h = e.left, d = i + a;
|
|
3832
|
+
p < d && h > p + 100 && (l = e.left - i - 8);
|
|
3833
|
+
const g = n - e.bottom, C = e.top;
|
|
3834
|
+
C >= o + a ? r = e.top - o - 8 : g >= o + a ? r = e.bottom + 8 : C > g ? (r = e.top - o - 8, r < a && (r = a)) : (r = e.bottom + 8, r + o > n - a && (r = n - o - a)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3745
3835
|
});
|
|
3746
3836
|
}
|
|
3747
3837
|
}
|
|
@@ -3759,10 +3849,10 @@ const P = class P extends x {
|
|
|
3759
3849
|
var t;
|
|
3760
3850
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3761
3851
|
if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
|
|
3762
|
-
const e =
|
|
3852
|
+
const e = O(this.value);
|
|
3763
3853
|
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3764
3854
|
}
|
|
3765
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3855
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), $.openInstance === this && ($.openInstance = null);
|
|
3766
3856
|
}
|
|
3767
3857
|
}
|
|
3768
3858
|
commitPendingSolidColor() {
|
|
@@ -3779,21 +3869,33 @@ const P = class P extends x {
|
|
|
3779
3869
|
this.parseAndSet(e.value);
|
|
3780
3870
|
}
|
|
3781
3871
|
parseAndSet(t) {
|
|
3782
|
-
|
|
3783
|
-
e && this.
|
|
3872
|
+
let e = t.trim();
|
|
3873
|
+
e && !e.startsWith("#") && !e.startsWith("var(") && !e.startsWith("rgb") && !e.startsWith("hsl") && !e.includes("gradient") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(e) && (e = "#" + e, this.inputEl && (this.inputEl.value = e));
|
|
3874
|
+
const i = I(e);
|
|
3875
|
+
i && this.setValue(i);
|
|
3876
|
+
}
|
|
3877
|
+
getChangePayload() {
|
|
3878
|
+
var t;
|
|
3879
|
+
if (this.value)
|
|
3880
|
+
return this.isBoundToGlobal() ? ((t = this.value.stops) == null ? void 0 : t.some(
|
|
3881
|
+
(i) => i.opacity !== void 0 && i.opacity !== 100
|
|
3882
|
+
)) ? this.resolveGradientGlobalVars(this.value) : this.linkedGlobalVariable || void 0 : this.value;
|
|
3784
3883
|
}
|
|
3785
3884
|
triggerChange() {
|
|
3786
|
-
var
|
|
3787
|
-
|
|
3885
|
+
var e, i;
|
|
3886
|
+
const t = this.getChangePayload();
|
|
3887
|
+
t !== void 0 && ((e = this.onChange) == null || e.call(this, t), (i = this.detectChange) == null || i.call(this, t));
|
|
3788
3888
|
}
|
|
3789
3889
|
getElement() {
|
|
3790
3890
|
return this.element;
|
|
3791
3891
|
}
|
|
3792
3892
|
getValue() {
|
|
3793
|
-
|
|
3893
|
+
const t = this.getChangePayload();
|
|
3894
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3794
3895
|
}
|
|
3795
3896
|
getCSSValue() {
|
|
3796
|
-
|
|
3897
|
+
const t = this.getChangePayload();
|
|
3898
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3797
3899
|
}
|
|
3798
3900
|
getCSSForText() {
|
|
3799
3901
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3802,36 +3904,36 @@ const P = class P extends x {
|
|
|
3802
3904
|
return this.value;
|
|
3803
3905
|
}
|
|
3804
3906
|
};
|
|
3805
|
-
|
|
3806
|
-
let
|
|
3807
|
-
const
|
|
3907
|
+
$.openInstance = null;
|
|
3908
|
+
let K = $;
|
|
3909
|
+
const se = `
|
|
3808
3910
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3809
3911
|
<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"/>
|
|
3810
3912
|
</svg>
|
|
3811
|
-
`,
|
|
3913
|
+
`, ne = `
|
|
3812
3914
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3813
3915
|
<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"/>
|
|
3814
3916
|
</svg>
|
|
3815
3917
|
`;
|
|
3816
|
-
class
|
|
3918
|
+
class Le extends T {
|
|
3817
3919
|
constructor(t) {
|
|
3818
3920
|
super({
|
|
3819
3921
|
title: "Border",
|
|
3820
3922
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3821
3923
|
settings: {
|
|
3822
|
-
size: new
|
|
3924
|
+
size: new P({
|
|
3823
3925
|
title: "Size",
|
|
3824
|
-
icon:
|
|
3926
|
+
icon: ne,
|
|
3825
3927
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3826
3928
|
suffix: "px"
|
|
3827
3929
|
}),
|
|
3828
|
-
color: new
|
|
3930
|
+
color: new K({
|
|
3829
3931
|
title: "Border Color",
|
|
3830
3932
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3831
3933
|
}),
|
|
3832
|
-
radius: new
|
|
3934
|
+
radius: new P({
|
|
3833
3935
|
title: "Radius",
|
|
3834
|
-
icon:
|
|
3936
|
+
icon: se,
|
|
3835
3937
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3836
3938
|
suffix: "px"
|
|
3837
3939
|
})
|
|
@@ -3855,20 +3957,20 @@ class xe extends H {
|
|
|
3855
3957
|
`;
|
|
3856
3958
|
}
|
|
3857
3959
|
}
|
|
3858
|
-
const
|
|
3960
|
+
const oe = `
|
|
3859
3961
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3860
3962
|
<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"/>
|
|
3861
3963
|
</svg>
|
|
3862
|
-
`,
|
|
3964
|
+
`, ae = `
|
|
3863
3965
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3864
3966
|
<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"/>
|
|
3865
3967
|
</svg>
|
|
3866
|
-
`,
|
|
3968
|
+
`, le = `
|
|
3867
3969
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3868
3970
|
<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"/>
|
|
3869
3971
|
</svg>
|
|
3870
3972
|
`;
|
|
3871
|
-
class
|
|
3973
|
+
class ke extends T {
|
|
3872
3974
|
constructor(t = {}) {
|
|
3873
3975
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3874
3976
|
super({
|
|
@@ -3876,13 +3978,13 @@ class Le extends H {
|
|
|
3876
3978
|
collapsed: i.collapsed,
|
|
3877
3979
|
settings: (() => {
|
|
3878
3980
|
const s = {
|
|
3879
|
-
color: new
|
|
3981
|
+
color: new K({
|
|
3880
3982
|
title: "Color",
|
|
3881
3983
|
default: i.colorDefault ?? "#001E1E"
|
|
3882
3984
|
}),
|
|
3883
|
-
fontFamily: new
|
|
3985
|
+
fontFamily: new et({
|
|
3884
3986
|
title: "Font",
|
|
3885
|
-
icon:
|
|
3987
|
+
icon: oe,
|
|
3886
3988
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3887
3989
|
options: i.fontFamilyOptions ?? [
|
|
3888
3990
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3893,9 +3995,9 @@ class Le extends H {
|
|
|
3893
3995
|
getOptions: i.fontFamilyGetOptions,
|
|
3894
3996
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3895
3997
|
}),
|
|
3896
|
-
fontWeight: new
|
|
3998
|
+
fontWeight: new et({
|
|
3897
3999
|
title: "Weight",
|
|
3898
|
-
icon:
|
|
4000
|
+
icon: ae,
|
|
3899
4001
|
default: i.fontWeightDefault ?? "400",
|
|
3900
4002
|
options: i.fontWeightOptions ?? [
|
|
3901
4003
|
{ name: "Regular", value: "400" },
|
|
@@ -3905,9 +4007,9 @@ class Le extends H {
|
|
|
3905
4007
|
getOptions: i.fontWeightGetOptions,
|
|
3906
4008
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3907
4009
|
}),
|
|
3908
|
-
fontSize: new
|
|
4010
|
+
fontSize: new P({
|
|
3909
4011
|
title: "Size",
|
|
3910
|
-
icon:
|
|
4012
|
+
icon: le,
|
|
3911
4013
|
default: i.fontSizeDefault ?? 12,
|
|
3912
4014
|
suffix: "px",
|
|
3913
4015
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3915,7 +4017,7 @@ class Le extends H {
|
|
|
3915
4017
|
};
|
|
3916
4018
|
return e ? {
|
|
3917
4019
|
...s,
|
|
3918
|
-
align: new
|
|
4020
|
+
align: new Pt({
|
|
3919
4021
|
title: "Align",
|
|
3920
4022
|
default: i.alignDefault ?? "center"
|
|
3921
4023
|
})
|
|
@@ -3947,7 +4049,7 @@ class Le extends H {
|
|
|
3947
4049
|
`;
|
|
3948
4050
|
}
|
|
3949
4051
|
}
|
|
3950
|
-
class
|
|
4052
|
+
class q extends x {
|
|
3951
4053
|
constructor(t) {
|
|
3952
4054
|
super({
|
|
3953
4055
|
...t,
|
|
@@ -3993,33 +4095,33 @@ class j extends x {
|
|
|
3993
4095
|
}), i;
|
|
3994
4096
|
}
|
|
3995
4097
|
}
|
|
3996
|
-
class
|
|
4098
|
+
class Me extends T {
|
|
3997
4099
|
constructor(t) {
|
|
3998
4100
|
super({
|
|
3999
4101
|
title: "Margins",
|
|
4000
4102
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4001
4103
|
settings: {
|
|
4002
|
-
marginTop: new
|
|
4104
|
+
marginTop: new q({
|
|
4003
4105
|
title: "Top",
|
|
4004
|
-
icon:
|
|
4106
|
+
icon: re,
|
|
4005
4107
|
suffix: "px",
|
|
4006
4108
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
4007
4109
|
}),
|
|
4008
|
-
marginRight: new
|
|
4110
|
+
marginRight: new q({
|
|
4009
4111
|
title: "Right",
|
|
4010
|
-
icon:
|
|
4112
|
+
icon: ce,
|
|
4011
4113
|
suffix: "px",
|
|
4012
4114
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
4013
4115
|
}),
|
|
4014
|
-
marginBottom: new
|
|
4116
|
+
marginBottom: new q({
|
|
4015
4117
|
title: "Bottom",
|
|
4016
|
-
icon:
|
|
4118
|
+
icon: he,
|
|
4017
4119
|
suffix: "px",
|
|
4018
4120
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
4019
4121
|
}),
|
|
4020
|
-
marginLeft: new
|
|
4122
|
+
marginLeft: new q({
|
|
4021
4123
|
title: "Left",
|
|
4022
|
-
icon:
|
|
4124
|
+
icon: de,
|
|
4023
4125
|
suffix: "px",
|
|
4024
4126
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
4025
4127
|
})
|
|
@@ -4036,29 +4138,29 @@ class ke extends H {
|
|
|
4036
4138
|
`;
|
|
4037
4139
|
}
|
|
4038
4140
|
}
|
|
4039
|
-
const
|
|
4141
|
+
const re = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4040
4142
|
<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"/>
|
|
4041
|
-
</svg>`,
|
|
4143
|
+
</svg>`, ce = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4042
4144
|
<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"/>
|
|
4043
|
-
</svg>`,
|
|
4145
|
+
</svg>`, he = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4044
4146
|
<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"/>
|
|
4045
|
-
</svg>`,
|
|
4147
|
+
</svg>`, de = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4046
4148
|
<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"/>
|
|
4047
4149
|
</svg>`;
|
|
4048
|
-
class
|
|
4150
|
+
class Se extends T {
|
|
4049
4151
|
constructor(t) {
|
|
4050
4152
|
super({
|
|
4051
4153
|
title: "Background Image",
|
|
4052
4154
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4053
4155
|
settings: {
|
|
4054
|
-
backgroundImage: new
|
|
4156
|
+
backgroundImage: new nt({
|
|
4055
4157
|
...t == null ? void 0 : t.uploadProps,
|
|
4056
4158
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
4057
4159
|
}),
|
|
4058
|
-
opacity: new
|
|
4160
|
+
opacity: new Vt({
|
|
4059
4161
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4060
4162
|
}),
|
|
4061
|
-
backgroundColor: new
|
|
4163
|
+
backgroundColor: new F({
|
|
4062
4164
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
4063
4165
|
})
|
|
4064
4166
|
}
|
|
@@ -4084,41 +4186,64 @@ class Me extends H {
|
|
|
4084
4186
|
`;
|
|
4085
4187
|
}
|
|
4086
4188
|
}
|
|
4189
|
+
class Ie extends T {
|
|
4190
|
+
constructor(t) {
|
|
4191
|
+
super({
|
|
4192
|
+
title: (t == null ? void 0 : t.title) ?? "Image",
|
|
4193
|
+
collapsed: t == null ? void 0 : t.collapsed,
|
|
4194
|
+
settings: {
|
|
4195
|
+
image: new nt({
|
|
4196
|
+
...t == null ? void 0 : t.uploadProps,
|
|
4197
|
+
default: (t == null ? void 0 : t.image) ?? ""
|
|
4198
|
+
}),
|
|
4199
|
+
width: new Ft({
|
|
4200
|
+
default: (t == null ? void 0 : t.width) ?? 1e3,
|
|
4201
|
+
mobile: t == null ? void 0 : t.widthMobile
|
|
4202
|
+
}),
|
|
4203
|
+
height: new Gt({
|
|
4204
|
+
default: (t == null ? void 0 : t.height) ?? 300,
|
|
4205
|
+
mobile: t == null ? void 0 : t.heightMobile
|
|
4206
|
+
})
|
|
4207
|
+
}
|
|
4208
|
+
});
|
|
4209
|
+
}
|
|
4210
|
+
}
|
|
4087
4211
|
export {
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
Ee as
|
|
4105
|
-
|
|
4106
|
-
|
|
4212
|
+
Pt as AlignSetting,
|
|
4213
|
+
xe as AnimationSetting,
|
|
4214
|
+
Se as BackgroundSettingSet,
|
|
4215
|
+
Le as BorderSettingSet,
|
|
4216
|
+
me as ButtonSetting,
|
|
4217
|
+
V as ColorSetting,
|
|
4218
|
+
F as ColorWithOpacitySetting,
|
|
4219
|
+
fe as DimensionSetting,
|
|
4220
|
+
ye as GapSetting,
|
|
4221
|
+
K as GradientSetting,
|
|
4222
|
+
ke as HeaderTypographySettingSet,
|
|
4223
|
+
Gt as HeightSetting,
|
|
4224
|
+
ge as HtmlSetting,
|
|
4225
|
+
Ie as ImageSettingSet,
|
|
4226
|
+
be as MarginBottomSetting,
|
|
4227
|
+
Me as MarginSettingGroup,
|
|
4228
|
+
Ee as MarginTopSetting,
|
|
4229
|
+
we as MultiLanguageSetting,
|
|
4230
|
+
P as NumberSetting,
|
|
4231
|
+
Vt as OpacitySetting,
|
|
4107
4232
|
ve as SelectApiSettings,
|
|
4108
|
-
|
|
4233
|
+
et as SelectSetting,
|
|
4109
4234
|
x as Setting,
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4235
|
+
T as SettingGroup,
|
|
4236
|
+
Mt as StringSetting,
|
|
4237
|
+
Lt as TabSettingGroup,
|
|
4238
|
+
Lt as TabsSettingGroup,
|
|
4239
|
+
Ce as Toggle,
|
|
4240
|
+
nt as UploadSetting,
|
|
4241
|
+
Ft as WidthSetting,
|
|
4242
|
+
ue as asSettingGroupWithSettings,
|
|
4243
|
+
kt as createSettingGroup,
|
|
4244
|
+
pe as createTabSettingGroup,
|
|
4120
4245
|
A as isSetting,
|
|
4121
|
-
|
|
4246
|
+
lt as isSettingChild,
|
|
4122
4247
|
L as isSettingGroup,
|
|
4123
|
-
|
|
4248
|
+
j as iterateSettings
|
|
4124
4249
|
};
|