builder-settings-types 0.0.311 → 0.0.312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +56 -56
- package/dist/builder-settings-types.es.js +1165 -1070
- package/dist/groups/image-setting-set/imageSettingSet.d.ts +21 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/settings/gradient-settings/GradientSetting.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
let t = "", e = crypto.getRandomValues(new Uint8Array(
|
|
4
|
-
for (;
|
|
5
|
-
t +=
|
|
1
|
+
const yt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let pt = (c = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
|
|
4
|
+
for (; c--; )
|
|
5
|
+
t += yt[e[c] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function bt(c) {
|
|
9
|
+
let t = 0, e = c.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function _(c, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function tt(c, t = 0) {
|
|
19
|
+
c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
|
-
|
|
21
|
+
_(s, n), tt(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const Et = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class wt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...Et, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class bt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = bt(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class bt {
|
|
|
111
111
|
this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
if (typeof
|
|
114
|
+
const at = new wt();
|
|
115
|
+
function X(c) {
|
|
116
|
+
if (c === null || typeof c != "object") return c;
|
|
117
|
+
if (c instanceof Date) return new Date(c.getTime());
|
|
118
|
+
if (c instanceof Array) return c.map((t) => X(t));
|
|
119
|
+
if (typeof c == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in c)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(c, e) && (t[e] = X(c[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return c;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function xt(c) {
|
|
128
|
+
switch (c) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,18 +142,18 @@ function Et(h) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
const
|
|
145
|
+
const G = class G {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || pt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
|
|
148
148
|
}
|
|
149
149
|
static SetUploadUrl(t) {
|
|
150
|
-
globalThis.DefaultUploadUrl = t,
|
|
150
|
+
globalThis.DefaultUploadUrl = t, G.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, G.DefaultLanguage = t;
|
|
154
154
|
}
|
|
155
155
|
static SetGlobalVariables(t) {
|
|
156
|
-
|
|
156
|
+
G.GlobalVariables = { ...G.GlobalVariables, ...t };
|
|
157
157
|
}
|
|
158
158
|
destroy() {
|
|
159
159
|
throw new Error("Method not implemented.");
|
|
@@ -174,30 +174,30 @@ const B = class B {
|
|
|
174
174
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
175
175
|
}
|
|
176
176
|
clone() {
|
|
177
|
-
const t = this.constructor, e =
|
|
178
|
-
return i.value =
|
|
177
|
+
const t = this.constructor, e = X(this.props), i = new t(e);
|
|
178
|
+
return i.value = X(this.value), i;
|
|
179
179
|
}
|
|
180
180
|
createInput(t) {
|
|
181
181
|
t = { ...this.props.inputProps, ...t };
|
|
182
182
|
const e = document.createElement("div");
|
|
183
183
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
184
|
+
const a = document.createElement("div");
|
|
185
|
+
if (a.className = "icon-container", t.icon) {
|
|
186
186
|
const l = this.createIcon(t.icon, t.iconClassName);
|
|
187
|
-
|
|
187
|
+
a.appendChild(l);
|
|
188
188
|
}
|
|
189
189
|
if (t.title) {
|
|
190
190
|
const l = this.createLabel(t.title, t.labelClassName);
|
|
191
|
-
|
|
191
|
+
a.appendChild(l);
|
|
192
192
|
}
|
|
193
|
-
e.appendChild(
|
|
193
|
+
e.appendChild(a);
|
|
194
194
|
}
|
|
195
195
|
const i = document.createElement("div");
|
|
196
196
|
i.className = t.wrapperClassName || "";
|
|
197
197
|
const s = document.createElement("input");
|
|
198
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
199
|
-
const n = (
|
|
200
|
-
const l =
|
|
198
|
+
this.inputEl = s, s.value = String(t.value || xt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
199
|
+
const n = (a) => {
|
|
200
|
+
const l = a.target;
|
|
201
201
|
let r = l.value;
|
|
202
202
|
switch (t.inputType) {
|
|
203
203
|
case "number":
|
|
@@ -222,10 +222,10 @@ const B = class B {
|
|
|
222
222
|
r = l.value;
|
|
223
223
|
}
|
|
224
224
|
this.value = r, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
225
|
-
},
|
|
226
|
-
|
|
225
|
+
}, o = (a) => {
|
|
226
|
+
a.target, this.onBlur && this.onBlur(this.value);
|
|
227
227
|
};
|
|
228
|
-
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur",
|
|
228
|
+
return s.addEventListener("input", n), s.addEventListener("change", n), s.addEventListener("blur", o), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
229
229
|
}
|
|
230
230
|
createLabel(t, e) {
|
|
231
231
|
const i = document.createElement("span");
|
|
@@ -236,7 +236,7 @@ const B = class B {
|
|
|
236
236
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
G.GlobalVariables = {
|
|
240
240
|
// Global Colors (each supports solid OR gradient)
|
|
241
241
|
primary: "#00141E",
|
|
242
242
|
secondary: "#00141E",
|
|
@@ -246,31 +246,31 @@ B.GlobalVariables = {
|
|
|
246
246
|
"text-dark": "#00141E",
|
|
247
247
|
"text-light": "#00141E"
|
|
248
248
|
};
|
|
249
|
-
let x =
|
|
250
|
-
function A(
|
|
251
|
-
return
|
|
249
|
+
let x = G;
|
|
250
|
+
function A(c) {
|
|
251
|
+
return c instanceof x;
|
|
252
252
|
}
|
|
253
|
-
function L(
|
|
254
|
-
return
|
|
253
|
+
function L(c) {
|
|
254
|
+
return c instanceof T;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return A(
|
|
256
|
+
function lt(c) {
|
|
257
|
+
return A(c) || L(c);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
for (const e in
|
|
261
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
262
|
-
const i =
|
|
259
|
+
function j(c, t) {
|
|
260
|
+
for (const e in c)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(c, e)) {
|
|
262
|
+
const i = c[e];
|
|
263
263
|
t(e, i);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const Y = class Y {
|
|
267
267
|
constructor(t) {
|
|
268
268
|
this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
|
|
269
|
-
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id ||
|
|
269
|
+
}, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || pt(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
270
270
|
}
|
|
271
271
|
propagateNestingLevel() {
|
|
272
272
|
const t = this.nestingLevel + 1;
|
|
273
|
-
|
|
273
|
+
j(this.settings, (e, i) => {
|
|
274
274
|
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
275
275
|
});
|
|
276
276
|
}
|
|
@@ -287,13 +287,13 @@ const K = class K {
|
|
|
287
287
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
288
288
|
}
|
|
289
289
|
propagateDataPropsPath() {
|
|
290
|
-
|
|
290
|
+
j(this.settings, (t, e) => {
|
|
291
291
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
292
292
|
(L(e) || A(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
updateNestingStyles() {
|
|
296
|
-
this.elementRef && (
|
|
296
|
+
this.elementRef && (_(this.elementRef, this.nestingLevel), tt(this.elementRef, this.nestingLevel));
|
|
297
297
|
}
|
|
298
298
|
forceChildUIRefresh() {
|
|
299
299
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
@@ -321,21 +321,21 @@ const K = class K {
|
|
|
321
321
|
".setting-group-content"
|
|
322
322
|
);
|
|
323
323
|
if (n) {
|
|
324
|
-
const
|
|
324
|
+
const o = Array.from(
|
|
325
325
|
n.querySelectorAll(
|
|
326
326
|
".setting-group, .setting, [data-setting-id]"
|
|
327
327
|
)
|
|
328
328
|
);
|
|
329
|
-
for (const
|
|
330
|
-
const l =
|
|
329
|
+
for (const a of o) {
|
|
330
|
+
const l = a.id, r = a.getAttribute(
|
|
331
331
|
"data-setting-id"
|
|
332
332
|
);
|
|
333
333
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
334
|
-
|
|
334
|
+
a.remove();
|
|
335
335
|
break;
|
|
336
336
|
}
|
|
337
337
|
if (r && "id" in e && typeof e.id == "string" && r === e.id) {
|
|
338
|
-
|
|
338
|
+
a.remove();
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -349,37 +349,37 @@ const K = class K {
|
|
|
349
349
|
this.elementRef;
|
|
350
350
|
}
|
|
351
351
|
updateSettings(t) {
|
|
352
|
-
var
|
|
352
|
+
var o;
|
|
353
353
|
const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
|
|
354
|
-
i.forEach((
|
|
355
|
-
const l = this.settings[
|
|
356
|
-
l && (L(l) ? s[
|
|
357
|
-
}), e.forEach((
|
|
358
|
-
i.includes(
|
|
359
|
-
}), i.forEach((
|
|
354
|
+
i.forEach((a) => {
|
|
355
|
+
const l = this.settings[a];
|
|
356
|
+
l && (L(l) ? s[a] = l.getValues() : A(l) ? s[a] = l.value : typeof l.getValues == "function" ? s[a] = l.getValues() : l.value !== void 0 && (s[a] = l.value));
|
|
357
|
+
}), e.forEach((a) => {
|
|
358
|
+
i.includes(a) || this.removeSetting(a);
|
|
359
|
+
}), i.forEach((a) => {
|
|
360
360
|
var p;
|
|
361
|
-
const l = t[
|
|
362
|
-
if (r !== l && (r && this.removeSetting(
|
|
363
|
-
const
|
|
361
|
+
const l = t[a], r = this.settings[a];
|
|
362
|
+
if (r !== l && (r && this.removeSetting(a), this.addSetting(a, l), a in s)) {
|
|
363
|
+
const h = s[a];
|
|
364
364
|
try {
|
|
365
365
|
L(l) ? l.setValue(
|
|
366
|
-
|
|
367
|
-
) : A(l) ? (p = l.setValue) == null || p.call(l,
|
|
366
|
+
h
|
|
367
|
+
) : A(l) ? (p = l.setValue) == null || p.call(l, h) : l.setValue && l.setValue(h);
|
|
368
368
|
} catch (d) {
|
|
369
|
-
console.warn(`Could not preserve value for setting ${
|
|
369
|
+
console.warn(`Could not preserve value for setting ${a}:`, d);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
373
373
|
const n = this.getValues();
|
|
374
|
-
this.initialValues = n, (
|
|
374
|
+
this.initialValues = n, (o = this.onChange) == null || o.call(this, n);
|
|
375
375
|
}
|
|
376
376
|
clone() {
|
|
377
377
|
const t = {};
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
typeof n.clone == "function" ? t[
|
|
381
|
-
`Setting with key '${
|
|
382
|
-
), t[
|
|
378
|
+
j(this.settings, (s, n) => {
|
|
379
|
+
const o = String(s);
|
|
380
|
+
typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
|
|
381
|
+
`Setting with key '${o}' does not have a clone method. Copying reference.`
|
|
382
|
+
), t[o] = n);
|
|
383
383
|
});
|
|
384
384
|
const e = {
|
|
385
385
|
title: this.title,
|
|
@@ -392,7 +392,7 @@ const K = class K {
|
|
|
392
392
|
deleteItem: this.deleteItemCfg,
|
|
393
393
|
dataProps: this.dataProps,
|
|
394
394
|
hide: this.hide
|
|
395
|
-
}, i =
|
|
395
|
+
}, i = kt(e);
|
|
396
396
|
return i.initialValues = this.getValues(), i;
|
|
397
397
|
}
|
|
398
398
|
resetDefault() {
|
|
@@ -438,19 +438,19 @@ const K = class K {
|
|
|
438
438
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
439
439
|
}, 50));
|
|
440
440
|
};
|
|
441
|
-
return this.changeHandlers.clear(),
|
|
441
|
+
return this.changeHandlers.clear(), j(this.settings, (i, s) => {
|
|
442
442
|
var n;
|
|
443
443
|
if (L(s))
|
|
444
444
|
s.setOnChange(() => {
|
|
445
|
-
const
|
|
446
|
-
this.initialValues =
|
|
445
|
+
const o = this.getValues();
|
|
446
|
+
this.initialValues = o, t(o);
|
|
447
447
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
448
448
|
else if (A(s)) {
|
|
449
|
-
const
|
|
450
|
-
this.changeHandlers.add(
|
|
449
|
+
const o = () => e();
|
|
450
|
+
this.changeHandlers.add(o), s.setOnChange(o);
|
|
451
451
|
} else {
|
|
452
|
-
const
|
|
453
|
-
this.changeHandlers.add(
|
|
452
|
+
const o = () => e();
|
|
453
|
+
this.changeHandlers.add(o), (n = s.setOnChange) == null || n.call(s, o);
|
|
454
454
|
}
|
|
455
455
|
}), this;
|
|
456
456
|
}
|
|
@@ -465,10 +465,10 @@ const K = class K {
|
|
|
465
465
|
Object.entries(t).forEach(([i, s]) => {
|
|
466
466
|
let n = this.settings[i];
|
|
467
467
|
if (!n && this.addItemCfg && i.startsWith(this.addItemCfg.keyPrefix)) {
|
|
468
|
-
const
|
|
469
|
-
if (Number.isFinite(
|
|
470
|
-
const l = this.addItemCfg.createItem(
|
|
471
|
-
|
|
468
|
+
const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
|
|
469
|
+
if (Number.isFinite(a)) {
|
|
470
|
+
const l = this.addItemCfg.createItem(a);
|
|
471
|
+
lt(l) && (this.addSetting(i, l), n = l);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
n && (L(n) || A(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
@@ -490,20 +490,20 @@ const K = class K {
|
|
|
490
490
|
addSetting(t, e) {
|
|
491
491
|
var s, n;
|
|
492
492
|
if (this.settings[t] = e, this.wireChild(e), this.elementRef) {
|
|
493
|
-
const
|
|
493
|
+
const o = this.elementRef.querySelector(
|
|
494
494
|
".setting-group-content"
|
|
495
495
|
);
|
|
496
|
-
if (
|
|
496
|
+
if (o) {
|
|
497
497
|
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
498
|
-
const
|
|
498
|
+
const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
499
499
|
if (l) {
|
|
500
|
-
const
|
|
501
|
-
|
|
500
|
+
const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
501
|
+
h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
|
|
502
502
|
}
|
|
503
|
-
const r =
|
|
504
|
-
r ?
|
|
505
|
-
const p =
|
|
506
|
-
|
|
503
|
+
const r = o.querySelector(".sg-add-button-bottom");
|
|
504
|
+
r ? o.insertBefore(a, r) : o.appendChild(a), at.trackElement(a), _(a, this.nestingLevel + 1), tt(a, this.nestingLevel + 1);
|
|
505
|
+
const p = a.style.display;
|
|
506
|
+
a.style.display = "none", a.offsetHeight, a.style.display = p, this.updateNestingStyles();
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
const i = this.getValues();
|
|
@@ -530,8 +530,8 @@ const K = class K {
|
|
|
530
530
|
if (!s) return;
|
|
531
531
|
const n = s.querySelector(".actions-section");
|
|
532
532
|
if (!n) return;
|
|
533
|
-
const
|
|
534
|
-
|
|
533
|
+
const o = document.createElement("button");
|
|
534
|
+
o.type = "button", o.className = "sg-delete-button", i ? i.deleteItemCfg : this.deleteItemCfg ?? this.addItemCfg, o.title = "Delete", o.style.cssText = `
|
|
535
535
|
background: none;
|
|
536
536
|
border: none;
|
|
537
537
|
cursor: pointer;
|
|
@@ -544,23 +544,23 @@ const K = class K {
|
|
|
544
544
|
border-radius: 4px;
|
|
545
545
|
transition: background-color 0.2s;
|
|
546
546
|
`;
|
|
547
|
-
const
|
|
547
|
+
const a = `
|
|
548
548
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
549
549
|
<path d="M2 4h12M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.333 1.333 0 0 1 1.334 1.334V4m2 0v9.333a1.333 1.333 0 0 1-1.334 1.334H4.667a1.333 1.333 0 0 1-1.334-1.334V4h8.667Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
550
550
|
<path d="M6.667 7.333v4M9.333 7.333v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
551
551
|
</svg>
|
|
552
552
|
`;
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}),
|
|
556
|
-
|
|
557
|
-
}),
|
|
553
|
+
o.innerHTML = a, o.addEventListener("mouseenter", () => {
|
|
554
|
+
o.style.backgroundColor = "#fef2f2";
|
|
555
|
+
}), o.addEventListener("mouseleave", () => {
|
|
556
|
+
o.style.backgroundColor = "transparent";
|
|
557
|
+
}), o.addEventListener("click", (r) => {
|
|
558
558
|
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((p) => {
|
|
559
559
|
p && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
560
560
|
});
|
|
561
561
|
});
|
|
562
562
|
const l = n.querySelector(".setting-group-arrow");
|
|
563
|
-
l ? n.insertBefore(
|
|
563
|
+
l ? n.insertBefore(o, l) : n.appendChild(o);
|
|
564
564
|
}
|
|
565
565
|
showDeleteConfirmation() {
|
|
566
566
|
return new Promise((t) => {
|
|
@@ -603,14 +603,14 @@ const K = class K {
|
|
|
603
603
|
font-size: 14px;
|
|
604
604
|
line-height: 1.5;
|
|
605
605
|
`;
|
|
606
|
-
const
|
|
607
|
-
|
|
606
|
+
const o = document.createElement("div");
|
|
607
|
+
o.style.cssText = `
|
|
608
608
|
display: flex;
|
|
609
609
|
gap: 12px;
|
|
610
610
|
justify-content: flex-end;
|
|
611
611
|
`;
|
|
612
|
-
const
|
|
613
|
-
|
|
612
|
+
const a = document.createElement("button");
|
|
613
|
+
a.textContent = "Cancel", a.type = "button", a.style.cssText = `
|
|
614
614
|
padding: 8px 16px;
|
|
615
615
|
border: 1px solid #d1d5db;
|
|
616
616
|
background: white;
|
|
@@ -632,10 +632,10 @@ const K = class K {
|
|
|
632
632
|
font-weight: 500;
|
|
633
633
|
cursor: pointer;
|
|
634
634
|
transition: all 0.2s;
|
|
635
|
-
`,
|
|
636
|
-
|
|
637
|
-
}),
|
|
638
|
-
|
|
635
|
+
`, a.addEventListener("mouseenter", () => {
|
|
636
|
+
a.style.backgroundColor = "#f9fafb", a.style.borderColor = "#9ca3af";
|
|
637
|
+
}), a.addEventListener("mouseleave", () => {
|
|
638
|
+
a.style.backgroundColor = "white", a.style.borderColor = "#d1d5db";
|
|
639
639
|
}), l.addEventListener("mouseenter", () => {
|
|
640
640
|
l.style.backgroundColor = "#dc2626";
|
|
641
641
|
}), l.addEventListener("mouseleave", () => {
|
|
@@ -646,17 +646,17 @@ const K = class K {
|
|
|
646
646
|
e.parentNode && e.parentNode.removeChild(e);
|
|
647
647
|
}, 200);
|
|
648
648
|
};
|
|
649
|
-
|
|
649
|
+
a.addEventListener("click", () => {
|
|
650
650
|
r(), t(!1);
|
|
651
651
|
}), l.addEventListener("click", () => {
|
|
652
652
|
r(), t(!0);
|
|
653
|
-
}), e.addEventListener("click", (
|
|
654
|
-
|
|
653
|
+
}), e.addEventListener("click", (h) => {
|
|
654
|
+
h.target === e && (r(), t(!1));
|
|
655
655
|
});
|
|
656
|
-
const p = (
|
|
657
|
-
|
|
656
|
+
const p = (h) => {
|
|
657
|
+
h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", p));
|
|
658
658
|
};
|
|
659
|
-
document.addEventListener("keydown", p),
|
|
659
|
+
document.addEventListener("keydown", p), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
660
660
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
661
661
|
}), setTimeout(() => l.focus(), 100);
|
|
662
662
|
});
|
|
@@ -674,8 +674,8 @@ const K = class K {
|
|
|
674
674
|
...Object.keys(t),
|
|
675
675
|
...Object.keys(e)
|
|
676
676
|
])).forEach((n) => {
|
|
677
|
-
const
|
|
678
|
-
JSON.stringify(
|
|
677
|
+
const o = t[n], a = e[n];
|
|
678
|
+
JSON.stringify(o) !== JSON.stringify(a) && (i[n] = { from: o, to: a });
|
|
679
679
|
}), i;
|
|
680
680
|
}
|
|
681
681
|
getValues(t) {
|
|
@@ -709,11 +709,11 @@ const K = class K {
|
|
|
709
709
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
710
710
|
const n = this.settings[s];
|
|
711
711
|
if (L(n)) {
|
|
712
|
-
const
|
|
713
|
-
|
|
712
|
+
const o = n.getValuesForJson();
|
|
713
|
+
o !== null && (i[s] = o);
|
|
714
714
|
} else {
|
|
715
|
-
const
|
|
716
|
-
|
|
715
|
+
const o = n;
|
|
716
|
+
o.includeGetJson !== !1 && (i[s] = o.value);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
return (this.hide === !0 || ((e = this == null ? void 0 : this.groupProps) == null ? void 0 : e.hide) === !0) && (i.hide = !0), i;
|
|
@@ -752,7 +752,7 @@ const K = class K {
|
|
|
752
752
|
}
|
|
753
753
|
draw() {
|
|
754
754
|
const t = document.createElement("div");
|
|
755
|
-
t.className = "setting-group", t.id = `setting-group-${this.id}`,
|
|
755
|
+
t.className = "setting-group", t.id = `setting-group-${this.id}`, Y.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), _(t, this.nestingLevel);
|
|
756
756
|
const e = document.createElement("div");
|
|
757
757
|
e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
|
|
758
758
|
"aria-expanded",
|
|
@@ -764,16 +764,16 @@ const K = class K {
|
|
|
764
764
|
s.textContent = this.title, i.appendChild(s);
|
|
765
765
|
const n = document.createElement("div");
|
|
766
766
|
n.className = "actions-section";
|
|
767
|
-
const
|
|
768
|
-
|
|
767
|
+
const o = document.createElement("span");
|
|
768
|
+
o.className = "setting-group-arrow", o.innerHTML = `
|
|
769
769
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
770
770
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
771
771
|
</svg>
|
|
772
|
-
`, this.isCollapsed &&
|
|
773
|
-
const
|
|
774
|
-
|
|
772
|
+
`, this.isCollapsed && o.classList.add("rotated"), n.appendChild(o);
|
|
773
|
+
const a = document.createElement("div");
|
|
774
|
+
a.className = "setting-group-content", this.isCollapsed && (a.classList.add("collapsed"), e.classList.add("collapsed-view"), o.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && a.classList.add("main-content");
|
|
775
775
|
const l = () => {
|
|
776
|
-
this.isCollapsed = !this.isCollapsed,
|
|
776
|
+
this.isCollapsed = !this.isCollapsed, a.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), o.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
777
777
|
"aria-expanded",
|
|
778
778
|
(!this.isCollapsed).toString()
|
|
779
779
|
);
|
|
@@ -783,38 +783,38 @@ const K = class K {
|
|
|
783
783
|
}, Object.keys(this.settings).length > 0) {
|
|
784
784
|
for (const p in this.settings)
|
|
785
785
|
if (Object.prototype.hasOwnProperty.call(this.settings, p)) {
|
|
786
|
-
const
|
|
787
|
-
L(
|
|
788
|
-
const d =
|
|
789
|
-
L(
|
|
786
|
+
const h = this.settings[p];
|
|
787
|
+
L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
|
|
788
|
+
const d = h.draw();
|
|
789
|
+
L(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
|
|
790
790
|
d,
|
|
791
791
|
p,
|
|
792
|
-
|
|
793
|
-
),
|
|
792
|
+
h
|
|
793
|
+
), a.appendChild(d);
|
|
794
794
|
}
|
|
795
795
|
} else {
|
|
796
796
|
const p = document.createElement("div");
|
|
797
|
-
p.className = "setting-group-empty", p.textContent = "No settings in this group",
|
|
797
|
+
p.className = "setting-group-empty", p.textContent = "No settings in this group", a.appendChild(p);
|
|
798
798
|
}
|
|
799
799
|
if (this.addItemCfg) {
|
|
800
800
|
const p = document.createElement("button");
|
|
801
801
|
p.type = "button", p.className = "sg-add-button-bottom", p.style.marginTop = "8px";
|
|
802
|
-
const
|
|
802
|
+
const h = `
|
|
803
803
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
804
804
|
xmlns="http://www.w3.org/2000/svg">
|
|
805
805
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
806
806
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
807
807
|
</svg>`;
|
|
808
|
-
p.innerHTML = `${
|
|
808
|
+
p.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, p.addEventListener("click", (d) => {
|
|
809
809
|
d.stopPropagation(), d.preventDefault();
|
|
810
810
|
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
811
|
-
if (
|
|
812
|
-
const
|
|
813
|
-
this.addSetting(
|
|
811
|
+
if (lt(g)) {
|
|
812
|
+
const m = `${this.addItemCfg.keyPrefix}${u}`;
|
|
813
|
+
this.addSetting(m, g);
|
|
814
814
|
}
|
|
815
|
-
}),
|
|
815
|
+
}), a.appendChild(p);
|
|
816
816
|
}
|
|
817
|
-
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(
|
|
817
|
+
return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, at.trackElement(t), setTimeout(() => {
|
|
818
818
|
this.updateNestingStyles();
|
|
819
819
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
820
820
|
}
|
|
@@ -845,10 +845,10 @@ const K = class K {
|
|
|
845
845
|
let i = e;
|
|
846
846
|
const s = Object.keys(this.settings), n = Object.keys(e);
|
|
847
847
|
if (!s.some(
|
|
848
|
-
(
|
|
848
|
+
(a) => n.includes(a)
|
|
849
849
|
) && n.length === 1) {
|
|
850
|
-
const
|
|
851
|
-
i = e[
|
|
850
|
+
const a = n[0];
|
|
851
|
+
i = e[a];
|
|
852
852
|
}
|
|
853
853
|
this.setValue(i);
|
|
854
854
|
} catch (e) {
|
|
@@ -856,12 +856,12 @@ const K = class K {
|
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
};
|
|
859
|
-
|
|
860
|
-
let
|
|
861
|
-
function
|
|
862
|
-
return new
|
|
859
|
+
Y.hiddenElements = /* @__PURE__ */ new Set();
|
|
860
|
+
let T = Y;
|
|
861
|
+
function pe(c) {
|
|
862
|
+
return new Lt(c);
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class Lt extends T {
|
|
865
865
|
constructor(t) {
|
|
866
866
|
super(t);
|
|
867
867
|
const e = Object.keys(this.settings)[0];
|
|
@@ -905,30 +905,30 @@ class wt extends H {
|
|
|
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",
|
|
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
912
|
const p = document.createElement("div");
|
|
913
|
-
p.className = "tab-panel", this.contentContainers[
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
)),
|
|
918
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
919
|
-
const
|
|
920
|
-
this.activeTabId =
|
|
913
|
+
p.className = "tab-panel", this.contentContainers[a] = p;
|
|
914
|
+
const h = this.settings[a];
|
|
915
|
+
h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
|
|
916
|
+
h.draw()
|
|
917
|
+
)), o.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = a);
|
|
918
|
+
}), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
|
|
919
|
+
const a = Object.keys(this.settings)[0];
|
|
920
|
+
this.activeTabId = a || "";
|
|
921
921
|
}
|
|
922
922
|
return this.updateTabUI(), t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
function
|
|
926
|
-
return new
|
|
925
|
+
function kt(c) {
|
|
926
|
+
return new T(c);
|
|
927
927
|
}
|
|
928
|
-
function
|
|
929
|
-
return
|
|
928
|
+
function ue(c) {
|
|
929
|
+
return c;
|
|
930
930
|
}
|
|
931
|
-
class
|
|
931
|
+
class Mt extends x {
|
|
932
932
|
constructor(t = {}) {
|
|
933
933
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
934
934
|
}
|
|
@@ -948,18 +948,18 @@ class Lt extends x {
|
|
|
948
948
|
});
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
|
-
const
|
|
952
|
-
class
|
|
951
|
+
const St = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
|
|
952
|
+
class I extends Mt {
|
|
953
953
|
constructor(t) {
|
|
954
954
|
super({
|
|
955
955
|
...t,
|
|
956
|
-
icon: t.icon ||
|
|
956
|
+
icon: t.icon || St,
|
|
957
957
|
title: t.title || "Color",
|
|
958
|
-
default: t.default ?
|
|
958
|
+
default: t.default ? I.normalizeColorValue(t.default) : "#000000"
|
|
959
959
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
960
960
|
}
|
|
961
961
|
static normalizeColorValue(t) {
|
|
962
|
-
return t.startsWith("var(--") ? t : t.startsWith("#") ?
|
|
962
|
+
return t.startsWith("var(--") ? t : t.startsWith("#") ? I.normalizeHexValue(t) : t.includes(",") ? I.rgbToHexStatic(t) : I.normalizeHexValue(t);
|
|
963
963
|
}
|
|
964
964
|
static normalizeHexValue(t) {
|
|
965
965
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
|
|
@@ -968,11 +968,11 @@ class N extends Lt {
|
|
|
968
968
|
const e = t.split(",").map((p) => parseInt(p.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 = (p) => {
|
|
972
|
+
const h = p.toString(16);
|
|
973
|
+
return h.length === 1 ? "0" + h : h;
|
|
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) {
|
|
@@ -980,7 +980,7 @@ class N extends Lt {
|
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
982
|
if (typeof t == "string") {
|
|
983
|
-
const e =
|
|
983
|
+
const e = I.normalizeColorValue(t);
|
|
984
984
|
this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
|
|
985
985
|
} else
|
|
986
986
|
this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
|
|
@@ -995,12 +995,12 @@ class N extends Lt {
|
|
|
995
995
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
996
996
|
const g = document.createElement("div");
|
|
997
997
|
if (g.className = "icon-container", this.props.icon) {
|
|
998
|
-
const
|
|
999
|
-
|
|
998
|
+
const m = document.createElement("span");
|
|
999
|
+
m.className = "input-icon", m.innerHTML = this.props.icon, g.appendChild(m);
|
|
1000
1000
|
}
|
|
1001
1001
|
if (this.props.title) {
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1002
|
+
const m = document.createElement("span");
|
|
1003
|
+
m.className = "input-label", m.textContent = this.props.title, g.appendChild(m);
|
|
1004
1004
|
}
|
|
1005
1005
|
t.appendChild(g);
|
|
1006
1006
|
}
|
|
@@ -1012,84 +1012,84 @@ class N extends Lt {
|
|
|
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
|
-
const
|
|
1024
|
-
|
|
1023
|
+
const m = document.createElement("div");
|
|
1024
|
+
m.textContent = "Error: System error (Setting undefined)", a.appendChild(m);
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
const g = x.GlobalVariables || {};
|
|
1028
1028
|
if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1029
|
+
const m = document.createElement("div");
|
|
1030
|
+
m.textContent = "No global colors defined", m.style.gridColumn = "1 / -1", m.style.fontSize = "12px", m.style.color = "#666", a.appendChild(m);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
Object.entries(g).forEach(([
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1036
|
-
var
|
|
1033
|
+
Object.entries(g).forEach(([m, f]) => {
|
|
1034
|
+
const v = document.createElement("button");
|
|
1035
|
+
v.className = "global-color-btn", v.title = m, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = f, v.style.cursor = "pointer", this.value === `var(--${m})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (C) => {
|
|
1036
|
+
var w, k;
|
|
1037
1037
|
C.preventDefault();
|
|
1038
|
-
const
|
|
1039
|
-
this.value =
|
|
1040
|
-
|
|
1041
|
-
}),
|
|
1042
|
-
}),
|
|
1038
|
+
const y = `var(--${m})`;
|
|
1039
|
+
this.value = y, (w = this.onChange) == null || w.call(this, y), (k = this.detectChange) == null || k.call(this, y), Array.from(a.children).forEach((S) => {
|
|
1040
|
+
S.style.border = "1px solid #ddd";
|
|
1041
|
+
}), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
|
|
1042
|
+
}), a.appendChild(v);
|
|
1043
1043
|
});
|
|
1044
1044
|
} catch (g) {
|
|
1045
|
-
console.error("ColorSetting: Error in renderGlobalOptions", g),
|
|
1045
|
+
console.error("ColorSetting: Error in renderGlobalOptions", g), a.innerHTML = "Error loading global options";
|
|
1046
1046
|
}
|
|
1047
1047
|
};
|
|
1048
1048
|
l(), s.addEventListener("click", (g) => {
|
|
1049
|
-
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"),
|
|
1049
|
+
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1050
1050
|
}), n.addEventListener("click", (g) => {
|
|
1051
|
-
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"),
|
|
1051
|
+
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
|
|
1052
1052
|
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1053
1053
|
const r = (g) => {
|
|
1054
|
-
const
|
|
1055
|
-
if (!
|
|
1054
|
+
const m = g.value.trim();
|
|
1055
|
+
if (!m)
|
|
1056
1056
|
return e.classList.remove("error"), !0;
|
|
1057
|
-
const
|
|
1058
|
-
return
|
|
1057
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(m);
|
|
1058
|
+
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
1059
1059
|
}, p = document.createElement("input");
|
|
1060
1060
|
p.type = "color", p.className = "color-picker", p.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", p.setAttribute("aria-label", "Choose color"), p.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && p.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = p;
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1061
|
+
const h = document.createElement("div");
|
|
1062
|
+
h.className = "color-preview";
|
|
1063
1063
|
let d = this.value || "#000000";
|
|
1064
1064
|
if (d.startsWith("var(--")) {
|
|
1065
1065
|
const g = d.replace("var(--", "").replace(")", "");
|
|
1066
1066
|
d = (x.GlobalVariables || {})[g] || "#000000";
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1068
|
+
h.style.backgroundColor = d;
|
|
1069
1069
|
const u = document.createElement("input");
|
|
1070
1070
|
return u.type = "text", u.className = "color-text-input", u.value = this.value || "", u.placeholder = "#000000", u.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), u.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), u.setAttribute("aria-label", "Hex color value"), u.setAttribute("maxlength", "7"), this.getDataPropsPath() && u.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = u, this.textInputEl.addEventListener("input", (g) => {
|
|
1071
|
-
var
|
|
1072
|
-
let
|
|
1071
|
+
var f, v;
|
|
1072
|
+
let m = g.target.value.trim();
|
|
1073
1073
|
if (this.textInputEl && r(this.textInputEl)) {
|
|
1074
|
-
const C =
|
|
1075
|
-
this.value = C, (
|
|
1074
|
+
const C = I.normalizeColorValue(m);
|
|
1075
|
+
this.value = C, (f = this.onChange) == null || f.call(this, C), (v = this.detectChange) == null || v.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), h.style.backgroundColor = C;
|
|
1076
1076
|
}
|
|
1077
1077
|
}), this.colorInputEl.addEventListener("input", (g) => {
|
|
1078
|
-
var
|
|
1079
|
-
const
|
|
1080
|
-
this.value =
|
|
1078
|
+
var v, C;
|
|
1079
|
+
const m = g.target.value, f = I.normalizeColorValue(m);
|
|
1080
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f, e.classList.remove("error");
|
|
1081
1081
|
}), this.colorInputEl.addEventListener("change", (g) => {
|
|
1082
|
-
var
|
|
1083
|
-
const
|
|
1084
|
-
this.value =
|
|
1085
|
-
}),
|
|
1082
|
+
var v, C;
|
|
1083
|
+
const m = g.target.value, f = I.normalizeColorValue(m);
|
|
1084
|
+
this.value = f, (v = this.onChange) == null || v.call(this, f), (C = this.detectChange) == null || C.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f;
|
|
1085
|
+
}), o.appendChild(p), o.appendChild(h), o.appendChild(u), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
|
|
1086
1086
|
}
|
|
1087
1087
|
getElement() {
|
|
1088
1088
|
return this.element;
|
|
1089
1089
|
}
|
|
1090
1090
|
// Helper method to get normalized hex value
|
|
1091
1091
|
getNormalizedValue() {
|
|
1092
|
-
return this.value ?
|
|
1092
|
+
return this.value ? I.normalizeColorValue(this.value) : "#000000";
|
|
1093
1093
|
}
|
|
1094
1094
|
// Helper method to check if current value is valid hex
|
|
1095
1095
|
isValidHex() {
|
|
@@ -1100,20 +1100,20 @@ class N extends Lt {
|
|
|
1100
1100
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1103
|
+
const Nt = `
|
|
1104
1104
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1105
1105
|
<path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1106
1106
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1107
1107
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
|
|
1108
1108
|
</svg>`;
|
|
1109
|
-
class
|
|
1109
|
+
class F extends x {
|
|
1110
1110
|
constructor(t = {}) {
|
|
1111
1111
|
super({
|
|
1112
1112
|
...t,
|
|
1113
|
-
icon: t.icon ||
|
|
1113
|
+
icon: t.icon || Nt,
|
|
1114
1114
|
title: t.title || "Color & Opacity",
|
|
1115
1115
|
default: t.default || "#000000FF"
|
|
1116
|
-
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value =
|
|
1116
|
+
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = F.normalizeHexWithOpacity(this.value));
|
|
1117
1117
|
}
|
|
1118
1118
|
static normalizeHexWithOpacity(t) {
|
|
1119
1119
|
return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
|
|
@@ -1131,18 +1131,18 @@ class R extends x {
|
|
|
1131
1131
|
return `#${i}${n}`;
|
|
1132
1132
|
}
|
|
1133
1133
|
setValue(t) {
|
|
1134
|
-
t === void 0 || t === "" ? this.value = "#000000FF" : this.value =
|
|
1134
|
+
t === void 0 || t === "" ? this.value = "#000000FF" : this.value = F.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
|
|
1135
1135
|
}
|
|
1136
1136
|
updateInputElements() {
|
|
1137
1137
|
this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
|
|
1138
1138
|
}
|
|
1139
1139
|
updateColorPreview() {
|
|
1140
1140
|
if (!this.colorPreviewEl || !this.value) return;
|
|
1141
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1142
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
1141
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1142
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1143
1143
|
}
|
|
1144
1144
|
handleColorChange(t) {
|
|
1145
|
-
const e = this.getOpacityPercent(), i =
|
|
1145
|
+
const e = this.getOpacityPercent(), i = F.combineColorOpacity(
|
|
1146
1146
|
t,
|
|
1147
1147
|
e
|
|
1148
1148
|
);
|
|
@@ -1153,7 +1153,7 @@ class R extends x {
|
|
|
1153
1153
|
return e || i ? (this.setValue(t), !0) : !1;
|
|
1154
1154
|
}
|
|
1155
1155
|
handleOpacityChange(t) {
|
|
1156
|
-
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s =
|
|
1156
|
+
const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = F.combineColorOpacity(
|
|
1157
1157
|
e,
|
|
1158
1158
|
i
|
|
1159
1159
|
);
|
|
@@ -1162,16 +1162,16 @@ class R extends x {
|
|
|
1162
1162
|
draw() {
|
|
1163
1163
|
const t = document.createElement("div");
|
|
1164
1164
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1165
|
-
const
|
|
1166
|
-
if (
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1165
|
+
const o = document.createElement("div");
|
|
1166
|
+
if (o.className = "icon-container", this.props.icon) {
|
|
1167
|
+
const a = document.createElement("span");
|
|
1168
|
+
a.className = "input-icon", a.innerHTML = this.props.icon, o.appendChild(a);
|
|
1169
1169
|
}
|
|
1170
1170
|
if (this.props.title) {
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1171
|
+
const a = document.createElement("span");
|
|
1172
|
+
a.className = "input-label", a.textContent = this.props.title, o.appendChild(a);
|
|
1173
1173
|
}
|
|
1174
|
-
t.appendChild(
|
|
1174
|
+
t.appendChild(o);
|
|
1175
1175
|
}
|
|
1176
1176
|
const e = document.createElement("div");
|
|
1177
1177
|
e.className = "color-with-opacity-input-wrapper", this.colorInputEl = document.createElement("input"), this.colorInputEl.type = "color", this.colorInputEl.className = "color-with-opacity-picker", this.getDataPropsPath() && this.colorInputEl.setAttribute(
|
|
@@ -1180,18 +1180,18 @@ class R extends x {
|
|
|
1180
1180
|
), this.colorPreviewEl = document.createElement("div"), this.colorPreviewEl.className = "color-with-opacity-preview", this.textInputEl = document.createElement("input"), this.textInputEl.type = "text", this.textInputEl.className = "color-with-opacity-text-input", this.textInputEl.placeholder = "#000000FF", this.getDataPropsPath() && this.textInputEl.setAttribute(
|
|
1181
1181
|
"data-test-id",
|
|
1182
1182
|
`${this.getDataPropsPath()}_text`
|
|
1183
|
-
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (
|
|
1184
|
-
const
|
|
1185
|
-
this.handleColorChange(
|
|
1186
|
-
}), this.textInputEl.addEventListener("input", (
|
|
1187
|
-
const
|
|
1188
|
-
this.handleTextInput(
|
|
1189
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1183
|
+
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (o) => {
|
|
1184
|
+
const a = o.target;
|
|
1185
|
+
this.handleColorChange(a.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1186
|
+
}), this.textInputEl.addEventListener("input", (o) => {
|
|
1187
|
+
const a = o.target;
|
|
1188
|
+
this.handleTextInput(a.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : a.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
|
|
1189
|
+
}), this.textInputEl.addEventListener("blur", (o) => {
|
|
1190
|
+
const a = o.target;
|
|
1191
|
+
a.value.trim() === "" && (a.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1192
1192
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1193
|
-
var
|
|
1194
|
-
(
|
|
1193
|
+
var o;
|
|
1194
|
+
(o = this.colorInputEl) == null || o.click();
|
|
1195
1195
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1196
1196
|
const i = document.createElement("div");
|
|
1197
1197
|
i.className = "color-with-opacity-opacity-wrapper", this.opacityInputEl = document.createElement("input"), this.opacityInputEl.type = "number", this.opacityInputEl.className = "color-with-opacity-opacity-input", this.opacityInputEl.value = this.getOpacityPercent().toString(), this.opacityInputEl.min = "0", this.opacityInputEl.max = "100", this.opacityInputEl.step = "1", this.opacityInputEl.placeholder = "100", this.getDataPropsPath() && this.opacityInputEl.setAttribute(
|
|
@@ -1199,13 +1199,13 @@ class R extends x {
|
|
|
1199
1199
|
`${this.getDataPropsPath()}_opacity`
|
|
1200
1200
|
);
|
|
1201
1201
|
const s = document.createElement("span");
|
|
1202
|
-
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
1203
|
-
const
|
|
1202
|
+
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (o) => {
|
|
1203
|
+
const a = o.target, l = parseFloat(a.value);
|
|
1204
1204
|
isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1205
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1206
|
-
const
|
|
1207
|
-
let l = parseFloat(
|
|
1208
|
-
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)),
|
|
1205
|
+
}), this.opacityInputEl.addEventListener("blur", (o) => {
|
|
1206
|
+
const a = o.target;
|
|
1207
|
+
let l = parseFloat(a.value);
|
|
1208
|
+
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), a.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1209
1209
|
}), i.appendChild(this.opacityInputEl), i.appendChild(s);
|
|
1210
1210
|
const n = document.createElement("div");
|
|
1211
1211
|
return n.className = "color-with-opacity-controls-wrapper", n.appendChild(e), n.appendChild(i), t.appendChild(n), this.element = t, this.updateInputElements(), this.updateColorPreview(), t;
|
|
@@ -1218,8 +1218,8 @@ class R extends x {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
getRgbaValue() {
|
|
1220
1220
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
1221
|
-
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16),
|
|
1222
|
-
return `rgba(${s}, ${n}, ${
|
|
1221
|
+
const t = this.getRgbColor(), e = this.getOpacityPercent() / 100, i = t.replace("#", ""), s = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
|
|
1222
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
1223
1223
|
}
|
|
1224
1224
|
getColorAndOpacity() {
|
|
1225
1225
|
return {
|
|
@@ -1228,7 +1228,7 @@ class R extends x {
|
|
|
1228
1228
|
};
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
|
-
class
|
|
1231
|
+
class ge extends x {
|
|
1232
1232
|
constructor(t = {}) {
|
|
1233
1233
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1234
1234
|
}
|
|
@@ -1240,27 +1240,27 @@ class de extends x {
|
|
|
1240
1240
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1241
1241
|
const n = document.createElement("div");
|
|
1242
1242
|
if (n.className = "icon-container", this.props.icon) {
|
|
1243
|
-
const
|
|
1244
|
-
n.appendChild(
|
|
1243
|
+
const o = this.createIcon(this.props.icon);
|
|
1244
|
+
n.appendChild(o);
|
|
1245
1245
|
}
|
|
1246
1246
|
if (this.props.title) {
|
|
1247
|
-
const
|
|
1248
|
-
n.appendChild(
|
|
1247
|
+
const o = this.createLabel(this.props.title);
|
|
1248
|
+
n.appendChild(o);
|
|
1249
1249
|
}
|
|
1250
1250
|
t.appendChild(n);
|
|
1251
1251
|
}
|
|
1252
1252
|
const e = document.createElement("textarea");
|
|
1253
1253
|
this.textareaEl = e, e.value = this.value || "", e.placeholder = this.props.placeholder || "Paste your HTML here...", e.className = "html-setting-textarea " + (this.props.textareaClassName || ""), e.rows = this.props.rows || 6, this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.props.maxLength !== void 0 && (e.maxLength = this.props.maxLength), this.props.className && e.classList.add(this.props.className);
|
|
1254
1254
|
const i = (n) => {
|
|
1255
|
-
const
|
|
1256
|
-
this.value =
|
|
1255
|
+
const a = n.target.value;
|
|
1256
|
+
this.value = a, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
1257
1257
|
}, s = (n) => {
|
|
1258
1258
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
1259
1259
|
};
|
|
1260
1260
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
class
|
|
1263
|
+
class P extends x {
|
|
1264
1264
|
constructor(t) {
|
|
1265
1265
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1266
1266
|
}
|
|
@@ -1283,12 +1283,12 @@ class V extends x {
|
|
|
1283
1283
|
const i = document.createElement("input");
|
|
1284
1284
|
if (i.type = "number", i.className = "number-setting-input " + (this.props.inputClassName || ""), i.value = String(this.value ?? ""), i.placeholder = this.props.placeholder || "", this.getDataPropsPath() && i.setAttribute("data-test-id", this.getDataPropsPath()), this.props.minValue !== void 0 && (i.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (i.max = String(this.props.maxValue)), this.props.step !== void 0 && (i.step = String(this.props.step)), i.addEventListener("input", () => {
|
|
1285
1285
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1286
|
-
let
|
|
1287
|
-
|
|
1286
|
+
let o = Number(i.value);
|
|
1287
|
+
o < s && (o = s), o > n && (o = n), String(o) !== i.value && (i.value = String(o)), this.setValue(o);
|
|
1288
1288
|
}), i.addEventListener("blur", () => {
|
|
1289
|
-
var n,
|
|
1289
|
+
var n, o;
|
|
1290
1290
|
const s = this.validateValue(Number(i.value));
|
|
1291
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
1291
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (o = (n = this.props).onBlur) == null || o.call(n);
|
|
1292
1292
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
1293
1293
|
const s = document.createElement("span");
|
|
1294
1294
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1319,12 +1319,12 @@ class V extends x {
|
|
|
1319
1319
|
);
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
const
|
|
1322
|
+
const Vt = `
|
|
1323
1323
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1324
1324
|
<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1325
1325
|
<path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1326
1326
|
</svg>`;
|
|
1327
|
-
class
|
|
1327
|
+
class It extends P {
|
|
1328
1328
|
constructor(t = {}) {
|
|
1329
1329
|
const e = {
|
|
1330
1330
|
title: "Opacity",
|
|
@@ -1333,7 +1333,7 @@ class Nt extends V {
|
|
|
1333
1333
|
maxValue: 100,
|
|
1334
1334
|
step: 1,
|
|
1335
1335
|
default: t.default ?? 100,
|
|
1336
|
-
icon:
|
|
1336
|
+
icon: Vt,
|
|
1337
1337
|
...t
|
|
1338
1338
|
};
|
|
1339
1339
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1345,12 +1345,12 @@ class Nt extends V {
|
|
|
1345
1345
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
const
|
|
1348
|
+
const Tt = `
|
|
1349
1349
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1350
1350
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1351
1351
|
</svg>
|
|
1352
1352
|
`;
|
|
1353
|
-
class
|
|
1353
|
+
class et extends x {
|
|
1354
1354
|
constructor(t = {}) {
|
|
1355
1355
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
|
|
1356
1356
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1371,12 +1371,12 @@ class tt extends x {
|
|
|
1371
1371
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1372
1372
|
const n = document.createElement("div");
|
|
1373
1373
|
if (n.className = "icon-container", this.props.icon) {
|
|
1374
|
-
const
|
|
1375
|
-
n.appendChild(
|
|
1374
|
+
const o = this.createIcon(this.props.icon);
|
|
1375
|
+
n.appendChild(o);
|
|
1376
1376
|
}
|
|
1377
1377
|
if (this.props.title) {
|
|
1378
|
-
const
|
|
1379
|
-
n.appendChild(
|
|
1378
|
+
const o = this.createLabel(this.props.title);
|
|
1379
|
+
n.appendChild(o);
|
|
1380
1380
|
}
|
|
1381
1381
|
t.appendChild(n);
|
|
1382
1382
|
} else {
|
|
@@ -1385,22 +1385,22 @@ class tt extends x {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
const e = document.createElement("div");
|
|
1387
1387
|
e.classList.add("select-button"), this.getDataPropsPath() && e.setAttribute("data-test-id", this.getDataPropsPath()), this.isLoading ? e.classList.add("loading") : e.textContent = this.selectedOptionIndex !== null ? this._options[this.selectedOptionIndex].name : this.props.placeholder || "Select an option", e.onclick = () => {
|
|
1388
|
-
var n,
|
|
1389
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1388
|
+
var n, o;
|
|
1389
|
+
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1390
1390
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1391
1391
|
const i = document.createElement("ul");
|
|
1392
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1392
|
+
i.classList.add("select-options"), this._options.forEach((n, o) => {
|
|
1393
|
+
const a = this.createOption(n, o);
|
|
1394
|
+
a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
|
|
1395
1395
|
}), document.body.appendChild(i);
|
|
1396
1396
|
const s = document.createElement("div");
|
|
1397
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1397
|
+
return s.classList.add("svg-container"), s.innerHTML = Tt, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1398
1398
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1399
1399
|
}).catch((n) => {
|
|
1400
1400
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1401
1401
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1402
|
-
var
|
|
1403
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1402
|
+
var o, a;
|
|
1403
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (o = this.optionsListEl) == null || o.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition());
|
|
1404
1404
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1405
1405
|
this.isOpen && this.checkDropdownPosition();
|
|
1406
1406
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1419,9 +1419,9 @@ class tt extends x {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
1421
|
selectOption(t, e, i) {
|
|
1422
|
-
var n,
|
|
1422
|
+
var n, o;
|
|
1423
1423
|
const s = this._options[e];
|
|
1424
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (
|
|
1424
|
+
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l, r) => {
|
|
1425
1425
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1426
1426
|
}));
|
|
1427
1427
|
}
|
|
@@ -1457,7 +1457,7 @@ class tt extends x {
|
|
|
1457
1457
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
class
|
|
1460
|
+
class Pt extends x {
|
|
1461
1461
|
constructor(t = {}) {
|
|
1462
1462
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1463
1463
|
}
|
|
@@ -1502,18 +1502,18 @@ class Vt extends x {
|
|
|
1502
1502
|
`
|
|
1503
1503
|
}
|
|
1504
1504
|
].forEach((n) => {
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1505
|
+
const o = document.createElement("button");
|
|
1506
|
+
o.className = "align-option-button", o.innerHTML = n.icon, this.getDataPropsPath() && o.setAttribute(
|
|
1507
1507
|
"data-test-id",
|
|
1508
1508
|
`${this.getDataPropsPath()}_${n.name}`
|
|
1509
|
-
), this.value === n.name &&
|
|
1510
|
-
var
|
|
1511
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1512
|
-
}), i.appendChild(
|
|
1509
|
+
), this.value === n.name && o.classList.add("selected"), o.addEventListener("click", () => {
|
|
1510
|
+
var a;
|
|
1511
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), o.classList.add("selected"), this.value = n.name, (a = this.onChange) == null || a.call(this, this.value);
|
|
1512
|
+
}), i.appendChild(o);
|
|
1513
1513
|
}), t.appendChild(i), t;
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
|
-
class
|
|
1516
|
+
class me extends x {
|
|
1517
1517
|
constructor(t) {
|
|
1518
1518
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1519
1519
|
}
|
|
@@ -1527,42 +1527,42 @@ class pe extends x {
|
|
|
1527
1527
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1528
1528
|
);
|
|
1529
1529
|
if (n) {
|
|
1530
|
-
let
|
|
1531
|
-
p >= 1 ? (
|
|
1530
|
+
let a = +n[1], l = +n[2], r = +n[3], p = +n[4];
|
|
1531
|
+
p >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : p = Math.min(1, p + 0.12), s = `rgba(${a},${l},${r},${p})`;
|
|
1532
1532
|
}
|
|
1533
1533
|
t.addEventListener("mouseenter", () => {
|
|
1534
1534
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1535
1535
|
}), t.addEventListener("mouseleave", () => {
|
|
1536
1536
|
t.style.setProperty("background-color", e, "important");
|
|
1537
1537
|
}), t.addEventListener("click", () => {
|
|
1538
|
-
var
|
|
1539
|
-
return (l = (
|
|
1538
|
+
var a, l;
|
|
1539
|
+
return (l = (a = this.props).onClick) == null ? void 0 : l.call(a);
|
|
1540
1540
|
});
|
|
1541
|
-
const
|
|
1542
|
-
return
|
|
1541
|
+
const o = document.createElement("div");
|
|
1542
|
+
return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
|
-
class
|
|
1545
|
+
class fe extends x {
|
|
1546
1546
|
constructor(t = {}) {
|
|
1547
1547
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1548
1548
|
const e = t.width || 0, i = t.height || 0;
|
|
1549
1549
|
this.value || (this.value = {
|
|
1550
1550
|
width: e,
|
|
1551
1551
|
height: i
|
|
1552
|
-
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new
|
|
1552
|
+
}), this.minWidth = t.minWidth ?? 0, this.maxWidth = t.maxWidth, this.minHeight = t.minHeight ?? 0, this.maxHeight = t.maxHeight, this.locked = t.locked ?? !1, this.value.height > 0 && (this.aspectRatio = this.value.width / this.value.height), this.widthSetting = new P({
|
|
1553
1553
|
title: "Width",
|
|
1554
1554
|
default: this.value.width,
|
|
1555
1555
|
suffix: "px",
|
|
1556
1556
|
minValue: this.minWidth,
|
|
1557
1557
|
maxValue: this.maxWidth,
|
|
1558
|
-
icon:
|
|
1559
|
-
}), this.heightSetting = new
|
|
1558
|
+
icon: Ot
|
|
1559
|
+
}), this.heightSetting = new P({
|
|
1560
1560
|
title: "Height",
|
|
1561
1561
|
default: this.value.height,
|
|
1562
1562
|
suffix: "px",
|
|
1563
1563
|
minValue: this.minHeight,
|
|
1564
1564
|
maxValue: this.maxHeight,
|
|
1565
|
-
icon:
|
|
1565
|
+
icon: Ht
|
|
1566
1566
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1567
1567
|
}
|
|
1568
1568
|
handleWidthChange(t) {
|
|
@@ -1632,8 +1632,8 @@ class ue extends x {
|
|
|
1632
1632
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1633
1633
|
"aria-label",
|
|
1634
1634
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1635
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1636
|
-
|
|
1635
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (o) => {
|
|
1636
|
+
o.preventDefault(), this.toggleLock(n);
|
|
1637
1637
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1638
1638
|
}
|
|
1639
1639
|
isLocked() {
|
|
@@ -1656,24 +1656,24 @@ class ue extends x {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
1659
|
-
const
|
|
1659
|
+
const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1660
1660
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1661
|
-
</svg>`,
|
|
1661
|
+
</svg>`, Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1662
1662
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1663
|
-
</svg>`,
|
|
1663
|
+
</svg>`, Q = `
|
|
1664
1664
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1665
1665
|
<path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1666
1666
|
</svg>
|
|
1667
|
-
`,
|
|
1667
|
+
`, $t = `
|
|
1668
1668
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1669
1669
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1670
1670
|
<path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1671
1671
|
</svg>
|
|
1672
|
-
`,
|
|
1672
|
+
`, Bt = `
|
|
1673
1673
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1674
1674
|
<path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1675
1675
|
</svg>
|
|
1676
|
-
`,
|
|
1676
|
+
`, At = `
|
|
1677
1677
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1678
1678
|
<!-- Top dot -->
|
|
1679
1679
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1693,7 +1693,7 @@ const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1693
1693
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1694
1694
|
</svg>
|
|
1695
1695
|
`;
|
|
1696
|
-
class
|
|
1696
|
+
class nt extends x {
|
|
1697
1697
|
constructor(t = {}) {
|
|
1698
1698
|
super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
|
|
1699
1699
|
}
|
|
@@ -1746,18 +1746,18 @@ class ct extends x {
|
|
|
1746
1746
|
);
|
|
1747
1747
|
if (t && t !== "") {
|
|
1748
1748
|
this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
|
|
1749
|
-
<span class="upload-icon">${
|
|
1749
|
+
<span class="upload-icon">${Q}</span>
|
|
1750
1750
|
<span class="upload-label">Replace</span>
|
|
1751
1751
|
`);
|
|
1752
1752
|
const n = () => {
|
|
1753
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1754
|
-
},
|
|
1755
|
-
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1753
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1754
|
+
}, o = () => {
|
|
1755
|
+
this.hideLoading(), this.showError("Failed to load image. Please try again."), this.previewWrapper.classList.remove("has-image"), this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", o);
|
|
1756
1756
|
};
|
|
1757
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1757
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
|
|
1758
1758
|
} else
|
|
1759
1759
|
this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
|
|
1760
|
-
<span class="upload-icon">${
|
|
1760
|
+
<span class="upload-icon">${Q}</span>
|
|
1761
1761
|
<span class="upload-label">Upload</span>
|
|
1762
1762
|
`);
|
|
1763
1763
|
}
|
|
@@ -1765,24 +1765,24 @@ class ct extends x {
|
|
|
1765
1765
|
const t = document.createElement("div");
|
|
1766
1766
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1767
1767
|
"focusout",
|
|
1768
|
-
(
|
|
1768
|
+
(a) => {
|
|
1769
1769
|
var l;
|
|
1770
|
-
|
|
1770
|
+
a.relatedTarget && t.contains(a.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1771
1771
|
},
|
|
1772
1772
|
!0
|
|
1773
1773
|
);
|
|
1774
1774
|
const e = !!(this.props.title || this.props.icon);
|
|
1775
1775
|
if (e || t.classList.add("no-label"), e) {
|
|
1776
|
-
const
|
|
1777
|
-
if (
|
|
1776
|
+
const a = document.createElement("div");
|
|
1777
|
+
if (a.className = "icon-title-container", this.props.icon) {
|
|
1778
1778
|
const l = this.createIcon(this.props.icon);
|
|
1779
|
-
|
|
1779
|
+
a.appendChild(l);
|
|
1780
1780
|
}
|
|
1781
1781
|
if (this.props.title) {
|
|
1782
1782
|
const l = this.createLabel(this.props.title);
|
|
1783
|
-
|
|
1783
|
+
a.appendChild(l);
|
|
1784
1784
|
}
|
|
1785
|
-
t.appendChild(
|
|
1785
|
+
t.appendChild(a);
|
|
1786
1786
|
}
|
|
1787
1787
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1788
1788
|
const i = document.createElement("div");
|
|
@@ -1790,19 +1790,19 @@ class ct extends x {
|
|
|
1790
1790
|
const s = this.value && this.value !== "";
|
|
1791
1791
|
s || i.classList.add("no-image");
|
|
1792
1792
|
const n = document.createElement("div");
|
|
1793
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1793
|
+
if (n.className = "preview-placeholder", n.innerHTML = $t, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = At, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1794
|
+
const a = document.createElement("button");
|
|
1795
|
+
a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Bt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
|
|
1796
1796
|
var r;
|
|
1797
1797
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1798
1798
|
};
|
|
1799
1799
|
}
|
|
1800
1800
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1801
|
-
const
|
|
1802
|
-
return
|
|
1803
|
-
<span class="upload-icon">${
|
|
1801
|
+
const o = document.createElement("button");
|
|
1802
|
+
return o.className = "upload-button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
|
|
1803
|
+
<span class="upload-icon">${Q}</span>
|
|
1804
1804
|
<span class="upload-label">Upload</span>
|
|
1805
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1805
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
|
|
1806
1806
|
window.postMessage(
|
|
1807
1807
|
{
|
|
1808
1808
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1813,14 +1813,14 @@ class ct extends x {
|
|
|
1813
1813
|
}, t;
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
|
-
class
|
|
1816
|
+
class Gt extends P {
|
|
1817
1817
|
constructor(t = {}) {
|
|
1818
1818
|
super({
|
|
1819
1819
|
...t,
|
|
1820
1820
|
title: t.title || "Height",
|
|
1821
1821
|
suffix: t.suffix || "px",
|
|
1822
1822
|
minValue: t.minValue ?? 0,
|
|
1823
|
-
icon: t.icon ||
|
|
1823
|
+
icon: t.icon || Dt,
|
|
1824
1824
|
default: t.default ?? 100
|
|
1825
1825
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1826
1826
|
}
|
|
@@ -1831,17 +1831,17 @@ class ge extends V {
|
|
|
1831
1831
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
|
-
const
|
|
1834
|
+
const Dt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1835
1835
|
<path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1836
1836
|
</svg>`;
|
|
1837
|
-
class
|
|
1837
|
+
class Ft extends P {
|
|
1838
1838
|
constructor(t = {}) {
|
|
1839
1839
|
super({
|
|
1840
1840
|
...t,
|
|
1841
1841
|
title: t.title || "Width",
|
|
1842
1842
|
suffix: t.suffix || "px",
|
|
1843
1843
|
minValue: t.minValue ?? 0,
|
|
1844
|
-
icon: t.icon ||
|
|
1844
|
+
icon: t.icon || Rt,
|
|
1845
1845
|
default: t.default ?? 100
|
|
1846
1846
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1847
1847
|
}
|
|
@@ -1852,9 +1852,9 @@ class me extends V {
|
|
|
1852
1852
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1853
1853
|
}
|
|
1854
1854
|
}
|
|
1855
|
-
const
|
|
1855
|
+
const Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1856
1856
|
<path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1857
|
-
</svg>`,
|
|
1857
|
+
</svg>`, Ut = `
|
|
1858
1858
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
1859
1859
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1860
1860
|
</svg>
|
|
@@ -1886,44 +1886,44 @@ class ve extends x {
|
|
|
1886
1886
|
e.classList.add("has-label");
|
|
1887
1887
|
const n = document.createElement("div");
|
|
1888
1888
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1889
|
-
const
|
|
1890
|
-
if (
|
|
1891
|
-
|
|
1889
|
+
const o = document.createElement("span");
|
|
1890
|
+
if (o.className = "select-value", this.isLoading)
|
|
1891
|
+
o.textContent = this.props.loadingText || "Loading options...";
|
|
1892
1892
|
else {
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1893
|
+
const a = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, l = a && typeof a.name == "string" ? a.name : "Select an option";
|
|
1894
|
+
o.textContent = l;
|
|
1895
1895
|
}
|
|
1896
|
-
e.appendChild(
|
|
1896
|
+
e.appendChild(o);
|
|
1897
1897
|
} else {
|
|
1898
1898
|
const n = document.createElement("span");
|
|
1899
1899
|
if (this.isLoading)
|
|
1900
1900
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1901
1901
|
else {
|
|
1902
|
-
const
|
|
1903
|
-
n.textContent =
|
|
1902
|
+
const o = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, a = o && typeof o.name == "string" ? o.name : "Select an option";
|
|
1903
|
+
n.textContent = a;
|
|
1904
1904
|
}
|
|
1905
1905
|
e.appendChild(n);
|
|
1906
1906
|
}
|
|
1907
1907
|
e.onclick = () => {
|
|
1908
|
-
var n,
|
|
1909
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1908
|
+
var n, o;
|
|
1909
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1910
1910
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1911
1911
|
const i = document.createElement("ul");
|
|
1912
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1912
|
+
i.classList.add("select-api-options"), this._options.forEach((n, o) => {
|
|
1913
|
+
const a = this.createOption(n, o);
|
|
1914
|
+
a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
|
|
1915
1915
|
}), t.appendChild(i);
|
|
1916
1916
|
const s = document.createElement("div");
|
|
1917
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1918
|
-
var n,
|
|
1919
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1917
|
+
return s.classList.add("svg-container"), s.innerHTML = Ut, t.appendChild(s), s.onclick = () => {
|
|
1918
|
+
var n, o;
|
|
1919
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
|
|
1920
1920
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1921
|
-
const
|
|
1921
|
+
const o = new Set(
|
|
1922
1922
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1923
|
-
),
|
|
1924
|
-
(l) => !
|
|
1923
|
+
), a = n.filter(
|
|
1924
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1925
1925
|
);
|
|
1926
|
-
if (this._options.push(...
|
|
1926
|
+
if (this._options.push(...a), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1927
1927
|
const l = this._options.findIndex(
|
|
1928
1928
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1929
1929
|
);
|
|
@@ -1937,12 +1937,12 @@ class ve extends x {
|
|
|
1937
1937
|
!0
|
|
1938
1938
|
);
|
|
1939
1939
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1940
|
-
const
|
|
1940
|
+
const o = new Set(
|
|
1941
1941
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1942
|
-
),
|
|
1943
|
-
(l) => !
|
|
1942
|
+
), a = n.filter(
|
|
1943
|
+
(l) => !o.has(JSON.stringify(l.value))
|
|
1944
1944
|
);
|
|
1945
|
-
if (this._options.push(...
|
|
1945
|
+
if (this._options.push(...a), this.isLoading = !1, this.value !== void 0) {
|
|
1946
1946
|
const l = this._options.findIndex(
|
|
1947
1947
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1948
1948
|
);
|
|
@@ -1961,11 +1961,11 @@ class ve extends x {
|
|
|
1961
1961
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1962
1962
|
}
|
|
1963
1963
|
selectApiOption(t, e, i) {
|
|
1964
|
-
var
|
|
1965
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
1964
|
+
var a, l, r;
|
|
1965
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((a = s.closest(".select-api-option")) == null ? void 0 : a.querySelector(".select-api-radio"));
|
|
1966
1966
|
n && (n.checked = !0);
|
|
1967
|
-
const
|
|
1968
|
-
this.setValue(
|
|
1967
|
+
const o = this._options[e].value;
|
|
1968
|
+
this.setValue(o), this.isOpen = !1, (l = this.optionsListEl) == null || l.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open");
|
|
1969
1969
|
}
|
|
1970
1970
|
updateOptionsList() {
|
|
1971
1971
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -2008,13 +2008,13 @@ class ve extends x {
|
|
|
2008
2008
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
2009
2009
|
}
|
|
2010
2010
|
}
|
|
2011
|
-
class
|
|
2011
|
+
class Ce extends x {
|
|
2012
2012
|
constructor(t) {
|
|
2013
2013
|
var e, i;
|
|
2014
2014
|
super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
|
|
2015
2015
|
}
|
|
2016
2016
|
draw() {
|
|
2017
|
-
var
|
|
2017
|
+
var o, a;
|
|
2018
2018
|
const t = document.createElement("div");
|
|
2019
2019
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
2020
2020
|
const e = document.createElement("div");
|
|
@@ -2030,9 +2030,9 @@ class fe extends x {
|
|
|
2030
2030
|
const i = document.createElement("label");
|
|
2031
2031
|
i.className = "toggle-switch";
|
|
2032
2032
|
const s = document.createElement("input");
|
|
2033
|
-
s.type = "checkbox", s.checked = ((
|
|
2033
|
+
s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
2034
2034
|
var r, p;
|
|
2035
|
-
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((
|
|
2035
|
+
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : p.value) ?? "";
|
|
2036
2036
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
2037
2037
|
});
|
|
2038
2038
|
const n = document.createElement("span");
|
|
@@ -2058,13 +2058,13 @@ class fe extends x {
|
|
|
2058
2058
|
this.detectChangeCallback = t;
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
const
|
|
2061
|
+
const Wt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2062
2062
|
<path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2063
2063
|
</svg>`;
|
|
2064
|
-
class
|
|
2064
|
+
class ye extends x {
|
|
2065
2065
|
// Store mobile value
|
|
2066
2066
|
constructor(t = {}) {
|
|
2067
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2067
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Wt, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
|
|
2068
2068
|
}
|
|
2069
2069
|
draw() {
|
|
2070
2070
|
const t = document.createElement("div");
|
|
@@ -2075,27 +2075,27 @@ class Ce extends x {
|
|
|
2075
2075
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
2076
2076
|
const s = document.createElement("span");
|
|
2077
2077
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2078
|
+
const a = document.createElement("span");
|
|
2079
|
+
a.className = "setting-icon", a.innerHTML = this.props.icon, i.insertBefore(a, s);
|
|
2080
2080
|
}
|
|
2081
2081
|
const n = document.createElement("div");
|
|
2082
2082
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
2083
|
-
const
|
|
2084
|
-
return
|
|
2083
|
+
const o = document.createElement("div");
|
|
2084
|
+
return o.className = "gap-inputs-container", this.props.rowGap && o.appendChild(this.createGapInput("row", "Row")), this.props.columnGap && o.appendChild(this.createGapInput("column", "Col")), n.appendChild(o), e.appendChild(i), e.appendChild(n), t.appendChild(e), t;
|
|
2085
2085
|
}
|
|
2086
2086
|
createGapInput(t, e) {
|
|
2087
2087
|
const i = document.createElement("div");
|
|
2088
2088
|
i.className = "gap-input-wrapper";
|
|
2089
2089
|
const s = document.createElement("input");
|
|
2090
2090
|
if (s.type = "number", s.className = `gap-input gap-${t}-input ${this.props.inputClassName || ""}`, s.id = `${this.id}-${t}-input`, s.min = String(this.props.minValue ?? 0), this.props.maxValue !== void 0 && (s.max = String(this.props.maxValue)), s.step = String(this.props.step ?? 1), s.value = String(this.inputValues[t] ?? this.value), s.title = e, this.getDataPropsPath() && s.setAttribute("data-test-id", `${this.getDataPropsPath()}_${t}`), s.addEventListener("input", (n) => {
|
|
2091
|
-
const
|
|
2092
|
-
let
|
|
2093
|
-
|
|
2091
|
+
const o = n.target;
|
|
2092
|
+
let a = parseFloat(o.value);
|
|
2093
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a)), this.inputValues[t] = a, this.setValue(a);
|
|
2094
2094
|
}), s.addEventListener("blur", (n) => {
|
|
2095
2095
|
var l, r;
|
|
2096
|
-
const
|
|
2097
|
-
let
|
|
2098
|
-
|
|
2096
|
+
const o = n.target;
|
|
2097
|
+
let a = parseFloat(o.value);
|
|
2098
|
+
a = this.validateValue(a), String(a) !== o.value && (o.value = String(a), this.inputValues[t] = a, this.setValue(a)), (r = (l = this.props).onBlur) == null || r.call(l);
|
|
2099
2099
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
2100
2100
|
const n = document.createElement("span");
|
|
2101
2101
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2115,40 +2115,40 @@ class Ce extends x {
|
|
|
2115
2115
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2116
2116
|
}
|
|
2117
2117
|
}
|
|
2118
|
-
const
|
|
2118
|
+
const zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2119
2119
|
<path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2120
2120
|
</svg>`;
|
|
2121
|
-
class
|
|
2121
|
+
class be extends P {
|
|
2122
2122
|
constructor(t = {}) {
|
|
2123
2123
|
super({
|
|
2124
2124
|
...t,
|
|
2125
2125
|
minValue: t.minValue ?? 0,
|
|
2126
2126
|
maxValue: t.maxValue ?? 1e3,
|
|
2127
|
-
icon: t.icon ||
|
|
2127
|
+
icon: t.icon || zt,
|
|
2128
2128
|
title: t.title || "Margin Bottom",
|
|
2129
2129
|
default: t.default ?? 20,
|
|
2130
2130
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2131
2131
|
}), this.inputType = "number";
|
|
2132
2132
|
}
|
|
2133
2133
|
}
|
|
2134
|
-
const
|
|
2134
|
+
const jt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2135
2135
|
<path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
|
|
2136
2136
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2137
2137
|
</svg>`;
|
|
2138
|
-
class
|
|
2138
|
+
class Ee extends P {
|
|
2139
2139
|
constructor(t = {}) {
|
|
2140
2140
|
super({
|
|
2141
2141
|
...t,
|
|
2142
2142
|
minValue: t.minValue ?? 0,
|
|
2143
2143
|
maxValue: t.maxValue ?? 1e3,
|
|
2144
|
-
icon: t.icon ||
|
|
2144
|
+
icon: t.icon || jt,
|
|
2145
2145
|
title: t.title || "Margin Top",
|
|
2146
2146
|
default: t.default ?? 20,
|
|
2147
2147
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2148
2148
|
}), this.inputType = "number";
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
|
-
class
|
|
2151
|
+
class we extends x {
|
|
2152
2152
|
constructor(t) {
|
|
2153
2153
|
super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), t.default ? this.value = { ...t.default } : this.value || (this.value = {}), this.defaultLanguage = t.languages.includes(x.DefaultLanguage) ? x.DefaultLanguage : t.languages[0];
|
|
2154
2154
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
@@ -2168,9 +2168,9 @@ class Ee extends x {
|
|
|
2168
2168
|
return i.font = s, i.measureText(t).width;
|
|
2169
2169
|
}
|
|
2170
2170
|
adaptPlaceholderToSingleLine(t, e) {
|
|
2171
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0,
|
|
2171
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0, o = parseFloat(i.borderLeftWidth) || 0, a = parseFloat(i.borderRightWidth) || 0, l = Math.max(
|
|
2172
2172
|
0,
|
|
2173
|
-
t.clientWidth - s - n -
|
|
2173
|
+
t.clientWidth - s - n - o - a
|
|
2174
2174
|
);
|
|
2175
2175
|
if (l <= 0) {
|
|
2176
2176
|
t.placeholder = e;
|
|
@@ -2181,42 +2181,42 @@ class Ee extends x {
|
|
|
2181
2181
|
return;
|
|
2182
2182
|
}
|
|
2183
2183
|
const p = "...";
|
|
2184
|
-
let
|
|
2185
|
-
for (;
|
|
2186
|
-
const
|
|
2187
|
-
this.measureTextWidth(
|
|
2184
|
+
let h = 0, d = e.length, u = 0;
|
|
2185
|
+
for (; h <= d; ) {
|
|
2186
|
+
const m = Math.floor((h + d) / 2), f = e.slice(0, m).trimEnd() + p;
|
|
2187
|
+
this.measureTextWidth(f, i) <= l ? (u = m, h = m + 1) : d = m - 1;
|
|
2188
2188
|
}
|
|
2189
2189
|
const g = e.slice(0, u).trimEnd() + p;
|
|
2190
2190
|
t.placeholder = g;
|
|
2191
2191
|
}
|
|
2192
2192
|
autosizeTextarea(t, e = 3) {
|
|
2193
2193
|
t.style.height = "auto";
|
|
2194
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom),
|
|
2195
|
-
t.style.height = `${l}px`, t.scrollHeight >
|
|
2194
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom), o = parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth), a = s * e + n + o, l = Math.min(t.scrollHeight || 44, a);
|
|
2195
|
+
t.style.height = `${l}px`, t.scrollHeight > a ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
2196
2196
|
}
|
|
2197
2197
|
createTextareaRow(t, e) {
|
|
2198
2198
|
const i = document.createElement("div");
|
|
2199
2199
|
i.classList.add("simple-multi-language-row");
|
|
2200
2200
|
const s = document.createElement("label");
|
|
2201
2201
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2202
|
-
const n = new
|
|
2202
|
+
const n = new nt({
|
|
2203
2203
|
defaultUrl: e || "",
|
|
2204
2204
|
title: "",
|
|
2205
2205
|
id: `${this.id}_upload_${t}`
|
|
2206
2206
|
});
|
|
2207
|
-
n.setOnChange((
|
|
2208
|
-
this.updateLanguageValue(t,
|
|
2207
|
+
n.setOnChange((a) => {
|
|
2208
|
+
this.updateLanguageValue(t, a), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(a);
|
|
2209
2209
|
}), this.uploadSettings.set(t, n);
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2210
|
+
const o = n.draw();
|
|
2211
|
+
o.classList.add("simple-language-upload"), i.appendChild(o);
|
|
2212
2212
|
} else {
|
|
2213
2213
|
const n = document.createElement("textarea");
|
|
2214
2214
|
n.id = `textarea-${t}`, n.classList.add("simple-language-textarea"), n.value = e || "", n.rows = 1, n.style.overflowY = "hidden";
|
|
2215
|
-
let
|
|
2216
|
-
|
|
2215
|
+
let o = this.props.placeholder || "Enter text in {language}...";
|
|
2216
|
+
o.includes("{language}") && (o = o.replace(
|
|
2217
2217
|
"{language}",
|
|
2218
2218
|
t.toUpperCase()
|
|
2219
|
-
)), n.setAttribute("data-full-placeholder",
|
|
2219
|
+
)), n.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(n, o), this.getDataPropsPath() && n.setAttribute(
|
|
2220
2220
|
"data-test-id",
|
|
2221
2221
|
`${this.getDataPropsPath()}_${t}`
|
|
2222
2222
|
), n.addEventListener("input", (l) => {
|
|
@@ -2245,11 +2245,11 @@ class Ee extends x {
|
|
|
2245
2245
|
`#textarea-${e}`
|
|
2246
2246
|
);
|
|
2247
2247
|
if (i && (!i.value || i.value.trim() === "")) {
|
|
2248
|
-
const
|
|
2248
|
+
const o = t || ((n = this.props.placeholder) == null ? void 0 : n.replace(
|
|
2249
2249
|
"{language}",
|
|
2250
2250
|
e.toUpperCase()
|
|
2251
2251
|
)) || `Enter text in ${e.toUpperCase()}...`;
|
|
2252
|
-
i.setAttribute("data-full-placeholder",
|
|
2252
|
+
i.setAttribute("data-full-placeholder", o), this.adaptPlaceholderToSingleLine(i, o);
|
|
2253
2253
|
}
|
|
2254
2254
|
});
|
|
2255
2255
|
}
|
|
@@ -2261,17 +2261,17 @@ class Ee extends x {
|
|
|
2261
2261
|
}
|
|
2262
2262
|
const e = document.createElement("div");
|
|
2263
2263
|
e.classList.add("simple-multi-language-content"), this.props.languages.forEach((s) => {
|
|
2264
|
-
var
|
|
2265
|
-
const n = ((
|
|
2266
|
-
e.appendChild(
|
|
2264
|
+
var a;
|
|
2265
|
+
const n = ((a = this.value) == null ? void 0 : a[s]) || "", o = this.createTextareaRow(s, n);
|
|
2266
|
+
e.appendChild(o);
|
|
2267
2267
|
}), t.appendChild(e), this.container = t;
|
|
2268
2268
|
const i = () => {
|
|
2269
2269
|
if (!this.container) return;
|
|
2270
2270
|
this.container.querySelectorAll(
|
|
2271
2271
|
".simple-language-textarea"
|
|
2272
2272
|
).forEach((n) => {
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2273
|
+
const o = n.getAttribute("data-full-placeholder") || "";
|
|
2274
|
+
o && this.adaptPlaceholderToSingleLine(n, o);
|
|
2275
2275
|
});
|
|
2276
2276
|
};
|
|
2277
2277
|
return window.addEventListener("resize", i), t;
|
|
@@ -2295,7 +2295,7 @@ class Ee extends x {
|
|
|
2295
2295
|
});
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
|
-
class
|
|
2298
|
+
class xe extends x {
|
|
2299
2299
|
constructor(t = {}) {
|
|
2300
2300
|
super(t), this.inputType = "select";
|
|
2301
2301
|
const e = [
|
|
@@ -2306,7 +2306,7 @@ class we extends x {
|
|
|
2306
2306
|
{ name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
|
|
2307
2307
|
{ name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
|
|
2308
2308
|
];
|
|
2309
|
-
this.selectSetting = new
|
|
2309
|
+
this.selectSetting = new et({
|
|
2310
2310
|
title: this.title || "Animation",
|
|
2311
2311
|
options: e,
|
|
2312
2312
|
default: this.props.default || "none"
|
|
@@ -2322,97 +2322,97 @@ class we extends x {
|
|
|
2322
2322
|
this.selectSetting.destroy(), super.destroy();
|
|
2323
2323
|
}
|
|
2324
2324
|
}
|
|
2325
|
-
const
|
|
2326
|
-
let i = !1, s = 0, n = 0,
|
|
2327
|
-
const l = (
|
|
2328
|
-
if (
|
|
2329
|
-
i = !0, s =
|
|
2325
|
+
const ut = (c, t, e) => {
|
|
2326
|
+
let i = !1, s = 0, n = 0, o = 0, a = 0;
|
|
2327
|
+
const l = (h) => {
|
|
2328
|
+
if (h.target.closest("button")) return;
|
|
2329
|
+
i = !0, s = h.clientX, n = h.clientY;
|
|
2330
2330
|
const d = t.getBoundingClientRect();
|
|
2331
|
-
|
|
2332
|
-
}, r = (
|
|
2331
|
+
o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2332
|
+
}, r = (h) => {
|
|
2333
2333
|
if (!i) return;
|
|
2334
|
-
const d =
|
|
2335
|
-
let C =
|
|
2336
|
-
C = Math.max(8, Math.min(g -
|
|
2334
|
+
const d = h.clientX - s, u = h.clientY - n, g = window.innerWidth, m = window.innerHeight, f = t.offsetWidth, v = t.offsetHeight;
|
|
2335
|
+
let C = o + d, y = a + u;
|
|
2336
|
+
C = Math.max(8, Math.min(g - f - 8, C)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
|
|
2337
2337
|
}, p = () => {
|
|
2338
2338
|
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2339
2339
|
};
|
|
2340
|
-
|
|
2341
|
-
}, W = (
|
|
2342
|
-
if (!
|
|
2343
|
-
let t =
|
|
2340
|
+
c.addEventListener("mousedown", l);
|
|
2341
|
+
}, W = (c) => {
|
|
2342
|
+
if (!c) return null;
|
|
2343
|
+
let t = c.trim();
|
|
2344
2344
|
return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
|
|
2345
|
-
},
|
|
2346
|
-
const t =
|
|
2345
|
+
}, J = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, V = (c) => {
|
|
2346
|
+
const t = c.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2347
2347
|
return {
|
|
2348
2348
|
r: parseInt(e.slice(0, 2), 16),
|
|
2349
2349
|
g: parseInt(e.slice(2, 4), 16),
|
|
2350
2350
|
b: parseInt(e.slice(4, 6), 16)
|
|
2351
2351
|
};
|
|
2352
|
-
},
|
|
2353
|
-
const { r: t, g: e, b: i } =
|
|
2352
|
+
}, R = (c) => {
|
|
2353
|
+
const { r: t, g: e, b: i } = V(c), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
|
|
2354
2354
|
let p = 0;
|
|
2355
|
-
r !== 0 && (
|
|
2356
|
-
const
|
|
2357
|
-
return { h: p * 60, s:
|
|
2358
|
-
},
|
|
2359
|
-
const i = (
|
|
2360
|
-
let
|
|
2361
|
-
return i < 60 ? (
|
|
2362
|
-
Math.round((
|
|
2363
|
-
Math.round((l +
|
|
2364
|
-
Math.round((r +
|
|
2355
|
+
r !== 0 && (a === s ? p = (n - o) / r % 6 : a === n ? p = (o - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
|
|
2356
|
+
const h = a === 0 ? 0 : r / a, d = a;
|
|
2357
|
+
return { h: p * 60, s: h, v: d };
|
|
2358
|
+
}, U = (c, t, e) => {
|
|
2359
|
+
const i = (c % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
|
|
2360
|
+
let a = 0, l = 0, r = 0;
|
|
2361
|
+
return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), J(
|
|
2362
|
+
Math.round((a + o) * 255),
|
|
2363
|
+
Math.round((l + o) * 255),
|
|
2364
|
+
Math.round((r + o) * 255)
|
|
2365
2365
|
);
|
|
2366
|
-
},
|
|
2366
|
+
}, gt = (c, t, e) => {
|
|
2367
2367
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2368
|
-
return { hue:
|
|
2369
|
-
},
|
|
2370
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2371
|
-
let
|
|
2372
|
-
return
|
|
2373
|
-
r: Math.round((
|
|
2374
|
-
g: Math.round((
|
|
2368
|
+
return { hue: c, sat: s, lightness: i };
|
|
2369
|
+
}, it = (c, t, e) => {
|
|
2370
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 60 % 2 - 1)), n = e - i / 2;
|
|
2371
|
+
let o = 0, a = 0, l = 0;
|
|
2372
|
+
return c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
|
|
2373
|
+
r: Math.round((o + n) * 255),
|
|
2374
|
+
g: Math.round((a + n) * 255),
|
|
2375
2375
|
b: Math.round((l + n) * 255)
|
|
2376
2376
|
};
|
|
2377
|
-
},
|
|
2377
|
+
}, st = (c, t) => {
|
|
2378
2378
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2379
|
-
if (
|
|
2380
|
-
const { r: s, g: n, b:
|
|
2381
|
-
return `rgba(${s}, ${n}, ${
|
|
2382
|
-
}
|
|
2383
|
-
if (
|
|
2384
|
-
return
|
|
2385
|
-
if (
|
|
2386
|
-
return
|
|
2387
|
-
if (
|
|
2388
|
-
const s =
|
|
2379
|
+
if (c.startsWith("#")) {
|
|
2380
|
+
const { r: s, g: n, b: o } = V(c);
|
|
2381
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2382
|
+
}
|
|
2383
|
+
if (c.startsWith("rgba("))
|
|
2384
|
+
return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2385
|
+
if (c.startsWith("rgb("))
|
|
2386
|
+
return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2387
|
+
if (c.startsWith("hsl(")) {
|
|
2388
|
+
const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2389
2389
|
if (s) {
|
|
2390
|
-
const { r: n, g:
|
|
2390
|
+
const { r: n, g: o, b: a } = it(
|
|
2391
2391
|
parseInt(s[1]),
|
|
2392
2392
|
parseInt(s[2]) / 100,
|
|
2393
2393
|
parseInt(s[3]) / 100
|
|
2394
2394
|
);
|
|
2395
|
-
return `rgba(${n}, ${
|
|
2395
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2396
2396
|
}
|
|
2397
2397
|
}
|
|
2398
|
-
if (
|
|
2399
|
-
const s =
|
|
2398
|
+
if (c.startsWith("hsla(")) {
|
|
2399
|
+
const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2400
2400
|
if (s) {
|
|
2401
|
-
const { r: n, g:
|
|
2401
|
+
const { r: n, g: o, b: a } = it(
|
|
2402
2402
|
parseInt(s[1]),
|
|
2403
2403
|
parseInt(s[2]) / 100,
|
|
2404
2404
|
parseInt(s[3]) / 100
|
|
2405
2405
|
);
|
|
2406
|
-
return `rgba(${n}, ${
|
|
2406
|
+
return `rgba(${n}, ${o}, ${a}, ${e})`;
|
|
2407
2407
|
}
|
|
2408
2408
|
}
|
|
2409
|
-
const i = W(
|
|
2409
|
+
const i = W(c);
|
|
2410
2410
|
if (i) {
|
|
2411
|
-
const { r: s, g: n, b:
|
|
2412
|
-
return `rgba(${s}, ${n}, ${
|
|
2411
|
+
const { r: s, g: n, b: o } = V(i);
|
|
2412
|
+
return `rgba(${s}, ${n}, ${o}, ${e})`;
|
|
2413
2413
|
}
|
|
2414
|
-
return
|
|
2415
|
-
},
|
|
2414
|
+
return c;
|
|
2415
|
+
}, qt = (c) => [
|
|
2416
2416
|
"red",
|
|
2417
2417
|
"green",
|
|
2418
2418
|
"blue",
|
|
@@ -2436,22 +2436,22 @@ const ht = (h, t, e) => {
|
|
|
2436
2436
|
"teal",
|
|
2437
2437
|
"fuchsia",
|
|
2438
2438
|
"transparent"
|
|
2439
|
-
].includes(
|
|
2439
|
+
].includes(c.toLowerCase()), mt = (c) => [
|
|
2440
2440
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2441
2441
|
/^rgba?\s*\([^)]+\)$/,
|
|
2442
2442
|
/^hsla?\s*\([^)]+\)$/,
|
|
2443
2443
|
/^[a-zA-Z]+$/
|
|
2444
|
-
].some((e) => e.test(
|
|
2444
|
+
].some((e) => e.test(c.trim())), _t = (c) => {
|
|
2445
2445
|
if (typeof document > "u")
|
|
2446
|
-
return
|
|
2446
|
+
return mt(c) || !!W(c);
|
|
2447
2447
|
const t = document.createElement("div");
|
|
2448
|
-
return t.style.color =
|
|
2449
|
-
},
|
|
2450
|
-
const t =
|
|
2448
|
+
return t.style.color = c, t.style.color !== "";
|
|
2449
|
+
}, ft = (c) => {
|
|
2450
|
+
const t = c.trim();
|
|
2451
2451
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2452
|
-
const n = t.slice(1),
|
|
2452
|
+
const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2453
2453
|
return {
|
|
2454
|
-
color:
|
|
2454
|
+
color: J(o, a, l),
|
|
2455
2455
|
position: 0,
|
|
2456
2456
|
opacity: Math.round(r / 255 * 100)
|
|
2457
2457
|
};
|
|
@@ -2460,9 +2460,9 @@ const ht = (h, t, e) => {
|
|
|
2460
2460
|
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2461
2461
|
);
|
|
2462
2462
|
if (e) {
|
|
2463
|
-
const n = parseInt(e[1]),
|
|
2463
|
+
const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2464
2464
|
return {
|
|
2465
|
-
color:
|
|
2465
|
+
color: J(n, o, a),
|
|
2466
2466
|
position: 0,
|
|
2467
2467
|
opacity: Math.round(l * 100)
|
|
2468
2468
|
};
|
|
@@ -2471,23 +2471,23 @@ const ht = (h, t, e) => {
|
|
|
2471
2471
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2472
2472
|
);
|
|
2473
2473
|
if (i) {
|
|
2474
|
-
const { r: n, g:
|
|
2474
|
+
const { r: n, g: o, b: a } = it(
|
|
2475
2475
|
parseFloat(i[1]),
|
|
2476
2476
|
parseFloat(i[2]) / 100,
|
|
2477
2477
|
parseFloat(i[3]) / 100
|
|
2478
2478
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2479
2479
|
return {
|
|
2480
|
-
color:
|
|
2480
|
+
color: J(n, o, a),
|
|
2481
2481
|
position: 0,
|
|
2482
2482
|
opacity: Math.round(l * 100)
|
|
2483
2483
|
};
|
|
2484
2484
|
}
|
|
2485
2485
|
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
2486
|
-
},
|
|
2486
|
+
}, rt = (c) => {
|
|
2487
2487
|
const t = [];
|
|
2488
2488
|
let e = "", i = 0;
|
|
2489
|
-
for (let s = 0; s <
|
|
2490
|
-
const n =
|
|
2489
|
+
for (let s = 0; s < c.length; s++) {
|
|
2490
|
+
const n = c[s];
|
|
2491
2491
|
if (n === "(") i++;
|
|
2492
2492
|
else if (n === ")") i--;
|
|
2493
2493
|
else if (n === "," && i === 0) {
|
|
@@ -2497,16 +2497,16 @@ const ht = (h, t, e) => {
|
|
|
2497
2497
|
e += n;
|
|
2498
2498
|
}
|
|
2499
2499
|
return e.trim() && t.push(e.trim()), t;
|
|
2500
|
-
},
|
|
2501
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2500
|
+
}, ct = (c, t) => {
|
|
2501
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.match(e);
|
|
2502
2502
|
if (!i) return null;
|
|
2503
2503
|
const s = i.index + i[0].length;
|
|
2504
|
-
let n = 1,
|
|
2505
|
-
for (let
|
|
2506
|
-
|
|
2507
|
-
return n === 0 ?
|
|
2508
|
-
},
|
|
2509
|
-
const t =
|
|
2504
|
+
let n = 1, o = s;
|
|
2505
|
+
for (let a = s; a < c.length && n > 0; a++)
|
|
2506
|
+
c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
|
|
2507
|
+
return n === 0 ? c.substring(s, o) : null;
|
|
2508
|
+
}, Jt = (c) => {
|
|
2509
|
+
const t = c.split(" ")[0].toLowerCase();
|
|
2510
2510
|
return [
|
|
2511
2511
|
"circle",
|
|
2512
2512
|
"ellipse",
|
|
@@ -2517,44 +2517,44 @@ const ht = (h, t, e) => {
|
|
|
2517
2517
|
"at",
|
|
2518
2518
|
"contain",
|
|
2519
2519
|
"cover"
|
|
2520
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2521
|
-
},
|
|
2520
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || qt(t);
|
|
2521
|
+
}, ht = (c) => {
|
|
2522
2522
|
const t = [];
|
|
2523
|
-
return
|
|
2523
|
+
return c.forEach((e, i) => {
|
|
2524
2524
|
const s = e.trim();
|
|
2525
2525
|
if (!s) return;
|
|
2526
|
-
let n = "",
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2529
|
-
const l =
|
|
2530
|
-
l.position = Math.max(0, Math.min(100, Math.round(
|
|
2526
|
+
let n = "", o = 0;
|
|
2527
|
+
const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2528
|
+
a && mt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
|
|
2529
|
+
const l = ft(n);
|
|
2530
|
+
l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
|
|
2531
2531
|
}), t;
|
|
2532
|
-
},
|
|
2533
|
-
const t =
|
|
2532
|
+
}, $ = (c) => {
|
|
2533
|
+
const t = c.stops && c.stops.length ? c.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2534
2534
|
return {
|
|
2535
|
-
type:
|
|
2536
|
-
angle: typeof
|
|
2535
|
+
type: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
|
|
2536
|
+
angle: typeof c.angle == "number" ? c.angle : 90,
|
|
2537
2537
|
stops: t.map((e, i) => ({
|
|
2538
2538
|
color: e.color || "#000000",
|
|
2539
2539
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2540
2540
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2541
2541
|
}))
|
|
2542
2542
|
};
|
|
2543
|
-
},
|
|
2544
|
-
const t =
|
|
2545
|
-
if (
|
|
2546
|
-
const s =
|
|
2547
|
-
return
|
|
2543
|
+
}, N = (c) => {
|
|
2544
|
+
const t = c.replace(/;$/, "").trim();
|
|
2545
|
+
if (_t(t)) {
|
|
2546
|
+
const s = ft(t);
|
|
2547
|
+
return $({ type: "solid", angle: 0, stops: [s] });
|
|
2548
2548
|
}
|
|
2549
|
-
const e =
|
|
2549
|
+
const e = ct(t, "linear-gradient");
|
|
2550
2550
|
if (e) {
|
|
2551
|
-
const s =
|
|
2552
|
-
let n = 90,
|
|
2553
|
-
const
|
|
2554
|
-
if (
|
|
2555
|
-
const r =
|
|
2556
|
-
r && (n = parseFloat(r[1]),
|
|
2557
|
-
} else
|
|
2551
|
+
const s = rt(e);
|
|
2552
|
+
let n = 90, o = s;
|
|
2553
|
+
const a = s[0];
|
|
2554
|
+
if (a.includes("deg")) {
|
|
2555
|
+
const r = a.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2556
|
+
r && (n = parseFloat(r[1]), o = s.slice(1));
|
|
2557
|
+
} else a.includes("to ") && (n = {
|
|
2558
2558
|
"to right": 90,
|
|
2559
2559
|
"to left": 270,
|
|
2560
2560
|
"to bottom": 180,
|
|
@@ -2563,31 +2563,31 @@ const ht = (h, t, e) => {
|
|
|
2563
2563
|
"to bottom left": 225,
|
|
2564
2564
|
"to top right": 45,
|
|
2565
2565
|
"to top left": 315
|
|
2566
|
-
}[
|
|
2567
|
-
const l =
|
|
2568
|
-
return l.length ?
|
|
2566
|
+
}[a] ?? 90, o = s.slice(1));
|
|
2567
|
+
const l = ht(o);
|
|
2568
|
+
return l.length ? $({ type: "linear", angle: n, stops: l }) : null;
|
|
2569
2569
|
}
|
|
2570
|
-
const i =
|
|
2570
|
+
const i = ct(t, "radial-gradient");
|
|
2571
2571
|
if (i) {
|
|
2572
|
-
const s =
|
|
2573
|
-
return
|
|
2572
|
+
const s = rt(i), n = s[0] && !Jt(s[0]) ? s.slice(1) : s, o = ht(n);
|
|
2573
|
+
return o.length ? $({ type: "radial", angle: 0, stops: o }) : null;
|
|
2574
2574
|
}
|
|
2575
2575
|
return null;
|
|
2576
|
-
},
|
|
2577
|
-
if (
|
|
2578
|
-
const e =
|
|
2576
|
+
}, O = (c) => {
|
|
2577
|
+
if (c.type === "solid") {
|
|
2578
|
+
const e = c.stops[0], i = e.color;
|
|
2579
2579
|
if (i.startsWith("var(--"))
|
|
2580
2580
|
return i;
|
|
2581
|
-
const s = e.opacity ?? 100, n = i.replace("#", ""),
|
|
2582
|
-
return `#${n}${
|
|
2581
|
+
const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2582
|
+
return `#${n}${o}`;
|
|
2583
2583
|
}
|
|
2584
|
-
const t =
|
|
2585
|
-
(e) => `${
|
|
2584
|
+
const t = c.stops.map(
|
|
2585
|
+
(e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2586
2586
|
).join(", ");
|
|
2587
|
-
return
|
|
2588
|
-
},
|
|
2589
|
-
if (
|
|
2590
|
-
const t =
|
|
2587
|
+
return c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
|
|
2588
|
+
}, Zt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), Z = (c) => {
|
|
2589
|
+
if (c.type === "solid") {
|
|
2590
|
+
const t = c.stops[0];
|
|
2591
2591
|
if (t) {
|
|
2592
2592
|
const e = t.color;
|
|
2593
2593
|
if (e.startsWith("var(--"))
|
|
@@ -2597,14 +2597,14 @@ const ht = (h, t, e) => {
|
|
|
2597
2597
|
if (i === 100)
|
|
2598
2598
|
return e;
|
|
2599
2599
|
{
|
|
2600
|
-
const s =
|
|
2600
|
+
const s = Zt(i);
|
|
2601
2601
|
return `${e}${s}`;
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
2604
|
return "#000000";
|
|
2605
2605
|
}
|
|
2606
|
-
return
|
|
2607
|
-
},
|
|
2606
|
+
return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
|
|
2607
|
+
}, z = class z {
|
|
2608
2608
|
static defaults() {
|
|
2609
2609
|
return {
|
|
2610
2610
|
solid: [],
|
|
@@ -2615,7 +2615,7 @@ const ht = (h, t, e) => {
|
|
|
2615
2615
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2616
2616
|
return t.forEach((s) => {
|
|
2617
2617
|
let n = W(s);
|
|
2618
|
-
n ||
|
|
2618
|
+
n || N(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2619
2619
|
}), i.slice(0, this.MAX_COLORS);
|
|
2620
2620
|
}
|
|
2621
2621
|
static ensureLoaded() {
|
|
@@ -2651,7 +2651,9 @@ const ht = (h, t, e) => {
|
|
|
2651
2651
|
}
|
|
2652
2652
|
static getColors(t) {
|
|
2653
2653
|
if (t === "all") {
|
|
2654
|
-
const e = this.list("solid"), i = this.list("gradient"), s = [
|
|
2654
|
+
const e = this.list("solid"), i = this.list("gradient"), s = [], n = Math.max(e.length, i.length);
|
|
2655
|
+
for (let o = 0; o < n; o++)
|
|
2656
|
+
o < e.length && s.push(e[o]), o < i.length && s.push(i[o]);
|
|
2655
2657
|
return this.normalizeList(s);
|
|
2656
2658
|
}
|
|
2657
2659
|
return [...this.list(t)];
|
|
@@ -2662,17 +2664,17 @@ const ht = (h, t, e) => {
|
|
|
2662
2664
|
if (i)
|
|
2663
2665
|
s = "solid";
|
|
2664
2666
|
else {
|
|
2665
|
-
const l =
|
|
2667
|
+
const l = N(t);
|
|
2666
2668
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2667
2669
|
}
|
|
2668
2670
|
if (!i) return;
|
|
2669
|
-
const n = e === "all" ? s : e,
|
|
2670
|
-
|
|
2671
|
+
const n = e === "all" ? s : e, o = this.list(n), a = o.indexOf(i);
|
|
2672
|
+
a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
|
|
2671
2673
|
}
|
|
2672
2674
|
};
|
|
2673
|
-
|
|
2674
|
-
let D =
|
|
2675
|
-
const
|
|
2675
|
+
z.STORAGE_KEY = "settingsLib_recentColors", z.MAX_COLORS = 12, z.colors = null;
|
|
2676
|
+
let D = z;
|
|
2677
|
+
const ot = (c, t) => {
|
|
2676
2678
|
const e = document.createElement("div");
|
|
2677
2679
|
e.className = "color-picker-recent-section";
|
|
2678
2680
|
const i = document.createElement("div");
|
|
@@ -2681,25 +2683,31 @@ const it = (h, t) => {
|
|
|
2681
2683
|
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2682
2684
|
const n = () => {
|
|
2683
2685
|
s.style.display = "none";
|
|
2684
|
-
},
|
|
2686
|
+
}, o = (p, h) => {
|
|
2685
2687
|
const d = p.getBoundingClientRect();
|
|
2686
|
-
s.textContent =
|
|
2687
|
-
},
|
|
2688
|
-
|
|
2688
|
+
s.textContent = h, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
2689
|
+
}, a = document.createElement("div");
|
|
2690
|
+
a.className = "color-picker-recent-grid";
|
|
2689
2691
|
const l = document.createElement("div");
|
|
2690
|
-
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(
|
|
2692
|
+
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
|
|
2691
2693
|
const r = () => {
|
|
2692
|
-
n(),
|
|
2694
|
+
n(), a.innerHTML = "";
|
|
2693
2695
|
const p = D.getColors(t);
|
|
2694
2696
|
if (p.length === 0) {
|
|
2695
|
-
|
|
2697
|
+
a.style.display = "none", l.style.display = "block";
|
|
2696
2698
|
return;
|
|
2697
2699
|
}
|
|
2698
|
-
|
|
2700
|
+
a.style.display = "grid", l.style.display = "none", p.forEach((h) => {
|
|
2699
2701
|
const d = document.createElement("button");
|
|
2700
2702
|
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
2701
|
-
const u =
|
|
2702
|
-
d.title = u, d.setAttribute("aria-label", `Use color: ${u}`),
|
|
2703
|
+
const u = Xt(h);
|
|
2704
|
+
if (d.title = u, d.setAttribute("aria-label", `Use color: ${u}`), h.includes("gradient(")) {
|
|
2705
|
+
d.style.backgroundImage = h, d.style.backgroundColor = "transparent";
|
|
2706
|
+
const m = N(h);
|
|
2707
|
+
m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
|
|
2708
|
+
} else
|
|
2709
|
+
d.style.backgroundColor = h, d.style.borderColor = h;
|
|
2710
|
+
d.addEventListener("mouseenter", () => o(d, u)), d.addEventListener("mouseleave", () => {
|
|
2703
2711
|
n(), d.style.boxShadow = "";
|
|
2704
2712
|
}), d.addEventListener("mousedown", () => {
|
|
2705
2713
|
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
@@ -2708,47 +2716,47 @@ const it = (h, t) => {
|
|
|
2708
2716
|
d.style.boxShadow = "";
|
|
2709
2717
|
}, 150);
|
|
2710
2718
|
}), d.addEventListener("click", () => {
|
|
2711
|
-
n(), h
|
|
2712
|
-
}),
|
|
2719
|
+
n(), c(h);
|
|
2720
|
+
}), a.appendChild(d);
|
|
2713
2721
|
});
|
|
2714
2722
|
};
|
|
2715
2723
|
return r(), { container: e, refresh: r };
|
|
2716
|
-
},
|
|
2717
|
-
const t =
|
|
2724
|
+
}, Xt = (c) => {
|
|
2725
|
+
const t = N(c);
|
|
2718
2726
|
if (t)
|
|
2719
|
-
return
|
|
2720
|
-
const e = W(
|
|
2727
|
+
return Z(t);
|
|
2728
|
+
const e = W(c);
|
|
2721
2729
|
if (e) {
|
|
2722
|
-
const i =
|
|
2730
|
+
const i = V(e);
|
|
2723
2731
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2724
2732
|
}
|
|
2725
|
-
return
|
|
2726
|
-
},
|
|
2733
|
+
return c;
|
|
2734
|
+
}, vt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2727
2735
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2728
2736
|
d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
|
|
2729
2737
|
fill="#919EAB"/>
|
|
2730
|
-
</svg>`,
|
|
2738
|
+
</svg>`, Ct = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2731
2739
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
|
|
2732
|
-
</svg>`,
|
|
2740
|
+
</svg>`, Kt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2733
2741
|
<path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2734
|
-
</svg>`,
|
|
2742
|
+
</svg>`, Yt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2735
2743
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2736
|
-
</svg>`,
|
|
2744
|
+
</svg>`, Qt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2737
2745
|
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2738
2746
|
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2739
2747
|
</svg>
|
|
2740
2748
|
|
|
2741
|
-
`,
|
|
2749
|
+
`, te = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2742
2750
|
<path d="M4.5 21L19.5 21C19.8978 21 20.2794 20.842 20.5607 20.5607C20.842 20.2794 21 19.8978 21 19.5L21 4.5C21 4.10218 20.842 3.72065 20.5607 3.43934C20.2794 3.15804 19.8978 3 19.5 3L4.5 3C4.10218 3 3.72065 3.15804 3.43934 3.43934C3.15804 3.72064 3 4.10218 3 4.5L3 19.5C3 19.8978 3.15804 20.2794 3.43934 20.5607C3.72065 20.842 4.10218 21 4.5 21ZM7.5 4.5L7.5 7.5L10.5 7.5L10.5 4.5L13.5 4.5L13.5 7.5L16.5 7.5L16.5 10.5L13.5 10.5L13.5 13.5L16.5 13.5L16.5 16.5L13.5 16.5L13.5 19.5L10.5 19.5L10.5 16.5L7.5 16.5L7.5 19.5L4.5 19.5L4.5 4.5L7.5 4.5Z" fill="#637381"/>
|
|
2743
2751
|
<path d="M13.5 16.5L10.5 16.5L10.5 13.5L13.5 13.5L13.5 16.5ZM13.5 10.5L10.5 10.5L10.5 7.5L13.5 7.5L13.5 10.5ZM10.5 13.5L7.5 13.5L7.5 10.5L10.5 10.5L10.5 13.5Z" fill="#637381"/>
|
|
2744
2752
|
</svg>
|
|
2745
2753
|
|
|
2746
|
-
`,
|
|
2754
|
+
`, ee = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2747
2755
|
<path d="M20.6106 19.5062C20.6887 19.5843 20.6887 19.711 20.6106 19.7891L19.7896 20.6101C19.7115 20.6882 19.5848 20.6882 19.5067 20.6101L5.98957 7.09298C5.91146 7.01488 5.91146 6.88825 5.98957 6.81014L6.81063 5.98908C6.88873 5.91097 7.01537 5.91097 7.09347 5.98908L20.6106 19.5062Z" fill="#46525C"/>
|
|
2748
2756
|
<path d="M9.69583 12.2146C9.81298 12.3318 9.81298 12.5217 9.69583 12.6389L7.80151 14.5332C6.72071 15.614 6.6062 17.4365 7.80151 18.6318C8.99473 19.8267 10.8184 19.7123 11.8992 18.6318L13.7935 16.7366C13.9106 16.6194 14.1006 16.6194 14.2178 16.7366L14.816 17.3348C14.9331 17.4519 14.9332 17.6418 14.816 17.759L12.9216 19.6543C11.2241 21.3536 8.47364 21.3518 6.77417 19.6543C5.07483 17.9568 5.0749 15.2064 6.77417 13.5068L8.66848 11.6116C8.78563 11.4944 8.97562 11.4944 9.0928 11.6116L9.69583 12.2146ZM13.5085 6.77441C15.2061 5.07514 17.9565 5.07509 19.656 6.77441C21.3535 8.47388 21.3533 11.2243 19.656 12.9238L17.7607 14.8182C17.6436 14.9354 17.4536 14.9353 17.3365 14.8182L16.7344 14.2161C16.6172 14.0989 16.6172 13.9089 16.7344 13.7918L18.6296 11.8975C19.7101 10.8167 19.8245 8.99503 18.6296 7.7998C17.4363 6.60449 15.6118 6.719 14.531 7.7998L12.6367 9.69412C12.5195 9.81128 12.3296 9.81128 12.2124 9.69412L11.6123 9.09402C11.4952 8.97684 11.4952 8.78685 11.6124 8.6697L13.5085 6.77441Z" fill="#46525C"/>
|
|
2749
2757
|
</svg>
|
|
2750
2758
|
`;
|
|
2751
|
-
class
|
|
2759
|
+
class dt {
|
|
2752
2760
|
constructor(t, e = "gradient") {
|
|
2753
2761
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2754
2762
|
if (!this.isOpen) return;
|
|
@@ -2764,8 +2772,8 @@ class Yt {
|
|
|
2764
2772
|
if (Array.from(n).some(
|
|
2765
2773
|
(l) => l.contains(s)
|
|
2766
2774
|
)) return;
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2775
|
+
const a = document.querySelector(".gradient-popover");
|
|
2776
|
+
a && a.contains(s) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2769
2777
|
}, this.keyDown = (i) => {
|
|
2770
2778
|
if (this.isOpen) {
|
|
2771
2779
|
if (i.key === "Escape")
|
|
@@ -2790,107 +2798,105 @@ class Yt {
|
|
|
2790
2798
|
const i = document.createElement("span");
|
|
2791
2799
|
i.textContent = "Color";
|
|
2792
2800
|
const s = document.createElement("button");
|
|
2793
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2801
|
+
s.className = "color-picker-close", s.innerHTML = vt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ut(e, t);
|
|
2794
2802
|
const n = document.createElement("div");
|
|
2795
2803
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2796
|
-
const a = document.createElement("div");
|
|
2797
|
-
a.className = "color-picker-marker", this.colorMarker = a, n.appendChild(a);
|
|
2798
2804
|
const o = document.createElement("div");
|
|
2799
|
-
o.className = "color-picker-
|
|
2805
|
+
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
2806
|
+
const a = document.createElement("div");
|
|
2807
|
+
a.className = "color-picker-sliders-container";
|
|
2800
2808
|
const l = document.createElement("button");
|
|
2801
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2809
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Ct;
|
|
2802
2810
|
const r = document.createElement("div");
|
|
2803
2811
|
r.className = "color-picker-sliders-group";
|
|
2804
2812
|
const p = document.createElement("div");
|
|
2805
2813
|
p.className = "color-picker-hue", this.hueSlider = p;
|
|
2806
|
-
const
|
|
2807
|
-
|
|
2814
|
+
const h = document.createElement("div");
|
|
2815
|
+
h.className = "color-picker-hue-marker", this.hueMarker = h, p.appendChild(h);
|
|
2808
2816
|
const d = document.createElement("div");
|
|
2809
2817
|
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2810
2818
|
const u = document.createElement("div");
|
|
2811
|
-
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d),
|
|
2812
|
-
const g =
|
|
2813
|
-
var
|
|
2814
|
-
this.setColor(b), (
|
|
2819
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d), a.appendChild(l), a.appendChild(r);
|
|
2820
|
+
const g = ot((b) => {
|
|
2821
|
+
var E;
|
|
2822
|
+
this.setColor(b), (E = this.onChange) == null || E.call(this, b, this.currentOpacity);
|
|
2815
2823
|
}, this.recentScope);
|
|
2816
2824
|
this.recentSectionRefresh = g.refresh;
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2825
|
+
const m = document.createElement("div");
|
|
2826
|
+
m.className = "color-picker-format-section";
|
|
2827
|
+
const f = document.createElement("select");
|
|
2828
|
+
f.className = "color-picker-format-select", this.select = f;
|
|
2829
|
+
const v = document.createElement("option");
|
|
2830
|
+
v.value = "hex", v.textContent = "HEX";
|
|
2823
2831
|
const C = document.createElement("option");
|
|
2824
2832
|
C.value = "rgb", C.textContent = "RGB";
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2829
|
-
const
|
|
2830
|
-
|
|
2831
|
-
const
|
|
2832
|
-
return
|
|
2833
|
+
const y = document.createElement("option");
|
|
2834
|
+
y.value = "hsl", y.textContent = "HSL", f.appendChild(v), f.appendChild(C), f.appendChild(y);
|
|
2835
|
+
const w = document.createElement("input");
|
|
2836
|
+
w.type = "text", w.className = "color-picker-color-input", w.value = this.currentColor, this.input = w;
|
|
2837
|
+
const k = document.createElement("div");
|
|
2838
|
+
k.className = "color-picker-input-container";
|
|
2839
|
+
const S = document.createElement("button");
|
|
2840
|
+
return S.className = "color-picker-copy-inside", S.textContent = "Copy", k.appendChild(w), k.appendChild(S), m.appendChild(f), m.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(g.container), t.appendChild(m), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, w, f, S, l), t;
|
|
2833
2841
|
}
|
|
2834
2842
|
createBackdrop() {
|
|
2835
2843
|
const t = document.createElement("div");
|
|
2836
|
-
return t.className = "color-picker-backdrop", t.style.display = "none", t.
|
|
2837
|
-
e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
2838
|
-
}), t;
|
|
2844
|
+
return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
|
|
2839
2845
|
}
|
|
2840
|
-
bind(t, e, i, s, n,
|
|
2841
|
-
const l = (
|
|
2846
|
+
bind(t, e, i, s, n, o, a) {
|
|
2847
|
+
const l = (h) => {
|
|
2842
2848
|
var C;
|
|
2843
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2849
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
2844
2850
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2845
|
-
const
|
|
2846
|
-
this.currentColor =
|
|
2847
|
-
}, r = (
|
|
2851
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
|
|
2852
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
2853
|
+
}, r = (h) => {
|
|
2848
2854
|
var C;
|
|
2849
2855
|
const d = e.getBoundingClientRect();
|
|
2850
|
-
let u = Math.max(0, Math.min(1, (
|
|
2856
|
+
let u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2851
2857
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2852
|
-
const g = u * 360,
|
|
2853
|
-
this.currentColor =
|
|
2854
|
-
}, p = (
|
|
2858
|
+
const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
|
|
2859
|
+
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
2860
|
+
}, p = (h) => {
|
|
2855
2861
|
var g;
|
|
2856
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2862
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
2857
2863
|
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
|
|
2858
2864
|
};
|
|
2859
|
-
t.addEventListener("mousedown", (
|
|
2860
|
-
|
|
2865
|
+
t.addEventListener("mousedown", (h) => {
|
|
2866
|
+
h.preventDefault(), l(h);
|
|
2861
2867
|
const d = (g) => l(g), u = () => {
|
|
2862
2868
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2863
2869
|
};
|
|
2864
2870
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2865
|
-
}), e.addEventListener("mousedown", (
|
|
2866
|
-
|
|
2871
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
2872
|
+
h.preventDefault(), r(h);
|
|
2867
2873
|
const d = (g) => r(g), u = () => {
|
|
2868
2874
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2869
2875
|
};
|
|
2870
2876
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2871
|
-
}), i.addEventListener("mousedown", (
|
|
2872
|
-
|
|
2877
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
2878
|
+
h.preventDefault(), p(h);
|
|
2873
2879
|
const d = (g) => p(g), u = () => {
|
|
2874
2880
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2875
2881
|
};
|
|
2876
2882
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2877
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2878
|
-
|
|
2879
|
-
}),
|
|
2883
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
|
|
2884
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
2885
|
+
}), o.addEventListener("click", async () => {
|
|
2880
2886
|
try {
|
|
2881
2887
|
await navigator.clipboard.writeText(s.value);
|
|
2882
2888
|
} catch {
|
|
2883
2889
|
s.select(), document.execCommand("copy");
|
|
2884
2890
|
}
|
|
2885
|
-
}),
|
|
2886
|
-
var
|
|
2891
|
+
}), a.addEventListener("click", async () => {
|
|
2892
|
+
var h;
|
|
2887
2893
|
if (!("EyeDropper" in window)) {
|
|
2888
2894
|
alert("EyeDropper API is not supported in this browser.");
|
|
2889
2895
|
return;
|
|
2890
2896
|
}
|
|
2891
2897
|
try {
|
|
2892
2898
|
const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
|
|
2893
|
-
this.setColor(u), (
|
|
2899
|
+
this.setColor(u), (h = this.onChange) == null || h.call(this, u, this.currentOpacity);
|
|
2894
2900
|
} catch {
|
|
2895
2901
|
}
|
|
2896
2902
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2899,22 +2905,22 @@ class Yt {
|
|
|
2899
2905
|
);
|
|
2900
2906
|
}
|
|
2901
2907
|
setColor(t) {
|
|
2902
|
-
var
|
|
2908
|
+
var o;
|
|
2903
2909
|
this.currentColor = t;
|
|
2904
|
-
const { h: e, s: i, v: s } =
|
|
2905
|
-
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (
|
|
2910
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
2911
|
+
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
|
|
2906
2912
|
}
|
|
2907
2913
|
syncInput() {
|
|
2908
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2914
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
2909
2915
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2910
2916
|
else if (t === "rgb") {
|
|
2911
|
-
const { r: n, g:
|
|
2912
|
-
this.input.value = `rgb(${n}, ${
|
|
2917
|
+
const { r: n, g: o, b: a } = V(this.currentColor);
|
|
2918
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
2913
2919
|
} else {
|
|
2914
|
-
const { hue: n, sat:
|
|
2920
|
+
const { hue: n, sat: o, lightness: a } = gt(e, i, s);
|
|
2915
2921
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2916
|
-
|
|
2917
|
-
)}%, ${Math.round(
|
|
2922
|
+
o * 100
|
|
2923
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
2918
2924
|
}
|
|
2919
2925
|
}
|
|
2920
2926
|
applyFromInput() {
|
|
@@ -2924,36 +2930,36 @@ class Yt {
|
|
|
2924
2930
|
else {
|
|
2925
2931
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2926
2932
|
if (i) {
|
|
2927
|
-
const s = parseInt(i[1]), n = parseInt(i[2]),
|
|
2928
|
-
s <= 255 && n <= 255 &&
|
|
2933
|
+
const s = parseInt(i[1]), n = parseInt(i[2]), o = parseInt(i[3]);
|
|
2934
|
+
s <= 255 && n <= 255 && o <= 255 && (e = `#${[s, n, o].map((a) => a.toString(16).padStart(2, "0")).join("")}`);
|
|
2929
2935
|
} else {
|
|
2930
2936
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2931
2937
|
if (s) {
|
|
2932
|
-
const n = parseInt(s[1]),
|
|
2933
|
-
e =
|
|
2938
|
+
const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
2939
|
+
e = U(n, r, l);
|
|
2934
2940
|
}
|
|
2935
2941
|
}
|
|
2936
2942
|
}
|
|
2937
2943
|
e && this.setColor(e);
|
|
2938
2944
|
}
|
|
2939
2945
|
updateOpacityBg() {
|
|
2940
|
-
const { r: t, g: e, b: i } =
|
|
2946
|
+
const { r: t, g: e, b: i } = V(this.currentColor);
|
|
2941
2947
|
this.opacitySlider.style.setProperty(
|
|
2942
2948
|
"--base-color",
|
|
2943
2949
|
`rgb(${t}, ${e}, ${i})`
|
|
2944
2950
|
);
|
|
2945
2951
|
}
|
|
2946
2952
|
open(t, e, i) {
|
|
2947
|
-
var
|
|
2953
|
+
var y;
|
|
2948
2954
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2949
|
-
const { h: s, s: n, v:
|
|
2950
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 -
|
|
2951
|
-
const
|
|
2955
|
+
const { h: s, s: n, v: o } = R(t);
|
|
2956
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (y = this.recentSectionRefresh) == null || y.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
|
|
2957
|
+
const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, h = window.innerHeight, d = 16;
|
|
2952
2958
|
let u = r.right + 8, g = r.top;
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2955
|
-
const
|
|
2956
|
-
|
|
2959
|
+
const m = p - r.right, f = r.left;
|
|
2960
|
+
m >= a + d ? u = r.right + 8 : f >= a + d ? u = r.left - a - 8 : u = Math.max(d, (p - a) / 2);
|
|
2961
|
+
const v = h - r.bottom, C = r.top;
|
|
2962
|
+
v >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : v > C ? (g = r.bottom + 8, g + l > h - d && (g = h - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2957
2963
|
}
|
|
2958
2964
|
close(t) {
|
|
2959
2965
|
var e;
|
|
@@ -2963,7 +2969,7 @@ class Yt {
|
|
|
2963
2969
|
return this.element;
|
|
2964
2970
|
}
|
|
2965
2971
|
}
|
|
2966
|
-
class
|
|
2972
|
+
class ie {
|
|
2967
2973
|
constructor(t) {
|
|
2968
2974
|
this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
|
|
2969
2975
|
}
|
|
@@ -2981,69 +2987,69 @@ class Qt {
|
|
|
2981
2987
|
const s = document.createElement("div");
|
|
2982
2988
|
s.className = "color-picker-sliders-container embedded";
|
|
2983
2989
|
const n = document.createElement("button");
|
|
2984
|
-
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML =
|
|
2985
|
-
const a = document.createElement("div");
|
|
2986
|
-
a.className = "color-picker-sliders-group";
|
|
2990
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Ct;
|
|
2987
2991
|
const o = document.createElement("div");
|
|
2988
|
-
o.className = "color-picker-
|
|
2992
|
+
o.className = "color-picker-sliders-group";
|
|
2993
|
+
const a = document.createElement("div");
|
|
2994
|
+
a.className = "color-picker-hue embedded", this.hueSlider = a;
|
|
2989
2995
|
const l = document.createElement("div");
|
|
2990
|
-
l.className = "color-picker-hue-marker", this.hueMarker = l,
|
|
2996
|
+
l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
|
|
2991
2997
|
const r = document.createElement("div");
|
|
2992
2998
|
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
2993
2999
|
const p = document.createElement("div");
|
|
2994
|
-
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p),
|
|
2995
|
-
const
|
|
2996
|
-
const
|
|
2997
|
-
|
|
3000
|
+
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
|
|
3001
|
+
const h = ot((w) => {
|
|
3002
|
+
const k = N(w);
|
|
3003
|
+
k && k.type !== "solid" ? this.onColorChange(w, this.currentOpacity) : (this.setColor(w), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
2998
3004
|
}, "all");
|
|
2999
|
-
this.recentSectionRefresh =
|
|
3005
|
+
this.recentSectionRefresh = h.refresh;
|
|
3000
3006
|
const d = document.createElement("div");
|
|
3001
3007
|
d.className = "color-picker-format-section embedded";
|
|
3002
3008
|
const u = document.createElement("select");
|
|
3003
3009
|
u.className = "color-picker-format-select", this.select = u;
|
|
3004
3010
|
const g = document.createElement("option");
|
|
3005
3011
|
g.value = "hex", g.textContent = "HEX";
|
|
3006
|
-
const v = document.createElement("option");
|
|
3007
|
-
v.value = "rgb", v.textContent = "RGB";
|
|
3008
3012
|
const m = document.createElement("option");
|
|
3009
|
-
m.value = "
|
|
3010
|
-
const f = document.createElement("
|
|
3011
|
-
f.
|
|
3013
|
+
m.value = "rgb", m.textContent = "RGB";
|
|
3014
|
+
const f = document.createElement("option");
|
|
3015
|
+
f.value = "hsl", f.textContent = "HSL", u.appendChild(g), u.appendChild(m), u.appendChild(f);
|
|
3016
|
+
const v = document.createElement("input");
|
|
3017
|
+
v.type = "text", v.className = "color-picker-color-input", this.input = v;
|
|
3012
3018
|
const C = document.createElement("div");
|
|
3013
3019
|
C.className = "color-picker-input-container";
|
|
3014
|
-
const
|
|
3015
|
-
return
|
|
3020
|
+
const y = document.createElement("button");
|
|
3021
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(h.container), this.bind(e, a, r, v, u, y, n), t;
|
|
3016
3022
|
}
|
|
3017
|
-
bind(t, e, i, s, n,
|
|
3018
|
-
const l = (
|
|
3019
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3023
|
+
bind(t, e, i, s, n, o, a) {
|
|
3024
|
+
const l = (h) => {
|
|
3025
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (h.clientY - d.top) / d.height));
|
|
3020
3026
|
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
3021
|
-
const
|
|
3022
|
-
this.currentColor =
|
|
3023
|
-
}, r = (
|
|
3024
|
-
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3027
|
+
const f = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(f, u, 1 - g);
|
|
3028
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3029
|
+
}, r = (h) => {
|
|
3030
|
+
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3025
3031
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
3026
|
-
const g = u * 360,
|
|
3027
|
-
this.currentColor =
|
|
3032
|
+
const g = u * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), f = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(g, m, 1 - f);
|
|
3033
|
+
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3028
3034
|
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3029
|
-
}, p = (
|
|
3030
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
3035
|
+
}, p = (h) => {
|
|
3036
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (h.clientX - d.left) / d.width));
|
|
3031
3037
|
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), this.queueChange();
|
|
3032
3038
|
};
|
|
3033
|
-
t.addEventListener("mousedown", (
|
|
3034
|
-
|
|
3039
|
+
t.addEventListener("mousedown", (h) => {
|
|
3040
|
+
h.preventDefault(), this.isDragging = !0, l(h);
|
|
3035
3041
|
const d = (g) => l(g), u = () => {
|
|
3036
3042
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3037
3043
|
};
|
|
3038
3044
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3039
|
-
}), e.addEventListener("mousedown", (
|
|
3040
|
-
|
|
3045
|
+
}), e.addEventListener("mousedown", (h) => {
|
|
3046
|
+
h.preventDefault(), this.isDragging = !0, r(h);
|
|
3041
3047
|
const d = (g) => r(g), u = () => {
|
|
3042
3048
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3043
3049
|
};
|
|
3044
3050
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3045
|
-
}), i.addEventListener("mousedown", (
|
|
3046
|
-
|
|
3051
|
+
}), i.addEventListener("mousedown", (h) => {
|
|
3052
|
+
h.preventDefault(), this.isDragging = !0, p(h);
|
|
3047
3053
|
const d = (g) => p(g), u = () => {
|
|
3048
3054
|
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3049
3055
|
};
|
|
@@ -3054,21 +3060,21 @@ class Qt {
|
|
|
3054
3060
|
this.applyFromInput();
|
|
3055
3061
|
}), s.addEventListener("blur", () => {
|
|
3056
3062
|
this.syncInput();
|
|
3057
|
-
}), s.addEventListener("keydown", (
|
|
3058
|
-
|
|
3059
|
-
}),
|
|
3063
|
+
}), s.addEventListener("keydown", (h) => {
|
|
3064
|
+
h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
|
|
3065
|
+
}), o.addEventListener("click", async () => {
|
|
3060
3066
|
try {
|
|
3061
3067
|
await navigator.clipboard.writeText(s.value);
|
|
3062
3068
|
} catch {
|
|
3063
3069
|
s.select(), document.execCommand("copy");
|
|
3064
3070
|
}
|
|
3065
|
-
}),
|
|
3071
|
+
}), a.addEventListener("click", async () => {
|
|
3066
3072
|
if (!("EyeDropper" in window)) {
|
|
3067
3073
|
alert("EyeDropper API is not supported in this browser.");
|
|
3068
3074
|
return;
|
|
3069
3075
|
}
|
|
3070
3076
|
try {
|
|
3071
|
-
const
|
|
3077
|
+
const h = new window.EyeDropper(), { sRGBHex: d } = await h.open();
|
|
3072
3078
|
this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3073
3079
|
} catch {
|
|
3074
3080
|
}
|
|
@@ -3076,22 +3082,22 @@ class Qt {
|
|
|
3076
3082
|
}
|
|
3077
3083
|
setColor(t) {
|
|
3078
3084
|
this.currentColor = t;
|
|
3079
|
-
const { h: e, s: i, v: s } =
|
|
3085
|
+
const { h: e, s: i, v: s } = R(t), n = e >= 360 ? e % 360 : e;
|
|
3080
3086
|
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3081
3087
|
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3082
3088
|
}
|
|
3083
3089
|
syncInput() {
|
|
3084
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
3090
|
+
const t = this.select.value, { h: e, s: i, v: s } = R(this.currentColor);
|
|
3085
3091
|
if (t === "hex")
|
|
3086
3092
|
this.input.value = this.currentColor;
|
|
3087
3093
|
else if (t === "rgb") {
|
|
3088
|
-
const { r: n, g:
|
|
3089
|
-
this.input.value = `rgb(${n}, ${
|
|
3094
|
+
const { r: n, g: o, b: a } = V(this.currentColor);
|
|
3095
|
+
this.input.value = `rgb(${n}, ${o}, ${a})`;
|
|
3090
3096
|
} else {
|
|
3091
|
-
const { hue: n, sat:
|
|
3097
|
+
const { hue: n, sat: o, lightness: a } = gt(e, i, s);
|
|
3092
3098
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3093
|
-
|
|
3094
|
-
)}%, ${Math.round(
|
|
3099
|
+
o * 100
|
|
3100
|
+
)}%, ${Math.round(a * 100)}%)`;
|
|
3095
3101
|
}
|
|
3096
3102
|
}
|
|
3097
3103
|
applyFromInput() {
|
|
@@ -3102,20 +3108,20 @@ class Qt {
|
|
|
3102
3108
|
else {
|
|
3103
3109
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3104
3110
|
if (i) {
|
|
3105
|
-
const s = parseInt(i[1], 10), n = parseInt(i[2], 10),
|
|
3106
|
-
s <= 255 && n <= 255 &&
|
|
3111
|
+
const s = parseInt(i[1], 10), n = parseInt(i[2], 10), o = parseInt(i[3], 10);
|
|
3112
|
+
s <= 255 && n <= 255 && o <= 255 && (e = "#" + [s, n, o].map((a) => a.toString(16).padStart(2, "0")).join(""));
|
|
3107
3113
|
} else {
|
|
3108
3114
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3109
3115
|
if (s) {
|
|
3110
|
-
const n = parseInt(s[1], 10),
|
|
3111
|
-
e =
|
|
3116
|
+
const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
|
|
3117
|
+
e = U(n, r, l);
|
|
3112
3118
|
}
|
|
3113
3119
|
}
|
|
3114
3120
|
}
|
|
3115
3121
|
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3116
3122
|
}
|
|
3117
3123
|
updateOpacityBg() {
|
|
3118
|
-
const { r: t, g: e, b: i } =
|
|
3124
|
+
const { r: t, g: e, b: i } = V(this.currentColor);
|
|
3119
3125
|
this.opacitySlider.style.setProperty(
|
|
3120
3126
|
"--base-color",
|
|
3121
3127
|
`rgb(${t}, ${e}, ${i})`
|
|
@@ -3135,11 +3141,11 @@ class Qt {
|
|
|
3135
3141
|
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
3136
3142
|
}
|
|
3137
3143
|
initFromColor(t, e) {
|
|
3138
|
-
var
|
|
3144
|
+
var a;
|
|
3139
3145
|
this.currentColor = t, this.currentOpacity = e;
|
|
3140
|
-
const { h: i, s, v: n } =
|
|
3141
|
-
this.hueMarker.style.left = `${
|
|
3142
|
-
linear-gradient(to right, #fff, hsl(${
|
|
3146
|
+
const { h: i, s, v: n } = R(t), o = i >= 360 ? i % 360 : i;
|
|
3147
|
+
this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3148
|
+
linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (a = this.recentSectionRefresh) == null || a.call(this);
|
|
3143
3149
|
}
|
|
3144
3150
|
commitRecentColor() {
|
|
3145
3151
|
var t;
|
|
@@ -3156,7 +3162,7 @@ class Qt {
|
|
|
3156
3162
|
this.initFromColor(t, e);
|
|
3157
3163
|
}
|
|
3158
3164
|
}
|
|
3159
|
-
const
|
|
3165
|
+
const H = class H extends x {
|
|
3160
3166
|
constructor(t = {}) {
|
|
3161
3167
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3162
3168
|
super({
|
|
@@ -3167,17 +3173,17 @@ const P = class P extends x {
|
|
|
3167
3173
|
type: "text",
|
|
3168
3174
|
angle: "number",
|
|
3169
3175
|
stops: "text"
|
|
3170
|
-
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
3176
|
+
}, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
|
|
3171
3177
|
var d;
|
|
3172
3178
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3173
|
-
const s = i.target, n = this.popoverEl.contains(s),
|
|
3179
|
+
const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((u) => u.contains(s)), r = s.closest(
|
|
3174
3180
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3175
3181
|
), p = s.classList.contains(
|
|
3176
3182
|
"color-picker-backdrop"
|
|
3177
|
-
),
|
|
3183
|
+
), h = s.classList.contains(
|
|
3178
3184
|
"gradient-popover-backdrop"
|
|
3179
3185
|
);
|
|
3180
|
-
!n && !
|
|
3186
|
+
!n && !o && !l && !r && !p && !h && this.closePopover();
|
|
3181
3187
|
}, this.handlePopoverKeydown = (i) => {
|
|
3182
3188
|
if (this.isPopoverOpen) {
|
|
3183
3189
|
if (i.key === "Escape") {
|
|
@@ -3191,7 +3197,7 @@ const P = class P extends x {
|
|
|
3191
3197
|
i.preventDefault(), this.closePopover();
|
|
3192
3198
|
}
|
|
3193
3199
|
}
|
|
3194
|
-
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3200
|
+
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue(), this.setLinkedGlobalVariableFrom(this.originalDefault ?? this.value);
|
|
3195
3201
|
}
|
|
3196
3202
|
resolveGlobalVarColor(t) {
|
|
3197
3203
|
if (t.startsWith("var(--")) {
|
|
@@ -3200,33 +3206,46 @@ const P = class P extends x {
|
|
|
3200
3206
|
}
|
|
3201
3207
|
return t;
|
|
3202
3208
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
if (!e.startsWith("var(--"))
|
|
3208
|
-
return;
|
|
3209
|
-
const i = this.resolveGlobalVarColor(e);
|
|
3210
|
-
if (i === e) {
|
|
3211
|
-
console.warn(`Could not resolve global variable: ${e}`);
|
|
3209
|
+
setLinkedGlobalVariableFrom(t) {
|
|
3210
|
+
var i, s;
|
|
3211
|
+
if (!t) {
|
|
3212
|
+
this.linkedGlobalVariable = null;
|
|
3212
3213
|
return;
|
|
3213
3214
|
}
|
|
3214
|
-
|
|
3215
|
+
const e = typeof t == "string" ? t : ((s = (i = t.stops) == null ? void 0 : i[0]) == null ? void 0 : s.color) ?? null;
|
|
3216
|
+
this.linkedGlobalVariable = e && e.startsWith("var(--") ? e : null;
|
|
3217
|
+
}
|
|
3218
|
+
isBoundToGlobal() {
|
|
3219
|
+
return !!this.linkedGlobalVariable;
|
|
3220
|
+
}
|
|
3221
|
+
clearGlobalBindingForCustomChange() {
|
|
3222
|
+
var t, e;
|
|
3223
|
+
this.isBoundToGlobal() && ((e = (t = this.value) == null ? void 0 : t.stops) != null && e.length && (this.value.stops = this.value.stops.map((i) => ({
|
|
3224
|
+
...i,
|
|
3225
|
+
color: this.resolveGlobalVarColor(i.color)
|
|
3226
|
+
}))), this.linkedGlobalVariable = null, this.updateUnlinkButtonVisibility());
|
|
3227
|
+
}
|
|
3228
|
+
breakGlobalBinding() {
|
|
3229
|
+
var t;
|
|
3230
|
+
!this.isBoundToGlobal() || !this.value || ((t = this.value.stops) != null && t.length && (this.value.stops = this.value.stops.map((e) => ({
|
|
3231
|
+
...e,
|
|
3232
|
+
color: this.resolveGlobalVarColor(e.color)
|
|
3233
|
+
}))), this.linkedGlobalVariable = null, this.updateUI(), this.triggerChange(), this.isPopoverOpen && this.refreshPopoverContent());
|
|
3215
3234
|
}
|
|
3216
3235
|
defaultValue() {
|
|
3217
3236
|
const t = this.originalDefault;
|
|
3218
3237
|
if (typeof t == "string") {
|
|
3219
3238
|
if (t.startsWith("var(--"))
|
|
3220
|
-
return
|
|
3239
|
+
return $({
|
|
3221
3240
|
type: "solid",
|
|
3222
3241
|
angle: 0,
|
|
3223
3242
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3224
3243
|
});
|
|
3225
|
-
const i =
|
|
3244
|
+
const i = N(t);
|
|
3226
3245
|
if (i)
|
|
3227
|
-
return
|
|
3246
|
+
return $(i);
|
|
3228
3247
|
}
|
|
3229
|
-
return
|
|
3248
|
+
return $(t && typeof t == "object" ? t : {
|
|
3230
3249
|
type: "linear",
|
|
3231
3250
|
angle: 90,
|
|
3232
3251
|
stops: [
|
|
@@ -3236,24 +3255,29 @@ const P = class P extends x {
|
|
|
3236
3255
|
});
|
|
3237
3256
|
}
|
|
3238
3257
|
setValue(t) {
|
|
3239
|
-
var i, s;
|
|
3240
3258
|
let e = null;
|
|
3241
|
-
typeof t == "string" ? t.startsWith("var(--") ? e =
|
|
3259
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = $({
|
|
3242
3260
|
type: "solid",
|
|
3243
3261
|
angle: 0,
|
|
3244
3262
|
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3245
|
-
}) : e =
|
|
3263
|
+
}) : e = N(t) : t && typeof t == "object" && (e = $(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
|
|
3246
3264
|
}
|
|
3247
3265
|
updateUI() {
|
|
3248
3266
|
if (this.previewEl && this.value)
|
|
3249
3267
|
if (this.value.type === "solid") {
|
|
3250
3268
|
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3251
|
-
this.previewEl.style.background =
|
|
3269
|
+
this.previewEl.style.background = st(i, e);
|
|
3252
3270
|
} else {
|
|
3253
3271
|
const t = this.resolveGradientGlobalVars(this.value);
|
|
3254
|
-
this.previewEl.style.background =
|
|
3272
|
+
this.previewEl.style.background = O(t);
|
|
3255
3273
|
}
|
|
3256
|
-
this.inputEl && this.value && !this.isEditing
|
|
3274
|
+
if (this.inputEl && this.value && !this.isEditing)
|
|
3275
|
+
if (this.isBoundToGlobal() && this.linkedGlobalVariable) {
|
|
3276
|
+
const e = this.linkedGlobalVariable.replace("var(--", "").replace(")", "").split("-").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
|
|
3277
|
+
this.inputEl.value = `Linked: ${e}`;
|
|
3278
|
+
} else
|
|
3279
|
+
this.inputEl.value = Z(this.value);
|
|
3280
|
+
this.updateUnlinkButtonVisibility();
|
|
3257
3281
|
}
|
|
3258
3282
|
resolveGradientGlobalVars(t) {
|
|
3259
3283
|
return {
|
|
@@ -3265,12 +3289,12 @@ const P = class P extends x {
|
|
|
3265
3289
|
};
|
|
3266
3290
|
}
|
|
3267
3291
|
updateUnlinkButtonVisibility() {
|
|
3268
|
-
if (!this.unlinkButton
|
|
3269
|
-
this.
|
|
3292
|
+
if (!this.unlinkButton) return;
|
|
3293
|
+
this.isBoundToGlobal() ? this.unlinkButton.classList.add("visible") : this.unlinkButton.classList.remove("visible");
|
|
3270
3294
|
}
|
|
3271
3295
|
cssForTextValue() {
|
|
3272
3296
|
return this.value ? {
|
|
3273
|
-
background:
|
|
3297
|
+
background: O(this.value),
|
|
3274
3298
|
"-webkit-background-clip": "text",
|
|
3275
3299
|
"background-clip": "text",
|
|
3276
3300
|
color: "transparent",
|
|
@@ -3286,9 +3310,9 @@ const P = class P extends x {
|
|
|
3286
3310
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3287
3311
|
}
|
|
3288
3312
|
const e = document.createElement("div");
|
|
3289
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3313
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? O(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
3290
3314
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3291
|
-
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ?
|
|
3315
|
+
}), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? Z(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3292
3316
|
if (this.isEditing = !0, this.value)
|
|
3293
3317
|
if (this.value.type === "solid") {
|
|
3294
3318
|
const i = this.value.stops[0];
|
|
@@ -3297,60 +3321,57 @@ const P = class P extends x {
|
|
|
3297
3321
|
if (n === 100)
|
|
3298
3322
|
this.inputEl.value = s;
|
|
3299
3323
|
else {
|
|
3300
|
-
const
|
|
3301
|
-
this.inputEl.value = `${s}${
|
|
3324
|
+
const a = Math.round(n / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3325
|
+
this.inputEl.value = `${s}${a}`;
|
|
3302
3326
|
}
|
|
3303
3327
|
}
|
|
3304
3328
|
} else
|
|
3305
|
-
this.inputEl.value =
|
|
3329
|
+
this.inputEl.value = O(this.value);
|
|
3306
3330
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3307
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3331
|
+
this.isEditing = !1, this.value && (this.inputEl.value = Z(this.value));
|
|
3308
3332
|
}), this.inputEl.addEventListener(
|
|
3309
3333
|
"paste",
|
|
3310
3334
|
(i) => this.handlePaste(i)
|
|
3311
3335
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3312
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3313
|
-
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML =
|
|
3336
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = O(this.value)), this.inputEl.blur());
|
|
3337
|
+
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = ee, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
3314
3338
|
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3315
3339
|
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3316
3340
|
}
|
|
3317
3341
|
createPopover() {
|
|
3318
|
-
var l, r, p;
|
|
3319
3342
|
if (this.popoverEl) return;
|
|
3320
|
-
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (
|
|
3321
|
-
|
|
3322
|
-
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (c) => {
|
|
3323
|
-
c.stopPropagation();
|
|
3343
|
+
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.style.pointerEvents = "none", this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (l) => {
|
|
3344
|
+
l.stopPropagation();
|
|
3324
3345
|
});
|
|
3325
3346
|
const t = document.createElement("div");
|
|
3326
3347
|
t.className = "gradient-popover-header", t.style.cursor = "move";
|
|
3327
3348
|
let e = null;
|
|
3328
3349
|
if (this.variant !== "global") {
|
|
3329
3350
|
e = document.createElement("div"), e.className = "color-setting-tabs header-tabs";
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3332
|
-
const
|
|
3333
|
-
|
|
3351
|
+
const l = document.createElement("button");
|
|
3352
|
+
l.className = "color-tab active", l.textContent = "Custom";
|
|
3353
|
+
const r = document.createElement("button");
|
|
3354
|
+
r.className = "color-tab", r.textContent = "Global", e.appendChild(l), e.appendChild(r), t.appendChild(e);
|
|
3334
3355
|
} else {
|
|
3335
|
-
const
|
|
3336
|
-
t.appendChild(
|
|
3356
|
+
const l = document.createElement("div");
|
|
3357
|
+
t.appendChild(l);
|
|
3337
3358
|
}
|
|
3338
3359
|
const i = document.createElement("button");
|
|
3339
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3340
|
-
this.popoverPosition = { left:
|
|
3360
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = vt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), ut(t, this.popoverEl, (l, r) => {
|
|
3361
|
+
this.popoverPosition = { left: l, top: r };
|
|
3341
3362
|
});
|
|
3342
3363
|
const s = document.createElement("div");
|
|
3343
3364
|
s.className = "gradient-editor";
|
|
3344
3365
|
const n = document.createElement("div");
|
|
3345
3366
|
n.className = "type-tabs-wrapper";
|
|
3346
|
-
const
|
|
3347
|
-
n.appendChild(
|
|
3348
|
-
const
|
|
3349
|
-
if (
|
|
3350
|
-
const
|
|
3351
|
-
this.currentMode =
|
|
3367
|
+
const o = this.createTypeTabs();
|
|
3368
|
+
n.appendChild(o), s.appendChild(n);
|
|
3369
|
+
const a = document.createElement("div");
|
|
3370
|
+
if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
|
|
3371
|
+
const l = e.children[0], r = e.children[1], p = (h) => {
|
|
3372
|
+
this.currentMode = h, h === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
|
|
3352
3373
|
};
|
|
3353
|
-
|
|
3374
|
+
l.addEventListener("click", () => p("custom")), r.addEventListener("click", () => p("global")), this.isBoundToGlobal() ? (this.currentMode = "global", p("global")) : (this.currentMode = "custom", p("custom"));
|
|
3354
3375
|
}
|
|
3355
3376
|
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3356
3377
|
}
|
|
@@ -3359,25 +3380,26 @@ const P = class P extends x {
|
|
|
3359
3380
|
const t = document.createElement("div");
|
|
3360
3381
|
t.className = "gradient-type-tabs";
|
|
3361
3382
|
const e = document.createElement("button");
|
|
3362
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML =
|
|
3383
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = Qt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
|
|
3363
3384
|
const i = document.createElement("button");
|
|
3364
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML =
|
|
3365
|
-
var
|
|
3366
|
-
const
|
|
3367
|
-
this.switchType(
|
|
3385
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = te, i.style.minWidth = "32px", i.addEventListener("click", () => {
|
|
3386
|
+
var a, l;
|
|
3387
|
+
const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3388
|
+
this.switchType(o);
|
|
3368
3389
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3369
3390
|
}
|
|
3370
3391
|
switchType(t) {
|
|
3371
|
-
var
|
|
3392
|
+
var n;
|
|
3372
3393
|
if (!this.value) return;
|
|
3373
|
-
|
|
3394
|
+
const e = this.isBoundToGlobal(), i = this.linkedGlobalVariable;
|
|
3395
|
+
if (this.value.type = t, t !== "solid" && (this.pendingSolidColor = null), t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3374
3396
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3375
3397
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3376
3398
|
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3377
|
-
const
|
|
3378
|
-
if (
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3399
|
+
const a = this.value.stops[0].color;
|
|
3400
|
+
if (a.startsWith("var(--")) {
|
|
3401
|
+
const l = this.resolveGlobalVarColor(a), r = N(l);
|
|
3402
|
+
r && r.type !== "solid" && r.stops.length >= 2 ? (this.value.stops = r.stops, this.value.angle = r.angle, this.value.type = r.type) : (this.value.stops.push({
|
|
3381
3403
|
color: "#786666",
|
|
3382
3404
|
position: 100,
|
|
3383
3405
|
opacity: 100
|
|
@@ -3388,15 +3410,22 @@ const P = class P extends x {
|
|
|
3388
3410
|
position: 100,
|
|
3389
3411
|
opacity: 100
|
|
3390
3412
|
}), this.value.angle = 90;
|
|
3391
|
-
} else t !== "solid" && this.value.stops.length >= 2
|
|
3413
|
+
} else if (t !== "solid" && this.value.stops.length >= 2)
|
|
3414
|
+
this.value.angle || (this.value.angle = 90);
|
|
3415
|
+
else if (t === "solid" && e && i) {
|
|
3416
|
+
const o = this.value.stops && this.value.stops[0] ? this.value.stops[0].opacity ?? 100 : 100;
|
|
3417
|
+
this.value.stops = [
|
|
3418
|
+
{ color: i, position: 0, opacity: o }
|
|
3419
|
+
], this.value.angle = 0;
|
|
3420
|
+
}
|
|
3392
3421
|
if (this.popoverEl) {
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3395
|
-
const
|
|
3396
|
-
t === "solid" ?
|
|
3422
|
+
const o = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3423
|
+
o.forEach((r) => r.classList.remove("active"));
|
|
3424
|
+
const a = o[0], l = o[1];
|
|
3425
|
+
t === "solid" ? a == null || a.classList.add("active") : l == null || l.classList.add("active");
|
|
3397
3426
|
}
|
|
3398
|
-
const
|
|
3399
|
-
|
|
3427
|
+
const s = (n = this.popoverEl) == null ? void 0 : n.querySelector(".gradient-editor-content");
|
|
3428
|
+
s && this.updatePopoverContent(s), this.updateUI(), this.triggerChange();
|
|
3400
3429
|
}
|
|
3401
3430
|
updatePopoverContent(t) {
|
|
3402
3431
|
if (t.innerHTML = "", !!this.value) {
|
|
@@ -3409,17 +3438,17 @@ const P = class P extends x {
|
|
|
3409
3438
|
}
|
|
3410
3439
|
renderGlobalColors(t) {
|
|
3411
3440
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3412
|
-
const e = this.value.stops[0], i = (
|
|
3413
|
-
|
|
3441
|
+
const e = this.value.stops[0], i = (h) => {
|
|
3442
|
+
h.innerHTML = "";
|
|
3414
3443
|
let d = {};
|
|
3415
3444
|
try {
|
|
3416
3445
|
d = x.GlobalVariables || {};
|
|
3417
|
-
} catch (
|
|
3418
|
-
console.warn("Could not access Setting.GlobalVariables",
|
|
3446
|
+
} catch (f) {
|
|
3447
|
+
console.warn("Could not access Setting.GlobalVariables", f);
|
|
3419
3448
|
}
|
|
3420
3449
|
if (!d || Object.keys(d).length === 0) {
|
|
3421
|
-
const
|
|
3422
|
-
|
|
3450
|
+
const f = document.createElement("div");
|
|
3451
|
+
f.textContent = "No global colors defined", f.style.fontSize = "12px", f.style.color = "#666", f.style.padding = "8px", h.appendChild(f);
|
|
3423
3452
|
return;
|
|
3424
3453
|
}
|
|
3425
3454
|
const u = [
|
|
@@ -3432,32 +3461,32 @@ const P = class P extends x {
|
|
|
3432
3461
|
keys: ["text-dark", "text-light"]
|
|
3433
3462
|
}
|
|
3434
3463
|
], g = this.globalSearchQuery.toLowerCase();
|
|
3435
|
-
let
|
|
3436
|
-
this.globalLayoutMode === "list" ? (
|
|
3437
|
-
const
|
|
3438
|
-
|
|
3464
|
+
let m;
|
|
3465
|
+
this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), u.forEach((f) => {
|
|
3466
|
+
const v = Object.entries(d).filter(([C]) => !f.keys.includes(C) && f.title !== "Global Colors" ? !1 : f.keys.includes(C) && C.toLowerCase().includes(g));
|
|
3467
|
+
v.length !== 0 && v.forEach(([C, y]) => {
|
|
3439
3468
|
if (this.globalLayoutMode === "list") {
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3444
|
-
const
|
|
3445
|
-
|
|
3446
|
-
const
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
const
|
|
3450
|
-
this.setValue(
|
|
3451
|
-
}),
|
|
3469
|
+
const w = document.createElement("div");
|
|
3470
|
+
w.className = "global-color-row";
|
|
3471
|
+
const k = document.createElement("div");
|
|
3472
|
+
k.className = "global-color-circle";
|
|
3473
|
+
const S = this.resolveGlobalVarColor(y);
|
|
3474
|
+
k.style.background = S, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && k.classList.add("selected");
|
|
3475
|
+
const E = document.createElement("span");
|
|
3476
|
+
E.className = "global-color-label", E.textContent = C.split("-").map((M) => M.charAt(0).toUpperCase() + M.slice(1)).join(" "), w.appendChild(k), w.appendChild(E), w.addEventListener("click", (M) => {
|
|
3477
|
+
M.preventDefault();
|
|
3478
|
+
const B = `var(--${C})`;
|
|
3479
|
+
this.setValue(B), this.pendingSolidColor = B, i(h);
|
|
3480
|
+
}), m.appendChild(w);
|
|
3452
3481
|
} else {
|
|
3453
|
-
const
|
|
3454
|
-
|
|
3455
|
-
const
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
const
|
|
3459
|
-
this.setValue(
|
|
3460
|
-
}),
|
|
3482
|
+
const w = document.createElement("div");
|
|
3483
|
+
w.className = "global-color-circle";
|
|
3484
|
+
const k = this.resolveGlobalVarColor(y);
|
|
3485
|
+
w.style.background = k, w.title = C.split("-").map((b) => b.charAt(0).toUpperCase() + b.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && w.classList.add("selected"), w.addEventListener("click", (b) => {
|
|
3486
|
+
b.preventDefault();
|
|
3487
|
+
const E = `var(--${C})`;
|
|
3488
|
+
this.setValue(E), this.pendingSolidColor = E, i(h);
|
|
3489
|
+
}), m.appendChild(w);
|
|
3461
3490
|
}
|
|
3462
3491
|
});
|
|
3463
3492
|
});
|
|
@@ -3465,14 +3494,14 @@ const P = class P extends x {
|
|
|
3465
3494
|
s.className = "global-controls-row";
|
|
3466
3495
|
const n = document.createElement("div");
|
|
3467
3496
|
n.className = "global-search-container";
|
|
3468
|
-
const
|
|
3469
|
-
|
|
3470
|
-
const
|
|
3471
|
-
|
|
3497
|
+
const o = document.createElement("span");
|
|
3498
|
+
o.className = "global-search-icon", o.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>';
|
|
3499
|
+
const a = document.createElement("input");
|
|
3500
|
+
a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
|
|
3472
3501
|
const l = document.createElement("div");
|
|
3473
|
-
|
|
3474
|
-
this.globalSearchQuery =
|
|
3475
|
-
}), n.appendChild(
|
|
3502
|
+
a.addEventListener("input", (h) => {
|
|
3503
|
+
this.globalSearchQuery = h.target.value, i(l);
|
|
3504
|
+
}), n.appendChild(o), n.appendChild(a);
|
|
3476
3505
|
const r = document.createElement("button");
|
|
3477
3506
|
r.className = "global-layout-toggle", r.type = "button";
|
|
3478
3507
|
const p = () => {
|
|
@@ -3484,14 +3513,14 @@ const P = class P extends x {
|
|
|
3484
3513
|
}
|
|
3485
3514
|
renderSolid(t) {
|
|
3486
3515
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3487
|
-
const e = this.value.stops[0], i = new
|
|
3516
|
+
const e = this.value.stops[0], i = new ie({
|
|
3488
3517
|
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3489
3518
|
initialOpacity: e.opacity ?? 100,
|
|
3490
3519
|
onColorChange: (s, n) => {
|
|
3491
|
-
if (this.value) {
|
|
3492
|
-
const
|
|
3493
|
-
if (
|
|
3494
|
-
this.value =
|
|
3520
|
+
if (this.clearGlobalBindingForCustomChange(), this.value) {
|
|
3521
|
+
const o = N(s);
|
|
3522
|
+
if (o && o.type !== "solid") {
|
|
3523
|
+
this.value = o, this.switchType(o.type);
|
|
3495
3524
|
return;
|
|
3496
3525
|
}
|
|
3497
3526
|
this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s;
|
|
@@ -3502,57 +3531,57 @@ const P = class P extends x {
|
|
|
3502
3531
|
}
|
|
3503
3532
|
renderGradient(t) {
|
|
3504
3533
|
this.solidPicker = null;
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
d
|
|
3534
|
+
let e = null;
|
|
3535
|
+
{
|
|
3536
|
+
const p = document.createElement("div");
|
|
3537
|
+
p.className = "gradient-subtype-inline";
|
|
3538
|
+
const h = document.createElement("select");
|
|
3539
|
+
h.className = "gradient-subtype-select";
|
|
3540
|
+
const d = document.createElement("option");
|
|
3541
|
+
d.value = "linear", d.textContent = "Linear";
|
|
3512
3542
|
const u = document.createElement("option");
|
|
3513
|
-
u.value = "
|
|
3514
|
-
const g = document.createElement("
|
|
3515
|
-
g.
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
this.switchType(d.value === "radial" ? "radial" : "linear"), i && this.updateDegreeVisibility(i);
|
|
3519
|
-
}), i.addEventListener("focus", (m) => {
|
|
3543
|
+
u.value = "radial", u.textContent = "Radial", h.appendChild(d), h.appendChild(u), h.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
|
|
3544
|
+
const g = document.createElement("button");
|
|
3545
|
+
g.type = "button", g.className = "gradient-flip-btn", g.innerHTML = Kt, h.addEventListener("change", () => {
|
|
3546
|
+
this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear"), e && this.updateDegreeVisibility(e);
|
|
3547
|
+
}), e.addEventListener("focus", (m) => {
|
|
3520
3548
|
const f = m.target;
|
|
3521
3549
|
f.value = f.value.replace(/[^0-9-]/g, ""), setTimeout(() => f.select(), 0);
|
|
3522
|
-
}),
|
|
3550
|
+
}), e.addEventListener("input", (m) => {
|
|
3551
|
+
this.clearGlobalBindingForCustomChange();
|
|
3523
3552
|
const f = parseInt(m.target.value);
|
|
3524
3553
|
!Number.isNaN(f) && this.value && (this.value.angle = Math.max(0, Math.min(360, f)), this.debouncedPreviewUpdate());
|
|
3525
|
-
}),
|
|
3526
|
-
var
|
|
3554
|
+
}), e.addEventListener("blur", (m) => {
|
|
3555
|
+
var C;
|
|
3527
3556
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3528
3557
|
const f = m.target;
|
|
3529
|
-
let
|
|
3530
|
-
Number.isNaN(
|
|
3531
|
-
}),
|
|
3532
|
-
!this.value || !this.value.stops
|
|
3558
|
+
let v = parseInt(f.value);
|
|
3559
|
+
Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), f.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3560
|
+
}), g.addEventListener("click", () => {
|
|
3561
|
+
this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
|
|
3533
3562
|
m.position = 100 - m.position;
|
|
3534
|
-
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(
|
|
3535
|
-
}),
|
|
3563
|
+
}), this.value.stops.sort((m, f) => m.position - f.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
|
|
3564
|
+
}), p.appendChild(h), p.appendChild(e), p.appendChild(g), t.appendChild(p), this.updateDegreeVisibility(e);
|
|
3536
3565
|
}
|
|
3566
|
+
const i = document.createElement("div");
|
|
3567
|
+
i.className = "gradient-preview", this.updateGradientPreview(i);
|
|
3537
3568
|
const s = document.createElement("div");
|
|
3538
|
-
s.className = "gradient-
|
|
3569
|
+
s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i);
|
|
3539
3570
|
const n = document.createElement("div");
|
|
3540
|
-
n.className = "gradient-
|
|
3541
|
-
const a = document.createElement("div");
|
|
3542
|
-
a.className = "gradient-stops-header";
|
|
3571
|
+
n.className = "gradient-stops-header";
|
|
3543
3572
|
const o = document.createElement("span");
|
|
3544
3573
|
o.textContent = "Stops";
|
|
3545
|
-
const
|
|
3546
|
-
|
|
3547
|
-
const
|
|
3548
|
-
|
|
3549
|
-
const
|
|
3550
|
-
const
|
|
3551
|
-
|
|
3574
|
+
const a = document.createElement("button");
|
|
3575
|
+
a.type = "button", a.className = "gradient-add-stop", a.textContent = "+", n.appendChild(o), n.appendChild(a);
|
|
3576
|
+
const l = document.createElement("div");
|
|
3577
|
+
l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
|
|
3578
|
+
const r = ot((p) => {
|
|
3579
|
+
const h = N(p);
|
|
3580
|
+
h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type), this.updateUI(), this.triggerChange());
|
|
3552
3581
|
}, "all");
|
|
3553
|
-
this.recentGradientRefresh =
|
|
3554
|
-
var
|
|
3555
|
-
this.addStop(), this.updateStopsList(
|
|
3582
|
+
this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
|
|
3583
|
+
var p;
|
|
3584
|
+
this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((p = document.activeElement) == null ? void 0 : p.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3556
3585
|
});
|
|
3557
3586
|
}
|
|
3558
3587
|
updateDegreeVisibility(t) {
|
|
@@ -3562,7 +3591,15 @@ const P = class P extends x {
|
|
|
3562
3591
|
updateGradientPreview(t) {
|
|
3563
3592
|
var i;
|
|
3564
3593
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3565
|
-
|
|
3594
|
+
if (e && this.value)
|
|
3595
|
+
if (this.value.type === "solid")
|
|
3596
|
+
e.style.background = O(this.value);
|
|
3597
|
+
else {
|
|
3598
|
+
const s = this.value.stops.map(
|
|
3599
|
+
(n) => `${st(n.color, n.opacity ?? 100)} ${n.position}%`
|
|
3600
|
+
).join(", ");
|
|
3601
|
+
e.style.background = `linear-gradient(90deg, ${s})`;
|
|
3602
|
+
}
|
|
3566
3603
|
}
|
|
3567
3604
|
debouncedPreviewUpdate(t) {
|
|
3568
3605
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3573,151 +3610,176 @@ const P = class P extends x {
|
|
|
3573
3610
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3574
3611
|
const n = document.createElement("div");
|
|
3575
3612
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3576
|
-
const
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
},
|
|
3587
|
-
|
|
3613
|
+
const o = document.createElement("div");
|
|
3614
|
+
o.className = "gstop-chip";
|
|
3615
|
+
const a = this.resolveGlobalVarColor(i.color);
|
|
3616
|
+
o.style.backgroundColor = a, n.appendChild(o);
|
|
3617
|
+
const l = new dt((f, v) => {
|
|
3618
|
+
this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = f, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = f, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
|
|
3619
|
+
}, "solid");
|
|
3620
|
+
let r = !1, p = !1, h = 0, d = 0;
|
|
3621
|
+
const u = (f) => {
|
|
3622
|
+
r = !0, p = !1, h = f.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", g), document.addEventListener("mouseup", m), f.preventDefault(), f.stopPropagation();
|
|
3623
|
+
}, g = (f) => {
|
|
3624
|
+
if (!r || !this.value) return;
|
|
3625
|
+
const v = f.clientX - h;
|
|
3626
|
+
if (Math.abs(v) > 3 && (p = !0), p) {
|
|
3627
|
+
this.clearGlobalBindingForCustomChange();
|
|
3628
|
+
const C = e.getBoundingClientRect();
|
|
3629
|
+
let y = d + v / C.width * 100;
|
|
3630
|
+
y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
|
|
3631
|
+
}
|
|
3632
|
+
}, m = (f) => {
|
|
3633
|
+
var v;
|
|
3634
|
+
if (r)
|
|
3635
|
+
if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), p)
|
|
3636
|
+
this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
|
|
3637
|
+
else {
|
|
3638
|
+
f.stopPropagation();
|
|
3639
|
+
const C = (v = this.value) == null ? void 0 : v.stops[s];
|
|
3640
|
+
C && setTimeout(() => {
|
|
3641
|
+
const y = this.resolveGlobalVarColor(C.color);
|
|
3642
|
+
l.open(y, o, C.opacity ?? 100);
|
|
3643
|
+
}, 0);
|
|
3644
|
+
}
|
|
3588
3645
|
};
|
|
3589
|
-
n.addEventListener("mousedown",
|
|
3646
|
+
n.addEventListener("mousedown", u), t.appendChild(n);
|
|
3590
3647
|
});
|
|
3591
3648
|
}
|
|
3592
3649
|
updateStopsList(t) {
|
|
3593
3650
|
var i;
|
|
3594
3651
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3595
3652
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3596
|
-
var
|
|
3597
|
-
const a = document.createElement("div");
|
|
3598
|
-
a.className = "gstop-row";
|
|
3653
|
+
var k, S;
|
|
3599
3654
|
const o = document.createElement("div");
|
|
3600
|
-
o.className = "gstop-
|
|
3655
|
+
o.className = "gstop-row";
|
|
3656
|
+
const a = document.createElement("div");
|
|
3657
|
+
a.className = "gstop-position-group";
|
|
3601
3658
|
const l = document.createElement("input");
|
|
3602
|
-
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px",
|
|
3659
|
+
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
|
|
3603
3660
|
const r = document.createElement("div");
|
|
3604
3661
|
r.className = "gstop-color-container";
|
|
3605
|
-
const p = document.createElement("div");
|
|
3606
|
-
|
|
3607
|
-
const
|
|
3608
|
-
|
|
3609
|
-
const d = document.createElement("button");
|
|
3610
|
-
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(p), r.appendChild(c), r.appendChild(d);
|
|
3662
|
+
const p = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
|
|
3663
|
+
h.className = "gstop-color-preview", h.style.backgroundColor = p;
|
|
3664
|
+
const d = document.createElement("input");
|
|
3665
|
+
d.type = "text", d.className = "gstop-color-input", d.value = p.replace("#", "").toUpperCase();
|
|
3611
3666
|
const u = document.createElement("button");
|
|
3612
|
-
u.type = "button", u.className = "gstop-
|
|
3613
|
-
const g = document.createElement("
|
|
3614
|
-
g.className = "gstop-
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3619
|
-
const
|
|
3620
|
-
|
|
3667
|
+
u.type = "button", u.className = "gstop-color-copy", u.textContent = "Copy", r.appendChild(h), r.appendChild(d), r.appendChild(u);
|
|
3668
|
+
const g = document.createElement("button");
|
|
3669
|
+
g.type = "button", g.className = "gstop-del", g.innerHTML = Yt, g.disabled = (((S = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : S.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(g), e.appendChild(o);
|
|
3670
|
+
const m = document.createElement("span");
|
|
3671
|
+
m.className = "gstop-opacity-label", m.textContent = "Opacity";
|
|
3672
|
+
const f = document.createElement("div");
|
|
3673
|
+
f.className = "gstop-opacity-group";
|
|
3674
|
+
const v = document.createElement("input");
|
|
3675
|
+
v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
|
|
3676
|
+
const C = V(p);
|
|
3677
|
+
v.style.setProperty(
|
|
3621
3678
|
"--slider-color",
|
|
3622
|
-
`rgb(${
|
|
3679
|
+
`rgb(${C.r}, ${C.g}, ${C.b})`
|
|
3623
3680
|
);
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3626
|
-
const w = new
|
|
3627
|
-
|
|
3628
|
-
const
|
|
3629
|
-
|
|
3681
|
+
const y = document.createElement("span");
|
|
3682
|
+
y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, f.appendChild(v), f.appendChild(y);
|
|
3683
|
+
const w = new dt((b, E) => {
|
|
3684
|
+
this.clearGlobalBindingForCustomChange(), d.value = b.replace("#", "").toUpperCase(), h.style.backgroundColor = b, this.value.stops[n].color = b, E !== void 0 && (this.value.stops[n].opacity = E, v.value = String(E), y.textContent = `${E}%`);
|
|
3685
|
+
const M = V(b);
|
|
3686
|
+
v.style.setProperty(
|
|
3630
3687
|
"--slider-color",
|
|
3631
|
-
`rgb(${
|
|
3688
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3632
3689
|
), this.updateGradientPreview(), this.createHandles(
|
|
3633
3690
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3634
3691
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3635
3692
|
), this.updateUI(), this.triggerChange();
|
|
3636
3693
|
}, "solid");
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3694
|
+
d.addEventListener("click", (b) => {
|
|
3695
|
+
b.preventDefault(), b.stopPropagation();
|
|
3696
|
+
const E = this.resolveGlobalVarColor(s.color);
|
|
3697
|
+
w.open(E, d, s.opacity ?? 100);
|
|
3698
|
+
}), d.addEventListener("input", () => {
|
|
3699
|
+
this.clearGlobalBindingForCustomChange();
|
|
3700
|
+
const b = d.value.trim(), E = b.startsWith("#") ? b : `#${b}`;
|
|
3701
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
|
|
3702
|
+
this.value.stops[n].color = E, h.style.backgroundColor = E;
|
|
3703
|
+
const M = V(E);
|
|
3704
|
+
v.style.setProperty(
|
|
3645
3705
|
"--slider-color",
|
|
3646
|
-
`rgb(${
|
|
3706
|
+
`rgb(${M.r}, ${M.g}, ${M.b})`
|
|
3647
3707
|
), this.debouncedPreviewUpdate();
|
|
3648
3708
|
}
|
|
3649
|
-
}),
|
|
3709
|
+
}), d.addEventListener("blur", () => {
|
|
3650
3710
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3651
|
-
}),
|
|
3652
|
-
|
|
3711
|
+
}), u.addEventListener("click", async (b) => {
|
|
3712
|
+
b.stopPropagation();
|
|
3653
3713
|
try {
|
|
3654
|
-
await navigator.clipboard.writeText(`#${
|
|
3714
|
+
await navigator.clipboard.writeText(`#${d.value}`);
|
|
3655
3715
|
} catch {
|
|
3656
3716
|
}
|
|
3657
|
-
}), l.addEventListener("focus", (
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3660
|
-
}), l.addEventListener("input", (
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3717
|
+
}), l.addEventListener("focus", (b) => {
|
|
3718
|
+
const E = b.target;
|
|
3719
|
+
E.value = E.value.replace("%", ""), E.select();
|
|
3720
|
+
}), l.addEventListener("input", (b) => {
|
|
3721
|
+
this.clearGlobalBindingForCustomChange();
|
|
3722
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3723
|
+
if (!Number.isNaN(M)) {
|
|
3724
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3725
|
+
this.value.stops[n].position = B, E.value = `${B}%`, this.debouncedPreviewUpdate();
|
|
3665
3726
|
}
|
|
3666
|
-
}), l.addEventListener("blur", (
|
|
3727
|
+
}), l.addEventListener("blur", (b) => {
|
|
3667
3728
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3668
|
-
const
|
|
3669
|
-
if (Number.isNaN(
|
|
3670
|
-
|
|
3729
|
+
const E = b.target, M = parseInt(E.value.replace(/[^\d]/g, ""), 10);
|
|
3730
|
+
if (Number.isNaN(M))
|
|
3731
|
+
E.value = `${this.value.stops[n].position}%`;
|
|
3671
3732
|
else {
|
|
3672
|
-
const
|
|
3673
|
-
this.value.stops[n].position =
|
|
3733
|
+
const B = Math.max(0, Math.min(100, M));
|
|
3734
|
+
this.value.stops[n].position = B, E.value = `${B}%`;
|
|
3674
3735
|
}
|
|
3675
3736
|
this.updateGradientPreview(), this.createHandles(
|
|
3676
3737
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3677
3738
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3678
3739
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3679
|
-
}),
|
|
3680
|
-
var
|
|
3681
|
-
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(n, 1), this.createHandles(
|
|
3740
|
+
}), g.addEventListener("click", () => {
|
|
3741
|
+
var b;
|
|
3742
|
+
(this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
|
|
3682
3743
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3683
3744
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3684
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
3685
|
-
}),
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3745
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((b = document.activeElement) == null ? void 0 : b.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3746
|
+
}), v.addEventListener("input", () => {
|
|
3747
|
+
this.clearGlobalBindingForCustomChange();
|
|
3748
|
+
const b = parseInt(v.value, 10);
|
|
3749
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, b)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3750
|
+
}), v.addEventListener("change", () => {
|
|
3751
|
+
this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3690
3752
|
});
|
|
3691
3753
|
}));
|
|
3692
3754
|
}
|
|
3693
3755
|
addStop() {
|
|
3694
3756
|
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3695
|
-
const t = this.value.stops.map((
|
|
3757
|
+
const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
|
|
3696
3758
|
let e = 50, i = 0;
|
|
3697
|
-
for (let
|
|
3698
|
-
const
|
|
3699
|
-
|
|
3759
|
+
for (let o = 0; o < t.length - 1; o++) {
|
|
3760
|
+
const a = t[o + 1] - t[o];
|
|
3761
|
+
a > i && (i = a, e = t[o] + a / 2);
|
|
3700
3762
|
}
|
|
3701
3763
|
const s = this.value.stops.reduce(
|
|
3702
|
-
(
|
|
3764
|
+
(o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o
|
|
3703
3765
|
), n = {
|
|
3704
3766
|
position: Math.round(e),
|
|
3705
3767
|
color: s.color,
|
|
3706
3768
|
opacity: s.opacity ?? 100
|
|
3707
3769
|
};
|
|
3708
|
-
this.value.stops.push(n), this.value.stops.sort((
|
|
3770
|
+
this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
|
|
3709
3771
|
}
|
|
3710
3772
|
openPopover() {
|
|
3711
|
-
if (this.popoverEl && (
|
|
3712
|
-
if (this.isPopoverOpen = !0,
|
|
3773
|
+
if (this.popoverEl && (H.openInstance && H.openInstance !== this && H.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3774
|
+
if (this.isPopoverOpen = !0, H.openInstance = this, this.backdropEl && (this.backdropEl.style.display = "block", this.backdropEl.parentElement || document.body.appendChild(this.backdropEl)), this.popoverEl.style.display = "flex", this.refreshPopoverContent(), this.element) {
|
|
3713
3775
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3714
3776
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3715
|
-
const
|
|
3716
|
-
let
|
|
3717
|
-
const r = i - t.right, p = t.left,
|
|
3718
|
-
r <
|
|
3777
|
+
const o = this.popoverEl.offsetHeight;
|
|
3778
|
+
let a = t.right + 8, l = t.top;
|
|
3779
|
+
const r = i - t.right, p = t.left, h = e + n;
|
|
3780
|
+
r < h && p > r + 100 && (a = t.left - e - 8);
|
|
3719
3781
|
const d = s - t.bottom, u = t.top;
|
|
3720
|
-
u >=
|
|
3782
|
+
u >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : u > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
|
|
3721
3783
|
}
|
|
3722
3784
|
setTimeout(
|
|
3723
3785
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3734,24 +3796,24 @@ const P = class P extends x {
|
|
|
3734
3796
|
}
|
|
3735
3797
|
requestAnimationFrame(() => {
|
|
3736
3798
|
if (!this.popoverEl || !this.element) return;
|
|
3737
|
-
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight,
|
|
3799
|
+
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight, o = 16;
|
|
3738
3800
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3739
|
-
const
|
|
3801
|
+
const a = this.popoverEl.offsetHeight;
|
|
3740
3802
|
let l = e.right + 8, r = e.top;
|
|
3741
|
-
const p = s - e.right,
|
|
3742
|
-
p < d &&
|
|
3803
|
+
const p = s - e.right, h = e.left, d = i + o;
|
|
3804
|
+
p < d && h > p + 100 && (l = e.left - i - 8);
|
|
3743
3805
|
const u = n - e.bottom, g = e.top;
|
|
3744
|
-
g >=
|
|
3806
|
+
g >= a + o ? r = e.top - a - 8 : u >= a + o ? r = e.bottom + 8 : g > u ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3745
3807
|
});
|
|
3746
3808
|
}
|
|
3747
3809
|
}
|
|
3748
3810
|
refreshPopoverContent() {
|
|
3749
|
-
var n,
|
|
3811
|
+
var n, o;
|
|
3750
3812
|
if (!this.popoverEl) return;
|
|
3751
3813
|
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3752
|
-
t.forEach((
|
|
3814
|
+
t.forEach((a) => a.classList.remove("active"));
|
|
3753
3815
|
const e = t[0], i = t[1];
|
|
3754
|
-
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (
|
|
3816
|
+
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (o = this.recentGradientRefresh) == null || o.call(this)), this.popoverEl.offsetHeight;
|
|
3755
3817
|
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3756
3818
|
s && this.updatePopoverContent(s);
|
|
3757
3819
|
}
|
|
@@ -3759,10 +3821,10 @@ const P = class P extends x {
|
|
|
3759
3821
|
var t;
|
|
3760
3822
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3761
3823
|
if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
|
|
3762
|
-
const e =
|
|
3824
|
+
const e = O(this.value);
|
|
3763
3825
|
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3764
3826
|
}
|
|
3765
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3827
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), H.openInstance === this && (H.openInstance = null);
|
|
3766
3828
|
}
|
|
3767
3829
|
}
|
|
3768
3830
|
commitPendingSolidColor() {
|
|
@@ -3779,21 +3841,31 @@ const P = class P extends x {
|
|
|
3779
3841
|
this.parseAndSet(e.value);
|
|
3780
3842
|
}
|
|
3781
3843
|
parseAndSet(t) {
|
|
3782
|
-
const e =
|
|
3844
|
+
const e = N(t.trim());
|
|
3783
3845
|
e && this.setValue(e);
|
|
3784
3846
|
}
|
|
3847
|
+
getChangePayload() {
|
|
3848
|
+
var t;
|
|
3849
|
+
if (this.value)
|
|
3850
|
+
return this.isBoundToGlobal() ? ((t = this.value.stops) == null ? void 0 : t.some(
|
|
3851
|
+
(i) => i.opacity !== void 0 && i.opacity !== 100
|
|
3852
|
+
)) ? this.resolveGradientGlobalVars(this.value) : this.linkedGlobalVariable || void 0 : this.value;
|
|
3853
|
+
}
|
|
3785
3854
|
triggerChange() {
|
|
3786
|
-
var
|
|
3787
|
-
|
|
3855
|
+
var e, i;
|
|
3856
|
+
const t = this.getChangePayload();
|
|
3857
|
+
t !== void 0 && ((e = this.onChange) == null || e.call(this, t), (i = this.detectChange) == null || i.call(this, t));
|
|
3788
3858
|
}
|
|
3789
3859
|
getElement() {
|
|
3790
3860
|
return this.element;
|
|
3791
3861
|
}
|
|
3792
3862
|
getValue() {
|
|
3793
|
-
|
|
3863
|
+
const t = this.getChangePayload();
|
|
3864
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3794
3865
|
}
|
|
3795
3866
|
getCSSValue() {
|
|
3796
|
-
|
|
3867
|
+
const t = this.getChangePayload();
|
|
3868
|
+
return t ? typeof t == "string" ? t : O(t) : "";
|
|
3797
3869
|
}
|
|
3798
3870
|
getCSSForText() {
|
|
3799
3871
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3802,36 +3874,36 @@ const P = class P extends x {
|
|
|
3802
3874
|
return this.value;
|
|
3803
3875
|
}
|
|
3804
3876
|
};
|
|
3805
|
-
|
|
3806
|
-
let
|
|
3807
|
-
const
|
|
3877
|
+
H.openInstance = null;
|
|
3878
|
+
let K = H;
|
|
3879
|
+
const se = `
|
|
3808
3880
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3809
3881
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3810
3882
|
</svg>
|
|
3811
|
-
`,
|
|
3883
|
+
`, ne = `
|
|
3812
3884
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3813
3885
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3814
3886
|
</svg>
|
|
3815
3887
|
`;
|
|
3816
|
-
class
|
|
3888
|
+
class Le extends T {
|
|
3817
3889
|
constructor(t) {
|
|
3818
3890
|
super({
|
|
3819
3891
|
title: "Border",
|
|
3820
3892
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3821
3893
|
settings: {
|
|
3822
|
-
size: new
|
|
3894
|
+
size: new P({
|
|
3823
3895
|
title: "Size",
|
|
3824
|
-
icon:
|
|
3896
|
+
icon: ne,
|
|
3825
3897
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3826
3898
|
suffix: "px"
|
|
3827
3899
|
}),
|
|
3828
|
-
color: new
|
|
3900
|
+
color: new K({
|
|
3829
3901
|
title: "Border Color",
|
|
3830
3902
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3831
3903
|
}),
|
|
3832
|
-
radius: new
|
|
3904
|
+
radius: new P({
|
|
3833
3905
|
title: "Radius",
|
|
3834
|
-
icon:
|
|
3906
|
+
icon: se,
|
|
3835
3907
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3836
3908
|
suffix: "px"
|
|
3837
3909
|
})
|
|
@@ -3855,20 +3927,20 @@ class xe extends H {
|
|
|
3855
3927
|
`;
|
|
3856
3928
|
}
|
|
3857
3929
|
}
|
|
3858
|
-
const
|
|
3930
|
+
const oe = `
|
|
3859
3931
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3860
3932
|
<path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3861
3933
|
</svg>
|
|
3862
|
-
`,
|
|
3934
|
+
`, ae = `
|
|
3863
3935
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3864
3936
|
<path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3865
3937
|
</svg>
|
|
3866
|
-
`,
|
|
3938
|
+
`, le = `
|
|
3867
3939
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3868
3940
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3869
3941
|
</svg>
|
|
3870
3942
|
`;
|
|
3871
|
-
class
|
|
3943
|
+
class ke extends T {
|
|
3872
3944
|
constructor(t = {}) {
|
|
3873
3945
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3874
3946
|
super({
|
|
@@ -3876,13 +3948,13 @@ class Le extends H {
|
|
|
3876
3948
|
collapsed: i.collapsed,
|
|
3877
3949
|
settings: (() => {
|
|
3878
3950
|
const s = {
|
|
3879
|
-
color: new
|
|
3951
|
+
color: new K({
|
|
3880
3952
|
title: "Color",
|
|
3881
3953
|
default: i.colorDefault ?? "#001E1E"
|
|
3882
3954
|
}),
|
|
3883
|
-
fontFamily: new
|
|
3955
|
+
fontFamily: new et({
|
|
3884
3956
|
title: "Font",
|
|
3885
|
-
icon:
|
|
3957
|
+
icon: oe,
|
|
3886
3958
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3887
3959
|
options: i.fontFamilyOptions ?? [
|
|
3888
3960
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3893,9 +3965,9 @@ class Le extends H {
|
|
|
3893
3965
|
getOptions: i.fontFamilyGetOptions,
|
|
3894
3966
|
getOptionsAsync: i.fontFamilyGetOptionsAsync
|
|
3895
3967
|
}),
|
|
3896
|
-
fontWeight: new
|
|
3968
|
+
fontWeight: new et({
|
|
3897
3969
|
title: "Weight",
|
|
3898
|
-
icon:
|
|
3970
|
+
icon: ae,
|
|
3899
3971
|
default: i.fontWeightDefault ?? "400",
|
|
3900
3972
|
options: i.fontWeightOptions ?? [
|
|
3901
3973
|
{ name: "Regular", value: "400" },
|
|
@@ -3905,9 +3977,9 @@ class Le extends H {
|
|
|
3905
3977
|
getOptions: i.fontWeightGetOptions,
|
|
3906
3978
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3907
3979
|
}),
|
|
3908
|
-
fontSize: new
|
|
3980
|
+
fontSize: new P({
|
|
3909
3981
|
title: "Size",
|
|
3910
|
-
icon:
|
|
3982
|
+
icon: le,
|
|
3911
3983
|
default: i.fontSizeDefault ?? 12,
|
|
3912
3984
|
suffix: "px",
|
|
3913
3985
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3915,7 +3987,7 @@ class Le extends H {
|
|
|
3915
3987
|
};
|
|
3916
3988
|
return e ? {
|
|
3917
3989
|
...s,
|
|
3918
|
-
align: new
|
|
3990
|
+
align: new Pt({
|
|
3919
3991
|
title: "Align",
|
|
3920
3992
|
default: i.alignDefault ?? "center"
|
|
3921
3993
|
})
|
|
@@ -3924,8 +3996,8 @@ class Le extends H {
|
|
|
3924
3996
|
});
|
|
3925
3997
|
}
|
|
3926
3998
|
getCssCode() {
|
|
3927
|
-
var
|
|
3928
|
-
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((
|
|
3999
|
+
var o;
|
|
4000
|
+
const t = this.settings.color.getValue() ?? "#000000", e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((o = this.settings.align) == null ? void 0 : o.value) ?? "left";
|
|
3929
4001
|
return `
|
|
3930
4002
|
color: ${t};
|
|
3931
4003
|
font-family: ${e};
|
|
@@ -3935,8 +4007,8 @@ class Le extends H {
|
|
|
3935
4007
|
`;
|
|
3936
4008
|
}
|
|
3937
4009
|
getTextGradientCss() {
|
|
3938
|
-
var
|
|
3939
|
-
const t = this.settings.color.getCSSForText(), e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((
|
|
4010
|
+
var a;
|
|
4011
|
+
const t = this.settings.color.getCSSForText(), e = this.settings.fontFamily.value ?? "Satoshi", i = this.settings.fontWeight.value ?? "bold", s = this.settings.fontSize.value ?? 12, n = ((a = this.settings.align) == null ? void 0 : a.value) ?? "left";
|
|
3940
4012
|
return `
|
|
3941
4013
|
${Object.entries(t).map(([l, r]) => `${l}: ${r};`).join(`
|
|
3942
4014
|
`)}
|
|
@@ -3947,7 +4019,7 @@ class Le extends H {
|
|
|
3947
4019
|
`;
|
|
3948
4020
|
}
|
|
3949
4021
|
}
|
|
3950
|
-
class
|
|
4022
|
+
class q extends x {
|
|
3951
4023
|
constructor(t) {
|
|
3952
4024
|
super({
|
|
3953
4025
|
...t,
|
|
@@ -3955,11 +4027,11 @@ class j extends x {
|
|
|
3955
4027
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
3956
4028
|
}
|
|
3957
4029
|
draw() {
|
|
3958
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
3959
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
4030
|
+
const t = this.value === "auto" ? "text" : "number", e = (a) => {
|
|
4031
|
+
this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
|
|
3960
4032
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3961
|
-
let p = Number(
|
|
3962
|
-
p < l && (p = l), p > r && (p = r),
|
|
4033
|
+
let p = Number(a.value);
|
|
4034
|
+
p < l && (p = l), p > r && (p = r), a.value = String(p);
|
|
3963
4035
|
}));
|
|
3964
4036
|
}, i = this.createInput({
|
|
3965
4037
|
value: this.value,
|
|
@@ -3980,9 +4052,9 @@ class j extends x {
|
|
|
3980
4052
|
s && (s.style.paddingRight = "35px");
|
|
3981
4053
|
const n = document.createElement("span");
|
|
3982
4054
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
3983
|
-
const
|
|
3984
|
-
return
|
|
3985
|
-
const l =
|
|
4055
|
+
const o = i.querySelector("input");
|
|
4056
|
+
return o && (o.oninput = (a) => {
|
|
4057
|
+
const l = a.target.value.trim();
|
|
3986
4058
|
if (l.toLowerCase() === "auto")
|
|
3987
4059
|
this.value = "auto";
|
|
3988
4060
|
else {
|
|
@@ -3993,33 +4065,33 @@ class j extends x {
|
|
|
3993
4065
|
}), i;
|
|
3994
4066
|
}
|
|
3995
4067
|
}
|
|
3996
|
-
class
|
|
4068
|
+
class Me extends T {
|
|
3997
4069
|
constructor(t) {
|
|
3998
4070
|
super({
|
|
3999
4071
|
title: "Margins",
|
|
4000
4072
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4001
4073
|
settings: {
|
|
4002
|
-
marginTop: new
|
|
4074
|
+
marginTop: new q({
|
|
4003
4075
|
title: "Top",
|
|
4004
|
-
icon:
|
|
4076
|
+
icon: re,
|
|
4005
4077
|
suffix: "px",
|
|
4006
4078
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
4007
4079
|
}),
|
|
4008
|
-
marginRight: new
|
|
4080
|
+
marginRight: new q({
|
|
4009
4081
|
title: "Right",
|
|
4010
|
-
icon:
|
|
4082
|
+
icon: ce,
|
|
4011
4083
|
suffix: "px",
|
|
4012
4084
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
4013
4085
|
}),
|
|
4014
|
-
marginBottom: new
|
|
4086
|
+
marginBottom: new q({
|
|
4015
4087
|
title: "Bottom",
|
|
4016
|
-
icon:
|
|
4088
|
+
icon: he,
|
|
4017
4089
|
suffix: "px",
|
|
4018
4090
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
4019
4091
|
}),
|
|
4020
|
-
marginLeft: new
|
|
4092
|
+
marginLeft: new q({
|
|
4021
4093
|
title: "Left",
|
|
4022
|
-
icon:
|
|
4094
|
+
icon: de,
|
|
4023
4095
|
suffix: "px",
|
|
4024
4096
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
4025
4097
|
})
|
|
@@ -4036,29 +4108,29 @@ class ke extends H {
|
|
|
4036
4108
|
`;
|
|
4037
4109
|
}
|
|
4038
4110
|
}
|
|
4039
|
-
const
|
|
4111
|
+
const re = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4040
4112
|
<path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4041
|
-
</svg>`,
|
|
4113
|
+
</svg>`, ce = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4042
4114
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4043
|
-
</svg>`,
|
|
4115
|
+
</svg>`, he = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4044
4116
|
<path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4045
|
-
</svg>`,
|
|
4117
|
+
</svg>`, de = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
4046
4118
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4047
4119
|
</svg>`;
|
|
4048
|
-
class
|
|
4120
|
+
class Se extends T {
|
|
4049
4121
|
constructor(t) {
|
|
4050
4122
|
super({
|
|
4051
4123
|
title: "Background Image",
|
|
4052
4124
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
4053
4125
|
settings: {
|
|
4054
|
-
backgroundImage: new
|
|
4126
|
+
backgroundImage: new nt({
|
|
4055
4127
|
...t == null ? void 0 : t.uploadProps,
|
|
4056
4128
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
4057
4129
|
}),
|
|
4058
|
-
opacity: new
|
|
4130
|
+
opacity: new It({
|
|
4059
4131
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
4060
4132
|
}),
|
|
4061
|
-
backgroundColor: new
|
|
4133
|
+
backgroundColor: new F({
|
|
4062
4134
|
default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
|
|
4063
4135
|
})
|
|
4064
4136
|
}
|
|
@@ -4067,10 +4139,10 @@ class Me extends H {
|
|
|
4067
4139
|
draw() {
|
|
4068
4140
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
4069
4141
|
if (!e) return t;
|
|
4070
|
-
const i = Array.from(e.children), [s, n,
|
|
4142
|
+
const i = Array.from(e.children), [s, n, o] = i;
|
|
4071
4143
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
4072
|
-
const
|
|
4073
|
-
return
|
|
4144
|
+
const a = document.createElement("div");
|
|
4145
|
+
return a.className = "bgset-or-label", a.textContent = "OR", e.appendChild(a), e.appendChild(o), t;
|
|
4074
4146
|
}
|
|
4075
4147
|
getCssCode() {
|
|
4076
4148
|
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
@@ -4084,41 +4156,64 @@ class Me extends H {
|
|
|
4084
4156
|
`;
|
|
4085
4157
|
}
|
|
4086
4158
|
}
|
|
4159
|
+
class Ne extends T {
|
|
4160
|
+
constructor(t) {
|
|
4161
|
+
super({
|
|
4162
|
+
title: (t == null ? void 0 : t.title) ?? "Image",
|
|
4163
|
+
collapsed: t == null ? void 0 : t.collapsed,
|
|
4164
|
+
settings: {
|
|
4165
|
+
image: new nt({
|
|
4166
|
+
...t == null ? void 0 : t.uploadProps,
|
|
4167
|
+
default: (t == null ? void 0 : t.image) ?? ""
|
|
4168
|
+
}),
|
|
4169
|
+
width: new Ft({
|
|
4170
|
+
default: (t == null ? void 0 : t.width) ?? 1e3,
|
|
4171
|
+
mobile: t == null ? void 0 : t.widthMobile
|
|
4172
|
+
}),
|
|
4173
|
+
height: new Gt({
|
|
4174
|
+
default: (t == null ? void 0 : t.height) ?? 300,
|
|
4175
|
+
mobile: t == null ? void 0 : t.heightMobile
|
|
4176
|
+
})
|
|
4177
|
+
}
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4087
4181
|
export {
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
Ee as
|
|
4105
|
-
|
|
4106
|
-
|
|
4182
|
+
Pt as AlignSetting,
|
|
4183
|
+
xe as AnimationSetting,
|
|
4184
|
+
Se as BackgroundSettingSet,
|
|
4185
|
+
Le as BorderSettingSet,
|
|
4186
|
+
me as ButtonSetting,
|
|
4187
|
+
I as ColorSetting,
|
|
4188
|
+
F as ColorWithOpacitySetting,
|
|
4189
|
+
fe as DimensionSetting,
|
|
4190
|
+
ye as GapSetting,
|
|
4191
|
+
K as GradientSetting,
|
|
4192
|
+
ke as HeaderTypographySettingSet,
|
|
4193
|
+
Gt as HeightSetting,
|
|
4194
|
+
ge as HtmlSetting,
|
|
4195
|
+
Ne as ImageSettingSet,
|
|
4196
|
+
be as MarginBottomSetting,
|
|
4197
|
+
Me as MarginSettingGroup,
|
|
4198
|
+
Ee as MarginTopSetting,
|
|
4199
|
+
we as MultiLanguageSetting,
|
|
4200
|
+
P as NumberSetting,
|
|
4201
|
+
It as OpacitySetting,
|
|
4107
4202
|
ve as SelectApiSettings,
|
|
4108
|
-
|
|
4203
|
+
et as SelectSetting,
|
|
4109
4204
|
x as Setting,
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4205
|
+
T as SettingGroup,
|
|
4206
|
+
Mt as StringSetting,
|
|
4207
|
+
Lt as TabSettingGroup,
|
|
4208
|
+
Lt as TabsSettingGroup,
|
|
4209
|
+
Ce as Toggle,
|
|
4210
|
+
nt as UploadSetting,
|
|
4211
|
+
Ft as WidthSetting,
|
|
4212
|
+
ue as asSettingGroupWithSettings,
|
|
4213
|
+
kt as createSettingGroup,
|
|
4214
|
+
pe as createTabSettingGroup,
|
|
4120
4215
|
A as isSetting,
|
|
4121
|
-
|
|
4216
|
+
lt as isSettingChild,
|
|
4122
4217
|
L as isSettingGroup,
|
|
4123
|
-
|
|
4218
|
+
j as iterateSettings
|
|
4124
4219
|
};
|