aptechka 0.82.4 → 0.82.5

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.
@@ -6,6 +6,11 @@ export type HeadNode = HTMLStyleElement | HTMLScriptElement | HTMLLinkElement;
6
6
  export interface RouteParameters {
7
7
  urlPatternResult: URLPatternResult;
8
8
  }
9
+ export interface RouteEvents {
10
+ __hmrInstanceReplace: CustomEvent<{
11
+ element: HTMLElement;
12
+ }>;
13
+ }
9
14
  export declare class Route {
10
15
  #private;
11
16
  constructor(pattern: string, module: RouteModule);
@@ -17,3 +22,7 @@ export declare class Route {
17
22
  render(container: Element | ShadowRoot, url: URL): Promise<void>;
18
23
  close(): void;
19
24
  }
25
+ declare global {
26
+ interface HTMLElementEventMap extends RouteEvents {
27
+ }
28
+ }
@@ -1 +1 @@
1
- "use strict";var lt=Object.defineProperty,ut=Object.defineProperties;var ct=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,t,e)=>t in i?lt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_=(i,t)=>{for(var e in t||(t={}))dt.call(t,e)&&W(i,e,t[e]);if(K)for(var e of K(t))ft.call(t,e)&&W(i,e,t[e]);return i},$=(i,t)=>ut(i,ct(t));var B=(i,t,e)=>t.has(i)||Y("Cannot "+e);var s=(i,t,e)=>(B(i,t,"read from private field"),e?e.call(i):t.get(i)),n=(i,t,e)=>t.has(i)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),h=(i,t,e,r)=>(B(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e),u=(i,t,e)=>(B(i,t,"access private method"),e);var G=(i,t,e,r)=>({set _(a){h(i,t,a,e)},get _(){return s(i,t,r)}});var p=(i,t,e)=>new Promise((r,a)=>{var c=m=>{try{w(e.next(m))}catch(L){a(L)}},H=m=>{try{w(e.throw(m))}catch(L){a(L)}},w=m=>m.done?r(m.value):Promise.resolve(m.value).then(c,H);w((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const mt=require("../history/index.cjs"),gt=require("../LocalLinks-Bua7BGRF.cjs"),wt=require("../PageAnnouncerElement-C4k2kDJ5.cjs"),pt=require("../PageScroll-C7QBpx0G.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const J=require("../url-CPgw9bd5.cjs"),Rt=require("urlpattern-polyfill"),Pt=require("../render-BWjKu0M_.cjs"),vt=require("../object-baN9pgbU.cjs");var S,M,E,g,d,q,U,P,v,b,o,Q,X,Z,tt,et,st,it,rt,I;class bt{constructor(t,e){n(this,o);n(this,S);n(this,M);n(this,E);n(this,g,null);n(this,d,null);n(this,q,!1);n(this,U,null);n(this,P);n(this,v,[]);n(this,b,[]);h(this,S,t),h(this,M,e),h(this,E,new URLPattern({pathname:s(this,S)})),h(this,P,new MutationObserver(u(this,o,it).bind(this)))}get pattern(){return s(this,S)}get isActive(){return s(this,q)}get element(){return s(this,d)}get nest(){return s(this,U)}testPathname(t){return s(this,E).test({pathname:t})}render(t,e){return p(this,null,function*(){s(this,P).observe(document.head,{childList:!0,subtree:!0}),s(this,g)?u(this,o,X).call(this):yield u(this,o,Q).call(this),yield u(this,o,rt).call(this),s(this,g)&&(yield u(this,o,Z).call(this,t,e)),s(this,P).disconnect()})}close(){u(this,o,et).call(this)}}S=new WeakMap,M=new WeakMap,E=new WeakMap,g=new WeakMap,d=new WeakMap,q=new WeakMap,U=new WeakMap,P=new WeakMap,v=new WeakMap,b=new WeakMap,o=new WeakSet,Q=function(){return p(this,null,function*(){const t=yield s(this,M).call(this);h(this,b,[...s(this,v)]),typeof t.default=="function"&&h(this,g,t.default)})},X=function(){s(this,v).forEach(t=>{document.head.appendChild(t.cloneNode(!0))})},Z=function(t,e){return p(this,null,function*(){const a={urlPatternResult:s(this,E).exec({pathname:e.pathname})};vt.isESClass(s(this,g))?(h(this,d,new(s(this,g))(a)),t.appendChild(s(this,d))):h(this,d,Pt.render(t,s(this,g),a)),u(this,o,tt).call(this),h(this,q,!0)})},tt=function(){var t;s(this,d)&&h(this,U,s(this,d).querySelector("[data-nest]")||((t=s(this,d).shadowRoot)==null?void 0:t.querySelector("[data-nest]"))||s(this,d).shadowRoot||s(this,d))},et=function(){var t;s(this,P).disconnect(),(t=s(this,d))==null||t.remove(),h(this,q,!1),u(this,o,st).call(this)},st=function(){s(this,b).forEach(t=>{t.parentNode===document.head&&document.head.removeChild(t)}),h(this,b,[])},it=function(t){t.forEach(e=>{e.addedNodes.forEach(r=>{s(this,g)?s(this,b).push(r):s(this,v).push(r)})})},rt=function(){return p(this,null,function*(){const t=s(this,v).filter(u(this,o,I));yield Promise.all(t.map(e=>new Promise(r=>{u(this,o,I).call(this,e)?e.onload=()=>r():r()})))})},I=function(t){return t instanceof HTMLElement&&(t.tagName==="STYLE"||t.tagName==="SCRIPT"||t.tagName==="LINK")};globalThis.URLPattern=Rt.URLPattern;var l,y,T,N,k,A,R,C,f,at,nt,ht,z,ot;class yt{constructor(t){n(this,f);n(this,l,null);n(this,y,null);n(this,T,null);n(this,N,null);n(this,k,null);n(this,A,0);n(this,R,[]);n(this,C,null);h(this,l,$(_({},t),{rootElement:(t==null?void 0:t.rootElement)||document.body,base:J.normalizeBase(t==null?void 0:t.base)})),h(this,k,new wt.PageAnnouncerElement),h(this,y,new pt.PageScroll(s(this,l).scrollSelector)),s(this,y).update(),h(this,T,new gt.LocalLinks({base:s(this,l).base,trailingSlash:s(this,l).trailingSlash,includeAnchor:t==null?void 0:t.includeAnchor,onClick:(e,r)=>{try{this.navigate(e,r)}catch(a){window.location.assign(e)}}})),s(this,T).update(),h(this,N,new mt.History({onPop:e=>{this.navigate(e)}}))}history(){return s(this,N)}get scroll(){return scroll}get routes(){return s(this,R)}run(){u(this,f,ot).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(t,e){const r=new bt(t,e);s(this,R).push(r)}navigate(t,e){return p(this,null,function*(){var O,j,x,V,D,F;const r=s(this,N).isBack,a=++G(this,A)._;let c=J.normalizeURL(t,{base:s(this,l).base,trailingSlash:s(this,l).trailingSlash});if(s(this,l).urlModifier&&(c=s(this,l).urlModifier(c)),!(yield u(this,f,at).call(this,c))||s(this,A)!==a||(yield(j=(O=s(this,l)).beforeNavigation)==null?void 0:j.call(O),s(this,A)!==a))return;const{activeRoutes:H,newRoutes:w,oldRoutes:m,keepRoutes:L}=u(this,f,nt).call(this,c);h(this,C,(x=L[L.length-1])!=null?x:null),r||(s(this,N).push(c),((V=e==null?void 0:e.keepScrollPosition)==null||V)&&s(this,y).element.scrollTo({top:0,behavior:"instant"})),s(this,k).create(document,c.pathname),s(this,l).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>u(this,f,z).call(this,m,w,c)).finished:yield u(this,f,z).call(this,m,w,c),s(this,y).update(),s(this,T).update(),s(this,k).done(),yield(F=(D=s(this,l)).afterNavigation)==null?void 0:F.call(D)})}}l=new WeakMap,y=new WeakMap,T=new WeakMap,N=new WeakMap,k=new WeakMap,A=new WeakMap,R=new WeakMap,C=new WeakMap,f=new WeakSet,at=function(t){return p(this,null,function*(){if(!s(this,l).preprocessor)return!0;try{return yield new Promise((e,r)=>{var a,c;(c=(a=s(this,l)).preprocessor)==null||c.call(a,{url:t,resolve:e,reject:r})}),!0}catch(e){return console.error(e!=null?e:"Route change canceled"),!1}})},nt=function(t){let e=t.pathname.replace(s(this,l).base,"");e.startsWith("/")||(e=`/${e}`);const r=s(this,R).filter(a=>a.isActive);return{activeRoutes:r,newRoutes:s(this,R).filter(a=>!r.includes(a)&&a.testPathname(e)),oldRoutes:r.filter(a=>!a.testPathname(e)),keepRoutes:r.filter(a=>a.testPathname(e))}},ht=function(t){t.forEach(e=>e.close())},z=function(t,e,r){return p(this,null,function*(){var a,c;u(this,f,ht).call(this,t);for(const H of e){const w=(c=(a=s(this,C))==null?void 0:a.nest)!=null?c:s(this,l).rootElement;yield H.render(w,r),h(this,C,H)}})},ot=function(){s(this,R).sort((t,e)=>{const r=t.pattern.split("/").length,a=e.pattern.split("/").length;return r-a})};exports.Router=yt;
1
+ "use strict";var ue=Object.defineProperty,ce=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,e,s)=>e in i?ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,$=(i,e)=>{for(var s in e||(e={}))me.call(e,s)&&W(i,s,e[s]);if(K)for(var s of K(e))fe.call(e,s)&&W(i,s,e[s]);return i},G=(i,e)=>ce(i,de(e));var U=(i,e,s)=>e.has(i)||Y("Cannot "+s);var t=(i,e,s)=>(U(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(i,e,s)=>e.has(i)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),h=(i,e,s,r)=>(U(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),d=(i,e,s)=>(U(i,e,"access private method"),s);var J=(i,e,s,r)=>({set _(a){h(i,e,a,s)},get _(){return t(i,e,r)}});var R=(i,e,s)=>new Promise((r,a)=>{var o=f=>{try{g(s.next(f))}catch(N){a(N)}},C=f=>{try{g(s.throw(f))}catch(N){a(N)}},g=f=>f.done?r(f.value):Promise.resolve(f.value).then(o,C);g((s=s.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../history/index.cjs"),ge=require("../LocalLinks-Bua7BGRF.cjs"),Re=require("../PageAnnouncerElement-C4k2kDJ5.cjs"),we=require("../PageScroll-C7QBpx0G.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const Q=require("../url-CPgw9bd5.cjs"),ve=require("urlpattern-polyfill"),Pe=require("../render-BWjKu0M_.cjs"),be=require("../object-baN9pgbU.cjs");var S,H,q,p,u,T,M,v,P,b,l,X,Z,ee,te,se,ie,re,ae,B,y;class ye{constructor(e,s){n(this,l);n(this,S);n(this,H);n(this,q);n(this,p,null);n(this,u,null);n(this,T,!1);n(this,M,null);n(this,v);n(this,P,[]);n(this,b,[]);n(this,y,e=>{t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),h(this,u,e.detail.element),t(this,u).addEventListener("__hmrInstanceReplace",t(this,y))});h(this,S,e),h(this,H,s),h(this,q,new URLPattern({pathname:t(this,S)})),h(this,v,new MutationObserver(d(this,l,re).bind(this)))}get pattern(){return t(this,S)}get isActive(){return t(this,T)}get element(){return t(this,u)}get nest(){return t(this,M)}testPathname(e){return t(this,q).test({pathname:e})}render(e,s){return R(this,null,function*(){t(this,v).observe(document.head,{childList:!0,subtree:!0}),t(this,p)?d(this,l,Z).call(this):yield d(this,l,X).call(this),yield d(this,l,ae).call(this),t(this,p)&&(yield d(this,l,ee).call(this,e,s)),t(this,v).disconnect()})}close(){d(this,l,se).call(this)}}S=new WeakMap,H=new WeakMap,q=new WeakMap,p=new WeakMap,u=new WeakMap,T=new WeakMap,M=new WeakMap,v=new WeakMap,P=new WeakMap,b=new WeakMap,l=new WeakSet,X=function(){return R(this,null,function*(){const e=yield t(this,H).call(this);h(this,b,[...t(this,P)]),typeof e.default=="function"&&h(this,p,e.default)})},Z=function(){t(this,P).forEach(e=>{document.head.appendChild(e.cloneNode(!0))})},ee=function(e,s){return R(this,null,function*(){var o;const a={urlPatternResult:t(this,q).exec({pathname:s.pathname})};be.isESClass(t(this,p))?(h(this,u,new(t(this,p))(a)),e.appendChild(t(this,u))):h(this,u,Pe.render(e,t(this,p),a)),(o=t(this,u))==null||o.addEventListener("__hmrInstanceReplace",t(this,y)),d(this,l,te).call(this),h(this,T,!0)})},te=function(){var e;t(this,u)&&h(this,M,t(this,u).querySelector("[data-nest]")||((e=t(this,u).shadowRoot)==null?void 0:e.querySelector("[data-nest]"))||t(this,u).shadowRoot||t(this,u))},se=function(){t(this,v).disconnect(),t(this,u)&&(t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),t(this,u).remove()),h(this,T,!1),d(this,l,ie).call(this)},ie=function(){t(this,b).forEach(e=>{e.parentNode===document.head&&document.head.removeChild(e)}),h(this,b,[])},re=function(e){e.forEach(s=>{s.addedNodes.forEach(r=>{t(this,p)?t(this,b).push(r):t(this,P).push(r)})})},ae=function(){return R(this,null,function*(){const e=t(this,P).filter(d(this,l,B));yield Promise.all(e.map(s=>new Promise(r=>{d(this,l,B).call(this,s)?s.onload=()=>r():r()})))})},B=function(e){return e instanceof HTMLElement&&(e.tagName==="STYLE"||e.tagName==="SCRIPT"||e.tagName==="LINK")},y=new WeakMap;globalThis.URLPattern=ve.URLPattern;var c,L,k,E,I,_,w,A,m,ne,he,le,z,oe;class Le{constructor(e){n(this,m);n(this,c,null);n(this,L,null);n(this,k,null);n(this,E,null);n(this,I,null);n(this,_,0);n(this,w,[]);n(this,A,null);h(this,c,G($({},e),{rootElement:(e==null?void 0:e.rootElement)||document.body,base:Q.normalizeBase(e==null?void 0:e.base)})),h(this,I,new Re.PageAnnouncerElement),h(this,L,new we.PageScroll(t(this,c).scrollSelector)),t(this,L).update(),h(this,k,new ge.LocalLinks({base:t(this,c).base,trailingSlash:t(this,c).trailingSlash,includeAnchor:e==null?void 0:e.includeAnchor,onClick:(s,r)=>{try{this.navigate(s,r)}catch(a){window.location.assign(s)}}})),t(this,k).update(),h(this,E,new pe.History({onPop:s=>{this.navigate(s)}}))}history(){return t(this,E)}get scroll(){return scroll}get routes(){return t(this,w)}run(){d(this,m,oe).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(e,s){const r=new ye(e,s);t(this,w).push(r)}navigate(e,s){return R(this,null,function*(){var O,j,x,V,D,F;const r=t(this,E).isBack,a=++J(this,_)._;let o=Q.normalizeURL(e,{base:t(this,c).base,trailingSlash:t(this,c).trailingSlash});if(t(this,c).urlModifier&&(o=t(this,c).urlModifier(o)),!(yield d(this,m,ne).call(this,o))||t(this,_)!==a||(yield(j=(O=t(this,c)).beforeNavigation)==null?void 0:j.call(O),t(this,_)!==a))return;const{activeRoutes:C,newRoutes:g,oldRoutes:f,keepRoutes:N}=d(this,m,he).call(this,o);h(this,A,(x=N[N.length-1])!=null?x:null),r||(t(this,E).push(o),((V=s==null?void 0:s.keepScrollPosition)==null||V)&&t(this,L).element.scrollTo({top:0,behavior:"instant"})),t(this,I).create(document,o.pathname),t(this,c).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>d(this,m,z).call(this,f,g,o)).finished:yield d(this,m,z).call(this,f,g,o),t(this,L).update(),t(this,k).update(),t(this,I).done(),yield(F=(D=t(this,c)).afterNavigation)==null?void 0:F.call(D)})}}c=new WeakMap,L=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,_=new WeakMap,w=new WeakMap,A=new WeakMap,m=new WeakSet,ne=function(e){return R(this,null,function*(){if(!t(this,c).preprocessor)return!0;try{return yield new Promise((s,r)=>{var a,o;(o=(a=t(this,c)).preprocessor)==null||o.call(a,{url:e,resolve:s,reject:r})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},he=function(e){let s=e.pathname.replace(t(this,c).base,"");s.startsWith("/")||(s=`/${s}`);const r=t(this,w).filter(a=>a.isActive);return{activeRoutes:r,newRoutes:t(this,w).filter(a=>!r.includes(a)&&a.testPathname(s)),oldRoutes:r.filter(a=>!a.testPathname(s)),keepRoutes:r.filter(a=>a.testPathname(s))}},le=function(e){e.forEach(s=>s.close())},z=function(e,s,r){return R(this,null,function*(){var a,o;d(this,m,le).call(this,e);for(const C of s){const g=(o=(a=t(this,A))==null?void 0:a.nest)!=null?o:t(this,c).rootElement;yield C.render(g,r),h(this,A,C)}})},oe=function(){t(this,w).sort((e,s)=>{const r=e.pattern.split("/").length,a=s.pattern.split("/").length;return r-a})};exports.Router=Le;
@@ -1,253 +1,268 @@
1
- var ot = Object.defineProperty, lt = Object.defineProperties;
1
+ var lt = Object.defineProperty, ct = Object.defineProperties;
2
2
  var ut = Object.getOwnPropertyDescriptors;
3
3
  var K = Object.getOwnPropertySymbols;
4
- var ct = Object.prototype.hasOwnProperty, dt = Object.prototype.propertyIsEnumerable;
4
+ var dt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
5
5
  var Y = (i) => {
6
6
  throw TypeError(i);
7
7
  };
8
- var W = (i, t, e) => t in i ? ot(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, j = (i, t) => {
9
- for (var e in t || (t = {}))
10
- ct.call(t, e) && W(i, e, t[e]);
8
+ var W = (i, t, s) => t in i ? lt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s, j = (i, t) => {
9
+ for (var s in t || (t = {}))
10
+ dt.call(t, s) && W(i, s, t[s]);
11
11
  if (K)
12
- for (var e of K(t))
13
- dt.call(t, e) && W(i, e, t[e]);
12
+ for (var s of K(t))
13
+ mt.call(t, s) && W(i, s, t[s]);
14
14
  return i;
15
- }, G = (i, t) => lt(i, ut(t));
16
- var I = (i, t, e) => t.has(i) || Y("Cannot " + e);
17
- var s = (i, t, e) => (I(i, t, "read from private field"), e ? e.call(i) : t.get(i)), n = (i, t, e) => t.has(i) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), h = (i, t, e, a) => (I(i, t, "write to private field"), a ? a.call(i, e) : t.set(i, e), e), u = (i, t, e) => (I(i, t, "access private method"), e);
18
- var J = (i, t, e, a) => ({
15
+ }, G = (i, t) => ct(i, ut(t));
16
+ var B = (i, t, s) => t.has(i) || Y("Cannot " + s);
17
+ var e = (i, t, s) => (B(i, t, "read from private field"), s ? s.call(i) : t.get(i)), n = (i, t, s) => t.has(i) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, a) => (B(i, t, "write to private field"), a ? a.call(i, s) : t.set(i, s), s), d = (i, t, s) => (B(i, t, "access private method"), s);
18
+ var J = (i, t, s, a) => ({
19
19
  set _(r) {
20
- h(i, t, r, e);
20
+ h(i, t, r, s);
21
21
  },
22
22
  get _() {
23
- return s(i, t, a);
23
+ return e(i, t, a);
24
24
  }
25
25
  });
26
- var g = (i, t, e) => new Promise((a, r) => {
27
- var c = (f) => {
26
+ var w = (i, t, s) => new Promise((a, r) => {
27
+ var l = (f) => {
28
28
  try {
29
- w(e.next(f));
30
- } catch (L) {
31
- r(L);
29
+ R(s.next(f));
30
+ } catch (E) {
31
+ r(E);
32
32
  }
33
- }, U = (f) => {
33
+ }, A = (f) => {
34
34
  try {
35
- w(e.throw(f));
36
- } catch (L) {
37
- r(L);
35
+ R(s.throw(f));
36
+ } catch (E) {
37
+ r(E);
38
38
  }
39
- }, w = (f) => f.done ? a(f.value) : Promise.resolve(f.value).then(c, U);
40
- w((e = e.apply(i, t)).next());
39
+ }, R = (f) => f.done ? a(f.value) : Promise.resolve(f.value).then(l, A);
40
+ R((s = s.apply(i, t)).next());
41
41
  });
42
- import { History as mt } from "../history/index.js";
43
- import { L as ft } from "../LocalLinks-TQkTpAMx.js";
44
- import { P as pt } from "../PageAnnouncerElement-sfh0_4vl.js";
42
+ import { History as ft } from "../history/index.js";
43
+ import { L as pt } from "../LocalLinks-TQkTpAMx.js";
44
+ import { P as Rt } from "../PageAnnouncerElement-sfh0_4vl.js";
45
45
  import { P as wt } from "../PageScroll-cQ3B5-6N.js";
46
46
  import "construct-style-sheets-polyfill";
47
47
  import "../index-LReFyN6i.js";
48
- import { a as gt, n as Rt } from "../url-DAl-mgbC.js";
48
+ import { a as gt, n as vt } from "../url-DAl-mgbC.js";
49
49
  import { URLPattern as Pt } from "urlpattern-polyfill";
50
- import { r as vt } from "../render-B3Hf-O7M.js";
50
+ import { r as Lt } from "../render-B3Hf-O7M.js";
51
51
  import { i as bt } from "../object-CcMK4y_r.js";
52
- var E, M, S, p, d, T, B, P, v, b, o, Q, X, Z, _, tt, et, st, it, z;
52
+ var S, U, T, p, c, I, M, v, P, L, o, Q, X, Z, tt, et, st, it, at, z, b;
53
53
  class Nt {
54
- constructor(t, e) {
54
+ constructor(t, s) {
55
55
  n(this, o);
56
- n(this, E);
57
- n(this, M);
58
56
  n(this, S);
57
+ n(this, U);
58
+ n(this, T);
59
59
  n(this, p, null);
60
- n(this, d, null);
61
- n(this, T, !1);
62
- n(this, B, null);
63
- n(this, P);
64
- n(this, v, []);
65
- n(this, b, []);
66
- h(this, E, t), h(this, M, e), h(this, S, new URLPattern({ pathname: s(this, E) })), h(this, P, new MutationObserver(
67
- u(this, o, st).bind(this)
60
+ n(this, c, null);
61
+ n(this, I, !1);
62
+ n(this, M, null);
63
+ n(this, v);
64
+ n(this, P, []);
65
+ n(this, L, []);
66
+ n(this, b, (t) => {
67
+ e(this, c).removeEventListener(
68
+ "__hmrInstanceReplace",
69
+ e(this, b)
70
+ ), h(this, c, t.detail.element), e(this, c).addEventListener(
71
+ "__hmrInstanceReplace",
72
+ e(this, b)
73
+ );
74
+ });
75
+ h(this, S, t), h(this, U, s), h(this, T, new URLPattern({ pathname: e(this, S) })), h(this, v, new MutationObserver(
76
+ d(this, o, it).bind(this)
68
77
  ));
69
78
  }
70
79
  get pattern() {
71
- return s(this, E);
80
+ return e(this, S);
72
81
  }
73
82
  get isActive() {
74
- return s(this, T);
83
+ return e(this, I);
75
84
  }
76
85
  get element() {
77
- return s(this, d);
86
+ return e(this, c);
78
87
  }
79
88
  get nest() {
80
- return s(this, B);
89
+ return e(this, M);
81
90
  }
82
91
  testPathname(t) {
83
- return s(this, S).test({ pathname: t });
92
+ return e(this, T).test({ pathname: t });
84
93
  }
85
- render(t, e) {
86
- return g(this, null, function* () {
87
- s(this, P).observe(document.head, {
94
+ render(t, s) {
95
+ return w(this, null, function* () {
96
+ e(this, v).observe(document.head, {
88
97
  childList: !0,
89
98
  subtree: !0
90
- }), s(this, p) ? u(this, o, X).call(this) : yield u(this, o, Q).call(this), yield u(this, o, it).call(this), s(this, p) && (yield u(this, o, Z).call(this, t, e)), s(this, P).disconnect();
99
+ }), e(this, p) ? d(this, o, X).call(this) : yield d(this, o, Q).call(this), yield d(this, o, at).call(this), e(this, p) && (yield d(this, o, Z).call(this, t, s)), e(this, v).disconnect();
91
100
  });
92
101
  }
93
102
  close() {
94
- u(this, o, tt).call(this);
103
+ d(this, o, et).call(this);
95
104
  }
96
105
  }
97
- E = new WeakMap(), M = new WeakMap(), S = new WeakMap(), p = new WeakMap(), d = new WeakMap(), T = new WeakMap(), B = new WeakMap(), P = new WeakMap(), v = new WeakMap(), b = new WeakMap(), o = new WeakSet(), Q = function() {
98
- return g(this, null, function* () {
99
- const t = yield s(this, M).call(this);
100
- h(this, b, [...s(this, v)]), typeof t.default == "function" && h(this, p, t.default);
106
+ S = new WeakMap(), U = new WeakMap(), T = new WeakMap(), p = new WeakMap(), c = new WeakMap(), I = new WeakMap(), M = new WeakMap(), v = new WeakMap(), P = new WeakMap(), L = new WeakMap(), o = new WeakSet(), Q = function() {
107
+ return w(this, null, function* () {
108
+ const t = yield e(this, U).call(this);
109
+ h(this, L, [...e(this, P)]), typeof t.default == "function" && h(this, p, t.default);
101
110
  });
102
111
  }, X = function() {
103
- s(this, v).forEach((t) => {
112
+ e(this, P).forEach((t) => {
104
113
  document.head.appendChild(t.cloneNode(!0));
105
114
  });
106
- }, Z = function(t, e) {
107
- return g(this, null, function* () {
108
- const r = { urlPatternResult: s(this, S).exec({ pathname: e.pathname }) };
109
- bt(s(this, p)) ? (h(this, d, new (s(this, p))(r)), t.appendChild(s(this, d))) : h(this, d, vt(
115
+ }, Z = function(t, s) {
116
+ return w(this, null, function* () {
117
+ var l;
118
+ const r = { urlPatternResult: e(this, T).exec({ pathname: s.pathname }) };
119
+ bt(e(this, p)) ? (h(this, c, new (e(this, p))(r)), t.appendChild(e(this, c))) : h(this, c, Lt(
110
120
  t,
111
- s(this, p),
121
+ e(this, p),
112
122
  r
113
- )), u(this, o, _).call(this), h(this, T, !0);
123
+ )), (l = e(this, c)) == null || l.addEventListener(
124
+ "__hmrInstanceReplace",
125
+ e(this, b)
126
+ ), d(this, o, tt).call(this), h(this, I, !0);
114
127
  });
115
- }, _ = function() {
116
- var t;
117
- s(this, d) && h(this, B, s(this, d).querySelector("[data-nest]") || ((t = s(this, d).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || s(this, d).shadowRoot || s(this, d));
118
128
  }, tt = function() {
119
129
  var t;
120
- s(this, P).disconnect(), (t = s(this, d)) == null || t.remove(), h(this, T, !1), u(this, o, et).call(this);
130
+ e(this, c) && h(this, M, e(this, c).querySelector("[data-nest]") || ((t = e(this, c).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || e(this, c).shadowRoot || e(this, c));
121
131
  }, et = function() {
122
- s(this, b).forEach((t) => {
132
+ e(this, v).disconnect(), e(this, c) && (e(this, c).removeEventListener(
133
+ "__hmrInstanceReplace",
134
+ e(this, b)
135
+ ), e(this, c).remove()), h(this, I, !1), d(this, o, st).call(this);
136
+ }, st = function() {
137
+ e(this, L).forEach((t) => {
123
138
  t.parentNode === document.head && document.head.removeChild(t);
124
- }), h(this, b, []);
125
- }, st = function(t) {
126
- t.forEach((e) => {
127
- e.addedNodes.forEach((a) => {
128
- s(this, p) ? s(this, b).push(a) : s(this, v).push(a);
139
+ }), h(this, L, []);
140
+ }, it = function(t) {
141
+ t.forEach((s) => {
142
+ s.addedNodes.forEach((a) => {
143
+ e(this, p) ? e(this, L).push(a) : e(this, P).push(a);
129
144
  });
130
145
  });
131
- }, it = function() {
132
- return g(this, null, function* () {
133
- const t = s(this, v).filter(u(this, o, z));
146
+ }, at = function() {
147
+ return w(this, null, function* () {
148
+ const t = e(this, P).filter(d(this, o, z));
134
149
  yield Promise.all(
135
150
  t.map(
136
- (e) => new Promise((a) => {
137
- u(this, o, z).call(this, e) ? e.onload = () => a() : a();
151
+ (s) => new Promise((a) => {
152
+ d(this, o, z).call(this, s) ? s.onload = () => a() : a();
138
153
  })
139
154
  )
140
155
  );
141
156
  });
142
157
  }, z = function(t) {
143
158
  return t instanceof HTMLElement && (t.tagName === "STYLE" || t.tagName === "SCRIPT" || t.tagName === "LINK");
144
- };
159
+ }, b = new WeakMap();
145
160
  globalThis.URLPattern = Pt;
146
- var l, N, k, y, C, H, R, A, m, at, rt, nt, O, ht;
147
- class It {
161
+ var u, N, k, y, C, H, g, _, m, rt, nt, ht, O, ot;
162
+ class Bt {
148
163
  constructor(t) {
149
164
  n(this, m);
150
- n(this, l, null);
165
+ n(this, u, null);
151
166
  n(this, N, null);
152
167
  n(this, k, null);
153
168
  n(this, y, null);
154
169
  n(this, C, null);
155
170
  n(this, H, 0);
156
- n(this, R, []);
157
- n(this, A, null);
158
- h(this, l, G(j({}, t), {
171
+ n(this, g, []);
172
+ n(this, _, null);
173
+ h(this, u, G(j({}, t), {
159
174
  rootElement: (t == null ? void 0 : t.rootElement) || document.body,
160
175
  base: gt(t == null ? void 0 : t.base)
161
- })), h(this, C, new pt()), h(this, N, new wt(s(this, l).scrollSelector)), s(this, N).update(), h(this, k, new ft({
162
- base: s(this, l).base,
163
- trailingSlash: s(this, l).trailingSlash,
176
+ })), h(this, C, new Rt()), h(this, N, new wt(e(this, u).scrollSelector)), e(this, N).update(), h(this, k, new pt({
177
+ base: e(this, u).base,
178
+ trailingSlash: e(this, u).trailingSlash,
164
179
  includeAnchor: t == null ? void 0 : t.includeAnchor,
165
- onClick: (e, a) => {
180
+ onClick: (s, a) => {
166
181
  try {
167
- this.navigate(e, a);
182
+ this.navigate(s, a);
168
183
  } catch (r) {
169
- window.location.assign(e);
184
+ window.location.assign(s);
170
185
  }
171
186
  }
172
- })), s(this, k).update(), h(this, y, new mt({
173
- onPop: (e) => {
174
- this.navigate(e);
187
+ })), e(this, k).update(), h(this, y, new ft({
188
+ onPop: (s) => {
189
+ this.navigate(s);
175
190
  }
176
191
  }));
177
192
  }
178
193
  history() {
179
- return s(this, y);
194
+ return e(this, y);
180
195
  }
181
196
  get scroll() {
182
197
  return scroll;
183
198
  }
184
199
  get routes() {
185
- return s(this, R);
200
+ return e(this, g);
186
201
  }
187
202
  run() {
188
- u(this, m, ht).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
203
+ d(this, m, ot).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
189
204
  }
190
- defineRoute(t, e) {
191
- const a = new Nt(t, e);
192
- s(this, R).push(a);
205
+ defineRoute(t, s) {
206
+ const a = new Nt(t, s);
207
+ e(this, g).push(a);
193
208
  }
194
- navigate(t, e) {
195
- return g(this, null, function* () {
209
+ navigate(t, s) {
210
+ return w(this, null, function* () {
196
211
  var q, x, V, $, D, F;
197
- const a = s(this, y).isBack, r = ++J(this, H)._;
198
- let c = Rt(t, {
199
- base: s(this, l).base,
200
- trailingSlash: s(this, l).trailingSlash
212
+ const a = e(this, y).isBack, r = ++J(this, H)._;
213
+ let l = vt(t, {
214
+ base: e(this, u).base,
215
+ trailingSlash: e(this, u).trailingSlash
201
216
  });
202
- if (s(this, l).urlModifier && (c = s(this, l).urlModifier(c)), !(yield u(this, m, at).call(this, c)) || s(this, H) !== r || (yield (x = (q = s(this, l)).beforeNavigation) == null ? void 0 : x.call(q), s(this, H) !== r))
217
+ if (e(this, u).urlModifier && (l = e(this, u).urlModifier(l)), !(yield d(this, m, rt).call(this, l)) || e(this, H) !== r || (yield (x = (q = e(this, u)).beforeNavigation) == null ? void 0 : x.call(q), e(this, H) !== r))
203
218
  return;
204
- const { activeRoutes: U, newRoutes: w, oldRoutes: f, keepRoutes: L } = u(this, m, rt).call(this, c);
205
- h(this, A, (V = L[L.length - 1]) != null ? V : null), a || (s(this, y).push(c), (($ = e == null ? void 0 : e.keepScrollPosition) == null || $) && s(this, N).element.scrollTo({ top: 0, behavior: "instant" })), s(this, C).create(document, c.pathname), s(this, l).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => u(this, m, O).call(this, f, w, c)).finished : yield u(this, m, O).call(this, f, w, c), s(this, N).update(), s(this, k).update(), s(this, C).done(), yield (F = (D = s(this, l)).afterNavigation) == null ? void 0 : F.call(D);
219
+ const { activeRoutes: A, newRoutes: R, oldRoutes: f, keepRoutes: E } = d(this, m, nt).call(this, l);
220
+ h(this, _, (V = E[E.length - 1]) != null ? V : null), a || (e(this, y).push(l), (($ = s == null ? void 0 : s.keepScrollPosition) == null || $) && e(this, N).element.scrollTo({ top: 0, behavior: "instant" })), e(this, C).create(document, l.pathname), e(this, u).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => d(this, m, O).call(this, f, R, l)).finished : yield d(this, m, O).call(this, f, R, l), e(this, N).update(), e(this, k).update(), e(this, C).done(), yield (F = (D = e(this, u)).afterNavigation) == null ? void 0 : F.call(D);
206
221
  });
207
222
  }
208
223
  }
209
- l = new WeakMap(), N = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), H = new WeakMap(), R = new WeakMap(), A = new WeakMap(), m = new WeakSet(), at = function(t) {
210
- return g(this, null, function* () {
211
- if (!s(this, l).preprocessor)
224
+ u = new WeakMap(), N = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), H = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), m = new WeakSet(), rt = function(t) {
225
+ return w(this, null, function* () {
226
+ if (!e(this, u).preprocessor)
212
227
  return !0;
213
228
  try {
214
- return yield new Promise((e, a) => {
215
- var r, c;
216
- (c = (r = s(this, l)).preprocessor) == null || c.call(r, { url: t, resolve: e, reject: a });
229
+ return yield new Promise((s, a) => {
230
+ var r, l;
231
+ (l = (r = e(this, u)).preprocessor) == null || l.call(r, { url: t, resolve: s, reject: a });
217
232
  }), !0;
218
- } catch (e) {
219
- return console.error(e != null ? e : "Route change canceled"), !1;
233
+ } catch (s) {
234
+ return console.error(s != null ? s : "Route change canceled"), !1;
220
235
  }
221
236
  });
222
- }, rt = function(t) {
223
- let e = t.pathname.replace(s(this, l).base, "");
224
- e.startsWith("/") || (e = `/${e}`);
225
- const a = s(this, R).filter((r) => r.isActive);
237
+ }, nt = function(t) {
238
+ let s = t.pathname.replace(e(this, u).base, "");
239
+ s.startsWith("/") || (s = `/${s}`);
240
+ const a = e(this, g).filter((r) => r.isActive);
226
241
  return {
227
242
  activeRoutes: a,
228
- newRoutes: s(this, R).filter(
229
- (r) => !a.includes(r) && r.testPathname(e)
243
+ newRoutes: e(this, g).filter(
244
+ (r) => !a.includes(r) && r.testPathname(s)
230
245
  ),
231
- oldRoutes: a.filter((r) => !r.testPathname(e)),
232
- keepRoutes: a.filter((r) => r.testPathname(e))
246
+ oldRoutes: a.filter((r) => !r.testPathname(s)),
247
+ keepRoutes: a.filter((r) => r.testPathname(s))
233
248
  };
234
- }, nt = function(t) {
235
- t.forEach((e) => e.close());
236
- }, O = function(t, e, a) {
237
- return g(this, null, function* () {
238
- var r, c;
239
- u(this, m, nt).call(this, t);
240
- for (const U of e) {
241
- const w = (c = (r = s(this, A)) == null ? void 0 : r.nest) != null ? c : s(this, l).rootElement;
242
- yield U.render(w, a), h(this, A, U);
249
+ }, ht = function(t) {
250
+ t.forEach((s) => s.close());
251
+ }, O = function(t, s, a) {
252
+ return w(this, null, function* () {
253
+ var r, l;
254
+ d(this, m, ht).call(this, t);
255
+ for (const A of s) {
256
+ const R = (l = (r = e(this, _)) == null ? void 0 : r.nest) != null ? l : e(this, u).rootElement;
257
+ yield A.render(R, a), h(this, _, A);
243
258
  }
244
259
  });
245
- }, ht = function() {
246
- s(this, R).sort((t, e) => {
247
- const a = t.pattern.split("/").length, r = e.pattern.split("/").length;
260
+ }, ot = function() {
261
+ e(this, g).sort((t, s) => {
262
+ const a = t.pattern.split("/").length, r = s.pattern.split("/").length;
248
263
  return a - r;
249
264
  });
250
265
  };
251
266
  export {
252
- It as Router
267
+ Bt as Router
253
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.82.4",
3
+ "version": "0.82.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"