aptechka 0.70.3 → 0.70.5
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 +58 -58
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +36 -35
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Yt=Object.defineProperty,Xt=Object.defineProperties;var jt=Object.getOwnPropertyDescriptors;var xt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var Ht=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),qt=r=>{throw TypeError(r)};var Nt=(r,t,s)=>t in r?Yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,pt=(r,t)=>{for(var s in t||(t={}))Ut.call(t,s)&&Nt(r,s,t[s]);if(xt)for(var s of xt(t))Kt.call(t,s)&&Nt(r,s,t[s]);return r},Et=(r,t)=>Xt(r,jt(t));var gt=(r,t,s)=>t.has(r)||qt("Cannot "+s);var e=(r,t,s)=>(gt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(gt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(gt(r,t,"access private method"),s);var Y=(r,t,s)=>new Promise((i,u)=>{var w=g=>{try{v(s.next(g))}catch(F){u(F)}},H=g=>{try{v(s.throw(g))}catch(F){u(F)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,H);v((s=s.apply(r,t)).next())});var Dt=(r,t,s)=>(t=r[Ht("asyncIterator")])?t.call(r):(r=r[Ht("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=w=>new Promise((H,v,g)=>(w=u.call(r,w),g=w.done,Promise.resolve(w.value).then(F=>H({value:F,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vt=require("../index-DekP7OZe.cjs"),X=require("../events-KVanG9sR.cjs"),$t=require("../polyfills-Df4r-ETT.cjs"),It=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),Gt=require("../css-value-parser/index.cjs");class zt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Vt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",zt);var C,l,D,st,$;class St{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const u=e(this,l).getAttribute("data-history-action")||"push",w=e(this,l).hasAttribute("data-center-scroll"),H=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=H?Gt.cssValueParser.parse(H):void 0,g=e(this,l).hasAttribute("data-revalidate"),F=e(this,l).hasAttribute("data-keep-search-parameters"),d=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(N=>N.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:u,centerScroll:w,offsetScroll:v,revalidate:g,keepSearchParameters:F,submorph:d,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Jt=new DOMParser;var T,I,b,P,j,R,G,U,V;class Rt{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,j,null);a(this,R,null);a(this,G,null);a(this,U,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,U))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return Y(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>Y(this,null,function*(){try{n(this,U,new AbortController);const u=yield(yield fetch(e(this,I),{signal:e(this,U).signal})).text(),w=Jt.parseFromString(u,"text/html");this.setInitialDocument(w)}catch(i){console.warn(i)}finally{n(this,U,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,j)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,j,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,j,null):n(this,j,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,j=new WeakMap,R=new WeakMap,G=new WeakMap,U=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,M,L,rt,x,K,Q,Z,nt,c,ht,wt,Bt,yt,bt,Lt,Pt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,M,!1);a(this,L,null);a(this,rt,!1);a(this,x,new Map);a(this,K,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>Y(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,M,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,M,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),u=t-e(this,Q);n(this,Z,s),n(this,Q,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),X.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Vt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,J,p(this,c,wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new Rt(this,e(this,f));i.setInitialDocument(document),e(this,x).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new zt),p(this,c,Lt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,M)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,x).get(e(this,f));s&&s.saveState(t)}getState(){const t=e(this,x).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return Y(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(F){return Y(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:H,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const d=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===d.path||e(this,f)===d.path){e(this,M)||p(this,c,Pt).call(this,d.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}n(this,z,d.path),e(this,E).forEach(N=>{N.checkCurrent(d.path)});try{let N=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),N=!1}if(!N||e(this,z)!==d.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const At={path:d.path,submorph:v};X.dispatchEvent(document,"morphNavigation",{detail:At});const dt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,x).forEach(o=>{o.path!==d.path&&o.abort()}),yield m==null?void 0:m.fetch(w),e(this,z)!==d.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}dt.clearState(),dt.saveScrollState(),dt.saveDocumentState(),e(this,M)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,K).textContent=m.title,document.body.appendChild(e(this,K));const mt=Et(pt({},At),{document:m.document});X.dispatchEvent(document,"morphStart",{detail:mt});const kt=Array.from(document.head.children),Ct=Array.from(m.document.head.children),Tt=p(this,c,Bt).call(this,kt,Ct),Ft=p(this,c,yt).call(this,kt,Tt),at=p(this,c,yt).call(this,Ct,Tt);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=o.getAttribute("src"),at[k]=y}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,bt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>Y(this,null,function*(){let k=0;try{for(var y=Dt(ft),tt,O,W;tt=!(O=yield y.next()).done;tt=!1){const lt=O.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(O){W=[O]}finally{try{tt&&(O=y.return)&&(yield O.call(y))}finally{if(W)throw W[0]}}}))),yield It.wait(10);const Mt=[];Ft.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,bt).call(this,o)?Mt.push(o):o.remove())});const Ot=p(this,c,wt).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,Lt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),ct.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(H?location.search:""),hash:d.hash}),e(this,K).remove(),n(this,it,e(this,f)),n(this,f,d.path),e(this,J).forEach((o,k)=>{const y=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let O=[],W=[];v?v.forEach(h=>{const S=o.querySelector(h),q=y.querySelector(h);S&&q&&(W.push(S),O.push(q))}):(O.push(...y.childNodes),W.push(...o.childNodes)),W.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),O.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),v?O.forEach((h,S)=>{var q;(q=W[S].parentElement)==null||q.insertBefore(h,W[S])}):o.prepend(...O),$t.requestIdleCallback(()=>{W.forEach(h=>{h instanceof HTMLElement&&h.classList.add("old-idle")}),O.forEach(h=>{var S;h instanceof HTMLElement&&((S=h.parentElement)==null||S.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("new-idle"))})});const lt=Et(pt({},mt),{morphElement:o});X.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Wt=new Promise(h=>{setTimeout(()=>{W.forEach(S=>S.remove()),O.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("new-idle","new"))}),X.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),h()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Wt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),X.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),d.hash?(m.clearScrollState(),p(this,c,Pt).call(this,d.hash,{centerScroll:i,offsetScroll:u})):e(this,M)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),Mt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(y=>{const tt=document.createElement("script");tt.type="module",tt.src=y.getAttribute("src"),y.replaceWith(tt)})}),X.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(N){console.error(N)}n(this,z,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,nt));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,M=new WeakMap,L=new WeakMap,rt=new WeakMap,x=new WeakMap,K=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=e(this,x).get(t);return s||(s=new Rt(this,t),e(this,x).set(t,s)),s},wt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Bt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},yt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},bt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Lt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},Pt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&It.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ut=new WeakMap,_=new WeakMap,et.instance=null;let vt=et;exports.Morph=vt;
|
|
1
|
+
"use strict";var Yt=Object.defineProperty,Xt=Object.defineProperties;var jt=Object.getOwnPropertyDescriptors;var xt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var Ht=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),qt=r=>{throw TypeError(r)};var Nt=(r,t,s)=>t in r?Yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,pt=(r,t)=>{for(var s in t||(t={}))Ut.call(t,s)&&Nt(r,s,t[s]);if(xt)for(var s of xt(t))Kt.call(t,s)&&Nt(r,s,t[s]);return r},Et=(r,t)=>Xt(r,jt(t));var gt=(r,t,s)=>t.has(r)||qt("Cannot "+s);var e=(r,t,s)=>(gt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(gt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(gt(r,t,"access private method"),s);var Y=(r,t,s)=>new Promise((i,u)=>{var w=g=>{try{v(s.next(g))}catch(F){u(F)}},H=g=>{try{v(s.throw(g))}catch(F){u(F)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,H);v((s=s.apply(r,t)).next())});var Dt=(r,t,s)=>(t=r[Ht("asyncIterator")])?t.call(r):(r=r[Ht("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=w=>new Promise((H,v,g)=>(w=u.call(r,w),g=w.done,Promise.resolve(w.value).then(F=>H({value:F,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vt=require("../index-DekP7OZe.cjs"),X=require("../events-KVanG9sR.cjs"),$t=require("../polyfills-Df4r-ETT.cjs"),It=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),Gt=require("../css-value-parser/index.cjs");class zt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Vt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",zt);var C,l,D,st,$;class St{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const u=e(this,l).getAttribute("data-history-action")||"push",w=e(this,l).hasAttribute("data-center-scroll"),H=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=H?Gt.cssValueParser.parse(H):void 0,g=e(this,l).hasAttribute("data-revalidate"),F=e(this,l).hasAttribute("data-keep-search-parameters"),d=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(N=>N.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:u,centerScroll:w,offsetScroll:v,revalidate:g,keepSearchParameters:F,submorph:d,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Jt=new DOMParser;var T,I,b,P,j,R,G,U,V;class Rt{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,j,null);a(this,R,null);a(this,G,null);a(this,U,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,U))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return Y(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>Y(this,null,function*(){try{n(this,U,new AbortController);const u=yield(yield fetch(e(this,I),{signal:e(this,U).signal})).text(),w=Jt.parseFromString(u,"text/html");this.setInitialDocument(w)}catch(i){console.warn(i)}finally{n(this,U,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,j)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,j,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,j,null):n(this,j,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,j=new WeakMap,R=new WeakMap,G=new WeakMap,U=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,M,L,rt,x,K,Q,Z,nt,c,ht,wt,Bt,yt,bt,Lt,Pt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,M,!1);a(this,L,null);a(this,rt,!1);a(this,x,new Map);a(this,K,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>Y(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,M,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,M,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),u=t-e(this,Q);n(this,Z,s),n(this,Q,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),X.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Vt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,J,p(this,c,wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new Rt(this,e(this,f));i.setInitialDocument(document),e(this,x).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new zt),p(this,c,Lt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,M)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,x).get(e(this,f));s&&s.saveState(t)}getState(){const t=e(this,x).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return Y(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(F){return Y(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:H,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const d=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===d.path||e(this,f)===d.path){e(this,M)||p(this,c,Pt).call(this,d.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}n(this,z,d.path),e(this,E).forEach(N=>{N.checkCurrent(d.path)});try{let N=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),N=!1}if(!N||e(this,z)!==d.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const At={path:d.path,submorph:v};X.dispatchEvent(document,"morphNavigation",{detail:At});const dt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,x).forEach(o=>{o.path!==d.path&&o.abort()}),yield m==null?void 0:m.fetch(w),e(this,z)!==d.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}dt.clearState(),dt.saveScrollState(),dt.saveDocumentState(),e(this,M)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,K).textContent=m.title,document.body.appendChild(e(this,K));const mt=Et(pt({},At),{document:m.document});X.dispatchEvent(document,"morphStart",{detail:mt});const kt=Array.from(document.head.children),Ct=Array.from(m.document.head.children),Tt=p(this,c,Bt).call(this,kt,Ct),Ft=p(this,c,yt).call(this,kt,Tt),at=p(this,c,yt).call(this,Ct,Tt);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=o.getAttribute("src"),at[k]=y}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,bt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>Y(this,null,function*(){let k=0;try{for(var y=Dt(ft),tt,O,W;tt=!(O=yield y.next()).done;tt=!1){const lt=O.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(O){W=[O]}finally{try{tt&&(O=y.return)&&(yield O.call(y))}finally{if(W)throw W[0]}}}))),yield It.wait(10);const Mt=[];Ft.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,bt).call(this,o)?Mt.push(o):o.remove())});const Ot=p(this,c,wt).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,Lt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),ct.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(H?location.search:""),hash:d.hash}),e(this,K).remove(),n(this,it,e(this,f)),n(this,f,d.path),e(this,J).forEach((o,k)=>{const y=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let O=[],W=[];v?v.forEach(h=>{const S=o.querySelector(h),q=y.querySelector(h);S&&q&&(W.push(S),O.push(q))}):(O.push(...y.childNodes),W.push(...o.childNodes)),W.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),O.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),v?O.forEach((h,S)=>{var q;(q=W[S].parentElement)==null||q.insertBefore(h,W[S])}):o.prepend(...O),$t.requestIdleCallback(()=>{W.forEach(h=>{h instanceof HTMLElement&&h.classList.add("old-idle")}),O.forEach(h=>{var S;h instanceof HTMLElement&&((S=h.parentElement)==null||S.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("new-idle"))})});const lt=Et(pt({},mt),{morphElement:o});X.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Wt=new Promise(h=>{setTimeout(()=>{W.forEach(S=>S.remove()),O.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("new-idle","new"))}),X.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),h()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Wt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),X.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),d.hash?(m.clearScrollState(),p(this,c,Pt).call(this,d.hash,{centerScroll:i,offsetScroll:u})):e(this,M)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),Mt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(y=>{const tt=document.createElement("script");tt.type="module",tt.src=y.getAttribute("src"),y.replaceWith(tt)})}),X.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(N){console.error(N)}n(this,z,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,nt));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,M=new WeakMap,L=new WeakMap,rt=new WeakMap,x=new WeakMap,K=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=t.split("#")[0],i=e(this,x).get(s);return i||(i=new Rt(this,s),e(this,x).set(s,i)),i},wt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Bt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},yt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},bt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Lt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},Pt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&It.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ut=new WeakMap,_=new WeakMap,et.instance=null;let vt=et;exports.Morph=vt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ot = Object.defineProperty, Yt = Object.defineProperties;
|
|
2
2
|
var Xt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Tt = Object.getOwnPropertySymbols;
|
|
4
4
|
var Ut = Object.prototype.hasOwnProperty, jt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var xt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r),
|
|
5
|
+
var xt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), Mt = (r) => {
|
|
6
6
|
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var Ht = (r, t, s) => t in r ? Ot(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s, ft = (r, t) => {
|
|
9
9
|
for (var s in t || (t = {}))
|
|
10
|
-
Ut.call(t, s) &&
|
|
10
|
+
Ut.call(t, s) && Ht(r, s, t[s]);
|
|
11
11
|
if (Tt)
|
|
12
12
|
for (var s of Tt(t))
|
|
13
|
-
jt.call(t, s) &&
|
|
13
|
+
jt.call(t, s) && Ht(r, s, t[s]);
|
|
14
14
|
return r;
|
|
15
15
|
}, pt = (r, t) => Yt(r, Xt(t));
|
|
16
|
-
var Et = (r, t, s) => t.has(r) ||
|
|
17
|
-
var e = (r, t, s) => (Et(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => t.has(r) ?
|
|
16
|
+
var Et = (r, t, s) => t.has(r) || Mt("Cannot " + s);
|
|
17
|
+
var e = (r, t, s) => (Et(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => t.has(r) ? Mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), n = (r, t, s, i) => (Et(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), p = (r, t, s) => (Et(r, t, "access private method"), s);
|
|
18
18
|
var Y = (r, t, s) => new Promise((i, u) => {
|
|
19
19
|
var y = (g) => {
|
|
20
20
|
try {
|
|
21
21
|
w(s.next(g));
|
|
22
|
-
} catch (
|
|
23
|
-
u(
|
|
22
|
+
} catch (W) {
|
|
23
|
+
u(W);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, M = (g) => {
|
|
26
26
|
try {
|
|
27
27
|
w(s.throw(g));
|
|
28
|
-
} catch (
|
|
29
|
-
u(
|
|
28
|
+
} catch (W) {
|
|
29
|
+
u(W);
|
|
30
30
|
}
|
|
31
|
-
}, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(y,
|
|
31
|
+
}, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(y, M);
|
|
32
32
|
w((s = s.apply(r, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
34
|
+
var Nt = (r, t, s) => (t = r[xt("asyncIterator")]) ? t.call(r) : (r = r[xt("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (y) => new Promise((M, w, g) => (y = u.call(r, y), g = y.done, Promise.resolve(y.value).then((W) => M({ value: W, done: g }), w)))), s("next"), s("return"), t);
|
|
35
35
|
import { i as Vt } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as X } from "../events-CsVF98U6.js";
|
|
37
37
|
import { r as Kt } from "../polyfills-DJrTJQky.js";
|
|
@@ -65,15 +65,15 @@ class gt {
|
|
|
65
65
|
n(this, I, e(this, l).getAttribute("href") || "/");
|
|
66
66
|
const u = e(this, l).getAttribute(
|
|
67
67
|
"data-history-action"
|
|
68
|
-
) || "push", y = e(this, l).hasAttribute("data-center-scroll"),
|
|
68
|
+
) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? Zt.parse(M) : void 0, g = e(this, l).hasAttribute("data-revalidate"), W = e(this, l).hasAttribute(
|
|
69
69
|
"data-keep-search-parameters"
|
|
70
|
-
), d = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((
|
|
70
|
+
), d = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((N) => N.trim()), ot = e(this, l).hasAttribute("data-clear-state");
|
|
71
71
|
e(this, C).navigate(e(this, I), {
|
|
72
72
|
historyAction: u,
|
|
73
73
|
centerScroll: y,
|
|
74
74
|
offsetScroll: w,
|
|
75
75
|
revalidate: g,
|
|
76
|
-
keepSearchParameters:
|
|
76
|
+
keepSearchParameters: W,
|
|
77
77
|
submorph: d,
|
|
78
78
|
clearState: ot
|
|
79
79
|
});
|
|
@@ -199,7 +199,7 @@ class It {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
T = new WeakMap(), R = new WeakMap(), b = new WeakMap(), P = new WeakMap(), U = new WeakMap(), V = new WeakMap(), G = new WeakMap(), j = new WeakMap(), q = new WeakMap();
|
|
202
|
-
var A, J, E, z, f, it, F, x, L, rt,
|
|
202
|
+
var A, J, E, z, f, it, F, x, L, rt, H, K, Q, Z, nt, c, ct, St, zt, wt, yt, vt, bt, ht, _;
|
|
203
203
|
const et = class et {
|
|
204
204
|
constructor(t) {
|
|
205
205
|
a(this, c);
|
|
@@ -213,7 +213,7 @@ const et = class et {
|
|
|
213
213
|
a(this, x, !1);
|
|
214
214
|
a(this, L, null);
|
|
215
215
|
a(this, rt, !1);
|
|
216
|
-
a(this,
|
|
216
|
+
a(this, H, /* @__PURE__ */ new Map());
|
|
217
217
|
a(this, K, null);
|
|
218
218
|
a(this, Q, 0);
|
|
219
219
|
a(this, Z, 0);
|
|
@@ -259,7 +259,7 @@ const et = class et {
|
|
|
259
259
|
);
|
|
260
260
|
n(this, f, s.path);
|
|
261
261
|
const i = new It(this, e(this, f));
|
|
262
|
-
i.setInitialDocument(document), e(this,
|
|
262
|
+
i.setInitialDocument(document), e(this, H).set(e(this, f), i), document.documentElement.setAttribute(
|
|
263
263
|
"data-current-pathname",
|
|
264
264
|
e(this, f)
|
|
265
265
|
), document.documentElement.setAttribute(
|
|
@@ -293,11 +293,11 @@ const et = class et {
|
|
|
293
293
|
return e(this, rt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, L).scrollTop, s = e(this, L).scrollLeft), { top: t, left: s };
|
|
294
294
|
}
|
|
295
295
|
saveState(t) {
|
|
296
|
-
const s = e(this,
|
|
296
|
+
const s = e(this, H).get(e(this, f));
|
|
297
297
|
s && s.saveState(t);
|
|
298
298
|
}
|
|
299
299
|
getState() {
|
|
300
|
-
const t = e(this,
|
|
300
|
+
const t = e(this, H).get(e(this, f));
|
|
301
301
|
return t == null ? void 0 : t.clearState();
|
|
302
302
|
}
|
|
303
303
|
normalizePath(t) {
|
|
@@ -314,13 +314,13 @@ const et = class et {
|
|
|
314
314
|
i == null || i.fetch(s);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
navigate(
|
|
317
|
+
navigate(W) {
|
|
318
318
|
return Y(this, arguments, function* (t, {
|
|
319
319
|
historyAction: s = "push",
|
|
320
320
|
centerScroll: i,
|
|
321
321
|
offsetScroll: u,
|
|
322
322
|
revalidate: y,
|
|
323
|
-
keepSearchParameters:
|
|
323
|
+
keepSearchParameters: M,
|
|
324
324
|
submorph: w,
|
|
325
325
|
clearState: g
|
|
326
326
|
} = {}) {
|
|
@@ -338,11 +338,11 @@ const et = class et {
|
|
|
338
338
|
});
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
|
-
n(this, z, d.path), e(this, E).forEach((
|
|
342
|
-
|
|
341
|
+
n(this, z, d.path), e(this, E).forEach((N) => {
|
|
342
|
+
N.checkCurrent(d.path);
|
|
343
343
|
});
|
|
344
344
|
try {
|
|
345
|
-
let
|
|
345
|
+
let N = !0;
|
|
346
346
|
if (this.preprocessor)
|
|
347
347
|
try {
|
|
348
348
|
yield new Promise((o, k) => {
|
|
@@ -355,9 +355,9 @@ const et = class et {
|
|
|
355
355
|
});
|
|
356
356
|
});
|
|
357
357
|
} catch (o) {
|
|
358
|
-
o ? console.error(o) : console.log("Route change canceled"),
|
|
358
|
+
o ? console.error(o) : console.log("Route change canceled"), N = !1;
|
|
359
359
|
}
|
|
360
|
-
if (!
|
|
360
|
+
if (!N || e(this, z) !== d.path) {
|
|
361
361
|
e(this, E).forEach((o) => {
|
|
362
362
|
o.checkCurrent(e(this, f));
|
|
363
363
|
});
|
|
@@ -371,7 +371,7 @@ const et = class et {
|
|
|
371
371
|
detail: Lt
|
|
372
372
|
});
|
|
373
373
|
const ut = p(this, c, ct).call(this, e(this, f)), m = p(this, c, ct).call(this, t);
|
|
374
|
-
if (e(this,
|
|
374
|
+
if (e(this, H).forEach((o) => {
|
|
375
375
|
o.path !== d.path && o.abort();
|
|
376
376
|
}), yield m == null ? void 0 : m.fetch(y), e(this, z) !== d.path) {
|
|
377
377
|
e(this, E).forEach((o) => {
|
|
@@ -404,20 +404,20 @@ const et = class et {
|
|
|
404
404
|
e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((o) => Y(this, null, function* () {
|
|
405
405
|
let k = 0;
|
|
406
406
|
try {
|
|
407
|
-
for (var v =
|
|
408
|
-
const lt =
|
|
407
|
+
for (var v = Nt(mt), tt, B, O; tt = !(B = yield v.next()).done; tt = !1) {
|
|
408
|
+
const lt = B.value;
|
|
409
409
|
lt.onload = () => {
|
|
410
410
|
k++, k === mt.length && o();
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
|
-
} catch (
|
|
414
|
-
|
|
413
|
+
} catch (B) {
|
|
414
|
+
O = [B];
|
|
415
415
|
} finally {
|
|
416
416
|
try {
|
|
417
|
-
tt && (
|
|
417
|
+
tt && (B = v.return) && (yield B.call(v));
|
|
418
418
|
} finally {
|
|
419
|
-
if (
|
|
420
|
-
throw
|
|
419
|
+
if (O)
|
|
420
|
+
throw O[0];
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
}))), yield $t(10);
|
|
@@ -425,7 +425,7 @@ const et = class et {
|
|
|
425
425
|
Ft.forEach((o) => {
|
|
426
426
|
o.hasAttribute("data-permanent") || (p(this, c, yt).call(this, o) ? Ct.push(o) : o.remove());
|
|
427
427
|
});
|
|
428
|
-
const
|
|
428
|
+
const Wt = p(this, c, St).call(this, m.document.body);
|
|
429
429
|
e(this, A).morphInsideScrollContainer || p(this, c, vt).call(this, m.document), document.documentElement.setAttribute(
|
|
430
430
|
"data-current-pathname",
|
|
431
431
|
d.pathname
|
|
@@ -435,28 +435,28 @@ const et = class et {
|
|
|
435
435
|
), Dt({
|
|
436
436
|
action: s,
|
|
437
437
|
pathname: d.pathname,
|
|
438
|
-
searchParameters: d.parameters || (
|
|
438
|
+
searchParameters: d.parameters || (M ? location.search : ""),
|
|
439
439
|
hash: d.hash
|
|
440
440
|
}), e(this, K).remove(), n(this, it, e(this, f)), n(this, f, d.path), e(this, J).forEach((o, k) => {
|
|
441
|
-
const v =
|
|
442
|
-
let
|
|
441
|
+
const v = Wt[k], tt = getComputedStyle(o).getPropertyValue("--morph-duration");
|
|
442
|
+
let B = [], O = [];
|
|
443
443
|
w ? w.forEach((h) => {
|
|
444
444
|
const S = o.querySelector(h), D = v.querySelector(h);
|
|
445
|
-
S && D && (
|
|
446
|
-
}) : (
|
|
445
|
+
S && D && (O.push(S), B.push(D));
|
|
446
|
+
}) : (B.push(...v.childNodes), O.push(...o.childNodes)), O.forEach((h) => {
|
|
447
447
|
h instanceof HTMLElement && (this.destroyOldLinks(h), h.classList.add("old"));
|
|
448
|
-
}),
|
|
448
|
+
}), B.forEach((h) => {
|
|
449
449
|
h instanceof HTMLElement && (this.findNewLinks(h), h.classList.add("new"));
|
|
450
|
-
}), w ?
|
|
450
|
+
}), w ? B.forEach((h, S) => {
|
|
451
451
|
var D;
|
|
452
|
-
(D =
|
|
452
|
+
(D = O[S].parentElement) == null || D.insertBefore(
|
|
453
453
|
h,
|
|
454
|
-
|
|
454
|
+
O[S]
|
|
455
455
|
);
|
|
456
|
-
}) : o.prepend(...
|
|
457
|
-
|
|
456
|
+
}) : o.prepend(...B), Kt(() => {
|
|
457
|
+
O.forEach((h) => {
|
|
458
458
|
h instanceof HTMLElement && h.classList.add("old-idle");
|
|
459
|
-
}),
|
|
459
|
+
}), B.forEach((h) => {
|
|
460
460
|
var S;
|
|
461
461
|
h instanceof HTMLElement && ((S = h.parentElement) == null || S.style.setProperty(
|
|
462
462
|
"--new-content-height",
|
|
@@ -470,9 +470,9 @@ const et = class et {
|
|
|
470
470
|
X(document, "morphNewChildrenAdded", {
|
|
471
471
|
detail: lt
|
|
472
472
|
});
|
|
473
|
-
const
|
|
473
|
+
const Bt = new Promise((h) => {
|
|
474
474
|
setTimeout(() => {
|
|
475
|
-
|
|
475
|
+
O.forEach((S) => S.remove()), B.forEach((S) => {
|
|
476
476
|
var D;
|
|
477
477
|
S instanceof HTMLElement && ((D = S.parentElement) == null || D.style.removeProperty(
|
|
478
478
|
"--new-content-height"
|
|
@@ -482,7 +482,7 @@ const et = class et {
|
|
|
482
482
|
}), h();
|
|
483
483
|
}, (parseFloat(tt) || 0) * 1e3 + 10);
|
|
484
484
|
});
|
|
485
|
-
e(this, F).push(
|
|
485
|
+
e(this, F).push(Bt);
|
|
486
486
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
487
487
|
"--new-document-scroll-position",
|
|
488
488
|
(this.scrollValue.top - m.scrollState.y) * 1 + "px"
|
|
@@ -504,8 +504,8 @@ const et = class et {
|
|
|
504
504
|
}), document.documentElement.style.removeProperty(
|
|
505
505
|
"--new-document-scroll-position"
|
|
506
506
|
), window.dispatchEvent(new Event("resize"));
|
|
507
|
-
} catch (
|
|
508
|
-
console.error(
|
|
507
|
+
} catch (N) {
|
|
508
|
+
console.error(N);
|
|
509
509
|
}
|
|
510
510
|
n(this, z, void 0);
|
|
511
511
|
});
|
|
@@ -539,9 +539,9 @@ const et = class et {
|
|
|
539
539
|
e(this, E).forEach((s) => s.destroy()), n(this, E, t.map((s) => new gt(s, this)));
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
|
-
A = new WeakMap(), J = new WeakMap(), E = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), F = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(),
|
|
543
|
-
let s = e(this,
|
|
544
|
-
return
|
|
542
|
+
A = new WeakMap(), J = new WeakMap(), E = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), F = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), H = new WeakMap(), K = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), c = new WeakSet(), ct = function(t) {
|
|
543
|
+
let s = t.split("#")[0], i = e(this, H).get(s);
|
|
544
|
+
return i || (i = new It(this, s), e(this, H).set(s, i)), i;
|
|
545
545
|
}, St = function(t) {
|
|
546
546
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
547
547
|
return s.length ? s : [t];
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var oe=c=>{throw TypeError(c)};var ee=(c,n,t)=>n.has(c)||oe("Cannot "+t);var e=(c,n,t)=>(ee(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(ee(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),f=(c,n,t)=>(ee(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),K=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-BT4fssbO.cjs"),ce=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var u,E,_,N;class de{constructor(){r(this,u,new Map);r(this,E,[]);r(this,_,n=>{var s;const t=[...e(this,E)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.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))),D=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||D)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,E)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,u)}get stack(){return e(this,E)}add(n,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(n);s!=null&&s.length||(s=[],e(this,u).set(n,s)),e(this,E).push(t),s.push(t)}remove(n,t){if(o(this,E,e(this,E).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(n);e(this,u).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(n);s&&(s=s.filter(i=>i!==t),e(this,u).set(n,s))}}}u=new WeakMap,E=new WeakMap,_=new WeakMap,N=new WeakMap;var v,M,B,k,H,m,L,A,x,b,R,q,S,T,$,a,V,W,p,le,O,Z,z,P,j,X,G;const w=class w extends HTMLElement{constructor(){super();r(this,p);r(this,v);r(this,M);r(this,B);r(this,k);r(this,H);r(this,m);r(this,L);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,S);r(this,T);r(this,$);r(this,a);r(this,V);r(this,W);r(this,z);r(this,P);r(this,j);r(this,X);r(this,G);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,L,new y.CSSProperty(this,"--restore",!1)),o(this,A,new y.CSSProperty(this,"--close-rest",!1)),o(this,x,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,R,new y.CSSProperty(this,"--click-outside",!1)),o(this,q,new y.CSSProperty(this,"--escape",!1)),o(this,S,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,T,!1),o(this,a,new ue.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,z,()=>{o(this,T,!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,T,!0)}),o(this,P,()=>{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,j).call(this)}),o(this,j,pe.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,S).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.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,G,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(w.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=w.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,L)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,M)),clearTimeout(e(this,B)),f(this,p,O).call(this,!0,this.openClass),f(this,p,O).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),K.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,T)&&history.pushState(history.state,"",e(this,p,le)),o(this,v,!0);const s=()=>{w.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),e(this,P).call(this),e(this,a).set("opened",!0),K.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0)},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,setTimeout(s,10))}close(){e(this,v)&&(o(this,v,!1),clearTimeout(e(this,k)),clearTimeout(e(this,H)),w.stack.remove(e(this,b).current,this),f(this,p,Z).call(this),f(this,p,O).call(this,!1,this.openClass),e(this,a).set("transitionend",!1),o(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),f(this,p,O).call(this,!0,this.closingClass),K.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),f(this,p,O).call(this,!1,this.closingClass),K.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,G))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,L).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,S).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,z)),setTimeout(()=>{e(this,L).current?(this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue})):(f(this,p,Z).call(this),o(this,T,!0))},0),e(this,S).subscribe(()=>{e(this,P).call(this)}),ce.windowResizer.subscribe(e(this,P))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,G))}),w.stack.remove(e(this,b).current,this),ce.windowResizer.unsubscribe(e(this,P)),e(this,a).close(),e(this,m).close(),e(this,L).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,S).close(),this.removeAttribute("role"),clearTimeout(e(this,M)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,z)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),f(this,p,Z).call(this)}};v=new WeakMap,M=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,L=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,S=new WeakMap,T=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,p=new WeakSet,le=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},O=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},z=new WeakMap,P=new WeakMap,j=new WeakMap,X=new WeakMap,G=new WeakMap,w.stack=new de;let U=w;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,C,te,Y,F,I,J,se;class ae extends HTMLElement{constructor(){super();r(this,C);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,()=>{e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,F,()=>{e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,I,()=>{e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,J,()=>{e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.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(f(this,C,te).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 D=d.querySelector("[data-popover]");return!D&&(d!=null&&d.parentElement)&&(D=l(d.parentElement)),D};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,F)),e(this,h).addEventListener("popoverClosing",e(this,I)),e(this,h).addEventListener("popoverClosed",e(this,J))):console.warn(this,`target ${t} not found`)}f(this,C,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{f(this,C,se).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"),f(this,C,te).call(this)}}h=new WeakMap,g=new WeakMap,C=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,F)),e(this,h).removeEventListener("popoverClosing",e(this,I)),e(this,h).removeEventListener("popoverClosed",e(this,J)))},Y=new WeakMap,F=new WeakMap,I=new WeakMap,J=new WeakMap,se=function(t){e(this,h)instanceof U&&(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")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
|
|
1
|
+
"use strict";var oe=c=>{throw TypeError(c)};var ee=(c,n,t)=>n.has(c)||oe("Cannot "+t);var e=(c,n,t)=>(ee(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(ee(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),f=(c,n,t)=>(ee(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),K=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-BT4fssbO.cjs"),ce=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var u,E,_,N;class de{constructor(){r(this,u,new Map);r(this,E,[]);r(this,_,n=>{var s;const t=[...e(this,E)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.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))),D=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||D)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,E)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,u)}get stack(){return e(this,E)}add(n,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(n);s!=null&&s.length||(s=[],e(this,u).set(n,s)),e(this,E).push(t),s.push(t)}remove(n,t){if(o(this,E,e(this,E).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(n);e(this,u).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(n);s&&(s=s.filter(i=>i!==t),e(this,u).set(n,s))}}}u=new WeakMap,E=new WeakMap,_=new WeakMap,N=new WeakMap;var v,M,B,k,H,m,L,A,x,b,R,q,S,P,$,a,V,W,p,le,O,Z,z,T,U,j,G;const w=class w extends HTMLElement{constructor(){super();r(this,p);r(this,v);r(this,M);r(this,B);r(this,k);r(this,H);r(this,m);r(this,L);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,S);r(this,P);r(this,$);r(this,a);r(this,V);r(this,W);r(this,z);r(this,T);r(this,U);r(this,j);r(this,G);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,L,new y.CSSProperty(this,"--restore",!1)),o(this,A,new y.CSSProperty(this,"--close-rest",!1)),o(this,x,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,R,new y.CSSProperty(this,"--click-outside",!1)),o(this,q,new y.CSSProperty(this,"--escape",!1)),o(this,S,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,P,!1),o(this,a,new ue.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,z,()=>{o(this,P,!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,P,!0)}),o(this,T,()=>{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,U).call(this)}),o(this,U,pe.debounce(()=>{e(this,j).call(this)},10)),o(this,j,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,S).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.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,G,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(w.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=w.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,L)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,M)),clearTimeout(e(this,B)),f(this,p,O).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),K.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,P)&&history.pushState(history.state,"",e(this,p,le)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{w.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),f(this,p,O).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,T).call(this),K.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0)},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,k)),clearTimeout(e(this,H)),w.stack.remove(e(this,b).current,this),f(this,p,Z).call(this),f(this,p,O).call(this,!1,this.openClass),e(this,a).set("transitionend",!1),o(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),f(this,p,O).call(this,!0,this.closingClass),K.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),f(this,p,O).call(this,!1,this.closingClass),K.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,G))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,L).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,S).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,z)),setTimeout(()=>{e(this,L).current?(this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue})):(f(this,p,Z).call(this),o(this,P,!0))},0),e(this,S).subscribe(()=>{e(this,T).call(this)}),ce.windowResizer.subscribe(e(this,T))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,G))}),w.stack.remove(e(this,b).current,this),ce.windowResizer.unsubscribe(e(this,T)),e(this,a).close(),e(this,m).close(),e(this,L).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,S).close(),this.removeAttribute("role"),clearTimeout(e(this,M)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,z)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),f(this,p,Z).call(this)}};v=new WeakMap,M=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,L=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,S=new WeakMap,P=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,p=new WeakSet,le=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},O=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},z=new WeakMap,T=new WeakMap,U=new WeakMap,j=new WeakMap,G=new WeakMap,w.stack=new de;let F=w;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",F);var h,g,C,te,X,Y,I,J,se;class ae extends HTMLElement{constructor(){super();r(this,C);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,X,()=>{e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,Y,()=>{e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,I,()=>{e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,J,()=>{e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.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(f(this,C,te).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 D=d.querySelector("[data-popover]");return!D&&(d!=null&&d.parentElement)&&(D=l(d.parentElement)),D};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,X)),e(this,h).addEventListener("popoverOpened",e(this,Y)),e(this,h).addEventListener("popoverClosing",e(this,I)),e(this,h).addEventListener("popoverClosed",e(this,J))):console.warn(this,`target ${t} not found`)}f(this,C,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{f(this,C,se).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"),f(this,C,te).call(this)}}h=new WeakMap,g=new WeakMap,C=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,X)),e(this,h).removeEventListener("popoverOpened",e(this,Y)),e(this,h).removeEventListener("popoverClosing",e(this,I)),e(this,h).removeEventListener("popoverClosed",e(this,J)))},X=new WeakMap,Y=new WeakMap,I=new WeakMap,J=new WeakMap,se=function(t){e(this,h)instanceof F&&(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")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=F;
|
package/lib/popover/index.js
CHANGED
|
@@ -27,8 +27,8 @@ class dt {
|
|
|
27
27
|
(rt) => rt instanceof HTMLElement && rt.hasAttribute("data-popover-content")
|
|
28
28
|
))
|
|
29
29
|
return;
|
|
30
|
-
const c = i[0], d = c instanceof Node && (e.contains(c) || ((s = e.shadowRoot) == null ? void 0 : s.contains(c))),
|
|
31
|
-
(!d ||
|
|
30
|
+
const c = i[0], d = c instanceof Node && (e.contains(c) || ((s = e.shadowRoot) == null ? void 0 : s.contains(c))), F = c instanceof HTMLElement && c.hasAttribute("data-outside");
|
|
31
|
+
(!d || F) && e.close();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
r(this, _, (h) => {
|
|
@@ -82,16 +82,16 @@ class dt {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
u = new WeakMap(), y = new WeakMap(), N = new WeakMap(), _ = new WeakMap();
|
|
85
|
-
var m,
|
|
85
|
+
var m, q, H, P, W, v, w, x, S, b, R, $, T, k, V, a, O, G, p, lt, M, Q, z, A, D, U, B;
|
|
86
86
|
const L = class L extends HTMLElement {
|
|
87
87
|
constructor() {
|
|
88
88
|
super();
|
|
89
89
|
r(this, p);
|
|
90
90
|
r(this, m);
|
|
91
|
+
r(this, q);
|
|
91
92
|
r(this, H);
|
|
92
|
-
r(this, W);
|
|
93
93
|
r(this, P);
|
|
94
|
-
r(this,
|
|
94
|
+
r(this, W);
|
|
95
95
|
r(this, v);
|
|
96
96
|
r(this, w);
|
|
97
97
|
r(this, x);
|
|
@@ -107,25 +107,26 @@ const L = class L extends HTMLElement {
|
|
|
107
107
|
r(this, G);
|
|
108
108
|
r(this, z);
|
|
109
109
|
r(this, A);
|
|
110
|
+
r(this, D);
|
|
110
111
|
r(this, U);
|
|
111
|
-
r(this, X);
|
|
112
112
|
r(this, B);
|
|
113
113
|
this.urlValue = "", o(this, m, !1), o(this, v, new E(this, "--history", !1)), o(this, w, new E(this, "--restore", !1)), o(this, x, new E(this, "--close-rest", !1)), o(this, S, new E(
|
|
114
114
|
this,
|
|
115
115
|
"--close-rest-in-group",
|
|
116
116
|
!1
|
|
117
117
|
)), o(this, b, new E(this, "--group", "")), o(this, R, new E(this, "--click-outside", !1)), o(this, $, new E(this, "--escape", !1)), o(this, T, new E(this, "--check-viewport-bounds", !1)), o(this, k, !1), o(this, a, new ct(this, {
|
|
118
|
+
triggered: !1,
|
|
119
|
+
beforeopen: !1,
|
|
118
120
|
opened: !1,
|
|
119
121
|
closing: !1,
|
|
120
|
-
triggered: !1,
|
|
121
122
|
transitionend: !1
|
|
122
123
|
})), o(this, O, []), o(this, G, []), o(this, z, () => {
|
|
123
124
|
o(this, k, !1), t(this, m) && t(this, v).current && !location.search.includes(this.id) ? this.close() : !t(this, m) && t(this, v).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, k, !0);
|
|
124
125
|
}), o(this, A, () => {
|
|
125
|
-
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"), t(this,
|
|
126
|
-
}), o(this,
|
|
127
|
-
t(this,
|
|
128
|
-
}, 10)), o(this,
|
|
126
|
+
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"), t(this, D).call(this);
|
|
127
|
+
}), o(this, D, at(() => {
|
|
128
|
+
t(this, U).call(this);
|
|
129
|
+
}, 10)), o(this, U, () => {
|
|
129
130
|
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, T).current) {
|
|
130
131
|
const e = this.getBoundingClientRect();
|
|
131
132
|
let s = 0, i = 0;
|
|
@@ -195,12 +196,12 @@ const L = class L extends HTMLElement {
|
|
|
195
196
|
open(e) {
|
|
196
197
|
if (t(this, m))
|
|
197
198
|
return;
|
|
198
|
-
o(this, V, e == null ? void 0 : e.trigger), clearTimeout(t(this,
|
|
199
|
+
o(this, V, e == null ? void 0 : e.trigger), clearTimeout(t(this, q)), clearTimeout(t(this, H)), f(this, p, M).call(this, !1, this.closingClass), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), J(this, "popoverTriggered", {
|
|
199
200
|
custom: !0,
|
|
200
201
|
detail: {
|
|
201
202
|
trigger: t(this, V)
|
|
202
203
|
}
|
|
203
|
-
}), t(this, v).current && t(this, k) && history.pushState(history.state, "", t(this, p, lt)), o(this, m, !0);
|
|
204
|
+
}), t(this, v).current && t(this, k) && history.pushState(history.state, "", t(this, p, lt)), t(this, a).set("beforeopen", !0), o(this, m, !0);
|
|
204
205
|
const s = () => {
|
|
205
206
|
L.stack.add(t(this, b).current, this), t(this, G).forEach((i) => {
|
|
206
207
|
i.scroll({
|
|
@@ -208,25 +209,25 @@ const L = class L extends HTMLElement {
|
|
|
208
209
|
left: 0,
|
|
209
210
|
behavior: "instant"
|
|
210
211
|
});
|
|
211
|
-
}),
|
|
212
|
+
}), f(this, p, M).call(this, !0, this.openClass), t(this, a).set("opened", !0), t(this, A).call(this), J(this, "popoverOpened", {
|
|
212
213
|
custom: !0,
|
|
213
214
|
detail: {
|
|
214
215
|
trigger: t(this, V)
|
|
215
216
|
},
|
|
216
217
|
bubbles: !0
|
|
217
|
-
}), o(this, P, void 0), o(this,
|
|
218
|
+
}), o(this, P, void 0), o(this, W, setTimeout(() => {
|
|
218
219
|
t(this, a).set("transitionend", !0);
|
|
219
220
|
}, ht(this) + 10));
|
|
220
221
|
};
|
|
221
|
-
e != null && e.skipTransition ? s() : o(this, P,
|
|
222
|
+
e != null && e.skipTransition ? s() : o(this, P, requestAnimationFrame(s));
|
|
222
223
|
}
|
|
223
224
|
close() {
|
|
224
|
-
t(this, m) && (o(this, m, !1),
|
|
225
|
+
t(this, m) && (o(this, m, !1), cancelAnimationFrame(t(this, P)), clearTimeout(t(this, W)), L.stack.remove(t(this, b).current, this), f(this, p, Q).call(this), f(this, p, M).call(this, !1, this.openClass), t(this, a).set("transitionend", !1), o(this, q, setTimeout(() => {
|
|
225
226
|
t(this, a).set("opened", !1), t(this, a).set("closing", !0), f(this, p, M).call(this, !0, this.closingClass), J(this, "popoverClosing", {
|
|
226
227
|
custom: !0,
|
|
227
228
|
bubbles: !0
|
|
228
|
-
}), o(this,
|
|
229
|
-
t(this, a).set("triggered", !1), t(this, a).set("closing", !1), f(this, p, M).call(this, !1, this.closingClass), J(this, "popoverClosed", {
|
|
229
|
+
}), o(this, H, setTimeout(() => {
|
|
230
|
+
t(this, a).set("triggered", !1), t(this, a).set("beforeopen", !1), t(this, a).set("closing", !1), f(this, p, M).call(this, !1, this.closingClass), J(this, "popoverClosed", {
|
|
230
231
|
custom: !0,
|
|
231
232
|
bubbles: !0
|
|
232
233
|
});
|
|
@@ -253,10 +254,10 @@ const L = class L extends HTMLElement {
|
|
|
253
254
|
disconnectedCallback() {
|
|
254
255
|
t(this, O).forEach((e) => {
|
|
255
256
|
e.removeEventListener("click", t(this, B));
|
|
256
|
-
}), L.stack.remove(t(this, b).current, this), nt.unsubscribe(t(this, A)), t(this, a).close(), t(this, v).close(), t(this, w).close(), t(this, x).close(), t(this, S).close(), t(this, b).close(), t(this, R).close(), t(this, $).close(), t(this, T).close(), this.removeAttribute("role"), clearTimeout(t(this,
|
|
257
|
+
}), L.stack.remove(t(this, b).current, this), nt.unsubscribe(t(this, A)), t(this, a).close(), t(this, v).close(), t(this, w).close(), t(this, x).close(), t(this, S).close(), t(this, b).close(), t(this, R).close(), t(this, $).close(), t(this, T).close(), this.removeAttribute("role"), clearTimeout(t(this, q)), clearTimeout(t(this, H)), clearTimeout(t(this, P)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, z)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), f(this, p, Q).call(this);
|
|
257
258
|
}
|
|
258
259
|
};
|
|
259
|
-
m = new WeakMap(),
|
|
260
|
+
m = new WeakMap(), q = new WeakMap(), H = new WeakMap(), P = new WeakMap(), W = new WeakMap(), v = new WeakMap(), w = new WeakMap(), x = new WeakMap(), S = new WeakMap(), b = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), k = new WeakMap(), V = new WeakMap(), a = new WeakMap(), O = new WeakMap(), G = new WeakMap(), p = new WeakSet(), lt = function() {
|
|
260
261
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
261
262
|
}, M = function(e, s) {
|
|
262
263
|
s && s.split(" ").map((i) => {
|
|
@@ -267,23 +268,23 @@ m = new WeakMap(), H = new WeakMap(), W = new WeakMap(), P = new WeakMap(), q =
|
|
|
267
268
|
const e = new URL(location.href);
|
|
268
269
|
e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
|
|
269
270
|
}
|
|
270
|
-
}, z = new WeakMap(), A = new WeakMap(),
|
|
271
|
+
}, z = new WeakMap(), A = new WeakMap(), D = new WeakMap(), U = new WeakMap(), B = new WeakMap(), L.stack = new dt();
|
|
271
272
|
let Z = L;
|
|
272
273
|
it && !customElements.get("e-popover") && customElements.define("e-popover", Z);
|
|
273
|
-
var n, g, C, et, Y, j,
|
|
274
|
+
var n, g, C, et, X, Y, j, I, st;
|
|
274
275
|
class ft extends HTMLElement {
|
|
275
276
|
constructor() {
|
|
276
277
|
super();
|
|
277
278
|
r(this, C);
|
|
278
279
|
r(this, n);
|
|
279
280
|
r(this, g, new E(this, "--type", "open"));
|
|
280
|
-
r(this,
|
|
281
|
+
r(this, X, () => {
|
|
281
282
|
t(this, g).current !== "close" && this.classList.add("triggered");
|
|
282
283
|
});
|
|
283
|
-
r(this,
|
|
284
|
+
r(this, Y, () => {
|
|
284
285
|
t(this, g).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
285
286
|
});
|
|
286
|
-
r(this,
|
|
287
|
+
r(this, j, () => {
|
|
287
288
|
t(this, g).current !== "close" && this.classList.remove("opened");
|
|
288
289
|
});
|
|
289
290
|
r(this, I, () => {
|
|
@@ -322,21 +323,21 @@ class ft extends HTMLElement {
|
|
|
322
323
|
const c = (d) => {
|
|
323
324
|
if (!d)
|
|
324
325
|
return null;
|
|
325
|
-
let
|
|
326
|
-
return !
|
|
326
|
+
let F = d.querySelector("[data-popover]");
|
|
327
|
+
return !F && (d != null && d.parentElement) && (F = c(d.parentElement)), F;
|
|
327
328
|
};
|
|
328
329
|
i = c(this.parentElement) || null;
|
|
329
330
|
} else
|
|
330
331
|
!e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
|
|
331
332
|
i instanceof HTMLElement ? (o(this, n, i), t(this, n).addEventListener(
|
|
332
333
|
"popoverTriggered",
|
|
333
|
-
t(this,
|
|
334
|
+
t(this, X)
|
|
334
335
|
), t(this, n).addEventListener(
|
|
335
336
|
"popoverOpened",
|
|
336
|
-
t(this,
|
|
337
|
+
t(this, Y)
|
|
337
338
|
), t(this, n).addEventListener(
|
|
338
339
|
"popoverClosing",
|
|
339
|
-
t(this,
|
|
340
|
+
t(this, j)
|
|
340
341
|
), t(this, n).addEventListener(
|
|
341
342
|
"popoverClosed",
|
|
342
343
|
t(this, I)
|
|
@@ -358,18 +359,18 @@ class ft extends HTMLElement {
|
|
|
358
359
|
n = new WeakMap(), g = new WeakMap(), C = new WeakSet(), et = function() {
|
|
359
360
|
t(this, n) && (t(this, n).removeEventListener(
|
|
360
361
|
"popoverTriggered",
|
|
361
|
-
t(this,
|
|
362
|
+
t(this, X)
|
|
362
363
|
), t(this, n).removeEventListener(
|
|
363
364
|
"popoverOpened",
|
|
364
|
-
t(this,
|
|
365
|
+
t(this, Y)
|
|
365
366
|
), t(this, n).removeEventListener(
|
|
366
367
|
"popoverClosing",
|
|
367
|
-
t(this,
|
|
368
|
+
t(this, j)
|
|
368
369
|
), t(this, n).removeEventListener(
|
|
369
370
|
"popoverClosed",
|
|
370
371
|
t(this, I)
|
|
371
372
|
));
|
|
372
|
-
},
|
|
373
|
+
}, X = new WeakMap(), Y = new WeakMap(), j = new WeakMap(), I = new WeakMap(), st = function(e) {
|
|
373
374
|
t(this, n) instanceof Z && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
374
375
|
"aria-expanded",
|
|
375
376
|
t(this, n).opened ? "true" : "false"
|