aptechka 0.51.16 → 0.52.1
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 +3 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +192 -185
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/{url-CfcHdBT6.js → url-B6BNcw6_.js} +4 -4
- package/lib/url-D1CgmwZ_.cjs +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +1 -1
- package/lib/url-CLvdjbII.cjs +0 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface MorphNavigateOptions {
|
|
|
28
28
|
centerScroll?: boolean;
|
|
29
29
|
offsetScroll?: number | ElementOrSelector<HTMLElement>;
|
|
30
30
|
revalidate?: boolean;
|
|
31
|
+
keepSearchParameters?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export interface MorphScrollDetail {
|
|
33
34
|
left: number;
|
|
@@ -49,6 +50,7 @@ export declare class Morph {
|
|
|
49
50
|
get previousPathname(): string | undefined;
|
|
50
51
|
get links(): MorphLink[];
|
|
51
52
|
get scrollElement(): HTMLElement;
|
|
53
|
+
get isPopstateNavigation(): boolean;
|
|
52
54
|
normalizePath(path: string): {
|
|
53
55
|
leaf: string;
|
|
54
56
|
pathname: string;
|
|
@@ -56,7 +58,7 @@ export declare class Morph {
|
|
|
56
58
|
hash: string;
|
|
57
59
|
};
|
|
58
60
|
prefetch(path: string): Promise<void>;
|
|
59
|
-
navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, }?: MorphNavigateOptions): Promise<void>;
|
|
61
|
+
navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, }?: MorphNavigateOptions): Promise<void>;
|
|
60
62
|
addLink(element: HTMLAnchorElement): void;
|
|
61
63
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
62
64
|
removeLink(element: HTMLAnchorElement): void;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var gt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),vt=n=>{throw TypeError(n)};var tt=(n,t,s)=>t.has(n)||vt("Cannot "+s);var e=(n,t,s)=>(tt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(tt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(tt(n,t,"access private method"),s);var T=(n,t,s)=>new Promise((i,u)=>{var f=c=>{try{M(s.next(c))}catch(g){u(g)}},O=c=>{try{M(s.throw(c))}catch(g){u(g)}},M=c=>c.done?i(c.value):Promise.resolve(c.value).then(f,O);M((s=s.apply(n,t)).next())});var Lt=(n,t,s)=>(t=n[gt("asyncIterator")])?t.call(n):(n=n[gt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=f=>new Promise((O,M,c)=>(f=u.call(n,f),c=f.done,Promise.resolve(f.value).then(g=>O({value:g,done:c}),M)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const wt=require("../index-Cqw2NKev.cjs"),_=require("../events-KVanG9sR.cjs"),Ht=require("../polyfills-Df4r-ETT.cjs"),xt=require("../scroll-H9zqFeML.cjs"),Q=require("../url-CLvdjbII.cjs"),Nt=require("../css-value-parser/index.cjs");class bt extends HTMLElement{connectedCallback(){const t={"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,i]of Object.entries(t))this.setAttribute(s,i)}}wt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",bt);var b,h,H,j,F;class St{constructor(t,s){o(this,b);o(this,h);o(this,H);o(this,j,t=>{t.preventDefault();const s=e(this,h).getAttribute("data-history-action")||"push",i=e(this,h).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),f=u?Nt.cssValueParser.parse(u):void 0,O=e(this,h).hasAttribute("data-revalidate");e(this,b).navigate(e(this,H),{historyAction:s,centerScroll:i,offsetScroll:f,revalidate:O})});o(this,F,()=>{e(this,b).prefetch(e(this,H)),e(this,h).removeEventListener("pointerenter",e(this,F))});a(this,b,s),a(this,h,t),a(this,H,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,j)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,F))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,b).normalizePath(t),i=e(this,b).normalizePath(e(this,H));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,j)),e(this,h).removeEventListener("pointerenter",e(this,F)),e(this,h).classList.remove("current")}}b=new WeakMap,h=new WeakMap,H=new WeakMap,j=new WeakMap,F=new WeakMap;var x,I,p,N,D,P;class yt{constructor(t,s,i){o(this,x);o(this,I);o(this,p,{x:0,y:0});o(this,N);o(this,D,null);o(this,P,null);a(this,x,t),a(this,I,s),a(this,N,i.cloneNode(!0))}get pathname(){return e(this,I)}get scrollState(){return e(this,p)}get document(){return e(this,P)}cloneDocument(){a(this,P,(e(this,D)||e(this,N)).cloneNode(!0))}get title(){let t="";if(e(this,P).title)t=e(this,P).title;else{const s=e(this,P).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,D,null)}saveScrollState(){e(this,N).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,x).scrollElement.scrollLeft,e(this,p).y=e(this,x).scrollElement.scrollTop)}saveDocumentState(){e(this,N).documentElement.hasAttribute("data-no-page-restoration")?a(this,D,null):a(this,D,document.cloneNode(!0))}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}x=new WeakMap,I=new WeakMap,p=new WeakMap,N=new WeakMap,D=new WeakMap,P=new WeakMap;var A,U,E,X,C,m,K,R,k,L,V,q,l,et,st,it,Pt,nt,rt,ot,at,Z,B;class Dt{constructor(t){o(this,l);o(this,A,null);o(this,U,null);o(this,E,[]);o(this,X,new DOMParser);o(this,C);o(this,m,null);o(this,K);o(this,R,[]);o(this,k,!1);o(this,L,null);o(this,V,new Map);o(this,q,null);o(this,Z,t=>T(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,k,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,k,!1))}));o(this,B,()=>{const t=e(this,L).scrollTop,s=e(this,L).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),_.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(wt.isBrowser){a(this,A,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,U,d(this,l,it).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,m,s.pathname),e(this,V).set(e(this,m),new yt(this,e(this,m),document)),document.documentElement.setAttribute("data-current-pathname",e(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,Z)),Q.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters,hash:s.hash}),a(this,q,new bt),d(this,l,ot).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,K)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}normalizePath(t){return Q.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t){return T(this,null,function*(){const s=this.normalizePath(t);d(this,l,st).call(this,s.pathname)})}navigate(O){return T(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f}={}){var lt;if(e(this,R).length)return;const M=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);let{pathname:c,hash:g,parameters:At,leaf:Ct}=M;if(e(this,C)===c||e(this,m)===c){e(this,k)||d(this,l,at).call(this,g||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,C,c),e(this,E).forEach(z=>{z.checkCurrent(c)});try{let z=!0;if(this.preprocessor)try{yield new Promise((r,y)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:c,resolve:r,reject:y})})}catch(r){r?console.error(r):console.log("Route change canceled"),z=!1}if(!z||e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}const ct=yield d(this,l,et).call(this,e(this,m)),S=yield d(this,l,et).call(this,c,f);if(e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}ct.saveScrollState(),ct.saveDocumentState(),e(this,k)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),e(this,q).textContent=S.title,document.body.appendChild(e(this,q));const ht={pathname:c};_.dispatchEvent(document,"morphStart",{detail:ht});const ut=Array.from(document.head.children),dt=Array.from(S.document.head.children),mt=d(this,l,Pt).call(this,ut,dt),kt=d(this,l,nt).call(this,ut,mt),Y=d(this,l,nt).call(this,dt,mt);Y.forEach((r,y)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=r.getAttribute("src"),Y[y]=w}}),Y.forEach(r=>{document.head.appendChild(r)});const $=Y.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,l,rt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&$.length&&(yield new Promise(r=>T(this,null,function*(){let y=0;try{for(var w=Lt($),pt,W,Et;pt=!(W=yield w.next()).done;pt=!1){const G=W.value;G.onload=()=>{y++,y===$.length&&r()}}}catch(W){Et=[W]}finally{try{pt&&(W=w.return)&&(yield W.call(w))}finally{if(Et)throw Et[0]}}})));const ft=[];kt.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,l,rt).call(this,r)?ft.push(r):r.remove())});const Mt=d(this,l,it).call(this,S.document.body);d(this,l,ot).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c),document.documentElement.setAttribute("data-current-leaf",Ct),Q.changeHistory({action:s,pathname:c,searchParameters:At,hash:g}),e(this,q).remove(),a(this,K,e(this,m)),a(this,m,c),e(this,U).forEach((r,y)=>{const w=Mt[y],pt=getComputedStyle(r).getPropertyValue("--morph-duration"),W=[...w.childNodes];if(pt){const Et=[...r.childNodes];Et.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),r.prepend(...W),Ht.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const G={morphElement:r,pathname:c};_.dispatchEvent(document,"morphNewChildrenAdded",{detail:G});const Tt=new Promise(v=>{setTimeout(()=>{Et.forEach(J=>J.remove()),W.forEach(J=>{J instanceof HTMLElement&&J.classList.remove("in","new")}),_.dispatchEvent(document,"morphOldChildrenRemoved",{detail:G}),v()},(parseFloat(pt)||0)*1e3+10)});e(this,R).push(Tt)}else r.innerHTML="",r.append(...W)}),g?(S.clearScrollState(),d(this,l,at).call(this,g,{centerScroll:i,offsetScroll:u})):e(this,k)&&S.restoreScrollPosition(),yield Promise.all(e(this,R)),ft.forEach(r=>r.remove()),a(this,R,[]),this.findLinks(),_.dispatchEvent(document,"morphComplete",{detail:ht}),window.dispatchEvent(new Event("resize"))}catch(z){console.error(z)}a(this,C,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var i;return((i=s.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")&&s.getAttribute("target")!=="_blank"});e(this,E).forEach(s=>s.destroy()),a(this,E,t.map(s=>new St(s,this)))}}A=new WeakMap,U=new WeakMap,E=new WeakMap,X=new WeakMap,C=new WeakMap,m=new WeakMap,K=new WeakMap,R=new WeakMap,k=new WeakMap,L=new WeakMap,V=new WeakMap,q=new WeakMap,l=new WeakSet,et=function(t,s=!1){return T(this,null,function*(){let i=e(this,V).get(t);return(!i||s)&&(i=yield d(this,l,st).call(this,t)),i})},st=function(t){return T(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,X).parseFromString(i,"text/html"),f=new yt(this,t,u);return e(this,V).set(t,f),f})},it=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Pt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},nt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},rt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},ot=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,B)),a(this,L,t.querySelector(e(this,A).scrollSelector)||t.documentElement),(i=e(this,L))==null||i.addEventListener("scroll",e(this,B)),e(this,B).call(this)},at=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&xt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Z=new WeakMap,B=new WeakMap;exports.Morph=Dt;
|
|
1
|
+
"use strict";var vt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),Lt=r=>{throw TypeError(r)};var et=(r,t,s)=>t.has(r)||Lt("Cannot "+s);var e=(r,t,s)=>(et(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?Lt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),a=(r,t,s,i)=>(et(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),d=(r,t,s)=>(et(r,t,"access private method"),s);var H=(r,t,s)=>new Promise((i,u)=>{var f=p=>{try{T(s.next(p))}catch(h){u(h)}},M=p=>{try{T(s.throw(p))}catch(h){u(h)}},T=p=>p.done?i(p.value):Promise.resolve(p.value).then(f,M);T((s=s.apply(r,t)).next())});var St=(r,t,s)=>(t=r[vt("asyncIterator")])?t.call(r):(r=r[vt("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=f=>new Promise((M,T,p)=>(f=u.call(r,f),p=f.done,Promise.resolve(f.value).then(h=>M({value:h,done:p}),T)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("../index-Cqw2NKev.cjs"),_=require("../events-KVanG9sR.cjs"),xt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-H9zqFeML.cjs"),X=require("../url-D1CgmwZ_.cjs"),Dt=require("../css-value-parser/index.cjs");class Pt extends HTMLElement{connectedCallback(){const t={"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,i]of Object.entries(t))this.setAttribute(s,i)}}bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Pt);var P,c,x,j,I;class yt{constructor(t,s){o(this,P);o(this,c);o(this,x);o(this,j,t=>{t.preventDefault();const s=e(this,c).getAttribute("data-history-action")||"push",i=e(this,c).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,c)).getPropertyValue("--offset-scroll").trim(),f=u?Dt.cssValueParser.parse(u):void 0,M=e(this,c).hasAttribute("data-revalidate"),T=e(this,c).hasAttribute("data-keep-search-parameters");e(this,P).navigate(e(this,x),{historyAction:s,centerScroll:i,offsetScroll:f,revalidate:M,keepSearchParameters:T})});o(this,I,()=>{e(this,P).prefetch(e(this,x)),e(this,c).removeEventListener("pointerenter",e(this,I))});a(this,P,s),a(this,c,t),a(this,x,e(this,c).getAttribute("href")||"/"),e(this,c).addEventListener("click",e(this,j)),this.checkCurrent(location.pathname),e(this,c).hasAttribute("data-prefetch")&&e(this,c).addEventListener("pointerenter",e(this,I))}get element(){return e(this,c)}checkCurrent(t){const s=e(this,P).normalizePath(t),i=e(this,P).normalizePath(e(this,x));e(this,c).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,c).classList.add("current"):i.pathname===s.pathname?e(this,c).classList.add("current"):e(this,c).classList.remove("current")}destroy(){e(this,c).removeEventListener("click",e(this,j)),e(this,c).removeEventListener("pointerenter",e(this,I)),e(this,c).classList.remove("current")}}P=new WeakMap,c=new WeakMap,x=new WeakMap,j=new WeakMap,I=new WeakMap;var N,V,E,D,R,A;class wt{constructor(t,s,i){o(this,N);o(this,V);o(this,E,{x:0,y:0});o(this,D);o(this,R,null);o(this,A,null);a(this,N,t),a(this,V,s),a(this,D,i.cloneNode(!0))}get pathname(){return e(this,V)}get scrollState(){return e(this,E)}get document(){return e(this,A)}cloneDocument(){a(this,A,(e(this,R)||e(this,D)).cloneNode(!0))}get title(){let t="";if(e(this,A).title)t=e(this,A).title;else{const s=e(this,A).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,V)}return t}clearScrollState(){e(this,E).x=0,e(this,E).y=0}clearDocumentState(){a(this,R,null)}saveScrollState(){e(this,D).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,E).x=0,e(this,E).y=0):(e(this,E).x=e(this,N).scrollElement.scrollLeft,e(this,E).y=e(this,N).scrollElement.scrollTop)}saveDocumentState(){e(this,D).documentElement.hasAttribute("data-no-page-restoration")?a(this,R,null):a(this,R,document.cloneNode(!0))}restoreScrollPosition(){e(this,N).scrollElement.scroll({top:e(this,E).y,left:e(this,E).x})}}N=new WeakMap,V=new WeakMap,E=new WeakMap,D=new WeakMap,R=new WeakMap,A=new WeakMap;var k,U,g,Z,C,m,K,q,y,L,B,z,l,st,it,rt,At,nt,ot,at,lt,$,O;class Rt{constructor(t){o(this,l);o(this,k,null);o(this,U,null);o(this,g,[]);o(this,Z,new DOMParser);o(this,C);o(this,m,null);o(this,K);o(this,q,[]);o(this,y,!1);o(this,L,null);o(this,B,new Map);o(this,z,null);o(this,$,t=>H(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,y,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,y,!1))}));o(this,O,()=>{const t=e(this,L).scrollTop,s=e(this,L).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),_.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(bt.isBrowser){a(this,k,{base:X.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,U,d(this,l,rt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,m,s.pathname),e(this,B).set(e(this,m),new wt(this,e(this,m),document)),document.documentElement.setAttribute("data-current-pathname",e(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,$)),X.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,z,new Pt),d(this,l,at).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,K)}get links(){return e(this,g)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,y)}normalizePath(t){return X.splitPath(t,{base:e(this,k).base,trailingSlash:e(this,k).trailingSlash})}prefetch(t){return H(this,null,function*(){const s=this.normalizePath(t);d(this,l,it).call(this,s.pathname)})}navigate(T){return H(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f,keepSearchParameters:M}={}){var ct;if(e(this,q).length)return;const p=this.normalizePath(((ct=this.pathnameModifier)==null?void 0:ct.call(this,t))||t);let{pathname:h,hash:Y,parameters:kt,leaf:Ct}=p;if(e(this,C)===h||e(this,m)===h){e(this,y)||d(this,l,lt).call(this,Y||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,C,h),e(this,g).forEach(F=>{F.checkCurrent(h)});try{let F=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:h,resolve:n,reject:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),F=!1}if(!F||e(this,C)!==h){e(this,g).forEach(n=>{n.checkCurrent(e(this,m))});return}const ht=yield d(this,l,st).call(this,e(this,m)),S=yield d(this,l,st).call(this,h,f);if(e(this,C)!==h){e(this,g).forEach(n=>{n.checkCurrent(e(this,m))});return}ht.saveScrollState(),ht.saveDocumentState(),e(this,y)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),e(this,z).textContent=S.title,document.body.appendChild(e(this,z));const ut={pathname:h};_.dispatchEvent(document,"morphStart",{detail:ut});const dt=Array.from(document.head.children),mt=Array.from(S.document.head.children),ft=d(this,l,At).call(this,dt,mt),Mt=d(this,l,nt).call(this,dt,ft),G=d(this,l,nt).call(this,mt,ft);G.forEach((n,w)=>{if(n.tagName==="SCRIPT"&&n.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=n.getAttribute("src"),G[w]=b}}),G.forEach(n=>{document.head.appendChild(n)});const tt=G.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(d(this,l,ot).call(this,n))return!0});e(this,k).waitForHeadToLoad&&tt.length&&(yield new Promise(n=>H(this,null,function*(){let w=0;try{for(var b=St(tt),Et,W,gt;Et=!(W=yield b.next()).done;Et=!1){const J=W.value;J.onload=()=>{w++,w===tt.length&&n()}}}catch(W){gt=[W]}finally{try{Et&&(W=b.return)&&(yield W.call(b))}finally{if(gt)throw gt[0]}}})));const pt=[];Mt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,l,ot).call(this,n)?pt.push(n):n.remove())});const Tt=d(this,l,rt).call(this,S.document.body);d(this,l,at).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",h),document.documentElement.setAttribute("data-current-leaf",Ct),X.changeHistory({action:s,pathname:h,searchParameters:kt||(M?location.search:""),hash:Y}),e(this,z).remove(),a(this,K,e(this,m)),a(this,m,h),e(this,U).forEach((n,w)=>{const b=Tt[w],Et=getComputedStyle(n).getPropertyValue("--morph-duration"),W=[...b.childNodes];if(Et){const gt=[...n.childNodes];gt.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),n.prepend(...W),xt.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const J={morphElement:n,pathname:h};_.dispatchEvent(document,"morphNewChildrenAdded",{detail:J});const Ht=new Promise(v=>{setTimeout(()=>{gt.forEach(Q=>Q.remove()),W.forEach(Q=>{Q instanceof HTMLElement&&Q.classList.remove("in","new")}),_.dispatchEvent(document,"morphOldChildrenRemoved",{detail:J}),v()},(parseFloat(Et)||0)*1e3+10)});e(this,q).push(Ht)}else n.innerHTML="",n.append(...W)}),Y?(S.clearScrollState(),d(this,l,lt).call(this,Y,{centerScroll:i,offsetScroll:u})):e(this,y)&&S.restoreScrollPosition(),yield Promise.all(e(this,q)),pt.forEach(n=>n.remove()),a(this,q,[]),this.findLinks(),_.dispatchEvent(document,"morphComplete",{detail:ut}),window.dispatchEvent(new Event("resize"))}catch(F){console.error(F)}a(this,C,void 0)})}addLink(t){e(this,g).push(new yt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,g,e(this,g).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var i;return((i=s.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")&&s.getAttribute("target")!=="_blank"});e(this,g).forEach(s=>s.destroy()),a(this,g,t.map(s=>new yt(s,this)))}}k=new WeakMap,U=new WeakMap,g=new WeakMap,Z=new WeakMap,C=new WeakMap,m=new WeakMap,K=new WeakMap,q=new WeakMap,y=new WeakMap,L=new WeakMap,B=new WeakMap,z=new WeakMap,l=new WeakSet,st=function(t,s=!1){return H(this,null,function*(){let i=e(this,B).get(t);return(!i||s)&&(i=yield d(this,l,it).call(this,t)),i})},it=function(t){return H(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,Z).parseFromString(i,"text/html"),f=new wt(this,t,u);return e(this,B).set(t,f),f})},rt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},At=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},nt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ot=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},at=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,O)),a(this,L,t.querySelector(e(this,k).scrollSelector)||t.documentElement),(i=e(this,L))==null||i.addEventListener("scroll",e(this,O)),e(this,O).call(this)},lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},$=new WeakMap,O=new WeakMap;exports.Morph=Rt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
1
|
+
var gt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), vt = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (r, t, s) => (
|
|
6
|
-
var
|
|
7
|
-
var f = (
|
|
4
|
+
var tt = (r, t, s) => t.has(r) || vt("Cannot " + s);
|
|
5
|
+
var e = (r, t, s) => (tt(r, t, "read from private field"), s ? s.call(r) : t.get(r)), o = (r, t, s) => t.has(r) ? vt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), a = (r, t, s, i) => (tt(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), d = (r, t, s) => (tt(r, t, "access private method"), s);
|
|
6
|
+
var H = (r, t, s) => new Promise((i, u) => {
|
|
7
|
+
var f = (p) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
u(
|
|
9
|
+
M(s.next(p));
|
|
10
|
+
} catch (c) {
|
|
11
|
+
u(c);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, T = (p) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
u(
|
|
15
|
+
M(s.throw(p));
|
|
16
|
+
} catch (c) {
|
|
17
|
+
u(c);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, M = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(f, T);
|
|
20
|
+
M((s = s.apply(r, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { i as
|
|
22
|
+
var Lt = (r, t, s) => (t = r[gt("asyncIterator")]) ? t.call(r) : (r = r[gt("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (f) => new Promise((T, M, p) => (f = u.call(r, f), p = f.done, Promise.resolve(f.value).then((c) => T({ value: c, done: p }), M)))), s("next"), s("return"), t);
|
|
23
|
+
import { i as bt } from "../index-euf5anj6.js";
|
|
24
24
|
import { d as U } from "../events-CsVF98U6.js";
|
|
25
|
-
import { r as
|
|
26
|
-
import { s as
|
|
27
|
-
import { n as
|
|
28
|
-
import { cssValueParser as
|
|
29
|
-
class
|
|
25
|
+
import { r as xt } from "../polyfills-DJrTJQky.js";
|
|
26
|
+
import { s as Nt } from "../scroll-myLAt-Tq.js";
|
|
27
|
+
import { n as Dt, c as St, s as Rt } from "../url-B6BNcw6_.js";
|
|
28
|
+
import { cssValueParser as zt } from "../css-value-parser/index.js";
|
|
29
|
+
class Pt extends HTMLElement {
|
|
30
30
|
connectedCallback() {
|
|
31
31
|
const t = {
|
|
32
32
|
"aria-live": "assertive",
|
|
@@ -37,120 +37,123 @@ class bt extends HTMLElement {
|
|
|
37
37
|
this.setAttribute(s, i);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
class
|
|
40
|
+
bt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Pt);
|
|
41
|
+
var P, h, x, j, I;
|
|
42
|
+
class yt {
|
|
43
43
|
constructor(t, s) {
|
|
44
|
-
o(this,
|
|
45
|
-
o(this,
|
|
46
|
-
o(this,
|
|
44
|
+
o(this, P);
|
|
45
|
+
o(this, h);
|
|
46
|
+
o(this, x);
|
|
47
47
|
o(this, j, (t) => {
|
|
48
48
|
t.preventDefault();
|
|
49
|
-
const s = e(this,
|
|
49
|
+
const s = e(this, h).getAttribute(
|
|
50
50
|
"data-history-action"
|
|
51
|
-
) || "push", i = e(this,
|
|
52
|
-
|
|
51
|
+
) || "push", i = e(this, h).hasAttribute("data-center-scroll"), u = getComputedStyle(e(this, h)).getPropertyValue("--offset-scroll").trim(), f = u ? zt.parse(u) : void 0, T = e(this, h).hasAttribute("data-revalidate"), M = e(this, h).hasAttribute(
|
|
52
|
+
"data-keep-search-parameters"
|
|
53
|
+
);
|
|
54
|
+
e(this, P).navigate(e(this, x), {
|
|
53
55
|
historyAction: s,
|
|
54
56
|
centerScroll: i,
|
|
55
57
|
offsetScroll: f,
|
|
56
|
-
revalidate:
|
|
58
|
+
revalidate: T,
|
|
59
|
+
keepSearchParameters: M
|
|
57
60
|
});
|
|
58
61
|
});
|
|
59
|
-
o(this,
|
|
60
|
-
e(this,
|
|
62
|
+
o(this, I, () => {
|
|
63
|
+
e(this, P).prefetch(e(this, x)), e(this, h).removeEventListener("pointerenter", e(this, I));
|
|
61
64
|
});
|
|
62
|
-
a(this,
|
|
65
|
+
a(this, P, s), a(this, h, t), a(this, x, e(this, h).getAttribute("href") || "/"), e(this, h).addEventListener("click", e(this, j)), this.checkCurrent(location.pathname), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, I));
|
|
63
66
|
}
|
|
64
67
|
get element() {
|
|
65
|
-
return e(this,
|
|
68
|
+
return e(this, h);
|
|
66
69
|
}
|
|
67
70
|
checkCurrent(t) {
|
|
68
|
-
const s = e(this,
|
|
69
|
-
e(this,
|
|
71
|
+
const s = e(this, P).normalizePath(t), i = e(this, P).normalizePath(e(this, x));
|
|
72
|
+
e(this, h).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, h).classList.add("current") : i.pathname === s.pathname ? e(this, h).classList.add("current") : e(this, h).classList.remove("current");
|
|
70
73
|
}
|
|
71
74
|
destroy() {
|
|
72
|
-
e(this,
|
|
75
|
+
e(this, h).removeEventListener("click", e(this, j)), e(this, h).removeEventListener("pointerenter", e(this, I)), e(this, h).classList.remove("current");
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
class
|
|
78
|
+
P = new WeakMap(), h = new WeakMap(), x = new WeakMap(), j = new WeakMap(), I = new WeakMap();
|
|
79
|
+
var N, V, E, D, R, A;
|
|
80
|
+
class wt {
|
|
78
81
|
constructor(t, s, i) {
|
|
79
|
-
o(this, x);
|
|
80
|
-
o(this, I);
|
|
81
|
-
o(this, p, { x: 0, y: 0 });
|
|
82
82
|
o(this, N);
|
|
83
|
-
o(this,
|
|
84
|
-
o(this,
|
|
85
|
-
|
|
83
|
+
o(this, V);
|
|
84
|
+
o(this, E, { x: 0, y: 0 });
|
|
85
|
+
o(this, D);
|
|
86
|
+
o(this, R, null);
|
|
87
|
+
o(this, A, null);
|
|
88
|
+
a(this, N, t), a(this, V, s), a(this, D, i.cloneNode(!0));
|
|
86
89
|
}
|
|
87
90
|
get pathname() {
|
|
88
|
-
return e(this,
|
|
91
|
+
return e(this, V);
|
|
89
92
|
}
|
|
90
93
|
get scrollState() {
|
|
91
|
-
return e(this,
|
|
94
|
+
return e(this, E);
|
|
92
95
|
}
|
|
93
96
|
get document() {
|
|
94
|
-
return e(this,
|
|
97
|
+
return e(this, A);
|
|
95
98
|
}
|
|
96
99
|
cloneDocument() {
|
|
97
|
-
a(this,
|
|
100
|
+
a(this, A, (e(this, R) || e(this, D)).cloneNode(!0));
|
|
98
101
|
}
|
|
99
102
|
get title() {
|
|
100
103
|
let t = "";
|
|
101
|
-
if (e(this,
|
|
102
|
-
t = e(this,
|
|
104
|
+
if (e(this, A).title)
|
|
105
|
+
t = e(this, A).title;
|
|
103
106
|
else {
|
|
104
|
-
const s = e(this,
|
|
105
|
-
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this,
|
|
107
|
+
const s = e(this, A).querySelector("h1");
|
|
108
|
+
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, V);
|
|
106
109
|
}
|
|
107
110
|
return t;
|
|
108
111
|
}
|
|
109
112
|
clearScrollState() {
|
|
110
|
-
e(this,
|
|
113
|
+
e(this, E).x = 0, e(this, E).y = 0;
|
|
111
114
|
}
|
|
112
115
|
clearDocumentState() {
|
|
113
|
-
a(this,
|
|
116
|
+
a(this, R, null);
|
|
114
117
|
}
|
|
115
118
|
saveScrollState() {
|
|
116
|
-
e(this,
|
|
119
|
+
e(this, D).documentElement.hasAttribute(
|
|
117
120
|
"data-no-scroll-restoration"
|
|
118
|
-
) ? (e(this,
|
|
121
|
+
) ? (e(this, E).x = 0, e(this, E).y = 0) : (e(this, E).x = e(this, N).scrollElement.scrollLeft, e(this, E).y = e(this, N).scrollElement.scrollTop);
|
|
119
122
|
}
|
|
120
123
|
saveDocumentState() {
|
|
121
|
-
e(this,
|
|
124
|
+
e(this, D).documentElement.hasAttribute(
|
|
122
125
|
"data-no-page-restoration"
|
|
123
|
-
) ? a(this,
|
|
126
|
+
) ? a(this, R, null) : a(this, R, document.cloneNode(!0));
|
|
124
127
|
}
|
|
125
128
|
restoreScrollPosition() {
|
|
126
|
-
e(this,
|
|
127
|
-
top: e(this,
|
|
128
|
-
left: e(this,
|
|
129
|
+
e(this, N).scrollElement.scroll({
|
|
130
|
+
top: e(this, E).y,
|
|
131
|
+
left: e(this, E).x
|
|
129
132
|
});
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
class
|
|
135
|
+
N = new WeakMap(), V = new WeakMap(), E = new WeakMap(), D = new WeakMap(), R = new WeakMap(), A = new WeakMap();
|
|
136
|
+
var k, K, g, X, C, m, Y, z, y, L, B, q, l, et, st, it, At, rt, nt, ot, at, Z, O;
|
|
137
|
+
class Ut {
|
|
135
138
|
constructor(t) {
|
|
136
139
|
o(this, l);
|
|
137
|
-
o(this,
|
|
140
|
+
o(this, k, null);
|
|
138
141
|
o(this, K, null);
|
|
139
|
-
o(this,
|
|
140
|
-
o(this,
|
|
142
|
+
o(this, g, []);
|
|
143
|
+
o(this, X, new DOMParser());
|
|
141
144
|
o(this, C);
|
|
142
145
|
o(this, m, null);
|
|
143
146
|
o(this, Y);
|
|
144
|
-
o(this,
|
|
145
|
-
o(this,
|
|
147
|
+
o(this, z, []);
|
|
148
|
+
o(this, y, !1);
|
|
146
149
|
o(this, L, null);
|
|
147
|
-
o(this,
|
|
148
|
-
o(this,
|
|
149
|
-
o(this,
|
|
150
|
+
o(this, B, /* @__PURE__ */ new Map());
|
|
151
|
+
o(this, q, null);
|
|
152
|
+
o(this, Z, (t) => H(this, null, function* () {
|
|
150
153
|
var s;
|
|
151
|
-
(s = t.state) != null && s.path && (t.preventDefault(), a(this,
|
|
154
|
+
(s = t.state) != null && s.path && (t.preventDefault(), a(this, y, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, y, !1));
|
|
152
155
|
}));
|
|
153
|
-
o(this,
|
|
156
|
+
o(this, O, () => {
|
|
154
157
|
const t = e(this, L).scrollTop, s = e(this, L).scrollLeft;
|
|
155
158
|
document.documentElement.classList.toggle("top-scrolled", t > 0), document.documentElement.classList.toggle("left-scrolled", s > 0), U(document, "morphScroll", {
|
|
156
159
|
detail: {
|
|
@@ -159,32 +162,32 @@ class Wt {
|
|
|
159
162
|
}
|
|
160
163
|
});
|
|
161
164
|
});
|
|
162
|
-
if (
|
|
163
|
-
a(this,
|
|
164
|
-
base:
|
|
165
|
+
if (bt) {
|
|
166
|
+
a(this, k, {
|
|
167
|
+
base: Dt(t == null ? void 0 : t.base),
|
|
165
168
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
166
169
|
cachePages: (t == null ? void 0 : t.cachePages) !== !1,
|
|
167
170
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
168
171
|
scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body"
|
|
169
|
-
}), a(this, K, d(this, l,
|
|
172
|
+
}), a(this, K, d(this, l, it).call(this, document.body));
|
|
170
173
|
const s = this.normalizePath(
|
|
171
174
|
location.pathname + location.hash
|
|
172
175
|
);
|
|
173
|
-
a(this, m, s.pathname), e(this,
|
|
176
|
+
a(this, m, s.pathname), e(this, B).set(
|
|
174
177
|
e(this, m),
|
|
175
|
-
new
|
|
178
|
+
new wt(this, e(this, m), document)
|
|
176
179
|
), document.documentElement.setAttribute(
|
|
177
180
|
"data-current-pathname",
|
|
178
181
|
e(this, m)
|
|
179
182
|
), document.documentElement.setAttribute(
|
|
180
183
|
"data-current-leaf",
|
|
181
184
|
s.leaf
|
|
182
|
-
), this.findLinks(), addEventListener("popstate", e(this,
|
|
185
|
+
), this.findLinks(), addEventListener("popstate", e(this, Z)), St({
|
|
183
186
|
action: "replace",
|
|
184
187
|
pathname: e(this, m),
|
|
185
|
-
searchParameters: s.parameters,
|
|
188
|
+
searchParameters: s.parameters || location.search,
|
|
186
189
|
hash: s.hash
|
|
187
|
-
}), a(this,
|
|
190
|
+
}), a(this, q, new Pt()), d(this, l, ot).call(this, document);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
get currentPathname() {
|
|
@@ -194,169 +197,173 @@ class Wt {
|
|
|
194
197
|
return e(this, Y);
|
|
195
198
|
}
|
|
196
199
|
get links() {
|
|
197
|
-
return e(this,
|
|
200
|
+
return e(this, g);
|
|
198
201
|
}
|
|
199
202
|
get scrollElement() {
|
|
200
203
|
return e(this, L);
|
|
201
204
|
}
|
|
205
|
+
get isPopstateNavigation() {
|
|
206
|
+
return e(this, y);
|
|
207
|
+
}
|
|
202
208
|
normalizePath(t) {
|
|
203
|
-
return
|
|
204
|
-
base: e(this,
|
|
205
|
-
trailingSlash: e(this,
|
|
209
|
+
return Rt(t, {
|
|
210
|
+
base: e(this, k).base,
|
|
211
|
+
trailingSlash: e(this, k).trailingSlash
|
|
206
212
|
});
|
|
207
213
|
}
|
|
208
214
|
prefetch(t) {
|
|
209
|
-
return
|
|
215
|
+
return H(this, null, function* () {
|
|
210
216
|
const s = this.normalizePath(t);
|
|
211
|
-
d(this, l,
|
|
217
|
+
d(this, l, st).call(this, s.pathname);
|
|
212
218
|
});
|
|
213
219
|
}
|
|
214
|
-
navigate(
|
|
215
|
-
return
|
|
220
|
+
navigate(M) {
|
|
221
|
+
return H(this, arguments, function* (t, {
|
|
216
222
|
historyAction: s = "push",
|
|
217
223
|
centerScroll: i,
|
|
218
224
|
offsetScroll: u,
|
|
219
|
-
revalidate: f
|
|
225
|
+
revalidate: f,
|
|
226
|
+
keepSearchParameters: T
|
|
220
227
|
} = {}) {
|
|
221
|
-
var
|
|
222
|
-
if (e(this,
|
|
228
|
+
var lt;
|
|
229
|
+
if (e(this, z).length)
|
|
223
230
|
return;
|
|
224
|
-
const
|
|
225
|
-
let { pathname:
|
|
226
|
-
if (e(this, C) ===
|
|
227
|
-
e(this,
|
|
231
|
+
const p = this.normalizePath(((lt = this.pathnameModifier) == null ? void 0 : lt.call(this, t)) || t);
|
|
232
|
+
let { pathname: c, hash: _, parameters: kt, leaf: Ct } = p;
|
|
233
|
+
if (e(this, C) === c || e(this, m) === c) {
|
|
234
|
+
e(this, y) || d(this, l, at).call(this, _ || 0, {
|
|
228
235
|
centerScroll: i,
|
|
229
236
|
offsetScroll: u,
|
|
230
237
|
behavior: "smooth"
|
|
231
238
|
});
|
|
232
239
|
return;
|
|
233
240
|
}
|
|
234
|
-
a(this, C,
|
|
235
|
-
|
|
241
|
+
a(this, C, c), e(this, g).forEach((F) => {
|
|
242
|
+
F.checkCurrent(c);
|
|
236
243
|
});
|
|
237
244
|
try {
|
|
238
|
-
let
|
|
245
|
+
let F = !0;
|
|
239
246
|
if (this.preprocessor)
|
|
240
247
|
try {
|
|
241
|
-
yield new Promise((n,
|
|
242
|
-
var
|
|
243
|
-
(
|
|
244
|
-
pathname:
|
|
248
|
+
yield new Promise((n, w) => {
|
|
249
|
+
var b;
|
|
250
|
+
(b = this.preprocessor) == null || b.call(this, {
|
|
251
|
+
pathname: c,
|
|
245
252
|
resolve: n,
|
|
246
|
-
reject:
|
|
253
|
+
reject: w
|
|
247
254
|
});
|
|
248
255
|
});
|
|
249
256
|
} catch (n) {
|
|
250
|
-
n ? console.error(n) : console.log("Route change canceled"),
|
|
257
|
+
n ? console.error(n) : console.log("Route change canceled"), F = !1;
|
|
251
258
|
}
|
|
252
|
-
if (!
|
|
253
|
-
e(this,
|
|
259
|
+
if (!F || e(this, C) !== c) {
|
|
260
|
+
e(this, g).forEach((n) => {
|
|
254
261
|
n.checkCurrent(e(this, m));
|
|
255
262
|
});
|
|
256
263
|
return;
|
|
257
264
|
}
|
|
258
|
-
const
|
|
259
|
-
if (e(this, C) !==
|
|
260
|
-
e(this,
|
|
265
|
+
const ht = yield d(this, l, et).call(this, e(this, m)), S = yield d(this, l, et).call(this, c, f);
|
|
266
|
+
if (e(this, C) !== c) {
|
|
267
|
+
e(this, g).forEach((n) => {
|
|
261
268
|
n.checkCurrent(e(this, m));
|
|
262
269
|
});
|
|
263
270
|
return;
|
|
264
271
|
}
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
pathname:
|
|
272
|
+
ht.saveScrollState(), ht.saveDocumentState(), e(this, y) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, q).textContent = S.title, document.body.appendChild(e(this, q));
|
|
273
|
+
const ct = {
|
|
274
|
+
pathname: c
|
|
268
275
|
};
|
|
269
276
|
U(document, "morphStart", {
|
|
270
|
-
detail:
|
|
277
|
+
detail: ct
|
|
271
278
|
});
|
|
272
|
-
const
|
|
273
|
-
|
|
279
|
+
const ut = Array.from(document.head.children), dt = Array.from(S.document.head.children), mt = d(this, l, At).call(this, ut, dt), Tt = d(this, l, rt).call(this, ut, mt), G = d(this, l, rt).call(this, dt, mt);
|
|
280
|
+
G.forEach((n, w) => {
|
|
274
281
|
if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
|
|
275
|
-
const
|
|
276
|
-
|
|
282
|
+
const b = document.createElement("script");
|
|
283
|
+
b.type = "module", b.src = n.getAttribute("src"), G[w] = b;
|
|
277
284
|
}
|
|
278
|
-
}),
|
|
285
|
+
}), G.forEach((n) => {
|
|
279
286
|
document.head.appendChild(n);
|
|
280
287
|
});
|
|
281
|
-
const
|
|
288
|
+
const $ = G.filter((n) => {
|
|
282
289
|
if (n.hasAttribute("data-no-waiting"))
|
|
283
290
|
return !1;
|
|
284
|
-
if (d(this, l,
|
|
291
|
+
if (d(this, l, nt).call(this, n))
|
|
285
292
|
return !0;
|
|
286
293
|
});
|
|
287
|
-
e(this,
|
|
288
|
-
let
|
|
294
|
+
e(this, k).waitForHeadToLoad && $.length && (yield new Promise((n) => H(this, null, function* () {
|
|
295
|
+
let w = 0;
|
|
289
296
|
try {
|
|
290
|
-
for (var
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
297
|
+
for (var b = Lt($), pt, W, Et; pt = !(W = yield b.next()).done; pt = !1) {
|
|
298
|
+
const J = W.value;
|
|
299
|
+
J.onload = () => {
|
|
300
|
+
w++, w === $.length && n();
|
|
294
301
|
};
|
|
295
302
|
}
|
|
296
303
|
} catch (W) {
|
|
297
|
-
|
|
304
|
+
Et = [W];
|
|
298
305
|
} finally {
|
|
299
306
|
try {
|
|
300
|
-
|
|
307
|
+
pt && (W = b.return) && (yield W.call(b));
|
|
301
308
|
} finally {
|
|
302
|
-
if (
|
|
303
|
-
throw
|
|
309
|
+
if (Et)
|
|
310
|
+
throw Et[0];
|
|
304
311
|
}
|
|
305
312
|
}
|
|
306
313
|
})));
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
n.hasAttribute("data-permanent") || (d(this, l,
|
|
314
|
+
const ft = [];
|
|
315
|
+
Tt.forEach((n) => {
|
|
316
|
+
n.hasAttribute("data-permanent") || (d(this, l, nt).call(this, n) ? ft.push(n) : n.remove());
|
|
310
317
|
});
|
|
311
|
-
const
|
|
312
|
-
d(this, l,
|
|
318
|
+
const Mt = d(this, l, it).call(this, S.document.body);
|
|
319
|
+
d(this, l, ot).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", c), document.documentElement.setAttribute("data-current-leaf", Ct), St({
|
|
313
320
|
action: s,
|
|
314
|
-
pathname:
|
|
315
|
-
searchParameters:
|
|
316
|
-
hash:
|
|
317
|
-
}), e(this,
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
|
|
321
|
+
pathname: c,
|
|
322
|
+
searchParameters: kt || (T ? location.search : ""),
|
|
323
|
+
hash: _
|
|
324
|
+
}), e(this, q).remove(), a(this, Y, e(this, m)), a(this, m, c), e(this, K).forEach((n, w) => {
|
|
325
|
+
const b = Mt[w], pt = getComputedStyle(n).getPropertyValue("--morph-duration"), W = [...b.childNodes];
|
|
326
|
+
if (pt) {
|
|
327
|
+
const Et = [...n.childNodes];
|
|
328
|
+
Et.forEach((v) => {
|
|
322
329
|
v instanceof HTMLElement && v.classList.add("old");
|
|
323
330
|
}), W.forEach((v) => {
|
|
324
331
|
v instanceof HTMLElement && v.classList.add("new");
|
|
325
|
-
}), n.prepend(...W),
|
|
332
|
+
}), n.prepend(...W), xt(() => {
|
|
326
333
|
W.forEach((v) => {
|
|
327
334
|
v instanceof HTMLElement && v.classList.add("in");
|
|
328
335
|
});
|
|
329
336
|
});
|
|
330
|
-
const
|
|
337
|
+
const J = {
|
|
331
338
|
morphElement: n,
|
|
332
|
-
pathname:
|
|
339
|
+
pathname: c
|
|
333
340
|
};
|
|
334
341
|
U(document, "morphNewChildrenAdded", {
|
|
335
|
-
detail:
|
|
342
|
+
detail: J
|
|
336
343
|
});
|
|
337
|
-
const
|
|
344
|
+
const Ht = new Promise((v) => {
|
|
338
345
|
setTimeout(() => {
|
|
339
|
-
|
|
340
|
-
|
|
346
|
+
Et.forEach((Q) => Q.remove()), W.forEach((Q) => {
|
|
347
|
+
Q instanceof HTMLElement && Q.classList.remove("in", "new");
|
|
341
348
|
}), U(document, "morphOldChildrenRemoved", {
|
|
342
|
-
detail:
|
|
349
|
+
detail: J
|
|
343
350
|
}), v();
|
|
344
|
-
}, (parseFloat(
|
|
351
|
+
}, (parseFloat(pt) || 0) * 1e3 + 10);
|
|
345
352
|
});
|
|
346
|
-
e(this,
|
|
353
|
+
e(this, z).push(Ht);
|
|
347
354
|
} else
|
|
348
355
|
n.innerHTML = "", n.append(...W);
|
|
349
|
-
}),
|
|
350
|
-
detail:
|
|
356
|
+
}), _ ? (S.clearScrollState(), d(this, l, at).call(this, _, { centerScroll: i, offsetScroll: u })) : e(this, y) && S.restoreScrollPosition(), yield Promise.all(e(this, z)), ft.forEach((n) => n.remove()), a(this, z, []), this.findLinks(), U(document, "morphComplete", {
|
|
357
|
+
detail: ct
|
|
351
358
|
}), window.dispatchEvent(new Event("resize"));
|
|
352
|
-
} catch (
|
|
353
|
-
console.error(
|
|
359
|
+
} catch (F) {
|
|
360
|
+
console.error(F);
|
|
354
361
|
}
|
|
355
362
|
a(this, C, void 0);
|
|
356
363
|
});
|
|
357
364
|
}
|
|
358
365
|
addLink(t) {
|
|
359
|
-
e(this,
|
|
366
|
+
e(this, g).push(new yt(t, this));
|
|
360
367
|
}
|
|
361
368
|
addLinks(t) {
|
|
362
369
|
t.forEach((s) => {
|
|
@@ -364,7 +371,7 @@ class Wt {
|
|
|
364
371
|
});
|
|
365
372
|
}
|
|
366
373
|
removeLink(t) {
|
|
367
|
-
a(this,
|
|
374
|
+
a(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
368
375
|
}
|
|
369
376
|
findLinks() {
|
|
370
377
|
const t = [
|
|
@@ -375,51 +382,51 @@ class Wt {
|
|
|
375
382
|
return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]") && s.getAttribute("target") !== "_blank";
|
|
376
383
|
}
|
|
377
384
|
);
|
|
378
|
-
e(this,
|
|
385
|
+
e(this, g).forEach((s) => s.destroy()), a(this, g, t.map((s) => new yt(s, this)));
|
|
379
386
|
}
|
|
380
387
|
}
|
|
381
|
-
|
|
382
|
-
return
|
|
383
|
-
let i = e(this,
|
|
384
|
-
return (!i || s) && (i = yield d(this, l,
|
|
385
|
-
});
|
|
386
|
-
}, et = function(t) {
|
|
387
|
-
return M(this, null, function* () {
|
|
388
|
-
const i = yield (yield fetch(t)).text(), u = e(this, Q).parseFromString(i, "text/html"), f = new yt(this, t, u);
|
|
389
|
-
return e(this, V).set(t, f), f;
|
|
388
|
+
k = new WeakMap(), K = new WeakMap(), g = new WeakMap(), X = new WeakMap(), C = new WeakMap(), m = new WeakMap(), Y = new WeakMap(), z = new WeakMap(), y = new WeakMap(), L = new WeakMap(), B = new WeakMap(), q = new WeakMap(), l = new WeakSet(), et = function(t, s = !1) {
|
|
389
|
+
return H(this, null, function* () {
|
|
390
|
+
let i = e(this, B).get(t);
|
|
391
|
+
return (!i || s) && (i = yield d(this, l, st).call(this, t)), i;
|
|
390
392
|
});
|
|
391
393
|
}, st = function(t) {
|
|
394
|
+
return H(this, null, function* () {
|
|
395
|
+
const i = yield (yield fetch(t)).text(), u = e(this, X).parseFromString(i, "text/html"), f = new wt(this, t, u);
|
|
396
|
+
return e(this, B).set(t, f), f;
|
|
397
|
+
});
|
|
398
|
+
}, it = function(t) {
|
|
392
399
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
393
400
|
return s.length ? s : [t];
|
|
394
|
-
},
|
|
401
|
+
}, At = function(t, s) {
|
|
395
402
|
return t.filter(
|
|
396
403
|
(i) => s.find(
|
|
397
404
|
(u) => u.outerHTML === i.outerHTML
|
|
398
405
|
)
|
|
399
406
|
);
|
|
400
|
-
},
|
|
407
|
+
}, rt = function(t, s) {
|
|
401
408
|
return t.filter(
|
|
402
409
|
(i) => !s.find(
|
|
403
410
|
(u) => u.outerHTML === i.outerHTML
|
|
404
411
|
)
|
|
405
412
|
);
|
|
406
|
-
}, rt = function(t) {
|
|
407
|
-
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
408
413
|
}, nt = function(t) {
|
|
414
|
+
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
415
|
+
}, ot = function(t) {
|
|
409
416
|
var s, i;
|
|
410
417
|
(s = e(this, L)) == null || s.removeEventListener(
|
|
411
418
|
"scroll",
|
|
412
|
-
e(this,
|
|
413
|
-
), a(this, L, t.querySelector(e(this,
|
|
414
|
-
},
|
|
419
|
+
e(this, O)
|
|
420
|
+
), a(this, L, t.querySelector(e(this, k).scrollSelector) || t.documentElement), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, O)), e(this, O).call(this);
|
|
421
|
+
}, at = function(t, s) {
|
|
415
422
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
416
|
-
(typeof i == "number" || i) &&
|
|
423
|
+
(typeof i == "number" || i) && Nt(i, {
|
|
417
424
|
scrollElement: e(this, L),
|
|
418
425
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
419
426
|
center: s == null ? void 0 : s.centerScroll,
|
|
420
427
|
offset: s == null ? void 0 : s.offsetScroll
|
|
421
428
|
});
|
|
422
|
-
},
|
|
429
|
+
}, Z = new WeakMap(), O = new WeakMap();
|
|
423
430
|
export {
|
|
424
|
-
|
|
431
|
+
Ut as Morph
|
|
425
432
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=c=>{throw TypeError(c)};var J=(c,r,t)=>r.has(c)||Z("Cannot "+t);var e=(c,r,t)=>(J(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(J(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(J(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("../class-linked-status/index.cjs"),b=require("../css-property/index.cjs"),X=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),ie=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs"),I=require("../url-
|
|
1
|
+
"use strict";var Z=c=>{throw TypeError(c)};var J=(c,r,t)=>r.has(c)||Z("Cannot "+t);var e=(c,r,t)=>(J(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(J(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(J(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("../class-linked-status/index.cjs"),b=require("../css-property/index.cjs"),X=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),ie=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs"),I=require("../url-D1CgmwZ_.cjs"),N=require("../window-resizer/index.cjs");var a,f,D,F;class oe{constructor(){i(this,a,new Map);i(this,f,[]);i(this,D,r=>{var s;const t=[...e(this,f)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(Y=>Y instanceof HTMLElement&&Y.hasAttribute("data-popover-content")))return;const l=o[0],q=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),te=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!q||te)&&t.close()}});i(this,F,r=>{if(r.code==="Escape"){const t=[...e(this,f)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,D)),addEventListener("keydown",e(this,F))}get groups(){return e(this,a)}get stack(){return e(this,f)}add(r,t){if(t.closeRest.current)e(this,a).forEach(o=>{o.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let o=e(this,a).get(r);o==null||o.forEach(l=>{l.close()})}let s=e(this,a).get(r);s!=null&&s.length||(s=[],e(this,a).set(r,s)),e(this,f).push(t),s.push(t)}remove(r,t){if(n(this,f,e(this,f).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,a).forEach(o=>{o.forEach(l=>s.push(l))}),e(this,a).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,a).get(r);e(this,a).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,a).get(r);s&&(s=s.filter(o=>o!==t),e(this,a).set(r,s))}}}a=new WeakMap,f=new WeakMap,D=new WeakMap,F=new WeakMap;var p,$,T,d,y,P,k,g,C,A,L,R,u,S,_,j,x,M,H,O;const E=class E extends HTMLElement{constructor(){super();i(this,S);i(this,p);i(this,$);i(this,T);i(this,d);i(this,y);i(this,P);i(this,k);i(this,g);i(this,C);i(this,A);i(this,L);i(this,R);i(this,u);i(this,x);i(this,M);i(this,H);i(this,O);this.urlValue="",n(this,p,!1),n(this,d,new b.CSSProperty(this,"--history",!1)),n(this,y,new b.CSSProperty(this,"--restore",!1)),n(this,P,new b.CSSProperty(this,"--close-rest",!1)),n(this,k,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new b.CSSProperty(this,"--group","")),n(this,C,new b.CSSProperty(this,"--click-outside",!1)),n(this,A,new b.CSSProperty(this,"--escape",!1)),n(this,L,!1),n(this,u,new se.ClassLinkedStatus(this,{opened:!1,closing:!1,triggered:!1})),n(this,x,()=>{n(this,L,!1),e(this,p)&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,p)&&e(this,d).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,L,!0)}),n(this,M,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,H).call(this)}),n(this,H,ie.debounce(()=>{e(this,O).call(this)},10)),n(this,O,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),o=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,d)}get restore(){return e(this,y)}get closeRest(){return e(this,P)}get closeRestInGroup(){return e(this,k)}get group(){return e(this,g)}get clickOutside(){return e(this,C)}get escape(){return e(this,A)}get opened(){return e(this,p)}get lastTrigger(){return e(this,R)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,p)&&I.updateSearchParameter(this.id,t)}open(t){if(e(this,p))return;n(this,R,t==null?void 0:t.trigger),clearTimeout(e(this,$)),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),U.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,R)}}),e(this,d).current&&e(this,L)&&history.pushState(history.state,"",e(this,S,_)),n(this,p,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,O).call(this),e(this,u).set("opened",!0),U.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,R)}}),n(this,T,void 0)};t!=null&&t.skipTransition?s():n(this,T,setTimeout(s,10))}close(){e(this,p)&&(clearTimeout(e(this,T)),E.stack.remove(e(this,g).current,this),n(this,p,!1),m(this,S,j).call(this),e(this,u).set("opened",!1),e(this,u).set("closing",!0),U.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,$,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("closing",!1),U.dispatchEvent(this,"popoverClosed",{custom:!0})},re.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,d).observe(),e(this,y).observe(),e(this,P).observe(),e(this,k).observe(),e(this,g).observe(),e(this,C).observe(),e(this,A).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,x)),setTimeout(()=>{e(this,y).current?(this.urlValue=I.parseSearchParameters(location.search)[this.id],e(this,x).call(this)):(m(this,S,j).call(this),n(this,L,!0))},0),N.windowResizer.subscribe(e(this,M))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),N.windowResizer.unsubscribe(e(this,M)),e(this,u).close(),e(this,d).close(),e(this,y).close(),e(this,P).close(),e(this,k).close(),e(this,g).close(),e(this,C).close(),e(this,A).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,S,j).call(this)}};p=new WeakMap,$=new WeakMap,T=new WeakMap,d=new WeakMap,y=new WeakMap,P=new WeakMap,k=new WeakMap,g=new WeakMap,C=new WeakMap,A=new WeakMap,L=new WeakMap,R=new WeakMap,u=new WeakMap,S=new WeakSet,_=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},j=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},x=new WeakMap,M=new WeakMap,H=new WeakMap,O=new WeakMap,E.stack=new oe;let V=E;X.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",V);var h,v,w,K,z,W,B,G,Q;class ee extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,v,new b.CSSProperty(this,"--type","open"));i(this,z,()=>{this.classList.add("triggered")});i(this,W,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});i(this,B,()=>{this.classList.remove("opened")});i(this,G,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});X.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,v).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,v)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(m(this,w,K).call(this),t){let o=null;if(t==="parent"){const l=this.closest("[popover-target]");if(l)o=l;else{const q=this.getRootNode();q instanceof ShadowRoot?o=q.host.closest("[popover-target]"):q instanceof HTMLElement&&(o=q.closest("[popover-target]"))}}else t==="sibling"?o=(s=this.parentElement)==null?void 0:s.querySelector("[popover-target]"):(!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),o=document.querySelector(t)||this.getRootNode().querySelector(t));o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,z)),e(this,h).addEventListener("popoverOpened",e(this,W)),e(this,h).addEventListener("popoverClosing",e(this,B)),e(this,h).addEventListener("popoverClosed",e(this,G))):console.warn(this,`target ${t} not found`)}m(this,w,Q).call(this,e(this,v).current)}connectedCallback(){e(this,v).subscribe(s=>{m(this,w,Q).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,v).observe()}disconnectedCallback(){e(this,v).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),m(this,w,K).call(this)}}h=new WeakMap,v=new WeakMap,w=new WeakSet,K=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,z)),e(this,h).removeEventListener("popoverOpened",e(this,W)),e(this,h).removeEventListener("popoverClosing",e(this,B)),e(this,h).removeEventListener("popoverClosed",e(this,G)))},z=new WeakMap,W=new WeakMap,B=new WeakMap,G=new WeakMap,Q=function(t){e(this,h)instanceof V&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};X.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ee);exports.PopoverButtonElement=ee;exports.PopoverElement=V;
|
package/lib/popover/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { i as X } from "../index-euf5anj6.js";
|
|
|
9
9
|
import { d as B } from "../events-CsVF98U6.js";
|
|
10
10
|
import { d as te } from "../function-C10DGppn.js";
|
|
11
11
|
import { g as se } from "../style-j2TwriJ_.js";
|
|
12
|
-
import { u as ie, p as re } from "../url-
|
|
12
|
+
import { u as ie, p as re } from "../url-B6BNcw6_.js";
|
|
13
13
|
import { windowResizer as I } from "../window-resizer/index.js";
|
|
14
14
|
var l, g, j, F;
|
|
15
15
|
class oe {
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var B=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../index-Cqw2NKev.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-
|
|
1
|
+
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var B=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../index-Cqw2NKev.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-D1CgmwZ_.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,M,et;class ct{constructor(e,s){r(this,M);r(this,R);r(this,O);r(this,A);r(this,p);r(this,m);r(this,v);r(this,k);r(this,L,null);r(this,b,[]);r(this,E,[]);a(this,R,e),a(this,O,s),a(this,A,new URLPattern({pathname:t(this,R)})),a(this,p,null),a(this,m,null),a(this,v,!1),a(this,k,null),tt.isBrowser&&a(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,m)}get nest(){return t(this,k)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return B(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(a(this,E,[...t(this,b)]),typeof o.default=="function"&&(a(this,p,o.default),ot.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,M,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:c,searchParams:f};a(this,m,new(t(this,p))(d)),e.appendChild(t(this,m)),a(this,k,t(this,m).querySelector("[data-nest]")||((h=t(this,m).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,m).shadowRoot||t(this,m)),a(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,m))==null||e.remove(),a(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),a(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,m)&&(e=[...t(this,m).querySelectorAll("a")]),(s=t(this,m))!=null&&s.shadowRoot&&(e=[...e,...t(this,m).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,k=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakSet,et=function(){return B(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var S,u,P,U,q,j;class lt{constructor(e,s){r(this,S);r(this,u);r(this,P);r(this,U);r(this,q);r(this,j,e=>{e.preventDefault(),t(this,S).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,u).classList.add("clicked"):t(s,u).classList.remove("clicked")}),t(this,S).navigate(t(this,P),t(this,U))});var o,c;a(this,S,e),a(this,u,s),a(this,P,t(this,u).getAttribute("href")||"/"),a(this,U,t(this,u).getAttribute("data-history-action")||"push"),t(this,u).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);a(this,q,(o=t(this,u).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,u).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,u).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,u).classList.add("current"),t(this,u).classList.add("clicked")):t(this,u).classList.remove("clicked")}destroy(){t(this,u).removeEventListener("click",t(this,j)),t(this,u).classList.remove("current")}}S=new WeakMap,u=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var N,C,g,z,T,y,H,x,_,I,st,D;class ut{constructor(e){r(this,I);r(this,N,null);r(this,C,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y);r(this,H,null);r(this,x,new rt.Notifier);r(this,_,ht.debounce(()=>{const e=s=>s.split("/").length;a(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{var s;(s=e.state)!=null&&s.path&&this.navigate(e.state.path,"none")});tt.isBrowser&&(e!=null&&e.base?a(this,C,F.normalizeBase(e.base)):a(this,C,"/"),a(this,N,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,x).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,_).call(this)}navigate(e,s="push"){return B(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;a(this,y,h);const d=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!d.includes(l)&&l.testPathname(f)),it=d.filter(l=>!l.testPathname(f)),G=d.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){a(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),a(this,H,h),F.changeHistory({action:s,pathname:h,searchParameters:c,hash:o});try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,N),h),a(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,I,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,x).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,{base:t(this,C)})}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,x=new WeakMap,_=new WeakMap,I=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,N).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),a(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
|
package/lib/router/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { URLPattern as at } from "urlpattern-polyfill";
|
|
|
24
24
|
import { Notifier as nt } from "../notifier/index.js";
|
|
25
25
|
import { i as _ } from "../index-euf5anj6.js";
|
|
26
26
|
import { d as ht } from "../function-C10DGppn.js";
|
|
27
|
-
import { n as rt, c as ot, s as ct } from "../url-
|
|
27
|
+
import { n as rt, c as ot, s as ct } from "../url-B6BNcw6_.js";
|
|
28
28
|
import { i as lt } from "../object-D6MVWB4l.js";
|
|
29
29
|
var y, U, A, p, d, L, k, v, E, R, M, tt;
|
|
30
30
|
class ut {
|
|
@@ -15,19 +15,19 @@ function d(t, { base: s = "", trailingSlash: a = !1 } = {}) {
|
|
|
15
15
|
const n = t.split("#"), e = n[0].split("?");
|
|
16
16
|
let r = e[0].startsWith("/") ? e[0] : "/" + e[0];
|
|
17
17
|
a ? r = !r.endsWith("/") && r !== "/" ? r + "/" : r : r = r.endsWith("/") && r !== "/" ? r.slice(0, -1) : r;
|
|
18
|
-
const f = s + r,
|
|
18
|
+
const f = s + r, m = e == null ? void 0 : e[1], l = n == null ? void 0 : n[1];
|
|
19
19
|
return {
|
|
20
20
|
leaf: r,
|
|
21
21
|
pathname: f,
|
|
22
|
-
parameters:
|
|
23
|
-
hash:
|
|
22
|
+
parameters: m,
|
|
23
|
+
hash: l
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function $(t = "/") {
|
|
27
27
|
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
28
28
|
}
|
|
29
29
|
function g(t) {
|
|
30
|
-
const s =
|
|
30
|
+
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", n = s ? s.startsWith("?") ? s : "?" + s : "", e = `${t.pathname}${a}${n}`, r = i(o({}, t.state), { path: e });
|
|
31
31
|
t.action === "push" ? history.pushState(r, "", e) : t.action === "replace" && history.replaceState(r, "", e);
|
|
32
32
|
}
|
|
33
33
|
function w(t) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var P=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var c=(t,s,r)=>s in t?P(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,i=(t,s)=>{for(var r in s||(s={}))u.call(s,r)&&c(t,r,s[r]);if(n)for(var r of n(s))p.call(s,r)&&c(t,r,s[r]);return t},o=(t,s)=>S(t,W(s));function y(t,{base:s="",trailingSlash:r=!1}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const h=t.split("#"),e=h[0].split("?");let a=e[0].startsWith("/")?e[0]:"/"+e[0];r?a=!a.endsWith("/")&&a!=="/"?a+"/":a:a=a.endsWith("/")&&a!=="/"?a.slice(0,-1):a;const f=s+a,m=e==null?void 0:e[1],l=h==null?void 0:h[1];return{leaf:a,pathname:f,parameters:m,hash:l}}function d(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function g(t){const s=t==null?void 0:t.searchParameters,r=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",h=s?s.startsWith("?")?s:"?"+s:"",e=`${t.pathname}${r}${h}`,a=o(i({},t.state),{path:e});t.action==="push"?history.pushState(a,"",e):t.action==="replace"&&history.replaceState(a,"",e)}function $(t){const s=new URLSearchParams(t),r={};for(const[h,e]of s)r[h]=e;return r}function w(t,s){const r=new URL(location.href),h=(s==null?void 0:s.toString())||"";r.searchParams.set(t,h),history.replaceState(history.state,"",r.href)}exports.changeHistory=g;exports.normalizeBase=d;exports.parseSearchParameters=$;exports.splitPath=y;exports.updateSearchParameter=w;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../attributes-Bf2svn4j.cjs"),y=require("../index-Cqw2NKev.cjs"),d=require("../canvas-CU5Xjahf.cjs"),g=require("../coordinates-D8Np3cPD.cjs"),p=require("../dom-JBOkFLTh.cjs"),r=require("../easings-GegIwET5.cjs"),q=require("../events-KVanG9sR.cjs"),C=require("../file-DSpfWdd9.cjs"),I=require("../function-MthRj-GJ.cjs"),w=require("../gestures-C7gbKx11.cjs"),O=require("../jss-CRBgdvJ3.cjs"),m=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),f=require("../number-0243DApo.cjs"),l=require("../object-CCiXnER2.cjs"),T=require("../polyfills-Df4r-ETT.cjs"),Q=require("../scroll-H9zqFeML.cjs"),c=require("../string-DUXXtU8v.cjs"),S=require("../style-At6aDoqG.cjs"),u=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../attributes-Bf2svn4j.cjs"),y=require("../index-Cqw2NKev.cjs"),d=require("../canvas-CU5Xjahf.cjs"),g=require("../coordinates-D8Np3cPD.cjs"),p=require("../dom-JBOkFLTh.cjs"),r=require("../easings-GegIwET5.cjs"),q=require("../events-KVanG9sR.cjs"),C=require("../file-DSpfWdd9.cjs"),I=require("../function-MthRj-GJ.cjs"),w=require("../gestures-C7gbKx11.cjs"),O=require("../jss-CRBgdvJ3.cjs"),m=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),f=require("../number-0243DApo.cjs"),l=require("../object-CCiXnER2.cjs"),T=require("../polyfills-Df4r-ETT.cjs"),Q=require("../scroll-H9zqFeML.cjs"),c=require("../string-DUXXtU8v.cjs"),S=require("../style-At6aDoqG.cjs"),u=require("../url-D1CgmwZ_.cjs");function B(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function D(t,e){const n=t.length;e=e%n;const o=new Array(n);for(let s=0;s<n;s++){const a=(s+e)%n;o[a]=t[s]}return o}function A(t,e=2){if(!+t)return"0 Bytes";const n=1024,o=e<0?0:e,s=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],a=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,a)).toFixed(o))} ${s[a]}`}function R(t){if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(e=>{console.error("Failed to copy text to clipboard:",e)});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="0",e.style.left="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(n){console.error("Failed to copy text to clipboard:",n)}document.body.removeChild(e)}}function N(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function z(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function E(t,e){const n=t.style.getPropertyValue(e);if(n){const o=n.toString();return o.startsWith("var")?E(t,o.slice(4,-1)):o}}function M(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(o=>{o instanceof CSSStyleRule&&o.selectorText===":root"&&t.forEach(s=>{const a=E(o,s);a&&(e[s]=a)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function j(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function k(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}function V(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function U(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function F(t,e,n,o){let s,a=!1,b=0;const x=()=>{clearInterval(s),o!=null&&o.restartCounter&&(b=0),a&&(s=setInterval(()=>{n(b++)},e))},v=y.intersector.subscribe(t,P=>{a=P.isIntersecting,x()});return()=>{v(),clearInterval(s)}}exports.parseAttribute=h.parseAttribute;exports.parseAttributeValue=h.parseAttributeValue;exports.isBrowser=y.isBrowser;exports.contain=d.contain;exports.cover=d.cover;exports.fixPosition=d.fixPosition;exports.measureText=d.measureText;exports.getPointerPosition=g.getPointerPosition;exports.normalize=g.normalize;exports.screenToCartesian=g.screenToCartesian;exports.findParentElement=p.findParentElement;exports.findScrollParentElement=p.findScrollParentElement;exports.getAllParentElements=p.getAllParentElements;exports.getElement=p.getElement;exports.easeInCubic=r.easeInCubic;exports.easeInExpo=r.easeInExpo;exports.easeInOutCubic=r.easeInOutCubic;exports.easeInOutExpo=r.easeInOutExpo;exports.easeInOutQuad=r.easeInOutQuad;exports.easeInOutQuart=r.easeInOutQuart;exports.easeInOutQuint=r.easeInOutQuint;exports.easeInQuad=r.easeInQuad;exports.easeInQuart=r.easeInQuart;exports.easeInQuint=r.easeInQuint;exports.easeOutCubic=r.easeOutCubic;exports.easeOutExpo=r.easeOutExpo;exports.easeOutQuad=r.easeOutQuad;exports.easeOutQuart=r.easeOutQuart;exports.easeOutQuint=r.easeOutQuint;exports.linear=r.linear;exports.dispatchEvent=q.dispatchEvent;exports.createJSONAndSave=C.createJSONAndSave;exports.downloadURI=C.downloadURI;exports.debounce=I.debounce;exports.throttle=I.throttle;exports.setupDrag=w.setupDrag;exports.createStylesheet=O.createStylesheet;exports.styleToString=O.styleToString;exports.getCumulativeOffsetLeft=m.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=m.getCumulativeOffsetTop;exports.getCumulativePosition=m.getCumulativePosition;exports.getStickyOffset=m.getStickyOffset;exports.calculateDistance=i.calculateDistance;exports.calculateDistanceWithRadius=i.calculateDistanceWithRadius;exports.clamp=i.clamp;exports.damp=i.damp;exports.lerp=i.lerp;exports.mapRange=i.mapRange;exports.round=i.round;exports.smootherstep=i.smootherstep;exports.smoothstep=i.smoothstep;exports.step=i.step;exports.loopNumber=f.loopNumber;exports.preciseNumber=f.preciseNumber;exports.roundNumberTo=f.roundNumberTo;exports.toStep=f.toStep;exports.cloneDeep=l.cloneDeep;exports.compareObjects=l.compareObjects;exports.isESClass=l.isESClass;exports.isNullish=l.isNullish;exports.isObject=l.isObject;exports.mergeDeep=l.mergeDeep;exports.mixin=l.mixin;exports.omit=l.omit;exports.pick=l.pick;exports.nullishCoalescing=T.nullishCoalescing;exports.requestIdleCallback=T.requestIdleCallback;exports.scrollToElement=Q.scrollToElement;exports.camelToKebab=c.camelToKebab;exports.capitalize=c.capitalize;exports.declension=c.declension;exports.decodeHtmlEntities=c.decodeHtmlEntities;exports.generateId=c.generateId;exports.isUppercase=c.isUppercase;exports.kebabToCamel=c.kebabToCamel;exports.snakeToDotted=c.snakeToDotted;exports.toPascalCase=c.toPascalCase;exports.uncapitalize=c.uncapitalize;exports.getElementTransitionDurationMS=S.getElementTransitionDurationMS;exports.getElementTransitionDurationS=S.getElementTransitionDurationS;exports.changeHistory=u.changeHistory;exports.normalizeBase=u.normalizeBase;exports.parseSearchParameters=u.parseSearchParameters;exports.splitPath=u.splitPath;exports.updateSearchParameter=u.updateSearchParameter;exports.cloneTemplateContent=U;exports.copyTextToClipboard=R;exports.decode=k;exports.dotCircleCollision=z;exports.dotRectCollision=N;exports.encode=j;exports.formatBytes=A;exports.getRootVariables=M;exports.insert=B;exports.setIntervalOnIntersection=F;exports.shiftArray=D;exports.wait=V;
|
package/lib/utils/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { n as _e, r as et } from "../polyfills-DJrTJQky.js";
|
|
|
18
18
|
import { s as st } from "../scroll-myLAt-Tq.js";
|
|
19
19
|
import { c as ot, a as rt, b as nt, d as it, g as ct, i as lt, k as ut, s as ft, t as pt, u as dt } from "../string-BlMQbe8b.js";
|
|
20
20
|
import { g as xt, a as gt } from "../style-j2TwriJ_.js";
|
|
21
|
-
import { c as ht, n as yt, p as Ct, s as It, u as vt } from "../url-
|
|
21
|
+
import { c as ht, n as yt, p as Ct, s as It, u as vt } from "../url-B6BNcw6_.js";
|
|
22
22
|
function d(t, e, ...s) {
|
|
23
23
|
return [...t.slice(0, e), ...s, ...t.slice(e)];
|
|
24
24
|
}
|
package/package.json
CHANGED
package/lib/url-CLvdjbII.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var c=(t,s,a)=>s in t?P(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,i=(t,s)=>{for(var a in s||(s={}))u.call(s,a)&&c(t,a,s[a]);if(n)for(var a of n(s))p.call(s,a)&&c(t,a,s[a]);return t},o=(t,s)=>S(t,W(s));function y(t,{base:s="",trailingSlash:a=!1}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const h=t.split("#"),e=h[0].split("?");let r=e[0].startsWith("/")?e[0]:"/"+e[0];a?r=!r.endsWith("/")&&r!=="/"?r+"/":r:r=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r;const f=s+r,m=e==null?void 0:e[1],l=h==null?void 0:h[1];return{leaf:r,pathname:f,parameters:m,hash:l}}function d(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function g(t){const s=(t==null?void 0:t.searchParameters)||location.search,a=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",h=s?s.startsWith("?")?s:"?"+s:"",e=`${t.pathname}${a}${h}`,r=o(i({},t.state),{path:e});t.action==="push"?history.pushState(r,"",e):t.action==="replace"&&history.replaceState(r,"",e)}function $(t){const s=new URLSearchParams(t),a={};for(const[h,e]of s)a[h]=e;return a}function w(t,s){const a=new URL(location.href),h=(s==null?void 0:s.toString())||"";a.searchParams.set(t,h),history.replaceState(history.state,"",a.href)}exports.changeHistory=g;exports.normalizeBase=d;exports.parseSearchParameters=$;exports.splitPath=y;exports.updateSearchParameter=w;
|