aptechka 0.78.4 → 0.78.6
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/index.cjs +1 -1
- package/lib/morph/index.js +28 -28
- 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/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +165 -155
- package/lib/{url-CBKXmNOi.js → url-Ddgqz4Q_.js} +15 -15
- package/lib/url-VIZgwj_h.cjs +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -1
- package/lib/url-Dns-01WU.cjs +0 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var fe=Object.defineProperty,ge=Object.defineProperties;var Ee=Object.getOwnPropertyDescriptors;var Zt=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var _t=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ee=h=>{throw TypeError(h)};var te=(h,e,s)=>e in h?fe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))be.call(e,s)&&te(h,s,e[s]);if(Zt)for(var s of Zt(e))ve.call(e,s)&&te(h,s,e[s]);return h},qt=(h,e)=>ge(h,Ee(e));var Dt=(h,e,s)=>e.has(h)||ee("Cannot "+s);var t=(h,e,s)=>(Dt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(Dt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),E=(h,e,s)=>(Dt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var se=(h,e,s)=>(e=h[_t("asyncIterator")])?e.call(h):(h=h[_t("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ie=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const mt=require("../url-Dns-01WU.cjs"),re=require("../string-DUXXtU8v.cjs"),Le=require("../math-GDWEqu7y.cjs"),Se=require("../css-value-parser/index.cjs");class oe extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}ne.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",oe);var R,i,x,at,xt,he,ft,nt;class zt{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,ft,e=>{e.preventDefault(),E(this,x,he).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,ft)),this.checkCurrent(location.href.replace(location.origin,""));const a=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=re.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],y=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===y||!u.has($)&&(y===""||y==="*"||y==="all"||y==="any"||y==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=E(this,x,xt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Le.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,ft)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},xt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},he=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?Se.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,Pt]=t(this,x,at).split("?"),j=new URLSearchParams(Pt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[S]of j)(!V.has(S)||V.has(S)&&V.get(S)!==j.get(S))&&it.append(S,j.get(S));if(t(this,i).hasAttribute("data-merge-params"))for(const[S]of V)j.has(S)||it.append(S,V.get(S));$=`${c}?${it.toString()}`}const y=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));y&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),y.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage-1,y.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage+1,y.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage+1,y.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},ft=new WeakMap,nt=new WeakMap;const ye=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,gt;class ae{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,gt);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}setHeaders(e){o(this,gt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,a){return G(this,null,function*(){var n;if(!a){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,gt))})).text(),d=ye.parseFromString(u,"text/html");this.setInitialDocument(d)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,gt=new WeakMap;var T,ot,Et,It,bt;class Ae{constructor(e){l(this,Et);l(this,T);l(this,ot,[]);l(this,bt,()=>{E(this,Et,It).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=re.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ot).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,bt)),E(this,Et,It).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,bt))}}T=new WeakMap,ot=new WeakMap,Et=new WeakSet,It=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ot).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ot).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},bt=new WeakMap;var q,ht,P,K,g,_,X,Y,U,vt,W,Lt,tt,lt,ct,St,dt,yt,p,Vt,At,Ht,Ot,le,Ft,Bt,Kt,Xt,Tt,ut;const pt=class pt{constructor(e){l(this,p);l(this,q,null);l(this,ht,null);l(this,P,[]);l(this,K);l(this,g,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,U,null);l(this,vt,!1);l(this,W,new Map);l(this,Lt,[]);l(this,tt,null);l(this,lt,0);l(this,ct,0);l(this,St);l(this,dt);l(this,yt);l(this,At,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,dt)?void 0:t(this,St),revalidate:t(this,dt),keepScrollPosition:t(this,yt)}),o(this,Y,!1)}));l(this,ut,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,ct),n=e-t(this,lt);o(this,ct,s),o(this,lt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ne.isBrowser&&!pt.instance){pt.instance=this,o(this,q,{base:mt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,ht,E(this,p,Ot).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,g,s);const a=new ae(this,t(this,g).pathname);a.setInitialDocument(document),t(this,W).set(t(this,g).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,g).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),mt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new oe),E(this,p,Kt).call(this,document)}}get currentURL(){return t(this,g)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,U)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,U).scrollTop,s=t(this,U).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,W).get(t(this,g).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,g).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return mt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=E(this,p,Ht).call(this,e);a==null||a.fetch(e,t(this,g).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var Pt,j,V,it;if(t(this,X).length)return;o(this,St,d),o(this,dt,f),o(this,yt,w);const y=((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,e))||e,c=this.normalizePath(y,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,g).pathname===c.pathname)){w||E(this,p,Xt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,g))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,g)),o(this,g,c),mt.changeHistory({action:((it=t(this,g))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,g),previousURL:t(this,_)}})),t(this,P).forEach(S=>{S.checkCurrent(c.path)});return}else t(this,P).forEach(S=>{S.checkCurrent(c.path)});o(this,K,c);try{let S=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),S=!1}if(!S||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}const Yt={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,ht).forEach(r=>{var k,M;(k=r.firstElementChild)==null||k.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:Yt});const Mt=E(this,p,Ht).call(this,t(this,g).pathname),A=E(this,p,Ht).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(y,t(this,g).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const kt=qt(Rt({},Yt),{document:A.document});v||kt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:kt});const $t=Array.from(document.head.children),jt=Array.from(A.document.head.children),Gt=E(this,p,le).call(this,$t,jt),ce=E(this,p,Ft).call(this,$t,Gt),wt=E(this,p,Ft).call(this,jt,Gt).filter(r=>!this.excludeHeadChild(r));wt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(wt[k]=E(this,p,Vt).call(this,r))}),wt.forEach(r=>{document.head.appendChild(r)});const Ut=wt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,p,Bt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var M=se(Ut),ue,O,N;ue=!(O=yield M.next()).done;ue=!1){const Ct=O.value;Ct.onload=()=>{k++,k===Ut.length&&r()}}}catch(O){N=[O]}finally{try{ue&&(O=M.return)&&(yield O.call(M))}finally{if(N)throw N[0]}}}))),yield ie.wait(10);const Jt=[];v||ce.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,p,Bt).call(this,r)?Jt.push(r):r.remove())});const de=E(this,p,Ot).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&E(this,p,Kt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),mt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,g)),o(this,g,c);const Nt=[];t(this,ht).forEach((r,k)=>{const M=de[k],ue=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=M.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&Nt.push(m.parentElement)})):(O.push(...M.childNodes),N.push(...r.childNodes),Nt.push(r));const Ct=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const pe=C.getAttribute("data-morph-transfer");Ct.push({element:C,selector:pe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(Ct.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Qt=qt(Rt({},kt),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Qt});const me=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Qt}),m()},(parseFloat(ue)||0)*1e3+10)});t(this,X).push(me)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),E(this,p,Xt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Jt.forEach(r=>r.remove()),o(this,X,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(E(this,p,Vt).call(this,M))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:kt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(S){console.error(S)}o(this,K,void 0)})}addLink(e){t(this,P).push(new zt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,At));t(this,P).push(...s.map(a=>new zt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,At));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new zt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Lt).forEach(s=>s.destroy()),o(this,Lt,e.map(s=>new Ae(s)))}};q=new WeakMap,ht=new WeakMap,P=new WeakMap,K=new WeakMap,g=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,U=new WeakMap,vt=new WeakMap,W=new WeakMap,Lt=new WeakMap,tt=new WeakMap,lt=new WeakMap,ct=new WeakMap,St=new WeakMap,dt=new WeakMap,yt=new WeakMap,p=new WeakSet,Vt=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},At=new WeakMap,Ht=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ae(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ot=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},le=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Ft=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,U))==null||s.removeEventListener("scroll",t(this,ut)),o(this,ct,0),o(this,lt,0),o(this,U,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,vt,t(this,U)===window),(a=t(this,U))==null||a.addEventListener("scroll",t(this,ut)),t(this,ut).call(this)},Xt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ie.scrollToElement(a,{scrollElement:t(this,U),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ut=new WeakMap,pt.instance=null;let Wt=pt;exports.Morph=Wt;
|
|
1
|
+
"use strict";var fe=Object.defineProperty,ge=Object.defineProperties;var Ee=Object.getOwnPropertyDescriptors;var Zt=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var _t=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ee=h=>{throw TypeError(h)};var te=(h,e,s)=>e in h?fe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))be.call(e,s)&&te(h,s,e[s]);if(Zt)for(var s of Zt(e))ve.call(e,s)&&te(h,s,e[s]);return h},qt=(h,e)=>ge(h,Ee(e));var Dt=(h,e,s)=>e.has(h)||ee("Cannot "+s);var t=(h,e,s)=>(Dt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(Dt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),E=(h,e,s)=>(Dt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var se=(h,e,s)=>(e=h[_t("asyncIterator")])?e.call(h):(h=h[_t("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ie=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const mt=require("../url-VIZgwj_h.cjs"),re=require("../string-DUXXtU8v.cjs"),Le=require("../math-GDWEqu7y.cjs"),Se=require("../css-value-parser/index.cjs");class oe extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}ne.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",oe);var R,i,x,at,xt,he,ft,nt;class zt{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,ft,e=>{e.preventDefault(),E(this,x,he).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,ft)),this.checkCurrent(location.href.replace(location.origin,""));const a=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=re.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],S=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===S||!u.has($)&&(S===""||S==="*"||S==="all"||S==="any"||S==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=E(this,x,xt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Le.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,ft)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},xt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},he=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?Se.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,Pt]=t(this,x,at).split("?"),j=new URLSearchParams(Pt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[y]of j)(!V.has(y)||V.has(y)&&V.get(y)!==j.get(y))&&it.append(y,j.get(y));if(t(this,i).hasAttribute("data-merge-params"))for(const[y]of V)j.has(y)||it.append(y,V.get(y));$=`${c}?${it.toString()}`}const S=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));S&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),S.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage-1,S.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!S||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},ft=new WeakMap,nt=new WeakMap;const ye=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,gt;class ae{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,gt);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}setHeaders(e){o(this,gt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,a){return G(this,null,function*(){var n;if(!a){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,gt))})).text(),d=ye.parseFromString(u,"text/html");this.setInitialDocument(d)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,gt=new WeakMap;var T,ot,Et,It,bt;class Ae{constructor(e){l(this,Et);l(this,T);l(this,ot,[]);l(this,bt,()=>{E(this,Et,It).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=re.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ot).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,bt)),E(this,Et,It).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,bt))}}T=new WeakMap,ot=new WeakMap,Et=new WeakSet,It=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ot).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ot).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},bt=new WeakMap;var q,ht,P,K,g,_,X,Y,U,vt,W,Lt,tt,lt,ct,St,dt,yt,p,Vt,At,Ht,Ot,le,Ft,Bt,Kt,Xt,Tt,ut;const pt=class pt{constructor(e){l(this,p);l(this,q,null);l(this,ht,null);l(this,P,[]);l(this,K);l(this,g,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,U,null);l(this,vt,!1);l(this,W,new Map);l(this,Lt,[]);l(this,tt,null);l(this,lt,0);l(this,ct,0);l(this,St);l(this,dt);l(this,yt);l(this,At,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,dt)?void 0:t(this,St),revalidate:t(this,dt),keepScrollPosition:t(this,yt)}),o(this,Y,!1)}));l(this,ut,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,ct),n=e-t(this,lt);o(this,ct,s),o(this,lt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ne.isBrowser&&!pt.instance){pt.instance=this,o(this,q,{base:mt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,ht,E(this,p,Ot).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,g,s);const a=new ae(this,t(this,g).pathname);a.setInitialDocument(document),t(this,W).set(t(this,g).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,g).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),mt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new oe),E(this,p,Kt).call(this,document)}}get currentURL(){return t(this,g)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,U)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,U).scrollTop,s=t(this,U).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,W).get(t(this,g).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,g).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return mt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=E(this,p,Ht).call(this,e);a==null||a.fetch(e,t(this,g).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var Pt,j,V,it;if(t(this,X).length)return;o(this,St,d),o(this,dt,f),o(this,yt,w);const S=((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,e))||e,c=this.normalizePath(S,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,g).pathname===c.pathname)){w||E(this,p,Xt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,g))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,g)),o(this,g,c),mt.changeHistory({action:((it=t(this,g))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,g),previousURL:t(this,_)}})),t(this,P).forEach(y=>{y.checkCurrent(c.path)});return}else t(this,P).forEach(y=>{y.checkCurrent(c.path)});o(this,K,c);try{let y=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),y=!1}if(!y||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}const Yt={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,ht).forEach(r=>{var k,M;(k=r.firstElementChild)==null||k.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:Yt});const Mt=E(this,p,Ht).call(this,t(this,g).pathname),A=E(this,p,Ht).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(S,t(this,g).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const kt=qt(Rt({},Yt),{document:A.document});v||kt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:kt});const $t=Array.from(document.head.children),jt=Array.from(A.document.head.children),Gt=E(this,p,le).call(this,$t,jt),ce=E(this,p,Ft).call(this,$t,Gt),wt=E(this,p,Ft).call(this,jt,Gt).filter(r=>!this.excludeHeadChild(r));wt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(wt[k]=E(this,p,Vt).call(this,r))}),wt.forEach(r=>{document.head.appendChild(r)});const Ut=wt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,p,Bt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var M=se(Ut),ue,O,N;ue=!(O=yield M.next()).done;ue=!1){const Ct=O.value;Ct.onload=()=>{k++,k===Ut.length&&r()}}}catch(O){N=[O]}finally{try{ue&&(O=M.return)&&(yield O.call(M))}finally{if(N)throw N[0]}}}))),yield ie.wait(10);const Jt=[];v||ce.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,p,Bt).call(this,r)?Jt.push(r):r.remove())});const de=E(this,p,Ot).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&E(this,p,Kt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),mt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,g)),o(this,g,c);const Nt=[];t(this,ht).forEach((r,k)=>{const M=de[k],ue=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=M.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&Nt.push(m.parentElement)})):(O.push(...M.childNodes),N.push(...r.childNodes),Nt.push(r));const Ct=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const pe=C.getAttribute("data-morph-transfer");Ct.push({element:C,selector:pe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(Ct.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Qt=qt(Rt({},kt),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Qt});const me=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Qt}),m()},(parseFloat(ue)||0)*1e3+10)});t(this,X).push(me)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),E(this,p,Xt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Jt.forEach(r=>r.remove()),o(this,X,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(E(this,p,Vt).call(this,M))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:kt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(y){console.error(y)}o(this,K,void 0)})}addLink(e){t(this,P).push(new zt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,At));t(this,P).push(...s.map(a=>new zt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,At));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new zt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Lt).forEach(s=>s.destroy()),o(this,Lt,e.map(s=>new Ae(s)))}};q=new WeakMap,ht=new WeakMap,P=new WeakMap,K=new WeakMap,g=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,U=new WeakMap,vt=new WeakMap,W=new WeakMap,Lt=new WeakMap,tt=new WeakMap,lt=new WeakMap,ct=new WeakMap,St=new WeakMap,dt=new WeakMap,yt=new WeakMap,p=new WeakSet,Vt=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},At=new WeakMap,Ht=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ae(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ot=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},le=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Ft=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,U))==null||s.removeEventListener("scroll",t(this,ut)),o(this,ct,0),o(this,lt,0),o(this,U,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,vt,t(this,U)===window),(a=t(this,U))==null||a.addEventListener("scroll",t(this,ut)),t(this,ut).call(this)},Xt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ie.scrollToElement(a,{scrollElement:t(this,U),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ut=new WeakMap,pt.instance=null;let Wt=pt;exports.Morph=Wt;
|
package/lib/morph/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import { i as ae } from "../index-Bv9zgfdb.js";
|
|
|
36
36
|
import { d as z } from "../events-CsVF98U6.js";
|
|
37
37
|
import { w as ve, s as Le } from "../scroll-DNGJVxa2.js";
|
|
38
38
|
import "construct-style-sheets-polyfill";
|
|
39
|
-
import { n as Se, c as zt, s as ye } from "../url-
|
|
39
|
+
import { n as Se, c as zt, s as ye } from "../url-Ddgqz4Q_.js";
|
|
40
40
|
import { c as ne } from "../string-BlMQbe8b.js";
|
|
41
41
|
import { c as Ae } from "../math-BOBiC4TN.js";
|
|
42
42
|
import { cssValueParser as Pe } from "../css-value-parser/index.js";
|
|
@@ -93,8 +93,8 @@ class qt {
|
|
|
93
93
|
for (const w in t(this, i).dataset) {
|
|
94
94
|
const st = ne(w);
|
|
95
95
|
if (st.startsWith("match-param-")) {
|
|
96
|
-
const $ = st.split("match-param-")[1],
|
|
97
|
-
u.has($) && u.get($) ===
|
|
96
|
+
const $ = st.split("match-param-")[1], S = t(this, i).dataset[w], c = `param-${$}-matched`;
|
|
97
|
+
u.has($) && u.get($) === S || !u.has($) && (S === "" || S === "*" || S === "all" || S === "any" || S === "vse") ? t(this, i).classList.add(c) : t(this, i).classList.remove(c);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -178,33 +178,33 @@ R = new WeakMap(), i = new WeakMap(), x = new WeakSet(), at = function() {
|
|
|
178
178
|
let $ = t(this, x, at);
|
|
179
179
|
if (t(this, i).hasAttribute("data-toggle-params")) {
|
|
180
180
|
const [c, At] = t(this, x, at).split("?"), j = new URLSearchParams(At), V = new URLSearchParams(location.search), it = new URLSearchParams();
|
|
181
|
-
for (const [
|
|
182
|
-
(!V.has(
|
|
181
|
+
for (const [y] of j)
|
|
182
|
+
(!V.has(y) || V.has(y) && V.get(y) !== j.get(y)) && it.append(y, j.get(y));
|
|
183
183
|
if (t(this, i).hasAttribute("data-merge-params"))
|
|
184
|
-
for (const [
|
|
185
|
-
j.has(
|
|
184
|
+
for (const [y] of V)
|
|
185
|
+
j.has(y) || it.append(y, V.get(y));
|
|
186
186
|
$ = `${c}?${it.toString()}`;
|
|
187
187
|
}
|
|
188
|
-
const
|
|
189
|
-
|
|
188
|
+
const S = b(this, x, Rt).call(this, t(this, i).getAttribute("data-pagination-set-link") || t(this, i).getAttribute("data-pagination-more-link") || t(this, i).getAttribute("data-pagination-next-link") || t(this, i).getAttribute("data-pagination-prev-link"));
|
|
189
|
+
S && (t(this, i).hasAttribute("data-pagination-set-link") ? t(this, R).links.forEach((c) => {
|
|
190
190
|
c.updatePagination(
|
|
191
191
|
parseInt(t(this, i).getAttribute("data-value") || "1"),
|
|
192
|
-
|
|
192
|
+
S.selector
|
|
193
193
|
);
|
|
194
194
|
}) : t(this, i).hasAttribute("data-pagination-prev-link") ? t(this, R).links.forEach((c) => {
|
|
195
195
|
c.updatePagination(
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
S.currentPage - 1,
|
|
197
|
+
S.selector
|
|
198
198
|
);
|
|
199
199
|
}) : t(this, i).hasAttribute("data-pagination-next-link") ? t(this, R).links.forEach((c) => {
|
|
200
200
|
c.updatePagination(
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
S.currentPage + 1,
|
|
202
|
+
S.selector
|
|
203
203
|
);
|
|
204
204
|
}) : t(this, i).hasAttribute("data-pagination-more-link") && t(this, R).links.forEach((c) => {
|
|
205
205
|
c.updatePagination(
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
S.currentPage + 1,
|
|
207
|
+
S.selector
|
|
208
208
|
);
|
|
209
209
|
})), t(this, R).navigate($, {
|
|
210
210
|
historyAction: a,
|
|
@@ -217,7 +217,7 @@ R = new WeakMap(), i = new WeakMap(), x = new WeakSet(), at = function() {
|
|
|
217
217
|
keepScrollPosition: v,
|
|
218
218
|
scrollBehaviour: et,
|
|
219
219
|
submorphAppend: t(this, i).hasAttribute("data-pagination-more-link"),
|
|
220
|
-
mergeParams: t(this, i).hasAttribute("data-merge-params") && !t(this, i).hasAttribute("data-toggle-params")
|
|
220
|
+
mergeParams: !!S || t(this, i).hasAttribute("data-merge-params") && !t(this, i).hasAttribute("data-toggle-params")
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
}, pt = new WeakMap(), nt = new WeakMap();
|
|
@@ -526,7 +526,7 @@ const mt = class mt {
|
|
|
526
526
|
if (t(this, K).length)
|
|
527
527
|
return;
|
|
528
528
|
o(this, Lt, d), o(this, dt, f), o(this, St, w);
|
|
529
|
-
const
|
|
529
|
+
const S = ((At = this.pathnameModifier) == null ? void 0 : At.call(this, e)) || e, c = this.normalizePath(S, {
|
|
530
530
|
mergeParams: st
|
|
531
531
|
});
|
|
532
532
|
if (!f && (((j = t(this, X)) == null ? void 0 : j.pathname) === c.pathname || t(this, g).pathname === c.pathname)) {
|
|
@@ -546,17 +546,17 @@ const mt = class mt {
|
|
|
546
546
|
newURL: t(this, g),
|
|
547
547
|
previousURL: t(this, _)
|
|
548
548
|
}
|
|
549
|
-
})), t(this, P).forEach((
|
|
550
|
-
|
|
549
|
+
})), t(this, P).forEach((y) => {
|
|
550
|
+
y.checkCurrent(c.path);
|
|
551
551
|
});
|
|
552
552
|
return;
|
|
553
553
|
} else
|
|
554
|
-
t(this, P).forEach((
|
|
555
|
-
|
|
554
|
+
t(this, P).forEach((y) => {
|
|
555
|
+
y.checkCurrent(c.path);
|
|
556
556
|
});
|
|
557
557
|
o(this, X, c);
|
|
558
558
|
try {
|
|
559
|
-
let
|
|
559
|
+
let y = !0;
|
|
560
560
|
if (this.preprocessor)
|
|
561
561
|
try {
|
|
562
562
|
yield new Promise((r, k) => {
|
|
@@ -569,9 +569,9 @@ const mt = class mt {
|
|
|
569
569
|
});
|
|
570
570
|
});
|
|
571
571
|
} catch (r) {
|
|
572
|
-
r ? console.error(r) : console.log("Route change canceled"),
|
|
572
|
+
r ? console.error(r) : console.log("Route change canceled"), y = !1;
|
|
573
573
|
}
|
|
574
|
-
if (!
|
|
574
|
+
if (!y || t(this, X).pathname !== c.pathname) {
|
|
575
575
|
t(this, P).forEach((r) => {
|
|
576
576
|
r.checkCurrent(t(this, g).path);
|
|
577
577
|
});
|
|
@@ -594,7 +594,7 @@ const mt = class mt {
|
|
|
594
594
|
const Ut = b(this, p, xt).call(this, t(this, g).pathname), A = b(this, p, xt).call(this, c.pathname);
|
|
595
595
|
if (t(this, W).forEach((r) => {
|
|
596
596
|
r.pathname !== c.pathname && r.abort();
|
|
597
|
-
}), yield A == null ? void 0 : A.fetch(
|
|
597
|
+
}), yield A == null ? void 0 : A.fetch(S, t(this, g).path, f), t(this, X).pathname !== c.pathname) {
|
|
598
598
|
t(this, P).forEach((r) => {
|
|
599
599
|
r.checkCurrent(t(this, g).path);
|
|
600
600
|
});
|
|
@@ -749,8 +749,8 @@ const mt = class mt {
|
|
|
749
749
|
}), document.documentElement.style.removeProperty(
|
|
750
750
|
"--new-document-scroll-position"
|
|
751
751
|
), window.dispatchEvent(new Event("resize"));
|
|
752
|
-
} catch (
|
|
753
|
-
console.error(
|
|
752
|
+
} catch (y) {
|
|
753
|
+
console.error(y);
|
|
754
754
|
}
|
|
755
755
|
o(this, X, void 0);
|
|
756
756
|
});
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),oe=require("../index-DekP7OZe.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-Dns-01WU.cjs"),ae=require("../window-resizer/index.cjs"),Z=require("../Viewport-DB0qAZPJ.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.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,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(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")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
|
1
|
+
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),oe=require("../index-DekP7OZe.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-VIZgwj_h.cjs"),ae=require("../window-resizer/index.cjs"),Z=require("../Viewport-DB0qAZPJ.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.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,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(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")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
package/lib/popover/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { d as W } from "../events-CsVF98U6.js";
|
|
|
10
10
|
import { d as dt } from "../function-C10DGppn.js";
|
|
11
11
|
import { g as lt } from "../style-j2TwriJ_.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
|
-
import { u as ft, p as gt } from "../url-
|
|
13
|
+
import { u as ft, p as gt } from "../url-Ddgqz4Q_.js";
|
|
14
14
|
import { windowResizer as ct } from "../window-resizer/index.js";
|
|
15
15
|
import { v as Q } from "../Viewport-DA10iWAO.js";
|
|
16
16
|
var f, w, tt, et;
|
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-DekP7OZe.cjs"),ht=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");const 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-DekP7OZe.cjs"),ht=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");const F=require("../url-VIZgwj_h.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
|
@@ -25,7 +25,7 @@ import { Notifier as nt } from "../notifier/index.js";
|
|
|
25
25
|
import { i as _ } from "../index-Bv9zgfdb.js";
|
|
26
26
|
import { d as ht } from "../function-C10DGppn.js";
|
|
27
27
|
import "construct-style-sheets-polyfill";
|
|
28
|
-
import { n as rt, c as ot, s as ct } from "../url-
|
|
28
|
+
import { n as rt, c as ot, s as ct } from "../url-Ddgqz4Q_.js";
|
|
29
29
|
import { i as lt } from "../object-D6MVWB4l.js";
|
|
30
30
|
var y, U, A, p, d, L, k, v, E, R, M, tt;
|
|
31
31
|
class ut {
|
package/lib/scroll-kit/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ft=n=>{throw TypeError(n)};var ot=(n,c,e)=>c.has(n)||ft("Cannot "+e);var t=(n,c,e)=>(ot(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?ft("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(ot(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),d=(n,c,e)=>(ot(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("../index-DekP7OZe.cjs"),kt=require("../dom-JBOkFLTh.cjs"),zt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const j=require("../ticker/index.cjs"),lt=require("../scroll-entries/index.cjs");require("../Store-Cd1GlEmZ.cjs");const Ht=require("../Damped-z9Uaw2MJ.cjs"),g=require("../css-property/index.cjs"),qt=require("../element-linked-store/index.cjs"),bt=require("../element-resizer/index.cjs"),ht=require("../events-KVanG9sR.cjs"),gt=require("../layout-Ctc2p3uz.cjs"),Mt=require("../math-GDWEqu7y.cjs"),pt=require("../window-resizer/index.cjs");var o,f,W,x,a,O,E,at,yt,Et,B,nt,K,k,J;class St extends HTMLElement{constructor(){super(...arguments);s(this,E);s(this,o,null);s(this,f,null);s(this,W,0);s(this,x,0);s(this,a,!1);s(this,O);s(this,B,()=>{this.classList.add("active"),clearTimeout(t(this,O));const i=t(this,E,at)/t(this,x)*t(this,W);t(this,a)?t(this,f).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,f).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,O,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,nt,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,E,yt),b=t(this,E,Et);r(this,x,i-b);let v=e*e/(t(this,x)+e);v=Math.max(v,30),t(this,a)?(t(this,f).style.width=v+"px",t(this,f).style.height="100%"):(t(this,f).style.width="100%",t(this,f).style.height=v+"px"),r(this,W,e-v),i<=b?this.style.display="none":this.style.display="block"});s(this,K,e=>{document.documentElement.classList.add("grabbing");const i=t(this,E,at),b=t(this,a)?e.x:e.y;zt.setupDrag(v=>{const xt=t(this,x)/t(this,W),mt=(t(this,a)?v.x-b:v.y-b)*xt;t(this,a)?t(this,o).scroll({left:i+mt,behavior:"instant"}):t(this,o).scroll({top:i+mt,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});s(this,k,()=>{t(this,nt).call(this)});s(this,J,e=>{e.isIntersecting?(j.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):j.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=kt.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const b=this.querySelector("[data-thumb]");i&&b&&(r(this,o,i),r(this,f,b),t(this,o).addEventListener("scroll",t(this,B)),t(this,f).addEventListener("pointerdown",t(this,K)),ct.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,J)))}disconnectedCallback(){t(this,o).removeEventListener("scroll",t(this,B)),t(this,f).removeEventListener("pointerdown",t(this,K)),clearTimeout(t(this,O)),ct.intersector.unsubscribe(t(this,J)),j.ticker.unsubscribe(t(this,k))}}o=new WeakMap,f=new WeakMap,W=new WeakMap,x=new WeakMap,a=new WeakMap,O=new WeakMap,E=new WeakSet,at=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},yt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},Et=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},B=new WeakMap,nt=new WeakMap,K=new WeakMap,k=new WeakMap,J=new WeakMap;ct.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",St);const Vt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var D,_,l,N,Y,z,X,Q,Z,tt,et,st;class vt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,D,new g.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,_,new g.CSSProperty(this,"--smooth-scroll-damping",10));s(this,l,new Ht.Damped(0));s(this,N,0);s(this,Y,!1);s(this,Q,e=>{if(!d(this,z,X).call(this)){if(Math.sign(e.deltaY)<0&&t(this,l).target===0&&t(this,l).direction<0||Math.sign(e.deltaY)>0&&t(this,l).target===t(this,l).max&&t(this,l).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const b=i.getAttribute("data-prevent-smooth-scroll");if(b){if(matchMedia(b).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,Z,()=>{d(this,z,X).call(this)||this.stop()});s(this,tt,e=>{d(this,z,X).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,et,()=>{this.resize()});s(this,st,e=>{d(this,z,X).call(this)||Vt.has(e.code)&&this.stop()})}resize(){t(this,l).min=0,t(this,l).max=this.scrollHeight-this.offsetHeight}stop(){t(this,l).unlistenAnimationFrame(),r(this,Y,!0)}sync(){const e=this.scrollTop;(t(this,Y)||Math.abs(e-t(this,l).current)>100)&&(r(this,Y,!1),t(this,l).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,l).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,l).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,et)),this.addEventListener("keydown",t(this,st)),this.addEventListener("pointerdown",t(this,tt)),this.addEventListener("touchstart",t(this,Z)),this.addEventListener("wheel",t(this,Q),{passive:!1}),t(this,l).subscribe(e=>{const i=Math.round(e.current);lt.scrollEntries.update(this,"y",e.current),i!==t(this,N)&&this.scroll({top:i,behavior:"instant"}),r(this,N,i)}),t(this,_).observe(),t(this,D).observe(),t(this,_).subscribe(e=>{t(this,l).damping=e.current}),lt.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,l).close(),t(this,_).close(),t(this,D).close(),lt.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,et)),this.removeEventListener("keydown",t(this,st)),this.removeEventListener("pointerdown",t(this,tt)),this.removeEventListener("touchstart",t(this,Z)),this.removeEventListener("wheel",t(this,Q))}}D=new WeakMap,_=new WeakMap,l=new WeakMap,N=new WeakMap,Y=new WeakMap,z=new WeakSet,X=function(){return t(this,D).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},Q=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",vt);var S,H,F,w,q,M,$,L,G,y,V,u,it,m,p,T,A,P,I,h,Lt,dt,Pt,C,R,ut,Ct,rt,U;class wt extends HTMLElement{constructor(){super(...arguments);s(this,h);s(this,S,this);s(this,H,null);s(this,F,new g.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,w,new g.CSSProperty(this,"--scroll-region-disabled",!1));s(this,q,new g.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,M,new g.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,$,new g.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new g.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,G,new g.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,y,new g.CSSProperty(this,"--scroll-region-progress-var",""));s(this,V,new g.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,u,new qt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,it,0);s(this,m,0);s(this,p,0);s(this,T,0);s(this,A,0);s(this,P,0);s(this,I,!1);s(this,C,()=>{this.resize()});s(this,R,()=>{this.tick()});s(this,U,()=>{document.readyState==="complete"&&d(this,h,Pt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,p)}get distance(){return t(this,T)}get scrolled(){return t(this,A)}get progress(){return t(this,P)}get status(){return t(this,u)}get scrollValue(){return t(this,H)instanceof HTMLElement?t(this,H).scrollTop:t(this,H).scrollY}resize(){t(this,w).current||(r(this,it,gt.getCumulativeOffsetTop(this)),r(this,m,t(this,it)),typeof t(this,M).current=="number"?r(this,m,t(this,m)+Math.max(t(this,q).current,t(this,M).current)):r(this,m,t(this,m)+t(this,q).current),r(this,m,t(this,m)+t(this,$).current),r(this,m,t(this,m)-gt.getStickyOffset(this,"top")),r(this,p,t(this,m)),t(this,L).current?r(this,p,t(this,p)+t(this,L).current):r(this,p,t(this,p)+this.offsetHeight),r(this,p,t(this,p)+t(this,G).current),r(this,T,t(this,p)-t(this,m)),r(this,I,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,A,Mt.clamp(e-t(this,m),0,t(this,T))),r(this,P,t(this,A)/t(this,T)||0),t(this,y).current&&t(this,S).style.setProperty(d(this,h,rt).call(this,t(this,y).current),t(this,P).toFixed(6)),t(this,u).set("activated",e>=t(this,m)),t(this,I)&&t(this,u).isFalse("entered")&&e>=t(this,m)&&e<=t(this,p)?d(this,h,ut).call(this):t(this,I)&&!t(this,V).current&&t(this,u).isTrue("entered")&&(e<t(this,m)||e>t(this,p))&&d(this,h,Ct).call(this),t(this,V).current&&t(this,P)===1&&(t(this,u).current.entered||d(this,h,ut).call(this),this.destroy()),ht.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,A)}})}destroy(){document.removeEventListener("readystatechange",t(this,U)),this.disable(!1),t(this,F).close(),t(this,w).close(),t(this,q).close(),t(this,M).close(),t(this,$).close(),t(this,L).close(),t(this,G).close(),t(this,y).close(),t(this,V).close()}enable(){j.ticker.subscribe(t(this,R),{culling:this}),bt.elementResizer.subscribe(this,t(this,C)),pt.windowResizer.subscribe(t(this,C)),t(this,R).call(this),t(this,u).set("enabled",!0)}disable(e=!0){j.ticker.unsubscribe(t(this,R)),bt.elementResizer.unsubscribe(t(this,C)),pt.windowResizer.unsubscribe(t(this,C)),e&&t(this,u).reset(),d(this,h,dt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,H,document.querySelector(e)),document.readyState==="complete"?t(this,U).call(this):document.addEventListener("readystatechange",t(this,U))}disconnectedCallback(){this.destroy()}}S=new WeakMap,H=new WeakMap,F=new WeakMap,w=new WeakMap,q=new WeakMap,M=new WeakMap,$=new WeakMap,L=new WeakMap,G=new WeakMap,y=new WeakMap,V=new WeakMap,u=new WeakMap,it=new WeakMap,m=new WeakMap,p=new WeakMap,T=new WeakMap,A=new WeakMap,P=new WeakMap,I=new WeakMap,h=new WeakSet,Lt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},dt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},Pt=function(){t(this,F).subscribe(e=>{t(this,S)&&(t(this,u).removeElement(t(this,S)),t(this,S).style.removeProperty(d(this,h,rt).call(this,t(this,y).current))),r(this,S,e.current?document.querySelector(e.current)||this:this),t(this,u).addElement(t(this,S))}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,y).subscribe(e=>{e.current?t(this,R).call(this):e.previous&&t(this,S).style.removeProperty(d(this,h,rt).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,F).observe(),t(this,w).observe(),t(this,q).observe(),t(this,M).observe(),t(this,$).observe(),t(this,L).observe(),t(this,G).observe(),t(this,y).observe(),t(this,V).observe()},C=new WeakMap,R=new WeakMap,ut=function(){const e=this.scrollValue;t(this,u).set("entered",!0),e===0&&t(this,u).set("enteredOnLoad",!0),d(this,h,Lt).call(this),ht.dispatchEvent(this,"scrollRegionEnter")},Ct=function(){t(this,u).set("entered",!1),d(this,h,dt).call(this),ht.dispatchEvent(this,"scrollRegionExit")},rt=function(e){return`--${e}`},U=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",wt);exports.ScrollRegionElement=wt;exports.ScrollbarElement=St;exports.SmoothScrollElement=vt;
|
|
1
|
+
"use strict";var gt=n=>{throw TypeError(n)};var lt=(n,c,e)=>c.has(n)||gt("Cannot "+e);var t=(n,c,e)=>(lt(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?gt("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(lt(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),d=(n,c,e)=>(lt(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dt=require("../index-DekP7OZe.cjs"),Ht=require("../dom-JBOkFLTh.cjs"),qt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const K=require("../ticker/index.cjs"),ct=require("../scroll-entries/index.cjs");require("../Store-Cd1GlEmZ.cjs");const Mt=require("../Damped-z9Uaw2MJ.cjs"),f=require("../css-property/index.cjs"),Vt=require("../element-linked-store/index.cjs"),pt=require("../element-resizer/index.cjs"),at=require("../events-KVanG9sR.cjs"),St=require("../layout-Ctc2p3uz.cjs"),Tt=require("../math-GDWEqu7y.cjs"),yt=require("../window-resizer/index.cjs");var o,b,O,x,a,D,y,ut,vt,wt,J,ht,N,k,Q;class Et extends HTMLElement{constructor(){super(...arguments);s(this,y);s(this,o,null);s(this,b,null);s(this,O,0);s(this,x,0);s(this,a,!1);s(this,D);s(this,J,()=>{this.classList.add("active"),clearTimeout(t(this,D));const i=t(this,y,ut)/t(this,x)*t(this,O);t(this,a)?t(this,b).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,b).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,D,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,ht,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,y,vt),g=t(this,y,wt);r(this,x,i-g);let E=e*e/(t(this,x)+e);E=Math.max(E,30),t(this,a)?(t(this,b).style.width=E+"px",t(this,b).style.height="100%"):(t(this,b).style.width="100%",t(this,b).style.height=E+"px"),r(this,O,e-E),i<=g?this.style.display="none":this.style.display="block"});s(this,N,e=>{document.documentElement.classList.add("grabbing");const i=t(this,y,ut),g=t(this,a)?e.x:e.y;qt.setupDrag(E=>{const zt=t(this,x)/t(this,O),bt=(t(this,a)?E.x-g:E.y-g)*zt;t(this,a)?t(this,o).scroll({left:i+bt,behavior:"instant"}):t(this,o).scroll({top:i+bt,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});s(this,k,()=>{t(this,ht).call(this)});s(this,Q,e=>{e.isIntersecting?(K.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):K.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=Ht.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const g=this.querySelector("[data-thumb]");i&&g&&(r(this,o,i),r(this,b,g),t(this,o).addEventListener("scroll",t(this,J)),t(this,b).addEventListener("pointerdown",t(this,N)),dt.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,Q)))}disconnectedCallback(){t(this,o).removeEventListener("scroll",t(this,J)),t(this,b).removeEventListener("pointerdown",t(this,N)),clearTimeout(t(this,D)),dt.intersector.unsubscribe(t(this,Q)),K.ticker.unsubscribe(t(this,k))}}o=new WeakMap,b=new WeakMap,O=new WeakMap,x=new WeakMap,a=new WeakMap,D=new WeakMap,y=new WeakSet,ut=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},vt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},wt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},J=new WeakMap,ht=new WeakMap,N=new WeakMap,k=new WeakMap,Q=new WeakMap;dt.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",Et);const At=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _,Y,h,Z,F,z,B,tt,et,st,it,rt;class Lt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,_,new f.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,Y,new f.CSSProperty(this,"--smooth-scroll-damping",10));s(this,h,new Mt.Damped(0));s(this,Z,0);s(this,F,!1);s(this,tt,e=>{if(!d(this,z,B).call(this)){if(Math.sign(e.deltaY)<0&&t(this,h).target===0&&t(this,h).direction<0||Math.sign(e.deltaY)>0&&t(this,h).target===t(this,h).max&&t(this,h).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const g=i.getAttribute("data-prevent-smooth-scroll");if(g){if(matchMedia(g).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,et,()=>{d(this,z,B).call(this)||this.stop()});s(this,st,e=>{d(this,z,B).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,it,()=>{this.resize()});s(this,rt,e=>{d(this,z,B).call(this)||At.has(e.code)&&this.stop()})}resize(){t(this,h).min=0,t(this,h).max=this.scrollHeight-this.offsetHeight}stop(){t(this,h).unlistenAnimationFrame(),r(this,F,!0)}sync(){const e=this.scrollTop;(t(this,F)||Math.abs(e-t(this,h).current)>100)&&(r(this,F,!1),t(this,h).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,h).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,h).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,it)),this.addEventListener("keydown",t(this,rt)),this.addEventListener("pointerdown",t(this,st)),this.addEventListener("touchstart",t(this,et)),this.addEventListener("wheel",t(this,tt),{passive:!1}),t(this,h).subscribe(e=>{const i=Math.round(e.current);ct.scrollEntries.update(this,"y",e.current),i!==t(this,Z)&&this.scroll({top:i,behavior:"instant"}),r(this,Z,i)}),t(this,Y).observe(),t(this,_).observe(),t(this,Y).subscribe(e=>{t(this,h).damping=e.current}),ct.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,h).close(),t(this,Y).close(),t(this,_).close(),ct.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,it)),this.removeEventListener("keydown",t(this,rt)),this.removeEventListener("pointerdown",t(this,st)),this.removeEventListener("touchstart",t(this,et)),this.removeEventListener("wheel",t(this,tt))}}_=new WeakMap,Y=new WeakMap,h=new WeakMap,Z=new WeakMap,F=new WeakMap,z=new WeakSet,B=function(){return t(this,_).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,rt=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",Lt);var H,v,q,$,G,w,M,V,I,L,U,S,T,u,nt,m,p,A,R,P,X,l,Ct,mt,xt,C,W,ft,kt,ot,j;class Pt extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,H,this);s(this,v,this);s(this,q,null);s(this,$,new f.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,G,new f.CSSProperty(this,"--scroll-region-progress-holder",!1));s(this,w,new f.CSSProperty(this,"--scroll-region-disabled",!1));s(this,M,new f.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,V,new f.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,I,new f.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new f.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,U,new f.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,S,new f.CSSProperty(this,"--scroll-region-progress-var",""));s(this,T,new f.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,u,new Vt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,nt,0);s(this,m,0);s(this,p,0);s(this,A,0);s(this,R,0);s(this,P,0);s(this,X,!1);s(this,C,()=>{this.resize()});s(this,W,()=>{this.tick()});s(this,j,()=>{document.readyState==="complete"&&d(this,l,xt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,p)}get distance(){return t(this,A)}get scrolled(){return t(this,R)}get progress(){return t(this,P)}get status(){return t(this,u)}get scrollValue(){return t(this,q)instanceof HTMLElement?t(this,q).scrollTop:t(this,q).scrollY}resize(){t(this,w).current||(r(this,nt,St.getCumulativeOffsetTop(this)),r(this,m,t(this,nt)),typeof t(this,V).current=="number"?r(this,m,t(this,m)+Math.max(t(this,M).current,t(this,V).current)):r(this,m,t(this,m)+t(this,M).current),r(this,m,t(this,m)+t(this,I).current),r(this,m,t(this,m)-St.getStickyOffset(this,"top")),r(this,p,t(this,m)),t(this,L).current?r(this,p,t(this,p)+t(this,L).current):r(this,p,t(this,p)+this.offsetHeight),r(this,p,t(this,p)+t(this,U).current),r(this,A,t(this,p)-t(this,m)),r(this,X,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,R,Tt.clamp(e-t(this,m),0,t(this,A))),r(this,P,t(this,R)/t(this,A)||0),t(this,S).current&&t(this,v).style.setProperty(d(this,l,ot).call(this,t(this,S).current),t(this,P).toFixed(6)),t(this,u).set("activated",e>=t(this,m)),t(this,X)&&t(this,u).isFalse("entered")&&e>=t(this,m)&&e<=t(this,p)?d(this,l,ft).call(this):t(this,X)&&!t(this,T).current&&t(this,u).isTrue("entered")&&(e<t(this,m)||e>t(this,p))&&d(this,l,kt).call(this),t(this,T).current&&t(this,P)===1&&(t(this,u).current.entered||d(this,l,ft).call(this),this.destroy()),at.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,R)}})}destroy(){document.removeEventListener("readystatechange",t(this,j)),this.disable(!1),t(this,$).close(),t(this,G).close(),t(this,w).close(),t(this,M).close(),t(this,V).close(),t(this,I).close(),t(this,L).close(),t(this,U).close(),t(this,S).close(),t(this,T).close()}enable(){K.ticker.subscribe(t(this,W),{culling:this}),pt.elementResizer.subscribe(this,t(this,C)),yt.windowResizer.subscribe(t(this,C)),t(this,W).call(this),t(this,u).set("enabled",!0)}disable(e=!0){K.ticker.unsubscribe(t(this,W)),pt.elementResizer.unsubscribe(t(this,C)),yt.windowResizer.unsubscribe(t(this,C)),e&&t(this,u).reset(),d(this,l,mt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,q,document.querySelector(e)),document.readyState==="complete"?t(this,j).call(this):document.addEventListener("readystatechange",t(this,j))}disconnectedCallback(){this.destroy()}}H=new WeakMap,v=new WeakMap,q=new WeakMap,$=new WeakMap,G=new WeakMap,w=new WeakMap,M=new WeakMap,V=new WeakMap,I=new WeakMap,L=new WeakMap,U=new WeakMap,S=new WeakMap,T=new WeakMap,u=new WeakMap,nt=new WeakMap,m=new WeakMap,p=new WeakMap,A=new WeakMap,R=new WeakMap,P=new WeakMap,X=new WeakMap,l=new WeakSet,Ct=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},mt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},xt=function(){t(this,$).subscribe(e=>{t(this,H)&&t(this,u).removeElement(t(this,H)),r(this,H,e.current?document.querySelector(e.current)||this:this),t(this,u).addElement(t(this,H))}),t(this,G).subscribe(e=>{t(this,v)&&t(this,v).style.removeProperty(d(this,l,ot).call(this,t(this,S).current)),r(this,v,e.current?document.querySelector(e.current)||this:this)}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,S).subscribe(e=>{e.current?t(this,W).call(this):e.previous&&t(this,v).style.removeProperty(d(this,l,ot).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,$).observe(),t(this,G).observe(),t(this,w).observe(),t(this,M).observe(),t(this,V).observe(),t(this,I).observe(),t(this,L).observe(),t(this,U).observe(),t(this,S).observe(),t(this,T).observe()},C=new WeakMap,W=new WeakMap,ft=function(){const e=this.scrollValue;t(this,u).set("entered",!0),e===0&&t(this,u).set("enteredOnLoad",!0),d(this,l,Ct).call(this),at.dispatchEvent(this,"scrollRegionEnter")},kt=function(){t(this,u).set("entered",!1),d(this,l,mt).call(this),at.dispatchEvent(this,"scrollRegionExit")},ot=function(e){return`--${e}`},j=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",Pt);exports.ScrollRegionElement=Pt;exports.ScrollbarElement=Et;exports.SmoothScrollElement=Lt;
|
package/lib/scroll-kit/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var
|
|
1
|
+
var bt = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (o, c, e) => (
|
|
6
|
-
import { i as
|
|
7
|
-
import { f as
|
|
8
|
-
import { s as
|
|
4
|
+
var lt = (o, c, e) => c.has(o) || bt("Cannot " + e);
|
|
5
|
+
var t = (o, c, e) => (lt(o, c, "read from private field"), e ? e.call(o) : c.get(o)), s = (o, c, e) => c.has(o) ? bt("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(o) : c.set(o, e), r = (o, c, e, i) => (lt(o, c, "write to private field"), i ? i.call(o, e) : c.set(o, e), e), d = (o, c, e) => (lt(o, c, "access private method"), e);
|
|
6
|
+
import { i as Pt, a as pt } from "../index-Bv9zgfdb.js";
|
|
7
|
+
import { f as Ht } from "../dom-CVWzyXPH.js";
|
|
8
|
+
import { s as xt } from "../gestures-CcXV6fCp.js";
|
|
9
9
|
import "construct-style-sheets-polyfill";
|
|
10
|
-
import { ticker as
|
|
11
|
-
import { scrollEntries as
|
|
10
|
+
import { ticker as J } from "../ticker/index.js";
|
|
11
|
+
import { scrollEntries as ct } from "../scroll-entries/index.js";
|
|
12
12
|
import "../Store-0BVty6AZ.js";
|
|
13
|
-
import { D as
|
|
14
|
-
import { CSSProperty as
|
|
15
|
-
import { ElementLinkedStore as
|
|
16
|
-
import { elementResizer as
|
|
17
|
-
import { d as
|
|
18
|
-
import { a as
|
|
19
|
-
import { c as
|
|
20
|
-
import { windowResizer as
|
|
21
|
-
var
|
|
22
|
-
class
|
|
13
|
+
import { D as kt } from "../Damped-CtQmJ52v.js";
|
|
14
|
+
import { CSSProperty as f } from "../css-property/index.js";
|
|
15
|
+
import { ElementLinkedStore as zt } from "../element-linked-store/index.js";
|
|
16
|
+
import { elementResizer as gt } from "../element-resizer/index.js";
|
|
17
|
+
import { d as at } from "../events-CsVF98U6.js";
|
|
18
|
+
import { a as Mt, b as Vt } from "../layout-BSMtwCga.js";
|
|
19
|
+
import { c as Tt } from "../math-BOBiC4TN.js";
|
|
20
|
+
import { windowResizer as Et } from "../window-resizer/index.js";
|
|
21
|
+
var h, b, R, H, a, q, v, dt, vt, yt, N, nt, Q, x, Z;
|
|
22
|
+
class At extends HTMLElement {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments);
|
|
25
|
-
s(this,
|
|
26
|
-
s(this,
|
|
27
|
-
s(this,
|
|
28
|
-
s(this,
|
|
29
|
-
s(this,
|
|
25
|
+
s(this, v);
|
|
26
|
+
s(this, h, null);
|
|
27
|
+
s(this, b, null);
|
|
28
|
+
s(this, R, 0);
|
|
29
|
+
s(this, H, 0);
|
|
30
30
|
s(this, a, !1);
|
|
31
|
-
s(this,
|
|
32
|
-
s(this,
|
|
33
|
-
this.classList.add("active"), clearTimeout(t(this,
|
|
34
|
-
const i = t(this,
|
|
35
|
-
t(this, a) ? t(this,
|
|
31
|
+
s(this, q);
|
|
32
|
+
s(this, N, () => {
|
|
33
|
+
this.classList.add("active"), clearTimeout(t(this, q));
|
|
34
|
+
const i = t(this, v, dt) / t(this, H) * t(this, R);
|
|
35
|
+
t(this, a) ? t(this, b).style.transform = `translate3d(${i}px, 0px, 0px)` : t(this, b).style.transform = `translate3d(0px, ${i}px, 0px)`, r(this, q, setTimeout(() => {
|
|
36
36
|
this.classList.remove("active");
|
|
37
37
|
}, 1e3));
|
|
38
38
|
});
|
|
39
|
-
s(this,
|
|
40
|
-
const e = t(this, a) ? this.offsetWidth : this.offsetHeight, i = t(this,
|
|
41
|
-
r(this,
|
|
42
|
-
let
|
|
43
|
-
|
|
39
|
+
s(this, nt, () => {
|
|
40
|
+
const e = t(this, a) ? this.offsetWidth : this.offsetHeight, i = t(this, v, vt), p = t(this, v, yt);
|
|
41
|
+
r(this, H, i - p);
|
|
42
|
+
let y = e * e / (t(this, H) + e);
|
|
43
|
+
y = Math.max(y, 30), t(this, a) ? (t(this, b).style.width = y + "px", t(this, b).style.height = "100%") : (t(this, b).style.width = "100%", t(this, b).style.height = y + "px"), r(this, R, e - y), i <= p ? this.style.display = "none" : this.style.display = "block";
|
|
44
44
|
});
|
|
45
|
-
s(this,
|
|
45
|
+
s(this, Q, (e) => {
|
|
46
46
|
document.documentElement.classList.add("grabbing");
|
|
47
|
-
const i = t(this,
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
const
|
|
51
|
-
t(this, a) ? t(this,
|
|
52
|
-
left: i +
|
|
47
|
+
const i = t(this, v, dt), p = t(this, a) ? e.x : e.y;
|
|
48
|
+
xt(
|
|
49
|
+
(y) => {
|
|
50
|
+
const Ct = t(this, H) / t(this, R), ft = (t(this, a) ? y.x - p : y.y - p) * Ct;
|
|
51
|
+
t(this, a) ? t(this, h).scroll({
|
|
52
|
+
left: i + ft,
|
|
53
53
|
behavior: "instant"
|
|
54
|
-
}) : t(this,
|
|
55
|
-
top: i +
|
|
54
|
+
}) : t(this, h).scroll({
|
|
55
|
+
top: i + ft,
|
|
56
56
|
behavior: "instant"
|
|
57
57
|
});
|
|
58
58
|
},
|
|
@@ -61,31 +61,31 @@ class Vt extends HTMLElement {
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
|
-
s(this,
|
|
65
|
-
t(this,
|
|
64
|
+
s(this, x, () => {
|
|
65
|
+
t(this, nt).call(this);
|
|
66
66
|
});
|
|
67
|
-
s(this,
|
|
68
|
-
e.isIntersecting ? (
|
|
67
|
+
s(this, Z, (e) => {
|
|
68
|
+
e.isIntersecting ? (J.subscribe(t(this, x), { maxFPS: 5 }), t(this, x).call(this)) : J.unsubscribe(t(this, x));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
connectedCallback() {
|
|
72
72
|
const e = this.getAttribute("data-scroll");
|
|
73
73
|
let i = null;
|
|
74
|
-
e && (e === "parent" ? i = this.parentElement : i = document.querySelector(e)), i || (i =
|
|
75
|
-
const
|
|
76
|
-
i &&
|
|
74
|
+
e && (e === "parent" ? i = this.parentElement : i = document.querySelector(e)), i || (i = Ht(this), i === document.body && (i = window)), r(this, a, this.hasAttribute("horisontal"));
|
|
75
|
+
const p = this.querySelector("[data-thumb]");
|
|
76
|
+
i && p && (r(this, h, i), r(this, b, p), t(this, h).addEventListener("scroll", t(this, N)), t(this, b).addEventListener("pointerdown", t(this, Q)), pt.subscribe(
|
|
77
77
|
this.parentElement === document.body ? this : this.parentElement,
|
|
78
|
-
t(this,
|
|
78
|
+
t(this, Z)
|
|
79
79
|
));
|
|
80
80
|
}
|
|
81
81
|
disconnectedCallback() {
|
|
82
|
-
t(this,
|
|
82
|
+
t(this, h).removeEventListener("scroll", t(this, N)), t(this, b).removeEventListener("pointerdown", t(this, Q)), clearTimeout(t(this, q)), pt.unsubscribe(t(this, Z)), J.unsubscribe(t(this, x));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
return t(this,
|
|
87
|
-
},
|
|
88
|
-
return t(this,
|
|
85
|
+
h = new WeakMap(), b = new WeakMap(), R = new WeakMap(), H = new WeakMap(), a = new WeakMap(), q = new WeakMap(), v = new WeakSet(), dt = function() {
|
|
86
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).scrollLeft : t(this, h).scrollTop : t(this, a) ? t(this, h).scrollX : t(this, h).scrollY;
|
|
87
|
+
}, vt = function() {
|
|
88
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).scrollWidth : t(this, h).scrollHeight : t(this, a) ? Math.max(
|
|
89
89
|
document.body.scrollWidth,
|
|
90
90
|
document.documentElement.scrollWidth,
|
|
91
91
|
document.body.offsetWidth,
|
|
@@ -100,11 +100,11 @@ n = new WeakMap(), f = new WeakMap(), O = new WeakMap(), x = new WeakMap(), a =
|
|
|
100
100
|
document.body.clientHeight,
|
|
101
101
|
document.documentElement.clientHeight
|
|
102
102
|
);
|
|
103
|
-
},
|
|
104
|
-
return t(this,
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
const
|
|
103
|
+
}, yt = function() {
|
|
104
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).offsetWidth : t(this, h).offsetHeight : t(this, a) ? innerWidth : innerHeight;
|
|
105
|
+
}, N = new WeakMap(), nt = new WeakMap(), Q = new WeakMap(), x = new WeakMap(), Z = new WeakMap();
|
|
106
|
+
Pt && !customElements.get("e-scrollbar") && customElements.define("e-scrollbar", At);
|
|
107
|
+
const Wt = /* @__PURE__ */ new Set([
|
|
108
108
|
"ArrowUp",
|
|
109
109
|
"ArrowDown",
|
|
110
110
|
"ArrowLeft",
|
|
@@ -115,26 +115,26 @@ const Tt = /* @__PURE__ */ new Set([
|
|
|
115
115
|
"End",
|
|
116
116
|
"Space"
|
|
117
117
|
]);
|
|
118
|
-
var Y,
|
|
119
|
-
class
|
|
118
|
+
var Y, F, n, _, $, k, j, tt, et, st, it, rt;
|
|
119
|
+
class Dt extends HTMLElement {
|
|
120
120
|
constructor() {
|
|
121
121
|
super(...arguments);
|
|
122
122
|
s(this, k);
|
|
123
|
-
s(this, Y, new
|
|
124
|
-
s(this,
|
|
125
|
-
s(this,
|
|
126
|
-
s(this,
|
|
127
|
-
s(this,
|
|
128
|
-
s(this,
|
|
129
|
-
if (!d(this, k,
|
|
130
|
-
if (Math.sign(e.deltaY) < 0 && t(this,
|
|
123
|
+
s(this, Y, new f(this, "--smooth-scroll-disabled", !1));
|
|
124
|
+
s(this, F, new f(this, "--smooth-scroll-damping", 10));
|
|
125
|
+
s(this, n, new kt(0));
|
|
126
|
+
s(this, _, 0);
|
|
127
|
+
s(this, $, !1);
|
|
128
|
+
s(this, tt, (e) => {
|
|
129
|
+
if (!d(this, k, j).call(this)) {
|
|
130
|
+
if (Math.sign(e.deltaY) < 0 && t(this, n).target === 0 && t(this, n).direction < 0 || Math.sign(e.deltaY) > 0 && t(this, n).target === t(this, n).max && t(this, n).direction > 0 || e.stopPropagation(), e.target instanceof Element) {
|
|
131
131
|
const i = e.target.closest("[data-prevent-smooth-scroll]");
|
|
132
132
|
if (i) {
|
|
133
|
-
const
|
|
133
|
+
const p = i.getAttribute(
|
|
134
134
|
"data-prevent-smooth-scroll"
|
|
135
135
|
);
|
|
136
|
-
if (
|
|
137
|
-
if (matchMedia(
|
|
136
|
+
if (p) {
|
|
137
|
+
if (matchMedia(p).matches)
|
|
138
138
|
return;
|
|
139
139
|
} else return;
|
|
140
140
|
}
|
|
@@ -142,74 +142,80 @@ class At extends HTMLElement {
|
|
|
142
142
|
Math.abs(e.deltaX) > Math.abs(e.deltaY) || (e.preventDefault(), this.shiftPosition(e.deltaY));
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
s(this,
|
|
146
|
-
d(this, k,
|
|
145
|
+
s(this, et, () => {
|
|
146
|
+
d(this, k, j).call(this) || this.stop();
|
|
147
147
|
});
|
|
148
|
-
s(this,
|
|
149
|
-
d(this, k,
|
|
148
|
+
s(this, st, (e) => {
|
|
149
|
+
d(this, k, j).call(this) || e.target instanceof Element && e.target.closest("a") && this.stop();
|
|
150
150
|
});
|
|
151
|
-
s(this,
|
|
151
|
+
s(this, it, () => {
|
|
152
152
|
this.resize();
|
|
153
153
|
});
|
|
154
|
-
s(this,
|
|
155
|
-
d(this, k,
|
|
154
|
+
s(this, rt, (e) => {
|
|
155
|
+
d(this, k, j).call(this) || Wt.has(e.code) && this.stop();
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
resize() {
|
|
159
|
-
t(this,
|
|
159
|
+
t(this, n).min = 0, t(this, n).max = this.scrollHeight - this.offsetHeight;
|
|
160
160
|
}
|
|
161
161
|
stop() {
|
|
162
|
-
t(this,
|
|
162
|
+
t(this, n).unlistenAnimationFrame(), r(this, $, !0);
|
|
163
163
|
}
|
|
164
164
|
sync() {
|
|
165
165
|
const e = this.scrollTop;
|
|
166
|
-
(t(this,
|
|
166
|
+
(t(this, $) || Math.abs(e - t(this, n).current) > 100) && (r(this, $, !1), t(this, n).set(e, { equalize: !0 }));
|
|
167
167
|
}
|
|
168
168
|
shiftPosition(e) {
|
|
169
|
-
this.resize(), this.sync(), t(this,
|
|
169
|
+
this.resize(), this.sync(), t(this, n).shift(e);
|
|
170
170
|
}
|
|
171
171
|
setPosition(e, i) {
|
|
172
|
-
this.resize(), this.sync(), t(this,
|
|
172
|
+
this.resize(), this.sync(), t(this, n).set(e, i);
|
|
173
173
|
}
|
|
174
174
|
connectedCallback() {
|
|
175
|
-
window.addEventListener("resize", t(this,
|
|
175
|
+
window.addEventListener("resize", t(this, it)), this.addEventListener("keydown", t(this, rt)), this.addEventListener("pointerdown", t(this, st)), this.addEventListener("touchstart", t(this, et)), this.addEventListener("wheel", t(this, tt), {
|
|
176
176
|
passive: !1
|
|
177
|
-
}), t(this,
|
|
177
|
+
}), t(this, n).subscribe((e) => {
|
|
178
178
|
const i = Math.round(e.current);
|
|
179
|
-
|
|
179
|
+
ct.update(this, "y", e.current), i !== t(this, _) && this.scroll({
|
|
180
180
|
top: i,
|
|
181
181
|
behavior: "instant"
|
|
182
|
-
}), r(this,
|
|
183
|
-
}), t(this,
|
|
184
|
-
t(this,
|
|
185
|
-
}),
|
|
182
|
+
}), r(this, _, i);
|
|
183
|
+
}), t(this, F).observe(), t(this, Y).observe(), t(this, F).subscribe((e) => {
|
|
184
|
+
t(this, n).damping = e.current;
|
|
185
|
+
}), ct.register(this), this.resize();
|
|
186
186
|
}
|
|
187
187
|
disconnectedCallback() {
|
|
188
|
-
t(this,
|
|
188
|
+
t(this, n).close(), t(this, F).close(), t(this, Y).close(), ct.unregister(this), window.removeEventListener("resize", t(this, it)), this.removeEventListener("keydown", t(this, rt)), this.removeEventListener("pointerdown", t(this, st)), this.removeEventListener("touchstart", t(this, et)), this.removeEventListener("wheel", t(this, tt));
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
Y = new WeakMap(),
|
|
191
|
+
Y = new WeakMap(), F = new WeakMap(), n = new WeakMap(), _ = new WeakMap(), $ = new WeakMap(), k = new WeakSet(), j = function() {
|
|
192
192
|
return t(this, Y).current || getComputedStyle(this).getPropertyValue("overflow") === "hidden";
|
|
193
|
-
},
|
|
194
|
-
customElements.get("e-smooth-scroll") || customElements.define("e-smooth-scroll",
|
|
195
|
-
var
|
|
196
|
-
class
|
|
193
|
+
}, tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), it = new WeakMap(), rt = new WeakMap();
|
|
194
|
+
customElements.get("e-smooth-scroll") || customElements.define("e-smooth-scroll", Dt);
|
|
195
|
+
var z, S, M, G, I, w, V, T, U, L, X, E, A, u, ot, m, g, W, D, C, B, l, St, ut, wt, P, O, mt, Lt, ht, K;
|
|
196
|
+
class Ot extends HTMLElement {
|
|
197
197
|
constructor() {
|
|
198
198
|
super(...arguments);
|
|
199
199
|
s(this, l);
|
|
200
|
-
s(this,
|
|
201
|
-
s(this,
|
|
202
|
-
s(this,
|
|
200
|
+
s(this, z, this);
|
|
201
|
+
s(this, S, this);
|
|
202
|
+
s(this, M, null);
|
|
203
|
+
s(this, G, new f(
|
|
203
204
|
this,
|
|
204
205
|
"--scroll-region-status-holder",
|
|
205
206
|
!1
|
|
206
207
|
));
|
|
207
|
-
s(this,
|
|
208
|
+
s(this, I, new f(
|
|
209
|
+
this,
|
|
210
|
+
"--scroll-region-progress-holder",
|
|
211
|
+
!1
|
|
212
|
+
));
|
|
213
|
+
s(this, w, new f(
|
|
208
214
|
this,
|
|
209
215
|
"--scroll-region-disabled",
|
|
210
216
|
!1
|
|
211
217
|
));
|
|
212
|
-
s(this,
|
|
218
|
+
s(this, V, new f(
|
|
213
219
|
this,
|
|
214
220
|
"--scroll-region-start-offset",
|
|
215
221
|
0,
|
|
@@ -217,7 +223,7 @@ class Wt extends HTMLElement {
|
|
|
217
223
|
rawValueCheck: !1
|
|
218
224
|
}
|
|
219
225
|
));
|
|
220
|
-
s(this,
|
|
226
|
+
s(this, T, new f(
|
|
221
227
|
this,
|
|
222
228
|
"--scroll-region-start-offset-min",
|
|
223
229
|
!1,
|
|
@@ -225,7 +231,7 @@ class Wt extends HTMLElement {
|
|
|
225
231
|
rawValueCheck: !1
|
|
226
232
|
}
|
|
227
233
|
));
|
|
228
|
-
s(this,
|
|
234
|
+
s(this, U, new f(
|
|
229
235
|
this,
|
|
230
236
|
"--scroll-region-start-extra-offset",
|
|
231
237
|
0,
|
|
@@ -233,7 +239,7 @@ class Wt extends HTMLElement {
|
|
|
233
239
|
rawValueCheck: !1
|
|
234
240
|
}
|
|
235
241
|
));
|
|
236
|
-
s(this, L, new
|
|
242
|
+
s(this, L, new f(
|
|
237
243
|
this,
|
|
238
244
|
"--scroll-region-distance",
|
|
239
245
|
0,
|
|
@@ -241,7 +247,7 @@ class Wt extends HTMLElement {
|
|
|
241
247
|
rawValueCheck: !1
|
|
242
248
|
}
|
|
243
249
|
));
|
|
244
|
-
s(this,
|
|
250
|
+
s(this, X, new f(
|
|
245
251
|
this,
|
|
246
252
|
"--scroll-region-distance-offset",
|
|
247
253
|
0,
|
|
@@ -249,37 +255,37 @@ class Wt extends HTMLElement {
|
|
|
249
255
|
rawValueCheck: !1
|
|
250
256
|
}
|
|
251
257
|
));
|
|
252
|
-
s(this,
|
|
258
|
+
s(this, E, new f(
|
|
253
259
|
this,
|
|
254
260
|
"--scroll-region-progress-var",
|
|
255
261
|
""
|
|
256
262
|
));
|
|
257
|
-
s(this,
|
|
263
|
+
s(this, A, new f(
|
|
258
264
|
this,
|
|
259
265
|
"--scroll-region-enter-once",
|
|
260
266
|
!1
|
|
261
267
|
));
|
|
262
|
-
s(this, u, new
|
|
268
|
+
s(this, u, new zt(this, {
|
|
263
269
|
enabled: !1,
|
|
264
270
|
entered: !1,
|
|
265
271
|
enteredOnLoad: !1,
|
|
266
272
|
activated: !1
|
|
267
273
|
}));
|
|
268
|
-
s(this,
|
|
274
|
+
s(this, ot, 0);
|
|
269
275
|
s(this, m, 0);
|
|
270
276
|
s(this, g, 0);
|
|
271
|
-
s(this, A, 0);
|
|
272
277
|
s(this, W, 0);
|
|
278
|
+
s(this, D, 0);
|
|
273
279
|
s(this, C, 0);
|
|
274
|
-
s(this,
|
|
280
|
+
s(this, B, !1);
|
|
275
281
|
s(this, P, () => {
|
|
276
282
|
this.resize();
|
|
277
283
|
});
|
|
278
|
-
s(this,
|
|
284
|
+
s(this, O, () => {
|
|
279
285
|
this.tick();
|
|
280
286
|
});
|
|
281
|
-
s(this,
|
|
282
|
-
document.readyState === "complete" && d(this, l,
|
|
287
|
+
s(this, K, () => {
|
|
288
|
+
document.readyState === "complete" && d(this, l, wt).call(this);
|
|
283
289
|
});
|
|
284
290
|
}
|
|
285
291
|
get start() {
|
|
@@ -289,10 +295,10 @@ class Wt extends HTMLElement {
|
|
|
289
295
|
return t(this, g);
|
|
290
296
|
}
|
|
291
297
|
get distance() {
|
|
292
|
-
return t(this,
|
|
298
|
+
return t(this, W);
|
|
293
299
|
}
|
|
294
300
|
get scrolled() {
|
|
295
|
-
return t(this,
|
|
301
|
+
return t(this, D);
|
|
296
302
|
}
|
|
297
303
|
get progress() {
|
|
298
304
|
return t(this, C);
|
|
@@ -301,82 +307,86 @@ class Wt extends HTMLElement {
|
|
|
301
307
|
return t(this, u);
|
|
302
308
|
}
|
|
303
309
|
get scrollValue() {
|
|
304
|
-
return t(this,
|
|
310
|
+
return t(this, M) instanceof HTMLElement ? t(this, M).scrollTop : t(this, M).scrollY;
|
|
305
311
|
}
|
|
306
312
|
resize() {
|
|
307
|
-
t(this,
|
|
308
|
-
t(this,
|
|
309
|
-
t(this,
|
|
310
|
-
)) : r(this, m, t(this, m) + t(this,
|
|
313
|
+
t(this, w).current || (r(this, ot, Mt(this)), r(this, m, t(this, ot)), typeof t(this, T).current == "number" ? r(this, m, t(this, m) + Math.max(
|
|
314
|
+
t(this, V).current,
|
|
315
|
+
t(this, T).current
|
|
316
|
+
)) : r(this, m, t(this, m) + t(this, V).current), r(this, m, t(this, m) + t(this, U).current), r(this, m, t(this, m) - Vt(this, "top")), r(this, g, t(this, m)), t(this, L).current ? r(this, g, t(this, g) + t(this, L).current) : r(this, g, t(this, g) + this.offsetHeight), r(this, g, t(this, g) + t(this, X).current), r(this, W, t(this, g) - t(this, m)), r(this, B, this.offsetWidth !== 0 && this.offsetHeight !== 0), this.tick());
|
|
311
317
|
}
|
|
312
318
|
tick() {
|
|
313
|
-
if (t(this,
|
|
319
|
+
if (t(this, w).current)
|
|
314
320
|
return;
|
|
315
321
|
const e = this.scrollValue;
|
|
316
|
-
r(this,
|
|
317
|
-
d(this, l,
|
|
322
|
+
r(this, D, Tt(e - t(this, m), 0, t(this, W))), r(this, C, t(this, D) / t(this, W) || 0), t(this, E).current && t(this, S).style.setProperty(
|
|
323
|
+
d(this, l, ht).call(this, t(this, E).current),
|
|
318
324
|
t(this, C).toFixed(6)
|
|
319
|
-
), t(this, u).set("activated", e >= t(this, m)), t(this,
|
|
325
|
+
), t(this, u).set("activated", e >= t(this, m)), t(this, B) && t(this, u).isFalse("entered") && e >= t(this, m) && e <= t(this, g) ? d(this, l, mt).call(this) : t(this, B) && !t(this, A).current && t(this, u).isTrue("entered") && (e < t(this, m) || e > t(this, g)) && d(this, l, Lt).call(this), t(this, A).current && t(this, C) === 1 && (t(this, u).current.entered || d(this, l, mt).call(this), this.destroy()), at(this, "scrollRegionProgress", {
|
|
320
326
|
detail: {
|
|
321
327
|
progress: t(this, C),
|
|
322
|
-
scrolled: t(this,
|
|
328
|
+
scrolled: t(this, D)
|
|
323
329
|
}
|
|
324
330
|
});
|
|
325
331
|
}
|
|
326
332
|
destroy() {
|
|
327
333
|
document.removeEventListener(
|
|
328
334
|
"readystatechange",
|
|
329
|
-
t(this,
|
|
330
|
-
), this.disable(!1), t(this,
|
|
335
|
+
t(this, K)
|
|
336
|
+
), this.disable(!1), t(this, G).close(), t(this, I).close(), t(this, w).close(), t(this, V).close(), t(this, T).close(), t(this, U).close(), t(this, L).close(), t(this, X).close(), t(this, E).close(), t(this, A).close();
|
|
331
337
|
}
|
|
332
338
|
enable() {
|
|
333
|
-
|
|
339
|
+
J.subscribe(t(this, O), { culling: this }), gt.subscribe(this, t(this, P)), Et.subscribe(t(this, P)), t(this, O).call(this), t(this, u).set("enabled", !0);
|
|
334
340
|
}
|
|
335
341
|
disable(e = !0) {
|
|
336
|
-
|
|
342
|
+
J.unsubscribe(t(this, O)), gt.unsubscribe(t(this, P)), Et.unsubscribe(t(this, P)), e && t(this, u).reset(), d(this, l, ut).call(this);
|
|
337
343
|
}
|
|
338
344
|
connectedCallback() {
|
|
339
345
|
const e = this.getAttribute("data-scroll") || ".page-scroll";
|
|
340
|
-
r(this,
|
|
346
|
+
r(this, M, document.querySelector(e)), document.readyState === "complete" ? t(this, K).call(this) : document.addEventListener(
|
|
341
347
|
"readystatechange",
|
|
342
|
-
t(this,
|
|
348
|
+
t(this, K)
|
|
343
349
|
);
|
|
344
350
|
}
|
|
345
351
|
disconnectedCallback() {
|
|
346
352
|
this.destroy();
|
|
347
353
|
}
|
|
348
354
|
}
|
|
349
|
-
|
|
355
|
+
z = new WeakMap(), S = new WeakMap(), M = new WeakMap(), G = new WeakMap(), I = new WeakMap(), w = new WeakMap(), V = new WeakMap(), T = new WeakMap(), U = new WeakMap(), L = new WeakMap(), X = new WeakMap(), E = new WeakMap(), A = new WeakMap(), u = new WeakMap(), ot = new WeakMap(), m = new WeakMap(), g = new WeakMap(), W = new WeakMap(), D = new WeakMap(), C = new WeakMap(), B = new WeakMap(), l = new WeakSet(), St = function() {
|
|
350
356
|
this.hasAttribute("data-global-class") && document.documentElement.classList.add(
|
|
351
357
|
this.getAttribute("data-global-class")
|
|
352
358
|
);
|
|
353
|
-
},
|
|
359
|
+
}, ut = function() {
|
|
354
360
|
this.hasAttribute("data-global-class") && document.documentElement.classList.remove(
|
|
355
361
|
this.getAttribute("data-global-class")
|
|
356
362
|
);
|
|
357
|
-
},
|
|
358
|
-
t(this,
|
|
359
|
-
t(this,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
+
}, wt = function() {
|
|
364
|
+
t(this, G).subscribe((e) => {
|
|
365
|
+
t(this, z) && t(this, u).removeElement(t(this, z)), r(this, z, e.current ? document.querySelector(e.current) || this : this), t(this, u).addElement(t(this, z));
|
|
366
|
+
}), t(this, I).subscribe((e) => {
|
|
367
|
+
t(this, S) && t(this, S).style.removeProperty(
|
|
368
|
+
d(this, l, ht).call(this, t(this, E).current)
|
|
369
|
+
), r(this, S, e.current ? document.querySelector(e.current) || this : this);
|
|
370
|
+
}), t(this, w).subscribe((e) => {
|
|
363
371
|
e.current && !e.previous ? this.disable() : this.enable();
|
|
364
|
-
}), t(this,
|
|
365
|
-
e.current ? t(this,
|
|
372
|
+
}), t(this, E).subscribe((e) => {
|
|
373
|
+
e.current ? t(this, O).call(this) : e.previous && t(this, S).style.removeProperty(
|
|
374
|
+
d(this, l, ht).call(this, e.previous)
|
|
375
|
+
);
|
|
366
376
|
}), t(this, L).subscribe(() => {
|
|
367
377
|
t(this, P).call(this);
|
|
368
|
-
}), t(this,
|
|
369
|
-
}, P = new WeakMap(),
|
|
378
|
+
}), t(this, G).observe(), t(this, I).observe(), t(this, w).observe(), t(this, V).observe(), t(this, T).observe(), t(this, U).observe(), t(this, L).observe(), t(this, X).observe(), t(this, E).observe(), t(this, A).observe();
|
|
379
|
+
}, P = new WeakMap(), O = new WeakMap(), mt = function() {
|
|
370
380
|
const e = this.scrollValue;
|
|
371
|
-
t(this, u).set("entered", !0), e === 0 && t(this, u).set("enteredOnLoad", !0), d(this, l,
|
|
372
|
-
},
|
|
373
|
-
t(this, u).set("entered", !1), d(this, l,
|
|
374
|
-
},
|
|
381
|
+
t(this, u).set("entered", !0), e === 0 && t(this, u).set("enteredOnLoad", !0), d(this, l, St).call(this), at(this, "scrollRegionEnter");
|
|
382
|
+
}, Lt = function() {
|
|
383
|
+
t(this, u).set("entered", !1), d(this, l, ut).call(this), at(this, "scrollRegionExit");
|
|
384
|
+
}, ht = function(e) {
|
|
375
385
|
return `--${e}`;
|
|
376
|
-
},
|
|
377
|
-
customElements.get("e-scroll-region") || customElements.define("e-scroll-region",
|
|
386
|
+
}, K = new WeakMap();
|
|
387
|
+
customElements.get("e-scroll-region") || customElements.define("e-scroll-region", Ot);
|
|
378
388
|
export {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
389
|
+
Ot as ScrollRegionElement,
|
|
390
|
+
At as ScrollbarElement,
|
|
391
|
+
Dt as SmoothScrollElement
|
|
382
392
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var $ = Object.defineProperty, d = Object.defineProperties;
|
|
2
2
|
var g = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var m = Object.getOwnPropertySymbols;
|
|
4
4
|
var w = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var P = (t, s, a) => s in t ? $(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a, p = (t, s) => {
|
|
6
6
|
for (var a in s || (s = {}))
|
|
7
|
-
w.call(s, a) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var a of
|
|
10
|
-
L.call(s, a) &&
|
|
7
|
+
w.call(s, a) && P(t, a, s[a]);
|
|
8
|
+
if (m)
|
|
9
|
+
for (var a of m(s))
|
|
10
|
+
L.call(s, a) && P(t, a, s[a]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
12
|
+
}, S = (t, s) => d(t, g(s));
|
|
13
13
|
function U(t, { base: s = "", trailingSlash: a = !1, mergeParams: e } = {}) {
|
|
14
14
|
s = s.endsWith("/") ? s.slice(0, -1) : s, t = t.replace(s, ""), t.startsWith("/") && (t = t.slice(1));
|
|
15
15
|
const n = t.split("#"), h = n[0].split("?");
|
|
@@ -17,18 +17,18 @@ function U(t, { base: s = "", trailingSlash: a = !1, mergeParams: e } = {}) {
|
|
|
17
17
|
a ? r = !r.endsWith("/") && r !== "/" ? r + "/" : r : r = r.endsWith("/") && r !== "/" ? r.slice(0, -1) : r;
|
|
18
18
|
let i = h[1] || "";
|
|
19
19
|
if (e) {
|
|
20
|
-
const
|
|
21
|
-
for (const [
|
|
22
|
-
|
|
23
|
-
i =
|
|
20
|
+
const o = new URLSearchParams(i), W = new URLSearchParams(e);
|
|
21
|
+
for (const [l, y] of W)
|
|
22
|
+
o.has(l) || o.set(l, y);
|
|
23
|
+
i = o.toString();
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const f = s + r, c = n[1], u = `${f}${i ? "?" + i : ""}${c ? "#" + c : ""}`;
|
|
26
26
|
return {
|
|
27
27
|
leaf: r,
|
|
28
|
-
pathname:
|
|
28
|
+
pathname: f,
|
|
29
29
|
parameters: i,
|
|
30
30
|
hash: c,
|
|
31
|
-
path:
|
|
31
|
+
path: u
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
function k(t = "/") {
|
|
@@ -37,7 +37,7 @@ function k(t = "/") {
|
|
|
37
37
|
function x(t) {
|
|
38
38
|
if (t.action === "none")
|
|
39
39
|
return;
|
|
40
|
-
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", e = s ? s.startsWith("?") ? s : "?" + s : "", n = `${t.pathname}${e}${a}`, h = p(
|
|
40
|
+
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", e = s ? s.startsWith("?") ? s : "?" + s : "", n = `${t.pathname}${e}${a}`, h = S(p({}, t.state), { path: n });
|
|
41
41
|
t.action === "push" ? history.pushState(h, "", n) : t.action === "replace" && history.replaceState(h, "", n);
|
|
42
42
|
}
|
|
43
43
|
function j(t) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty,$=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var P=(t,s,a)=>s in t?d(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,S=(t,s)=>{for(var a in s||(s={}))w.call(s,a)&&P(t,a,s[a]);if(m)for(var a of m(s))L.call(s,a)&&P(t,a,s[a]);return t},p=(t,s)=>$(t,g(s));function R(t,{base:s="",trailingSlash:a=!1,mergeParams:r}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const n=t.split("#"),h=n[0].split("?");let e=h[0].startsWith("/")?h[0]:"/"+h[0];a?e=!e.endsWith("/")&&e!=="/"?e+"/":e:e=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;let i=h[1]||"";if(r){const o=new URLSearchParams(i),W=new URLSearchParams(r);for(const[l,y]of W)o.has(l)||o.set(l,y);i=o.toString()}const f=s+e,c=n[1],u=`${f}${i?"?"+i:""}${c?"#"+c:""}`;return{leaf:e,pathname:f,parameters:i,hash:c,path:u}}function U(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function k(t){if(t.action==="none")return;const s=t==null?void 0:t.searchParameters,a=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",r=s?s.startsWith("?")?s:"?"+s:"",n=`${t.pathname}${r}${a}`,h=p(S({},t.state),{path:n});t.action==="push"?history.pushState(h,"",n):t.action==="replace"&&history.replaceState(h,"",n)}function z(t){const s=new URLSearchParams(t),a={};for(const[r,n]of s)a[r]=n;return a}function B(t,s){const a=new URL(location.href),r=(s==null?void 0:s.toString())||"";a.searchParams.set(t,r),history.replaceState(history.state,"",a.href)}exports.changeHistory=k;exports.normalizeBase=U;exports.parseSearchParameters=z;exports.splitPath=R;exports.updateSearchParameter=B;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),E=require("../index-DekP7OZe.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),D=require("../custom-elements-Dh4TWRDJ.cjs"),g=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),Q=require("../element-yhcBhsho.cjs"),A=require("../events-KVanG9sR.cjs"),O=require("../file-DSpfWdd9.cjs"),T=require("../function-MthRj-GJ.cjs"),B=require("../gestures-C7gbKx11.cjs"),S=require("../stylesheet-HWF2a3nr.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-ChAm68cm.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-CIdNtj3G.cjs"),l=require("../string-DUXXtU8v.cjs"),q=require("../style-At6aDoqG.cjs"),f=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),E=require("../index-DekP7OZe.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),D=require("../custom-elements-Dh4TWRDJ.cjs"),g=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),Q=require("../element-yhcBhsho.cjs"),A=require("../events-KVanG9sR.cjs"),O=require("../file-DSpfWdd9.cjs"),T=require("../function-MthRj-GJ.cjs"),B=require("../gestures-C7gbKx11.cjs"),S=require("../stylesheet-HWF2a3nr.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-ChAm68cm.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-CIdNtj3G.cjs"),l=require("../string-DUXXtU8v.cjs"),q=require("../style-At6aDoqG.cjs"),f=require("../url-VIZgwj_h.cjs");function R(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function N(t,e){const n=t.length;e=e%n;const o=new Array(n);for(let r=0;r<n;r++){const i=(r+e)%n;o[i]=t[r]}return o}function z(t,e=2){if(!+t)return"0 Bytes";const n=1024,o=e<0?0:e,r=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,i)).toFixed(o))} ${r[i]}`}function j(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 M(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function V(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function k(t,e){let n=!1;const{x:o,y:r}=t;for(let i=0,u=e.length-1;i<e.length;u=i++){const p=e[i].x,d=e[i].y,y=e[u].x,I=e[u].y;d>r!=I>r&&o<(y-p)*(r-d)/(I-d)+p&&(n=!n)}return n}function w(t,e){const n=t.style.getPropertyValue(e);if(n){const o=n.toString();return o.startsWith("var")?w(t,o.slice(4,-1)):o}}function F(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(o=>{o instanceof CSSStyleRule&&o.selectorText===":root"&&t.forEach(r=>{const i=w(o,r);i&&(e[r]=i)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function $(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function H(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}const U=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,K=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function W(t){let e,n;return K.test(t)?(e=`mailto:${t.trim()}`,n="email"):U.test(t)&&(e=`tel:${t.replace(/[^0-9\\.\\+]+/g,"")}`,n="phone"),{href:e,type:n,contact:t}}function Z(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function J(t,e,n,o){let r,i=!1,u=0;const p=()=>{clearInterval(r),o!=null&&o.restartCounter&&(u=0),i&&(r=setInterval(()=>{n(u++)},e))},d=E.intersector.subscribe(t,y=>{i=y.isIntersecting,p()});return()=>{d(),clearInterval(r)}}exports.parseAttribute=x.parseAttribute;exports.parseAttributeValue=x.parseAttributeValue;exports.isBrowser=E.isBrowser;exports.contain=b.contain;exports.cover=b.cover;exports.fixPosition=b.fixPosition;exports.measureText=b.measureText;exports.getPointerPosition=C.getPointerPosition;exports.normalize=C.normalize;exports.screenToCartesian=C.screenToCartesian;exports.whenDefined=D.whenDefined;exports.findParentElement=g.findParentElement;exports.findScrollParentElement=g.findScrollParentElement;exports.getAllParentElements=g.getAllParentElements;exports.getElement=g.getElement;exports.easeInCubic=s.easeInCubic;exports.easeInExpo=s.easeInExpo;exports.easeInOutCubic=s.easeInOutCubic;exports.easeInOutExpo=s.easeInOutExpo;exports.easeInOutQuad=s.easeInOutQuad;exports.easeInOutQuart=s.easeInOutQuart;exports.easeInOutQuint=s.easeInOutQuint;exports.easeInQuad=s.easeInQuad;exports.easeInQuart=s.easeInQuart;exports.easeInQuint=s.easeInQuint;exports.easeOutCubic=s.easeOutCubic;exports.easeOutExpo=s.easeOutExpo;exports.easeOutQuad=s.easeOutQuad;exports.easeOutQuart=s.easeOutQuart;exports.easeOutQuint=s.easeOutQuint;exports.linear=s.linear;exports.isElementVisible=Q.isElementVisible;exports.dispatchEvent=A.dispatchEvent;exports.createJSONAndSave=O.createJSONAndSave;exports.downloadURI=O.downloadURI;exports.debounce=T.debounce;exports.throttle=T.throttle;exports.setupDrag=B.setupDrag;exports.createStylesheet=S.createStylesheet;exports.styleToString=S.styleToString;exports.getCumulativeOffsetLeft=h.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=h.getCumulativeOffsetTop;exports.getCumulativePosition=h.getCumulativePosition;exports.getStickyOffset=h.getStickyOffset;exports.calculateDistance=a.calculateDistance;exports.calculateDistanceWithRadius=a.calculateDistanceWithRadius;exports.clamp=a.clamp;exports.damp=a.damp;exports.lerp=a.lerp;exports.mapRange=a.mapRange;exports.round=a.round;exports.smootherstep=a.smootherstep;exports.smoothstep=a.smoothstep;exports.step=a.step;exports.beautifyNumber=m.beautifyNumber;exports.loopNumber=m.loopNumber;exports.preciseNumber=m.preciseNumber;exports.roundNumberTo=m.roundNumberTo;exports.toStep=m.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=v.nullishCoalescing;exports.requestIdleCallback=v.requestIdleCallback;exports.scrollToElement=P.scrollToElement;exports.wait=P.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=q.getElementTransitionDurationMS;exports.getElementTransitionDurationS=q.getElementTransitionDurationS;exports.changeHistory=f.changeHistory;exports.normalizeBase=f.normalizeBase;exports.parseSearchParameters=f.parseSearchParameters;exports.splitPath=f.splitPath;exports.updateSearchParameter=f.updateSearchParameter;exports.cloneTemplateContent=Z;exports.copyTextToClipboard=j;exports.decode=H;exports.dotCircleCollision=V;exports.dotPolygonCollision=k;exports.dotRectCollision=M;exports.encode=$;exports.formatBytes=z;exports.getRootVariables=F;exports.insert=R;exports.setIntervalOnIntersection=J;exports.shiftArray=N;exports.tryCreateHrefFromContact=W;
|
package/lib/utils/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { n as lt, r as ut } from "../polyfills-DJrTJQky.js";
|
|
|
20
20
|
import { s as dt, w as mt } from "../scroll-DNGJVxa2.js";
|
|
21
21
|
import { c as xt, a as ht, b as bt, d as gt, g as yt, i as Ct, k as It, s as wt, t as vt, u as Et } from "../string-BlMQbe8b.js";
|
|
22
22
|
import { g as Tt, a as Ot } from "../style-j2TwriJ_.js";
|
|
23
|
-
import { c as Bt, n as At, p as Rt, s as Dt, u as Qt } from "../url-
|
|
23
|
+
import { c as Bt, n as At, p as Rt, s as Dt, u as Qt } from "../url-Ddgqz4Q_.js";
|
|
24
24
|
function b(t, e, ...s) {
|
|
25
25
|
return [...t.slice(0, e), ...s, ...t.slice(e)];
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aptechka",
|
|
3
|
-
"version": "0.78.
|
|
3
|
+
"version": "0.78.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/denisavitski/aptechka.git"
|
|
@@ -401,6 +401,7 @@
|
|
|
401
401
|
"vite-plugin-htmc": "0.1.16"
|
|
402
402
|
},
|
|
403
403
|
"dependencies": {
|
|
404
|
+
"aptechka": "^0.78.5",
|
|
404
405
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
405
406
|
"three": "^0.176.0",
|
|
406
407
|
"urlpattern-polyfill": "^10.0.0"
|
package/lib/url-Dns-01WU.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty,$=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var m=(t,s,a)=>s in t?d(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,P=(t,s)=>{for(var a in s||(s={}))w.call(s,a)&&m(t,a,s[a]);if(l)for(var a of l(s))L.call(s,a)&&m(t,a,s[a]);return t},S=(t,s)=>$(t,g(s));function R(t,{base:s="",trailingSlash:a=!1,mergeParams:r}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const n=t.split("#"),h=n[0].split("?");let e=h[0].startsWith("/")?h[0]:"/"+h[0];a?e=!e.endsWith("/")&&e!=="/"?e+"/":e:e=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;let i=h[1]||"";if(r){const f=new URLSearchParams(i),u=new URLSearchParams(r);for(const[W,y]of u)f.set(W,y);i=f.toString()}const o=s+e,c=n[1],p=`${o}${i?"?"+i:""}${c?"#"+c:""}`;return{leaf:e,pathname:o,parameters:i,hash:c,path:p}}function U(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function k(t){if(t.action==="none")return;const s=t==null?void 0:t.searchParameters,a=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",r=s?s.startsWith("?")?s:"?"+s:"",n=`${t.pathname}${r}${a}`,h=S(P({},t.state),{path:n});t.action==="push"?history.pushState(h,"",n):t.action==="replace"&&history.replaceState(h,"",n)}function z(t){const s=new URLSearchParams(t),a={};for(const[r,n]of s)a[r]=n;return a}function B(t,s){const a=new URL(location.href),r=(s==null?void 0:s.toString())||"";a.searchParams.set(t,r),history.replaceState(history.state,"",a.href)}exports.changeHistory=k;exports.normalizeBase=U;exports.parseSearchParameters=z;exports.splitPath=R;exports.updateSearchParameter=B;
|