builder-settings-types 0.0.306 → 0.0.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Font.svg +3 -3
- package/dist/Opacity.svg +7 -7
- package/dist/Typography-Size.svg +3 -3
- package/dist/URL.svg +3 -3
- package/dist/Upload.svg +4 -4
- package/dist/Weight.svg +3 -3
- package/dist/align-centre.svg +4 -4
- package/dist/align-left.svg +4 -4
- package/dist/align-right.svg +4 -4
- package/dist/base/settings.d.ts +2 -0
- package/dist/border-size.svg +3 -3
- package/dist/builder-settings-types.cjs.js +64 -77
- package/dist/builder-settings-types.es.js +1420 -1206
- package/dist/chevron-down.svg +5 -5
- package/dist/colors.svg +3 -3
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/margins-bottom.svg +3 -3
- package/dist/margins-left.svg +3 -3
- package/dist/margins-right.svg +3 -3
- package/dist/margins-top.svg +3 -3
- package/dist/radius.svg +3 -3
- package/dist/settings/gradient-settings/GradientSetting.d.ts +10 -0
- package/dist/settings/gradient-settings/components/EmbeddedColorPicker.d.ts +24 -28
- package/dist/settings/gradient-settings/utils/icon.d.ts +3 -0
- package/dist/settings/gradient-settings/utils/types.d.ts +1 -0
- package/dist/spacing-height.svg +3 -3
- package/dist/spacing-width.svg +3 -3
- 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 vt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2
|
+
let rt = (h = 21) => {
|
|
3
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
|
|
4
|
+
for (; h--; )
|
|
5
|
+
t += vt[e[h] & 63];
|
|
6
6
|
return t;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
let t = 0, e =
|
|
8
|
+
function Ct(h) {
|
|
9
|
+
let t = 0, e = h.parentElement;
|
|
10
10
|
for (; e; )
|
|
11
|
-
e.classList.contains("setting-group") && e !==
|
|
11
|
+
e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function q(
|
|
14
|
+
function q(h, t) {
|
|
15
15
|
const e = Math.min(Math.max(t, 0), 5);
|
|
16
|
-
|
|
16
|
+
h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
|
|
17
17
|
}
|
|
18
|
-
function Q(
|
|
19
|
-
|
|
18
|
+
function Q(h, t = 0) {
|
|
19
|
+
h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
|
|
20
20
|
const s = i, n = t + 1;
|
|
21
21
|
q(s, n), Q(s, n);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const yt = {
|
|
25
25
|
maxLevel: 5,
|
|
26
26
|
spacingMultiplier: 1,
|
|
27
27
|
visualIndentMultiplier: 2,
|
|
28
28
|
enableAutoDetection: !0
|
|
29
29
|
};
|
|
30
|
-
class
|
|
30
|
+
class bt {
|
|
31
31
|
constructor(t = {}) {
|
|
32
|
-
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...
|
|
32
|
+
this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...yt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Setup automatic detection using MutationObserver
|
|
@@ -63,7 +63,7 @@ class vt {
|
|
|
63
63
|
* Update nesting for a specific element
|
|
64
64
|
*/
|
|
65
65
|
updateElementNesting(t) {
|
|
66
|
-
const e =
|
|
66
|
+
const e = Ct(t);
|
|
67
67
|
this.applyNestingWithConfig(t, e);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -111,21 +111,21 @@ class vt {
|
|
|
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 st = new bt();
|
|
115
|
+
function Z(h) {
|
|
116
|
+
if (h === null || typeof h != "object") return h;
|
|
117
|
+
if (h instanceof Date) return new Date(h.getTime());
|
|
118
|
+
if (h instanceof Array) return h.map((t) => Z(t));
|
|
119
|
+
if (typeof h == "object") {
|
|
120
120
|
const t = {};
|
|
121
|
-
for (const e in
|
|
122
|
-
Object.prototype.hasOwnProperty.call(
|
|
121
|
+
for (const e in h)
|
|
122
|
+
Object.prototype.hasOwnProperty.call(h, e) && (t[e] = Z(h[e]));
|
|
123
123
|
return t;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return h;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
switch (
|
|
127
|
+
function Et(h) {
|
|
128
|
+
switch (h) {
|
|
129
129
|
case "number":
|
|
130
130
|
return 0;
|
|
131
131
|
case "text":
|
|
@@ -142,15 +142,18 @@ function Ct(c) {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
const B = class B {
|
|
146
146
|
constructor(t = {}) {
|
|
147
|
-
this.props = t, this.dataPropsPath = "", this.id = t.id ||
|
|
147
|
+
this.props = t, this.dataPropsPath = "", this.id = t.id || rt(), 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, B.DefaultUploadUrl = t;
|
|
151
151
|
}
|
|
152
152
|
static SetDefaultLanguage(t) {
|
|
153
|
-
globalThis.DefaultLanguage = t,
|
|
153
|
+
globalThis.DefaultLanguage = t, B.DefaultLanguage = t;
|
|
154
|
+
}
|
|
155
|
+
static SetGlobalVariables(t) {
|
|
156
|
+
B.GlobalVariables = { ...B.GlobalVariables, ...t };
|
|
154
157
|
}
|
|
155
158
|
destroy() {
|
|
156
159
|
throw new Error("Method not implemented.");
|
|
@@ -171,30 +174,30 @@ class w {
|
|
|
171
174
|
this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
|
|
172
175
|
}
|
|
173
176
|
clone() {
|
|
174
|
-
const t = this.constructor, e =
|
|
175
|
-
return i.value =
|
|
177
|
+
const t = this.constructor, e = Z(this.props), i = new t(e);
|
|
178
|
+
return i.value = Z(this.value), i;
|
|
176
179
|
}
|
|
177
180
|
createInput(t) {
|
|
178
181
|
t = { ...this.props.inputProps, ...t };
|
|
179
182
|
const e = document.createElement("div");
|
|
180
183
|
if (e.className = t.wrapperClassName || "", t.title || t.icon) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
184
|
+
const o = document.createElement("div");
|
|
185
|
+
if (o.className = "icon-container", t.icon) {
|
|
183
186
|
const l = this.createIcon(t.icon, t.iconClassName);
|
|
184
|
-
|
|
187
|
+
o.appendChild(l);
|
|
185
188
|
}
|
|
186
189
|
if (t.title) {
|
|
187
190
|
const l = this.createLabel(t.title, t.labelClassName);
|
|
188
|
-
|
|
191
|
+
o.appendChild(l);
|
|
189
192
|
}
|
|
190
|
-
e.appendChild(
|
|
193
|
+
e.appendChild(o);
|
|
191
194
|
}
|
|
192
195
|
const i = document.createElement("div");
|
|
193
196
|
i.className = t.wrapperClassName || "";
|
|
194
197
|
const s = document.createElement("input");
|
|
195
|
-
this.inputEl = s, s.value = String(t.value ||
|
|
196
|
-
const n = (
|
|
197
|
-
const l =
|
|
198
|
+
this.inputEl = s, s.value = String(t.value || Et(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
|
|
199
|
+
const n = (o) => {
|
|
200
|
+
const l = o.target;
|
|
198
201
|
let r = l.value;
|
|
199
202
|
switch (t.inputType) {
|
|
200
203
|
case "number":
|
|
@@ -219,10 +222,10 @@ class w {
|
|
|
219
222
|
r = l.value;
|
|
220
223
|
}
|
|
221
224
|
this.value = r, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
222
|
-
},
|
|
223
|
-
|
|
225
|
+
}, a = (o) => {
|
|
226
|
+
o.target, this.onBlur && this.onBlur(this.value);
|
|
224
227
|
};
|
|
225
|
-
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", a), t.inputCustomizer && t.inputCustomizer(s), i.appendChild(s), e.appendChild(i), e;
|
|
226
229
|
}
|
|
227
230
|
createLabel(t, e) {
|
|
228
231
|
const i = document.createElement("span");
|
|
@@ -232,32 +235,43 @@ class w {
|
|
|
232
235
|
const i = document.createElement("span");
|
|
233
236
|
return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
|
|
234
237
|
}
|
|
238
|
+
};
|
|
239
|
+
B.GlobalVariables = {
|
|
240
|
+
// Global Colors (each supports solid OR gradient)
|
|
241
|
+
primary: "#00141E",
|
|
242
|
+
secondary: "#00141E",
|
|
243
|
+
tertiary: "#00141E",
|
|
244
|
+
accent: "#00141E",
|
|
245
|
+
// Text Color
|
|
246
|
+
"text-dark": "#00141E",
|
|
247
|
+
"text-light": "#00141E"
|
|
248
|
+
};
|
|
249
|
+
let x = B;
|
|
250
|
+
function A(h) {
|
|
251
|
+
return h instanceof x;
|
|
235
252
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
238
|
-
}
|
|
239
|
-
function b(c) {
|
|
240
|
-
return c instanceof T;
|
|
253
|
+
function L(h) {
|
|
254
|
+
return h instanceof H;
|
|
241
255
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
256
|
+
function nt(h) {
|
|
257
|
+
return A(h) || L(h);
|
|
244
258
|
}
|
|
245
|
-
function
|
|
246
|
-
for (const e in
|
|
247
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
248
|
-
const i =
|
|
259
|
+
function z(h, t) {
|
|
260
|
+
for (const e in h)
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(h, e)) {
|
|
262
|
+
const i = h[e];
|
|
249
263
|
t(e, i);
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
266
|
const K = class K {
|
|
253
267
|
constructor(t) {
|
|
254
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 = () => {
|
|
255
|
-
}, 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 || rt(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
256
270
|
}
|
|
257
271
|
propagateNestingLevel() {
|
|
258
272
|
const t = this.nestingLevel + 1;
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
z(this.settings, (e, i) => {
|
|
274
|
+
L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
|
|
261
275
|
});
|
|
262
276
|
}
|
|
263
277
|
getNestingLevel() {
|
|
@@ -273,9 +287,9 @@ const K = class K {
|
|
|
273
287
|
this.dataPropsPath = t, this.propagateDataPropsPath();
|
|
274
288
|
}
|
|
275
289
|
propagateDataPropsPath() {
|
|
276
|
-
|
|
290
|
+
z(this.settings, (t, e) => {
|
|
277
291
|
const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
|
|
278
|
-
(
|
|
292
|
+
(L(e) || A(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
|
|
279
293
|
});
|
|
280
294
|
}
|
|
281
295
|
updateNestingStyles() {
|
|
@@ -284,7 +298,7 @@ const K = class K {
|
|
|
284
298
|
forceChildUIRefresh() {
|
|
285
299
|
Object.entries(this.settings).forEach(([t, e]) => {
|
|
286
300
|
try {
|
|
287
|
-
if (
|
|
301
|
+
if (L(e)) {
|
|
288
302
|
const i = e.getValues();
|
|
289
303
|
e.setValue(i);
|
|
290
304
|
} else if (typeof e.setValue == "function") {
|
|
@@ -307,21 +321,21 @@ const K = class K {
|
|
|
307
321
|
".setting-group-content"
|
|
308
322
|
);
|
|
309
323
|
if (n) {
|
|
310
|
-
const
|
|
324
|
+
const a = Array.from(
|
|
311
325
|
n.querySelectorAll(
|
|
312
326
|
".setting-group, .setting, [data-setting-id]"
|
|
313
327
|
)
|
|
314
328
|
);
|
|
315
|
-
for (const
|
|
316
|
-
const l =
|
|
329
|
+
for (const o of a) {
|
|
330
|
+
const l = o.id, r = o.getAttribute(
|
|
317
331
|
"data-setting-id"
|
|
318
332
|
);
|
|
319
333
|
if (l && "id" in e && typeof e.id == "string" && l.includes(e.id)) {
|
|
320
|
-
|
|
334
|
+
o.remove();
|
|
321
335
|
break;
|
|
322
336
|
}
|
|
323
337
|
if (r && "id" in e && typeof e.id == "string" && r === e.id) {
|
|
324
|
-
|
|
338
|
+
o.remove();
|
|
325
339
|
break;
|
|
326
340
|
}
|
|
327
341
|
}
|
|
@@ -335,37 +349,37 @@ const K = class K {
|
|
|
335
349
|
this.elementRef;
|
|
336
350
|
}
|
|
337
351
|
updateSettings(t) {
|
|
338
|
-
var
|
|
352
|
+
var a;
|
|
339
353
|
const e = new Set(Object.keys(this.settings)), i = Object.keys(t), s = {};
|
|
340
|
-
i.forEach((
|
|
341
|
-
const l = this.settings[
|
|
342
|
-
l && (
|
|
343
|
-
}), e.forEach((
|
|
344
|
-
i.includes(
|
|
345
|
-
}), i.forEach((
|
|
346
|
-
var
|
|
347
|
-
const l = t[
|
|
348
|
-
if (r !== l && (r && this.removeSetting(
|
|
349
|
-
const
|
|
354
|
+
i.forEach((o) => {
|
|
355
|
+
const l = this.settings[o];
|
|
356
|
+
l && (L(l) ? s[o] = l.getValues() : A(l) ? s[o] = l.value : typeof l.getValues == "function" ? s[o] = l.getValues() : l.value !== void 0 && (s[o] = l.value));
|
|
357
|
+
}), e.forEach((o) => {
|
|
358
|
+
i.includes(o) || this.removeSetting(o);
|
|
359
|
+
}), i.forEach((o) => {
|
|
360
|
+
var p;
|
|
361
|
+
const l = t[o], r = this.settings[o];
|
|
362
|
+
if (r !== l && (r && this.removeSetting(o), this.addSetting(o, l), o in s)) {
|
|
363
|
+
const c = s[o];
|
|
350
364
|
try {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
) :
|
|
365
|
+
L(l) ? l.setValue(
|
|
366
|
+
c
|
|
367
|
+
) : A(l) ? (p = l.setValue) == null || p.call(l, c) : l.setValue && l.setValue(c);
|
|
354
368
|
} catch (d) {
|
|
355
|
-
console.warn(`Could not preserve value for setting ${
|
|
369
|
+
console.warn(`Could not preserve value for setting ${o}:`, d);
|
|
356
370
|
}
|
|
357
371
|
}
|
|
358
372
|
}), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
|
|
359
373
|
const n = this.getValues();
|
|
360
|
-
this.initialValues = n, (
|
|
374
|
+
this.initialValues = n, (a = this.onChange) == null || a.call(this, n);
|
|
361
375
|
}
|
|
362
376
|
clone() {
|
|
363
377
|
const t = {};
|
|
364
|
-
|
|
365
|
-
const
|
|
366
|
-
typeof n.clone == "function" ? t[
|
|
367
|
-
`Setting with key '${
|
|
368
|
-
), t[
|
|
378
|
+
z(this.settings, (s, n) => {
|
|
379
|
+
const a = String(s);
|
|
380
|
+
typeof n.clone == "function" ? t[a] = n.clone() : (console.warn(
|
|
381
|
+
`Setting with key '${a}' does not have a clone method. Copying reference.`
|
|
382
|
+
), t[a] = n);
|
|
369
383
|
});
|
|
370
384
|
const e = {
|
|
371
385
|
title: this.title,
|
|
@@ -378,7 +392,7 @@ const K = class K {
|
|
|
378
392
|
deleteItem: this.deleteItemCfg,
|
|
379
393
|
dataProps: this.dataProps,
|
|
380
394
|
hide: this.hide
|
|
381
|
-
}, i =
|
|
395
|
+
}, i = xt(e);
|
|
382
396
|
return i.initialValues = this.getValues(), i;
|
|
383
397
|
}
|
|
384
398
|
resetDefault() {
|
|
@@ -388,7 +402,7 @@ const K = class K {
|
|
|
388
402
|
setMobileValues(t) {
|
|
389
403
|
!t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
|
|
390
404
|
const s = this.settings[e];
|
|
391
|
-
s && (
|
|
405
|
+
s && (L(s) || A(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
|
|
392
406
|
}), this.setValue(t), this.onChange && this.onChange(this.getValues()));
|
|
393
407
|
}
|
|
394
408
|
getMobileValues(t) {
|
|
@@ -397,7 +411,7 @@ const K = class K {
|
|
|
397
411
|
for (const i in this.settings)
|
|
398
412
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
399
413
|
const s = this.settings[i];
|
|
400
|
-
if (
|
|
414
|
+
if (L(s))
|
|
401
415
|
e[i] = s.getMobileValues();
|
|
402
416
|
else {
|
|
403
417
|
const n = s;
|
|
@@ -408,7 +422,7 @@ const K = class K {
|
|
|
408
422
|
} else {
|
|
409
423
|
const e = this.settings[t];
|
|
410
424
|
if (!e) return;
|
|
411
|
-
if (
|
|
425
|
+
if (L(e)) return e.getMobileValues();
|
|
412
426
|
const i = e;
|
|
413
427
|
return i.mobileValue !== void 0 ? i.mobileValue : i.value;
|
|
414
428
|
}
|
|
@@ -424,19 +438,19 @@ const K = class K {
|
|
|
424
438
|
Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
|
|
425
439
|
}, 50));
|
|
426
440
|
};
|
|
427
|
-
return this.changeHandlers.clear(),
|
|
441
|
+
return this.changeHandlers.clear(), z(this.settings, (i, s) => {
|
|
428
442
|
var n;
|
|
429
|
-
if (
|
|
443
|
+
if (L(s))
|
|
430
444
|
s.setOnChange(() => {
|
|
431
|
-
const
|
|
432
|
-
this.initialValues =
|
|
445
|
+
const a = this.getValues();
|
|
446
|
+
this.initialValues = a, t(a);
|
|
433
447
|
}), this.changeHandlers.add(() => t(this.getValues()));
|
|
434
|
-
else if (
|
|
435
|
-
const
|
|
436
|
-
this.changeHandlers.add(
|
|
448
|
+
else if (A(s)) {
|
|
449
|
+
const a = () => e();
|
|
450
|
+
this.changeHandlers.add(a), s.setOnChange(a);
|
|
437
451
|
} else {
|
|
438
|
-
const
|
|
439
|
-
this.changeHandlers.add(
|
|
452
|
+
const a = () => e();
|
|
453
|
+
this.changeHandlers.add(a), (n = s.setOnChange) == null || n.call(s, a);
|
|
440
454
|
}
|
|
441
455
|
}), this;
|
|
442
456
|
}
|
|
@@ -451,13 +465,13 @@ const K = class K {
|
|
|
451
465
|
Object.entries(t).forEach(([i, s]) => {
|
|
452
466
|
let n = this.settings[i];
|
|
453
467
|
if (!n && this.addItemCfg && i.startsWith(this.addItemCfg.keyPrefix)) {
|
|
454
|
-
const
|
|
455
|
-
if (Number.isFinite(
|
|
456
|
-
const l = this.addItemCfg.createItem(
|
|
457
|
-
|
|
468
|
+
const a = i.slice(this.addItemCfg.keyPrefix.length), o = Number(a);
|
|
469
|
+
if (Number.isFinite(o)) {
|
|
470
|
+
const l = this.addItemCfg.createItem(o);
|
|
471
|
+
nt(l) && (this.addSetting(i, l), n = l);
|
|
458
472
|
}
|
|
459
473
|
}
|
|
460
|
-
n && (
|
|
474
|
+
n && (L(n) || A(n)) && typeof n.setValue == "function" && n.setValue(s);
|
|
461
475
|
}), setTimeout(() => {
|
|
462
476
|
this.forceChildUIRefresh();
|
|
463
477
|
}, 0);
|
|
@@ -471,25 +485,25 @@ const K = class K {
|
|
|
471
485
|
const s = this.getValues();
|
|
472
486
|
this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
|
|
473
487
|
};
|
|
474
|
-
|
|
488
|
+
L(t) ? t.setOnChange(() => e()) : A(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
|
|
475
489
|
}
|
|
476
490
|
addSetting(t, e) {
|
|
477
491
|
var s, n;
|
|
478
492
|
if (this.settings[t] = e, this.wireChild(e), this.elementRef) {
|
|
479
|
-
const
|
|
493
|
+
const a = this.elementRef.querySelector(
|
|
480
494
|
".setting-group-content"
|
|
481
495
|
);
|
|
482
|
-
if (
|
|
483
|
-
|
|
484
|
-
const
|
|
496
|
+
if (a) {
|
|
497
|
+
L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
|
|
498
|
+
const o = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
|
|
485
499
|
if (l) {
|
|
486
|
-
const
|
|
487
|
-
|
|
500
|
+
const c = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
|
|
501
|
+
c && t.startsWith(c) && this.addDeleteButtonToElement(o, t);
|
|
488
502
|
}
|
|
489
|
-
const r =
|
|
490
|
-
r ?
|
|
491
|
-
const
|
|
492
|
-
|
|
503
|
+
const r = a.querySelector(".sg-add-button-bottom");
|
|
504
|
+
r ? a.insertBefore(o, r) : a.appendChild(o), st.trackElement(o), q(o, this.nestingLevel + 1), Q(o, this.nestingLevel + 1);
|
|
505
|
+
const p = o.style.display;
|
|
506
|
+
o.style.display = "none", o.offsetHeight, o.style.display = p, this.updateNestingStyles();
|
|
493
507
|
}
|
|
494
508
|
}
|
|
495
509
|
const i = this.getValues();
|
|
@@ -506,9 +520,9 @@ const K = class K {
|
|
|
506
520
|
const r = Array.from(
|
|
507
521
|
t.querySelectorAll(".setting-group-title")
|
|
508
522
|
);
|
|
509
|
-
for (const
|
|
510
|
-
if (
|
|
511
|
-
s =
|
|
523
|
+
for (const p of r)
|
|
524
|
+
if (p.closest(".setting-group") === t) {
|
|
525
|
+
s = p;
|
|
512
526
|
break;
|
|
513
527
|
}
|
|
514
528
|
s || (s = r[0] ?? null);
|
|
@@ -516,8 +530,8 @@ const K = class K {
|
|
|
516
530
|
if (!s) return;
|
|
517
531
|
const n = s.querySelector(".actions-section");
|
|
518
532
|
if (!n) return;
|
|
519
|
-
const
|
|
520
|
-
|
|
533
|
+
const a = document.createElement("button");
|
|
534
|
+
a.type = "button", a.className = "sg-delete-button", i ? i.deleteItemCfg : this.deleteItemCfg ?? this.addItemCfg, a.title = "Delete", a.style.cssText = `
|
|
521
535
|
background: none;
|
|
522
536
|
border: none;
|
|
523
537
|
cursor: pointer;
|
|
@@ -530,23 +544,23 @@ const K = class K {
|
|
|
530
544
|
border-radius: 4px;
|
|
531
545
|
transition: background-color 0.2s;
|
|
532
546
|
`;
|
|
533
|
-
const
|
|
547
|
+
const o = `
|
|
534
548
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
535
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"/>
|
|
536
550
|
<path d="M6.667 7.333v4M9.333 7.333v4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
537
551
|
</svg>
|
|
538
552
|
`;
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}),
|
|
542
|
-
|
|
543
|
-
}),
|
|
544
|
-
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((
|
|
545
|
-
|
|
553
|
+
a.innerHTML = o, a.addEventListener("mouseenter", () => {
|
|
554
|
+
a.style.backgroundColor = "#fef2f2";
|
|
555
|
+
}), a.addEventListener("mouseleave", () => {
|
|
556
|
+
a.style.backgroundColor = "transparent";
|
|
557
|
+
}), a.addEventListener("click", (r) => {
|
|
558
|
+
r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((p) => {
|
|
559
|
+
p && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
|
|
546
560
|
});
|
|
547
561
|
});
|
|
548
562
|
const l = n.querySelector(".setting-group-arrow");
|
|
549
|
-
l ? n.insertBefore(
|
|
563
|
+
l ? n.insertBefore(a, l) : n.appendChild(a);
|
|
550
564
|
}
|
|
551
565
|
showDeleteConfirmation() {
|
|
552
566
|
return new Promise((t) => {
|
|
@@ -589,14 +603,14 @@ const K = class K {
|
|
|
589
603
|
font-size: 14px;
|
|
590
604
|
line-height: 1.5;
|
|
591
605
|
`;
|
|
592
|
-
const
|
|
593
|
-
|
|
606
|
+
const a = document.createElement("div");
|
|
607
|
+
a.style.cssText = `
|
|
594
608
|
display: flex;
|
|
595
609
|
gap: 12px;
|
|
596
610
|
justify-content: flex-end;
|
|
597
611
|
`;
|
|
598
|
-
const
|
|
599
|
-
|
|
612
|
+
const o = document.createElement("button");
|
|
613
|
+
o.textContent = "Cancel", o.type = "button", o.style.cssText = `
|
|
600
614
|
padding: 8px 16px;
|
|
601
615
|
border: 1px solid #d1d5db;
|
|
602
616
|
background: white;
|
|
@@ -618,10 +632,10 @@ const K = class K {
|
|
|
618
632
|
font-weight: 500;
|
|
619
633
|
cursor: pointer;
|
|
620
634
|
transition: all 0.2s;
|
|
621
|
-
`,
|
|
622
|
-
|
|
623
|
-
}),
|
|
624
|
-
|
|
635
|
+
`, o.addEventListener("mouseenter", () => {
|
|
636
|
+
o.style.backgroundColor = "#f9fafb", o.style.borderColor = "#9ca3af";
|
|
637
|
+
}), o.addEventListener("mouseleave", () => {
|
|
638
|
+
o.style.backgroundColor = "white", o.style.borderColor = "#d1d5db";
|
|
625
639
|
}), l.addEventListener("mouseenter", () => {
|
|
626
640
|
l.style.backgroundColor = "#dc2626";
|
|
627
641
|
}), l.addEventListener("mouseleave", () => {
|
|
@@ -632,17 +646,17 @@ const K = class K {
|
|
|
632
646
|
e.parentNode && e.parentNode.removeChild(e);
|
|
633
647
|
}, 200);
|
|
634
648
|
};
|
|
635
|
-
|
|
649
|
+
o.addEventListener("click", () => {
|
|
636
650
|
r(), t(!1);
|
|
637
651
|
}), l.addEventListener("click", () => {
|
|
638
652
|
r(), t(!0);
|
|
639
|
-
}), e.addEventListener("click", (
|
|
640
|
-
|
|
653
|
+
}), e.addEventListener("click", (c) => {
|
|
654
|
+
c.target === e && (r(), t(!1));
|
|
641
655
|
});
|
|
642
|
-
const
|
|
643
|
-
|
|
656
|
+
const p = (c) => {
|
|
657
|
+
c.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", p));
|
|
644
658
|
};
|
|
645
|
-
document.addEventListener("keydown",
|
|
659
|
+
document.addEventListener("keydown", p), a.appendChild(o), a.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(a), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
|
|
646
660
|
e.style.opacity = "1", i.style.transform = "scale(1)";
|
|
647
661
|
}), setTimeout(() => l.focus(), 100);
|
|
648
662
|
});
|
|
@@ -660,8 +674,8 @@ const K = class K {
|
|
|
660
674
|
...Object.keys(t),
|
|
661
675
|
...Object.keys(e)
|
|
662
676
|
])).forEach((n) => {
|
|
663
|
-
const
|
|
664
|
-
JSON.stringify(
|
|
677
|
+
const a = t[n], o = e[n];
|
|
678
|
+
JSON.stringify(a) !== JSON.stringify(o) && (i[n] = { from: a, to: o });
|
|
665
679
|
}), i;
|
|
666
680
|
}
|
|
667
681
|
getValues(t) {
|
|
@@ -670,7 +684,7 @@ const K = class K {
|
|
|
670
684
|
for (const i in this.settings)
|
|
671
685
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
672
686
|
const s = this.settings[i];
|
|
673
|
-
if (
|
|
687
|
+
if (L(s))
|
|
674
688
|
e[i] = s.getValues();
|
|
675
689
|
else {
|
|
676
690
|
const n = s;
|
|
@@ -681,7 +695,7 @@ const K = class K {
|
|
|
681
695
|
} else {
|
|
682
696
|
const e = this.settings[t];
|
|
683
697
|
if (!e) return;
|
|
684
|
-
if (
|
|
698
|
+
if (L(e)) return e.getValues();
|
|
685
699
|
const i = e;
|
|
686
700
|
return i.getValue ? i.getValue() : i.value;
|
|
687
701
|
}
|
|
@@ -694,19 +708,19 @@ const K = class K {
|
|
|
694
708
|
for (const s in this.settings)
|
|
695
709
|
if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
|
|
696
710
|
const n = this.settings[s];
|
|
697
|
-
if (
|
|
698
|
-
const
|
|
699
|
-
|
|
711
|
+
if (L(n)) {
|
|
712
|
+
const a = n.getValuesForJson();
|
|
713
|
+
a !== null && (i[s] = a);
|
|
700
714
|
} else {
|
|
701
|
-
const
|
|
702
|
-
|
|
715
|
+
const a = n;
|
|
716
|
+
a.includeGetJson !== !1 && (i[s] = a.value);
|
|
703
717
|
}
|
|
704
718
|
}
|
|
705
719
|
return (this.hide === !0 || ((e = this == null ? void 0 : this.groupProps) == null ? void 0 : e.hide) === !0) && (i.hide = !0), i;
|
|
706
720
|
} else {
|
|
707
721
|
const i = this.settings[t];
|
|
708
722
|
if (!i) return;
|
|
709
|
-
if (
|
|
723
|
+
if (L(i))
|
|
710
724
|
return i.includeGetJson === !1 ? null : i.getValuesForJson();
|
|
711
725
|
{
|
|
712
726
|
const s = i;
|
|
@@ -720,7 +734,7 @@ const K = class K {
|
|
|
720
734
|
for (const i in this.settings)
|
|
721
735
|
if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
|
|
722
736
|
const s = this.settings[i];
|
|
723
|
-
if (
|
|
737
|
+
if (L(s))
|
|
724
738
|
e[i] = s.getDefaultValues();
|
|
725
739
|
else {
|
|
726
740
|
const n = s;
|
|
@@ -731,7 +745,7 @@ const K = class K {
|
|
|
731
745
|
} else {
|
|
732
746
|
const e = this.settings[t];
|
|
733
747
|
if (!e) return;
|
|
734
|
-
if (
|
|
748
|
+
if (L(e)) return e.getDefaultValues();
|
|
735
749
|
const i = e;
|
|
736
750
|
return i.default !== void 0 ? i.default : i.value;
|
|
737
751
|
}
|
|
@@ -750,57 +764,57 @@ const K = class K {
|
|
|
750
764
|
s.textContent = this.title, i.appendChild(s);
|
|
751
765
|
const n = document.createElement("div");
|
|
752
766
|
n.className = "actions-section";
|
|
753
|
-
const
|
|
754
|
-
|
|
767
|
+
const a = document.createElement("span");
|
|
768
|
+
a.className = "setting-group-arrow", a.innerHTML = `
|
|
755
769
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
756
770
|
<path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
757
771
|
</svg>
|
|
758
|
-
`, this.isCollapsed &&
|
|
759
|
-
const
|
|
760
|
-
|
|
772
|
+
`, this.isCollapsed && a.classList.add("rotated"), n.appendChild(a);
|
|
773
|
+
const o = document.createElement("div");
|
|
774
|
+
o.className = "setting-group-content", this.isCollapsed && (o.classList.add("collapsed"), e.classList.add("collapsed-view"), a.classList.add("rotated"), t.classList.add("collapsed")), this.isMain && o.classList.add("main-content");
|
|
761
775
|
const l = () => {
|
|
762
|
-
this.isCollapsed = !this.isCollapsed,
|
|
776
|
+
this.isCollapsed = !this.isCollapsed, o.classList.toggle("collapsed"), e.classList.toggle("collapsed-view"), a.classList.toggle("rotated"), t.classList.toggle("collapsed", this.isCollapsed), e.setAttribute(
|
|
763
777
|
"aria-expanded",
|
|
764
778
|
(!this.isCollapsed).toString()
|
|
765
779
|
);
|
|
766
780
|
};
|
|
767
|
-
if (e.onclick = l, e.onkeydown = (
|
|
768
|
-
(
|
|
781
|
+
if (e.onclick = l, e.onkeydown = (p) => {
|
|
782
|
+
(p.key === "Enter" || p.key === " ") && (p.preventDefault(), l());
|
|
769
783
|
}, Object.keys(this.settings).length > 0) {
|
|
770
|
-
for (const
|
|
771
|
-
if (Object.prototype.hasOwnProperty.call(this.settings,
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
const d =
|
|
775
|
-
|
|
784
|
+
for (const p in this.settings)
|
|
785
|
+
if (Object.prototype.hasOwnProperty.call(this.settings, p)) {
|
|
786
|
+
const c = this.settings[p];
|
|
787
|
+
L(c) && typeof c.setNestingLevel == "function" && c.setNestingLevel(this.nestingLevel + 1);
|
|
788
|
+
const d = c.draw();
|
|
789
|
+
L(c) && c.deleteItemCfg && this.addDeleteButtonToElement(
|
|
776
790
|
d,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
),
|
|
791
|
+
p,
|
|
792
|
+
c
|
|
793
|
+
), o.appendChild(d);
|
|
780
794
|
}
|
|
781
795
|
} else {
|
|
782
|
-
const
|
|
783
|
-
|
|
796
|
+
const p = document.createElement("div");
|
|
797
|
+
p.className = "setting-group-empty", p.textContent = "No settings in this group", o.appendChild(p);
|
|
784
798
|
}
|
|
785
799
|
if (this.addItemCfg) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
const
|
|
800
|
+
const p = document.createElement("button");
|
|
801
|
+
p.type = "button", p.className = "sg-add-button-bottom", p.style.marginTop = "8px";
|
|
802
|
+
const c = `
|
|
789
803
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
|
|
790
804
|
xmlns="http://www.w3.org/2000/svg">
|
|
791
805
|
<path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
|
|
792
806
|
stroke-width="1.5" stroke-linecap="round"/>
|
|
793
807
|
</svg>`;
|
|
794
|
-
|
|
808
|
+
p.innerHTML = `${c}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, p.addEventListener("click", (d) => {
|
|
795
809
|
d.stopPropagation(), d.preventDefault();
|
|
796
|
-
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix),
|
|
797
|
-
if (
|
|
810
|
+
const u = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), g = this.addItemCfg.createItem(u);
|
|
811
|
+
if (nt(g)) {
|
|
798
812
|
const f = `${this.addItemCfg.keyPrefix}${u}`;
|
|
799
|
-
this.addSetting(f,
|
|
813
|
+
this.addSetting(f, g);
|
|
800
814
|
}
|
|
801
|
-
}),
|
|
815
|
+
}), o.appendChild(p);
|
|
802
816
|
}
|
|
803
|
-
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(o), this.elementRef = t, st.trackElement(t), setTimeout(() => {
|
|
804
818
|
this.updateNestingStyles();
|
|
805
819
|
}, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
|
|
806
820
|
}
|
|
@@ -831,10 +845,10 @@ const K = class K {
|
|
|
831
845
|
let i = e;
|
|
832
846
|
const s = Object.keys(this.settings), n = Object.keys(e);
|
|
833
847
|
if (!s.some(
|
|
834
|
-
(
|
|
848
|
+
(o) => n.includes(o)
|
|
835
849
|
) && n.length === 1) {
|
|
836
|
-
const
|
|
837
|
-
i = e[
|
|
850
|
+
const o = n[0];
|
|
851
|
+
i = e[o];
|
|
838
852
|
}
|
|
839
853
|
this.setValue(i);
|
|
840
854
|
} catch (e) {
|
|
@@ -843,11 +857,11 @@ const K = class K {
|
|
|
843
857
|
}
|
|
844
858
|
};
|
|
845
859
|
K.hiddenElements = /* @__PURE__ */ new Set();
|
|
846
|
-
let
|
|
847
|
-
function
|
|
848
|
-
return new
|
|
860
|
+
let H = K;
|
|
861
|
+
function ce(h) {
|
|
862
|
+
return new wt(h);
|
|
849
863
|
}
|
|
850
|
-
class
|
|
864
|
+
class wt extends H {
|
|
851
865
|
constructor(t) {
|
|
852
866
|
super(t);
|
|
853
867
|
const e = Object.keys(this.settings)[0];
|
|
@@ -881,30 +895,30 @@ class yt extends T {
|
|
|
881
895
|
s.textContent = this.title, i.appendChild(s);
|
|
882
896
|
const n = document.createElement("div");
|
|
883
897
|
n.className = "tabs-header", this.tabsContainer = n;
|
|
884
|
-
const
|
|
885
|
-
if (
|
|
898
|
+
const a = document.createElement("div");
|
|
899
|
+
if (a.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((o, l) => {
|
|
886
900
|
const r = document.createElement("button");
|
|
887
|
-
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id",
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
)),
|
|
894
|
-
}), e.appendChild(i), e.appendChild(n), e.appendChild(
|
|
895
|
-
const
|
|
896
|
-
this.activeTabId =
|
|
901
|
+
r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", o), r.textContent = o, r.addEventListener("click", () => this.switchToTab(o)), n.appendChild(r);
|
|
902
|
+
const p = document.createElement("div");
|
|
903
|
+
p.className = "tab-panel", this.contentContainers[o] = p;
|
|
904
|
+
const c = this.settings[o];
|
|
905
|
+
c && (L(c) && typeof c.setNestingLevel == "function" && c.setNestingLevel(this.getNestingLevel() + 1), p.appendChild(
|
|
906
|
+
c.draw()
|
|
907
|
+
)), a.appendChild(p), l === 0 && !this.activeTabId && (this.activeTabId = o);
|
|
908
|
+
}), e.appendChild(i), e.appendChild(n), e.appendChild(a), !this.activeTabId) {
|
|
909
|
+
const o = Object.keys(this.settings)[0];
|
|
910
|
+
this.activeTabId = o || "";
|
|
897
911
|
}
|
|
898
912
|
return this.updateTabUI(), t;
|
|
899
913
|
}
|
|
900
914
|
}
|
|
901
|
-
function
|
|
902
|
-
return new
|
|
915
|
+
function xt(h) {
|
|
916
|
+
return new H(h);
|
|
903
917
|
}
|
|
904
|
-
function
|
|
905
|
-
return
|
|
918
|
+
function he(h) {
|
|
919
|
+
return h;
|
|
906
920
|
}
|
|
907
|
-
class
|
|
921
|
+
class Lt extends x {
|
|
908
922
|
constructor(t = {}) {
|
|
909
923
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
910
924
|
}
|
|
@@ -924,31 +938,31 @@ class bt extends w {
|
|
|
924
938
|
});
|
|
925
939
|
}
|
|
926
940
|
}
|
|
927
|
-
const
|
|
928
|
-
class
|
|
941
|
+
const kt = "<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>";
|
|
942
|
+
class N extends Lt {
|
|
929
943
|
constructor(t) {
|
|
930
944
|
super({
|
|
931
945
|
...t,
|
|
932
|
-
icon: t.icon ||
|
|
946
|
+
icon: t.icon || kt,
|
|
933
947
|
title: t.title || "Color",
|
|
934
|
-
default: t.default ?
|
|
948
|
+
default: t.default ? N.normalizeColorValue(t.default) : "#000000"
|
|
935
949
|
}), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
|
|
936
950
|
}
|
|
937
951
|
static normalizeColorValue(t) {
|
|
938
|
-
return t.startsWith("#") ?
|
|
952
|
+
return t.startsWith("var(--") ? t : t.startsWith("#") ? N.normalizeHexValue(t) : t.includes(",") ? N.rgbToHexStatic(t) : N.normalizeHexValue(t);
|
|
939
953
|
}
|
|
940
954
|
static normalizeHexValue(t) {
|
|
941
955
|
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");
|
|
942
956
|
}
|
|
943
957
|
static rgbToHexStatic(t) {
|
|
944
|
-
const e = t.split(",").map((
|
|
958
|
+
const e = t.split(",").map((p) => parseInt(p.trim()));
|
|
945
959
|
if (e.length !== 3 || e.some(isNaN))
|
|
946
960
|
return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
|
|
947
|
-
const [i, s, n] = e,
|
|
948
|
-
const
|
|
949
|
-
return
|
|
961
|
+
const [i, s, n] = e, a = Math.max(0, Math.min(255, i)), o = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (p) => {
|
|
962
|
+
const c = p.toString(16);
|
|
963
|
+
return c.length === 1 ? "0" + c : c;
|
|
950
964
|
};
|
|
951
|
-
return `#${r(
|
|
965
|
+
return `#${r(a)}${r(o)}${r(l)}`;
|
|
952
966
|
}
|
|
953
967
|
setValue(t) {
|
|
954
968
|
if (t === void 0) {
|
|
@@ -956,7 +970,7 @@ class M extends bt {
|
|
|
956
970
|
return;
|
|
957
971
|
}
|
|
958
972
|
if (typeof t == "string") {
|
|
959
|
-
const e =
|
|
973
|
+
const e = N.normalizeColorValue(t);
|
|
960
974
|
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);
|
|
961
975
|
} else
|
|
962
976
|
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");
|
|
@@ -969,55 +983,103 @@ class M extends bt {
|
|
|
969
983
|
draw() {
|
|
970
984
|
const t = document.createElement("div");
|
|
971
985
|
if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
972
|
-
const
|
|
973
|
-
if (
|
|
974
|
-
const
|
|
975
|
-
|
|
986
|
+
const g = document.createElement("div");
|
|
987
|
+
if (g.className = "icon-container", this.props.icon) {
|
|
988
|
+
const f = document.createElement("span");
|
|
989
|
+
f.className = "input-icon", f.innerHTML = this.props.icon, g.appendChild(f);
|
|
976
990
|
}
|
|
977
991
|
if (this.props.title) {
|
|
978
|
-
const
|
|
979
|
-
|
|
992
|
+
const f = document.createElement("span");
|
|
993
|
+
f.className = "input-label", f.textContent = this.props.title, g.appendChild(f);
|
|
980
994
|
}
|
|
981
|
-
t.appendChild(
|
|
995
|
+
t.appendChild(g);
|
|
982
996
|
}
|
|
983
997
|
const e = document.createElement("div");
|
|
984
998
|
e.className = "color-input-wrapper";
|
|
985
|
-
const i = (
|
|
986
|
-
|
|
987
|
-
|
|
999
|
+
const i = document.createElement("div");
|
|
1000
|
+
i.className = "color-setting-tabs", i.style.display = "flex", i.style.marginBottom = "8px", i.style.gap = "4px";
|
|
1001
|
+
const s = document.createElement("button");
|
|
1002
|
+
s.className = "color-tab active", s.textContent = "Solid";
|
|
1003
|
+
const n = document.createElement("button");
|
|
1004
|
+
n.className = "color-tab", n.textContent = "Global", i.appendChild(s), i.appendChild(n);
|
|
1005
|
+
const a = document.createElement("div");
|
|
1006
|
+
a.className = "color-content-solid";
|
|
1007
|
+
const o = document.createElement("div");
|
|
1008
|
+
o.className = "color-content-global", o.style.display = "none", o.style.display = "grid", o.style.gridTemplateColumns = "repeat(auto-fill, minmax(30px, 1fr))", o.style.gap = "8px";
|
|
1009
|
+
const l = () => {
|
|
1010
|
+
try {
|
|
1011
|
+
if (console.log("ColorSetting: renderGlobalOptions called"), o.innerHTML = "", !x) {
|
|
1012
|
+
console.error("ColorSetting: Setting class is undefined");
|
|
1013
|
+
const f = document.createElement("div");
|
|
1014
|
+
f.textContent = "Error: System error (Setting undefined)", o.appendChild(f);
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
const g = x.GlobalVariables || {};
|
|
1018
|
+
if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
|
|
1019
|
+
const f = document.createElement("div");
|
|
1020
|
+
f.textContent = "No global colors defined", f.style.gridColumn = "1 / -1", f.style.fontSize = "12px", f.style.color = "#666", o.appendChild(f);
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
Object.entries(g).forEach(([f, m]) => {
|
|
1024
|
+
const v = document.createElement("button");
|
|
1025
|
+
v.className = "global-color-btn", v.title = f, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = m, v.style.cursor = "pointer", this.value === `var(--${f})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (C) => {
|
|
1026
|
+
var E, M;
|
|
1027
|
+
C.preventDefault();
|
|
1028
|
+
const w = `var(--${f})`;
|
|
1029
|
+
this.value = w, (E = this.onChange) == null || E.call(this, w), (M = this.detectChange) == null || M.call(this, w), Array.from(o.children).forEach((y) => {
|
|
1030
|
+
y.style.border = "1px solid #ddd";
|
|
1031
|
+
}), v.style.border = "2px solid #2196f3", c.style.backgroundColor = m;
|
|
1032
|
+
}), o.appendChild(v);
|
|
1033
|
+
});
|
|
1034
|
+
} catch (g) {
|
|
1035
|
+
console.error("ColorSetting: Error in renderGlobalOptions", g), o.innerHTML = "Error loading global options";
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
l(), s.addEventListener("click", (g) => {
|
|
1039
|
+
g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), a.style.display = "flex", o.style.display = "none", this.value && this.value.startsWith("var(--");
|
|
1040
|
+
}), n.addEventListener("click", (g) => {
|
|
1041
|
+
g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), a.style.display = "none", o.style.display = "grid", l();
|
|
1042
|
+
}), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
|
|
1043
|
+
const r = (g) => {
|
|
1044
|
+
const f = g.value.trim();
|
|
1045
|
+
if (!f)
|
|
988
1046
|
return e.classList.remove("error"), !0;
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
-
},
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
}), this.colorInputEl.addEventListener("
|
|
1010
|
-
var
|
|
1011
|
-
const
|
|
1012
|
-
this.value =
|
|
1013
|
-
}),
|
|
1047
|
+
const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(f);
|
|
1048
|
+
return v ? e.classList.remove("error") : e.classList.add("error"), v;
|
|
1049
|
+
}, p = document.createElement("input");
|
|
1050
|
+
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;
|
|
1051
|
+
const c = document.createElement("div");
|
|
1052
|
+
c.className = "color-preview";
|
|
1053
|
+
let d = this.value || "#000000";
|
|
1054
|
+
if (d.startsWith("var(--")) {
|
|
1055
|
+
const g = d.replace("var(--", "").replace(")", "");
|
|
1056
|
+
d = (x.GlobalVariables || {})[g] || "#000000";
|
|
1057
|
+
}
|
|
1058
|
+
c.style.backgroundColor = d;
|
|
1059
|
+
const u = document.createElement("input");
|
|
1060
|
+
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) => {
|
|
1061
|
+
var m, v;
|
|
1062
|
+
let f = g.target.value.trim();
|
|
1063
|
+
if (this.textInputEl && r(this.textInputEl)) {
|
|
1064
|
+
const C = N.normalizeColorValue(f);
|
|
1065
|
+
this.value = C, (m = this.onChange) == null || m.call(this, C), (v = this.detectChange) == null || v.call(this, C), this.colorInputEl && (this.colorInputEl.value = C), c.style.backgroundColor = C;
|
|
1066
|
+
}
|
|
1067
|
+
}), this.colorInputEl.addEventListener("input", (g) => {
|
|
1068
|
+
var v, C;
|
|
1069
|
+
const f = g.target.value, m = N.normalizeColorValue(f);
|
|
1070
|
+
this.value = m, (v = this.onChange) == null || v.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m, e.classList.remove("error");
|
|
1071
|
+
}), this.colorInputEl.addEventListener("change", (g) => {
|
|
1072
|
+
var v, C;
|
|
1073
|
+
const f = g.target.value, m = N.normalizeColorValue(f);
|
|
1074
|
+
this.value = m, (v = this.onChange) == null || v.call(this, m), (C = this.detectChange) == null || C.call(this, m), this.textInputEl && (this.textInputEl.value = m), c.style.backgroundColor = m;
|
|
1075
|
+
}), a.appendChild(p), a.appendChild(c), a.appendChild(u), e.appendChild(i), e.appendChild(a), e.appendChild(o), t.appendChild(e), this.element = t, t;
|
|
1014
1076
|
}
|
|
1015
1077
|
getElement() {
|
|
1016
1078
|
return this.element;
|
|
1017
1079
|
}
|
|
1018
1080
|
// Helper method to get normalized hex value
|
|
1019
1081
|
getNormalizedValue() {
|
|
1020
|
-
return this.value ?
|
|
1082
|
+
return this.value ? N.normalizeColorValue(this.value) : "#000000";
|
|
1021
1083
|
}
|
|
1022
1084
|
// Helper method to check if current value is valid hex
|
|
1023
1085
|
isValidHex() {
|
|
@@ -1028,17 +1090,17 @@ class M extends bt {
|
|
|
1028
1090
|
return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
|
|
1029
1091
|
}
|
|
1030
1092
|
}
|
|
1031
|
-
const
|
|
1093
|
+
const Mt = `
|
|
1032
1094
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1033
1095
|
<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"/>
|
|
1034
1096
|
<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"/>
|
|
1035
1097
|
<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"/>
|
|
1036
1098
|
</svg>`;
|
|
1037
|
-
class R extends
|
|
1099
|
+
class R extends x {
|
|
1038
1100
|
constructor(t = {}) {
|
|
1039
1101
|
super({
|
|
1040
1102
|
...t,
|
|
1041
|
-
icon: t.icon ||
|
|
1103
|
+
icon: t.icon || Mt,
|
|
1042
1104
|
title: t.title || "Color & Opacity",
|
|
1043
1105
|
default: t.default || "#000000FF"
|
|
1044
1106
|
}), 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 = R.normalizeHexWithOpacity(this.value));
|
|
@@ -1066,8 +1128,8 @@ class R extends w {
|
|
|
1066
1128
|
}
|
|
1067
1129
|
updateColorPreview() {
|
|
1068
1130
|
if (!this.colorPreviewEl || !this.value) return;
|
|
1069
|
-
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),
|
|
1070
|
-
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${
|
|
1131
|
+
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), a = parseInt(i.substring(4, 6), 16);
|
|
1132
|
+
this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
1071
1133
|
}
|
|
1072
1134
|
handleColorChange(t) {
|
|
1073
1135
|
const e = this.getOpacityPercent(), i = R.combineColorOpacity(
|
|
@@ -1090,16 +1152,16 @@ class R extends w {
|
|
|
1090
1152
|
draw() {
|
|
1091
1153
|
const t = document.createElement("div");
|
|
1092
1154
|
if (t.className = "color-with-opacity-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1155
|
+
const a = document.createElement("div");
|
|
1156
|
+
if (a.className = "icon-container", this.props.icon) {
|
|
1157
|
+
const o = document.createElement("span");
|
|
1158
|
+
o.className = "input-icon", o.innerHTML = this.props.icon, a.appendChild(o);
|
|
1097
1159
|
}
|
|
1098
1160
|
if (this.props.title) {
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1161
|
+
const o = document.createElement("span");
|
|
1162
|
+
o.className = "input-label", o.textContent = this.props.title, a.appendChild(o);
|
|
1101
1163
|
}
|
|
1102
|
-
t.appendChild(
|
|
1164
|
+
t.appendChild(a);
|
|
1103
1165
|
}
|
|
1104
1166
|
const e = document.createElement("div");
|
|
1105
1167
|
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(
|
|
@@ -1108,18 +1170,18 @@ class R extends w {
|
|
|
1108
1170
|
), 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(
|
|
1109
1171
|
"data-test-id",
|
|
1110
1172
|
`${this.getDataPropsPath()}_text`
|
|
1111
|
-
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (
|
|
1112
|
-
const
|
|
1113
|
-
this.handleColorChange(
|
|
1114
|
-
}), this.textInputEl.addEventListener("input", (
|
|
1115
|
-
const
|
|
1116
|
-
this.handleTextInput(
|
|
1117
|
-
}), this.textInputEl.addEventListener("blur", (
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1173
|
+
), this.updateInputElements(), this.updateColorPreview(), this.colorInputEl.addEventListener("input", (a) => {
|
|
1174
|
+
const o = a.target;
|
|
1175
|
+
this.handleColorChange(o.value), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1176
|
+
}), this.textInputEl.addEventListener("input", (a) => {
|
|
1177
|
+
const o = a.target;
|
|
1178
|
+
this.handleTextInput(o.value) ? (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.updateColorPreview(), e.classList.remove("error")) : o.value.trim() === "" ? e.classList.remove("error") : e.classList.add("error");
|
|
1179
|
+
}), this.textInputEl.addEventListener("blur", (a) => {
|
|
1180
|
+
const o = a.target;
|
|
1181
|
+
o.value.trim() === "" && (o.value = this.value || "#000000FF", e.classList.remove("error"));
|
|
1120
1182
|
}), this.colorPreviewEl.addEventListener("click", () => {
|
|
1121
|
-
var
|
|
1122
|
-
(
|
|
1183
|
+
var a;
|
|
1184
|
+
(a = this.colorInputEl) == null || a.click();
|
|
1123
1185
|
}), e.appendChild(this.colorInputEl), e.appendChild(this.colorPreviewEl), e.appendChild(this.textInputEl);
|
|
1124
1186
|
const i = document.createElement("div");
|
|
1125
1187
|
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(
|
|
@@ -1127,13 +1189,13 @@ class R extends w {
|
|
|
1127
1189
|
`${this.getDataPropsPath()}_opacity`
|
|
1128
1190
|
);
|
|
1129
1191
|
const s = document.createElement("span");
|
|
1130
|
-
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (
|
|
1131
|
-
const
|
|
1192
|
+
s.className = "color-with-opacity-opacity-suffix", s.textContent = "%", this.opacityInputEl.addEventListener("input", (a) => {
|
|
1193
|
+
const o = a.target, l = parseFloat(o.value);
|
|
1132
1194
|
isNaN(l) || (this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview());
|
|
1133
|
-
}), this.opacityInputEl.addEventListener("blur", (
|
|
1134
|
-
const
|
|
1135
|
-
let l = parseFloat(
|
|
1136
|
-
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)),
|
|
1195
|
+
}), this.opacityInputEl.addEventListener("blur", (a) => {
|
|
1196
|
+
const o = a.target;
|
|
1197
|
+
let l = parseFloat(o.value);
|
|
1198
|
+
isNaN(l) && (l = this.getOpacityPercent()), l = Math.max(0, Math.min(100, l)), o.value = l.toString(), this.handleOpacityChange(l), this.textInputEl && (this.textInputEl.value = this.value || "#000000FF"), this.updateColorPreview();
|
|
1137
1199
|
}), i.appendChild(this.opacityInputEl), i.appendChild(s);
|
|
1138
1200
|
const n = document.createElement("div");
|
|
1139
1201
|
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;
|
|
@@ -1146,8 +1208,8 @@ class R extends w {
|
|
|
1146
1208
|
}
|
|
1147
1209
|
getRgbaValue() {
|
|
1148
1210
|
if (!this.value) return "rgba(0, 0, 0, 1)";
|
|
1149
|
-
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),
|
|
1150
|
-
return `rgba(${s}, ${n}, ${
|
|
1211
|
+
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), a = parseInt(i.substring(4, 6), 16);
|
|
1212
|
+
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
1151
1213
|
}
|
|
1152
1214
|
getColorAndOpacity() {
|
|
1153
1215
|
return {
|
|
@@ -1156,7 +1218,7 @@ class R extends w {
|
|
|
1156
1218
|
};
|
|
1157
1219
|
}
|
|
1158
1220
|
}
|
|
1159
|
-
class
|
|
1221
|
+
class de extends x {
|
|
1160
1222
|
constructor(t = {}) {
|
|
1161
1223
|
super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
|
|
1162
1224
|
}
|
|
@@ -1168,27 +1230,27 @@ class le extends w {
|
|
|
1168
1230
|
if (t.className = "html-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
|
|
1169
1231
|
const n = document.createElement("div");
|
|
1170
1232
|
if (n.className = "icon-container", this.props.icon) {
|
|
1171
|
-
const
|
|
1172
|
-
n.appendChild(
|
|
1233
|
+
const a = this.createIcon(this.props.icon);
|
|
1234
|
+
n.appendChild(a);
|
|
1173
1235
|
}
|
|
1174
1236
|
if (this.props.title) {
|
|
1175
|
-
const
|
|
1176
|
-
n.appendChild(
|
|
1237
|
+
const a = this.createLabel(this.props.title);
|
|
1238
|
+
n.appendChild(a);
|
|
1177
1239
|
}
|
|
1178
1240
|
t.appendChild(n);
|
|
1179
1241
|
}
|
|
1180
1242
|
const e = document.createElement("textarea");
|
|
1181
1243
|
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);
|
|
1182
1244
|
const i = (n) => {
|
|
1183
|
-
const
|
|
1184
|
-
this.value =
|
|
1245
|
+
const o = n.target.value;
|
|
1246
|
+
this.value = o, this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value);
|
|
1185
1247
|
}, s = (n) => {
|
|
1186
1248
|
this.onBlur && this.value !== void 0 && this.onBlur(this.value);
|
|
1187
1249
|
};
|
|
1188
1250
|
return e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("blur", s), t.appendChild(e), t;
|
|
1189
1251
|
}
|
|
1190
1252
|
}
|
|
1191
|
-
class
|
|
1253
|
+
class V extends x {
|
|
1192
1254
|
constructor(t) {
|
|
1193
1255
|
super(t), this.inputType = "number", this.inputElement = null, this.mobileValue = t.mobile, this.validateProps(), this.value = this.validateValue(this.value);
|
|
1194
1256
|
}
|
|
@@ -1211,12 +1273,12 @@ class S extends w {
|
|
|
1211
1273
|
const i = document.createElement("input");
|
|
1212
1274
|
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", () => {
|
|
1213
1275
|
const s = this.props.minValue ?? Number.MIN_SAFE_INTEGER, n = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
1214
|
-
let
|
|
1215
|
-
|
|
1276
|
+
let a = Number(i.value);
|
|
1277
|
+
a < s && (a = s), a > n && (a = n), String(a) !== i.value && (i.value = String(a)), this.setValue(a);
|
|
1216
1278
|
}), i.addEventListener("blur", () => {
|
|
1217
|
-
var n,
|
|
1279
|
+
var n, a;
|
|
1218
1280
|
const s = this.validateValue(Number(i.value));
|
|
1219
|
-
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (
|
|
1281
|
+
s !== Number(i.value) && (i.value = String(s), this.setValue(s)), (a = (n = this.props).onBlur) == null || a.call(n);
|
|
1220
1282
|
}), e.appendChild(i), this.props.suffix && this.props.suffix !== "none") {
|
|
1221
1283
|
const s = document.createElement("span");
|
|
1222
1284
|
s.className = "suffix-label", s.textContent = this.props.suffix, e.appendChild(s);
|
|
@@ -1247,12 +1309,12 @@ class S extends w {
|
|
|
1247
1309
|
);
|
|
1248
1310
|
}
|
|
1249
1311
|
}
|
|
1250
|
-
const
|
|
1312
|
+
const St = `
|
|
1251
1313
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1252
1314
|
<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"/>
|
|
1253
1315
|
<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"/>
|
|
1254
1316
|
</svg>`;
|
|
1255
|
-
class
|
|
1317
|
+
class Nt extends V {
|
|
1256
1318
|
constructor(t = {}) {
|
|
1257
1319
|
const e = {
|
|
1258
1320
|
title: "Opacity",
|
|
@@ -1261,7 +1323,7 @@ class kt extends S {
|
|
|
1261
1323
|
maxValue: 100,
|
|
1262
1324
|
step: 1,
|
|
1263
1325
|
default: t.default ?? 100,
|
|
1264
|
-
icon:
|
|
1326
|
+
icon: St,
|
|
1265
1327
|
...t
|
|
1266
1328
|
};
|
|
1267
1329
|
super(e), this.inputType = "number", this.mobileValue = t.mobile;
|
|
@@ -1273,12 +1335,12 @@ class kt extends S {
|
|
|
1273
1335
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1274
1336
|
}
|
|
1275
1337
|
}
|
|
1276
|
-
const
|
|
1338
|
+
const It = `
|
|
1277
1339
|
<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">
|
|
1278
1340
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1279
1341
|
</svg>
|
|
1280
1342
|
`;
|
|
1281
|
-
class tt extends
|
|
1343
|
+
class tt extends x {
|
|
1282
1344
|
constructor(t = {}) {
|
|
1283
1345
|
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) {
|
|
1284
1346
|
const e = this._options.findIndex((i) => i.value === this.value);
|
|
@@ -1299,12 +1361,12 @@ class tt extends w {
|
|
|
1299
1361
|
if (t.classList.add("select-container"), this.container = t, this.props.icon || this.props.title) {
|
|
1300
1362
|
const n = document.createElement("div");
|
|
1301
1363
|
if (n.className = "icon-container", this.props.icon) {
|
|
1302
|
-
const
|
|
1303
|
-
n.appendChild(
|
|
1364
|
+
const a = this.createIcon(this.props.icon);
|
|
1365
|
+
n.appendChild(a);
|
|
1304
1366
|
}
|
|
1305
1367
|
if (this.props.title) {
|
|
1306
|
-
const
|
|
1307
|
-
n.appendChild(
|
|
1368
|
+
const a = this.createLabel(this.props.title);
|
|
1369
|
+
n.appendChild(a);
|
|
1308
1370
|
}
|
|
1309
1371
|
t.appendChild(n);
|
|
1310
1372
|
} else {
|
|
@@ -1313,22 +1375,22 @@ class tt extends w {
|
|
|
1313
1375
|
}
|
|
1314
1376
|
const e = document.createElement("div");
|
|
1315
1377
|
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 = () => {
|
|
1316
|
-
var n,
|
|
1317
|
-
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1378
|
+
var n, a;
|
|
1379
|
+
this.isLoading || (this.isOpen = !this.isOpen, this.isOpen ? this.checkDropdownPosition() : this.cleanupDropdownPosition(), (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
1318
1380
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1319
1381
|
const i = document.createElement("ul");
|
|
1320
|
-
i.classList.add("select-options"), this._options.forEach((n,
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1382
|
+
i.classList.add("select-options"), this._options.forEach((n, a) => {
|
|
1383
|
+
const o = this.createOption(n, a);
|
|
1384
|
+
o.onclick = (l) => this.selectOption(l, a, e), i.appendChild(o);
|
|
1323
1385
|
}), document.body.appendChild(i);
|
|
1324
1386
|
const s = document.createElement("div");
|
|
1325
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1387
|
+
return s.classList.add("svg-container"), s.innerHTML = It, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1326
1388
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
1327
1389
|
}).catch((n) => {
|
|
1328
1390
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
1329
1391
|
})), this.clickOutsideListener && document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = (n) => {
|
|
1330
|
-
var
|
|
1331
|
-
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (
|
|
1392
|
+
var a, o;
|
|
1393
|
+
this.isOpen && !t.contains(n.target) && (this.isOpen = !1, (a = this.optionsListEl) == null || a.classList.remove("open"), (o = this.svgContainer) == null || o.classList.remove("open"), this.cleanupDropdownPosition());
|
|
1332
1394
|
}, document.addEventListener("click", this.clickOutsideListener), this.resizeListener && window.removeEventListener("resize", this.resizeListener), this.resizeListener = () => {
|
|
1333
1395
|
this.isOpen && this.checkDropdownPosition();
|
|
1334
1396
|
}, window.addEventListener("resize", this.resizeListener), t;
|
|
@@ -1347,9 +1409,9 @@ class tt extends w {
|
|
|
1347
1409
|
}
|
|
1348
1410
|
}
|
|
1349
1411
|
selectOption(t, e, i) {
|
|
1350
|
-
var n,
|
|
1412
|
+
var n, a;
|
|
1351
1413
|
const s = this._options[e];
|
|
1352
|
-
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (
|
|
1414
|
+
s && (this.setValue(s.value), this.selectedOptionIndex = e, this.isOpen = !1, i.textContent = s.name, (n = this.optionsListEl) == null || n.classList.remove("open"), (a = this.svgContainer) == null || a.classList.remove("open"), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.querySelectorAll(".select-option").forEach((l, r) => {
|
|
1353
1415
|
r === e ? l.classList.add("selected") : l.classList.remove("selected");
|
|
1354
1416
|
}));
|
|
1355
1417
|
}
|
|
@@ -1385,7 +1447,7 @@ class tt extends w {
|
|
|
1385
1447
|
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();
|
|
1386
1448
|
}
|
|
1387
1449
|
}
|
|
1388
|
-
class
|
|
1450
|
+
class Vt extends x {
|
|
1389
1451
|
constructor(t = {}) {
|
|
1390
1452
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
1391
1453
|
}
|
|
@@ -1430,18 +1492,18 @@ class St extends w {
|
|
|
1430
1492
|
`
|
|
1431
1493
|
}
|
|
1432
1494
|
].forEach((n) => {
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1495
|
+
const a = document.createElement("button");
|
|
1496
|
+
a.className = "align-option-button", a.innerHTML = n.icon, this.getDataPropsPath() && a.setAttribute(
|
|
1435
1497
|
"data-test-id",
|
|
1436
1498
|
`${this.getDataPropsPath()}_${n.name}`
|
|
1437
|
-
), this.value === n.name &&
|
|
1438
|
-
var
|
|
1439
|
-
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")),
|
|
1440
|
-
}), i.appendChild(
|
|
1499
|
+
), this.value === n.name && a.classList.add("selected"), a.addEventListener("click", () => {
|
|
1500
|
+
var o;
|
|
1501
|
+
i.querySelectorAll(".align-option-button").forEach((l) => l.classList.remove("selected")), a.classList.add("selected"), this.value = n.name, (o = this.onChange) == null || o.call(this, this.value);
|
|
1502
|
+
}), i.appendChild(a);
|
|
1441
1503
|
}), t.appendChild(i), t;
|
|
1442
1504
|
}
|
|
1443
1505
|
}
|
|
1444
|
-
class
|
|
1506
|
+
class pe extends x {
|
|
1445
1507
|
constructor(t) {
|
|
1446
1508
|
super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
|
|
1447
1509
|
}
|
|
@@ -1455,42 +1517,42 @@ class re extends w {
|
|
|
1455
1517
|
/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
|
|
1456
1518
|
);
|
|
1457
1519
|
if (n) {
|
|
1458
|
-
let
|
|
1459
|
-
|
|
1520
|
+
let o = +n[1], l = +n[2], r = +n[3], p = +n[4];
|
|
1521
|
+
p >= 1 ? (o = Math.round(o * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : p = Math.min(1, p + 0.12), s = `rgba(${o},${l},${r},${p})`;
|
|
1460
1522
|
}
|
|
1461
1523
|
t.addEventListener("mouseenter", () => {
|
|
1462
1524
|
console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
|
|
1463
1525
|
}), t.addEventListener("mouseleave", () => {
|
|
1464
1526
|
t.style.setProperty("background-color", e, "important");
|
|
1465
1527
|
}), t.addEventListener("click", () => {
|
|
1466
|
-
var
|
|
1467
|
-
return (l = (
|
|
1528
|
+
var o, l;
|
|
1529
|
+
return (l = (o = this.props).onClick) == null ? void 0 : l.call(o);
|
|
1468
1530
|
});
|
|
1469
|
-
const
|
|
1470
|
-
return
|
|
1531
|
+
const a = document.createElement("div");
|
|
1532
|
+
return a.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), a.appendChild(t), a;
|
|
1471
1533
|
}
|
|
1472
1534
|
}
|
|
1473
|
-
class
|
|
1535
|
+
class ue extends x {
|
|
1474
1536
|
constructor(t = {}) {
|
|
1475
1537
|
super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
|
|
1476
1538
|
const e = t.width || 0, i = t.height || 0;
|
|
1477
1539
|
this.value || (this.value = {
|
|
1478
1540
|
width: e,
|
|
1479
1541
|
height: i
|
|
1480
|
-
}), 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
|
|
1542
|
+
}), 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 V({
|
|
1481
1543
|
title: "Width",
|
|
1482
1544
|
default: this.value.width,
|
|
1483
1545
|
suffix: "px",
|
|
1484
1546
|
minValue: this.minWidth,
|
|
1485
1547
|
maxValue: this.maxWidth,
|
|
1486
|
-
icon:
|
|
1487
|
-
}), this.heightSetting = new
|
|
1548
|
+
icon: Tt
|
|
1549
|
+
}), this.heightSetting = new V({
|
|
1488
1550
|
title: "Height",
|
|
1489
1551
|
default: this.value.height,
|
|
1490
1552
|
suffix: "px",
|
|
1491
1553
|
minValue: this.minHeight,
|
|
1492
1554
|
maxValue: this.maxHeight,
|
|
1493
|
-
icon:
|
|
1555
|
+
icon: Pt
|
|
1494
1556
|
}), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
|
|
1495
1557
|
}
|
|
1496
1558
|
handleWidthChange(t) {
|
|
@@ -1560,8 +1622,8 @@ class ce extends w {
|
|
|
1560
1622
|
return n.className = "dimension-lock-icon", n.setAttribute("type", "button"), n.setAttribute("aria-pressed", String(this.locked)), n.setAttribute(
|
|
1561
1623
|
"aria-label",
|
|
1562
1624
|
this.locked ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
1563
|
-
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (
|
|
1564
|
-
|
|
1625
|
+
), n.title = this.locked ? "Unlock aspect ratio" : "Lock aspect ratio", n.innerHTML = this.getLockSVG(this.locked), n.onclick = (a) => {
|
|
1626
|
+
a.preventDefault(), this.toggleLock(n);
|
|
1565
1627
|
}, s.appendChild(n), t.appendChild(e), t.appendChild(s), t.appendChild(i), t;
|
|
1566
1628
|
}
|
|
1567
1629
|
isLocked() {
|
|
@@ -1584,24 +1646,24 @@ class ce extends w {
|
|
|
1584
1646
|
}
|
|
1585
1647
|
}
|
|
1586
1648
|
}
|
|
1587
|
-
const
|
|
1649
|
+
const Tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1588
1650
|
<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"/>
|
|
1589
|
-
</svg>`,
|
|
1651
|
+
</svg>`, Pt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1590
1652
|
<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"/>
|
|
1591
1653
|
</svg>`, Y = `
|
|
1592
1654
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
|
|
1593
1655
|
<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"/>
|
|
1594
1656
|
</svg>
|
|
1595
|
-
`,
|
|
1657
|
+
`, Ot = `
|
|
1596
1658
|
<svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1597
1659
|
<rect width="91" height="71" rx="4" fill="#F2F4F7"/>
|
|
1598
1660
|
<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"/>
|
|
1599
1661
|
</svg>
|
|
1600
|
-
`,
|
|
1662
|
+
`, Ht = `
|
|
1601
1663
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
|
|
1602
1664
|
<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"/>
|
|
1603
1665
|
</svg>
|
|
1604
|
-
`,
|
|
1666
|
+
`, $t = `
|
|
1605
1667
|
<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
|
|
1606
1668
|
<!-- Top dot -->
|
|
1607
1669
|
<circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
|
|
@@ -1621,7 +1683,7 @@ const It = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1621
1683
|
<circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
|
|
1622
1684
|
</svg>
|
|
1623
1685
|
`;
|
|
1624
|
-
class
|
|
1686
|
+
class ct extends x {
|
|
1625
1687
|
constructor(t = {}) {
|
|
1626
1688
|
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();
|
|
1627
1689
|
}
|
|
@@ -1678,11 +1740,11 @@ class rt extends w {
|
|
|
1678
1740
|
<span class="upload-label">Replace</span>
|
|
1679
1741
|
`);
|
|
1680
1742
|
const n = () => {
|
|
1681
|
-
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error",
|
|
1682
|
-
},
|
|
1683
|
-
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",
|
|
1743
|
+
this.hideLoading(), this.previewWrapper.classList.add("has-image"), this.previewEl.style.display = "block", this.previewEl.removeEventListener("load", n), this.previewEl.removeEventListener("error", a);
|
|
1744
|
+
}, a = () => {
|
|
1745
|
+
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", a);
|
|
1684
1746
|
};
|
|
1685
|
-
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error",
|
|
1747
|
+
this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", a), this.previewEl.src = t;
|
|
1686
1748
|
} else
|
|
1687
1749
|
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 = `
|
|
1688
1750
|
<span class="upload-icon">${Y}</span>
|
|
@@ -1693,24 +1755,24 @@ class rt extends w {
|
|
|
1693
1755
|
const t = document.createElement("div");
|
|
1694
1756
|
t.className = "upload-setting-wrapper", t.setAttribute("data-setting-id", this.id), t.addEventListener(
|
|
1695
1757
|
"focusout",
|
|
1696
|
-
(
|
|
1758
|
+
(o) => {
|
|
1697
1759
|
var l;
|
|
1698
|
-
|
|
1760
|
+
o.relatedTarget && t.contains(o.relatedTarget) || (l = this.onBlur) == null || l.call(this, this.value ?? "");
|
|
1699
1761
|
},
|
|
1700
1762
|
!0
|
|
1701
1763
|
);
|
|
1702
1764
|
const e = !!(this.props.title || this.props.icon);
|
|
1703
1765
|
if (e || t.classList.add("no-label"), e) {
|
|
1704
|
-
const
|
|
1705
|
-
if (
|
|
1766
|
+
const o = document.createElement("div");
|
|
1767
|
+
if (o.className = "icon-title-container", this.props.icon) {
|
|
1706
1768
|
const l = this.createIcon(this.props.icon);
|
|
1707
|
-
|
|
1769
|
+
o.appendChild(l);
|
|
1708
1770
|
}
|
|
1709
1771
|
if (this.props.title) {
|
|
1710
1772
|
const l = this.createLabel(this.props.title);
|
|
1711
|
-
|
|
1773
|
+
o.appendChild(l);
|
|
1712
1774
|
}
|
|
1713
|
-
t.appendChild(
|
|
1775
|
+
t.appendChild(o);
|
|
1714
1776
|
}
|
|
1715
1777
|
this.errorContainer = document.createElement("div"), this.errorContainer.className = "error-message", this.errorContainer.style.display = "none", t.appendChild(this.errorContainer);
|
|
1716
1778
|
const i = document.createElement("div");
|
|
@@ -1718,19 +1780,19 @@ class rt extends w {
|
|
|
1718
1780
|
const s = this.value && this.value !== "";
|
|
1719
1781
|
s || i.classList.add("no-image");
|
|
1720
1782
|
const n = document.createElement("div");
|
|
1721
|
-
if (n.className = "preview-placeholder", n.innerHTML =
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1783
|
+
if (n.className = "preview-placeholder", n.innerHTML = Ot, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = $t, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
|
|
1784
|
+
const o = document.createElement("button");
|
|
1785
|
+
o.className = "delete-button", o.type = "button", o.title = "Delete image", o.innerHTML = Ht, this.previewWrapper.appendChild(o), o.onclick = (l) => {
|
|
1724
1786
|
var r;
|
|
1725
1787
|
l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
|
|
1726
1788
|
};
|
|
1727
1789
|
}
|
|
1728
1790
|
this.previewWrapper.appendChild(this.previewEl);
|
|
1729
|
-
const
|
|
1730
|
-
return
|
|
1791
|
+
const a = document.createElement("button");
|
|
1792
|
+
return a.className = "upload-button", this.getDataPropsPath() && a.setAttribute("data-test-id", this.getDataPropsPath()), a.innerHTML = `
|
|
1731
1793
|
<span class="upload-icon">${Y}</span>
|
|
1732
1794
|
<span class="upload-label">Upload</span>
|
|
1733
|
-
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(
|
|
1795
|
+
`, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(a), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), a.onclick = () => {
|
|
1734
1796
|
window.postMessage(
|
|
1735
1797
|
{
|
|
1736
1798
|
type: "OPEN_FILE_MANAGER_MODAL",
|
|
@@ -1741,14 +1803,14 @@ class rt extends w {
|
|
|
1741
1803
|
}, t;
|
|
1742
1804
|
}
|
|
1743
1805
|
}
|
|
1744
|
-
class
|
|
1806
|
+
class ge extends V {
|
|
1745
1807
|
constructor(t = {}) {
|
|
1746
1808
|
super({
|
|
1747
1809
|
...t,
|
|
1748
1810
|
title: t.title || "Height",
|
|
1749
1811
|
suffix: t.suffix || "px",
|
|
1750
1812
|
minValue: t.minValue ?? 0,
|
|
1751
|
-
icon: t.icon ||
|
|
1813
|
+
icon: t.icon || At,
|
|
1752
1814
|
default: t.default ?? 100
|
|
1753
1815
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1754
1816
|
}
|
|
@@ -1759,17 +1821,17 @@ class he extends S {
|
|
|
1759
1821
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1760
1822
|
}
|
|
1761
1823
|
}
|
|
1762
|
-
const
|
|
1824
|
+
const At = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1763
1825
|
<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"/>
|
|
1764
1826
|
</svg>`;
|
|
1765
|
-
class
|
|
1827
|
+
class me extends V {
|
|
1766
1828
|
constructor(t = {}) {
|
|
1767
1829
|
super({
|
|
1768
1830
|
...t,
|
|
1769
1831
|
title: t.title || "Width",
|
|
1770
1832
|
suffix: t.suffix || "px",
|
|
1771
1833
|
minValue: t.minValue ?? 0,
|
|
1772
|
-
icon: t.icon ||
|
|
1834
|
+
icon: t.icon || Bt,
|
|
1773
1835
|
default: t.default ?? 100
|
|
1774
1836
|
}), this.inputType = "number", this.mobileValue = t.mobile;
|
|
1775
1837
|
}
|
|
@@ -1780,14 +1842,14 @@ class pe extends S {
|
|
|
1780
1842
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
1781
1843
|
}
|
|
1782
1844
|
}
|
|
1783
|
-
const
|
|
1845
|
+
const Bt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1784
1846
|
<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"/>
|
|
1785
|
-
</svg>`,
|
|
1847
|
+
</svg>`, Dt = `
|
|
1786
1848
|
<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">
|
|
1787
1849
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1788
1850
|
</svg>
|
|
1789
1851
|
`;
|
|
1790
|
-
class
|
|
1852
|
+
class fe extends x {
|
|
1791
1853
|
constructor(t = {}) {
|
|
1792
1854
|
if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
|
|
1793
1855
|
const e = this._options.findIndex(
|
|
@@ -1814,44 +1876,44 @@ class de extends w {
|
|
|
1814
1876
|
e.classList.add("has-label");
|
|
1815
1877
|
const n = document.createElement("div");
|
|
1816
1878
|
n.className = "select-label", n.textContent = this.props.title, e.appendChild(n);
|
|
1817
|
-
const
|
|
1818
|
-
if (
|
|
1819
|
-
|
|
1879
|
+
const a = document.createElement("span");
|
|
1880
|
+
if (a.className = "select-value", this.isLoading)
|
|
1881
|
+
a.textContent = this.props.loadingText || "Loading options...";
|
|
1820
1882
|
else {
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1883
|
+
const o = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, l = o && typeof o.name == "string" ? o.name : "Select an option";
|
|
1884
|
+
a.textContent = l;
|
|
1823
1885
|
}
|
|
1824
|
-
e.appendChild(
|
|
1886
|
+
e.appendChild(a);
|
|
1825
1887
|
} else {
|
|
1826
1888
|
const n = document.createElement("span");
|
|
1827
1889
|
if (this.isLoading)
|
|
1828
1890
|
n.textContent = this.props.loadingText || "Loading options...";
|
|
1829
1891
|
else {
|
|
1830
|
-
const
|
|
1831
|
-
n.textContent =
|
|
1892
|
+
const a = this.selectedOptionIndex !== null && this._options && this.selectedOptionIndex >= 0 && this.selectedOptionIndex < this._options.length ? this._options[this.selectedOptionIndex] : null, o = a && typeof a.name == "string" ? a.name : "Select an option";
|
|
1893
|
+
n.textContent = o;
|
|
1832
1894
|
}
|
|
1833
1895
|
e.appendChild(n);
|
|
1834
1896
|
}
|
|
1835
1897
|
e.onclick = () => {
|
|
1836
|
-
var n,
|
|
1837
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1898
|
+
var n, a;
|
|
1899
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
1838
1900
|
}, t.appendChild(e), this.buttonEl = e;
|
|
1839
1901
|
const i = document.createElement("ul");
|
|
1840
|
-
i.classList.add("select-api-options"), this._options.forEach((n,
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1902
|
+
i.classList.add("select-api-options"), this._options.forEach((n, a) => {
|
|
1903
|
+
const o = this.createOption(n, a);
|
|
1904
|
+
o.onclick = (l) => this.selectApiOption(l, a, e), i.appendChild(o);
|
|
1843
1905
|
}), t.appendChild(i);
|
|
1844
1906
|
const s = document.createElement("div");
|
|
1845
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
1846
|
-
var n,
|
|
1847
|
-
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (
|
|
1907
|
+
return s.classList.add("svg-container"), s.innerHTML = Dt, t.appendChild(s), s.onclick = () => {
|
|
1908
|
+
var n, a;
|
|
1909
|
+
this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (a = this.svgContainer) == null || a.classList.toggle("open", this.isOpen));
|
|
1848
1910
|
}, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1849
|
-
const
|
|
1911
|
+
const a = new Set(
|
|
1850
1912
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1851
|
-
),
|
|
1852
|
-
(l) => !
|
|
1913
|
+
), o = n.filter(
|
|
1914
|
+
(l) => !a.has(JSON.stringify(l.value))
|
|
1853
1915
|
);
|
|
1854
|
-
if (this._options.push(...
|
|
1916
|
+
if (this._options.push(...o), this.isLoading = !1, this.hasInitializedOptions = !0, this.value !== void 0) {
|
|
1855
1917
|
const l = this._options.findIndex(
|
|
1856
1918
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1857
1919
|
);
|
|
@@ -1865,12 +1927,12 @@ class de extends w {
|
|
|
1865
1927
|
!0
|
|
1866
1928
|
);
|
|
1867
1929
|
})) : this.props.getOptionsAsync && this._options.length <= 1 && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
1868
|
-
const
|
|
1930
|
+
const a = new Set(
|
|
1869
1931
|
this._options.map((l) => JSON.stringify(l.value))
|
|
1870
|
-
),
|
|
1871
|
-
(l) => !
|
|
1932
|
+
), o = n.filter(
|
|
1933
|
+
(l) => !a.has(JSON.stringify(l.value))
|
|
1872
1934
|
);
|
|
1873
|
-
if (this._options.push(...
|
|
1935
|
+
if (this._options.push(...o), this.isLoading = !1, this.value !== void 0) {
|
|
1874
1936
|
const l = this._options.findIndex(
|
|
1875
1937
|
(r) => JSON.stringify(r.value) === JSON.stringify(this.value)
|
|
1876
1938
|
);
|
|
@@ -1889,11 +1951,11 @@ class de extends w {
|
|
|
1889
1951
|
return JSON.stringify(t ? {} : { value: this.value }, null, 2);
|
|
1890
1952
|
}
|
|
1891
1953
|
selectApiOption(t, e, i) {
|
|
1892
|
-
var
|
|
1893
|
-
const s = t.target, n = s.querySelector(".select-api-radio") || ((
|
|
1954
|
+
var o, l, r;
|
|
1955
|
+
const s = t.target, n = s.querySelector(".select-api-radio") || ((o = s.closest(".select-api-option")) == null ? void 0 : o.querySelector(".select-api-radio"));
|
|
1894
1956
|
n && (n.checked = !0);
|
|
1895
|
-
const
|
|
1896
|
-
this.setValue(
|
|
1957
|
+
const a = this._options[e].value;
|
|
1958
|
+
this.setValue(a), this.isOpen = !1, (l = this.optionsListEl) == null || l.classList.remove("open"), (r = this.svgContainer) == null || r.classList.remove("open");
|
|
1897
1959
|
}
|
|
1898
1960
|
updateOptionsList() {
|
|
1899
1961
|
!this.optionsListEl || !this.buttonEl || (this.optionsListEl.innerHTML = "", this._options.forEach((t, e) => {
|
|
@@ -1936,13 +1998,13 @@ class de extends w {
|
|
|
1936
1998
|
), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
|
|
1937
1999
|
}
|
|
1938
2000
|
}
|
|
1939
|
-
class
|
|
2001
|
+
class ve extends x {
|
|
1940
2002
|
constructor(t) {
|
|
1941
2003
|
var e, i;
|
|
1942
2004
|
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;
|
|
1943
2005
|
}
|
|
1944
2006
|
draw() {
|
|
1945
|
-
var
|
|
2007
|
+
var a, o;
|
|
1946
2008
|
const t = document.createElement("div");
|
|
1947
2009
|
t.className = "toggle-setting-container", this.props.icon && t.classList.add("toggle-with-icon");
|
|
1948
2010
|
const e = document.createElement("div");
|
|
@@ -1958,20 +2020,20 @@ class ue extends w {
|
|
|
1958
2020
|
const i = document.createElement("label");
|
|
1959
2021
|
i.className = "toggle-switch";
|
|
1960
2022
|
const s = document.createElement("input");
|
|
1961
|
-
s.type = "checkbox", s.checked = ((
|
|
1962
|
-
var r,
|
|
1963
|
-
const l = ((
|
|
2023
|
+
s.type = "checkbox", s.checked = ((o = (a = this.props.options) == null ? void 0 : a.find((l) => l.value === this.value)) == null ? void 0 : o.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
|
|
2024
|
+
var r, p;
|
|
2025
|
+
const l = ((p = (r = this.props.options) == null ? void 0 : r.find((c) => c.status === s.checked)) == null ? void 0 : p.value) ?? "";
|
|
1964
2026
|
this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
|
|
1965
2027
|
});
|
|
1966
2028
|
const n = document.createElement("span");
|
|
1967
2029
|
if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
|
|
1968
|
-
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50",
|
|
2030
|
+
const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", p = this.props.inactiveColor || "#ccc";
|
|
1969
2031
|
l.textContent = `
|
|
1970
2032
|
.toggle-switch input:checked + .toggle-slider {
|
|
1971
2033
|
background-color: ${r};
|
|
1972
2034
|
}
|
|
1973
2035
|
.toggle-switch .toggle-slider {
|
|
1974
|
-
background-color: ${
|
|
2036
|
+
background-color: ${p};
|
|
1975
2037
|
}
|
|
1976
2038
|
`, document.head.appendChild(l);
|
|
1977
2039
|
}
|
|
@@ -1986,13 +2048,13 @@ class ue extends w {
|
|
|
1986
2048
|
this.detectChangeCallback = t;
|
|
1987
2049
|
}
|
|
1988
2050
|
}
|
|
1989
|
-
const
|
|
2051
|
+
const Rt = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1990
2052
|
<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"/>
|
|
1991
2053
|
</svg>`;
|
|
1992
|
-
class
|
|
2054
|
+
class Ce extends x {
|
|
1993
2055
|
// Store mobile value
|
|
1994
2056
|
constructor(t = {}) {
|
|
1995
|
-
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ??
|
|
2057
|
+
t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Rt, 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);
|
|
1996
2058
|
}
|
|
1997
2059
|
draw() {
|
|
1998
2060
|
const t = document.createElement("div");
|
|
@@ -2003,27 +2065,27 @@ class ge extends w {
|
|
|
2003
2065
|
i.className = "setting-label", i.setAttribute("for", this.id + "-input");
|
|
2004
2066
|
const s = document.createElement("span");
|
|
2005
2067
|
if (s.textContent = this.props.title ?? "Gap", i.appendChild(s), this.props.icon) {
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2068
|
+
const o = document.createElement("span");
|
|
2069
|
+
o.className = "setting-icon", o.innerHTML = this.props.icon, i.insertBefore(o, s);
|
|
2008
2070
|
}
|
|
2009
2071
|
const n = document.createElement("div");
|
|
2010
2072
|
n.className = `setting-input-wrapper ${this.props.wrapperClassName || ""}`, n.classList.add("gap-setting-wrapper");
|
|
2011
|
-
const
|
|
2012
|
-
return
|
|
2073
|
+
const a = document.createElement("div");
|
|
2074
|
+
return a.className = "gap-inputs-container", this.props.rowGap && a.appendChild(this.createGapInput("row", "Row")), this.props.columnGap && a.appendChild(this.createGapInput("column", "Col")), n.appendChild(a), e.appendChild(i), e.appendChild(n), t.appendChild(e), t;
|
|
2013
2075
|
}
|
|
2014
2076
|
createGapInput(t, e) {
|
|
2015
2077
|
const i = document.createElement("div");
|
|
2016
2078
|
i.className = "gap-input-wrapper";
|
|
2017
2079
|
const s = document.createElement("input");
|
|
2018
2080
|
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) => {
|
|
2019
|
-
const
|
|
2020
|
-
let
|
|
2021
|
-
|
|
2081
|
+
const a = n.target;
|
|
2082
|
+
let o = parseFloat(a.value);
|
|
2083
|
+
o = this.validateValue(o), String(o) !== a.value && (a.value = String(o)), this.inputValues[t] = o, this.setValue(o);
|
|
2022
2084
|
}), s.addEventListener("blur", (n) => {
|
|
2023
2085
|
var l, r;
|
|
2024
|
-
const
|
|
2025
|
-
let
|
|
2026
|
-
|
|
2086
|
+
const a = n.target;
|
|
2087
|
+
let o = parseFloat(a.value);
|
|
2088
|
+
o = this.validateValue(o), String(o) !== a.value && (a.value = String(o), this.inputValues[t] = o, this.setValue(o)), (r = (l = this.props).onBlur) == null || r.call(l);
|
|
2027
2089
|
}), i.appendChild(s), this.props.suffix && this.props.suffix !== "none") {
|
|
2028
2090
|
const n = document.createElement("span");
|
|
2029
2091
|
n.className = "gap-suffix", n.textContent = this.props.suffix, i.appendChild(n), s.style.paddingRight = "30px";
|
|
@@ -2043,42 +2105,42 @@ class ge extends w {
|
|
|
2043
2105
|
this.mobileValue = t, t !== void 0 && this.setValue(t);
|
|
2044
2106
|
}
|
|
2045
2107
|
}
|
|
2046
|
-
const
|
|
2108
|
+
const Gt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2047
2109
|
<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"/>
|
|
2048
2110
|
</svg>`;
|
|
2049
|
-
class
|
|
2111
|
+
class ye extends V {
|
|
2050
2112
|
constructor(t = {}) {
|
|
2051
2113
|
super({
|
|
2052
2114
|
...t,
|
|
2053
2115
|
minValue: t.minValue ?? 0,
|
|
2054
2116
|
maxValue: t.maxValue ?? 1e3,
|
|
2055
|
-
icon: t.icon ||
|
|
2117
|
+
icon: t.icon || Gt,
|
|
2056
2118
|
title: t.title || "Margin Bottom",
|
|
2057
2119
|
default: t.default ?? 20,
|
|
2058
2120
|
wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
|
|
2059
2121
|
}), this.inputType = "number";
|
|
2060
2122
|
}
|
|
2061
2123
|
}
|
|
2062
|
-
const
|
|
2124
|
+
const Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
2063
2125
|
<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"
|
|
2064
2126
|
stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2065
2127
|
</svg>`;
|
|
2066
|
-
class
|
|
2128
|
+
class be extends V {
|
|
2067
2129
|
constructor(t = {}) {
|
|
2068
2130
|
super({
|
|
2069
2131
|
...t,
|
|
2070
2132
|
minValue: t.minValue ?? 0,
|
|
2071
2133
|
maxValue: t.maxValue ?? 1e3,
|
|
2072
|
-
icon: t.icon ||
|
|
2134
|
+
icon: t.icon || Ft,
|
|
2073
2135
|
title: t.title || "Margin Top",
|
|
2074
2136
|
default: t.default ?? 20,
|
|
2075
2137
|
wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
|
|
2076
2138
|
}), this.inputType = "number";
|
|
2077
2139
|
}
|
|
2078
2140
|
}
|
|
2079
|
-
class
|
|
2141
|
+
class Ee extends x {
|
|
2080
2142
|
constructor(t) {
|
|
2081
|
-
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(
|
|
2143
|
+
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];
|
|
2082
2144
|
const e = t.defaultValue || `Enter text in ${this.capitalizeFirstLetter(this.defaultLanguage)}`;
|
|
2083
2145
|
t.languages.forEach((i) => {
|
|
2084
2146
|
var s, n;
|
|
@@ -2096,9 +2158,9 @@ class ve extends w {
|
|
|
2096
2158
|
return i.font = s, i.measureText(t).width;
|
|
2097
2159
|
}
|
|
2098
2160
|
adaptPlaceholderToSingleLine(t, e) {
|
|
2099
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0,
|
|
2161
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.paddingLeft) || 0, n = parseFloat(i.paddingRight) || 0, a = parseFloat(i.borderLeftWidth) || 0, o = parseFloat(i.borderRightWidth) || 0, l = Math.max(
|
|
2100
2162
|
0,
|
|
2101
|
-
t.clientWidth - s - n -
|
|
2163
|
+
t.clientWidth - s - n - a - o
|
|
2102
2164
|
);
|
|
2103
2165
|
if (l <= 0) {
|
|
2104
2166
|
t.placeholder = e;
|
|
@@ -2108,50 +2170,50 @@ class ve extends w {
|
|
|
2108
2170
|
t.placeholder = e;
|
|
2109
2171
|
return;
|
|
2110
2172
|
}
|
|
2111
|
-
const
|
|
2112
|
-
let
|
|
2113
|
-
for (;
|
|
2114
|
-
const f = Math.floor((
|
|
2115
|
-
this.measureTextWidth(
|
|
2173
|
+
const p = "...";
|
|
2174
|
+
let c = 0, d = e.length, u = 0;
|
|
2175
|
+
for (; c <= d; ) {
|
|
2176
|
+
const f = Math.floor((c + d) / 2), m = e.slice(0, f).trimEnd() + p;
|
|
2177
|
+
this.measureTextWidth(m, i) <= l ? (u = f, c = f + 1) : d = f - 1;
|
|
2116
2178
|
}
|
|
2117
|
-
const
|
|
2118
|
-
t.placeholder =
|
|
2179
|
+
const g = e.slice(0, u).trimEnd() + p;
|
|
2180
|
+
t.placeholder = g;
|
|
2119
2181
|
}
|
|
2120
2182
|
autosizeTextarea(t, e = 3) {
|
|
2121
2183
|
t.style.height = "auto";
|
|
2122
|
-
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom),
|
|
2123
|
-
t.style.height = `${l}px`, t.scrollHeight >
|
|
2184
|
+
const i = window.getComputedStyle(t), s = parseFloat(i.lineHeight) || 20, n = parseFloat(i.paddingTop) + parseFloat(i.paddingBottom), a = parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth), o = s * e + n + a, l = Math.min(t.scrollHeight || 44, o);
|
|
2185
|
+
t.style.height = `${l}px`, t.scrollHeight > o ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
2124
2186
|
}
|
|
2125
2187
|
createTextareaRow(t, e) {
|
|
2126
2188
|
const i = document.createElement("div");
|
|
2127
2189
|
i.classList.add("simple-multi-language-row");
|
|
2128
2190
|
const s = document.createElement("label");
|
|
2129
2191
|
if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
|
|
2130
|
-
const n = new
|
|
2192
|
+
const n = new ct({
|
|
2131
2193
|
defaultUrl: e || "",
|
|
2132
2194
|
title: "",
|
|
2133
2195
|
id: `${this.id}_upload_${t}`
|
|
2134
2196
|
});
|
|
2135
|
-
n.setOnChange((
|
|
2136
|
-
this.updateLanguageValue(t,
|
|
2197
|
+
n.setOnChange((o) => {
|
|
2198
|
+
this.updateLanguageValue(t, o), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(o);
|
|
2137
2199
|
}), this.uploadSettings.set(t, n);
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2200
|
+
const a = n.draw();
|
|
2201
|
+
a.classList.add("simple-language-upload"), i.appendChild(a);
|
|
2140
2202
|
} else {
|
|
2141
2203
|
const n = document.createElement("textarea");
|
|
2142
2204
|
n.id = `textarea-${t}`, n.classList.add("simple-language-textarea"), n.value = e || "", n.rows = 1, n.style.overflowY = "hidden";
|
|
2143
|
-
let
|
|
2144
|
-
|
|
2205
|
+
let a = this.props.placeholder || "Enter text in {language}...";
|
|
2206
|
+
a.includes("{language}") && (a = a.replace(
|
|
2145
2207
|
"{language}",
|
|
2146
2208
|
t.toUpperCase()
|
|
2147
|
-
)), n.setAttribute("data-full-placeholder",
|
|
2209
|
+
)), n.setAttribute("data-full-placeholder", a), this.adaptPlaceholderToSingleLine(n, a), this.getDataPropsPath() && n.setAttribute(
|
|
2148
2210
|
"data-test-id",
|
|
2149
2211
|
`${this.getDataPropsPath()}_${t}`
|
|
2150
2212
|
), n.addEventListener("input", (l) => {
|
|
2151
2213
|
const r = l.target;
|
|
2152
2214
|
this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2215
|
+
const p = n.getAttribute("data-full-placeholder") || "";
|
|
2216
|
+
p && this.adaptPlaceholderToSingleLine(n, p);
|
|
2155
2217
|
}), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
|
|
2156
2218
|
this.autosizeTextarea(n, 3);
|
|
2157
2219
|
const l = n.getAttribute("data-full-placeholder") || "";
|
|
@@ -2173,11 +2235,11 @@ class ve extends w {
|
|
|
2173
2235
|
`#textarea-${e}`
|
|
2174
2236
|
);
|
|
2175
2237
|
if (i && (!i.value || i.value.trim() === "")) {
|
|
2176
|
-
const
|
|
2238
|
+
const a = t || ((n = this.props.placeholder) == null ? void 0 : n.replace(
|
|
2177
2239
|
"{language}",
|
|
2178
2240
|
e.toUpperCase()
|
|
2179
2241
|
)) || `Enter text in ${e.toUpperCase()}...`;
|
|
2180
|
-
i.setAttribute("data-full-placeholder",
|
|
2242
|
+
i.setAttribute("data-full-placeholder", a), this.adaptPlaceholderToSingleLine(i, a);
|
|
2181
2243
|
}
|
|
2182
2244
|
});
|
|
2183
2245
|
}
|
|
@@ -2189,17 +2251,17 @@ class ve extends w {
|
|
|
2189
2251
|
}
|
|
2190
2252
|
const e = document.createElement("div");
|
|
2191
2253
|
e.classList.add("simple-multi-language-content"), this.props.languages.forEach((s) => {
|
|
2192
|
-
var
|
|
2193
|
-
const n = ((
|
|
2194
|
-
e.appendChild(
|
|
2254
|
+
var o;
|
|
2255
|
+
const n = ((o = this.value) == null ? void 0 : o[s]) || "", a = this.createTextareaRow(s, n);
|
|
2256
|
+
e.appendChild(a);
|
|
2195
2257
|
}), t.appendChild(e), this.container = t;
|
|
2196
2258
|
const i = () => {
|
|
2197
2259
|
if (!this.container) return;
|
|
2198
2260
|
this.container.querySelectorAll(
|
|
2199
2261
|
".simple-language-textarea"
|
|
2200
2262
|
).forEach((n) => {
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2263
|
+
const a = n.getAttribute("data-full-placeholder") || "";
|
|
2264
|
+
a && this.adaptPlaceholderToSingleLine(n, a);
|
|
2203
2265
|
});
|
|
2204
2266
|
};
|
|
2205
2267
|
return window.addEventListener("resize", i), t;
|
|
@@ -2223,7 +2285,7 @@ class ve extends w {
|
|
|
2223
2285
|
});
|
|
2224
2286
|
}
|
|
2225
2287
|
}
|
|
2226
|
-
class
|
|
2288
|
+
class we extends x {
|
|
2227
2289
|
constructor(t = {}) {
|
|
2228
2290
|
super(t), this.inputType = "select";
|
|
2229
2291
|
const e = [
|
|
@@ -2250,97 +2312,97 @@ class Ce extends w {
|
|
|
2250
2312
|
this.selectSetting.destroy(), super.destroy();
|
|
2251
2313
|
}
|
|
2252
2314
|
}
|
|
2253
|
-
const
|
|
2254
|
-
let i = !1, s = 0, n = 0,
|
|
2255
|
-
const l = (
|
|
2256
|
-
if (
|
|
2257
|
-
i = !0, s =
|
|
2315
|
+
const ht = (h, t, e) => {
|
|
2316
|
+
let i = !1, s = 0, n = 0, a = 0, o = 0;
|
|
2317
|
+
const l = (c) => {
|
|
2318
|
+
if (c.target.closest("button")) return;
|
|
2319
|
+
i = !0, s = c.clientX, n = c.clientY;
|
|
2258
2320
|
const d = t.getBoundingClientRect();
|
|
2259
|
-
|
|
2260
|
-
}, r = (
|
|
2321
|
+
a = d.left, o = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", p), document.body.style.userSelect = "none";
|
|
2322
|
+
}, r = (c) => {
|
|
2261
2323
|
if (!i) return;
|
|
2262
|
-
const d =
|
|
2263
|
-
let
|
|
2264
|
-
|
|
2265
|
-
},
|
|
2266
|
-
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup",
|
|
2324
|
+
const d = c.clientX - s, u = c.clientY - n, g = window.innerWidth, f = window.innerHeight, m = t.offsetWidth, v = t.offsetHeight;
|
|
2325
|
+
let C = a + d, w = o + u;
|
|
2326
|
+
C = Math.max(8, Math.min(g - m - 8, C)), w = Math.max(8, Math.min(f - v - 8, w)), t.style.left = `${C}px`, t.style.top = `${w}px`, e == null || e(C, w);
|
|
2327
|
+
}, p = () => {
|
|
2328
|
+
i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", p), document.body.style.userSelect = "";
|
|
2267
2329
|
};
|
|
2268
|
-
|
|
2269
|
-
},
|
|
2270
|
-
if (!
|
|
2271
|
-
let t =
|
|
2330
|
+
h.addEventListener("mousedown", l);
|
|
2331
|
+
}, W = (h) => {
|
|
2332
|
+
if (!h) return null;
|
|
2333
|
+
let t = h.trim();
|
|
2272
2334
|
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()}`;
|
|
2273
|
-
},
|
|
2274
|
-
const t =
|
|
2335
|
+
}, _ = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, S = (h) => {
|
|
2336
|
+
const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
|
|
2275
2337
|
return {
|
|
2276
2338
|
r: parseInt(e.slice(0, 2), 16),
|
|
2277
2339
|
g: parseInt(e.slice(2, 4), 16),
|
|
2278
2340
|
b: parseInt(e.slice(4, 6), 16)
|
|
2279
2341
|
};
|
|
2280
|
-
},
|
|
2281
|
-
const { r: t, g: e, b: i } =
|
|
2282
|
-
let
|
|
2283
|
-
r !== 0 && (
|
|
2284
|
-
const
|
|
2285
|
-
return { h:
|
|
2286
|
-
},
|
|
2287
|
-
const i = (
|
|
2288
|
-
let
|
|
2289
|
-
return i < 60 ? (
|
|
2290
|
-
Math.round((
|
|
2291
|
-
Math.round((l +
|
|
2292
|
-
Math.round((r +
|
|
2342
|
+
}, G = (h) => {
|
|
2343
|
+
const { r: t, g: e, b: i } = S(h), s = t / 255, n = e / 255, a = i / 255, o = Math.max(s, n, a), l = Math.min(s, n, a), r = o - l;
|
|
2344
|
+
let p = 0;
|
|
2345
|
+
r !== 0 && (o === s ? p = (n - a) / r % 6 : o === n ? p = (a - s) / r + 2 : p = (s - n) / r + 4), p < 0 && (p += 6);
|
|
2346
|
+
const c = o === 0 ? 0 : r / o, d = o;
|
|
2347
|
+
return { h: p * 60, s: c, v: d };
|
|
2348
|
+
}, F = (h, t, e) => {
|
|
2349
|
+
const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), a = e - s;
|
|
2350
|
+
let o = 0, l = 0, r = 0;
|
|
2351
|
+
return i < 60 ? (o = s, l = n, r = 0) : i < 120 ? (o = n, l = s, r = 0) : i < 180 ? (o = 0, l = s, r = n) : i < 240 ? (o = 0, l = n, r = s) : i < 300 ? (o = n, l = 0, r = s) : (o = s, l = 0, r = n), _(
|
|
2352
|
+
Math.round((o + a) * 255),
|
|
2353
|
+
Math.round((l + a) * 255),
|
|
2354
|
+
Math.round((r + a) * 255)
|
|
2293
2355
|
);
|
|
2294
|
-
},
|
|
2356
|
+
}, dt = (h, t, e) => {
|
|
2295
2357
|
const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
|
|
2296
|
-
return { hue:
|
|
2297
|
-
},
|
|
2298
|
-
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(
|
|
2299
|
-
let
|
|
2300
|
-
return
|
|
2301
|
-
r: Math.round((
|
|
2302
|
-
g: Math.round((
|
|
2358
|
+
return { hue: h, sat: s, lightness: i };
|
|
2359
|
+
}, et = (h, t, e) => {
|
|
2360
|
+
const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
|
|
2361
|
+
let a = 0, o = 0, l = 0;
|
|
2362
|
+
return h < 60 ? (a = i, o = s, l = 0) : h < 120 ? (a = s, o = i, l = 0) : h < 180 ? (a = 0, o = i, l = s) : h < 240 ? (a = 0, o = s, l = i) : h < 300 ? (a = s, o = 0, l = i) : (a = i, o = 0, l = s), {
|
|
2363
|
+
r: Math.round((a + n) * 255),
|
|
2364
|
+
g: Math.round((o + n) * 255),
|
|
2303
2365
|
b: Math.round((l + n) * 255)
|
|
2304
2366
|
};
|
|
2305
|
-
},
|
|
2367
|
+
}, pt = (h, t) => {
|
|
2306
2368
|
const e = Math.max(0, Math.min(100, t)) / 100;
|
|
2307
|
-
if (
|
|
2308
|
-
const { r: s, g: n, b:
|
|
2309
|
-
return `rgba(${s}, ${n}, ${
|
|
2310
|
-
}
|
|
2311
|
-
if (
|
|
2312
|
-
return
|
|
2313
|
-
if (
|
|
2314
|
-
return
|
|
2315
|
-
if (
|
|
2316
|
-
const s =
|
|
2369
|
+
if (h.startsWith("#")) {
|
|
2370
|
+
const { r: s, g: n, b: a } = S(h);
|
|
2371
|
+
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
2372
|
+
}
|
|
2373
|
+
if (h.startsWith("rgba("))
|
|
2374
|
+
return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
|
|
2375
|
+
if (h.startsWith("rgb("))
|
|
2376
|
+
return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
|
|
2377
|
+
if (h.startsWith("hsl(")) {
|
|
2378
|
+
const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2317
2379
|
if (s) {
|
|
2318
|
-
const { r: n, g:
|
|
2380
|
+
const { r: n, g: a, b: o } = et(
|
|
2319
2381
|
parseInt(s[1]),
|
|
2320
2382
|
parseInt(s[2]) / 100,
|
|
2321
2383
|
parseInt(s[3]) / 100
|
|
2322
2384
|
);
|
|
2323
|
-
return `rgba(${n}, ${
|
|
2385
|
+
return `rgba(${n}, ${a}, ${o}, ${e})`;
|
|
2324
2386
|
}
|
|
2325
2387
|
}
|
|
2326
|
-
if (
|
|
2327
|
-
const s =
|
|
2388
|
+
if (h.startsWith("hsla(")) {
|
|
2389
|
+
const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
|
|
2328
2390
|
if (s) {
|
|
2329
|
-
const { r: n, g:
|
|
2391
|
+
const { r: n, g: a, b: o } = et(
|
|
2330
2392
|
parseInt(s[1]),
|
|
2331
2393
|
parseInt(s[2]) / 100,
|
|
2332
2394
|
parseInt(s[3]) / 100
|
|
2333
2395
|
);
|
|
2334
|
-
return `rgba(${n}, ${
|
|
2396
|
+
return `rgba(${n}, ${a}, ${o}, ${e})`;
|
|
2335
2397
|
}
|
|
2336
2398
|
}
|
|
2337
|
-
const i =
|
|
2399
|
+
const i = W(h);
|
|
2338
2400
|
if (i) {
|
|
2339
|
-
const { r: s, g: n, b:
|
|
2340
|
-
return `rgba(${s}, ${n}, ${
|
|
2401
|
+
const { r: s, g: n, b: a } = S(i);
|
|
2402
|
+
return `rgba(${s}, ${n}, ${a}, ${e})`;
|
|
2341
2403
|
}
|
|
2342
|
-
return
|
|
2343
|
-
},
|
|
2404
|
+
return h;
|
|
2405
|
+
}, Wt = (h) => [
|
|
2344
2406
|
"red",
|
|
2345
2407
|
"green",
|
|
2346
2408
|
"blue",
|
|
@@ -2364,22 +2426,22 @@ const ct = (c, t, e) => {
|
|
|
2364
2426
|
"teal",
|
|
2365
2427
|
"fuchsia",
|
|
2366
2428
|
"transparent"
|
|
2367
|
-
].includes(
|
|
2429
|
+
].includes(h.toLowerCase()), ut = (h) => [
|
|
2368
2430
|
/^#[0-9a-fA-F]{3,8}$/,
|
|
2369
2431
|
/^rgba?\s*\([^)]+\)$/,
|
|
2370
2432
|
/^hsla?\s*\([^)]+\)$/,
|
|
2371
2433
|
/^[a-zA-Z]+$/
|
|
2372
|
-
].some((e) => e.test(
|
|
2434
|
+
].some((e) => e.test(h.trim())), Ut = (h) => {
|
|
2373
2435
|
if (typeof document > "u")
|
|
2374
|
-
return
|
|
2436
|
+
return ut(h) || !!W(h);
|
|
2375
2437
|
const t = document.createElement("div");
|
|
2376
|
-
return t.style.color =
|
|
2377
|
-
},
|
|
2378
|
-
const t =
|
|
2438
|
+
return t.style.color = h, t.style.color !== "";
|
|
2439
|
+
}, gt = (h) => {
|
|
2440
|
+
const t = h.trim();
|
|
2379
2441
|
if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
|
|
2380
|
-
const n = t.slice(1),
|
|
2442
|
+
const n = t.slice(1), a = parseInt(n.slice(0, 2), 16), o = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
|
|
2381
2443
|
return {
|
|
2382
|
-
color:
|
|
2444
|
+
color: _(a, o, l),
|
|
2383
2445
|
position: 0,
|
|
2384
2446
|
opacity: Math.round(r / 255 * 100)
|
|
2385
2447
|
};
|
|
@@ -2388,9 +2450,9 @@ const ct = (c, t, e) => {
|
|
|
2388
2450
|
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2389
2451
|
);
|
|
2390
2452
|
if (e) {
|
|
2391
|
-
const n = parseInt(e[1]),
|
|
2453
|
+
const n = parseInt(e[1]), a = parseInt(e[2]), o = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
|
|
2392
2454
|
return {
|
|
2393
|
-
color:
|
|
2455
|
+
color: _(n, a, o),
|
|
2394
2456
|
position: 0,
|
|
2395
2457
|
opacity: Math.round(l * 100)
|
|
2396
2458
|
};
|
|
@@ -2399,23 +2461,23 @@ const ct = (c, t, e) => {
|
|
|
2399
2461
|
/hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
|
|
2400
2462
|
);
|
|
2401
2463
|
if (i) {
|
|
2402
|
-
const { r: n, g:
|
|
2464
|
+
const { r: n, g: a, b: o } = et(
|
|
2403
2465
|
parseFloat(i[1]),
|
|
2404
2466
|
parseFloat(i[2]) / 100,
|
|
2405
2467
|
parseFloat(i[3]) / 100
|
|
2406
2468
|
), l = i[4] ? parseFloat(i[4]) : 1;
|
|
2407
2469
|
return {
|
|
2408
|
-
color:
|
|
2470
|
+
color: _(n, a, o),
|
|
2409
2471
|
position: 0,
|
|
2410
2472
|
opacity: Math.round(l * 100)
|
|
2411
2473
|
};
|
|
2412
2474
|
}
|
|
2413
|
-
return { color:
|
|
2414
|
-
},
|
|
2475
|
+
return { color: W(t) || t, position: 0, opacity: 100 };
|
|
2476
|
+
}, ot = (h) => {
|
|
2415
2477
|
const t = [];
|
|
2416
2478
|
let e = "", i = 0;
|
|
2417
|
-
for (let s = 0; s <
|
|
2418
|
-
const n =
|
|
2479
|
+
for (let s = 0; s < h.length; s++) {
|
|
2480
|
+
const n = h[s];
|
|
2419
2481
|
if (n === "(") i++;
|
|
2420
2482
|
else if (n === ")") i--;
|
|
2421
2483
|
else if (n === "," && i === 0) {
|
|
@@ -2425,16 +2487,16 @@ const ct = (c, t, e) => {
|
|
|
2425
2487
|
e += n;
|
|
2426
2488
|
}
|
|
2427
2489
|
return e.trim() && t.push(e.trim()), t;
|
|
2428
|
-
},
|
|
2429
|
-
const e = new RegExp(`${t}\\s*\\(`, "i"), i =
|
|
2490
|
+
}, at = (h, t) => {
|
|
2491
|
+
const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
|
|
2430
2492
|
if (!i) return null;
|
|
2431
2493
|
const s = i.index + i[0].length;
|
|
2432
|
-
let n = 1,
|
|
2433
|
-
for (let
|
|
2434
|
-
|
|
2435
|
-
return n === 0 ?
|
|
2436
|
-
},
|
|
2437
|
-
const t =
|
|
2494
|
+
let n = 1, a = s;
|
|
2495
|
+
for (let o = s; o < h.length && n > 0; o++)
|
|
2496
|
+
h[o] === "(" ? n++ : h[o] === ")" && n--, a = o;
|
|
2497
|
+
return n === 0 ? h.substring(s, a) : null;
|
|
2498
|
+
}, zt = (h) => {
|
|
2499
|
+
const t = h.split(" ")[0].toLowerCase();
|
|
2438
2500
|
return [
|
|
2439
2501
|
"circle",
|
|
2440
2502
|
"ellipse",
|
|
@@ -2445,44 +2507,44 @@ const ct = (c, t, e) => {
|
|
|
2445
2507
|
"at",
|
|
2446
2508
|
"contain",
|
|
2447
2509
|
"cover"
|
|
2448
|
-
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(
|
|
2449
|
-
},
|
|
2510
|
+
].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Wt(t);
|
|
2511
|
+
}, lt = (h) => {
|
|
2450
2512
|
const t = [];
|
|
2451
|
-
return
|
|
2513
|
+
return h.forEach((e, i) => {
|
|
2452
2514
|
const s = e.trim();
|
|
2453
2515
|
if (!s) return;
|
|
2454
|
-
let n = "",
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
const l =
|
|
2458
|
-
l.position = Math.max(0, Math.min(100, Math.round(
|
|
2516
|
+
let n = "", a = 0;
|
|
2517
|
+
const o = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
|
|
2518
|
+
o && ut(o[1].trim()) ? (n = o[1].trim(), a = parseFloat(o[2])) : (n = s, a = h.length === 1 ? 0 : i / (h.length - 1) * 100);
|
|
2519
|
+
const l = gt(n);
|
|
2520
|
+
l.position = Math.max(0, Math.min(100, Math.round(a))), t.push(l);
|
|
2459
2521
|
}), t;
|
|
2460
|
-
},
|
|
2461
|
-
const t =
|
|
2522
|
+
}, O = (h) => {
|
|
2523
|
+
const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
|
|
2462
2524
|
return {
|
|
2463
|
-
type:
|
|
2464
|
-
angle: typeof
|
|
2525
|
+
type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
|
|
2526
|
+
angle: typeof h.angle == "number" ? h.angle : 90,
|
|
2465
2527
|
stops: t.map((e, i) => ({
|
|
2466
2528
|
color: e.color || "#000000",
|
|
2467
2529
|
position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
|
|
2468
2530
|
opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
|
|
2469
2531
|
}))
|
|
2470
2532
|
};
|
|
2471
|
-
},
|
|
2472
|
-
const t =
|
|
2533
|
+
}, I = (h) => {
|
|
2534
|
+
const t = h.replace(/;$/, "").trim();
|
|
2473
2535
|
if (Ut(t)) {
|
|
2474
|
-
const s =
|
|
2475
|
-
return
|
|
2536
|
+
const s = gt(t);
|
|
2537
|
+
return O({ type: "solid", angle: 0, stops: [s] });
|
|
2476
2538
|
}
|
|
2477
|
-
const e =
|
|
2539
|
+
const e = at(t, "linear-gradient");
|
|
2478
2540
|
if (e) {
|
|
2479
|
-
const s =
|
|
2480
|
-
let n = 90,
|
|
2481
|
-
const
|
|
2482
|
-
if (
|
|
2483
|
-
const r =
|
|
2484
|
-
r && (n = parseFloat(r[1]),
|
|
2485
|
-
} else
|
|
2541
|
+
const s = ot(e);
|
|
2542
|
+
let n = 90, a = s;
|
|
2543
|
+
const o = s[0];
|
|
2544
|
+
if (o.includes("deg")) {
|
|
2545
|
+
const r = o.match(/(-?\d+(?:\.\d+)?)deg/);
|
|
2546
|
+
r && (n = parseFloat(r[1]), a = s.slice(1));
|
|
2547
|
+
} else o.includes("to ") && (n = {
|
|
2486
2548
|
"to right": 90,
|
|
2487
2549
|
"to left": 270,
|
|
2488
2550
|
"to bottom": 180,
|
|
@@ -2491,41 +2553,48 @@ const ct = (c, t, e) => {
|
|
|
2491
2553
|
"to bottom left": 225,
|
|
2492
2554
|
"to top right": 45,
|
|
2493
2555
|
"to top left": 315
|
|
2494
|
-
}[
|
|
2495
|
-
const l =
|
|
2496
|
-
return l.length ?
|
|
2556
|
+
}[o] ?? 90, a = s.slice(1));
|
|
2557
|
+
const l = lt(a);
|
|
2558
|
+
return l.length ? O({ type: "linear", angle: n, stops: l }) : null;
|
|
2497
2559
|
}
|
|
2498
|
-
const i =
|
|
2560
|
+
const i = at(t, "radial-gradient");
|
|
2499
2561
|
if (i) {
|
|
2500
|
-
const s =
|
|
2501
|
-
return
|
|
2562
|
+
const s = ot(i), n = s[0] && !zt(s[0]) ? s.slice(1) : s, a = lt(n);
|
|
2563
|
+
return a.length ? O({ type: "radial", angle: 0, stops: a }) : null;
|
|
2502
2564
|
}
|
|
2503
2565
|
return null;
|
|
2504
|
-
},
|
|
2505
|
-
if (
|
|
2506
|
-
const e =
|
|
2507
|
-
|
|
2566
|
+
}, T = (h) => {
|
|
2567
|
+
if (h.type === "solid") {
|
|
2568
|
+
const e = h.stops[0], i = e.color;
|
|
2569
|
+
if (i.startsWith("var(--"))
|
|
2570
|
+
return i;
|
|
2571
|
+
const s = e.opacity ?? 100, n = i.replace("#", ""), a = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
2572
|
+
return `#${n}${a}`;
|
|
2508
2573
|
}
|
|
2509
|
-
const t =
|
|
2510
|
-
(e) => `${
|
|
2574
|
+
const t = h.stops.map(
|
|
2575
|
+
(e) => `${pt(e.color, e.opacity ?? 100)} ${e.position}%`
|
|
2511
2576
|
).join(", ");
|
|
2512
|
-
return
|
|
2513
|
-
},
|
|
2514
|
-
if (
|
|
2515
|
-
const t =
|
|
2577
|
+
return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
|
|
2578
|
+
}, jt = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), J = (h) => {
|
|
2579
|
+
if (h.type === "solid") {
|
|
2580
|
+
const t = h.stops[0];
|
|
2516
2581
|
if (t) {
|
|
2517
|
-
const e = t.color
|
|
2582
|
+
const e = t.color;
|
|
2583
|
+
if (e.startsWith("var(--"))
|
|
2584
|
+
return e.replace("var(--", "").replace(")", "").split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
|
|
2585
|
+
e.toUpperCase();
|
|
2586
|
+
const i = t.opacity ?? 100;
|
|
2518
2587
|
if (i === 100)
|
|
2519
2588
|
return e;
|
|
2520
2589
|
{
|
|
2521
|
-
const s =
|
|
2590
|
+
const s = jt(i);
|
|
2522
2591
|
return `${e}${s}`;
|
|
2523
2592
|
}
|
|
2524
2593
|
}
|
|
2525
2594
|
return "#000000";
|
|
2526
2595
|
}
|
|
2527
|
-
return
|
|
2528
|
-
},
|
|
2596
|
+
return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
|
|
2597
|
+
}, U = class U {
|
|
2529
2598
|
static defaults() {
|
|
2530
2599
|
return {
|
|
2531
2600
|
solid: [],
|
|
@@ -2535,8 +2604,8 @@ const ct = (c, t, e) => {
|
|
|
2535
2604
|
static normalizeList(t) {
|
|
2536
2605
|
const e = /* @__PURE__ */ new Set(), i = [];
|
|
2537
2606
|
return t.forEach((s) => {
|
|
2538
|
-
let n =
|
|
2539
|
-
n ||
|
|
2607
|
+
let n = W(s);
|
|
2608
|
+
n || I(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
|
|
2540
2609
|
}), i.slice(0, this.MAX_COLORS);
|
|
2541
2610
|
}
|
|
2542
2611
|
static ensureLoaded() {
|
|
@@ -2579,90 +2648,114 @@ const ct = (c, t, e) => {
|
|
|
2579
2648
|
}
|
|
2580
2649
|
static addColor(t, e) {
|
|
2581
2650
|
if (!t) return;
|
|
2582
|
-
let i =
|
|
2651
|
+
let i = W(t), s = "solid";
|
|
2583
2652
|
if (i)
|
|
2584
2653
|
s = "solid";
|
|
2585
2654
|
else {
|
|
2586
|
-
const l =
|
|
2655
|
+
const l = I(t);
|
|
2587
2656
|
l && (i = t, s = l.type === "solid" ? "solid" : "gradient");
|
|
2588
2657
|
}
|
|
2589
2658
|
if (!i) return;
|
|
2590
|
-
const n = e === "all" ? s : e,
|
|
2591
|
-
|
|
2659
|
+
const n = e === "all" ? s : e, a = this.list(n), o = a.indexOf(i);
|
|
2660
|
+
o !== -1 && a.splice(o, 1), a.unshift(i), a.length > this.MAX_COLORS && (a.length = this.MAX_COLORS), this.persist();
|
|
2592
2661
|
}
|
|
2593
2662
|
};
|
|
2594
|
-
|
|
2595
|
-
let D =
|
|
2596
|
-
const
|
|
2663
|
+
U.STORAGE_KEY = "settingsLib_recentColors", U.MAX_COLORS = 12, U.colors = null;
|
|
2664
|
+
let D = U;
|
|
2665
|
+
const it = (h, t) => {
|
|
2597
2666
|
const e = document.createElement("div");
|
|
2598
2667
|
e.className = "color-picker-recent-section";
|
|
2599
2668
|
const i = document.createElement("div");
|
|
2600
2669
|
i.className = "color-picker-recent-title", i.textContent = "Recently Used";
|
|
2601
2670
|
const s = document.createElement("div");
|
|
2602
|
-
s.className = "color-picker-
|
|
2603
|
-
const n =
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2671
|
+
s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
|
|
2672
|
+
const n = () => {
|
|
2673
|
+
s.style.display = "none";
|
|
2674
|
+
}, a = (p, c) => {
|
|
2675
|
+
const d = p.getBoundingClientRect();
|
|
2676
|
+
s.textContent = c, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
|
|
2677
|
+
}, o = document.createElement("div");
|
|
2678
|
+
o.className = "color-picker-recent-grid";
|
|
2679
|
+
const l = document.createElement("div");
|
|
2680
|
+
l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(o), e.appendChild(l);
|
|
2681
|
+
const r = () => {
|
|
2682
|
+
n(), o.innerHTML = "";
|
|
2683
|
+
const p = D.getColors(t);
|
|
2684
|
+
if (p.length === 0) {
|
|
2685
|
+
o.style.display = "none", l.style.display = "block";
|
|
2610
2686
|
return;
|
|
2611
2687
|
}
|
|
2612
|
-
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2615
|
-
const
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
}), r.addEventListener("mouseleave", () => {
|
|
2622
|
-
p.style.display = "none", r.style.boxShadow = "";
|
|
2623
|
-
}), r.addEventListener("mousedown", () => {
|
|
2624
|
-
r.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
2625
|
-
}), r.addEventListener("mouseup", () => {
|
|
2688
|
+
o.style.display = "grid", l.style.display = "none", p.forEach((c) => {
|
|
2689
|
+
const d = document.createElement("button");
|
|
2690
|
+
d.type = "button", d.className = "color-picker-recent-swatch";
|
|
2691
|
+
const u = qt(c);
|
|
2692
|
+
d.title = u, d.setAttribute("aria-label", `Use color: ${u}`), d.style.background = c, d.style.borderColor = c, d.addEventListener("mouseenter", () => a(d, u)), d.addEventListener("mouseleave", () => {
|
|
2693
|
+
n(), d.style.boxShadow = "";
|
|
2694
|
+
}), d.addEventListener("mousedown", () => {
|
|
2695
|
+
d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
|
|
2696
|
+
}), d.addEventListener("mouseup", () => {
|
|
2626
2697
|
setTimeout(() => {
|
|
2627
|
-
|
|
2698
|
+
d.style.boxShadow = "";
|
|
2628
2699
|
}, 150);
|
|
2629
|
-
}),
|
|
2630
|
-
|
|
2631
|
-
}),
|
|
2700
|
+
}), d.addEventListener("click", () => {
|
|
2701
|
+
n(), h(c);
|
|
2702
|
+
}), o.appendChild(d);
|
|
2632
2703
|
});
|
|
2633
2704
|
};
|
|
2634
|
-
return
|
|
2635
|
-
},
|
|
2636
|
-
const t =
|
|
2705
|
+
return r(), { container: e, refresh: r };
|
|
2706
|
+
}, qt = (h) => {
|
|
2707
|
+
const t = I(h);
|
|
2637
2708
|
if (t)
|
|
2638
|
-
return
|
|
2639
|
-
const e =
|
|
2709
|
+
return J(t);
|
|
2710
|
+
const e = W(h);
|
|
2640
2711
|
if (e) {
|
|
2641
|
-
const i =
|
|
2712
|
+
const i = S(e);
|
|
2642
2713
|
return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
|
|
2643
2714
|
}
|
|
2644
|
-
return
|
|
2645
|
-
},
|
|
2715
|
+
return h;
|
|
2716
|
+
}, mt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2646
2717
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
2647
2718
|
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"
|
|
2648
2719
|
fill="#919EAB"/>
|
|
2649
|
-
</svg>`,
|
|
2720
|
+
</svg>`, ft = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2650
2721
|
<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"/>
|
|
2651
|
-
</svg>`,
|
|
2722
|
+
</svg>`, _t = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2652
2723
|
<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"/>
|
|
2653
|
-
</svg>`,
|
|
2724
|
+
</svg>`, Jt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2654
2725
|
<path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2655
|
-
</svg
|
|
2656
|
-
|
|
2726
|
+
</svg>`, Zt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2727
|
+
<rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
|
|
2728
|
+
<rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
|
|
2729
|
+
</svg>
|
|
2730
|
+
|
|
2731
|
+
`, Xt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2732
|
+
<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"/>
|
|
2733
|
+
<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"/>
|
|
2734
|
+
</svg>
|
|
2735
|
+
|
|
2736
|
+
`, Kt = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2737
|
+
<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"/>
|
|
2738
|
+
<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"/>
|
|
2739
|
+
</svg>
|
|
2740
|
+
`;
|
|
2741
|
+
class Yt {
|
|
2657
2742
|
constructor(t, e = "gradient") {
|
|
2658
2743
|
this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
|
|
2659
2744
|
if (!this.isOpen) return;
|
|
2660
2745
|
const s = i.target;
|
|
2661
2746
|
if (this.element.contains(s)) return;
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2747
|
+
if (this.backdrop.contains(s)) {
|
|
2748
|
+
i.preventDefault(), i.stopPropagation(), this.close(!0);
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
const n = document.querySelectorAll(
|
|
2752
|
+
".gstop-color-input, .gstop-color-preview, .gradient-mini-preview"
|
|
2753
|
+
);
|
|
2754
|
+
if (Array.from(n).some(
|
|
2755
|
+
(l) => l.contains(s)
|
|
2756
|
+
)) return;
|
|
2757
|
+
const o = document.querySelector(".gradient-popover");
|
|
2758
|
+
o && o.contains(s) || (i.preventDefault(), i.stopPropagation(), this.close(!0));
|
|
2666
2759
|
}, this.keyDown = (i) => {
|
|
2667
2760
|
if (this.isOpen) {
|
|
2668
2761
|
if (i.key === "Escape")
|
|
@@ -2687,46 +2780,46 @@ class Jt {
|
|
|
2687
2780
|
const i = document.createElement("span");
|
|
2688
2781
|
i.textContent = "Color";
|
|
2689
2782
|
const s = document.createElement("button");
|
|
2690
|
-
s.className = "color-picker-close", s.innerHTML =
|
|
2783
|
+
s.className = "color-picker-close", s.innerHTML = mt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ht(e, t);
|
|
2691
2784
|
const n = document.createElement("div");
|
|
2692
2785
|
n.className = "color-picker-area", this.colorArea = n;
|
|
2693
|
-
const o = document.createElement("div");
|
|
2694
|
-
o.className = "color-picker-marker", this.colorMarker = o, n.appendChild(o);
|
|
2695
2786
|
const a = document.createElement("div");
|
|
2696
|
-
a.className = "color-picker-
|
|
2787
|
+
a.className = "color-picker-marker", this.colorMarker = a, n.appendChild(a);
|
|
2788
|
+
const o = document.createElement("div");
|
|
2789
|
+
o.className = "color-picker-sliders-container";
|
|
2697
2790
|
const l = document.createElement("button");
|
|
2698
|
-
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML =
|
|
2791
|
+
l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = ft;
|
|
2699
2792
|
const r = document.createElement("div");
|
|
2700
2793
|
r.className = "color-picker-sliders-group";
|
|
2701
|
-
const h = document.createElement("div");
|
|
2702
|
-
h.className = "color-picker-hue", this.hueSlider = h;
|
|
2703
2794
|
const p = document.createElement("div");
|
|
2704
|
-
p.className = "color-picker-hue
|
|
2795
|
+
p.className = "color-picker-hue", this.hueSlider = p;
|
|
2796
|
+
const c = document.createElement("div");
|
|
2797
|
+
c.className = "color-picker-hue-marker", this.hueMarker = c, p.appendChild(c);
|
|
2705
2798
|
const d = document.createElement("div");
|
|
2706
2799
|
d.className = "color-picker-opacity", this.opacitySlider = d;
|
|
2707
2800
|
const u = document.createElement("div");
|
|
2708
|
-
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(
|
|
2709
|
-
const
|
|
2710
|
-
var
|
|
2711
|
-
this.setColor(
|
|
2801
|
+
u.className = "color-picker-opacity-marker", this.opacityMarker = u, d.appendChild(u), r.appendChild(p), r.appendChild(d), o.appendChild(l), o.appendChild(r);
|
|
2802
|
+
const g = it((b) => {
|
|
2803
|
+
var k;
|
|
2804
|
+
this.setColor(b), (k = this.onChange) == null || k.call(this, b, this.currentOpacity);
|
|
2712
2805
|
}, this.recentScope);
|
|
2713
|
-
this.recentSectionRefresh =
|
|
2806
|
+
this.recentSectionRefresh = g.refresh;
|
|
2714
2807
|
const f = document.createElement("div");
|
|
2715
2808
|
f.className = "color-picker-format-section";
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2809
|
+
const m = document.createElement("select");
|
|
2810
|
+
m.className = "color-picker-format-select", this.select = m;
|
|
2811
|
+
const v = document.createElement("option");
|
|
2812
|
+
v.value = "hex", v.textContent = "HEX";
|
|
2718
2813
|
const C = document.createElement("option");
|
|
2719
|
-
C.value = "
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
const
|
|
2727
|
-
|
|
2728
|
-
const v = document.createElement("button");
|
|
2729
|
-
return v.className = "color-picker-copy-inside", v.textContent = "Copy", H.appendChild(I), H.appendChild(v), f.appendChild(g), f.appendChild(H), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(m.container), t.appendChild(f), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, d, I, g, v, l), t;
|
|
2814
|
+
C.value = "rgb", C.textContent = "RGB";
|
|
2815
|
+
const w = document.createElement("option");
|
|
2816
|
+
w.value = "hsl", w.textContent = "HSL", m.appendChild(v), m.appendChild(C), m.appendChild(w);
|
|
2817
|
+
const E = document.createElement("input");
|
|
2818
|
+
E.type = "text", E.className = "color-picker-color-input", E.value = this.currentColor, this.input = E;
|
|
2819
|
+
const M = document.createElement("div");
|
|
2820
|
+
M.className = "color-picker-input-container";
|
|
2821
|
+
const y = document.createElement("button");
|
|
2822
|
+
return y.className = "color-picker-copy-inside", y.textContent = "Copy", M.appendChild(E), M.appendChild(y), f.appendChild(m), f.appendChild(M), t.appendChild(e), t.appendChild(n), t.appendChild(o), t.appendChild(g.container), t.appendChild(f), t.addEventListener("click", (b) => b.stopPropagation()), this.bind(n, p, d, E, m, y, l), t;
|
|
2730
2823
|
}
|
|
2731
2824
|
createBackdrop() {
|
|
2732
2825
|
const t = document.createElement("div");
|
|
@@ -2734,60 +2827,60 @@ class Jt {
|
|
|
2734
2827
|
e.preventDefault(), e.stopPropagation(), this.close(!0);
|
|
2735
2828
|
}), t;
|
|
2736
2829
|
}
|
|
2737
|
-
bind(t, e, i, s, n,
|
|
2738
|
-
const l = (
|
|
2739
|
-
var
|
|
2740
|
-
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2741
|
-
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${
|
|
2742
|
-
const
|
|
2743
|
-
this.currentColor =
|
|
2744
|
-
}, r = (
|
|
2745
|
-
var
|
|
2830
|
+
bind(t, e, i, s, n, a, o) {
|
|
2831
|
+
const l = (c) => {
|
|
2832
|
+
var C;
|
|
2833
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
2834
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
2835
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = F(m, u, 1 - g);
|
|
2836
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
|
|
2837
|
+
}, r = (c) => {
|
|
2838
|
+
var C;
|
|
2746
2839
|
const d = e.getBoundingClientRect();
|
|
2747
|
-
let u = Math.max(0, Math.min(1, (
|
|
2840
|
+
let u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2748
2841
|
this.hueMarker.style.left = `${u * 100}%`;
|
|
2749
|
-
const
|
|
2750
|
-
this.currentColor =
|
|
2751
|
-
},
|
|
2752
|
-
var
|
|
2753
|
-
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (
|
|
2754
|
-
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (
|
|
2842
|
+
const g = u * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), v = F(g, f, 1 - m);
|
|
2843
|
+
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);
|
|
2844
|
+
}, p = (c) => {
|
|
2845
|
+
var g;
|
|
2846
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
2847
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), (g = this.onChange) == null || g.call(this, this.currentColor, this.currentOpacity);
|
|
2755
2848
|
};
|
|
2756
|
-
t.addEventListener("mousedown", (
|
|
2757
|
-
|
|
2758
|
-
const d = (
|
|
2849
|
+
t.addEventListener("mousedown", (c) => {
|
|
2850
|
+
c.preventDefault(), l(c);
|
|
2851
|
+
const d = (g) => l(g), u = () => {
|
|
2759
2852
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2760
2853
|
};
|
|
2761
2854
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2762
|
-
}), e.addEventListener("mousedown", (
|
|
2763
|
-
|
|
2764
|
-
const d = (
|
|
2855
|
+
}), e.addEventListener("mousedown", (c) => {
|
|
2856
|
+
c.preventDefault(), r(c);
|
|
2857
|
+
const d = (g) => r(g), u = () => {
|
|
2765
2858
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2766
2859
|
};
|
|
2767
2860
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2768
|
-
}), i.addEventListener("mousedown", (
|
|
2769
|
-
|
|
2770
|
-
const d = (
|
|
2861
|
+
}), i.addEventListener("mousedown", (c) => {
|
|
2862
|
+
c.preventDefault(), p(c);
|
|
2863
|
+
const d = (g) => p(g), u = () => {
|
|
2771
2864
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
2772
2865
|
};
|
|
2773
2866
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2774
|
-
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (
|
|
2775
|
-
|
|
2776
|
-
}),
|
|
2867
|
+
}), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (c) => {
|
|
2868
|
+
c.key === "Enter" && (c.preventDefault(), this.syncInput(), s.blur());
|
|
2869
|
+
}), a.addEventListener("click", async () => {
|
|
2777
2870
|
try {
|
|
2778
2871
|
await navigator.clipboard.writeText(s.value);
|
|
2779
2872
|
} catch {
|
|
2780
2873
|
s.select(), document.execCommand("copy");
|
|
2781
2874
|
}
|
|
2782
|
-
}),
|
|
2783
|
-
var
|
|
2875
|
+
}), o.addEventListener("click", async () => {
|
|
2876
|
+
var c;
|
|
2784
2877
|
if (!("EyeDropper" in window)) {
|
|
2785
2878
|
alert("EyeDropper API is not supported in this browser.");
|
|
2786
2879
|
return;
|
|
2787
2880
|
}
|
|
2788
2881
|
try {
|
|
2789
2882
|
const d = new window.EyeDropper(), { sRGBHex: u } = await d.open();
|
|
2790
|
-
this.setColor(u), (
|
|
2883
|
+
this.setColor(u), (c = this.onChange) == null || c.call(this, u, this.currentOpacity);
|
|
2791
2884
|
} catch {
|
|
2792
2885
|
}
|
|
2793
2886
|
}), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
|
|
@@ -2796,22 +2889,22 @@ class Jt {
|
|
|
2796
2889
|
);
|
|
2797
2890
|
}
|
|
2798
2891
|
setColor(t) {
|
|
2799
|
-
var
|
|
2892
|
+
var a;
|
|
2800
2893
|
this.currentColor = t;
|
|
2801
|
-
const { h: e, s: i, v: s } =
|
|
2802
|
-
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(), (
|
|
2894
|
+
const { h: e, s: i, v: s } = G(t), n = e >= 360 ? e % 360 : e;
|
|
2895
|
+
this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (a = this.onChange) == null || a.call(this, t, this.currentOpacity);
|
|
2803
2896
|
}
|
|
2804
2897
|
syncInput() {
|
|
2805
|
-
const t = this.select.value, { h: e, s: i, v: s } =
|
|
2898
|
+
const t = this.select.value, { h: e, s: i, v: s } = G(this.currentColor);
|
|
2806
2899
|
if (t === "hex") this.input.value = this.currentColor;
|
|
2807
2900
|
else if (t === "rgb") {
|
|
2808
|
-
const { r: n, g:
|
|
2809
|
-
this.input.value = `rgb(${n}, ${
|
|
2901
|
+
const { r: n, g: a, b: o } = S(this.currentColor);
|
|
2902
|
+
this.input.value = `rgb(${n}, ${a}, ${o})`;
|
|
2810
2903
|
} else {
|
|
2811
|
-
const { hue: n, sat:
|
|
2904
|
+
const { hue: n, sat: a, lightness: o } = dt(e, i, s);
|
|
2812
2905
|
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2813
|
-
|
|
2814
|
-
)}%, ${Math.round(
|
|
2906
|
+
a * 100
|
|
2907
|
+
)}%, ${Math.round(o * 100)}%)`;
|
|
2815
2908
|
}
|
|
2816
2909
|
}
|
|
2817
2910
|
applyFromInput() {
|
|
@@ -2821,36 +2914,36 @@ class Jt {
|
|
|
2821
2914
|
else {
|
|
2822
2915
|
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
2823
2916
|
if (i) {
|
|
2824
|
-
const s = parseInt(i[1]), n = parseInt(i[2]),
|
|
2825
|
-
s <= 255 && n <= 255 &&
|
|
2917
|
+
const s = parseInt(i[1]), n = parseInt(i[2]), a = parseInt(i[3]);
|
|
2918
|
+
s <= 255 && n <= 255 && a <= 255 && (e = `#${[s, n, a].map((o) => o.toString(16).padStart(2, "0")).join("")}`);
|
|
2826
2919
|
} else {
|
|
2827
2920
|
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
2828
2921
|
if (s) {
|
|
2829
|
-
const n = parseInt(s[1]),
|
|
2830
|
-
e =
|
|
2922
|
+
const n = parseInt(s[1]), a = parseInt(s[2]) / 100, o = parseInt(s[3]) / 100, l = o + a * Math.min(o, 1 - o), r = l === 0 ? 0 : 2 * (1 - o / l);
|
|
2923
|
+
e = F(n, r, l);
|
|
2831
2924
|
}
|
|
2832
2925
|
}
|
|
2833
2926
|
}
|
|
2834
2927
|
e && this.setColor(e);
|
|
2835
2928
|
}
|
|
2836
2929
|
updateOpacityBg() {
|
|
2837
|
-
const { r: t, g: e, b: i } =
|
|
2930
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
2838
2931
|
this.opacitySlider.style.setProperty(
|
|
2839
2932
|
"--base-color",
|
|
2840
2933
|
`rgb(${t}, ${e}, ${i})`
|
|
2841
2934
|
);
|
|
2842
2935
|
}
|
|
2843
2936
|
open(t, e, i) {
|
|
2844
|
-
var
|
|
2937
|
+
var w;
|
|
2845
2938
|
this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
|
|
2846
|
-
const { h: s, s: n, v:
|
|
2847
|
-
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 -
|
|
2848
|
-
const
|
|
2849
|
-
let u = r.right + 8,
|
|
2850
|
-
const f =
|
|
2851
|
-
f >=
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2939
|
+
const { h: s, s: n, v: a } = G(t);
|
|
2940
|
+
this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - a) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (w = this.recentSectionRefresh) == null || w.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);
|
|
2941
|
+
const o = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), p = window.innerWidth, c = window.innerHeight, d = 16;
|
|
2942
|
+
let u = r.right + 8, g = r.top;
|
|
2943
|
+
const f = p - r.right, m = r.left;
|
|
2944
|
+
f >= o + d ? u = r.right + 8 : m >= o + d ? u = r.left - o - 8 : u = Math.max(d, (p - o) / 2);
|
|
2945
|
+
const v = c - r.bottom, C = r.top;
|
|
2946
|
+
v >= l + d ? g = r.bottom + 8 : C >= l + d ? g = r.top - l - 8 : v > C ? (g = r.bottom + 8, g + l > c - d && (g = c - l - d)) : (g = r.top - l - 8, g < d && (g = d)), this.element.style.left = `${u}px`, this.element.style.top = `${g}px`;
|
|
2854
2947
|
}
|
|
2855
2948
|
close(t) {
|
|
2856
2949
|
var e;
|
|
@@ -2860,243 +2953,200 @@ class Jt {
|
|
|
2860
2953
|
return this.element;
|
|
2861
2954
|
}
|
|
2862
2955
|
}
|
|
2863
|
-
class
|
|
2956
|
+
class Qt {
|
|
2864
2957
|
constructor(t) {
|
|
2865
|
-
this.
|
|
2958
|
+
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);
|
|
2866
2959
|
}
|
|
2867
|
-
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
<div class="color-picker-area embedded">
|
|
2871
|
-
<div class="color-picker-marker"></div>
|
|
2872
|
-
</div>
|
|
2873
|
-
<div class="color-picker-sliders-container embedded">
|
|
2874
|
-
<button class="color-picker-eyedropper">
|
|
2875
|
-
<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2876
|
-
<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"/>
|
|
2877
|
-
</svg>
|
|
2878
|
-
</button>
|
|
2879
|
-
<div class="color-picker-sliders-group">
|
|
2880
|
-
<div class="color-picker-hue embedded">
|
|
2881
|
-
<div class="color-picker-hue-marker"></div>
|
|
2882
|
-
</div>
|
|
2883
|
-
<div class="color-picker-opacity embedded">
|
|
2884
|
-
<div class="color-picker-opacity-marker"></div>
|
|
2885
|
-
</div>
|
|
2886
|
-
</div>
|
|
2887
|
-
</div>
|
|
2888
|
-
<div class="color-picker-format-section embedded">
|
|
2889
|
-
<select class="color-picker-format-select">
|
|
2890
|
-
<option value="hex">HEX</option>
|
|
2891
|
-
<option value="rgb">RGB</option>
|
|
2892
|
-
<option value="hsl">HSL</option>
|
|
2893
|
-
</select>
|
|
2894
|
-
<div class="color-picker-input-container">
|
|
2895
|
-
<input type="text" class="color-picker-color-input" />
|
|
2896
|
-
<button class="color-picker-copy-inside">Copy</button>
|
|
2897
|
-
</div>
|
|
2898
|
-
</div>
|
|
2899
|
-
`;
|
|
2900
|
-
const e = et((i) => {
|
|
2901
|
-
this.applyRecentColor(i);
|
|
2902
|
-
}, this.recentScope);
|
|
2903
|
-
return this.recentSectionRefresh = e.refresh, t.appendChild(e.container), t;
|
|
2904
|
-
}
|
|
2905
|
-
initializePicker() {
|
|
2906
|
-
this.colorArea = this.container.querySelector(
|
|
2907
|
-
".color-picker-area"
|
|
2908
|
-
), this.colorMarker = this.container.querySelector(
|
|
2909
|
-
".color-picker-marker"
|
|
2910
|
-
), this.hueSlider = this.container.querySelector(
|
|
2911
|
-
".color-picker-hue"
|
|
2912
|
-
), this.hueMarker = this.container.querySelector(
|
|
2913
|
-
".color-picker-hue-marker"
|
|
2914
|
-
), this.opacitySlider = this.container.querySelector(
|
|
2915
|
-
".color-picker-opacity"
|
|
2916
|
-
), this.opacityMarker = this.container.querySelector(
|
|
2917
|
-
".color-picker-opacity-marker"
|
|
2918
|
-
), this.formatSelect = this.container.querySelector(
|
|
2919
|
-
".color-picker-format-select"
|
|
2920
|
-
), this.colorInput = this.container.querySelector(
|
|
2921
|
-
".color-picker-color-input"
|
|
2922
|
-
);
|
|
2923
|
-
const t = this.container.querySelector(
|
|
2924
|
-
".color-picker-copy-inside"
|
|
2925
|
-
), { h: e, s: i, v: s } = $(this.currentColor);
|
|
2926
|
-
this.hueMarker.style.left = `${e / 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(${e}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBackground(this.opacitySlider), this.updateColorInput(this.formatSelect, this.colorInput), this.setupColorAreaEvents(), this.setupHueSliderEvents(), this.setupOpacitySliderEvents(), this.setupFormatEvents(t);
|
|
2927
|
-
}
|
|
2928
|
-
scheduleInputUpdate() {
|
|
2929
|
-
this.inputUpdateTimeout && clearTimeout(this.inputUpdateTimeout), this.inputUpdateTimeout = window.setTimeout(() => {
|
|
2930
|
-
this.updateColorInput(this.formatSelect, this.colorInput);
|
|
2931
|
-
}, 16);
|
|
2932
|
-
}
|
|
2933
|
-
updateOpacityBackground(t) {
|
|
2934
|
-
const e = k(this.currentColor);
|
|
2935
|
-
t.style.setProperty(
|
|
2936
|
-
"--base-color",
|
|
2937
|
-
`rgb(${e.r}, ${e.g}, ${e.b})`
|
|
2938
|
-
);
|
|
2939
|
-
}
|
|
2940
|
-
updateColorInput(t, e) {
|
|
2941
|
-
switch (t.value) {
|
|
2942
|
-
case "hex":
|
|
2943
|
-
e.value = this.currentColor;
|
|
2944
|
-
break;
|
|
2945
|
-
case "rgb":
|
|
2946
|
-
const s = k(this.currentColor);
|
|
2947
|
-
e.value = `rgb(${s.r}, ${s.g}, ${s.b})`;
|
|
2948
|
-
break;
|
|
2949
|
-
case "hsl":
|
|
2950
|
-
const { h: n, s: o, v: a } = $(this.currentColor), l = a * (1 - o / 2), r = l === 0 || l === 1 ? 0 : (a - l) / Math.min(l, 1 - l);
|
|
2951
|
-
e.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
2952
|
-
r * 100
|
|
2953
|
-
)}%, ${Math.round(l * 100)}%)`;
|
|
2954
|
-
break;
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
applyRecentColor(t) {
|
|
2958
|
-
this.currentColor = t, t.includes("gradient") || t.includes("radial") || (this.updatePickerVisualState(), this.updateColorInput(this.formatSelect, this.colorInput)), this.triggerChange();
|
|
2959
|
-
}
|
|
2960
|
-
commitRecentColor() {
|
|
2961
|
-
var t;
|
|
2962
|
-
D.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this);
|
|
2960
|
+
parsePercentage(t) {
|
|
2961
|
+
const e = parseFloat(t);
|
|
2962
|
+
return isNaN(e) ? 0 : e / 100;
|
|
2963
2963
|
}
|
|
2964
|
-
|
|
2965
|
-
const t = (
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2964
|
+
build() {
|
|
2965
|
+
const t = document.createElement("div");
|
|
2966
|
+
t.className = "embedded-color-picker";
|
|
2967
|
+
const e = document.createElement("div");
|
|
2968
|
+
e.className = "color-picker-area embedded", this.colorArea = e;
|
|
2969
|
+
const i = document.createElement("div");
|
|
2970
|
+
i.className = "color-picker-marker", this.colorMarker = i, e.appendChild(i);
|
|
2971
|
+
const s = document.createElement("div");
|
|
2972
|
+
s.className = "color-picker-sliders-container embedded";
|
|
2973
|
+
const n = document.createElement("button");
|
|
2974
|
+
n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = ft;
|
|
2975
|
+
const a = document.createElement("div");
|
|
2976
|
+
a.className = "color-picker-sliders-group";
|
|
2977
|
+
const o = document.createElement("div");
|
|
2978
|
+
o.className = "color-picker-hue embedded", this.hueSlider = o;
|
|
2979
|
+
const l = document.createElement("div");
|
|
2980
|
+
l.className = "color-picker-hue-marker", this.hueMarker = l, o.appendChild(l);
|
|
2981
|
+
const r = document.createElement("div");
|
|
2982
|
+
r.className = "color-picker-opacity embedded", this.opacitySlider = r;
|
|
2983
|
+
const p = document.createElement("div");
|
|
2984
|
+
p.className = "color-picker-opacity-marker", this.opacityMarker = p, r.appendChild(p), a.appendChild(o), a.appendChild(r), s.appendChild(n), s.appendChild(a);
|
|
2985
|
+
const c = it((E) => {
|
|
2986
|
+
const M = I(E);
|
|
2987
|
+
M && M.type !== "solid" ? this.onColorChange(E, this.currentOpacity) : (this.setColor(E), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
2988
|
+
}, "all");
|
|
2989
|
+
this.recentSectionRefresh = c.refresh;
|
|
2990
|
+
const d = document.createElement("div");
|
|
2991
|
+
d.className = "color-picker-format-section embedded";
|
|
2992
|
+
const u = document.createElement("select");
|
|
2993
|
+
u.className = "color-picker-format-select", this.select = u;
|
|
2994
|
+
const g = document.createElement("option");
|
|
2995
|
+
g.value = "hex", g.textContent = "HEX";
|
|
2996
|
+
const f = document.createElement("option");
|
|
2997
|
+
f.value = "rgb", f.textContent = "RGB";
|
|
2998
|
+
const m = document.createElement("option");
|
|
2999
|
+
m.value = "hsl", m.textContent = "HSL", u.appendChild(g), u.appendChild(f), u.appendChild(m);
|
|
3000
|
+
const v = document.createElement("input");
|
|
3001
|
+
v.type = "text", v.className = "color-picker-color-input", this.input = v;
|
|
3002
|
+
const C = document.createElement("div");
|
|
3003
|
+
C.className = "color-picker-input-container";
|
|
3004
|
+
const w = document.createElement("button");
|
|
3005
|
+
return w.className = "color-picker-copy-inside", w.textContent = "Copy", C.appendChild(v), C.appendChild(w), d.appendChild(u), d.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(c.container), this.bind(e, o, r, v, u, w, n), t;
|
|
3006
|
+
}
|
|
3007
|
+
bind(t, e, i, s, n, a, o) {
|
|
3008
|
+
const l = (c) => {
|
|
3009
|
+
const d = t.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width)), g = Math.max(0, Math.min(1, (c.clientY - d.top) / d.height));
|
|
3010
|
+
this.colorMarker.style.left = `${u * 100}%`, this.colorMarker.style.top = `${g * 100}%`;
|
|
3011
|
+
const m = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = F(m, u, 1 - g);
|
|
3012
|
+
this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3013
|
+
}, r = (c) => {
|
|
3014
|
+
const d = e.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
3015
|
+
this.hueMarker.style.left = `${u * 100}%`;
|
|
3016
|
+
const g = u * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), m = this.parsePercentage(this.colorMarker.style.top || "0%"), v = F(g, f, 1 - m);
|
|
3017
|
+
this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3018
|
+
linear-gradient(to right, #fff, hsl(${g}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
|
|
3019
|
+
}, p = (c) => {
|
|
3020
|
+
const d = i.getBoundingClientRect(), u = Math.max(0, Math.min(1, (c.clientX - d.left) / d.width));
|
|
3021
|
+
this.opacityMarker.style.left = `${u * 100}%`, this.currentOpacity = Math.round(u * 100), this.queueChange();
|
|
2970
3022
|
};
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
const
|
|
2974
|
-
document.removeEventListener("mousemove",
|
|
3023
|
+
t.addEventListener("mousedown", (c) => {
|
|
3024
|
+
c.preventDefault(), this.isDragging = !0, l(c);
|
|
3025
|
+
const d = (g) => l(g), u = () => {
|
|
3026
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
2975
3027
|
};
|
|
2976
|
-
document.addEventListener("mousemove",
|
|
2977
|
-
})
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
const i = this.hueSlider.getBoundingClientRect();
|
|
2982
|
-
let s = (e.clientX - i.left) / i.width;
|
|
2983
|
-
s = Math.max(0, Math.min(1, s)), this.hueMarker.style.left = `${s * 100}%`;
|
|
2984
|
-
const n = Math.max(0, Math.min(360, s * 360)), o = parseFloat(
|
|
2985
|
-
this.colorMarker.style.left || "50%"
|
|
2986
|
-
), a = parseFloat(this.colorMarker.style.top || "50%"), l = Math.max(
|
|
2987
|
-
0,
|
|
2988
|
-
Math.min(1, (isNaN(o) ? 50 : o) / 100)
|
|
2989
|
-
), r = Math.max(
|
|
2990
|
-
0,
|
|
2991
|
-
Math.min(1, (isNaN(a) ? 50 : a) / 100)
|
|
2992
|
-
);
|
|
2993
|
-
this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`;
|
|
2994
|
-
const h = G(n, l, 1 - r);
|
|
2995
|
-
this.currentColor = h, this.updateOpacityBackground(this.opacitySlider), this.triggerChange();
|
|
2996
|
-
};
|
|
2997
|
-
this.hueSlider.addEventListener("mousedown", (e) => {
|
|
2998
|
-
e.preventDefault(), t(e);
|
|
2999
|
-
const i = (n) => t(n), s = () => {
|
|
3000
|
-
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", s), this.inputUpdateTimeout && clearTimeout(this.inputUpdateTimeout), this.updateColorInput(this.formatSelect, this.colorInput);
|
|
3028
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3029
|
+
}), e.addEventListener("mousedown", (c) => {
|
|
3030
|
+
c.preventDefault(), this.isDragging = !0, r(c);
|
|
3031
|
+
const d = (g) => r(g), u = () => {
|
|
3032
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3001
3033
|
};
|
|
3002
|
-
document.addEventListener("mousemove",
|
|
3003
|
-
})
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
const i = this.opacitySlider.getBoundingClientRect(), s = Math.max(0, Math.min(1, (e.clientX - i.left) / i.width));
|
|
3008
|
-
this.opacityMarker.style.left = `${s * 100}%`, this.currentOpacity = Math.round(s * 100), this.triggerChange();
|
|
3009
|
-
};
|
|
3010
|
-
this.opacitySlider.addEventListener("mousedown", (e) => {
|
|
3011
|
-
e.preventDefault(), t(e);
|
|
3012
|
-
const i = (n) => t(n), s = () => {
|
|
3013
|
-
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", s);
|
|
3034
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3035
|
+
}), i.addEventListener("mousedown", (c) => {
|
|
3036
|
+
c.preventDefault(), this.isDragging = !0, p(c);
|
|
3037
|
+
const d = (g) => p(g), u = () => {
|
|
3038
|
+
this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), this.applyPendingExternal();
|
|
3014
3039
|
};
|
|
3015
|
-
document.addEventListener("mousemove",
|
|
3040
|
+
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
3041
|
+
}), n.addEventListener("change", () => {
|
|
3042
|
+
this.syncInput();
|
|
3043
|
+
}), s.addEventListener("input", () => {
|
|
3044
|
+
this.applyFromInput();
|
|
3045
|
+
}), s.addEventListener("blur", () => {
|
|
3046
|
+
this.syncInput();
|
|
3047
|
+
}), s.addEventListener("keydown", (c) => {
|
|
3048
|
+
c.key === "Enter" && (c.preventDefault(), this.syncInput(), s.blur());
|
|
3049
|
+
}), a.addEventListener("click", async () => {
|
|
3050
|
+
try {
|
|
3051
|
+
await navigator.clipboard.writeText(s.value);
|
|
3052
|
+
} catch {
|
|
3053
|
+
s.select(), document.execCommand("copy");
|
|
3054
|
+
}
|
|
3055
|
+
}), o.addEventListener("click", async () => {
|
|
3056
|
+
if (!("EyeDropper" in window)) {
|
|
3057
|
+
alert("EyeDropper API is not supported in this browser.");
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
try {
|
|
3061
|
+
const c = new window.EyeDropper(), { sRGBHex: d } = await c.open();
|
|
3062
|
+
this.setColor(d), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3063
|
+
} catch {
|
|
3064
|
+
}
|
|
3016
3065
|
});
|
|
3017
3066
|
}
|
|
3018
|
-
|
|
3019
|
-
this.
|
|
3020
|
-
|
|
3021
|
-
})
|
|
3022
|
-
|
|
3023
|
-
this.colorInput.select(), document.execCommand("copy");
|
|
3024
|
-
});
|
|
3025
|
-
}), this.colorInput.addEventListener("input", () => {
|
|
3026
|
-
this.handleManualColorInput(this.colorInput.value, this.formatSelect);
|
|
3027
|
-
}), this.colorInput.addEventListener("blur", () => {
|
|
3028
|
-
this.updateColorInput(this.formatSelect, this.colorInput);
|
|
3029
|
-
});
|
|
3067
|
+
setColor(t) {
|
|
3068
|
+
this.currentColor = t;
|
|
3069
|
+
const { h: e, s: i, v: s } = G(t), n = e >= 360 ? e % 360 : e;
|
|
3070
|
+
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),
|
|
3071
|
+
linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
|
|
3030
3072
|
}
|
|
3031
|
-
|
|
3032
|
-
const i =
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
break;
|
|
3044
|
-
}
|
|
3045
|
-
s || (s = this.autoDetectColorFormat(i)), s && (this.currentColor = s, this.updatePickerVisualState(), this.triggerChange());
|
|
3046
|
-
}
|
|
3047
|
-
parseHexInput(t) {
|
|
3048
|
-
const e = t.startsWith("#") ? t : `#${t}`;
|
|
3049
|
-
return B(e);
|
|
3050
|
-
}
|
|
3051
|
-
parseRgbInput(t) {
|
|
3052
|
-
const e = t.match(
|
|
3053
|
-
/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/
|
|
3054
|
-
);
|
|
3055
|
-
if (e) {
|
|
3056
|
-
const i = parseInt(e[1]), s = parseInt(e[2]), n = parseInt(e[3]);
|
|
3057
|
-
if (i <= 255 && s <= 255 && n <= 255)
|
|
3058
|
-
return F(i, s, n);
|
|
3073
|
+
syncInput() {
|
|
3074
|
+
const t = this.select.value, { h: e, s: i, v: s } = G(this.currentColor);
|
|
3075
|
+
if (t === "hex")
|
|
3076
|
+
this.input.value = this.currentColor;
|
|
3077
|
+
else if (t === "rgb") {
|
|
3078
|
+
const { r: n, g: a, b: o } = S(this.currentColor);
|
|
3079
|
+
this.input.value = `rgb(${n}, ${a}, ${o})`;
|
|
3080
|
+
} else {
|
|
3081
|
+
const { hue: n, sat: a, lightness: o } = dt(e, i, s);
|
|
3082
|
+
this.input.value = `hsl(${Math.round(n)}, ${Math.round(
|
|
3083
|
+
a * 100
|
|
3084
|
+
)}%, ${Math.round(o * 100)}%)`;
|
|
3059
3085
|
}
|
|
3060
|
-
return null;
|
|
3061
3086
|
}
|
|
3062
|
-
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3065
|
-
)
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3087
|
+
applyFromInput() {
|
|
3088
|
+
const t = this.input.value.trim();
|
|
3089
|
+
let e = "";
|
|
3090
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(t))
|
|
3091
|
+
e = t;
|
|
3092
|
+
else {
|
|
3093
|
+
const i = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
3094
|
+
if (i) {
|
|
3095
|
+
const s = parseInt(i[1], 10), n = parseInt(i[2], 10), a = parseInt(i[3], 10);
|
|
3096
|
+
s <= 255 && n <= 255 && a <= 255 && (e = "#" + [s, n, a].map((o) => o.toString(16).padStart(2, "0")).join(""));
|
|
3097
|
+
} else {
|
|
3098
|
+
const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
|
|
3099
|
+
if (s) {
|
|
3100
|
+
const n = parseInt(s[1], 10), a = parseInt(s[2], 10) / 100, o = parseInt(s[3], 10) / 100, l = o + a * Math.min(o, 1 - o), r = l === 0 ? 0 : 2 * (1 - o / l);
|
|
3101
|
+
e = F(n, r, l);
|
|
3102
|
+
}
|
|
3071
3103
|
}
|
|
3072
3104
|
}
|
|
3073
|
-
|
|
3105
|
+
e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
|
|
3074
3106
|
}
|
|
3075
|
-
|
|
3076
|
-
const e = this.
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
return s || null;
|
|
3107
|
+
updateOpacityBg() {
|
|
3108
|
+
const { r: t, g: e, b: i } = S(this.currentColor);
|
|
3109
|
+
this.opacitySlider.style.setProperty(
|
|
3110
|
+
"--base-color",
|
|
3111
|
+
`rgb(${t}, ${e}, ${i})`
|
|
3112
|
+
);
|
|
3082
3113
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3114
|
+
queueChange() {
|
|
3115
|
+
this.changeRafId === void 0 && (this.changeRafId = window.requestAnimationFrame(() => {
|
|
3116
|
+
this.changeRafId = void 0, this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3117
|
+
}));
|
|
3086
3118
|
}
|
|
3087
|
-
|
|
3088
|
-
this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3119
|
+
flushChange() {
|
|
3120
|
+
this.changeRafId !== void 0 && (cancelAnimationFrame(this.changeRafId), this.changeRafId = void 0), this.onColorChange(this.currentColor, this.currentOpacity);
|
|
3121
|
+
}
|
|
3122
|
+
applyPendingExternal() {
|
|
3123
|
+
if (!this.pendingExternalUpdate) return;
|
|
3124
|
+
const { color: t, opacity: e } = this.pendingExternalUpdate;
|
|
3125
|
+
this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
|
|
3126
|
+
}
|
|
3127
|
+
initFromColor(t, e) {
|
|
3128
|
+
var o;
|
|
3129
|
+
this.currentColor = t, this.currentOpacity = e;
|
|
3130
|
+
const { h: i, s, v: n } = G(t), a = i >= 360 ? i % 360 : i;
|
|
3131
|
+
this.hueMarker.style.left = `${a / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
|
|
3132
|
+
linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (o = this.recentSectionRefresh) == null || o.call(this);
|
|
3133
|
+
}
|
|
3134
|
+
commitRecentColor() {
|
|
3135
|
+
var t;
|
|
3136
|
+
this.recentScope === "solid" && (D.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
|
|
3089
3137
|
}
|
|
3090
3138
|
getElement() {
|
|
3091
|
-
return this.
|
|
3139
|
+
return this.element;
|
|
3092
3140
|
}
|
|
3093
3141
|
updateColor(t, e) {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3142
|
+
if (this.isDragging) {
|
|
3143
|
+
this.pendingExternalUpdate = { color: t, opacity: e };
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
3146
|
+
this.initFromColor(t, e);
|
|
3097
3147
|
}
|
|
3098
3148
|
}
|
|
3099
|
-
const
|
|
3149
|
+
const P = class P extends x {
|
|
3100
3150
|
constructor(t = {}) {
|
|
3101
3151
|
const e = typeof t.default == "string" ? void 0 : t.default;
|
|
3102
3152
|
super({
|
|
@@ -3107,17 +3157,17 @@ const V = class V extends w {
|
|
|
3107
3157
|
type: "text",
|
|
3108
3158
|
angle: "number",
|
|
3109
3159
|
stops: "text"
|
|
3110
|
-
}, 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.onBackgroundClick = (i) => {
|
|
3160
|
+
}, 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) => {
|
|
3111
3161
|
var d;
|
|
3112
3162
|
if (!this.popoverEl || !this.isPopoverOpen) return;
|
|
3113
|
-
const s = i.target, n = this.popoverEl.contains(s),
|
|
3163
|
+
const s = i.target, n = this.popoverEl.contains(s), a = (d = this.element) == null ? void 0 : d.contains(s), o = document.querySelectorAll(".custom-color-picker"), l = Array.from(o).some((u) => u.contains(s)), r = s.closest(
|
|
3114
3164
|
".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"
|
|
3115
|
-
), h = s.classList.contains(
|
|
3116
|
-
"color-picker-backdrop"
|
|
3117
3165
|
), p = s.classList.contains(
|
|
3166
|
+
"color-picker-backdrop"
|
|
3167
|
+
), c = s.classList.contains(
|
|
3118
3168
|
"gradient-popover-backdrop"
|
|
3119
3169
|
);
|
|
3120
|
-
!n && !
|
|
3170
|
+
!n && !a && !l && !r && !p && !c && this.closePopover();
|
|
3121
3171
|
}, this.handlePopoverKeydown = (i) => {
|
|
3122
3172
|
if (this.isPopoverOpen) {
|
|
3123
3173
|
if (i.key === "Escape") {
|
|
@@ -3131,16 +3181,42 @@ const V = class V extends w {
|
|
|
3131
3181
|
i.preventDefault(), this.closePopover();
|
|
3132
3182
|
}
|
|
3133
3183
|
}
|
|
3134
|
-
}, this.detectChange = t.detectChange, this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3184
|
+
}, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue();
|
|
3185
|
+
}
|
|
3186
|
+
resolveGlobalVarColor(t) {
|
|
3187
|
+
if (t.startsWith("var(--")) {
|
|
3188
|
+
const e = t.replace("var(--", "").replace(")", "");
|
|
3189
|
+
return (x.GlobalVariables || {})[e] || t;
|
|
3190
|
+
}
|
|
3191
|
+
return t;
|
|
3192
|
+
}
|
|
3193
|
+
breakGlobalBinding() {
|
|
3194
|
+
if (!this.value || this.value.type !== "solid" || !this.value.stops.length)
|
|
3195
|
+
return;
|
|
3196
|
+
const e = this.value.stops[0].color;
|
|
3197
|
+
if (!e.startsWith("var(--"))
|
|
3198
|
+
return;
|
|
3199
|
+
const i = this.resolveGlobalVarColor(e);
|
|
3200
|
+
if (i === e) {
|
|
3201
|
+
console.warn(`Could not resolve global variable: ${e}`);
|
|
3202
|
+
return;
|
|
3203
|
+
}
|
|
3204
|
+
this.value.stops[0].color = i, this.updateUI(), this.triggerChange(), this.isPopoverOpen && this.refreshPopoverContent();
|
|
3135
3205
|
}
|
|
3136
3206
|
defaultValue() {
|
|
3137
3207
|
const t = this.originalDefault;
|
|
3138
3208
|
if (typeof t == "string") {
|
|
3139
|
-
|
|
3209
|
+
if (t.startsWith("var(--"))
|
|
3210
|
+
return O({
|
|
3211
|
+
type: "solid",
|
|
3212
|
+
angle: 0,
|
|
3213
|
+
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3214
|
+
});
|
|
3215
|
+
const i = I(t);
|
|
3140
3216
|
if (i)
|
|
3141
|
-
return
|
|
3217
|
+
return O(i);
|
|
3142
3218
|
}
|
|
3143
|
-
return
|
|
3219
|
+
return O(t && typeof t == "object" ? t : {
|
|
3144
3220
|
type: "linear",
|
|
3145
3221
|
angle: 90,
|
|
3146
3222
|
stops: [
|
|
@@ -3152,20 +3228,39 @@ const V = class V extends w {
|
|
|
3152
3228
|
setValue(t) {
|
|
3153
3229
|
var i, s;
|
|
3154
3230
|
let e = null;
|
|
3155
|
-
typeof t == "string" ?
|
|
3231
|
+
typeof t == "string" ? t.startsWith("var(--") ? e = O({
|
|
3232
|
+
type: "solid",
|
|
3233
|
+
angle: 0,
|
|
3234
|
+
stops: [{ color: t, position: 0, opacity: 100 }]
|
|
3235
|
+
}) : e = I(t) : t && typeof t == "object" && (e = O(t)), e || (e = this.defaultValue()), this.value = e, this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), (i = this.onChange) == null || i.call(this, this.value), (s = this.detectChange) == null || s.call(this, this.value), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
|
|
3156
3236
|
}
|
|
3157
3237
|
updateUI() {
|
|
3158
3238
|
if (this.previewEl && this.value)
|
|
3159
3239
|
if (this.value.type === "solid") {
|
|
3160
|
-
const t = this.value.stops[0], e = t.opacity ?? 100;
|
|
3161
|
-
this.previewEl.style.background =
|
|
3162
|
-
} else
|
|
3163
|
-
|
|
3164
|
-
|
|
3240
|
+
const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
|
|
3241
|
+
this.previewEl.style.background = pt(i, e);
|
|
3242
|
+
} else {
|
|
3243
|
+
const t = this.resolveGradientGlobalVars(this.value);
|
|
3244
|
+
this.previewEl.style.background = T(t);
|
|
3245
|
+
}
|
|
3246
|
+
this.inputEl && this.value && !this.isEditing && (this.inputEl.value = J(this.value)), this.updateUnlinkButtonVisibility();
|
|
3247
|
+
}
|
|
3248
|
+
resolveGradientGlobalVars(t) {
|
|
3249
|
+
return {
|
|
3250
|
+
...t,
|
|
3251
|
+
stops: t.stops.map((e) => ({
|
|
3252
|
+
...e,
|
|
3253
|
+
color: this.resolveGlobalVarColor(e.color)
|
|
3254
|
+
}))
|
|
3255
|
+
};
|
|
3256
|
+
}
|
|
3257
|
+
updateUnlinkButtonVisibility() {
|
|
3258
|
+
if (!this.unlinkButton || !this.value) return;
|
|
3259
|
+
this.value.type === "solid" && this.value.stops.length > 0 && this.value.stops[0].color.startsWith("var(--") ? this.unlinkButton.classList.add("visible") : this.unlinkButton.classList.remove("visible");
|
|
3165
3260
|
}
|
|
3166
3261
|
cssForTextValue() {
|
|
3167
3262
|
return this.value ? {
|
|
3168
|
-
background:
|
|
3263
|
+
background: T(this.value),
|
|
3169
3264
|
"-webkit-background-clip": "text",
|
|
3170
3265
|
"background-clip": "text",
|
|
3171
3266
|
color: "transparent",
|
|
@@ -3181,9 +3276,9 @@ const V = class V extends w {
|
|
|
3181
3276
|
s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
|
|
3182
3277
|
}
|
|
3183
3278
|
const e = document.createElement("div");
|
|
3184
|
-
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ?
|
|
3279
|
+
return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? T(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
|
|
3185
3280
|
i.preventDefault(), i.stopPropagation(), this.openPopover();
|
|
3186
|
-
}), 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 ?
|
|
3281
|
+
}), 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 ? J(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
|
|
3187
3282
|
if (this.isEditing = !0, this.value)
|
|
3188
3283
|
if (this.value.type === "solid") {
|
|
3189
3284
|
const i = this.value.stops[0];
|
|
@@ -3192,54 +3287,74 @@ const V = class V extends w {
|
|
|
3192
3287
|
if (n === 100)
|
|
3193
3288
|
this.inputEl.value = s;
|
|
3194
3289
|
else {
|
|
3195
|
-
const
|
|
3196
|
-
this.inputEl.value = `${s}${
|
|
3290
|
+
const o = Math.round(n / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
|
|
3291
|
+
this.inputEl.value = `${s}${o}`;
|
|
3197
3292
|
}
|
|
3198
3293
|
}
|
|
3199
3294
|
} else
|
|
3200
|
-
this.inputEl.value =
|
|
3295
|
+
this.inputEl.value = T(this.value);
|
|
3201
3296
|
}), this.inputEl.addEventListener("blur", () => {
|
|
3202
|
-
this.isEditing = !1, this.value && (this.inputEl.value =
|
|
3297
|
+
this.isEditing = !1, this.value && (this.inputEl.value = J(this.value));
|
|
3203
3298
|
}), this.inputEl.addEventListener(
|
|
3204
3299
|
"paste",
|
|
3205
3300
|
(i) => this.handlePaste(i)
|
|
3206
3301
|
), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
|
|
3207
|
-
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value =
|
|
3208
|
-
}), e.appendChild(this.previewEl),
|
|
3302
|
+
i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = T(this.value)), this.inputEl.blur());
|
|
3303
|
+
}), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = Kt, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
|
|
3304
|
+
i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
|
|
3305
|
+
}), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
|
|
3209
3306
|
}
|
|
3210
3307
|
createPopover() {
|
|
3308
|
+
var l, r, p;
|
|
3211
3309
|
if (this.popoverEl) return;
|
|
3212
|
-
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (
|
|
3213
|
-
|
|
3214
|
-
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (
|
|
3215
|
-
|
|
3310
|
+
this.backdropEl = document.createElement("div"), this.backdropEl.className = "gradient-popover-backdrop", this.backdropEl.style.display = "none", this.backdropEl.addEventListener("click", (c) => {
|
|
3311
|
+
c.preventDefault(), c.stopPropagation(), this.closePopover();
|
|
3312
|
+
}), this.popoverEl = document.createElement("div"), this.popoverEl.className = "gradient-popover", this.popoverEl.style.display = "none", this.popoverEl.addEventListener("click", (c) => {
|
|
3313
|
+
c.stopPropagation();
|
|
3216
3314
|
});
|
|
3217
3315
|
const t = document.createElement("div");
|
|
3218
3316
|
t.className = "gradient-popover-header", t.style.cursor = "move";
|
|
3219
|
-
|
|
3220
|
-
|
|
3317
|
+
let e = null;
|
|
3318
|
+
if (this.variant !== "global") {
|
|
3319
|
+
e = document.createElement("div"), e.className = "color-setting-tabs header-tabs";
|
|
3320
|
+
const c = document.createElement("button");
|
|
3321
|
+
c.className = "color-tab active", c.textContent = "Custom";
|
|
3322
|
+
const d = document.createElement("button");
|
|
3323
|
+
d.className = "color-tab", d.textContent = "Global", e.appendChild(c), e.appendChild(d), t.appendChild(e);
|
|
3324
|
+
} else {
|
|
3325
|
+
const c = document.createElement("div");
|
|
3326
|
+
t.appendChild(c);
|
|
3327
|
+
}
|
|
3221
3328
|
const i = document.createElement("button");
|
|
3222
|
-
i.type = "button", i.className = "gradient-popover-close", i.innerHTML =
|
|
3223
|
-
this.popoverPosition = { left:
|
|
3329
|
+
i.type = "button", i.className = "gradient-popover-close", i.innerHTML = mt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), ht(t, this.popoverEl, (c, d) => {
|
|
3330
|
+
this.popoverPosition = { left: c, top: d };
|
|
3224
3331
|
});
|
|
3225
3332
|
const s = document.createElement("div");
|
|
3226
3333
|
s.className = "gradient-editor";
|
|
3227
|
-
const n =
|
|
3228
|
-
|
|
3334
|
+
const n = document.createElement("div");
|
|
3335
|
+
n.className = "type-tabs-wrapper";
|
|
3336
|
+
const a = this.createTypeTabs();
|
|
3337
|
+
n.appendChild(a), s.appendChild(n);
|
|
3229
3338
|
const o = document.createElement("div");
|
|
3230
|
-
o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.
|
|
3339
|
+
if (o.className = "gradient-editor-content", this.updatePopoverContent(o), s.appendChild(o), this.variant !== "global" && e) {
|
|
3340
|
+
const c = e.children[0], d = e.children[1], u = (g) => {
|
|
3341
|
+
this.currentMode = g, g === "custom" ? (c.classList.add("active"), d.classList.remove("active"), n.style.display = "block") : (d.classList.add("active"), c.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(o);
|
|
3342
|
+
};
|
|
3343
|
+
c.addEventListener("click", () => u("custom")), d.addEventListener("click", () => u("global")), (p = (r = (l = this.value) == null ? void 0 : l.stops) == null ? void 0 : r[0]) != null && p.color.startsWith("var(--") ? (this.currentMode = "global", u("global")) : (this.currentMode = "custom", u("custom"));
|
|
3344
|
+
}
|
|
3345
|
+
this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
|
|
3231
3346
|
}
|
|
3232
3347
|
createTypeTabs() {
|
|
3233
3348
|
var s, n;
|
|
3234
3349
|
const t = document.createElement("div");
|
|
3235
3350
|
t.className = "gradient-type-tabs";
|
|
3236
3351
|
const e = document.createElement("button");
|
|
3237
|
-
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.
|
|
3352
|
+
e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = Zt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
|
|
3238
3353
|
const i = document.createElement("button");
|
|
3239
|
-
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.
|
|
3240
|
-
var
|
|
3241
|
-
const
|
|
3242
|
-
this.switchType(
|
|
3354
|
+
return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = Xt, i.style.minWidth = "32px", i.addEventListener("click", () => {
|
|
3355
|
+
var o, l;
|
|
3356
|
+
const a = ((o = this.value) == null ? void 0 : o.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
|
|
3357
|
+
this.switchType(a);
|
|
3243
3358
|
}), t.appendChild(e), t.appendChild(i), t;
|
|
3244
3359
|
}
|
|
3245
3360
|
switchType(t) {
|
|
@@ -3248,28 +3363,125 @@ const V = class V extends w {
|
|
|
3248
3363
|
if (this.value.type = t, t !== "solid" && (!this.value.stops || this.value.stops.length === 0) && (this.value.stops = [
|
|
3249
3364
|
{ color: "#a84b4b", position: 0, opacity: 100 },
|
|
3250
3365
|
{ color: "#786666", position: 100, opacity: 100 }
|
|
3251
|
-
]), t !== "solid" && this.value.stops.length
|
|
3366
|
+
]), t !== "solid" && this.value.stops.length === 1) {
|
|
3367
|
+
const n = this.value.stops[0].color;
|
|
3368
|
+
if (n.startsWith("var(--")) {
|
|
3369
|
+
const a = this.resolveGlobalVarColor(n), o = I(a);
|
|
3370
|
+
o && o.type !== "solid" && o.stops.length >= 2 ? (this.value.stops = o.stops, this.value.angle = o.angle, this.value.type = o.type) : (this.value.stops.push({
|
|
3371
|
+
color: "#786666",
|
|
3372
|
+
position: 100,
|
|
3373
|
+
opacity: 100
|
|
3374
|
+
}), this.value.angle = 90);
|
|
3375
|
+
} else
|
|
3376
|
+
this.value.stops.push({
|
|
3377
|
+
color: "#786666",
|
|
3378
|
+
position: 100,
|
|
3379
|
+
opacity: 100
|
|
3380
|
+
}), this.value.angle = 90;
|
|
3381
|
+
} else t !== "solid" && this.value.stops.length >= 2 && (this.value.angle || (this.value.angle = 90));
|
|
3382
|
+
if (this.popoverEl) {
|
|
3252
3383
|
const s = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3253
|
-
s.forEach((
|
|
3254
|
-
const n = s[0],
|
|
3255
|
-
t === "solid" ? n == null || n.classList.add("active") :
|
|
3384
|
+
s.forEach((o) => o.classList.remove("active"));
|
|
3385
|
+
const n = s[0], a = s[1];
|
|
3386
|
+
t === "solid" ? n == null || n.classList.add("active") : a == null || a.classList.add("active");
|
|
3256
3387
|
}
|
|
3257
3388
|
const e = (i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-editor-content");
|
|
3258
3389
|
e && this.updatePopoverContent(e), this.updateUI(), this.triggerChange();
|
|
3259
3390
|
}
|
|
3260
3391
|
updatePopoverContent(t) {
|
|
3261
|
-
t.innerHTML = "", this.value
|
|
3392
|
+
if (t.innerHTML = "", !!this.value) {
|
|
3393
|
+
if (this.variant !== "global" && this.currentMode === "global") {
|
|
3394
|
+
this.renderGlobalColors(t);
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
this.value.type === "solid" ? this.renderSolid(t) : this.renderGradient(t);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
renderGlobalColors(t) {
|
|
3401
|
+
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3402
|
+
const e = this.value.stops[0], i = (c) => {
|
|
3403
|
+
c.innerHTML = "";
|
|
3404
|
+
let d = {};
|
|
3405
|
+
try {
|
|
3406
|
+
d = x.GlobalVariables || {};
|
|
3407
|
+
} catch (m) {
|
|
3408
|
+
console.warn("Could not access Setting.GlobalVariables", m);
|
|
3409
|
+
}
|
|
3410
|
+
if (!d || Object.keys(d).length === 0) {
|
|
3411
|
+
const m = document.createElement("div");
|
|
3412
|
+
m.textContent = "No global colors defined", m.style.fontSize = "12px", m.style.color = "#666", m.style.padding = "8px", c.appendChild(m);
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
const u = [
|
|
3416
|
+
{
|
|
3417
|
+
title: "Global Colors",
|
|
3418
|
+
keys: ["primary", "secondary", "tertiary", "accent", "background"]
|
|
3419
|
+
},
|
|
3420
|
+
{
|
|
3421
|
+
title: "Text Color",
|
|
3422
|
+
keys: ["text-dark", "text-light"]
|
|
3423
|
+
}
|
|
3424
|
+
], g = this.globalSearchQuery.toLowerCase();
|
|
3425
|
+
let f;
|
|
3426
|
+
this.globalLayoutMode === "list" ? (f = document.createElement("div"), f.className = "global-colors-list") : (f = document.createElement("div"), f.className = "global-colors-grid"), c.appendChild(f), u.forEach((m) => {
|
|
3427
|
+
const v = Object.entries(d).filter(([C]) => !m.keys.includes(C) && m.title !== "Global Colors" ? !1 : m.keys.includes(C) && C.toLowerCase().includes(g));
|
|
3428
|
+
v.length !== 0 && v.forEach(([C, w]) => {
|
|
3429
|
+
if (this.globalLayoutMode === "list") {
|
|
3430
|
+
const E = document.createElement("div");
|
|
3431
|
+
E.className = "global-color-row";
|
|
3432
|
+
const M = document.createElement("div");
|
|
3433
|
+
M.className = "global-color-circle";
|
|
3434
|
+
const y = this.resolveGlobalVarColor(w);
|
|
3435
|
+
M.style.background = y, e.color === `var(--${C})` && M.classList.add("selected");
|
|
3436
|
+
const b = document.createElement("span");
|
|
3437
|
+
b.className = "global-color-label", b.textContent = C.split("-").map((k) => k.charAt(0).toUpperCase() + k.slice(1)).join(" "), E.appendChild(M), E.appendChild(b), E.addEventListener("click", (k) => {
|
|
3438
|
+
k.preventDefault();
|
|
3439
|
+
const $ = `var(--${C})`;
|
|
3440
|
+
this.setValue($), this.pendingSolidColor = $, i(c);
|
|
3441
|
+
}), f.appendChild(E);
|
|
3442
|
+
} else {
|
|
3443
|
+
const E = document.createElement("div");
|
|
3444
|
+
E.className = "global-color-circle";
|
|
3445
|
+
const M = this.resolveGlobalVarColor(w);
|
|
3446
|
+
E.style.background = M, E.title = C.split("-").map((y) => y.charAt(0).toUpperCase() + y.slice(1)).join(" "), e.color === `var(--${C})` && E.classList.add("selected"), E.addEventListener("click", (y) => {
|
|
3447
|
+
y.preventDefault();
|
|
3448
|
+
const b = `var(--${C})`;
|
|
3449
|
+
this.setValue(b), this.pendingSolidColor = b, i(c);
|
|
3450
|
+
}), f.appendChild(E);
|
|
3451
|
+
}
|
|
3452
|
+
});
|
|
3453
|
+
});
|
|
3454
|
+
}, s = document.createElement("div");
|
|
3455
|
+
s.className = "global-controls-row";
|
|
3456
|
+
const n = document.createElement("div");
|
|
3457
|
+
n.className = "global-search-container";
|
|
3458
|
+
const a = document.createElement("span");
|
|
3459
|
+
a.className = "global-search-icon", a.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>';
|
|
3460
|
+
const o = document.createElement("input");
|
|
3461
|
+
o.type = "text", o.className = "global-search-input", o.placeholder = "Search", o.value = this.globalSearchQuery;
|
|
3462
|
+
const l = document.createElement("div");
|
|
3463
|
+
o.addEventListener("input", (c) => {
|
|
3464
|
+
this.globalSearchQuery = c.target.value, i(l);
|
|
3465
|
+
}), n.appendChild(a), n.appendChild(o);
|
|
3466
|
+
const r = document.createElement("button");
|
|
3467
|
+
r.className = "global-layout-toggle", r.type = "button";
|
|
3468
|
+
const p = () => {
|
|
3469
|
+
r.innerHTML = this.globalLayoutMode === "list" ? '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>';
|
|
3470
|
+
};
|
|
3471
|
+
p(), r.addEventListener("click", () => {
|
|
3472
|
+
this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", p(), i(l);
|
|
3473
|
+
}), s.appendChild(n), s.appendChild(r), t.appendChild(s), t.appendChild(l), i(l);
|
|
3262
3474
|
}
|
|
3263
3475
|
renderSolid(t) {
|
|
3264
3476
|
(!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
|
|
3265
|
-
const e = this.value.stops[0], i = new
|
|
3266
|
-
initialColor: e.color,
|
|
3477
|
+
const e = this.value.stops[0], i = new Qt({
|
|
3478
|
+
initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
|
|
3267
3479
|
initialOpacity: e.opacity ?? 100,
|
|
3268
3480
|
onColorChange: (s, n) => {
|
|
3269
3481
|
if (this.value) {
|
|
3270
|
-
const
|
|
3271
|
-
if (
|
|
3272
|
-
this.value =
|
|
3482
|
+
const a = I(s);
|
|
3483
|
+
if (a && a.type !== "solid") {
|
|
3484
|
+
this.value = a, this.switchType(a.type);
|
|
3273
3485
|
return;
|
|
3274
3486
|
}
|
|
3275
3487
|
this.value.stops[0].color = s, this.value.stops[0].opacity = n, this.updateUI(), this.triggerChange(), this.pendingSolidColor = s;
|
|
@@ -3280,65 +3492,67 @@ const V = class V extends w {
|
|
|
3280
3492
|
}
|
|
3281
3493
|
renderGradient(t) {
|
|
3282
3494
|
this.solidPicker = null;
|
|
3283
|
-
const e =
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3495
|
+
const e = this.variant !== "global";
|
|
3496
|
+
let i = null;
|
|
3497
|
+
if (e) {
|
|
3498
|
+
const c = document.createElement("div");
|
|
3499
|
+
c.className = "gradient-subtype-inline";
|
|
3500
|
+
const d = document.createElement("select");
|
|
3501
|
+
d.className = "gradient-subtype-select";
|
|
3502
|
+
const u = document.createElement("option");
|
|
3503
|
+
u.value = "linear", u.textContent = "Linear";
|
|
3504
|
+
const g = document.createElement("option");
|
|
3505
|
+
g.value = "radial", g.textContent = "Radial", d.appendChild(u), d.appendChild(g), d.value = this.value.type === "radial" ? "radial" : "linear", i = document.createElement("input"), i.type = "text", i.inputMode = "numeric", i.className = "gradient-degree-input", i.value = `${this.value.angle ?? 90}°`, i.style.width = "75px", i.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, i.value = "90°");
|
|
3506
|
+
const f = document.createElement("button");
|
|
3507
|
+
f.type = "button", f.className = "gradient-flip-btn", f.innerHTML = _t, d.addEventListener("change", () => {
|
|
3508
|
+
this.switchType(d.value === "radial" ? "radial" : "linear"), i && this.updateDegreeVisibility(i);
|
|
3509
|
+
}), i.addEventListener("focus", (m) => {
|
|
3510
|
+
const v = m.target;
|
|
3511
|
+
v.value = v.value.replace(/[^0-9-]/g, ""), setTimeout(() => v.select(), 0);
|
|
3512
|
+
}), i.addEventListener("input", (m) => {
|
|
3513
|
+
const v = parseInt(m.target.value);
|
|
3514
|
+
!Number.isNaN(v) && this.value && (this.value.angle = Math.max(0, Math.min(360, v)), this.debouncedPreviewUpdate());
|
|
3515
|
+
}), i.addEventListener("blur", (m) => {
|
|
3516
|
+
var w;
|
|
3517
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3518
|
+
const v = m.target;
|
|
3519
|
+
let C = parseInt(v.value);
|
|
3520
|
+
Number.isNaN(C) && (C = ((w = this.value) == null ? void 0 : w.angle) ?? 0), C = Math.max(0, Math.min(360, C)), this.value && (this.value.angle = C), v.value = `${C}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3521
|
+
}), f.addEventListener("click", () => {
|
|
3522
|
+
!this.value || !this.value.stops || (this.value.stops.forEach((m) => {
|
|
3523
|
+
m.position = 100 - m.position;
|
|
3524
|
+
}), this.value.stops.sort((m, v) => m.position - v.position), this.updateGradientPreview(s), this.createHandles(n, s), this.updateStopsList(r), this.updateUI(), this.triggerChange());
|
|
3525
|
+
}), c.appendChild(d), c.appendChild(i), c.appendChild(f), t.appendChild(c), this.updateDegreeVisibility(i);
|
|
3526
|
+
}
|
|
3527
|
+
const s = document.createElement("div");
|
|
3528
|
+
s.className = "gradient-preview", this.updateGradientPreview(s);
|
|
3529
|
+
const n = document.createElement("div");
|
|
3530
|
+
n.className = "gradient-handles", s.appendChild(n), t.appendChild(s), this.createHandles(n, s);
|
|
3531
|
+
const a = document.createElement("div");
|
|
3532
|
+
a.className = "gradient-stops-header";
|
|
3533
|
+
const o = document.createElement("span");
|
|
3534
|
+
o.textContent = "Stops";
|
|
3535
|
+
const l = document.createElement("button");
|
|
3536
|
+
l.type = "button", l.className = "gradient-add-stop", l.textContent = "+", a.appendChild(o), a.appendChild(l);
|
|
3315
3537
|
const r = document.createElement("div");
|
|
3316
|
-
r.className = "gradient-
|
|
3317
|
-
const
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
p.textContent = "Stops";
|
|
3321
|
-
const d = document.createElement("button");
|
|
3322
|
-
d.type = "button", d.className = "gradient-add-stop", d.textContent = "+", h.appendChild(p), h.appendChild(d);
|
|
3323
|
-
const u = document.createElement("div");
|
|
3324
|
-
u.className = "gradient-stops", t.appendChild(h), t.appendChild(u), this.updateStopsList(u);
|
|
3325
|
-
const m = et((f) => {
|
|
3326
|
-
const g = P(f);
|
|
3327
|
-
g && (this.value = g, this.switchType(g.type), this.updateUI(), this.triggerChange());
|
|
3538
|
+
r.className = "gradient-stops", t.appendChild(a), t.appendChild(r), this.updateStopsList(r);
|
|
3539
|
+
const p = it((c) => {
|
|
3540
|
+
const d = I(c);
|
|
3541
|
+
d && (this.value = d, this.switchType(d.type), this.updateUI(), this.triggerChange());
|
|
3328
3542
|
}, "all");
|
|
3329
|
-
this.recentGradientRefresh =
|
|
3330
|
-
var
|
|
3331
|
-
this.addStop(), this.updateStopsList(
|
|
3543
|
+
this.recentGradientRefresh = p.refresh, t.appendChild(p.container), l.addEventListener("click", () => {
|
|
3544
|
+
var c;
|
|
3545
|
+
this.addStop(), this.updateStopsList(r), this.updateGradientPreview(s), this.createHandles(n, s), this.updateUI(), ((c = document.activeElement) == null ? void 0 : c.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
|
|
3332
3546
|
});
|
|
3333
3547
|
}
|
|
3334
3548
|
updateDegreeVisibility(t) {
|
|
3335
3549
|
var e;
|
|
3336
|
-
((e = this.value) == null ? void 0 : e.type) === "radial" ? (t.disabled = !0, t.style.opacity = "0.5") : (t.disabled = !1, t.style.opacity = "1");
|
|
3550
|
+
t && (((e = this.value) == null ? void 0 : e.type) === "radial" ? (t.disabled = !0, t.style.opacity = "0.5") : (t.disabled = !1, t.style.opacity = "1"));
|
|
3337
3551
|
}
|
|
3338
3552
|
updateGradientPreview(t) {
|
|
3339
3553
|
var i;
|
|
3340
3554
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
|
|
3341
|
-
e && this.value && (e.style.background =
|
|
3555
|
+
e && this.value && (e.style.background = T(this.value));
|
|
3342
3556
|
}
|
|
3343
3557
|
debouncedPreviewUpdate(t) {
|
|
3344
3558
|
this.previewUpdateTimeout && clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = window.setTimeout(() => {
|
|
@@ -3349,151 +3563,151 @@ const V = class V extends w {
|
|
|
3349
3563
|
t.innerHTML = "", !(!this.value || this.value.type === "solid" || !this.value.stops) && this.value.stops.forEach((i, s) => {
|
|
3350
3564
|
const n = document.createElement("div");
|
|
3351
3565
|
n.className = "gstop-handle", n.style.left = `${Math.max(0, Math.min(100, i.position))}%`, n.style.top = "0%";
|
|
3352
|
-
const
|
|
3353
|
-
|
|
3354
|
-
let
|
|
3355
|
-
const
|
|
3356
|
-
|
|
3357
|
-
},
|
|
3358
|
-
if (!
|
|
3359
|
-
const
|
|
3360
|
-
let
|
|
3361
|
-
|
|
3566
|
+
const a = document.createElement("div");
|
|
3567
|
+
a.className = "gstop-chip", a.style.backgroundColor = i.color, n.appendChild(a);
|
|
3568
|
+
let o = !1, l = 0, r = 0;
|
|
3569
|
+
const p = (u) => {
|
|
3570
|
+
o = !0, l = u.clientX, r = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", c), document.addEventListener("mouseup", d), u.preventDefault(), u.stopPropagation();
|
|
3571
|
+
}, c = (u) => {
|
|
3572
|
+
if (!o || !this.value) return;
|
|
3573
|
+
const g = e.getBoundingClientRect(), f = u.clientX - l;
|
|
3574
|
+
let m = r + f / g.width * 100;
|
|
3575
|
+
m = Math.max(0, Math.min(100, m)), this.value.stops[s].position = Math.round(m), n.style.left = `${m}%`, this.updateGradientPreview();
|
|
3362
3576
|
}, d = () => {
|
|
3363
|
-
|
|
3577
|
+
o && (o = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", d), this.value && (this.value.stops.sort((u, g) => u.position - g.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange());
|
|
3364
3578
|
};
|
|
3365
|
-
n.addEventListener("mousedown",
|
|
3579
|
+
n.addEventListener("mousedown", p), t.appendChild(n);
|
|
3366
3580
|
});
|
|
3367
3581
|
}
|
|
3368
3582
|
updateStopsList(t) {
|
|
3369
3583
|
var i;
|
|
3370
3584
|
const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
|
|
3371
3585
|
!e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
|
|
3372
|
-
var
|
|
3373
|
-
const o = document.createElement("div");
|
|
3374
|
-
o.className = "gstop-row";
|
|
3586
|
+
var E, M;
|
|
3375
3587
|
const a = document.createElement("div");
|
|
3376
|
-
a.className = "gstop-
|
|
3588
|
+
a.className = "gstop-row";
|
|
3589
|
+
const o = document.createElement("div");
|
|
3590
|
+
o.className = "gstop-position-group";
|
|
3377
3591
|
const l = document.createElement("input");
|
|
3378
|
-
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px",
|
|
3592
|
+
l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", o.appendChild(l);
|
|
3379
3593
|
const r = document.createElement("div");
|
|
3380
3594
|
r.className = "gstop-color-container";
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3383
|
-
const
|
|
3384
|
-
|
|
3595
|
+
const p = document.createElement("div");
|
|
3596
|
+
p.className = "gstop-color-preview", p.style.backgroundColor = s.color;
|
|
3597
|
+
const c = document.createElement("input");
|
|
3598
|
+
c.type = "text", c.className = "gstop-color-input", c.value = s.color.replace("#", "").toUpperCase();
|
|
3385
3599
|
const d = document.createElement("button");
|
|
3386
|
-
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(
|
|
3600
|
+
d.type = "button", d.className = "gstop-color-copy", d.textContent = "Copy", r.appendChild(p), r.appendChild(c), r.appendChild(d);
|
|
3387
3601
|
const u = document.createElement("button");
|
|
3388
|
-
u.type = "button", u.className = "gstop-del", u.innerHTML =
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3602
|
+
u.type = "button", u.className = "gstop-del", u.innerHTML = Jt, u.disabled = (((M = (E = this.value) == null ? void 0 : E.stops) == null ? void 0 : M.length) || 0) <= 2, a.appendChild(o), a.appendChild(r), a.appendChild(u), e.appendChild(a);
|
|
3603
|
+
const g = document.createElement("span");
|
|
3604
|
+
g.className = "gstop-opacity-label", g.textContent = "Opacity";
|
|
3391
3605
|
const f = document.createElement("div");
|
|
3392
3606
|
f.className = "gstop-opacity-group";
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3395
|
-
const
|
|
3396
|
-
|
|
3607
|
+
const m = document.createElement("input");
|
|
3608
|
+
m.type = "range", m.className = "gstop-opacity-slider", m.min = "0", m.max = "100", m.value = String(s.opacity ?? 100);
|
|
3609
|
+
const v = S(s.color);
|
|
3610
|
+
m.style.setProperty(
|
|
3397
3611
|
"--slider-color",
|
|
3398
|
-
`rgb(${
|
|
3612
|
+
`rgb(${v.r}, ${v.g}, ${v.b})`
|
|
3399
3613
|
);
|
|
3400
|
-
const
|
|
3401
|
-
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3404
|
-
const
|
|
3405
|
-
|
|
3614
|
+
const C = document.createElement("span");
|
|
3615
|
+
C.className = "gstop-opacity-value", C.textContent = `${s.opacity ?? 100}%`, f.appendChild(m), f.appendChild(C);
|
|
3616
|
+
const w = new Yt((y, b) => {
|
|
3617
|
+
c.value = y.replace("#", "").toUpperCase(), p.style.backgroundColor = y, this.value.stops[n].color = y, b !== void 0 && (this.value.stops[n].opacity = b, m.value = String(b), C.textContent = `${b}%`);
|
|
3618
|
+
const k = S(y);
|
|
3619
|
+
m.style.setProperty(
|
|
3406
3620
|
"--slider-color",
|
|
3407
|
-
`rgb(${
|
|
3621
|
+
`rgb(${k.r}, ${k.g}, ${k.b})`
|
|
3408
3622
|
), this.updateGradientPreview(), this.createHandles(
|
|
3409
3623
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3410
3624
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3411
3625
|
), this.updateUI(), this.triggerChange();
|
|
3412
3626
|
}, "solid");
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
}),
|
|
3416
|
-
const
|
|
3417
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(
|
|
3418
|
-
this.value.stops[n].color =
|
|
3419
|
-
const
|
|
3420
|
-
|
|
3627
|
+
c.addEventListener("click", (y) => {
|
|
3628
|
+
y.preventDefault(), y.stopPropagation(), w.open(s.color, c, s.opacity ?? 100);
|
|
3629
|
+
}), c.addEventListener("input", () => {
|
|
3630
|
+
const y = c.value.trim(), b = y.startsWith("#") ? y : `#${y}`;
|
|
3631
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(b)) {
|
|
3632
|
+
this.value.stops[n].color = b, p.style.backgroundColor = b;
|
|
3633
|
+
const k = S(b);
|
|
3634
|
+
m.style.setProperty(
|
|
3421
3635
|
"--slider-color",
|
|
3422
|
-
`rgb(${
|
|
3636
|
+
`rgb(${k.r}, ${k.g}, ${k.b})`
|
|
3423
3637
|
), this.debouncedPreviewUpdate();
|
|
3424
3638
|
}
|
|
3425
|
-
}),
|
|
3639
|
+
}), c.addEventListener("blur", () => {
|
|
3426
3640
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3427
|
-
}), d.addEventListener("click", async (
|
|
3428
|
-
|
|
3641
|
+
}), d.addEventListener("click", async (y) => {
|
|
3642
|
+
y.stopPropagation();
|
|
3429
3643
|
try {
|
|
3430
|
-
await navigator.clipboard.writeText(`#${
|
|
3644
|
+
await navigator.clipboard.writeText(`#${c.value}`);
|
|
3431
3645
|
} catch {
|
|
3432
3646
|
}
|
|
3433
|
-
}), l.addEventListener("focus", (
|
|
3434
|
-
const
|
|
3435
|
-
|
|
3436
|
-
}), l.addEventListener("input", (
|
|
3437
|
-
const
|
|
3438
|
-
if (!Number.isNaN(
|
|
3439
|
-
const
|
|
3440
|
-
this.value.stops[n].position =
|
|
3647
|
+
}), l.addEventListener("focus", (y) => {
|
|
3648
|
+
const b = y.target;
|
|
3649
|
+
b.value = b.value.replace("%", ""), b.select();
|
|
3650
|
+
}), l.addEventListener("input", (y) => {
|
|
3651
|
+
const b = y.target, k = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3652
|
+
if (!Number.isNaN(k)) {
|
|
3653
|
+
const $ = Math.max(0, Math.min(100, k));
|
|
3654
|
+
this.value.stops[n].position = $, b.value = `${$}%`, this.debouncedPreviewUpdate();
|
|
3441
3655
|
}
|
|
3442
|
-
}), l.addEventListener("blur", (
|
|
3656
|
+
}), l.addEventListener("blur", (y) => {
|
|
3443
3657
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
|
|
3444
|
-
const
|
|
3445
|
-
if (Number.isNaN(
|
|
3446
|
-
|
|
3658
|
+
const b = y.target, k = parseInt(b.value.replace(/[^\d]/g, ""), 10);
|
|
3659
|
+
if (Number.isNaN(k))
|
|
3660
|
+
b.value = `${this.value.stops[n].position}%`;
|
|
3447
3661
|
else {
|
|
3448
|
-
const
|
|
3449
|
-
this.value.stops[n].position =
|
|
3662
|
+
const $ = Math.max(0, Math.min(100, k));
|
|
3663
|
+
this.value.stops[n].position = $, b.value = `${$}%`;
|
|
3450
3664
|
}
|
|
3451
3665
|
this.updateGradientPreview(), this.createHandles(
|
|
3452
3666
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3453
3667
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3454
3668
|
), this.updateStopsList(), this.updateUI(), this.triggerChange();
|
|
3455
3669
|
}), u.addEventListener("click", () => {
|
|
3456
|
-
var
|
|
3670
|
+
var y;
|
|
3457
3671
|
(this.value.stops.length || 0) <= 2 || (this.value.stops.splice(n, 1), this.createHandles(
|
|
3458
3672
|
this.popoverEl.querySelector(".gradient-handles"),
|
|
3459
3673
|
this.popoverEl.querySelector(".gradient-preview")
|
|
3460
|
-
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((
|
|
3461
|
-
}),
|
|
3462
|
-
const
|
|
3463
|
-
this.value.stops[n].opacity = Math.max(0, Math.min(100,
|
|
3464
|
-
}),
|
|
3674
|
+
), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((y = document.activeElement) == null ? void 0 : y.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
|
|
3675
|
+
}), m.addEventListener("input", () => {
|
|
3676
|
+
const y = parseInt(m.value, 10);
|
|
3677
|
+
this.value.stops[n].opacity = Math.max(0, Math.min(100, y)), C.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
|
|
3678
|
+
}), m.addEventListener("change", () => {
|
|
3465
3679
|
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
|
|
3466
3680
|
});
|
|
3467
3681
|
}));
|
|
3468
3682
|
}
|
|
3469
3683
|
addStop() {
|
|
3470
3684
|
if (!this.value || this.value.type === "solid" || !this.value.stops) return;
|
|
3471
|
-
const t = this.value.stops.map((
|
|
3685
|
+
const t = this.value.stops.map((a) => a.position).sort((a, o) => a - o);
|
|
3472
3686
|
let e = 50, i = 0;
|
|
3473
|
-
for (let
|
|
3474
|
-
const
|
|
3475
|
-
|
|
3687
|
+
for (let a = 0; a < t.length - 1; a++) {
|
|
3688
|
+
const o = t[a + 1] - t[a];
|
|
3689
|
+
o > i && (i = o, e = t[a] + o / 2);
|
|
3476
3690
|
}
|
|
3477
3691
|
const s = this.value.stops.reduce(
|
|
3478
|
-
(
|
|
3692
|
+
(a, o) => Math.abs(o.position - e) < Math.abs(a.position - e) ? o : a
|
|
3479
3693
|
), n = {
|
|
3480
3694
|
position: Math.round(e),
|
|
3481
3695
|
color: s.color,
|
|
3482
3696
|
opacity: s.opacity ?? 100
|
|
3483
3697
|
};
|
|
3484
|
-
this.value.stops.push(n), this.value.stops.sort((
|
|
3698
|
+
this.value.stops.push(n), this.value.stops.sort((a, o) => a.position - o.position);
|
|
3485
3699
|
}
|
|
3486
3700
|
openPopover() {
|
|
3487
|
-
if (this.popoverEl && (
|
|
3488
|
-
if (this.isPopoverOpen = !0,
|
|
3701
|
+
if (this.popoverEl && (P.openInstance && P.openInstance !== this && P.openInstance.closePopover(), !this.isPopoverOpen)) {
|
|
3702
|
+
if (this.isPopoverOpen = !0, P.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) {
|
|
3489
3703
|
const t = this.element.getBoundingClientRect(), e = 306, i = window.innerWidth, s = window.innerHeight, n = 16;
|
|
3490
3704
|
this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3491
|
-
const
|
|
3492
|
-
let
|
|
3493
|
-
const r = i - t.right,
|
|
3494
|
-
r <
|
|
3705
|
+
const a = this.popoverEl.offsetHeight;
|
|
3706
|
+
let o = t.right + 8, l = t.top;
|
|
3707
|
+
const r = i - t.right, p = t.left, c = e + n;
|
|
3708
|
+
r < c && p > r + 100 && (o = t.left - e - 8);
|
|
3495
3709
|
const d = s - t.bottom, u = t.top;
|
|
3496
|
-
u >=
|
|
3710
|
+
u >= a + n ? l = t.top - a - 8 : d >= a + n ? l = t.bottom + 8 : u > d ? (l = t.top - a - 8, l < n && (l = n)) : (l = t.bottom + 8, l + a > s - n && (l = s - a - n)), this.popoverEl.style.left = `${o}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: o, top: l };
|
|
3497
3711
|
}
|
|
3498
3712
|
setTimeout(
|
|
3499
3713
|
() => document.addEventListener("click", this.onBackgroundClick, !0),
|
|
@@ -3510,24 +3724,24 @@ const V = class V extends w {
|
|
|
3510
3724
|
}
|
|
3511
3725
|
requestAnimationFrame(() => {
|
|
3512
3726
|
if (!this.popoverEl || !this.element) return;
|
|
3513
|
-
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight,
|
|
3727
|
+
const e = this.element.getBoundingClientRect(), i = 306, s = window.innerWidth, n = window.innerHeight, a = 16;
|
|
3514
3728
|
this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
|
|
3515
|
-
const
|
|
3729
|
+
const o = this.popoverEl.offsetHeight;
|
|
3516
3730
|
let l = e.right + 8, r = e.top;
|
|
3517
|
-
const
|
|
3518
|
-
|
|
3519
|
-
const u = n - e.bottom,
|
|
3520
|
-
|
|
3731
|
+
const p = s - e.right, c = e.left, d = i + a;
|
|
3732
|
+
p < d && c > p + 100 && (l = e.left - i - 8);
|
|
3733
|
+
const u = n - e.bottom, g = e.top;
|
|
3734
|
+
g >= o + a ? r = e.top - o - 8 : u >= o + a ? r = e.bottom + 8 : g > u ? (r = e.top - o - 8, r < a && (r = a)) : (r = e.bottom + 8, r + o > n - a && (r = n - o - a)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
|
|
3521
3735
|
});
|
|
3522
3736
|
}
|
|
3523
3737
|
}
|
|
3524
3738
|
refreshPopoverContent() {
|
|
3525
|
-
var n,
|
|
3739
|
+
var n, a;
|
|
3526
3740
|
if (!this.popoverEl) return;
|
|
3527
3741
|
const t = this.popoverEl.querySelectorAll(".gradient-type-tab");
|
|
3528
|
-
t.forEach((
|
|
3742
|
+
t.forEach((o) => o.classList.remove("active"));
|
|
3529
3743
|
const e = t[0], i = t[1];
|
|
3530
|
-
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (
|
|
3744
|
+
((n = this.value) == null ? void 0 : n.type) === "solid" ? e.classList.add("active") : (i.classList.add("active"), (a = this.recentGradientRefresh) == null || a.call(this)), this.popoverEl.offsetHeight;
|
|
3531
3745
|
const s = this.popoverEl.querySelector(".gradient-editor-content");
|
|
3532
3746
|
s && this.updatePopoverContent(s);
|
|
3533
3747
|
}
|
|
@@ -3535,10 +3749,10 @@ const V = class V extends w {
|
|
|
3535
3749
|
var t;
|
|
3536
3750
|
if (!(!this.popoverEl || !this.isPopoverOpen)) {
|
|
3537
3751
|
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") {
|
|
3538
|
-
const e =
|
|
3752
|
+
const e = T(this.value);
|
|
3539
3753
|
D.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
|
|
3540
3754
|
}
|
|
3541
|
-
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null),
|
|
3755
|
+
this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), P.openInstance === this && (P.openInstance = null);
|
|
3542
3756
|
}
|
|
3543
3757
|
}
|
|
3544
3758
|
commitPendingSolidColor() {
|
|
@@ -3555,7 +3769,7 @@ const V = class V extends w {
|
|
|
3555
3769
|
this.parseAndSet(e.value);
|
|
3556
3770
|
}
|
|
3557
3771
|
parseAndSet(t) {
|
|
3558
|
-
const e =
|
|
3772
|
+
const e = I(t.trim());
|
|
3559
3773
|
e && this.setValue(e);
|
|
3560
3774
|
}
|
|
3561
3775
|
triggerChange() {
|
|
@@ -3566,10 +3780,10 @@ const V = class V extends w {
|
|
|
3566
3780
|
return this.element;
|
|
3567
3781
|
}
|
|
3568
3782
|
getValue() {
|
|
3569
|
-
return this.value ?
|
|
3783
|
+
return this.value ? T(this.value) : "";
|
|
3570
3784
|
}
|
|
3571
3785
|
getCSSValue() {
|
|
3572
|
-
return this.value ?
|
|
3786
|
+
return this.value ? T(this.value) : "";
|
|
3573
3787
|
}
|
|
3574
3788
|
getCSSForText() {
|
|
3575
3789
|
return this.value ? this.cssForTextValue() : {};
|
|
@@ -3578,36 +3792,36 @@ const V = class V extends w {
|
|
|
3578
3792
|
return this.value;
|
|
3579
3793
|
}
|
|
3580
3794
|
};
|
|
3581
|
-
|
|
3582
|
-
let
|
|
3583
|
-
const
|
|
3795
|
+
P.openInstance = null;
|
|
3796
|
+
let X = P;
|
|
3797
|
+
const te = `
|
|
3584
3798
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3585
3799
|
<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"/>
|
|
3586
3800
|
</svg>
|
|
3587
|
-
`,
|
|
3801
|
+
`, ee = `
|
|
3588
3802
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3589
3803
|
<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"/>
|
|
3590
3804
|
</svg>
|
|
3591
3805
|
`;
|
|
3592
|
-
class
|
|
3806
|
+
class xe extends H {
|
|
3593
3807
|
constructor(t) {
|
|
3594
3808
|
super({
|
|
3595
3809
|
title: "Border",
|
|
3596
3810
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3597
3811
|
settings: {
|
|
3598
|
-
size: new
|
|
3812
|
+
size: new V({
|
|
3599
3813
|
title: "Size",
|
|
3600
|
-
icon:
|
|
3814
|
+
icon: ee,
|
|
3601
3815
|
default: (t == null ? void 0 : t.size) ?? 0,
|
|
3602
3816
|
suffix: "px"
|
|
3603
3817
|
}),
|
|
3604
|
-
color: new
|
|
3818
|
+
color: new X({
|
|
3605
3819
|
title: "Border Color",
|
|
3606
3820
|
default: (t == null ? void 0 : t.color) || "#000000"
|
|
3607
3821
|
}),
|
|
3608
|
-
radius: new
|
|
3822
|
+
radius: new V({
|
|
3609
3823
|
title: "Radius",
|
|
3610
|
-
icon:
|
|
3824
|
+
icon: te,
|
|
3611
3825
|
default: (t == null ? void 0 : t.radius) ?? 12,
|
|
3612
3826
|
suffix: "px"
|
|
3613
3827
|
})
|
|
@@ -3631,20 +3845,20 @@ class ye extends T {
|
|
|
3631
3845
|
`;
|
|
3632
3846
|
}
|
|
3633
3847
|
}
|
|
3634
|
-
const
|
|
3848
|
+
const ie = `
|
|
3635
3849
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
|
|
3636
3850
|
<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"/>
|
|
3637
3851
|
</svg>
|
|
3638
|
-
`,
|
|
3852
|
+
`, se = `
|
|
3639
3853
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3640
3854
|
<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"/>
|
|
3641
3855
|
</svg>
|
|
3642
|
-
`,
|
|
3856
|
+
`, ne = `
|
|
3643
3857
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3644
3858
|
<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"/>
|
|
3645
3859
|
</svg>
|
|
3646
3860
|
`;
|
|
3647
|
-
class
|
|
3861
|
+
class Le extends H {
|
|
3648
3862
|
constructor(t = {}) {
|
|
3649
3863
|
const { showAlign: e = t.showAlign ?? !0, ...i } = t;
|
|
3650
3864
|
super({
|
|
@@ -3652,13 +3866,13 @@ class Ee extends T {
|
|
|
3652
3866
|
collapsed: i.collapsed,
|
|
3653
3867
|
settings: (() => {
|
|
3654
3868
|
const s = {
|
|
3655
|
-
color: new
|
|
3869
|
+
color: new X({
|
|
3656
3870
|
title: "Color",
|
|
3657
3871
|
default: i.colorDefault ?? "#001E1E"
|
|
3658
3872
|
}),
|
|
3659
3873
|
fontFamily: new tt({
|
|
3660
3874
|
title: "Font",
|
|
3661
|
-
icon:
|
|
3875
|
+
icon: ie,
|
|
3662
3876
|
default: i.fontFamilyDefault ?? "Satoshi",
|
|
3663
3877
|
options: i.fontFamilyOptions ?? [
|
|
3664
3878
|
{ name: "Alt", value: "Croco Sans Black Caps Alt" },
|
|
@@ -3671,7 +3885,7 @@ class Ee extends T {
|
|
|
3671
3885
|
}),
|
|
3672
3886
|
fontWeight: new tt({
|
|
3673
3887
|
title: "Weight",
|
|
3674
|
-
icon:
|
|
3888
|
+
icon: se,
|
|
3675
3889
|
default: i.fontWeightDefault ?? "400",
|
|
3676
3890
|
options: i.fontWeightOptions ?? [
|
|
3677
3891
|
{ name: "Regular", value: "400" },
|
|
@@ -3681,9 +3895,9 @@ class Ee extends T {
|
|
|
3681
3895
|
getOptions: i.fontWeightGetOptions,
|
|
3682
3896
|
getOptionsAsync: i.fontWeightGetOptionsAsync
|
|
3683
3897
|
}),
|
|
3684
|
-
fontSize: new
|
|
3898
|
+
fontSize: new V({
|
|
3685
3899
|
title: "Size",
|
|
3686
|
-
icon:
|
|
3900
|
+
icon: ne,
|
|
3687
3901
|
default: i.fontSizeDefault ?? 12,
|
|
3688
3902
|
suffix: "px",
|
|
3689
3903
|
mobile: i.fontSizeMobileDefault
|
|
@@ -3691,7 +3905,7 @@ class Ee extends T {
|
|
|
3691
3905
|
};
|
|
3692
3906
|
return e ? {
|
|
3693
3907
|
...s,
|
|
3694
|
-
align: new
|
|
3908
|
+
align: new Vt({
|
|
3695
3909
|
title: "Align",
|
|
3696
3910
|
default: i.alignDefault ?? "center"
|
|
3697
3911
|
})
|
|
@@ -3700,8 +3914,8 @@ class Ee extends T {
|
|
|
3700
3914
|
});
|
|
3701
3915
|
}
|
|
3702
3916
|
getCssCode() {
|
|
3703
|
-
var
|
|
3704
|
-
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 = ((
|
|
3917
|
+
var a;
|
|
3918
|
+
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 = ((a = this.settings.align) == null ? void 0 : a.value) ?? "left";
|
|
3705
3919
|
return `
|
|
3706
3920
|
color: ${t};
|
|
3707
3921
|
font-family: ${e};
|
|
@@ -3711,8 +3925,8 @@ class Ee extends T {
|
|
|
3711
3925
|
`;
|
|
3712
3926
|
}
|
|
3713
3927
|
getTextGradientCss() {
|
|
3714
|
-
var
|
|
3715
|
-
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 = ((
|
|
3928
|
+
var o;
|
|
3929
|
+
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 = ((o = this.settings.align) == null ? void 0 : o.value) ?? "left";
|
|
3716
3930
|
return `
|
|
3717
3931
|
${Object.entries(t).map(([l, r]) => `${l}: ${r};`).join(`
|
|
3718
3932
|
`)}
|
|
@@ -3723,7 +3937,7 @@ class Ee extends T {
|
|
|
3723
3937
|
`;
|
|
3724
3938
|
}
|
|
3725
3939
|
}
|
|
3726
|
-
class j extends
|
|
3940
|
+
class j extends x {
|
|
3727
3941
|
constructor(t) {
|
|
3728
3942
|
super({
|
|
3729
3943
|
...t,
|
|
@@ -3731,11 +3945,11 @@ class j extends w {
|
|
|
3731
3945
|
}), this.inputType = "number", this.value = t.default !== void 0 ? t.default : "auto";
|
|
3732
3946
|
}
|
|
3733
3947
|
draw() {
|
|
3734
|
-
const t = this.value === "auto" ? "text" : "number", e = (
|
|
3735
|
-
this.value !== "auto" && (this.props.minValue !== void 0 && (
|
|
3948
|
+
const t = this.value === "auto" ? "text" : "number", e = (o) => {
|
|
3949
|
+
this.value !== "auto" && (this.props.minValue !== void 0 && (o.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (o.max = String(this.props.maxValue)), this.props.className && o.classList.add(this.props.className), o.addEventListener("input", () => {
|
|
3736
3950
|
const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
|
|
3737
|
-
let
|
|
3738
|
-
|
|
3951
|
+
let p = Number(o.value);
|
|
3952
|
+
p < l && (p = l), p > r && (p = r), o.value = String(p);
|
|
3739
3953
|
}));
|
|
3740
3954
|
}, i = this.createInput({
|
|
3741
3955
|
value: this.value,
|
|
@@ -3756,9 +3970,9 @@ class j extends w {
|
|
|
3756
3970
|
s && (s.style.paddingRight = "35px");
|
|
3757
3971
|
const n = document.createElement("span");
|
|
3758
3972
|
n.className = "suffix-label", n.textContent = this.props.suffix, i.appendChild(n);
|
|
3759
|
-
const
|
|
3760
|
-
return
|
|
3761
|
-
const l =
|
|
3973
|
+
const a = i.querySelector("input");
|
|
3974
|
+
return a && (a.oninput = (o) => {
|
|
3975
|
+
const l = o.target.value.trim();
|
|
3762
3976
|
if (l.toLowerCase() === "auto")
|
|
3763
3977
|
this.value = "auto";
|
|
3764
3978
|
else {
|
|
@@ -3769,7 +3983,7 @@ class j extends w {
|
|
|
3769
3983
|
}), i;
|
|
3770
3984
|
}
|
|
3771
3985
|
}
|
|
3772
|
-
class
|
|
3986
|
+
class ke extends H {
|
|
3773
3987
|
constructor(t) {
|
|
3774
3988
|
super({
|
|
3775
3989
|
title: "Margins",
|
|
@@ -3777,25 +3991,25 @@ class be extends T {
|
|
|
3777
3991
|
settings: {
|
|
3778
3992
|
marginTop: new j({
|
|
3779
3993
|
title: "Top",
|
|
3780
|
-
icon:
|
|
3994
|
+
icon: oe,
|
|
3781
3995
|
suffix: "px",
|
|
3782
3996
|
default: (t == null ? void 0 : t.marginTop) ?? "auto"
|
|
3783
3997
|
}),
|
|
3784
3998
|
marginRight: new j({
|
|
3785
3999
|
title: "Right",
|
|
3786
|
-
icon:
|
|
4000
|
+
icon: ae,
|
|
3787
4001
|
suffix: "px",
|
|
3788
4002
|
default: (t == null ? void 0 : t.marginRight) ?? 0
|
|
3789
4003
|
}),
|
|
3790
4004
|
marginBottom: new j({
|
|
3791
4005
|
title: "Bottom",
|
|
3792
|
-
icon:
|
|
4006
|
+
icon: le,
|
|
3793
4007
|
suffix: "px",
|
|
3794
4008
|
default: (t == null ? void 0 : t.marginBottom) ?? 0
|
|
3795
4009
|
}),
|
|
3796
4010
|
marginLeft: new j({
|
|
3797
4011
|
title: "Left",
|
|
3798
|
-
icon:
|
|
4012
|
+
icon: re,
|
|
3799
4013
|
suffix: "px",
|
|
3800
4014
|
default: (t == null ? void 0 : t.marginLeft) ?? 0
|
|
3801
4015
|
})
|
|
@@ -3812,26 +4026,26 @@ class be extends T {
|
|
|
3812
4026
|
`;
|
|
3813
4027
|
}
|
|
3814
4028
|
}
|
|
3815
|
-
const
|
|
4029
|
+
const oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3816
4030
|
<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"/>
|
|
3817
|
-
</svg>`,
|
|
4031
|
+
</svg>`, ae = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3818
4032
|
<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"/>
|
|
3819
|
-
</svg>`,
|
|
4033
|
+
</svg>`, le = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3820
4034
|
<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"/>
|
|
3821
|
-
</svg>`,
|
|
4035
|
+
</svg>`, re = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
3822
4036
|
<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"/>
|
|
3823
4037
|
</svg>`;
|
|
3824
|
-
class
|
|
4038
|
+
class Me extends H {
|
|
3825
4039
|
constructor(t) {
|
|
3826
4040
|
super({
|
|
3827
4041
|
title: "Background Image",
|
|
3828
4042
|
collapsed: t == null ? void 0 : t.collapsed,
|
|
3829
4043
|
settings: {
|
|
3830
|
-
backgroundImage: new
|
|
4044
|
+
backgroundImage: new ct({
|
|
3831
4045
|
...t == null ? void 0 : t.uploadProps,
|
|
3832
4046
|
default: (t == null ? void 0 : t.backgroundImage) ?? ""
|
|
3833
4047
|
}),
|
|
3834
|
-
opacity: new
|
|
4048
|
+
opacity: new Nt({
|
|
3835
4049
|
default: (t == null ? void 0 : t.opacity) ?? 100
|
|
3836
4050
|
}),
|
|
3837
4051
|
backgroundColor: new R({
|
|
@@ -3843,10 +4057,10 @@ class we extends T {
|
|
|
3843
4057
|
draw() {
|
|
3844
4058
|
const t = super.draw(), e = t.querySelector(".setting-group-content");
|
|
3845
4059
|
if (!e) return t;
|
|
3846
|
-
const i = Array.from(e.children), [s, n,
|
|
4060
|
+
const i = Array.from(e.children), [s, n, a] = i;
|
|
3847
4061
|
e.innerHTML = "", e.appendChild(s), e.appendChild(n);
|
|
3848
|
-
const
|
|
3849
|
-
return
|
|
4062
|
+
const o = document.createElement("div");
|
|
4063
|
+
return o.className = "bgset-or-label", o.textContent = "OR", e.appendChild(o), e.appendChild(a), t;
|
|
3850
4064
|
}
|
|
3851
4065
|
getCssCode() {
|
|
3852
4066
|
const t = this.settings.backgroundImage.value || "", e = this.settings.opacity.value ?? 100, i = this.settings.backgroundColor.value || "#000000";
|
|
@@ -3861,40 +4075,40 @@ class we extends T {
|
|
|
3861
4075
|
}
|
|
3862
4076
|
}
|
|
3863
4077
|
export {
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
4078
|
+
Vt as AlignSetting,
|
|
4079
|
+
we as AnimationSetting,
|
|
4080
|
+
Me as BackgroundSettingSet,
|
|
4081
|
+
xe as BorderSettingSet,
|
|
4082
|
+
pe as ButtonSetting,
|
|
4083
|
+
N as ColorSetting,
|
|
3870
4084
|
R as ColorWithOpacitySetting,
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
4085
|
+
ue as DimensionSetting,
|
|
4086
|
+
Ce as GapSetting,
|
|
4087
|
+
X as GradientSetting,
|
|
4088
|
+
Le as HeaderTypographySettingSet,
|
|
4089
|
+
ge as HeightSetting,
|
|
4090
|
+
de as HtmlSetting,
|
|
4091
|
+
ye as MarginBottomSetting,
|
|
4092
|
+
ke as MarginSettingGroup,
|
|
4093
|
+
be as MarginTopSetting,
|
|
4094
|
+
Ee as MultiLanguageSetting,
|
|
4095
|
+
V as NumberSetting,
|
|
4096
|
+
Nt as OpacitySetting,
|
|
4097
|
+
fe as SelectApiSettings,
|
|
3884
4098
|
tt as SelectSetting,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
4099
|
+
x as Setting,
|
|
4100
|
+
H as SettingGroup,
|
|
4101
|
+
Lt as StringSetting,
|
|
4102
|
+
wt as TabSettingGroup,
|
|
4103
|
+
wt as TabsSettingGroup,
|
|
4104
|
+
ve as Toggle,
|
|
4105
|
+
ct as UploadSetting,
|
|
4106
|
+
me as WidthSetting,
|
|
4107
|
+
he as asSettingGroupWithSettings,
|
|
4108
|
+
xt as createSettingGroup,
|
|
4109
|
+
ce as createTabSettingGroup,
|
|
4110
|
+
A as isSetting,
|
|
4111
|
+
nt as isSettingChild,
|
|
4112
|
+
L as isSettingGroup,
|
|
4113
|
+
z as iterateSettings
|
|
3900
4114
|
};
|