builder-settings-types 0.0.310 → 0.0.312
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 +56 -56
- package/dist/builder-settings-types.es.js +1163 -1064
- 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/dist/types/index.d.ts +10 -2
- 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,30 +174,30 @@ 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 };
|
|
182
182
|
const e = document.createElement("div");
|
|
183
183
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
184
|
+
const a = document.createElement("div");
|
|
185
|
+
if (a.className = "icon-container", t.icon) {
|
|
186
186
|
const l = this.createIcon(t.icon, t.iconClassName);
|
|
187
|
-
|
|
187
|
+
a.appendChild(l);
|
|
188
188
|
}
|
|
189
189
|
if (t.title) {
|
|
190
190
|
const l = this.createLabel(t.title, t.labelClassName);
|
|
191
|
-
|
|
191
|
+
a.appendChild(l);
|
|
192
192
|
}
|
|
193
|
-
e.appendChild(
|
|
193
|
+
e.appendChild(a);
|
|
194
194
|
}
|
|
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 ||
|
|
199
|
-
const n = (
|
|
200
|
-
const l =
|
|
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
|
+
const n = (a) => {
|
|
200
|
+
const l = a.target;
|
|
201
201
|
let r = l.value;
|
|
202
202
|
switch (t.inputType) {
|
|
203
203
|
case "number":
|
|
@@ -222,10 +222,10 @@ const B = class B {
|
|
|
222
222
|
r = l.value;
|
|
223
223
|
}
|
|
224
224
|
this.value = r, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
225
|
-
},
|
|
226
|
-
|
|
225
|
+
}, o = (a) => {
|
|
226
|
+
a.target, this.onBlur && this.onBlur(this.value);
|
|
227
227
|
};
|
|
228
|
-
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur",
|
|
228
|
+
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur", o), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
229
229
|
}
|
|
230
230
|
createLabel(t, e) {
|
|
231
231
|
const i = document.createElement("span");
|
|
@@ -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]) => {
|
|
@@ -321,21 +321,21 @@ const K = class K {
|
|
|
321
321
|
".setting-group-content"
|
|
322
322
|
);
|
|
323
323
|
if (n) {
|
|
324
|
-
const
|
|
324
|
+
const o = Array.from(
|
|
325
325
|
n.querySelectorAll(
|
|
326
326
|
".setting-group, .setting, [data-setting-id]"
|
|
327
327
|
)
|
|
328
328
|
);
|
|
329
|
-
for (const
|
|
330
|
-
const l =
|
|
329
|
+
for (const a of o) {
|
|
330
|
+
const l = a.id, r = a.getAttribute(
|
|
331
331
|
"data-setting-id"
|
|
332
332
|
);
|
|
333
333
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
334
|
-
|
|
334
|
+
a.remove();
|
|
335
335
|
break;
|
|
336
336
|
}
|
|
337
337
|
if (r && "id" in e && typeof e.id == "string" && r === e.id) {
|
|
338
|
-
|
|
338
|
+
a.remove();
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -349,37 +349,37 @@ const K = class K {
|
|
|
349
349
|
this.elementRef;
|
|
350
350
|
}
|
|
351
351
|
updateSettings(t) {
|
|
352
|
-
var
|
|
352
|
+
var o;
|
|
353
353
|
const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
|
|
354
|
-
i.forEach((
|
|
355
|
-
const l = this.settings[
|
|
356
|
-
l && (L(l) ? s[
|
|
357
|
-
}), e.forEach((
|
|
358
|
-
i.includes(
|
|
359
|
-
}), i.forEach((
|
|
354
|
+
i.forEach((a) => {
|
|
355
|
+
const l = this.settings[a];
|
|
356
|
+
l && (L(l) ? s[a] = l.getValues() : A(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
|
|
357
|
+
}), e.forEach((a) => {
|
|
358
|
+
i.includes(a) || this.removeSetting(a);
|
|
359
|
+
}), i.forEach((a) => {
|
|
360
360
|
var p;
|
|
361
|
-
const l = t[
|
|
362
|
-
if (r !== l && (r && this.removeSetting(
|
|
363
|
-
const
|
|
361
|
+
const l = t[a], r = this.settings[a];
|
|
362
|
+
if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
|
|
363
|
+
const h = s[a];
|
|
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
|
-
console.warn(`Could not preserve value for setting ${
|
|
369
|
+
console.warn(`Could not preserve value for setting ${a}:`, d);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
373
373
|
const n = this.getValues();
|
|
374
|
-
this.initialValues = n, (
|
|
374
|
+
this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
|
|
375
375
|
}
|
|
376
376
|
clone() {
|
|
377
377
|
const t = {};
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
typeof n.clone == "function" ? t[
|
|
381
|
-
`Setting with key '${
|
|
382
|
-
), t[
|
|
378
|
+
j(this.settings, (s, n) => {
|
|
379
|
+
const o = String(s);
|
|
380
|
+
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
381
|
+
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
382
|
+
), t[o] = n);
|
|
383
383
|
});
|
|
384
384
|
const e = {
|
|
385
385
|
title: this.title,
|
|
@@ -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,19 +438,19 @@ 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(() => {
|
|
445
|
-
const
|
|
446
|
-
this.initialValues =
|
|
445
|
+
const o = this.getValues();
|
|
446
|
+
this.initialValues = o, t(o);
|
|
447
447
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
448
448
|
else if (A(s)) {
|
|
449
|
-
const
|
|
450
|
-
this.changeHandlers.add(
|
|
449
|
+
const o = () => e();
|
|
450
|
+
this.changeHandlers.add(o), s.setOnChange(o);
|
|
451
451
|
} else {
|
|
452
|
-
const
|
|
453
|
-
this.changeHandlers.add(
|
|
452
|
+
const o = () => e();
|
|
453
|
+
this.changeHandlers.add(o), (n = s.setOnChange) == null || n.call(s, o);
|
|
454
454
|
}
|
|
455
455
|
}), this;
|
|
456
456
|
}
|
|
@@ -465,10 +465,10 @@ const K = class K {
|
|
|
465
465
|
Object.entries(t).forEach(([i, s]) => {
|
|
466
466
|
let n = this.settings[i];
|
|
467
467
|
if (!n && this.addItemCfg && i.startsWith(this.addItemCfg.keyPrefix)) {
|
|
468
|
-
const
|
|
469
|
-
if (Number.isFinite(
|
|
470
|
-
const l = this.addItemCfg.createItem(
|
|
471
|
-
|
|
468
|
+
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
469
|
+
if (Number.isFinite(a)) {
|
|
470
|
+
const l = this.addItemCfg.createItem(a);
|
|
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);
|
|
@@ -490,20 +490,20 @@ const K = class K {
|
|
|
490
490
|
addSetting(t, e) {
|
|
491
491
|
var s, n;
|
|
492
492
|
if (this.settings[t] = e, this.wireChild(e), this.elementRef) {
|
|
493
|
-
const
|
|
493
|
+
const o = this.elementRef.querySelector(
|
|
494
494
|
".setting-group-content"
|
|
495
495
|
);
|
|
496
|
-
if (
|
|
496
|
+
if (o) {
|
|
497
497
|
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
498
|
-
const
|
|
498
|
+
const a = 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(a, t);
|
|
502
502
|
}
|
|
503
|
-
const r =
|
|
504
|
-
r ?
|
|
505
|
-
const p =
|
|
506
|
-
|
|
503
|
+
const r = o.querySelector(".sg-add-button-bottom");
|
|
504
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), at.trackElement(a), _(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
505
|
+
const p = a.style.display;
|
|
506
|
+
a.style.display = "none", a.offsetHeight, a.style.display = p, this.updateNestingStyles();
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
const i = this.getValues();
|
|
@@ -530,8 +530,8 @@ const K = class K {
|
|
|
530
530
|
if (!s) return;
|
|
531
531
|
const n = s.querySelector(".actions-section");
|
|
532
532
|
if (!n) return;
|
|
533
|
-
const
|
|
534
|
-
|
|
533
|
+
const o = document.createElement("button");
|
|
534
|
+
o.type = "button", o.className = "sg-delete-button", i ? i.deleteItemCfg : this.deleteItemCfg ?? this.addItemCfg, o.title = "Delete", o.style.cssText = `
|
|
535
535
|
background: none;
|
|
536
536
|
border: none;
|
|
537
537
|
cursor: pointer;
|
|
@@ -544,23 +544,23 @@ const K = class K {
|
|
|
544
544
|
border-radius: 4px;
|
|
545
545
|
transition: background-color 0.2s;
|
|
546
546
|
`;
|
|
547
|
-
const
|
|
547
|
+
const a = `
|
|
548
548
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
549
549
|
<path d="M2 4h12M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.333 1.333 0 0 1 1.334 1.334V4m2 0v9.333a1.333 1.333 0 0 1-1.334 1.334H4.667a1.333 1.333 0 0 1-1.334-1.334V4h8.667Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
550
550
|
<path d="M6.667 7.333v4M9.333 7.333v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
551
551
|
</svg>
|
|
552
552
|
`;
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}),
|
|
556
|
-
|
|
557
|
-
}),
|
|
553
|
+
o.innerHTML = a, o.addEventListener("mouseenter", () => {
|
|
554
|
+
o.style.backgroundColor = "#fef2f2";
|
|
555
|
+
}), o.addEventListener("mouseleave", () => {
|
|
556
|
+
o.style.backgroundColor = "transparent";
|
|
557
|
+
}), o.addEventListener("click", (r) => {
|
|
558
558
|
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((p) => {
|
|
559
559
|
p && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
560
560
|
});
|
|
561
561
|
});
|
|
562
562
|
const l = n.querySelector(".setting-group-arrow");
|
|
563
|
-
l ? n.insertBefore(
|
|
563
|
+
l ? n.insertBefore(o, l) : n.appendChild(o);
|
|
564
564
|
}
|
|
565
565
|
showDeleteConfirmation() {
|
|
566
566
|
return new Promise((t) => {
|
|
@@ -603,14 +603,14 @@ const K = class K {
|
|
|
603
603
|
font-size: 14px;
|
|
604
604
|
line-height: 1.5;
|
|
605
605
|
`;
|
|
606
|
-
const
|
|
607
|
-
|
|
606
|
+
const o = document.createElement("div");
|
|
607
|
+
o.style.cssText = `
|
|
608
608
|
display: flex;
|
|
609
609
|
gap: 12px;
|
|
610
610
|
justify-content: flex-end;
|
|
611
611
|
`;
|
|
612
|
-
const
|
|
613
|
-
|
|
612
|
+
const a = document.createElement("button");
|
|
613
|
+
a.textContent = "Cancel", a.type = "button", a.style.cssText = `
|
|
614
614
|
padding: 8px 16px;
|
|
615
615
|
border: 1px solid #d1d5db;
|
|
616
616
|
background: white;
|
|
@@ -632,10 +632,10 @@ const K = class K {
|
|
|
632
632
|
font-weight: 500;
|
|
633
633
|
cursor: pointer;
|
|
634
634
|
transition: all 0.2s;
|
|
635
|
-
`,
|
|
636
|
-
|
|
637
|
-
}),
|
|
638
|
-
|
|
635
|
+
`, a.addEventListener("mouseenter", () => {
|
|
636
|
+
a.style.backgroundColor = "#f9fafb", a.style.borderColor = "#9ca3af";
|
|
637
|
+
}), a.addEventListener("mouseleave", () => {
|
|
638
|
+
a.style.backgroundColor = "white", a.style.borderColor = "#d1d5db";
|
|
639
639
|
}), l.addEventListener("mouseenter", () => {
|
|
640
640
|
l.style.backgroundColor = "#dc2626";
|
|
641
641
|
}), l.addEventListener("mouseleave", () => {
|
|
@@ -646,17 +646,17 @@ const K = class K {
|
|
|
646
646
|
e.parentNode && e.parentNode.removeChild(e);
|
|
647
647
|
}, 200);
|
|
648
648
|
};
|
|
649
|
-
|
|
649
|
+
a.addEventListener("click", () => {
|
|
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
|
-
document.addEventListener("keydown", p),
|
|
659
|
+
document.addEventListener("keydown", p), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
660
660
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
661
661
|
}), setTimeout(() => l.focus(), 100);
|
|
662
662
|
});
|
|
@@ -674,8 +674,8 @@ const K = class K {
|
|
|
674
674
|
...Object.keys(t),
|
|
675
675
|
...Object.keys(e)
|
|
676
676
|
])).forEach((n) => {
|
|
677
|
-
const
|
|
678
|
-
JSON.stringify(
|
|
677
|
+
const o = t[n], a = e[n];
|
|
678
|
+
JSON.stringify(o) !== JSON.stringify(a) && (i[n] = { from: o, to: a });
|
|
679
679
|
}), i;
|
|
680
680
|
}
|
|
681
681
|
getValues(t) {
|
|
@@ -709,11 +709,11 @@ const K = class K {
|
|
|
709
709
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
710
710
|
const n = this.settings[s];
|
|
711
711
|
if (L(n)) {
|
|
712
|
-
const
|
|
713
|
-
|
|
712
|
+
const o = n.getValuesForJson();
|
|
713
|
+
o !== null && (i[s] = o);
|
|
714
714
|
} else {
|
|
715
|
-
const
|
|
716
|
-
|
|
715
|
+
const o = n;
|
|
716
|
+
o.includeGetJson !== !1 && (i[s] = o.value);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
return (this.hide === !0 || ((e = this == null ? void 0 : this.groupProps) == null ? void 0 : e.hide) === !0) && (i.hide = !0), i;
|
|
@@ -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",
|
|
@@ -764,16 +764,16 @@ const K = class K {
|
|
|
764
764
|
s.textContent = this.title, i.appendChild(s);
|
|
765
765
|
const n = document.createElement("div");
|
|
766
766
|
n.className = "actions-section";
|
|
767
|
-
const
|
|
768
|
-
|
|
767
|
+
const o = document.createElement("span");
|
|
768
|
+
o.className = "setting-group-arrow", o.innerHTML = `
|
|
769
769
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
770
770
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
771
771
|
</svg>
|
|
772
|
-
`, this.isCollapsed &&
|
|
773
|
-
const
|
|
774
|
-
|
|
772
|
+
`, this.isCollapsed && o.classList.add("rotated"), n.appendChild(o);
|
|
773
|
+
const a = document.createElement("div");
|
|
774
|
+
a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content");
|
|
775
775
|
const l = () => {
|
|
776
|
-
this.isCollapsed = !this.isCollapsed,
|
|
776
|
+
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
777
777
|
"aria-expanded",
|
|
778
778
|
(!this.isCollapsed).toString()
|
|
779
779
|
);
|
|
@@ -783,38 +783,38 @@ 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
|
-
|
|
793
|
-
),
|
|
792
|
+
h
|
|
793
|
+
), a.appendChild(d);
|
|
794
794
|
}
|
|
795
795
|
} else {
|
|
796
796
|
const p = document.createElement("div");
|
|
797
|
-
p.className = "setting-group-empty", p.textContent = "No settings in this group",
|
|
797
|
+
p.className = "setting-group-empty", p.textContent = "No settings in this group", a.appendChild(p);
|
|
798
798
|
}
|
|
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
810
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
811
|
-
if (
|
|
812
|
-
const
|
|
813
|
-
this.addSetting(
|
|
811
|
+
if (lt(g)) {
|
|
812
|
+
const m = `${this.addItemCfg.keyPrefix}${u}`;
|
|
813
|
+
this.addSetting(m, g);
|
|
814
814
|
}
|
|
815
|
-
}),
|
|
815
|
+
}), a.appendChild(p);
|
|
816
816
|
}
|
|
817
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(
|
|
817
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, at.trackElement(t), setTimeout(() => {
|
|
818
818
|
this.updateNestingStyles();
|
|
819
819
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
820
820
|
}
|
|
@@ -845,10 +845,10 @@ const K = class K {
|
|
|
845
845
|
let i = e;
|
|
846
846
|
const s = Object.keys(this.settings), n = Object.keys(e);
|
|
847
847
|
if (!s.some(
|
|
848
|
-
(
|
|
848
|
+
(a) => n.includes(a)
|
|
849
849
|
) && n.length === 1) {
|
|
850
|
-
const
|
|
851
|
-
i = e[
|
|
850
|
+
const a = n[0];
|
|
851
|
+
i = e[a];
|
|
852
852
|
}
|
|
853
853
|
this.setValue(i);
|
|
854
854
|
} catch (e) {
|
|
@@ -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];
|
|
@@ -871,7 +871,11 @@ class wt extends H {
|
|
|
871
871
|
return this.activeTabId;
|
|
872
872
|
}
|
|
873
873
|
switchToTab(t) {
|
|
874
|
-
|
|
874
|
+
var i;
|
|
875
|
+
if (!this.settings[t] || this.activeTabId === t) return;
|
|
876
|
+
this.activeTabId = t, this.updateTabUI();
|
|
877
|
+
const e = this.getValues();
|
|
878
|
+
this.initialValues = e, (i = this.onChange) == null || i.call(this, e);
|
|
875
879
|
}
|
|
876
880
|
getValues(t) {
|
|
877
881
|
return t !== void 0 ? super.getValues(t) : {
|
|
@@ -901,30 +905,30 @@ class wt extends H {
|
|
|
901
905
|
s.textContent = this.title, i.appendChild(s);
|
|
902
906
|
const n = document.createElement("div");
|
|
903
907
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
908
|
+
const o = document.createElement("div");
|
|
909
|
+
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
906
910
|
const r = document.createElement("button");
|
|
907
|
-
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id",
|
|
911
|
+
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
|
|
908
912
|
const p = document.createElement("div");
|
|
909
|
-
p.className = "tab-panel", this.contentContainers[
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
)),
|
|
914
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
915
|
-
const
|
|
916
|
-
this.activeTabId =
|
|
913
|
+
p.className = "tab-panel", this.contentContainers[a] = p;
|
|
914
|
+
const h = this.settings[a];
|
|
915
|
+
h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
|
|
916
|
+
h.draw()
|
|
917
|
+
)), o.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
918
|
+
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
919
|
+
const a = Object.keys(this.settings)[0];
|
|
920
|
+
this.activeTabId = a || "";
|
|
917
921
|
}
|
|
918
922
|
return this.updateTabUI(), t;
|
|
919
923
|
}
|
|
920
924
|
}
|
|
921
|
-
function
|
|
922
|
-
return new
|
|
925
|
+
function kt(c) {
|
|
926
|
+
return new T(c);
|
|
923
927
|
}
|
|
924
|
-
function
|
|
925
|
-
return
|
|
928
|
+
function ue(c) {
|
|
929
|
+
return c;
|
|
926
930
|
}
|
|
927
|
-
class
|
|
931
|
+
class Mt extends x {
|
|
928
932
|
constructor(t = {}) {
|
|
929
933
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
930
934
|
}
|
|
@@ -944,18 +948,18 @@ class Lt extends x {
|
|
|
944
948
|
});
|
|
945
949
|
}
|
|
946
950
|
}
|
|
947
|
-
const
|
|
948
|
-
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 I extends Mt {
|
|
949
953
|
constructor(t) {
|
|
950
954
|
super({
|
|
951
955
|
...t,
|
|
952
|
-
icon: t.icon ||
|
|
956
|
+
icon: t.icon || St,
|
|
953
957
|
title: t.title || "Color",
|
|
954
|
-
default: t.default ?
|
|
958
|
+
default: t.default ? I.normalizeColorValue(t.default) : "#000000"
|
|
955
959
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
956
960
|
}
|
|
957
961
|
static normalizeColorValue(t) {
|
|
958
|
-
return t.startsWith("var(--") ? t : t.startsWith("#") ?
|
|
962
|
+
return t.startsWith("var(--") ? t : t.startsWith("#") ? I.normalizeHexValue(t) : t.includes(",") ? I.rgbToHexStatic(t) : I.normalizeHexValue(t);
|
|
959
963
|
}
|
|
960
964
|
static normalizeHexValue(t) {
|
|
961
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");
|
|
@@ -964,11 +968,11 @@ class N extends Lt {
|
|
|
964
968
|
const e = t.split(",").map((p) => parseInt(p.trim()));
|
|
965
969
|
if (e.length !== 3 || e.some(isNaN))
|
|
966
970
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
967
|
-
const [i, s, n] = e,
|
|
968
|
-
const
|
|
969
|
-
return
|
|
971
|
+
const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (p) => {
|
|
972
|
+
const h = p.toString(16);
|
|
973
|
+
return h.length === 1 ? "0" + h : h;
|
|
970
974
|
};
|
|
971
|
-
return `#${r(
|
|
975
|
+
return `#${r(o)}${r(a)}${r(l)}`;
|
|
972
976
|
}
|
|
973
977
|
setValue(t) {
|
|
974
978
|
if (t === void 0) {
|
|
@@ -976,7 +980,7 @@ class N extends Lt {
|
|
|
976
980
|
return;
|
|
977
981
|
}
|
|
978
982
|
if (typeof t == "string") {
|
|
979
|
-
const e =
|
|
983
|
+
const e = I.normalizeColorValue(t);
|
|
980
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);
|
|
981
985
|
} else
|
|
982
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");
|
|
@@ -991,12 +995,12 @@ class N extends Lt {
|
|
|
991
995
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
992
996
|
const g = document.createElement("div");
|
|
993
997
|
if (g.className = "icon-container", this.props.icon) {
|
|
994
|
-
const
|
|
995
|
-
|
|
998
|
+
const m = document.createElement("span");
|
|
999
|
+
m.className = "input-icon", m.innerHTML = this.props.icon, g.appendChild(m);
|
|
996
1000
|
}
|
|
997
1001
|
if (this.props.title) {
|
|
998
|
-
const
|
|
999
|
-
|
|
1002
|
+
const m = document.createElement("span");
|
|
1003
|
+
m.className = "input-label", m.textContent = this.props.title, g.appendChild(m);
|
|
1000
1004
|
}
|
|
1001
1005
|
t.appendChild(g);
|
|
1002
1006
|
}
|
|
@@ -1008,84 +1012,84 @@ class N extends Lt {
|
|
|
1008
1012
|
s.className = "color-tab active", s.textContent = "Solid";
|
|
1009
1013
|
const n = document.createElement("button");
|
|
1010
1014
|
n.className = "color-tab", n.textContent = "Global", i.appendChild(s), i.appendChild(n);
|
|
1011
|
-
const a = document.createElement("div");
|
|
1012
|
-
a.className = "color-content-solid";
|
|
1013
1015
|
const o = document.createElement("div");
|
|
1014
|
-
o.className = "color-content-
|
|
1016
|
+
o.className = "color-content-solid";
|
|
1017
|
+
const a = document.createElement("div");
|
|
1018
|
+
a.className = "color-content-global", a.style.display = "none", a.style.display = "grid", a.style.gridTemplateColumns = "repeat(auto-fill, minmax(30px, 1fr))", a.style.gap = "8px";
|
|
1015
1019
|
const l = () => {
|
|
1016
1020
|
try {
|
|
1017
|
-
if (console.log("ColorSetting: renderGlobalOptions called"),
|
|
1021
|
+
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !x) {
|
|
1018
1022
|
console.error("ColorSetting: Setting class is undefined");
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1023
|
+
const m = document.createElement("div");
|
|
1024
|
+
m.textContent = "Error: System error (Setting undefined)", a.appendChild(m);
|
|
1021
1025
|
return;
|
|
1022
1026
|
}
|
|
1023
1027
|
const g = x.GlobalVariables || {};
|
|
1024
1028
|
if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1029
|
+
const m = document.createElement("div");
|
|
1030
|
+
m.textContent = "No global colors defined", m.style.gridColumn = "1 / -1", m.style.fontSize = "12px", m.style.color = "#666", a.appendChild(m);
|
|
1027
1031
|
return;
|
|
1028
1032
|
}
|
|
1029
|
-
Object.entries(g).forEach(([
|
|
1033
|
+
Object.entries(g).forEach(([m, f]) => {
|
|
1030
1034
|
const v = document.createElement("button");
|
|
1031
|
-
v.className = "global-color-btn", v.title =
|
|
1032
|
-
var
|
|
1035
|
+
v.className = "global-color-btn", v.title = m, 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(--${m})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (C) => {
|
|
1036
|
+
var w, k;
|
|
1033
1037
|
C.preventDefault();
|
|
1034
|
-
const
|
|
1035
|
-
this.value =
|
|
1036
|
-
|
|
1037
|
-
}), v.style.border = "2px solid #2196f3",
|
|
1038
|
-
}),
|
|
1038
|
+
const y = `var(--${m})`;
|
|
1039
|
+
this.value = y, (w = this.onChange) == null || w.call(this, y), (k = this.detectChange) == null || k.call(this, y), Array.from(a.children).forEach((S) => {
|
|
1040
|
+
S.style.border = "1px solid #ddd";
|
|
1041
|
+
}), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
|
|
1042
|
+
}), a.appendChild(v);
|
|
1039
1043
|
});
|
|
1040
1044
|
} catch (g) {
|
|
1041
|
-
console.error("ColorSetting: Error in renderGlobalOptions", g),
|
|
1045
|
+
console.error("ColorSetting: Error in renderGlobalOptions", g), a.innerHTML = "Error loading global options";
|
|
1042
1046
|
}
|
|
1043
1047
|
};
|
|
1044
1048
|
l(), s.addEventListener("click", (g) => {
|
|
1045
|
-
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"),
|
|
1049
|
+
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1046
1050
|
}), n.addEventListener("click", (g) => {
|
|
1047
|
-
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"),
|
|
1051
|
+
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
1048
1052
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1049
1053
|
const r = (g) => {
|
|
1050
|
-
const
|
|
1051
|
-
if (!
|
|
1054
|
+
const m = g.value.trim();
|
|
1055
|
+
if (!m)
|
|
1052
1056
|
return e.classList.remove("error"), !0;
|
|
1053
|
-
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(
|
|
1057
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(m);
|
|
1054
1058
|
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
1055
1059
|
}, p = document.createElement("input");
|
|
1056
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;
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1061
|
+
const h = document.createElement("div");
|
|
1062
|
+
h.className = "color-preview";
|
|
1059
1063
|
let d = this.value || "#000000";
|
|
1060
1064
|
if (d.startsWith("var(--")) {
|
|
1061
1065
|
const g = d.replace("var(--", "").replace(")", "");
|
|
1062
1066
|
d = (x.GlobalVariables || {})[g] || "#000000";
|
|
1063
1067
|
}
|
|
1064
|
-
|
|
1068
|
+
h.style.backgroundColor = d;
|
|
1065
1069
|
const u = document.createElement("input");
|
|
1066
1070
|
return u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u, this.textInputEl.addEventListener("input", (g) => {
|
|
1067
|
-
var
|
|
1068
|
-
let
|
|
1071
|
+
var f, v;
|
|
1072
|
+
let m = g.target.value.trim();
|
|
1069
1073
|
if (this.textInputEl && r(this.textInputEl)) {
|
|
1070
|
-
const C =
|
|
1071
|
-
this.value = C, (
|
|
1074
|
+
const C = I.normalizeColorValue(m);
|
|
1075
|
+
this.value = C, (f = this.onChange) == null || f.call(this, C), (v = this.detectChange) == null || v.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), h.style.backgroundColor = C;
|
|
1072
1076
|
}
|
|
1073
1077
|
}), this.colorInputEl.addEventListener("input", (g) => {
|
|
1074
1078
|
var v, C;
|
|
1075
|
-
const
|
|
1076
|
-
this.value =
|
|
1079
|
+
const m = g.target.value, f = I.normalizeColorValue(m);
|
|
1080
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f, e.classList.remove("error");
|
|
1077
1081
|
}), this.colorInputEl.addEventListener("change", (g) => {
|
|
1078
1082
|
var v, C;
|
|
1079
|
-
const
|
|
1080
|
-
this.value =
|
|
1081
|
-
}),
|
|
1083
|
+
const m = g.target.value, f = I.normalizeColorValue(m);
|
|
1084
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f;
|
|
1085
|
+
}), o.appendChild(p), o.appendChild(h), o.appendChild(u), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
1082
1086
|
}
|
|
1083
1087
|
getElement() {
|
|
1084
1088
|
return this.element;
|
|
1085
1089
|
}
|
|
1086
1090
|
// Helper method to get normalized hex value
|
|
1087
1091
|
getNormalizedValue() {
|
|
1088
|
-
return this.value ?
|
|
1092
|
+
return this.value ? I.normalizeColorValue(this.value) : "#000000";
|
|
1089
1093
|
}
|
|
1090
1094
|
// Helper method to check if current value is valid hex
|
|
1091
1095
|
isValidHex() {
|
|
@@ -1096,20 +1100,20 @@ class N extends Lt {
|
|
|
1096
1100
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1097
1101
|
}
|
|
1098
1102
|
}
|
|
1099
|
-
const
|
|
1103
|
+
const Nt = `
|
|
1100
1104
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1101
1105
|
<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"/>
|
|
1102
1106
|
<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"/>
|
|
1103
1107
|
<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"/>
|
|
1104
1108
|
</svg>`;
|
|
1105
|
-
class
|
|
1109
|
+
class F extends x {
|
|
1106
1110
|
constructor(t = {}) {
|
|
1107
1111
|
super({
|
|
1108
1112
|
...t,
|
|
1109
|
-
icon: t.icon ||
|
|
1113
|
+
icon: t.icon || Nt,
|
|
1110
1114
|
title: t.title || "Color & Opacity",
|
|
1111
1115
|
default: t.default || "#000000FF"
|
|
1112
|
-
}), 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 =
|
|
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 = F.normalizeHexWithOpacity(this.value));
|
|
1113
1117
|
}
|
|
1114
1118
|
static normalizeHexWithOpacity(t) {
|
|
1115
1119
|
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");
|
|
@@ -1127,18 +1131,18 @@ class R extends x {
|
|
|
1127
1131
|
return `#${i}${n}`;
|
|
1128
1132
|
}
|
|
1129
1133
|
setValue(t) {
|
|
1130
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1134
|
+
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);
|
|
1131
1135
|
}
|
|
1132
1136
|
updateInputElements() {
|
|
1133
1137
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
1134
1138
|
}
|
|
1135
1139
|
updateColorPreview() {
|
|
1136
1140
|
if (!this.colorPreviewEl || !this.value) return;
|
|
1137
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1138
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
1141
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1142
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1139
1143
|
}
|
|
1140
1144
|
handleColorChange(t) {
|
|
1141
|
-
const e = this.getOpacityPercent(), i =
|
|
1145
|
+
const e = this.getOpacityPercent(), i = F.combineColorOpacity(
|
|
1142
1146
|
t,
|
|
1143
1147
|
e
|
|
1144
1148
|
);
|
|
@@ -1149,7 +1153,7 @@ class R extends x {
|
|
|
1149
1153
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1150
1154
|
}
|
|
1151
1155
|
handleOpacityChange(t) {
|
|
1152
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1156
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = F.combineColorOpacity(
|
|
1153
1157
|
e,
|
|
1154
1158
|
i
|
|
1155
1159
|
);
|
|
@@ -1158,16 +1162,16 @@ class R extends x {
|
|
|
1158
1162
|
draw() {
|
|
1159
1163
|
const t = document.createElement("div");
|
|
1160
1164
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1165
|
+
const o = document.createElement("div");
|
|
1166
|
+
if (o.className = "icon-container", this.props.icon) {
|
|
1167
|
+
const a = document.createElement("span");
|
|
1168
|
+
a.className = "input-icon", a.innerHTML = this.props.icon, o.appendChild(a);
|
|
1165
1169
|
}
|
|
1166
1170
|
if (this.props.title) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1171
|
+
const a = document.createElement("span");
|
|
1172
|
+
a.className = "input-label", a.textContent = this.props.title, o.appendChild(a);
|
|
1169
1173
|
}
|
|
1170
|
-
t.appendChild(
|
|
1174
|
+
t.appendChild(o);
|
|
1171
1175
|
}
|
|
1172
1176
|
const e = document.createElement("div");
|
|
1173
1177
|
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(
|
|
@@ -1176,18 +1180,18 @@ class R extends x {
|
|
|
1176
1180
|
), 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(
|
|
1177
1181
|
"data-test-id",
|
|
1178
1182
|
`${this.getDataPropsPath()}_text`
|
|
1179
|
-
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (
|
|
1180
|
-
const
|
|
1181
|
-
this.handleColorChange(
|
|
1182
|
-
}), this.textInputEl.addEventListener("input", (
|
|
1183
|
-
const
|
|
1184
|
-
this.handleTextInput(
|
|
1185
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1183
|
+
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (o) => {
|
|
1184
|
+
const a = o.target;
|
|
1185
|
+
this.handleColorChange(a.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1186
|
+
}), this.textInputEl.addEventListener("input", (o) => {
|
|
1187
|
+
const a = o.target;
|
|
1188
|
+
this.handleTextInput(a.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : a.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
|
|
1189
|
+
}), this.textInputEl.addEventListener("blur", (o) => {
|
|
1190
|
+
const a = o.target;
|
|
1191
|
+
a.value.trim() === "" && (a.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1188
1192
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1189
|
-
var
|
|
1190
|
-
(
|
|
1193
|
+
var o;
|
|
1194
|
+
(o = this.colorInputEl) == null || o.click();
|
|
1191
1195
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1192
1196
|
const i = document.createElement("div");
|
|
1193
1197
|
i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
|
|
@@ -1195,13 +1199,13 @@ class R extends x {
|
|
|
1195
1199
|
`${this.getDataPropsPath()}_opacity`
|
|
1196
1200
|
);
|
|
1197
1201
|
const s = document.createElement("span");
|
|
1198
|
-
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
1199
|
-
const
|
|
1202
|
+
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
|
|
1203
|
+
const a = o.target, l = parseFloat(a.value);
|
|
1200
1204
|
isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1201
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1202
|
-
const
|
|
1203
|
-
let l = parseFloat(
|
|
1204
|
-
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)),
|
|
1205
|
+
}), this.opacityInputEl.addEventListener("blur", (o) => {
|
|
1206
|
+
const a = o.target;
|
|
1207
|
+
let l = parseFloat(a.value);
|
|
1208
|
+
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), a.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1205
1209
|
}), i.appendChild(this.opacityInputEl), i.appendChild(s);
|
|
1206
1210
|
const n = document.createElement("div");
|
|
1207
1211
|
return n.className = "color-with-opacity-controls-wrapper", n.appendChild(e), n.appendChild(i), t.appendChild(n), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
@@ -1214,8 +1218,8 @@ class R extends x {
|
|
|
1214
1218
|
}
|
|
1215
1219
|
getRgbaValue() {
|
|
1216
1220
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
1217
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1218
|
-
return `rgba(${s}, ${n}, ${
|
|
1221
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1222
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1219
1223
|
}
|
|
1220
1224
|
getColorAndOpacity() {
|
|
1221
1225
|
return {
|
|
@@ -1224,7 +1228,7 @@ class R extends x {
|
|
|
1224
1228
|
};
|
|
1225
1229
|
}
|
|
1226
1230
|
}
|
|
1227
|
-
class
|
|
1231
|
+
class ge extends x {
|
|
1228
1232
|
constructor(t = {}) {
|
|
1229
1233
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1230
1234
|
}
|
|
@@ -1236,27 +1240,27 @@ class de extends x {
|
|
|
1236
1240
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1237
1241
|
const n = document.createElement("div");
|
|
1238
1242
|
if (n.className = "icon-container", this.props.icon) {
|
|
1239
|
-
const
|
|
1240
|
-
n.appendChild(
|
|
1243
|
+
const o = this.createIcon(this.props.icon);
|
|
1244
|
+
n.appendChild(o);
|
|
1241
1245
|
}
|
|
1242
1246
|
if (this.props.title) {
|
|
1243
|
-
const
|
|
1244
|
-
n.appendChild(
|
|
1247
|
+
const o = this.createLabel(this.props.title);
|
|
1248
|
+
n.appendChild(o);
|
|
1245
1249
|
}
|
|
1246
1250
|
t.appendChild(n);
|
|
1247
1251
|
}
|
|
1248
1252
|
const e = document.createElement("textarea");
|
|
1249
1253
|
this.textareaEl = e, e.value = this.value || "", e.placeholder = this.props.placeholder || "Paste your HTML here...", e.className = "html-setting-textarea " + (this.props.textareaClassName || ""), e.rows = this.props.rows || 6, this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.props.maxLength !== void 0 && (e.maxLength = this.props.maxLength), this.props.className && e.classList.add(this.props.className);
|
|
1250
1254
|
const i = (n) => {
|
|
1251
|
-
const
|
|
1252
|
-
this.value =
|
|
1255
|
+
const a = n.target.value;
|
|
1256
|
+
this.value = a, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
1253
1257
|
}, s = (n) => {
|
|
1254
1258
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
1255
1259
|
};
|
|
1256
1260
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1257
1261
|
}
|
|
1258
1262
|
}
|
|
1259
|
-
class
|
|
1263
|
+
class P extends x {
|
|
1260
1264
|
constructor(t) {
|
|
1261
1265
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1262
1266
|
}
|
|
@@ -1279,12 +1283,12 @@ class V extends x {
|
|
|
1279
1283
|
const i = document.createElement("input");
|
|
1280
1284
|
if (i.type = "number", i.className = "number-setting-input " + (this.props.inputClassName || ""), i.value = String(this.value ?? ""), i.placeholder = this.props.placeholder || "", this.getDataPropsPath() && i.setAttribute("data-test-id", this.getDataPropsPath()), this.props.minValue !== void 0 && (i.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (i.max = String(this.props.maxValue)), this.props.step !== void 0 && (i.step = String(this.props.step)), i.addEventListener("input", () => {
|
|
1281
1285
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1282
|
-
let
|
|
1283
|
-
|
|
1286
|
+
let o = Number(i.value);
|
|
1287
|
+
o < s && (o = s), o > n && (o = n), String(o) !== i.value && (i.value = String(o)), this.setValue(o);
|
|
1284
1288
|
}), i.addEventListener("blur", () => {
|
|
1285
|
-
var n,
|
|
1289
|
+
var n, o;
|
|
1286
1290
|
const s = this.validateValue(Number(i.value));
|
|
1287
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
1291
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (o = (n = this.props).onBlur) == null || o.call(n);
|
|
1288
1292
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
1289
1293
|
const s = document.createElement("span");
|
|
1290
1294
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1315,12 +1319,12 @@ class V extends x {
|
|
|
1315
1319
|
);
|
|
1316
1320
|
}
|
|
1317
1321
|
}
|
|
1318
|
-
const
|
|
1322
|
+
const Vt = `
|
|
1319
1323
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1320
1324
|
<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"/>
|
|
1321
1325
|
<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"/>
|
|
1322
1326
|
</svg>`;
|
|
1323
|
-
class
|
|
1327
|
+
class It extends P {
|
|
1324
1328
|
constructor(t = {}) {
|
|
1325
1329
|
const e = {
|
|
1326
1330
|
title: "Opacity",
|
|
@@ -1329,7 +1333,7 @@ class Nt extends V {
|
|
|
1329
1333
|
maxValue: 100,
|
|
1330
1334
|
step: 1,
|
|
1331
1335
|
default: t.default ?? 100,
|
|
1332
|
-
icon:
|
|
1336
|
+
icon: Vt,
|
|
1333
1337
|
...t
|
|
1334
1338
|
};
|
|
1335
1339
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1341,12 +1345,12 @@ class Nt extends V {
|
|
|
1341
1345
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1342
1346
|
}
|
|
1343
1347
|
}
|
|
1344
|
-
const
|
|
1348
|
+
const Tt = `
|
|
1345
1349
|
<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">
|
|
1346
1350
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1347
1351
|
</svg>
|
|
1348
1352
|
`;
|
|
1349
|
-
class
|
|
1353
|
+
class et extends x {
|
|
1350
1354
|
constructor(t = {}) {
|
|
1351
1355
|
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) {
|
|
1352
1356
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1367,12 +1371,12 @@ class tt extends x {
|
|
|
1367
1371
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1368
1372
|
const n = document.createElement("div");
|
|
1369
1373
|
if (n.className = "icon-container", this.props.icon) {
|
|
1370
|
-
const
|
|
1371
|
-
n.appendChild(
|
|
1374
|
+
const o = this.createIcon(this.props.icon);
|
|
1375
|
+
n.appendChild(o);
|
|
1372
1376
|
}
|
|
1373
1377
|
if (this.props.title) {
|
|
1374
|
-
const
|
|
1375
|
-
n.appendChild(
|
|
1378
|
+
const o = this.createLabel(this.props.title);
|
|
1379
|
+
n.appendChild(o);
|
|
1376
1380
|
}
|
|
1377
1381
|
t.appendChild(n);
|
|
1378
1382
|
} else {
|
|
@@ -1381,22 +1385,22 @@ class tt extends x {
|
|
|
1381
1385
|
}
|
|
1382
1386
|
const e = document.createElement("div");
|
|
1383
1387
|
e.classList.add("select-button"), this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
1384
|
-
var n,
|
|
1385
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1388
|
+
var n, o;
|
|
1389
|
+
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1386
1390
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1387
1391
|
const i = document.createElement("ul");
|
|
1388
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1392
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
1393
|
+
const a = this.createOption(n, o);
|
|
1394
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1391
1395
|
}), document.body.appendChild(i);
|
|
1392
1396
|
const s = document.createElement("div");
|
|
1393
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1397
|
+
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) => {
|
|
1394
1398
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1395
1399
|
}).catch((n) => {
|
|
1396
1400
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1397
1401
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1398
|
-
var
|
|
1399
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1402
|
+
var o, a;
|
|
1403
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition());
|
|
1400
1404
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1401
1405
|
this.isOpen && this.checkDropdownPosition();
|
|
1402
1406
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1415,9 +1419,9 @@ class tt extends x {
|
|
|
1415
1419
|
}
|
|
1416
1420
|
}
|
|
1417
1421
|
selectOption(t, e, i) {
|
|
1418
|
-
var n,
|
|
1422
|
+
var n, o;
|
|
1419
1423
|
const s = this._options[e];
|
|
1420
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (
|
|
1424
|
+
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l, r) => {
|
|
1421
1425
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1422
1426
|
}));
|
|
1423
1427
|
}
|
|
@@ -1453,7 +1457,7 @@ class tt extends x {
|
|
|
1453
1457
|
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();
|
|
1454
1458
|
}
|
|
1455
1459
|
}
|
|
1456
|
-
class
|
|
1460
|
+
class Pt extends x {
|
|
1457
1461
|
constructor(t = {}) {
|
|
1458
1462
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1459
1463
|
}
|
|
@@ -1498,18 +1502,18 @@ class Vt extends x {
|
|
|
1498
1502
|
`
|
|
1499
1503
|
}
|
|
1500
1504
|
].forEach((n) => {
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1505
|
+
const o = document.createElement("button");
|
|
1506
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.getDataPropsPath() && o.setAttribute(
|
|
1503
1507
|
"data-test-id",
|
|
1504
1508
|
`${this.getDataPropsPath()}_${n.name}`
|
|
1505
|
-
), this.value === n.name &&
|
|
1506
|
-
var
|
|
1507
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1508
|
-
}), i.appendChild(
|
|
1509
|
+
), this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
1510
|
+
var a;
|
|
1511
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = n.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
1512
|
+
}), i.appendChild(o);
|
|
1509
1513
|
}), t.appendChild(i), t;
|
|
1510
1514
|
}
|
|
1511
1515
|
}
|
|
1512
|
-
class
|
|
1516
|
+
class me extends x {
|
|
1513
1517
|
constructor(t) {
|
|
1514
1518
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1515
1519
|
}
|
|
@@ -1523,42 +1527,42 @@ class pe extends x {
|
|
|
1523
1527
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1524
1528
|
);
|
|
1525
1529
|
if (n) {
|
|
1526
|
-
let
|
|
1527
|
-
p >= 1 ? (
|
|
1530
|
+
let a = +n[1], l = +n[2], r = +n[3], p = +n[4];
|
|
1531
|
+
p >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : p = Math.min(1, p + 0.12), s = `rgba(${a},${l},${r},${p})`;
|
|
1528
1532
|
}
|
|
1529
1533
|
t.addEventListener("mouseenter", () => {
|
|
1530
1534
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1531
1535
|
}), t.addEventListener("mouseleave", () => {
|
|
1532
1536
|
t.style.setProperty("background-color", e, "important");
|
|
1533
1537
|
}), t.addEventListener("click", () => {
|
|
1534
|
-
var
|
|
1535
|
-
return (l = (
|
|
1538
|
+
var a, l;
|
|
1539
|
+
return (l = (a = this.props).onClick) == null ? void 0 : l.call(a);
|
|
1536
1540
|
});
|
|
1537
|
-
const
|
|
1538
|
-
return
|
|
1541
|
+
const o = document.createElement("div");
|
|
1542
|
+
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1539
1543
|
}
|
|
1540
1544
|
}
|
|
1541
|
-
class
|
|
1545
|
+
class fe extends x {
|
|
1542
1546
|
constructor(t = {}) {
|
|
1543
1547
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1544
1548
|
const e = t.width || 0, i = t.height || 0;
|
|
1545
1549
|
this.value || (this.value = {
|
|
1546
1550
|
width: e,
|
|
1547
1551
|
height: i
|
|
1548
|
-
}), 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
|
|
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 P({
|
|
1549
1553
|
title: "Width",
|
|
1550
1554
|
default: this.value.width,
|
|
1551
1555
|
suffix: "px",
|
|
1552
1556
|
minValue: this.minWidth,
|
|
1553
1557
|
maxValue: this.maxWidth,
|
|
1554
|
-
icon:
|
|
1555
|
-
}), this.heightSetting = new
|
|
1558
|
+
icon: Ot
|
|
1559
|
+
}), this.heightSetting = new P({
|
|
1556
1560
|
title: "Height",
|
|
1557
1561
|
default: this.value.height,
|
|
1558
1562
|
suffix: "px",
|
|
1559
1563
|
minValue: this.minHeight,
|
|
1560
1564
|
maxValue: this.maxHeight,
|
|
1561
|
-
icon:
|
|
1565
|
+
icon: Ht
|
|
1562
1566
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1563
1567
|
}
|
|
1564
1568
|
handleWidthChange(t) {
|
|
@@ -1628,8 +1632,8 @@ class ue extends x {
|
|
|
1628
1632
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1629
1633
|
"aria-label",
|
|
1630
1634
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1631
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1632
|
-
|
|
1635
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
1636
|
+
o.preventDefault(), this.toggleLock(n);
|
|
1633
1637
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1634
1638
|
}
|
|
1635
1639
|
isLocked() {
|
|
@@ -1652,24 +1656,24 @@ class ue extends x {
|
|
|
1652
1656
|
}
|
|
1653
1657
|
}
|
|
1654
1658
|
}
|
|
1655
|
-
const
|
|
1659
|
+
const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1656
1660
|
<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"/>
|
|
1657
|
-
</svg>`,
|
|
1661
|
+
</svg>`, Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1658
1662
|
<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"/>
|
|
1659
|
-
</svg>`,
|
|
1663
|
+
</svg>`, Q = `
|
|
1660
1664
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1661
1665
|
<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"/>
|
|
1662
1666
|
</svg>
|
|
1663
|
-
`,
|
|
1667
|
+
`, $t = `
|
|
1664
1668
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1665
1669
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1666
1670
|
<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"/>
|
|
1667
1671
|
</svg>
|
|
1668
|
-
`,
|
|
1672
|
+
`, Bt = `
|
|
1669
1673
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1670
1674
|
<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"/>
|
|
1671
1675
|
</svg>
|
|
1672
|
-
`,
|
|
1676
|
+
`, At = `
|
|
1673
1677
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1674
1678
|
<!-- Top dot -->
|
|
1675
1679
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1689,7 +1693,7 @@ const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1689
1693
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1690
1694
|
</svg>
|
|
1691
1695
|
`;
|
|
1692
|
-
class
|
|
1696
|
+
class nt extends x {
|
|
1693
1697
|
constructor(t = {}) {
|
|
1694
1698
|
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();
|
|
1695
1699
|
}
|
|
@@ -1742,18 +1746,18 @@ class ct extends x {
|
|
|
1742
1746
|
);
|
|
1743
1747
|
if (t && t !== "") {
|
|
1744
1748
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1745
|
-
<span class="upload-icon">${
|
|
1749
|
+
<span class="upload-icon">${Q}</span>
|
|
1746
1750
|
<span class="upload-label">Replace</span>
|
|
1747
1751
|
`);
|
|
1748
1752
|
const n = () => {
|
|
1749
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1750
|
-
},
|
|
1751
|
-
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1753
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1754
|
+
}, o = () => {
|
|
1755
|
+
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1752
1756
|
};
|
|
1753
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1757
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1754
1758
|
} else
|
|
1755
1759
|
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 = `
|
|
1756
|
-
<span class="upload-icon">${
|
|
1760
|
+
<span class="upload-icon">${Q}</span>
|
|
1757
1761
|
<span class="upload-label">Upload</span>
|
|
1758
1762
|
`);
|
|
1759
1763
|
}
|
|
@@ -1761,24 +1765,24 @@ class ct extends x {
|
|
|
1761
1765
|
const t = document.createElement("div");
|
|
1762
1766
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1763
1767
|
"focusout",
|
|
1764
|
-
(
|
|
1768
|
+
(a) => {
|
|
1765
1769
|
var l;
|
|
1766
|
-
|
|
1770
|
+
a.relatedTarget && t.contains(a.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1767
1771
|
},
|
|
1768
1772
|
!0
|
|
1769
1773
|
);
|
|
1770
1774
|
const e = !!(this.props.title || this.props.icon);
|
|
1771
1775
|
if (e || t.classList.add("no-label"), e) {
|
|
1772
|
-
const
|
|
1773
|
-
if (
|
|
1776
|
+
const a = document.createElement("div");
|
|
1777
|
+
if (a.className = "icon-title-container", this.props.icon) {
|
|
1774
1778
|
const l = this.createIcon(this.props.icon);
|
|
1775
|
-
|
|
1779
|
+
a.appendChild(l);
|
|
1776
1780
|
}
|
|
1777
1781
|
if (this.props.title) {
|
|
1778
1782
|
const l = this.createLabel(this.props.title);
|
|
1779
|
-
|
|
1783
|
+
a.appendChild(l);
|
|
1780
1784
|
}
|
|
1781
|
-
t.appendChild(
|
|
1785
|
+
t.appendChild(a);
|
|
1782
1786
|
}
|
|
1783
1787
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1784
1788
|
const i = document.createElement("div");
|
|
@@ -1786,19 +1790,19 @@ class ct extends x {
|
|
|
1786
1790
|
const s = this.value && this.value !== "";
|
|
1787
1791
|
s || i.classList.add("no-image");
|
|
1788
1792
|
const n = document.createElement("div");
|
|
1789
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1793
|
+
if (n.className = "preview-placeholder", n.innerHTML = $t, 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
|
+
const a = document.createElement("button");
|
|
1795
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Bt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1792
1796
|
var r;
|
|
1793
1797
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1794
1798
|
};
|
|
1795
1799
|
}
|
|
1796
1800
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1797
|
-
const
|
|
1798
|
-
return
|
|
1799
|
-
<span class="upload-icon">${
|
|
1801
|
+
const o = document.createElement("button");
|
|
1802
|
+
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1803
|
+
<span class="upload-icon">${Q}</span>
|
|
1800
1804
|
<span class="upload-label">Upload</span>
|
|
1801
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1805
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1802
1806
|
window.postMessage(
|
|
1803
1807
|
{
|
|
1804
1808
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1809,14 +1813,14 @@ class ct extends x {
|
|
|
1809
1813
|
}, t;
|
|
1810
1814
|
}
|
|
1811
1815
|
}
|
|
1812
|
-
class
|
|
1816
|
+
class Gt extends P {
|
|
1813
1817
|
constructor(t = {}) {
|
|
1814
1818
|
super({
|
|
1815
1819
|
...t,
|
|
1816
1820
|
title: t.title || "Height",
|
|
1817
1821
|
suffix: t.suffix || "px",
|
|
1818
1822
|
minValue: t.minValue ?? 0,
|
|
1819
|
-
icon: t.icon ||
|
|
1823
|
+
icon: t.icon || Dt,
|
|
1820
1824
|
default: t.default ?? 100
|
|
1821
1825
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1822
1826
|
}
|
|
@@ -1827,17 +1831,17 @@ class ge extends V {
|
|
|
1827
1831
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1828
1832
|
}
|
|
1829
1833
|
}
|
|
1830
|
-
const
|
|
1834
|
+
const Dt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1831
1835
|
<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"/>
|
|
1832
1836
|
</svg>`;
|
|
1833
|
-
class
|
|
1837
|
+
class Ft extends P {
|
|
1834
1838
|
constructor(t = {}) {
|
|
1835
1839
|
super({
|
|
1836
1840
|
...t,
|
|
1837
1841
|
title: t.title || "Width",
|
|
1838
1842
|
suffix: t.suffix || "px",
|
|
1839
1843
|
minValue: t.minValue ?? 0,
|
|
1840
|
-
icon: t.icon ||
|
|
1844
|
+
icon: t.icon || Rt,
|
|
1841
1845
|
default: t.default ?? 100
|
|
1842
1846
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1843
1847
|
}
|
|
@@ -1848,14 +1852,14 @@ class me extends V {
|
|
|
1848
1852
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1849
1853
|
}
|
|
1850
1854
|
}
|
|
1851
|
-
const
|
|
1855
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1852
1856
|
<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"/>
|
|
1853
|
-
</svg>`,
|
|
1857
|
+
</svg>`, Ut = `
|
|
1854
1858
|
<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">
|
|
1855
1859
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1856
1860
|
</svg>
|
|
1857
1861
|
`;
|
|
1858
|
-
class
|
|
1862
|
+
class ve extends x {
|
|
1859
1863
|
constructor(t = {}) {
|
|
1860
1864
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1861
1865
|
const e = this._options.findIndex(
|
|
@@ -1882,44 +1886,44 @@ class fe extends x {
|
|
|
1882
1886
|
e.classList.add("has-label");
|
|
1883
1887
|
const n = document.createElement("div");
|
|
1884
1888
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1885
|
-
const
|
|
1886
|
-
if (
|
|
1887
|
-
|
|
1889
|
+
const o = document.createElement("span");
|
|
1890
|
+
if (o.className = "select-value", this.isLoading)
|
|
1891
|
+
o.textContent = this.props.loadingText || "Loading options...";
|
|
1888
1892
|
else {
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1893
|
+
const a = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, l = a && typeof a.name == "string" ? a.name : "Select an option";
|
|
1894
|
+
o.textContent = l;
|
|
1891
1895
|
}
|
|
1892
|
-
e.appendChild(
|
|
1896
|
+
e.appendChild(o);
|
|
1893
1897
|
} else {
|
|
1894
1898
|
const n = document.createElement("span");
|
|
1895
1899
|
if (this.isLoading)
|
|
1896
1900
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1897
1901
|
else {
|
|
1898
|
-
const
|
|
1899
|
-
n.textContent =
|
|
1902
|
+
const o = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, a = o && typeof o.name == "string" ? o.name : "Select an option";
|
|
1903
|
+
n.textContent = a;
|
|
1900
1904
|
}
|
|
1901
1905
|
e.appendChild(n);
|
|
1902
1906
|
}
|
|
1903
1907
|
e.onclick = () => {
|
|
1904
|
-
var n,
|
|
1905
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1908
|
+
var n, o;
|
|
1909
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1906
1910
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1907
1911
|
const i = document.createElement("ul");
|
|
1908
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1912
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
1913
|
+
const a = this.createOption(n, o);
|
|
1914
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1911
1915
|
}), t.appendChild(i);
|
|
1912
1916
|
const s = document.createElement("div");
|
|
1913
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1914
|
-
var n,
|
|
1915
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1917
|
+
return s.classList.add("svg-container"), s.innerHTML = Ut, t.appendChild(s), s.onclick = () => {
|
|
1918
|
+
var n, o;
|
|
1919
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1916
1920
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1917
|
-
const
|
|
1921
|
+
const o = new Set(
|
|
1918
1922
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1919
|
-
),
|
|
1920
|
-
(l) => !
|
|
1923
|
+
), a = n.filter(
|
|
1924
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1921
1925
|
);
|
|
1922
|
-
if (this._options.push(...
|
|
1926
|
+
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1923
1927
|
const l = this._options.findIndex(
|
|
1924
1928
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1925
1929
|
);
|
|
@@ -1933,12 +1937,12 @@ class fe extends x {
|
|
|
1933
1937
|
!0
|
|
1934
1938
|
);
|
|
1935
1939
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1936
|
-
const
|
|
1940
|
+
const o = new Set(
|
|
1937
1941
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1938
|
-
),
|
|
1939
|
-
(l) => !
|
|
1942
|
+
), a = n.filter(
|
|
1943
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1940
1944
|
);
|
|
1941
|
-
if (this._options.push(...
|
|
1945
|
+
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1942
1946
|
const l = this._options.findIndex(
|
|
1943
1947
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1944
1948
|
);
|
|
@@ -1957,11 +1961,11 @@ class fe extends x {
|
|
|
1957
1961
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1958
1962
|
}
|
|
1959
1963
|
selectApiOption(t, e, i) {
|
|
1960
|
-
var
|
|
1961
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
1964
|
+
var a, l, r;
|
|
1965
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((a = s.closest(".select-api-option")) == null ? void 0 : a.querySelector(".select-api-radio"));
|
|
1962
1966
|
n && (n.checked = !0);
|
|
1963
|
-
const
|
|
1964
|
-
this.setValue(
|
|
1967
|
+
const o = this._options[e].value;
|
|
1968
|
+
this.setValue(o), this.isOpen = !1, (l = this.optionsListEl) == null || l.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open");
|
|
1965
1969
|
}
|
|
1966
1970
|
updateOptionsList() {
|
|
1967
1971
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -2004,13 +2008,13 @@ class fe extends x {
|
|
|
2004
2008
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
2005
2009
|
}
|
|
2006
2010
|
}
|
|
2007
|
-
class
|
|
2011
|
+
class Ce extends x {
|
|
2008
2012
|
constructor(t) {
|
|
2009
2013
|
var e, i;
|
|
2010
2014
|
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;
|
|
2011
2015
|
}
|
|
2012
2016
|
draw() {
|
|
2013
|
-
var
|
|
2017
|
+
var o, a;
|
|
2014
2018
|
const t = document.createElement("div");
|
|
2015
2019
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
2016
2020
|
const e = document.createElement("div");
|
|
@@ -2026,9 +2030,9 @@ class ve extends x {
|
|
|
2026
2030
|
const i = document.createElement("label");
|
|
2027
2031
|
i.className = "toggle-switch";
|
|
2028
2032
|
const s = document.createElement("input");
|
|
2029
|
-
s.type = "checkbox", s.checked = ((
|
|
2033
|
+
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
2030
2034
|
var r, p;
|
|
2031
|
-
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((
|
|
2035
|
+
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : p.value) ?? "";
|
|
2032
2036
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
2033
2037
|
});
|
|
2034
2038
|
const n = document.createElement("span");
|
|
@@ -2054,13 +2058,13 @@ class ve extends x {
|
|
|
2054
2058
|
this.detectChangeCallback = t;
|
|
2055
2059
|
}
|
|
2056
2060
|
}
|
|
2057
|
-
const
|
|
2061
|
+
const Wt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2058
2062
|
<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"/>
|
|
2059
2063
|
</svg>`;
|
|
2060
|
-
class
|
|
2064
|
+
class ye extends x {
|
|
2061
2065
|
// Store mobile value
|
|
2062
2066
|
constructor(t = {}) {
|
|
2063
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2067
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Wt, 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);
|
|
2064
2068
|
}
|
|
2065
2069
|
draw() {
|
|
2066
2070
|
const t = document.createElement("div");
|
|
@@ -2071,27 +2075,27 @@ class Ce extends x {
|
|
|
2071
2075
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
2072
2076
|
const s = document.createElement("span");
|
|
2073
2077
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
2074
|
-
const
|
|
2075
|
-
|
|
2078
|
+
const a = document.createElement("span");
|
|
2079
|
+
a.className = "setting-icon", a.innerHTML = this.props.icon, i.insertBefore(a, s);
|
|
2076
2080
|
}
|
|
2077
2081
|
const n = document.createElement("div");
|
|
2078
2082
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
2079
|
-
const
|
|
2080
|
-
return
|
|
2083
|
+
const o = document.createElement("div");
|
|
2084
|
+
return o.className = "gap-inputs-container", this.props.rowGap && o.appendChild(this.createGapInput("row", "Row")), this.props.columnGap && o.appendChild(this.createGapInput("column", "Col")), n.appendChild(o), e.appendChild(i), e.appendChild(n), t.appendChild(e), t;
|
|
2081
2085
|
}
|
|
2082
2086
|
createGapInput(t, e) {
|
|
2083
2087
|
const i = document.createElement("div");
|
|
2084
2088
|
i.className = "gap-input-wrapper";
|
|
2085
2089
|
const s = document.createElement("input");
|
|
2086
2090
|
if (s.type = "number", s.className = `gap-input gap-${t}-input ${this.props.inputClassName || ""}`, s.id = `${this.id}-${t}-input`, s.min = String(this.props.minValue ?? 0), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), s.step = String(this.props.step ?? 1), s.value = String(this.inputValues[t] ?? this.value), s.title = e, this.getDataPropsPath() && s.setAttribute("data-test-id", `${this.getDataPropsPath()}_${t}`), s.addEventListener("input", (n) => {
|
|
2087
|
-
const
|
|
2088
|
-
let
|
|
2089
|
-
|
|
2091
|
+
const o = n.target;
|
|
2092
|
+
let a = parseFloat(o.value);
|
|
2093
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
2090
2094
|
}), s.addEventListener("blur", (n) => {
|
|
2091
2095
|
var l, r;
|
|
2092
|
-
const
|
|
2093
|
-
let
|
|
2094
|
-
|
|
2096
|
+
const o = n.target;
|
|
2097
|
+
let a = parseFloat(o.value);
|
|
2098
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (r = (l = this.props).onBlur) == null || r.call(l);
|
|
2095
2099
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
2096
2100
|
const n = document.createElement("span");
|
|
2097
2101
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2111,40 +2115,40 @@ class Ce extends x {
|
|
|
2111
2115
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2112
2116
|
}
|
|
2113
2117
|
}
|
|
2114
|
-
const
|
|
2118
|
+
const zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2115
2119
|
<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"/>
|
|
2116
2120
|
</svg>`;
|
|
2117
|
-
class
|
|
2121
|
+
class be extends P {
|
|
2118
2122
|
constructor(t = {}) {
|
|
2119
2123
|
super({
|
|
2120
2124
|
...t,
|
|
2121
2125
|
minValue: t.minValue ?? 0,
|
|
2122
2126
|
maxValue: t.maxValue ?? 1e3,
|
|
2123
|
-
icon: t.icon ||
|
|
2127
|
+
icon: t.icon || zt,
|
|
2124
2128
|
title: t.title || "Margin Bottom",
|
|
2125
2129
|
default: t.default ?? 20,
|
|
2126
2130
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2127
2131
|
}), this.inputType = "number";
|
|
2128
2132
|
}
|
|
2129
2133
|
}
|
|
2130
|
-
const
|
|
2134
|
+
const jt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2131
2135
|
<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"
|
|
2132
2136
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2133
2137
|
</svg>`;
|
|
2134
|
-
class
|
|
2138
|
+
class Ee extends P {
|
|
2135
2139
|
constructor(t = {}) {
|
|
2136
2140
|
super({
|
|
2137
2141
|
...t,
|
|
2138
2142
|
minValue: t.minValue ?? 0,
|
|
2139
2143
|
maxValue: t.maxValue ?? 1e3,
|
|
2140
|
-
icon: t.icon ||
|
|
2144
|
+
icon: t.icon || jt,
|
|
2141
2145
|
title: t.title || "Margin Top",
|
|
2142
2146
|
default: t.default ?? 20,
|
|
2143
2147
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2144
2148
|
}), this.inputType = "number";
|
|
2145
2149
|
}
|
|
2146
2150
|
}
|
|
2147
|
-
class
|
|
2151
|
+
class we extends x {
|
|
2148
2152
|
constructor(t) {
|
|
2149
2153
|
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];
|
|
2150
2154
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
@@ -2164,9 +2168,9 @@ class Ee extends x {
|
|
|
2164
2168
|
return i.font = s, i.measureText(t).width;
|
|
2165
2169
|
}
|
|
2166
2170
|
adaptPlaceholderToSingleLine(t, e) {
|
|
2167
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0,
|
|
2171
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0, o = parseFloat(i.borderLeftWidth) || 0, a = parseFloat(i.borderRightWidth) || 0, l = Math.max(
|
|
2168
2172
|
0,
|
|
2169
|
-
t.clientWidth - s - n -
|
|
2173
|
+
t.clientWidth - s - n - o - a
|
|
2170
2174
|
);
|
|
2171
2175
|
if (l <= 0) {
|
|
2172
2176
|
t.placeholder = e;
|
|
@@ -2177,42 +2181,42 @@ class Ee extends x {
|
|
|
2177
2181
|
return;
|
|
2178
2182
|
}
|
|
2179
2183
|
const p = "...";
|
|
2180
|
-
let
|
|
2181
|
-
for (;
|
|
2182
|
-
const
|
|
2183
|
-
this.measureTextWidth(
|
|
2184
|
+
let h = 0, d = e.length, u = 0;
|
|
2185
|
+
for (; h <= d; ) {
|
|
2186
|
+
const m = Math.floor((h + d) / 2), f = e.slice(0, m).trimEnd() + p;
|
|
2187
|
+
this.measureTextWidth(f, i) <= l ? (u = m, h = m + 1) : d = m - 1;
|
|
2184
2188
|
}
|
|
2185
2189
|
const g = e.slice(0, u).trimEnd() + p;
|
|
2186
2190
|
t.placeholder = g;
|
|
2187
2191
|
}
|
|
2188
2192
|
autosizeTextarea(t, e = 3) {
|
|
2189
2193
|
t.style.height = "auto";
|
|
2190
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom),
|
|
2191
|
-
t.style.height = `${l}px`, t.scrollHeight >
|
|
2194
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom), o = parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth), a = s * e + n + o, l = Math.min(t.scrollHeight || 44, a);
|
|
2195
|
+
t.style.height = `${l}px`, t.scrollHeight > a ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
2192
2196
|
}
|
|
2193
2197
|
createTextareaRow(t, e) {
|
|
2194
2198
|
const i = document.createElement("div");
|
|
2195
2199
|
i.classList.add("simple-multi-language-row");
|
|
2196
2200
|
const s = document.createElement("label");
|
|
2197
2201
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2198
|
-
const n = new
|
|
2202
|
+
const n = new nt({
|
|
2199
2203
|
defaultUrl: e || "",
|
|
2200
2204
|
title: "",
|
|
2201
2205
|
id: `${this.id}_upload_${t}`
|
|
2202
2206
|
});
|
|
2203
|
-
n.setOnChange((
|
|
2204
|
-
this.updateLanguageValue(t,
|
|
2207
|
+
n.setOnChange((a) => {
|
|
2208
|
+
this.updateLanguageValue(t, a), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(a);
|
|
2205
2209
|
}), this.uploadSettings.set(t, n);
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2210
|
+
const o = n.draw();
|
|
2211
|
+
o.classList.add("simple-language-upload"), i.appendChild(o);
|
|
2208
2212
|
} else {
|
|
2209
2213
|
const n = document.createElement("textarea");
|
|
2210
2214
|
n.id = `textarea-${t}`, n.classList.add("simple-language-textarea"), n.value = e || "", n.rows = 1, n.style.overflowY = "hidden";
|
|
2211
|
-
let
|
|
2212
|
-
|
|
2215
|
+
let o = this.props.placeholder || "Enter text in {language}...";
|
|
2216
|
+
o.includes("{language}") && (o = o.replace(
|
|
2213
2217
|
"{language}",
|
|
2214
2218
|
t.toUpperCase()
|
|
2215
|
-
)), n.setAttribute("data-full-placeholder",
|
|
2219
|
+
)), n.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(n, o), this.getDataPropsPath() && n.setAttribute(
|
|
2216
2220
|
"data-test-id",
|
|
2217
2221
|
`${this.getDataPropsPath()}_${t}`
|
|
2218
2222
|
), n.addEventListener("input", (l) => {
|
|
@@ -2241,11 +2245,11 @@ class Ee extends x {
|
|
|
2241
2245
|
`#textarea-${e}`
|
|
2242
2246
|
);
|
|
2243
2247
|
if (i && (!i.value || i.value.trim() === "")) {
|
|
2244
|
-
const
|
|
2248
|
+
const o = t || ((n = this.props.placeholder) == null ? void 0 : n.replace(
|
|
2245
2249
|
"{language}",
|
|
2246
2250
|
e.toUpperCase()
|
|
2247
2251
|
)) || `Enter text in ${e.toUpperCase()}...`;
|
|
2248
|
-
i.setAttribute("data-full-placeholder",
|
|
2252
|
+
i.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(i, o);
|
|
2249
2253
|
}
|
|
2250
2254
|
});
|
|
2251
2255
|
}
|
|
@@ -2257,17 +2261,17 @@ class Ee extends x {
|
|
|
2257
2261
|
}
|
|
2258
2262
|
const e = document.createElement("div");
|
|
2259
2263
|
e.classList.add("simple-multi-language-content"), this.props.languages.forEach((s) => {
|
|
2260
|
-
var
|
|
2261
|
-
const n = ((
|
|
2262
|
-
e.appendChild(
|
|
2264
|
+
var a;
|
|
2265
|
+
const n = ((a = this.value) == null ? void 0 : a[s]) || "", o = this.createTextareaRow(s, n);
|
|
2266
|
+
e.appendChild(o);
|
|
2263
2267
|
}), t.appendChild(e), this.container = t;
|
|
2264
2268
|
const i = () => {
|
|
2265
2269
|
if (!this.container) return;
|
|
2266
2270
|
this.container.querySelectorAll(
|
|
2267
2271
|
".simple-language-textarea"
|
|
2268
2272
|
).forEach((n) => {
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2273
|
+
const o = n.getAttribute("data-full-placeholder") || "";
|
|
2274
|
+
o && this.adaptPlaceholderToSingleLine(n, o);
|
|
2271
2275
|
});
|
|
2272
2276
|
};
|
|
2273
2277
|
return window.addEventListener("resize", i), t;
|
|
@@ -2291,7 +2295,7 @@ class Ee extends x {
|
|
|
2291
2295
|
});
|
|
2292
2296
|
}
|
|
2293
2297
|
}
|
|
2294
|
-
class
|
|
2298
|
+
class xe extends x {
|
|
2295
2299
|
constructor(t = {}) {
|
|
2296
2300
|
super(t), this.inputType = "select";
|
|
2297
2301
|
const e = [
|
|
@@ -2302,7 +2306,7 @@ class we extends x {
|
|
|
2302
2306
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2303
2307
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2304
2308
|
];
|
|
2305
|
-
this.selectSetting = new
|
|
2309
|
+
this.selectSetting = new et({
|
|
2306
2310
|
title: this.title || "Animation",
|
|
2307
2311
|
options: e,
|
|
2308
2312
|
default: this.props.default || "none"
|
|
@@ -2318,97 +2322,97 @@ class we extends x {
|
|
|
2318
2322
|
this.selectSetting.destroy(), super.destroy();
|
|
2319
2323
|
}
|
|
2320
2324
|
}
|
|
2321
|
-
const
|
|
2322
|
-
let i = !1, s = 0, n = 0,
|
|
2323
|
-
const l = (
|
|
2324
|
-
if (
|
|
2325
|
-
i = !0, s =
|
|
2325
|
+
const ut = (c, t, e) => {
|
|
2326
|
+
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2327
|
+
const l = (h) => {
|
|
2328
|
+
if (h.target.closest("button")) return;
|
|
2329
|
+
i = !0, s = h.clientX, n = h.clientY;
|
|
2326
2330
|
const d = t.getBoundingClientRect();
|
|
2327
|
-
|
|
2328
|
-
}, r = (
|
|
2331
|
+
o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2332
|
+
}, r = (h) => {
|
|
2329
2333
|
if (!i) return;
|
|
2330
|
-
const d =
|
|
2331
|
-
let C =
|
|
2332
|
-
C = Math.max(8, Math.min(g -
|
|
2334
|
+
const d = h.clientX - s, u = h.clientY - n, g = window.innerWidth, m = window.innerHeight, f = t.offsetWidth, v = t.offsetHeight;
|
|
2335
|
+
let C = o + d, y = a + u;
|
|
2336
|
+
C = Math.max(8, Math.min(g - f - 8, C)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
|
|
2333
2337
|
}, p = () => {
|
|
2334
2338
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2335
2339
|
};
|
|
2336
|
-
|
|
2337
|
-
}, W = (
|
|
2338
|
-
if (!
|
|
2339
|
-
let t =
|
|
2340
|
+
c.addEventListener("mousedown", l);
|
|
2341
|
+
}, W = (c) => {
|
|
2342
|
+
if (!c) return null;
|
|
2343
|
+
let t = c.trim();
|
|
2340
2344
|
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()}`;
|
|
2341
|
-
},
|
|
2342
|
-
const t =
|
|
2345
|
+
}, J = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, V = (c) => {
|
|
2346
|
+
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2343
2347
|
return {
|
|
2344
2348
|
r: parseInt(e.slice(0, 2), 16),
|
|
2345
2349
|
g: parseInt(e.slice(2, 4), 16),
|
|
2346
2350
|
b: parseInt(e.slice(4, 6), 16)
|
|
2347
2351
|
};
|
|
2348
|
-
},
|
|
2349
|
-
const { r: t, g: e, b: i } =
|
|
2352
|
+
}, R = (c) => {
|
|
2353
|
+
const { r: t, g: e, b: i } = V(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2350
2354
|
let p = 0;
|
|
2351
|
-
r !== 0 && (
|
|
2352
|
-
const
|
|
2353
|
-
return { h: p * 60, s:
|
|
2354
|
-
},
|
|
2355
|
-
const i = (
|
|
2356
|
-
let
|
|
2357
|
-
return i < 60 ? (
|
|
2358
|
-
Math.round((
|
|
2359
|
-
Math.round((l +
|
|
2360
|
-
Math.round((r +
|
|
2355
|
+
r !== 0 && (a === s ? p = (n - o) / r % 6 : a === n ? p = (o - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
|
|
2356
|
+
const h = a === 0 ? 0 : r / a, d = a;
|
|
2357
|
+
return { h: p * 60, s: h, v: d };
|
|
2358
|
+
}, U = (c, t, e) => {
|
|
2359
|
+
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2360
|
+
let a = 0, l = 0, r = 0;
|
|
2361
|
+
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), J(
|
|
2362
|
+
Math.round((a + o) * 255),
|
|
2363
|
+
Math.round((l + o) * 255),
|
|
2364
|
+
Math.round((r + o) * 255)
|
|
2361
2365
|
);
|
|
2362
|
-
},
|
|
2366
|
+
}, gt = (c, t, e) => {
|
|
2363
2367
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2364
|
-
return { hue:
|
|
2365
|
-
},
|
|
2366
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2367
|
-
let
|
|
2368
|
-
return
|
|
2369
|
-
r: Math.round((
|
|
2370
|
-
g: Math.round((
|
|
2368
|
+
return { hue: c, sat: s, lightness: i };
|
|
2369
|
+
}, it = (c, t, e) => {
|
|
2370
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2371
|
+
let o = 0, a = 0, l = 0;
|
|
2372
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2373
|
+
r: Math.round((o + n) * 255),
|
|
2374
|
+
g: Math.round((a + n) * 255),
|
|
2371
2375
|
b: Math.round((l + n) * 255)
|
|
2372
2376
|
};
|
|
2373
|
-
},
|
|
2377
|
+
}, st = (c, t) => {
|
|
2374
2378
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2375
|
-
if (
|
|
2376
|
-
const { r: s, g: n, b:
|
|
2377
|
-
return `rgba(${s}, ${n}, ${
|
|
2378
|
-
}
|
|
2379
|
-
if (
|
|
2380
|
-
return
|
|
2381
|
-
if (
|
|
2382
|
-
return
|
|
2383
|
-
if (
|
|
2384
|
-
const s =
|
|
2379
|
+
if (c.startsWith("#")) {
|
|
2380
|
+
const { r: s, g: n, b: o } = V(c);
|
|
2381
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2382
|
+
}
|
|
2383
|
+
if (c.startsWith("rgba("))
|
|
2384
|
+
return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2385
|
+
if (c.startsWith("rgb("))
|
|
2386
|
+
return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2387
|
+
if (c.startsWith("hsl(")) {
|
|
2388
|
+
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2385
2389
|
if (s) {
|
|
2386
|
-
const { r: n, g:
|
|
2390
|
+
const { r: n, g: o, b: a } = it(
|
|
2387
2391
|
parseInt(s[1]),
|
|
2388
2392
|
parseInt(s[2]) / 100,
|
|
2389
2393
|
parseInt(s[3]) / 100
|
|
2390
2394
|
);
|
|
2391
|
-
return `rgba(${n}, ${
|
|
2395
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2392
2396
|
}
|
|
2393
2397
|
}
|
|
2394
|
-
if (
|
|
2395
|
-
const s =
|
|
2398
|
+
if (c.startsWith("hsla(")) {
|
|
2399
|
+
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2396
2400
|
if (s) {
|
|
2397
|
-
const { r: n, g:
|
|
2401
|
+
const { r: n, g: o, b: a } = it(
|
|
2398
2402
|
parseInt(s[1]),
|
|
2399
2403
|
parseInt(s[2]) / 100,
|
|
2400
2404
|
parseInt(s[3]) / 100
|
|
2401
2405
|
);
|
|
2402
|
-
return `rgba(${n}, ${
|
|
2406
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2403
2407
|
}
|
|
2404
2408
|
}
|
|
2405
|
-
const i = W(
|
|
2409
|
+
const i = W(c);
|
|
2406
2410
|
if (i) {
|
|
2407
|
-
const { r: s, g: n, b:
|
|
2408
|
-
return `rgba(${s}, ${n}, ${
|
|
2411
|
+
const { r: s, g: n, b: o } = V(i);
|
|
2412
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2409
2413
|
}
|
|
2410
|
-
return
|
|
2411
|
-
},
|
|
2414
|
+
return c;
|
|
2415
|
+
}, qt = (c) => [
|
|
2412
2416
|
"red",
|
|
2413
2417
|
"green",
|
|
2414
2418
|
"blue",
|
|
@@ -2432,22 +2436,22 @@ const ht = (h, t, e) => {
|
|
|
2432
2436
|
"teal",
|
|
2433
2437
|
"fuchsia",
|
|
2434
2438
|
"transparent"
|
|
2435
|
-
].includes(
|
|
2439
|
+
].includes(c.toLowerCase()), mt = (c) => [
|
|
2436
2440
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2437
2441
|
/^rgba?\s*\([^)]+\)$/,
|
|
2438
2442
|
/^hsla?\s*\([^)]+\)$/,
|
|
2439
2443
|
/^[a-zA-Z]+$/
|
|
2440
|
-
].some((e) => e.test(
|
|
2444
|
+
].some((e) => e.test(c.trim())), _t = (c) => {
|
|
2441
2445
|
if (typeof document > "u")
|
|
2442
|
-
return
|
|
2446
|
+
return mt(c) || !!W(c);
|
|
2443
2447
|
const t = document.createElement("div");
|
|
2444
|
-
return t.style.color =
|
|
2445
|
-
},
|
|
2446
|
-
const t =
|
|
2448
|
+
return t.style.color = c, t.style.color !== "";
|
|
2449
|
+
}, ft = (c) => {
|
|
2450
|
+
const t = c.trim();
|
|
2447
2451
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2448
|
-
const n = t.slice(1),
|
|
2452
|
+
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2449
2453
|
return {
|
|
2450
|
-
color:
|
|
2454
|
+
color: J(o, a, l),
|
|
2451
2455
|
position: 0,
|
|
2452
2456
|
opacity: Math.round(r / 255 * 100)
|
|
2453
2457
|
};
|
|
@@ -2456,9 +2460,9 @@ const ht = (h, t, e) => {
|
|
|
2456
2460
|
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2457
2461
|
);
|
|
2458
2462
|
if (e) {
|
|
2459
|
-
const n = parseInt(e[1]),
|
|
2463
|
+
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2460
2464
|
return {
|
|
2461
|
-
color:
|
|
2465
|
+
color: J(n, o, a),
|
|
2462
2466
|
position: 0,
|
|
2463
2467
|
opacity: Math.round(l * 100)
|
|
2464
2468
|
};
|
|
@@ -2467,23 +2471,23 @@ const ht = (h, t, e) => {
|
|
|
2467
2471
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2468
2472
|
);
|
|
2469
2473
|
if (i) {
|
|
2470
|
-
const { r: n, g:
|
|
2474
|
+
const { r: n, g: o, b: a } = it(
|
|
2471
2475
|
parseFloat(i[1]),
|
|
2472
2476
|
parseFloat(i[2]) / 100,
|
|
2473
2477
|
parseFloat(i[3]) / 100
|
|
2474
2478
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2475
2479
|
return {
|
|
2476
|
-
color:
|
|
2480
|
+
color: J(n, o, a),
|
|
2477
2481
|
position: 0,
|
|
2478
2482
|
opacity: Math.round(l * 100)
|
|
2479
2483
|
};
|
|
2480
2484
|
}
|
|
2481
2485
|
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
2482
|
-
},
|
|
2486
|
+
}, rt = (c) => {
|
|
2483
2487
|
const t = [];
|
|
2484
2488
|
let e = "", i = 0;
|
|
2485
|
-
for (let s = 0; s <
|
|
2486
|
-
const n =
|
|
2489
|
+
for (let s = 0; s < c.length; s++) {
|
|
2490
|
+
const n = c[s];
|
|
2487
2491
|
if (n === "(") i++;
|
|
2488
2492
|
else if (n === ")") i--;
|
|
2489
2493
|
else if (n === "," && i === 0) {
|
|
@@ -2493,16 +2497,16 @@ const ht = (h, t, e) => {
|
|
|
2493
2497
|
e += n;
|
|
2494
2498
|
}
|
|
2495
2499
|
return e.trim() && t.push(e.trim()), t;
|
|
2496
|
-
},
|
|
2497
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2500
|
+
}, ct = (c, t) => {
|
|
2501
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2498
2502
|
if (!i) return null;
|
|
2499
2503
|
const s = i.index + i[0].length;
|
|
2500
|
-
let n = 1,
|
|
2501
|
-
for (let
|
|
2502
|
-
|
|
2503
|
-
return n === 0 ?
|
|
2504
|
-
},
|
|
2505
|
-
const t =
|
|
2504
|
+
let n = 1, o = s;
|
|
2505
|
+
for (let a = s; a < c.length && n > 0; a++)
|
|
2506
|
+
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2507
|
+
return n === 0 ? c.substring(s, o) : null;
|
|
2508
|
+
}, Jt = (c) => {
|
|
2509
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2506
2510
|
return [
|
|
2507
2511
|
"circle",
|
|
2508
2512
|
"ellipse",
|
|
@@ -2513,44 +2517,44 @@ const ht = (h, t, e) => {
|
|
|
2513
2517
|
"at",
|
|
2514
2518
|
"contain",
|
|
2515
2519
|
"cover"
|
|
2516
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2517
|
-
},
|
|
2520
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || qt(t);
|
|
2521
|
+
}, ht = (c) => {
|
|
2518
2522
|
const t = [];
|
|
2519
|
-
return
|
|
2523
|
+
return c.forEach((e, i) => {
|
|
2520
2524
|
const s = e.trim();
|
|
2521
2525
|
if (!s) return;
|
|
2522
|
-
let n = "",
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
const l =
|
|
2526
|
-
l.position = Math.max(0, Math.min(100, Math.round(
|
|
2526
|
+
let n = "", o = 0;
|
|
2527
|
+
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2528
|
+
a && mt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2529
|
+
const l = ft(n);
|
|
2530
|
+
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2527
2531
|
}), t;
|
|
2528
|
-
},
|
|
2529
|
-
const t =
|
|
2532
|
+
}, $ = (c) => {
|
|
2533
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2530
2534
|
return {
|
|
2531
|
-
type:
|
|
2532
|
-
angle: typeof
|
|
2535
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2536
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2533
2537
|
stops: t.map((e, i) => ({
|
|
2534
2538
|
color: e.color || "#000000",
|
|
2535
2539
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2536
2540
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2537
2541
|
}))
|
|
2538
2542
|
};
|
|
2539
|
-
},
|
|
2540
|
-
const t =
|
|
2541
|
-
if (
|
|
2542
|
-
const s =
|
|
2543
|
-
return
|
|
2543
|
+
}, N = (c) => {
|
|
2544
|
+
const t = c.replace(/;$/, "").trim();
|
|
2545
|
+
if (_t(t)) {
|
|
2546
|
+
const s = ft(t);
|
|
2547
|
+
return $({ type: "solid", angle: 0, stops: [s] });
|
|
2544
2548
|
}
|
|
2545
|
-
const e =
|
|
2549
|
+
const e = ct(t, "linear-gradient");
|
|
2546
2550
|
if (e) {
|
|
2547
|
-
const s =
|
|
2548
|
-
let n = 90,
|
|
2549
|
-
const
|
|
2550
|
-
if (
|
|
2551
|
-
const r =
|
|
2552
|
-
r && (n = parseFloat(r[1]),
|
|
2553
|
-
} else
|
|
2551
|
+
const s = rt(e);
|
|
2552
|
+
let n = 90, o = s;
|
|
2553
|
+
const a = s[0];
|
|
2554
|
+
if (a.includes("deg")) {
|
|
2555
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2556
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2557
|
+
} else a.includes("to ") && (n = {
|
|
2554
2558
|
"to right": 90,
|
|
2555
2559
|
"to left": 270,
|
|
2556
2560
|
"to bottom": 180,
|
|
@@ -2559,31 +2563,31 @@ const ht = (h, t, e) => {
|
|
|
2559
2563
|
"to bottom left": 225,
|
|
2560
2564
|
"to top right": 45,
|
|
2561
2565
|
"to top left": 315
|
|
2562
|
-
}[
|
|
2563
|
-
const l =
|
|
2564
|
-
return l.length ?
|
|
2566
|
+
}[a] ?? 90, o = s.slice(1));
|
|
2567
|
+
const l = ht(o);
|
|
2568
|
+
return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
|
|
2565
2569
|
}
|
|
2566
|
-
const i =
|
|
2570
|
+
const i = ct(t, "radial-gradient");
|
|
2567
2571
|
if (i) {
|
|
2568
|
-
const s =
|
|
2569
|
-
return
|
|
2572
|
+
const s = rt(i), n = s[0] && !Jt(s[0]) ? s.slice(1) : s, o = ht(n);
|
|
2573
|
+
return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
|
|
2570
2574
|
}
|
|
2571
2575
|
return null;
|
|
2572
|
-
},
|
|
2573
|
-
if (
|
|
2574
|
-
const e =
|
|
2576
|
+
}, O = (c) => {
|
|
2577
|
+
if (c.type === "solid") {
|
|
2578
|
+
const e = c.stops[0], i = e.color;
|
|
2575
2579
|
if (i.startsWith("var(--"))
|
|
2576
2580
|
return i;
|
|
2577
|
-
const s = e.opacity ?? 100, n = i.replace("#", ""),
|
|
2578
|
-
return `#${n}${
|
|
2581
|
+
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2582
|
+
return `#${n}${o}`;
|
|
2579
2583
|
}
|
|
2580
|
-
const t =
|
|
2581
|
-
(e) => `${
|
|
2584
|
+
const t = c.stops.map(
|
|
2585
|
+
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2582
2586
|
).join(", ");
|
|
2583
|
-
return
|
|
2584
|
-
},
|
|
2585
|
-
if (
|
|
2586
|
-
const t =
|
|
2587
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
2588
|
+
}, Zt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), Z = (c) => {
|
|
2589
|
+
if (c.type === "solid") {
|
|
2590
|
+
const t = c.stops[0];
|
|
2587
2591
|
if (t) {
|
|
2588
2592
|
const e = t.color;
|
|
2589
2593
|
if (e.startsWith("var(--"))
|
|
@@ -2593,14 +2597,14 @@ const ht = (h, t, e) => {
|
|
|
2593
2597
|
if (i === 100)
|
|
2594
2598
|
return e;
|
|
2595
2599
|
{
|
|
2596
|
-
const s =
|
|
2600
|
+
const s = Zt(i);
|
|
2597
2601
|
return `${e}${s}`;
|
|
2598
2602
|
}
|
|
2599
2603
|
}
|
|
2600
2604
|
return "#000000";
|
|
2601
2605
|
}
|
|
2602
|
-
return
|
|
2603
|
-
},
|
|
2606
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
2607
|
+
}, z = class z {
|
|
2604
2608
|
static defaults() {
|
|
2605
2609
|
return {
|
|
2606
2610
|
solid: [],
|
|
@@ -2611,7 +2615,7 @@ const ht = (h, t, e) => {
|
|
|
2611
2615
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2612
2616
|
return t.forEach((s) => {
|
|
2613
2617
|
let n = W(s);
|
|
2614
|
-
n ||
|
|
2618
|
+
n || N(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2615
2619
|
}), i.slice(0, this.MAX_COLORS);
|
|
2616
2620
|
}
|
|
2617
2621
|
static ensureLoaded() {
|
|
@@ -2647,7 +2651,9 @@ const ht = (h, t, e) => {
|
|
|
2647
2651
|
}
|
|
2648
2652
|
static getColors(t) {
|
|
2649
2653
|
if (t === "all") {
|
|
2650
|
-
const e = this.list("solid"), i = this.list("gradient"), s = [
|
|
2654
|
+
const e = this.list("solid"), i = this.list("gradient"), s = [], n = Math.max(e.length, i.length);
|
|
2655
|
+
for (let o = 0; o < n; o++)
|
|
2656
|
+
o < e.length && s.push(e[o]), o < i.length && s.push(i[o]);
|
|
2651
2657
|
return this.normalizeList(s);
|
|
2652
2658
|
}
|
|
2653
2659
|
return [...this.list(t)];
|
|
@@ -2658,17 +2664,17 @@ const ht = (h, t, e) => {
|
|
|
2658
2664
|
if (i)
|
|
2659
2665
|
s = "solid";
|
|
2660
2666
|
else {
|
|
2661
|
-
const l =
|
|
2667
|
+
const l = N(t);
|
|
2662
2668
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2663
2669
|
}
|
|
2664
2670
|
if (!i) return;
|
|
2665
|
-
const n = e === "all" ? s : e,
|
|
2666
|
-
|
|
2671
|
+
const n = e === "all" ? s : e, o = this.list(n), a = o.indexOf(i);
|
|
2672
|
+
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2667
2673
|
}
|
|
2668
2674
|
};
|
|
2669
|
-
|
|
2670
|
-
let D =
|
|
2671
|
-
const
|
|
2675
|
+
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2676
|
+
let D = z;
|
|
2677
|
+
const ot = (c, t) => {
|
|
2672
2678
|
const e = document.createElement("div");
|
|
2673
2679
|
e.className = "color-picker-recent-section";
|
|
2674
2680
|
const i = document.createElement("div");
|
|
@@ -2677,25 +2683,31 @@ const it = (h, t) => {
|
|
|
2677
2683
|
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2678
2684
|
const n = () => {
|
|
2679
2685
|
s.style.display = "none";
|
|
2680
|
-
},
|
|
2686
|
+
}, o = (p, h) => {
|
|
2681
2687
|
const d = p.getBoundingClientRect();
|
|
2682
|
-
s.textContent =
|
|
2683
|
-
},
|
|
2684
|
-
|
|
2688
|
+
s.textContent = h, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
2689
|
+
}, a = document.createElement("div");
|
|
2690
|
+
a.className = "color-picker-recent-grid";
|
|
2685
2691
|
const l = document.createElement("div");
|
|
2686
|
-
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(
|
|
2692
|
+
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
2687
2693
|
const r = () => {
|
|
2688
|
-
n(),
|
|
2694
|
+
n(), a.innerHTML = "";
|
|
2689
2695
|
const p = D.getColors(t);
|
|
2690
2696
|
if (p.length === 0) {
|
|
2691
|
-
|
|
2697
|
+
a.style.display = "none", l.style.display = "block";
|
|
2692
2698
|
return;
|
|
2693
2699
|
}
|
|
2694
|
-
|
|
2700
|
+
a.style.display = "grid", l.style.display = "none", p.forEach((h) => {
|
|
2695
2701
|
const d = document.createElement("button");
|
|
2696
2702
|
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
2697
|
-
const u =
|
|
2698
|
-
d.title = u, d.setAttribute("aria-label", `Use color: ${u}`),
|
|
2703
|
+
const u = Xt(h);
|
|
2704
|
+
if (d.title = u, d.setAttribute("aria-label", `Use color: ${u}`), h.includes("gradient(")) {
|
|
2705
|
+
d.style.backgroundImage = h, d.style.backgroundColor = "transparent";
|
|
2706
|
+
const m = N(h);
|
|
2707
|
+
m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
|
|
2708
|
+
} else
|
|
2709
|
+
d.style.backgroundColor = h, d.style.borderColor = h;
|
|
2710
|
+
d.addEventListener("mouseenter", () => o(d, u)), d.addEventListener("mouseleave", () => {
|
|
2699
2711
|
n(), d.style.boxShadow = "";
|
|
2700
2712
|
}), d.addEventListener("mousedown", () => {
|
|
2701
2713
|
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
@@ -2704,47 +2716,47 @@ const it = (h, t) => {
|
|
|
2704
2716
|
d.style.boxShadow = "";
|
|
2705
2717
|
}, 150);
|
|
2706
2718
|
}), d.addEventListener("click", () => {
|
|
2707
|
-
n(), h
|
|
2708
|
-
}),
|
|
2719
|
+
n(), c(h);
|
|
2720
|
+
}), a.appendChild(d);
|
|
2709
2721
|
});
|
|
2710
2722
|
};
|
|
2711
2723
|
return r(), { container: e, refresh: r };
|
|
2712
|
-
},
|
|
2713
|
-
const t =
|
|
2724
|
+
}, Xt = (c) => {
|
|
2725
|
+
const t = N(c);
|
|
2714
2726
|
if (t)
|
|
2715
|
-
return
|
|
2716
|
-
const e = W(
|
|
2727
|
+
return Z(t);
|
|
2728
|
+
const e = W(c);
|
|
2717
2729
|
if (e) {
|
|
2718
|
-
const i =
|
|
2730
|
+
const i = V(e);
|
|
2719
2731
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2720
2732
|
}
|
|
2721
|
-
return
|
|
2722
|
-
},
|
|
2733
|
+
return c;
|
|
2734
|
+
}, vt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2723
2735
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2724
2736
|
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"
|
|
2725
2737
|
fill="#919EAB"/>
|
|
2726
|
-
</svg>`,
|
|
2738
|
+
</svg>`, Ct = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2727
2739
|
<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"/>
|
|
2728
|
-
</svg>`,
|
|
2740
|
+
</svg>`, Kt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2729
2741
|
<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"/>
|
|
2730
|
-
</svg>`,
|
|
2742
|
+
</svg>`, Yt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2731
2743
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2732
|
-
</svg>`,
|
|
2744
|
+
</svg>`, Qt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2733
2745
|
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2734
2746
|
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2735
2747
|
</svg>
|
|
2736
2748
|
|
|
2737
|
-
`,
|
|
2749
|
+
`, te = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2738
2750
|
<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"/>
|
|
2739
2751
|
<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"/>
|
|
2740
2752
|
</svg>
|
|
2741
2753
|
|
|
2742
|
-
`,
|
|
2754
|
+
`, ee = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2743
2755
|
<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"/>
|
|
2744
2756
|
<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"/>
|
|
2745
2757
|
</svg>
|
|
2746
2758
|
`;
|
|
2747
|
-
class
|
|
2759
|
+
class dt {
|
|
2748
2760
|
constructor(t, e = "gradient") {
|
|
2749
2761
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2750
2762
|
if (!this.isOpen) return;
|
|
@@ -2760,8 +2772,8 @@ class Yt {
|
|
|
2760
2772
|
if (Array.from(n).some(
|
|
2761
2773
|
(l) => l.contains(s)
|
|
2762
2774
|
)) return;
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2775
|
+
const a = document.querySelector(".gradient-popover");
|
|
2776
|
+
a && a.contains(s) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2765
2777
|
}, this.keyDown = (i) => {
|
|
2766
2778
|
if (this.isOpen) {
|
|
2767
2779
|
if (i.key === "Escape")
|
|
@@ -2786,107 +2798,105 @@ class Yt {
|
|
|
2786
2798
|
const i = document.createElement("span");
|
|
2787
2799
|
i.textContent = "Color";
|
|
2788
2800
|
const s = document.createElement("button");
|
|
2789
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2801
|
+
s.className = "color-picker-close", s.innerHTML = vt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ut(e, t);
|
|
2790
2802
|
const n = document.createElement("div");
|
|
2791
2803
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2792
|
-
const a = document.createElement("div");
|
|
2793
|
-
a.className = "color-picker-marker", this.colorMarker = a, n.appendChild(a);
|
|
2794
2804
|
const o = document.createElement("div");
|
|
2795
|
-
o.className = "color-picker-
|
|
2805
|
+
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
2806
|
+
const a = document.createElement("div");
|
|
2807
|
+
a.className = "color-picker-sliders-container";
|
|
2796
2808
|
const l = document.createElement("button");
|
|
2797
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2809
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Ct;
|
|
2798
2810
|
const r = document.createElement("div");
|
|
2799
2811
|
r.className = "color-picker-sliders-group";
|
|
2800
2812
|
const p = document.createElement("div");
|
|
2801
2813
|
p.className = "color-picker-hue", this.hueSlider = p;
|
|
2802
|
-
const
|
|
2803
|
-
|
|
2814
|
+
const h = document.createElement("div");
|
|
2815
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, p.appendChild(h);
|
|
2804
2816
|
const d = document.createElement("div");
|
|
2805
2817
|
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2806
2818
|
const u = document.createElement("div");
|
|
2807
|
-
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d),
|
|
2808
|
-
const g =
|
|
2809
|
-
var
|
|
2810
|
-
this.setColor(b), (
|
|
2819
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d), a.appendChild(l), a.appendChild(r);
|
|
2820
|
+
const g = ot((b) => {
|
|
2821
|
+
var E;
|
|
2822
|
+
this.setColor(b), (E = this.onChange) == null || E.call(this, b, this.currentOpacity);
|
|
2811
2823
|
}, this.recentScope);
|
|
2812
2824
|
this.recentSectionRefresh = g.refresh;
|
|
2813
|
-
const
|
|
2814
|
-
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2825
|
+
const m = document.createElement("div");
|
|
2826
|
+
m.className = "color-picker-format-section";
|
|
2827
|
+
const f = document.createElement("select");
|
|
2828
|
+
f.className = "color-picker-format-select", this.select = f;
|
|
2817
2829
|
const v = document.createElement("option");
|
|
2818
2830
|
v.value = "hex", v.textContent = "HEX";
|
|
2819
2831
|
const C = document.createElement("option");
|
|
2820
2832
|
C.value = "rgb", C.textContent = "RGB";
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2823
|
-
const
|
|
2824
|
-
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2827
|
-
const
|
|
2828
|
-
return
|
|
2833
|
+
const y = document.createElement("option");
|
|
2834
|
+
y.value = "hsl", y.textContent = "HSL", f.appendChild(v), f.appendChild(C), f.appendChild(y);
|
|
2835
|
+
const w = document.createElement("input");
|
|
2836
|
+
w.type = "text", w.className = "color-picker-color-input", w.value = this.currentColor, this.input = w;
|
|
2837
|
+
const k = document.createElement("div");
|
|
2838
|
+
k.className = "color-picker-input-container";
|
|
2839
|
+
const S = document.createElement("button");
|
|
2840
|
+
return S.className = "color-picker-copy-inside", S.textContent = "Copy", k.appendChild(w), k.appendChild(S), m.appendChild(f), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(g.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, w, f, S, l), t;
|
|
2829
2841
|
}
|
|
2830
2842
|
createBackdrop() {
|
|
2831
2843
|
const t = document.createElement("div");
|
|
2832
|
-
return t.className = "color-picker-backdrop", t.style.display = "none", t.
|
|
2833
|
-
e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
2834
|
-
}), t;
|
|
2844
|
+
return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
|
|
2835
2845
|
}
|
|
2836
|
-
bind(t, e, i, s, n,
|
|
2837
|
-
const l = (
|
|
2846
|
+
bind(t, e, i, s, n, o, a) {
|
|
2847
|
+
const l = (h) => {
|
|
2838
2848
|
var C;
|
|
2839
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2849
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
2840
2850
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2841
|
-
const
|
|
2851
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
|
|
2842
2852
|
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
2843
|
-
}, r = (
|
|
2853
|
+
}, r = (h) => {
|
|
2844
2854
|
var C;
|
|
2845
2855
|
const d = e.getBoundingClientRect();
|
|
2846
|
-
let u = Math.max(0, Math.min(1, (
|
|
2856
|
+
let u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2847
2857
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2848
|
-
const g = u * 360,
|
|
2858
|
+
const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
|
|
2849
2859
|
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
2850
|
-
}, p = (
|
|
2860
|
+
}, p = (h) => {
|
|
2851
2861
|
var g;
|
|
2852
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2862
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2853
2863
|
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
|
|
2854
2864
|
};
|
|
2855
|
-
t.addEventListener("mousedown", (
|
|
2856
|
-
|
|
2865
|
+
t.addEventListener("mousedown", (h) => {
|
|
2866
|
+
h.preventDefault(), l(h);
|
|
2857
2867
|
const d = (g) => l(g), u = () => {
|
|
2858
2868
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2859
2869
|
};
|
|
2860
2870
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2861
|
-
}), e.addEventListener("mousedown", (
|
|
2862
|
-
|
|
2871
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
2872
|
+
h.preventDefault(), r(h);
|
|
2863
2873
|
const d = (g) => r(g), u = () => {
|
|
2864
2874
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2865
2875
|
};
|
|
2866
2876
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2867
|
-
}), i.addEventListener("mousedown", (
|
|
2868
|
-
|
|
2877
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
2878
|
+
h.preventDefault(), p(h);
|
|
2869
2879
|
const d = (g) => p(g), u = () => {
|
|
2870
2880
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2871
2881
|
};
|
|
2872
2882
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2873
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2874
|
-
|
|
2875
|
-
}),
|
|
2883
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
|
|
2884
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
2885
|
+
}), o.addEventListener("click", async () => {
|
|
2876
2886
|
try {
|
|
2877
2887
|
await navigator.clipboard.writeText(s.value);
|
|
2878
2888
|
} catch {
|
|
2879
2889
|
s.select(), document.execCommand("copy");
|
|
2880
2890
|
}
|
|
2881
|
-
}),
|
|
2882
|
-
var
|
|
2891
|
+
}), a.addEventListener("click", async () => {
|
|
2892
|
+
var h;
|
|
2883
2893
|
if (!("EyeDropper" in window)) {
|
|
2884
2894
|
alert("EyeDropper API is not supported in this browser.");
|
|
2885
2895
|
return;
|
|
2886
2896
|
}
|
|
2887
2897
|
try {
|
|
2888
2898
|
const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
|
|
2889
|
-
this.setColor(u), (
|
|
2899
|
+
this.setColor(u), (h = this.onChange) == null || h.call(this, u, this.currentOpacity);
|
|
2890
2900
|
} catch {
|
|
2891
2901
|
}
|
|
2892
2902
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2895,22 +2905,22 @@ class Yt {
|
|
|
2895
2905
|
);
|
|
2896
2906
|
}
|
|
2897
2907
|
setColor(t) {
|
|
2898
|
-
var
|
|
2908
|
+
var o;
|
|
2899
2909
|
this.currentColor = t;
|
|
2900
|
-
const { h: e, s: i, v: s } =
|
|
2901
|
-
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(), (
|
|
2910
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
2911
|
+
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(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2902
2912
|
}
|
|
2903
2913
|
syncInput() {
|
|
2904
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2914
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
2905
2915
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2906
2916
|
else if (t === "rgb") {
|
|
2907
|
-
const { r: n, g:
|
|
2908
|
-
this.input.value = `rgb(${n}, ${
|
|
2917
|
+
const { r: n, g: o, b: a } = V(this.currentColor);
|
|
2918
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2909
2919
|
} else {
|
|
2910
|
-
const { hue: n, sat:
|
|
2920
|
+
const { hue: n, sat: o, lightness: a } = gt(e, i, s);
|
|
2911
2921
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2912
|
-
|
|
2913
|
-
)}%, ${Math.round(
|
|
2922
|
+
o * 100
|
|
2923
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
2914
2924
|
}
|
|
2915
2925
|
}
|
|
2916
2926
|
applyFromInput() {
|
|
@@ -2920,36 +2930,36 @@ class Yt {
|
|
|
2920
2930
|
else {
|
|
2921
2931
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2922
2932
|
if (i) {
|
|
2923
|
-
const s = parseInt(i[1]), n = parseInt(i[2]),
|
|
2924
|
-
s <= 255 && n <= 255 &&
|
|
2933
|
+
const s = parseInt(i[1]), n = parseInt(i[2]), o = parseInt(i[3]);
|
|
2934
|
+
s <= 255 && n <= 255 && o <= 255 && (e = `#${[s, n, o].map((a) => a.toString(16).padStart(2, "0")).join("")}`);
|
|
2925
2935
|
} else {
|
|
2926
2936
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2927
2937
|
if (s) {
|
|
2928
|
-
const n = parseInt(s[1]),
|
|
2929
|
-
e =
|
|
2938
|
+
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
2939
|
+
e = U(n, r, l);
|
|
2930
2940
|
}
|
|
2931
2941
|
}
|
|
2932
2942
|
}
|
|
2933
2943
|
e && this.setColor(e);
|
|
2934
2944
|
}
|
|
2935
2945
|
updateOpacityBg() {
|
|
2936
|
-
const { r: t, g: e, b: i } =
|
|
2946
|
+
const { r: t, g: e, b: i } = V(this.currentColor);
|
|
2937
2947
|
this.opacitySlider.style.setProperty(
|
|
2938
2948
|
"--base-color",
|
|
2939
2949
|
`rgb(${t}, ${e}, ${i})`
|
|
2940
2950
|
);
|
|
2941
2951
|
}
|
|
2942
2952
|
open(t, e, i) {
|
|
2943
|
-
var
|
|
2953
|
+
var y;
|
|
2944
2954
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2945
|
-
const { h: s, s: n, v:
|
|
2946
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 -
|
|
2947
|
-
const
|
|
2955
|
+
const { h: s, s: n, v: o } = R(t);
|
|
2956
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 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);
|
|
2957
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, h = window.innerHeight, d = 16;
|
|
2948
2958
|
let u = r.right + 8, g = r.top;
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2951
|
-
const v =
|
|
2952
|
-
v >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : v > C ? (g = r.bottom + 8, g + l >
|
|
2959
|
+
const m = p - r.right, f = r.left;
|
|
2960
|
+
m >= a + d ? u = r.right + 8 : f >= a + d ? u = r.left - a - 8 : u = Math.max(d, (p - a) / 2);
|
|
2961
|
+
const v = h - r.bottom, C = r.top;
|
|
2962
|
+
v >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : v > C ? (g = r.bottom + 8, g + l > h - d && (g = h - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2953
2963
|
}
|
|
2954
2964
|
close(t) {
|
|
2955
2965
|
var e;
|
|
@@ -2959,7 +2969,7 @@ class Yt {
|
|
|
2959
2969
|
return this.element;
|
|
2960
2970
|
}
|
|
2961
2971
|
}
|
|
2962
|
-
class
|
|
2972
|
+
class ie {
|
|
2963
2973
|
constructor(t) {
|
|
2964
2974
|
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);
|
|
2965
2975
|
}
|
|
@@ -2977,69 +2987,69 @@ class Qt {
|
|
|
2977
2987
|
const s = document.createElement("div");
|
|
2978
2988
|
s.className = "color-picker-sliders-container embedded";
|
|
2979
2989
|
const n = document.createElement("button");
|
|
2980
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
2981
|
-
const a = document.createElement("div");
|
|
2982
|
-
a.className = "color-picker-sliders-group";
|
|
2990
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Ct;
|
|
2983
2991
|
const o = document.createElement("div");
|
|
2984
|
-
o.className = "color-picker-
|
|
2992
|
+
o.className = "color-picker-sliders-group";
|
|
2993
|
+
const a = document.createElement("div");
|
|
2994
|
+
a.className = "color-picker-hue embedded", this.hueSlider = a;
|
|
2985
2995
|
const l = document.createElement("div");
|
|
2986
|
-
l.className = "color-picker-hue-marker", this.hueMarker = l,
|
|
2996
|
+
l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
|
|
2987
2997
|
const r = document.createElement("div");
|
|
2988
2998
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
2989
2999
|
const p = document.createElement("div");
|
|
2990
|
-
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p),
|
|
2991
|
-
const
|
|
2992
|
-
const
|
|
2993
|
-
|
|
3000
|
+
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
3001
|
+
const h = ot((w) => {
|
|
3002
|
+
const k = N(w);
|
|
3003
|
+
k && k.type !== "solid" ? this.onColorChange(w, this.currentOpacity) : (this.setColor(w), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
2994
3004
|
}, "all");
|
|
2995
|
-
this.recentSectionRefresh =
|
|
3005
|
+
this.recentSectionRefresh = h.refresh;
|
|
2996
3006
|
const d = document.createElement("div");
|
|
2997
3007
|
d.className = "color-picker-format-section embedded";
|
|
2998
3008
|
const u = document.createElement("select");
|
|
2999
3009
|
u.className = "color-picker-format-select", this.select = u;
|
|
3000
3010
|
const g = document.createElement("option");
|
|
3001
3011
|
g.value = "hex", g.textContent = "HEX";
|
|
3002
|
-
const f = document.createElement("option");
|
|
3003
|
-
f.value = "rgb", f.textContent = "RGB";
|
|
3004
3012
|
const m = document.createElement("option");
|
|
3005
|
-
m.value = "
|
|
3013
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
3014
|
+
const f = document.createElement("option");
|
|
3015
|
+
f.value = "hsl", f.textContent = "HSL", u.appendChild(g), u.appendChild(m), u.appendChild(f);
|
|
3006
3016
|
const v = document.createElement("input");
|
|
3007
3017
|
v.type = "text", v.className = "color-picker-color-input", this.input = v;
|
|
3008
3018
|
const C = document.createElement("div");
|
|
3009
3019
|
C.className = "color-picker-input-container";
|
|
3010
|
-
const
|
|
3011
|
-
return
|
|
3020
|
+
const y = document.createElement("button");
|
|
3021
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(h.container), this.bind(e, a, r, v, u, y, n), t;
|
|
3012
3022
|
}
|
|
3013
|
-
bind(t, e, i, s, n,
|
|
3014
|
-
const l = (
|
|
3015
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3023
|
+
bind(t, e, i, s, n, o, a) {
|
|
3024
|
+
const l = (h) => {
|
|
3025
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
3016
3026
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
3017
|
-
const
|
|
3027
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
|
|
3018
3028
|
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3019
|
-
}, r = (
|
|
3020
|
-
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3029
|
+
}, r = (h) => {
|
|
3030
|
+
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3021
3031
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
3022
|
-
const g = u * 360,
|
|
3032
|
+
const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
|
|
3023
3033
|
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3024
3034
|
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3025
|
-
}, p = (
|
|
3026
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3035
|
+
}, p = (h) => {
|
|
3036
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3027
3037
|
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), this.queueChange();
|
|
3028
3038
|
};
|
|
3029
|
-
t.addEventListener("mousedown", (
|
|
3030
|
-
|
|
3039
|
+
t.addEventListener("mousedown", (h) => {
|
|
3040
|
+
h.preventDefault(), this.isDragging = !0, l(h);
|
|
3031
3041
|
const d = (g) => l(g), u = () => {
|
|
3032
3042
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3033
3043
|
};
|
|
3034
3044
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3035
|
-
}), e.addEventListener("mousedown", (
|
|
3036
|
-
|
|
3045
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
3046
|
+
h.preventDefault(), this.isDragging = !0, r(h);
|
|
3037
3047
|
const d = (g) => r(g), u = () => {
|
|
3038
3048
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3039
3049
|
};
|
|
3040
3050
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3041
|
-
}), i.addEventListener("mousedown", (
|
|
3042
|
-
|
|
3051
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
3052
|
+
h.preventDefault(), this.isDragging = !0, p(h);
|
|
3043
3053
|
const d = (g) => p(g), u = () => {
|
|
3044
3054
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3045
3055
|
};
|
|
@@ -3050,21 +3060,21 @@ class Qt {
|
|
|
3050
3060
|
this.applyFromInput();
|
|
3051
3061
|
}), s.addEventListener("blur", () => {
|
|
3052
3062
|
this.syncInput();
|
|
3053
|
-
}), s.addEventListener("keydown", (
|
|
3054
|
-
|
|
3055
|
-
}),
|
|
3063
|
+
}), s.addEventListener("keydown", (h) => {
|
|
3064
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
3065
|
+
}), o.addEventListener("click", async () => {
|
|
3056
3066
|
try {
|
|
3057
3067
|
await navigator.clipboard.writeText(s.value);
|
|
3058
3068
|
} catch {
|
|
3059
3069
|
s.select(), document.execCommand("copy");
|
|
3060
3070
|
}
|
|
3061
|
-
}),
|
|
3071
|
+
}), a.addEventListener("click", async () => {
|
|
3062
3072
|
if (!("EyeDropper" in window)) {
|
|
3063
3073
|
alert("EyeDropper API is not supported in this browser.");
|
|
3064
3074
|
return;
|
|
3065
3075
|
}
|
|
3066
3076
|
try {
|
|
3067
|
-
const
|
|
3077
|
+
const h = new window.EyeDropper(), { sRGBHex: d } = await h.open();
|
|
3068
3078
|
this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3069
3079
|
} catch {
|
|
3070
3080
|
}
|
|
@@ -3072,22 +3082,22 @@ class Qt {
|
|
|
3072
3082
|
}
|
|
3073
3083
|
setColor(t) {
|
|
3074
3084
|
this.currentColor = t;
|
|
3075
|
-
const { h: e, s: i, v: s } =
|
|
3085
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
3076
3086
|
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),
|
|
3077
3087
|
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3078
3088
|
}
|
|
3079
3089
|
syncInput() {
|
|
3080
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
3090
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
3081
3091
|
if (t === "hex")
|
|
3082
3092
|
this.input.value = this.currentColor;
|
|
3083
3093
|
else if (t === "rgb") {
|
|
3084
|
-
const { r: n, g:
|
|
3085
|
-
this.input.value = `rgb(${n}, ${
|
|
3094
|
+
const { r: n, g: o, b: a } = V(this.currentColor);
|
|
3095
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
3086
3096
|
} else {
|
|
3087
|
-
const { hue: n, sat:
|
|
3097
|
+
const { hue: n, sat: o, lightness: a } = gt(e, i, s);
|
|
3088
3098
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3089
|
-
|
|
3090
|
-
)}%, ${Math.round(
|
|
3099
|
+
o * 100
|
|
3100
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
3091
3101
|
}
|
|
3092
3102
|
}
|
|
3093
3103
|
applyFromInput() {
|
|
@@ -3098,20 +3108,20 @@ class Qt {
|
|
|
3098
3108
|
else {
|
|
3099
3109
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3100
3110
|
if (i) {
|
|
3101
|
-
const s = parseInt(i[1], 10), n = parseInt(i[2], 10),
|
|
3102
|
-
s <= 255 && n <= 255 &&
|
|
3111
|
+
const s = parseInt(i[1], 10), n = parseInt(i[2], 10), o = parseInt(i[3], 10);
|
|
3112
|
+
s <= 255 && n <= 255 && o <= 255 && (e = "#" + [s, n, o].map((a) => a.toString(16).padStart(2, "0")).join(""));
|
|
3103
3113
|
} else {
|
|
3104
3114
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3105
3115
|
if (s) {
|
|
3106
|
-
const n = parseInt(s[1], 10),
|
|
3107
|
-
e =
|
|
3116
|
+
const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
3117
|
+
e = U(n, r, l);
|
|
3108
3118
|
}
|
|
3109
3119
|
}
|
|
3110
3120
|
}
|
|
3111
3121
|
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3112
3122
|
}
|
|
3113
3123
|
updateOpacityBg() {
|
|
3114
|
-
const { r: t, g: e, b: i } =
|
|
3124
|
+
const { r: t, g: e, b: i } = V(this.currentColor);
|
|
3115
3125
|
this.opacitySlider.style.setProperty(
|
|
3116
3126
|
"--base-color",
|
|
3117
3127
|
`rgb(${t}, ${e}, ${i})`
|
|
@@ -3131,11 +3141,11 @@ class Qt {
|
|
|
3131
3141
|
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
3132
3142
|
}
|
|
3133
3143
|
initFromColor(t, e) {
|
|
3134
|
-
var
|
|
3144
|
+
var a;
|
|
3135
3145
|
this.currentColor = t, this.currentOpacity = e;
|
|
3136
|
-
const { h: i, s, v: n } =
|
|
3137
|
-
this.hueMarker.style.left = `${
|
|
3138
|
-
linear-gradient(to right, #fff, hsl(${
|
|
3146
|
+
const { h: i, s, v: n } = R(t), o = i >= 360 ? i % 360 : i;
|
|
3147
|
+
this.hueMarker.style.left = `${o / 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),
|
|
3148
|
+
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (a = this.recentSectionRefresh) == null || a.call(this);
|
|
3139
3149
|
}
|
|
3140
3150
|
commitRecentColor() {
|
|
3141
3151
|
var t;
|
|
@@ -3152,7 +3162,7 @@ class Qt {
|
|
|
3152
3162
|
this.initFromColor(t, e);
|
|
3153
3163
|
}
|
|
3154
3164
|
}
|
|
3155
|
-
const
|
|
3165
|
+
const H = class H extends x {
|
|
3156
3166
|
constructor(t = {}) {
|
|
3157
3167
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3158
3168
|
super({
|
|
@@ -3163,17 +3173,17 @@ const P = class P extends x {
|
|
|
3163
3173
|
type: "text",
|
|
3164
3174
|
angle: "number",
|
|
3165
3175
|
stops: "text"
|
|
3166
|
-
}, 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) => {
|
|
3176
|
+
}, 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) => {
|
|
3167
3177
|
var d;
|
|
3168
3178
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3169
|
-
const s = i.target, n = this.popoverEl.contains(s),
|
|
3179
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((u) => u.contains(s)), r = s.closest(
|
|
3170
3180
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3171
3181
|
), p = s.classList.contains(
|
|
3172
3182
|
"color-picker-backdrop"
|
|
3173
|
-
),
|
|
3183
|
+
), h = s.classList.contains(
|
|
3174
3184
|
"gradient-popover-backdrop"
|
|
3175
3185
|
);
|
|
3176
|
-
!n && !
|
|
3186
|
+
!n && !o && !l && !r && !p && !h && this.closePopover();
|
|
3177
3187
|
}, this.handlePopoverKeydown = (i) => {
|
|
3178
3188
|
if (this.isPopoverOpen) {
|
|
3179
3189
|
if (i.key === "Escape") {
|
|
@@ -3187,7 +3197,7 @@ const P = class P extends x {
|
|
|
3187
3197
|
i.preventDefault(), this.closePopover();
|
|
3188
3198
|
}
|
|
3189
3199
|
}
|
|
3190
|
-
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3200
|
+
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue(), this.setLinkedGlobalVariableFrom(this.originalDefault ?? this.value);
|
|
3191
3201
|
}
|
|
3192
3202
|
resolveGlobalVarColor(t) {
|
|
3193
3203
|
if (t.startsWith("var(--")) {
|
|
@@ -3196,33 +3206,46 @@ const P = class P extends x {
|
|
|
3196
3206
|
}
|
|
3197
3207
|
return t;
|
|
3198
3208
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
if (!e.startsWith("var(--"))
|
|
3204
|
-
return;
|
|
3205
|
-
const i = this.resolveGlobalVarColor(e);
|
|
3206
|
-
if (i === e) {
|
|
3207
|
-
console.warn(`Could not resolve global variable: ${e}`);
|
|
3209
|
+
setLinkedGlobalVariableFrom(t) {
|
|
3210
|
+
var i, s;
|
|
3211
|
+
if (!t) {
|
|
3212
|
+
this.linkedGlobalVariable = null;
|
|
3208
3213
|
return;
|
|
3209
3214
|
}
|
|
3210
|
-
|
|
3215
|
+
const e = typeof t == "string" ? t : ((s = (i = t.stops) == null ? void 0 : i[0]) == null ? void 0 : s.color) ?? null;
|
|
3216
|
+
this.linkedGlobalVariable = e && e.startsWith("var(--") ? e : null;
|
|
3217
|
+
}
|
|
3218
|
+
isBoundToGlobal() {
|
|
3219
|
+
return !!this.linkedGlobalVariable;
|
|
3220
|
+
}
|
|
3221
|
+
clearGlobalBindingForCustomChange() {
|
|
3222
|
+
var t, e;
|
|
3223
|
+
this.isBoundToGlobal() && ((e = (t = this.value) == null ? void 0 : t.stops) != null && e.length && (this.value.stops = this.value.stops.map((i) => ({
|
|
3224
|
+
...i,
|
|
3225
|
+
color: this.resolveGlobalVarColor(i.color)
|
|
3226
|
+
}))), this.linkedGlobalVariable = null, this.updateUnlinkButtonVisibility());
|
|
3227
|
+
}
|
|
3228
|
+
breakGlobalBinding() {
|
|
3229
|
+
var t;
|
|
3230
|
+
!this.isBoundToGlobal() || !this.value || ((t = this.value.stops) != null && t.length && (this.value.stops = this.value.stops.map((e) => ({
|
|
3231
|
+
...e,
|
|
3232
|
+
color: this.resolveGlobalVarColor(e.color)
|
|
3233
|
+
}))), this.linkedGlobalVariable = null, this.updateUI(), this.triggerChange(), this.isPopoverOpen && this.refreshPopoverContent());
|
|
3211
3234
|
}
|
|
3212
3235
|
defaultValue() {
|
|
3213
3236
|
const t = this.originalDefault;
|
|
3214
3237
|
if (typeof t == "string") {
|
|
3215
3238
|
if (t.startsWith("var(--"))
|
|
3216
|
-
return
|
|
3239
|
+
return $({
|
|
3217
3240
|
type: "solid",
|
|
3218
3241
|
angle: 0,
|
|
3219
3242
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3220
3243
|
});
|
|
3221
|
-
const i =
|
|
3244
|
+
const i = N(t);
|
|
3222
3245
|
if (i)
|
|
3223
|
-
return
|
|
3246
|
+
return $(i);
|
|
3224
3247
|
}
|
|
3225
|
-
return
|
|
3248
|
+
return $(t && typeof t == "object" ? t : {
|
|
3226
3249
|
type: "linear",
|
|
3227
3250
|
angle: 90,
|
|
3228
3251
|
stops: [
|
|
@@ -3232,24 +3255,29 @@ const P = class P extends x {
|
|
|
3232
3255
|
});
|
|
3233
3256
|
}
|
|
3234
3257
|
setValue(t) {
|
|
3235
|
-
var i, s;
|
|
3236
3258
|
let e = null;
|
|
3237
|
-
typeof t == "string" ? t.startsWith("var(--") ? e =
|
|
3259
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = $({
|
|
3238
3260
|
type: "solid",
|
|
3239
3261
|
angle: 0,
|
|
3240
3262
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3241
|
-
}) : e =
|
|
3263
|
+
}) : e = N(t) : t && typeof t == "object" && (e = $(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();
|
|
3242
3264
|
}
|
|
3243
3265
|
updateUI() {
|
|
3244
3266
|
if (this.previewEl && this.value)
|
|
3245
3267
|
if (this.value.type === "solid") {
|
|
3246
3268
|
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3247
|
-
this.previewEl.style.background =
|
|
3269
|
+
this.previewEl.style.background = st(i, e);
|
|
3248
3270
|
} else {
|
|
3249
3271
|
const t = this.resolveGradientGlobalVars(this.value);
|
|
3250
|
-
this.previewEl.style.background =
|
|
3272
|
+
this.previewEl.style.background = O(t);
|
|
3251
3273
|
}
|
|
3252
|
-
this.inputEl && this.value && !this.isEditing
|
|
3274
|
+
if (this.inputEl && this.value && !this.isEditing)
|
|
3275
|
+
if (this.isBoundToGlobal() && this.linkedGlobalVariable) {
|
|
3276
|
+
const e = this.linkedGlobalVariable.replace("var(--", "").replace(")", "").split("-").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
|
|
3277
|
+
this.inputEl.value = `Linked: ${e}`;
|
|
3278
|
+
} else
|
|
3279
|
+
this.inputEl.value = Z(this.value);
|
|
3280
|
+
this.updateUnlinkButtonVisibility();
|
|
3253
3281
|
}
|
|
3254
3282
|
resolveGradientGlobalVars(t) {
|
|
3255
3283
|
return {
|
|
@@ -3261,12 +3289,12 @@ const P = class P extends x {
|
|
|
3261
3289
|
};
|
|
3262
3290
|
}
|
|
3263
3291
|
updateUnlinkButtonVisibility() {
|
|
3264
|
-
if (!this.unlinkButton
|
|
3265
|
-
this.
|
|
3292
|
+
if (!this.unlinkButton) return;
|
|
3293
|
+
this.isBoundToGlobal() ? this.unlinkButton.classList.add("visible") : this.unlinkButton.classList.remove("visible");
|
|
3266
3294
|
}
|
|
3267
3295
|
cssForTextValue() {
|
|
3268
3296
|
return this.value ? {
|
|
3269
|
-
background:
|
|
3297
|
+
background: O(this.value),
|
|
3270
3298
|
"-webkit-background-clip": "text",
|
|
3271
3299
|
"background-clip": "text",
|
|
3272
3300
|
color: "transparent",
|
|
@@ -3282,9 +3310,9 @@ const P = class P extends x {
|
|
|
3282
3310
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3283
3311
|
}
|
|
3284
3312
|
const e = document.createElement("div");
|
|
3285
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3313
|
+
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) => {
|
|
3286
3314
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3287
|
-
}), 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 ?
|
|
3315
|
+
}), 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", () => {
|
|
3288
3316
|
if (this.isEditing = !0, this.value)
|
|
3289
3317
|
if (this.value.type === "solid") {
|
|
3290
3318
|
const i = this.value.stops[0];
|
|
@@ -3293,60 +3321,57 @@ const P = class P extends x {
|
|
|
3293
3321
|
if (n === 100)
|
|
3294
3322
|
this.inputEl.value = s;
|
|
3295
3323
|
else {
|
|
3296
|
-
const
|
|
3297
|
-
this.inputEl.value = `${s}${
|
|
3324
|
+
const a = Math.round(n / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3325
|
+
this.inputEl.value = `${s}${a}`;
|
|
3298
3326
|
}
|
|
3299
3327
|
}
|
|
3300
3328
|
} else
|
|
3301
|
-
this.inputEl.value =
|
|
3329
|
+
this.inputEl.value = O(this.value);
|
|
3302
3330
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3303
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3331
|
+
this.isEditing = !1, this.value && (this.inputEl.value = Z(this.value));
|
|
3304
3332
|
}), this.inputEl.addEventListener(
|
|
3305
3333
|
"paste",
|
|
3306
3334
|
(i) => this.handlePaste(i)
|
|
3307
3335
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3308
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3309
|
-
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML =
|
|
3336
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = O(this.value)), this.inputEl.blur());
|
|
3337
|
+
}), 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) => {
|
|
3310
3338
|
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3311
3339
|
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3312
3340
|
}
|
|
3313
3341
|
createPopover() {
|
|
3314
|
-
var l, r, p;
|
|
3315
3342
|
if (this.popoverEl) return;
|
|
3316
|
-
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (
|
|
3317
|
-
|
|
3318
|
-
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (c) => {
|
|
3319
|
-
c.stopPropagation();
|
|
3343
|
+
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) => {
|
|
3344
|
+
l.stopPropagation();
|
|
3320
3345
|
});
|
|
3321
3346
|
const t = document.createElement("div");
|
|
3322
3347
|
t.className = "gradient-popover-header", t.style.cursor = "move";
|
|
3323
3348
|
let e = null;
|
|
3324
3349
|
if (this.variant !== "global") {
|
|
3325
3350
|
e = document.createElement("div"), e.className = "color-setting-tabs header-tabs";
|
|
3326
|
-
const
|
|
3327
|
-
|
|
3328
|
-
const
|
|
3329
|
-
|
|
3351
|
+
const l = document.createElement("button");
|
|
3352
|
+
l.className = "color-tab active", l.textContent = "Custom";
|
|
3353
|
+
const r = document.createElement("button");
|
|
3354
|
+
r.className = "color-tab", r.textContent = "Global", e.appendChild(l), e.appendChild(r), t.appendChild(e);
|
|
3330
3355
|
} else {
|
|
3331
|
-
const
|
|
3332
|
-
t.appendChild(
|
|
3356
|
+
const l = document.createElement("div");
|
|
3357
|
+
t.appendChild(l);
|
|
3333
3358
|
}
|
|
3334
3359
|
const i = document.createElement("button");
|
|
3335
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3336
|
-
this.popoverPosition = { left:
|
|
3360
|
+
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) => {
|
|
3361
|
+
this.popoverPosition = { left: l, top: r };
|
|
3337
3362
|
});
|
|
3338
3363
|
const s = document.createElement("div");
|
|
3339
3364
|
s.className = "gradient-editor";
|
|
3340
3365
|
const n = document.createElement("div");
|
|
3341
3366
|
n.className = "type-tabs-wrapper";
|
|
3342
|
-
const
|
|
3343
|
-
n.appendChild(
|
|
3344
|
-
const
|
|
3345
|
-
if (
|
|
3346
|
-
const
|
|
3347
|
-
this.currentMode =
|
|
3367
|
+
const o = this.createTypeTabs();
|
|
3368
|
+
n.appendChild(o), s.appendChild(n);
|
|
3369
|
+
const a = document.createElement("div");
|
|
3370
|
+
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
3371
|
+
const l = e.children[0], r = e.children[1], p = (h) => {
|
|
3372
|
+
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(a);
|
|
3348
3373
|
};
|
|
3349
|
-
|
|
3374
|
+
l.addEventListener("click", () => p("custom")), r.addEventListener("click", () => p("global")), this.isBoundToGlobal() ? (this.currentMode = "global", p("global")) : (this.currentMode = "custom", p("custom"));
|
|
3350
3375
|
}
|
|
3351
3376
|
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3352
3377
|
}
|
|
@@ -3355,25 +3380,26 @@ const P = class P extends x {
|
|
|
3355
3380
|
const t = document.createElement("div");
|
|
3356
3381
|
t.className = "gradient-type-tabs";
|
|
3357
3382
|
const e = document.createElement("button");
|
|
3358
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML =
|
|
3383
|
+
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"));
|
|
3359
3384
|
const i = document.createElement("button");
|
|
3360
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML =
|
|
3361
|
-
var
|
|
3362
|
-
const
|
|
3363
|
-
this.switchType(
|
|
3385
|
+
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", () => {
|
|
3386
|
+
var a, l;
|
|
3387
|
+
const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3388
|
+
this.switchType(o);
|
|
3364
3389
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3365
3390
|
}
|
|
3366
3391
|
switchType(t) {
|
|
3367
|
-
var
|
|
3392
|
+
var n;
|
|
3368
3393
|
if (!this.value) return;
|
|
3369
|
-
|
|
3394
|
+
const e = this.isBoundToGlobal(), i = this.linkedGlobalVariable;
|
|
3395
|
+
if (this.value.type = t, t !== "solid" && (this.pendingSolidColor = null), t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3370
3396
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3371
3397
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3372
3398
|
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3373
|
-
const
|
|
3374
|
-
if (
|
|
3375
|
-
const
|
|
3376
|
-
|
|
3399
|
+
const a = this.value.stops[0].color;
|
|
3400
|
+
if (a.startsWith("var(--")) {
|
|
3401
|
+
const l = this.resolveGlobalVarColor(a), r = N(l);
|
|
3402
|
+
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({
|
|
3377
3403
|
color: "#786666",
|
|
3378
3404
|
position: 100,
|
|
3379
3405
|
opacity: 100
|
|
@@ -3384,15 +3410,22 @@ const P = class P extends x {
|
|
|
3384
3410
|
position: 100,
|
|
3385
3411
|
opacity: 100
|
|
3386
3412
|
}), this.value.angle = 90;
|
|
3387
|
-
} else t !== "solid" && this.value.stops.length >= 2
|
|
3413
|
+
} else if (t !== "solid" && this.value.stops.length >= 2)
|
|
3414
|
+
this.value.angle || (this.value.angle = 90);
|
|
3415
|
+
else if (t === "solid" && e && i) {
|
|
3416
|
+
const o = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
3417
|
+
this.value.stops = [
|
|
3418
|
+
{ color: i, position: 0, opacity: o }
|
|
3419
|
+
], this.value.angle = 0;
|
|
3420
|
+
}
|
|
3388
3421
|
if (this.popoverEl) {
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3391
|
-
const
|
|
3392
|
-
t === "solid" ?
|
|
3422
|
+
const o = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3423
|
+
o.forEach((r) => r.classList.remove("active"));
|
|
3424
|
+
const a = o[0], l = o[1];
|
|
3425
|
+
t === "solid" ? a == null || a.classList.add("active") : l == null || l.classList.add("active");
|
|
3393
3426
|
}
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3427
|
+
const s = (n = this.popoverEl) == null ? void 0 : n.querySelector(".gradient-editor-content");
|
|
3428
|
+
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
3396
3429
|
}
|
|
3397
3430
|
updatePopoverContent(t) {
|
|
3398
3431
|
if (t.innerHTML = "", !!this.value) {
|
|
@@ -3405,17 +3438,17 @@ const P = class P extends x {
|
|
|
3405
3438
|
}
|
|
3406
3439
|
renderGlobalColors(t) {
|
|
3407
3440
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3408
|
-
const e = this.value.stops[0], i = (
|
|
3409
|
-
|
|
3441
|
+
const e = this.value.stops[0], i = (h) => {
|
|
3442
|
+
h.innerHTML = "";
|
|
3410
3443
|
let d = {};
|
|
3411
3444
|
try {
|
|
3412
3445
|
d = x.GlobalVariables || {};
|
|
3413
|
-
} catch (
|
|
3414
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
3446
|
+
} catch (f) {
|
|
3447
|
+
console.warn("Could not access Setting.GlobalVariables", f);
|
|
3415
3448
|
}
|
|
3416
3449
|
if (!d || Object.keys(d).length === 0) {
|
|
3417
|
-
const
|
|
3418
|
-
|
|
3450
|
+
const f = document.createElement("div");
|
|
3451
|
+
f.textContent = "No global colors defined", f.style.fontSize = "12px", f.style.color = "#666", f.style.padding = "8px", h.appendChild(f);
|
|
3419
3452
|
return;
|
|
3420
3453
|
}
|
|
3421
3454
|
const u = [
|
|
@@ -3428,32 +3461,32 @@ const P = class P extends x {
|
|
|
3428
3461
|
keys: ["text-dark", "text-light"]
|
|
3429
3462
|
}
|
|
3430
3463
|
], g = this.globalSearchQuery.toLowerCase();
|
|
3431
|
-
let
|
|
3432
|
-
this.globalLayoutMode === "list" ? (
|
|
3433
|
-
const v = Object.entries(d).filter(([C]) => !
|
|
3434
|
-
v.length !== 0 && v.forEach(([C,
|
|
3464
|
+
let m;
|
|
3465
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), u.forEach((f) => {
|
|
3466
|
+
const v = Object.entries(d).filter(([C]) => !f.keys.includes(C) && f.title !== "Global Colors" ? !1 : f.keys.includes(C) && C.toLowerCase().includes(g));
|
|
3467
|
+
v.length !== 0 && v.forEach(([C, y]) => {
|
|
3435
3468
|
if (this.globalLayoutMode === "list") {
|
|
3436
|
-
const
|
|
3437
|
-
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
const
|
|
3446
|
-
this.setValue(
|
|
3447
|
-
}),
|
|
3469
|
+
const w = document.createElement("div");
|
|
3470
|
+
w.className = "global-color-row";
|
|
3471
|
+
const k = document.createElement("div");
|
|
3472
|
+
k.className = "global-color-circle";
|
|
3473
|
+
const S = this.resolveGlobalVarColor(y);
|
|
3474
|
+
k.style.background = S, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && k.classList.add("selected");
|
|
3475
|
+
const E = document.createElement("span");
|
|
3476
|
+
E.className = "global-color-label", E.textContent = C.split("-").map((M) => M.charAt(0).toUpperCase() + M.slice(1)).join(" "), w.appendChild(k), w.appendChild(E), w.addEventListener("click", (M) => {
|
|
3477
|
+
M.preventDefault();
|
|
3478
|
+
const B = `var(--${C})`;
|
|
3479
|
+
this.setValue(B), this.pendingSolidColor = B, i(h);
|
|
3480
|
+
}), m.appendChild(w);
|
|
3448
3481
|
} else {
|
|
3449
|
-
const
|
|
3450
|
-
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
const
|
|
3455
|
-
this.setValue(
|
|
3456
|
-
}),
|
|
3482
|
+
const w = document.createElement("div");
|
|
3483
|
+
w.className = "global-color-circle";
|
|
3484
|
+
const k = this.resolveGlobalVarColor(y);
|
|
3485
|
+
w.style.background = k, w.title = C.split("-").map((b) => b.charAt(0).toUpperCase() + b.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && w.classList.add("selected"), w.addEventListener("click", (b) => {
|
|
3486
|
+
b.preventDefault();
|
|
3487
|
+
const E = `var(--${C})`;
|
|
3488
|
+
this.setValue(E), this.pendingSolidColor = E, i(h);
|
|
3489
|
+
}), m.appendChild(w);
|
|
3457
3490
|
}
|
|
3458
3491
|
});
|
|
3459
3492
|
});
|
|
@@ -3461,14 +3494,14 @@ const P = class P extends x {
|
|
|
3461
3494
|
s.className = "global-controls-row";
|
|
3462
3495
|
const n = document.createElement("div");
|
|
3463
3496
|
n.className = "global-search-container";
|
|
3464
|
-
const
|
|
3465
|
-
|
|
3466
|
-
const
|
|
3467
|
-
|
|
3497
|
+
const o = document.createElement("span");
|
|
3498
|
+
o.className = "global-search-icon", o.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';
|
|
3499
|
+
const a = document.createElement("input");
|
|
3500
|
+
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
3468
3501
|
const l = document.createElement("div");
|
|
3469
|
-
|
|
3470
|
-
this.globalSearchQuery =
|
|
3471
|
-
}), n.appendChild(
|
|
3502
|
+
a.addEventListener("input", (h) => {
|
|
3503
|
+
this.globalSearchQuery = h.target.value, i(l);
|
|
3504
|
+
}), n.appendChild(o), n.appendChild(a);
|
|
3472
3505
|
const r = document.createElement("button");
|
|
3473
3506
|
r.className = "global-layout-toggle", r.type = "button";
|
|
3474
3507
|
const p = () => {
|
|
@@ -3480,14 +3513,14 @@ const P = class P extends x {
|
|
|
3480
3513
|
}
|
|
3481
3514
|
renderSolid(t) {
|
|
3482
3515
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3483
|
-
const e = this.value.stops[0], i = new
|
|
3516
|
+
const e = this.value.stops[0], i = new ie({
|
|
3484
3517
|
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3485
3518
|
initialOpacity: e.opacity ?? 100,
|
|
3486
3519
|
onColorChange: (s, n) => {
|
|
3487
|
-
if (this.value) {
|
|
3488
|
-
const
|
|
3489
|
-
if (
|
|
3490
|
-
this.value =
|
|
3520
|
+
if (this.clearGlobalBindingForCustomChange(), this.value) {
|
|
3521
|
+
const o = N(s);
|
|
3522
|
+
if (o && o.type !== "solid") {
|
|
3523
|
+
this.value = o, this.switchType(o.type);
|
|
3491
3524
|
return;
|
|
3492
3525
|
}
|
|
3493
3526
|
this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s;
|
|
@@ -3498,57 +3531,57 @@ const P = class P extends x {
|
|
|
3498
3531
|
}
|
|
3499
3532
|
renderGradient(t) {
|
|
3500
3533
|
this.solidPicker = null;
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
d
|
|
3534
|
+
let e = null;
|
|
3535
|
+
{
|
|
3536
|
+
const p = document.createElement("div");
|
|
3537
|
+
p.className = "gradient-subtype-inline";
|
|
3538
|
+
const h = document.createElement("select");
|
|
3539
|
+
h.className = "gradient-subtype-select";
|
|
3540
|
+
const d = document.createElement("option");
|
|
3541
|
+
d.value = "linear", d.textContent = "Linear";
|
|
3508
3542
|
const u = document.createElement("option");
|
|
3509
|
-
u.value = "
|
|
3510
|
-
const g = document.createElement("
|
|
3511
|
-
g.
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
var w;
|
|
3543
|
+
u.value = "radial", u.textContent = "Radial", h.appendChild(d), h.appendChild(u), 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°");
|
|
3544
|
+
const g = document.createElement("button");
|
|
3545
|
+
g.type = "button", g.className = "gradient-flip-btn", g.innerHTML = Kt, h.addEventListener("change", () => {
|
|
3546
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
|
|
3547
|
+
}), e.addEventListener("focus", (m) => {
|
|
3548
|
+
const f = m.target;
|
|
3549
|
+
f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
|
|
3550
|
+
}), e.addEventListener("input", (m) => {
|
|
3551
|
+
this.clearGlobalBindingForCustomChange();
|
|
3552
|
+
const f = parseInt(m.target.value);
|
|
3553
|
+
!Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
|
|
3554
|
+
}), e.addEventListener("blur", (m) => {
|
|
3555
|
+
var C;
|
|
3523
3556
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3524
|
-
const
|
|
3525
|
-
let
|
|
3526
|
-
Number.isNaN(
|
|
3527
|
-
}),
|
|
3528
|
-
!this.value || !this.value.stops
|
|
3557
|
+
const f = m.target;
|
|
3558
|
+
let v = parseInt(f.value);
|
|
3559
|
+
Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), f.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3560
|
+
}), g.addEventListener("click", () => {
|
|
3561
|
+
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
3529
3562
|
m.position = 100 - m.position;
|
|
3530
|
-
}), this.value.stops.sort((m,
|
|
3531
|
-
}),
|
|
3563
|
+
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
3564
|
+
}), p.appendChild(h), p.appendChild(e), p.appendChild(g), t.appendChild(p), this.updateDegreeVisibility(e);
|
|
3532
3565
|
}
|
|
3566
|
+
const i = document.createElement("div");
|
|
3567
|
+
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
3533
3568
|
const s = document.createElement("div");
|
|
3534
|
-
s.className = "gradient-
|
|
3569
|
+
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i);
|
|
3535
3570
|
const n = document.createElement("div");
|
|
3536
|
-
n.className = "gradient-
|
|
3537
|
-
const a = document.createElement("div");
|
|
3538
|
-
a.className = "gradient-stops-header";
|
|
3571
|
+
n.className = "gradient-stops-header";
|
|
3539
3572
|
const o = document.createElement("span");
|
|
3540
3573
|
o.textContent = "Stops";
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
const
|
|
3544
|
-
|
|
3545
|
-
const
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3574
|
+
const a = document.createElement("button");
|
|
3575
|
+
a.type = "button", a.className = "gradient-add-stop", a.textContent = "+", n.appendChild(o), n.appendChild(a);
|
|
3576
|
+
const l = document.createElement("div");
|
|
3577
|
+
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
3578
|
+
const r = ot((p) => {
|
|
3579
|
+
const h = N(p);
|
|
3580
|
+
h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type), this.updateUI(), this.triggerChange());
|
|
3548
3581
|
}, "all");
|
|
3549
|
-
this.recentGradientRefresh =
|
|
3550
|
-
var
|
|
3551
|
-
this.addStop(), this.updateStopsList(
|
|
3582
|
+
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
3583
|
+
var p;
|
|
3584
|
+
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();
|
|
3552
3585
|
});
|
|
3553
3586
|
}
|
|
3554
3587
|
updateDegreeVisibility(t) {
|
|
@@ -3558,7 +3591,15 @@ const P = class P extends x {
|
|
|
3558
3591
|
updateGradientPreview(t) {
|
|
3559
3592
|
var i;
|
|
3560
3593
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3561
|
-
|
|
3594
|
+
if (e && this.value)
|
|
3595
|
+
if (this.value.type === "solid")
|
|
3596
|
+
e.style.background = O(this.value);
|
|
3597
|
+
else {
|
|
3598
|
+
const s = this.value.stops.map(
|
|
3599
|
+
(n) => `${st(n.color, n.opacity ?? 100)} ${n.position}%`
|
|
3600
|
+
).join(", ");
|
|
3601
|
+
e.style.background = `linear-gradient(90deg, ${s})`;
|
|
3602
|
+
}
|
|
3562
3603
|
}
|
|
3563
3604
|
debouncedPreviewUpdate(t) {
|
|
3564
3605
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3569,151 +3610,176 @@ const P = class P extends x {
|
|
|
3569
3610
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3570
3611
|
const n = document.createElement("div");
|
|
3571
3612
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3572
|
-
const
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
},
|
|
3583
|
-
|
|
3613
|
+
const o = document.createElement("div");
|
|
3614
|
+
o.className = "gstop-chip";
|
|
3615
|
+
const a = this.resolveGlobalVarColor(i.color);
|
|
3616
|
+
o.style.backgroundColor = a, n.appendChild(o);
|
|
3617
|
+
const l = new dt((f, v) => {
|
|
3618
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = f, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = f, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3619
|
+
}, "solid");
|
|
3620
|
+
let r = !1, p = !1, h = 0, d = 0;
|
|
3621
|
+
const u = (f) => {
|
|
3622
|
+
r = !0, p = !1, h = f.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", g), document.addEventListener("mouseup", m), f.preventDefault(), f.stopPropagation();
|
|
3623
|
+
}, g = (f) => {
|
|
3624
|
+
if (!r || !this.value) return;
|
|
3625
|
+
const v = f.clientX - h;
|
|
3626
|
+
if (Math.abs(v) > 3 && (p = !0), p) {
|
|
3627
|
+
this.clearGlobalBindingForCustomChange();
|
|
3628
|
+
const C = e.getBoundingClientRect();
|
|
3629
|
+
let y = d + v / C.width * 100;
|
|
3630
|
+
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
3631
|
+
}
|
|
3632
|
+
}, m = (f) => {
|
|
3633
|
+
var v;
|
|
3634
|
+
if (r)
|
|
3635
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), p)
|
|
3636
|
+
this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
3637
|
+
else {
|
|
3638
|
+
f.stopPropagation();
|
|
3639
|
+
const C = (v = this.value) == null ? void 0 : v.stops[s];
|
|
3640
|
+
C && setTimeout(() => {
|
|
3641
|
+
const y = this.resolveGlobalVarColor(C.color);
|
|
3642
|
+
l.open(y, o, C.opacity ?? 100);
|
|
3643
|
+
}, 0);
|
|
3644
|
+
}
|
|
3584
3645
|
};
|
|
3585
|
-
n.addEventListener("mousedown",
|
|
3646
|
+
n.addEventListener("mousedown", u), t.appendChild(n);
|
|
3586
3647
|
});
|
|
3587
3648
|
}
|
|
3588
3649
|
updateStopsList(t) {
|
|
3589
3650
|
var i;
|
|
3590
3651
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3591
3652
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3592
|
-
var
|
|
3593
|
-
const a = document.createElement("div");
|
|
3594
|
-
a.className = "gstop-row";
|
|
3653
|
+
var k, S;
|
|
3595
3654
|
const o = document.createElement("div");
|
|
3596
|
-
o.className = "gstop-
|
|
3655
|
+
o.className = "gstop-row";
|
|
3656
|
+
const a = document.createElement("div");
|
|
3657
|
+
a.className = "gstop-position-group";
|
|
3597
3658
|
const l = document.createElement("input");
|
|
3598
|
-
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px",
|
|
3659
|
+
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
3599
3660
|
const r = document.createElement("div");
|
|
3600
3661
|
r.className = "gstop-color-container";
|
|
3601
|
-
const p = document.createElement("div");
|
|
3602
|
-
|
|
3603
|
-
const
|
|
3604
|
-
|
|
3605
|
-
const d = document.createElement("button");
|
|
3606
|
-
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(p), r.appendChild(c), r.appendChild(d);
|
|
3662
|
+
const p = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
|
|
3663
|
+
h.className = "gstop-color-preview", h.style.backgroundColor = p;
|
|
3664
|
+
const d = document.createElement("input");
|
|
3665
|
+
d.type = "text", d.className = "gstop-color-input", d.value = p.replace("#", "").toUpperCase();
|
|
3607
3666
|
const u = document.createElement("button");
|
|
3608
|
-
u.type = "button", u.className = "gstop-
|
|
3609
|
-
const g = document.createElement("
|
|
3610
|
-
g.className = "gstop-
|
|
3667
|
+
u.type = "button", u.className = "gstop-color-copy", u.textContent = "Copy", r.appendChild(h), r.appendChild(d), r.appendChild(u);
|
|
3668
|
+
const g = document.createElement("button");
|
|
3669
|
+
g.type = "button", g.className = "gstop-del", g.innerHTML = Yt, g.disabled = (((S = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : S.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(g), e.appendChild(o);
|
|
3670
|
+
const m = document.createElement("span");
|
|
3671
|
+
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3611
3672
|
const f = document.createElement("div");
|
|
3612
3673
|
f.className = "gstop-opacity-group";
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3674
|
+
const v = document.createElement("input");
|
|
3675
|
+
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
|
|
3676
|
+
const C = V(p);
|
|
3677
|
+
v.style.setProperty(
|
|
3617
3678
|
"--slider-color",
|
|
3618
|
-
`rgb(${
|
|
3679
|
+
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3619
3680
|
);
|
|
3620
|
-
const
|
|
3621
|
-
|
|
3622
|
-
const w = new
|
|
3623
|
-
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3681
|
+
const y = document.createElement("span");
|
|
3682
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, f.appendChild(v), f.appendChild(y);
|
|
3683
|
+
const w = new dt((b, E) => {
|
|
3684
|
+
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, v.value = String(E), y.textContent = `${E}%`);
|
|
3685
|
+
const M = V(b);
|
|
3686
|
+
v.style.setProperty(
|
|
3626
3687
|
"--slider-color",
|
|
3627
|
-
`rgb(${
|
|
3688
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3628
3689
|
), this.updateGradientPreview(), this.createHandles(
|
|
3629
3690
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3630
3691
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3631
3692
|
), this.updateUI(), this.triggerChange();
|
|
3632
3693
|
}, "solid");
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3694
|
+
d.addEventListener("click", (b) => {
|
|
3695
|
+
b.preventDefault(), b.stopPropagation();
|
|
3696
|
+
const E = this.resolveGlobalVarColor(s.color);
|
|
3697
|
+
w.open(E, d, s.opacity ?? 100);
|
|
3698
|
+
}), d.addEventListener("input", () => {
|
|
3699
|
+
this.clearGlobalBindingForCustomChange();
|
|
3700
|
+
const b = d.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
|
|
3701
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3702
|
+
this.value.stops[n].color = E, h.style.backgroundColor = E;
|
|
3703
|
+
const M = V(E);
|
|
3704
|
+
v.style.setProperty(
|
|
3641
3705
|
"--slider-color",
|
|
3642
|
-
`rgb(${
|
|
3706
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3643
3707
|
), this.debouncedPreviewUpdate();
|
|
3644
3708
|
}
|
|
3645
|
-
}),
|
|
3709
|
+
}), d.addEventListener("blur", () => {
|
|
3646
3710
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3647
|
-
}),
|
|
3648
|
-
|
|
3711
|
+
}), u.addEventListener("click", async (b) => {
|
|
3712
|
+
b.stopPropagation();
|
|
3649
3713
|
try {
|
|
3650
|
-
await navigator.clipboard.writeText(`#${
|
|
3714
|
+
await navigator.clipboard.writeText(`#${d.value}`);
|
|
3651
3715
|
} catch {
|
|
3652
3716
|
}
|
|
3653
|
-
}), l.addEventListener("focus", (
|
|
3654
|
-
const
|
|
3655
|
-
|
|
3656
|
-
}), l.addEventListener("input", (
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3717
|
+
}), l.addEventListener("focus", (b) => {
|
|
3718
|
+
const E = b.target;
|
|
3719
|
+
E.value = E.value.replace("%", ""), E.select();
|
|
3720
|
+
}), l.addEventListener("input", (b) => {
|
|
3721
|
+
this.clearGlobalBindingForCustomChange();
|
|
3722
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3723
|
+
if (!Number.isNaN(M)) {
|
|
3724
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3725
|
+
this.value.stops[n].position = B, E.value = `${B}%`, this.debouncedPreviewUpdate();
|
|
3661
3726
|
}
|
|
3662
|
-
}), l.addEventListener("blur", (
|
|
3727
|
+
}), l.addEventListener("blur", (b) => {
|
|
3663
3728
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3664
|
-
const
|
|
3665
|
-
if (Number.isNaN(
|
|
3666
|
-
|
|
3729
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3730
|
+
if (Number.isNaN(M))
|
|
3731
|
+
E.value = `${this.value.stops[n].position}%`;
|
|
3667
3732
|
else {
|
|
3668
|
-
const
|
|
3669
|
-
this.value.stops[n].position =
|
|
3733
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3734
|
+
this.value.stops[n].position = B, E.value = `${B}%`;
|
|
3670
3735
|
}
|
|
3671
3736
|
this.updateGradientPreview(), this.createHandles(
|
|
3672
3737
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3673
3738
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3674
3739
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3675
|
-
}),
|
|
3676
|
-
var
|
|
3677
|
-
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(n, 1), this.createHandles(
|
|
3740
|
+
}), g.addEventListener("click", () => {
|
|
3741
|
+
var b;
|
|
3742
|
+
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
3678
3743
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3679
3744
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3680
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
3681
|
-
}),
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3745
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((b = document.activeElement) == null ? void 0 : b.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3746
|
+
}), v.addEventListener("input", () => {
|
|
3747
|
+
this.clearGlobalBindingForCustomChange();
|
|
3748
|
+
const b = parseInt(v.value, 10);
|
|
3749
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, b)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3750
|
+
}), v.addEventListener("change", () => {
|
|
3751
|
+
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3686
3752
|
});
|
|
3687
3753
|
}));
|
|
3688
3754
|
}
|
|
3689
3755
|
addStop() {
|
|
3690
3756
|
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3691
|
-
const t = this.value.stops.map((
|
|
3757
|
+
const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
|
|
3692
3758
|
let e = 50, i = 0;
|
|
3693
|
-
for (let
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3759
|
+
for (let o = 0; o < t.length - 1; o++) {
|
|
3760
|
+
const a = t[o + 1] - t[o];
|
|
3761
|
+
a > i && (i = a, e = t[o] + a / 2);
|
|
3696
3762
|
}
|
|
3697
3763
|
const s = this.value.stops.reduce(
|
|
3698
|
-
(
|
|
3764
|
+
(o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o
|
|
3699
3765
|
), n = {
|
|
3700
3766
|
position: Math.round(e),
|
|
3701
3767
|
color: s.color,
|
|
3702
3768
|
opacity: s.opacity ?? 100
|
|
3703
3769
|
};
|
|
3704
|
-
this.value.stops.push(n), this.value.stops.sort((
|
|
3770
|
+
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3705
3771
|
}
|
|
3706
3772
|
openPopover() {
|
|
3707
|
-
if (this.popoverEl && (
|
|
3708
|
-
if (this.isPopoverOpen = !0,
|
|
3773
|
+
if (this.popoverEl && (H.openInstance && H.openInstance !== this && H.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3774
|
+
if (this.isPopoverOpen = !0, H.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) {
|
|
3709
3775
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3710
3776
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3711
|
-
const
|
|
3712
|
-
let
|
|
3713
|
-
const r = i - t.right, p = t.left,
|
|
3714
|
-
r <
|
|
3777
|
+
const o = this.popoverEl.offsetHeight;
|
|
3778
|
+
let a = t.right + 8, l = t.top;
|
|
3779
|
+
const r = i - t.right, p = t.left, h = e + n;
|
|
3780
|
+
r < h && p > r + 100 && (a = t.left - e - 8);
|
|
3715
3781
|
const d = s - t.bottom, u = t.top;
|
|
3716
|
-
u >=
|
|
3782
|
+
u >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : u > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
|
|
3717
3783
|
}
|
|
3718
3784
|
setTimeout(
|
|
3719
3785
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3730,24 +3796,24 @@ const P = class P extends x {
|
|
|
3730
3796
|
}
|
|
3731
3797
|
requestAnimationFrame(() => {
|
|
3732
3798
|
if (!this.popoverEl || !this.element) return;
|
|
3733
|
-
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight,
|
|
3799
|
+
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight, o = 16;
|
|
3734
3800
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3735
|
-
const
|
|
3801
|
+
const a = this.popoverEl.offsetHeight;
|
|
3736
3802
|
let l = e.right + 8, r = e.top;
|
|
3737
|
-
const p = s - e.right,
|
|
3738
|
-
p < d &&
|
|
3803
|
+
const p = s - e.right, h = e.left, d = i + o;
|
|
3804
|
+
p < d && h > p + 100 && (l = e.left - i - 8);
|
|
3739
3805
|
const u = n - e.bottom, g = e.top;
|
|
3740
|
-
g >=
|
|
3806
|
+
g >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : g > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3741
3807
|
});
|
|
3742
3808
|
}
|
|
3743
3809
|
}
|
|
3744
3810
|
refreshPopoverContent() {
|
|
3745
|
-
var n,
|
|
3811
|
+
var n, o;
|
|
3746
3812
|
if (!this.popoverEl) return;
|
|
3747
3813
|
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3748
|
-
t.forEach((
|
|
3814
|
+
t.forEach((a) => a.classList.remove("active"));
|
|
3749
3815
|
const e = t[0], i = t[1];
|
|
3750
|
-
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (
|
|
3816
|
+
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (o = this.recentGradientRefresh) == null || o.call(this)), this.popoverEl.offsetHeight;
|
|
3751
3817
|
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3752
3818
|
s && this.updatePopoverContent(s);
|
|
3753
3819
|
}
|
|
@@ -3755,10 +3821,10 @@ const P = class P extends x {
|
|
|
3755
3821
|
var t;
|
|
3756
3822
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3757
3823
|
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") {
|
|
3758
|
-
const e =
|
|
3824
|
+
const e = O(this.value);
|
|
3759
3825
|
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3760
3826
|
}
|
|
3761
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3827
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), H.openInstance === this && (H.openInstance = null);
|
|
3762
3828
|
}
|
|
3763
3829
|
}
|
|
3764
3830
|
commitPendingSolidColor() {
|
|
@@ -3775,21 +3841,31 @@ const P = class P extends x {
|
|
|
3775
3841
|
this.parseAndSet(e.value);
|
|
3776
3842
|
}
|
|
3777
3843
|
parseAndSet(t) {
|
|
3778
|
-
const e =
|
|
3844
|
+
const e = N(t.trim());
|
|
3779
3845
|
e && this.setValue(e);
|
|
3780
3846
|
}
|
|
3847
|
+
getChangePayload() {
|
|
3848
|
+
var t;
|
|
3849
|
+
if (this.value)
|
|
3850
|
+
return this.isBoundToGlobal() ? ((t = this.value.stops) == null ? void 0 : t.some(
|
|
3851
|
+
(i) => i.opacity !== void 0 && i.opacity !== 100
|
|
3852
|
+
)) ? this.resolveGradientGlobalVars(this.value) : this.linkedGlobalVariable || void 0 : this.value;
|
|
3853
|
+
}
|
|
3781
3854
|
triggerChange() {
|
|
3782
|
-
var
|
|
3783
|
-
|
|
3855
|
+
var e, i;
|
|
3856
|
+
const t = this.getChangePayload();
|
|
3857
|
+
t !== void 0 && ((e = this.onChange) == null || e.call(this, t), (i = this.detectChange) == null || i.call(this, t));
|
|
3784
3858
|
}
|
|
3785
3859
|
getElement() {
|
|
3786
3860
|
return this.element;
|
|
3787
3861
|
}
|
|
3788
3862
|
getValue() {
|
|
3789
|
-
|
|
3863
|
+
const t = this.getChangePayload();
|
|
3864
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3790
3865
|
}
|
|
3791
3866
|
getCSSValue() {
|
|
3792
|
-
|
|
3867
|
+
const t = this.getChangePayload();
|
|
3868
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3793
3869
|
}
|
|
3794
3870
|
getCSSForText() {
|
|
3795
3871
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3798,36 +3874,36 @@ const P = class P extends x {
|
|
|
3798
3874
|
return this.value;
|
|
3799
3875
|
}
|
|
3800
3876
|
};
|
|
3801
|
-
|
|
3802
|
-
let
|
|
3803
|
-
const
|
|
3877
|
+
H.openInstance = null;
|
|
3878
|
+
let K = H;
|
|
3879
|
+
const se = `
|
|
3804
3880
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3805
3881
|
<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"/>
|
|
3806
3882
|
</svg>
|
|
3807
|
-
`,
|
|
3883
|
+
`, ne = `
|
|
3808
3884
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3809
3885
|
<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"/>
|
|
3810
3886
|
</svg>
|
|
3811
3887
|
`;
|
|
3812
|
-
class
|
|
3888
|
+
class Le extends T {
|
|
3813
3889
|
constructor(t) {
|
|
3814
3890
|
super({
|
|
3815
3891
|
title: "Border",
|
|
3816
3892
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3817
3893
|
settings: {
|
|
3818
|
-
size: new
|
|
3894
|
+
size: new P({
|
|
3819
3895
|
title: "Size",
|
|
3820
|
-
icon:
|
|
3896
|
+
icon: ne,
|
|
3821
3897
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3822
3898
|
suffix: "px"
|
|
3823
3899
|
}),
|
|
3824
|
-
color: new
|
|
3900
|
+
color: new K({
|
|
3825
3901
|
title: "Border Color",
|
|
3826
3902
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3827
3903
|
}),
|
|
3828
|
-
radius: new
|
|
3904
|
+
radius: new P({
|
|
3829
3905
|
title: "Radius",
|
|
3830
|
-
icon:
|
|
3906
|
+
icon: se,
|
|
3831
3907
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3832
3908
|
suffix: "px"
|
|
3833
3909
|
})
|
|
@@ -3851,20 +3927,20 @@ class xe extends H {
|
|
|
3851
3927
|
`;
|
|
3852
3928
|
}
|
|
3853
3929
|
}
|
|
3854
|
-
const
|
|
3930
|
+
const oe = `
|
|
3855
3931
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3856
3932
|
<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"/>
|
|
3857
3933
|
</svg>
|
|
3858
|
-
`,
|
|
3934
|
+
`, ae = `
|
|
3859
3935
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3860
3936
|
<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"/>
|
|
3861
3937
|
</svg>
|
|
3862
|
-
`,
|
|
3938
|
+
`, le = `
|
|
3863
3939
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3864
3940
|
<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"/>
|
|
3865
3941
|
</svg>
|
|
3866
3942
|
`;
|
|
3867
|
-
class
|
|
3943
|
+
class ke extends T {
|
|
3868
3944
|
constructor(t = {}) {
|
|
3869
3945
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3870
3946
|
super({
|
|
@@ -3872,13 +3948,13 @@ class Le extends H {
|
|
|
3872
3948
|
collapsed: i.collapsed,
|
|
3873
3949
|
settings: (() => {
|
|
3874
3950
|
const s = {
|
|
3875
|
-
color: new
|
|
3951
|
+
color: new K({
|
|
3876
3952
|
title: "Color",
|
|
3877
3953
|
default: i.colorDefault ?? "#001E1E"
|
|
3878
3954
|
}),
|
|
3879
|
-
fontFamily: new
|
|
3955
|
+
fontFamily: new et({
|
|
3880
3956
|
title: "Font",
|
|
3881
|
-
icon:
|
|
3957
|
+
icon: oe,
|
|
3882
3958
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3883
3959
|
options: i.fontFamilyOptions ?? [
|
|
3884
3960
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3889,9 +3965,9 @@ class Le extends H {
|
|
|
3889
3965
|
getOptions: i.fontFamilyGetOptions,
|
|
3890
3966
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3891
3967
|
}),
|
|
3892
|
-
fontWeight: new
|
|
3968
|
+
fontWeight: new et({
|
|
3893
3969
|
title: "Weight",
|
|
3894
|
-
icon:
|
|
3970
|
+
icon: ae,
|
|
3895
3971
|
default: i.fontWeightDefault ?? "400",
|
|
3896
3972
|
options: i.fontWeightOptions ?? [
|
|
3897
3973
|
{ name: "Regular", value: "400" },
|
|
@@ -3901,9 +3977,9 @@ class Le extends H {
|
|
|
3901
3977
|
getOptions: i.fontWeightGetOptions,
|
|
3902
3978
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3903
3979
|
}),
|
|
3904
|
-
fontSize: new
|
|
3980
|
+
fontSize: new P({
|
|
3905
3981
|
title: "Size",
|
|
3906
|
-
icon:
|
|
3982
|
+
icon: le,
|
|
3907
3983
|
default: i.fontSizeDefault ?? 12,
|
|
3908
3984
|
suffix: "px",
|
|
3909
3985
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3911,7 +3987,7 @@ class Le extends H {
|
|
|
3911
3987
|
};
|
|
3912
3988
|
return e ? {
|
|
3913
3989
|
...s,
|
|
3914
|
-
align: new
|
|
3990
|
+
align: new Pt({
|
|
3915
3991
|
title: "Align",
|
|
3916
3992
|
default: i.alignDefault ?? "center"
|
|
3917
3993
|
})
|
|
@@ -3920,8 +3996,8 @@ class Le extends H {
|
|
|
3920
3996
|
});
|
|
3921
3997
|
}
|
|
3922
3998
|
getCssCode() {
|
|
3923
|
-
var
|
|
3924
|
-
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((
|
|
3999
|
+
var o;
|
|
4000
|
+
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((o = this.settings.align) == null ? void 0 : o.value) ?? "left";
|
|
3925
4001
|
return `
|
|
3926
4002
|
color: ${t};
|
|
3927
4003
|
font-family: ${e};
|
|
@@ -3931,8 +4007,8 @@ class Le extends H {
|
|
|
3931
4007
|
`;
|
|
3932
4008
|
}
|
|
3933
4009
|
getTextGradientCss() {
|
|
3934
|
-
var
|
|
3935
|
-
const t = this.settings.color.getCSSForText(), e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((
|
|
4010
|
+
var a;
|
|
4011
|
+
const t = this.settings.color.getCSSForText(), e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((a = this.settings.align) == null ? void 0 : a.value) ?? "left";
|
|
3936
4012
|
return `
|
|
3937
4013
|
${Object.entries(t).map(([l, r]) => `${l}: ${r};`).join(`
|
|
3938
4014
|
`)}
|
|
@@ -3943,7 +4019,7 @@ class Le extends H {
|
|
|
3943
4019
|
`;
|
|
3944
4020
|
}
|
|
3945
4021
|
}
|
|
3946
|
-
class
|
|
4022
|
+
class q extends x {
|
|
3947
4023
|
constructor(t) {
|
|
3948
4024
|
super({
|
|
3949
4025
|
...t,
|
|
@@ -3951,11 +4027,11 @@ class j extends x {
|
|
|
3951
4027
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
3952
4028
|
}
|
|
3953
4029
|
draw() {
|
|
3954
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
3955
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
4030
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
4031
|
+
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
3956
4032
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3957
|
-
let p = Number(
|
|
3958
|
-
p < l && (p = l), p > r && (p = r),
|
|
4033
|
+
let p = Number(a.value);
|
|
4034
|
+
p < l && (p = l), p > r && (p = r), a.value = String(p);
|
|
3959
4035
|
}));
|
|
3960
4036
|
}, i = this.createInput({
|
|
3961
4037
|
value: this.value,
|
|
@@ -3976,9 +4052,9 @@ class j extends x {
|
|
|
3976
4052
|
s && (s.style.paddingRight = "35px");
|
|
3977
4053
|
const n = document.createElement("span");
|
|
3978
4054
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
3979
|
-
const
|
|
3980
|
-
return
|
|
3981
|
-
const l =
|
|
4055
|
+
const o = i.querySelector("input");
|
|
4056
|
+
return o && (o.oninput = (a) => {
|
|
4057
|
+
const l = a.target.value.trim();
|
|
3982
4058
|
if (l.toLowerCase() === "auto")
|
|
3983
4059
|
this.value = "auto";
|
|
3984
4060
|
else {
|
|
@@ -3989,33 +4065,33 @@ class j extends x {
|
|
|
3989
4065
|
}), i;
|
|
3990
4066
|
}
|
|
3991
4067
|
}
|
|
3992
|
-
class
|
|
4068
|
+
class Me extends T {
|
|
3993
4069
|
constructor(t) {
|
|
3994
4070
|
super({
|
|
3995
4071
|
title: "Margins",
|
|
3996
4072
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3997
4073
|
settings: {
|
|
3998
|
-
marginTop: new
|
|
4074
|
+
marginTop: new q({
|
|
3999
4075
|
title: "Top",
|
|
4000
|
-
icon:
|
|
4076
|
+
icon: re,
|
|
4001
4077
|
suffix: "px",
|
|
4002
4078
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
4003
4079
|
}),
|
|
4004
|
-
marginRight: new
|
|
4080
|
+
marginRight: new q({
|
|
4005
4081
|
title: "Right",
|
|
4006
|
-
icon:
|
|
4082
|
+
icon: ce,
|
|
4007
4083
|
suffix: "px",
|
|
4008
4084
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
4009
4085
|
}),
|
|
4010
|
-
marginBottom: new
|
|
4086
|
+
marginBottom: new q({
|
|
4011
4087
|
title: "Bottom",
|
|
4012
|
-
icon:
|
|
4088
|
+
icon: he,
|
|
4013
4089
|
suffix: "px",
|
|
4014
4090
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
4015
4091
|
}),
|
|
4016
|
-
marginLeft: new
|
|
4092
|
+
marginLeft: new q({
|
|
4017
4093
|
title: "Left",
|
|
4018
|
-
icon:
|
|
4094
|
+
icon: de,
|
|
4019
4095
|
suffix: "px",
|
|
4020
4096
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
4021
4097
|
})
|
|
@@ -4032,29 +4108,29 @@ class ke extends H {
|
|
|
4032
4108
|
`;
|
|
4033
4109
|
}
|
|
4034
4110
|
}
|
|
4035
|
-
const
|
|
4111
|
+
const re = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4036
4112
|
<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"/>
|
|
4037
|
-
</svg>`,
|
|
4113
|
+
</svg>`, ce = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4038
4114
|
<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"/>
|
|
4039
|
-
</svg>`,
|
|
4115
|
+
</svg>`, he = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4040
4116
|
<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"/>
|
|
4041
|
-
</svg>`,
|
|
4117
|
+
</svg>`, de = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4042
4118
|
<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"/>
|
|
4043
4119
|
</svg>`;
|
|
4044
|
-
class
|
|
4120
|
+
class Se extends T {
|
|
4045
4121
|
constructor(t) {
|
|
4046
4122
|
super({
|
|
4047
4123
|
title: "Background Image",
|
|
4048
4124
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4049
4125
|
settings: {
|
|
4050
|
-
backgroundImage: new
|
|
4126
|
+
backgroundImage: new nt({
|
|
4051
4127
|
...t == null ? void 0 : t.uploadProps,
|
|
4052
4128
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
4053
4129
|
}),
|
|
4054
|
-
opacity: new
|
|
4130
|
+
opacity: new It({
|
|
4055
4131
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4056
4132
|
}),
|
|
4057
|
-
backgroundColor: new
|
|
4133
|
+
backgroundColor: new F({
|
|
4058
4134
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
4059
4135
|
})
|
|
4060
4136
|
}
|
|
@@ -4063,10 +4139,10 @@ class Me extends H {
|
|
|
4063
4139
|
draw() {
|
|
4064
4140
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
4065
4141
|
if (!e) return t;
|
|
4066
|
-
const i = Array.from(e.children), [s, n,
|
|
4142
|
+
const i = Array.from(e.children), [s, n, o] = i;
|
|
4067
4143
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
4068
|
-
const
|
|
4069
|
-
return
|
|
4144
|
+
const a = document.createElement("div");
|
|
4145
|
+
return a.className = "bgset-or-label", a.textContent = "OR", e.appendChild(a), e.appendChild(o), t;
|
|
4070
4146
|
}
|
|
4071
4147
|
getCssCode() {
|
|
4072
4148
|
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
@@ -4080,41 +4156,64 @@ class Me extends H {
|
|
|
4080
4156
|
`;
|
|
4081
4157
|
}
|
|
4082
4158
|
}
|
|
4159
|
+
class Ne extends T {
|
|
4160
|
+
constructor(t) {
|
|
4161
|
+
super({
|
|
4162
|
+
title: (t == null ? void 0 : t.title) ?? "Image",
|
|
4163
|
+
collapsed: t == null ? void 0 : t.collapsed,
|
|
4164
|
+
settings: {
|
|
4165
|
+
image: new nt({
|
|
4166
|
+
...t == null ? void 0 : t.uploadProps,
|
|
4167
|
+
default: (t == null ? void 0 : t.image) ?? ""
|
|
4168
|
+
}),
|
|
4169
|
+
width: new Ft({
|
|
4170
|
+
default: (t == null ? void 0 : t.width) ?? 1e3,
|
|
4171
|
+
mobile: t == null ? void 0 : t.widthMobile
|
|
4172
|
+
}),
|
|
4173
|
+
height: new Gt({
|
|
4174
|
+
default: (t == null ? void 0 : t.height) ?? 300,
|
|
4175
|
+
mobile: t == null ? void 0 : t.heightMobile
|
|
4176
|
+
})
|
|
4177
|
+
}
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4083
4181
|
export {
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
Ee as
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4182
|
+
Pt as AlignSetting,
|
|
4183
|
+
xe as AnimationSetting,
|
|
4184
|
+
Se as BackgroundSettingSet,
|
|
4185
|
+
Le as BorderSettingSet,
|
|
4186
|
+
me as ButtonSetting,
|
|
4187
|
+
I as ColorSetting,
|
|
4188
|
+
F as ColorWithOpacitySetting,
|
|
4189
|
+
fe as DimensionSetting,
|
|
4190
|
+
ye as GapSetting,
|
|
4191
|
+
K as GradientSetting,
|
|
4192
|
+
ke as HeaderTypographySettingSet,
|
|
4193
|
+
Gt as HeightSetting,
|
|
4194
|
+
ge as HtmlSetting,
|
|
4195
|
+
Ne as ImageSettingSet,
|
|
4196
|
+
be as MarginBottomSetting,
|
|
4197
|
+
Me as MarginSettingGroup,
|
|
4198
|
+
Ee as MarginTopSetting,
|
|
4199
|
+
we as MultiLanguageSetting,
|
|
4200
|
+
P as NumberSetting,
|
|
4201
|
+
It as OpacitySetting,
|
|
4202
|
+
ve as SelectApiSettings,
|
|
4203
|
+
et as SelectSetting,
|
|
4105
4204
|
x as Setting,
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4205
|
+
T as SettingGroup,
|
|
4206
|
+
Mt as StringSetting,
|
|
4207
|
+
Lt as TabSettingGroup,
|
|
4208
|
+
Lt as TabsSettingGroup,
|
|
4209
|
+
Ce as Toggle,
|
|
4210
|
+
nt as UploadSetting,
|
|
4211
|
+
Ft as WidthSetting,
|
|
4212
|
+
ue as asSettingGroupWithSettings,
|
|
4213
|
+
kt as createSettingGroup,
|
|
4214
|
+
pe as createTabSettingGroup,
|
|
4116
4215
|
A as isSetting,
|
|
4117
|
-
|
|
4216
|
+
lt as isSettingChild,
|
|
4118
4217
|
L as isSettingGroup,
|
|
4119
|
-
|
|
4218
|
+
j as iterateSettings
|
|
4120
4219
|
};
|