aptechka 0.54.1 → 0.54.3
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/{Tweened-BWPx3jJR.js → Tweened-BSC-evuL.js} +1 -1
- package/lib/animation/index.js +1 -1
- package/lib/controls/index.js +2 -2
- package/lib/{easings-BEmRlrDd.js → easings-Bni3YAAW.js} +15 -15
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +155 -152
- package/lib/scroll/index.js +2 -2
- package/lib/utils/href.d.ts +4 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +160 -154
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var c = (a, r, e) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writab
|
|
|
15
15
|
}, g = (a, r) => b(a, x(r));
|
|
16
16
|
var A = (a, r, e) => r.has(a) || f("Cannot " + e);
|
|
17
17
|
var m = (a, r, e) => (A(a, r, "read from private field"), e ? e.call(a) : r.get(a)), n = (a, r, e) => r.has(a) ? f("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, e), u = (a, r, e, i) => (A(a, r, "write to private field"), i ? i.call(a, e) : r.set(a, e), e);
|
|
18
|
-
import { l as h, e as T } from "./easings-
|
|
18
|
+
import { l as h, e as T } from "./easings-Bni3YAAW.js";
|
|
19
19
|
import { c as q } from "./math-BOBiC4TN.js";
|
|
20
20
|
import { p as w } from "./number-DwCxt_Ck.js";
|
|
21
21
|
import { n as z } from "./polyfills-DJrTJQky.js";
|
package/lib/animation/index.js
CHANGED
package/lib/controls/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import { i as b } from "../index-euf5anj6.js";
|
|
|
8
8
|
import { g as J } from "../dom-CVWzyXPH.js";
|
|
9
9
|
import { ticker as A } from "../ticker/index.js";
|
|
10
10
|
import "../Store-swP_0ymB.js";
|
|
11
|
-
import {
|
|
12
|
-
import { T as ie } from "../Tweened-
|
|
11
|
+
import { b as te } from "../easings-Bni3YAAW.js";
|
|
12
|
+
import { T as ie } from "../Tweened-BSC-evuL.js";
|
|
13
13
|
import { s as se } from "../gestures-CcXV6fCp.js";
|
|
14
14
|
import { p as he } from "../number-DwCxt_Ck.js";
|
|
15
15
|
import { TICK_ORDER as ae } from "../order/index.js";
|
|
@@ -18,21 +18,21 @@ const n = (e) => e, s = (e) => e * e, a = (e) => e * (2 - e), r = (e) => e < 0.5
|
|
|
18
18
|
linear: n
|
|
19
19
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
20
20
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
g as a,
|
|
22
|
+
s as b,
|
|
23
|
+
a as c,
|
|
24
|
+
r as d,
|
|
25
25
|
x as e,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
i,
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
u as f,
|
|
27
|
+
o as g,
|
|
28
|
+
c as h,
|
|
29
|
+
O as i,
|
|
30
|
+
i as j,
|
|
31
|
+
I as k,
|
|
32
32
|
n as l,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
Q as m,
|
|
34
|
+
b as n,
|
|
35
|
+
l as o,
|
|
36
|
+
p,
|
|
37
|
+
d as q
|
|
38
38
|
};
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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 Pt=require("../index-Cqw2NKev.cjs"),_=require("../events-KVanG9sR.cjs"),Nt=require("../polyfills-Df4r-ETT.cjs"),yt=require("../scroll-DAhSpkhR.cjs"),X=require("../url-D1CgmwZ_.cjs"),Dt=require("../css-value-parser/index.cjs");class At 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)}}Pt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",At);var P,c,x,j,I;class wt{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 bt{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,kt,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(Pt.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 bt(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 At),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:Ct,leaf:Mt}=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,kt).call(this,dt,mt),Tt=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]}}}))),yield yt.wait(10);const pt=[];Tt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,l,ot).call(this,n)?pt.push(n):n.remove())});const Ht=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",Mt),X.changeHistory({action:s,pathname:h,searchParameters:Ct||(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=Ht[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),Nt.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const J={morphElement:n,pathname:h};_.dispatchEvent(document,"morphNewChildrenAdded",{detail:J});const xt=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(xt)}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 wt(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 wt(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 bt(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]},kt=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)&&yt.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;
|
|
1
|
+
"use strict";var vt=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),Lt=r=>{throw TypeError(r)};var et=(r,e,s)=>e.has(r)||Lt("Cannot "+s);var t=(r,e,s)=>(et(r,e,"read from private field"),s?s.call(r):e.get(r)),o=(r,e,s)=>e.has(r)?Lt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,s),a=(r,e,s,i)=>(et(r,e,"write to private field"),i?i.call(r,s):e.set(r,s),s),d=(r,e,s)=>(et(r,e,"access private method"),s);var H=(r,e,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,e)).next())});var St=(r,e,s)=>(e=r[vt("asyncIterator")])?e.call(r):(r=r[vt("iterator")](),e={},s=(i,u)=>(u=r[i])&&(e[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"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pt=require("../index-Cqw2NKev.cjs"),_=require("../events-KVanG9sR.cjs"),Nt=require("../polyfills-Df4r-ETT.cjs"),yt=require("../scroll-DAhSpkhR.cjs"),X=require("../url-D1CgmwZ_.cjs"),Dt=require("../css-value-parser/index.cjs");class At 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,i]of Object.entries(e))this.setAttribute(s,i)}}Pt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",At);var y,c,x,j,I;class bt{constructor(e,s){o(this,y);o(this,c);o(this,x);o(this,j,e=>{if(e.preventDefault(),t(this,c).hasAttribute("data-back")&&t(this,y).previousPathname)history.back();else{const i=t(this,c).getAttribute("data-history-action")||"push",u=t(this,c).hasAttribute("data-center-scroll"),f=getComputedStyle(t(this,c)).getPropertyValue("--offset-scroll").trim(),M=f?Dt.cssValueParser.parse(f):void 0,T=t(this,c).hasAttribute("data-revalidate"),p=t(this,c).hasAttribute("data-keep-search-parameters");t(this,y).navigate(t(this,x),{historyAction:i,centerScroll:u,offsetScroll:M,revalidate:T,keepSearchParameters:p})}});o(this,I,()=>{t(this,y).prefetch(t(this,x)),t(this,c).removeEventListener("pointerenter",t(this,I))});a(this,y,s),a(this,c,e),a(this,x,t(this,c).getAttribute("href")||"/"),t(this,c).addEventListener("click",t(this,j)),this.checkCurrent(location.pathname),t(this,c).hasAttribute("data-prefetch")&&t(this,c).addEventListener("pointerenter",t(this,I))}get element(){return t(this,c)}checkCurrent(e){const s=t(this,y).normalizePath(e),i=t(this,y).normalizePath(t(this,x));t(this,c).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,c).classList.add("current"):i.pathname===s.pathname?t(this,c).classList.add("current"):t(this,c).classList.remove("current")}destroy(){t(this,c).removeEventListener("click",t(this,j)),t(this,c).removeEventListener("pointerenter",t(this,I)),t(this,c).classList.remove("current")}}y=new WeakMap,c=new WeakMap,x=new WeakMap,j=new WeakMap,I=new WeakMap;var N,V,E,D,R,A;class wt{constructor(e,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,e),a(this,V,s),a(this,D,i.cloneNode(!0))}get pathname(){return t(this,V)}get scrollState(){return t(this,E)}get document(){return t(this,A)}cloneDocument(){a(this,A,(t(this,R)||t(this,D)).cloneNode(!0))}get title(){let e="";if(t(this,A).title)e=t(this,A).title;else{const s=t(this,A).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,V)}return e}clearScrollState(){t(this,E).x=0,t(this,E).y=0}clearDocumentState(){a(this,R,null)}saveScrollState(){t(this,D).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,E).x=0,t(this,E).y=0):(t(this,E).x=t(this,N).scrollElement.scrollLeft,t(this,E).y=t(this,N).scrollElement.scrollTop)}saveDocumentState(){t(this,D).documentElement.hasAttribute("data-no-page-restoration")?a(this,R,null):a(this,R,document.cloneNode(!0))}restoreScrollPosition(){t(this,N).scrollElement.scroll({top:t(this,E).y,left:t(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,b,L,B,z,l,st,it,rt,kt,nt,ot,at,lt,$,O;class Rt{constructor(e){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,b,!1);o(this,L,null);o(this,B,new Map);o(this,z,null);o(this,$,e=>H(this,null,function*(){var s;(s=e.state)!=null&&s.path&&(e.preventDefault(),a(this,b,!0),yield this.navigate(e.state.path,{historyAction:"none"}),a(this,b,!1))}));o(this,O,()=>{const e=t(this,L).scrollTop,s=t(this,L).scrollLeft;document.documentElement.classList.toggle("top-scrolled",e>0),document.documentElement.classList.toggle("left-scrolled",s>0),_.dispatchEvent(document,"morphScroll",{detail:{left:s,top:e}})});if(Pt.isBrowser){a(this,k,{base:X.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,cachePages:(e==null?void 0:e.cachePages)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:(e==null?void 0:e.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),t(this,B).set(t(this,m),new wt(this,t(this,m),document)),document.documentElement.setAttribute("data-current-pathname",t(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",t(this,$)),X.changeHistory({action:"replace",pathname:t(this,m),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,z,new At),d(this,l,at).call(this,document)}}get currentPathname(){return t(this,m)}get previousPathname(){return t(this,K)}get links(){return t(this,g)}get scrollElement(){return t(this,L)}get isPopstateNavigation(){return t(this,b)}normalizePath(e){return X.splitPath(e,{base:t(this,k).base,trailingSlash:t(this,k).trailingSlash})}prefetch(e){return H(this,null,function*(){const s=this.normalizePath(e);d(this,l,it).call(this,s.pathname)})}navigate(T){return H(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f,keepSearchParameters:M}={}){var ct;if(t(this,q).length)return;const p=this.normalizePath(((ct=this.pathnameModifier)==null?void 0:ct.call(this,e))||e);let{pathname:h,hash:Y,parameters:Ct,leaf:Mt}=p;if(t(this,C)===h||t(this,m)===h){t(this,b)||d(this,l,lt).call(this,Y||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,C,h),t(this,g).forEach(F=>{F.checkCurrent(h)});try{let F=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var P;(P=this.preprocessor)==null||P.call(this,{pathname:h,resolve:n,reject:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),F=!1}if(!F||t(this,C)!==h){t(this,g).forEach(n=>{n.checkCurrent(t(this,m))});return}const ht=yield d(this,l,st).call(this,t(this,m)),S=yield d(this,l,st).call(this,h,f);if(t(this,C)!==h){t(this,g).forEach(n=>{n.checkCurrent(t(this,m))});return}ht.saveScrollState(),ht.saveDocumentState(),t(this,b)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),t(this,z).textContent=S.title,document.body.appendChild(t(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,kt).call(this,dt,mt),Tt=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 P=document.createElement("script");P.type="module",P.src=n.getAttribute("src"),G[w]=P}}),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});t(this,k).waitForHeadToLoad&&tt.length&&(yield new Promise(n=>H(this,null,function*(){let w=0;try{for(var P=St(tt),Et,W,gt;Et=!(W=yield P.next()).done;Et=!1){const J=W.value;J.onload=()=>{w++,w===tt.length&&n()}}}catch(W){gt=[W]}finally{try{Et&&(W=P.return)&&(yield W.call(P))}finally{if(gt)throw gt[0]}}}))),yield yt.wait(10);const pt=[];Tt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,l,ot).call(this,n)?pt.push(n):n.remove())});const Ht=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",Mt),X.changeHistory({action:s,pathname:h,searchParameters:Ct||(M?location.search:""),hash:Y}),t(this,z).remove(),a(this,K,t(this,m)),a(this,m,h),t(this,U).forEach((n,w)=>{const P=Ht[w],Et=getComputedStyle(n).getPropertyValue("--morph-duration"),W=[...P.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),Nt.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const J={morphElement:n,pathname:h};_.dispatchEvent(document,"morphNewChildrenAdded",{detail:J});const xt=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)});t(this,q).push(xt)}else n.innerHTML="",n.append(...W)}),Y?(S.clearScrollState(),d(this,l,lt).call(this,Y,{centerScroll:i,offsetScroll:u})):t(this,b)&&S.restoreScrollPosition(),yield Promise.all(t(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(e){t(this,g).push(new bt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){a(this,g,t(this,g).filter(s=>s.element===e?(s.destroy(),!1):!0))}findLinks(){const e=[...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"});t(this,g).forEach(s=>s.destroy()),a(this,g,e.map(s=>new bt(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,b=new WeakMap,L=new WeakMap,B=new WeakMap,z=new WeakMap,l=new WeakSet,st=function(e,s=!1){return H(this,null,function*(){let i=t(this,B).get(e);return(!i||s)&&(i=yield d(this,l,it).call(this,e)),i})},it=function(e){return H(this,null,function*(){const i=yield(yield fetch(e)).text(),u=t(this,Z).parseFromString(i,"text/html"),f=new wt(this,e,u);return t(this,B).set(e,f),f})},rt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},kt=function(e,s){return e.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},nt=function(e,s){return e.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ot=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},at=function(e){var s,i;(s=t(this,L))==null||s.removeEventListener("scroll",t(this,O)),a(this,L,e.querySelector(t(this,k).scrollSelector)||e.documentElement),(i=t(this,L))==null||i.addEventListener("scroll",t(this,O)),t(this,O).call(this)},lt=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&yt.scrollToElement(i,{scrollElement:t(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,9 +1,9 @@
|
|
|
1
|
-
var gt = (r,
|
|
1
|
+
var gt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), vt = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var tt = (r,
|
|
5
|
-
var
|
|
6
|
-
var H = (r,
|
|
4
|
+
var tt = (r, e, s) => e.has(r) || vt("Cannot " + s);
|
|
5
|
+
var t = (r, e, s) => (tt(r, e, "read from private field"), s ? s.call(r) : e.get(r)), o = (r, e, s) => e.has(r) ? vt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), a = (r, e, s, i) => (tt(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s), d = (r, e, s) => (tt(r, e, "access private method"), s);
|
|
6
|
+
var H = (r, e, s) => new Promise((i, u) => {
|
|
7
7
|
var f = (p) => {
|
|
8
8
|
try {
|
|
9
9
|
M(s.next(p));
|
|
@@ -17,10 +17,10 @@ var H = (r, t, s) => new Promise((i, u) => {
|
|
|
17
17
|
u(c);
|
|
18
18
|
}
|
|
19
19
|
}, M = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(f, T);
|
|
20
|
-
M((s = s.apply(r,
|
|
20
|
+
M((s = s.apply(r, e)).next());
|
|
21
21
|
});
|
|
22
|
-
var Lt = (r,
|
|
23
|
-
import { i as
|
|
22
|
+
var Lt = (r, e, s) => (e = r[gt("asyncIterator")]) ? e.call(r) : (r = r[gt("iterator")](), e = {}, s = (i, u) => (u = r[i]) && (e[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"), e);
|
|
23
|
+
import { i as yt } from "../index-euf5anj6.js";
|
|
24
24
|
import { d as U } from "../events-CsVF98U6.js";
|
|
25
25
|
import { r as xt } from "../polyfills-DJrTJQky.js";
|
|
26
26
|
import { w as Nt, s as Dt } from "../scroll-Benkuq-t.js";
|
|
@@ -28,115 +28,118 @@ import { n as Rt, c as St, s as zt } from "../url-B6BNcw6_.js";
|
|
|
28
28
|
import { cssValueParser as qt } from "../css-value-parser/index.js";
|
|
29
29
|
class Pt extends HTMLElement {
|
|
30
30
|
connectedCallback() {
|
|
31
|
-
const
|
|
31
|
+
const e = {
|
|
32
32
|
"aria-live": "assertive",
|
|
33
33
|
"aria-atomic": "true",
|
|
34
34
|
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"
|
|
35
35
|
};
|
|
36
|
-
for (const [s, i] of Object.entries(
|
|
36
|
+
for (const [s, i] of Object.entries(e))
|
|
37
37
|
this.setAttribute(s, i);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
class
|
|
43
|
-
constructor(
|
|
44
|
-
o(this,
|
|
45
|
-
o(this,
|
|
40
|
+
yt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Pt);
|
|
41
|
+
var b, l, x, j, I;
|
|
42
|
+
class bt {
|
|
43
|
+
constructor(e, s) {
|
|
44
|
+
o(this, b);
|
|
45
|
+
o(this, l);
|
|
46
46
|
o(this, x);
|
|
47
|
-
o(this, j, (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
o(this, j, (e) => {
|
|
48
|
+
if (e.preventDefault(), t(this, l).hasAttribute("data-back") && t(this, b).previousPathname)
|
|
49
|
+
history.back();
|
|
50
|
+
else {
|
|
51
|
+
const i = t(this, l).getAttribute(
|
|
52
|
+
"data-history-action"
|
|
53
|
+
) || "push", u = t(this, l).hasAttribute("data-center-scroll"), f = getComputedStyle(t(this, l)).getPropertyValue("--offset-scroll").trim(), T = f ? qt.parse(f) : void 0, M = t(this, l).hasAttribute("data-revalidate"), p = t(this, l).hasAttribute(
|
|
54
|
+
"data-keep-search-parameters"
|
|
55
|
+
);
|
|
56
|
+
t(this, b).navigate(t(this, x), {
|
|
57
|
+
historyAction: i,
|
|
58
|
+
centerScroll: u,
|
|
59
|
+
offsetScroll: T,
|
|
60
|
+
revalidate: M,
|
|
61
|
+
keepSearchParameters: p
|
|
62
|
+
});
|
|
63
|
+
}
|
|
61
64
|
});
|
|
62
65
|
o(this, I, () => {
|
|
63
|
-
|
|
66
|
+
t(this, b).prefetch(t(this, x)), t(this, l).removeEventListener("pointerenter", t(this, I));
|
|
64
67
|
});
|
|
65
|
-
a(this,
|
|
68
|
+
a(this, b, s), a(this, l, e), a(this, x, t(this, l).getAttribute("href") || "/"), t(this, l).addEventListener("click", t(this, j)), this.checkCurrent(location.pathname), t(this, l).hasAttribute("data-prefetch") && t(this, l).addEventListener("pointerenter", t(this, I));
|
|
66
69
|
}
|
|
67
70
|
get element() {
|
|
68
|
-
return
|
|
71
|
+
return t(this, l);
|
|
69
72
|
}
|
|
70
|
-
checkCurrent(
|
|
71
|
-
const s =
|
|
72
|
-
|
|
73
|
+
checkCurrent(e) {
|
|
74
|
+
const s = t(this, b).normalizePath(e), i = t(this, b).normalizePath(t(this, x));
|
|
75
|
+
t(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? t(this, l).classList.add("current") : i.pathname === s.pathname ? t(this, l).classList.add("current") : t(this, l).classList.remove("current");
|
|
73
76
|
}
|
|
74
77
|
destroy() {
|
|
75
|
-
|
|
78
|
+
t(this, l).removeEventListener("click", t(this, j)), t(this, l).removeEventListener("pointerenter", t(this, I)), t(this, l).classList.remove("current");
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
|
|
81
|
+
b = new WeakMap(), l = new WeakMap(), x = new WeakMap(), j = new WeakMap(), I = new WeakMap();
|
|
79
82
|
var N, V, E, D, R, A;
|
|
80
|
-
class
|
|
81
|
-
constructor(
|
|
83
|
+
class wt {
|
|
84
|
+
constructor(e, s, i) {
|
|
82
85
|
o(this, N);
|
|
83
86
|
o(this, V);
|
|
84
87
|
o(this, E, { x: 0, y: 0 });
|
|
85
88
|
o(this, D);
|
|
86
89
|
o(this, R, null);
|
|
87
90
|
o(this, A, null);
|
|
88
|
-
a(this, N,
|
|
91
|
+
a(this, N, e), a(this, V, s), a(this, D, i.cloneNode(!0));
|
|
89
92
|
}
|
|
90
93
|
get pathname() {
|
|
91
|
-
return
|
|
94
|
+
return t(this, V);
|
|
92
95
|
}
|
|
93
96
|
get scrollState() {
|
|
94
|
-
return
|
|
97
|
+
return t(this, E);
|
|
95
98
|
}
|
|
96
99
|
get document() {
|
|
97
|
-
return
|
|
100
|
+
return t(this, A);
|
|
98
101
|
}
|
|
99
102
|
cloneDocument() {
|
|
100
|
-
a(this, A, (
|
|
103
|
+
a(this, A, (t(this, R) || t(this, D)).cloneNode(!0));
|
|
101
104
|
}
|
|
102
105
|
get title() {
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
+
let e = "";
|
|
107
|
+
if (t(this, A).title)
|
|
108
|
+
e = t(this, A).title;
|
|
106
109
|
else {
|
|
107
|
-
const s =
|
|
108
|
-
|
|
110
|
+
const s = t(this, A).querySelector("h1");
|
|
111
|
+
e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, V);
|
|
109
112
|
}
|
|
110
|
-
return
|
|
113
|
+
return e;
|
|
111
114
|
}
|
|
112
115
|
clearScrollState() {
|
|
113
|
-
|
|
116
|
+
t(this, E).x = 0, t(this, E).y = 0;
|
|
114
117
|
}
|
|
115
118
|
clearDocumentState() {
|
|
116
119
|
a(this, R, null);
|
|
117
120
|
}
|
|
118
121
|
saveScrollState() {
|
|
119
|
-
|
|
122
|
+
t(this, D).documentElement.hasAttribute(
|
|
120
123
|
"data-no-scroll-restoration"
|
|
121
|
-
) ? (
|
|
124
|
+
) ? (t(this, E).x = 0, t(this, E).y = 0) : (t(this, E).x = t(this, N).scrollElement.scrollLeft, t(this, E).y = t(this, N).scrollElement.scrollTop);
|
|
122
125
|
}
|
|
123
126
|
saveDocumentState() {
|
|
124
|
-
|
|
127
|
+
t(this, D).documentElement.hasAttribute(
|
|
125
128
|
"data-no-page-restoration"
|
|
126
129
|
) ? a(this, R, null) : a(this, R, document.cloneNode(!0));
|
|
127
130
|
}
|
|
128
131
|
restoreScrollPosition() {
|
|
129
|
-
|
|
130
|
-
top:
|
|
131
|
-
left:
|
|
132
|
+
t(this, N).scrollElement.scroll({
|
|
133
|
+
top: t(this, E).y,
|
|
134
|
+
left: t(this, E).x
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
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, w, L, B, q,
|
|
139
|
+
var k, K, g, X, C, m, Y, z, w, L, B, q, h, et, st, it, At, rt, nt, ot, at, Z, O;
|
|
137
140
|
class jt {
|
|
138
|
-
constructor(
|
|
139
|
-
o(this,
|
|
141
|
+
constructor(e) {
|
|
142
|
+
o(this, h);
|
|
140
143
|
o(this, k, null);
|
|
141
144
|
o(this, K, null);
|
|
142
145
|
o(this, g, []);
|
|
@@ -149,96 +152,96 @@ class jt {
|
|
|
149
152
|
o(this, L, null);
|
|
150
153
|
o(this, B, /* @__PURE__ */ new Map());
|
|
151
154
|
o(this, q, null);
|
|
152
|
-
o(this, Z, (
|
|
155
|
+
o(this, Z, (e) => H(this, null, function* () {
|
|
153
156
|
var s;
|
|
154
|
-
(s =
|
|
157
|
+
(s = e.state) != null && s.path && (e.preventDefault(), a(this, w, !0), yield this.navigate(e.state.path, { historyAction: "none" }), a(this, w, !1));
|
|
155
158
|
}));
|
|
156
159
|
o(this, O, () => {
|
|
157
|
-
const
|
|
158
|
-
document.documentElement.classList.toggle("top-scrolled",
|
|
160
|
+
const e = t(this, L).scrollTop, s = t(this, L).scrollLeft;
|
|
161
|
+
document.documentElement.classList.toggle("top-scrolled", e > 0), document.documentElement.classList.toggle("left-scrolled", s > 0), U(document, "morphScroll", {
|
|
159
162
|
detail: {
|
|
160
163
|
left: s,
|
|
161
|
-
top:
|
|
164
|
+
top: e
|
|
162
165
|
}
|
|
163
166
|
});
|
|
164
167
|
});
|
|
165
|
-
if (
|
|
168
|
+
if (yt) {
|
|
166
169
|
a(this, k, {
|
|
167
|
-
base: Rt(
|
|
168
|
-
waitForHeadToLoad: (
|
|
169
|
-
cachePages: (
|
|
170
|
-
trailingSlash: (
|
|
171
|
-
scrollSelector: (
|
|
172
|
-
}), a(this, K, d(this,
|
|
170
|
+
base: Rt(e == null ? void 0 : e.base),
|
|
171
|
+
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
172
|
+
cachePages: (e == null ? void 0 : e.cachePages) !== !1,
|
|
173
|
+
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
174
|
+
scrollSelector: (e == null ? void 0 : e.scrollSelector) || "body"
|
|
175
|
+
}), a(this, K, d(this, h, it).call(this, document.body));
|
|
173
176
|
const s = this.normalizePath(
|
|
174
177
|
location.pathname + location.hash
|
|
175
178
|
);
|
|
176
|
-
a(this, m, s.pathname),
|
|
177
|
-
|
|
178
|
-
new
|
|
179
|
+
a(this, m, s.pathname), t(this, B).set(
|
|
180
|
+
t(this, m),
|
|
181
|
+
new wt(this, t(this, m), document)
|
|
179
182
|
), document.documentElement.setAttribute(
|
|
180
183
|
"data-current-pathname",
|
|
181
|
-
|
|
184
|
+
t(this, m)
|
|
182
185
|
), document.documentElement.setAttribute(
|
|
183
186
|
"data-current-leaf",
|
|
184
187
|
s.leaf
|
|
185
|
-
), this.findLinks(), addEventListener("popstate",
|
|
188
|
+
), this.findLinks(), addEventListener("popstate", t(this, Z)), St({
|
|
186
189
|
action: "replace",
|
|
187
|
-
pathname:
|
|
190
|
+
pathname: t(this, m),
|
|
188
191
|
searchParameters: s.parameters || location.search,
|
|
189
192
|
hash: s.hash
|
|
190
|
-
}), a(this, q, new Pt()), d(this,
|
|
193
|
+
}), a(this, q, new Pt()), d(this, h, ot).call(this, document);
|
|
191
194
|
}
|
|
192
195
|
}
|
|
193
196
|
get currentPathname() {
|
|
194
|
-
return
|
|
197
|
+
return t(this, m);
|
|
195
198
|
}
|
|
196
199
|
get previousPathname() {
|
|
197
|
-
return
|
|
200
|
+
return t(this, Y);
|
|
198
201
|
}
|
|
199
202
|
get links() {
|
|
200
|
-
return
|
|
203
|
+
return t(this, g);
|
|
201
204
|
}
|
|
202
205
|
get scrollElement() {
|
|
203
|
-
return
|
|
206
|
+
return t(this, L);
|
|
204
207
|
}
|
|
205
208
|
get isPopstateNavigation() {
|
|
206
|
-
return
|
|
209
|
+
return t(this, w);
|
|
207
210
|
}
|
|
208
|
-
normalizePath(
|
|
209
|
-
return zt(
|
|
210
|
-
base:
|
|
211
|
-
trailingSlash:
|
|
211
|
+
normalizePath(e) {
|
|
212
|
+
return zt(e, {
|
|
213
|
+
base: t(this, k).base,
|
|
214
|
+
trailingSlash: t(this, k).trailingSlash
|
|
212
215
|
});
|
|
213
216
|
}
|
|
214
|
-
prefetch(
|
|
217
|
+
prefetch(e) {
|
|
215
218
|
return H(this, null, function* () {
|
|
216
|
-
const s = this.normalizePath(
|
|
217
|
-
d(this,
|
|
219
|
+
const s = this.normalizePath(e);
|
|
220
|
+
d(this, h, st).call(this, s.pathname);
|
|
218
221
|
});
|
|
219
222
|
}
|
|
220
223
|
navigate(M) {
|
|
221
|
-
return H(this, arguments, function* (
|
|
224
|
+
return H(this, arguments, function* (e, {
|
|
222
225
|
historyAction: s = "push",
|
|
223
226
|
centerScroll: i,
|
|
224
227
|
offsetScroll: u,
|
|
225
228
|
revalidate: f,
|
|
226
229
|
keepSearchParameters: T
|
|
227
230
|
} = {}) {
|
|
228
|
-
var
|
|
229
|
-
if (
|
|
231
|
+
var ht;
|
|
232
|
+
if (t(this, z).length)
|
|
230
233
|
return;
|
|
231
|
-
const p = this.normalizePath(((
|
|
234
|
+
const p = this.normalizePath(((ht = this.pathnameModifier) == null ? void 0 : ht.call(this, e)) || e);
|
|
232
235
|
let { pathname: c, hash: _, parameters: kt, leaf: Ct } = p;
|
|
233
|
-
if (
|
|
234
|
-
|
|
236
|
+
if (t(this, C) === c || t(this, m) === c) {
|
|
237
|
+
t(this, w) || d(this, h, at).call(this, _ || 0, {
|
|
235
238
|
centerScroll: i,
|
|
236
239
|
offsetScroll: u,
|
|
237
240
|
behavior: "smooth"
|
|
238
241
|
});
|
|
239
242
|
return;
|
|
240
243
|
}
|
|
241
|
-
a(this, C, c),
|
|
244
|
+
a(this, C, c), t(this, g).forEach((F) => {
|
|
242
245
|
F.checkCurrent(c);
|
|
243
246
|
});
|
|
244
247
|
try {
|
|
@@ -246,8 +249,8 @@ class jt {
|
|
|
246
249
|
if (this.preprocessor)
|
|
247
250
|
try {
|
|
248
251
|
yield new Promise((n, y) => {
|
|
249
|
-
var
|
|
250
|
-
(
|
|
252
|
+
var P;
|
|
253
|
+
(P = this.preprocessor) == null || P.call(this, {
|
|
251
254
|
pathname: c,
|
|
252
255
|
resolve: n,
|
|
253
256
|
reject: y
|
|
@@ -256,31 +259,31 @@ class jt {
|
|
|
256
259
|
} catch (n) {
|
|
257
260
|
n ? console.error(n) : console.log("Route change canceled"), F = !1;
|
|
258
261
|
}
|
|
259
|
-
if (!F ||
|
|
260
|
-
|
|
261
|
-
n.checkCurrent(
|
|
262
|
+
if (!F || t(this, C) !== c) {
|
|
263
|
+
t(this, g).forEach((n) => {
|
|
264
|
+
n.checkCurrent(t(this, m));
|
|
262
265
|
});
|
|
263
266
|
return;
|
|
264
267
|
}
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
n.checkCurrent(
|
|
268
|
+
const lt = yield d(this, h, et).call(this, t(this, m)), S = yield d(this, h, et).call(this, c, f);
|
|
269
|
+
if (t(this, C) !== c) {
|
|
270
|
+
t(this, g).forEach((n) => {
|
|
271
|
+
n.checkCurrent(t(this, m));
|
|
269
272
|
});
|
|
270
273
|
return;
|
|
271
274
|
}
|
|
272
|
-
|
|
275
|
+
lt.saveScrollState(), lt.saveDocumentState(), t(this, w) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), t(this, q).textContent = S.title, document.body.appendChild(t(this, q));
|
|
273
276
|
const ct = {
|
|
274
277
|
pathname: c
|
|
275
278
|
};
|
|
276
279
|
U(document, "morphStart", {
|
|
277
280
|
detail: ct
|
|
278
281
|
});
|
|
279
|
-
const ut = Array.from(document.head.children), dt = Array.from(S.document.head.children), mt = d(this,
|
|
282
|
+
const ut = Array.from(document.head.children), dt = Array.from(S.document.head.children), mt = d(this, h, At).call(this, ut, dt), Tt = d(this, h, rt).call(this, ut, mt), G = d(this, h, rt).call(this, dt, mt);
|
|
280
283
|
G.forEach((n, y) => {
|
|
281
284
|
if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
|
|
282
|
-
const
|
|
283
|
-
|
|
285
|
+
const P = document.createElement("script");
|
|
286
|
+
P.type = "module", P.src = n.getAttribute("src"), G[y] = P;
|
|
284
287
|
}
|
|
285
288
|
}), G.forEach((n) => {
|
|
286
289
|
document.head.appendChild(n);
|
|
@@ -288,13 +291,13 @@ class jt {
|
|
|
288
291
|
const $ = G.filter((n) => {
|
|
289
292
|
if (n.hasAttribute("data-no-waiting"))
|
|
290
293
|
return !1;
|
|
291
|
-
if (d(this,
|
|
294
|
+
if (d(this, h, nt).call(this, n))
|
|
292
295
|
return !0;
|
|
293
296
|
});
|
|
294
|
-
|
|
297
|
+
t(this, k).waitForHeadToLoad && $.length && (yield new Promise((n) => H(this, null, function* () {
|
|
295
298
|
let y = 0;
|
|
296
299
|
try {
|
|
297
|
-
for (var
|
|
300
|
+
for (var P = Lt($), pt, W, Et; pt = !(W = yield P.next()).done; pt = !1) {
|
|
298
301
|
const J = W.value;
|
|
299
302
|
J.onload = () => {
|
|
300
303
|
y++, y === $.length && n();
|
|
@@ -304,7 +307,7 @@ class jt {
|
|
|
304
307
|
Et = [W];
|
|
305
308
|
} finally {
|
|
306
309
|
try {
|
|
307
|
-
pt && (W =
|
|
310
|
+
pt && (W = P.return) && (yield W.call(P));
|
|
308
311
|
} finally {
|
|
309
312
|
if (Et)
|
|
310
313
|
throw Et[0];
|
|
@@ -313,16 +316,16 @@ class jt {
|
|
|
313
316
|
}))), yield Nt(10);
|
|
314
317
|
const ft = [];
|
|
315
318
|
Tt.forEach((n) => {
|
|
316
|
-
n.hasAttribute("data-permanent") || (d(this,
|
|
319
|
+
n.hasAttribute("data-permanent") || (d(this, h, nt).call(this, n) ? ft.push(n) : n.remove());
|
|
317
320
|
});
|
|
318
|
-
const Mt = d(this,
|
|
319
|
-
d(this,
|
|
321
|
+
const Mt = d(this, h, it).call(this, S.document.body);
|
|
322
|
+
d(this, h, ot).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", c), document.documentElement.setAttribute("data-current-leaf", Ct), St({
|
|
320
323
|
action: s,
|
|
321
324
|
pathname: c,
|
|
322
325
|
searchParameters: kt || (T ? location.search : ""),
|
|
323
326
|
hash: _
|
|
324
|
-
}),
|
|
325
|
-
const
|
|
327
|
+
}), t(this, q).remove(), a(this, Y, t(this, m)), a(this, m, c), t(this, K).forEach((n, y) => {
|
|
328
|
+
const P = Mt[y], pt = getComputedStyle(n).getPropertyValue("--morph-duration"), W = [...P.childNodes];
|
|
326
329
|
if (pt) {
|
|
327
330
|
const Et = [...n.childNodes];
|
|
328
331
|
Et.forEach((v) => {
|
|
@@ -350,10 +353,10 @@ class jt {
|
|
|
350
353
|
}), v();
|
|
351
354
|
}, (parseFloat(pt) || 0) * 1e3 + 10);
|
|
352
355
|
});
|
|
353
|
-
|
|
356
|
+
t(this, z).push(Ht);
|
|
354
357
|
} else
|
|
355
358
|
n.innerHTML = "", n.append(...W);
|
|
356
|
-
}), _ ? (S.clearScrollState(), d(this,
|
|
359
|
+
}), _ ? (S.clearScrollState(), d(this, h, at).call(this, _, { centerScroll: i, offsetScroll: u })) : t(this, w) && S.restoreScrollPosition(), yield Promise.all(t(this, z)), ft.forEach((n) => n.remove()), a(this, z, []), this.findLinks(), U(document, "morphComplete", {
|
|
357
360
|
detail: ct
|
|
358
361
|
}), window.dispatchEvent(new Event("resize"));
|
|
359
362
|
} catch (F) {
|
|
@@ -362,19 +365,19 @@ class jt {
|
|
|
362
365
|
a(this, C, void 0);
|
|
363
366
|
});
|
|
364
367
|
}
|
|
365
|
-
addLink(
|
|
366
|
-
|
|
368
|
+
addLink(e) {
|
|
369
|
+
t(this, g).push(new bt(e, this));
|
|
367
370
|
}
|
|
368
|
-
addLinks(
|
|
369
|
-
|
|
371
|
+
addLinks(e) {
|
|
372
|
+
e.forEach((s) => {
|
|
370
373
|
this.addLink(s);
|
|
371
374
|
});
|
|
372
375
|
}
|
|
373
|
-
removeLink(
|
|
374
|
-
a(this, g,
|
|
376
|
+
removeLink(e) {
|
|
377
|
+
a(this, g, t(this, g).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
|
|
375
378
|
}
|
|
376
379
|
findLinks() {
|
|
377
|
-
const
|
|
380
|
+
const e = [
|
|
378
381
|
...document.documentElement.querySelectorAll("a")
|
|
379
382
|
].filter(
|
|
380
383
|
(s) => {
|
|
@@ -382,46 +385,46 @@ class jt {
|
|
|
382
385
|
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";
|
|
383
386
|
}
|
|
384
387
|
);
|
|
385
|
-
|
|
388
|
+
t(this, g).forEach((s) => s.destroy()), a(this, g, e.map((s) => new bt(s, this)));
|
|
386
389
|
}
|
|
387
390
|
}
|
|
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(), w = new WeakMap(), L = new WeakMap(), B = new WeakMap(), q = new WeakMap(),
|
|
391
|
+
k = new WeakMap(), K = new WeakMap(), g = new WeakMap(), X = new WeakMap(), C = new WeakMap(), m = new WeakMap(), Y = new WeakMap(), z = new WeakMap(), w = new WeakMap(), L = new WeakMap(), B = new WeakMap(), q = new WeakMap(), h = new WeakSet(), et = function(e, s = !1) {
|
|
389
392
|
return H(this, null, function* () {
|
|
390
|
-
let i =
|
|
391
|
-
return (!i || s) && (i = yield d(this,
|
|
393
|
+
let i = t(this, B).get(e);
|
|
394
|
+
return (!i || s) && (i = yield d(this, h, st).call(this, e)), i;
|
|
392
395
|
});
|
|
393
|
-
}, st = function(
|
|
396
|
+
}, st = function(e) {
|
|
394
397
|
return H(this, null, function* () {
|
|
395
|
-
const i = yield (yield fetch(
|
|
396
|
-
return
|
|
398
|
+
const i = yield (yield fetch(e)).text(), u = t(this, X).parseFromString(i, "text/html"), f = new wt(this, e, u);
|
|
399
|
+
return t(this, B).set(e, f), f;
|
|
397
400
|
});
|
|
398
|
-
}, it = function(
|
|
399
|
-
const s = [...
|
|
400
|
-
return s.length ? s : [
|
|
401
|
-
}, At = function(
|
|
402
|
-
return
|
|
401
|
+
}, it = function(e) {
|
|
402
|
+
const s = [...e.querySelectorAll("[data-morph]")];
|
|
403
|
+
return s.length ? s : [e];
|
|
404
|
+
}, At = function(e, s) {
|
|
405
|
+
return e.filter(
|
|
403
406
|
(i) => s.find(
|
|
404
407
|
(u) => u.outerHTML === i.outerHTML
|
|
405
408
|
)
|
|
406
409
|
);
|
|
407
|
-
}, rt = function(
|
|
408
|
-
return
|
|
410
|
+
}, rt = function(e, s) {
|
|
411
|
+
return e.filter(
|
|
409
412
|
(i) => !s.find(
|
|
410
413
|
(u) => u.outerHTML === i.outerHTML
|
|
411
414
|
)
|
|
412
415
|
);
|
|
413
|
-
}, nt = function(
|
|
414
|
-
return
|
|
415
|
-
}, ot = function(
|
|
416
|
+
}, nt = function(e) {
|
|
417
|
+
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
418
|
+
}, ot = function(e) {
|
|
416
419
|
var s, i;
|
|
417
|
-
(s =
|
|
420
|
+
(s = t(this, L)) == null || s.removeEventListener(
|
|
418
421
|
"scroll",
|
|
419
|
-
|
|
420
|
-
), a(this, L,
|
|
421
|
-
}, at = function(
|
|
422
|
-
const i = typeof
|
|
422
|
+
t(this, O)
|
|
423
|
+
), a(this, L, e.querySelector(t(this, k).scrollSelector) || e.documentElement), (i = t(this, L)) == null || i.addEventListener("scroll", t(this, O)), t(this, O).call(this);
|
|
424
|
+
}, at = function(e, s) {
|
|
425
|
+
const i = typeof e == "string" ? document.getElementById(e) : e;
|
|
423
426
|
(typeof i == "number" || i) && Dt(i, {
|
|
424
|
-
scrollElement:
|
|
427
|
+
scrollElement: t(this, L),
|
|
425
428
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
426
429
|
center: s == null ? void 0 : s.centerScroll,
|
|
427
430
|
offset: s == null ? void 0 : s.offsetScroll
|
package/lib/scroll/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var Le = (p, n, e) => n.has(p) || Be("Cannot " + e);
|
|
|
16
16
|
var t = (p, n, e) => (Le(p, n, "read from private field"), e ? e.call(p) : n.get(p)), s = (p, n, e) => n.has(p) ? Be("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(p) : n.set(p, e), h = (p, n, e, i) => (Le(p, n, "write to private field"), i ? i.call(p, e) : n.set(p, e), e), c = (p, n, e) => (Le(p, n, "access private method"), e);
|
|
17
17
|
import { S as Qe } from "../Store-swP_0ymB.js";
|
|
18
18
|
import { i as H } from "../index-euf5anj6.js";
|
|
19
|
-
import {
|
|
19
|
+
import { a as Xe } from "../easings-Bni3YAAW.js";
|
|
20
20
|
import { d as re } from "../events-CsVF98U6.js";
|
|
21
21
|
import { d as ze } from "../function-C10DGppn.js";
|
|
22
22
|
import { c as Ne } from "../jss-DtnXPEnq.js";
|
|
@@ -26,7 +26,7 @@ import { p as Ye, l as ts } from "../number-DwCxt_Ck.js";
|
|
|
26
26
|
import "../ticker/index.js";
|
|
27
27
|
import { TICK_ORDER as es, RESIZE_ORDER as Ae } from "../order/index.js";
|
|
28
28
|
import { D as ss } from "../Damped-GyAS-U-z.js";
|
|
29
|
-
import { T as is } from "../Tweened-
|
|
29
|
+
import { T as is } from "../Tweened-BSC-evuL.js";
|
|
30
30
|
import { WheelControls as rs, KeyboardControls as ns, DragControls as hs, AutoplayControls as os } from "../controls/index.js";
|
|
31
31
|
import { windowResizer as Ht } from "../window-resizer/index.js";
|
|
32
32
|
import { scrollEntries as vt } from "../scroll-entries/index.js";
|
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"),w=require("../events-KVanG9sR.cjs"),C=require("../file-DSpfWdd9.cjs"),I=require("../function-MthRj-GJ.cjs"),Q=require("../gestures-C7gbKx11.cjs"),O=require("../jss-CRBgdvJ3.cjs"),m=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),f=require("../number-0243DApo.cjs"),
|
|
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"),w=require("../events-KVanG9sR.cjs"),C=require("../file-DSpfWdd9.cjs"),I=require("../function-MthRj-GJ.cjs"),Q=require("../gestures-C7gbKx11.cjs"),O=require("../jss-CRBgdvJ3.cjs"),m=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),f=require("../number-0243DApo.cjs"),c=require("../object-CCiXnER2.cjs"),T=require("../polyfills-Df4r-ETT.cjs"),x=require("../scroll-DAhSpkhR.cjs"),l=require("../string-DUXXtU8v.cjs"),S=require("../style-At6aDoqG.cjs"),u=require("../url-D1CgmwZ_.cjs");function A(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function B(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 D(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 z(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function N(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)}const F=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,V=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function $(t){let e,n;return V.test(t)?(e=`mailto:${t.trim()}`,n="email"):F.test(t)&&(e=`tel:${t.replace(/[^0-9\\.\\+]+/g,"")}`,n="phone"),{href:e,type:n}}function H(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function U(t,e,n,o){let s,a=!1,b=0;const v=()=>{clearInterval(s),o!=null&&o.restartCounter&&(b=0),a&&(s=setInterval(()=>{n(b++)},e))},P=y.intersector.subscribe(t,q=>{a=q.isIntersecting,v()});return()=>{P(),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=w.dispatchEvent;exports.createJSONAndSave=C.createJSONAndSave;exports.downloadURI=C.downloadURI;exports.debounce=I.debounce;exports.throttle=I.throttle;exports.setupDrag=Q.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=c.cloneDeep;exports.compareObjects=c.compareObjects;exports.isESClass=c.isESClass;exports.isNullish=c.isNullish;exports.isObject=c.isObject;exports.mergeDeep=c.mergeDeep;exports.mixin=c.mixin;exports.omit=c.omit;exports.pick=c.pick;exports.nullishCoalescing=T.nullishCoalescing;exports.requestIdleCallback=T.requestIdleCallback;exports.scrollToElement=x.scrollToElement;exports.wait=x.wait;exports.camelToKebab=l.camelToKebab;exports.capitalize=l.capitalize;exports.declension=l.declension;exports.decodeHtmlEntities=l.decodeHtmlEntities;exports.generateId=l.generateId;exports.isUppercase=l.isUppercase;exports.kebabToCamel=l.kebabToCamel;exports.snakeToDotted=l.snakeToDotted;exports.toPascalCase=l.toPascalCase;exports.uncapitalize=l.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=H;exports.copyTextToClipboard=R;exports.decode=k;exports.dotCircleCollision=N;exports.dotRectCollision=z;exports.encode=j;exports.formatBytes=D;exports.getRootVariables=M;exports.insert=A;exports.setIntervalOnIntersection=U;exports.shiftArray=B;exports.tryCreateHrefFromContact=$;
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as B, p as A } from "../attributes-69we3byR.js";
|
|
2
2
|
import { a as f } from "../index-euf5anj6.js";
|
|
3
|
-
import { i as
|
|
4
|
-
import { a as
|
|
5
|
-
import { g as
|
|
6
|
-
import { b as
|
|
7
|
-
import {
|
|
8
|
-
import { d as
|
|
9
|
-
import { c as
|
|
10
|
-
import { d as
|
|
11
|
-
import { s as
|
|
12
|
-
import { c as
|
|
13
|
-
import { g as
|
|
14
|
-
import { e as
|
|
15
|
-
import { l as
|
|
16
|
-
import { c as
|
|
17
|
-
import { n as
|
|
18
|
-
import { s as
|
|
19
|
-
import { c as
|
|
20
|
-
import { g as
|
|
21
|
-
import { c as
|
|
22
|
-
function
|
|
23
|
-
return [...t.slice(0, e), ...
|
|
3
|
+
import { i as Q } from "../index-euf5anj6.js";
|
|
4
|
+
import { a as z, c as M, f as $, m as F } from "../canvas-DeZ0SLUJ.js";
|
|
5
|
+
import { g as V, n as j, s as k } from "../coordinates-CgdGoSYs.js";
|
|
6
|
+
import { b as q, f as H, a as Z, g as K } from "../dom-CVWzyXPH.js";
|
|
7
|
+
import { f as G, p as J, h as L, a as Y, d as X, k as _, o as ee, b as te, i as se, m as ae, g as oe, q as re, c as ne, j as ie, n as ce, l as le } from "../easings-Bni3YAAW.js";
|
|
8
|
+
import { d as fe } from "../events-CsVF98U6.js";
|
|
9
|
+
import { c as pe, d as me } from "../file-GHShUlue.js";
|
|
10
|
+
import { d as ge, t as he } from "../function-C10DGppn.js";
|
|
11
|
+
import { s as ye } from "../gestures-CcXV6fCp.js";
|
|
12
|
+
import { c as Ie, s as ve } from "../jss-DtnXPEnq.js";
|
|
13
|
+
import { g as Ee, a as Se, b as Te, c as Oe } from "../layout-DpZo-I0y.js";
|
|
14
|
+
import { e as Be, f as Ae, c as Re, d as Qe, l as De, m as ze, r as Me, b as $e, a as Fe, s as Ne } from "../math-BOBiC4TN.js";
|
|
15
|
+
import { l as je, p as ke, r as Ue, t as qe } from "../number-DwCxt_Ck.js";
|
|
16
|
+
import { c as Ze, d as Ke, i as We, b as Ge, a as Je, m as Le, e as Ye, o as Xe, p as _e } from "../object-D6MVWB4l.js";
|
|
17
|
+
import { n as tt, r as st } from "../polyfills-DJrTJQky.js";
|
|
18
|
+
import { s as ot, w as rt } from "../scroll-Benkuq-t.js";
|
|
19
|
+
import { c as it, a as ct, b as lt, d as ut, g as ft, i as dt, k as pt, s as mt, t as xt, u as gt } from "../string-BlMQbe8b.js";
|
|
20
|
+
import { g as bt, a as yt } from "../style-j2TwriJ_.js";
|
|
21
|
+
import { c as It, n as vt, p as wt, s as Et, u as St } from "../url-B6BNcw6_.js";
|
|
22
|
+
function x(t, e, ...s) {
|
|
23
|
+
return [...t.slice(0, e), ...s, ...t.slice(e)];
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
e = e %
|
|
28
|
-
const
|
|
29
|
-
for (let o = 0; o <
|
|
30
|
-
const r = (o + e) %
|
|
31
|
-
|
|
25
|
+
function g(t, e) {
|
|
26
|
+
const s = t.length;
|
|
27
|
+
e = e % s;
|
|
28
|
+
const a = new Array(s);
|
|
29
|
+
for (let o = 0; o < s; o++) {
|
|
30
|
+
const r = (o + e) % s;
|
|
31
|
+
a[r] = t[o];
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return a;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function h(t, e = 2) {
|
|
36
36
|
if (!+t) return "0 Bytes";
|
|
37
|
-
const
|
|
37
|
+
const s = 1024, a = e < 0 ? 0 : e, o = [
|
|
38
38
|
"Bytes",
|
|
39
39
|
"KiB",
|
|
40
40
|
"MiB",
|
|
@@ -44,10 +44,10 @@ function x(t, e = 2) {
|
|
|
44
44
|
"EiB",
|
|
45
45
|
"ZiB",
|
|
46
46
|
"YiB"
|
|
47
|
-
], r = Math.floor(Math.log(t) / Math.log(
|
|
48
|
-
return `${parseFloat((t / Math.pow(
|
|
47
|
+
], r = Math.floor(Math.log(t) / Math.log(s));
|
|
48
|
+
return `${parseFloat((t / Math.pow(s, r)).toFixed(a))} ${o[r]}`;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function b(t) {
|
|
51
51
|
if (navigator.clipboard)
|
|
52
52
|
navigator.clipboard.writeText(t).then(() => {
|
|
53
53
|
console.log("Text copied to clipboard successfully!");
|
|
@@ -59,58 +59,63 @@ function g(t) {
|
|
|
59
59
|
e.value = t, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", document.body.appendChild(e), e.select();
|
|
60
60
|
try {
|
|
61
61
|
document.execCommand("copy") ? console.log("Text copied to clipboard successfully!") : console.error("Failed to copy text to clipboard.");
|
|
62
|
-
} catch (
|
|
63
|
-
console.error("Failed to copy text to clipboard:",
|
|
62
|
+
} catch (s) {
|
|
63
|
+
console.error("Failed to copy text to clipboard:", s);
|
|
64
64
|
}
|
|
65
65
|
document.body.removeChild(e);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function y(t, e) {
|
|
69
69
|
return t.x < e.x + e.width && t.x > e.x && t.y < e.y + e.height && t.y > e.y;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function C(t, e) {
|
|
72
72
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2) < e.radius;
|
|
73
73
|
}
|
|
74
74
|
function i(t, e) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
return
|
|
75
|
+
const s = t.style.getPropertyValue(e);
|
|
76
|
+
if (s) {
|
|
77
|
+
const a = s.toString();
|
|
78
|
+
return a.startsWith("var") ? i(t, a.slice(4, -1)) : a;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function I(...t) {
|
|
82
82
|
const e = {};
|
|
83
|
-
return Array.from(document.styleSheets).forEach((
|
|
84
|
-
Array.from(
|
|
85
|
-
|
|
86
|
-
const r = i(
|
|
83
|
+
return Array.from(document.styleSheets).forEach((s) => {
|
|
84
|
+
Array.from(s.cssRules).forEach((a) => {
|
|
85
|
+
a instanceof CSSStyleRule && a.selectorText === ":root" && t.forEach((o) => {
|
|
86
|
+
const r = i(a, o);
|
|
87
87
|
r && (e[o] = r);
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
-
}), t.forEach((
|
|
91
|
-
e[
|
|
90
|
+
}), t.forEach((s) => {
|
|
91
|
+
e[s] || console.warn(`variable named ${s} not found`);
|
|
92
92
|
}), e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function v(t) {
|
|
95
95
|
const e = window.atob(t);
|
|
96
96
|
return decodeURIComponent(window.escape(e));
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function w(t) {
|
|
99
99
|
const e = window.unescape(encodeURIComponent(t));
|
|
100
100
|
return window.btoa(e);
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
const d = /^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/, p = /^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;
|
|
103
|
+
function E(t) {
|
|
104
|
+
let e, s;
|
|
105
|
+
return p.test(t) ? (e = `mailto:${t.trim()}`, s = "email") : d.test(t) && (e = `tel:${t.replace(/[^0-9\\.\\+]+/g, "")}`, s = "phone"), { href: e, type: s };
|
|
106
|
+
}
|
|
107
|
+
function S(t, e) {
|
|
103
108
|
if (t) {
|
|
104
|
-
const
|
|
105
|
-
return
|
|
109
|
+
const a = t.content.cloneNode(!0).firstElementChild;
|
|
110
|
+
return a && (e == null || e(a)), a;
|
|
106
111
|
}
|
|
107
112
|
return null;
|
|
108
113
|
}
|
|
109
|
-
function
|
|
114
|
+
function T(t, e, s, a) {
|
|
110
115
|
let o, r = !1, n = 0;
|
|
111
116
|
const c = () => {
|
|
112
|
-
clearInterval(o),
|
|
113
|
-
|
|
117
|
+
clearInterval(o), a != null && a.restartCounter && (n = 0), r && (o = setInterval(() => {
|
|
118
|
+
s(n++);
|
|
114
119
|
}, e));
|
|
115
120
|
}, l = f.subscribe(t, (u) => {
|
|
116
121
|
r = u.isIntersecting, c();
|
|
@@ -120,101 +125,102 @@ function E(t, e, a, s) {
|
|
|
120
125
|
};
|
|
121
126
|
}
|
|
122
127
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
128
|
+
Be as calculateDistance,
|
|
129
|
+
Ae as calculateDistanceWithRadius,
|
|
130
|
+
it as camelToKebab,
|
|
131
|
+
ct as capitalize,
|
|
132
|
+
It as changeHistory,
|
|
133
|
+
Re as clamp,
|
|
134
|
+
Ze as cloneDeep,
|
|
135
|
+
S as cloneTemplateContent,
|
|
136
|
+
Ke as compareObjects,
|
|
137
|
+
z as contain,
|
|
138
|
+
b as copyTextToClipboard,
|
|
139
|
+
M as cover,
|
|
140
|
+
pe as createJSONAndSave,
|
|
141
|
+
Ie as createStylesheet,
|
|
142
|
+
Qe as damp,
|
|
143
|
+
ge as debounce,
|
|
144
|
+
lt as declension,
|
|
145
|
+
w as decode,
|
|
146
|
+
ut as decodeHtmlEntities,
|
|
147
|
+
fe as dispatchEvent,
|
|
148
|
+
C as dotCircleCollision,
|
|
149
|
+
y as dotRectCollision,
|
|
150
|
+
me as downloadURI,
|
|
151
|
+
G as easeInCubic,
|
|
152
|
+
J as easeInExpo,
|
|
153
|
+
L as easeInOutCubic,
|
|
154
|
+
Y as easeInOutExpo,
|
|
155
|
+
X as easeInOutQuad,
|
|
156
|
+
_ as easeInOutQuart,
|
|
157
|
+
ee as easeInOutQuint,
|
|
158
|
+
te as easeInQuad,
|
|
159
|
+
se as easeInQuart,
|
|
160
|
+
ae as easeInQuint,
|
|
161
|
+
oe as easeOutCubic,
|
|
162
|
+
re as easeOutExpo,
|
|
163
|
+
ne as easeOutQuad,
|
|
164
|
+
ie as easeOutQuart,
|
|
165
|
+
ce as easeOutQuint,
|
|
166
|
+
v as encode,
|
|
167
|
+
q as findParentElement,
|
|
168
|
+
H as findScrollParentElement,
|
|
169
|
+
$ as fixPosition,
|
|
170
|
+
h as formatBytes,
|
|
171
|
+
ft as generateId,
|
|
172
|
+
Z as getAllParentElements,
|
|
173
|
+
Ee as getCumulativeOffsetLeft,
|
|
174
|
+
Se as getCumulativeOffsetTop,
|
|
175
|
+
Te as getCumulativePosition,
|
|
176
|
+
K as getElement,
|
|
177
|
+
bt as getElementTransitionDurationMS,
|
|
178
|
+
yt as getElementTransitionDurationS,
|
|
179
|
+
V as getPointerPosition,
|
|
180
|
+
I as getRootVariables,
|
|
181
|
+
Oe as getStickyOffset,
|
|
182
|
+
x as insert,
|
|
183
|
+
Q as isBrowser,
|
|
184
|
+
We as isESClass,
|
|
185
|
+
Ge as isNullish,
|
|
186
|
+
Je as isObject,
|
|
187
|
+
dt as isUppercase,
|
|
188
|
+
pt as kebabToCamel,
|
|
189
|
+
De as lerp,
|
|
190
|
+
le as linear,
|
|
191
|
+
je as loopNumber,
|
|
192
|
+
ze as mapRange,
|
|
193
|
+
F as measureText,
|
|
194
|
+
Le as mergeDeep,
|
|
195
|
+
Ye as mixin,
|
|
196
|
+
j as normalize,
|
|
197
|
+
vt as normalizeBase,
|
|
198
|
+
tt as nullishCoalescing,
|
|
199
|
+
Xe as omit,
|
|
200
|
+
B as parseAttribute,
|
|
201
|
+
A as parseAttributeValue,
|
|
202
|
+
wt as parseSearchParameters,
|
|
203
|
+
_e as pick,
|
|
204
|
+
ke as preciseNumber,
|
|
205
|
+
st as requestIdleCallback,
|
|
206
|
+
Me as round,
|
|
207
|
+
Ue as roundNumberTo,
|
|
208
|
+
k as screenToCartesian,
|
|
209
|
+
ot as scrollToElement,
|
|
210
|
+
T as setIntervalOnIntersection,
|
|
211
|
+
ye as setupDrag,
|
|
212
|
+
g as shiftArray,
|
|
213
|
+
$e as smootherstep,
|
|
214
|
+
Fe as smoothstep,
|
|
215
|
+
mt as snakeToDotted,
|
|
216
|
+
Et as splitPath,
|
|
212
217
|
Ne as step,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
ve as styleToString,
|
|
219
|
+
he as throttle,
|
|
220
|
+
xt as toPascalCase,
|
|
221
|
+
qe as toStep,
|
|
222
|
+
E as tryCreateHrefFromContact,
|
|
223
|
+
gt as uncapitalize,
|
|
224
|
+
St as updateSearchParameter,
|
|
225
|
+
rt as wait
|
|
220
226
|
};
|