aptechka 0.5.7 → 0.5.8
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/Animation.d.ts +3 -3
- package/lib/animation/AnimationLink.d.ts +2 -2
- package/lib/animation/Damped.d.ts +1 -1
- package/lib/animation/Tweened.d.ts +2 -2
- package/lib/morph/Morph.d.ts +3 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +146 -139
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export interface AnimationOptions extends TickerAddOptions {
|
|
|
15
15
|
equalize?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export type AnimationConstructorOptions<Options extends AnimationOptions> = StoreOptions<number, 'number'> & Options;
|
|
18
|
-
export declare abstract class Animation<Entry extends AnimationEntry = AnimationEntry> extends Store<number, 'number', Entry> {
|
|
18
|
+
export declare abstract class Animation<Entry extends AnimationEntry = AnimationEntry, Options extends AnimationOptions = AnimationOptions> extends Store<number, 'number', Entry> {
|
|
19
19
|
#private;
|
|
20
20
|
constructor(initial?: number, options?: StoreOptions<number, 'number'>);
|
|
21
21
|
get linked(): Set<AnimationLink<AnimationLinkOptions>>;
|
|
@@ -43,8 +43,8 @@ export declare abstract class Animation<Entry extends AnimationEntry = Animation
|
|
|
43
43
|
progress: number;
|
|
44
44
|
};
|
|
45
45
|
setTarget(value: number): void;
|
|
46
|
-
set(value: number, options?:
|
|
47
|
-
shift(value: number, options?:
|
|
46
|
+
set(value: number, options?: Options): void;
|
|
47
|
+
shift(value: number, options?: Options): void;
|
|
48
48
|
reset(): void;
|
|
49
49
|
close(): void;
|
|
50
50
|
listenAnimationFrame(): void;
|
|
@@ -7,7 +7,7 @@ export interface AnimationLinkOptions extends Omit<AnimationOptions, keyof Store
|
|
|
7
7
|
export declare class AnimationLink<Options extends AnimationLinkOptions = AnimationLinkOptions> {
|
|
8
8
|
#private;
|
|
9
9
|
constructor(triggerAnimation: Animation<any>, targetAnimation: Animation<any>, startValue: number, setValue: number, options?: Options | undefined);
|
|
10
|
-
get targetAnimation(): Animation<any>;
|
|
11
|
-
get triggerAnimation(): Animation<any>;
|
|
10
|
+
get targetAnimation(): Animation<any, AnimationOptions>;
|
|
11
|
+
get triggerAnimation(): Animation<any, AnimationOptions>;
|
|
12
12
|
destroy(): void;
|
|
13
13
|
}
|
|
@@ -10,7 +10,7 @@ export interface DampedEntry extends AnimationEntry {
|
|
|
10
10
|
velocity: number;
|
|
11
11
|
speed: number;
|
|
12
12
|
}
|
|
13
|
-
export declare class Damped extends Animation<DampedEntry> {
|
|
13
|
+
export declare class Damped extends Animation<DampedEntry, DampedOptions> {
|
|
14
14
|
#private;
|
|
15
15
|
damping: number;
|
|
16
16
|
stiffness: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Animation, AnimationConstructorOptions, AnimationOptions } from './Animation';
|
|
1
|
+
import { Animation, AnimationConstructorOptions, AnimationEntry, AnimationOptions } from './Animation';
|
|
2
2
|
import { EasingFunction } from '../utils';
|
|
3
3
|
import { TickerCallbackEntry } from '../ticker';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export interface TweenedOptions extends AnimationOptions {
|
|
|
7
7
|
duration?: number;
|
|
8
8
|
restart?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare class Tweened extends Animation {
|
|
10
|
+
export declare class Tweened extends Animation<AnimationEntry, TweenedOptions> {
|
|
11
11
|
#private;
|
|
12
12
|
constructor(initial?: number, options?: AnimationConstructorOptions<TweenedOptions>);
|
|
13
13
|
updateOptions(options?: TweenedOptions): void;
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Link } from './Link';
|
|
2
|
+
|
|
1
3
|
export type MorphHistoryAction = 'replace' | 'push' | 'none';
|
|
2
4
|
export interface MorphParameters {
|
|
3
5
|
base?: string;
|
|
@@ -21,6 +23,7 @@ export declare class Morph {
|
|
|
21
23
|
postprocessor?: MorphPostprocessor;
|
|
22
24
|
constructor(parameters?: MorphParameters);
|
|
23
25
|
get currentPathname(): string;
|
|
26
|
+
get links(): Link[];
|
|
24
27
|
normalizePath(path: string): {
|
|
25
28
|
leaf: string;
|
|
26
29
|
pathname: string;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var at=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var Q=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var e=(r,t,s)=>(Q(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},l=(r,t,s,n)=>(Q(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var p=(r,t,s)=>(Q(r,t,"access private method"),s);var H=(r,t,s)=>new Promise((n,i)=>{var c=d=>{try{u(s.next(d))}catch(m){i(m)}},f=d=>{try{u(s.throw(d))}catch(m){i(m)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(c,f);u((s=s.apply(r,t)).next())});var ht=(r,t,s)=>(t=r[at("asyncIterator")])?t.call(r):(r=r[at("iterator")](),t={},s=(n,i)=>(i=r[n])&&(t[n]=c=>new Promise((f,u,d)=>(c=i.call(r,c),d=c.done,Promise.resolve(c.value).then(m=>f({value:m,done:d}),u)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),pt=require("../browser-CpzFX2xg.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var y,o,g,S,A,k,M;class gt{constructor(t,s){a(this,y,void 0);a(this,o,void 0);a(this,g,void 0);a(this,S,void 0);a(this,A,void 0);a(this,k,t=>{t.preventDefault(),e(this,y).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,A))!=null&&n.includes(e(this,g))?e(s,o).classList.add("clicked"):e(s,o).classList.remove("clicked")}),e(this,y).navigate(e(this,g),e(this,S))});a(this,M,()=>{e(this,y).prefetch(e(this,g)),e(this,o).removeEventListener("pointerenter",e(this,M))});var c,f;l(this,y,s),l(this,o,t),l(this,g,e(this,o).getAttribute("href")||"/"),l(this,S,e(this,o).getAttribute("data-history-action")||"push"),e(this,o).addEventListener("click",e(this,k));const n=s.normalizePath(e(this,g)),i=s.normalizePath(location.pathname);l(this,A,(c=e(this,o).getAttribute("data-match-paths"))==null?void 0:c.split(",").map(u=>s.normalizePath(u.trim()).pathname)),e(this,o).hasAttribute("data-include")?i.pathname.includes(n.pathname)&&e(this,o).classList.add("current"):n.pathname===i.pathname||(f=e(this,A))!=null&&f.includes(i.pathname)?(e(this,o).classList.add("current"),e(this,o).classList.add("clicked")):e(this,o).classList.remove("clicked"),e(this,o).hasAttribute("data-prefetch")&&e(this,o).addEventListener("pointerenter",e(this,M))}destroy(){e(this,o).removeEventListener("click",e(this,k)),e(this,o).removeEventListener("pointerenter",e(this,M)),e(this,o).classList.remove("current")}}y=new WeakMap,o=new WeakMap,g=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap;var E,C,z,W,N,B,P,L,w,q,x,D,U,R,V,F,X,K,ct,I,Z,Y;class Et{constructor(t){a(this,D);a(this,R);a(this,F);a(this,K);a(this,I);a(this,E,null);a(this,C,null);a(this,z,null);a(this,W,null);a(this,N,[]);a(this,B,new DOMParser);a(this,P,new Map);a(this,L,void 0);a(this,w,null);a(this,q,new ot.Notifier);a(this,x,new ot.Notifier);a(this,Y,t=>{t.state&&this.navigate(t.state,"none")});pt.isBrowser&&(l(this,E,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(l(this,E,t.base),t.base.endsWith("/")||l(this,E,e(this,E)+"/")):l(this,E,"/"),l(this,C,(t==null?void 0:t.waitForHeadToLoad)!==!1),l(this,z,(t==null?void 0:t.cachePages)!==!1),l(this,W,p(this,F,X).call(this,document.body)),l(this,w,this.normalizePath(location.pathname).pathname),document.documentElement.setAttribute("data-current-pathname",e(this,w)),p(this,R,V).call(this),addEventListener("popstate",e(this,Y)))}get currentPathname(){return e(this,w)}get links(){return e(this,N)}normalizePath(t){t=t.replace(e(this,E),""),t.startsWith("/")&&(t=t.slice(1));const s=t.split("#"),n=s[0].split("?"),i=n[0].endsWith("/")?n[0].slice(0,-1):n[0],c=e(this,E)+i,f=n==null?void 0:n[1],u=s==null?void 0:s[1];return{leaf:i,pathname:c,parameters:f,hash:u}}beforeNavigationEvent(t){return e(this,q).subscribe(t)}afterNavigationEvent(t){return e(this,x).subscribe(t)}prefetch(t){return H(this,null,function*(){const s=this.normalizePath(t);return p(this,D,U).call(this,s.pathname)})}navigate(t,s="push"){return H(this,null,function*(){var d;const n=this.normalizePath(t);let{pathname:i,hash:c,parameters:f}=n;if(e(this,L)===i||e(this,w)===i)return;l(this,L,i);const u=e(this,P).has(i);try{let m=!0;if(e(this,q).notify({pathname:i,isCached:u}),this.preprocessor)try{yield new Promise((h,b)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:i,resolve:h,reject:b,isCached:u})})}catch(h){h?console.error(h):console.log("Route change canceled"),m=!1}if(!m||e(this,L)!==i)return;const tt=e(this,P).get(i)||(yield p(this,D,U).call(this,i));if(e(this,L)!==i)return;const et=Array.from(document.head.children),st=Array.from(tt.head.cloneNode(!0).children),it=p(this,K,ct).call(this,et,st),lt=p(this,I,Z).call(this,et,it),O=p(this,I,Z).call(this,st,it);O.forEach((h,b)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),O[b]=v}}),O.forEach(h=>{document.head.appendChild(h)});const _=O.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");e(this,C)&&_.length&&(yield new Promise(h=>H(this,null,function*(){let b=0;try{for(var v=ht(_),mt,G,j;mt=!(G=yield v.next()).done;mt=!1){const T=G.value;T.onload=()=>{b++,b===_.length&&h()}}}catch(G){j=[G]}finally{try{mt&&(G=v.return)&&(yield G.call(v))}finally{if(j)throw j[0]}}}))),lt.forEach(h=>{h.hasAttribute("data-permanent")||h.remove()}),l(this,w,i);const $=f||location.search,ut=c?c.startsWith("#")?c:"#"+c:"",dt=$?$.startsWith("?")?$:"?"+$:"",nt=`${i}${ut}${dt}`;s==="push"?history.pushState(i,"",nt):s==="replace"&&history.replaceState(i,"",nt);const ft=p(this,F,X).call(this,tt.body.cloneNode(!0));e(this,W).forEach((h,b)=>{const v=ft[b];let mt=[...h.childNodes],G=[...v.childNodes];mt.forEach(j=>{if(j instanceof HTMLElement){const T=j.getAttribute("data-remain");let rt;G=G.filter(J=>J instanceof HTMLElement&&T&&J.getAttribute("data-remain")===T?(rt=J,!1):!0),T&&rt||j.remove()}else j.remove()}),h.append(...G)}),p(this,R,V).call(this),document.documentElement.setAttribute("data-current-pathname",i),(d=this.postprocessor)==null||d.call(this,{pathname:i,isCached:u}),e(this,x).notify({pathname:i,isCached:u})}catch(m){console.error(m)}l(this,L,void 0)})}}E=new WeakMap,C=new WeakMap,z=new WeakMap,W=new WeakMap,N=new WeakMap,B=new WeakMap,P=new WeakMap,L=new WeakMap,w=new WeakMap,q=new WeakMap,x=new WeakMap,D=new WeakSet,U=function(t){return H(this,null,function*(){const s=e(this,P).get(t);if(s)return s;const i=yield(yield fetch(t)).text(),c=e(this,B).parseFromString(i,"text/html");return e(this,z)&&e(this,P).set(t,c),c})},R=new WeakSet,V=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return(n=s.getAttribute("href"))==null?void 0:n.startsWith("/")});e(this,N).forEach(s=>s.destroy()),l(this,N,t.map(s=>new gt(s,this)))},F=new WeakSet,X=function(t){return[...t.querySelectorAll("[data-morph]")]},K=new WeakSet,ct=function(t,s){return t.filter(n=>s.find(i=>i.outerHTML===n.outerHTML))},I=new WeakSet,Z=function(t,s){return t.filter(n=>!s.find(i=>i.outerHTML===n.outerHTML))},Y=new WeakMap;exports.Morph=Et;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,230 +1,237 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
if (!t.has(
|
|
4
|
-
throw TypeError("Cannot " +
|
|
1
|
+
var at = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r);
|
|
2
|
+
var U = (r, t, s) => {
|
|
3
|
+
if (!t.has(r))
|
|
4
|
+
throw TypeError("Cannot " + s);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
if (t.has(
|
|
6
|
+
var e = (r, t, s) => (U(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => {
|
|
7
|
+
if (t.has(r))
|
|
8
8
|
throw TypeError("Cannot add the same private member more than once");
|
|
9
|
-
t instanceof WeakSet ? t.add(
|
|
10
|
-
},
|
|
11
|
-
var p = (
|
|
12
|
-
var
|
|
13
|
-
var
|
|
9
|
+
t instanceof WeakSet ? t.add(r) : t.set(r, s);
|
|
10
|
+
}, l = (r, t, s, n) => (U(r, t, "write to private field"), n ? n.call(r, s) : t.set(r, s), s);
|
|
11
|
+
var p = (r, t, s) => (U(r, t, "access private method"), s);
|
|
12
|
+
var T = (r, t, s) => new Promise((n, i) => {
|
|
13
|
+
var c = (d) => {
|
|
14
14
|
try {
|
|
15
|
-
u(
|
|
15
|
+
u(s.next(d));
|
|
16
16
|
} catch (m) {
|
|
17
17
|
i(m);
|
|
18
18
|
}
|
|
19
19
|
}, f = (d) => {
|
|
20
20
|
try {
|
|
21
|
-
u(
|
|
21
|
+
u(s.throw(d));
|
|
22
22
|
} catch (m) {
|
|
23
23
|
i(m);
|
|
24
24
|
}
|
|
25
|
-
}, u = (d) => d.done ?
|
|
26
|
-
u((
|
|
25
|
+
}, u = (d) => d.done ? n(d.value) : Promise.resolve(d.value).then(c, f);
|
|
26
|
+
u((s = s.apply(r, t)).next());
|
|
27
27
|
});
|
|
28
|
-
var
|
|
28
|
+
var ht = (r, t, s) => (t = r[at("asyncIterator")]) ? t.call(r) : (r = r[at("iterator")](), t = {}, s = (n, i) => (i = r[n]) && (t[n] = (c) => new Promise((f, u, d) => (c = i.call(r, c), d = c.done, Promise.resolve(c.value).then((m) => f({ value: m, done: d }), u)))), s("next"), s("return"), t);
|
|
29
29
|
import { Notifier as ot } from "../notifier/index.js";
|
|
30
|
-
import { i as
|
|
30
|
+
import { i as pt } from "../browser-0zX67oeU.js";
|
|
31
31
|
import "../path-data-polyfill-DgeDWYeI.js";
|
|
32
|
-
var
|
|
33
|
-
class
|
|
34
|
-
constructor(t,
|
|
35
|
-
a(this,
|
|
36
|
-
a(this,
|
|
37
|
-
a(this,
|
|
38
|
-
a(this,
|
|
39
|
-
a(this,
|
|
40
|
-
|
|
32
|
+
var y, o, g, k, A, C, M;
|
|
33
|
+
class gt {
|
|
34
|
+
constructor(t, s) {
|
|
35
|
+
a(this, y, void 0);
|
|
36
|
+
a(this, o, void 0);
|
|
37
|
+
a(this, g, void 0);
|
|
38
|
+
a(this, k, void 0);
|
|
39
|
+
a(this, A, void 0);
|
|
40
|
+
a(this, C, (t) => {
|
|
41
|
+
t.preventDefault(), e(this, y).links.forEach((s) => {
|
|
42
|
+
var n;
|
|
43
|
+
e(this, g) === e(s, g) || (n = e(s, A)) != null && n.includes(e(this, g)) ? e(s, o).classList.add("clicked") : e(s, o).classList.remove("clicked");
|
|
44
|
+
}), e(this, y).navigate(e(this, g), e(this, k));
|
|
41
45
|
});
|
|
42
|
-
a(this,
|
|
43
|
-
|
|
46
|
+
a(this, M, () => {
|
|
47
|
+
e(this, y).prefetch(e(this, g)), e(this, o).removeEventListener("pointerenter", e(this, M));
|
|
44
48
|
});
|
|
45
|
-
var f;
|
|
46
|
-
|
|
49
|
+
var c, f;
|
|
50
|
+
l(this, y, s), l(this, o, t), l(this, g, e(this, o).getAttribute("href") || "/"), l(this, k, e(this, o).getAttribute(
|
|
47
51
|
"data-history-action"
|
|
48
|
-
) || "push"),
|
|
49
|
-
const
|
|
50
|
-
s(this,
|
|
52
|
+
) || "push"), e(this, o).addEventListener("click", e(this, C));
|
|
53
|
+
const n = s.normalizePath(e(this, g)), i = s.normalizePath(location.pathname);
|
|
54
|
+
l(this, A, (c = e(this, o).getAttribute("data-match-paths")) == null ? void 0 : c.split(",").map((u) => s.normalizePath(u.trim()).pathname)), e(this, o).hasAttribute("data-include") ? i.pathname.includes(n.pathname) && e(this, o).classList.add("current") : n.pathname === i.pathname || (f = e(this, A)) != null && f.includes(i.pathname) ? (e(this, o).classList.add("current"), e(this, o).classList.add("clicked")) : e(this, o).classList.remove("clicked"), e(this, o).hasAttribute("data-prefetch") && e(this, o).addEventListener("pointerenter", e(this, M));
|
|
51
55
|
}
|
|
52
56
|
destroy() {
|
|
53
|
-
|
|
57
|
+
e(this, o).removeEventListener("click", e(this, C)), e(this, o).removeEventListener("pointerenter", e(this, M)), e(this, o).classList.remove("current");
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
|
-
|
|
57
|
-
var E,
|
|
58
|
-
class
|
|
60
|
+
y = new WeakMap(), o = new WeakMap(), g = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), M = new WeakMap();
|
|
61
|
+
var E, S, z, W, H, K, P, b, w, x, D, R, V, F, X, I, Z, Y, ct, $, _, j;
|
|
62
|
+
class wt {
|
|
59
63
|
constructor(t) {
|
|
60
|
-
a(this, D);
|
|
61
64
|
a(this, R);
|
|
62
65
|
a(this, F);
|
|
63
|
-
a(this, B);
|
|
64
66
|
a(this, I);
|
|
67
|
+
a(this, Y);
|
|
68
|
+
a(this, $);
|
|
65
69
|
a(this, E, null);
|
|
66
|
-
a(this, C, null);
|
|
67
70
|
a(this, S, null);
|
|
68
|
-
a(this,
|
|
69
|
-
a(this,
|
|
70
|
-
a(this,
|
|
71
|
-
a(this,
|
|
72
|
-
a(this,
|
|
73
|
-
a(this, b,
|
|
74
|
-
a(this,
|
|
71
|
+
a(this, z, null);
|
|
72
|
+
a(this, W, null);
|
|
73
|
+
a(this, H, []);
|
|
74
|
+
a(this, K, new DOMParser());
|
|
75
|
+
a(this, P, /* @__PURE__ */ new Map());
|
|
76
|
+
a(this, b, void 0);
|
|
77
|
+
a(this, w, null);
|
|
75
78
|
a(this, x, new ot());
|
|
76
|
-
a(this,
|
|
79
|
+
a(this, D, new ot());
|
|
80
|
+
a(this, j, (t) => {
|
|
77
81
|
t.state && this.navigate(t.state, "none");
|
|
78
82
|
});
|
|
79
|
-
|
|
83
|
+
pt && (l(this, E, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (l(this, E, t.base), t.base.endsWith("/") || l(this, E, e(this, E) + "/")) : l(this, E, "/"), l(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), l(this, z, (t == null ? void 0 : t.cachePages) !== !1), l(this, W, p(this, I, Z).call(this, document.body)), l(this, w, this.normalizePath(location.pathname).pathname), document.documentElement.setAttribute(
|
|
80
84
|
"data-current-pathname",
|
|
81
|
-
|
|
82
|
-
), p(this,
|
|
85
|
+
e(this, w)
|
|
86
|
+
), p(this, F, X).call(this), addEventListener("popstate", e(this, j)));
|
|
83
87
|
}
|
|
84
88
|
get currentPathname() {
|
|
85
|
-
return
|
|
89
|
+
return e(this, w);
|
|
90
|
+
}
|
|
91
|
+
get links() {
|
|
92
|
+
return e(this, H);
|
|
86
93
|
}
|
|
87
94
|
normalizePath(t) {
|
|
88
|
-
t = t.replace(
|
|
89
|
-
const
|
|
95
|
+
t = t.replace(e(this, E), ""), t.startsWith("/") && (t = t.slice(1));
|
|
96
|
+
const s = t.split("#"), n = s[0].split("?"), i = n[0].endsWith("/") ? n[0].slice(0, -1) : n[0], c = e(this, E) + i, f = n == null ? void 0 : n[1], u = s == null ? void 0 : s[1];
|
|
90
97
|
return {
|
|
91
98
|
leaf: i,
|
|
92
|
-
pathname:
|
|
99
|
+
pathname: c,
|
|
93
100
|
parameters: f,
|
|
94
101
|
hash: u
|
|
95
102
|
};
|
|
96
103
|
}
|
|
97
104
|
beforeNavigationEvent(t) {
|
|
98
|
-
return
|
|
105
|
+
return e(this, x).subscribe(t);
|
|
99
106
|
}
|
|
100
107
|
afterNavigationEvent(t) {
|
|
101
|
-
return
|
|
108
|
+
return e(this, D).subscribe(t);
|
|
102
109
|
}
|
|
103
110
|
prefetch(t) {
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
return p(this,
|
|
111
|
+
return T(this, null, function* () {
|
|
112
|
+
const s = this.normalizePath(t);
|
|
113
|
+
return p(this, R, V).call(this, s.pathname);
|
|
107
114
|
});
|
|
108
115
|
}
|
|
109
|
-
navigate(t,
|
|
110
|
-
return
|
|
116
|
+
navigate(t, s = "push") {
|
|
117
|
+
return T(this, null, function* () {
|
|
111
118
|
var d;
|
|
112
|
-
const
|
|
113
|
-
let { pathname: i, hash:
|
|
114
|
-
if (
|
|
119
|
+
const n = this.normalizePath(t);
|
|
120
|
+
let { pathname: i, hash: c, parameters: f } = n;
|
|
121
|
+
if (e(this, b) === i || e(this, w) === i)
|
|
115
122
|
return;
|
|
116
|
-
|
|
117
|
-
const u =
|
|
123
|
+
l(this, b, i);
|
|
124
|
+
const u = e(this, P).has(i);
|
|
118
125
|
try {
|
|
119
126
|
let m = !0;
|
|
120
|
-
if (
|
|
127
|
+
if (e(this, x).notify({
|
|
121
128
|
pathname: i,
|
|
122
129
|
isCached: u
|
|
123
130
|
}), this.preprocessor)
|
|
124
131
|
try {
|
|
125
|
-
yield new Promise((
|
|
126
|
-
var
|
|
127
|
-
(
|
|
132
|
+
yield new Promise((h, L) => {
|
|
133
|
+
var v;
|
|
134
|
+
(v = this.preprocessor) == null || v.call(this, { pathname: i, resolve: h, reject: L, isCached: u });
|
|
128
135
|
});
|
|
129
|
-
} catch (
|
|
130
|
-
|
|
136
|
+
} catch (h) {
|
|
137
|
+
h ? console.error(h) : console.log("Route change canceled"), m = !1;
|
|
131
138
|
}
|
|
132
|
-
if (!m ||
|
|
139
|
+
if (!m || e(this, b) !== i)
|
|
133
140
|
return;
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
141
|
+
const tt = e(this, P).get(i) || (yield p(this, R, V).call(this, i));
|
|
142
|
+
if (e(this, b) !== i)
|
|
136
143
|
return;
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
),
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
+
const et = Array.from(document.head.children), st = Array.from(
|
|
145
|
+
tt.head.cloneNode(!0).children
|
|
146
|
+
), it = p(this, Y, ct).call(this, et, st), lt = p(this, $, _).call(this, et, it), q = p(this, $, _).call(this, st, it);
|
|
147
|
+
q.forEach((h, L) => {
|
|
148
|
+
if (h.tagName === "SCRIPT" && h.getAttribute("src")) {
|
|
149
|
+
const v = document.createElement("script");
|
|
150
|
+
v.type = "module", v.src = h.getAttribute("src"), q[L] = v;
|
|
144
151
|
}
|
|
145
|
-
}),
|
|
146
|
-
document.head.appendChild(
|
|
152
|
+
}), q.forEach((h) => {
|
|
153
|
+
document.head.appendChild(h);
|
|
147
154
|
});
|
|
148
|
-
const
|
|
149
|
-
(
|
|
155
|
+
const G = q.filter(
|
|
156
|
+
(h) => h.tagName === "STYLE" || h.tagName === "SCRIPT" || h.tagName === "LINK"
|
|
150
157
|
);
|
|
151
|
-
|
|
152
|
-
let
|
|
158
|
+
e(this, S) && G.length && (yield new Promise((h) => T(this, null, function* () {
|
|
159
|
+
let L = 0;
|
|
153
160
|
try {
|
|
154
|
-
for (var
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
for (var v = ht(G), mt, J, B; mt = !(J = yield v.next()).done; mt = !1) {
|
|
162
|
+
const N = J.value;
|
|
163
|
+
N.onload = () => {
|
|
164
|
+
L++, L === G.length && h();
|
|
158
165
|
};
|
|
159
166
|
}
|
|
160
|
-
} catch (
|
|
161
|
-
|
|
167
|
+
} catch (J) {
|
|
168
|
+
B = [J];
|
|
162
169
|
} finally {
|
|
163
170
|
try {
|
|
164
|
-
|
|
171
|
+
mt && (J = v.return) && (yield J.call(v));
|
|
165
172
|
} finally {
|
|
166
|
-
if (
|
|
167
|
-
throw
|
|
173
|
+
if (B)
|
|
174
|
+
throw B[0];
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
|
-
}))),
|
|
171
|
-
|
|
172
|
-
}),
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
let
|
|
183
|
-
|
|
184
|
-
(
|
|
185
|
-
),
|
|
177
|
+
}))), lt.forEach((h) => {
|
|
178
|
+
h.hasAttribute("data-permanent") || h.remove();
|
|
179
|
+
}), l(this, w, i);
|
|
180
|
+
const O = f || location.search, ut = c ? c.startsWith("#") ? c : "#" + c : "", dt = O ? O.startsWith("?") ? O : "?" + O : "", nt = `${i}${ut}${dt}`;
|
|
181
|
+
s === "push" ? history.pushState(i, "", nt) : s === "replace" && history.replaceState(i, "", nt);
|
|
182
|
+
const ft = p(this, I, Z).call(this, tt.body.cloneNode(!0));
|
|
183
|
+
e(this, W).forEach((h, L) => {
|
|
184
|
+
const v = ft[L];
|
|
185
|
+
let mt = [...h.childNodes], J = [...v.childNodes];
|
|
186
|
+
mt.forEach((B) => {
|
|
187
|
+
if (B instanceof HTMLElement) {
|
|
188
|
+
const N = B.getAttribute("data-remain");
|
|
189
|
+
let rt;
|
|
190
|
+
J = J.filter(
|
|
191
|
+
(Q) => Q instanceof HTMLElement && N && Q.getAttribute("data-remain") === N ? (rt = Q, !1) : !0
|
|
192
|
+
), N && rt || B.remove();
|
|
186
193
|
} else
|
|
187
|
-
|
|
188
|
-
}),
|
|
189
|
-
}), p(this,
|
|
194
|
+
B.remove();
|
|
195
|
+
}), h.append(...J);
|
|
196
|
+
}), p(this, F, X).call(this), document.documentElement.setAttribute("data-current-pathname", i), (d = this.postprocessor) == null || d.call(this, { pathname: i, isCached: u }), e(this, D).notify({ pathname: i, isCached: u });
|
|
190
197
|
} catch (m) {
|
|
191
198
|
console.error(m);
|
|
192
199
|
}
|
|
193
|
-
|
|
200
|
+
l(this, b, void 0);
|
|
194
201
|
});
|
|
195
202
|
}
|
|
196
203
|
}
|
|
197
|
-
E = new WeakMap(),
|
|
198
|
-
return
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
return
|
|
202
|
-
const i = yield (yield fetch(t)).text(),
|
|
203
|
-
return
|
|
204
|
+
E = new WeakMap(), S = new WeakMap(), z = new WeakMap(), W = new WeakMap(), H = new WeakMap(), K = new WeakMap(), P = new WeakMap(), b = new WeakMap(), w = new WeakMap(), x = new WeakMap(), D = new WeakMap(), R = new WeakSet(), V = function(t) {
|
|
205
|
+
return T(this, null, function* () {
|
|
206
|
+
const s = e(this, P).get(t);
|
|
207
|
+
if (s)
|
|
208
|
+
return s;
|
|
209
|
+
const i = yield (yield fetch(t)).text(), c = e(this, K).parseFromString(i, "text/html");
|
|
210
|
+
return e(this, z) && e(this, P).set(t, c), c;
|
|
204
211
|
});
|
|
205
|
-
},
|
|
212
|
+
}, F = new WeakSet(), X = function() {
|
|
206
213
|
const t = [
|
|
207
214
|
...document.documentElement.querySelectorAll("a")
|
|
208
|
-
].filter((
|
|
209
|
-
var
|
|
210
|
-
return (
|
|
215
|
+
].filter((s) => {
|
|
216
|
+
var n;
|
|
217
|
+
return (n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/");
|
|
211
218
|
});
|
|
212
|
-
|
|
213
|
-
},
|
|
219
|
+
e(this, H).forEach((s) => s.destroy()), l(this, H, t.map((s) => new gt(s, this)));
|
|
220
|
+
}, I = new WeakSet(), Z = function(t) {
|
|
214
221
|
return [...t.querySelectorAll("[data-morph]")];
|
|
215
|
-
},
|
|
222
|
+
}, Y = new WeakSet(), ct = function(t, s) {
|
|
216
223
|
return t.filter(
|
|
217
|
-
(
|
|
218
|
-
(i) => i.outerHTML ===
|
|
224
|
+
(n) => s.find(
|
|
225
|
+
(i) => i.outerHTML === n.outerHTML
|
|
219
226
|
)
|
|
220
227
|
);
|
|
221
|
-
},
|
|
228
|
+
}, $ = new WeakSet(), _ = function(t, s) {
|
|
222
229
|
return t.filter(
|
|
223
|
-
(
|
|
224
|
-
(i) => i.outerHTML ===
|
|
230
|
+
(n) => !s.find(
|
|
231
|
+
(i) => i.outerHTML === n.outerHTML
|
|
225
232
|
)
|
|
226
233
|
);
|
|
227
|
-
},
|
|
234
|
+
}, j = new WeakMap();
|
|
228
235
|
export {
|
|
229
|
-
|
|
236
|
+
wt as Morph
|
|
230
237
|
};
|