aptechka 0.73.3 → 0.74.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/masonry-layout/index.cjs +1 -1
- package/lib/masonry-layout/index.js +49 -35
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +57 -58
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=
|
|
1
|
+
"use strict";var v=e=>{throw TypeError(e)};var p=(e,s,t)=>s.has(e)||v("Cannot "+t);var o=(e,s,t)=>(p(e,s,"read from private field"),t?t.call(e):s.get(e)),c=(e,s,t)=>s.has(e)?v("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),f=(e,s,t,i)=>(p(e,s,"write to private field"),i?i.call(e,t):s.set(e,t),t),m=(e,s,t)=>(p(e,s,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../css-property/index.cjs"),C=require("../index-DekP7OZe.cjs"),x=require("../events-KVanG9sR.cjs"),R=require("../stylesheet-HWF2a3nr.cjs");var l,u,a,h,y,d,b;class E extends HTMLElement{constructor(){super();c(this,d);c(this,l,new w.CSSProperty(this,"--distribute-rule","default",{skipSubscribeNotification:!0}));c(this,u,new w.CSSProperty(this,"--columns",2));c(this,a,[]);c(this,h,null);c(this,y,()=>{m(this,d,b).call(this)});const t=this.attachShadow({mode:"open"});t.adoptedStyleSheets=[R.createStylesheet({":host":{display:"grid",gridTemplateColumns:"repeat(var(--columns), 1fr)"},".column":{display:"grid",width:"100%",gap:"var(--gap, 0rem)",gridAutoRows:"max-content"}})]}get columnElements(){return o(this,a)}connectedCallback(){f(this,h,new MutationObserver(o(this,y))),o(this,h).observe(this,{childList:!0}),o(this,l).subscribe(()=>{m(this,d,b).call(this)}),o(this,u).subscribe(t=>{var i;this.shadowRoot.innerHTML="",f(this,a,[]);for(let n=0;n<t.current;n++){const r=document.createElement("div");r.classList.add("column"),r.innerHTML=`<slot name="col-${n}"></slot>`,o(this,a).push(r),(i=this.shadowRoot)==null||i.appendChild(r)}m(this,d,b).call(this)}),o(this,l).observe(),o(this,u).observe()}disconnectedCallback(){o(this,u).close(),o(this,h).disconnect(),this.classList.remove("distributed")}}l=new WeakMap,u=new WeakMap,a=new WeakMap,h=new WeakMap,y=new WeakMap,d=new WeakSet,b=function(){const t=[...this.children],i=o(this,u).current;o(this,l).current==="chessboard"&&i%2===0?t.forEach((n,r)=>{const L=Math.floor(r/i),S=r%i,g=L%2,M=(S+g)%i;n.slot=`col-${M}`}):o(this,l).current==="default"&&t.forEach((n,r)=>{n.slot=`col-${r%i}`}),this.classList.add("distributed"),x.dispatchEvent(this,"masonryLayoutDistributed",{custom:!0})};C.isBrowser&&!customElements.get("e-masonry-layout")&&customElements.define("e-masonry-layout",E);exports.MasonryLayoutElement=E;
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var w = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var o = (
|
|
6
|
-
import { CSSProperty as
|
|
7
|
-
import { i as
|
|
8
|
-
import { d as
|
|
9
|
-
import { c as
|
|
10
|
-
var
|
|
11
|
-
class
|
|
4
|
+
var f = (s, e, t) => e.has(s) || w("Cannot " + t);
|
|
5
|
+
var o = (s, e, t) => (f(s, e, "read from private field"), t ? t.call(s) : e.get(s)), c = (s, e, t) => e.has(s) ? w("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), y = (s, e, t, i) => (f(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), m = (s, e, t) => (f(s, e, "access private method"), t);
|
|
6
|
+
import { CSSProperty as v } from "../css-property/index.js";
|
|
7
|
+
import { i as M } from "../index-Bv9zgfdb.js";
|
|
8
|
+
import { d as C } from "../events-CsVF98U6.js";
|
|
9
|
+
import { c as R } from "../stylesheet-DpnWNVyD.js";
|
|
10
|
+
var l, a, h, u, b, d, p;
|
|
11
|
+
class x extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
c(this, d);
|
|
15
|
+
c(this, l, new v(
|
|
16
|
+
this,
|
|
17
|
+
"--distribute-rule",
|
|
18
|
+
"default",
|
|
19
|
+
{
|
|
20
|
+
skipSubscribeNotification: !0
|
|
21
|
+
}
|
|
22
|
+
));
|
|
23
|
+
c(this, a, new v(this, "--columns", 2));
|
|
24
|
+
c(this, h, []);
|
|
25
|
+
c(this, u, null);
|
|
26
|
+
c(this, b, () => {
|
|
27
|
+
m(this, d, p).call(this);
|
|
20
28
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const t = this.attachShadow({ mode: "open" });
|
|
30
|
+
t.adoptedStyleSheets = [
|
|
31
|
+
R({
|
|
24
32
|
":host": {
|
|
25
33
|
display: "grid",
|
|
26
34
|
gridTemplateColumns: "repeat(var(--columns), 1fr)"
|
|
@@ -35,31 +43,37 @@ class w extends HTMLElement {
|
|
|
35
43
|
];
|
|
36
44
|
}
|
|
37
45
|
get columnElements() {
|
|
38
|
-
return o(this,
|
|
46
|
+
return o(this, h);
|
|
39
47
|
}
|
|
40
48
|
connectedCallback() {
|
|
41
|
-
|
|
49
|
+
y(this, u, new MutationObserver(o(this, b))), o(this, u).observe(this, {
|
|
42
50
|
childList: !0
|
|
43
|
-
}), o(this,
|
|
51
|
+
}), o(this, l).subscribe(() => {
|
|
52
|
+
m(this, d, p).call(this);
|
|
53
|
+
}), o(this, a).subscribe((t) => {
|
|
44
54
|
var i;
|
|
45
|
-
this.shadowRoot.innerHTML = "",
|
|
46
|
-
for (let
|
|
47
|
-
const
|
|
48
|
-
|
|
55
|
+
this.shadowRoot.innerHTML = "", y(this, h, []);
|
|
56
|
+
for (let n = 0; n < t.current; n++) {
|
|
57
|
+
const r = document.createElement("div");
|
|
58
|
+
r.classList.add("column"), r.innerHTML = `<slot name="col-${n}"></slot>`, o(this, h).push(r), (i = this.shadowRoot) == null || i.appendChild(r);
|
|
49
59
|
}
|
|
50
|
-
|
|
51
|
-
}), o(this,
|
|
60
|
+
m(this, d, p).call(this);
|
|
61
|
+
}), o(this, l).observe(), o(this, a).observe();
|
|
52
62
|
}
|
|
53
63
|
disconnectedCallback() {
|
|
54
|
-
o(this,
|
|
64
|
+
o(this, a).close(), o(this, u).disconnect(), this.classList.remove("distributed");
|
|
55
65
|
}
|
|
56
66
|
}
|
|
57
|
-
|
|
58
|
-
[...this.children]
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
l = new WeakMap(), a = new WeakMap(), h = new WeakMap(), u = new WeakMap(), b = new WeakMap(), d = new WeakSet(), p = function() {
|
|
68
|
+
const t = [...this.children], i = o(this, a).current;
|
|
69
|
+
o(this, l).current === "chessboard" && i % 2 === 0 ? t.forEach((n, r) => {
|
|
70
|
+
const E = Math.floor(r / i), L = r % i, g = E % 2, S = (L + g) % i;
|
|
71
|
+
n.slot = `col-${S}`;
|
|
72
|
+
}) : o(this, l).current === "default" && t.forEach((n, r) => {
|
|
73
|
+
n.slot = `col-${r % i}`;
|
|
74
|
+
}), this.classList.add("distributed"), C(this, "masonryLayoutDistributed", { custom: !0 });
|
|
61
75
|
};
|
|
62
|
-
|
|
76
|
+
M && !customElements.get("e-masonry-layout") && customElements.define("e-masonry-layout", x);
|
|
63
77
|
export {
|
|
64
|
-
|
|
78
|
+
x as MasonryLayoutElement
|
|
65
79
|
};
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var se=Object.defineProperty,ae=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var Wt=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Xt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),jt=o=>{throw TypeError(o)};var Yt=(o,e,i)=>e in o?se(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,gt=(o,e)=>{for(var i in e||(e={}))re.call(e,i)&&Yt(o,i,e[i]);if(Wt)for(var i of Wt(e))oe.call(e,i)&&Yt(o,i,e[i]);return o},At=(o,e)=>ae(o,ne(e));var Pt=(o,e,i)=>e.has(o)||jt("Cannot "+i);var t=(o,e,i)=>(Pt(o,e,"read from private field"),i?i.call(o):e.get(o)),l=(o,e,i)=>e.has(o)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,i),r=(o,e,i,s)=>(Pt(o,e,"write to private field"),s?s.call(o,i):e.set(o,i),i),p=(o,e,i)=>(Pt(o,e,"access private method"),i);var W=(o,e,i)=>new Promise((s,h)=>{var v=d=>{try{L(i.next(d))}catch(E){h(E)}},g=d=>{try{L(i.throw(d))}catch(E){h(E)}},L=d=>d.done?s(d.value):Promise.resolve(d.value).then(v,g);L((i=i.apply(o,e)).next())});var Kt=(o,e,i)=>(e=o[Xt("asyncIterator")])?e.call(o):(o=o[Xt("iterator")](),e={},i=(s,h)=>(h=o[s])&&(e[s]=v=>new Promise((g,L,d)=>(v=h.call(o,v),d=v.done,Promise.resolve(v.value).then(E=>g({value:E,done:d}),L)))),i("next"),i("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),le=require("../polyfills-Df4r-ETT.cjs"),$t=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const at=require("../url-DGcX4fGV.cjs"),he=require("../css-value-parser/index.cjs");class Qt extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[i,s]of Object.entries(e))this.setAttribute(i,s)}}Jt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Qt);var P,a,I,J,Et,rt,Q;class Ct{constructor(e,i){l(this,J);l(this,P);l(this,a);l(this,I);l(this,rt,e=>{var s;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,P).previousURL)history.back();else{r(this,I,t(this,a).getAttribute("href")||"/");const h=t(this,a).getAttribute("data-history-action")||"push",v=t(this,a).hasAttribute("data-center-scroll"),g=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),L=g?he.cssValueParser.parse(g):void 0,d=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),E=t(this,a).hasAttribute("data-keep-search-parameters"),bt=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),Lt=t(this,a).getAttribute("data-scroll-behaviour"),ut=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));ut&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,P).links.forEach(q=>{q.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),ut.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,P).links.forEach(q=>{q.updatePagination(ut.currentPage+1,ut.selector)}));const dt=((s=t(this,a).getAttribute("data-submorph"))==null?void 0:s.split(",").map(q=>q.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,c=t(this,a).hasAttribute("data-clear-state");t(this,P).navigate(t(this,I),{historyAction:h,centerScroll:v,offsetScroll:L,revalidate:d,keepSearchParameters:E,submorph:dt,clearState:c,keepScrollPosition:bt,scrollBehaviour:Lt,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link")})}});l(this,Q,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,P).prefetch(t(this,I),e),t(this,a).removeEventListener("pointerenter",t(this,Q))});r(this,P,i),r(this,a,e),t(this,a).addEventListener("click",t(this,rt)),r(this,I,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const s=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));s&&this.updatePagination(s.currentPage,s.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,Q))}get element(){return t(this,a)}checkCurrent(e){var h;const i=t(this,P).normalizePath(e),s=t(this,P).normalizePath(t(this,I));t(this,a).hasAttribute("data-include")&&i.pathname.includes(s.pathname)?t(this,a).classList.add("current"):s.pathname===i.pathname?t(this,a).classList.add("current"):(h=t(this,a).getAttribute("data-associated-paths"))!=null&&h.split(",").find(v=>i.pathname.includes(v))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),i.path===s.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact")}updatePagination(e,i){const s=p(this,J,Et).call(this,i);if(s)if(s.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<s.totalPages){t(this,a).style.display="";const h=t(this,a).querySelector("[data-pagination-more-link-counter]");h&&(h.textContent=(s.totalPages-e).toString());const v=t(this,a).getAttribute("href"),g=new URL(v,window.location.origin);g.searchParams.set("page",(e+1).toString());const L=g.href.replace(g.origin,"").toString();t(this,a).setAttribute("href",L),this.checkCurrent(L)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,rt)),t(this,a).removeEventListener("pointerenter",t(this,Q)),t(this,a).classList.remove("current","exact","pagination-current")}}P=new WeakMap,a=new WeakMap,I=new WeakMap,J=new WeakSet,Et=function(e){if(!e)return;const i=document.querySelector(e);if(i){const s=parseInt(i.getAttribute("data-current-page")||"1"),h=parseInt(i.getAttribute("data-total-pages")||"1");return{element:i,currentPage:s,totalPages:h,selector:e}}},rt=new WeakMap,Q=new WeakMap;const ce=new DOMParser;var T,X,k,x,Y,z,Z,j,V,ot;class Gt{constructor(e,i){l(this,T);l(this,X);l(this,k,{x:0,y:0});l(this,x,null);l(this,Y,null);l(this,z,null);l(this,Z,null);l(this,j,null);l(this,V,null);l(this,ot);r(this,T,e),r(this,X,i)}get pathname(){return t(this,X)}get scrollState(){return t(this,k)}get document(){return t(this,z)}setHeaders(e){r(this,ot,e)}setInitialDocument(e){r(this,x,e.cloneNode(!0))}abort(){var e;return(e=t(this,j))==null?void 0:e.abort(`[${t(this,X)}] page loading cancelled`)}fetch(e,i,s){return W(this,null,function*(){var h;if(!s){const L=((h=t(this,x))==null?void 0:h.documentElement.getAttribute("data-cache"))&&i!==e,d=t(this,x)&&t(this,T).isPopstateNavigation;if(t(this,V)||L||d)return t(this,V)}return r(this,V,new Promise(v=>W(this,null,function*(){try{r(this,j,new AbortController);const L=yield(yield fetch(e,{signal:t(this,j).signal,headers:gt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(i),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,ot))})).text(),d=ce.parseFromString(L,"text/html");this.setInitialDocument(d)}catch(g){console.warn(g)}finally{r(this,j,null),r(this,V,null),v()}}))),t(this,V)})}cloneDocument(){r(this,z,(t(this,Y)||t(this,x)).cloneNode(!0))}get title(){let e="";if(t(this,z).title)e=t(this,z).title;else{const i=t(this,z).querySelector("h1");e=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||t(this,X)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){r(this,Y,null)}saveScrollState(){t(this,x).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,T).scrollValue.left,t(this,k).y=t(this,T).scrollValue.top)}restoreScrollPosition(){t(this,T).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,x).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){t(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,Z,e)}clearState(){const e=t(this,Z);return r(this,Z,null),e}}T=new WeakMap,X=new WeakMap,k=new WeakMap,x=new WeakMap,Y=new WeakMap,z=new WeakMap,Z=new WeakMap,j=new WeakMap,V=new WeakMap,ot=new WeakMap;var R,_,y,O,f,K,F,B,C,lt,N,$,tt,et,ht,it,m,Rt,ct,vt,Mt,Zt,Tt,xt,Nt,qt,St,st;const nt=class nt{constructor(e){l(this,m);l(this,R,null);l(this,_,null);l(this,y,[]);l(this,O);l(this,f,null);l(this,K);l(this,F,[]);l(this,B,!1);l(this,C,null);l(this,lt,!1);l(this,N,new Map);l(this,$,null);l(this,tt,0);l(this,et,0);l(this,ht);l(this,it);l(this,ct,e=>{var i;return((i=e.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,St,e=>W(this,null,function*(){e.preventDefault(),r(this,B,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,it)?void 0:t(this,ht),revalidate:t(this,it)}),r(this,B,!1)}));l(this,st,()=>{const{left:e,top:i}=this.scrollValue,s=i-t(this,et),h=e-t(this,tt);r(this,et,i),r(this,tt,e),document.documentElement.classList.toggle("scroll-y",i>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",s>0),document.documentElement.classList.toggle("scroll-y-backward",s<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),M.dispatchEvent(document,"morphScroll",{detail:{left:e,top:i}})});if(Jt.isBrowser&&!nt.instance){nt.instance=this,r(this,R,{base:at.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,_,p(this,m,Mt).call(this,document.body));const i=this.normalizePath(location.pathname+location.search+location.hash);r(this,f,i);const s=new Gt(this,t(this,f).pathname);s.setInitialDocument(document),t(this,N).set(t(this,f).pathname,s),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",t(this,St)),at.changeHistory({action:"replace",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash}),r(this,$,new Qt),p(this,m,Nt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,K)}get links(){return t(this,y)}get scrollElement(){return t(this,C)}get isPopstateNavigation(){return t(this,B)}get scrollValue(){let e=0,i=0;return t(this,lt)?(e=window.scrollY,i=window.scrollX):(e=t(this,C).scrollTop,i=t(this,C).scrollLeft),{top:e,left:i}}saveState(e){const i=t(this,N).get(t(this,f).path);i&&i.saveState(e)}getState(){const e=t(this,N).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e){return at.splitPath(e,{base:t(this,R).base,trailingSlash:t(this,R).trailingSlash})}prefetch(e,i){return W(this,null,function*(){var h;if(t(this,F).length)return;e=((h=this.pathnameModifier)==null?void 0:h.call(this,e))||e;const s=p(this,m,vt).call(this,e);s==null||s.fetch(e,t(this,f).path,i)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(ut){return W(this,arguments,function*(e,{historyAction:i="push",centerScroll:s,offsetScroll:h,scrollBehaviour:v,revalidate:g,keepSearchParameters:L,submorph:d,submorphAppend:E,clearState:bt,keepScrollPosition:Lt}={}){var q,Ut,Dt,It;if(t(this,F).length)return;r(this,ht,d),r(this,it,g);const dt=((q=this.pathnameModifier)==null?void 0:q.call(this,e))||e,c=this.normalizePath(dt);if(t(this,y).forEach(G=>{G.checkCurrent(c.path)}),!g&&(((Ut=t(this,O))==null?void 0:Ut.pathname)===c.pathname||t(this,f).pathname===c.pathname)){p(this,m,qt).call(this,c.hash||0,{centerScroll:s,offsetScroll:h,behavior:"smooth"}),M.dispatchEvent(document,"morphSamePath",{custom:!0}),((Dt=t(this,f))==null?void 0:Dt.parameters)!==c.parameters&&(r(this,K,t(this,f)),r(this,f,c),at.changeHistory({action:((It=t(this,f))==null?void 0:It.hash)!==c.hash?"replace":i,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),M.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,K)}}));return}r(this,O,c);try{let G=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var A;(A=this.preprocessor)==null||A.call(this,{url:c,resolve:n,reject:w,submorph:d})})}catch(n){n?console.error(n):console.log("Route change canceled"),G=!1}if(!G||t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}const zt={url:c,submorph:d};d?E||d.forEach(n=>{document.querySelectorAll(n).forEach(w=>{w.classList.add("out"),w.setAttribute("data-morph-out","")})}):t(this,_).forEach(n=>{var w,A;(w=n.firstElementChild)==null||w.classList.add("out"),(A=n.firstElementChild)==null||A.setAttribute("data-morph-out","")}),M.dispatchEvent(document,"morphNavigation",{detail:zt});const yt=p(this,m,vt).call(this,t(this,f).pathname),S=p(this,m,vt).call(this,c.pathname);if(t(this,N).forEach(n=>{n.pathname!==c.pathname&&n.abort()}),yield S==null?void 0:S.fetch(dt,t(this,f).path,g),t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}yt.clearState(),yt.saveScrollState(),yt.saveDocumentState(),(!t(this,B)||g)&&(S.clearScrollState(),S.clearDocumentState()),bt&&S.clearState(),S.cloneDocument(),t(this,$).textContent=S.title,document.body.appendChild(t(this,$));const mt=At(gt({},zt),{document:S.document});E||mt.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),M.dispatchEvent(document,"morphStart",{detail:mt});const Vt=Array.from(document.head.children),Ot=Array.from(S.document.head.children),Ft=p(this,m,Zt).call(this,Vt,Ot),_t=p(this,m,Tt).call(this,Vt,Ft),ft=p(this,m,Tt).call(this,Ot,Ft).filter(n=>!this.excludeHeadChild(n));ft.forEach((n,w)=>{n.tagName==="SCRIPT"&&(ft[w]=p(this,m,Rt).call(this,n))}),ft.forEach(n=>{document.head.appendChild(n)});const wt=ft.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(p(this,m,xt).call(this,n))return!0});t(this,R).waitForHeadToLoad&&wt.length&&(yield new Promise(n=>W(this,null,function*(){let w=0;try{for(var A=Kt(wt),ee,U,H;ee=!(U=yield A.next()).done;ee=!1){const pt=U.value;pt.onload=()=>{w++,w===wt.length&&n()}}}catch(U){H=[U]}finally{try{ee&&(U=A.return)&&(yield U.call(A))}finally{if(H)throw H[0]}}}))),yield $t.wait(10);const Bt=[];E||_t.forEach(n=>{n.hasAttribute("data-permanent")||(p(this,m,xt).call(this,n)?Bt.push(n):n.remove())});const te=p(this,m,Mt).call(this,S.document.body);!t(this,R).morphInsideScrollContainer&&!d&&p(this,m,Nt).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),at.changeHistory({action:i,pathname:c.pathname,searchParameters:c.parameters||(L?location.search:""),hash:c.hash}),t(this,$).remove(),r(this,K,t(this,f)),r(this,f,c);const kt=[];t(this,_).forEach((n,w)=>{const A=te[w],ee=getComputedStyle(n).getPropertyValue("--morph-duration");let U=[],H=[];d?(d.forEach(u=>{const b=n.querySelector(u),D=A.querySelector(u);b&&D&&(H.push(b),U.push(D))}),H.forEach(u=>{u.parentElement&&kt.push(u.parentElement)})):(U.push(...A.childNodes),H.push(...n.childNodes),kt.push(n)),E||H.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),U.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),d?E?U.forEach((u,b)=>{H[b]instanceof HTMLElement&&H[b].append(...u.childNodes)}):U.forEach((u,b)=>{var D;(D=H[b].parentElement)==null||D.insertBefore(u,H[b])}):n.prepend(...U),le.requestIdleCallback(()=>{E||H.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),U.forEach(u=>{var b;u instanceof HTMLElement&&((b=u.parentElement)==null||b.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})});const pt=At(gt({},mt),{morphElement:n});M.dispatchEvent(document,"morphNewChildrenAdded",{detail:pt});const ie=new Promise(u=>{setTimeout(()=>{E||H.forEach(b=>b.remove()),U.forEach(b=>{var D;b instanceof HTMLElement&&((D=b.parentElement)==null||D.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),E||M.dispatchEvent(document,"morphOldChildrenRemoved",{detail:pt}),u()},(parseFloat(ee)||0)*1e3+10)});t(this,F).push(ie)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-S.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),M.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:S.scrollState}),c.hash?(S.clearScrollState(),p(this,m,qt).call(this,c.hash,{centerScroll:s,offsetScroll:h,behavior:v})):t(this,B)?S.restoreScrollPosition():Lt||S.renewScrollPosition(),yield Promise.all(t(this,F)),E||Bt.forEach(n=>n.remove()),r(this,F,[]),kt.forEach(n=>{n.querySelectorAll("script").forEach(A=>{A.replaceWith(p(this,m,Rt).call(this,A))})}),t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)}),M.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(G){console.error(G)}r(this,O,void 0)})}addLink(e){t(this,y).push(new Ct(e,this))}addLinks(e){e.forEach(i=>{this.addLink(i)})}removeLink(e){r(this,y,t(this,y).filter(i=>i.element===e?(i.destroy(),!1):!0))}destroyOldLinks(e){r(this,y,t(this,y).filter(i=>e.contains(i.element)?(i.destroy(),!1):!0))}findNewLinks(e){const i=[...e.querySelectorAll("a")].filter(t(this,ct));t(this,y).push(...i.map(s=>new Ct(s,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,ct));t(this,y).forEach(i=>i.destroy()),r(this,y,e.map(i=>new Ct(i,this)))}};R=new WeakMap,_=new WeakMap,y=new WeakMap,O=new WeakMap,f=new WeakMap,K=new WeakMap,F=new WeakMap,B=new WeakMap,C=new WeakMap,lt=new WeakMap,N=new WeakMap,$=new WeakMap,tt=new WeakMap,et=new WeakMap,ht=new WeakMap,it=new WeakMap,m=new WeakSet,Rt=function(e){const i=document.createElement("script");for(let s=0;s<e.attributes.length;s++){const h=e.attributes[s];i.setAttribute(h.name,h.value)}return e.hasAttribute("src")||(i.innerHTML=e.innerHTML),i},ct=new WeakMap,vt=function(e){const i=this.normalizePath(e);let s=t(this,N).get(i.pathname);return s||(s=new Gt(this,i.pathname),t(this,N).set(i.pathname,s)),s},Mt=function(e){const i=[...e.querySelectorAll("[data-morph]")];return i.length?i:[e]},Zt=function(e,i){return e.filter(s=>i.find(h=>h.outerHTML===s.outerHTML))},Tt=function(e,i){return e.filter(s=>!i.find(h=>h.outerHTML===s.outerHTML))},xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Nt=function(e){var i,s;(i=t(this,C))==null||i.removeEventListener("scroll",t(this,st)),r(this,et,0),r(this,tt,0),r(this,C,t(this,R).scrollSelector&&e.querySelector(t(this,R).scrollSelector)||window),r(this,lt,t(this,C)===window),(s=t(this,C))==null||s.addEventListener("scroll",t(this,st)),t(this,st).call(this)},qt=function(e,i){const s=typeof e=="string"?document.getElementById(e):e;(typeof s=="number"||s)&&$t.scrollToElement(s,{scrollElement:t(this,C),behavior:(i==null?void 0:i.behavior)||"instant",center:i==null?void 0:i.centerScroll,offset:i==null?void 0:i.offsetScroll})},St=new WeakMap,st=new WeakMap,nt.instance=null;let Ht=nt;exports.Morph=Ht;
|
|
1
|
+
"use strict";var se=Object.defineProperty,ae=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var Wt=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Xt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),jt=o=>{throw TypeError(o)};var Yt=(o,e,i)=>e in o?se(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,gt=(o,e)=>{for(var i in e||(e={}))re.call(e,i)&&Yt(o,i,e[i]);if(Wt)for(var i of Wt(e))oe.call(e,i)&&Yt(o,i,e[i]);return o},kt=(o,e)=>ae(o,ne(e));var Pt=(o,e,i)=>e.has(o)||jt("Cannot "+i);var t=(o,e,i)=>(Pt(o,e,"read from private field"),i?i.call(o):e.get(o)),l=(o,e,i)=>e.has(o)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,i),r=(o,e,i,s)=>(Pt(o,e,"write to private field"),s?s.call(o,i):e.set(o,i),i),p=(o,e,i)=>(Pt(o,e,"access private method"),i);var W=(o,e,i)=>new Promise((s,h)=>{var v=d=>{try{L(i.next(d))}catch(E){h(E)}},g=d=>{try{L(i.throw(d))}catch(E){h(E)}},L=d=>d.done?s(d.value):Promise.resolve(d.value).then(v,g);L((i=i.apply(o,e)).next())});var Kt=(o,e,i)=>(e=o[Xt("asyncIterator")])?e.call(o):(o=o[Xt("iterator")](),e={},i=(s,h)=>(h=o[s])&&(e[s]=v=>new Promise((g,L,d)=>(v=h.call(o,v),d=v.done,Promise.resolve(v.value).then(E=>g({value:E,done:d}),L)))),i("next"),i("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),$t=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const at=require("../url-DGcX4fGV.cjs"),le=require("../css-value-parser/index.cjs");class Qt extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[i,s]of Object.entries(e))this.setAttribute(i,s)}}Jt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Qt);var P,a,I,J,Et,rt,Q;class Ct{constructor(e,i){l(this,J);l(this,P);l(this,a);l(this,I);l(this,rt,e=>{var s;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,P).previousURL)history.back();else{r(this,I,t(this,a).getAttribute("href")||"/");const h=t(this,a).getAttribute("data-history-action")||"push",v=t(this,a).hasAttribute("data-center-scroll"),g=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),L=g?le.cssValueParser.parse(g):void 0,d=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),E=t(this,a).hasAttribute("data-keep-search-parameters"),bt=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),Lt=t(this,a).getAttribute("data-scroll-behaviour"),ut=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));ut&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,P).links.forEach(U=>{U.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),ut.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,P).links.forEach(U=>{U.updatePagination(ut.currentPage+1,ut.selector)}));const dt=((s=t(this,a).getAttribute("data-submorph"))==null?void 0:s.split(",").map(U=>U.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,c=t(this,a).hasAttribute("data-clear-state");t(this,P).navigate(t(this,I),{historyAction:h,centerScroll:v,offsetScroll:L,revalidate:d,keepSearchParameters:E,submorph:dt,clearState:c,keepScrollPosition:bt,scrollBehaviour:Lt,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link")})}});l(this,Q,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,P).prefetch(t(this,I),e),t(this,a).removeEventListener("pointerenter",t(this,Q))});r(this,P,i),r(this,a,e),t(this,a).addEventListener("click",t(this,rt)),r(this,I,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const s=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));s&&this.updatePagination(s.currentPage,s.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,Q))}get element(){return t(this,a)}checkCurrent(e){var h;const i=t(this,P).normalizePath(e),s=t(this,P).normalizePath(t(this,I));t(this,a).hasAttribute("data-include")&&i.pathname.includes(s.pathname)?t(this,a).classList.add("current"):s.pathname===i.pathname?t(this,a).classList.add("current"):(h=t(this,a).getAttribute("data-associated-paths"))!=null&&h.split(",").find(v=>i.pathname.includes(v))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),i.path===s.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact")}updatePagination(e,i){const s=p(this,J,Et).call(this,i);if(s)if(s.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<s.totalPages){t(this,a).style.display="";const h=t(this,a).querySelector("[data-pagination-more-link-counter]");h&&(h.textContent=(s.totalPages-e).toString());const v=t(this,a).getAttribute("href"),g=new URL(v,window.location.origin);g.searchParams.set("page",(e+1).toString());const L=g.href.replace(g.origin,"").toString();t(this,a).setAttribute("href",L),this.checkCurrent(L)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,rt)),t(this,a).removeEventListener("pointerenter",t(this,Q)),t(this,a).classList.remove("current","exact","pagination-current")}}P=new WeakMap,a=new WeakMap,I=new WeakMap,J=new WeakSet,Et=function(e){if(!e)return;const i=document.querySelector(e);if(i){const s=parseInt(i.getAttribute("data-current-page")||"1"),h=parseInt(i.getAttribute("data-total-pages")||"1");return{element:i,currentPage:s,totalPages:h,selector:e}}},rt=new WeakMap,Q=new WeakMap;const he=new DOMParser;var T,X,A,x,Y,z,Z,j,V,ot;class Gt{constructor(e,i){l(this,T);l(this,X);l(this,A,{x:0,y:0});l(this,x,null);l(this,Y,null);l(this,z,null);l(this,Z,null);l(this,j,null);l(this,V,null);l(this,ot);r(this,T,e),r(this,X,i)}get pathname(){return t(this,X)}get scrollState(){return t(this,A)}get document(){return t(this,z)}setHeaders(e){r(this,ot,e)}setInitialDocument(e){r(this,x,e.cloneNode(!0))}abort(){var e;return(e=t(this,j))==null?void 0:e.abort(`[${t(this,X)}] page loading cancelled`)}fetch(e,i,s){return W(this,null,function*(){var h;if(!s){const L=((h=t(this,x))==null?void 0:h.documentElement.getAttribute("data-cache"))&&i!==e,d=t(this,x)&&t(this,T).isPopstateNavigation;if(t(this,V)||L||d)return t(this,V)}return r(this,V,new Promise(v=>W(this,null,function*(){try{r(this,j,new AbortController);const L=yield(yield fetch(e,{signal:t(this,j).signal,headers:gt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(i),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,ot))})).text(),d=he.parseFromString(L,"text/html");this.setInitialDocument(d)}catch(g){console.warn(g)}finally{r(this,j,null),r(this,V,null),v()}}))),t(this,V)})}cloneDocument(){r(this,z,(t(this,Y)||t(this,x)).cloneNode(!0))}get title(){let e="";if(t(this,z).title)e=t(this,z).title;else{const i=t(this,z).querySelector("h1");e=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||t(this,X)}return e}clearScrollState(){t(this,A).x=0,t(this,A).y=0}clearDocumentState(){r(this,Y,null)}saveScrollState(){t(this,x).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,A).x=0,t(this,A).y=0):(t(this,A).x=t(this,T).scrollValue.left,t(this,A).y=t(this,T).scrollValue.top)}restoreScrollPosition(){t(this,T).scrollElement.scroll({top:t(this,A).y,left:t(this,A).x,behavior:"instant"})}saveDocumentState(){t(this,x).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){t(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,Z,e)}clearState(){const e=t(this,Z);return r(this,Z,null),e}}T=new WeakMap,X=new WeakMap,A=new WeakMap,x=new WeakMap,Y=new WeakMap,z=new WeakMap,Z=new WeakMap,j=new WeakMap,V=new WeakMap,ot=new WeakMap;var R,_,y,O,f,K,F,B,C,lt,N,$,tt,et,ht,it,m,Rt,ct,vt,Mt,Zt,Tt,xt,Nt,Ut,St,st;const nt=class nt{constructor(e){l(this,m);l(this,R,null);l(this,_,null);l(this,y,[]);l(this,O);l(this,f,null);l(this,K);l(this,F,[]);l(this,B,!1);l(this,C,null);l(this,lt,!1);l(this,N,new Map);l(this,$,null);l(this,tt,0);l(this,et,0);l(this,ht);l(this,it);l(this,ct,e=>{var i;return((i=e.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,St,e=>W(this,null,function*(){e.preventDefault(),r(this,B,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,it)?void 0:t(this,ht),revalidate:t(this,it)}),r(this,B,!1)}));l(this,st,()=>{const{left:e,top:i}=this.scrollValue,s=i-t(this,et),h=e-t(this,tt);r(this,et,i),r(this,tt,e),document.documentElement.classList.toggle("scroll-y",i>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",s>0),document.documentElement.classList.toggle("scroll-y-backward",s<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),M.dispatchEvent(document,"morphScroll",{detail:{left:e,top:i}})});if(Jt.isBrowser&&!nt.instance){nt.instance=this,r(this,R,{base:at.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,_,p(this,m,Mt).call(this,document.body));const i=this.normalizePath(location.pathname+location.search+location.hash);r(this,f,i);const s=new Gt(this,t(this,f).pathname);s.setInitialDocument(document),t(this,N).set(t(this,f).pathname,s),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",t(this,St)),at.changeHistory({action:"replace",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash}),r(this,$,new Qt),p(this,m,Nt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,K)}get links(){return t(this,y)}get scrollElement(){return t(this,C)}get isPopstateNavigation(){return t(this,B)}get scrollValue(){let e=0,i=0;return t(this,lt)?(e=window.scrollY,i=window.scrollX):(e=t(this,C).scrollTop,i=t(this,C).scrollLeft),{top:e,left:i}}saveState(e){const i=t(this,N).get(t(this,f).path);i&&i.saveState(e)}getState(){const e=t(this,N).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e){return at.splitPath(e,{base:t(this,R).base,trailingSlash:t(this,R).trailingSlash})}prefetch(e,i){return W(this,null,function*(){var h;if(t(this,F).length)return;e=((h=this.pathnameModifier)==null?void 0:h.call(this,e))||e;const s=p(this,m,vt).call(this,e);s==null||s.fetch(e,t(this,f).path,i)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(ut){return W(this,arguments,function*(e,{historyAction:i="push",centerScroll:s,offsetScroll:h,scrollBehaviour:v,revalidate:g,keepSearchParameters:L,submorph:d,submorphAppend:E,clearState:bt,keepScrollPosition:Lt}={}){var U,qt,Dt,It;if(t(this,F).length)return;r(this,ht,d),r(this,it,g);const dt=((U=this.pathnameModifier)==null?void 0:U.call(this,e))||e,c=this.normalizePath(dt);if(t(this,y).forEach(G=>{G.checkCurrent(c.path)}),!g&&(((qt=t(this,O))==null?void 0:qt.pathname)===c.pathname||t(this,f).pathname===c.pathname)){p(this,m,Ut).call(this,c.hash||0,{centerScroll:s,offsetScroll:h,behavior:"smooth"}),M.dispatchEvent(document,"morphSamePath",{custom:!0}),((Dt=t(this,f))==null?void 0:Dt.parameters)!==c.parameters&&(r(this,K,t(this,f)),r(this,f,c),at.changeHistory({action:((It=t(this,f))==null?void 0:It.hash)!==c.hash?"replace":i,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),M.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,K)}}));return}r(this,O,c);try{let G=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var k;(k=this.preprocessor)==null||k.call(this,{url:c,resolve:n,reject:w,submorph:d})})}catch(n){n?console.error(n):console.log("Route change canceled"),G=!1}if(!G||t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}const zt={url:c,submorph:d};d?E||d.forEach(n=>{document.querySelectorAll(n).forEach(w=>{w.classList.add("out"),w.setAttribute("data-morph-out","")})}):t(this,_).forEach(n=>{var w,k;(w=n.firstElementChild)==null||w.classList.add("out"),(k=n.firstElementChild)==null||k.setAttribute("data-morph-out","")}),M.dispatchEvent(document,"morphNavigation",{detail:zt});const yt=p(this,m,vt).call(this,t(this,f).pathname),S=p(this,m,vt).call(this,c.pathname);if(t(this,N).forEach(n=>{n.pathname!==c.pathname&&n.abort()}),yield S==null?void 0:S.fetch(dt,t(this,f).path,g),t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}yt.clearState(),yt.saveScrollState(),yt.saveDocumentState(),(!t(this,B)||g)&&(S.clearScrollState(),S.clearDocumentState()),bt&&S.clearState(),S.cloneDocument(),t(this,$).textContent=S.title,document.body.appendChild(t(this,$));const mt=kt(gt({},zt),{document:S.document});E||mt.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),M.dispatchEvent(document,"morphStart",{detail:mt});const Vt=Array.from(document.head.children),Ot=Array.from(S.document.head.children),Ft=p(this,m,Zt).call(this,Vt,Ot),_t=p(this,m,Tt).call(this,Vt,Ft),ft=p(this,m,Tt).call(this,Ot,Ft).filter(n=>!this.excludeHeadChild(n));ft.forEach((n,w)=>{n.tagName==="SCRIPT"&&(ft[w]=p(this,m,Rt).call(this,n))}),ft.forEach(n=>{document.head.appendChild(n)});const wt=ft.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(p(this,m,xt).call(this,n))return!0});t(this,R).waitForHeadToLoad&&wt.length&&(yield new Promise(n=>W(this,null,function*(){let w=0;try{for(var k=Kt(wt),ee,q,H;ee=!(q=yield k.next()).done;ee=!1){const pt=q.value;pt.onload=()=>{w++,w===wt.length&&n()}}}catch(q){H=[q]}finally{try{ee&&(q=k.return)&&(yield q.call(k))}finally{if(H)throw H[0]}}}))),yield $t.wait(10);const Bt=[];E||_t.forEach(n=>{n.hasAttribute("data-permanent")||(p(this,m,xt).call(this,n)?Bt.push(n):n.remove())});const te=p(this,m,Mt).call(this,S.document.body);!t(this,R).morphInsideScrollContainer&&!d&&p(this,m,Nt).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),at.changeHistory({action:i,pathname:c.pathname,searchParameters:c.parameters||(L?location.search:""),hash:c.hash}),t(this,$).remove(),r(this,K,t(this,f)),r(this,f,c);const At=[];t(this,_).forEach((n,w)=>{const k=te[w],ee=getComputedStyle(n).getPropertyValue("--morph-duration");let q=[],H=[];d?(d.forEach(u=>{const b=n.querySelector(u),D=k.querySelector(u);b&&D&&(H.push(b),q.push(D))}),H.forEach(u=>{u.parentElement&&At.push(u.parentElement)})):(q.push(...k.childNodes),H.push(...n.childNodes),At.push(n)),E||H.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),q.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),d?E?q.forEach((u,b)=>{H[b]instanceof HTMLElement&&H[b].append(...u.childNodes)}):q.forEach((u,b)=>{var D;(D=H[b].parentElement)==null||D.insertBefore(u,H[b])}):n.prepend(...q),setTimeout(()=>{E||H.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),q.forEach(u=>{var b;u instanceof HTMLElement&&((b=u.parentElement)==null||b.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const pt=kt(gt({},mt),{morphElement:n});M.dispatchEvent(document,"morphNewChildrenAdded",{detail:pt});const ie=new Promise(u=>{setTimeout(()=>{E||H.forEach(b=>b.remove()),q.forEach(b=>{var D;b instanceof HTMLElement&&((D=b.parentElement)==null||D.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),E||M.dispatchEvent(document,"morphOldChildrenRemoved",{detail:pt}),u()},(parseFloat(ee)||0)*1e3+10)});t(this,F).push(ie)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-S.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),M.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:S.scrollState}),c.hash?(S.clearScrollState(),p(this,m,Ut).call(this,c.hash,{centerScroll:s,offsetScroll:h,behavior:v})):t(this,B)?S.restoreScrollPosition():Lt||S.renewScrollPosition(),yield Promise.all(t(this,F)),E||Bt.forEach(n=>n.remove()),r(this,F,[]),At.forEach(n=>{n.querySelectorAll("script").forEach(k=>{k.replaceWith(p(this,m,Rt).call(this,k))})}),t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)}),M.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(G){console.error(G)}r(this,O,void 0)})}addLink(e){t(this,y).push(new Ct(e,this))}addLinks(e){e.forEach(i=>{this.addLink(i)})}removeLink(e){r(this,y,t(this,y).filter(i=>i.element===e?(i.destroy(),!1):!0))}destroyOldLinks(e){r(this,y,t(this,y).filter(i=>e.contains(i.element)?(i.destroy(),!1):!0))}findNewLinks(e){const i=[...e.querySelectorAll("a")].filter(t(this,ct));t(this,y).push(...i.map(s=>new Ct(s,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,ct));t(this,y).forEach(i=>i.destroy()),r(this,y,e.map(i=>new Ct(i,this)))}};R=new WeakMap,_=new WeakMap,y=new WeakMap,O=new WeakMap,f=new WeakMap,K=new WeakMap,F=new WeakMap,B=new WeakMap,C=new WeakMap,lt=new WeakMap,N=new WeakMap,$=new WeakMap,tt=new WeakMap,et=new WeakMap,ht=new WeakMap,it=new WeakMap,m=new WeakSet,Rt=function(e){const i=document.createElement("script");for(let s=0;s<e.attributes.length;s++){const h=e.attributes[s];i.setAttribute(h.name,h.value)}return e.hasAttribute("src")||(i.innerHTML=e.innerHTML),i},ct=new WeakMap,vt=function(e){const i=this.normalizePath(e);let s=t(this,N).get(i.pathname);return s||(s=new Gt(this,i.pathname),t(this,N).set(i.pathname,s)),s},Mt=function(e){const i=[...e.querySelectorAll("[data-morph]")];return i.length?i:[e]},Zt=function(e,i){return e.filter(s=>i.find(h=>h.outerHTML===s.outerHTML))},Tt=function(e,i){return e.filter(s=>!i.find(h=>h.outerHTML===s.outerHTML))},xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Nt=function(e){var i,s;(i=t(this,C))==null||i.removeEventListener("scroll",t(this,st)),r(this,et,0),r(this,tt,0),r(this,C,t(this,R).scrollSelector&&e.querySelector(t(this,R).scrollSelector)||window),r(this,lt,t(this,C)===window),(s=t(this,C))==null||s.addEventListener("scroll",t(this,st)),t(this,st).call(this)},Ut=function(e,i){const s=typeof e=="string"?document.getElementById(e):e;(typeof s=="number"||s)&&$t.scrollToElement(s,{scrollElement:t(this,C),behavior:(i==null?void 0:i.behavior)||"instant",center:i==null?void 0:i.centerScroll,offset:i==null?void 0:i.offsetScroll})},St=new WeakMap,st=new WeakMap,nt.instance=null;let Ht=nt;exports.Morph=Ht;
|
package/lib/morph/index.js
CHANGED
|
@@ -12,9 +12,9 @@ var Xt = (o, e, i) => e in o ? ie(o, e, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
for (var i of Bt(e))
|
|
13
13
|
re.call(e, i) && Xt(o, i, e[i]);
|
|
14
14
|
return o;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var t = (o, e, i) => (
|
|
15
|
+
}, At = (o, e) => se(o, ae(e));
|
|
16
|
+
var kt = (o, e, i) => e.has(o) || Yt("Cannot " + i);
|
|
17
|
+
var t = (o, e, i) => (kt(o, e, "read from private field"), i ? i.call(o) : e.get(o)), l = (o, e, i) => e.has(o) ? Yt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, i), r = (o, e, i, s) => (kt(o, e, "write to private field"), s ? s.call(o, i) : e.set(o, i), i), p = (o, e, i) => (kt(o, e, "access private method"), i);
|
|
18
18
|
var W = (o, e, i) => new Promise((s, h) => {
|
|
19
19
|
var S = (d) => {
|
|
20
20
|
try {
|
|
@@ -33,12 +33,11 @@ var W = (o, e, i) => new Promise((s, h) => {
|
|
|
33
33
|
});
|
|
34
34
|
var jt = (o, e, i) => (e = o[Wt("asyncIterator")]) ? e.call(o) : (o = o[Wt("iterator")](), e = {}, i = (s, h) => (h = o[s]) && (e[s] = (S) => new Promise((g, b, d) => (S = h.call(o, S), d = S.done, Promise.resolve(S.value).then((E) => g({ value: E, done: d }), b)))), i("next"), i("return"), e);
|
|
35
35
|
import { i as Gt } from "../index-Bv9zgfdb.js";
|
|
36
|
-
import { d as
|
|
37
|
-
import {
|
|
38
|
-
import { w as le, s as he } from "../scroll-DPkCFTxg.js";
|
|
36
|
+
import { d as T } from "../events-CsVF98U6.js";
|
|
37
|
+
import { w as oe, s as le } from "../scroll-DPkCFTxg.js";
|
|
39
38
|
import "construct-style-sheets-polyfill";
|
|
40
|
-
import { n as
|
|
41
|
-
import { cssValueParser as
|
|
39
|
+
import { n as he, c as Pt, s as ce } from "../url-CFnGU6md.js";
|
|
40
|
+
import { cssValueParser as ue } from "../css-value-parser/index.js";
|
|
42
41
|
class Jt extends HTMLElement {
|
|
43
42
|
connectedCallback() {
|
|
44
43
|
const e = {
|
|
@@ -68,7 +67,7 @@ class Ct {
|
|
|
68
67
|
r(this, q, t(this, a).getAttribute("href") || "/");
|
|
69
68
|
const h = t(this, a).getAttribute(
|
|
70
69
|
"data-history-action"
|
|
71
|
-
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), g = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), b = g ?
|
|
70
|
+
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), g = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), b = g ? ue.parse(g) : void 0, d = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link"), E = t(this, a).hasAttribute(
|
|
72
71
|
"data-keep-search-parameters"
|
|
73
72
|
), vt = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link"), Lt = t(this, a).getAttribute(
|
|
74
73
|
"data-scroll-behaviour"
|
|
@@ -165,13 +164,13 @@ P = new WeakMap(), a = new WeakMap(), q = new WeakMap(), J = new WeakSet(), gt =
|
|
|
165
164
|
};
|
|
166
165
|
}
|
|
167
166
|
}, nt = new WeakMap(), Q = new WeakMap();
|
|
168
|
-
const
|
|
169
|
-
var
|
|
167
|
+
const de = new DOMParser();
|
|
168
|
+
var M, X, A, x, Y, z, Z, j, V, rt;
|
|
170
169
|
class Kt {
|
|
171
170
|
constructor(e, i) {
|
|
172
|
-
l(this,
|
|
171
|
+
l(this, M);
|
|
173
172
|
l(this, X);
|
|
174
|
-
l(this,
|
|
173
|
+
l(this, A, { x: 0, y: 0 });
|
|
175
174
|
l(this, x, null);
|
|
176
175
|
l(this, Y, null);
|
|
177
176
|
l(this, z, null);
|
|
@@ -179,13 +178,13 @@ class Kt {
|
|
|
179
178
|
l(this, j, null);
|
|
180
179
|
l(this, V, null);
|
|
181
180
|
l(this, rt);
|
|
182
|
-
r(this,
|
|
181
|
+
r(this, M, e), r(this, X, i);
|
|
183
182
|
}
|
|
184
183
|
get pathname() {
|
|
185
184
|
return t(this, X);
|
|
186
185
|
}
|
|
187
186
|
get scrollState() {
|
|
188
|
-
return t(this,
|
|
187
|
+
return t(this, A);
|
|
189
188
|
}
|
|
190
189
|
get document() {
|
|
191
190
|
return t(this, z);
|
|
@@ -206,7 +205,7 @@ class Kt {
|
|
|
206
205
|
return W(this, null, function* () {
|
|
207
206
|
var h;
|
|
208
207
|
if (!s) {
|
|
209
|
-
const b = ((h = t(this, x)) == null ? void 0 : h.documentElement.getAttribute("data-cache")) && i !== e, d = t(this, x) && t(this,
|
|
208
|
+
const b = ((h = t(this, x)) == null ? void 0 : h.documentElement.getAttribute("data-cache")) && i !== e, d = t(this, x) && t(this, M).isPopstateNavigation;
|
|
210
209
|
if (t(this, V) || b || d)
|
|
211
210
|
return t(this, V);
|
|
212
211
|
}
|
|
@@ -220,7 +219,7 @@ class Kt {
|
|
|
220
219
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(i),
|
|
221
220
|
"X-MORPH-NEW-PATH": encodeURIComponent(e)
|
|
222
221
|
}, t(this, rt))
|
|
223
|
-
})).text(), d =
|
|
222
|
+
})).text(), d = de.parseFromString(b, "text/html");
|
|
224
223
|
this.setInitialDocument(d);
|
|
225
224
|
} catch (g) {
|
|
226
225
|
console.warn(g);
|
|
@@ -244,7 +243,7 @@ class Kt {
|
|
|
244
243
|
return e;
|
|
245
244
|
}
|
|
246
245
|
clearScrollState() {
|
|
247
|
-
t(this,
|
|
246
|
+
t(this, A).x = 0, t(this, A).y = 0;
|
|
248
247
|
}
|
|
249
248
|
clearDocumentState() {
|
|
250
249
|
r(this, Y, null);
|
|
@@ -252,12 +251,12 @@ class Kt {
|
|
|
252
251
|
saveScrollState() {
|
|
253
252
|
t(this, x).documentElement.hasAttribute(
|
|
254
253
|
"data-no-scroll-restoration"
|
|
255
|
-
) ? (t(this,
|
|
254
|
+
) ? (t(this, A).x = 0, t(this, A).y = 0) : (t(this, A).x = t(this, M).scrollValue.left, t(this, A).y = t(this, M).scrollValue.top);
|
|
256
255
|
}
|
|
257
256
|
restoreScrollPosition() {
|
|
258
|
-
t(this,
|
|
259
|
-
top: t(this,
|
|
260
|
-
left: t(this,
|
|
257
|
+
t(this, M).scrollElement.scroll({
|
|
258
|
+
top: t(this, A).y,
|
|
259
|
+
left: t(this, A).x,
|
|
261
260
|
behavior: "instant"
|
|
262
261
|
});
|
|
263
262
|
}
|
|
@@ -267,7 +266,7 @@ class Kt {
|
|
|
267
266
|
) ? r(this, Y, null) : r(this, Y, document.cloneNode(!0));
|
|
268
267
|
}
|
|
269
268
|
renewScrollPosition() {
|
|
270
|
-
t(this,
|
|
269
|
+
t(this, M).scrollElement.scroll({
|
|
271
270
|
top: 0,
|
|
272
271
|
left: 0,
|
|
273
272
|
behavior: "instant"
|
|
@@ -281,8 +280,8 @@ class Kt {
|
|
|
281
280
|
return r(this, Z, null), e;
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
|
-
|
|
285
|
-
var R, _, y, F, f, K, O, B, C, ot, N, $, tt, et, lt, it, m, Ht, ht, Et, Rt, Qt,
|
|
283
|
+
M = new WeakMap(), X = new WeakMap(), A = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), j = new WeakMap(), V = new WeakMap(), rt = new WeakMap();
|
|
284
|
+
var R, _, y, F, f, K, O, B, C, ot, N, $, tt, et, lt, it, m, Ht, ht, Et, Rt, Qt, Tt, Mt, xt, Nt, St, st;
|
|
286
285
|
const at = class at {
|
|
287
286
|
constructor(e) {
|
|
288
287
|
l(this, m);
|
|
@@ -327,7 +326,7 @@ const at = class at {
|
|
|
327
326
|
), document.documentElement.classList.toggle(
|
|
328
327
|
"scroll-x-backward",
|
|
329
328
|
h < 0
|
|
330
|
-
),
|
|
329
|
+
), T(document, "morphScroll", {
|
|
331
330
|
detail: {
|
|
332
331
|
left: e,
|
|
333
332
|
top: i
|
|
@@ -336,7 +335,7 @@ const at = class at {
|
|
|
336
335
|
});
|
|
337
336
|
if (Gt && !at.instance) {
|
|
338
337
|
at.instance = this, r(this, R, {
|
|
339
|
-
base:
|
|
338
|
+
base: he(e == null ? void 0 : e.base),
|
|
340
339
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
341
340
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
342
341
|
scrollSelector: e == null ? void 0 : e.scrollSelector,
|
|
@@ -389,7 +388,7 @@ const at = class at {
|
|
|
389
388
|
return e == null ? void 0 : e.clearState();
|
|
390
389
|
}
|
|
391
390
|
normalizePath(e) {
|
|
392
|
-
return
|
|
391
|
+
return ce(e, {
|
|
393
392
|
base: t(this, R).base,
|
|
394
393
|
trailingSlash: t(this, R).trailingSlash
|
|
395
394
|
});
|
|
@@ -434,14 +433,14 @@ const at = class at {
|
|
|
434
433
|
centerScroll: s,
|
|
435
434
|
offsetScroll: h,
|
|
436
435
|
behavior: "smooth"
|
|
437
|
-
}),
|
|
436
|
+
}), T(document, "morphSamePath", {
|
|
438
437
|
custom: !0
|
|
439
438
|
}), ((Dt = t(this, f)) == null ? void 0 : Dt.parameters) !== c.parameters && (r(this, K, t(this, f)), r(this, f, c), Pt({
|
|
440
439
|
action: ((It = t(this, f)) == null ? void 0 : It.hash) !== c.hash ? "replace" : i,
|
|
441
440
|
pathname: c.pathname,
|
|
442
441
|
searchParameters: c.parameters,
|
|
443
442
|
hash: c.hash
|
|
444
|
-
}),
|
|
443
|
+
}), T(document, "morphURLParametersChange", {
|
|
445
444
|
detail: {
|
|
446
445
|
newURL: t(this, f),
|
|
447
446
|
previousURL: t(this, K)
|
|
@@ -455,8 +454,8 @@ const at = class at {
|
|
|
455
454
|
if (this.preprocessor)
|
|
456
455
|
try {
|
|
457
456
|
yield new Promise((n, w) => {
|
|
458
|
-
var
|
|
459
|
-
(
|
|
457
|
+
var k;
|
|
458
|
+
(k = this.preprocessor) == null || k.call(this, {
|
|
460
459
|
url: c,
|
|
461
460
|
resolve: n,
|
|
462
461
|
reject: w,
|
|
@@ -481,9 +480,9 @@ const at = class at {
|
|
|
481
480
|
w.classList.add("out"), w.setAttribute("data-morph-out", "");
|
|
482
481
|
});
|
|
483
482
|
}) : t(this, _).forEach((n) => {
|
|
484
|
-
var w,
|
|
485
|
-
(w = n.firstElementChild) == null || w.classList.add("out"), (
|
|
486
|
-
}),
|
|
483
|
+
var w, k;
|
|
484
|
+
(w = n.firstElementChild) == null || w.classList.add("out"), (k = n.firstElementChild) == null || k.setAttribute("data-morph-out", "");
|
|
485
|
+
}), T(document, "morphNavigation", {
|
|
487
486
|
detail: qt
|
|
488
487
|
});
|
|
489
488
|
const bt = p(this, m, Et).call(this, t(this, f).pathname), v = p(this, m, Et).call(this, c.pathname);
|
|
@@ -496,15 +495,15 @@ const at = class at {
|
|
|
496
495
|
return;
|
|
497
496
|
}
|
|
498
497
|
bt.clearState(), bt.saveScrollState(), bt.saveDocumentState(), (!t(this, B) || g) && (v.clearScrollState(), v.clearDocumentState()), vt && v.clearState(), v.cloneDocument(), t(this, $).textContent = v.title, document.body.appendChild(t(this, $));
|
|
499
|
-
const dt =
|
|
498
|
+
const dt = At(pt({}, qt), {
|
|
500
499
|
document: v.document
|
|
501
500
|
});
|
|
502
501
|
E || dt.document.querySelectorAll("[data-morph-out]").forEach((n) => {
|
|
503
502
|
n.classList.remove("out");
|
|
504
|
-
}),
|
|
503
|
+
}), T(document, "morphStart", {
|
|
505
504
|
detail: dt
|
|
506
505
|
});
|
|
507
|
-
const zt = Array.from(document.head.children), Vt = Array.from(v.document.head.children), Ft = p(this, m, Qt).call(this, zt, Vt), Zt = p(this, m,
|
|
506
|
+
const zt = Array.from(document.head.children), Vt = Array.from(v.document.head.children), Ft = p(this, m, Qt).call(this, zt, Vt), Zt = p(this, m, Tt).call(this, zt, Ft), mt = p(this, m, Tt).call(this, Vt, Ft).filter((n) => !this.excludeHeadChild(n));
|
|
508
507
|
mt.forEach((n, w) => {
|
|
509
508
|
n.tagName === "SCRIPT" && (mt[w] = p(this, m, Ht).call(this, n));
|
|
510
509
|
}), mt.forEach((n) => {
|
|
@@ -513,13 +512,13 @@ const at = class at {
|
|
|
513
512
|
const yt = mt.filter((n) => {
|
|
514
513
|
if (n.hasAttribute("data-no-waiting"))
|
|
515
514
|
return !1;
|
|
516
|
-
if (p(this, m,
|
|
515
|
+
if (p(this, m, Mt).call(this, n))
|
|
517
516
|
return !0;
|
|
518
517
|
});
|
|
519
518
|
t(this, R).waitForHeadToLoad && yt.length && (yield new Promise((n) => W(this, null, function* () {
|
|
520
519
|
let w = 0;
|
|
521
520
|
try {
|
|
522
|
-
for (var
|
|
521
|
+
for (var k = jt(yt), te, D, H; te = !(D = yield k.next()).done; te = !1) {
|
|
523
522
|
const ft = D.value;
|
|
524
523
|
ft.onload = () => {
|
|
525
524
|
w++, w === yt.length && n();
|
|
@@ -529,16 +528,16 @@ const at = class at {
|
|
|
529
528
|
H = [D];
|
|
530
529
|
} finally {
|
|
531
530
|
try {
|
|
532
|
-
te && (D =
|
|
531
|
+
te && (D = k.return) && (yield D.call(k));
|
|
533
532
|
} finally {
|
|
534
533
|
if (H)
|
|
535
534
|
throw H[0];
|
|
536
535
|
}
|
|
537
536
|
}
|
|
538
|
-
}))), yield
|
|
537
|
+
}))), yield oe(10);
|
|
539
538
|
const Ot = [];
|
|
540
539
|
E || Zt.forEach((n) => {
|
|
541
|
-
n.hasAttribute("data-permanent") || (p(this, m,
|
|
540
|
+
n.hasAttribute("data-permanent") || (p(this, m, Mt).call(this, n) ? Ot.push(n) : n.remove());
|
|
542
541
|
});
|
|
543
542
|
const _t = p(this, m, Rt).call(this, v.document.body);
|
|
544
543
|
!t(this, R).morphInsideScrollContainer && !d && p(this, m, xt).call(this, v.document), document.documentElement.setAttribute(
|
|
@@ -555,14 +554,14 @@ const at = class at {
|
|
|
555
554
|
}), t(this, $).remove(), r(this, K, t(this, f)), r(this, f, c);
|
|
556
555
|
const wt = [];
|
|
557
556
|
t(this, _).forEach((n, w) => {
|
|
558
|
-
const
|
|
557
|
+
const k = _t[w], te = getComputedStyle(n).getPropertyValue("--morph-duration");
|
|
559
558
|
let D = [], H = [];
|
|
560
559
|
d ? (d.forEach((u) => {
|
|
561
|
-
const L = n.querySelector(u), I =
|
|
560
|
+
const L = n.querySelector(u), I = k.querySelector(u);
|
|
562
561
|
L && I && (H.push(L), D.push(I));
|
|
563
562
|
}), H.forEach((u) => {
|
|
564
563
|
u.parentElement && wt.push(u.parentElement);
|
|
565
|
-
})) : (D.push(...
|
|
564
|
+
})) : (D.push(...k.childNodes), H.push(...n.childNodes), wt.push(n)), E || H.forEach((u) => {
|
|
566
565
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
567
566
|
}), D.forEach((u) => {
|
|
568
567
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
@@ -574,7 +573,7 @@ const at = class at {
|
|
|
574
573
|
u,
|
|
575
574
|
H[L]
|
|
576
575
|
);
|
|
577
|
-
}) : n.prepend(...D),
|
|
576
|
+
}) : n.prepend(...D), setTimeout(() => {
|
|
578
577
|
E || H.forEach((u) => {
|
|
579
578
|
u instanceof HTMLElement && u.classList.add("old-idle");
|
|
580
579
|
}), D.forEach((u) => {
|
|
@@ -584,11 +583,11 @@ const at = class at {
|
|
|
584
583
|
u.offsetHeight + "px"
|
|
585
584
|
), u.classList.add("new-idle"));
|
|
586
585
|
});
|
|
587
|
-
});
|
|
588
|
-
const ft =
|
|
586
|
+
}, 0);
|
|
587
|
+
const ft = At(pt({}, dt), {
|
|
589
588
|
morphElement: n
|
|
590
589
|
});
|
|
591
|
-
|
|
590
|
+
T(document, "morphNewChildrenAdded", {
|
|
592
591
|
detail: ft
|
|
593
592
|
});
|
|
594
593
|
const ee = new Promise((u) => {
|
|
@@ -598,7 +597,7 @@ const at = class at {
|
|
|
598
597
|
L instanceof HTMLElement && ((I = L.parentElement) == null || I.style.removeProperty(
|
|
599
598
|
"--new-content-height"
|
|
600
599
|
), L.classList.remove("new-idle", "new"));
|
|
601
|
-
}), E ||
|
|
600
|
+
}), E || T(document, "morphOldChildrenRemoved", {
|
|
602
601
|
detail: ft
|
|
603
602
|
}), u();
|
|
604
603
|
}, (parseFloat(te) || 0) * 1e3 + 10);
|
|
@@ -610,19 +609,19 @@ const at = class at {
|
|
|
610
609
|
) : document.documentElement.style.setProperty(
|
|
611
610
|
"--new-document-scroll-position",
|
|
612
611
|
this.scrollValue.top + "px"
|
|
613
|
-
),
|
|
612
|
+
), T(document, "morphBeforeNavigationScroll", {
|
|
614
613
|
detail: v.scrollState
|
|
615
614
|
}), c.hash ? (v.clearScrollState(), p(this, m, Nt).call(this, c.hash, {
|
|
616
615
|
centerScroll: s,
|
|
617
616
|
offsetScroll: h,
|
|
618
617
|
behavior: S
|
|
619
618
|
})) : t(this, B) ? v.restoreScrollPosition() : Lt || v.renewScrollPosition(), yield Promise.all(t(this, O)), E || Ot.forEach((n) => n.remove()), r(this, O, []), wt.forEach((n) => {
|
|
620
|
-
n.querySelectorAll("script").forEach((
|
|
621
|
-
|
|
619
|
+
n.querySelectorAll("script").forEach((k) => {
|
|
620
|
+
k.replaceWith(p(this, m, Ht).call(this, k));
|
|
622
621
|
});
|
|
623
622
|
}), t(this, y).forEach((n) => {
|
|
624
623
|
n.checkCurrent(t(this, f).path);
|
|
625
|
-
}),
|
|
624
|
+
}), T(document, "morphComplete", {
|
|
626
625
|
detail: dt
|
|
627
626
|
}), document.documentElement.style.removeProperty(
|
|
628
627
|
"--new-document-scroll-position"
|
|
@@ -682,13 +681,13 @@ R = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), F = new WeakMap(), f =
|
|
|
682
681
|
(h) => h.outerHTML === s.outerHTML
|
|
683
682
|
)
|
|
684
683
|
);
|
|
685
|
-
},
|
|
684
|
+
}, Tt = function(e, i) {
|
|
686
685
|
return e.filter(
|
|
687
686
|
(s) => !i.find(
|
|
688
687
|
(h) => h.outerHTML === s.outerHTML
|
|
689
688
|
)
|
|
690
689
|
);
|
|
691
|
-
},
|
|
690
|
+
}, Mt = function(e) {
|
|
692
691
|
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
693
692
|
}, xt = function(e) {
|
|
694
693
|
var i, s;
|
|
@@ -698,7 +697,7 @@ R = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), F = new WeakMap(), f =
|
|
|
698
697
|
), r(this, et, 0), r(this, tt, 0), r(this, C, t(this, R).scrollSelector && e.querySelector(t(this, R).scrollSelector) || window), r(this, ot, t(this, C) === window), (s = t(this, C)) == null || s.addEventListener("scroll", t(this, st)), t(this, st).call(this);
|
|
699
698
|
}, Nt = function(e, i) {
|
|
700
699
|
const s = typeof e == "string" ? document.getElementById(e) : e;
|
|
701
|
-
(typeof s == "number" || s) &&
|
|
700
|
+
(typeof s == "number" || s) && le(s, {
|
|
702
701
|
scrollElement: t(this, C),
|
|
703
702
|
behavior: (i == null ? void 0 : i.behavior) || "instant",
|
|
704
703
|
center: i == null ? void 0 : i.centerScroll,
|