@3r1s_s/erisui 1.0.14 → 1.0.16
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/erisui.css +1 -1
- package/dist/erisui.js +119 -22
- package/dist/erisui.mjs +387 -262
- package/package.json +1 -1
package/dist/erisui.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var z = (o, t, e) => t in o ? S(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
-
var v = (o, t, e) => z(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
class M extends HTMLElement {
|
|
1
|
+
class E extends HTMLElement {
|
|
5
2
|
static get observedAttributes() {
|
|
6
3
|
return ["size", "border-radius", "name", "color"];
|
|
7
4
|
}
|
|
@@ -55,32 +52,32 @@ class M extends HTMLElement {
|
|
|
55
52
|
}
|
|
56
53
|
connectedCallback() {
|
|
57
54
|
this.avatar = this.shadowRoot.querySelector(".avatar"), this.initials = this.shadowRoot.querySelector("#initials");
|
|
58
|
-
const t = this.shadowRoot.querySelector("slot"),
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
|
|
55
|
+
const t = this.shadowRoot.querySelector("slot"), i = t && t.assignedNodes().length > 0;
|
|
56
|
+
if (i) {
|
|
57
|
+
const e = t.assignedNodes()[0];
|
|
58
|
+
e && e.tagName === "IMG" && (this.initials.style.display = "none", this.avatar.style.backgroundColor = "transparent");
|
|
62
59
|
} else
|
|
63
60
|
this.hasAttribute("color") && (this.avatar.style.backgroundColor = this.getAttribute("color"));
|
|
64
61
|
if (this.hasAttribute("color") && (this.avatar.style.backgroundColor = this.getAttribute("color")), this.hasAttribute("size")) {
|
|
65
|
-
const
|
|
66
|
-
this.avatar.style.width =
|
|
62
|
+
const e = this.getAttribute("size");
|
|
63
|
+
this.avatar.style.width = e + "px", this.avatar.style.height = e + "px", this.initials.style.fontSize = e / 2 + "px";
|
|
67
64
|
}
|
|
68
|
-
if (this.hasAttribute("border-radius") && (this.avatar.style.borderRadius = this.getAttribute("border-radius") + "px"), this.hasAttribute("name") && (this.avatar.title = this.getAttribute("name")), !
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
|
|
65
|
+
if (this.hasAttribute("border-radius") && (this.avatar.style.borderRadius = this.getAttribute("border-radius") + "px"), this.hasAttribute("name") && (this.avatar.title = this.getAttribute("name")), !i && this.hasAttribute("name")) {
|
|
66
|
+
const a = this.getAttribute("name").trim().split(/\s+/);
|
|
67
|
+
let n = "";
|
|
68
|
+
a.length === 1 ? n = a[0][0] || "" : n = (a[0][0] || "") + (a[a.length - 1][0] || ""), this.initials.textContent = n.toUpperCase();
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
customElements.define("eui-avatar",
|
|
72
|
+
customElements.define("eui-avatar", E);
|
|
76
73
|
const u = /* @__PURE__ */ (() => {
|
|
77
|
-
let
|
|
74
|
+
let s = {};
|
|
78
75
|
return {
|
|
79
|
-
register(t,
|
|
80
|
-
|
|
76
|
+
register(t, i) {
|
|
77
|
+
s[t] = i;
|
|
81
78
|
},
|
|
82
79
|
get(t) {
|
|
83
|
-
return
|
|
80
|
+
return s[t] || "";
|
|
84
81
|
}
|
|
85
82
|
};
|
|
86
83
|
})();
|
|
@@ -93,7 +90,7 @@ u.register("copy", '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="1
|
|
|
93
90
|
u.register("arrow", '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path d="M9.3 5.3a1 1 0 0 0 0 1.4l5.29 5.3-5.3 5.3a1 1 0 1 0 1.42 1.4l6-6a1 1 0 0 0 0-1.4l-6-6a1 1 0 0 0-1.42 0Z"></path></svg>');
|
|
94
91
|
u.register("back", '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="transform: rotate(180deg)"><path d="M9.3 5.3a1 1 0 0 0 0 1.4l5.29 5.3-5.3 5.3a1 1 0 1 0 1.42 1.4l6-6a1 1 0 0 0 0-1.4l-6-6a1 1 0 0 0-1.42 0Z"></path></svg>');
|
|
95
92
|
u.register("check", '<svg width="12" height="10" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.86368 9.12226C3.82463 9.16131 3.76131 9.16131 3.72226 9.12226L0.146522 5.54652C-0.0487403 5.35126 -0.0487401 5.03468 0.146522 4.83942L0.839416 4.14652C1.03468 3.95126 1.35126 3.95126 1.54652 4.14652L3.72226 6.32226C3.76131 6.36131 3.82463 6.36131 3.86368 6.32226L10.0394 0.146522C10.2347 -0.0487398 10.5513 -0.0487399 10.7465 0.146522L11.4394 0.839416C11.6347 1.03468 11.6347 1.35126 11.4394 1.54652L3.86368 9.12226Z" fill="currentColor"/></svg>');
|
|
96
|
-
class
|
|
93
|
+
class A extends HTMLElement {
|
|
97
94
|
static get observedAttributes() {
|
|
98
95
|
return ["name", "width", "height"];
|
|
99
96
|
}
|
|
@@ -107,23 +104,23 @@ class T extends HTMLElement {
|
|
|
107
104
|
this.render();
|
|
108
105
|
}
|
|
109
106
|
render() {
|
|
110
|
-
const t = this.getAttribute("name"),
|
|
111
|
-
if (!
|
|
107
|
+
const t = this.getAttribute("name"), i = u.get(t);
|
|
108
|
+
if (!i) {
|
|
112
109
|
this.shadowRoot.innerHTML = '<span style="color:red;">?</span>';
|
|
113
110
|
return;
|
|
114
111
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
const r = this.getAttribute("width"),
|
|
120
|
-
r &&
|
|
112
|
+
const e = document.createElement("template");
|
|
113
|
+
e.innerHTML = i.trim();
|
|
114
|
+
const a = e.content.cloneNode(!0), n = a.firstElementChild;
|
|
115
|
+
if (n && n.style) {
|
|
116
|
+
const r = this.getAttribute("width"), l = this.getAttribute("height");
|
|
117
|
+
r && n.setAttribute("width", r), l && n.setAttribute("height", l), n.style.display = "block";
|
|
121
118
|
}
|
|
122
|
-
this.shadowRoot.innerHTML = "", this.shadowRoot.appendChild(
|
|
119
|
+
this.shadowRoot.innerHTML = "", this.shadowRoot.appendChild(a);
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
|
-
customElements.define("eui-icon",
|
|
126
|
-
class
|
|
122
|
+
customElements.define("eui-icon", A);
|
|
123
|
+
class L extends HTMLElement {
|
|
127
124
|
static get observedAttributes() {
|
|
128
125
|
return ["label", "value", "id", "type", "filled"];
|
|
129
126
|
}
|
|
@@ -231,21 +228,23 @@ class $ extends HTMLElement {
|
|
|
231
228
|
`;
|
|
232
229
|
}
|
|
233
230
|
connectedCallback() {
|
|
234
|
-
this.form = this.shadowRoot.querySelector(".form"), this.inputEl = this.shadowRoot.querySelector(".form-input"), this.labelEl = this.shadowRoot.querySelector("label"), this.hasAttribute("value") && (this.inputEl.value = this.getAttribute("value")), this.hasAttribute("id") && (this.inputEl.id = this.getAttribute("id")), this.hasAttribute("label") && (this.labelEl.textContent = this.getAttribute("label")), this.hasAttribute("type") && (this.inputEl.type = this.getAttribute("type")), this.hasAttribute("filled") && this.form.classList.add("filled"), this.inputEl.addEventListener("input", () => {
|
|
235
|
-
this.setAttribute("value", this.inputEl.value);
|
|
231
|
+
this.form = this.shadowRoot.querySelector(".form"), this.inputEl = this.shadowRoot.querySelector(".form-input"), this.labelEl = this.shadowRoot.querySelector("label"), this.hasAttribute("value") && (this.inputEl.value = this.getAttribute("value")), this.hasAttribute("id") && (this.inputEl.id = this.getAttribute("id")), this.hasAttribute("label") && (this.labelEl.textContent = this.getAttribute("label")), this.hasAttribute("type") && (this.inputEl.type = this.getAttribute("type")), this.hasAttribute("filled") && this.form.classList.add("filled"), this.inputEl.addEventListener("input", (t) => {
|
|
232
|
+
this.setAttribute("value", this.inputEl.value), this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
|
|
233
|
+
}), this.inputEl.addEventListener("change", (t) => {
|
|
234
|
+
this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
236
235
|
});
|
|
237
236
|
}
|
|
238
|
-
attributeChangedCallback(t,
|
|
237
|
+
attributeChangedCallback(t, i, e) {
|
|
239
238
|
if (!(!this.inputEl || !this.labelEl))
|
|
240
239
|
switch (t) {
|
|
241
240
|
case "value":
|
|
242
|
-
this.inputEl.value !==
|
|
241
|
+
this.inputEl.value !== e && (this.inputEl.value = e);
|
|
243
242
|
break;
|
|
244
243
|
case "id":
|
|
245
|
-
this.inputEl.id =
|
|
244
|
+
this.inputEl.id = e;
|
|
246
245
|
break;
|
|
247
246
|
case "label":
|
|
248
|
-
this.labelEl.textContent =
|
|
247
|
+
this.labelEl.textContent = e;
|
|
249
248
|
break;
|
|
250
249
|
}
|
|
251
250
|
}
|
|
@@ -256,8 +255,8 @@ class $ extends HTMLElement {
|
|
|
256
255
|
this.setAttribute("value", t);
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
|
-
customElements.define("eui-input",
|
|
260
|
-
class
|
|
258
|
+
customElements.define("eui-input", L);
|
|
259
|
+
class S extends HTMLElement {
|
|
261
260
|
constructor() {
|
|
262
261
|
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
263
262
|
<style>
|
|
@@ -307,8 +306,8 @@ class R extends HTMLElement {
|
|
|
307
306
|
`;
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
|
-
customElements.define("eui-loader",
|
|
311
|
-
class
|
|
309
|
+
customElements.define("eui-loader", S);
|
|
310
|
+
class z extends HTMLElement {
|
|
312
311
|
static get observedAttributes() {
|
|
313
312
|
return ["value", "intermediate", "id"];
|
|
314
313
|
}
|
|
@@ -370,8 +369,8 @@ class H extends HTMLElement {
|
|
|
370
369
|
this.hasAttribute("id") && (this.progress.id = this.getAttribute("id")), this.hasAttribute("intermediate") && t.classList.add("intermediate"), this.hasAttribute("value") && (t.style.width = this.getAttribute("value") + "%");
|
|
371
370
|
}
|
|
372
371
|
}
|
|
373
|
-
customElements.define("eui-progressbar",
|
|
374
|
-
const
|
|
372
|
+
customElements.define("eui-progressbar", z);
|
|
373
|
+
const v = {
|
|
375
374
|
is: {
|
|
376
375
|
iPhone: /iPhone/.test(navigator.userAgent),
|
|
377
376
|
iPad: /iPad/.test(navigator.userAgent),
|
|
@@ -391,80 +390,80 @@ const x = {
|
|
|
391
390
|
haptics: "vibrate" in navigator || "Vibrate" in window || typeof window.navigator.vibrate == "function"
|
|
392
391
|
},
|
|
393
392
|
userAgent: navigator.userAgent
|
|
394
|
-
},
|
|
393
|
+
}, Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
395
394
|
__proto__: null,
|
|
396
|
-
device:
|
|
395
|
+
device: v
|
|
397
396
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
398
|
-
function
|
|
397
|
+
function T() {
|
|
399
398
|
try {
|
|
400
|
-
const
|
|
401
|
-
|
|
399
|
+
const s = document.createElement("label");
|
|
400
|
+
s.ariaHidden = "true", s.style.display = "none";
|
|
402
401
|
const t = document.createElement("input");
|
|
403
|
-
t.type = "checkbox", t.setAttribute("switch", ""),
|
|
402
|
+
t.type = "checkbox", t.setAttribute("switch", ""), s.appendChild(t), document.head.appendChild(s), s.click(), document.head.removeChild(s);
|
|
404
403
|
} catch {
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
406
|
+
function x(s) {
|
|
407
|
+
v.supports.haptics ? navigator.vibrate(s || 50) : v.is.iPhone && T();
|
|
409
408
|
}
|
|
410
|
-
const
|
|
409
|
+
const X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
411
410
|
__proto__: null,
|
|
412
|
-
haptic:
|
|
413
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
414
|
-
let
|
|
411
|
+
haptic: x
|
|
412
|
+
}, Symbol.toStringTag, { value: "Module" })), w = (() => {
|
|
413
|
+
let s = {}, t;
|
|
415
414
|
try {
|
|
416
|
-
|
|
417
|
-
} catch (
|
|
418
|
-
console.error(
|
|
415
|
+
s = JSON.parse(localStorage.getItem(t) || "{}");
|
|
416
|
+
} catch (i) {
|
|
417
|
+
console.error(i);
|
|
419
418
|
}
|
|
420
419
|
return {
|
|
421
|
-
get(
|
|
422
|
-
return
|
|
420
|
+
get(i) {
|
|
421
|
+
return s[i];
|
|
423
422
|
},
|
|
424
|
-
set(
|
|
425
|
-
|
|
423
|
+
set(i, e) {
|
|
424
|
+
s[i] = e, localStorage.setItem(t, JSON.stringify(s));
|
|
426
425
|
},
|
|
427
|
-
delete(
|
|
428
|
-
delete
|
|
426
|
+
delete(i) {
|
|
427
|
+
delete s[i], localStorage.setItem(t, JSON.stringify(s));
|
|
429
428
|
},
|
|
430
429
|
all() {
|
|
431
|
-
return
|
|
430
|
+
return s;
|
|
432
431
|
},
|
|
433
432
|
clear() {
|
|
434
|
-
|
|
433
|
+
s = {}, localStorage.setItem(t, JSON.stringify(s));
|
|
435
434
|
},
|
|
436
|
-
name(
|
|
437
|
-
t =
|
|
435
|
+
name(i) {
|
|
436
|
+
t = i;
|
|
438
437
|
try {
|
|
439
|
-
|
|
440
|
-
} catch (
|
|
441
|
-
console.error(
|
|
438
|
+
s = JSON.parse(localStorage.getItem(t) || "{}");
|
|
439
|
+
} catch (e) {
|
|
440
|
+
console.error(e);
|
|
442
441
|
}
|
|
443
442
|
},
|
|
444
443
|
settings: {
|
|
445
|
-
get(
|
|
446
|
-
return
|
|
444
|
+
get(i) {
|
|
445
|
+
return s && s.settings && s.settings[i];
|
|
447
446
|
},
|
|
448
|
-
set(
|
|
449
|
-
|
|
447
|
+
set(i, e) {
|
|
448
|
+
s.settings || (s.settings = {}), s.settings[i] = e, localStorage.setItem(t, JSON.stringify(s));
|
|
450
449
|
},
|
|
451
|
-
delete(
|
|
452
|
-
|
|
450
|
+
delete(i) {
|
|
451
|
+
s.settings && (delete s.settings[i], localStorage.setItem(t, JSON.stringify(s)));
|
|
453
452
|
},
|
|
454
453
|
all() {
|
|
455
|
-
return
|
|
454
|
+
return s.settings || {};
|
|
456
455
|
},
|
|
457
456
|
clear() {
|
|
458
|
-
|
|
457
|
+
s.settings && (s.settings = {}, localStorage.setItem(t, JSON.stringify(s)));
|
|
459
458
|
}
|
|
460
459
|
}
|
|
461
460
|
};
|
|
462
|
-
})(),
|
|
461
|
+
})(), M = w.settings, W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
463
462
|
__proto__: null,
|
|
464
|
-
settings:
|
|
465
|
-
storage:
|
|
463
|
+
settings: M,
|
|
464
|
+
storage: w
|
|
466
465
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
467
|
-
class
|
|
466
|
+
class $ extends HTMLElement {
|
|
468
467
|
static get observedAttributes() {
|
|
469
468
|
return ["selected"];
|
|
470
469
|
}
|
|
@@ -544,13 +543,13 @@ class F extends HTMLElement {
|
|
|
544
543
|
this.inputEl = this.shadowRoot.querySelector("input"), this.switchEl = this.shadowRoot.querySelector(".switch"), this.updateFromAttribute(), this.switchEl.addEventListener("click", () => this.toggle());
|
|
545
544
|
}
|
|
546
545
|
toggle() {
|
|
547
|
-
this.selected = !this.selected,
|
|
546
|
+
this.selected = !this.selected, x(), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
548
547
|
}
|
|
549
548
|
updateFromAttribute() {
|
|
550
549
|
const t = this.hasAttribute("selected");
|
|
551
550
|
this.inputEl.checked = t, this.switchEl.classList.toggle("selected", t);
|
|
552
551
|
}
|
|
553
|
-
attributeChangedCallback(t,
|
|
552
|
+
attributeChangedCallback(t, i, e) {
|
|
554
553
|
t === "selected" && this.inputEl && this.updateFromAttribute();
|
|
555
554
|
}
|
|
556
555
|
get selected() {
|
|
@@ -560,8 +559,8 @@ class F extends HTMLElement {
|
|
|
560
559
|
t ? this.setAttribute("selected", "") : this.removeAttribute("selected");
|
|
561
560
|
}
|
|
562
561
|
}
|
|
563
|
-
customElements.define("eui-switch",
|
|
564
|
-
class
|
|
562
|
+
customElements.define("eui-switch", $);
|
|
563
|
+
class R extends HTMLElement {
|
|
565
564
|
constructor() {
|
|
566
565
|
super(), this.attachShadow({ mode: "open" });
|
|
567
566
|
}
|
|
@@ -612,97 +611,97 @@ class I extends HTMLElement {
|
|
|
612
611
|
</style>
|
|
613
612
|
<slot></slot>
|
|
614
613
|
`, this.addEventListener("pointerdown", (t) => {
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
614
|
+
const i = document.createElement("span"), e = t.currentTarget, a = Math.max(e.offsetWidth, e.offsetHeight);
|
|
615
|
+
i.classList.add("ripple"), i.style.left = t.clientX - e.getBoundingClientRect().left - a / 2 + "px", i.style.top = t.clientY - e.getBoundingClientRect().top - a / 2 + "px", i.style.width = a + "px", i.style.height = a + "px", this.shadowRoot.appendChild(i), setTimeout(() => {
|
|
616
|
+
i.remove();
|
|
618
617
|
}, 600);
|
|
619
618
|
});
|
|
620
619
|
}
|
|
621
620
|
}
|
|
622
|
-
customElements.define("eui-chip",
|
|
623
|
-
const
|
|
624
|
-
const
|
|
625
|
-
function t(
|
|
626
|
-
const h = [], g =
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
function
|
|
630
|
-
for (const { regex:
|
|
631
|
-
const p =
|
|
621
|
+
customElements.define("eui-chip", R);
|
|
622
|
+
const b = "", y = (() => {
|
|
623
|
+
const s = [];
|
|
624
|
+
function t(o, d) {
|
|
625
|
+
const h = [], g = o.replace(/:([^/]+)/g, (m, f) => (h.push(f), "([^/]+)")).replace(/\//g, "\\/"), p = new RegExp(`^${b}${g}$`);
|
|
626
|
+
s.push({ regex: p, paramNames: h, renderFn: d });
|
|
627
|
+
}
|
|
628
|
+
function i(o) {
|
|
629
|
+
for (const { regex: d, paramNames: h, renderFn: g } of s) {
|
|
630
|
+
const p = o.match(d);
|
|
632
631
|
if (p) {
|
|
633
|
-
const
|
|
634
|
-
return h.forEach((f,
|
|
635
|
-
|
|
636
|
-
}), { renderFn: g, params:
|
|
632
|
+
const m = {};
|
|
633
|
+
return h.forEach((f, C) => {
|
|
634
|
+
m[f] = decodeURIComponent(p[C + 1]);
|
|
635
|
+
}), { renderFn: g, params: m };
|
|
637
636
|
}
|
|
638
637
|
}
|
|
639
638
|
return null;
|
|
640
639
|
}
|
|
641
|
-
function
|
|
642
|
-
|
|
643
|
-
const h =
|
|
644
|
-
if (h === window.location.pathname &&
|
|
645
|
-
|
|
646
|
-
const p = "#" +
|
|
647
|
-
|
|
640
|
+
function e(o, d = !0) {
|
|
641
|
+
o.startsWith(b) || (o = b + (o.startsWith("/") ? "" : "/") + o);
|
|
642
|
+
const h = o.split(/[?#]/)[0];
|
|
643
|
+
if (h === window.location.pathname && o.includes("#")) {
|
|
644
|
+
d && history.pushState({}, "", o);
|
|
645
|
+
const p = "#" + o.split("#")[1];
|
|
646
|
+
a(p);
|
|
648
647
|
return;
|
|
649
648
|
}
|
|
650
|
-
const g =
|
|
649
|
+
const g = i(h);
|
|
651
650
|
if (g)
|
|
652
|
-
if (
|
|
653
|
-
const p = "#" +
|
|
654
|
-
setTimeout(() =>
|
|
651
|
+
if (d && history.pushState({}, "", o), g.renderFn(g.params), window.dispatchEvent(new CustomEvent("route-changed", { detail: { path: o } })), o.includes("#")) {
|
|
652
|
+
const p = "#" + o.split("#")[1];
|
|
653
|
+
setTimeout(() => a(p), 100);
|
|
655
654
|
} else {
|
|
656
655
|
const p = document.getElementById("main");
|
|
657
656
|
p && p.scrollTo(0, 0);
|
|
658
657
|
}
|
|
659
|
-
else
|
|
658
|
+
else n ? (d && history.pushState({}, "", o), n()) : console.warn(`No route found for ${h}`);
|
|
660
659
|
}
|
|
661
|
-
function
|
|
662
|
-
if (
|
|
660
|
+
function a(o) {
|
|
661
|
+
if (o)
|
|
663
662
|
try {
|
|
664
|
-
const
|
|
665
|
-
|
|
663
|
+
const d = document.querySelector(o);
|
|
664
|
+
d && d.scrollIntoView({ behavior: "smooth" });
|
|
666
665
|
} catch {
|
|
667
|
-
console.warn("Invalid hash:",
|
|
666
|
+
console.warn("Invalid hash:", o);
|
|
668
667
|
}
|
|
669
668
|
}
|
|
670
|
-
let
|
|
671
|
-
function r(
|
|
672
|
-
|
|
669
|
+
let n = null;
|
|
670
|
+
function r(o) {
|
|
671
|
+
n = o;
|
|
673
672
|
}
|
|
674
|
-
function
|
|
673
|
+
function l() {
|
|
675
674
|
history.back();
|
|
676
675
|
}
|
|
677
|
-
function
|
|
678
|
-
return window.location.pathname.replace(
|
|
676
|
+
function c() {
|
|
677
|
+
return window.location.pathname.replace(b, "") || "/";
|
|
679
678
|
}
|
|
680
679
|
return window.addEventListener("popstate", () => {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
}), window.addEventListener("click", (
|
|
684
|
-
if (
|
|
685
|
-
const
|
|
686
|
-
if (!
|
|
687
|
-
const h =
|
|
680
|
+
const o = window.location.pathname + window.location.search + window.location.hash;
|
|
681
|
+
e(o, !1);
|
|
682
|
+
}), window.addEventListener("click", (o) => {
|
|
683
|
+
if (o.button !== 0 || o.metaKey || o.altKey || o.ctrlKey || o.shiftKey) return;
|
|
684
|
+
const d = o.target.closest("a");
|
|
685
|
+
if (!d || d.hasAttribute("download") || d.getAttribute("target") === "_blank") return;
|
|
686
|
+
const h = d.getAttribute("href");
|
|
688
687
|
if (!(!h || h.startsWith("http") && !h.startsWith(window.location.origin))) {
|
|
689
|
-
if (
|
|
690
|
-
history.pushState({}, "", h),
|
|
688
|
+
if (o.preventDefault(), h.startsWith("#")) {
|
|
689
|
+
history.pushState({}, "", h), a(h);
|
|
691
690
|
return;
|
|
692
691
|
}
|
|
693
|
-
|
|
692
|
+
e(h);
|
|
694
693
|
}
|
|
695
|
-
}), { add: t, navigate:
|
|
694
|
+
}), { add: t, navigate: e, back: l, location: c, setNotFound: r };
|
|
696
695
|
})();
|
|
697
|
-
async function
|
|
696
|
+
async function J(s) {
|
|
698
697
|
try {
|
|
699
698
|
const t = document.getElementById("main");
|
|
700
|
-
t.classList.add("fade-out"), await new Promise((
|
|
701
|
-
const
|
|
702
|
-
t.innerHTML =
|
|
699
|
+
t.classList.add("fade-out"), await new Promise((e) => setTimeout(e, 200));
|
|
700
|
+
const i = await fetch(`/src/pages/${s}.html`).then((e) => e.text());
|
|
701
|
+
t.innerHTML = i, t.classList.remove("fade-out"), t.classList.add("fade-in"), window.location.hash ? setTimeout(() => {
|
|
703
702
|
try {
|
|
704
|
-
const
|
|
705
|
-
|
|
703
|
+
const e = document.querySelector(window.location.hash);
|
|
704
|
+
e && e.scrollIntoView({ behavior: "smooth" });
|
|
706
705
|
} catch {
|
|
707
706
|
}
|
|
708
707
|
}, 100) : t && t.scrollTo(0, 0), setTimeout(() => {
|
|
@@ -712,60 +711,59 @@ async function G(o) {
|
|
|
712
711
|
console.error("Page load failed:", t);
|
|
713
712
|
}
|
|
714
713
|
}
|
|
715
|
-
class
|
|
716
|
-
constructor() {
|
|
717
|
-
super();
|
|
718
|
-
v(this, "handleClick", () => {
|
|
719
|
-
const e = this.getAttribute("path");
|
|
720
|
-
e && C.navigate(e);
|
|
721
|
-
});
|
|
722
|
-
this.attachShadow({ mode: "open" });
|
|
723
|
-
}
|
|
714
|
+
class H extends HTMLElement {
|
|
724
715
|
static get observedAttributes() {
|
|
725
716
|
return ["path", "icon", "label", "badge", "active", "avatar-src", "avatar-name"];
|
|
726
717
|
}
|
|
718
|
+
constructor() {
|
|
719
|
+
super(), this.attachShadow({ mode: "open" });
|
|
720
|
+
}
|
|
727
721
|
connectedCallback() {
|
|
728
722
|
this.hasRendered || (this.render(), this.setupEventListeners(), this.hasRendered = !0), this.updateContent(), this.addEventListener("click", this.handleClick);
|
|
729
723
|
}
|
|
730
724
|
disconnectedCallback() {
|
|
731
725
|
this.removeEventListener("click", this.handleClick);
|
|
732
726
|
}
|
|
733
|
-
attributeChangedCallback(
|
|
734
|
-
if (i !==
|
|
735
|
-
if (
|
|
727
|
+
attributeChangedCallback(t, i, e) {
|
|
728
|
+
if (i !== e && this.hasRendered) {
|
|
729
|
+
if (t === "active")
|
|
736
730
|
return;
|
|
737
731
|
this.updateContent();
|
|
738
732
|
}
|
|
739
733
|
}
|
|
734
|
+
handleClick = () => {
|
|
735
|
+
const t = this.getAttribute("path");
|
|
736
|
+
t && y.navigate(t);
|
|
737
|
+
};
|
|
740
738
|
setupEventListeners() {
|
|
741
|
-
this.addEventListener("pointerdown", (
|
|
742
|
-
const i = document.createElement("span"),
|
|
743
|
-
i.classList.add("ripple"), i.style.width = `${
|
|
739
|
+
this.addEventListener("pointerdown", (t) => {
|
|
740
|
+
const i = document.createElement("span"), e = t.currentTarget, a = e.getBoundingClientRect(), n = Math.max(e.offsetWidth, e.offsetHeight), r = n / 2;
|
|
741
|
+
i.classList.add("ripple"), i.style.width = `${n}px`, i.style.height = `${n}px`, i.style.left = `${t.clientX - a.left - r}px`, i.style.top = `${t.clientY - a.top - r}px`, this.shadowRoot.appendChild(i), i.addEventListener("animationend", () => {
|
|
744
742
|
i.remove();
|
|
745
743
|
});
|
|
746
744
|
});
|
|
747
745
|
}
|
|
748
746
|
updateContent() {
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
if (
|
|
752
|
-
|
|
747
|
+
const t = this.getAttribute("icon"), i = this.getAttribute("avatar-src"), e = this.getAttribute("avatar-name"), a = this.getAttribute("label") || "", n = this.getAttribute("badge"), r = this.shadowRoot.querySelector(".badge");
|
|
748
|
+
if (n)
|
|
749
|
+
if (r)
|
|
750
|
+
r.textContent = n;
|
|
753
751
|
else {
|
|
754
|
-
const
|
|
755
|
-
|
|
752
|
+
const o = document.createElement("span");
|
|
753
|
+
o.className = "badge", o.textContent = n, this.shadowRoot.appendChild(o);
|
|
756
754
|
}
|
|
757
|
-
else
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
if (i ||
|
|
761
|
-
let
|
|
762
|
-
|
|
755
|
+
else r && r.remove();
|
|
756
|
+
const l = this.shadowRoot.querySelector("slot[name='icon']");
|
|
757
|
+
if (l)
|
|
758
|
+
if (i || e) {
|
|
759
|
+
let o = '<eui-avatar size="24"';
|
|
760
|
+
e && (o += ` name="${e}"`), o += ">", i && (o += `<img src="${i}" alt="${e || "Avatar"}" />`), o += "</eui-avatar>", l.innerHTML = o;
|
|
763
761
|
} else {
|
|
764
|
-
const
|
|
765
|
-
|
|
762
|
+
const o = l.querySelector("eui-icon");
|
|
763
|
+
t && o ? o.getAttribute("name") !== t && o.setAttribute("name", t) : t ? l.innerHTML = `<eui-icon width="24" height="24" name="${t}"></eui-icon>` : l.innerHTML = "";
|
|
766
764
|
}
|
|
767
|
-
const
|
|
768
|
-
|
|
765
|
+
const c = this.shadowRoot.querySelector(".label");
|
|
766
|
+
c && (c.textContent = a);
|
|
769
767
|
}
|
|
770
768
|
render() {
|
|
771
769
|
this.shadowRoot.innerHTML = `
|
|
@@ -876,8 +874,8 @@ class j extends HTMLElement {
|
|
|
876
874
|
`;
|
|
877
875
|
}
|
|
878
876
|
}
|
|
879
|
-
customElements.define("eui-nav-item",
|
|
880
|
-
class
|
|
877
|
+
customElements.define("eui-nav-item", H);
|
|
878
|
+
class _ extends HTMLElement {
|
|
881
879
|
constructor() {
|
|
882
880
|
super(), this.attachShadow({ mode: "open" });
|
|
883
881
|
}
|
|
@@ -986,11 +984,10 @@ class q extends HTMLElement {
|
|
|
986
984
|
<a href="#content" id="skip_navigation_link">Skip To Content</a>
|
|
987
985
|
<div class="nav-items">
|
|
988
986
|
${this.navItems.map((t) => {
|
|
989
|
-
var n, s;
|
|
990
987
|
if (t.type === "divider")
|
|
991
988
|
return '<div style="height: 1px; background: var(--app-300); margin: 0.5rem 0;"></div>';
|
|
992
|
-
const
|
|
993
|
-
return `<eui-nav-item path="${t.path}" icon="${t.icon}" avatar-src="${
|
|
989
|
+
const i = t.avatar?.src || "", e = t.avatar?.name || "";
|
|
990
|
+
return `<eui-nav-item path="${t.path}" icon="${t.icon}" avatar-src="${i}" avatar-name="${e}" label="${t.label}"></eui-nav-item>`;
|
|
994
991
|
}).join("")}
|
|
995
992
|
</div>
|
|
996
993
|
</div>
|
|
@@ -1003,13 +1000,13 @@ class q extends HTMLElement {
|
|
|
1003
1000
|
return this._navItems || [];
|
|
1004
1001
|
}
|
|
1005
1002
|
updateActiveState(t) {
|
|
1006
|
-
t || (t =
|
|
1007
|
-
|
|
1003
|
+
t || (t = y.location()), t.startsWith("/") || (t = "/" + t), this.shadowRoot.querySelectorAll("eui-nav-item").forEach((e) => {
|
|
1004
|
+
e.getAttribute("path") === t ? e.setAttribute("active", "") : e.removeAttribute("active");
|
|
1008
1005
|
});
|
|
1009
1006
|
}
|
|
1010
1007
|
}
|
|
1011
|
-
customElements.define("eui-app-nav",
|
|
1012
|
-
class
|
|
1008
|
+
customElements.define("eui-app-nav", _);
|
|
1009
|
+
class F extends HTMLElement {
|
|
1013
1010
|
static get observedAttributes() {
|
|
1014
1011
|
return ["type", "title", "subtitle", "img"];
|
|
1015
1012
|
}
|
|
@@ -1105,13 +1102,13 @@ class B extends HTMLElement {
|
|
|
1105
1102
|
connectedCallback() {
|
|
1106
1103
|
this.hd = this.shadowRoot.querySelector(".header"), this.hasAttribute("type") && this.hd.classList.add(this.getAttribute("type"));
|
|
1107
1104
|
}
|
|
1108
|
-
attributeChangedCallback(t,
|
|
1109
|
-
const
|
|
1110
|
-
t === "title" && (
|
|
1105
|
+
attributeChangedCallback(t, i, e) {
|
|
1106
|
+
const a = this.shadowRoot.querySelector("h1"), n = this.shadowRoot.querySelector("p"), r = this.shadowRoot.querySelector(".img");
|
|
1107
|
+
t === "title" && (a.textContent = e), t === "subtitle" && (n.textContent = e), t === "img" && (r.style.backgroundImage = e ? `url(${e})` : "");
|
|
1111
1108
|
}
|
|
1112
1109
|
}
|
|
1113
|
-
customElements.define("eui-header",
|
|
1114
|
-
class
|
|
1110
|
+
customElements.define("eui-header", F);
|
|
1111
|
+
class I extends HTMLElement {
|
|
1115
1112
|
static get observedAttributes() {
|
|
1116
1113
|
return ["selected"];
|
|
1117
1114
|
}
|
|
@@ -1119,7 +1116,8 @@ class N extends HTMLElement {
|
|
|
1119
1116
|
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
1120
1117
|
<style>
|
|
1121
1118
|
:host {
|
|
1122
|
-
display: block;
|
|
1119
|
+
display: inline-block;
|
|
1120
|
+
vertical-align: bottom;
|
|
1123
1121
|
position: relative;
|
|
1124
1122
|
cursor: pointer;
|
|
1125
1123
|
width: 24px;
|
|
@@ -1205,15 +1203,13 @@ class N extends HTMLElement {
|
|
|
1205
1203
|
this.inputEl = this.shadowRoot.querySelector("input"), this.checkEl = this.shadowRoot.querySelector(".checkbox"), this.updateFromAttribute(), this.checkEl.addEventListener("click", () => this.toggle());
|
|
1206
1204
|
}
|
|
1207
1205
|
toggle() {
|
|
1208
|
-
this.selected = !this.selected,
|
|
1209
|
-
const t = this.selected, e = this.dataset.setting;
|
|
1210
|
-
e && k.set(e, t);
|
|
1206
|
+
this.selected = !this.selected, x(), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
1211
1207
|
}
|
|
1212
1208
|
updateFromAttribute() {
|
|
1213
1209
|
const t = this.hasAttribute("selected");
|
|
1214
1210
|
this.inputEl.checked = t, this.checkEl.classList.toggle("selected", t);
|
|
1215
1211
|
}
|
|
1216
|
-
attributeChangedCallback(t,
|
|
1212
|
+
attributeChangedCallback(t, i, e) {
|
|
1217
1213
|
t === "selected" && this.inputEl && this.updateFromAttribute();
|
|
1218
1214
|
}
|
|
1219
1215
|
get selected() {
|
|
@@ -1223,8 +1219,9 @@ class N extends HTMLElement {
|
|
|
1223
1219
|
t ? this.setAttribute("selected", "") : this.removeAttribute("selected");
|
|
1224
1220
|
}
|
|
1225
1221
|
}
|
|
1226
|
-
customElements.define("eui-checkbox",
|
|
1227
|
-
class
|
|
1222
|
+
customElements.define("eui-checkbox", I);
|
|
1223
|
+
class q extends HTMLElement {
|
|
1224
|
+
static observedAttributes = ["type", "width", "height", "border-radius", "icon", "link", "href"];
|
|
1228
1225
|
constructor() {
|
|
1229
1226
|
super(), this.attachShadow({ mode: "open" });
|
|
1230
1227
|
}
|
|
@@ -1232,7 +1229,7 @@ class E extends HTMLElement {
|
|
|
1232
1229
|
this.render();
|
|
1233
1230
|
}
|
|
1234
1231
|
render() {
|
|
1235
|
-
const t = this.getAttribute("href"),
|
|
1232
|
+
const t = this.getAttribute("href"), i = t ? "a" : "button";
|
|
1236
1233
|
this.shadowRoot.innerHTML = `
|
|
1237
1234
|
<style>
|
|
1238
1235
|
button, a {
|
|
@@ -1336,22 +1333,21 @@ class E extends HTMLElement {
|
|
|
1336
1333
|
}
|
|
1337
1334
|
|
|
1338
1335
|
</style>
|
|
1339
|
-
<${
|
|
1336
|
+
<${i}>
|
|
1340
1337
|
<slot></slot>
|
|
1341
|
-
</${
|
|
1338
|
+
</${i}>
|
|
1342
1339
|
`;
|
|
1343
|
-
const
|
|
1344
|
-
t &&
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1347
|
-
|
|
1340
|
+
const e = this.shadowRoot.querySelector(i);
|
|
1341
|
+
t && e.setAttribute("href", t), this.hasAttribute("type") && e.classList.add(this.getAttribute("type")), this.hasAttribute("icon") && e.classList.add("icon"), this.hasAttribute("width") && (e.style.width = this.getAttribute("width") + "px"), this.hasAttribute("height") && (e.style.height = this.getAttribute("height") + "px"), this.hasAttribute("border-radius") && (e.style.borderRadius = this.getAttribute("border-radius") + "px"), e.addEventListener("pointerdown", (a) => {
|
|
1342
|
+
const n = document.createElement("span"), r = a.currentTarget, l = r.getBoundingClientRect(), c = Math.max(r.offsetWidth, r.offsetHeight), o = c / 2;
|
|
1343
|
+
n.classList.add("ripple"), n.style.width = `${c}px`, n.style.height = `${c}px`, n.style.left = `${a.clientX - l.left - o}px`, n.style.top = `${a.clientY - l.top - o}px`, e.appendChild(n), n.addEventListener("animationend", () => {
|
|
1344
|
+
n.remove();
|
|
1348
1345
|
});
|
|
1349
1346
|
});
|
|
1350
1347
|
}
|
|
1351
1348
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
class O extends HTMLElement {
|
|
1349
|
+
customElements.define("eui-button", q);
|
|
1350
|
+
class j extends HTMLElement {
|
|
1355
1351
|
static get observedAttributes() {
|
|
1356
1352
|
return ["type", "anchor"];
|
|
1357
1353
|
}
|
|
@@ -1423,28 +1419,28 @@ class O extends HTMLElement {
|
|
|
1423
1419
|
`;
|
|
1424
1420
|
}
|
|
1425
1421
|
}
|
|
1426
|
-
customElements.define("eui-heading",
|
|
1427
|
-
function
|
|
1428
|
-
const
|
|
1429
|
-
return
|
|
1422
|
+
customElements.define("eui-heading", j);
|
|
1423
|
+
function B(s) {
|
|
1424
|
+
const e = Date.now() - s, a = Math.floor(e / 1e3), n = Math.floor(a / 60), r = Math.floor(n / 60), l = Math.floor(r / 24), c = Math.floor(l / 30), o = Math.floor(c / 12);
|
|
1425
|
+
return o > 0 ? `${o}y` : c > 0 ? `${c}mo` : l > 0 ? `${l}d` : r > 0 ? `${r}h` : n > 0 ? `${n}m` : `${a}s`;
|
|
1430
1426
|
}
|
|
1431
|
-
function
|
|
1432
|
-
const
|
|
1433
|
-
return
|
|
1427
|
+
function N(s) {
|
|
1428
|
+
const e = Date.now() - s, a = Math.floor(e / 1e3), n = Math.floor(a / 60), r = Math.floor(n / 60), l = Math.floor(r / 24), c = Math.floor(l / 30), o = Math.floor(c / 12);
|
|
1429
|
+
return o > 0 ? `${o} year${o > 1 ? "s" : ""} ago` : c > 0 ? `${c} month${c > 1 ? "s" : ""} ago` : l > 0 ? `${l} day${l > 1 ? "s" : ""} ago` : r > 0 ? `${r} hour${r > 1 ? "s" : ""} ago` : n > 0 ? `${n} minute${n > 1 ? "s" : ""} ago` : `${a} second${a > 1 ? "s" : ""} ago`;
|
|
1434
1430
|
}
|
|
1435
|
-
function
|
|
1436
|
-
return
|
|
1431
|
+
function O(s) {
|
|
1432
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/`/g, "`").replace(/'/g, "'");
|
|
1437
1433
|
}
|
|
1438
|
-
function
|
|
1434
|
+
function k(s) {
|
|
1439
1435
|
const t = document.createElement("input");
|
|
1440
|
-
t.value =
|
|
1436
|
+
t.value = s, document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
1441
1437
|
}
|
|
1442
|
-
const
|
|
1438
|
+
const K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1443
1439
|
__proto__: null,
|
|
1444
|
-
copystr:
|
|
1445
|
-
joinedAgo:
|
|
1446
|
-
sanitize:
|
|
1447
|
-
timeAgo:
|
|
1440
|
+
copystr: k,
|
|
1441
|
+
joinedAgo: N,
|
|
1442
|
+
sanitize: O,
|
|
1443
|
+
timeAgo: B
|
|
1448
1444
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1449
1445
|
class U extends HTMLElement {
|
|
1450
1446
|
static get observedAttributes() {
|
|
@@ -1456,11 +1452,11 @@ class U extends HTMLElement {
|
|
|
1456
1452
|
connectedCallback() {
|
|
1457
1453
|
this._isRendered || (this.render(), this._isRendered = !0);
|
|
1458
1454
|
}
|
|
1459
|
-
attributeChangedCallback(t,
|
|
1460
|
-
this._isRendered &&
|
|
1455
|
+
attributeChangedCallback(t, i, e) {
|
|
1456
|
+
this._isRendered && i !== e && this.render();
|
|
1461
1457
|
}
|
|
1462
1458
|
render() {
|
|
1463
|
-
const t = this.hasAttribute("copy"),
|
|
1459
|
+
const t = this.hasAttribute("copy"), i = this.getAttribute("language") || "text";
|
|
1464
1460
|
this.shadowRoot.innerHTML = `
|
|
1465
1461
|
<style>
|
|
1466
1462
|
:host {
|
|
@@ -1514,39 +1510,39 @@ class U extends HTMLElement {
|
|
|
1514
1510
|
|
|
1515
1511
|
<pre class="${t ? "g" : ""}"><code></code></pre>
|
|
1516
1512
|
`, this.copyBtn = this.shadowRoot.querySelector(".copy"), this.codeEl = this.shadowRoot.querySelector("code");
|
|
1517
|
-
const
|
|
1518
|
-
this.codeEl.innerHTML = this._highlight(
|
|
1513
|
+
const e = this._getFormattedText();
|
|
1514
|
+
this.codeEl.innerHTML = this._highlight(e, i), t ? this.copyBtn.addEventListener("click", this._boundCopy) : this.copyBtn.style.display = "none";
|
|
1519
1515
|
}
|
|
1520
1516
|
_getFormattedText() {
|
|
1521
|
-
let
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
`),
|
|
1525
|
-
return
|
|
1517
|
+
let i = (this.querySelector("code") || this).innerHTML || "";
|
|
1518
|
+
i = this._unescapeHtml(i), i = i.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
|
|
1519
|
+
const e = i.split(`
|
|
1520
|
+
`), a = e.filter((r) => r.trim()).map((r) => r.match(/^\s*/)[0].length), n = a.length ? Math.min(...a) : 0;
|
|
1521
|
+
return e.map((r) => r.slice(n)).join(`
|
|
1526
1522
|
`);
|
|
1527
1523
|
}
|
|
1528
1524
|
_unescapeHtml(t) {
|
|
1529
|
-
const
|
|
1530
|
-
return
|
|
1525
|
+
const i = document.createElement("textarea");
|
|
1526
|
+
return i.innerHTML = t, i.value;
|
|
1531
1527
|
}
|
|
1532
|
-
_highlight(t,
|
|
1528
|
+
_highlight(t, i) {
|
|
1533
1529
|
t = t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1534
|
-
const
|
|
1535
|
-
let
|
|
1536
|
-
function
|
|
1537
|
-
const
|
|
1538
|
-
return
|
|
1530
|
+
const e = {};
|
|
1531
|
+
let a = 0;
|
|
1532
|
+
function n(r, l) {
|
|
1533
|
+
const c = `__TOKEN_${l}_${a++}__`;
|
|
1534
|
+
return e[c] = `<span class="token ${l}">${r}</span>`, c;
|
|
1539
1535
|
}
|
|
1540
|
-
return ["javascript", "js", "json", "bash", "sh", "css"].includes(
|
|
1541
|
-
t = t.replace(r,
|
|
1536
|
+
return ["javascript", "js", "json", "bash", "sh", "css"].includes(i) ? (t = t.replace(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, (r) => n(r, "string")), i === "bash" || i === "sh" ? t = t.replace(/(#.*$)/gm, (r) => n(r, "comment")) : i === "css" ? t = t.replace(/(\/\*[\s\S]*?\*\/)/g, (r) => n(r, "comment")) : t = t.replace(/(\/\/.*$|\/\*[\s\S]*?\*\/)/gm, (r) => n(r, "comment"))) : ["html", "xml"].includes(i) && (t = t.replace(/(<!--[\s\S]*?-->)/g, (r) => n(r, "comment")), t = t.replace(/(<\/?[a-z0-9:-]+)/gi, (r) => n(r, "tag"))), i === "javascript" || i === "js" || i === "json" ? (t = t.replace(/\b(const|let|var|if|else|for|while|return|function|class|import|export|from|default|switch|case|break|continue|new|this|async|await)\b/g, '<span class="token keyword">$1</span>'), t = t.replace(/\b(true|false|null|undefined)\b/g, '<span class="token boolean">$1</span>'), t = t.replace(/\b([a-zA-Z0-9_]+)\s*(?=\()/g, '<span class="token function">$1</span>')) : i === "bash" || i === "sh" ? (t = t.replace(/\b(npm|npx|node|git|cd|ls|mkdir|rm|mv|cp|echo|cat|sudo|docker|brew|grep|curl|wget|chmod|chown|touch)\b/g, '<span class="token keyword">$1</span>'), t = t.replace(/\b(install|run|build|start|test|dev|init|clone|pull|push|commit|add|checkout|branch|merge)\b/g, '<span class="token function">$1</span>'), t = t.replace(/(\s-+[a-zA-Z0-9-]+)/g, '<span class="token attr-name">$1</span>'), t = t.replace(/(\$[A-Z0-9_]+)/g, '<span class="token number">$1</span>')) : i === "html" || i === "xml" ? (t = t.replace(/\s([a-z0-9:-]+)=/gi, (r, l) => " " + n(l, "attr-name") + "="), t = t.replace(/(".*?")/g, (r) => n(r, "attr-value")), t = t.replace(/>/g, '<span class="token tag">></span>')) : i === "css" && (t = t.replace(/([a-z-]+)(?=:)/g, '<span class="token keyword">$1</span>')), Object.keys(e).reverse().forEach((r) => {
|
|
1537
|
+
t = t.replace(r, e[r]);
|
|
1542
1538
|
}), t;
|
|
1543
1539
|
}
|
|
1544
1540
|
_onCopy() {
|
|
1545
|
-
|
|
1541
|
+
k(this._getFormattedText());
|
|
1546
1542
|
const t = this.copyBtn.querySelector("eui-icon");
|
|
1547
1543
|
if (t) {
|
|
1548
|
-
const
|
|
1549
|
-
t.setAttribute("name", "check"), setTimeout(() => t.setAttribute("name",
|
|
1544
|
+
const i = t.getAttribute("name");
|
|
1545
|
+
t.setAttribute("name", "check"), setTimeout(() => t.setAttribute("name", i), 2e3);
|
|
1550
1546
|
}
|
|
1551
1547
|
}
|
|
1552
1548
|
disconnectedCallback() {
|
|
@@ -1554,7 +1550,7 @@ class U extends HTMLElement {
|
|
|
1554
1550
|
}
|
|
1555
1551
|
}
|
|
1556
1552
|
customElements.define("eui-code", U);
|
|
1557
|
-
class
|
|
1553
|
+
class P extends HTMLElement {
|
|
1558
1554
|
constructor() {
|
|
1559
1555
|
super(), this.attachShadow({ mode: "open" });
|
|
1560
1556
|
}
|
|
@@ -1564,7 +1560,7 @@ class Z extends HTMLElement {
|
|
|
1564
1560
|
static get observedAttributes() {
|
|
1565
1561
|
return ["name"];
|
|
1566
1562
|
}
|
|
1567
|
-
attributeChangedCallback(t,
|
|
1563
|
+
attributeChangedCallback(t, i, e) {
|
|
1568
1564
|
t === "name" && (this.render(), this.setupEventListeners());
|
|
1569
1565
|
}
|
|
1570
1566
|
setupEventListeners() {
|
|
@@ -1670,8 +1666,8 @@ class Z extends HTMLElement {
|
|
|
1670
1666
|
`;
|
|
1671
1667
|
}
|
|
1672
1668
|
}
|
|
1673
|
-
customElements.define("eui-app-titlebar",
|
|
1674
|
-
class
|
|
1669
|
+
customElements.define("eui-app-titlebar", P);
|
|
1670
|
+
class V extends HTMLElement {
|
|
1675
1671
|
constructor() {
|
|
1676
1672
|
super(), this.attachShadow({ mode: "open" }), this._handleMouseDown = this._addRipple.bind(this);
|
|
1677
1673
|
}
|
|
@@ -1681,16 +1677,16 @@ class X extends HTMLElement {
|
|
|
1681
1677
|
static get observedAttributes() {
|
|
1682
1678
|
return ["elevated", "interactive", "ripple"];
|
|
1683
1679
|
}
|
|
1684
|
-
attributeChangedCallback(t,
|
|
1685
|
-
|
|
1680
|
+
attributeChangedCallback(t, i, e) {
|
|
1681
|
+
i !== e && t === "ripple" && this.setupEventListeners();
|
|
1686
1682
|
}
|
|
1687
1683
|
setupEventListeners() {
|
|
1688
1684
|
this.removeEventListener("mousedown", this._handleMouseDown), this.hasAttribute("ripple") && this.addEventListener("mousedown", this._handleMouseDown);
|
|
1689
1685
|
}
|
|
1690
1686
|
_addRipple(t) {
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
|
|
1687
|
+
const i = this.getBoundingClientRect(), e = document.createElement("span"), a = Math.max(i.width, i.height), n = a / 2;
|
|
1688
|
+
e.style.width = e.style.height = `${a}px`, e.style.left = `${t.clientX - i.left - n}px`, e.style.top = `${t.clientY - i.top - n}px`, e.classList.add("ripple"), this.shadowRoot.querySelector(".surface").appendChild(e), e.addEventListener("animationend", () => {
|
|
1689
|
+
e.remove();
|
|
1694
1690
|
});
|
|
1695
1691
|
}
|
|
1696
1692
|
render() {
|
|
@@ -1758,14 +1754,143 @@ class X extends HTMLElement {
|
|
|
1758
1754
|
`;
|
|
1759
1755
|
}
|
|
1760
1756
|
}
|
|
1761
|
-
customElements.define("eui-surface",
|
|
1757
|
+
customElements.define("eui-surface", V);
|
|
1758
|
+
class D extends HTMLElement {
|
|
1759
|
+
static get observedAttributes() {
|
|
1760
|
+
return ["value", "min", "max", "step", "label"];
|
|
1761
|
+
}
|
|
1762
|
+
constructor() {
|
|
1763
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
1764
|
+
<style>
|
|
1765
|
+
:host {
|
|
1766
|
+
display: flex;
|
|
1767
|
+
flex-direction: column;
|
|
1768
|
+
gap: 8px;
|
|
1769
|
+
width: 100%;
|
|
1770
|
+
max-width: 300px;
|
|
1771
|
+
margin: 0.75rem 0;
|
|
1772
|
+
user-select: none;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.header {
|
|
1776
|
+
display: flex;
|
|
1777
|
+
justify-content: space-between;
|
|
1778
|
+
align-items: center;
|
|
1779
|
+
color: var(--app-400, #999);
|
|
1780
|
+
font-size: 0.85rem;
|
|
1781
|
+
font-weight: 500;
|
|
1782
|
+
padding: 0 4px;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
.slider-container {
|
|
1786
|
+
position: relative;
|
|
1787
|
+
height: 32px;
|
|
1788
|
+
display: flex;
|
|
1789
|
+
align-items: center;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
input[type="range"] {
|
|
1793
|
+
-webkit-appearance: none;
|
|
1794
|
+
appearance: none;
|
|
1795
|
+
opacity: 0;
|
|
1796
|
+
width: 100%;
|
|
1797
|
+
height: 4px;
|
|
1798
|
+
background: var(--app-300, #333);
|
|
1799
|
+
border-radius: 3px;
|
|
1800
|
+
outline: none;
|
|
1801
|
+
margin: 0;
|
|
1802
|
+
cursor: pointer;
|
|
1803
|
+
position: relative;
|
|
1804
|
+
z-index: 1;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.track {
|
|
1808
|
+
position: absolute;
|
|
1809
|
+
height: 4px;
|
|
1810
|
+
width: 100%;
|
|
1811
|
+
background: var(--app-200, #333);
|
|
1812
|
+
border-radius: 3px;
|
|
1813
|
+
overflow: hidden;
|
|
1814
|
+
pointer-events: none;
|
|
1815
|
+
z-index: 0;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
.track-fill {
|
|
1819
|
+
position: absolute;
|
|
1820
|
+
height: 4px;
|
|
1821
|
+
background: var(--app-accent, #6366f1);
|
|
1822
|
+
pointer-events: none;
|
|
1823
|
+
z-index: 0;
|
|
1824
|
+
left: 0;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
.slider-thumb {
|
|
1828
|
+
position: absolute;
|
|
1829
|
+
width: 20px;
|
|
1830
|
+
height: 20px;
|
|
1831
|
+
background: var(--app-accent, #6366f1);
|
|
1832
|
+
box-shadow: inset 0 0 0 1px var(--app-500, #131318), inset 0 0 0 4px var(--app-200, #131318);
|
|
1833
|
+
border-radius: 50%;
|
|
1834
|
+
pointer-events: none;
|
|
1835
|
+
z-index: 0;
|
|
1836
|
+
left: 0;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.slider-thumb.active {
|
|
1840
|
+
background: var(--app-accent-50, #7376ff);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
.value-badge {
|
|
1844
|
+
color: var(--app-text);
|
|
1845
|
+
font-weight: 600;
|
|
1846
|
+
}
|
|
1847
|
+
</style>
|
|
1848
|
+
<div class="header">
|
|
1849
|
+
<span class="label"></span>
|
|
1850
|
+
<span class="value-badge"></span>
|
|
1851
|
+
</div>
|
|
1852
|
+
<div class="slider-container">
|
|
1853
|
+
<div class="track">
|
|
1854
|
+
<div class="track-fill"></div>
|
|
1855
|
+
</div>
|
|
1856
|
+
<div class="slider-thumb"></div>
|
|
1857
|
+
<input type="range">
|
|
1858
|
+
</div>
|
|
1859
|
+
`;
|
|
1860
|
+
}
|
|
1861
|
+
connectedCallback() {
|
|
1862
|
+
this.inputEl = this.shadowRoot.querySelector("input"), this.labelEl = this.shadowRoot.querySelector(".label"), this.valueEl = this.shadowRoot.querySelector(".value-badge"), this.trackFillEl = this.shadowRoot.querySelector(".track-fill"), this.sliderThumbEl = this.shadowRoot.querySelector(".slider-thumb"), this.inputEl.min = this.getAttribute("min") || 0, this.inputEl.max = this.getAttribute("max") || 100, this.inputEl.step = this.getAttribute("step") || 1, this.inputEl.value = this.getAttribute("value") || 50, this.hasAttribute("label") && (this.labelEl.textContent = this.getAttribute("label")), this.updateUI(), this.inputEl.addEventListener("input", () => {
|
|
1863
|
+
this.updateValue(this.inputEl.value), this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
|
|
1864
|
+
}), this.inputEl.addEventListener("change", () => {
|
|
1865
|
+
this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
1866
|
+
}), this.inputEl.addEventListener("mousedown", () => this.sliderThumbEl.classList.add("active")), this.inputEl.addEventListener("touchstart", () => this.sliderThumbEl.classList.add("active"), { passive: !0 }), window.addEventListener("mouseup", () => this.sliderThumbEl.classList.remove("active")), window.addEventListener("touchend", () => this.sliderThumbEl.classList.remove("active"));
|
|
1867
|
+
}
|
|
1868
|
+
updateValue(t) {
|
|
1869
|
+
this.setAttribute("value", t), this.updateUI();
|
|
1870
|
+
}
|
|
1871
|
+
updateUI() {
|
|
1872
|
+
if (!this.inputEl) return;
|
|
1873
|
+
const t = parseFloat(this.inputEl.min), i = parseFloat(this.inputEl.max), e = parseFloat(this.inputEl.value), a = (e - t) / (i - t) * 100;
|
|
1874
|
+
this.trackFillEl.style.width = `${a}%`, this.sliderThumbEl.style.left = `calc(${a}% - ${a / 100 * 20}px)`, this.valueEl.textContent = e;
|
|
1875
|
+
}
|
|
1876
|
+
attributeChangedCallback(t, i, e) {
|
|
1877
|
+
this.inputEl && (t === "value" && e !== this.inputEl.value ? (this.inputEl.value = e, this.updateUI()) : ["min", "max", "step"].includes(t) ? (this.inputEl[t] = e, this.updateUI()) : t === "label" && (this.labelEl.textContent = e));
|
|
1878
|
+
}
|
|
1879
|
+
get value() {
|
|
1880
|
+
return parseFloat(this.inputEl.value);
|
|
1881
|
+
}
|
|
1882
|
+
set value(t) {
|
|
1883
|
+
this.setAttribute("value", t);
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
customElements.define("eui-slider", D);
|
|
1762
1887
|
typeof window < "u" && console.log("ErisUI loaded successfully");
|
|
1763
1888
|
export {
|
|
1764
|
-
|
|
1765
|
-
|
|
1889
|
+
Z as device,
|
|
1890
|
+
X as haptics,
|
|
1766
1891
|
u as icons,
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1892
|
+
J as loadPage,
|
|
1893
|
+
y as router,
|
|
1894
|
+
W as storage,
|
|
1895
|
+
K as utils
|
|
1771
1896
|
};
|