aptechka 0.81.0 → 0.82.0
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/lib/{Animation-C4tLEBGM.js → Animation-DxtCzFP3.js} +2 -2
- package/lib/{Composed-BB1MtFiT.js → Composed-DtS09lSU.js} +2 -2
- package/lib/{Damped-DVG5nrYV.js → Damped-DMnIOXpC.js} +2 -2
- package/lib/{DerivedArray-D3scYQdp.js → DerivedArray-DG9iR0mf.js} +1 -1
- package/lib/{DragControls-Cm_88cLt.js → DragControls-DCC8iEOR.js} +4 -4
- package/lib/LocalLinks-Bua7BGRF.cjs +1 -0
- package/lib/LocalLinks-TQkTpAMx.js +62 -0
- package/lib/PageAnnouncerElement-C4k2kDJ5.cjs +1 -0
- package/lib/PageAnnouncerElement-sfh0_4vl.js +24 -0
- package/lib/PageScroll-C7QBpx0G.cjs +1 -0
- package/lib/PageScroll-cQ3B5-6N.js +62 -0
- package/lib/SourceElement-BQ7g2KWK.js +260 -0
- package/lib/SourceElement-TzgPNQOd.cjs +5 -0
- package/lib/{Store-BtVtCGLk.js → Store-CgQ3ReoB.js} +1 -1
- package/lib/{Tweened-C1lnK6n9.js → Tweened-lT68VACv.js} +2 -2
- package/lib/{Viewport-DbN_JWBM.js → Viewport-DGnJ31b4.js} +2 -2
- package/lib/accordion/index.js +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/attribute/index.js +3 -3
- package/lib/billboard/index.js +2 -2
- package/lib/cache/Cache.d.ts +8 -0
- package/lib/cache/index.cjs +1 -0
- package/lib/cache/index.d.ts +1 -0
- package/lib/cache/index.js +37 -0
- package/lib/canvas/index.js +2 -2
- package/lib/controls/index.js +1 -1
- package/lib/css-property/index.js +3 -3
- package/lib/css-value-parser/index.js +1 -1
- package/lib/dev/index.js +2 -2
- package/lib/device/index.js +1 -1
- package/lib/{dom-fgxIeFxm.js → dom-BIeVMHfK.js} +2 -2
- package/lib/element-linked-store/index.js +2 -2
- package/lib/element-resizer/index.js +2 -2
- package/lib/en3/index.js +2 -2
- package/lib/history/History.d.ts +10 -0
- package/lib/history/index.cjs +1 -0
- package/lib/history/index.d.ts +1 -0
- package/lib/history/index.js +34 -0
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +3 -3
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +4 -4
- package/lib/{index-JqYHGoo6.js → index-LReFyN6i.js} +1 -1
- package/lib/intersector/index.js +2 -2
- package/lib/jsx/index.js +6 -6
- package/lib/ladder/index.js +2 -2
- package/lib/layout-box/index.js +2 -2
- package/lib/loading/index.js +1 -1
- package/lib/local-links/LocalLinks.d.ts +17 -0
- package/lib/local-links/index.cjs +1 -0
- package/lib/local-links/index.d.ts +1 -0
- package/lib/local-links/index.js +4 -0
- package/lib/masonry-layout/index.js +2 -2
- package/lib/media/index.js +2 -2
- package/lib/metadata-BcYZ5w3T.cjs +1 -0
- package/lib/metadata-jfowcCyz.js +12 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +141 -140
- package/lib/morph-B6sGhLCi.cjs +1 -0
- package/lib/morph-BQErz7qP.js +242 -0
- package/lib/need_redo_tweaker/index.cjs +1 -1
- package/lib/need_redo_tweaker/index.js +4 -4
- package/lib/{object-D6MVWB4l.js → object-CcMK4y_r.js} +12 -10
- package/lib/object-baN9pgbU.cjs +1 -0
- package/lib/page-announcer/PageAnnouncerElement.d.ts +10 -0
- package/lib/page-announcer/index.cjs +1 -0
- package/lib/page-announcer/index.d.ts +1 -0
- package/lib/page-announcer/index.js +4 -0
- package/lib/page-scroll/PageScroll.d.ts +23 -0
- package/lib/page-scroll/index.cjs +1 -0
- package/lib/page-scroll/index.d.ts +1 -0
- package/lib/page-scroll/index.js +4 -0
- package/lib/pixel-perfect/index.js +3 -3
- package/lib/pointer/index.js +4 -4
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +3 -3
- package/lib/radio/index.js +1 -1
- package/lib/{render-CMQbWthg.js → render-CiA0mn5V.js} +3 -3
- package/lib/router/Route.d.ts +1 -2
- package/lib/router/Router.d.ts +18 -23
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.d.ts +1 -1
- package/lib/router/index.js +183 -249
- package/lib/scroll/index.js +8 -8
- package/lib/scroll-entries/index.js +1 -1
- package/lib/{scroll-7JSxRKFK.js → scroll-jcbHDexr.js} +2 -2
- package/lib/scroll-kit/index.js +4 -4
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +3 -3
- package/lib/size-element/index.js +1 -1
- package/lib/slicer/index.js +1 -1
- package/lib/source/SourceElement.d.ts +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/spa/SPA.d.ts +29 -0
- package/lib/spa/index.cjs +1 -0
- package/lib/spa/index.d.ts +1 -0
- package/lib/spa/index.js +130 -0
- package/lib/store/index.js +3 -3
- package/lib/{stylesheet-JlRFfJIc.js → stylesheet-DbHOxtjw.js} +1 -1
- package/lib/ticker/index.js +2 -2
- package/lib/url-CPgw9bd5.cjs +1 -0
- package/lib/url-DAl-mgbC.js +97 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +141 -120
- package/lib/utils/morph.d.ts +49 -0
- package/lib/utils/object.d.ts +1 -1
- package/lib/utils/url.d.ts +6 -0
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +3 -3
- package/lib/window-resizer/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +3 -3
- package/package.json +49 -1
- package/lib/SourceElement-BBfaAgwe.cjs +0 -5
- package/lib/SourceElement-BiNNtaz9.js +0 -265
- package/lib/object-CCiXnER2.cjs +0 -1
- package/lib/router/Link.d.ts +0 -8
- package/lib/url-CoUSEREU.cjs +0 -1
- package/lib/url-IGj2LgDW.js +0 -66
package/lib/router/Router.d.ts
CHANGED
|
@@ -1,41 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { History } from '../history';
|
|
2
|
+
import { LocalLinksLinkOptions, LocalLinksOptions } from '../local-links';
|
|
3
3
|
import { Route, RouteModule } from './Route';
|
|
4
4
|
export interface RouterPreprocessorEntry {
|
|
5
|
-
|
|
5
|
+
url: URL;
|
|
6
6
|
resolve: () => void;
|
|
7
7
|
reject: () => void;
|
|
8
8
|
}
|
|
9
9
|
export type RouterPreprocessor = (entry: RouterPreprocessorEntry) => void;
|
|
10
10
|
export interface RouterPostprocessorEntry {
|
|
11
|
-
|
|
11
|
+
url: URL;
|
|
12
12
|
}
|
|
13
13
|
export type RouterPostprocessor = (entry: RouterPostprocessorEntry) => void;
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export type RouterURLModifier = (url: URL) => URL;
|
|
15
|
+
export interface RouterNavigateOptions extends LocalLinksLinkOptions {
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
export interface RouterNavigateOptions {
|
|
19
|
-
historyAction?: ChangeHistoryAction;
|
|
20
|
-
revalidate?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface RouterParameters {
|
|
17
|
+
export interface RouterOptions extends Pick<LocalLinksOptions, 'base' | 'trailingSlash' | 'includeAnchor'> {
|
|
23
18
|
rootElement?: HTMLElement;
|
|
24
|
-
|
|
19
|
+
scrollSelector?: string;
|
|
20
|
+
beforeNavigation?: () => void | Promise<void>;
|
|
21
|
+
afterNavigation?: () => void | Promise<void>;
|
|
22
|
+
urlModifier?: RouterURLModifier;
|
|
23
|
+
preprocessor?: RouterPreprocessor;
|
|
24
|
+
postprocessor?: RouterPostprocessor;
|
|
25
|
+
viewTransition?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export declare class Router {
|
|
27
28
|
#private;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
get candidateURL(): SplitPathResult | null;
|
|
32
|
-
get currentURL(): SplitPathResult;
|
|
29
|
+
constructor(options?: RouterOptions);
|
|
30
|
+
history(): History;
|
|
31
|
+
get scroll(): typeof scroll;
|
|
33
32
|
get routes(): Route[];
|
|
34
|
-
get links(): Link[];
|
|
35
33
|
run(): void;
|
|
36
|
-
destroy(): void;
|
|
37
|
-
navigationEvent(callback: RouterAfterNavigationCallback): () => void;
|
|
38
34
|
defineRoute(pattern: string, module: RouteModule): void;
|
|
39
|
-
navigate(
|
|
40
|
-
normalizePath(path: string): SplitPathResult;
|
|
35
|
+
navigate(url: string | URL, options?: RouterNavigateOptions): Promise<void>;
|
|
41
36
|
}
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=
|
|
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-DBQUdpsp.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;
|
package/lib/router/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Router, type
|
|
1
|
+
export { Router, type RouterPostprocessor, type RouterPreprocessor, type RouterPreprocessorEntry, } from './Router';
|
|
2
2
|
export { type RouteModule, type RouteParameters } from './Route';
|
package/lib/router/index.js
CHANGED
|
@@ -1,319 +1,253 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var ot = Object.defineProperty, lt = Object.defineProperties;
|
|
2
|
+
var ut = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var K = Object.getOwnPropertySymbols;
|
|
4
|
+
var ct = Object.prototype.hasOwnProperty, dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Y = (i) => {
|
|
6
|
+
throw TypeError(i);
|
|
3
7
|
};
|
|
4
|
-
var
|
|
5
|
-
var e
|
|
6
|
-
|
|
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]);
|
|
11
|
+
if (K)
|
|
12
|
+
for (var e of K(t))
|
|
13
|
+
dt.call(t, e) && W(i, e, t[e]);
|
|
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) => ({
|
|
19
|
+
set _(r) {
|
|
20
|
+
h(i, t, r, e);
|
|
21
|
+
},
|
|
22
|
+
get _() {
|
|
23
|
+
return s(i, t, a);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var g = (i, t, e) => new Promise((a, r) => {
|
|
27
|
+
var c = (f) => {
|
|
8
28
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
|
|
29
|
+
w(e.next(f));
|
|
30
|
+
} catch (L) {
|
|
31
|
+
r(L);
|
|
12
32
|
}
|
|
13
|
-
},
|
|
33
|
+
}, U = (f) => {
|
|
14
34
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
35
|
+
w(e.throw(f));
|
|
36
|
+
} catch (L) {
|
|
37
|
+
r(L);
|
|
18
38
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
39
|
+
}, w = (f) => f.done ? a(f.value) : Promise.resolve(f.value).then(c, U);
|
|
40
|
+
w((e = e.apply(i, t)).next());
|
|
21
41
|
});
|
|
22
|
-
import {
|
|
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";
|
|
45
|
+
import { P as wt } from "../PageScroll-cQ3B5-6N.js";
|
|
23
46
|
import "construct-style-sheets-polyfill";
|
|
24
|
-
import "../index-
|
|
25
|
-
import {
|
|
26
|
-
import { URLPattern as
|
|
27
|
-
import { r as vt } from "../render-
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
r(this, b, t), r(this, v, s), e(this, v).addEventListener("click", e(this, T));
|
|
46
|
-
}
|
|
47
|
-
checkCurrent(t) {
|
|
48
|
-
}
|
|
49
|
-
destroy() {
|
|
50
|
-
e(this, v).removeEventListener("click", e(this, T)), e(this, v).classList.remove("current");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
b = new WeakMap(), v = new WeakMap(), B = new WeakSet(), G = function() {
|
|
54
|
-
const t = new URL(e(this, v).href);
|
|
55
|
-
return e(this, b).normalizePath(
|
|
56
|
-
t.pathname + t.search + t.hash
|
|
57
|
-
).path;
|
|
58
|
-
}, T = new WeakMap();
|
|
59
|
-
var k, q, C, d, u, U, M, P, A, N, o, J, Q, V, X, Z, _, tt, et, st, F;
|
|
60
|
-
class yt {
|
|
61
|
-
constructor(t, s) {
|
|
62
|
-
a(this, o);
|
|
63
|
-
a(this, k);
|
|
64
|
-
a(this, q);
|
|
65
|
-
a(this, C);
|
|
66
|
-
a(this, d, null);
|
|
67
|
-
a(this, u, null);
|
|
68
|
-
a(this, U, !1);
|
|
69
|
-
a(this, M, null);
|
|
70
|
-
a(this, P);
|
|
71
|
-
a(this, A, []);
|
|
72
|
-
a(this, N, []);
|
|
73
|
-
r(this, k, t), r(this, q, s), r(this, C, new URLPattern({ pathname: e(this, k) })), r(this, P, new MutationObserver(
|
|
74
|
-
n(this, o, et).bind(this)
|
|
47
|
+
import "../index-LReFyN6i.js";
|
|
48
|
+
import { a as gt, n as Rt } from "../url-DAl-mgbC.js";
|
|
49
|
+
import { URLPattern as Pt } from "urlpattern-polyfill";
|
|
50
|
+
import { r as vt } from "../render-CiA0mn5V.js";
|
|
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;
|
|
53
|
+
class Nt {
|
|
54
|
+
constructor(t, e) {
|
|
55
|
+
n(this, o);
|
|
56
|
+
n(this, E);
|
|
57
|
+
n(this, M);
|
|
58
|
+
n(this, S);
|
|
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)
|
|
75
68
|
));
|
|
76
69
|
}
|
|
77
70
|
get pattern() {
|
|
78
|
-
return
|
|
71
|
+
return s(this, E);
|
|
79
72
|
}
|
|
80
73
|
get isActive() {
|
|
81
|
-
return
|
|
74
|
+
return s(this, T);
|
|
82
75
|
}
|
|
83
76
|
get element() {
|
|
84
|
-
return
|
|
77
|
+
return s(this, d);
|
|
85
78
|
}
|
|
86
79
|
get nest() {
|
|
87
|
-
return
|
|
80
|
+
return s(this, B);
|
|
88
81
|
}
|
|
89
82
|
testPathname(t) {
|
|
90
|
-
return
|
|
83
|
+
return s(this, S).test({ pathname: t });
|
|
91
84
|
}
|
|
92
|
-
render(t,
|
|
93
|
-
return
|
|
94
|
-
|
|
85
|
+
render(t, e) {
|
|
86
|
+
return g(this, null, function* () {
|
|
87
|
+
s(this, P).observe(document.head, {
|
|
95
88
|
childList: !0,
|
|
96
89
|
subtree: !0
|
|
97
|
-
}),
|
|
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();
|
|
98
91
|
});
|
|
99
92
|
}
|
|
100
93
|
close() {
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
getAnchorElements() {
|
|
104
|
-
const t = [];
|
|
105
|
-
return e(this, u) && (t.push(...e(this, u).querySelectorAll("a")), Lt(e(this, u), (s) => {
|
|
106
|
-
t.push(...s.shadowRoot.querySelectorAll("a"));
|
|
107
|
-
})), t;
|
|
94
|
+
u(this, o, tt).call(this);
|
|
108
95
|
}
|
|
109
96
|
}
|
|
110
|
-
|
|
111
|
-
return
|
|
112
|
-
const t = yield
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
}, Q = function() {
|
|
116
|
-
return R(this, null, function* () {
|
|
117
|
-
if (e(this, d) && j(e(this, d))) {
|
|
118
|
-
const t = `e-${e(this, d).name.toLowerCase()}`;
|
|
119
|
-
customElements.get(t) || customElements.define(
|
|
120
|
-
t,
|
|
121
|
-
e(this, d)
|
|
122
|
-
);
|
|
123
|
-
}
|
|
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);
|
|
124
101
|
});
|
|
125
|
-
},
|
|
126
|
-
|
|
102
|
+
}, X = function() {
|
|
103
|
+
s(this, v).forEach((t) => {
|
|
127
104
|
document.head.appendChild(t.cloneNode(!0));
|
|
128
105
|
});
|
|
129
|
-
},
|
|
130
|
-
return
|
|
131
|
-
const
|
|
132
|
-
|
|
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(
|
|
133
110
|
t,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)),
|
|
111
|
+
s(this, p),
|
|
112
|
+
r
|
|
113
|
+
)), u(this, o, _).call(this), h(this, T, !0);
|
|
137
114
|
});
|
|
138
|
-
}, Z = function() {
|
|
139
|
-
var t;
|
|
140
|
-
e(this, u) && r(this, M, e(this, u).querySelector("[data-nest]") || ((t = e(this, u).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || e(this, u).shadowRoot || e(this, u));
|
|
141
115
|
}, _ = function() {
|
|
142
116
|
var t;
|
|
143
|
-
|
|
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));
|
|
144
118
|
}, tt = function() {
|
|
145
|
-
|
|
119
|
+
var t;
|
|
120
|
+
s(this, P).disconnect(), (t = s(this, d)) == null || t.remove(), h(this, T, !1), u(this, o, et).call(this);
|
|
121
|
+
}, et = function() {
|
|
122
|
+
s(this, b).forEach((t) => {
|
|
146
123
|
t.parentNode === document.head && document.head.removeChild(t);
|
|
147
|
-
}),
|
|
148
|
-
},
|
|
149
|
-
t.forEach((
|
|
150
|
-
|
|
151
|
-
|
|
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);
|
|
152
129
|
});
|
|
153
130
|
});
|
|
154
|
-
},
|
|
155
|
-
return
|
|
156
|
-
const t =
|
|
131
|
+
}, it = function() {
|
|
132
|
+
return g(this, null, function* () {
|
|
133
|
+
const t = s(this, v).filter(u(this, o, z));
|
|
157
134
|
yield Promise.all(
|
|
158
135
|
t.map(
|
|
159
|
-
(
|
|
160
|
-
|
|
136
|
+
(e) => new Promise((a) => {
|
|
137
|
+
u(this, o, z).call(this, e) ? e.onload = () => a() : a();
|
|
161
138
|
})
|
|
162
139
|
)
|
|
163
140
|
);
|
|
164
141
|
});
|
|
165
|
-
},
|
|
142
|
+
}, z = function(t) {
|
|
166
143
|
return t instanceof HTMLElement && (t.tagName === "STYLE" || t.tagName === "SCRIPT" || t.tagName === "LINK");
|
|
167
144
|
};
|
|
168
|
-
globalThis.URLPattern =
|
|
169
|
-
var
|
|
170
|
-
class
|
|
145
|
+
globalThis.URLPattern = Pt;
|
|
146
|
+
var l, N, k, y, C, H, R, A, m, at, rt, nt, O, ht;
|
|
147
|
+
class It {
|
|
171
148
|
constructor(t) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
149
|
+
n(this, m);
|
|
150
|
+
n(this, l, null);
|
|
151
|
+
n(this, N, null);
|
|
152
|
+
n(this, k, null);
|
|
153
|
+
n(this, y, null);
|
|
154
|
+
n(this, C, null);
|
|
155
|
+
n(this, H, 0);
|
|
156
|
+
n(this, R, []);
|
|
157
|
+
n(this, A, null);
|
|
158
|
+
h(this, l, G(j({}, t), {
|
|
159
|
+
rootElement: (t == null ? void 0 : t.rootElement) || document.body,
|
|
160
|
+
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,
|
|
164
|
+
includeAnchor: t == null ? void 0 : t.includeAnchor,
|
|
165
|
+
onClick: (e, a) => {
|
|
166
|
+
try {
|
|
167
|
+
this.navigate(e, a);
|
|
168
|
+
} catch (r) {
|
|
169
|
+
window.location.assign(e);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
})), s(this, k).update(), h(this, y, new mt({
|
|
173
|
+
onPop: (e) => {
|
|
174
|
+
this.navigate(e);
|
|
175
|
+
}
|
|
176
|
+
}));
|
|
192
177
|
}
|
|
193
|
-
|
|
194
|
-
return
|
|
178
|
+
history() {
|
|
179
|
+
return s(this, y);
|
|
195
180
|
}
|
|
196
|
-
get
|
|
197
|
-
return
|
|
181
|
+
get scroll() {
|
|
182
|
+
return scroll;
|
|
198
183
|
}
|
|
199
184
|
get routes() {
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
get links() {
|
|
203
|
-
return e(this, E);
|
|
185
|
+
return s(this, R);
|
|
204
186
|
}
|
|
205
187
|
run() {
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const i = this.normalizePath(t);
|
|
222
|
-
if (!(s != null && s.revalidate) && (((l = e(this, L)) == null ? void 0 : l.pathname) === i.pathname || e(this, p).pathname === i.pathname)) {
|
|
223
|
-
((m = e(this, p)) == null ? void 0 : m.parameters) !== i.parameters && (r(this, O, e(this, p)), r(this, p, i), Y({
|
|
224
|
-
action: ((w = e(this, p)) == null ? void 0 : w.hash) !== i.hash ? "replace" : (s == null ? void 0 : s.historyAction) || "push",
|
|
225
|
-
pathname: i.pathname,
|
|
226
|
-
searchParameters: i.parameters,
|
|
227
|
-
hash: i.hash
|
|
228
|
-
})), e(this, E).forEach((y) => {
|
|
229
|
-
y.checkCurrent(i);
|
|
230
|
-
});
|
|
188
|
+
u(this, m, ht).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
|
|
189
|
+
}
|
|
190
|
+
defineRoute(t, e) {
|
|
191
|
+
const a = new Nt(t, e);
|
|
192
|
+
s(this, R).push(a);
|
|
193
|
+
}
|
|
194
|
+
navigate(t, e) {
|
|
195
|
+
return g(this, null, function* () {
|
|
196
|
+
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
|
|
201
|
+
});
|
|
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))
|
|
231
203
|
return;
|
|
232
|
-
}
|
|
233
|
-
|
|
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);
|
|
234
206
|
});
|
|
235
207
|
}
|
|
236
|
-
normalizePath(t) {
|
|
237
|
-
return Rt(t, { base: e(this, I) });
|
|
238
|
-
}
|
|
239
208
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (!this.preprocessor) return !0;
|
|
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)
|
|
212
|
+
return !0;
|
|
245
213
|
try {
|
|
246
|
-
return yield new Promise((
|
|
247
|
-
var
|
|
248
|
-
(
|
|
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 });
|
|
249
217
|
}), !0;
|
|
250
|
-
} catch (
|
|
251
|
-
return console.error(
|
|
218
|
+
} catch (e) {
|
|
219
|
+
return console.error(e != null ? e : "Route change canceled"), !1;
|
|
252
220
|
}
|
|
253
221
|
});
|
|
254
|
-
}, ht = function(i) {
|
|
255
|
-
return R(this, arguments, function* (t, s = {}) {
|
|
256
|
-
var f;
|
|
257
|
-
const { activeRoutes: l, newRoutes: m, oldRoutes: w, keepRoutes: y } = n(this, h, rt).call(this, t.leaf);
|
|
258
|
-
r(this, z, (f = y[y.length - 1]) != null ? f : null), n(this, h, nt).call(this, w), r(this, p, t), Y({
|
|
259
|
-
action: s.historyAction || "push",
|
|
260
|
-
pathname: t.pathname,
|
|
261
|
-
searchParameters: t.parameters,
|
|
262
|
-
hash: t.hash
|
|
263
|
-
}), yield n(this, h, ot).call(this, m, t.leaf), n(this, h, ut).call(this), n(this, h, ct).call(this, t.pathname);
|
|
264
|
-
});
|
|
265
222
|
}, rt = function(t) {
|
|
266
|
-
|
|
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);
|
|
267
226
|
return {
|
|
268
|
-
activeRoutes:
|
|
269
|
-
newRoutes:
|
|
270
|
-
(
|
|
227
|
+
activeRoutes: a,
|
|
228
|
+
newRoutes: s(this, R).filter(
|
|
229
|
+
(r) => !a.includes(r) && r.testPathname(e)
|
|
271
230
|
),
|
|
272
|
-
oldRoutes:
|
|
273
|
-
keepRoutes:
|
|
231
|
+
oldRoutes: a.filter((r) => !r.testPathname(e)),
|
|
232
|
+
keepRoutes: a.filter((r) => r.testPathname(e))
|
|
274
233
|
};
|
|
275
234
|
}, nt = function(t) {
|
|
276
|
-
t.forEach((
|
|
277
|
-
},
|
|
278
|
-
return
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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);
|
|
283
243
|
}
|
|
284
244
|
});
|
|
285
|
-
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
e(this, g).sort((t, s) => {
|
|
290
|
-
const i = t.pattern.split("/").length, l = s.pattern.split("/").length;
|
|
291
|
-
return i - l;
|
|
245
|
+
}, ht = function() {
|
|
246
|
+
s(this, R).sort((t, e) => {
|
|
247
|
+
const a = t.pattern.split("/").length, r = e.pattern.split("/").length;
|
|
248
|
+
return a - r;
|
|
292
249
|
});
|
|
293
|
-
}
|
|
294
|
-
n(this, h, K).call(this), n(this, h, dt).call(this);
|
|
295
|
-
}, K = function() {
|
|
296
|
-
e(this, E).forEach((t) => t.destroy()), r(this, E, []);
|
|
297
|
-
}, dt = function() {
|
|
298
|
-
const t = e(this, g).filter((i) => i.isActive), s = n(this, h, mt).call(this, t);
|
|
299
|
-
r(this, E, s.map((i) => new wt(this, i)));
|
|
300
|
-
}, mt = function(t) {
|
|
301
|
-
const s = Array.from(
|
|
302
|
-
e(this, S).querySelectorAll("a")
|
|
303
|
-
), i = t.flatMap(
|
|
304
|
-
(l) => l.getAnchorElements()
|
|
305
|
-
);
|
|
306
|
-
return Array.from(
|
|
307
|
-
new Set(
|
|
308
|
-
[...s, ...i].filter(
|
|
309
|
-
(l) => {
|
|
310
|
-
var m;
|
|
311
|
-
return (m = l.getAttribute("href")) == null ? void 0 : m.startsWith("/");
|
|
312
|
-
}
|
|
313
|
-
)
|
|
314
|
-
)
|
|
315
|
-
);
|
|
316
|
-
}, x = new WeakMap();
|
|
250
|
+
};
|
|
317
251
|
export {
|
|
318
|
-
|
|
252
|
+
It as Router
|
|
319
253
|
};
|