@3r1s_s/erisui 1.0.19 → 1.0.20

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.js CHANGED
@@ -232,7 +232,7 @@
232
232
  <div class="progressbar">
233
233
  <span class="progress"></span>
234
234
  </div>
235
- `}set value(t){this.setAttribute("value",t)}attributeChangedCallback(){this.connectedCallback()}connectedCallback(){const t=this.shadowRoot.querySelector(".progress");this.hasAttribute("id")&&(t.id=this.getAttribute("id")),this.hasAttribute("intermediate")&&t.classList.add("intermediate"),this.hasAttribute("value")&&(t.style.width=this.getAttribute("value")+"%")}}customElements.define("eui-progressbar",T);const v={is:{iPhone:/iPhone/.test(navigator.userAgent),iPad:/iPad/.test(navigator.userAgent),iOS:/iPhone|iPad|iPod/.test(navigator.userAgent),android:/Android/.test(navigator.userAgent),mobile:/Mobi|Android/i.test(navigator.userAgent)},prefers:{language:navigator.language||navigator.userLanguage,reducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,reducedTransparency:window.matchMedia("(prefers-reduced-transparency: reduce)").matches},supports:{share:typeof navigator.share=="function",directDownload:"download"in document.createElement("a"),haptics:"vibrate"in navigator||"Vibrate"in window||typeof window.navigator.vibrate=="function"},userAgent:navigator.userAgent},z=Object.freeze(Object.defineProperty({__proto__:null,device:v},Symbol.toStringTag,{value:"Module"}));function M(){try{const s=document.createElement("label");s.ariaHidden="true",s.style.display="none";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),s.appendChild(t),document.head.appendChild(s),s.click(),document.head.removeChild(s)}catch{}}function x(s){v.supports.haptics?navigator.vibrate(s||50):v.is.iPhone&&M()}const $=Object.freeze(Object.defineProperty({__proto__:null,haptic:x},Symbol.toStringTag,{value:"Module"})),C=(()=>{let s={},t;try{s=JSON.parse(localStorage.getItem(t)||"{}")}catch(i){console.error(i)}return{get(i){return s[i]},set(i,e){s[i]=e,localStorage.setItem(t,JSON.stringify(s))},delete(i){delete s[i],localStorage.setItem(t,JSON.stringify(s))},all(){return s},clear(){s={},localStorage.setItem(t,JSON.stringify(s))},name(i){t=i;try{s=JSON.parse(localStorage.getItem(t)||"{}")}catch(e){console.error(e)}},settings:{get(i){return s&&s.settings&&s.settings[i]},set(i,e){s.settings||(s.settings={}),s.settings[i]=e,localStorage.setItem(t,JSON.stringify(s))},delete(i){s.settings&&(delete s.settings[i],localStorage.setItem(t,JSON.stringify(s)))},all(){return s.settings||{}},clear(){s.settings&&(s.settings={},localStorage.setItem(t,JSON.stringify(s)))}}}})(),R=C.settings,H=Object.freeze(Object.defineProperty({__proto__:null,settings:R,storage:C},Symbol.toStringTag,{value:"Module"}));class _ extends HTMLElement{static get observedAttributes(){return["selected"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
235
+ `}set value(t){this.setAttribute("value",t)}set intermediate(t){t?this.setAttribute("intermediate",""):this.removeAttribute("intermediate")}set id(t){this.setAttribute("id",t)}get intermediate(){return this.hasAttribute("intermediate")}get value(){return this.getAttribute("value")}attributeChangedCallback(){this.connectedCallback()}connectedCallback(){const t=this.shadowRoot.querySelector(".progress");this.hasAttribute("id")&&(t.id=this.getAttribute("id")),this.hasAttribute("intermediate")?t.classList.add("intermediate"):t.classList.remove("intermediate"),this.hasAttribute("value")&&(t.style.width=this.getAttribute("value")+"%")}}customElements.define("eui-progressbar",T);const v={is:{iPhone:/iPhone/.test(navigator.userAgent),iPad:/iPad/.test(navigator.userAgent),iOS:/iPhone|iPad|iPod/.test(navigator.userAgent),android:/Android/.test(navigator.userAgent),mobile:/Mobi|Android/i.test(navigator.userAgent)},prefers:{language:navigator.language||navigator.userLanguage,reducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,reducedTransparency:window.matchMedia("(prefers-reduced-transparency: reduce)").matches},supports:{share:typeof navigator.share=="function",directDownload:"download"in document.createElement("a"),haptics:"vibrate"in navigator||"Vibrate"in window||typeof window.navigator.vibrate=="function"},userAgent:navigator.userAgent},z=Object.freeze(Object.defineProperty({__proto__:null,device:v},Symbol.toStringTag,{value:"Module"}));function M(){try{const s=document.createElement("label");s.ariaHidden="true",s.style.display="none";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),s.appendChild(t),document.head.appendChild(s),s.click(),document.head.removeChild(s)}catch{}}function x(s){v.supports.haptics?navigator.vibrate(s||50):v.is.iPhone&&M()}const $=Object.freeze(Object.defineProperty({__proto__:null,haptic:x},Symbol.toStringTag,{value:"Module"})),C=(()=>{let s={},t;try{s=JSON.parse(localStorage.getItem(t)||"{}")}catch(i){console.error(i)}return{get(i){return s[i]},set(i,e){s[i]=e,localStorage.setItem(t,JSON.stringify(s))},delete(i){delete s[i],localStorage.setItem(t,JSON.stringify(s))},all(){return s},clear(){s={},localStorage.setItem(t,JSON.stringify(s))},name(i){t=i;try{s=JSON.parse(localStorage.getItem(t)||"{}")}catch(e){console.error(e)}},settings:{get(i){return s&&s.settings&&s.settings[i]},set(i,e){s.settings||(s.settings={}),s.settings[i]=e,localStorage.setItem(t,JSON.stringify(s))},delete(i){s.settings&&(delete s.settings[i],localStorage.setItem(t,JSON.stringify(s)))},all(){return s.settings||{}},clear(){s.settings&&(s.settings={},localStorage.setItem(t,JSON.stringify(s)))}}}})(),R=C.settings,H=Object.freeze(Object.defineProperty({__proto__:null,settings:R,storage:C},Symbol.toStringTag,{value:"Module"}));class _ extends HTMLElement{static get observedAttributes(){return["selected"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
236
236
  <style>
237
237
  .switch {
238
238
  background-color: var(--app-200);
package/dist/erisui.mjs CHANGED
@@ -64,8 +64,8 @@ class E extends HTMLElement {
64
64
  }
65
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
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();
67
+ let o = "";
68
+ a.length === 1 ? o = a[0][0] || "" : o = (a[0][0] || "") + (a[a.length - 1][0] || ""), this.initials.textContent = o.toUpperCase();
69
69
  }
70
70
  }
71
71
  }
@@ -111,10 +111,10 @@ class A extends HTMLElement {
111
111
  }
112
112
  const e = document.createElement("template");
113
113
  e.innerHTML = i.trim();
114
- const a = e.content.cloneNode(!0), n = a.firstElementChild;
115
- if (n && n.style) {
114
+ const a = e.content.cloneNode(!0), o = a.firstElementChild;
115
+ if (o && o.style) {
116
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";
117
+ r && o.setAttribute("width", r), l && o.setAttribute("height", l), o.style.display = "block";
118
118
  }
119
119
  this.shadowRoot.innerHTML = "", this.shadowRoot.appendChild(a);
120
120
  }
@@ -361,12 +361,24 @@ class z extends HTMLElement {
361
361
  set value(t) {
362
362
  this.setAttribute("value", t);
363
363
  }
364
+ set intermediate(t) {
365
+ t ? this.setAttribute("intermediate", "") : this.removeAttribute("intermediate");
366
+ }
367
+ set id(t) {
368
+ this.setAttribute("id", t);
369
+ }
370
+ get intermediate() {
371
+ return this.hasAttribute("intermediate");
372
+ }
373
+ get value() {
374
+ return this.getAttribute("value");
375
+ }
364
376
  attributeChangedCallback() {
365
377
  this.connectedCallback();
366
378
  }
367
379
  connectedCallback() {
368
380
  const t = this.shadowRoot.querySelector(".progress");
369
- this.hasAttribute("id") && (t.id = this.getAttribute("id")), this.hasAttribute("intermediate") && t.classList.add("intermediate"), this.hasAttribute("value") && (t.style.width = this.getAttribute("value") + "%");
381
+ this.hasAttribute("id") && (t.id = this.getAttribute("id")), this.hasAttribute("intermediate") ? t.classList.add("intermediate") : t.classList.remove("intermediate"), this.hasAttribute("value") && (t.style.width = this.getAttribute("value") + "%");
370
382
  }
371
383
  }
372
384
  customElements.define("eui-progressbar", z);
@@ -621,13 +633,13 @@ class R extends HTMLElement {
621
633
  customElements.define("eui-chip", R);
622
634
  const b = "", y = (() => {
623
635
  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}$`);
636
+ function t(n, d) {
637
+ const h = [], g = n.replace(/:([^/]+)/g, (m, f) => (h.push(f), "([^/]+)")).replace(/\//g, "\\/"), p = new RegExp(`^${b}${g}$`);
626
638
  s.push({ regex: p, paramNames: h, renderFn: d });
627
639
  }
628
- function i(o) {
640
+ function i(n) {
629
641
  for (const { regex: d, paramNames: h, renderFn: g } of s) {
630
- const p = o.match(d);
642
+ const p = n.match(d);
631
643
  if (p) {
632
644
  const m = {};
633
645
  return h.forEach((f, C) => {
@@ -637,38 +649,38 @@ const b = "", y = (() => {
637
649
  }
638
650
  return null;
639
651
  }
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];
652
+ function e(n, d = !0) {
653
+ n.startsWith(b) || (n = b + (n.startsWith("/") ? "" : "/") + n);
654
+ const h = n.split(/[?#]/)[0];
655
+ if (h === window.location.pathname && n.includes("#")) {
656
+ d && history.pushState({}, "", n);
657
+ const p = "#" + n.split("#")[1];
646
658
  a(p);
647
659
  return;
648
660
  }
649
661
  const g = i(h);
650
662
  if (g)
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];
663
+ if (d && history.pushState({}, "", n), g.renderFn(g.params), window.dispatchEvent(new CustomEvent("route-changed", { detail: { path: n } })), n.includes("#")) {
664
+ const p = "#" + n.split("#")[1];
653
665
  setTimeout(() => a(p), 100);
654
666
  } else {
655
667
  const p = document.getElementById("main");
656
668
  p && p.scrollTo(0, 0);
657
669
  }
658
- else n ? (d && history.pushState({}, "", o), n()) : console.warn(`No route found for ${h}`);
670
+ else o ? (d && history.pushState({}, "", n), o()) : console.warn(`No route found for ${h}`);
659
671
  }
660
- function a(o) {
661
- if (o)
672
+ function a(n) {
673
+ if (n)
662
674
  try {
663
- const d = document.querySelector(o);
675
+ const d = document.querySelector(n);
664
676
  d && d.scrollIntoView({ behavior: "smooth" });
665
677
  } catch {
666
- console.warn("Invalid hash:", o);
678
+ console.warn("Invalid hash:", n);
667
679
  }
668
680
  }
669
- let n = null;
670
- function r(o) {
671
- n = o;
681
+ let o = null;
682
+ function r(n) {
683
+ o = n;
672
684
  }
673
685
  function l() {
674
686
  history.back();
@@ -677,15 +689,15 @@ const b = "", y = (() => {
677
689
  return window.location.pathname.replace(b, "") || "/";
678
690
  }
679
691
  return window.addEventListener("popstate", () => {
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");
692
+ const n = window.location.pathname + window.location.search + window.location.hash;
693
+ e(n, !1);
694
+ }), window.addEventListener("click", (n) => {
695
+ if (n.button !== 0 || n.metaKey || n.altKey || n.ctrlKey || n.shiftKey) return;
696
+ const d = n.target.closest("a");
685
697
  if (!d || d.hasAttribute("download") || d.getAttribute("target") === "_blank") return;
686
698
  const h = d.getAttribute("href");
687
699
  if (!(!h || h.startsWith("http") && !h.startsWith(window.location.origin))) {
688
- if (o.preventDefault(), h.startsWith("#")) {
700
+ if (n.preventDefault(), h.startsWith("#")) {
689
701
  history.pushState({}, "", h), a(h);
690
702
  return;
691
703
  }
@@ -737,30 +749,30 @@ class H extends HTMLElement {
737
749
  };
738
750
  setupEventListeners() {
739
751
  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", () => {
752
+ const i = document.createElement("span"), e = t.currentTarget, a = e.getBoundingClientRect(), o = Math.max(e.offsetWidth, e.offsetHeight), r = o / 2;
753
+ i.classList.add("ripple"), i.style.width = `${o}px`, i.style.height = `${o}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", () => {
742
754
  i.remove();
743
755
  });
744
756
  });
