aptechka 0.4.18 → 0.4.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.
@@ -1 +1 @@
1
- "use strict";var tt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var K=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var i=(n,t,e)=>(K(n,t,"read from private field"),e?e.call(n):t.get(n)),o=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},c=(n,t,e,r)=>(K(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e);var m=(n,t,e)=>(K(n,t,"access private method"),e);var T=(n,t,e)=>new Promise((r,s)=>{var a=u=>{try{d(e.next(u))}catch(f){s(f)}},L=u=>{try{d(e.throw(u))}catch(f){s(f)}},d=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,L);d((e=e.apply(n,t)).next())});var et=(n,t,e)=>(t=n[tt("asyncIterator")])?t.call(n):(n=n[tt("iterator")](),t={},e=(r,s)=>(s=n[r])&&(t[r]=a=>new Promise((L,d,u)=>(a=s.call(n,a),u=a.done,Promise.resolve(a.value).then(f=>L({value:f,done:u}),d)))),e("next"),e("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("../notifier/index.cjs"),at=require("../browser-CpzFX2xg.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var y,l,w,H,S,P;class lt{constructor(t,e){o(this,y,void 0);o(this,l,void 0);o(this,w,void 0);o(this,H,void 0);o(this,S,t=>{t.preventDefault(),i(this,y).navigate(i(this,w),i(this,H))});o(this,P,()=>{i(this,y).prefetch(i(this,w)),i(this,l).removeEventListener("pointerenter",i(this,P))});c(this,y,e),c(this,l,t),c(this,w,i(this,l).getAttribute("href")||"/"),c(this,H,i(this,l).getAttribute("data-history-action")||"push"),i(this,l).addEventListener("click",i(this,S));const r=e.normalizePath(i(this,w)),s=e.normalizePath(location.pathname);r.pathname===s.pathname&&i(this,l).classList.add("current"),i(this,l).hasAttribute("data-prefetch")&&i(this,l).addEventListener("pointerenter",i(this,P))}destroy(){i(this,l).removeEventListener("click",i(this,S)),i(this,l).removeEventListener("pointerenter",i(this,P)),i(this,l).classList.remove("current")}}y=new WeakMap,l=new WeakMap,w=new WeakMap,H=new WeakMap,S=new WeakMap,P=new WeakMap;var p,N,A,C,k,O,b,E,M,W,x,q,Y,z,_,D,G,$,st,R,J,j;class ut{constructor(t){o(this,q);o(this,z);o(this,D);o(this,$);o(this,R);o(this,p,null);o(this,N,null);o(this,A,null);o(this,C,null);o(this,k,[]);o(this,O,new DOMParser);o(this,b,new Map);o(this,E,void 0);o(this,M,null);o(this,W,new it.Notifier);o(this,x,new it.Notifier);o(this,j,t=>{t.state&&this.navigate(t.state,"none")});at.isBrowser&&(c(this,p,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(c(this,p,t.base),t.base.endsWith("/")||c(this,p,i(this,p)+"/")):c(this,p,"/"),c(this,N,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,A,(t==null?void 0:t.cachePages)!==!1),c(this,C,m(this,D,G).call(this,document)),c(this,M,location.pathname),m(this,z,_).call(this),addEventListener("popstate",i(this,j)))}normalizePath(t){t=t.replace(i(this,p),""),t.startsWith("/")&&(t=t.slice(1));const e=t.split("#"),r=e[0].split("?"),s=r[0].endsWith("/")?r[0].slice(0,-1):r[0],a=i(this,p)+s,L=r==null?void 0:r[1],d=e==null?void 0:e[1];return{leaf:s,pathname:a,parameters:L,hash:d}}beforeNavigationEvent(t){return i(this,W).subscribe(t)}afterNavigationEvent(t){return i(this,x).subscribe(t)}prefetch(t){return T(this,null,function*(){const e=this.normalizePath(t);return m(this,q,Y).call(this,e.pathname)})}navigate(t,e="push"){return T(this,null,function*(){var u;const r=this.normalizePath(t);let{pathname:s,hash:a,parameters:L}=r;if(i(this,E)===s||i(this,M)===s)return;c(this,E,s);const d=i(this,b).has(s);try{let f=!0;if(i(this,W).notify({pathname:s,isCached:d}),this.preprocessor)try{yield new Promise((h,g)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:s,resolve:h,reject:g,isCached:d})})}catch(h){h?console.error(h):console.log("Route change canceled"),f=!1}if(!f||i(this,E)!==s)return;const Q=i(this,b).get(s)||(yield m(this,q,Y).call(this,s));if(i(this,E)!==s)return;const U=Array.from(document.head.children),V=Array.from(Q.head.cloneNode(!0).children),X=m(this,$,st).call(this,U,V),nt=m(this,R,J).call(this,U,X),F=m(this,R,J).call(this,V,X);nt.forEach(h=>{h.remove()}),F.forEach((h,g)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),F[g]=v}}),F.forEach((h,g)=>{document.head.appendChild(h)});const B=F.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");i(this,N)&&B.length&&(yield new Promise(h=>T(this,null,function*(){let g=0;try{for(var v=et(B),mt,gt,pt;mt=!(gt=yield v.next()).done;mt=!1){const ct=gt.value;ct.onload=()=>{g++,g===B.length&&h()}}}catch(gt){pt=[gt]}finally{try{mt&&(gt=v.return)&&(yield gt.call(v))}finally{if(pt)throw pt[0]}}}))),c(this,M,s);const I=L||location.search,rt=a?a.startsWith("#")?a:"#"+a:"",ot=I?I.startsWith("?")?I:"?"+I:"",Z=`${s}${rt}${ot}`;e==="push"?history.pushState(s,"",Z):e==="replace"&&history.replaceState(s,"",Z);const ht=m(this,D,G).call(this,Q);i(this,C).forEach((h,g)=>{const v=ht[g];h.innerHTML=v.innerHTML}),m(this,z,_).call(this),(u=this.postprocessor)==null||u.call(this,{pathname:s,isCached:d}),i(this,x).notify({pathname:s,isCached:d})}catch(f){console.error(f)}c(this,E,void 0)})}}p=new WeakMap,N=new WeakMap,A=new WeakMap,C=new WeakMap,k=new WeakMap,O=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakMap,W=new WeakMap,x=new WeakMap,q=new WeakSet,Y=function(t){return T(this,null,function*(){const e=i(this,b).get(t);if(e)return e;const s=yield(yield fetch(t)).text(),a=i(this,O).parseFromString(s,"text/html");return i(this,A)&&i(this,b).set(t,a),a})},z=new WeakSet,_=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(e=>{var r;return(r=e.getAttribute("href"))==null?void 0:r.startsWith("/")});i(this,k).forEach(e=>e.destroy()),c(this,k,t.map(e=>new lt(e,this)))},D=new WeakSet,G=function(t){const e=t.querySelectorAll("[data-morph]");return e.length?[...e]:[t.body]},$=new WeakSet,st=function(t,e){return t.filter(r=>e.find(s=>s.outerHTML===r.outerHTML))},R=new WeakSet,J=function(t,e){return t.filter(r=>!e.find(s=>s.outerHTML===r.outerHTML))},j=new WeakMap;exports.Morph=ut;
1
+ "use strict";var tt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var K=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var i=(n,t,e)=>(K(n,t,"read from private field"),e?e.call(n):t.get(n)),o=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},a=(n,t,e,r)=>(K(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e);var m=(n,t,e)=>(K(n,t,"access private method"),e);var T=(n,t,e)=>new Promise((r,s)=>{var c=u=>{try{d(e.next(u))}catch(f){s(f)}},L=u=>{try{d(e.throw(u))}catch(f){s(f)}},d=u=>u.done?r(u.value):Promise.resolve(u.value).then(c,L);d((e=e.apply(n,t)).next())});var et=(n,t,e)=>(t=n[tt("asyncIterator")])?t.call(n):(n=n[tt("iterator")](),t={},e=(r,s)=>(s=n[r])&&(t[r]=c=>new Promise((L,d,u)=>(c=s.call(n,c),u=c.done,Promise.resolve(c.value).then(f=>L({value:f,done:u}),d)))),e("next"),e("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("../notifier/index.cjs"),ct=require("../browser-CpzFX2xg.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var y,l,w,H,S,P;class lt{constructor(t,e){o(this,y,void 0);o(this,l,void 0);o(this,w,void 0);o(this,H,void 0);o(this,S,t=>{t.preventDefault(),i(this,y).navigate(i(this,w),i(this,H))});o(this,P,()=>{i(this,y).prefetch(i(this,w)),i(this,l).removeEventListener("pointerenter",i(this,P))});a(this,y,e),a(this,l,t),a(this,w,i(this,l).getAttribute("href")||"/"),a(this,H,i(this,l).getAttribute("data-history-action")||"push"),i(this,l).addEventListener("click",i(this,S));const r=e.normalizePath(i(this,w)),s=e.normalizePath(location.pathname);i(this,l).hasAttribute("data-include")?s.pathname.includes(r.pathname)&&i(this,l).classList.add("current"):r.pathname===s.pathname&&i(this,l).classList.add("current"),i(this,l).hasAttribute("data-prefetch")&&i(this,l).addEventListener("pointerenter",i(this,P))}destroy(){i(this,l).removeEventListener("click",i(this,S)),i(this,l).removeEventListener("pointerenter",i(this,P)),i(this,l).classList.remove("current")}}y=new WeakMap,l=new WeakMap,w=new WeakMap,H=new WeakMap,S=new WeakMap,P=new WeakMap;var g,N,A,C,k,O,b,E,M,W,x,q,Y,z,_,D,G,$,st,R,J,j;class ut{constructor(t){o(this,q);o(this,z);o(this,D);o(this,$);o(this,R);o(this,g,null);o(this,N,null);o(this,A,null);o(this,C,null);o(this,k,[]);o(this,O,new DOMParser);o(this,b,new Map);o(this,E,void 0);o(this,M,null);o(this,W,new it.Notifier);o(this,x,new it.Notifier);o(this,j,t=>{t.state&&this.navigate(t.state,"none")});ct.isBrowser&&(a(this,g,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(a(this,g,t.base),t.base.endsWith("/")||a(this,g,i(this,g)+"/")):a(this,g,"/"),a(this,N,(t==null?void 0:t.waitForHeadToLoad)!==!1),a(this,A,(t==null?void 0:t.cachePages)!==!1),a(this,C,m(this,D,G).call(this,document)),a(this,M,location.pathname),m(this,z,_).call(this),addEventListener("popstate",i(this,j)))}normalizePath(t){t=t.replace(i(this,g),""),t.startsWith("/")&&(t=t.slice(1));const e=t.split("#"),r=e[0].split("?"),s=r[0].endsWith("/")?r[0].slice(0,-1):r[0],c=i(this,g)+s,L=r==null?void 0:r[1],d=e==null?void 0:e[1];return{leaf:s,pathname:c,parameters:L,hash:d}}beforeNavigationEvent(t){return i(this,W).subscribe(t)}afterNavigationEvent(t){return i(this,x).subscribe(t)}prefetch(t){return T(this,null,function*(){const e=this.normalizePath(t);return m(this,q,Y).call(this,e.pathname)})}navigate(t,e="push"){return T(this,null,function*(){var u;const r=this.normalizePath(t);let{pathname:s,hash:c,parameters:L}=r;if(i(this,E)===s||i(this,M)===s)return;a(this,E,s);const d=i(this,b).has(s);try{let f=!0;if(i(this,W).notify({pathname:s,isCached:d}),this.preprocessor)try{yield new Promise((h,p)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:s,resolve:h,reject:p,isCached:d})})}catch(h){h?console.error(h):console.log("Route change canceled"),f=!1}if(!f||i(this,E)!==s)return;const Q=i(this,b).get(s)||(yield m(this,q,Y).call(this,s));if(i(this,E)!==s)return;const U=Array.from(document.head.children),V=Array.from(Q.head.cloneNode(!0).children),X=m(this,$,st).call(this,U,V),nt=m(this,R,J).call(this,U,X),F=m(this,R,J).call(this,V,X);nt.forEach(h=>{h.remove()}),F.forEach((h,p)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),F[p]=v}}),F.forEach((h,p)=>{document.head.appendChild(h)});const B=F.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");i(this,N)&&B.length&&(yield new Promise(h=>T(this,null,function*(){let p=0;try{for(var v=et(B),mt,pt,gt;mt=!(pt=yield v.next()).done;mt=!1){const at=pt.value;at.onload=()=>{p++,p===B.length&&h()}}}catch(pt){gt=[pt]}finally{try{mt&&(pt=v.return)&&(yield pt.call(v))}finally{if(gt)throw gt[0]}}}))),a(this,M,s);const I=L||location.search,rt=c?c.startsWith("#")?c:"#"+c:"",ot=I?I.startsWith("?")?I:"?"+I:"",Z=`${s}${rt}${ot}`;e==="push"?history.pushState(s,"",Z):e==="replace"&&history.replaceState(s,"",Z);const ht=m(this,D,G).call(this,Q);i(this,C).forEach((h,p)=>{const v=ht[p];h.innerHTML=v.innerHTML}),m(this,z,_).call(this),(u=this.postprocessor)==null||u.call(this,{pathname:s,isCached:d}),i(this,x).notify({pathname:s,isCached:d})}catch(f){console.error(f)}a(this,E,void 0)})}}g=new WeakMap,N=new WeakMap,A=new WeakMap,C=new WeakMap,k=new WeakMap,O=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakMap,W=new WeakMap,x=new WeakMap,q=new WeakSet,Y=function(t){return T(this,null,function*(){const e=i(this,b).get(t);if(e)return e;const s=yield(yield fetch(t)).text(),c=i(this,O).parseFromString(s,"text/html");return i(this,A)&&i(this,b).set(t,c),c})},z=new WeakSet,_=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(e=>{var r;return(r=e.getAttribute("href"))==null?void 0:r.startsWith("/")});i(this,k).forEach(e=>e.destroy()),a(this,k,t.map(e=>new lt(e,this)))},D=new WeakSet,G=function(t){const e=t.querySelectorAll("[data-morph]");return e.length?[...e]:[t.body]},$=new WeakSet,st=function(t,e){return t.filter(r=>e.find(s=>s.outerHTML===r.outerHTML))},R=new WeakSet,J=function(t,e){return t.filter(r=>!e.find(s=>s.outerHTML===r.outerHTML))},j=new WeakMap;exports.Morph=ut;
@@ -3,7 +3,7 @@ var Y = (n, t, e) => {
3
3
  if (!t.has(n))
4
4
  throw TypeError("Cannot " + e);
5
5
  };
6
- var s = (n, t, e) => (Y(n, t, "read from private field"), e ? e.call(n) : t.get(n)), r = (n, t, e) => {
6
+ var s = (n, t, e) => (Y(n, t, "read from private field"), e ? e.call(n) : t.get(n)), h = (n, t, e) => {
7
7
  if (t.has(n))
8
8
  throw TypeError("Cannot add the same private member more than once");
9
9
  t instanceof WeakSet ? t.add(n) : t.set(n, e);
@@ -12,79 +12,79 @@ var m = (n, t, e) => (Y(n, t, "access private method"), e);
12
12
  var T = (n, t, e) => new Promise((o, i) => {
13
13
  var c = (u) => {
14
14
  try {
15
- f(e.next(u));
16
- } catch (d) {
17
- i(d);
15
+ d(e.next(u));
16
+ } catch (f) {
17
+ i(f);
18
18
  }
19
- }, L = (u) => {
19
+ }, v = (u) => {
20
20
  try {
21
- f(e.throw(u));
22
- } catch (d) {
23
- i(d);
21
+ d(e.throw(u));
22
+ } catch (f) {
23
+ i(f);
24
24
  }
25
- }, f = (u) => u.done ? o(u.value) : Promise.resolve(u.value).then(c, L);
26
- f((e = e.apply(n, t)).next());
25
+ }, d = (u) => u.done ? o(u.value) : Promise.resolve(u.value).then(c, v);
26
+ d((e = e.apply(n, t)).next());
27
27
  });
28
- var et = (n, t, e) => (t = n[tt("asyncIterator")]) ? t.call(n) : (n = n[tt("iterator")](), t = {}, e = (o, i) => (i = n[o]) && (t[o] = (c) => new Promise((L, f, u) => (c = i.call(n, c), u = c.done, Promise.resolve(c.value).then((d) => L({ value: d, done: u }), f)))), e("next"), e("return"), t);
28
+ var et = (n, t, e) => (t = n[tt("asyncIterator")]) ? t.call(n) : (n = n[tt("iterator")](), t = {}, e = (o, i) => (i = n[o]) && (t[o] = (c) => new Promise((v, d, u) => (c = i.call(n, c), u = c.done, Promise.resolve(c.value).then((f) => v({ value: f, done: u }), d)))), e("next"), e("return"), t);
29
29
  import { Notifier as st } from "../notifier/index.js";
30
30
  import { i as ct } from "../browser-0zX67oeU.js";
31
31
  import "../path-data-polyfill-DgeDWYeI.js";
32
- var b, l, w, M, N, P;
32
+ var y, l, w, M, A, P;
33
33
  class lt {
34
34
  constructor(t, e) {
35
- r(this, b, void 0);
36
- r(this, l, void 0);
37
- r(this, w, void 0);
38
- r(this, M, void 0);
39
- r(this, N, (t) => {
40
- t.preventDefault(), s(this, b).navigate(s(this, w), s(this, M));
35
+ h(this, y, void 0);
36
+ h(this, l, void 0);
37
+ h(this, w, void 0);
38
+ h(this, M, void 0);
39
+ h(this, A, (t) => {
40
+ t.preventDefault(), s(this, y).navigate(s(this, w), s(this, M));
41
41
  });
42
- r(this, P, () => {
43
- s(this, b).prefetch(s(this, w)), s(this, l).removeEventListener("pointerenter", s(this, P));
42
+ h(this, P, () => {
43
+ s(this, y).prefetch(s(this, w)), s(this, l).removeEventListener("pointerenter", s(this, P));
44
44
  });
45
- a(this, b, e), a(this, l, t), a(this, w, s(this, l).getAttribute("href") || "/"), a(this, M, s(this, l).getAttribute(
45
+ a(this, y, e), a(this, l, t), a(this, w, s(this, l).getAttribute("href") || "/"), a(this, M, s(this, l).getAttribute(
46
46
  "data-history-action"
47
- ) || "push"), s(this, l).addEventListener("click", s(this, N));
47
+ ) || "push"), s(this, l).addEventListener("click", s(this, A));
48
48
  const o = e.normalizePath(s(this, w)), i = e.normalizePath(location.pathname);
49
- o.pathname === i.pathname && s(this, l).classList.add("current"), s(this, l).hasAttribute("data-prefetch") && s(this, l).addEventListener("pointerenter", s(this, P));
49
+ s(this, l).hasAttribute("data-include") ? i.pathname.includes(o.pathname) && s(this, l).classList.add("current") : o.pathname === i.pathname && s(this, l).classList.add("current"), s(this, l).hasAttribute("data-prefetch") && s(this, l).addEventListener("pointerenter", s(this, P));
50
50
  }
51
51
  destroy() {
52
- s(this, l).removeEventListener("click", s(this, N)), s(this, l).removeEventListener("pointerenter", s(this, P)), s(this, l).classList.remove("current");
52
+ s(this, l).removeEventListener("click", s(this, A)), s(this, l).removeEventListener("pointerenter", s(this, P)), s(this, l).classList.remove("current");
53
53
  }
54
54
  }
55
- b = new WeakMap(), l = new WeakMap(), w = new WeakMap(), M = new WeakMap(), N = new WeakMap(), P = new WeakMap();
56
- var g, S, A, C, k, q, y, v, H, W, x, z, j, D, G, R, J, O, it, F, Q, B;
55
+ y = new WeakMap(), l = new WeakMap(), w = new WeakMap(), M = new WeakMap(), A = new WeakMap(), P = new WeakMap();
56
+ var g, N, S, C, k, q, b, L, H, W, x, z, j, D, G, R, J, O, it, F, Q, B;
57
57
  class pt {
58
58
  constructor(t) {
59
- r(this, z);
60
- r(this, D);
61
- r(this, R);
62
- r(this, O);
63
- r(this, F);
64
- r(this, g, null);
65
- r(this, S, null);
66
- r(this, A, null);
67
- r(this, C, null);
68
- r(this, k, []);
69
- r(this, q, new DOMParser());
70
- r(this, y, /* @__PURE__ */ new Map());
71
- r(this, v, void 0);
72
- r(this, H, null);
73
- r(this, W, new st());
74
- r(this, x, new st());
75
- r(this, B, (t) => {
59
+ h(this, z);
60
+ h(this, D);
61
+ h(this, R);
62
+ h(this, O);
63
+ h(this, F);
64
+ h(this, g, null);
65
+ h(this, N, null);
66
+ h(this, S, null);
67
+ h(this, C, null);
68
+ h(this, k, []);
69
+ h(this, q, new DOMParser());
70
+ h(this, b, /* @__PURE__ */ new Map());
71
+ h(this, L, void 0);
72
+ h(this, H, null);
73
+ h(this, W, new st());
74
+ h(this, x, new st());
75
+ h(this, B, (t) => {
76
76
  t.state && this.navigate(t.state, "none");
77
77
  });
78
- ct && (a(this, g, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (a(this, g, t.base), t.base.endsWith("/") || a(this, g, s(this, g) + "/")) : a(this, g, "/"), a(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), a(this, A, (t == null ? void 0 : t.cachePages) !== !1), a(this, C, m(this, R, J).call(this, document)), a(this, H, location.pathname), m(this, D, G).call(this), addEventListener("popstate", s(this, B)));
78
+ ct && (a(this, g, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (a(this, g, t.base), t.base.endsWith("/") || a(this, g, s(this, g) + "/")) : a(this, g, "/"), a(this, N, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), a(this, S, (t == null ? void 0 : t.cachePages) !== !1), a(this, C, m(this, R, J).call(this, document)), a(this, H, location.pathname), m(this, D, G).call(this), addEventListener("popstate", s(this, B)));
79
79
  }
80
80
  normalizePath(t) {
81
81
  t = t.replace(s(this, g), ""), t.startsWith("/") && (t = t.slice(1));
82
- const e = t.split("#"), o = e[0].split("?"), i = o[0].endsWith("/") ? o[0].slice(0, -1) : o[0], c = s(this, g) + i, L = o == null ? void 0 : o[1], f = e == null ? void 0 : e[1];
82
+ const e = t.split("#"), o = e[0].split("?"), i = o[0].endsWith("/") ? o[0].slice(0, -1) : o[0], c = s(this, g) + i, v = o == null ? void 0 : o[1], d = e == null ? void 0 : e[1];
83
83
  return {
84
84
  leaf: i,
85
85
  pathname: c,
86
- parameters: L,
87
- hash: f
86
+ parameters: v,
87
+ hash: d
88
88
  };
89
89
  }
90
90
  beforeNavigationEvent(t) {
@@ -103,87 +103,87 @@ class pt {
103
103
  return T(this, null, function* () {
104
104
  var u;
105
105
  const o = this.normalizePath(t);
106
- let { pathname: i, hash: c, parameters: L } = o;
107
- if (s(this, v) === i || s(this, H) === i)
106
+ let { pathname: i, hash: c, parameters: v } = o;
107
+ if (s(this, L) === i || s(this, H) === i)
108
108
  return;
109
- a(this, v, i);
110
- const f = s(this, y).has(i);
109
+ a(this, L, i);
110
+ const d = s(this, b).has(i);
111
111
  try {
112
- let d = !0;
112
+ let f = !0;
113
113
  if (s(this, W).notify({
114
114
  pathname: i,
115
- isCached: f
115
+ isCached: d
116
116
  }), this.preprocessor)
117
117
  try {
118
- yield new Promise((h, p) => {
118
+ yield new Promise((r, p) => {
119
119
  var E;
120
- (E = this.preprocessor) == null || E.call(this, { pathname: i, resolve: h, reject: p, isCached: f });
120
+ (E = this.preprocessor) == null || E.call(this, { pathname: i, resolve: r, reject: p, isCached: d });
121
121
  });
122
- } catch (h) {
123
- h ? console.error(h) : console.log("Route change canceled"), d = !1;
122
+ } catch (r) {
123
+ r ? console.error(r) : console.log("Route change canceled"), f = !1;
124
124
  }
125
- if (!d || s(this, v) !== i)
125
+ if (!f || s(this, L) !== i)
126
126
  return;
127
- const U = s(this, y).get(i) || (yield m(this, z, j).call(this, i));
128
- if (s(this, v) !== i)
127
+ const U = s(this, b).get(i) || (yield m(this, z, j).call(this, i));
128
+ if (s(this, L) !== i)
129
129
  return;
130
130
  const V = Array.from(document.head.children), X = Array.from(
131
131
  U.head.cloneNode(!0).children
132
132
  ), Z = m(this, O, it).call(this, V, X), nt = m(this, F, Q).call(this, V, Z), I = m(this, F, Q).call(this, X, Z);
133
- nt.forEach((h) => {
134
- h.remove();
135
- }), I.forEach((h, p) => {
136
- if (h.tagName === "SCRIPT" && h.getAttribute("src")) {
133
+ nt.forEach((r) => {
134
+ r.remove();
135
+ }), I.forEach((r, p) => {
136
+ if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
137
137
  const E = document.createElement("script");
138
- E.type = "module", E.src = h.getAttribute("src"), I[p] = E;
138
+ E.type = "module", E.src = r.getAttribute("src"), I[p] = E;
139
139
  }
140
- }), I.forEach((h, p) => {
141
- document.head.appendChild(h);
140
+ }), I.forEach((r, p) => {
141
+ document.head.appendChild(r);
142
142
  });
143
143
  const K = I.filter(
144
- (h) => h.tagName === "STYLE" || h.tagName === "SCRIPT" || h.tagName === "LINK"
144
+ (r) => r.tagName === "STYLE" || r.tagName === "SCRIPT" || r.tagName === "LINK"
145
145
  );
146
- s(this, S) && K.length && (yield new Promise((h) => T(this, null, function* () {
146
+ s(this, N) && K.length && (yield new Promise((r) => T(this, null, function* () {
147
147
  let p = 0;
148
148
  try {
149
- for (var E = et(K), vt, Lt, wt; vt = !(Lt = yield E.next()).done; vt = !1) {
150
- const at = Lt.value;
149
+ for (var E = et(K), Lt, vt, wt; Lt = !(vt = yield E.next()).done; Lt = !1) {
150
+ const at = vt.value;
151
151
  at.onload = () => {
152
- p++, p === K.length && h();
152
+ p++, p === K.length && r();
153
153
  };
154
154
  }
155
- } catch (Lt) {
156
- wt = [Lt];
155
+ } catch (vt) {
156
+ wt = [vt];
157
157
  } finally {
158
158
  try {
159
- vt && (Lt = E.return) && (yield Lt.call(E));
159
+ Lt && (vt = E.return) && (yield vt.call(E));
160
160
  } finally {
161
161
  if (wt)
162
162
  throw wt[0];
163
163
  }
164
164
  }
165
165
  }))), a(this, H, i);
166
- const $ = L || location.search, ot = c ? c.startsWith("#") ? c : "#" + c : "", rt = $ ? $.startsWith("?") ? $ : "?" + $ : "", _ = `${i}${ot}${rt}`;
166
+ const $ = v || location.search, ot = c ? c.startsWith("#") ? c : "#" + c : "", ht = $ ? $.startsWith("?") ? $ : "?" + $ : "", _ = `${i}${ot}${ht}`;
167
167
  e === "push" ? history.pushState(i, "", _) : e === "replace" && history.replaceState(i, "", _);
168
- const ht = m(this, R, J).call(this, U);
169
- s(this, C).forEach((h, p) => {
170
- const E = ht[p];
171
- h.innerHTML = E.innerHTML;
172
- }), m(this, D, G).call(this), (u = this.postprocessor) == null || u.call(this, { pathname: i, isCached: f }), s(this, x).notify({ pathname: i, isCached: f });
173
- } catch (d) {
174
- console.error(d);
168
+ const rt = m(this, R, J).call(this, U);
169
+ s(this, C).forEach((r, p) => {
170
+ const E = rt[p];
171
+ r.innerHTML = E.innerHTML;
172
+ }), m(this, D, G).call(this), (u = this.postprocessor) == null || u.call(this, { pathname: i, isCached: d }), s(this, x).notify({ pathname: i, isCached: d });
173
+ } catch (f) {
174
+ console.error(f);
175
175
  }
176
- a(this, v, void 0);
176
+ a(this, L, void 0);
177
177
  });
178
178
  }
179
179
  }
180
- g = new WeakMap(), S = new WeakMap(), A = new WeakMap(), C = new WeakMap(), k = new WeakMap(), q = new WeakMap(), y = new WeakMap(), v = new WeakMap(), H = new WeakMap(), W = new WeakMap(), x = new WeakMap(), z = new WeakSet(), j = function(t) {
180
+ g = new WeakMap(), N = new WeakMap(), S = new WeakMap(), C = new WeakMap(), k = new WeakMap(), q = new WeakMap(), b = new WeakMap(), L = new WeakMap(), H = new WeakMap(), W = new WeakMap(), x = new WeakMap(), z = new WeakSet(), j = function(t) {
181
181
  return T(this, null, function* () {
182
- const e = s(this, y).get(t);
182
+ const e = s(this, b).get(t);
183
183
  if (e)
184
184
  return e;
185
185
  const i = yield (yield fetch(t)).text(), c = s(this, q).parseFromString(i, "text/html");
186
- return s(this, A) && s(this, y).set(t, c), c;
186
+ return s(this, S) && s(this, b).set(t, c), c;
187
187
  });
188
188
  }, D = new WeakSet(), G = function() {
189
189
  const t = [
@@ -7,6 +7,7 @@ export declare class PopoverButtonElement extends CustomElement {
7
7
  constructor();
8
8
  get popoverElement(): PopoverElement | undefined;
9
9
  protected connectedCallback(): void;
10
+ protected disconnectedCallback(): void;
10
11
  }
11
12
  declare global {
12
13
  interface HTMLElementTagNameMap {
@@ -17,4 +17,10 @@ declare global {
17
17
  interface HTMLElementTagNameMap {
18
18
  'e-popover': PopoverElement;
19
19
  }
20
+ interface HTMLElementEventMap {
21
+ popoverTriggered: CustomEvent;
22
+ popoverOpened: CustomEvent;
23
+ popoverClosing: CustomEvent;
24
+ popoverClosed: CustomEvent;
25
+ }
20
26
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../attribute/index.cjs"),S=require("../custom-element/index.cjs"),A=require("../Store-BQGNOHlY.cjs"),b=require("../style-At6aDoqG.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const x=require("../browser-CpzFX2xg.cjs"),k=require("../tags-CueX-JLX.cjs"),B=require("../createStylesheet-C8aQQ4hd.cjs");var D=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(t,e,s,i)=>{for(var n=i>1?void 0:i?I(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&D(e,s,n),n},C=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),o=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},L=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),$=(t,e,s)=>(C(t,e,"access private method"),s),P,a,E,h,u,_,M,O,v,m,w,y,g,W,f;exports.PopoverElement=class extends S.CustomElement{constructor(){super(...arguments),o(this,M),o(this,v),o(this,g),o(this,P,-1),o(this,a,new A.Store(!1)),o(this,E,void 0),o(this,h,new T.Attribute(this,"history",!1)),o(this,u,new T.Attribute(this,"single",!1)),o(this,_,!1),this.open=()=>{r(this,a).current||(r(this,a).current=!0,r(this,u).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),L(this,P,exports.PopoverElement.__opened.length-1),r(this,h).current&&r(this,_)&&history.pushState("","",r(this,M,O)),clearTimeout(r(this,E)),this.classList.add("triggered"),this.style.display="block",setTimeout(()=>{addEventListener("click",r(this,w)),addEventListener("keydown",r(this,y)),this.style.opacity="1",this.classList.add("opened")}))},this.close=()=>{if(r(this,a).current){if(r(this,a).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),r(this,h).current){const e=new URL(location.href);e.searchParams.delete(r(this,v,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",removeEventListener("click",r(this,w)),removeEventListener("keydown",r(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none"},b.getElementTransitionDurationMS(this))}},o(this,w,e=>{$(this,g,W).call(this,()=>{const s=e.composedPath();(!s.find(i=>i===this)&&!s.find(i=>i instanceof HTMLElement&&i.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),o(this,y,e=>{$(this,g,W).call(this,()=>{e.code==="Escape"&&this.close()})}),o(this,f,()=>{L(this,_,!1),r(this,a).current&&r(this,h).current&&!location.search.includes(r(this,v,m))?this.close():!r(this,a).current&&r(this,h).current&&location.search.includes(r(this,v,m))&&this.open(),L(this,_,!0)})}get history(){return r(this,h)}get single(){return r(this,u)}get opened(){return r(this,a)}connectedCallback(){r(this,h).observe(),r(this,u).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",r(this,f)),setTimeout(()=>{r(this,f).call(this)},0)}disconnectedCallback(){r(this,h).unobserve(),r(this,u).unobserve(),clearTimeout(r(this,E)),removeEventListener("popstate",r(this,f))}};P=new WeakMap;a=new WeakMap;E=new WeakMap;h=new WeakMap;u=new WeakMap;_=new WeakMap;M=new WeakSet;O=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${r(this,v,m)}`};v=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;g=new WeakSet;W=function(t){(exports.PopoverElement.__opened[r(this,P)-1]||exports.PopoverElement.__opened.length===1)&&t()};f=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=N([S.define("e-popover")],exports.PopoverElement);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,R=(t,e,s,i)=>{for(var n=i>1?void 0:i?H(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&G(e,s,n),n},q=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},d=(t,e,s)=>(q(t,e,"read from private field"),s?s.call(t):e.get(t)),U=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},z=(t,e,s,i)=>(q(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),l;const F=B.createStylesheet({button:{all:"inherit"}});exports.PopoverButtonElement=class extends S.CustomElement{constructor(){super(),U(this,l,void 0),this.openShadow(F),x.isBrowser&&k.element(this,{children:[k.button({onClick:()=>{if(d(this,l)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!d(this,l).opened.current?d(this,l).open():(e==="close"||e==="toggle"&&d(this,l).opened.current)&&d(this,l).close()}},children:[k.slot()]})]})}get popoverElement(){return d(this,l)}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?z(this,l,s):console.warn(this,`target ${e} not found`)}}};l=new WeakMap;exports.PopoverButtonElement=R([S.define("e-popover-button")],exports.PopoverButtonElement);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attribute/index.cjs"),W=require("../custom-element/index.cjs"),I=require("../Store-BQGNOHlY.cjs"),N=require("../style-At6aDoqG.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const G=require("../browser-CpzFX2xg.cjs"),T=require("../tags-CueX-JLX.cjs"),H=require("../createStylesheet-C8aQQ4hd.cjs");var R=Object.defineProperty,U=Object.getOwnPropertyDescriptor,z=(t,e,s,n)=>{for(var a=n>1?void 0:n?U(e,s):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&R(e,s,a),a},A=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},i=(t,e,s)=>(A(t,e,"read from private field"),s?s.call(t):e.get(t)),h=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},O=(t,e,s,n)=>(A(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),x=(t,e,s)=>(A(t,e,"access private method"),s),M,p,g,l,v,f,$,B,u,m,w,y,L,q,E;exports.PopoverElement=class extends W.CustomElement{constructor(){super(...arguments),h(this,$),h(this,u),h(this,L),h(this,M,-1),h(this,p,new I.Store(!1)),h(this,g,void 0),h(this,l,new b.Attribute(this,"history",!1)),h(this,v,new b.Attribute(this,"single",!1)),h(this,f,!1),this.open=()=>{i(this,p).current||(i(this,p).current=!0,i(this,v).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),O(this,M,exports.PopoverElement.__opened.length-1),i(this,l).current&&i(this,f)&&history.pushState("","",i(this,$,B)),clearTimeout(i(this,g)),this.classList.add("triggered"),this.style.display="block",this.dispatchEvent(new CustomEvent("popoverTriggered")),setTimeout(()=>{addEventListener("click",i(this,w)),addEventListener("keydown",i(this,y)),this.style.opacity="1",this.classList.add("opened"),this.dispatchEvent(new CustomEvent("popoverOpened"))}))},this.close=()=>{if(i(this,p).current){if(i(this,p).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),i(this,l).current){const e=new URL(location.href);e.searchParams.delete(i(this,u,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",this.dispatchEvent(new CustomEvent("popoverClosing")),removeEventListener("click",i(this,w)),removeEventListener("keydown",i(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",this.dispatchEvent(new CustomEvent("popoverClosed"))},N.getElementTransitionDurationMS(this))}},h(this,w,e=>{x(this,L,q).call(this,()=>{const s=e.composedPath();(!s.find(n=>n===this)&&!s.find(n=>n instanceof HTMLElement&&n.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),h(this,y,e=>{x(this,L,q).call(this,()=>{e.code==="Escape"&&this.close()})}),h(this,E,()=>{O(this,f,!1),i(this,p).current&&i(this,l).current&&!location.search.includes(i(this,u,m))?this.close():!i(this,p).current&&i(this,l).current&&location.search.includes(i(this,u,m))&&this.open(),O(this,f,!0)})}get history(){return i(this,l)}get single(){return i(this,v)}get opened(){return i(this,p)}connectedCallback(){i(this,l).observe(),i(this,v).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",i(this,E)),setTimeout(()=>{i(this,E).call(this)},0)}disconnectedCallback(){i(this,l).unobserve(),i(this,v).unobserve(),clearTimeout(i(this,g)),removeEventListener("popstate",i(this,E))}};M=new WeakMap;p=new WeakMap;g=new WeakMap;l=new WeakMap;v=new WeakMap;f=new WeakMap;$=new WeakSet;B=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${i(this,u,m)}`};u=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;L=new WeakSet;q=function(t){(exports.PopoverElement.__opened[i(this,M)-1]||exports.PopoverElement.__opened.length===1)&&t()};E=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=z([W.define("e-popover")],exports.PopoverElement);var F=Object.defineProperty,J=Object.getOwnPropertyDescriptor,K=(t,e,s,n)=>{for(var a=n>1?void 0:n?J(e,s):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&F(e,s,a),a},D=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(D(t,e,"read from private field"),s?s.call(t):e.get(t)),_=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},Q=(t,e,s,n)=>(D(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),o,P,C,k,S;const V=H.createStylesheet({button:{all:"inherit"}});exports.PopoverButtonElement=class extends W.CustomElement{constructor(){super(),_(this,o,void 0),_(this,P,()=>{this.classList.add("triggered")}),_(this,C,()=>{this.classList.add("opened")}),_(this,k,()=>{this.classList.remove("opened")}),_(this,S,()=>{this.classList.remove("triggered")}),this.openShadow(V),G.isBrowser&&T.element(this,{children:[T.button({onClick:()=>{if(r(this,o)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!r(this,o).opened.current?r(this,o).open():(e==="close"||e==="toggle"&&r(this,o).opened.current)&&r(this,o).close()}},children:[T.slot()]})]})}get popoverElement(){return r(this,o)}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?(Q(this,o,s),r(this,o).addEventListener("popoverTriggered",r(this,P)),r(this,o).addEventListener("popoverOpened",r(this,C)),r(this,o).addEventListener("popoverClosing",r(this,k)),r(this,o).addEventListener("popoverClosed",r(this,S))):console.warn(this,`target ${e} not found`)}}disconnectedCallback(){r(this,o)&&(r(this,o).removeEventListener("popoverTriggered",r(this,P)),r(this,o).removeEventListener("popoverOpened",r(this,C)),r(this,o).removeEventListener("popoverClosing",r(this,k)),r(this,o).removeEventListener("popoverClosed",r(this,S)))}};o=new WeakMap;P=new WeakMap;C=new WeakMap;k=new WeakMap;S=new WeakMap;exports.PopoverButtonElement=K([W.define("e-popover-button")],exports.PopoverButtonElement);
@@ -1,146 +1,185 @@
1
- import { Attribute as C } from "../attribute/index.js";
2
- import { CustomElement as O, define as A } from "../custom-element/index.js";
3
- import { S as I } from "../Store-Cd-E5W1z.js";
4
- import { g as N } from "../style-j2TwriJ_.js";
1
+ import { Attribute as D } from "../attribute/index.js";
2
+ import { CustomElement as N, define as q } from "../custom-element/index.js";
3
+ import { S as H } from "../Store-Cd-E5W1z.js";
4
+ import { g as R } from "../style-j2TwriJ_.js";
5
5
  import "../path-data-polyfill-DgeDWYeI.js";
6
- import { i as q } from "../browser-0zX67oeU.js";
7
- import { e as B, p as G, ay as H } from "../tags-BoPv9fDr.js";
8
- import { c as R } from "../createStylesheet-KMRQhSa-.js";
9
- var U = Object.defineProperty, b = Object.getOwnPropertyDescriptor, z = (e, t, s, r) => {
10
- for (var n = r > 1 ? void 0 : r ? b(t, s) : t, p = e.length - 1, d; p >= 0; p--)
11
- (d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
12
- return r && n && U(t, s, n), n;
13
- }, $ = (e, t, s) => {
6
+ import { i as b } from "../browser-0zX67oeU.js";
7
+ import { e as U, p as z, ay as F } from "../tags-BoPv9fDr.js";
8
+ import { c as J } from "../createStylesheet-KMRQhSa-.js";
9
+ var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, V = (e, t, s, o) => {
10
+ for (var a = o > 1 ? void 0 : o ? Q(t, s) : t, d = e.length - 1, v; d >= 0; d--)
11
+ (v = e[d]) && (a = (o ? v(t, s, a) : v(a)) || a);
12
+ return o && a && K(t, s, a), a;
13
+ }, A = (e, t, s) => {
14
14
  if (!t.has(e))
15
15
  throw TypeError("Cannot " + s);
16
- }, i = (e, t, s) => ($(e, t, "read from private field"), s ? s.call(e) : t.get(e)), o = (e, t, s) => {
16
+ }, i = (e, t, s) => (A(e, t, "read from private field"), s ? s.call(e) : t.get(e)), h = (e, t, s) => {
17
17
  if (t.has(e))
18
18
  throw TypeError("Cannot add the same private member more than once");
19
19
  t instanceof WeakSet ? t.add(e) : t.set(e, s);
20
- }, L = (e, t, s, r) => ($(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), T = (e, t, s) => ($(e, t, "access private method"), s), S, h, y, c, f, v, W, D, _, w, g, E, k, M, m;
21
- let a = class extends O {
20
+ }, O = (e, t, s, o) => (A(e, t, "write to private field"), o ? o.call(e, s) : t.set(e, s), s), x = (e, t, s) => (A(e, t, "access private method"), s), T, c, E, l, u, m, $, B, _, w, y, L, C, P, g;
21
+ let p = class extends N {
22
22
  constructor() {
23
- super(...arguments), o(this, W), o(this, _), o(this, k), o(this, S, -1), o(this, h, new I(!1)), o(this, y, void 0), o(this, c, new C(this, "history", !1)), o(this, f, new C(this, "single", !1)), o(this, v, !1), this.open = () => {
24
- i(this, h).current || (i(this, h).current = !0, i(this, f).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), L(this, S, a.__opened.length - 1), i(this, c).current && i(this, v) && history.pushState("", "", i(this, W, D)), clearTimeout(i(this, y)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
25
- addEventListener("click", i(this, g)), addEventListener("keydown", i(this, E)), this.style.opacity = "1", this.classList.add("opened");
23
+ super(...arguments), h(this, $), h(this, _), h(this, C), h(this, T, -1), h(this, c, new H(!1)), h(this, E, void 0), h(this, l, new D(this, "history", !1)), h(this, u, new D(this, "single", !1)), h(this, m, !1), this.open = () => {
24
+ i(this, c).current || (i(this, c).current = !0, i(this, u).current && (p.__opened.forEach((e) => e.close()), p.__opened = []), p.__opened.push(this), O(this, T, p.__opened.length - 1), i(this, l).current && i(this, m) && history.pushState("", "", i(this, $, B)), clearTimeout(i(this, E)), this.classList.add("triggered"), this.style.display = "block", this.dispatchEvent(new CustomEvent("popoverTriggered")), setTimeout(() => {
25
+ addEventListener("click", i(this, y)), addEventListener("keydown", i(this, L)), this.style.opacity = "1", this.classList.add("opened"), this.dispatchEvent(new CustomEvent("popoverOpened"));
26
26
  }));
27
27
  }, this.close = () => {
28
- if (i(this, h).current) {
29
- if (i(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), i(this, c).current) {
28
+ if (i(this, c).current) {
29
+ if (i(this, c).current = !1, p.__opened = p.__opened.filter((e) => e !== this), i(this, l).current) {
30
30
  const e = new URL(location.href);
31
31
  e.searchParams.delete(i(this, _, w)), history.replaceState(null, "", e.href);
32
32
  }
33
- this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this, g)), removeEventListener("keydown", i(this, E)), setTimeout(() => {
34
- this.classList.remove("triggered"), this.style.display = "none";
35
- }, N(this));
33
+ this.classList.remove("opened"), this.style.opacity = "0", this.dispatchEvent(new CustomEvent("popoverClosing")), removeEventListener("click", i(this, y)), removeEventListener("keydown", i(this, L)), setTimeout(() => {
34
+ this.classList.remove("triggered"), this.style.display = "none", this.dispatchEvent(new CustomEvent("popoverClosed"));
35
+ }, R(this));
36
36
  }
37
- }, o(this, g, (e) => {
38
- T(this, k, M).call(this, () => {
37
+ }, h(this, y, (e) => {
38
+ x(this, C, P).call(this, () => {
39
39
  const t = e.composedPath();
40
40
  (!t.find((s) => s === this) && !t.find(
41
41
  (s) => s instanceof HTMLElement && s.closest("e-popover-button")
42
42
  ) || t[0] instanceof HTMLElement && t[0].hasAttribute("outside")) && this.close();
43
43
  });
44
- }), o(this, E, (e) => {
45
- T(this, k, M).call(this, () => {
44
+ }), h(this, L, (e) => {
45
+ x(this, C, P).call(this, () => {
46
46
  e.code === "Escape" && this.close();
47
47
  });
48
- }), o(this, m, () => {
49
- L(this, v, !1), i(this, h).current && i(this, c).current && !location.search.includes(i(this, _, w)) ? this.close() : !i(this, h).current && i(this, c).current && location.search.includes(i(this, _, w)) && this.open(), L(this, v, !0);
48
+ }), h(this, g, () => {
49
+ O(this, m, !1), i(this, c).current && i(this, l).current && !location.search.includes(i(this, _, w)) ? this.close() : !i(this, c).current && i(this, l).current && location.search.includes(i(this, _, w)) && this.open(), O(this, m, !0);
50
50
  });
51
51
  }
52
52
  get history() {
53
- return i(this, c);
53
+ return i(this, l);
54
54
  }
55
55
  get single() {
56
- return i(this, f);
56
+ return i(this, u);
57
57
  }
58
58
  get opened() {
59
- return i(this, h);
59
+ return i(this, c);
60
60
  }
61
61
  connectedCallback() {
62
- i(this, c).observe(), i(this, f).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, m)), setTimeout(() => {
63
- i(this, m).call(this);
62
+ i(this, l).observe(), i(this, u).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, g)), setTimeout(() => {
63
+ i(this, g).call(this);
64
64
  }, 0);
65
65
  }
66
66
  disconnectedCallback() {
67
- i(this, c).unobserve(), i(this, f).unobserve(), clearTimeout(i(this, y)), removeEventListener("popstate", i(this, m));
67
+ i(this, l).unobserve(), i(this, u).unobserve(), clearTimeout(i(this, E)), removeEventListener("popstate", i(this, g));
68
68
  }
69
69
  };
70
- S = /* @__PURE__ */ new WeakMap();
71
- h = /* @__PURE__ */ new WeakMap();
72
- y = /* @__PURE__ */ new WeakMap();
70
+ T = /* @__PURE__ */ new WeakMap();
73
71
  c = /* @__PURE__ */ new WeakMap();
74
- f = /* @__PURE__ */ new WeakMap();
75
- v = /* @__PURE__ */ new WeakMap();
76
- W = /* @__PURE__ */ new WeakSet();
77
- D = function() {
72
+ E = /* @__PURE__ */ new WeakMap();
73
+ l = /* @__PURE__ */ new WeakMap();
74
+ u = /* @__PURE__ */ new WeakMap();
75
+ m = /* @__PURE__ */ new WeakMap();
76
+ $ = /* @__PURE__ */ new WeakSet();
77
+ B = function() {
78
78
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this, _, w)}`;
79
79
  };
80
80
  _ = /* @__PURE__ */ new WeakSet();
81
81
  w = function() {
82
82
  return `modal-${this.id}`;
83
83
  };
84
- g = /* @__PURE__ */ new WeakMap();
85
- E = /* @__PURE__ */ new WeakMap();
86
- k = /* @__PURE__ */ new WeakSet();
87
- M = function(e) {
88
- (a.__opened[i(this, S) - 1] || a.__opened.length === 1) && e();
84
+ y = /* @__PURE__ */ new WeakMap();
85
+ L = /* @__PURE__ */ new WeakMap();
86
+ C = /* @__PURE__ */ new WeakSet();
87
+ P = function(e) {
88
+ (p.__opened[i(this, T) - 1] || p.__opened.length === 1) && e();
89
89
  };
90
- m = /* @__PURE__ */ new WeakMap();
91
- a.__opened = [];
92
- a = z([
93
- A("e-popover")
94
- ], a);
95
- var F = Object.defineProperty, J = Object.getOwnPropertyDescriptor, K = (e, t, s, r) => {
96
- for (var n = r > 1 ? void 0 : r ? J(t, s) : t, p = e.length - 1, d; p >= 0; p--)
97
- (d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
98
- return r && n && F(t, s, n), n;
99
- }, x = (e, t, s) => {
90
+ g = /* @__PURE__ */ new WeakMap();
91
+ p.__opened = [];
92
+ p = V([
93
+ q("e-popover")
94
+ ], p);
95
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, Z = (e, t, s, o) => {
96
+ for (var a = o > 1 ? void 0 : o ? Y(t, s) : t, d = e.length - 1, v; d >= 0; d--)
97
+ (v = e[d]) && (a = (o ? v(t, s, a) : v(a)) || a);
98
+ return o && a && X(t, s, a), a;
99
+ }, G = (e, t, s) => {
100
100
  if (!t.has(e))
101
101
  throw TypeError("Cannot " + s);
102
- }, u = (e, t, s) => (x(e, t, "read from private field"), s ? s.call(e) : t.get(e)), Q = (e, t, s) => {
102
+ }, r = (e, t, s) => (G(e, t, "read from private field"), s ? s.call(e) : t.get(e)), f = (e, t, s) => {
103
103
  if (t.has(e))
104
104
  throw TypeError("Cannot add the same private member more than once");
105
105
  t instanceof WeakSet ? t.add(e) : t.set(e, s);
106
- }, V = (e, t, s, r) => (x(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), l;
107
- const X = R({
106
+ }, j = (e, t, s, o) => (G(e, t, "write to private field"), o ? o.call(e, s) : t.set(e, s), s), n, k, W, M, S;
107
+ const ee = J({
108
108
  button: {
109
109
  all: "inherit"
110
110
  }
111
111
  });
112
- let P = class extends O {
112
+ let I = class extends N {
113
113
  constructor() {
114
- super(), Q(this, l, void 0), this.openShadow(X), q && B(this, {
114
+ super(), f(this, n, void 0), f(this, k, () => {
115
+ this.classList.add("triggered");
116
+ }), f(this, W, () => {
117
+ this.classList.add("opened");
118
+ }), f(this, M, () => {
119
+ this.classList.remove("opened");
120
+ }), f(this, S, () => {
121
+ this.classList.remove("triggered");
122
+ }), this.openShadow(ee), b && U(this, {
115
123
  children: [
116
- G({
124
+ z({
117
125
  onClick: () => {
118
- if (u(this, l)) {
126
+ if (r(this, n)) {
119
127
  const e = this.getAttribute("type") || "open";
120
- e === "open" || e === "toggle" && !u(this, l).opened.current ? u(this, l).open() : (e === "close" || e === "toggle" && u(this, l).opened.current) && u(this, l).close();
128
+ e === "open" || e === "toggle" && !r(this, n).opened.current ? r(this, n).open() : (e === "close" || e === "toggle" && r(this, n).opened.current) && r(this, n).close();
121
129
  }
122
130
  },
123
- children: [H()]
131
+ children: [F()]
124
132
  })
125
133
  ]
126
134
  });
127
135
  }
128
136
  get popoverElement() {
129
- return u(this, l);
137
+ return r(this, n);
130
138
  }
131
139
  connectedCallback() {
132
140
  const e = this.getAttribute("target");
133
141
  if (e) {
134
142
  const t = document.querySelector(`#${e}`) || this.getRootNode().querySelector(`#${e}`);
135
- t ? V(this, l, t) : console.warn(this, `target ${e} not found`);
143
+ t ? (j(this, n, t), r(this, n).addEventListener(
144
+ "popoverTriggered",
145
+ r(this, k)
146
+ ), r(this, n).addEventListener(
147
+ "popoverOpened",
148
+ r(this, W)
149
+ ), r(this, n).addEventListener(
150
+ "popoverClosing",
151
+ r(this, M)
152
+ ), r(this, n).addEventListener(
153
+ "popoverClosed",
154
+ r(this, S)
155
+ )) : console.warn(this, `target ${e} not found`);
136
156
  }
137
157
  }
158
+ disconnectedCallback() {
159
+ r(this, n) && (r(this, n).removeEventListener(
160
+ "popoverTriggered",
161
+ r(this, k)
162
+ ), r(this, n).removeEventListener(
163
+ "popoverOpened",
164
+ r(this, W)
165
+ ), r(this, n).removeEventListener(
166
+ "popoverClosing",
167
+ r(this, M)
168
+ ), r(this, n).removeEventListener(
169
+ "popoverClosed",
170
+ r(this, S)
171
+ ));
172
+ }
138
173
  };
139
- l = /* @__PURE__ */ new WeakMap();
140
- P = K([
141
- A("e-popover-button")
142
- ], P);
174
+ n = /* @__PURE__ */ new WeakMap();
175
+ k = /* @__PURE__ */ new WeakMap();
176
+ W = /* @__PURE__ */ new WeakMap();
177
+ M = /* @__PURE__ */ new WeakMap();
178
+ S = /* @__PURE__ */ new WeakMap();
179
+ I = Z([
180
+ q("e-popover-button")
181
+ ], I);
143
182
  export {
144
- P as PopoverButtonElement,
145
- a as PopoverElement
183
+ I as PopoverButtonElement,
184
+ p as PopoverElement
146
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"