builder-settings-types 0.0.313 → 0.0.315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/settings-group/settingsGroup.d.ts +3 -1
- package/dist/builder-settings-types.cjs.js +115 -56
- package/dist/builder-settings-types.es.js +1459 -1060
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/settings/image-map-settings/ImageMapSetting.d.ts +61 -0
- package/dist/settings/image-map-settings/index.d.ts +2 -0
- package/dist/settings/image-map-settings/types.d.ts +18 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const Et = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let mt = (h = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
|
+
for (; h--; )
|
|
5
|
+
t += Et[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function wt(h) {
|
|
9
|
+
let t = 0, e = h.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function _(
|
|
14
|
+
function _(h, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function et(h, t = 0) {
|
|
19
|
+
h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
_(s, n),
|
|
21
|
+
_(s, n), et(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const xt = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class Lt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...xt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class wt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = wt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class wt {
|
|
|
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 rt = new Lt();
|
|
115
|
+
function K(h) {
|
|
116
|
+
if (h === null || typeof h != "object") return h;
|
|
117
|
+
if (h instanceof Date) return new Date(h.getTime());
|
|
118
|
+
if (h instanceof Array) return h.map((t) => K(t));
|
|
119
|
+
if (typeof h == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in h)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(h, e) && (t[e] = K(h[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return h;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function kt(h) {
|
|
128
|
+
switch (h) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -144,7 +144,7 @@ function xt(c) {
|
|
|
144
144
|
}
|
|
145
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 || mt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
150
|
globalThis.DefaultUploadUrl = t, G.DefaultUploadUrl = t;
|
|
@@ -174,30 +174,30 @@ const G = class G {
|
|
|
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 = K(this.props), i = new t(e);
|
|
178
|
+
return i.value = K(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 || kt(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 G = class G {
|
|
|
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");
|
|
@@ -247,30 +247,30 @@ G.GlobalVariables = {
|
|
|
247
247
|
"text-light": "#00141E"
|
|
248
248
|
};
|
|
249
249
|
let x = G;
|
|
250
|
-
function
|
|
251
|
-
return
|
|
250
|
+
function D(h) {
|
|
251
|
+
return h instanceof x;
|
|
252
252
|
}
|
|
253
|
-
function L(
|
|
254
|
-
return
|
|
253
|
+
function L(h) {
|
|
254
|
+
return h instanceof T;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function ct(h) {
|
|
257
|
+
return D(h) || L(h);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
for (const e in
|
|
261
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
262
|
-
const i =
|
|
259
|
+
function q(h, t) {
|
|
260
|
+
for (const e in h)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(h, e)) {
|
|
262
|
+
const i = h[e];
|
|
263
263
|
t(e, i);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const Q = class Q {
|
|
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 || mt(), 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
|
+
q(this.settings, (e, i) => {
|
|
274
274
|
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
275
275
|
});
|
|
276
276
|
}
|
|
@@ -287,13 +287,13 @@ const Y = class Y {
|
|
|
287
287
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
288
288
|
}
|
|
289
289
|
propagateDataPropsPath() {
|
|
290
|
-
|
|
290
|
+
q(this.settings, (t, e) => {
|
|
291
291
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
292
|
-
(L(e) ||
|
|
292
|
+
(L(e) || D(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
updateNestingStyles() {
|
|
296
|
-
this.elementRef && (_(this.elementRef, this.nestingLevel),
|
|
296
|
+
this.elementRef && (_(this.elementRef, this.nestingLevel), et(this.elementRef, this.nestingLevel));
|
|
297
297
|
}
|
|
298
298
|
forceChildUIRefresh() {
|
|
299
299
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -321,21 +321,21 @@ const Y = class Y {
|
|
|
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
|
}
|
|
@@ -348,38 +348,38 @@ const Y = class Y {
|
|
|
348
348
|
updateVisibility() {
|
|
349
349
|
this.elementRef;
|
|
350
350
|
}
|
|
351
|
-
updateSettings(t) {
|
|
352
|
-
var
|
|
353
|
-
const e = new Set(Object.keys(this.settings)),
|
|
354
|
-
i.forEach((
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
}),
|
|
358
|
-
|
|
359
|
-
}),
|
|
351
|
+
updateSettings(t, e) {
|
|
352
|
+
var l;
|
|
353
|
+
const i = (e == null ? void 0 : e.preserveValues) ?? !0, s = new Set(Object.keys(this.settings)), n = Object.keys(t), o = {};
|
|
354
|
+
i && n.forEach((r) => {
|
|
355
|
+
const c = this.settings[r];
|
|
356
|
+
c && (L(c) ? o[r] = c.getValues() : D(c) ? o[r] = c.value : typeof c.getValues == "function" ? o[r] = c.getValues() : c.value !== void 0 && (o[r] = c.value));
|
|
357
|
+
}), s.forEach((r) => {
|
|
358
|
+
n.includes(r) || this.removeSetting(r);
|
|
359
|
+
}), n.forEach((r) => {
|
|
360
360
|
var p;
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
const
|
|
361
|
+
const c = t[r], d = this.settings[r];
|
|
362
|
+
if (d !== c && (d && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
|
|
363
|
+
const g = o[r];
|
|
364
364
|
try {
|
|
365
|
-
L(
|
|
366
|
-
|
|
367
|
-
) :
|
|
368
|
-
} catch (
|
|
369
|
-
console.warn(`Could not preserve value for setting ${
|
|
365
|
+
L(c) ? c.setValue(
|
|
366
|
+
g
|
|
367
|
+
) : D(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
|
|
368
|
+
} catch (f) {
|
|
369
|
+
console.warn(`Could not preserve value for setting ${r}:`, f);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
373
|
-
const
|
|
374
|
-
this.initialValues =
|
|
373
|
+
const a = this.getValues();
|
|
374
|
+
this.initialValues = a, (l = this.onChange) == null || l.call(this, a);
|
|
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
|
+
q(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 Y = class Y {
|
|
|
392
392
|
deleteItem: this.deleteItemCfg,
|
|
393
393
|
dataProps: this.dataProps,
|
|
394
394
|
hide: this.hide
|
|
395
|
-
}, i =
|
|
395
|
+
}, i = It(e);
|
|
396
396
|
return i.initialValues = this.getValues(), i;
|
|
397
397
|
}
|
|
398
398
|
resetDefault() {
|
|
@@ -402,7 +402,7 @@ const Y = class Y {
|
|
|
402
402
|
setMobileValues(t) {
|
|
403
403
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
404
404
|
const s = this.settings[e];
|
|
405
|
-
s && (L(s) ||
|
|
405
|
+
s && (L(s) || D(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
406
406
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
407
407
|
}
|
|
408
408
|
getMobileValues(t) {
|
|
@@ -438,19 +438,19 @@ const Y = class Y {
|
|
|
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(), q(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
|
-
else if (
|
|
449
|
-
const
|
|
450
|
-
this.changeHandlers.add(
|
|
448
|
+
else if (D(s)) {
|
|
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,13 +465,13 @@ const Y = class Y {
|
|
|
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
|
+
ct(l) && (this.addSetting(i, l), n = l);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
n && (L(n) ||
|
|
474
|
+
n && (L(n) || D(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
475
475
|
}), setTimeout(() => {
|
|
476
476
|
this.forceChildUIRefresh();
|
|
477
477
|
}, 0);
|
|
@@ -485,25 +485,25 @@ const Y = class Y {
|
|
|
485
485
|
const s = this.getValues();
|
|
486
486
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
487
487
|
};
|
|
488
|
-
L(t) ? t.setOnChange(() => e()) :
|
|
488
|
+
L(t) ? t.setOnChange(() => e()) : D(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
489
489
|
}
|
|
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 d = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
501
|
+
d && t.startsWith(d) && this.addDeleteButtonToElement(a, t);
|
|
502
502
|
}
|
|
503
|
-
const r =
|
|
504
|
-
r ?
|
|
505
|
-
const
|
|
506
|
-
|
|
503
|
+
const r = o.querySelector(".sg-add-button-bottom");
|
|
504
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), _(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
|
|
505
|
+
const c = a.style.display;
|
|
506
|
+
a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
const i = this.getValues();
|
|
@@ -520,9 +520,9 @@ const Y = class Y {
|
|
|
520
520
|
const r = Array.from(
|
|
521
521
|
t.querySelectorAll(".setting-group-title")
|
|
522
522
|
);
|
|
523
|
-
for (const
|
|
524
|
-
if (
|
|
525
|
-
s =
|
|
523
|
+
for (const c of r)
|
|
524
|
+
if (c.closest(".setting-group") === t) {
|
|
525
|
+
s = c;
|
|
526
526
|
break;
|
|
527
527
|
}
|
|
528
528
|
s || (s = r[0] ?? null);
|
|
@@ -530,8 +530,8 @@ const Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
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
|
-
}),
|
|
558
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
559
|
-
|
|
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
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((c) => {
|
|
559
|
+
c && (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 Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
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", (d) => {
|
|
654
|
+
d.target === e && (r(), t(!1));
|
|
655
655
|
});
|
|
656
|
-
const
|
|
657
|
-
|
|
656
|
+
const c = (d) => {
|
|
657
|
+
d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
|
|
658
658
|
};
|
|
659
|
-
document.addEventListener("keydown",
|
|
659
|
+
document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
660
660
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
661
661
|
}), setTimeout(() => l.focus(), 100);
|
|
662
662
|
});
|
|
@@ -674,8 +674,8 @@ const Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
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}`, Q.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,57 +764,57 @@ const Y = class Y {
|
|
|
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
|
);
|
|
780
780
|
};
|
|
781
|
-
if (e.onclick = l, e.onkeydown = (
|
|
782
|
-
(
|
|
781
|
+
if (e.onclick = l, e.onkeydown = (c) => {
|
|
782
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), l());
|
|
783
783
|
}, Object.keys(this.settings).length > 0) {
|
|
784
|
-
for (const
|
|
785
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
786
|
-
const
|
|
787
|
-
L(
|
|
788
|
-
const
|
|
789
|
-
L(
|
|
790
|
-
d,
|
|
784
|
+
for (const c in this.settings)
|
|
785
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
|
|
786
|
+
const d = this.settings[c];
|
|
787
|
+
L(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
|
|
788
|
+
const p = d.draw();
|
|
789
|
+
L(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
|
|
791
790
|
p,
|
|
792
|
-
|
|
793
|
-
|
|
791
|
+
c,
|
|
792
|
+
d
|
|
793
|
+
), a.appendChild(p);
|
|
794
794
|
}
|
|
795
795
|
} else {
|
|
796
|
-
const
|
|
797
|
-
|
|
796
|
+
const c = document.createElement("div");
|
|
797
|
+
c.className = "setting-group-empty", c.textContent = "No settings in this group", a.appendChild(c);
|
|
798
798
|
}
|
|
799
799
|
if (this.addItemCfg) {
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
const
|
|
800
|
+
const c = document.createElement("button");
|
|
801
|
+
c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
|
|
802
|
+
const d = `
|
|
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
|
-
|
|
809
|
-
|
|
810
|
-
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),
|
|
811
|
-
if (
|
|
808
|
+
c.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
|
|
809
|
+
p.stopPropagation(), p.preventDefault();
|
|
810
|
+
const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), f = this.addItemCfg.createItem(g);
|
|
811
|
+
if (ct(f)) {
|
|
812
812
|
const m = `${this.addItemCfg.keyPrefix}${g}`;
|
|
813
|
-
this.addSetting(m,
|
|
813
|
+
this.addSetting(m, f);
|
|
814
814
|
}
|
|
815
|
-
}),
|
|
815
|
+
}), a.appendChild(c);
|
|
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, rt.trackElement(t), setTimeout(() => {
|
|
818
818
|
this.updateNestingStyles();
|
|
819
819
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
820
820
|
}
|
|
@@ -845,10 +845,10 @@ const Y = class Y {
|
|
|
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 Y = class Y {
|
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
};
|
|
859
|
-
|
|
860
|
-
let T =
|
|
861
|
-
function
|
|
862
|
-
return new
|
|
859
|
+
Q.hiddenElements = /* @__PURE__ */ new Set();
|
|
860
|
+
let T = Q;
|
|
861
|
+
function ye(h) {
|
|
862
|
+
return new Mt(h);
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class Mt extends T {
|
|
865
865
|
constructor(t) {
|
|
866
866
|
super(t);
|
|
867
867
|
const e = Object.keys(this.settings)[0];
|
|
@@ -905,30 +905,30 @@ class Lt extends T {
|
|
|
905
905
|
s.textContent = this.title, i.appendChild(s);
|
|
906
906
|
const n = document.createElement("div");
|
|
907
907
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
908
|
-
const
|
|
909
|
-
if (
|
|
908
|
+
const o = document.createElement("div");
|
|
909
|
+
if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
|
|
910
910
|
const r = document.createElement("button");
|
|
911
|
-
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id",
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
)),
|
|
918
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
919
|
-
const
|
|
920
|
-
this.activeTabId =
|
|
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);
|
|
912
|
+
const c = document.createElement("div");
|
|
913
|
+
c.className = "tab-panel", this.contentContainers[a] = c;
|
|
914
|
+
const d = this.settings[a];
|
|
915
|
+
d && (L(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
|
|
916
|
+
d.draw()
|
|
917
|
+
)), o.appendChild(c), 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 || "";
|
|
921
921
|
}
|
|
922
922
|
return this.updateTabUI(), t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
function
|
|
926
|
-
return new T(
|
|
925
|
+
function It(h) {
|
|
926
|
+
return new T(h);
|
|
927
927
|
}
|
|
928
|
-
function
|
|
929
|
-
return
|
|
928
|
+
function be(h) {
|
|
929
|
+
return h;
|
|
930
930
|
}
|
|
931
|
-
class
|
|
931
|
+
class Nt extends x {
|
|
932
932
|
constructor(t = {}) {
|
|
933
933
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
934
934
|
}
|
|
@@ -949,7 +949,7 @@ class Mt extends x {
|
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
951
|
const St = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
952
|
-
class V extends
|
|
952
|
+
class V extends Nt {
|
|
953
953
|
constructor(t) {
|
|
954
954
|
super({
|
|
955
955
|
...t,
|
|
@@ -965,14 +965,14 @@ class V extends Mt {
|
|
|
965
965
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
966
966
|
}
|
|
967
967
|
static rgbToHexStatic(t) {
|
|
968
|
-
const e = t.split(",").map((
|
|
968
|
+
const e = t.split(",").map((c) => parseInt(c.trim()));
|
|
969
969
|
if (e.length !== 3 || e.some(isNaN))
|
|
970
970
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
971
|
-
const [i, s, n] = e,
|
|
972
|
-
const
|
|
973
|
-
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 = (c) => {
|
|
972
|
+
const d = c.toString(16);
|
|
973
|
+
return d.length === 1 ? "0" + d : d;
|
|
974
974
|
};
|
|
975
|
-
return `#${r(
|
|
975
|
+
return `#${r(o)}${r(a)}${r(l)}`;
|
|
976
976
|
}
|
|
977
977
|
setValue(t) {
|
|
978
978
|
if (t === void 0) {
|
|
@@ -1012,90 +1012,90 @@ class V extends Mt {
|
|
|
1012
1012
|
s.className = "color-tab active", s.textContent = "Solid";
|
|
1013
1013
|
const n = document.createElement("button");
|
|
1014
1014
|
n.className = "color-tab", n.textContent = "Global", i.appendChild(s), i.appendChild(n);
|
|
1015
|
-
const a = document.createElement("div");
|
|
1016
|
-
a.className = "color-content-solid";
|
|
1017
1015
|
const o = document.createElement("div");
|
|
1018
|
-
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";
|
|
1019
1019
|
const l = () => {
|
|
1020
1020
|
try {
|
|
1021
|
-
if (console.log("ColorSetting: renderGlobalOptions called"),
|
|
1021
|
+
if (console.log("ColorSetting: renderGlobalOptions called"), a.innerHTML = "", !x) {
|
|
1022
1022
|
console.error("ColorSetting: Setting class is undefined");
|
|
1023
1023
|
const u = document.createElement("div");
|
|
1024
|
-
u.textContent = "Error: System error (Setting undefined)",
|
|
1024
|
+
u.textContent = "Error: System error (Setting undefined)", a.appendChild(u);
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
const m = x.GlobalVariables || {};
|
|
1028
1028
|
if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
|
|
1029
1029
|
const u = document.createElement("div");
|
|
1030
|
-
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666",
|
|
1030
|
+
u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
Object.entries(m).forEach(([u,
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1036
|
-
var k,
|
|
1033
|
+
Object.entries(m).forEach(([u, v]) => {
|
|
1034
|
+
const C = document.createElement("button");
|
|
1035
|
+
C.className = "global-color-btn", C.title = u, C.style.width = "30px", C.style.height = "30px", C.style.borderRadius = "50%", C.style.border = "1px solid #ddd", C.style.backgroundColor = v, C.style.cursor = "pointer", this.value === `var(--${u})` && (C.style.border = "2px solid #2196f3"), C.addEventListener("click", (y) => {
|
|
1036
|
+
var k, I;
|
|
1037
1037
|
y.preventDefault();
|
|
1038
1038
|
const w = `var(--${u})`;
|
|
1039
|
-
this.value = w, (k = this.onChange) == null || k.call(this, w), (
|
|
1039
|
+
this.value = w, (k = this.onChange) == null || k.call(this, w), (I = this.detectChange) == null || I.call(this, w), Array.from(a.children).forEach((b) => {
|
|
1040
1040
|
b.style.border = "1px solid #ddd";
|
|
1041
|
-
}),
|
|
1042
|
-
}),
|
|
1041
|
+
}), C.style.border = "2px solid #2196f3", d.style.backgroundColor = v;
|
|
1042
|
+
}), a.appendChild(C);
|
|
1043
1043
|
});
|
|
1044
1044
|
} catch (m) {
|
|
1045
|
-
console.error("ColorSetting: Error in renderGlobalOptions", m),
|
|
1045
|
+
console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
|
|
1046
1046
|
}
|
|
1047
1047
|
};
|
|
1048
1048
|
l(), s.addEventListener("click", (m) => {
|
|
1049
|
-
m.preventDefault(), s.classList.add("active"), n.classList.remove("active"),
|
|
1049
|
+
m.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1050
1050
|
}), n.addEventListener("click", (m) => {
|
|
1051
|
-
m.preventDefault(), n.classList.add("active"), s.classList.remove("active"),
|
|
1051
|
+
m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
1052
1052
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1053
1053
|
const r = (m) => {
|
|
1054
1054
|
const u = m.value.trim();
|
|
1055
1055
|
if (!u)
|
|
1056
1056
|
return e.classList.remove("error"), !0;
|
|
1057
|
-
const
|
|
1058
|
-
return
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
let
|
|
1064
|
-
if (
|
|
1065
|
-
const m =
|
|
1066
|
-
|
|
1057
|
+
const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
|
|
1058
|
+
return C ? e.classList.remove("error") : e.classList.add("error"), C;
|
|
1059
|
+
}, c = document.createElement("input");
|
|
1060
|
+
c.type = "color", c.className = "color-picker", c.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", c.setAttribute("aria-label", "Choose color"), c.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && c.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = c;
|
|
1061
|
+
const d = document.createElement("div");
|
|
1062
|
+
d.className = "color-preview";
|
|
1063
|
+
let p = this.value || "#000000";
|
|
1064
|
+
if (p.startsWith("var(--")) {
|
|
1065
|
+
const m = p.replace("var(--", "").replace(")", "");
|
|
1066
|
+
p = (x.GlobalVariables || {})[m] || "#000000";
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1068
|
+
d.style.backgroundColor = p;
|
|
1069
1069
|
const g = document.createElement("input");
|
|
1070
1070
|
g.type = "text", g.className = "color-text-input", g.value = this.value || "", g.placeholder = "#000000", g.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), g.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), g.setAttribute("aria-label", "Hex color value"), g.setAttribute("maxlength", "7"), this.getDataPropsPath() && g.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = g;
|
|
1071
|
-
const
|
|
1072
|
-
var
|
|
1071
|
+
const f = (m) => {
|
|
1072
|
+
var v, C;
|
|
1073
1073
|
let u = m.trim();
|
|
1074
1074
|
if (u && !u.startsWith("#") && !u.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(u) && (u = "#" + u, this.textInputEl && (this.textInputEl.value = u)), this.textInputEl && r(this.textInputEl)) {
|
|
1075
1075
|
const y = V.normalizeColorValue(u);
|
|
1076
|
-
this.value = y, (
|
|
1076
|
+
this.value = y, (v = this.onChange) == null || v.call(this, y), (C = this.detectChange) == null || C.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), d.style.backgroundColor = y;
|
|
1077
1077
|
}
|
|
1078
1078
|
};
|
|
1079
1079
|
return this.textInputEl.addEventListener("input", (m) => {
|
|
1080
1080
|
const u = m.target.value;
|
|
1081
|
-
|
|
1081
|
+
f(u);
|
|
1082
1082
|
}), this.textInputEl.addEventListener("paste", (m) => {
|
|
1083
|
-
var
|
|
1083
|
+
var v;
|
|
1084
1084
|
m.preventDefault();
|
|
1085
|
-
const u = ((
|
|
1086
|
-
this.textInputEl && (this.textInputEl.value = u.trim(),
|
|
1085
|
+
const u = ((v = m.clipboardData) == null ? void 0 : v.getData("text")) || "";
|
|
1086
|
+
this.textInputEl && (this.textInputEl.value = u.trim(), f(u));
|
|
1087
1087
|
}), this.textInputEl.addEventListener("keydown", (m) => {
|
|
1088
|
-
var u,
|
|
1089
|
-
m.key === "Enter" && (m.preventDefault(),
|
|
1088
|
+
var u, v, C;
|
|
1089
|
+
m.key === "Enter" && (m.preventDefault(), f(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (v = this.textInputEl) == null || v.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (C = this.textInputEl) == null || C.blur(), e.classList.remove("error"));
|
|
1090
1090
|
}), this.colorInputEl.addEventListener("input", (m) => {
|
|
1091
|
-
var
|
|
1092
|
-
const u = m.target.value,
|
|
1093
|
-
this.value =
|
|
1091
|
+
var C, y;
|
|
1092
|
+
const u = m.target.value, v = V.normalizeColorValue(u);
|
|
1093
|
+
this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), d.style.backgroundColor = v, e.classList.remove("error");
|
|
1094
1094
|
}), this.colorInputEl.addEventListener("change", (m) => {
|
|
1095
|
-
var
|
|
1096
|
-
const u = m.target.value,
|
|
1097
|
-
this.value =
|
|
1098
|
-
}),
|
|
1095
|
+
var C, y;
|
|
1096
|
+
const u = m.target.value, v = V.normalizeColorValue(u);
|
|
1097
|
+
this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), d.style.backgroundColor = v;
|
|
1098
|
+
}), o.appendChild(c), o.appendChild(d), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
1099
1099
|
}
|
|
1100
1100
|
getElement() {
|
|
1101
1101
|
return this.element;
|
|
@@ -1113,7 +1113,7 @@ class V extends Mt {
|
|
|
1113
1113
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
|
-
const
|
|
1116
|
+
const Vt = `
|
|
1117
1117
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1118
1118
|
<path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1119
1119
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
@@ -1123,7 +1123,7 @@ class F extends x {
|
|
|
1123
1123
|
constructor(t = {}) {
|
|
1124
1124
|
super({
|
|
1125
1125
|
...t,
|
|
1126
|
-
icon: t.icon ||
|
|
1126
|
+
icon: t.icon || Vt,
|
|
1127
1127
|
title: t.title || "Color & Opacity",
|
|
1128
1128
|
default: t.default || "#000000FF"
|
|
1129
1129
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = F.normalizeHexWithOpacity(this.value));
|
|
@@ -1151,8 +1151,8 @@ class F extends x {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
updateColorPreview() {
|
|
1153
1153
|
if (!this.colorPreviewEl || !this.value) return;
|
|
1154
|
-
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),
|
|
1155
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
1154
|
+
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);
|
|
1155
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1156
1156
|
}
|
|
1157
1157
|
handleColorChange(t) {
|
|
1158
1158
|
const e = this.getOpacityPercent(), i = F.combineColorOpacity(
|
|
@@ -1175,16 +1175,16 @@ class F extends x {
|
|
|
1175
1175
|
draw() {
|
|
1176
1176
|
const t = document.createElement("div");
|
|
1177
1177
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1178
|
-
const
|
|
1179
|
-
if (
|
|
1178
|
+
const a = document.createElement("div");
|
|
1179
|
+
if (a.className = "icon-container", this.props.icon) {
|
|
1180
1180
|
const l = document.createElement("span");
|
|
1181
|
-
l.className = "input-icon", l.innerHTML = this.props.icon,
|
|
1181
|
+
l.className = "input-icon", l.innerHTML = this.props.icon, a.appendChild(l);
|
|
1182
1182
|
}
|
|
1183
1183
|
if (this.props.title) {
|
|
1184
1184
|
const l = document.createElement("span");
|
|
1185
|
-
l.className = "input-label", l.textContent = this.props.title,
|
|
1185
|
+
l.className = "input-label", l.textContent = this.props.title, a.appendChild(l);
|
|
1186
1186
|
}
|
|
1187
|
-
t.appendChild(
|
|
1187
|
+
t.appendChild(a);
|
|
1188
1188
|
}
|
|
1189
1189
|
const e = document.createElement("div");
|
|
1190
1190
|
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.getDataPropsPath() && this.colorInputEl.setAttribute(
|
|
@@ -1194,32 +1194,32 @@ class F extends x {
|
|
|
1194
1194
|
"data-test-id",
|
|
1195
1195
|
`${this.getDataPropsPath()}_text`
|
|
1196
1196
|
), this.updateInputElements(), this.updateColorPreview();
|
|
1197
|
-
const i = (
|
|
1198
|
-
let l =
|
|
1197
|
+
const i = (a) => {
|
|
1198
|
+
let l = a.trim();
|
|
1199
1199
|
l && !l.startsWith("#") && /^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(l) && (l = "#" + l, this.textInputEl && (this.textInputEl.value = l));
|
|
1200
1200
|
const r = this.handleTextInput(l);
|
|
1201
1201
|
return r ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : l === "" ? e.classList.remove("error") : e.classList.add("error"), r;
|
|
1202
1202
|
};
|
|
1203
|
-
this.colorInputEl.addEventListener("input", (
|
|
1204
|
-
const l =
|
|
1203
|
+
this.colorInputEl.addEventListener("input", (a) => {
|
|
1204
|
+
const l = a.target;
|
|
1205
1205
|
this.handleColorChange(l.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1206
|
-
}), this.textInputEl.addEventListener("input", (
|
|
1207
|
-
const l =
|
|
1206
|
+
}), this.textInputEl.addEventListener("input", (a) => {
|
|
1207
|
+
const l = a.target;
|
|
1208
1208
|
i(l.value);
|
|
1209
|
-
}), this.textInputEl.addEventListener("paste", (
|
|
1209
|
+
}), this.textInputEl.addEventListener("paste", (a) => {
|
|
1210
1210
|
var r;
|
|
1211
|
-
|
|
1212
|
-
const l = ((r =
|
|
1211
|
+
a.preventDefault();
|
|
1212
|
+
const l = ((r = a.clipboardData) == null ? void 0 : r.getData("text")) || "";
|
|
1213
1213
|
this.textInputEl && (this.textInputEl.value = l.trim(), i(l));
|
|
1214
|
-
}), this.textInputEl.addEventListener("keydown", (
|
|
1215
|
-
var l, r,
|
|
1216
|
-
|
|
1217
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
1218
|
-
const l =
|
|
1214
|
+
}), this.textInputEl.addEventListener("keydown", (a) => {
|
|
1215
|
+
var l, r, c;
|
|
1216
|
+
a.key === "Enter" && (a.preventDefault(), i(((l = this.textInputEl) == null ? void 0 : l.value) || ""), (r = this.textInputEl) == null || r.blur()), a.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (c = this.textInputEl) == null || c.blur(), e.classList.remove("error"));
|
|
1217
|
+
}), this.textInputEl.addEventListener("blur", (a) => {
|
|
1218
|
+
const l = a.target;
|
|
1219
1219
|
l.value.trim() === "" && (l.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1220
1220
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1221
|
-
var
|
|
1222
|
-
(
|
|
1221
|
+
var a;
|
|
1222
|
+
(a = this.colorInputEl) == null || a.click();
|
|
1223
1223
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1224
1224
|
const s = document.createElement("div");
|
|
1225
1225
|
s.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
|
|
@@ -1227,16 +1227,16 @@ class F extends x {
|
|
|
1227
1227
|
`${this.getDataPropsPath()}_opacity`
|
|
1228
1228
|
);
|
|
1229
1229
|
const n = document.createElement("span");
|
|
1230
|
-
n.className = "color-with-opacity-opacity-suffix", n.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
1231
|
-
const l =
|
|
1230
|
+
n.className = "color-with-opacity-opacity-suffix", n.textContent = "%", this.opacityInputEl.addEventListener("input", (a) => {
|
|
1231
|
+
const l = a.target, r = parseFloat(l.value);
|
|
1232
1232
|
isNaN(r) || (this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1233
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1234
|
-
const l =
|
|
1233
|
+
}), this.opacityInputEl.addEventListener("blur", (a) => {
|
|
1234
|
+
const l = a.target;
|
|
1235
1235
|
let r = parseFloat(l.value);
|
|
1236
1236
|
isNaN(r) && (r = this.getOpacityPercent()), r = Math.max(0, Math.min(100, r)), l.value = r.toString(), this.handleOpacityChange(r), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1237
1237
|
}), s.appendChild(this.opacityInputEl), s.appendChild(n);
|
|
1238
|
-
const
|
|
1239
|
-
return
|
|
1238
|
+
const o = document.createElement("div");
|
|
1239
|
+
return o.className = "color-with-opacity-controls-wrapper", o.appendChild(e), o.appendChild(s), t.appendChild(o), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
1240
1240
|
}
|
|
1241
1241
|
getElement() {
|
|
1242
1242
|
return this.element;
|
|
@@ -1246,8 +1246,8 @@ class F extends x {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
getRgbaValue() {
|
|
1248
1248
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
1249
|
-
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),
|
|
1250
|
-
return `rgba(${s}, ${n}, ${
|
|
1249
|
+
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);
|
|
1250
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1251
1251
|
}
|
|
1252
1252
|
getColorAndOpacity() {
|
|
1253
1253
|
return {
|
|
@@ -1256,7 +1256,7 @@ class F extends x {
|
|
|
1256
1256
|
};
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
|
-
class
|
|
1259
|
+
class Ee extends x {
|
|
1260
1260
|
constructor(t = {}) {
|
|
1261
1261
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1262
1262
|
}
|
|
@@ -1268,20 +1268,20 @@ class ge extends x {
|
|
|
1268
1268
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1269
1269
|
const n = document.createElement("div");
|
|
1270
1270
|
if (n.className = "icon-container", this.props.icon) {
|
|
1271
|
-
const
|
|
1272
|
-
n.appendChild(
|
|
1271
|
+
const o = this.createIcon(this.props.icon);
|
|
1272
|
+
n.appendChild(o);
|
|
1273
1273
|
}
|
|
1274
1274
|
if (this.props.title) {
|
|
1275
|
-
const
|
|
1276
|
-
n.appendChild(
|
|
1275
|
+
const o = this.createLabel(this.props.title);
|
|
1276
|
+
n.appendChild(o);
|
|
1277
1277
|
}
|
|
1278
1278
|
t.appendChild(n);
|
|
1279
1279
|
}
|
|
1280
1280
|
const e = document.createElement("textarea");
|
|
1281
1281
|
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);
|
|
1282
1282
|
const i = (n) => {
|
|
1283
|
-
const
|
|
1284
|
-
this.value =
|
|
1283
|
+
const a = n.target.value;
|
|
1284
|
+
this.value = a, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
1285
1285
|
}, s = (n) => {
|
|
1286
1286
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
1287
1287
|
};
|
|
@@ -1311,12 +1311,12 @@ class P extends x {
|
|
|
1311
1311
|
const i = document.createElement("input");
|
|
1312
1312
|
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", () => {
|
|
1313
1313
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1314
|
-
let
|
|
1315
|
-
|
|
1314
|
+
let o = Number(i.value);
|
|
1315
|
+
o < s && (o = s), o > n && (o = n), String(o) !== i.value && (i.value = String(o)), this.setValue(o);
|
|
1316
1316
|
}), i.addEventListener("blur", () => {
|
|
1317
|
-
var n,
|
|
1317
|
+
var n, o;
|
|
1318
1318
|
const s = this.validateValue(Number(i.value));
|
|
1319
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
1319
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (o = (n = this.props).onBlur) == null || o.call(n);
|
|
1320
1320
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
1321
1321
|
const s = document.createElement("span");
|
|
1322
1322
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1347,12 +1347,12 @@ class P extends x {
|
|
|
1347
1347
|
);
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
|
-
const
|
|
1350
|
+
const Tt = `
|
|
1351
1351
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1352
1352
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1353
1353
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1354
1354
|
</svg>`;
|
|
1355
|
-
class
|
|
1355
|
+
class Pt extends P {
|
|
1356
1356
|
constructor(t = {}) {
|
|
1357
1357
|
const e = {
|
|
1358
1358
|
title: "Opacity",
|
|
@@ -1361,7 +1361,7 @@ class Vt extends P {
|
|
|
1361
1361
|
maxValue: 100,
|
|
1362
1362
|
step: 1,
|
|
1363
1363
|
default: t.default ?? 100,
|
|
1364
|
-
icon:
|
|
1364
|
+
icon: Tt,
|
|
1365
1365
|
...t
|
|
1366
1366
|
};
|
|
1367
1367
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1373,12 +1373,12 @@ class Vt extends P {
|
|
|
1373
1373
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
const
|
|
1376
|
+
const Ot = `
|
|
1377
1377
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1378
1378
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1379
1379
|
</svg>
|
|
1380
1380
|
`;
|
|
1381
|
-
class
|
|
1381
|
+
class it extends x {
|
|
1382
1382
|
constructor(t = {}) {
|
|
1383
1383
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1384
1384
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1399,12 +1399,12 @@ class et extends x {
|
|
|
1399
1399
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1400
1400
|
const n = document.createElement("div");
|
|
1401
1401
|
if (n.className = "icon-container", this.props.icon) {
|
|
1402
|
-
const
|
|
1403
|
-
n.appendChild(
|
|
1402
|
+
const o = this.createIcon(this.props.icon);
|
|
1403
|
+
n.appendChild(o);
|
|
1404
1404
|
}
|
|
1405
1405
|
if (this.props.title) {
|
|
1406
|
-
const
|
|
1407
|
-
n.appendChild(
|
|
1406
|
+
const o = this.createLabel(this.props.title);
|
|
1407
|
+
n.appendChild(o);
|
|
1408
1408
|
}
|
|
1409
1409
|
t.appendChild(n);
|
|
1410
1410
|
} else {
|
|
@@ -1413,22 +1413,22 @@ class et extends x {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
const e = document.createElement("div");
|
|
1415
1415
|
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 = () => {
|
|
1416
|
-
var n,
|
|
1417
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1416
|
+
var n, o;
|
|
1417
|
+
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));
|
|
1418
1418
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1419
1419
|
const i = document.createElement("ul");
|
|
1420
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1420
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
1421
|
+
const a = this.createOption(n, o);
|
|
1422
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1423
1423
|
}), document.body.appendChild(i);
|
|
1424
1424
|
const s = document.createElement("div");
|
|
1425
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1425
|
+
return s.classList.add("svg-container"), s.innerHTML = Ot, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1426
1426
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1427
1427
|
}).catch((n) => {
|
|
1428
1428
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1429
1429
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1430
|
-
var
|
|
1431
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1430
|
+
var o, a;
|
|
1431
|
+
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());
|
|
1432
1432
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1433
1433
|
this.isOpen && this.checkDropdownPosition();
|
|
1434
1434
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1447,9 +1447,9 @@ class et extends x {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
1449
1449
|
selectOption(t, e, i) {
|
|
1450
|
-
var n,
|
|
1450
|
+
var n, o;
|
|
1451
1451
|
const s = this._options[e];
|
|
1452
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (
|
|
1452
|
+
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) => {
|
|
1453
1453
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1454
1454
|
}));
|
|
1455
1455
|
}
|
|
@@ -1485,7 +1485,7 @@ class et extends x {
|
|
|
1485
1485
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
|
-
class
|
|
1488
|
+
class $t extends x {
|
|
1489
1489
|
constructor(t = {}) {
|
|
1490
1490
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1491
1491
|
}
|
|
@@ -1530,18 +1530,18 @@ class Pt extends x {
|
|
|
1530
1530
|
`
|
|
1531
1531
|
}
|
|
1532
1532
|
].forEach((n) => {
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1533
|
+
const o = document.createElement("button");
|
|
1534
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.getDataPropsPath() && o.setAttribute(
|
|
1535
1535
|
"data-test-id",
|
|
1536
1536
|
`${this.getDataPropsPath()}_${n.name}`
|
|
1537
|
-
), this.value === n.name &&
|
|
1538
|
-
var
|
|
1539
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1540
|
-
}), i.appendChild(
|
|
1537
|
+
), this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
1538
|
+
var a;
|
|
1539
|
+
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);
|
|
1540
|
+
}), i.appendChild(o);
|
|
1541
1541
|
}), t.appendChild(i), t;
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
|
-
class
|
|
1544
|
+
class we extends x {
|
|
1545
1545
|
constructor(t) {
|
|
1546
1546
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1547
1547
|
}
|
|
@@ -1555,22 +1555,22 @@ class me extends x {
|
|
|
1555
1555
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1556
1556
|
);
|
|
1557
1557
|
if (n) {
|
|
1558
|
-
let
|
|
1559
|
-
|
|
1558
|
+
let a = +n[1], l = +n[2], r = +n[3], c = +n[4];
|
|
1559
|
+
c >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : c = Math.min(1, c + 0.12), s = `rgba(${a},${l},${r},${c})`;
|
|
1560
1560
|
}
|
|
1561
1561
|
t.addEventListener("mouseenter", () => {
|
|
1562
1562
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1563
1563
|
}), t.addEventListener("mouseleave", () => {
|
|
1564
1564
|
t.style.setProperty("background-color", e, "important");
|
|
1565
1565
|
}), t.addEventListener("click", () => {
|
|
1566
|
-
var
|
|
1567
|
-
return (l = (
|
|
1566
|
+
var a, l;
|
|
1567
|
+
return (l = (a = this.props).onClick) == null ? void 0 : l.call(a);
|
|
1568
1568
|
});
|
|
1569
|
-
const
|
|
1570
|
-
return
|
|
1569
|
+
const o = document.createElement("div");
|
|
1570
|
+
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
class
|
|
1573
|
+
class xe extends x {
|
|
1574
1574
|
constructor(t = {}) {
|
|
1575
1575
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1576
1576
|
const e = t.width || 0, i = t.height || 0;
|
|
@@ -1583,14 +1583,14 @@ class fe extends x {
|
|
|
1583
1583
|
suffix: "px",
|
|
1584
1584
|
minValue: this.minWidth,
|
|
1585
1585
|
maxValue: this.maxWidth,
|
|
1586
|
-
icon:
|
|
1586
|
+
icon: Ht
|
|
1587
1587
|
}), this.heightSetting = new P({
|
|
1588
1588
|
title: "Height",
|
|
1589
1589
|
default: this.value.height,
|
|
1590
1590
|
suffix: "px",
|
|
1591
1591
|
minValue: this.minHeight,
|
|
1592
1592
|
maxValue: this.maxHeight,
|
|
1593
|
-
icon:
|
|
1593
|
+
icon: Bt
|
|
1594
1594
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1595
1595
|
}
|
|
1596
1596
|
handleWidthChange(t) {
|
|
@@ -1660,8 +1660,8 @@ class fe extends x {
|
|
|
1660
1660
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1661
1661
|
"aria-label",
|
|
1662
1662
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1663
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1664
|
-
|
|
1663
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
1664
|
+
o.preventDefault(), this.toggleLock(n);
|
|
1665
1665
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1666
1666
|
}
|
|
1667
1667
|
isLocked() {
|
|
@@ -1684,24 +1684,24 @@ class fe extends x {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
1686
|
}
|
|
1687
|
-
const
|
|
1687
|
+
const Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1688
1688
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1689
|
-
</svg>`,
|
|
1689
|
+
</svg>`, Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1690
1690
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1691
|
-
</svg>`,
|
|
1691
|
+
</svg>`, tt = `
|
|
1692
1692
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1693
1693
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1694
1694
|
</svg>
|
|
1695
|
-
`,
|
|
1695
|
+
`, At = `
|
|
1696
1696
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1697
1697
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1698
1698
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1699
1699
|
</svg>
|
|
1700
|
-
`,
|
|
1700
|
+
`, Dt = `
|
|
1701
1701
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1702
1702
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1703
1703
|
</svg>
|
|
1704
|
-
`,
|
|
1704
|
+
`, Gt = `
|
|
1705
1705
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1706
1706
|
<!-- Top dot -->
|
|
1707
1707
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1721,7 +1721,7 @@ const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1721
1721
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1722
1722
|
</svg>
|
|
1723
1723
|
`;
|
|
1724
|
-
class
|
|
1724
|
+
class ot extends x {
|
|
1725
1725
|
constructor(t = {}) {
|
|
1726
1726
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1727
1727
|
}
|
|
@@ -1774,18 +1774,18 @@ class nt extends x {
|
|
|
1774
1774
|
);
|
|
1775
1775
|
if (t && t !== "") {
|
|
1776
1776
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1777
|
-
<span class="upload-icon">${
|
|
1777
|
+
<span class="upload-icon">${tt}</span>
|
|
1778
1778
|
<span class="upload-label">Replace</span>
|
|
1779
1779
|
`);
|
|
1780
1780
|
const n = () => {
|
|
1781
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1782
|
-
},
|
|
1783
|
-
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",
|
|
1781
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1782
|
+
}, o = () => {
|
|
1783
|
+
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);
|
|
1784
1784
|
};
|
|
1785
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1785
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1786
1786
|
} else
|
|
1787
1787
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1788
|
-
<span class="upload-icon">${
|
|
1788
|
+
<span class="upload-icon">${tt}</span>
|
|
1789
1789
|
<span class="upload-label">Upload</span>
|
|
1790
1790
|
`);
|
|
1791
1791
|
}
|
|
@@ -1793,24 +1793,24 @@ class nt extends x {
|
|
|
1793
1793
|
const t = document.createElement("div");
|
|
1794
1794
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1795
1795
|
"focusout",
|
|
1796
|
-
(
|
|
1796
|
+
(a) => {
|
|
1797
1797
|
var l;
|
|
1798
|
-
|
|
1798
|
+
a.relatedTarget && t.contains(a.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1799
1799
|
},
|
|
1800
1800
|
!0
|
|
1801
1801
|
);
|
|
1802
1802
|
const e = !!(this.props.title || this.props.icon);
|
|
1803
1803
|
if (e || t.classList.add("no-label"), e) {
|
|
1804
|
-
const
|
|
1805
|
-
if (
|
|
1804
|
+
const a = document.createElement("div");
|
|
1805
|
+
if (a.className = "icon-title-container", this.props.icon) {
|
|
1806
1806
|
const l = this.createIcon(this.props.icon);
|
|
1807
|
-
|
|
1807
|
+
a.appendChild(l);
|
|
1808
1808
|
}
|
|
1809
1809
|
if (this.props.title) {
|
|
1810
1810
|
const l = this.createLabel(this.props.title);
|
|
1811
|
-
|
|
1811
|
+
a.appendChild(l);
|
|
1812
1812
|
}
|
|
1813
|
-
t.appendChild(
|
|
1813
|
+
t.appendChild(a);
|
|
1814
1814
|
}
|
|
1815
1815
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1816
1816
|
const i = document.createElement("div");
|
|
@@ -1818,19 +1818,19 @@ class nt extends x {
|
|
|
1818
1818
|
const s = this.value && this.value !== "";
|
|
1819
1819
|
s || i.classList.add("no-image");
|
|
1820
1820
|
const n = document.createElement("div");
|
|
1821
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1821
|
+
if (n.className = "preview-placeholder", n.innerHTML = At, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Gt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1822
|
+
const a = document.createElement("button");
|
|
1823
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Dt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1824
1824
|
var r;
|
|
1825
1825
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1826
1826
|
};
|
|
1827
1827
|
}
|
|
1828
1828
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1829
|
-
const
|
|
1830
|
-
return
|
|
1831
|
-
<span class="upload-icon">${
|
|
1829
|
+
const o = document.createElement("button");
|
|
1830
|
+
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1831
|
+
<span class="upload-icon">${tt}</span>
|
|
1832
1832
|
<span class="upload-label">Upload</span>
|
|
1833
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1833
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1834
1834
|
window.postMessage(
|
|
1835
1835
|
{
|
|
1836
1836
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1841,14 +1841,428 @@ class nt extends x {
|
|
|
1841
1841
|
}, t;
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
|
|
1844
|
+
const at = (h, t, e) => {
|
|
1845
|
+
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
1846
|
+
const l = (d) => {
|
|
1847
|
+
if (d.target.closest("button")) return;
|
|
1848
|
+
i = !0, s = d.clientX, n = d.clientY;
|
|
1849
|
+
const p = t.getBoundingClientRect();
|
|
1850
|
+
o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
|
|
1851
|
+
}, r = (d) => {
|
|
1852
|
+
if (!i) return;
|
|
1853
|
+
const p = d.clientX - s, g = d.clientY - n, f = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, v = t.offsetHeight;
|
|
1854
|
+
let C = o + p, y = a + g;
|
|
1855
|
+
C = Math.max(8, Math.min(f - u - 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);
|
|
1856
|
+
}, c = () => {
|
|
1857
|
+
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
|
|
1858
|
+
};
|
|
1859
|
+
h.addEventListener("mousedown", l);
|
|
1860
|
+
}, Rt = `
|
|
1861
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1862
|
+
<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"/>
|
|
1863
|
+
</svg>
|
|
1864
|
+
`, Ft = `
|
|
1865
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
1866
|
+
<path d="M12 4L4 12M4 4L12 12" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1867
|
+
</svg>
|
|
1868
|
+
`, zt = `
|
|
1869
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
1870
|
+
<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"/>
|
|
1871
|
+
</svg>
|
|
1872
|
+
`, Ut = `
|
|
1873
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
1874
|
+
<path d="M4.66667 3.5H9.91667C11.5275 3.5 12.8333 4.80584 12.8333 6.41667C12.8333 8.0275 11.5275 9.33333 9.91667 9.33333H3.5M3.5 9.33333L5.83333 7M3.5 9.33333L5.83333 11.6667" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1875
|
+
</svg>
|
|
1876
|
+
`, Wt = `
|
|
1877
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
1878
|
+
<path d="M9.33333 3.5H4.08333C2.47249 3.5 1.16667 4.80584 1.16667 6.41667C1.16667 8.0275 2.47249 9.33333 4.08333 9.33333H10.5M10.5 9.33333L8.16667 7M10.5 9.33333L8.16667 11.6667" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1879
|
+
</svg>
|
|
1880
|
+
`, $ = class $ extends x {
|
|
1881
|
+
constructor(t = {}) {
|
|
1882
|
+
super(t), this.inputType = {
|
|
1883
|
+
imageUrl: "text",
|
|
1884
|
+
markers: "text"
|
|
1885
|
+
}, this.mainButton = null, this.thumbnailEl = null, this.markerCountEl = null, this.popoverEl = null, this.backdropEl = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.draggingMarkerId = null, this.history = [], this.historyIndex = -1, this.isUndoRedoOperation = !1, this.initialValue = null, this.props.maxMarkers = this.props.maxMarkers ?? 10, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? 5, this.props.markerSize = this.props.markerSize ?? 24, this.value || (this.value = { imageUrl: "", markers: [] }), this.onBackgroundClick = (e) => {
|
|
1886
|
+
this.isPopoverOpen && this.popoverEl && !this.popoverEl.contains(e.target) && this.closePopover();
|
|
1887
|
+
}, this.handlePopoverKeydown = (e) => {
|
|
1888
|
+
this.isPopoverOpen && (e.key === "Escape" ? this.closePopover() : (e.ctrlKey || e.metaKey) && (e.key === "z" || e.key === "Z" ? e.shiftKey ? (e.preventDefault(), this.redo()) : (e.preventDefault(), this.undo()) : (e.key === "y" || e.key === "Y") && (e.preventDefault(), this.redo())));
|
|
1889
|
+
}, this.boundHandleMarkerDrag = this.handleMarkerDrag.bind(this), this.boundStopDragging = this.stopDragging.bind(this);
|
|
1890
|
+
}
|
|
1891
|
+
draw() {
|
|
1892
|
+
const t = document.createElement("div");
|
|
1893
|
+
if (t.className = "image-map-setting-wrapper", this.props.title || this.props.icon) {
|
|
1894
|
+
const e = document.createElement("div");
|
|
1895
|
+
if (e.className = "icon-container", this.props.icon) {
|
|
1896
|
+
const i = this.createIcon(this.props.icon);
|
|
1897
|
+
e.appendChild(i);
|
|
1898
|
+
}
|
|
1899
|
+
if (this.props.title) {
|
|
1900
|
+
const i = this.createLabel(this.props.title);
|
|
1901
|
+
e.appendChild(i);
|
|
1902
|
+
}
|
|
1903
|
+
t.appendChild(e);
|
|
1904
|
+
}
|
|
1905
|
+
return this.mainButton = document.createElement("button"), this.mainButton.type = "button", this.mainButton.className = "image-map-button", this.thumbnailEl = document.createElement("img"), this.thumbnailEl.className = "image-map-thumbnail", this.mainButton.appendChild(this.thumbnailEl), this.markerCountEl = document.createElement("span"), this.markerCountEl.className = "image-map-marker-count", this.mainButton.appendChild(this.markerCountEl), this.mainButton.addEventListener("click", () => this.openPopover()), t.appendChild(this.mainButton), this.createPopover(), this.updateButtonDisplay(), t;
|
|
1906
|
+
}
|
|
1907
|
+
updateButtonDisplay() {
|
|
1908
|
+
if (!this.mainButton || !this.thumbnailEl || !this.markerCountEl) return;
|
|
1909
|
+
if (this.value && this.value.imageUrl && this.value.imageUrl !== "") {
|
|
1910
|
+
this.mainButton.classList.add("has-image"), this.thumbnailEl.src = this.value.imageUrl;
|
|
1911
|
+
const e = this.value.markers.length;
|
|
1912
|
+
this.markerCountEl.textContent = `${e} marker${e !== 1 ? "s" : ""}`;
|
|
1913
|
+
} else
|
|
1914
|
+
this.mainButton.classList.remove("has-image"), this.thumbnailEl.src = "", this.markerCountEl.textContent = "Add Image Map";
|
|
1915
|
+
}
|
|
1916
|
+
createPopover() {
|
|
1917
|
+
this.backdropEl = document.createElement("div"), this.backdropEl.className = "image-map-backdrop", this.backdropEl.style.display = "none", this.popoverEl = document.createElement("div"), this.popoverEl.className = "image-map-popover", this.popoverEl.style.display = "none";
|
|
1918
|
+
const t = document.createElement("div");
|
|
1919
|
+
t.className = "image-map-header", t.style.cursor = "move";
|
|
1920
|
+
const e = document.createElement("h3");
|
|
1921
|
+
e.className = "image-map-title", e.textContent = "Configure Image Map", t.appendChild(e);
|
|
1922
|
+
const i = document.createElement("button");
|
|
1923
|
+
i.type = "button", i.className = "image-map-close-btn", i.innerHTML = Ft, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), at(t, this.popoverEl, (n, o) => {
|
|
1924
|
+
this.popoverPosition = { left: n, top: o };
|
|
1925
|
+
}), this.popoverEl.appendChild(t);
|
|
1926
|
+
const s = document.createElement("div");
|
|
1927
|
+
s.className = "image-map-content", this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
1928
|
+
}
|
|
1929
|
+
openPopover() {
|
|
1930
|
+
$.openInstance && $.openInstance !== this && $.openInstance.closePopover(), this.isPopoverOpen = !0, $.openInstance = this, this.value ? this.initialValue = JSON.parse(JSON.stringify(this.value)) : this.initialValue = { imageUrl: "", markers: [] }, this.value && (this.history = [JSON.parse(JSON.stringify(this.value.markers))], this.historyIndex = 0), this.backdropEl && (this.backdropEl.style.display = "block"), this.popoverEl && (this.popoverEl.style.display = "flex"), this.positionPopover(), this.refreshPopoverContent(), setTimeout(() => {
|
|
1931
|
+
document.addEventListener("click", this.onBackgroundClick, !0);
|
|
1932
|
+
}, 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
1933
|
+
}
|
|
1934
|
+
hasAllMarkers() {
|
|
1935
|
+
if (!this.value) return !1;
|
|
1936
|
+
const t = this.props.maxMarkers || 10;
|
|
1937
|
+
return this.value.markers.length === t;
|
|
1938
|
+
}
|
|
1939
|
+
hasChanges() {
|
|
1940
|
+
return !this.initialValue || !this.value ? !1 : JSON.stringify(this.initialValue.markers) !== JSON.stringify(this.value.markers);
|
|
1941
|
+
}
|
|
1942
|
+
closePopover(t = !1) {
|
|
1943
|
+
if (!t && this.hasChanges() && !this.hasAllMarkers()) {
|
|
1944
|
+
if (!window.confirm(
|
|
1945
|
+
"You haven't placed all markers. Closing will discard your changes. Do you want to continue?"
|
|
1946
|
+
))
|
|
1947
|
+
return;
|
|
1948
|
+
this.initialValue && (this.value = JSON.parse(JSON.stringify(this.initialValue)), this.updateButtonDisplay(), this.triggerChange());
|
|
1949
|
+
}
|
|
1950
|
+
this.isPopoverOpen = !1, this.draggingMarkerId = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl && (this.popoverEl.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), $.openInstance === this && ($.openInstance = null);
|
|
1951
|
+
}
|
|
1952
|
+
positionPopover() {
|
|
1953
|
+
if (!this.popoverEl || !this.mainButton) return;
|
|
1954
|
+
const t = this.mainButton.getBoundingClientRect(), e = 800, i = Math.min(window.innerHeight * 0.8, 700);
|
|
1955
|
+
let s = t.right + 8, n = t.top;
|
|
1956
|
+
const o = window.innerWidth - t.right;
|
|
1957
|
+
o < e + 16 && t.left > o + 100 && (s = t.left - e - 8), s = Math.max(8, Math.min(s, window.innerWidth - e - 8)), n = Math.max(8, Math.min(n, window.innerHeight - i - 8)), this.popoverEl.style.left = `${s}px`, this.popoverEl.style.top = `${n}px`, this.popoverPosition = { left: s, top: n };
|
|
1958
|
+
}
|
|
1959
|
+
refreshPopoverContent() {
|
|
1960
|
+
if (!this.popoverEl) return;
|
|
1961
|
+
const t = this.popoverEl.querySelector(".image-map-content");
|
|
1962
|
+
if (!t) return;
|
|
1963
|
+
const e = t.querySelector(".image-map-container"), i = (e == null ? void 0 : e.scrollTop) || 0;
|
|
1964
|
+
if (t.innerHTML = "", this.value && this.value.imageUrl && this.value.imageUrl !== "") {
|
|
1965
|
+
const n = document.createElement("div");
|
|
1966
|
+
n.className = "image-map-main-layout";
|
|
1967
|
+
const o = document.createElement("div");
|
|
1968
|
+
o.className = "image-map-image-section", this.renderImageMapSection(o);
|
|
1969
|
+
const a = document.createElement("div");
|
|
1970
|
+
a.className = "image-map-sidebar", this.renderSidebar(a), n.appendChild(o), n.appendChild(a), t.appendChild(n), requestAnimationFrame(() => {
|
|
1971
|
+
const l = o.querySelector(".image-map-container");
|
|
1972
|
+
l && (l.scrollTop = i);
|
|
1973
|
+
});
|
|
1974
|
+
} else
|
|
1975
|
+
this.renderUploadSection(t);
|
|
1976
|
+
}
|
|
1977
|
+
renderUploadSection(t) {
|
|
1978
|
+
const e = document.createElement("div");
|
|
1979
|
+
e.className = "upload-section";
|
|
1980
|
+
const i = document.createElement("label");
|
|
1981
|
+
i.className = "upload-label", i.innerHTML = `
|
|
1982
|
+
<div class="upload-placeholder">
|
|
1983
|
+
${Rt}
|
|
1984
|
+
<span>Click to upload image</span>
|
|
1985
|
+
</div>
|
|
1986
|
+
`;
|
|
1987
|
+
const s = document.createElement("input");
|
|
1988
|
+
s.type = "file", s.accept = "image/*", s.style.display = "none", s.addEventListener("change", (n) => {
|
|
1989
|
+
var a;
|
|
1990
|
+
const o = (a = n.target.files) == null ? void 0 : a[0];
|
|
1991
|
+
o && this.handleImageUpload(o);
|
|
1992
|
+
}), i.appendChild(s), e.appendChild(i), t.appendChild(e);
|
|
1993
|
+
}
|
|
1994
|
+
renderImageMapSection(t) {
|
|
1995
|
+
const e = document.createElement("div");
|
|
1996
|
+
e.className = "image-map-actions";
|
|
1997
|
+
const i = document.createElement("div");
|
|
1998
|
+
i.className = "undo-redo-group";
|
|
1999
|
+
const s = document.createElement("button");
|
|
2000
|
+
s.type = "button", s.className = "undo-btn action-btn", s.innerHTML = Ut, s.title = "Undo (Ctrl+Z)", s.disabled = !this.canUndo(), s.addEventListener("click", () => this.undo()), i.appendChild(s);
|
|
2001
|
+
const n = document.createElement("button");
|
|
2002
|
+
n.type = "button", n.className = "redo-btn action-btn", n.innerHTML = Wt, n.title = "Redo (Ctrl+Y)", n.disabled = !this.canRedo(), n.addEventListener("click", () => this.redo()), i.appendChild(n), e.appendChild(i);
|
|
2003
|
+
const o = document.createElement("button");
|
|
2004
|
+
o.type = "button", o.className = "clear-all-btn", o.textContent = "Clear All Markers", o.addEventListener("click", () => this.handleClearAllMarkers()), e.appendChild(o), t.appendChild(e);
|
|
2005
|
+
const a = document.createElement("div");
|
|
2006
|
+
a.className = "image-map-container";
|
|
2007
|
+
const l = document.createElement("div");
|
|
2008
|
+
l.className = "image-map-wrapper", l.addEventListener("mousemove", this.boundHandleMarkerDrag), l.addEventListener("mouseup", this.boundStopDragging), l.addEventListener("mouseleave", this.boundStopDragging), this.imageElement = document.createElement("img"), this.imageElement.className = "image-map-image", this.imageElement.src = this.value.imageUrl, this.imageElement.addEventListener("click", (r) => this.handleImageClick(r)), l.appendChild(this.imageElement), this.cursorTooltip = document.createElement("div"), this.cursorTooltip.className = "marker-cursor-tooltip", l.appendChild(this.cursorTooltip), this.imageElement.addEventListener("mouseenter", () => this.showCursorTooltip()), this.imageElement.addEventListener("mouseleave", () => this.hideCursorTooltip()), this.imageElement.addEventListener("mousemove", (r) => this.updateCursorTooltip(r)), this.value && this.value.markers && this.value.markers.forEach((r) => {
|
|
2009
|
+
const c = this.createMarkerElement(r);
|
|
2010
|
+
l.appendChild(c);
|
|
2011
|
+
}), a.appendChild(l), t.appendChild(a);
|
|
2012
|
+
}
|
|
2013
|
+
renderSidebar(t) {
|
|
2014
|
+
var l;
|
|
2015
|
+
const e = document.createElement("div");
|
|
2016
|
+
e.className = "prize-counter";
|
|
2017
|
+
const i = this.props.maxMarkers || 10, s = ((l = this.value) == null ? void 0 : l.markers.length) || 0, n = s === i;
|
|
2018
|
+
e.textContent = `Prizes ${s}/${i}`, n && e.classList.add("complete"), t.appendChild(e);
|
|
2019
|
+
const o = document.createElement("div");
|
|
2020
|
+
if (o.className = "prize-list", this.value && this.value.markers.length > 0)
|
|
2021
|
+
[...this.value.markers].sort((c, d) => c.index - d.index).forEach((c) => {
|
|
2022
|
+
const d = document.createElement("div");
|
|
2023
|
+
d.className = "prize-item";
|
|
2024
|
+
const p = document.createElement("div");
|
|
2025
|
+
p.className = "prize-label", c.prizeName ? p.textContent = `Prize #${c.index}, ${c.prizeName}` : p.textContent = `Prize #${c.index}`, d.appendChild(p), o.appendChild(d);
|
|
2026
|
+
});
|
|
2027
|
+
else {
|
|
2028
|
+
const r = document.createElement("div");
|
|
2029
|
+
r.className = "prize-list-empty", r.textContent = "No prizes added yet. Click on the image to add prizes.", o.appendChild(r);
|
|
2030
|
+
}
|
|
2031
|
+
t.appendChild(o);
|
|
2032
|
+
const a = document.createElement("button");
|
|
2033
|
+
a.type = "button", a.className = "sidebar-save-btn", a.textContent = "Save", n ? a.title = "Save and close" : (a.disabled = !0, a.title = `Add ${i - s} more prize(s) to save`), a.addEventListener("click", () => {
|
|
2034
|
+
n && (this.triggerChange(), this.closePopover(!0));
|
|
2035
|
+
}), t.appendChild(a);
|
|
2036
|
+
}
|
|
2037
|
+
createMarkerElement(t) {
|
|
2038
|
+
const e = document.createElement("div");
|
|
2039
|
+
e.className = "marker-container", e.style.left = `${t.x}%`, e.style.top = `${t.y}%`, e.setAttribute("data-marker-id", String(t.id));
|
|
2040
|
+
const i = document.createElement("div");
|
|
2041
|
+
i.className = "image-map-marker";
|
|
2042
|
+
const s = document.createElement("span");
|
|
2043
|
+
s.className = "marker-number", s.textContent = String(t.index), i.appendChild(s);
|
|
2044
|
+
const n = document.createElement("button");
|
|
2045
|
+
n.type = "button", n.className = "marker-delete-btn", n.innerHTML = zt, n.addEventListener("click", (a) => {
|
|
2046
|
+
a.stopPropagation(), this.handleDeleteMarker(t.id);
|
|
2047
|
+
}), i.appendChild(n), e.appendChild(i);
|
|
2048
|
+
const o = document.createElement("div");
|
|
2049
|
+
return o.className = "marker-label", t.prizeName ? o.textContent = t.prizeName : o.textContent = `Prize ${t.index}`, e.appendChild(o), e.addEventListener("mousedown", (a) => {
|
|
2050
|
+
a.stopPropagation(), a.preventDefault(), this.draggingMarkerId = t.id, e.classList.add("dragging");
|
|
2051
|
+
}), e;
|
|
2052
|
+
}
|
|
2053
|
+
handleImageUpload(t) {
|
|
2054
|
+
if (!["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp"].includes(t.type)) {
|
|
2055
|
+
this.showError("Invalid file type. Please upload a JPEG, PNG, GIF, or WebP image.");
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2058
|
+
const i = (this.props.maxFileSizeMB || 5) * 1024 * 1024;
|
|
2059
|
+
if (t.size > i) {
|
|
2060
|
+
const n = (t.size / 1048576).toFixed(1);
|
|
2061
|
+
this.showError(`File size (${n}MB) exceeds ${this.props.maxFileSizeMB}MB limit.`);
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
const s = new FileReader();
|
|
2065
|
+
s.onload = (n) => {
|
|
2066
|
+
var a;
|
|
2067
|
+
const o = (a = n.target) == null ? void 0 : a.result;
|
|
2068
|
+
typeof o == "string" && (this.value = {
|
|
2069
|
+
imageUrl: o,
|
|
2070
|
+
markers: []
|
|
2071
|
+
// Clear markers on new upload
|
|
2072
|
+
}, this.history = [[]], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange());
|
|
2073
|
+
}, s.onerror = () => {
|
|
2074
|
+
this.showError("Failed to read image file.");
|
|
2075
|
+
}, s.readAsDataURL(t);
|
|
2076
|
+
}
|
|
2077
|
+
handleImageClick(t) {
|
|
2078
|
+
if (this.draggingMarkerId !== null || !this.value || !this.imageElement) return;
|
|
2079
|
+
if (this.value.markers.length >= (this.props.maxMarkers || 10)) {
|
|
2080
|
+
this.showError(`Maximum of ${this.props.maxMarkers || 10} markers allowed.`);
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, d) => c - d);
|
|
2084
|
+
let o = 1;
|
|
2085
|
+
for (const c of n)
|
|
2086
|
+
if (c === o)
|
|
2087
|
+
o++;
|
|
2088
|
+
else
|
|
2089
|
+
break;
|
|
2090
|
+
let a;
|
|
2091
|
+
this.props.prizeMap && this.props.prizeMap.length > 0 && (a = this.props.prizeMap[o - 1]);
|
|
2092
|
+
const l = {
|
|
2093
|
+
id: Date.now(),
|
|
2094
|
+
index: o,
|
|
2095
|
+
x: Math.min(100, Math.max(0, i)),
|
|
2096
|
+
y: Math.min(100, Math.max(0, s)),
|
|
2097
|
+
prizeName: a
|
|
2098
|
+
}, r = [...this.value.markers, l];
|
|
2099
|
+
this.setMarkers(r), this.saveState(), this.refreshPopoverContent(), this.updateButtonDisplay(), this.triggerChange();
|
|
2100
|
+
}
|
|
2101
|
+
handleMarkerDrag(t) {
|
|
2102
|
+
var r;
|
|
2103
|
+
if (this.draggingMarkerId === null || !this.imageElement || !this.value) return;
|
|
2104
|
+
const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = Math.min(100, Math.max(0, i)), o = Math.min(100, Math.max(0, s)), a = this.value.markers.map(
|
|
2105
|
+
(c) => c.id === this.draggingMarkerId ? { ...c, x: n, y: o } : c
|
|
2106
|
+
), l = (r = this.popoverEl) == null ? void 0 : r.querySelector(
|
|
2107
|
+
`[data-marker-id="${this.draggingMarkerId}"]`
|
|
2108
|
+
);
|
|
2109
|
+
l && (l.style.left = `${n}%`, l.style.top = `${o}%`), this.setMarkers(a);
|
|
2110
|
+
}
|
|
2111
|
+
stopDragging() {
|
|
2112
|
+
var t;
|
|
2113
|
+
if (this.draggingMarkerId !== null) {
|
|
2114
|
+
const e = (t = this.popoverEl) == null ? void 0 : t.querySelector(
|
|
2115
|
+
`[data-marker-id="${this.draggingMarkerId}"]`
|
|
2116
|
+
);
|
|
2117
|
+
e == null || e.classList.remove("dragging"), this.draggingMarkerId = null, this.saveState(), this.triggerChange();
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
handleDeleteMarker(t) {
|
|
2121
|
+
if (!this.value || this.value.markers.findIndex((s) => s.id === t) === -1) return;
|
|
2122
|
+
const i = this.value.markers.filter((s) => s.id !== t);
|
|
2123
|
+
this.setMarkers(i), this.saveState(), this.refreshPopoverContent(), this.updateButtonDisplay(), this.triggerChange();
|
|
2124
|
+
}
|
|
2125
|
+
handleClearAllMarkers() {
|
|
2126
|
+
this.value && (this.setMarkers([]), this.saveState(), this.refreshPopoverContent(), this.updateButtonDisplay(), this.triggerChange());
|
|
2127
|
+
}
|
|
2128
|
+
getNextPrizeInfo() {
|
|
2129
|
+
if (!this.value) return { index: 1, name: "Prize 1" };
|
|
2130
|
+
const t = this.value.markers.map((s) => s.index).sort((s, n) => s - n);
|
|
2131
|
+
let e = 1;
|
|
2132
|
+
for (const s of t)
|
|
2133
|
+
if (s === e)
|
|
2134
|
+
e++;
|
|
2135
|
+
else
|
|
2136
|
+
break;
|
|
2137
|
+
let i = `Prize ${e}`;
|
|
2138
|
+
if (this.props.prizeMap && this.props.prizeMap.length > 0) {
|
|
2139
|
+
const s = this.props.prizeMap[e - 1];
|
|
2140
|
+
s && (i = s);
|
|
2141
|
+
}
|
|
2142
|
+
return { index: e, name: i };
|
|
2143
|
+
}
|
|
2144
|
+
showCursorTooltip() {
|
|
2145
|
+
if (!this.cursorTooltip || !this.value || this.value.markers.length >= (this.props.maxMarkers || 10))
|
|
2146
|
+
return;
|
|
2147
|
+
const t = this.getNextPrizeInfo();
|
|
2148
|
+
this.cursorTooltip.textContent = `Add: ${t.name}`, this.cursorTooltip.classList.add("visible");
|
|
2149
|
+
}
|
|
2150
|
+
hideCursorTooltip() {
|
|
2151
|
+
this.cursorTooltip && this.cursorTooltip.classList.remove("visible");
|
|
2152
|
+
}
|
|
2153
|
+
updateCursorTooltip(t) {
|
|
2154
|
+
if (!this.cursorTooltip || !this.imageElement) return;
|
|
2155
|
+
const e = this.imageElement.getBoundingClientRect(), i = t.clientX - e.left, s = t.clientY - e.top;
|
|
2156
|
+
this.cursorTooltip.style.left = `${i}px`, this.cursorTooltip.style.top = `${s}px`;
|
|
2157
|
+
}
|
|
2158
|
+
saveState() {
|
|
2159
|
+
if (this.isUndoRedoOperation || !this.value) return;
|
|
2160
|
+
const t = JSON.parse(JSON.stringify(this.value.markers));
|
|
2161
|
+
if (this.historyIndex >= 0 && this.history.length > 0) {
|
|
2162
|
+
const e = this.history[this.historyIndex];
|
|
2163
|
+
if (JSON.stringify(e) === JSON.stringify(t))
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
this.history = this.history.slice(0, this.historyIndex + 1), this.history.push(t), this.historyIndex++, this.history.length > 50 && (this.history.shift(), this.historyIndex--), this.updateUndoRedoButtons();
|
|
2167
|
+
}
|
|
2168
|
+
canUndo() {
|
|
2169
|
+
return this.historyIndex > 0;
|
|
2170
|
+
}
|
|
2171
|
+
canRedo() {
|
|
2172
|
+
return this.historyIndex < this.history.length - 1;
|
|
2173
|
+
}
|
|
2174
|
+
undo() {
|
|
2175
|
+
if (!this.canUndo() || !this.value) return;
|
|
2176
|
+
this.historyIndex--, this.isUndoRedoOperation = !0;
|
|
2177
|
+
const t = JSON.parse(
|
|
2178
|
+
JSON.stringify(this.history[this.historyIndex])
|
|
2179
|
+
);
|
|
2180
|
+
this.setMarkers(t), this.refreshPopoverContent(), this.updateButtonDisplay(), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons();
|
|
2181
|
+
}
|
|
2182
|
+
redo() {
|
|
2183
|
+
if (!this.canRedo() || !this.value) return;
|
|
2184
|
+
this.historyIndex++, this.isUndoRedoOperation = !0;
|
|
2185
|
+
const t = JSON.parse(
|
|
2186
|
+
JSON.stringify(this.history[this.historyIndex])
|
|
2187
|
+
);
|
|
2188
|
+
this.setMarkers(t), this.refreshPopoverContent(), this.updateButtonDisplay(), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons();
|
|
2189
|
+
}
|
|
2190
|
+
updateUndoRedoButtons() {
|
|
2191
|
+
if (!this.popoverEl) return;
|
|
2192
|
+
const t = this.popoverEl.querySelector(".undo-btn"), e = this.popoverEl.querySelector(".redo-btn");
|
|
2193
|
+
t && (t.disabled = !this.canUndo()), e && (e.disabled = !this.canRedo());
|
|
2194
|
+
}
|
|
2195
|
+
showError(t) {
|
|
2196
|
+
const e = document.createElement("div");
|
|
2197
|
+
if (e.className = "image-map-error-toast", e.textContent = t, e.style.cssText = `
|
|
2198
|
+
position: fixed;
|
|
2199
|
+
top: 20px;
|
|
2200
|
+
right: 20px;
|
|
2201
|
+
background-color: #ef4444;
|
|
2202
|
+
color: white;
|
|
2203
|
+
padding: 12px 16px;
|
|
2204
|
+
border-radius: 8px;
|
|
2205
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
2206
|
+
z-index: 10000;
|
|
2207
|
+
max-width: 350px;
|
|
2208
|
+
font-size: 14px;
|
|
2209
|
+
animation: slideIn 0.3s ease-out;
|
|
2210
|
+
`, !document.getElementById("image-map-toast-styles")) {
|
|
2211
|
+
const i = document.createElement("style");
|
|
2212
|
+
i.id = "image-map-toast-styles", i.textContent = `
|
|
2213
|
+
@keyframes slideIn {
|
|
2214
|
+
from {
|
|
2215
|
+
transform: translateX(400px);
|
|
2216
|
+
opacity: 0;
|
|
2217
|
+
}
|
|
2218
|
+
to {
|
|
2219
|
+
transform: translateX(0);
|
|
2220
|
+
opacity: 1;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
@keyframes slideOut {
|
|
2224
|
+
from {
|
|
2225
|
+
transform: translateX(0);
|
|
2226
|
+
opacity: 1;
|
|
2227
|
+
}
|
|
2228
|
+
to {
|
|
2229
|
+
transform: translateX(400px);
|
|
2230
|
+
opacity: 0;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
`, document.head.appendChild(i);
|
|
2234
|
+
}
|
|
2235
|
+
document.body.appendChild(e), setTimeout(() => {
|
|
2236
|
+
e.style.animation = "slideOut 0.3s ease-out", setTimeout(() => {
|
|
2237
|
+
e.parentElement && e.parentElement.removeChild(e);
|
|
2238
|
+
}, 300);
|
|
2239
|
+
}, 5e3);
|
|
2240
|
+
}
|
|
2241
|
+
setMarkers(t) {
|
|
2242
|
+
const e = t.map((i) => ({ ...i }));
|
|
2243
|
+
this.value = {
|
|
2244
|
+
...this.value || { imageUrl: "", markers: [] },
|
|
2245
|
+
markers: e
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
triggerChange() {
|
|
2249
|
+
this.value && (this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value));
|
|
2250
|
+
}
|
|
2251
|
+
destroy() {
|
|
2252
|
+
var t, e;
|
|
2253
|
+
this.closePopover(), (t = this.backdropEl) != null && t.parentElement && this.backdropEl.parentElement.removeChild(this.backdropEl), (e = this.popoverEl) != null && e.parentElement && this.popoverEl.parentElement.removeChild(this.popoverEl), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0);
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
$.openInstance = null;
|
|
2257
|
+
let ht = $;
|
|
2258
|
+
class jt extends P {
|
|
1845
2259
|
constructor(t = {}) {
|
|
1846
2260
|
super({
|
|
1847
2261
|
...t,
|
|
1848
2262
|
title: t.title || "Height",
|
|
1849
2263
|
suffix: t.suffix || "px",
|
|
1850
2264
|
minValue: t.minValue ?? 0,
|
|
1851
|
-
icon: t.icon ||
|
|
2265
|
+
icon: t.icon || qt,
|
|
1852
2266
|
default: t.default ?? 100
|
|
1853
2267
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1854
2268
|
}
|
|
@@ -1859,17 +2273,17 @@ class Gt extends P {
|
|
|
1859
2273
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1860
2274
|
}
|
|
1861
2275
|
}
|
|
1862
|
-
const
|
|
2276
|
+
const qt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1863
2277
|
<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"/>
|
|
1864
2278
|
</svg>`;
|
|
1865
|
-
class
|
|
2279
|
+
class Jt extends P {
|
|
1866
2280
|
constructor(t = {}) {
|
|
1867
2281
|
super({
|
|
1868
2282
|
...t,
|
|
1869
2283
|
title: t.title || "Width",
|
|
1870
2284
|
suffix: t.suffix || "px",
|
|
1871
2285
|
minValue: t.minValue ?? 0,
|
|
1872
|
-
icon: t.icon ||
|
|
2286
|
+
icon: t.icon || _t,
|
|
1873
2287
|
default: t.default ?? 100
|
|
1874
2288
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1875
2289
|
}
|
|
@@ -1880,14 +2294,14 @@ class Ft extends P {
|
|
|
1880
2294
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1881
2295
|
}
|
|
1882
2296
|
}
|
|
1883
|
-
const
|
|
2297
|
+
const _t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1884
2298
|
<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"/>
|
|
1885
|
-
</svg>`,
|
|
2299
|
+
</svg>`, Xt = `
|
|
1886
2300
|
<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">
|
|
1887
2301
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1888
2302
|
</svg>
|
|
1889
2303
|
`;
|
|
1890
|
-
class
|
|
2304
|
+
class Le extends x {
|
|
1891
2305
|
constructor(t = {}) {
|
|
1892
2306
|
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) {
|
|
1893
2307
|
const e = this._options.findIndex(
|
|
@@ -1914,44 +2328,44 @@ class ve extends x {
|
|
|
1914
2328
|
e.classList.add("has-label");
|
|
1915
2329
|
const n = document.createElement("div");
|
|
1916
2330
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1917
|
-
const
|
|
1918
|
-
if (
|
|
1919
|
-
|
|
2331
|
+
const o = document.createElement("span");
|
|
2332
|
+
if (o.className = "select-value", this.isLoading)
|
|
2333
|
+
o.textContent = this.props.loadingText || "Loading options...";
|
|
1920
2334
|
else {
|
|
1921
|
-
const
|
|
1922
|
-
|
|
2335
|
+
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";
|
|
2336
|
+
o.textContent = l;
|
|
1923
2337
|
}
|
|
1924
|
-
e.appendChild(
|
|
2338
|
+
e.appendChild(o);
|
|
1925
2339
|
} else {
|
|
1926
2340
|
const n = document.createElement("span");
|
|
1927
2341
|
if (this.isLoading)
|
|
1928
2342
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1929
2343
|
else {
|
|
1930
|
-
const
|
|
1931
|
-
n.textContent =
|
|
2344
|
+
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";
|
|
2345
|
+
n.textContent = a;
|
|
1932
2346
|
}
|
|
1933
2347
|
e.appendChild(n);
|
|
1934
2348
|
}
|
|
1935
2349
|
e.onclick = () => {
|
|
1936
|
-
var n,
|
|
1937
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
2350
|
+
var n, o;
|
|
2351
|
+
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));
|
|
1938
2352
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1939
2353
|
const i = document.createElement("ul");
|
|
1940
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1941
|
-
const
|
|
1942
|
-
|
|
2354
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
2355
|
+
const a = this.createOption(n, o);
|
|
2356
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1943
2357
|
}), t.appendChild(i);
|
|
1944
2358
|
const s = document.createElement("div");
|
|
1945
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1946
|
-
var n,
|
|
1947
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
2359
|
+
return s.classList.add("svg-container"), s.innerHTML = Xt, t.appendChild(s), s.onclick = () => {
|
|
2360
|
+
var n, o;
|
|
2361
|
+
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));
|
|
1948
2362
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1949
|
-
const
|
|
2363
|
+
const o = new Set(
|
|
1950
2364
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1951
|
-
),
|
|
1952
|
-
(l) => !
|
|
2365
|
+
), a = n.filter(
|
|
2366
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1953
2367
|
);
|
|
1954
|
-
if (this._options.push(...
|
|
2368
|
+
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1955
2369
|
const l = this._options.findIndex(
|
|
1956
2370
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1957
2371
|
);
|
|
@@ -1965,12 +2379,12 @@ class ve extends x {
|
|
|
1965
2379
|
!0
|
|
1966
2380
|
);
|
|
1967
2381
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1968
|
-
const
|
|
2382
|
+
const o = new Set(
|
|
1969
2383
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1970
|
-
),
|
|
1971
|
-
(l) => !
|
|
2384
|
+
), a = n.filter(
|
|
2385
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1972
2386
|
);
|
|
1973
|
-
if (this._options.push(...
|
|
2387
|
+
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1974
2388
|
const l = this._options.findIndex(
|
|
1975
2389
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1976
2390
|
);
|
|
@@ -1989,11 +2403,11 @@ class ve extends x {
|
|
|
1989
2403
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1990
2404
|
}
|
|
1991
2405
|
selectApiOption(t, e, i) {
|
|
1992
|
-
var
|
|
1993
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
2406
|
+
var a, l, r;
|
|
2407
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((a = s.closest(".select-api-option")) == null ? void 0 : a.querySelector(".select-api-radio"));
|
|
1994
2408
|
n && (n.checked = !0);
|
|
1995
|
-
const
|
|
1996
|
-
this.setValue(
|
|
2409
|
+
const o = this._options[e].value;
|
|
2410
|
+
this.setValue(o), this.isOpen = !1, (l = this.optionsListEl) == null || l.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open");
|
|
1997
2411
|
}
|
|
1998
2412
|
updateOptionsList() {
|
|
1999
2413
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -2036,13 +2450,13 @@ class ve extends x {
|
|
|
2036
2450
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
2037
2451
|
}
|
|
2038
2452
|
}
|
|
2039
|
-
class
|
|
2453
|
+
class ke extends x {
|
|
2040
2454
|
constructor(t) {
|
|
2041
2455
|
var e, i;
|
|
2042
2456
|
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;
|
|
2043
2457
|
}
|
|
2044
2458
|
draw() {
|
|
2045
|
-
var
|
|
2459
|
+
var o, a;
|
|
2046
2460
|
const t = document.createElement("div");
|
|
2047
2461
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
2048
2462
|
const e = document.createElement("div");
|
|
@@ -2058,20 +2472,20 @@ class Ce extends x {
|
|
|
2058
2472
|
const i = document.createElement("label");
|
|
2059
2473
|
i.className = "toggle-switch";
|
|
2060
2474
|
const s = document.createElement("input");
|
|
2061
|
-
s.type = "checkbox", s.checked = ((
|
|
2062
|
-
var r,
|
|
2063
|
-
const l = ((
|
|
2475
|
+
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", () => {
|
|
2476
|
+
var r, c;
|
|
2477
|
+
const l = ((c = (r = this.props.options) == null ? void 0 : r.find((d) => d.status === s.checked)) == null ? void 0 : c.value) ?? "";
|
|
2064
2478
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
2065
2479
|
});
|
|
2066
2480
|
const n = document.createElement("span");
|
|
2067
2481
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
2068
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
2482
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", c = this.props.inactiveColor || "#ccc";
|
|
2069
2483
|
l.textContent = `
|
|
2070
2484
|
.toggle-switch input:checked + .toggle-slider {
|
|
2071
2485
|
background-color: ${r};
|
|
2072
2486
|
}
|
|
2073
2487
|
.toggle-switch .toggle-slider {
|
|
2074
|
-
background-color: ${
|
|
2488
|
+
background-color: ${c};
|
|
2075
2489
|
}
|
|
2076
2490
|
`, document.head.appendChild(l);
|
|
2077
2491
|
}
|
|
@@ -2086,13 +2500,13 @@ class Ce extends x {
|
|
|
2086
2500
|
this.detectChangeCallback = t;
|
|
2087
2501
|
}
|
|
2088
2502
|
}
|
|
2089
|
-
const
|
|
2503
|
+
const Zt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2090
2504
|
<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"/>
|
|
2091
2505
|
</svg>`;
|
|
2092
|
-
class
|
|
2506
|
+
class Me extends x {
|
|
2093
2507
|
// Store mobile value
|
|
2094
2508
|
constructor(t = {}) {
|
|
2095
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2509
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Zt, 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);
|
|
2096
2510
|
}
|
|
2097
2511
|
draw() {
|
|
2098
2512
|
const t = document.createElement("div");
|
|
@@ -2103,27 +2517,27 @@ class ye extends x {
|
|
|
2103
2517
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
2104
2518
|
const s = document.createElement("span");
|
|
2105
2519
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2520
|
+
const a = document.createElement("span");
|
|
2521
|
+
a.className = "setting-icon", a.innerHTML = this.props.icon, i.insertBefore(a, s);
|
|
2108
2522
|
}
|
|
2109
2523
|
const n = document.createElement("div");
|
|
2110
2524
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
2111
|
-
const
|
|
2112
|
-
return
|
|
2525
|
+
const o = document.createElement("div");
|
|
2526
|
+
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;
|
|
2113
2527
|
}
|
|
2114
2528
|
createGapInput(t, e) {
|
|
2115
2529
|
const i = document.createElement("div");
|
|
2116
2530
|
i.className = "gap-input-wrapper";
|
|
2117
2531
|
const s = document.createElement("input");
|
|
2118
2532
|
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) => {
|
|
2119
|
-
const
|
|
2120
|
-
let
|
|
2121
|
-
|
|
2533
|
+
const o = n.target;
|
|
2534
|
+
let a = parseFloat(o.value);
|
|
2535
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
2122
2536
|
}), s.addEventListener("blur", (n) => {
|
|
2123
2537
|
var l, r;
|
|
2124
|
-
const
|
|
2125
|
-
let
|
|
2126
|
-
|
|
2538
|
+
const o = n.target;
|
|
2539
|
+
let a = parseFloat(o.value);
|
|
2540
|
+
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);
|
|
2127
2541
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
2128
2542
|
const n = document.createElement("span");
|
|
2129
2543
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2143,40 +2557,40 @@ class ye extends x {
|
|
|
2143
2557
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2144
2558
|
}
|
|
2145
2559
|
}
|
|
2146
|
-
const
|
|
2560
|
+
const Kt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2147
2561
|
<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"/>
|
|
2148
2562
|
</svg>`;
|
|
2149
|
-
class
|
|
2563
|
+
class Ie extends P {
|
|
2150
2564
|
constructor(t = {}) {
|
|
2151
2565
|
super({
|
|
2152
2566
|
...t,
|
|
2153
2567
|
minValue: t.minValue ?? 0,
|
|
2154
2568
|
maxValue: t.maxValue ?? 1e3,
|
|
2155
|
-
icon: t.icon ||
|
|
2569
|
+
icon: t.icon || Kt,
|
|
2156
2570
|
title: t.title || "Margin Bottom",
|
|
2157
2571
|
default: t.default ?? 20,
|
|
2158
2572
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2159
2573
|
}), this.inputType = "number";
|
|
2160
2574
|
}
|
|
2161
2575
|
}
|
|
2162
|
-
const
|
|
2576
|
+
const Yt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2163
2577
|
<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"
|
|
2164
2578
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2165
2579
|
</svg>`;
|
|
2166
|
-
class
|
|
2580
|
+
class Ne extends P {
|
|
2167
2581
|
constructor(t = {}) {
|
|
2168
2582
|
super({
|
|
2169
2583
|
...t,
|
|
2170
2584
|
minValue: t.minValue ?? 0,
|
|
2171
2585
|
maxValue: t.maxValue ?? 1e3,
|
|
2172
|
-
icon: t.icon ||
|
|
2586
|
+
icon: t.icon || Yt,
|
|
2173
2587
|
title: t.title || "Margin Top",
|
|
2174
2588
|
default: t.default ?? 20,
|
|
2175
2589
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2176
2590
|
}), this.inputType = "number";
|
|
2177
2591
|
}
|
|
2178
2592
|
}
|
|
2179
|
-
class
|
|
2593
|
+
class Se extends x {
|
|
2180
2594
|
constructor(t) {
|
|
2181
2595
|
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];
|
|
2182
2596
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
@@ -2196,9 +2610,9 @@ class we extends x {
|
|
|
2196
2610
|
return i.font = s, i.measureText(t).width;
|
|
2197
2611
|
}
|
|
2198
2612
|
adaptPlaceholderToSingleLine(t, e) {
|
|
2199
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0,
|
|
2613
|
+
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(
|
|
2200
2614
|
0,
|
|
2201
|
-
t.clientWidth - s - n -
|
|
2615
|
+
t.clientWidth - s - n - o - a
|
|
2202
2616
|
);
|
|
2203
2617
|
if (l <= 0) {
|
|
2204
2618
|
t.placeholder = e;
|
|
@@ -2208,50 +2622,50 @@ class we extends x {
|
|
|
2208
2622
|
t.placeholder = e;
|
|
2209
2623
|
return;
|
|
2210
2624
|
}
|
|
2211
|
-
const
|
|
2212
|
-
let
|
|
2213
|
-
for (;
|
|
2214
|
-
const m = Math.floor((
|
|
2215
|
-
this.measureTextWidth(u, i) <= l ? (g = m,
|
|
2625
|
+
const c = "...";
|
|
2626
|
+
let d = 0, p = e.length, g = 0;
|
|
2627
|
+
for (; d <= p; ) {
|
|
2628
|
+
const m = Math.floor((d + p) / 2), u = e.slice(0, m).trimEnd() + c;
|
|
2629
|
+
this.measureTextWidth(u, i) <= l ? (g = m, d = m + 1) : p = m - 1;
|
|
2216
2630
|
}
|
|
2217
|
-
const
|
|
2218
|
-
t.placeholder =
|
|
2631
|
+
const f = e.slice(0, g).trimEnd() + c;
|
|
2632
|
+
t.placeholder = f;
|
|
2219
2633
|
}
|
|
2220
2634
|
autosizeTextarea(t, e = 3) {
|
|
2221
2635
|
t.style.height = "auto";
|
|
2222
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom),
|
|
2223
|
-
t.style.height = `${l}px`, t.scrollHeight >
|
|
2636
|
+
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);
|
|
2637
|
+
t.style.height = `${l}px`, t.scrollHeight > a ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
2224
2638
|
}
|
|
2225
2639
|
createTextareaRow(t, e) {
|
|
2226
2640
|
const i = document.createElement("div");
|
|
2227
2641
|
i.classList.add("simple-multi-language-row");
|
|
2228
2642
|
const s = document.createElement("label");
|
|
2229
2643
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2230
|
-
const n = new
|
|
2644
|
+
const n = new ot({
|
|
2231
2645
|
defaultUrl: e || "",
|
|
2232
2646
|
title: "",
|
|
2233
2647
|
id: `${this.id}_upload_${t}`
|
|
2234
2648
|
});
|
|
2235
|
-
n.setOnChange((
|
|
2236
|
-
this.updateLanguageValue(t,
|
|
2649
|
+
n.setOnChange((a) => {
|
|
2650
|
+
this.updateLanguageValue(t, a), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(a);
|
|
2237
2651
|
}), this.uploadSettings.set(t, n);
|
|
2238
|
-
const
|
|
2239
|
-
|
|
2652
|
+
const o = n.draw();
|
|
2653
|
+
o.classList.add("simple-language-upload"), i.appendChild(o);
|
|
2240
2654
|
} else {
|
|
2241
2655
|
const n = document.createElement("textarea");
|
|
2242
2656
|
n.id = `textarea-${t}`, n.classList.add("simple-language-textarea"), n.value = e || "", n.rows = 1, n.style.overflowY = "hidden";
|
|
2243
|
-
let
|
|
2244
|
-
|
|
2657
|
+
let o = this.props.placeholder || "Enter text in {language}...";
|
|
2658
|
+
o.includes("{language}") && (o = o.replace(
|
|
2245
2659
|
"{language}",
|
|
2246
2660
|
t.toUpperCase()
|
|
2247
|
-
)), n.setAttribute("data-full-placeholder",
|
|
2661
|
+
)), n.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(n, o), this.getDataPropsPath() && n.setAttribute(
|
|
2248
2662
|
"data-test-id",
|
|
2249
2663
|
`${this.getDataPropsPath()}_${t}`
|
|
2250
2664
|
), n.addEventListener("input", (l) => {
|
|
2251
2665
|
const r = l.target;
|
|
2252
2666
|
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2667
|
+
const c = n.getAttribute("data-full-placeholder") || "";
|
|
2668
|
+
c && this.adaptPlaceholderToSingleLine(n, c);
|
|
2255
2669
|
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2256
2670
|
this.autosizeTextarea(n, 3);
|
|
2257
2671
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
@@ -2273,11 +2687,11 @@ class we extends x {
|
|
|
2273
2687
|
`#textarea-${e}`
|
|
2274
2688
|
);
|
|
2275
2689
|
if (i && (!i.value || i.value.trim() === "")) {
|
|
2276
|
-
const
|
|
2690
|
+
const o = t || ((n = this.props.placeholder) == null ? void 0 : n.replace(
|
|
2277
2691
|
"{language}",
|
|
2278
2692
|
e.toUpperCase()
|
|
2279
2693
|
)) || `Enter text in ${e.toUpperCase()}...`;
|
|
2280
|
-
i.setAttribute("data-full-placeholder",
|
|
2694
|
+
i.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(i, o);
|
|
2281
2695
|
}
|
|
2282
2696
|
});
|
|
2283
2697
|
}
|
|
@@ -2289,17 +2703,17 @@ class we extends x {
|
|
|
2289
2703
|
}
|
|
2290
2704
|
const e = document.createElement("div");
|
|
2291
2705
|
e.classList.add("simple-multi-language-content"), this.props.languages.forEach((s) => {
|
|
2292
|
-
var
|
|
2293
|
-
const n = ((
|
|
2294
|
-
e.appendChild(
|
|
2706
|
+
var a;
|
|
2707
|
+
const n = ((a = this.value) == null ? void 0 : a[s]) || "", o = this.createTextareaRow(s, n);
|
|
2708
|
+
e.appendChild(o);
|
|
2295
2709
|
}), t.appendChild(e), this.container = t;
|
|
2296
2710
|
const i = () => {
|
|
2297
2711
|
if (!this.container) return;
|
|
2298
2712
|
this.container.querySelectorAll(
|
|
2299
2713
|
".simple-language-textarea"
|
|
2300
2714
|
).forEach((n) => {
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2715
|
+
const o = n.getAttribute("data-full-placeholder") || "";
|
|
2716
|
+
o && this.adaptPlaceholderToSingleLine(n, o);
|
|
2303
2717
|
});
|
|
2304
2718
|
};
|
|
2305
2719
|
return window.addEventListener("resize", i), t;
|
|
@@ -2323,7 +2737,7 @@ class we extends x {
|
|
|
2323
2737
|
});
|
|
2324
2738
|
}
|
|
2325
2739
|
}
|
|
2326
|
-
class
|
|
2740
|
+
class Ve extends x {
|
|
2327
2741
|
constructor(t = {}) {
|
|
2328
2742
|
super(t), this.inputType = "select";
|
|
2329
2743
|
const e = [
|
|
@@ -2334,7 +2748,7 @@ class xe extends x {
|
|
|
2334
2748
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2335
2749
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2336
2750
|
];
|
|
2337
|
-
this.selectSetting = new
|
|
2751
|
+
this.selectSetting = new it({
|
|
2338
2752
|
title: this.title || "Animation",
|
|
2339
2753
|
options: e,
|
|
2340
2754
|
default: this.props.default || "none"
|
|
@@ -2350,97 +2764,81 @@ class xe extends x {
|
|
|
2350
2764
|
this.selectSetting.destroy(), super.destroy();
|
|
2351
2765
|
}
|
|
2352
2766
|
}
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
if (h.target.closest("button")) return;
|
|
2357
|
-
i = !0, s = h.clientX, n = h.clientY;
|
|
2358
|
-
const d = t.getBoundingClientRect();
|
|
2359
|
-
a = d.left, o = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2360
|
-
}, r = (h) => {
|
|
2361
|
-
if (!i) return;
|
|
2362
|
-
const d = h.clientX - s, g = h.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
|
|
2363
|
-
let v = a + d, y = o + g;
|
|
2364
|
-
v = Math.max(8, Math.min(C - u - 8, v)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
|
|
2365
|
-
}, p = () => {
|
|
2366
|
-
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2367
|
-
};
|
|
2368
|
-
c.addEventListener("mousedown", l);
|
|
2369
|
-
}, U = (c) => {
|
|
2370
|
-
if (!c) return null;
|
|
2371
|
-
let t = c.trim();
|
|
2767
|
+
const W = (h) => {
|
|
2768
|
+
if (!h) return null;
|
|
2769
|
+
let t = h.trim();
|
|
2372
2770
|
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()}`;
|
|
2373
|
-
},
|
|
2374
|
-
const t =
|
|
2771
|
+
}, X = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (h) => {
|
|
2772
|
+
const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2375
2773
|
return {
|
|
2376
2774
|
r: parseInt(e.slice(0, 2), 16),
|
|
2377
2775
|
g: parseInt(e.slice(2, 4), 16),
|
|
2378
2776
|
b: parseInt(e.slice(4, 6), 16)
|
|
2379
2777
|
};
|
|
2380
|
-
},
|
|
2381
|
-
const { r: t, g: e, b: i } =
|
|
2382
|
-
let
|
|
2383
|
-
r !== 0 && (
|
|
2384
|
-
const
|
|
2385
|
-
return { h:
|
|
2386
|
-
},
|
|
2387
|
-
const i = (
|
|
2388
|
-
let
|
|
2389
|
-
return i < 60 ? (
|
|
2390
|
-
Math.round((
|
|
2391
|
-
Math.round((l +
|
|
2392
|
-
Math.round((r +
|
|
2778
|
+
}, z = (h) => {
|
|
2779
|
+
const { r: t, g: e, b: i } = S(h), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2780
|
+
let c = 0;
|
|
2781
|
+
r !== 0 && (a === s ? c = (n - o) / r % 6 : a === n ? c = (o - s) / r + 2 : c = (s - n) / r + 4), c < 0 && (c += 6);
|
|
2782
|
+
const d = a === 0 ? 0 : r / a, p = a;
|
|
2783
|
+
return { h: c * 60, s: d, v: p };
|
|
2784
|
+
}, U = (h, t, e) => {
|
|
2785
|
+
const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2786
|
+
let a = 0, l = 0, r = 0;
|
|
2787
|
+
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), X(
|
|
2788
|
+
Math.round((a + o) * 255),
|
|
2789
|
+
Math.round((l + o) * 255),
|
|
2790
|
+
Math.round((r + o) * 255)
|
|
2393
2791
|
);
|
|
2394
|
-
},
|
|
2792
|
+
}, vt = (h, t, e) => {
|
|
2395
2793
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2396
|
-
return { hue:
|
|
2397
|
-
},
|
|
2398
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2399
|
-
let
|
|
2400
|
-
return
|
|
2401
|
-
r: Math.round((
|
|
2402
|
-
g: Math.round((
|
|
2794
|
+
return { hue: h, sat: s, lightness: i };
|
|
2795
|
+
}, st = (h, t, e) => {
|
|
2796
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
|
|
2797
|
+
let o = 0, a = 0, l = 0;
|
|
2798
|
+
return h < 60 ? (o = i, a = s, l = 0) : h < 120 ? (o = s, a = i, l = 0) : h < 180 ? (o = 0, a = i, l = s) : h < 240 ? (o = 0, a = s, l = i) : h < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2799
|
+
r: Math.round((o + n) * 255),
|
|
2800
|
+
g: Math.round((a + n) * 255),
|
|
2403
2801
|
b: Math.round((l + n) * 255)
|
|
2404
2802
|
};
|
|
2405
|
-
},
|
|
2803
|
+
}, nt = (h, t) => {
|
|
2406
2804
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2407
|
-
if (
|
|
2408
|
-
const { r: s, g: n, b:
|
|
2409
|
-
return `rgba(${s}, ${n}, ${
|
|
2410
|
-
}
|
|
2411
|
-
if (
|
|
2412
|
-
return
|
|
2413
|
-
if (
|
|
2414
|
-
return
|
|
2415
|
-
if (
|
|
2416
|
-
const s =
|
|
2805
|
+
if (h.startsWith("#")) {
|
|
2806
|
+
const { r: s, g: n, b: o } = S(h);
|
|
2807
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2808
|
+
}
|
|
2809
|
+
if (h.startsWith("rgba("))
|
|
2810
|
+
return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2811
|
+
if (h.startsWith("rgb("))
|
|
2812
|
+
return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2813
|
+
if (h.startsWith("hsl(")) {
|
|
2814
|
+
const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2417
2815
|
if (s) {
|
|
2418
|
-
const { r: n, g:
|
|
2816
|
+
const { r: n, g: o, b: a } = st(
|
|
2419
2817
|
parseInt(s[1]),
|
|
2420
2818
|
parseInt(s[2]) / 100,
|
|
2421
2819
|
parseInt(s[3]) / 100
|
|
2422
2820
|
);
|
|
2423
|
-
return `rgba(${n}, ${
|
|
2821
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2424
2822
|
}
|
|
2425
2823
|
}
|
|
2426
|
-
if (
|
|
2427
|
-
const s =
|
|
2824
|
+
if (h.startsWith("hsla(")) {
|
|
2825
|
+
const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2428
2826
|
if (s) {
|
|
2429
|
-
const { r: n, g:
|
|
2827
|
+
const { r: n, g: o, b: a } = st(
|
|
2430
2828
|
parseInt(s[1]),
|
|
2431
2829
|
parseInt(s[2]) / 100,
|
|
2432
2830
|
parseInt(s[3]) / 100
|
|
2433
2831
|
);
|
|
2434
|
-
return `rgba(${n}, ${
|
|
2832
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2435
2833
|
}
|
|
2436
2834
|
}
|
|
2437
|
-
const i =
|
|
2835
|
+
const i = W(h);
|
|
2438
2836
|
if (i) {
|
|
2439
|
-
const { r: s, g: n, b:
|
|
2440
|
-
return `rgba(${s}, ${n}, ${
|
|
2837
|
+
const { r: s, g: n, b: o } = S(i);
|
|
2838
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2441
2839
|
}
|
|
2442
|
-
return
|
|
2443
|
-
},
|
|
2840
|
+
return h;
|
|
2841
|
+
}, Qt = (h) => [
|
|
2444
2842
|
"red",
|
|
2445
2843
|
"green",
|
|
2446
2844
|
"blue",
|
|
@@ -2464,22 +2862,22 @@ const ut = (c, t, e) => {
|
|
|
2464
2862
|
"teal",
|
|
2465
2863
|
"fuchsia",
|
|
2466
2864
|
"transparent"
|
|
2467
|
-
].includes(
|
|
2865
|
+
].includes(h.toLowerCase()), ft = (h) => [
|
|
2468
2866
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2469
2867
|
/^rgba?\s*\([^)]+\)$/,
|
|
2470
2868
|
/^hsla?\s*\([^)]+\)$/,
|
|
2471
2869
|
/^[a-zA-Z]+$/
|
|
2472
|
-
].some((e) => e.test(
|
|
2870
|
+
].some((e) => e.test(h.trim())), te = (h) => {
|
|
2473
2871
|
if (typeof document > "u")
|
|
2474
|
-
return
|
|
2872
|
+
return ft(h) || !!W(h);
|
|
2475
2873
|
const t = document.createElement("div");
|
|
2476
|
-
return t.style.color =
|
|
2477
|
-
},
|
|
2478
|
-
const t =
|
|
2874
|
+
return t.style.color = h, t.style.color !== "";
|
|
2875
|
+
}, Ct = (h) => {
|
|
2876
|
+
const t = h.trim();
|
|
2479
2877
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2480
|
-
const n = t.slice(1),
|
|
2878
|
+
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);
|
|
2481
2879
|
return {
|
|
2482
|
-
color:
|
|
2880
|
+
color: X(o, a, l),
|
|
2483
2881
|
position: 0,
|
|
2484
2882
|
opacity: Math.round(r / 255 * 100)
|
|
2485
2883
|
};
|
|
@@ -2488,9 +2886,9 @@ const ut = (c, t, e) => {
|
|
|
2488
2886
|
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2489
2887
|
);
|
|
2490
2888
|
if (e) {
|
|
2491
|
-
const n = parseInt(e[1]),
|
|
2889
|
+
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2492
2890
|
return {
|
|
2493
|
-
color:
|
|
2891
|
+
color: X(n, o, a),
|
|
2494
2892
|
position: 0,
|
|
2495
2893
|
opacity: Math.round(l * 100)
|
|
2496
2894
|
};
|
|
@@ -2499,23 +2897,23 @@ const ut = (c, t, e) => {
|
|
|
2499
2897
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2500
2898
|
);
|
|
2501
2899
|
if (i) {
|
|
2502
|
-
const { r: n, g:
|
|
2900
|
+
const { r: n, g: o, b: a } = st(
|
|
2503
2901
|
parseFloat(i[1]),
|
|
2504
2902
|
parseFloat(i[2]) / 100,
|
|
2505
2903
|
parseFloat(i[3]) / 100
|
|
2506
2904
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2507
2905
|
return {
|
|
2508
|
-
color:
|
|
2906
|
+
color: X(n, o, a),
|
|
2509
2907
|
position: 0,
|
|
2510
2908
|
opacity: Math.round(l * 100)
|
|
2511
2909
|
};
|
|
2512
2910
|
}
|
|
2513
|
-
return { color:
|
|
2514
|
-
},
|
|
2911
|
+
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
2912
|
+
}, dt = (h) => {
|
|
2515
2913
|
const t = [];
|
|
2516
2914
|
let e = "", i = 0;
|
|
2517
|
-
for (let s = 0; s <
|
|
2518
|
-
const n =
|
|
2915
|
+
for (let s = 0; s < h.length; s++) {
|
|
2916
|
+
const n = h[s];
|
|
2519
2917
|
if (n === "(") i++;
|
|
2520
2918
|
else if (n === ")") i--;
|
|
2521
2919
|
else if (n === "," && i === 0) {
|
|
@@ -2525,16 +2923,16 @@ const ut = (c, t, e) => {
|
|
|
2525
2923
|
e += n;
|
|
2526
2924
|
}
|
|
2527
2925
|
return e.trim() && t.push(e.trim()), t;
|
|
2528
|
-
},
|
|
2529
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2926
|
+
}, pt = (h, t) => {
|
|
2927
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
|
|
2530
2928
|
if (!i) return null;
|
|
2531
2929
|
const s = i.index + i[0].length;
|
|
2532
|
-
let n = 1,
|
|
2533
|
-
for (let
|
|
2534
|
-
|
|
2535
|
-
return n === 0 ?
|
|
2536
|
-
},
|
|
2537
|
-
const t =
|
|
2930
|
+
let n = 1, o = s;
|
|
2931
|
+
for (let a = s; a < h.length && n > 0; a++)
|
|
2932
|
+
h[a] === "(" ? n++ : h[a] === ")" && n--, o = a;
|
|
2933
|
+
return n === 0 ? h.substring(s, o) : null;
|
|
2934
|
+
}, ee = (h) => {
|
|
2935
|
+
const t = h.split(" ")[0].toLowerCase();
|
|
2538
2936
|
return [
|
|
2539
2937
|
"circle",
|
|
2540
2938
|
"ellipse",
|
|
@@ -2545,44 +2943,44 @@ const ut = (c, t, e) => {
|
|
|
2545
2943
|
"at",
|
|
2546
2944
|
"contain",
|
|
2547
2945
|
"cover"
|
|
2548
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2549
|
-
},
|
|
2946
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Qt(t);
|
|
2947
|
+
}, ut = (h) => {
|
|
2550
2948
|
const t = [];
|
|
2551
|
-
return
|
|
2949
|
+
return h.forEach((e, i) => {
|
|
2552
2950
|
const s = e.trim();
|
|
2553
2951
|
if (!s) return;
|
|
2554
|
-
let n = "",
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2557
|
-
const l =
|
|
2558
|
-
l.position = Math.max(0, Math.min(100, Math.round(
|
|
2952
|
+
let n = "", o = 0;
|
|
2953
|
+
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2954
|
+
a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = h.length === 1 ? 0 : i / (h.length - 1) * 100);
|
|
2955
|
+
const l = Ct(n);
|
|
2956
|
+
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2559
2957
|
}), t;
|
|
2560
|
-
},
|
|
2561
|
-
const t =
|
|
2958
|
+
}, B = (h) => {
|
|
2959
|
+
const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2562
2960
|
return {
|
|
2563
|
-
type:
|
|
2564
|
-
angle: typeof
|
|
2961
|
+
type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
|
|
2962
|
+
angle: typeof h.angle == "number" ? h.angle : 90,
|
|
2565
2963
|
stops: t.map((e, i) => ({
|
|
2566
2964
|
color: e.color || "#000000",
|
|
2567
2965
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2568
2966
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2569
2967
|
}))
|
|
2570
2968
|
};
|
|
2571
|
-
},
|
|
2572
|
-
const t =
|
|
2573
|
-
if (
|
|
2574
|
-
const s =
|
|
2575
|
-
return
|
|
2969
|
+
}, N = (h) => {
|
|
2970
|
+
const t = h.replace(/;$/, "").trim();
|
|
2971
|
+
if (te(t)) {
|
|
2972
|
+
const s = Ct(t);
|
|
2973
|
+
return B({ type: "solid", angle: 0, stops: [s] });
|
|
2576
2974
|
}
|
|
2577
|
-
const e =
|
|
2975
|
+
const e = pt(t, "linear-gradient");
|
|
2578
2976
|
if (e) {
|
|
2579
|
-
const s =
|
|
2580
|
-
let n = 90,
|
|
2581
|
-
const
|
|
2582
|
-
if (
|
|
2583
|
-
const r =
|
|
2584
|
-
r && (n = parseFloat(r[1]),
|
|
2585
|
-
} else
|
|
2977
|
+
const s = dt(e);
|
|
2978
|
+
let n = 90, o = s;
|
|
2979
|
+
const a = s[0];
|
|
2980
|
+
if (a.includes("deg")) {
|
|
2981
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2982
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2983
|
+
} else a.includes("to ") && (n = {
|
|
2586
2984
|
"to right": 90,
|
|
2587
2985
|
"to left": 270,
|
|
2588
2986
|
"to bottom": 180,
|
|
@@ -2591,31 +2989,31 @@ const ut = (c, t, e) => {
|
|
|
2591
2989
|
"to bottom left": 225,
|
|
2592
2990
|
"to top right": 45,
|
|
2593
2991
|
"to top left": 315
|
|
2594
|
-
}[
|
|
2595
|
-
const l =
|
|
2596
|
-
return l.length ?
|
|
2992
|
+
}[a] ?? 90, o = s.slice(1));
|
|
2993
|
+
const l = ut(o);
|
|
2994
|
+
return l.length ? B({ type: "linear", angle: n, stops: l }) : null;
|
|
2597
2995
|
}
|
|
2598
|
-
const i =
|
|
2996
|
+
const i = pt(t, "radial-gradient");
|
|
2599
2997
|
if (i) {
|
|
2600
|
-
const s =
|
|
2601
|
-
return
|
|
2998
|
+
const s = dt(i), n = s[0] && !ee(s[0]) ? s.slice(1) : s, o = ut(n);
|
|
2999
|
+
return o.length ? B({ type: "radial", angle: 0, stops: o }) : null;
|
|
2602
3000
|
}
|
|
2603
3001
|
return null;
|
|
2604
|
-
}, O = (
|
|
2605
|
-
if (
|
|
2606
|
-
const e =
|
|
3002
|
+
}, O = (h) => {
|
|
3003
|
+
if (h.type === "solid") {
|
|
3004
|
+
const e = h.stops[0], i = e.color;
|
|
2607
3005
|
if (i.startsWith("var(--"))
|
|
2608
3006
|
return i;
|
|
2609
|
-
const s = e.opacity ?? 100, n = i.replace("#", ""),
|
|
2610
|
-
return `#${n}${
|
|
3007
|
+
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3008
|
+
return `#${n}${o}`;
|
|
2611
3009
|
}
|
|
2612
|
-
const t =
|
|
2613
|
-
(e) => `${
|
|
3010
|
+
const t = h.stops.map(
|
|
3011
|
+
(e) => `${nt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2614
3012
|
).join(", ");
|
|
2615
|
-
return
|
|
2616
|
-
},
|
|
2617
|
-
if (
|
|
2618
|
-
const t =
|
|
3013
|
+
return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
|
|
3014
|
+
}, ie = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), Z = (h) => {
|
|
3015
|
+
if (h.type === "solid") {
|
|
3016
|
+
const t = h.stops[0];
|
|
2619
3017
|
if (t) {
|
|
2620
3018
|
const e = t.color;
|
|
2621
3019
|
if (e.startsWith("var(--"))
|
|
@@ -2625,14 +3023,14 @@ const ut = (c, t, e) => {
|
|
|
2625
3023
|
if (i === 100)
|
|
2626
3024
|
return e;
|
|
2627
3025
|
{
|
|
2628
|
-
const s =
|
|
3026
|
+
const s = ie(i);
|
|
2629
3027
|
return `${e}${s}`;
|
|
2630
3028
|
}
|
|
2631
3029
|
}
|
|
2632
3030
|
return "#000000";
|
|
2633
3031
|
}
|
|
2634
|
-
return
|
|
2635
|
-
},
|
|
3032
|
+
return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
|
|
3033
|
+
}, j = class j {
|
|
2636
3034
|
static defaults() {
|
|
2637
3035
|
return {
|
|
2638
3036
|
solid: [],
|
|
@@ -2642,8 +3040,8 @@ const ut = (c, t, e) => {
|
|
|
2642
3040
|
static normalizeList(t) {
|
|
2643
3041
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2644
3042
|
return t.forEach((s) => {
|
|
2645
|
-
let n =
|
|
2646
|
-
n ||
|
|
3043
|
+
let n = W(s);
|
|
3044
|
+
n || N(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2647
3045
|
}), i.slice(0, this.MAX_COLORS);
|
|
2648
3046
|
}
|
|
2649
3047
|
static ensureLoaded() {
|
|
@@ -2680,29 +3078,29 @@ const ut = (c, t, e) => {
|
|
|
2680
3078
|
static getColors(t) {
|
|
2681
3079
|
if (t === "all") {
|
|
2682
3080
|
const e = this.list("solid"), i = this.list("gradient"), s = [], n = Math.max(e.length, i.length);
|
|
2683
|
-
for (let
|
|
2684
|
-
|
|
3081
|
+
for (let o = 0; o < n; o++)
|
|
3082
|
+
o < e.length && s.push(e[o]), o < i.length && s.push(i[o]);
|
|
2685
3083
|
return this.normalizeList(s);
|
|
2686
3084
|
}
|
|
2687
3085
|
return [...this.list(t)];
|
|
2688
3086
|
}
|
|
2689
3087
|
static addColor(t, e) {
|
|
2690
3088
|
if (!t) return;
|
|
2691
|
-
let i =
|
|
3089
|
+
let i = W(t), s = "solid";
|
|
2692
3090
|
if (i)
|
|
2693
3091
|
s = "solid";
|
|
2694
3092
|
else {
|
|
2695
|
-
const l =
|
|
3093
|
+
const l = N(t);
|
|
2696
3094
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2697
3095
|
}
|
|
2698
3096
|
if (!i) return;
|
|
2699
|
-
const n = e === "all" ? s : e,
|
|
2700
|
-
|
|
3097
|
+
const n = e === "all" ? s : e, o = this.list(n), a = o.indexOf(i);
|
|
3098
|
+
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2701
3099
|
}
|
|
2702
3100
|
};
|
|
2703
|
-
|
|
2704
|
-
let
|
|
2705
|
-
const
|
|
3101
|
+
j.STORAGE_KEY = "settingsLib_recentColors", j.MAX_COLORS = 12, j.colors = null;
|
|
3102
|
+
let R = j;
|
|
3103
|
+
const lt = (h, t) => {
|
|
2706
3104
|
const e = document.createElement("div");
|
|
2707
3105
|
e.className = "color-picker-recent-section";
|
|
2708
3106
|
const i = document.createElement("div");
|
|
@@ -2711,80 +3109,80 @@ const ot = (c, t) => {
|
|
|
2711
3109
|
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2712
3110
|
const n = () => {
|
|
2713
3111
|
s.style.display = "none";
|
|
2714
|
-
},
|
|
2715
|
-
const
|
|
2716
|
-
s.textContent =
|
|
2717
|
-
},
|
|
2718
|
-
|
|
3112
|
+
}, o = (c, d) => {
|
|
3113
|
+
const p = c.getBoundingClientRect();
|
|
3114
|
+
s.textContent = d, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.bottom + 8}px`, s.style.display = "block";
|
|
3115
|
+
}, a = document.createElement("div");
|
|
3116
|
+
a.className = "color-picker-recent-grid";
|
|
2719
3117
|
const l = document.createElement("div");
|
|
2720
|
-
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(
|
|
3118
|
+
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
2721
3119
|
const r = () => {
|
|
2722
|
-
n(),
|
|
2723
|
-
const
|
|
2724
|
-
if (
|
|
2725
|
-
|
|
3120
|
+
n(), a.innerHTML = "";
|
|
3121
|
+
const c = R.getColors(t);
|
|
3122
|
+
if (c.length === 0) {
|
|
3123
|
+
a.style.display = "none", l.style.display = "block";
|
|
2726
3124
|
return;
|
|
2727
3125
|
}
|
|
2728
|
-
|
|
2729
|
-
const
|
|
2730
|
-
|
|
2731
|
-
const g =
|
|
2732
|
-
if (
|
|
2733
|
-
|
|
2734
|
-
const m =
|
|
2735
|
-
m && m.stops && m.stops.length > 0 && (
|
|
3126
|
+
a.style.display = "grid", l.style.display = "none", c.forEach((d) => {
|
|
3127
|
+
const p = document.createElement("button");
|
|
3128
|
+
p.type = "button", p.className = "color-picker-recent-swatch";
|
|
3129
|
+
const g = se(d);
|
|
3130
|
+
if (p.title = g, p.setAttribute("aria-label", `Use color: ${g}`), d.includes("gradient(")) {
|
|
3131
|
+
p.style.backgroundImage = d, p.style.backgroundColor = "transparent";
|
|
3132
|
+
const m = N(d);
|
|
3133
|
+
m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
|
|
2736
3134
|
} else
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
n(),
|
|
2740
|
-
}),
|
|
2741
|
-
|
|
2742
|
-
}),
|
|
3135
|
+
p.style.backgroundColor = d, p.style.borderColor = d;
|
|
3136
|
+
p.addEventListener("mouseenter", () => o(p, g)), p.addEventListener("mouseleave", () => {
|
|
3137
|
+
n(), p.style.boxShadow = "";
|
|
3138
|
+
}), p.addEventListener("mousedown", () => {
|
|
3139
|
+
p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
3140
|
+
}), p.addEventListener("mouseup", () => {
|
|
2743
3141
|
setTimeout(() => {
|
|
2744
|
-
|
|
3142
|
+
p.style.boxShadow = "";
|
|
2745
3143
|
}, 150);
|
|
2746
|
-
}),
|
|
2747
|
-
n(),
|
|
2748
|
-
}),
|
|
3144
|
+
}), p.addEventListener("click", () => {
|
|
3145
|
+
n(), h(d);
|
|
3146
|
+
}), a.appendChild(p);
|
|
2749
3147
|
});
|
|
2750
3148
|
};
|
|
2751
3149
|
return r(), { container: e, refresh: r };
|
|
2752
|
-
},
|
|
2753
|
-
const t =
|
|
3150
|
+
}, se = (h) => {
|
|
3151
|
+
const t = N(h);
|
|
2754
3152
|
if (t)
|
|
2755
3153
|
return Z(t);
|
|
2756
|
-
const e =
|
|
3154
|
+
const e = W(h);
|
|
2757
3155
|
if (e) {
|
|
2758
|
-
const i =
|
|
3156
|
+
const i = S(e);
|
|
2759
3157
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2760
3158
|
}
|
|
2761
|
-
return
|
|
2762
|
-
},
|
|
3159
|
+
return h;
|
|
3160
|
+
}, yt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2763
3161
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2764
3162
|
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"
|
|
2765
3163
|
fill="#919EAB"/>
|
|
2766
|
-
</svg>`,
|
|
3164
|
+
</svg>`, bt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2767
3165
|
<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"/>
|
|
2768
|
-
</svg>`,
|
|
3166
|
+
</svg>`, ne = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2769
3167
|
<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"/>
|
|
2770
|
-
</svg>`,
|
|
3168
|
+
</svg>`, oe = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2771
3169
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2772
|
-
</svg>`,
|
|
3170
|
+
</svg>`, ae = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2773
3171
|
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2774
3172
|
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2775
3173
|
</svg>
|
|
2776
3174
|
|
|
2777
|
-
`,
|
|
3175
|
+
`, le = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2778
3176
|
<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"/>
|
|
2779
3177
|
<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"/>
|
|
2780
3178
|
</svg>
|
|
2781
3179
|
|
|
2782
|
-
`,
|
|
3180
|
+
`, re = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2783
3181
|
<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"/>
|
|
2784
3182
|
<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"/>
|
|
2785
3183
|
</svg>
|
|
2786
3184
|
`;
|
|
2787
|
-
class
|
|
3185
|
+
class gt {
|
|
2788
3186
|
constructor(t, e = "gradient") {
|
|
2789
3187
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2790
3188
|
if (!this.isOpen) return;
|
|
@@ -2800,8 +3198,8 @@ class dt {
|
|
|
2800
3198
|
if (Array.from(n).some(
|
|
2801
3199
|
(l) => l.contains(s)
|
|
2802
3200
|
)) return;
|
|
2803
|
-
const
|
|
2804
|
-
|
|
3201
|
+
const a = document.querySelector(".gradient-popover");
|
|
3202
|
+
a && a.contains(s) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2805
3203
|
}, this.keyDown = (i) => {
|
|
2806
3204
|
if (this.isOpen) {
|
|
2807
3205
|
if (i.key === "Escape")
|
|
@@ -2826,105 +3224,105 @@ class dt {
|
|
|
2826
3224
|
const i = document.createElement("span");
|
|
2827
3225
|
i.textContent = "Color";
|
|
2828
3226
|
const s = document.createElement("button");
|
|
2829
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
3227
|
+
s.className = "color-picker-close", s.innerHTML = yt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), at(e, t);
|
|
2830
3228
|
const n = document.createElement("div");
|
|
2831
3229
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2832
|
-
const a = document.createElement("div");
|
|
2833
|
-
a.className = "color-picker-marker", this.colorMarker = a, n.appendChild(a);
|
|
2834
3230
|
const o = document.createElement("div");
|
|
2835
|
-
o.className = "color-picker-
|
|
3231
|
+
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
3232
|
+
const a = document.createElement("div");
|
|
3233
|
+
a.className = "color-picker-sliders-container";
|
|
2836
3234
|
const l = document.createElement("button");
|
|
2837
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
3235
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = bt;
|
|
2838
3236
|
const r = document.createElement("div");
|
|
2839
3237
|
r.className = "color-picker-sliders-group";
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2842
|
-
const h = document.createElement("div");
|
|
2843
|
-
h.className = "color-picker-hue-marker", this.hueMarker = h, p.appendChild(h);
|
|
3238
|
+
const c = document.createElement("div");
|
|
3239
|
+
c.className = "color-picker-hue", this.hueSlider = c;
|
|
2844
3240
|
const d = document.createElement("div");
|
|
2845
|
-
d.className = "color-picker-
|
|
3241
|
+
d.className = "color-picker-hue-marker", this.hueMarker = d, c.appendChild(d);
|
|
3242
|
+
const p = document.createElement("div");
|
|
3243
|
+
p.className = "color-picker-opacity", this.opacitySlider = p;
|
|
2846
3244
|
const g = document.createElement("div");
|
|
2847
|
-
g.className = "color-picker-opacity-marker", this.opacityMarker = g,
|
|
2848
|
-
const
|
|
3245
|
+
g.className = "color-picker-opacity-marker", this.opacityMarker = g, p.appendChild(g), r.appendChild(c), r.appendChild(p), a.appendChild(l), a.appendChild(r);
|
|
3246
|
+
const f = lt((b) => {
|
|
2849
3247
|
var E;
|
|
2850
3248
|
this.setColor(b), (E = this.onChange) == null || E.call(this, b, this.currentOpacity);
|
|
2851
3249
|
}, this.recentScope);
|
|
2852
|
-
this.recentSectionRefresh =
|
|
3250
|
+
this.recentSectionRefresh = f.refresh;
|
|
2853
3251
|
const m = document.createElement("div");
|
|
2854
3252
|
m.className = "color-picker-format-section";
|
|
2855
3253
|
const u = document.createElement("select");
|
|
2856
3254
|
u.className = "color-picker-format-select", this.select = u;
|
|
2857
|
-
const f = document.createElement("option");
|
|
2858
|
-
f.value = "hex", f.textContent = "HEX";
|
|
2859
3255
|
const v = document.createElement("option");
|
|
2860
|
-
v.value = "
|
|
3256
|
+
v.value = "hex", v.textContent = "HEX";
|
|
3257
|
+
const C = document.createElement("option");
|
|
3258
|
+
C.value = "rgb", C.textContent = "RGB";
|
|
2861
3259
|
const y = document.createElement("option");
|
|
2862
|
-
y.value = "hsl", y.textContent = "HSL", u.appendChild(
|
|
3260
|
+
y.value = "hsl", y.textContent = "HSL", u.appendChild(v), u.appendChild(C), u.appendChild(y);
|
|
2863
3261
|
const w = document.createElement("input");
|
|
2864
3262
|
w.type = "text", w.className = "color-picker-color-input", w.value = this.currentColor, this.input = w;
|
|
2865
3263
|
const k = document.createElement("div");
|
|
2866
3264
|
k.className = "color-picker-input-container";
|
|
2867
|
-
const
|
|
2868
|
-
return
|
|
3265
|
+
const I = document.createElement("button");
|
|
3266
|
+
return I.className = "color-picker-copy-inside", I.textContent = "Copy", k.appendChild(w), k.appendChild(I), m.appendChild(u), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(f.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, c, p, w, u, I, l), t;
|
|
2869
3267
|
}
|
|
2870
3268
|
createBackdrop() {
|
|
2871
3269
|
const t = document.createElement("div");
|
|
2872
3270
|
return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
|
|
2873
3271
|
}
|
|
2874
|
-
bind(t, e, i, s, n,
|
|
2875
|
-
const l = (
|
|
2876
|
-
var v;
|
|
2877
|
-
const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
2878
|
-
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
|
|
2879
|
-
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(u, g, 1 - C);
|
|
2880
|
-
this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
2881
|
-
}, r = (h) => {
|
|
2882
|
-
var v;
|
|
2883
|
-
const d = e.getBoundingClientRect();
|
|
2884
|
-
let g = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2885
|
-
this.hueMarker.style.left = `${g * 100}%`;
|
|
2886
|
-
const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
|
|
2887
|
-
this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
|
|
2888
|
-
}, p = (h) => {
|
|
3272
|
+
bind(t, e, i, s, n, o, a) {
|
|
3273
|
+
const l = (d) => {
|
|
2889
3274
|
var C;
|
|
2890
|
-
const
|
|
2891
|
-
this.
|
|
3275
|
+
const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
|
|
3276
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
|
|
3277
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
|
|
3278
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
3279
|
+
}, r = (d) => {
|
|
3280
|
+
var C;
|
|
3281
|
+
const p = e.getBoundingClientRect();
|
|
3282
|
+
let g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
3283
|
+
this.hueMarker.style.left = `${g * 100}%`;
|
|
3284
|
+
const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
|
|
3285
|
+
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
3286
|
+
}, c = (d) => {
|
|
3287
|
+
var f;
|
|
3288
|
+
const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
3289
|
+
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (f = this.onChange) == null || f.call(this, this.currentColor, this.currentOpacity);
|
|
2892
3290
|
};
|
|
2893
|
-
t.addEventListener("mousedown", (
|
|
2894
|
-
|
|
2895
|
-
const
|
|
2896
|
-
document.removeEventListener("mousemove",
|
|
3291
|
+
t.addEventListener("mousedown", (d) => {
|
|
3292
|
+
d.preventDefault(), l(d);
|
|
3293
|
+
const p = (f) => l(f), g = () => {
|
|
3294
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
2897
3295
|
};
|
|
2898
|
-
document.addEventListener("mousemove",
|
|
2899
|
-
}), e.addEventListener("mousedown", (
|
|
2900
|
-
|
|
2901
|
-
const
|
|
2902
|
-
document.removeEventListener("mousemove",
|
|
3296
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3297
|
+
}), e.addEventListener("mousedown", (d) => {
|
|
3298
|
+
d.preventDefault(), r(d);
|
|
3299
|
+
const p = (f) => r(f), g = () => {
|
|
3300
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
2903
3301
|
};
|
|
2904
|
-
document.addEventListener("mousemove",
|
|
2905
|
-
}), i.addEventListener("mousedown", (
|
|
2906
|
-
|
|
2907
|
-
const
|
|
2908
|
-
document.removeEventListener("mousemove",
|
|
3302
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3303
|
+
}), i.addEventListener("mousedown", (d) => {
|
|
3304
|
+
d.preventDefault(), c(d);
|
|
3305
|
+
const p = (f) => c(f), g = () => {
|
|
3306
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
2909
3307
|
};
|
|
2910
|
-
document.addEventListener("mousemove",
|
|
2911
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2912
|
-
|
|
2913
|
-
}),
|
|
3308
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3309
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (d) => {
|
|
3310
|
+
d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
|
|
3311
|
+
}), o.addEventListener("click", async () => {
|
|
2914
3312
|
try {
|
|
2915
3313
|
await navigator.clipboard.writeText(s.value);
|
|
2916
3314
|
} catch {
|
|
2917
3315
|
s.select(), document.execCommand("copy");
|
|
2918
3316
|
}
|
|
2919
|
-
}),
|
|
2920
|
-
var
|
|
3317
|
+
}), a.addEventListener("click", async () => {
|
|
3318
|
+
var d;
|
|
2921
3319
|
if (!("EyeDropper" in window)) {
|
|
2922
3320
|
alert("EyeDropper API is not supported in this browser.");
|
|
2923
3321
|
return;
|
|
2924
3322
|
}
|
|
2925
3323
|
try {
|
|
2926
|
-
const
|
|
2927
|
-
this.setColor(g), (
|
|
3324
|
+
const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
|
|
3325
|
+
this.setColor(g), (d = this.onChange) == null || d.call(this, g, this.currentOpacity);
|
|
2928
3326
|
} catch {
|
|
2929
3327
|
}
|
|
2930
3328
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2933,22 +3331,22 @@ class dt {
|
|
|
2933
3331
|
);
|
|
2934
3332
|
}
|
|
2935
3333
|
setColor(t) {
|
|
2936
|
-
var
|
|
3334
|
+
var o;
|
|
2937
3335
|
this.currentColor = t;
|
|
2938
|
-
const { h: e, s: i, v: s } =
|
|
2939
|
-
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (
|
|
3336
|
+
const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
|
|
3337
|
+
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);
|
|
2940
3338
|
}
|
|
2941
3339
|
syncInput() {
|
|
2942
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
3340
|
+
const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
|
|
2943
3341
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2944
3342
|
else if (t === "rgb") {
|
|
2945
|
-
const { r: n, g:
|
|
2946
|
-
this.input.value = `rgb(${n}, ${
|
|
3343
|
+
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
3344
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2947
3345
|
} else {
|
|
2948
|
-
const { hue: n, sat:
|
|
3346
|
+
const { hue: n, sat: o, lightness: a } = vt(e, i, s);
|
|
2949
3347
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2950
|
-
|
|
2951
|
-
)}%, ${Math.round(
|
|
3348
|
+
o * 100
|
|
3349
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
2952
3350
|
}
|
|
2953
3351
|
}
|
|
2954
3352
|
applyFromInput() {
|
|
@@ -2958,20 +3356,20 @@ class dt {
|
|
|
2958
3356
|
else {
|
|
2959
3357
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2960
3358
|
if (i) {
|
|
2961
|
-
const s = parseInt(i[1]), n = parseInt(i[2]),
|
|
2962
|
-
s <= 255 && n <= 255 &&
|
|
3359
|
+
const s = parseInt(i[1]), n = parseInt(i[2]), o = parseInt(i[3]);
|
|
3360
|
+
s <= 255 && n <= 255 && o <= 255 && (e = `#${[s, n, o].map((a) => a.toString(16).padStart(2, "0")).join("")}`);
|
|
2963
3361
|
} else {
|
|
2964
3362
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2965
3363
|
if (s) {
|
|
2966
|
-
const n = parseInt(s[1]),
|
|
2967
|
-
e =
|
|
3364
|
+
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);
|
|
3365
|
+
e = U(n, r, l);
|
|
2968
3366
|
}
|
|
2969
3367
|
}
|
|
2970
3368
|
}
|
|
2971
3369
|
e && this.setColor(e);
|
|
2972
3370
|
}
|
|
2973
3371
|
updateOpacityBg() {
|
|
2974
|
-
const { r: t, g: e, b: i } =
|
|
3372
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
2975
3373
|
this.opacitySlider.style.setProperty(
|
|
2976
3374
|
"--base-color",
|
|
2977
3375
|
`rgb(${t}, ${e}, ${i})`
|
|
@@ -2980,24 +3378,24 @@ class dt {
|
|
|
2980
3378
|
open(t, e, i) {
|
|
2981
3379
|
var y;
|
|
2982
3380
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2983
|
-
const { h: s, s: n, v:
|
|
2984
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 -
|
|
2985
|
-
const
|
|
2986
|
-
let g = r.right + 8,
|
|
2987
|
-
const m =
|
|
2988
|
-
m >=
|
|
2989
|
-
const
|
|
2990
|
-
|
|
3381
|
+
const { h: s, s: n, v: o } = z(t);
|
|
3382
|
+
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);
|
|
3383
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, d = window.innerHeight, p = 16;
|
|
3384
|
+
let g = r.right + 8, f = r.top;
|
|
3385
|
+
const m = c - r.right, u = r.left;
|
|
3386
|
+
m >= a + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (c - a) / 2);
|
|
3387
|
+
const v = d - r.bottom, C = r.top;
|
|
3388
|
+
v >= l + p ? f = r.bottom + 8 : C >= l + p ? f = r.top - l - 8 : v > C ? (f = r.bottom + 8, f + l > d - p && (f = d - l - p)) : (f = r.top - l - 8, f < p && (f = p)), this.element.style.left = `${g}px`, this.element.style.top = `${f}px`;
|
|
2991
3389
|
}
|
|
2992
3390
|
close(t) {
|
|
2993
3391
|
var e;
|
|
2994
|
-
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (
|
|
3392
|
+
this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
|
|
2995
3393
|
}
|
|
2996
3394
|
getElement() {
|
|
2997
3395
|
return this.element;
|
|
2998
3396
|
}
|
|
2999
3397
|
}
|
|
3000
|
-
class
|
|
3398
|
+
class ce {
|
|
3001
3399
|
constructor(t) {
|
|
3002
3400
|
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);
|
|
3003
3401
|
}
|
|
@@ -3015,117 +3413,117 @@ class ie {
|
|
|
3015
3413
|
const s = document.createElement("div");
|
|
3016
3414
|
s.className = "color-picker-sliders-container embedded";
|
|
3017
3415
|
const n = document.createElement("button");
|
|
3018
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
3019
|
-
const a = document.createElement("div");
|
|
3020
|
-
a.className = "color-picker-sliders-group";
|
|
3416
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = bt;
|
|
3021
3417
|
const o = document.createElement("div");
|
|
3022
|
-
o.className = "color-picker-
|
|
3418
|
+
o.className = "color-picker-sliders-group";
|
|
3419
|
+
const a = document.createElement("div");
|
|
3420
|
+
a.className = "color-picker-hue embedded", this.hueSlider = a;
|
|
3023
3421
|
const l = document.createElement("div");
|
|
3024
|
-
l.className = "color-picker-hue-marker", this.hueMarker = l,
|
|
3422
|
+
l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
|
|
3025
3423
|
const r = document.createElement("div");
|
|
3026
3424
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
3027
|
-
const
|
|
3028
|
-
|
|
3029
|
-
const
|
|
3030
|
-
const k =
|
|
3425
|
+
const c = document.createElement("div");
|
|
3426
|
+
c.className = "color-picker-opacity-marker", this.opacityMarker = c, r.appendChild(c), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
3427
|
+
const d = lt((w) => {
|
|
3428
|
+
const k = N(w);
|
|
3031
3429
|
k && k.type !== "solid" ? this.onColorChange(w, this.currentOpacity) : (this.setColor(w), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3032
3430
|
}, "all");
|
|
3033
|
-
this.recentSectionRefresh =
|
|
3034
|
-
const
|
|
3035
|
-
|
|
3431
|
+
this.recentSectionRefresh = d.refresh;
|
|
3432
|
+
const p = document.createElement("div");
|
|
3433
|
+
p.className = "color-picker-format-section embedded";
|
|
3036
3434
|
const g = document.createElement("select");
|
|
3037
3435
|
g.className = "color-picker-format-select", this.select = g;
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3436
|
+
const f = document.createElement("option");
|
|
3437
|
+
f.value = "hex", f.textContent = "HEX";
|
|
3040
3438
|
const m = document.createElement("option");
|
|
3041
3439
|
m.value = "rgb", m.textContent = "RGB";
|
|
3042
3440
|
const u = document.createElement("option");
|
|
3043
|
-
u.value = "hsl", u.textContent = "HSL", g.appendChild(
|
|
3044
|
-
const
|
|
3045
|
-
|
|
3046
|
-
const
|
|
3047
|
-
|
|
3441
|
+
u.value = "hsl", u.textContent = "HSL", g.appendChild(f), g.appendChild(m), g.appendChild(u);
|
|
3442
|
+
const v = document.createElement("input");
|
|
3443
|
+
v.type = "text", v.className = "color-picker-color-input", this.input = v;
|
|
3444
|
+
const C = document.createElement("div");
|
|
3445
|
+
C.className = "color-picker-input-container";
|
|
3048
3446
|
const y = document.createElement("button");
|
|
3049
|
-
return y.className = "color-picker-copy-inside", y.textContent = "Copy",
|
|
3050
|
-
}
|
|
3051
|
-
bind(t, e, i, s, n,
|
|
3052
|
-
const l = (
|
|
3053
|
-
const
|
|
3054
|
-
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${
|
|
3055
|
-
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360,
|
|
3056
|
-
this.currentColor =
|
|
3057
|
-
}, r = (
|
|
3058
|
-
const
|
|
3447
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), p.appendChild(g), p.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(d.container), this.bind(e, a, r, v, g, y, n), t;
|
|
3448
|
+
}
|
|
3449
|
+
bind(t, e, i, s, n, o, a) {
|
|
3450
|
+
const l = (d) => {
|
|
3451
|
+
const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
|
|
3452
|
+
this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
|
|
3453
|
+
const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
|
|
3454
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3455
|
+
}, r = (d) => {
|
|
3456
|
+
const p = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
3059
3457
|
this.hueMarker.style.left = `${g * 100}%`;
|
|
3060
|
-
const
|
|
3061
|
-
this.currentColor =
|
|
3062
|
-
linear-gradient(to right, #fff, hsl(${
|
|
3063
|
-
},
|
|
3064
|
-
const
|
|
3458
|
+
const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
|
|
3459
|
+
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3460
|
+
linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3461
|
+
}, c = (d) => {
|
|
3462
|
+
const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
|
|
3065
3463
|
this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
|
|
3066
3464
|
};
|
|
3067
|
-
t.addEventListener("mousedown", (
|
|
3068
|
-
|
|
3069
|
-
const
|
|
3070
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
3465
|
+
t.addEventListener("mousedown", (d) => {
|
|
3466
|
+
d.preventDefault(), this.isDragging = !0, l(d);
|
|
3467
|
+
const p = (f) => l(f), g = () => {
|
|
3468
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3071
3469
|
};
|
|
3072
|
-
document.addEventListener("mousemove",
|
|
3073
|
-
}), e.addEventListener("mousedown", (
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
3470
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3471
|
+
}), e.addEventListener("mousedown", (d) => {
|
|
3472
|
+
d.preventDefault(), this.isDragging = !0, r(d);
|
|
3473
|
+
const p = (f) => r(f), g = () => {
|
|
3474
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3077
3475
|
};
|
|
3078
|
-
document.addEventListener("mousemove",
|
|
3079
|
-
}), i.addEventListener("mousedown", (
|
|
3080
|
-
|
|
3081
|
-
const
|
|
3082
|
-
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove",
|
|
3476
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3477
|
+
}), i.addEventListener("mousedown", (d) => {
|
|
3478
|
+
d.preventDefault(), this.isDragging = !0, c(d);
|
|
3479
|
+
const p = (f) => c(f), g = () => {
|
|
3480
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
|
|
3083
3481
|
};
|
|
3084
|
-
document.addEventListener("mousemove",
|
|
3482
|
+
document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
3085
3483
|
}), n.addEventListener("change", () => {
|
|
3086
3484
|
this.syncInput();
|
|
3087
3485
|
}), s.addEventListener("input", () => {
|
|
3088
3486
|
this.applyFromInput();
|
|
3089
3487
|
}), s.addEventListener("blur", () => {
|
|
3090
3488
|
this.syncInput();
|
|
3091
|
-
}), s.addEventListener("keydown", (
|
|
3092
|
-
|
|
3093
|
-
}),
|
|
3489
|
+
}), s.addEventListener("keydown", (d) => {
|
|
3490
|
+
d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
|
|
3491
|
+
}), o.addEventListener("click", async () => {
|
|
3094
3492
|
try {
|
|
3095
3493
|
await navigator.clipboard.writeText(s.value);
|
|
3096
3494
|
} catch {
|
|
3097
3495
|
s.select(), document.execCommand("copy");
|
|
3098
3496
|
}
|
|
3099
|
-
}),
|
|
3497
|
+
}), a.addEventListener("click", async () => {
|
|
3100
3498
|
if (!("EyeDropper" in window)) {
|
|
3101
3499
|
alert("EyeDropper API is not supported in this browser.");
|
|
3102
3500
|
return;
|
|
3103
3501
|
}
|
|
3104
3502
|
try {
|
|
3105
|
-
const
|
|
3106
|
-
this.setColor(
|
|
3503
|
+
const d = new window.EyeDropper(), { sRGBHex: p } = await d.open();
|
|
3504
|
+
this.setColor(p), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3107
3505
|
} catch {
|
|
3108
3506
|
}
|
|
3109
3507
|
});
|
|
3110
3508
|
}
|
|
3111
3509
|
setColor(t) {
|
|
3112
3510
|
this.currentColor = t;
|
|
3113
|
-
const { h: e, s: i, v: s } =
|
|
3511
|
+
const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
|
|
3114
3512
|
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),
|
|
3115
3513
|
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3116
3514
|
}
|
|
3117
3515
|
syncInput() {
|
|
3118
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
3516
|
+
const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
|
|
3119
3517
|
if (t === "hex")
|
|
3120
3518
|
this.input.value = this.currentColor;
|
|
3121
3519
|
else if (t === "rgb") {
|
|
3122
|
-
const { r: n, g:
|
|
3123
|
-
this.input.value = `rgb(${n}, ${
|
|
3520
|
+
const { r: n, g: o, b: a } = S(this.currentColor);
|
|
3521
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
3124
3522
|
} else {
|
|
3125
|
-
const { hue: n, sat:
|
|
3523
|
+
const { hue: n, sat: o, lightness: a } = vt(e, i, s);
|
|
3126
3524
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3127
|
-
|
|
3128
|
-
)}%, ${Math.round(
|
|
3525
|
+
o * 100
|
|
3526
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
3129
3527
|
}
|
|
3130
3528
|
}
|
|
3131
3529
|
applyFromInput() {
|
|
@@ -3136,20 +3534,20 @@ class ie {
|
|
|
3136
3534
|
else {
|
|
3137
3535
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3138
3536
|
if (i) {
|
|
3139
|
-
const s = parseInt(i[1], 10), n = parseInt(i[2], 10),
|
|
3140
|
-
s <= 255 && n <= 255 &&
|
|
3537
|
+
const s = parseInt(i[1], 10), n = parseInt(i[2], 10), o = parseInt(i[3], 10);
|
|
3538
|
+
s <= 255 && n <= 255 && o <= 255 && (e = "#" + [s, n, o].map((a) => a.toString(16).padStart(2, "0")).join(""));
|
|
3141
3539
|
} else {
|
|
3142
3540
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3143
3541
|
if (s) {
|
|
3144
|
-
const n = parseInt(s[1], 10),
|
|
3145
|
-
e =
|
|
3542
|
+
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);
|
|
3543
|
+
e = U(n, r, l);
|
|
3146
3544
|
}
|
|
3147
3545
|
}
|
|
3148
3546
|
}
|
|
3149
3547
|
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3150
3548
|
}
|
|
3151
3549
|
updateOpacityBg() {
|
|
3152
|
-
const { r: t, g: e, b: i } =
|
|
3550
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
3153
3551
|
this.opacitySlider.style.setProperty(
|
|
3154
3552
|
"--base-color",
|
|
3155
3553
|
`rgb(${t}, ${e}, ${i})`
|
|
@@ -3169,15 +3567,15 @@ class ie {
|
|
|
3169
3567
|
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
3170
3568
|
}
|
|
3171
3569
|
initFromColor(t, e) {
|
|
3172
|
-
var
|
|
3570
|
+
var a;
|
|
3173
3571
|
this.currentColor = t, this.currentOpacity = e;
|
|
3174
|
-
const { h: i, s, v: n } =
|
|
3175
|
-
this.hueMarker.style.left = `${
|
|
3176
|
-
linear-gradient(to right, #fff, hsl(${
|
|
3572
|
+
const { h: i, s, v: n } = z(t), o = i >= 360 ? i % 360 : i;
|
|
3573
|
+
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),
|
|
3574
|
+
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);
|
|
3177
3575
|
}
|
|
3178
3576
|
commitRecentColor() {
|
|
3179
3577
|
var t;
|
|
3180
|
-
this.recentScope === "solid" && (
|
|
3578
|
+
this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
3181
3579
|
}
|
|
3182
3580
|
getElement() {
|
|
3183
3581
|
return this.element;
|
|
@@ -3190,7 +3588,7 @@ class ie {
|
|
|
3190
3588
|
this.initFromColor(t, e);
|
|
3191
3589
|
}
|
|
3192
3590
|
}
|
|
3193
|
-
const
|
|
3591
|
+
const H = class H extends x {
|
|
3194
3592
|
constructor(t = {}) {
|
|
3195
3593
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3196
3594
|
super({
|
|
@@ -3202,16 +3600,16 @@ const $ = class $ extends x {
|
|
|
3202
3600
|
angle: "number",
|
|
3203
3601
|
stops: "text"
|
|
3204
3602
|
}, 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) => {
|
|
3205
|
-
var
|
|
3603
|
+
var p;
|
|
3206
3604
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3207
|
-
const s = i.target, n = this.popoverEl.contains(s),
|
|
3605
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(
|
|
3208
3606
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3209
|
-
),
|
|
3607
|
+
), c = s.classList.contains(
|
|
3210
3608
|
"color-picker-backdrop"
|
|
3211
|
-
),
|
|
3609
|
+
), d = s.classList.contains(
|
|
3212
3610
|
"gradient-popover-backdrop"
|
|
3213
3611
|
);
|
|
3214
|
-
!n && !
|
|
3612
|
+
!n && !o && !l && !r && !c && !d && this.closePopover();
|
|
3215
3613
|
}, this.handlePopoverKeydown = (i) => {
|
|
3216
3614
|
if (this.isPopoverOpen) {
|
|
3217
3615
|
if (i.key === "Escape") {
|
|
@@ -3264,16 +3662,16 @@ const $ = class $ extends x {
|
|
|
3264
3662
|
const t = this.originalDefault;
|
|
3265
3663
|
if (typeof t == "string") {
|
|
3266
3664
|
if (t.startsWith("var(--"))
|
|
3267
|
-
return
|
|
3665
|
+
return B({
|
|
3268
3666
|
type: "solid",
|
|
3269
3667
|
angle: 0,
|
|
3270
3668
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3271
3669
|
});
|
|
3272
|
-
const i =
|
|
3670
|
+
const i = N(t);
|
|
3273
3671
|
if (i)
|
|
3274
|
-
return
|
|
3672
|
+
return B(i);
|
|
3275
3673
|
}
|
|
3276
|
-
return
|
|
3674
|
+
return B(t && typeof t == "object" ? t : {
|
|
3277
3675
|
type: "linear",
|
|
3278
3676
|
angle: 90,
|
|
3279
3677
|
stops: [
|
|
@@ -3284,17 +3682,17 @@ const $ = class $ extends x {
|
|
|
3284
3682
|
}
|
|
3285
3683
|
setValue(t) {
|
|
3286
3684
|
let e = null;
|
|
3287
|
-
typeof t == "string" ? t.startsWith("var(--") ? e =
|
|
3685
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = B({
|
|
3288
3686
|
type: "solid",
|
|
3289
3687
|
angle: 0,
|
|
3290
3688
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3291
|
-
}) : e =
|
|
3689
|
+
}) : e = N(t) : t && typeof t == "object" && (e = B(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();
|
|
3292
3690
|
}
|
|
3293
3691
|
updateUI() {
|
|
3294
3692
|
if (this.previewEl && this.value)
|
|
3295
3693
|
if (this.value.type === "solid") {
|
|
3296
3694
|
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3297
|
-
this.previewEl.style.background =
|
|
3695
|
+
this.previewEl.style.background = nt(i, e);
|
|
3298
3696
|
} else {
|
|
3299
3697
|
const t = this.resolveGradientGlobalVars(this.value);
|
|
3300
3698
|
this.previewEl.style.background = O(t);
|
|
@@ -3349,8 +3747,8 @@ const $ = class $ extends x {
|
|
|
3349
3747
|
if (n === 100)
|
|
3350
3748
|
this.inputEl.value = s;
|
|
3351
3749
|
else {
|
|
3352
|
-
const
|
|
3353
|
-
this.inputEl.value = `${s}${
|
|
3750
|
+
const a = Math.round(n / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3751
|
+
this.inputEl.value = `${s}${a}`;
|
|
3354
3752
|
}
|
|
3355
3753
|
}
|
|
3356
3754
|
} else
|
|
@@ -3362,7 +3760,7 @@ const $ = class $ extends x {
|
|
|
3362
3760
|
(i) => this.handlePaste(i)
|
|
3363
3761
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3364
3762
|
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = O(this.value)), this.inputEl.blur());
|
|
3365
|
-
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML =
|
|
3763
|
+
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = re, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
3366
3764
|
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3367
3765
|
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3368
3766
|
}
|
|
@@ -3385,21 +3783,21 @@ const $ = class $ extends x {
|
|
|
3385
3783
|
t.appendChild(l);
|
|
3386
3784
|
}
|
|
3387
3785
|
const i = document.createElement("button");
|
|
3388
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3786
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = yt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), at(t, this.popoverEl, (l, r) => {
|
|
3389
3787
|
this.popoverPosition = { left: l, top: r };
|
|
3390
3788
|
});
|
|
3391
3789
|
const s = document.createElement("div");
|
|
3392
3790
|
s.className = "gradient-editor";
|
|
3393
3791
|
const n = document.createElement("div");
|
|
3394
3792
|
n.className = "type-tabs-wrapper";
|
|
3395
|
-
const
|
|
3396
|
-
n.appendChild(
|
|
3397
|
-
const
|
|
3398
|
-
if (
|
|
3399
|
-
const l = e.children[0], r = e.children[1],
|
|
3400
|
-
this.currentMode =
|
|
3793
|
+
const o = this.createTypeTabs();
|
|
3794
|
+
n.appendChild(o), s.appendChild(n);
|
|
3795
|
+
const a = document.createElement("div");
|
|
3796
|
+
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
3797
|
+
const l = e.children[0], r = e.children[1], c = (d) => {
|
|
3798
|
+
this.currentMode = d, d === "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);
|
|
3401
3799
|
};
|
|
3402
|
-
l.addEventListener("click", () =>
|
|
3800
|
+
l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
|
|
3403
3801
|
}
|
|
3404
3802
|
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3405
3803
|
}
|
|
@@ -3408,12 +3806,12 @@ const $ = class $ extends x {
|
|
|
3408
3806
|
const t = document.createElement("div");
|
|
3409
3807
|
t.className = "gradient-type-tabs";
|
|
3410
3808
|
const e = document.createElement("button");
|
|
3411
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML =
|
|
3809
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = ae, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
|
|
3412
3810
|
const i = document.createElement("button");
|
|
3413
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML =
|
|
3414
|
-
var
|
|
3415
|
-
const
|
|
3416
|
-
this.switchType(
|
|
3811
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = le, i.style.minWidth = "32px", i.addEventListener("click", () => {
|
|
3812
|
+
var a, l;
|
|
3813
|
+
const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3814
|
+
this.switchType(o);
|
|
3417
3815
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3418
3816
|
}
|
|
3419
3817
|
switchType(t) {
|
|
@@ -3424,9 +3822,9 @@ const $ = class $ extends x {
|
|
|
3424
3822
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3425
3823
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3426
3824
|
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3427
|
-
const
|
|
3428
|
-
if (
|
|
3429
|
-
const l = this.resolveGlobalVarColor(
|
|
3825
|
+
const a = this.value.stops[0].color;
|
|
3826
|
+
if (a.startsWith("var(--")) {
|
|
3827
|
+
const l = this.resolveGlobalVarColor(a), r = N(l);
|
|
3430
3828
|
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({
|
|
3431
3829
|
color: "#786666",
|
|
3432
3830
|
position: 100,
|
|
@@ -3441,16 +3839,16 @@ const $ = class $ extends x {
|
|
|
3441
3839
|
} else if (t !== "solid" && this.value.stops.length >= 2)
|
|
3442
3840
|
this.value.angle || (this.value.angle = 90);
|
|
3443
3841
|
else if (t === "solid" && e && i) {
|
|
3444
|
-
const
|
|
3842
|
+
const o = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
3445
3843
|
this.value.stops = [
|
|
3446
|
-
{ color: i, position: 0, opacity:
|
|
3844
|
+
{ color: i, position: 0, opacity: o }
|
|
3447
3845
|
], this.value.angle = 0;
|
|
3448
3846
|
}
|
|
3449
3847
|
if (this.popoverEl) {
|
|
3450
|
-
const
|
|
3451
|
-
|
|
3452
|
-
const
|
|
3453
|
-
t === "solid" ?
|
|
3848
|
+
const o = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3849
|
+
o.forEach((r) => r.classList.remove("active"));
|
|
3850
|
+
const a = o[0], l = o[1];
|
|
3851
|
+
t === "solid" ? a == null || a.classList.add("active") : l == null || l.classList.add("active");
|
|
3454
3852
|
}
|
|
3455
3853
|
const s = (n = this.popoverEl) == null ? void 0 : n.querySelector(".gradient-editor-content");
|
|
3456
3854
|
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
@@ -3466,17 +3864,17 @@ const $ = class $ extends x {
|
|
|
3466
3864
|
}
|
|
3467
3865
|
renderGlobalColors(t) {
|
|
3468
3866
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3469
|
-
const e = this.value.stops[0], i = (
|
|
3470
|
-
|
|
3471
|
-
let
|
|
3867
|
+
const e = this.value.stops[0], i = (d) => {
|
|
3868
|
+
d.innerHTML = "";
|
|
3869
|
+
let p = {};
|
|
3472
3870
|
try {
|
|
3473
|
-
|
|
3871
|
+
p = x.GlobalVariables || {};
|
|
3474
3872
|
} catch (u) {
|
|
3475
3873
|
console.warn("Could not access Setting.GlobalVariables", u);
|
|
3476
3874
|
}
|
|
3477
|
-
if (!
|
|
3875
|
+
if (!p || Object.keys(p).length === 0) {
|
|
3478
3876
|
const u = document.createElement("div");
|
|
3479
|
-
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px",
|
|
3877
|
+
u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", d.appendChild(u);
|
|
3480
3878
|
return;
|
|
3481
3879
|
}
|
|
3482
3880
|
const g = [
|
|
@@ -3488,32 +3886,32 @@ const $ = class $ extends x {
|
|
|
3488
3886
|
title: "Text Color",
|
|
3489
3887
|
keys: ["text-dark", "text-light"]
|
|
3490
3888
|
}
|
|
3491
|
-
],
|
|
3889
|
+
], f = this.globalSearchQuery.toLowerCase();
|
|
3492
3890
|
let m;
|
|
3493
|
-
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"),
|
|
3494
|
-
const
|
|
3495
|
-
|
|
3891
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), d.appendChild(m), g.forEach((u) => {
|
|
3892
|
+
const v = Object.entries(p).filter(([C]) => !u.keys.includes(C) && u.title !== "Global Colors" ? !1 : u.keys.includes(C) && C.toLowerCase().includes(f));
|
|
3893
|
+
v.length !== 0 && v.forEach(([C, y]) => {
|
|
3496
3894
|
if (this.globalLayoutMode === "list") {
|
|
3497
3895
|
const w = document.createElement("div");
|
|
3498
3896
|
w.className = "global-color-row";
|
|
3499
3897
|
const k = document.createElement("div");
|
|
3500
3898
|
k.className = "global-color-circle";
|
|
3501
|
-
const
|
|
3502
|
-
k.style.background =
|
|
3899
|
+
const I = this.resolveGlobalVarColor(y);
|
|
3900
|
+
k.style.background = I, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && k.classList.add("selected");
|
|
3503
3901
|
const E = document.createElement("span");
|
|
3504
|
-
E.className = "global-color-label", E.textContent =
|
|
3902
|
+
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) => {
|
|
3505
3903
|
M.preventDefault();
|
|
3506
|
-
const
|
|
3507
|
-
this.setValue(
|
|
3904
|
+
const A = `var(--${C})`;
|
|
3905
|
+
this.setValue(A), this.pendingSolidColor = A, i(d);
|
|
3508
3906
|
}), m.appendChild(w);
|
|
3509
3907
|
} else {
|
|
3510
3908
|
const w = document.createElement("div");
|
|
3511
3909
|
w.className = "global-color-circle";
|
|
3512
3910
|
const k = this.resolveGlobalVarColor(y);
|
|
3513
|
-
w.style.background = k, w.title =
|
|
3911
|
+
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) => {
|
|
3514
3912
|
b.preventDefault();
|
|
3515
|
-
const E = `var(--${
|
|
3516
|
-
this.setValue(E), this.pendingSolidColor = E, i(
|
|
3913
|
+
const E = `var(--${C})`;
|
|
3914
|
+
this.setValue(E), this.pendingSolidColor = E, i(d);
|
|
3517
3915
|
}), m.appendChild(w);
|
|
3518
3916
|
}
|
|
3519
3917
|
});
|
|
@@ -3522,33 +3920,33 @@ const $ = class $ extends x {
|
|
|
3522
3920
|
s.className = "global-controls-row";
|
|
3523
3921
|
const n = document.createElement("div");
|
|
3524
3922
|
n.className = "global-search-container";
|
|
3525
|
-
const
|
|
3526
|
-
|
|
3527
|
-
const
|
|
3528
|
-
|
|
3923
|
+
const o = document.createElement("span");
|
|
3924
|
+
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>';
|
|
3925
|
+
const a = document.createElement("input");
|
|
3926
|
+
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
3529
3927
|
const l = document.createElement("div");
|
|
3530
|
-
|
|
3531
|
-
this.globalSearchQuery =
|
|
3532
|
-
}), n.appendChild(
|
|
3928
|
+
a.addEventListener("input", (d) => {
|
|
3929
|
+
this.globalSearchQuery = d.target.value, i(l);
|
|
3930
|
+
}), n.appendChild(o), n.appendChild(a);
|
|
3533
3931
|
const r = document.createElement("button");
|
|
3534
3932
|
r.className = "global-layout-toggle", r.type = "button";
|
|
3535
|
-
const
|
|
3933
|
+
const c = () => {
|
|
3536
3934
|
r.innerHTML = this.globalLayoutMode === "list" ? '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>';
|
|
3537
3935
|
};
|
|
3538
|
-
|
|
3539
|
-
this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list",
|
|
3936
|
+
c(), r.addEventListener("click", () => {
|
|
3937
|
+
this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", c(), i(l);
|
|
3540
3938
|
}), s.appendChild(n), s.appendChild(r), t.appendChild(s), t.appendChild(l), i(l);
|
|
3541
3939
|
}
|
|
3542
3940
|
renderSolid(t) {
|
|
3543
3941
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3544
|
-
const e = this.value.stops[0], i = new
|
|
3942
|
+
const e = this.value.stops[0], i = new ce({
|
|
3545
3943
|
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3546
3944
|
initialOpacity: e.opacity ?? 100,
|
|
3547
3945
|
onColorChange: (s, n) => {
|
|
3548
3946
|
if (this.clearGlobalBindingForCustomChange(), this.value) {
|
|
3549
|
-
const
|
|
3550
|
-
if (
|
|
3551
|
-
this.value =
|
|
3947
|
+
const o = N(s);
|
|
3948
|
+
if (o && o.type !== "solid") {
|
|
3949
|
+
this.value = o, this.switchType(o.type);
|
|
3552
3950
|
return;
|
|
3553
3951
|
}
|
|
3554
3952
|
this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s;
|
|
@@ -3561,17 +3959,17 @@ const $ = class $ extends x {
|
|
|
3561
3959
|
this.solidPicker = null;
|
|
3562
3960
|
let e = null;
|
|
3563
3961
|
{
|
|
3564
|
-
const
|
|
3565
|
-
|
|
3566
|
-
const
|
|
3567
|
-
|
|
3568
|
-
const
|
|
3569
|
-
|
|
3962
|
+
const c = document.createElement("div");
|
|
3963
|
+
c.className = "gradient-subtype-inline";
|
|
3964
|
+
const d = document.createElement("select");
|
|
3965
|
+
d.className = "gradient-subtype-select";
|
|
3966
|
+
const p = document.createElement("option");
|
|
3967
|
+
p.value = "linear", p.textContent = "Linear";
|
|
3570
3968
|
const g = document.createElement("option");
|
|
3571
|
-
g.value = "radial", g.textContent = "Radial",
|
|
3572
|
-
const
|
|
3573
|
-
|
|
3574
|
-
this.clearGlobalBindingForCustomChange(), this.switchType(
|
|
3969
|
+
g.value = "radial", g.textContent = "Radial", d.appendChild(p), d.appendChild(g), d.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°");
|
|
3970
|
+
const f = document.createElement("button");
|
|
3971
|
+
f.type = "button", f.className = "gradient-flip-btn", f.innerHTML = ne, d.addEventListener("change", () => {
|
|
3972
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(d.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
|
|
3575
3973
|
}), e.addEventListener("focus", (m) => {
|
|
3576
3974
|
const u = m.target;
|
|
3577
3975
|
u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
|
|
@@ -3580,16 +3978,16 @@ const $ = class $ extends x {
|
|
|
3580
3978
|
const u = parseInt(m.target.value);
|
|
3581
3979
|
!Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
|
|
3582
3980
|
}), e.addEventListener("blur", (m) => {
|
|
3583
|
-
var
|
|
3981
|
+
var C;
|
|
3584
3982
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3585
3983
|
const u = m.target;
|
|
3586
|
-
let
|
|
3587
|
-
Number.isNaN(
|
|
3588
|
-
}),
|
|
3984
|
+
let v = parseInt(u.value);
|
|
3985
|
+
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), u.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3986
|
+
}), f.addEventListener("click", () => {
|
|
3589
3987
|
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
3590
3988
|
m.position = 100 - m.position;
|
|
3591
3989
|
}), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
3592
|
-
}),
|
|
3990
|
+
}), c.appendChild(d), c.appendChild(e), c.appendChild(f), t.appendChild(c), this.updateDegreeVisibility(e);
|
|
3593
3991
|
}
|
|
3594
3992
|
const i = document.createElement("div");
|
|
3595
3993
|
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
@@ -3597,19 +3995,19 @@ const $ = class $ extends x {
|
|
|
3597
3995
|
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i);
|
|
3598
3996
|
const n = document.createElement("div");
|
|
3599
3997
|
n.className = "gradient-stops-header";
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3602
|
-
const
|
|
3603
|
-
|
|
3998
|
+
const o = document.createElement("span");
|
|
3999
|
+
o.textContent = "Stops";
|
|
4000
|
+
const a = document.createElement("button");
|
|
4001
|
+
a.type = "button", a.className = "gradient-add-stop", a.textContent = "+", n.appendChild(o), n.appendChild(a);
|
|
3604
4002
|
const l = document.createElement("div");
|
|
3605
4003
|
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
3606
|
-
const r =
|
|
3607
|
-
const
|
|
3608
|
-
|
|
4004
|
+
const r = lt((c) => {
|
|
4005
|
+
const d = N(c);
|
|
4006
|
+
d && (this.clearGlobalBindingForCustomChange(), this.value = d, this.switchType(d.type), this.updateUI(), this.triggerChange());
|
|
3609
4007
|
}, "all");
|
|
3610
|
-
this.recentGradientRefresh = r.refresh, t.appendChild(r.container),
|
|
3611
|
-
var
|
|
3612
|
-
this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((
|
|
4008
|
+
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
4009
|
+
var c;
|
|
4010
|
+
this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((c = document.activeElement) == null ? void 0 : c.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3613
4011
|
});
|
|
3614
4012
|
}
|
|
3615
4013
|
updateDegreeVisibility(t) {
|
|
@@ -3624,7 +4022,7 @@ const $ = class $ extends x {
|
|
|
3624
4022
|
e.style.background = O(this.value);
|
|
3625
4023
|
else {
|
|
3626
4024
|
const s = this.value.stops.map(
|
|
3627
|
-
(n) => `${
|
|
4025
|
+
(n) => `${nt(n.color, n.opacity ?? 100)} ${n.position}%`
|
|
3628
4026
|
).join(", ");
|
|
3629
4027
|
e.style.background = `linear-gradient(90deg, ${s})`;
|
|
3630
4028
|
}
|
|
@@ -3638,36 +4036,36 @@ const $ = class $ extends x {
|
|
|
3638
4036
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3639
4037
|
const n = document.createElement("div");
|
|
3640
4038
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3641
|
-
const
|
|
3642
|
-
|
|
3643
|
-
const
|
|
3644
|
-
|
|
3645
|
-
const l = new
|
|
3646
|
-
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u,
|
|
4039
|
+
const o = document.createElement("div");
|
|
4040
|
+
o.className = "gstop-chip";
|
|
4041
|
+
const a = this.resolveGlobalVarColor(i.color);
|
|
4042
|
+
o.style.backgroundColor = a, n.appendChild(o);
|
|
4043
|
+
const l = new gt((u, v) => {
|
|
4044
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3647
4045
|
}, "solid");
|
|
3648
|
-
let r = !1,
|
|
4046
|
+
let r = !1, c = !1, d = 0, p = 0;
|
|
3649
4047
|
const g = (u) => {
|
|
3650
|
-
r = !0,
|
|
3651
|
-
},
|
|
4048
|
+
r = !0, c = !1, d = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", f), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
|
|
4049
|
+
}, f = (u) => {
|
|
3652
4050
|
if (!r || !this.value) return;
|
|
3653
|
-
const
|
|
3654
|
-
if (Math.abs(
|
|
4051
|
+
const v = u.clientX - d;
|
|
4052
|
+
if (Math.abs(v) > 3 && (c = !0), c) {
|
|
3655
4053
|
this.clearGlobalBindingForCustomChange();
|
|
3656
|
-
const
|
|
3657
|
-
let y =
|
|
4054
|
+
const C = e.getBoundingClientRect();
|
|
4055
|
+
let y = p + v / C.width * 100;
|
|
3658
4056
|
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
3659
4057
|
}
|
|
3660
4058
|
}, m = (u) => {
|
|
3661
|
-
var
|
|
4059
|
+
var v;
|
|
3662
4060
|
if (r)
|
|
3663
|
-
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove",
|
|
3664
|
-
this.value && (this.value.stops.sort((
|
|
4061
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", m), c)
|
|
4062
|
+
this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
3665
4063
|
else {
|
|
3666
4064
|
u.stopPropagation();
|
|
3667
|
-
const
|
|
3668
|
-
|
|
3669
|
-
const y = this.resolveGlobalVarColor(
|
|
3670
|
-
l.open(y,
|
|
4065
|
+
const C = (v = this.value) == null ? void 0 : v.stops[s];
|
|
4066
|
+
C && setTimeout(() => {
|
|
4067
|
+
const y = this.resolveGlobalVarColor(C.color);
|
|
4068
|
+
l.open(y, o, C.opacity ?? 100);
|
|
3671
4069
|
}, 0);
|
|
3672
4070
|
}
|
|
3673
4071
|
};
|
|
@@ -3678,40 +4076,40 @@ const $ = class $ extends x {
|
|
|
3678
4076
|
var i;
|
|
3679
4077
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3680
4078
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3681
|
-
var k,
|
|
3682
|
-
const a = document.createElement("div");
|
|
3683
|
-
a.className = "gstop-row";
|
|
4079
|
+
var k, I;
|
|
3684
4080
|
const o = document.createElement("div");
|
|
3685
|
-
o.className = "gstop-
|
|
4081
|
+
o.className = "gstop-row";
|
|
4082
|
+
const a = document.createElement("div");
|
|
4083
|
+
a.className = "gstop-position-group";
|
|
3686
4084
|
const l = document.createElement("input");
|
|
3687
|
-
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px",
|
|
4085
|
+
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
3688
4086
|
const r = document.createElement("div");
|
|
3689
4087
|
r.className = "gstop-color-container";
|
|
3690
|
-
const
|
|
3691
|
-
|
|
3692
|
-
const
|
|
3693
|
-
|
|
4088
|
+
const c = this.resolveGlobalVarColor(s.color), d = document.createElement("div");
|
|
4089
|
+
d.className = "gstop-color-preview", d.style.backgroundColor = c;
|
|
4090
|
+
const p = document.createElement("input");
|
|
4091
|
+
p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
|
|
3694
4092
|
const g = document.createElement("button");
|
|
3695
|
-
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(
|
|
3696
|
-
const
|
|
3697
|
-
|
|
4093
|
+
g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(d), r.appendChild(p), r.appendChild(g);
|
|
4094
|
+
const f = document.createElement("button");
|
|
4095
|
+
f.type = "button", f.className = "gstop-del", f.innerHTML = oe, f.disabled = (((I = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(f), e.appendChild(o);
|
|
3698
4096
|
const m = document.createElement("span");
|
|
3699
4097
|
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3700
4098
|
const u = document.createElement("div");
|
|
3701
4099
|
u.className = "gstop-opacity-group";
|
|
3702
|
-
const
|
|
3703
|
-
|
|
3704
|
-
const
|
|
3705
|
-
|
|
4100
|
+
const v = document.createElement("input");
|
|
4101
|
+
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
|
|
4102
|
+
const C = S(c);
|
|
4103
|
+
v.style.setProperty(
|
|
3706
4104
|
"--slider-color",
|
|
3707
|
-
`rgb(${
|
|
4105
|
+
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3708
4106
|
);
|
|
3709
4107
|
const y = document.createElement("span");
|
|
3710
|
-
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(
|
|
3711
|
-
const w = new
|
|
3712
|
-
this.clearGlobalBindingForCustomChange(),
|
|
3713
|
-
const M =
|
|
3714
|
-
|
|
4108
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(v), u.appendChild(y);
|
|
4109
|
+
const w = new gt((b, E) => {
|
|
4110
|
+
this.clearGlobalBindingForCustomChange(), p.value = b.replace("#", "").toUpperCase(), d.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}%`);
|
|
4111
|
+
const M = S(b);
|
|
4112
|
+
v.style.setProperty(
|
|
3715
4113
|
"--slider-color",
|
|
3716
4114
|
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3717
4115
|
), this.updateGradientPreview(), this.createHandles(
|
|
@@ -3719,27 +4117,27 @@ const $ = class $ extends x {
|
|
|
3719
4117
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3720
4118
|
), this.updateUI(), this.triggerChange();
|
|
3721
4119
|
}, "solid");
|
|
3722
|
-
|
|
4120
|
+
p.addEventListener("click", (b) => {
|
|
3723
4121
|
b.preventDefault(), b.stopPropagation();
|
|
3724
4122
|
const E = this.resolveGlobalVarColor(s.color);
|
|
3725
|
-
w.open(E,
|
|
3726
|
-
}),
|
|
4123
|
+
w.open(E, p, s.opacity ?? 100);
|
|
4124
|
+
}), p.addEventListener("input", () => {
|
|
3727
4125
|
this.clearGlobalBindingForCustomChange();
|
|
3728
|
-
const b =
|
|
4126
|
+
const b = p.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
|
|
3729
4127
|
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3730
|
-
this.value.stops[n].color = E,
|
|
3731
|
-
const M =
|
|
3732
|
-
|
|
4128
|
+
this.value.stops[n].color = E, d.style.backgroundColor = E;
|
|
4129
|
+
const M = S(E);
|
|
4130
|
+
v.style.setProperty(
|
|
3733
4131
|
"--slider-color",
|
|
3734
4132
|
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3735
4133
|
), this.debouncedPreviewUpdate();
|
|
3736
4134
|
}
|
|
3737
|
-
}),
|
|
4135
|
+
}), p.addEventListener("blur", () => {
|
|
3738
4136
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3739
4137
|
}), g.addEventListener("click", async (b) => {
|
|
3740
4138
|
b.stopPropagation();
|
|
3741
4139
|
try {
|
|
3742
|
-
await navigator.clipboard.writeText(`#${
|
|
4140
|
+
await navigator.clipboard.writeText(`#${p.value}`);
|
|
3743
4141
|
} catch {
|
|
3744
4142
|
}
|
|
3745
4143
|
}), l.addEventListener("focus", (b) => {
|
|
@@ -3749,8 +4147,8 @@ const $ = class $ extends x {
|
|
|
3749
4147
|
this.clearGlobalBindingForCustomChange();
|
|
3750
4148
|
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3751
4149
|
if (!Number.isNaN(M)) {
|
|
3752
|
-
const
|
|
3753
|
-
this.value.stops[n].position =
|
|
4150
|
+
const A = Math.max(0, Math.min(100, M));
|
|
4151
|
+
this.value.stops[n].position = A, E.value = `${A}%`, this.debouncedPreviewUpdate();
|
|
3754
4152
|
}
|
|
3755
4153
|
}), l.addEventListener("blur", (b) => {
|
|
3756
4154
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
@@ -3758,56 +4156,56 @@ const $ = class $ extends x {
|
|
|
3758
4156
|
if (Number.isNaN(M))
|
|
3759
4157
|
E.value = `${this.value.stops[n].position}%`;
|
|
3760
4158
|
else {
|
|
3761
|
-
const
|
|
3762
|
-
this.value.stops[n].position =
|
|
4159
|
+
const A = Math.max(0, Math.min(100, M));
|
|
4160
|
+
this.value.stops[n].position = A, E.value = `${A}%`;
|
|
3763
4161
|
}
|
|
3764
4162
|
this.updateGradientPreview(), this.createHandles(
|
|
3765
4163
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3766
4164
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3767
4165
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3768
|
-
}),
|
|
4166
|
+
}), f.addEventListener("click", () => {
|
|
3769
4167
|
var b;
|
|
3770
4168
|
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
3771
4169
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3772
4170
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3773
4171
|
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((b = document.activeElement) == null ? void 0 : b.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3774
|
-
}),
|
|
4172
|
+
}), v.addEventListener("input", () => {
|
|
3775
4173
|
this.clearGlobalBindingForCustomChange();
|
|
3776
|
-
const b = parseInt(
|
|
4174
|
+
const b = parseInt(v.value, 10);
|
|
3777
4175
|
this.value.stops[n].opacity = Math.max(0, Math.min(100, b)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3778
|
-
}),
|
|
4176
|
+
}), v.addEventListener("change", () => {
|
|
3779
4177
|
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3780
4178
|
});
|
|
3781
4179
|
}));
|
|
3782
4180
|
}
|
|
3783
4181
|
addStop() {
|
|
3784
4182
|
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3785
|
-
const t = this.value.stops.map((
|
|
4183
|
+
const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
|
|
3786
4184
|
let e = 50, i = 0;
|
|
3787
|
-
for (let
|
|
3788
|
-
const
|
|
3789
|
-
|
|
4185
|
+
for (let o = 0; o < t.length - 1; o++) {
|
|
4186
|
+
const a = t[o + 1] - t[o];
|
|
4187
|
+
a > i && (i = a, e = t[o] + a / 2);
|
|
3790
4188
|
}
|
|
3791
4189
|
const s = this.value.stops.reduce(
|
|
3792
|
-
(
|
|
4190
|
+
(o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o
|
|
3793
4191
|
), n = {
|
|
3794
4192
|
position: Math.round(e),
|
|
3795
4193
|
color: s.color,
|
|
3796
4194
|
opacity: s.opacity ?? 100
|
|
3797
4195
|
};
|
|
3798
|
-
this.value.stops.push(n), this.value.stops.sort((
|
|
4196
|
+
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3799
4197
|
}
|
|
3800
4198
|
openPopover() {
|
|
3801
|
-
if (this.popoverEl && (
|
|
3802
|
-
if (this.isPopoverOpen = !0,
|
|
4199
|
+
if (this.popoverEl && (H.openInstance && H.openInstance !== this && H.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
4200
|
+
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) {
|
|
3803
4201
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3804
4202
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3805
|
-
const
|
|
3806
|
-
let
|
|
3807
|
-
const r = i - t.right,
|
|
3808
|
-
r <
|
|
3809
|
-
const
|
|
3810
|
-
g >=
|
|
4203
|
+
const o = this.popoverEl.offsetHeight;
|
|
4204
|
+
let a = t.right + 8, l = t.top;
|
|
4205
|
+
const r = i - t.right, c = t.left, d = e + n;
|
|
4206
|
+
r < d && c > r + 100 && (a = t.left - e - 8);
|
|
4207
|
+
const p = s - t.bottom, g = t.top;
|
|
4208
|
+
g >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : g > p ? (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 };
|
|
3811
4209
|
}
|
|
3812
4210
|
setTimeout(
|
|
3813
4211
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3824,24 +4222,24 @@ const $ = class $ extends x {
|
|
|
3824
4222
|
}
|
|
3825
4223
|
requestAnimationFrame(() => {
|
|
3826
4224
|
if (!this.popoverEl || !this.element) return;
|
|
3827
|
-
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight,
|
|
4225
|
+
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight, o = 16;
|
|
3828
4226
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3829
|
-
const
|
|
4227
|
+
const a = this.popoverEl.offsetHeight;
|
|
3830
4228
|
let l = e.right + 8, r = e.top;
|
|
3831
|
-
const
|
|
3832
|
-
|
|
3833
|
-
const g = n - e.bottom,
|
|
3834
|
-
|
|
4229
|
+
const c = s - e.right, d = e.left, p = i + o;
|
|
4230
|
+
c < p && d > c + 100 && (l = e.left - i - 8);
|
|
4231
|
+
const g = n - e.bottom, f = e.top;
|
|
4232
|
+
f >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : f > g ? (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`;
|
|
3835
4233
|
});
|
|
3836
4234
|
}
|
|
3837
4235
|
}
|
|
3838
4236
|
refreshPopoverContent() {
|
|
3839
|
-
var n,
|
|
4237
|
+
var n, o;
|
|
3840
4238
|
if (!this.popoverEl) return;
|
|
3841
4239
|
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3842
|
-
t.forEach((
|
|
4240
|
+
t.forEach((a) => a.classList.remove("active"));
|
|
3843
4241
|
const e = t[0], i = t[1];
|
|
3844
|
-
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (
|
|
4242
|
+
((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;
|
|
3845
4243
|
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3846
4244
|
s && this.updatePopoverContent(s);
|
|
3847
4245
|
}
|
|
@@ -3850,13 +4248,13 @@ const $ = class $ extends x {
|
|
|
3850
4248
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3851
4249
|
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") {
|
|
3852
4250
|
const e = O(this.value);
|
|
3853
|
-
|
|
4251
|
+
R.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3854
4252
|
}
|
|
3855
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
4253
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), H.openInstance === this && (H.openInstance = null);
|
|
3856
4254
|
}
|
|
3857
4255
|
}
|
|
3858
4256
|
commitPendingSolidColor() {
|
|
3859
|
-
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() :
|
|
4257
|
+
this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : R.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
|
|
3860
4258
|
}
|
|
3861
4259
|
handlePaste(t) {
|
|
3862
4260
|
var i;
|
|
@@ -3871,7 +4269,7 @@ const $ = class $ extends x {
|
|
|
3871
4269
|
parseAndSet(t) {
|
|
3872
4270
|
let e = t.trim();
|
|
3873
4271
|
e && !e.startsWith("#") && !e.startsWith("var(") && !e.startsWith("rgb") && !e.startsWith("hsl") && !e.includes("gradient") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$|^[0-9A-Fa-f]{8}$/.test(e) && (e = "#" + e, this.inputEl && (this.inputEl.value = e));
|
|
3874
|
-
const i =
|
|
4272
|
+
const i = N(e);
|
|
3875
4273
|
i && this.setValue(i);
|
|
3876
4274
|
}
|
|
3877
4275
|
getChangePayload() {
|
|
@@ -3904,18 +4302,18 @@ const $ = class $ extends x {
|
|
|
3904
4302
|
return this.value;
|
|
3905
4303
|
}
|
|
3906
4304
|
};
|
|
3907
|
-
|
|
3908
|
-
let
|
|
3909
|
-
const
|
|
4305
|
+
H.openInstance = null;
|
|
4306
|
+
let Y = H;
|
|
4307
|
+
const he = `
|
|
3910
4308
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3911
4309
|
<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"/>
|
|
3912
4310
|
</svg>
|
|
3913
|
-
`,
|
|
4311
|
+
`, de = `
|
|
3914
4312
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3915
4313
|
<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"/>
|
|
3916
4314
|
</svg>
|
|
3917
4315
|
`;
|
|
3918
|
-
class
|
|
4316
|
+
class Te extends T {
|
|
3919
4317
|
constructor(t) {
|
|
3920
4318
|
super({
|
|
3921
4319
|
title: "Border",
|
|
@@ -3923,17 +4321,17 @@ class Le extends T {
|
|
|
3923
4321
|
settings: {
|
|
3924
4322
|
size: new P({
|
|
3925
4323
|
title: "Size",
|
|
3926
|
-
icon:
|
|
4324
|
+
icon: de,
|
|
3927
4325
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3928
4326
|
suffix: "px"
|
|
3929
4327
|
}),
|
|
3930
|
-
color: new
|
|
4328
|
+
color: new Y({
|
|
3931
4329
|
title: "Border Color",
|
|
3932
4330
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3933
4331
|
}),
|
|
3934
4332
|
radius: new P({
|
|
3935
4333
|
title: "Radius",
|
|
3936
|
-
icon:
|
|
4334
|
+
icon: he,
|
|
3937
4335
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3938
4336
|
suffix: "px"
|
|
3939
4337
|
})
|
|
@@ -3957,20 +4355,20 @@ class Le extends T {
|
|
|
3957
4355
|
`;
|
|
3958
4356
|
}
|
|
3959
4357
|
}
|
|
3960
|
-
const
|
|
4358
|
+
const pe = `
|
|
3961
4359
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3962
4360
|
<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"/>
|
|
3963
4361
|
</svg>
|
|
3964
|
-
`,
|
|
4362
|
+
`, ue = `
|
|
3965
4363
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3966
4364
|
<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"/>
|
|
3967
4365
|
</svg>
|
|
3968
|
-
`,
|
|
4366
|
+
`, ge = `
|
|
3969
4367
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3970
4368
|
<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"/>
|
|
3971
4369
|
</svg>
|
|
3972
4370
|
`;
|
|
3973
|
-
class
|
|
4371
|
+
class Pe extends T {
|
|
3974
4372
|
constructor(t = {}) {
|
|
3975
4373
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3976
4374
|
super({
|
|
@@ -3978,13 +4376,13 @@ class ke extends T {
|
|
|
3978
4376
|
collapsed: i.collapsed,
|
|
3979
4377
|
settings: (() => {
|
|
3980
4378
|
const s = {
|
|
3981
|
-
color: new
|
|
4379
|
+
color: new Y({
|
|
3982
4380
|
title: "Color",
|
|
3983
4381
|
default: i.colorDefault ?? "#001E1E"
|
|
3984
4382
|
}),
|
|
3985
|
-
fontFamily: new
|
|
4383
|
+
fontFamily: new it({
|
|
3986
4384
|
title: "Font",
|
|
3987
|
-
icon:
|
|
4385
|
+
icon: pe,
|
|
3988
4386
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3989
4387
|
options: i.fontFamilyOptions ?? [
|
|
3990
4388
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3995,9 +4393,9 @@ class ke extends T {
|
|
|
3995
4393
|
getOptions: i.fontFamilyGetOptions,
|
|
3996
4394
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3997
4395
|
}),
|
|
3998
|
-
fontWeight: new
|
|
4396
|
+
fontWeight: new it({
|
|
3999
4397
|
title: "Weight",
|
|
4000
|
-
icon:
|
|
4398
|
+
icon: ue,
|
|
4001
4399
|
default: i.fontWeightDefault ?? "400",
|
|
4002
4400
|
options: i.fontWeightOptions ?? [
|
|
4003
4401
|
{ name: "Regular", value: "400" },
|
|
@@ -4009,7 +4407,7 @@ class ke extends T {
|
|
|
4009
4407
|
}),
|
|
4010
4408
|
fontSize: new P({
|
|
4011
4409
|
title: "Size",
|
|
4012
|
-
icon:
|
|
4410
|
+
icon: ge,
|
|
4013
4411
|
default: i.fontSizeDefault ?? 12,
|
|
4014
4412
|
suffix: "px",
|
|
4015
4413
|
mobile: i.fontSizeMobileDefault
|
|
@@ -4017,7 +4415,7 @@ class ke extends T {
|
|
|
4017
4415
|
};
|
|
4018
4416
|
return e ? {
|
|
4019
4417
|
...s,
|
|
4020
|
-
align: new
|
|
4418
|
+
align: new $t({
|
|
4021
4419
|
title: "Align",
|
|
4022
4420
|
default: i.alignDefault ?? "center"
|
|
4023
4421
|
})
|
|
@@ -4026,8 +4424,8 @@ class ke extends T {
|
|
|
4026
4424
|
});
|
|
4027
4425
|
}
|
|
4028
4426
|
getCssCode() {
|
|
4029
|
-
var
|
|
4030
|
-
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 = ((
|
|
4427
|
+
var o;
|
|
4428
|
+
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";
|
|
4031
4429
|
return `
|
|
4032
4430
|
color: ${t};
|
|
4033
4431
|
font-family: ${e};
|
|
@@ -4037,8 +4435,8 @@ class ke extends T {
|
|
|
4037
4435
|
`;
|
|
4038
4436
|
}
|
|
4039
4437
|
getTextGradientCss() {
|
|
4040
|
-
var
|
|
4041
|
-
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 = ((
|
|
4438
|
+
var a;
|
|
4439
|
+
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";
|
|
4042
4440
|
return `
|
|
4043
4441
|
${Object.entries(t).map(([l, r]) => `${l}: ${r};`).join(`
|
|
4044
4442
|
`)}
|
|
@@ -4049,7 +4447,7 @@ class ke extends T {
|
|
|
4049
4447
|
`;
|
|
4050
4448
|
}
|
|
4051
4449
|
}
|
|
4052
|
-
class
|
|
4450
|
+
class J extends x {
|
|
4053
4451
|
constructor(t) {
|
|
4054
4452
|
super({
|
|
4055
4453
|
...t,
|
|
@@ -4057,11 +4455,11 @@ class q extends x {
|
|
|
4057
4455
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
4058
4456
|
}
|
|
4059
4457
|
draw() {
|
|
4060
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
4061
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
4458
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
4459
|
+
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", () => {
|
|
4062
4460
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
4063
|
-
let
|
|
4064
|
-
|
|
4461
|
+
let c = Number(a.value);
|
|
4462
|
+
c < l && (c = l), c > r && (c = r), a.value = String(c);
|
|
4065
4463
|
}));
|
|
4066
4464
|
}, i = this.createInput({
|
|
4067
4465
|
value: this.value,
|
|
@@ -4082,9 +4480,9 @@ class q extends x {
|
|
|
4082
4480
|
s && (s.style.paddingRight = "35px");
|
|
4083
4481
|
const n = document.createElement("span");
|
|
4084
4482
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
4085
|
-
const
|
|
4086
|
-
return
|
|
4087
|
-
const l =
|
|
4483
|
+
const o = i.querySelector("input");
|
|
4484
|
+
return o && (o.oninput = (a) => {
|
|
4485
|
+
const l = a.target.value.trim();
|
|
4088
4486
|
if (l.toLowerCase() === "auto")
|
|
4089
4487
|
this.value = "auto";
|
|
4090
4488
|
else {
|
|
@@ -4095,33 +4493,33 @@ class q extends x {
|
|
|
4095
4493
|
}), i;
|
|
4096
4494
|
}
|
|
4097
4495
|
}
|
|
4098
|
-
class
|
|
4496
|
+
class Oe extends T {
|
|
4099
4497
|
constructor(t) {
|
|
4100
4498
|
super({
|
|
4101
4499
|
title: "Margins",
|
|
4102
4500
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4103
4501
|
settings: {
|
|
4104
|
-
marginTop: new
|
|
4502
|
+
marginTop: new J({
|
|
4105
4503
|
title: "Top",
|
|
4106
|
-
icon:
|
|
4504
|
+
icon: me,
|
|
4107
4505
|
suffix: "px",
|
|
4108
4506
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
4109
4507
|
}),
|
|
4110
|
-
marginRight: new
|
|
4508
|
+
marginRight: new J({
|
|
4111
4509
|
title: "Right",
|
|
4112
|
-
icon:
|
|
4510
|
+
icon: ve,
|
|
4113
4511
|
suffix: "px",
|
|
4114
4512
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
4115
4513
|
}),
|
|
4116
|
-
marginBottom: new
|
|
4514
|
+
marginBottom: new J({
|
|
4117
4515
|
title: "Bottom",
|
|
4118
|
-
icon:
|
|
4516
|
+
icon: fe,
|
|
4119
4517
|
suffix: "px",
|
|
4120
4518
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
4121
4519
|
}),
|
|
4122
|
-
marginLeft: new
|
|
4520
|
+
marginLeft: new J({
|
|
4123
4521
|
title: "Left",
|
|
4124
|
-
icon:
|
|
4522
|
+
icon: Ce,
|
|
4125
4523
|
suffix: "px",
|
|
4126
4524
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
4127
4525
|
})
|
|
@@ -4138,26 +4536,26 @@ class Me extends T {
|
|
|
4138
4536
|
`;
|
|
4139
4537
|
}
|
|
4140
4538
|
}
|
|
4141
|
-
const
|
|
4539
|
+
const me = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4142
4540
|
<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"/>
|
|
4143
|
-
</svg>`,
|
|
4541
|
+
</svg>`, ve = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4144
4542
|
<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"/>
|
|
4145
|
-
</svg>`,
|
|
4543
|
+
</svg>`, fe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4146
4544
|
<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"/>
|
|
4147
|
-
</svg>`,
|
|
4545
|
+
</svg>`, Ce = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4148
4546
|
<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"/>
|
|
4149
4547
|
</svg>`;
|
|
4150
|
-
class
|
|
4548
|
+
class $e extends T {
|
|
4151
4549
|
constructor(t) {
|
|
4152
4550
|
super({
|
|
4153
4551
|
title: "Background Image",
|
|
4154
4552
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4155
4553
|
settings: {
|
|
4156
|
-
backgroundImage: new
|
|
4554
|
+
backgroundImage: new ot({
|
|
4157
4555
|
...t == null ? void 0 : t.uploadProps,
|
|
4158
4556
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
4159
4557
|
}),
|
|
4160
|
-
opacity: new
|
|
4558
|
+
opacity: new Pt({
|
|
4161
4559
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4162
4560
|
}),
|
|
4163
4561
|
backgroundColor: new F({
|
|
@@ -4169,10 +4567,10 @@ class Se extends T {
|
|
|
4169
4567
|
draw() {
|
|
4170
4568
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
4171
4569
|
if (!e) return t;
|
|
4172
|
-
const i = Array.from(e.children), [s, n,
|
|
4570
|
+
const i = Array.from(e.children), [s, n, o] = i;
|
|
4173
4571
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
4174
|
-
const
|
|
4175
|
-
return
|
|
4572
|
+
const a = document.createElement("div");
|
|
4573
|
+
return a.className = "bgset-or-label", a.textContent = "OR", e.appendChild(a), e.appendChild(o), t;
|
|
4176
4574
|
}
|
|
4177
4575
|
getCssCode() {
|
|
4178
4576
|
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
@@ -4186,21 +4584,21 @@ class Se extends T {
|
|
|
4186
4584
|
`;
|
|
4187
4585
|
}
|
|
4188
4586
|
}
|
|
4189
|
-
class
|
|
4587
|
+
class He extends T {
|
|
4190
4588
|
constructor(t) {
|
|
4191
4589
|
super({
|
|
4192
4590
|
title: (t == null ? void 0 : t.title) ?? "Image",
|
|
4193
4591
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4194
4592
|
settings: {
|
|
4195
|
-
image: new
|
|
4593
|
+
image: new ot({
|
|
4196
4594
|
...t == null ? void 0 : t.uploadProps,
|
|
4197
4595
|
default: (t == null ? void 0 : t.image) ?? ""
|
|
4198
4596
|
}),
|
|
4199
|
-
width: new
|
|
4597
|
+
width: new Jt({
|
|
4200
4598
|
default: (t == null ? void 0 : t.width) ?? 1e3,
|
|
4201
4599
|
mobile: t == null ? void 0 : t.widthMobile
|
|
4202
4600
|
}),
|
|
4203
|
-
height: new
|
|
4601
|
+
height: new jt({
|
|
4204
4602
|
default: (t == null ? void 0 : t.height) ?? 300,
|
|
4205
4603
|
mobile: t == null ? void 0 : t.heightMobile
|
|
4206
4604
|
})
|
|
@@ -4209,41 +4607,42 @@ class Ie extends T {
|
|
|
4209
4607
|
}
|
|
4210
4608
|
}
|
|
4211
4609
|
export {
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4610
|
+
$t as AlignSetting,
|
|
4611
|
+
Ve as AnimationSetting,
|
|
4612
|
+
$e as BackgroundSettingSet,
|
|
4613
|
+
Te as BorderSettingSet,
|
|
4614
|
+
we as ButtonSetting,
|
|
4217
4615
|
V as ColorSetting,
|
|
4218
4616
|
F as ColorWithOpacitySetting,
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4617
|
+
xe as DimensionSetting,
|
|
4618
|
+
Me as GapSetting,
|
|
4619
|
+
Y as GradientSetting,
|
|
4620
|
+
Pe as HeaderTypographySettingSet,
|
|
4621
|
+
jt as HeightSetting,
|
|
4622
|
+
Ee as HtmlSetting,
|
|
4623
|
+
ht as ImageMapSetting,
|
|
4624
|
+
He as ImageSettingSet,
|
|
4625
|
+
Ie as MarginBottomSetting,
|
|
4626
|
+
Oe as MarginSettingGroup,
|
|
4627
|
+
Ne as MarginTopSetting,
|
|
4628
|
+
Se as MultiLanguageSetting,
|
|
4230
4629
|
P as NumberSetting,
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4630
|
+
Pt as OpacitySetting,
|
|
4631
|
+
Le as SelectApiSettings,
|
|
4632
|
+
it as SelectSetting,
|
|
4234
4633
|
x as Setting,
|
|
4235
4634
|
T as SettingGroup,
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4635
|
+
Nt as StringSetting,
|
|
4636
|
+
Mt as TabSettingGroup,
|
|
4637
|
+
Mt as TabsSettingGroup,
|
|
4638
|
+
ke as Toggle,
|
|
4639
|
+
ot as UploadSetting,
|
|
4640
|
+
Jt as WidthSetting,
|
|
4641
|
+
be as asSettingGroupWithSettings,
|
|
4642
|
+
It as createSettingGroup,
|
|
4643
|
+
ye as createTabSettingGroup,
|
|
4644
|
+
D as isSetting,
|
|
4645
|
+
ct as isSettingChild,
|
|
4247
4646
|
L as isSettingGroup,
|
|
4248
|
-
|
|
4647
|
+
q as iterateSettings
|
|
4249
4648
|
};
|