745
757
  }
746
758
  updateContent() {
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)
759
+ const t = this.getAttribute("icon"), i = this.getAttribute("avatar-src"), e = this.getAttribute("avatar-name"), a = this.getAttribute("label") || "", o = this.getAttribute("badge"), r = this.shadowRoot.querySelector(".badge");
760
+ if (o)
749
761
  if (r)
750
- r.textContent = n;
762
+ r.textContent = o;
751
763
  else {
752
- const o = document.createElement("span");
753
- o.className = "badge", o.textContent = n, this.shadowRoot.appendChild(o);
764
+ const n = document.createElement("span");
765
+ n.className = "badge", n.textContent = o, this.shadowRoot.appendChild(n);
754
766
  }
755
767
  else r && r.remove();
756
768
  const l = this.shadowRoot.querySelector("slot[name='icon']");
757
769
  if (l)
758
770
  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;
771
+ let n = '<eui-avatar size="24"';
772
+ e && (n += ` name="${e}"`), n += ">", i && (n += `<img src="${i}" alt="${e || "Avatar"}" />`), n += "</eui-avatar>", l.innerHTML = n;
761
773
  } else {
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 = "";
774
+ const n = l.querySelector("eui-icon");
775
+ t && n ? n.getAttribute("name") !== t && n.setAttribute("name", t) : t ? l.innerHTML = `<eui-icon width="24" height="24" name="${t}"></eui-icon>` : l.innerHTML = "";
764
776
  }
