aptechka 0.78.8 → 0.79.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/morph/Morph.d.ts +1 -0
- package/lib/morph/MorphRoute.d.ts +1 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +274 -266
- package/package.json +1 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export declare class Morph {
|
|
|
99
99
|
prefetch(path: string, revalidate?: boolean): Promise<void>;
|
|
100
100
|
excludeHeadChild(child: Node): boolean;
|
|
101
101
|
setHeaders(path: string): void;
|
|
102
|
+
needRavalidation(path: string): void;
|
|
102
103
|
navigate(path: string, { historyAction, centerScroll, offsetScroll, scrollBehaviour, revalidate, keepSearchParameters, submorph, submorphAppend, clearState, keepScrollPosition, mergeParams, }?: MorphNavigateOptions): Promise<void>;
|
|
103
104
|
addLink(element: HTMLAnchorElement): void;
|
|
104
105
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
@@ -14,6 +14,7 @@ export declare class MorphRoute {
|
|
|
14
14
|
get pathname(): string;
|
|
15
15
|
get scrollState(): MorphRouteScrollState;
|
|
16
16
|
get document(): Document;
|
|
17
|
+
needRavalidation(): void;
|
|
17
18
|
setHeaders(headers: HeadersInit): void;
|
|
18
19
|
setInitialDocument(document: Document): void;
|
|
19
20
|
abort(): void | undefined;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var fe=Object.defineProperty,ge=Object.defineProperties;var Ee=Object.getOwnPropertyDescriptors;var Zt=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var _t=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ee=h=>{throw TypeError(h)};var te=(h,e,s)=>e in h?fe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))be.call(e,s)&&te(h,s,e[s]);if(Zt)for(var s of Zt(e))ve.call(e,s)&&te(h,s,e[s]);return h},qt=(h,e)=>ge(h,Ee(e));var Dt=(h,e,s)=>e.has(h)||ee("Cannot "+s);var t=(h,e,s)=>(Dt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(Dt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),E=(h,e,s)=>(Dt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var se=(h,e,s)=>(e=h[_t("asyncIterator")])?e.call(h):(h=h[_t("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ie=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const mt=require("../url-VIZgwj_h.cjs"),re=require("../string-DUXXtU8v.cjs"),Le=require("../math-GDWEqu7y.cjs"),Se=require("../css-value-parser/index.cjs");class oe 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[s,a]of Object.entries(e))this.setAttribute(s,a)}}ne.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",oe);var R,i,x,at,xt,he,ft,nt;class zt{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,ft,e=>{e.preventDefault(),E(this,x,he).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,ft)),this.checkCurrent(location.href.replace(location.origin,""));const a=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=re.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],S=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===S||!u.has($)&&(S===""||S==="*"||S==="all"||S==="any"||S==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=E(this,x,xt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Le.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,ft)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},xt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},he=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?Se.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,Pt]=t(this,x,at).split("?"),j=new URLSearchParams(Pt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[y]of j)(!V.has(y)||V.has(y)&&V.get(y)!==j.get(y))&&it.append(y,j.get(y));if(t(this,i).hasAttribute("data-merge-params"))for(const[y]of V)j.has(y)||it.append(y,V.get(y));$=`${c}?${it.toString()}`}const S=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));S&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),S.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage-1,S.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!S||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},ft=new WeakMap,nt=new WeakMap;const ye=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,gt;class ae{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,gt);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}setHeaders(e){o(this,gt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,a){return G(this,null,function*(){var n;if(!a){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,gt))})).text(),d=ye.parseFromString(u,"text/html");this.setInitialDocument(d)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,gt=new WeakMap;var T,ot,Et,It,bt;class Ae{constructor(e){l(this,Et);l(this,T);l(this,ot,[]);l(this,bt,()=>{E(this,Et,It).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=re.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ot).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,bt)),E(this,Et,It).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,bt))}}T=new WeakMap,ot=new WeakMap,Et=new WeakSet,It=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ot).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ot).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},bt=new WeakMap;var q,ht,P,K,g,_,X,Y,U,vt,W,Lt,tt,lt,ct,St,dt,yt,p,Vt,At,Ht,Ot,le,Ft,Bt,Kt,Xt,Tt,ut;const pt=class pt{constructor(e){l(this,p);l(this,q,null);l(this,ht,null);l(this,P,[]);l(this,K);l(this,g,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,U,null);l(this,vt,!1);l(this,W,new Map);l(this,Lt,[]);l(this,tt,null);l(this,lt,0);l(this,ct,0);l(this,St);l(this,dt);l(this,yt);l(this,At,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,dt)?void 0:t(this,St),revalidate:t(this,dt),keepScrollPosition:t(this,yt)}),o(this,Y,!1)}));l(this,ut,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,ct),n=e-t(this,lt);o(this,ct,s),o(this,lt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ne.isBrowser&&!pt.instance){pt.instance=this,o(this,q,{base:mt.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}),o(this,ht,E(this,p,Ot).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,g,s);const a=new ae(this,t(this,g).pathname);a.setInitialDocument(document),t(this,W).set(t(this,g).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,g).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),mt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new oe),E(this,p,Kt).call(this,document)}}get currentURL(){return t(this,g)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,U)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,U).scrollTop,s=t(this,U).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,W).get(t(this,g).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,g).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return mt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=E(this,p,Ht).call(this,e);a==null||a.fetch(e,t(this,g).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var Pt,j,V,it;if(t(this,X).length)return;o(this,St,d),o(this,dt,f),o(this,yt,w);const S=((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,e))||e,c=this.normalizePath(S,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,g).pathname===c.pathname)){w||E(this,p,Xt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,g))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,g)),o(this,g,c),mt.changeHistory({action:((it=t(this,g))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,g),previousURL:t(this,_)}})),t(this,P).forEach(y=>{y.checkCurrent(c.path)});return}else t(this,P).forEach(y=>{y.checkCurrent(c.path)});o(this,K,c);try{let y=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),y=!1}if(!y||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}const Yt={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,ht).forEach(r=>{var k,M;(k=r.firstElementChild)==null||k.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:Yt});const Mt=E(this,p,Ht).call(this,t(this,g).pathname),A=E(this,p,Ht).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(S,t(this,g).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const kt=qt(Rt({},Yt),{document:A.document});v||kt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:kt});const $t=Array.from(document.head.children),jt=Array.from(A.document.head.children),Gt=E(this,p,le).call(this,$t,jt),ce=E(this,p,Ft).call(this,$t,Gt),wt=E(this,p,Ft).call(this,jt,Gt).filter(r=>!this.excludeHeadChild(r));wt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(wt[k]=E(this,p,Vt).call(this,r))}),wt.forEach(r=>{document.head.appendChild(r)});const Ut=wt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,p,Bt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var M=se(Ut),ue,O,N;ue=!(O=yield M.next()).done;ue=!1){const Ct=O.value;Ct.onload=()=>{k++,k===Ut.length&&r()}}}catch(O){N=[O]}finally{try{ue&&(O=M.return)&&(yield O.call(M))}finally{if(N)throw N[0]}}}))),yield ie.wait(10);const Jt=[];v||ce.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,p,Bt).call(this,r)?Jt.push(r):r.remove())});const de=E(this,p,Ot).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&E(this,p,Kt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),mt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,g)),o(this,g,c);const Nt=[];t(this,ht).forEach((r,k)=>{const M=de[k],ue=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=M.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&Nt.push(m.parentElement)})):(O.push(...M.childNodes),N.push(...r.childNodes),Nt.push(r));const Ct=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const pe=C.getAttribute("data-morph-transfer");Ct.push({element:C,selector:pe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(Ct.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Qt=qt(Rt({},kt),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Qt});const me=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Qt}),m()},(parseFloat(ue)||0)*1e3+10)});t(this,X).push(me)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),E(this,p,Xt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Jt.forEach(r=>r.remove()),o(this,X,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(E(this,p,Vt).call(this,M))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:kt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(y){console.error(y)}o(this,K,void 0)})}addLink(e){t(this,P).push(new zt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,At));t(this,P).push(...s.map(a=>new zt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,At));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new zt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Lt).forEach(s=>s.destroy()),o(this,Lt,e.map(s=>new Ae(s)))}};q=new WeakMap,ht=new WeakMap,P=new WeakMap,K=new WeakMap,g=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,U=new WeakMap,vt=new WeakMap,W=new WeakMap,Lt=new WeakMap,tt=new WeakMap,lt=new WeakMap,ct=new WeakMap,St=new WeakMap,dt=new WeakMap,yt=new WeakMap,p=new WeakSet,Vt=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},At=new WeakMap,Ht=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ae(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ot=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},le=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Ft=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,U))==null||s.removeEventListener("scroll",t(this,ut)),o(this,ct,0),o(this,lt,0),o(this,U,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,vt,t(this,U)===window),(a=t(this,U))==null||a.addEventListener("scroll",t(this,ut)),t(this,ut).call(this)},Xt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ie.scrollToElement(a,{scrollElement:t(this,U),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ut=new WeakMap,pt.instance=null;let Wt=pt;exports.Morph=Wt;
|
|
1
|
+
"use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var _t=Object.getOwnPropertySymbols;var ve=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var te=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),se=h=>{throw TypeError(h)};var ee=(h,e,s)=>e in h?ge(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Ht=(h,e)=>{for(var s in e||(e={}))ve.call(e,s)&&ee(h,s,e[s]);if(_t)for(var s of _t(e))Le.call(e,s)&&ee(h,s,e[s]);return h},Dt=(h,e)=>Ee(h,be(e));var zt=(h,e,s)=>e.has(h)||se("Cannot "+s);var t=(h,e,s)=>(zt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(zt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),g=(h,e,s)=>(zt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var ie=(h,e,s)=>(e=h[te("asyncIterator")])?e.call(h):(h=h[te("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ae=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-VIZgwj_h.cjs"),oe=require("../string-DUXXtU8v.cjs"),Se=require("../math-GDWEqu7y.cjs"),ye=require("../css-value-parser/index.cjs");class he 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[s,a]of Object.entries(e))this.setAttribute(s,a)}}re.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",he);var R,i,x,at,Tt,le,Et,nt;class It{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,Et,e=>{e.preventDefault(),g(this,x,le).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,Et)),this.checkCurrent(location.href.replace(location.origin,""));const a=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=oe.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],S=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===S||!u.has($)&&(S===""||S==="*"||S==="all"||S==="any"||S==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=g(this,x,Tt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Se.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,Et)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},Tt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},le=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?ye.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,wt]=t(this,x,at).split("?"),j=new URLSearchParams(wt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[y]of j)(!V.has(y)||V.has(y)&&V.get(y)!==j.get(y))&&it.append(y,j.get(y));if(t(this,i).hasAttribute("data-merge-params"))for(const[y]of V)j.has(y)||it.append(y,V.get(y));$=`${c}?${it.toString()}`}const S=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));S&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),S.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage-1,S.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!S||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},Et=new WeakMap,nt=new WeakMap;const Ae=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,bt,ot;class ne{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,bt);l(this,ot,!1);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}needRavalidation(){o(this,ot,!0)}setHeaders(e){o(this,bt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,a){return G(this,null,function*(){var n;if(!a&&!t(this,ot)){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Ht({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,bt))})).text(),d=Ae.parseFromString(u,"text/html");this.setInitialDocument(d),o(this,ot,!1)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,bt=new WeakMap,ot=new WeakMap;var T,ht,vt,Wt,Lt;class Pe{constructor(e){l(this,vt);l(this,T);l(this,ht,[]);l(this,Lt,()=>{g(this,vt,Wt).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=oe.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ht).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,Lt)),g(this,vt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Lt))}}T=new WeakMap,ht=new WeakMap,vt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ht).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ht).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},Lt=new WeakMap;var q,lt,P,K,E,_,X,Y,M,St,W,yt,tt,ct,dt,At,ut,Pt,p,Ot,kt,ft,Ft,ce,Bt,Kt,Xt,Yt,Ut,mt;const gt=class gt{constructor(e){l(this,p);l(this,q,null);l(this,lt,null);l(this,P,[]);l(this,K);l(this,E,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,M,null);l(this,St,!1);l(this,W,new Map);l(this,yt,[]);l(this,tt,null);l(this,ct,0);l(this,dt,0);l(this,At);l(this,ut);l(this,Pt);l(this,kt,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Ut,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,At),revalidate:t(this,ut),keepScrollPosition:t(this,Pt)}),o(this,Y,!1)}));l(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),n=e-t(this,ct);o(this,dt,s),o(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(re.isBrowser&&!gt.instance){gt.instance=this,o(this,q,{base:pt.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}),o(this,lt,g(this,p,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,E,s);const a=new ne(this,t(this,E).pathname);a.setInitialDocument(document),t(this,W).set(t(this,E).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,E).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Ut)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new he),g(this,p,Xt).call(this,document)}}get currentURL(){return t(this,E)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,St)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,W).get(t(this,E).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,E).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=g(this,p,ft).call(this,e);a==null||a.fetch(e,t(this,E).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=g(this,p,ft).call(this,s.path);a==null||a.needRavalidation()}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var wt,j,V,it;if(t(this,X).length)return;o(this,At,d),o(this,ut,f),o(this,Pt,w);const S=((wt=this.pathnameModifier)==null?void 0:wt.call(this,e))||e,c=this.normalizePath(S,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,E).pathname===c.pathname)){w||g(this,p,Yt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,E))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,E)),o(this,E,c),pt.changeHistory({action:((it=t(this,E))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,E),previousURL:t(this,_)}})),t(this,P).forEach(y=>{y.checkCurrent(c.path)});return}else t(this,P).forEach(y=>{y.checkCurrent(c.path)});o(this,K,c);try{let y=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var U;(U=this.preprocessor)==null||U.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),y=!1}if(!y||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}const $t={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,lt).forEach(r=>{var k,U;(k=r.firstElementChild)==null||k.classList.add("out"),(U=r.firstElementChild)==null||U.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:$t});const Mt=g(this,p,ft).call(this,t(this,E).pathname),A=g(this,p,ft).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(S,t(this,E).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const Ct=Dt(Ht({},$t),{document:A.document});v||Ct.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:Ct});const jt=Array.from(document.head.children),Gt=Array.from(A.document.head.children),Jt=g(this,p,ce).call(this,jt,Gt),de=g(this,p,Bt).call(this,jt,Jt),Rt=g(this,p,Bt).call(this,Gt,Jt).filter(r=>!this.excludeHeadChild(r));Rt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(Rt[k]=g(this,p,Ot).call(this,r))}),Rt.forEach(r=>{document.head.appendChild(r)});const Nt=Rt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(g(this,p,Kt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Nt.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var U=ie(Nt),me,O,N;me=!(O=yield U.next()).done;me=!1){const xt=O.value;xt.onload=()=>{k++,k===Nt.length&&r()}}}catch(O){N=[O]}finally{try{me&&(O=U.return)&&(yield O.call(U))}finally{if(N)throw N[0]}}}))),yield ae.wait(10);const Qt=[];v||de.forEach(r=>{r.hasAttribute("data-permanent")||(g(this,p,Kt).call(this,r)?Qt.push(r):r.remove())});const ue=g(this,p,Ft).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&g(this,p,Xt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),pt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,E)),o(this,E,c);const qt=[];t(this,lt).forEach((r,k)=>{const U=ue[k],me=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=U.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&qt.push(m.parentElement)})):(O.push(...U.childNodes),N.push(...r.childNodes),qt.push(r));const xt=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const fe=C.getAttribute("data-morph-transfer");xt.push({element:C,selector:fe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(xt.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Zt=Dt(Ht({},Ct),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Zt});const pe=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Zt}),m()},(parseFloat(me)||0)*1e3+10)});t(this,X).push(pe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),g(this,p,Yt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Qt.forEach(r=>r.remove()),o(this,X,[]),qt.forEach(r=>{r.querySelectorAll("script").forEach(U=>{U.replaceWith(g(this,p,Ot).call(this,U))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(y){console.error(y)}o(this,K,void 0)})}addLink(e){t(this,P).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,P).push(...s.map(a=>new It(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,yt).forEach(s=>s.destroy()),o(this,yt,e.map(s=>new Pe(s)))}};q=new WeakMap,lt=new WeakMap,P=new WeakMap,K=new WeakMap,E=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,M=new WeakMap,St=new WeakMap,W=new WeakMap,yt=new WeakMap,tt=new WeakMap,ct=new WeakMap,dt=new WeakMap,At=new WeakMap,ut=new WeakMap,Pt=new WeakMap,p=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},kt=new WeakMap,ft=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ne(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ce=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Kt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,a;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,mt)),o(this,dt,0),o(this,ct,0),o(this,M,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,St,t(this,M)===window),(a=t(this,M))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Yt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ae.scrollToElement(a,{scrollElement:t(this,M),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Ut=new WeakMap,mt=new WeakMap,gt.instance=null;let Vt=gt;exports.Morph=Vt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var fe = Object.defineProperty, ge = Object.defineProperties;
|
|
2
|
+
var be = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Zt = Object.getOwnPropertySymbols;
|
|
4
|
+
var Ee = Object.prototype.hasOwnProperty, ve = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _t = (h, e) => (e = Symbol[h]) ? e : Symbol.for("Symbol." + h), ee = (h) => {
|
|
6
6
|
throw TypeError(h);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var te = (h, e, s) => e in h ? fe(h, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : h[e] = s, xt = (h, e) => {
|
|
9
9
|
for (var s in e || (e = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var s of
|
|
13
|
-
|
|
10
|
+
Ee.call(e, s) && te(h, s, e[s]);
|
|
11
|
+
if (Zt)
|
|
12
|
+
for (var s of Zt(e))
|
|
13
|
+
ve.call(e, s) && te(h, s, e[s]);
|
|
14
14
|
return h;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var t = (h, e, s) => (
|
|
18
|
-
var G = (h, e, s) => new Promise((
|
|
15
|
+
}, Dt = (h, e) => ge(h, be(e));
|
|
16
|
+
var zt = (h, e, s) => e.has(h) || ee("Cannot " + s);
|
|
17
|
+
var t = (h, e, s) => (zt(h, e, "read from private field"), s ? s.call(h) : e.get(h)), l = (h, e, s) => e.has(h) ? ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(h) : e.set(h, s), o = (h, e, s, i) => (zt(h, e, "write to private field"), i ? i.call(h, s) : e.set(h, s), s), g = (h, e, s) => (zt(h, e, "access private method"), s);
|
|
18
|
+
var G = (h, e, s) => new Promise((i, n) => {
|
|
19
19
|
var E = (d) => {
|
|
20
20
|
try {
|
|
21
21
|
u(s.next(d));
|
|
@@ -28,186 +28,186 @@ var G = (h, e, s) => new Promise((a, n) => {
|
|
|
28
28
|
} catch (v) {
|
|
29
29
|
n(v);
|
|
30
30
|
}
|
|
31
|
-
}, u = (d) => d.done ?
|
|
31
|
+
}, u = (d) => d.done ? i(d.value) : Promise.resolve(d.value).then(E, f);
|
|
32
32
|
u((s = s.apply(h, e)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
35
|
-
import { i as
|
|
34
|
+
var se = (h, e, s) => (e = h[_t("asyncIterator")]) ? e.call(h) : (h = h[_t("iterator")](), e = {}, s = (i, n) => (n = h[i]) && (e[i] = (E) => new Promise((f, u, d) => (E = n.call(h, E), d = E.done, Promise.resolve(E.value).then((v) => f({ value: v, done: d }), u)))), s("next"), s("return"), e);
|
|
35
|
+
import { i as ne } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as z } from "../events-CsVF98U6.js";
|
|
37
|
-
import { w as
|
|
37
|
+
import { w as Le, s as Se } from "../scroll-DNGJVxa2.js";
|
|
38
38
|
import "construct-style-sheets-polyfill";
|
|
39
|
-
import { n as
|
|
40
|
-
import { c as
|
|
41
|
-
import { c as
|
|
42
|
-
import { cssValueParser as
|
|
43
|
-
class
|
|
39
|
+
import { n as ye, c as qt, s as Ae } from "../url-Ddgqz4Q_.js";
|
|
40
|
+
import { c as re } from "../string-BlMQbe8b.js";
|
|
41
|
+
import { c as Pe } from "../math-BOBiC4TN.js";
|
|
42
|
+
import { cssValueParser as ke } from "../css-value-parser/index.js";
|
|
43
|
+
class oe extends HTMLElement {
|
|
44
44
|
connectedCallback() {
|
|
45
45
|
const e = {
|
|
46
46
|
"aria-live": "assertive",
|
|
47
47
|
"aria-atomic": "true",
|
|
48
48
|
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"
|
|
49
49
|
};
|
|
50
|
-
for (const [s,
|
|
51
|
-
this.setAttribute(s,
|
|
50
|
+
for (const [s, i] of Object.entries(e))
|
|
51
|
+
this.setAttribute(s, i);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
var R,
|
|
56
|
-
class
|
|
54
|
+
ne && !customElements.get("morph-announcer") && customElements.define("morph-announcer", oe);
|
|
55
|
+
var R, a, x, it, Ht, he, gt, nt;
|
|
56
|
+
class It {
|
|
57
57
|
constructor(e, s) {
|
|
58
58
|
l(this, x);
|
|
59
59
|
l(this, R);
|
|
60
|
-
l(this,
|
|
61
|
-
l(this,
|
|
62
|
-
e.preventDefault(),
|
|
60
|
+
l(this, a);
|
|
61
|
+
l(this, gt, (e) => {
|
|
62
|
+
e.preventDefault(), g(this, x, he).call(this);
|
|
63
63
|
});
|
|
64
64
|
l(this, nt, () => {
|
|
65
|
-
const e = t(this,
|
|
66
|
-
t(this, R).prefetch(t(this, x,
|
|
65
|
+
const e = t(this, a).hasAttribute("data-revalidate");
|
|
66
|
+
t(this, R).prefetch(t(this, x, it), e), t(this, a).removeEventListener("pointerenter", t(this, nt));
|
|
67
67
|
});
|
|
68
|
-
o(this, R, s), o(this,
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
), t(this,
|
|
68
|
+
o(this, R, s), o(this, a, e), t(this, a).addEventListener("click", t(this, gt)), this.checkCurrent(location.href.replace(location.origin, ""));
|
|
69
|
+
const i = g(this, x, Ht).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link") || t(this, a).getAttribute("data-pagination-next-link") || t(this, a).getAttribute("data-pagination-prev-link"));
|
|
70
|
+
i && this.updatePagination(
|
|
71
|
+
i.currentPage,
|
|
72
|
+
i.selector
|
|
73
|
+
), t(this, a).hasAttribute("data-prefetch") && t(this, a).addEventListener("pointerenter", t(this, nt));
|
|
74
74
|
}
|
|
75
75
|
get element() {
|
|
76
|
-
return t(this,
|
|
76
|
+
return t(this, a);
|
|
77
77
|
}
|
|
78
78
|
checkCurrent(e) {
|
|
79
79
|
var v, et;
|
|
80
|
-
const s = t(this, R).normalizePath(e),
|
|
81
|
-
t(this,
|
|
82
|
-
const [n, E] = (et = t(this, x,
|
|
80
|
+
const s = t(this, R).normalizePath(e), i = t(this, R).normalizePath(t(this, x, it));
|
|
81
|
+
t(this, a).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? t(this, a).classList.add("current") : i.pathname === s.pathname ? t(this, a).classList.add("current") : (v = t(this, a).getAttribute("data-associated-paths")) != null && v.split(",").find((w) => s.pathname.includes(w)) ? t(this, a).classList.add("current") : t(this, a).classList.remove("current"), s.path === i.path ? t(this, a).classList.add("exact") : t(this, a).classList.remove("exact");
|
|
82
|
+
const [n, E] = (et = t(this, x, it).split("#")[0]) == null ? void 0 : et.split("?"), f = new URLSearchParams(E), u = new URLSearchParams(location.search);
|
|
83
83
|
let d = 0;
|
|
84
84
|
for (const [w] of u)
|
|
85
85
|
f.has(w) && u.get(w) === f.get(w) && d++;
|
|
86
|
-
d ? (t(this,
|
|
86
|
+
d ? (t(this, a).classList.toggle(
|
|
87
87
|
"all-params-matched",
|
|
88
88
|
u.size === d
|
|
89
|
-
), t(this,
|
|
89
|
+
), t(this, a).classList.toggle(
|
|
90
90
|
"some-params-matched",
|
|
91
91
|
u.size !== d
|
|
92
|
-
)) : !u.size && t(this,
|
|
93
|
-
for (const w in t(this,
|
|
94
|
-
const st =
|
|
92
|
+
)) : !u.size && t(this, a).hasAttribute("data-match-no-params") ? t(this, a).classList.add("all-params-matched") : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
|
|
93
|
+
for (const w in t(this, a).dataset) {
|
|
94
|
+
const st = re(w);
|
|
95
95
|
if (st.startsWith("match-param-")) {
|
|
96
|
-
const $ = st.split("match-param-")[1], S = t(this,
|
|
97
|
-
u.has($) && u.get($) === S || !u.has($) && (S === "" || S === "*" || S === "all" || S === "any" || S === "vse") ? t(this,
|
|
96
|
+
const $ = st.split("match-param-")[1], S = t(this, a).dataset[w], c = `param-${$}-matched`;
|
|
97
|
+
u.has($) && u.get($) === S || !u.has($) && (S === "" || S === "*" || S === "all" || S === "any" || S === "vse") ? t(this, a).classList.add(c) : t(this, a).classList.remove(c);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
updatePagination(e, s) {
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
if (
|
|
102
|
+
const i = g(this, x, Ht).call(this, s);
|
|
103
|
+
if (i)
|
|
104
|
+
if (i.element.setAttribute(
|
|
105
105
|
"data-current-page",
|
|
106
106
|
e.toString()
|
|
107
|
-
), t(this,
|
|
108
|
-
if (e <
|
|
109
|
-
t(this,
|
|
110
|
-
const n = t(this,
|
|
107
|
+
), t(this, a).hasAttribute("data-pagination-more-link"))
|
|
108
|
+
if (e < i.totalPages) {
|
|
109
|
+
t(this, a).style.display = "";
|
|
110
|
+
const n = t(this, a).querySelector(
|
|
111
111
|
"[data-pagination-more-link-counter]"
|
|
112
112
|
);
|
|
113
|
-
n && (n.textContent = (
|
|
114
|
-
const E = t(this,
|
|
113
|
+
n && (n.textContent = (i.totalPages - e).toString());
|
|
114
|
+
const E = t(this, a).getAttribute("href"), f = new URL(E, window.location.origin);
|
|
115
115
|
f.searchParams.set("page", (e + 1).toString());
|
|
116
116
|
const u = f.href.replace(f.origin, "").toString();
|
|
117
|
-
t(this,
|
|
117
|
+
t(this, a).setAttribute("href", u), this.checkCurrent(u);
|
|
118
118
|
} else
|
|
119
|
-
t(this,
|
|
120
|
-
else if (t(this,
|
|
121
|
-
const n = t(this,
|
|
119
|
+
t(this, a).style.display = "none";
|
|
120
|
+
else if (t(this, a).hasAttribute("data-pagination-prev-link") || t(this, a).hasAttribute("data-pagination-next-link")) {
|
|
121
|
+
const n = t(this, a).hasAttribute("data-pagination-prev-link"), E = t(this, a).getAttribute("href"), f = new URL(E, window.location.origin), u = e + (n ? -1 : 1);
|
|
122
122
|
f.searchParams.set(
|
|
123
123
|
"page",
|
|
124
|
-
|
|
124
|
+
Pe(u, 1, i.totalPages).toString()
|
|
125
125
|
);
|
|
126
126
|
const d = f.href.replace(f.origin, "").toString();
|
|
127
|
-
t(this,
|
|
128
|
-
} else t(this,
|
|
127
|
+
t(this, a).setAttribute("href", d), n ? u < 1 ? (t(this, a).classList.add("pagination-disabled"), t(this, a).setAttribute("tabindex", "-1")) : (t(this, a).classList.remove("pagination-disabled"), t(this, a).removeAttribute("tabindex")) : u > i.totalPages ? (t(this, a).classList.add("pagination-disabled"), t(this, a).setAttribute("tabindex", "-1")) : (t(this, a).classList.remove("pagination-disabled"), t(this, a).removeAttribute("tabindex"));
|
|
128
|
+
} 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"));
|
|
129
129
|
}
|
|
130
130
|
destroy() {
|
|
131
|
-
t(this,
|
|
131
|
+
t(this, a).removeEventListener("click", t(this, gt)), t(this, a).removeEventListener("pointerenter", t(this, nt)), t(this, a).classList.remove("current", "exact", "pagination-current");
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
R = new WeakMap(),
|
|
135
|
-
const e = new URL(t(this,
|
|
134
|
+
R = new WeakMap(), a = new WeakMap(), x = new WeakSet(), it = function() {
|
|
135
|
+
const e = new URL(t(this, a).href);
|
|
136
136
|
return t(this, R).normalizePath(
|
|
137
137
|
e.pathname + e.search + e.hash
|
|
138
138
|
).path;
|
|
139
|
-
},
|
|
139
|
+
}, Ht = function(e) {
|
|
140
140
|
if (!e)
|
|
141
141
|
return;
|
|
142
142
|
const s = document.querySelector(e);
|
|
143
143
|
if (s) {
|
|
144
|
-
const
|
|
144
|
+
const i = parseInt(
|
|
145
145
|
s.getAttribute("data-current-page") || "1"
|
|
146
146
|
), n = parseInt(
|
|
147
147
|
s.getAttribute("data-total-pages") || "1"
|
|
148
148
|
);
|
|
149
149
|
return {
|
|
150
150
|
element: s,
|
|
151
|
-
currentPage:
|
|
151
|
+
currentPage: i,
|
|
152
152
|
totalPages: n,
|
|
153
153
|
selector: e
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
},
|
|
156
|
+
}, he = function() {
|
|
157
157
|
var s;
|
|
158
158
|
if (document.documentElement.classList.contains("click-disabled"))
|
|
159
159
|
return;
|
|
160
|
-
if (t(this,
|
|
160
|
+
if (t(this, a).hasAttribute("data-back") && t(this, R).previousURL)
|
|
161
161
|
history.back();
|
|
162
162
|
else {
|
|
163
|
-
const
|
|
163
|
+
const i = t(this, a).getAttribute(
|
|
164
164
|
"data-history-action"
|
|
165
|
-
) || "push", n = t(this,
|
|
165
|
+
) || "push", n = t(this, a).hasAttribute("data-center-scroll"), E = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), f = E ? ke.parse(E) : void 0, u = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link") || t(this, a).hasAttribute("data-pagination-next-link") || t(this, a).hasAttribute("data-pagination-prev-link"), d = t(this, a).hasAttribute(
|
|
166
166
|
"data-keep-search-parameters"
|
|
167
|
-
), v = t(this,
|
|
167
|
+
), v = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link"), et = t(this, a).getAttribute(
|
|
168
168
|
"data-scroll-behaviour"
|
|
169
|
-
), w = ((s = t(this,
|
|
170
|
-
t(this,
|
|
171
|
-
] || t(this,
|
|
172
|
-
t(this,
|
|
173
|
-
] || t(this,
|
|
174
|
-
t(this,
|
|
175
|
-
] || t(this,
|
|
176
|
-
t(this,
|
|
177
|
-
] || void 0, st = t(this,
|
|
178
|
-
let $ = t(this, x,
|
|
179
|
-
if (t(this,
|
|
180
|
-
const [c,
|
|
169
|
+
), w = ((s = t(this, a).getAttribute("data-submorph")) == null ? void 0 : s.split(",").map((c) => c.trim())) || t(this, a).hasAttribute("data-pagination-more-link") && [
|
|
170
|
+
t(this, a).getAttribute("data-pagination-more-link")
|
|
171
|
+
] || t(this, a).hasAttribute("data-pagination-set-link") && [
|
|
172
|
+
t(this, a).getAttribute("data-pagination-set-link")
|
|
173
|
+
] || t(this, a).hasAttribute("data-pagination-next-link") && [
|
|
174
|
+
t(this, a).getAttribute("data-pagination-next-link")
|
|
175
|
+
] || t(this, a).hasAttribute("data-pagination-prev-link") && [
|
|
176
|
+
t(this, a).getAttribute("data-pagination-prev-link")
|
|
177
|
+
] || void 0, st = t(this, a).hasAttribute("data-clear-state");
|
|
178
|
+
let $ = t(this, x, it);
|
|
179
|
+
if (t(this, a).hasAttribute("data-toggle-params")) {
|
|
180
|
+
const [c, kt] = t(this, x, it).split("?"), j = new URLSearchParams(kt), V = new URLSearchParams(location.search), at = new URLSearchParams();
|
|
181
181
|
for (const [y] of j)
|
|
182
|
-
(!V.has(y) || V.has(y) && V.get(y) !== j.get(y)) &&
|
|
183
|
-
if (t(this,
|
|
182
|
+
(!V.has(y) || V.has(y) && V.get(y) !== j.get(y)) && at.append(y, j.get(y));
|
|
183
|
+
if (t(this, a).hasAttribute("data-merge-params"))
|
|
184
184
|
for (const [y] of V)
|
|
185
|
-
j.has(y) ||
|
|
186
|
-
$ = `${c}?${
|
|
185
|
+
j.has(y) || at.append(y, V.get(y));
|
|
186
|
+
$ = `${c}?${at.toString()}`;
|
|
187
187
|
}
|
|
188
|
-
const S =
|
|
189
|
-
S && (t(this,
|
|
188
|
+
const S = g(this, x, Ht).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link") || t(this, a).getAttribute("data-pagination-next-link") || t(this, a).getAttribute("data-pagination-prev-link"));
|
|
189
|
+
S && (t(this, a).hasAttribute("data-pagination-set-link") ? t(this, R).links.forEach((c) => {
|
|
190
190
|
c.updatePagination(
|
|
191
|
-
parseInt(t(this,
|
|
191
|
+
parseInt(t(this, a).getAttribute("data-value") || "1"),
|
|
192
192
|
S.selector
|
|
193
193
|
);
|
|
194
|
-
}) : t(this,
|
|
194
|
+
}) : t(this, a).hasAttribute("data-pagination-prev-link") ? t(this, R).links.forEach((c) => {
|
|
195
195
|
c.updatePagination(
|
|
196
196
|
S.currentPage - 1,
|
|
197
197
|
S.selector
|
|
198
198
|
);
|
|
199
|
-
}) : t(this,
|
|
199
|
+
}) : t(this, a).hasAttribute("data-pagination-next-link") ? t(this, R).links.forEach((c) => {
|
|
200
200
|
c.updatePagination(
|
|
201
201
|
S.currentPage + 1,
|
|
202
202
|
S.selector
|
|
203
203
|
);
|
|
204
|
-
}) : t(this,
|
|
204
|
+
}) : t(this, a).hasAttribute("data-pagination-more-link") && t(this, R).links.forEach((c) => {
|
|
205
205
|
c.updatePagination(
|
|
206
206
|
S.currentPage + 1,
|
|
207
207
|
S.selector
|
|
208
208
|
);
|
|
209
209
|
})), t(this, R).navigate($, {
|
|
210
|
-
historyAction:
|
|
210
|
+
historyAction: i,
|
|
211
211
|
centerScroll: n,
|
|
212
212
|
offsetScroll: f,
|
|
213
213
|
revalidate: u,
|
|
@@ -216,14 +216,14 @@ R = new WeakMap(), i = new WeakMap(), x = new WeakSet(), at = function() {
|
|
|
216
216
|
clearState: st,
|
|
217
217
|
keepScrollPosition: v,
|
|
218
218
|
scrollBehaviour: et,
|
|
219
|
-
submorphAppend: t(this,
|
|
220
|
-
mergeParams: !!S || t(this,
|
|
219
|
+
submorphAppend: t(this, a).hasAttribute("data-pagination-more-link"),
|
|
220
|
+
mergeParams: !!S || t(this, a).hasAttribute("data-merge-params") && !t(this, a).hasAttribute("data-toggle-params")
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
-
},
|
|
224
|
-
const
|
|
225
|
-
var q, J, H, I, Q, O, rt, Z, B,
|
|
226
|
-
class
|
|
223
|
+
}, gt = new WeakMap(), nt = new WeakMap();
|
|
224
|
+
const we = new DOMParser();
|
|
225
|
+
var q, J, H, I, Q, O, rt, Z, B, bt, ot;
|
|
226
|
+
class ae {
|
|
227
227
|
constructor(e, s) {
|
|
228
228
|
l(this, q);
|
|
229
229
|
l(this, J);
|
|
@@ -234,7 +234,8 @@ class se {
|
|
|
234
234
|
l(this, rt, null);
|
|
235
235
|
l(this, Z, null);
|
|
236
236
|
l(this, B, null);
|
|
237
|
-
l(this,
|
|
237
|
+
l(this, bt);
|
|
238
|
+
l(this, ot, !1);
|
|
238
239
|
o(this, q, e), o(this, J, s);
|
|
239
240
|
}
|
|
240
241
|
get pathname() {
|
|
@@ -246,8 +247,11 @@ class se {
|
|
|
246
247
|
get document() {
|
|
247
248
|
return t(this, O);
|
|
248
249
|
}
|
|
250
|
+
needRavalidation() {
|
|
251
|
+
o(this, ot, !0);
|
|
252
|
+
}
|
|
249
253
|
setHeaders(e) {
|
|
250
|
-
o(this,
|
|
254
|
+
o(this, bt, e);
|
|
251
255
|
}
|
|
252
256
|
setInitialDocument(e) {
|
|
253
257
|
o(this, I, e.cloneNode(!0));
|
|
@@ -258,10 +262,10 @@ class se {
|
|
|
258
262
|
`[${t(this, J)}] page loading cancelled`
|
|
259
263
|
);
|
|
260
264
|
}
|
|
261
|
-
fetch(e, s,
|
|
265
|
+
fetch(e, s, i) {
|
|
262
266
|
return G(this, null, function* () {
|
|
263
267
|
var n;
|
|
264
|
-
if (!
|
|
268
|
+
if (!i && !t(this, ot)) {
|
|
265
269
|
const u = ((n = t(this, I)) == null ? void 0 : n.documentElement.getAttribute("data-cache")) && s !== e, d = t(this, I) && t(this, q).isPopstateNavigation;
|
|
266
270
|
if (t(this, B) || u || d)
|
|
267
271
|
return t(this, B);
|
|
@@ -271,13 +275,13 @@ class se {
|
|
|
271
275
|
o(this, Z, new AbortController());
|
|
272
276
|
const u = yield (yield fetch(e, {
|
|
273
277
|
signal: t(this, Z).signal,
|
|
274
|
-
headers:
|
|
278
|
+
headers: xt({
|
|
275
279
|
"X-MORPH": "true",
|
|
276
280
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(s),
|
|
277
281
|
"X-MORPH-NEW-PATH": encodeURIComponent(e)
|
|
278
|
-
}, t(this,
|
|
279
|
-
})).text(), d =
|
|
280
|
-
this.setInitialDocument(d);
|
|
282
|
+
}, t(this, bt))
|
|
283
|
+
})).text(), d = we.parseFromString(u, "text/html");
|
|
284
|
+
this.setInitialDocument(d), o(this, ot, !1);
|
|
281
285
|
} catch (f) {
|
|
282
286
|
console.warn(f);
|
|
283
287
|
} finally {
|
|
@@ -337,22 +341,22 @@ class se {
|
|
|
337
341
|
return o(this, rt, null), e;
|
|
338
342
|
}
|
|
339
343
|
}
|
|
340
|
-
q = new WeakMap(), J = new WeakMap(), H = new WeakMap(), I = new WeakMap(), Q = new WeakMap(), O = new WeakMap(), rt = new WeakMap(), Z = new WeakMap(), B = new WeakMap(),
|
|
341
|
-
var U,
|
|
342
|
-
class
|
|
344
|
+
q = new WeakMap(), J = new WeakMap(), H = new WeakMap(), I = new WeakMap(), Q = new WeakMap(), O = new WeakMap(), rt = new WeakMap(), Z = new WeakMap(), B = new WeakMap(), bt = new WeakMap(), ot = new WeakMap();
|
|
345
|
+
var U, ht, Et, Wt, vt;
|
|
346
|
+
class Ce {
|
|
343
347
|
constructor(e) {
|
|
344
|
-
l(this,
|
|
348
|
+
l(this, Et);
|
|
345
349
|
l(this, U);
|
|
346
|
-
l(this,
|
|
347
|
-
l(this,
|
|
348
|
-
|
|
350
|
+
l(this, ht, []);
|
|
351
|
+
l(this, vt, () => {
|
|
352
|
+
g(this, Et, Wt).call(this);
|
|
349
353
|
});
|
|
350
354
|
o(this, U, e);
|
|
351
355
|
for (const s in t(this, U).dataset) {
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const n =
|
|
355
|
-
t(this,
|
|
356
|
+
const i = re(s);
|
|
357
|
+
if (i.startsWith("param-")) {
|
|
358
|
+
const n = i.split("param-")[1], E = t(this, U).dataset[s];
|
|
359
|
+
t(this, ht).push({
|
|
356
360
|
name: n,
|
|
357
361
|
value: E
|
|
358
362
|
});
|
|
@@ -360,65 +364,65 @@ class we {
|
|
|
360
364
|
}
|
|
361
365
|
document.addEventListener(
|
|
362
366
|
"morphURLParametersChange",
|
|
363
|
-
t(this,
|
|
364
|
-
),
|
|
367
|
+
t(this, vt)
|
|
368
|
+
), g(this, Et, Wt).call(this);
|
|
365
369
|
}
|
|
366
370
|
destroy() {
|
|
367
371
|
document.removeEventListener(
|
|
368
372
|
"morphURLParametersChange",
|
|
369
|
-
t(this,
|
|
373
|
+
t(this, vt)
|
|
370
374
|
);
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
|
-
U = new WeakMap(),
|
|
377
|
+
U = new WeakMap(), ht = new WeakMap(), Et = new WeakSet(), Wt = function() {
|
|
374
378
|
const e = new URLSearchParams(location.search);
|
|
375
|
-
let s = !!t(this,
|
|
376
|
-
!s && t(this, U).hasAttribute("data-match-no-params") && (s = !t(this,
|
|
377
|
-
const
|
|
378
|
-
s ?
|
|
379
|
-
},
|
|
380
|
-
var D,
|
|
381
|
-
const
|
|
379
|
+
let s = !!t(this, ht).find((n) => e.has(n.name) && (e.get(n.name) === n.value || n.value === "*" || n.value === "all" || n.value === "any" || n.value === "vse" || e.get(n.name) === "*" || e.get(n.name) === "all" || e.get(n.name) === "any" || e.get(n.name) === "vse"));
|
|
380
|
+
!s && t(this, U).hasAttribute("data-match-no-params") && (s = !t(this, ht).filter((n) => e.has(n.name)).length);
|
|
381
|
+
const i = t(this, U).getAttribute("data-hide-class");
|
|
382
|
+
s ? i ? t(this, U).classList.remove(i) : t(this, U).style.display = "" : i ? t(this, U).classList.add(i) : t(this, U).style.display = "none";
|
|
383
|
+
}, vt = new WeakMap();
|
|
384
|
+
var D, lt, P, X, b, _, K, Y, M, Lt, W, St, tt, ct, dt, yt, ut, At, p, Vt, Pt, pt, Ft, le, Ot, Bt, Xt, Kt, Ut, mt;
|
|
385
|
+
const ft = class ft {
|
|
382
386
|
constructor(e) {
|
|
383
387
|
l(this, p);
|
|
384
388
|
l(this, D, null);
|
|
385
|
-
l(this,
|
|
389
|
+
l(this, lt, null);
|
|
386
390
|
l(this, P, []);
|
|
387
391
|
l(this, X);
|
|
388
|
-
l(this,
|
|
392
|
+
l(this, b, null);
|
|
389
393
|
l(this, _);
|
|
390
394
|
l(this, K, []);
|
|
391
395
|
l(this, Y, !1);
|
|
392
396
|
l(this, M, null);
|
|
393
|
-
l(this,
|
|
397
|
+
l(this, Lt, !1);
|
|
394
398
|
l(this, W, /* @__PURE__ */ new Map());
|
|
395
|
-
l(this,
|
|
399
|
+
l(this, St, []);
|
|
396
400
|
l(this, tt, null);
|
|
397
|
-
l(this, lt, 0);
|
|
398
401
|
l(this, ct, 0);
|
|
399
|
-
l(this,
|
|
400
|
-
l(this,
|
|
401
|
-
l(this,
|
|
402
|
-
l(this,
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
l(this, dt, 0);
|
|
403
|
+
l(this, yt);
|
|
404
|
+
l(this, ut);
|
|
405
|
+
l(this, At);
|
|
406
|
+
l(this, Pt, (e) => {
|
|
407
|
+
var s, i;
|
|
408
|
+
return (((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) || ((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";
|
|
405
409
|
});
|
|
406
|
-
l(this,
|
|
410
|
+
l(this, Ut, (e) => G(this, null, function* () {
|
|
407
411
|
e.preventDefault(), o(this, Y, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
408
412
|
historyAction: "none",
|
|
409
|
-
submorph: t(this,
|
|
410
|
-
revalidate: t(this,
|
|
411
|
-
keepScrollPosition: t(this,
|
|
413
|
+
submorph: t(this, ut) ? void 0 : t(this, yt),
|
|
414
|
+
revalidate: t(this, ut),
|
|
415
|
+
keepScrollPosition: t(this, At)
|
|
412
416
|
}), o(this, Y, !1);
|
|
413
417
|
}));
|
|
414
|
-
l(this,
|
|
415
|
-
const { left: e, top: s } = this.scrollValue,
|
|
416
|
-
o(this,
|
|
418
|
+
l(this, mt, () => {
|
|
419
|
+
const { left: e, top: s } = this.scrollValue, i = s - t(this, dt), n = e - t(this, ct);
|
|
420
|
+
o(this, dt, s), o(this, ct, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
|
|
417
421
|
"scroll-y-forward",
|
|
418
|
-
|
|
422
|
+
i > 0
|
|
419
423
|
), document.documentElement.classList.toggle(
|
|
420
424
|
"scroll-y-backward",
|
|
421
|
-
|
|
425
|
+
i < 0
|
|
422
426
|
), document.documentElement.classList.toggle(
|
|
423
427
|
"scroll-x-forward",
|
|
424
428
|
n > 0
|
|
@@ -432,35 +436,35 @@ const mt = class mt {
|
|
|
432
436
|
}
|
|
433
437
|
});
|
|
434
438
|
});
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
base:
|
|
439
|
+
if (ne && !ft.instance) {
|
|
440
|
+
ft.instance = this, o(this, D, {
|
|
441
|
+
base: ye(e == null ? void 0 : e.base),
|
|
438
442
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
439
443
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
440
444
|
scrollSelector: e == null ? void 0 : e.scrollSelector,
|
|
441
445
|
morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
|
|
442
|
-
}), o(this,
|
|
446
|
+
}), o(this, lt, g(this, p, Ft).call(this, document.body));
|
|
443
447
|
const s = this.normalizePath(
|
|
444
448
|
location.pathname + location.search + location.hash
|
|
445
449
|
);
|
|
446
|
-
o(this,
|
|
447
|
-
const
|
|
448
|
-
|
|
450
|
+
o(this, b, s);
|
|
451
|
+
const i = new ae(this, t(this, b).pathname);
|
|
452
|
+
i.setInitialDocument(document), t(this, W).set(t(this, b).pathname, i), document.documentElement.setAttribute(
|
|
449
453
|
"data-current-pathname",
|
|
450
|
-
t(this,
|
|
454
|
+
t(this, b).pathname
|
|
451
455
|
), document.documentElement.setAttribute(
|
|
452
456
|
"data-current-leaf",
|
|
453
457
|
s.leaf
|
|
454
|
-
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this,
|
|
458
|
+
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, Ut)), qt({
|
|
455
459
|
action: "replace",
|
|
456
460
|
pathname: s.pathname,
|
|
457
461
|
searchParameters: s.parameters,
|
|
458
462
|
hash: s.hash
|
|
459
|
-
}), o(this, tt, new
|
|
463
|
+
}), o(this, tt, new oe()), g(this, p, Xt).call(this, document);
|
|
460
464
|
}
|
|
461
465
|
}
|
|
462
466
|
get currentURL() {
|
|
463
|
-
return t(this,
|
|
467
|
+
return t(this, b);
|
|
464
468
|
}
|
|
465
469
|
get previousURL() {
|
|
466
470
|
return t(this, _);
|
|
@@ -476,18 +480,18 @@ const mt = class mt {
|
|
|
476
480
|
}
|
|
477
481
|
get scrollValue() {
|
|
478
482
|
let e = 0, s = 0;
|
|
479
|
-
return t(this,
|
|
483
|
+
return t(this, Lt) ? (e = window.scrollY, s = window.scrollX) : (e = t(this, M).scrollTop, s = t(this, M).scrollLeft), { top: e, left: s };
|
|
480
484
|
}
|
|
481
485
|
saveState(e) {
|
|
482
|
-
const s = t(this, W).get(t(this,
|
|
486
|
+
const s = t(this, W).get(t(this, b).path);
|
|
483
487
|
s && s.saveState(e);
|
|
484
488
|
}
|
|
485
489
|
getState() {
|
|
486
|
-
const e = t(this, W).get(t(this,
|
|
490
|
+
const e = t(this, W).get(t(this, b).path);
|
|
487
491
|
return e == null ? void 0 : e.clearState();
|
|
488
492
|
}
|
|
489
493
|
normalizePath(e, s) {
|
|
490
|
-
return
|
|
494
|
+
return Ae(e, {
|
|
491
495
|
base: t(this, D).base,
|
|
492
496
|
trailingSlash: t(this, D).trailingSlash,
|
|
493
497
|
mergeParams: s != null && s.mergeParams ? location.search : ""
|
|
@@ -499,8 +503,8 @@ const mt = class mt {
|
|
|
499
503
|
if (t(this, K).length)
|
|
500
504
|
return;
|
|
501
505
|
e = ((n = this.pathnameModifier) == null ? void 0 : n.call(this, e)) || e;
|
|
502
|
-
const
|
|
503
|
-
|
|
506
|
+
const i = g(this, p, pt).call(this, e);
|
|
507
|
+
i == null || i.fetch(e, t(this, b).path, s);
|
|
504
508
|
});
|
|
505
509
|
}
|
|
506
510
|
excludeHeadChild(e) {
|
|
@@ -508,10 +512,14 @@ const mt = class mt {
|
|
|
508
512
|
}
|
|
509
513
|
setHeaders(e) {
|
|
510
514
|
}
|
|
515
|
+
needRavalidation(e) {
|
|
516
|
+
const s = this.normalizePath(e), i = g(this, p, pt).call(this, s.path);
|
|
517
|
+
i == null || i.needRavalidation();
|
|
518
|
+
}
|
|
511
519
|
navigate($) {
|
|
512
520
|
return G(this, arguments, function* (e, {
|
|
513
521
|
historyAction: s = "push",
|
|
514
|
-
centerScroll:
|
|
522
|
+
centerScroll: i,
|
|
515
523
|
offsetScroll: n,
|
|
516
524
|
scrollBehaviour: E,
|
|
517
525
|
revalidate: f,
|
|
@@ -522,28 +530,28 @@ const mt = class mt {
|
|
|
522
530
|
keepScrollPosition: w,
|
|
523
531
|
mergeParams: st
|
|
524
532
|
} = {}) {
|
|
525
|
-
var
|
|
533
|
+
var kt, j, V, at;
|
|
526
534
|
if (t(this, K).length)
|
|
527
535
|
return;
|
|
528
|
-
o(this,
|
|
529
|
-
const S = ((
|
|
536
|
+
o(this, yt, d), o(this, ut, f), o(this, At, w);
|
|
537
|
+
const S = ((kt = this.pathnameModifier) == null ? void 0 : kt.call(this, e)) || e, c = this.normalizePath(S, {
|
|
530
538
|
mergeParams: st
|
|
531
539
|
});
|
|
532
|
-
if (!f && (((j = t(this, X)) == null ? void 0 : j.pathname) === c.pathname || t(this,
|
|
533
|
-
w ||
|
|
534
|
-
centerScroll:
|
|
540
|
+
if (!f && (((j = t(this, X)) == null ? void 0 : j.pathname) === c.pathname || t(this, b).pathname === c.pathname)) {
|
|
541
|
+
w || g(this, p, Kt).call(this, c.hash || 0, {
|
|
542
|
+
centerScroll: i,
|
|
535
543
|
offsetScroll: n,
|
|
536
544
|
behavior: "smooth"
|
|
537
545
|
}), z(document, "morphSamePath", {
|
|
538
546
|
custom: !0
|
|
539
|
-
}), ((V = t(this,
|
|
540
|
-
action: ((
|
|
547
|
+
}), ((V = t(this, b)) == null ? void 0 : V.parameters) !== c.parameters && (o(this, _, t(this, b)), o(this, b, c), qt({
|
|
548
|
+
action: ((at = t(this, b)) == null ? void 0 : at.hash) !== c.hash ? "replace" : s,
|
|
541
549
|
pathname: c.pathname,
|
|
542
550
|
searchParameters: c.parameters,
|
|
543
551
|
hash: c.hash
|
|
544
552
|
}), z(document, "morphURLParametersChange", {
|
|
545
553
|
detail: {
|
|
546
|
-
newURL: t(this,
|
|
554
|
+
newURL: t(this, b),
|
|
547
555
|
previousURL: t(this, _)
|
|
548
556
|
}
|
|
549
557
|
})), t(this, P).forEach((y) => {
|
|
@@ -573,11 +581,11 @@ const mt = class mt {
|
|
|
573
581
|
}
|
|
574
582
|
if (!y || t(this, X).pathname !== c.pathname) {
|
|
575
583
|
t(this, P).forEach((r) => {
|
|
576
|
-
r.checkCurrent(t(this,
|
|
584
|
+
r.checkCurrent(t(this, b).path);
|
|
577
585
|
});
|
|
578
586
|
return;
|
|
579
587
|
}
|
|
580
|
-
const
|
|
588
|
+
const Yt = {
|
|
581
589
|
url: c,
|
|
582
590
|
submorph: d
|
|
583
591
|
};
|
|
@@ -585,102 +593,102 @@ const mt = class mt {
|
|
|
585
593
|
document.querySelectorAll(r).forEach((k) => {
|
|
586
594
|
k.classList.add("out"), k.setAttribute("data-morph-out", "");
|
|
587
595
|
});
|
|
588
|
-
}) : t(this,
|
|
596
|
+
}) : t(this, lt).forEach((r) => {
|
|
589
597
|
var k, T;
|
|
590
598
|
(k = r.firstElementChild) == null || k.classList.add("out"), (T = r.firstElementChild) == null || T.setAttribute("data-morph-out", "");
|
|
591
599
|
}), z(document, "morphNavigation", {
|
|
592
|
-
detail:
|
|
600
|
+
detail: Yt
|
|
593
601
|
});
|
|
594
|
-
const
|
|
602
|
+
const Tt = g(this, p, pt).call(this, t(this, b).pathname), A = g(this, p, pt).call(this, c.pathname);
|
|
595
603
|
if (t(this, W).forEach((r) => {
|
|
596
604
|
r.pathname !== c.pathname && r.abort();
|
|
597
|
-
}), yield A == null ? void 0 : A.fetch(S, t(this,
|
|
605
|
+
}), yield A == null ? void 0 : A.fetch(S, t(this, b).path, f), t(this, X).pathname !== c.pathname) {
|
|
598
606
|
t(this, P).forEach((r) => {
|
|
599
|
-
r.checkCurrent(t(this,
|
|
607
|
+
r.checkCurrent(t(this, b).path);
|
|
600
608
|
});
|
|
601
609
|
return;
|
|
602
610
|
}
|
|
603
|
-
|
|
604
|
-
const
|
|
611
|
+
Tt.clearState(), Tt.saveScrollState(), Tt.saveDocumentState(), (!t(this, Y) || f) && (A.clearScrollState(), A.clearDocumentState()), et && A.clearState(), A.cloneDocument(), t(this, tt).textContent = A.title, document.body.appendChild(t(this, tt));
|
|
612
|
+
const wt = Dt(xt({}, Yt), {
|
|
605
613
|
document: A.document
|
|
606
614
|
});
|
|
607
|
-
v ||
|
|
615
|
+
v || wt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
608
616
|
r.classList.remove("out");
|
|
609
617
|
}), z(document, "morphStart", {
|
|
610
|
-
detail:
|
|
618
|
+
detail: wt
|
|
611
619
|
});
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
r.tagName === "SCRIPT" && (
|
|
615
|
-
}),
|
|
620
|
+
const $t = Array.from(document.head.children), jt = Array.from(A.document.head.children), Gt = g(this, p, le).call(this, $t, jt), ce = g(this, p, Ot).call(this, $t, Gt), Ct = g(this, p, Ot).call(this, jt, Gt).filter((r) => !this.excludeHeadChild(r));
|
|
621
|
+
Ct.forEach((r, k) => {
|
|
622
|
+
r.tagName === "SCRIPT" && (Ct[k] = g(this, p, Vt).call(this, r));
|
|
623
|
+
}), Ct.forEach((r) => {
|
|
616
624
|
document.head.appendChild(r);
|
|
617
625
|
});
|
|
618
|
-
const
|
|
626
|
+
const Mt = Ct.filter((r) => {
|
|
619
627
|
if (r.hasAttribute("data-no-waiting"))
|
|
620
628
|
return !1;
|
|
621
|
-
if (
|
|
629
|
+
if (g(this, p, Bt).call(this, r))
|
|
622
630
|
return !0;
|
|
623
631
|
});
|
|
624
|
-
t(this, D).waitForHeadToLoad &&
|
|
632
|
+
t(this, D).waitForHeadToLoad && Mt.length && (yield new Promise((r) => G(this, null, function* () {
|
|
625
633
|
let k = 0;
|
|
626
634
|
try {
|
|
627
|
-
for (var T =
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
k++, k ===
|
|
635
|
+
for (var T = se(Mt), ue, F, N; ue = !(F = yield T.next()).done; ue = !1) {
|
|
636
|
+
const Rt = F.value;
|
|
637
|
+
Rt.onload = () => {
|
|
638
|
+
k++, k === Mt.length && r();
|
|
631
639
|
};
|
|
632
640
|
}
|
|
633
641
|
} catch (F) {
|
|
634
642
|
N = [F];
|
|
635
643
|
} finally {
|
|
636
644
|
try {
|
|
637
|
-
|
|
645
|
+
ue && (F = T.return) && (yield F.call(T));
|
|
638
646
|
} finally {
|
|
639
647
|
if (N)
|
|
640
648
|
throw N[0];
|
|
641
649
|
}
|
|
642
650
|
}
|
|
643
|
-
}))), yield
|
|
644
|
-
const
|
|
645
|
-
v ||
|
|
646
|
-
r.hasAttribute("data-permanent") || (
|
|
651
|
+
}))), yield Le(10);
|
|
652
|
+
const Jt = [];
|
|
653
|
+
v || ce.forEach((r) => {
|
|
654
|
+
r.hasAttribute("data-permanent") || (g(this, p, Bt).call(this, r) ? Jt.push(r) : r.remove());
|
|
647
655
|
});
|
|
648
|
-
const
|
|
649
|
-
!t(this, D).morphInsideScrollContainer && !d &&
|
|
656
|
+
const de = g(this, p, Ft).call(this, A.document.body);
|
|
657
|
+
!t(this, D).morphInsideScrollContainer && !d && g(this, p, Xt).call(this, A.document), document.documentElement.setAttribute(
|
|
650
658
|
"data-current-pathname",
|
|
651
659
|
c.pathname
|
|
652
660
|
), document.documentElement.setAttribute(
|
|
653
661
|
"data-current-leaf",
|
|
654
662
|
c.leaf
|
|
655
|
-
),
|
|
663
|
+
), qt({
|
|
656
664
|
action: s,
|
|
657
665
|
pathname: c.pathname,
|
|
658
666
|
searchParameters: c.parameters || (u ? location.search : ""),
|
|
659
667
|
hash: c.hash
|
|
660
|
-
}), t(this, tt).remove(), o(this, _, t(this,
|
|
661
|
-
const
|
|
662
|
-
t(this,
|
|
663
|
-
const T =
|
|
668
|
+
}), t(this, tt).remove(), o(this, _, t(this, b)), o(this, b, c);
|
|
669
|
+
const Nt = [];
|
|
670
|
+
t(this, lt).forEach((r, k) => {
|
|
671
|
+
const T = de[k], ue = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
664
672
|
let F = [], N = [];
|
|
665
673
|
d ? (d.forEach((m) => {
|
|
666
674
|
const L = r.querySelector(m), C = T.querySelector(m);
|
|
667
675
|
L && C && (N.push(L), F.push(C));
|
|
668
676
|
}), N.forEach((m) => {
|
|
669
|
-
m.parentElement &&
|
|
670
|
-
})) : (F.push(...T.childNodes), N.push(...r.childNodes),
|
|
671
|
-
const
|
|
677
|
+
m.parentElement && Nt.push(m.parentElement);
|
|
678
|
+
})) : (F.push(...T.childNodes), N.push(...r.childNodes), Nt.push(r));
|
|
679
|
+
const Rt = [];
|
|
672
680
|
v || N.forEach((m) => {
|
|
673
681
|
m instanceof HTMLElement && (this.destroyOldLinks(m), m.classList.add("old"), m.querySelectorAll(
|
|
674
682
|
"[data-morph-transfer]"
|
|
675
683
|
).forEach((C) => {
|
|
676
|
-
const
|
|
677
|
-
|
|
684
|
+
const pe = C.getAttribute("data-morph-transfer");
|
|
685
|
+
Rt.push({
|
|
678
686
|
element: C,
|
|
679
|
-
selector:
|
|
687
|
+
selector: pe
|
|
680
688
|
});
|
|
681
689
|
}));
|
|
682
690
|
}), F.forEach((m) => {
|
|
683
|
-
m instanceof HTMLElement && (
|
|
691
|
+
m instanceof HTMLElement && (Rt.forEach((L) => {
|
|
684
692
|
const C = m.querySelector(L.selector);
|
|
685
693
|
C && C.replaceWith(
|
|
686
694
|
A.document.importNode(L.element, !0)
|
|
@@ -705,13 +713,13 @@ const mt = class mt {
|
|
|
705
713
|
), m.classList.add("new-idle"));
|
|
706
714
|
});
|
|
707
715
|
}, 0);
|
|
708
|
-
const
|
|
716
|
+
const Qt = Dt(xt({}, wt), {
|
|
709
717
|
morphElement: r
|
|
710
718
|
});
|
|
711
719
|
z(document, "morphNewChildrenAdded", {
|
|
712
|
-
detail:
|
|
720
|
+
detail: Qt
|
|
713
721
|
});
|
|
714
|
-
const
|
|
722
|
+
const me = new Promise((m) => {
|
|
715
723
|
setTimeout(() => {
|
|
716
724
|
v || N.forEach((L) => {
|
|
717
725
|
L.remove();
|
|
@@ -721,11 +729,11 @@ const mt = class mt {
|
|
|
721
729
|
"--new-content-height"
|
|
722
730
|
), L.classList.remove("new-idle", "new"));
|
|
723
731
|
}), v || z(document, "morphOldChildrenRemoved", {
|
|
724
|
-
detail:
|
|
732
|
+
detail: Qt
|
|
725
733
|
}), m();
|
|
726
|
-
}, (parseFloat(
|
|
734
|
+
}, (parseFloat(ue) || 0) * 1e3 + 10);
|
|
727
735
|
});
|
|
728
|
-
t(this, K).push(
|
|
736
|
+
t(this, K).push(me);
|
|
729
737
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
730
738
|
"--new-document-scroll-position",
|
|
731
739
|
(this.scrollValue.top - A.scrollState.y) * 1 + "px"
|
|
@@ -734,18 +742,18 @@ const mt = class mt {
|
|
|
734
742
|
this.scrollValue.top + "px"
|
|
735
743
|
), z(document, "morphBeforeNavigationScroll", {
|
|
736
744
|
detail: A.scrollState
|
|
737
|
-
}), c.hash ? (A.clearScrollState(),
|
|
738
|
-
centerScroll:
|
|
745
|
+
}), c.hash ? (A.clearScrollState(), g(this, p, Kt).call(this, c.hash, {
|
|
746
|
+
centerScroll: i,
|
|
739
747
|
offsetScroll: n,
|
|
740
748
|
behavior: E
|
|
741
|
-
})) : t(this, Y) ? A.restoreScrollPosition() : w || A.renewScrollPosition(), yield Promise.all(t(this, K)), v ||
|
|
749
|
+
})) : t(this, Y) ? A.restoreScrollPosition() : w || A.renewScrollPosition(), yield Promise.all(t(this, K)), v || Jt.forEach((r) => r.remove()), o(this, K, []), Nt.forEach((r) => {
|
|
742
750
|
r.querySelectorAll("script").forEach((T) => {
|
|
743
|
-
T.replaceWith(
|
|
751
|
+
T.replaceWith(g(this, p, Vt).call(this, T));
|
|
744
752
|
});
|
|
745
753
|
}), t(this, P).forEach((r) => {
|
|
746
|
-
r.checkCurrent(t(this,
|
|
754
|
+
r.checkCurrent(t(this, b).path);
|
|
747
755
|
}), this.findParamsDependent(), z(document, "morphComplete", {
|
|
748
|
-
detail:
|
|
756
|
+
detail: wt
|
|
749
757
|
}), document.documentElement.style.removeProperty(
|
|
750
758
|
"--new-document-scroll-position"
|
|
751
759
|
), window.dispatchEvent(new Event("resize"));
|
|
@@ -756,7 +764,7 @@ const mt = class mt {
|
|
|
756
764
|
});
|
|
757
765
|
}
|
|
758
766
|
addLink(e) {
|
|
759
|
-
t(this, P).push(new
|
|
767
|
+
t(this, P).push(new It(e, this));
|
|
760
768
|
}
|
|
761
769
|
addLinks(e) {
|
|
762
770
|
e.forEach((s) => {
|
|
@@ -771,17 +779,17 @@ const mt = class mt {
|
|
|
771
779
|
}
|
|
772
780
|
findNewLinks(e) {
|
|
773
781
|
const s = [...e.querySelectorAll("a")].filter(
|
|
774
|
-
t(this,
|
|
782
|
+
t(this, Pt)
|
|
775
783
|
);
|
|
776
784
|
t(this, P).push(
|
|
777
|
-
...s.map((
|
|
785
|
+
...s.map((i) => new It(i, this))
|
|
778
786
|
);
|
|
779
787
|
}
|
|
780
788
|
findLinks() {
|
|
781
789
|
const e = [
|
|
782
790
|
...document.documentElement.querySelectorAll("a")
|
|
783
|
-
].filter(t(this,
|
|
784
|
-
t(this, P).forEach((s) => s.destroy()), o(this, P, e.map((s) => new
|
|
791
|
+
].filter(t(this, Pt));
|
|
792
|
+
t(this, P).forEach((s) => s.destroy()), o(this, P, e.map((s) => new It(s, this)));
|
|
785
793
|
}
|
|
786
794
|
findParamsDependent() {
|
|
787
795
|
const e = [
|
|
@@ -789,55 +797,55 @@ const mt = class mt {
|
|
|
789
797
|
"[data-morph-params-dependent]"
|
|
790
798
|
)
|
|
791
799
|
];
|
|
792
|
-
t(this,
|
|
793
|
-
(s) => new
|
|
800
|
+
t(this, St).forEach((s) => s.destroy()), o(this, St, e.map(
|
|
801
|
+
(s) => new Ce(s)
|
|
794
802
|
));
|
|
795
803
|
}
|
|
796
804
|
};
|
|
797
|
-
D = new WeakMap(),
|
|
805
|
+
D = new WeakMap(), lt = new WeakMap(), P = new WeakMap(), X = new WeakMap(), b = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), M = new WeakMap(), Lt = new WeakMap(), W = new WeakMap(), St = new WeakMap(), tt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), yt = new WeakMap(), ut = new WeakMap(), At = new WeakMap(), p = new WeakSet(), Vt = function(e) {
|
|
798
806
|
const s = document.createElement("script");
|
|
799
|
-
for (let
|
|
800
|
-
const n = e.attributes[
|
|
807
|
+
for (let i = 0; i < e.attributes.length; i++) {
|
|
808
|
+
const n = e.attributes[i];
|
|
801
809
|
s.setAttribute(n.name, n.value);
|
|
802
810
|
}
|
|
803
811
|
return e.hasAttribute("src") || (s.innerHTML = e.innerHTML), s;
|
|
804
|
-
},
|
|
812
|
+
}, Pt = new WeakMap(), pt = function(e) {
|
|
805
813
|
const s = this.normalizePath(e);
|
|
806
|
-
let
|
|
807
|
-
return
|
|
808
|
-
},
|
|
814
|
+
let i = t(this, W).get(s.pathname);
|
|
815
|
+
return i || (i = new ae(this, s.pathname), t(this, W).set(s.pathname, i)), i;
|
|
816
|
+
}, Ft = function(e) {
|
|
809
817
|
const s = [...e.querySelectorAll("[data-morph]")];
|
|
810
818
|
return s.length ? s : [e];
|
|
811
|
-
},
|
|
819
|
+
}, le = function(e, s) {
|
|
812
820
|
return e.filter(
|
|
813
|
-
(
|
|
814
|
-
(n) => n.outerHTML ===
|
|
821
|
+
(i) => s.find(
|
|
822
|
+
(n) => n.outerHTML === i.outerHTML
|
|
815
823
|
)
|
|
816
824
|
);
|
|
817
|
-
},
|
|
825
|
+
}, Ot = function(e, s) {
|
|
818
826
|
return e.filter(
|
|
819
|
-
(
|
|
820
|
-
(n) => n.outerHTML ===
|
|
827
|
+
(i) => !s.find(
|
|
828
|
+
(n) => n.outerHTML === i.outerHTML
|
|
821
829
|
)
|
|
822
830
|
);
|
|
823
|
-
}, Ot = function(e) {
|
|
824
|
-
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
825
831
|
}, Bt = function(e) {
|
|
826
|
-
|
|
832
|
+
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
833
|
+
}, Xt = function(e) {
|
|
834
|
+
var s, i;
|
|
827
835
|
(s = t(this, M)) == null || s.removeEventListener(
|
|
828
836
|
"scroll",
|
|
829
|
-
t(this,
|
|
830
|
-
), o(this,
|
|
831
|
-
},
|
|
832
|
-
const
|
|
833
|
-
(typeof
|
|
837
|
+
t(this, mt)
|
|
838
|
+
), o(this, dt, 0), o(this, ct, 0), o(this, M, t(this, D).scrollSelector && e.querySelector(t(this, D).scrollSelector) || window), o(this, Lt, t(this, M) === window), (i = t(this, M)) == null || i.addEventListener("scroll", t(this, mt)), t(this, mt).call(this);
|
|
839
|
+
}, Kt = function(e, s) {
|
|
840
|
+
const i = typeof e == "string" ? document.getElementById(e) : e;
|
|
841
|
+
(typeof i == "number" || i) && Se(i, {
|
|
834
842
|
scrollElement: t(this, M),
|
|
835
843
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
836
844
|
center: s == null ? void 0 : s.centerScroll,
|
|
837
845
|
offset: s == null ? void 0 : s.offsetScroll
|
|
838
846
|
});
|
|
839
|
-
},
|
|
840
|
-
let ie =
|
|
847
|
+
}, Ut = new WeakMap(), mt = new WeakMap(), ft.instance = null;
|
|
848
|
+
let ie = ft;
|
|
841
849
|
export {
|
|
842
850
|
ie as Morph
|
|
843
851
|
};
|