765
777
  const c = this.shadowRoot.querySelector(".label");
766
778
  c && (c.textContent = a);
@@ -1103,8 +1115,8 @@ class F extends HTMLElement {
1103
1115
  this.hd = this.shadowRoot.querySelector(".header"), this.hasAttribute("type") && this.hd.classList.add(this.getAttribute("type"));
1104
1116
  }
1105
1117
  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})` : "");
1118
+ const a = this.shadowRoot.querySelector("h1"), o = this.shadowRoot.querySelector("p"), r = this.shadowRoot.querySelector(".img");
1119
+ t === "title" && (a.textContent = e), t === "subtitle" && (o.textContent = e), t === "img" && (r.style.backgroundImage = e ? `url(${e})` : "");
1108
1120
  }
1109
1121
  }
1110
1122
  customElements.define("eui-header", F);
@@ -1339,9 +1351,9 @@ class q extends HTMLElement {
1339
1351
  `;
1340
1352
  const e = this.shadowRoot.querySelector(i);
1341
1353
  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();
1354
+ const o = document.createElement("span"), r = a.currentTarget, l = r.getBoundingClientRect(), c = Math.max(r.offsetWidth, r.offsetHeight), n = c / 2;
1355
+ o.classList.add("ripple"), o.style.width = `${c}px`, o.style.height = `${c}px`, o.style.left = `${a.clientX - l.left - n}px`, o.style.top = `${a.clientY - l.top - n}px`, e.appendChild(o), o.addEventListener("animationend", () => {
1356
+ o.remove();
1345
1357
  });
1346
1358
  });
1347
1359
  }
@@ -1421,12 +1433,12 @@ class j extends HTMLElement {
1421
1433
  }
1422
1434
  customElements.define("eui-heading", j);
1423
1435
  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`;
1436
+ const e = Date.now() - s, a = Math.floor(e / 1e3), o = Math.floor(a / 60), r = Math.floor(o / 60), l = Math.floor(r / 24), c = Math.floor(l / 30), n = Math.floor(c / 12);
1437
+ return n > 0 ? `${n}y` : c > 0 ? `${c}mo` : l > 0 ? `${l}d` : r > 0 ? `${r}h` : o > 0 ? `${o}m` : `${a}s`;
1426
1438
  }
1427
1439
  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`;
1440
+ const e = Date.now() - s, a = Math.floor(e / 1e3), o = Math.floor(a / 60), r = Math.floor(o / 60), l = Math.floor(r / 24), c = Math.floor(l / 30), n = Math.floor(c / 12);
1441
+ return n > 0 ? `${n} year${n > 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` : o > 0 ? `${o} minute${o > 1 ? "s" : ""} ago` : `${a} second${a > 1 ? "s" : ""} ago`;
1430
1442
  }
1431
1443
  function O(s) {
1432
1444
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;").replace(/`/g, "&#96;").replace(/'/g, "&#39;");
@@ -1517,8 +1529,8 @@ class U extends HTMLElement {
1517
1529
  let i = (this.querySelector("code") || this).innerHTML || "";
1518
1530
  i = this._unescapeHtml(i), i = i.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
1519
1531
  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(`
1532
+ `), a = e.filter((r) => r.trim()).map((r) => r.match(/^\s*/)[0].length), o = a.length ? Math.min(...a) : 0;
1533
+ return e.map((r) => r.slice(o)).join(`
1522
1534
  `);
1523
1535
  }
1524
1536
  _unescapeHtml(t) {
@@ -1529,11 +1541,11 @@ class U extends HTMLElement {
1529
1541
  t = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1530
1542
  const e = {};
1531
1543
  let a = 0;
1532
- function n(r, l) {
1544
+ function o(r, l) {
1533
1545
  const c = `__TOKEN_${l}_${a++}__`;
1534
1546
  return e[c] = `<span class="token ${l}">${r}</span>`, c;
1535
1547
  }
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(/(&lt;!--[\s\S]*?--&gt;)/g, (r) => n(r, "comment")), t = t.replace(/(&lt;\/?[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(/&gt;/g, '<span class="token tag">&gt;</span>')) : i === "css" && (t = t.replace(/([a-z-]+)(?=:)/g, '<span class="token keyword">$1</span>')), Object.keys(e).reverse().forEach((r) => {
1548
+ return ["javascript", "js", "json", "bash", "sh", "css"].includes(i) ? (t = t.replace(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, (r) => o(r, "string")), i === "bash" || i === "sh" ? t = t.replace(/(#.*$)/gm, (r) => o(r, "comment")) : i === "css" ? t = t.replace(/(\/\*[\s\S]*?\*\/)/g, (r) => o(r, "comment")) : t = t.replace(/(\/\/.*$|\/\*[\s\S]*?\*\/)/gm, (r) => o(r, "comment"))) : ["html", "xml"].includes(i) && (t = t.replace(/(&lt;!--[\s\S]*?--&gt;)/g, (r) => o(r, "comment")), t = t.replace(/(&lt;\/?[a-z0-9:-]+)/gi, (r) => o(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) => " " + o(l, "attr-name") + "="), t = t.replace(/(".*?")/g, (r) => o(r, "attr-value")), t = t.replace(/&gt;/g, '<span class="token tag">&gt;</span>')) : i === "css" && (t = t.replace(/([a-z-]+)(?=:)/g, '<span class="token keyword">$1</span>')), Object.keys(e).reverse().forEach((r) => {
1537
1549
  t = t.replace(r, e[r]);
1538
1550
  }), t;
1539
1551
  }
@@ -1684,8 +1696,8 @@ class V extends HTMLElement {
1684
1696
  this.removeEventListener("mousedown", this._handleMouseDown), this.hasAttribute("ripple") && this.addEventListener("mousedown", this._handleMouseDown);
1685
1697
  }
1686
1698
  _addRipple(t) {
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", () => {
1699
+ const i = this.getBoundingClientRect(), e = document.createElement("span"), a = Math.max(i.width, i.height), o = a / 2;
1700
+ e.style.width = e.style.height = `${a}px`, e.style.left = `${t.clientX - i.left - o}px`, e.style.top = `${t.clientY - i.top - o}px`, e.classList.add("ripple"), this.shadowRoot.querySelector(".surface").appendChild(e), e.addEventListener("animationend", () => {
1689
1701
  e.remove();
1690
1702
  });
1691
1703
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3r1s_s/erisui",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "an awesome ui library for web apps",
5
5
  "type": "module",
6
6
  "files": [