aptechka 0.65.7 → 0.65.9
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 +89 -88
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +13 -11
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Mt=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),xt=a=>{throw TypeError(a)};var pt=(a,t,s)=>t.has(a)||xt("Cannot "+s);var e=(a,t,s)=>(pt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),n=(a,t,s,i)=>(pt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),m=(a,t,s)=>(pt(a,t,"access private method"),s);var z=(a,t,s)=>new Promise((i,h)=>{var v=E=>{try{S(s.next(E))}catch(D){h(D)}},b=E=>{try{S(s.throw(E))}catch(D){h(D)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(a,t)).next())});var Ht=(a,t,s)=>(t=a[Mt("asyncIterator")])?t.call(a):(a=a[Mt("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=h.call(a,v),E=v.done,Promise.resolve(v.value).then(D=>b({value:D,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../index-DekP7OZe.cjs"),V=require("../events-KVanG9sR.cjs"),Wt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ot=require("../url-lnBE_6yf.cjs"),Yt=require("../css-value-parser/index.cjs");class Rt 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)}}Dt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Rt);var C,l,I,et,U;class Et{constructor(t,s){o(this,C);o(this,l);o(this,I);o(this,et,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{const h=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Yt.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),D=e(this,l).hasAttribute("data-keep-search-parameters"),ut=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(Y=>Y.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,I),{historyAction:h,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:D,submorph:ut,clearState:f})}});o(this,U,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,U))});n(this,C,s),n(this,l,t),n(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,et)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,U))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,I));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,et)),e(this,l).removeEventListener("pointerenter",e(this,U)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,I=new WeakMap,et=new WeakMap,U=new WeakMap;var x,$,L,O,B,H,K;class qt{constructor(t,s,i){o(this,x);o(this,$);o(this,L,{x:0,y:0});o(this,O);o(this,B,null);o(this,H,null);o(this,K,null);n(this,x,t),n(this,$,s),n(this,O,i.cloneNode(!0))}get pathname(){return e(this,$)}get scrollState(){return e(this,L)}get document(){return e(this,H)}cloneDocument(){n(this,H,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,H).title)t=e(this,H).title;else{const s=e(this,H).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,$)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,x).scrollValue.left,e(this,L).y=e(this,x).scrollValue.top)}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?n(this,B,null):n(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,K,t)}clearState(){const t=e(this,K);return n(this,K,null),t}}x=new WeakMap,$=new WeakMap,L=new WeakMap,O=new WeakMap,B=new WeakMap,H=new WeakMap,K=new WeakMap;var k,G,p,ct,N,d,st,F,T,P,it,q,W,J,Q,rt,c,lt,zt,St,Vt,vt,wt,yt,Lt,ht,Z;const tt=class tt{constructor(t){o(this,c);o(this,k,null);o(this,G,null);o(this,p,[]);o(this,ct,new DOMParser);o(this,N);o(this,d,null);o(this,st);o(this,F,[]);o(this,T,!1);o(this,P,null);o(this,it,!1);o(this,q,new Map);o(this,W,null);o(this,J,0);o(this,Q,0);o(this,rt,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"});o(this,ht,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,T,!1))}));o(this,Z,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Q),h=t-e(this,J);n(this,Q,s),n(this,J,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",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),V.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Dt.isBrowser&&!tt.instance){tt.instance=this,n(this,k,{base:ot.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,G,m(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);n(this,d,s.pathname),e(this,q).set(e(this,d),new qt(this,e(this,d),document)),document.documentElement.setAttribute("data-current-pathname",e(this,d)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ht)),ot.changeHistory({action:"replace",pathname:e(this,d),searchParameters:s.parameters||location.search,hash:s.hash}),n(this,W,new Rt),m(this,c,yt).call(this,document)}}get currentPathname(){return e(this,d)}get previousPathname(){return e(this,st)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}get scrollValue(){let t=0,s=0;return e(this,it)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,q).get(e(this,d));s&&s.saveState(t)}getState(){const t=e(this,q).get(e(this,d));return t==null?void 0:t.clearState()}normalizePath(t){return ot.splitPath(t,{base:e(this,k).base,trailingSlash:e(this,k).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,lt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(D){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var Pt;if(e(this,F).length)return;const ut=this.normalizePath(((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,t))||t);let{pathname:f,hash:Y,parameters:bt,leaf:It}=ut;if(e(this,N)===f||e(this,d)===f){e(this,T)||m(this,c,Lt).call(this,Y||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,N,f),e(this,p).forEach(X=>{X.checkCurrent(f)});try{let X=!0;if(this.preprocessor)try{yield new Promise((r,A)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:A,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),X=!1}if(!X||e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}const dt={pathname:f,submorph:S};V.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=yield m(this,c,lt).call(this,e(this,d)),w=yield m(this,c,lt).call(this,f,{searchParameters:bt,revalidate:v});if(e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,T)||(w.clearScrollState(),w.clearDocumentState()),E&&w.clearState(),w.cloneDocument(),e(this,W).textContent=w.title,document.body.appendChild(e(this,W)),V.dispatchEvent(document,"morphStart",{detail:dt});const kt=Array.from(document.head.children),At=Array.from(w.document.head.children),Ct=m(this,c,Vt).call(this,kt,At),Ot=m(this,c,vt).call(this,kt,Ct),nt=m(this,c,vt).call(this,At,Ct);nt.forEach((r,A)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),nt[A]=y}}),nt.forEach(r=>{document.head.appendChild(r)});const ft=nt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,wt).call(this,r))return!0});e(this,k).waitForHeadToLoad&&ft.length&&(yield new Promise(r=>z(this,null,function*(){let A=0;try{for(var y=Ht(ft),_,R,j;_=!(R=yield y.next()).done;_=!1){const at=R.value;at.onload=()=>{A++,A===ft.length&&r()}}}catch(R){j=[R]}finally{try{_&&(R=y.return)&&(yield R.call(y))}finally{if(j)throw j[0]}}}))),yield Nt.wait(10);const Tt=[];Ot.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,wt).call(this,r)?Tt.push(r):r.remove())});const Bt=m(this,c,St).call(this,w.document.body);e(this,k).morphInsideScrollContainer||m(this,c,yt).call(this,w.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",It),ot.changeHistory({action:s,pathname:f,searchParameters:bt||(b?location.search:""),hash:Y}),e(this,W).remove(),n(this,st,e(this,d)),n(this,d,f),e(this,G).forEach((r,A)=>{const y=Bt[A],_=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],j=[];S?S.forEach(u=>{const g=r.querySelector(u),M=y.querySelector(u);g&&M&&(j.push(g),R.push(M))}):(R.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),R.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),S?R.forEach((u,g)=>{var M;(M=j[g].parentElement)==null||M.insertBefore(u,j[g])}):r.prepend(...R),Wt.requestIdleCallback(()=>{R.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("in"))})});const at={morphElement:r,pathname:f};V.dispatchEvent(document,"morphNewChildrenAdded",{detail:at});const Ft=new Promise(u=>{setTimeout(()=>{j.forEach(g=>g.remove()),R.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),V.dispatchEvent(document,"morphOldChildrenRemoved",{detail:at}),u()},(parseFloat(_)||0)*1e3+10)});e(this,F).push(Ft)}),Y?(w.clearScrollState(),m(this,c,Lt).call(this,Y,{centerScroll:i,offsetScroll:h})):e(this,T)?w.restoreScrollPosition():w.renewScrollPosition(),V.dispatchEvent(document,"morphNavigationScroll",{detail:w.scrollState}),yield Promise.all(e(this,F)),Tt.forEach(r=>r.remove()),n(this,F,[]),e(this,G).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const _=document.createElement("script");_.type="module",_.src=y.getAttribute("src"),y.replaceWith(_)})}),V.dispatchEvent(document,"morphComplete",{detail:dt}),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}n(this,N,void 0)})}addLink(t){e(this,p).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,rt));e(this,p).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,rt));e(this,p).forEach(s=>s.destroy()),n(this,p,t.map(s=>new Et(s,this)))}};k=new WeakMap,G=new WeakMap,p=new WeakMap,ct=new WeakMap,N=new WeakMap,d=new WeakMap,st=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,it=new WeakMap,q=new WeakMap,W=new WeakMap,J=new WeakMap,Q=new WeakMap,rt=new WeakMap,c=new WeakSet,lt=function(t,s){return z(this,null,function*(){let i=e(this,q).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,zt).call(this,t,s==null?void 0:s.searchParameters)),i})},zt=function(t,s){return z(this,null,function*(){const h=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,ct).parseFromString(h,"text/html"),b=new qt(this,t,v);return e(this,q).set(t,b),b})},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Vt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Z)),n(this,Q,0),n(this,J,0),n(this,P,e(this,k).scrollSelector&&t.querySelector(e(this,k).scrollSelector)||window),n(this,it,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Z)),e(this,Z).call(this)},Lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ht=new WeakMap,Z=new WeakMap,tt.instance=null;let gt=tt;exports.Morph=gt;
|
|
1
|
+
"use strict";var Mt=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),xt=a=>{throw TypeError(a)};var pt=(a,t,s)=>t.has(a)||xt("Cannot "+s);var e=(a,t,s)=>(pt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),n=(a,t,s,i)=>(pt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),m=(a,t,s)=>(pt(a,t,"access private method"),s);var V=(a,t,s)=>new Promise((i,h)=>{var v=E=>{try{S(s.next(E))}catch(R){h(R)}},b=E=>{try{S(s.throw(E))}catch(R){h(R)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(a,t)).next())});var Ht=(a,t,s)=>(t=a[Mt("asyncIterator")])?t.call(a):(a=a[Mt("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=h.call(a,v),E=v.done,Promise.resolve(v.value).then(R=>b({value:R,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../index-DekP7OZe.cjs"),I=require("../events-KVanG9sR.cjs"),Wt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ot=require("../url-lnBE_6yf.cjs"),Yt=require("../css-value-parser/index.cjs");class Rt 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)}}Dt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Rt);var C,l,x,et,U;class Et{constructor(t,s){o(this,C);o(this,l);o(this,x);o(this,et,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,x,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Yt.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),R=e(this,l).hasAttribute("data-keep-search-parameters"),ut=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(Y=>Y.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,x),{historyAction:h,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:R,submorph:ut,clearState:f})}});o(this,U,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,x),t),e(this,l).removeEventListener("pointerenter",e(this,U))});n(this,C,s),n(this,l,t),n(this,x,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,et)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,U))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,x));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,et)),e(this,l).removeEventListener("pointerenter",e(this,U)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,x=new WeakMap,et=new WeakMap,U=new WeakMap;var H,$,L,O,B,N,K;class qt{constructor(t,s,i){o(this,H);o(this,$);o(this,L,{x:0,y:0});o(this,O);o(this,B,null);o(this,N,null);o(this,K,null);n(this,H,t),n(this,$,s),n(this,O,i.cloneNode(!0))}get pathname(){return e(this,$)}get scrollState(){return e(this,L)}get document(){return e(this,N)}cloneDocument(){n(this,N,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,$)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,H).scrollValue.left,e(this,L).y=e(this,H).scrollValue.top)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?n(this,B,null):n(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,K,t)}clearState(){const t=e(this,K);return n(this,K,null),t}}H=new WeakMap,$=new WeakMap,L=new WeakMap,O=new WeakMap,B=new WeakMap,N=new WeakMap,K=new WeakMap;var A,G,p,ct,q,d,st,F,T,P,it,D,W,J,Q,rt,c,lt,zt,St,Vt,vt,wt,yt,Lt,ht,Z;const tt=class tt{constructor(t){o(this,c);o(this,A,null);o(this,G,null);o(this,p,[]);o(this,ct,new DOMParser);o(this,q);o(this,d,null);o(this,st);o(this,F,[]);o(this,T,!1);o(this,P,null);o(this,it,!1);o(this,D,new Map);o(this,W,null);o(this,J,0);o(this,Q,0);o(this,rt,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"});o(this,ht,t=>V(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,T,!1))}));o(this,Z,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Q),h=t-e(this,J);n(this,Q,s),n(this,J,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",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),I.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Dt.isBrowser&&!tt.instance){tt.instance=this,n(this,A,{base:ot.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,G,m(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);n(this,d,s.pathname),e(this,D).set(e(this,d),new qt(this,e(this,d),document)),document.documentElement.setAttribute("data-current-pathname",e(this,d)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ht)),ot.changeHistory({action:"replace",pathname:e(this,d),searchParameters:s.parameters||location.search,hash:s.hash}),n(this,W,new Rt),m(this,c,yt).call(this,document)}}get currentPathname(){return e(this,d)}get previousPathname(){return e(this,st)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}get scrollValue(){let t=0,s=0;return e(this,it)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,D).get(e(this,d));s&&s.saveState(t)}getState(){const t=e(this,D).get(e(this,d));return t==null?void 0:t.clearState()}normalizePath(t){return ot.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return V(this,null,function*(){const i=this.normalizePath(t);m(this,c,lt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(R){return V(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var Pt;if(e(this,F).length)return;const ut=this.normalizePath(((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,t))||t);let{pathname:f,hash:Y,parameters:bt,leaf:It}=ut;if(e(this,q)===f||e(this,d)===f){e(this,T)||m(this,c,Lt).call(this,Y||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,q,f),e(this,p).forEach(X=>{X.checkCurrent(f)});try{let X=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:k,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),X=!1}if(!X||e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}const dt={pathname:f,submorph:S};I.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=yield m(this,c,lt).call(this,e(this,d)),w=yield m(this,c,lt).call(this,f,{searchParameters:bt,revalidate:v});if(e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,T)||(w.clearScrollState(),w.clearDocumentState()),E&&w.clearState(),w.cloneDocument(),e(this,W).textContent=w.title,document.body.appendChild(e(this,W)),I.dispatchEvent(document,"morphStart",{detail:dt});const At=Array.from(document.head.children),kt=Array.from(w.document.head.children),Ct=m(this,c,Vt).call(this,At,kt),Ot=m(this,c,vt).call(this,At,Ct),nt=m(this,c,vt).call(this,kt,Ct);nt.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),nt[k]=y}}),nt.forEach(r=>{document.head.appendChild(r)});const ft=nt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,wt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(r=>V(this,null,function*(){let k=0;try{for(var y=Ht(ft),_,z,j;_=!(z=yield y.next()).done;_=!1){const at=z.value;at.onload=()=>{k++,k===ft.length&&r()}}}catch(z){j=[z]}finally{try{_&&(z=y.return)&&(yield z.call(y))}finally{if(j)throw j[0]}}}))),yield Nt.wait(10);const Tt=[];Ot.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,wt).call(this,r)?Tt.push(r):r.remove())});const Bt=m(this,c,St).call(this,w.document.body);e(this,A).morphInsideScrollContainer||m(this,c,yt).call(this,w.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",It),ot.changeHistory({action:s,pathname:f,searchParameters:bt||(b?location.search:""),hash:Y}),e(this,W).remove(),n(this,st,e(this,d)),n(this,d,f),e(this,G).forEach((r,k)=>{const y=Bt[k],_=getComputedStyle(r).getPropertyValue("--morph-duration");let z=[],j=[];S?S.forEach(u=>{const g=r.querySelector(u),M=y.querySelector(u);g&&M&&(j.push(g),z.push(M))}):(z.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),z.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),S?z.forEach((u,g)=>{var M;(M=j[g].parentElement)==null||M.insertBefore(u,j[g])}):r.prepend(...z),Wt.requestIdleCallback(()=>{z.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("in"))})});const at={morphElement:r,pathname:f};I.dispatchEvent(document,"morphNewChildrenAdded",{detail:at});const Ft=new Promise(u=>{setTimeout(()=>{j.forEach(g=>g.remove()),z.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),I.dispatchEvent(document,"morphOldChildrenRemoved",{detail:at}),u()},(parseFloat(_)||0)*1e3+10)});e(this,F).push(Ft)}),Y?(w.clearScrollState(),m(this,c,Lt).call(this,Y,{centerScroll:i,offsetScroll:h})):e(this,T)?w.restoreScrollPosition():w.renewScrollPosition(),I.dispatchEvent(document,"morphNavigationScroll",{detail:w.scrollState}),yield Promise.all(e(this,F)),Tt.forEach(r=>r.remove()),n(this,F,[]),e(this,G).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const _=document.createElement("script");_.type="module",_.src=y.getAttribute("src"),y.replaceWith(_)})}),I.dispatchEvent(document,"morphComplete",{detail:dt}),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}n(this,q,void 0)})}addLink(t){e(this,p).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,rt));e(this,p).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,rt));e(this,p).forEach(s=>s.destroy()),n(this,p,t.map(s=>new Et(s,this)))}};A=new WeakMap,G=new WeakMap,p=new WeakMap,ct=new WeakMap,q=new WeakMap,d=new WeakMap,st=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,it=new WeakMap,D=new WeakMap,W=new WeakMap,J=new WeakMap,Q=new WeakMap,rt=new WeakMap,c=new WeakSet,lt=function(t,s){return V(this,null,function*(){let i=e(this,D).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,zt).call(this,t,s==null?void 0:s.searchParameters)),i})},zt=function(t,s){return V(this,null,function*(){const h=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,ct).parseFromString(h,"text/html"),b=new qt(this,t,v);return e(this,D).set(t,b),b})},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Vt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Z)),n(this,Q,0),n(this,J,0),n(this,P,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,it,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Z)),e(this,Z).call(this)},Lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ht=new WeakMap,Z=new WeakMap,tt.instance=null;let gt=tt;exports.Morph=gt;
|
package/lib/morph/index.js
CHANGED
|
@@ -3,25 +3,25 @@ var Ct = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Tt = (a) =>
|
|
|
3
3
|
};
|
|
4
4
|
var ft = (a, t, s) => t.has(a) || Tt("Cannot " + s);
|
|
5
5
|
var e = (a, t, s) => (ft(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), n = (a, t, s, i) => (ft(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), m = (a, t, s) => (ft(a, t, "access private method"), s);
|
|
6
|
-
var
|
|
6
|
+
var I = (a, t, s) => new Promise((i, h) => {
|
|
7
7
|
var w = (E) => {
|
|
8
8
|
try {
|
|
9
9
|
S(s.next(E));
|
|
10
|
-
} catch (
|
|
11
|
-
h(
|
|
10
|
+
} catch (q) {
|
|
11
|
+
h(q);
|
|
12
12
|
}
|
|
13
13
|
}, b = (E) => {
|
|
14
14
|
try {
|
|
15
15
|
S(s.throw(E));
|
|
16
|
-
} catch (
|
|
17
|
-
h(
|
|
16
|
+
} catch (q) {
|
|
17
|
+
h(q);
|
|
18
18
|
}
|
|
19
19
|
}, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(w, b);
|
|
20
20
|
S((s = s.apply(a, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var xt = (a, t, s) => (t = a[Ct("asyncIterator")]) ? t.call(a) : (a = a[Ct("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (w) => new Promise((b, S, E) => (w = h.call(a, w), E = w.done, Promise.resolve(w.value).then((
|
|
22
|
+
var xt = (a, t, s) => (t = a[Ct("asyncIterator")]) ? t.call(a) : (a = a[Ct("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (w) => new Promise((b, S, E) => (w = h.call(a, w), E = w.done, Promise.resolve(w.value).then((q) => b({ value: q, done: E }), S)))), s("next"), s("return"), t);
|
|
23
23
|
import { i as Dt } from "../index-Bv9zgfdb.js";
|
|
24
|
-
import { d as
|
|
24
|
+
import { d as V } from "../events-CsVF98U6.js";
|
|
25
25
|
import { r as Wt } from "../polyfills-DJrTJQky.js";
|
|
26
26
|
import { w as Bt, s as Yt } from "../scroll-DPkCFTxg.js";
|
|
27
27
|
import "construct-style-sheets-polyfill";
|
|
@@ -39,28 +39,29 @@ class Rt extends HTMLElement {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
Dt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Rt);
|
|
42
|
-
var C, l,
|
|
42
|
+
var C, l, M, et, $;
|
|
43
43
|
class pt {
|
|
44
44
|
constructor(t, s) {
|
|
45
45
|
o(this, C);
|
|
46
46
|
o(this, l);
|
|
47
|
-
o(this,
|
|
47
|
+
o(this, M);
|
|
48
48
|
o(this, et, (t) => {
|
|
49
49
|
var i;
|
|
50
50
|
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, C).previousPathname)
|
|
51
51
|
history.back();
|
|
52
52
|
else {
|
|
53
|
+
n(this, M, e(this, l).getAttribute("href") || "/");
|
|
53
54
|
const h = e(this, l).getAttribute(
|
|
54
55
|
"data-history-action"
|
|
55
|
-
) || "push", w = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? $t.parse(b) : void 0, E = e(this, l).hasAttribute("data-revalidate"),
|
|
56
|
+
) || "push", w = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? $t.parse(b) : void 0, E = e(this, l).hasAttribute("data-revalidate"), q = e(this, l).hasAttribute(
|
|
56
57
|
"data-keep-search-parameters"
|
|
57
58
|
), ht = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((Y) => Y.trim()), f = e(this, l).hasAttribute("data-clear-state");
|
|
58
|
-
e(this, C).navigate(e(this,
|
|
59
|
+
e(this, C).navigate(e(this, M), {
|
|
59
60
|
historyAction: h,
|
|
60
61
|
centerScroll: w,
|
|
61
62
|
offsetScroll: S,
|
|
62
63
|
revalidate: E,
|
|
63
|
-
keepSearchParameters:
|
|
64
|
+
keepSearchParameters: q,
|
|
64
65
|
submorph: ht,
|
|
65
66
|
clearState: f
|
|
66
67
|
});
|
|
@@ -68,33 +69,33 @@ class pt {
|
|
|
68
69
|
});
|
|
69
70
|
o(this, $, () => {
|
|
70
71
|
const t = e(this, l).hasAttribute("data-revalidate");
|
|
71
|
-
e(this, C).prefetch(e(this,
|
|
72
|
+
e(this, C).prefetch(e(this, M), t), e(this, l).removeEventListener("pointerenter", e(this, $));
|
|
72
73
|
});
|
|
73
|
-
n(this, C, s), n(this, l, t), n(this,
|
|
74
|
+
n(this, C, s), n(this, l, t), n(this, M, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, et)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, $));
|
|
74
75
|
}
|
|
75
76
|
get element() {
|
|
76
77
|
return e(this, l);
|
|
77
78
|
}
|
|
78
79
|
checkCurrent(t) {
|
|
79
|
-
const s = e(this, C).normalizePath(t), i = e(this, C).normalizePath(e(this,
|
|
80
|
+
const s = e(this, C).normalizePath(t), i = e(this, C).normalizePath(e(this, M));
|
|
80
81
|
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");
|
|
81
82
|
}
|
|
82
83
|
destroy() {
|
|
83
84
|
e(this, l).removeEventListener("click", e(this, et)), e(this, l).removeEventListener("pointerenter", e(this, $)), e(this, l).classList.remove("current");
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
C = new WeakMap(), l = new WeakMap(),
|
|
87
|
-
var
|
|
87
|
+
C = new WeakMap(), l = new WeakMap(), M = new WeakMap(), et = new WeakMap(), $ = new WeakMap();
|
|
88
|
+
var H, j, L, F, O, N, K;
|
|
88
89
|
class Ht {
|
|
89
90
|
constructor(t, s, i) {
|
|
90
|
-
o(this,
|
|
91
|
+
o(this, H);
|
|
91
92
|
o(this, j);
|
|
92
93
|
o(this, L, { x: 0, y: 0 });
|
|
93
94
|
o(this, F);
|
|
94
95
|
o(this, O, null);
|
|
95
|
-
o(this,
|
|
96
|
+
o(this, N, null);
|
|
96
97
|
o(this, K, null);
|
|
97
|
-
n(this,
|
|
98
|
+
n(this, H, t), n(this, j, s), n(this, F, i.cloneNode(!0));
|
|
98
99
|
}
|
|
99
100
|
get pathname() {
|
|
100
101
|
return e(this, j);
|
|
@@ -103,17 +104,17 @@ class Ht {
|
|
|
103
104
|
return e(this, L);
|
|
104
105
|
}
|
|
105
106
|
get document() {
|
|
106
|
-
return e(this,
|
|
107
|
+
return e(this, N);
|
|
107
108
|
}
|
|
108
109
|
cloneDocument() {
|
|
109
|
-
n(this,
|
|
110
|
+
n(this, N, (e(this, O) || e(this, F)).cloneNode(!0));
|
|
110
111
|
}
|
|
111
112
|
get title() {
|
|
112
113
|
let t = "";
|
|
113
|
-
if (e(this,
|
|
114
|
-
t = e(this,
|
|
114
|
+
if (e(this, N).title)
|
|
115
|
+
t = e(this, N).title;
|
|
115
116
|
else {
|
|
116
|
-
const s = e(this,
|
|
117
|
+
const s = e(this, N).querySelector("h1");
|
|
117
118
|
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, j);
|
|
118
119
|
}
|
|
119
120
|
return t;
|
|
@@ -127,10 +128,10 @@ class Ht {
|
|
|
127
128
|
saveScrollState() {
|
|
128
129
|
e(this, F).documentElement.hasAttribute(
|
|
129
130
|
"data-no-scroll-restoration"
|
|
130
|
-
) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this,
|
|
131
|
+
) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, H).scrollValue.left, e(this, L).y = e(this, H).scrollValue.top);
|
|
131
132
|
}
|
|
132
133
|
restoreScrollPosition() {
|
|
133
|
-
e(this,
|
|
134
|
+
e(this, H).scrollElement.scroll({
|
|
134
135
|
top: e(this, L).y,
|
|
135
136
|
left: e(this, L).x,
|
|
136
137
|
behavior: "instant"
|
|
@@ -142,7 +143,7 @@ class Ht {
|
|
|
142
143
|
) ? n(this, O, null) : n(this, O, document.cloneNode(!0));
|
|
143
144
|
}
|
|
144
145
|
renewScrollPosition() {
|
|
145
|
-
e(this,
|
|
146
|
+
e(this, H).scrollElement.scroll({
|
|
146
147
|
top: 0,
|
|
147
148
|
left: 0,
|
|
148
149
|
behavior: "instant"
|
|
@@ -156,23 +157,23 @@ class Ht {
|
|
|
156
157
|
return n(this, K, null), t;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
-
var
|
|
160
|
+
H = new WeakMap(), j = new WeakMap(), L = new WeakMap(), F = new WeakMap(), O = new WeakMap(), N = new WeakMap(), K = new WeakMap();
|
|
161
|
+
var A, G, p, lt, D, d, st, W, T, P, it, R, B, J, Q, rt, c, ot, qt, Et, zt, gt, St, wt, vt, ct, Z;
|
|
161
162
|
const tt = class tt {
|
|
162
163
|
constructor(t) {
|
|
163
164
|
o(this, c);
|
|
164
|
-
o(this,
|
|
165
|
+
o(this, A, null);
|
|
165
166
|
o(this, G, null);
|
|
166
167
|
o(this, p, []);
|
|
167
168
|
o(this, lt, new DOMParser());
|
|
168
|
-
o(this,
|
|
169
|
+
o(this, D);
|
|
169
170
|
o(this, d, null);
|
|
170
171
|
o(this, st);
|
|
171
172
|
o(this, W, []);
|
|
172
173
|
o(this, T, !1);
|
|
173
174
|
o(this, P, null);
|
|
174
175
|
o(this, it, !1);
|
|
175
|
-
o(this,
|
|
176
|
+
o(this, R, /* @__PURE__ */ new Map());
|
|
176
177
|
o(this, B, null);
|
|
177
178
|
o(this, J, 0);
|
|
178
179
|
o(this, Q, 0);
|
|
@@ -180,7 +181,7 @@ const tt = class tt {
|
|
|
180
181
|
var s;
|
|
181
182
|
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";
|
|
182
183
|
});
|
|
183
|
-
o(this, ct, (t) =>
|
|
184
|
+
o(this, ct, (t) => I(this, null, function* () {
|
|
184
185
|
var s;
|
|
185
186
|
(s = t.state) != null && s.path && (t.preventDefault(), n(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, T, !1));
|
|
186
187
|
}));
|
|
@@ -198,7 +199,7 @@ const tt = class tt {
|
|
|
198
199
|
), document.documentElement.classList.toggle(
|
|
199
200
|
"scroll-x-backward",
|
|
200
201
|
h < 0
|
|
201
|
-
),
|
|
202
|
+
), V(document, "morphScroll", {
|
|
202
203
|
detail: {
|
|
203
204
|
left: t,
|
|
204
205
|
top: s
|
|
@@ -206,7 +207,7 @@ const tt = class tt {
|
|
|
206
207
|
});
|
|
207
208
|
});
|
|
208
209
|
if (Dt && !tt.instance) {
|
|
209
|
-
tt.instance = this, n(this,
|
|
210
|
+
tt.instance = this, n(this, A, {
|
|
210
211
|
base: Xt(t == null ? void 0 : t.base),
|
|
211
212
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
212
213
|
cachePages: (t == null ? void 0 : t.cachePages) !== !1,
|
|
@@ -217,7 +218,7 @@ const tt = class tt {
|
|
|
217
218
|
const s = this.normalizePath(
|
|
218
219
|
location.pathname + location.hash
|
|
219
220
|
);
|
|
220
|
-
n(this, d, s.pathname), e(this,
|
|
221
|
+
n(this, d, s.pathname), e(this, R).set(
|
|
221
222
|
e(this, d),
|
|
222
223
|
new Ht(this, e(this, d), document)
|
|
223
224
|
), document.documentElement.setAttribute(
|
|
@@ -254,21 +255,21 @@ const tt = class tt {
|
|
|
254
255
|
return e(this, it) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, P).scrollTop, s = e(this, P).scrollLeft), { top: t, left: s };
|
|
255
256
|
}
|
|
256
257
|
saveState(t) {
|
|
257
|
-
const s = e(this,
|
|
258
|
+
const s = e(this, R).get(e(this, d));
|
|
258
259
|
s && s.saveState(t);
|
|
259
260
|
}
|
|
260
261
|
getState() {
|
|
261
|
-
const t = e(this,
|
|
262
|
+
const t = e(this, R).get(e(this, d));
|
|
262
263
|
return t == null ? void 0 : t.clearState();
|
|
263
264
|
}
|
|
264
265
|
normalizePath(t) {
|
|
265
266
|
return Ut(t, {
|
|
266
|
-
base: e(this,
|
|
267
|
-
trailingSlash: e(this,
|
|
267
|
+
base: e(this, A).base,
|
|
268
|
+
trailingSlash: e(this, A).trailingSlash
|
|
268
269
|
});
|
|
269
270
|
}
|
|
270
271
|
prefetch(t, s) {
|
|
271
|
-
return
|
|
272
|
+
return I(this, null, function* () {
|
|
272
273
|
const i = this.normalizePath(t);
|
|
273
274
|
m(this, c, ot).call(this, i.pathname, {
|
|
274
275
|
searchParameters: i.parameters,
|
|
@@ -276,8 +277,8 @@ const tt = class tt {
|
|
|
276
277
|
});
|
|
277
278
|
});
|
|
278
279
|
}
|
|
279
|
-
navigate(
|
|
280
|
-
return
|
|
280
|
+
navigate(q) {
|
|
281
|
+
return I(this, arguments, function* (t, {
|
|
281
282
|
historyAction: s = "push",
|
|
282
283
|
centerScroll: i,
|
|
283
284
|
offsetScroll: h,
|
|
@@ -291,7 +292,7 @@ const tt = class tt {
|
|
|
291
292
|
return;
|
|
292
293
|
const ht = this.normalizePath(((Lt = this.pathnameModifier) == null ? void 0 : Lt.call(this, t)) || t);
|
|
293
294
|
let { pathname: f, hash: Y, parameters: yt, leaf: It } = ht;
|
|
294
|
-
if (e(this,
|
|
295
|
+
if (e(this, D) === f || e(this, d) === f) {
|
|
295
296
|
e(this, T) || m(this, c, vt).call(this, Y || 0, {
|
|
296
297
|
centerScroll: i,
|
|
297
298
|
offsetScroll: h,
|
|
@@ -299,26 +300,26 @@ const tt = class tt {
|
|
|
299
300
|
});
|
|
300
301
|
return;
|
|
301
302
|
}
|
|
302
|
-
n(this,
|
|
303
|
+
n(this, D, f), e(this, p).forEach((X) => {
|
|
303
304
|
X.checkCurrent(f);
|
|
304
305
|
});
|
|
305
306
|
try {
|
|
306
307
|
let X = !0;
|
|
307
308
|
if (this.preprocessor)
|
|
308
309
|
try {
|
|
309
|
-
yield new Promise((r,
|
|
310
|
+
yield new Promise((r, k) => {
|
|
310
311
|
var y;
|
|
311
312
|
(y = this.preprocessor) == null || y.call(this, {
|
|
312
313
|
pathname: f,
|
|
313
314
|
resolve: r,
|
|
314
|
-
reject:
|
|
315
|
+
reject: k,
|
|
315
316
|
submorph: S
|
|
316
317
|
});
|
|
317
318
|
});
|
|
318
319
|
} catch (r) {
|
|
319
320
|
r ? console.error(r) : console.log("Route change canceled"), X = !1;
|
|
320
321
|
}
|
|
321
|
-
if (!X || e(this,
|
|
322
|
+
if (!X || e(this, D) !== f) {
|
|
322
323
|
e(this, p).forEach((r) => {
|
|
323
324
|
r.checkCurrent(e(this, d));
|
|
324
325
|
});
|
|
@@ -328,27 +329,27 @@ const tt = class tt {
|
|
|
328
329
|
pathname: f,
|
|
329
330
|
submorph: S
|
|
330
331
|
};
|
|
331
|
-
|
|
332
|
+
V(document, "morphNavigation", {
|
|
332
333
|
detail: ut
|
|
333
334
|
});
|
|
334
335
|
const dt = yield m(this, c, ot).call(this, e(this, d)), v = yield m(this, c, ot).call(this, f, {
|
|
335
336
|
searchParameters: yt,
|
|
336
337
|
revalidate: w
|
|
337
338
|
});
|
|
338
|
-
if (e(this,
|
|
339
|
+
if (e(this, D) !== f) {
|
|
339
340
|
e(this, p).forEach((r) => {
|
|
340
341
|
r.checkCurrent(e(this, d));
|
|
341
342
|
});
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
344
|
-
dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, T) || (v.clearScrollState(), v.clearDocumentState()), E && v.clearState(), v.cloneDocument(), e(this, B).textContent = v.title, document.body.appendChild(e(this, B)),
|
|
345
|
+
dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, T) || (v.clearScrollState(), v.clearDocumentState()), E && v.clearState(), v.cloneDocument(), e(this, B).textContent = v.title, document.body.appendChild(e(this, B)), V(document, "morphStart", {
|
|
345
346
|
detail: ut
|
|
346
347
|
});
|
|
347
|
-
const bt = Array.from(document.head.children), Pt = Array.from(v.document.head.children),
|
|
348
|
-
nt.forEach((r,
|
|
348
|
+
const bt = Array.from(document.head.children), Pt = Array.from(v.document.head.children), At = m(this, c, zt).call(this, bt, Pt), Vt = m(this, c, gt).call(this, bt, At), nt = m(this, c, gt).call(this, Pt, At);
|
|
349
|
+
nt.forEach((r, k) => {
|
|
349
350
|
if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
|
|
350
351
|
const y = document.createElement("script");
|
|
351
|
-
y.type = "module", y.src = r.getAttribute("src"), nt[
|
|
352
|
+
y.type = "module", y.src = r.getAttribute("src"), nt[k] = y;
|
|
352
353
|
}
|
|
353
354
|
}), nt.forEach((r) => {
|
|
354
355
|
document.head.appendChild(r);
|
|
@@ -359,54 +360,54 @@ const tt = class tt {
|
|
|
359
360
|
if (m(this, c, St).call(this, r))
|
|
360
361
|
return !0;
|
|
361
362
|
});
|
|
362
|
-
e(this,
|
|
363
|
-
let
|
|
363
|
+
e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((r) => I(this, null, function* () {
|
|
364
|
+
let k = 0;
|
|
364
365
|
try {
|
|
365
|
-
for (var y = xt(mt), _,
|
|
366
|
-
const at =
|
|
366
|
+
for (var y = xt(mt), _, z, U; _ = !(z = yield y.next()).done; _ = !1) {
|
|
367
|
+
const at = z.value;
|
|
367
368
|
at.onload = () => {
|
|
368
|
-
|
|
369
|
+
k++, k === mt.length && r();
|
|
369
370
|
};
|
|
370
371
|
}
|
|
371
|
-
} catch (
|
|
372
|
-
U = [
|
|
372
|
+
} catch (z) {
|
|
373
|
+
U = [z];
|
|
373
374
|
} finally {
|
|
374
375
|
try {
|
|
375
|
-
_ && (
|
|
376
|
+
_ && (z = y.return) && (yield z.call(y));
|
|
376
377
|
} finally {
|
|
377
378
|
if (U)
|
|
378
379
|
throw U[0];
|
|
379
380
|
}
|
|
380
381
|
}
|
|
381
382
|
}))), yield Bt(10);
|
|
382
|
-
const
|
|
383
|
+
const kt = [];
|
|
383
384
|
Vt.forEach((r) => {
|
|
384
|
-
r.hasAttribute("data-permanent") || (m(this, c, St).call(this, r) ?
|
|
385
|
+
r.hasAttribute("data-permanent") || (m(this, c, St).call(this, r) ? kt.push(r) : r.remove());
|
|
385
386
|
});
|
|
386
387
|
const Ft = m(this, c, Et).call(this, v.document.body);
|
|
387
|
-
e(this,
|
|
388
|
+
e(this, A).morphInsideScrollContainer || m(this, c, wt).call(this, v.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", It), Mt({
|
|
388
389
|
action: s,
|
|
389
390
|
pathname: f,
|
|
390
391
|
searchParameters: yt || (b ? location.search : ""),
|
|
391
392
|
hash: Y
|
|
392
|
-
}), e(this, B).remove(), n(this, st, e(this, d)), n(this, d, f), e(this, G).forEach((r,
|
|
393
|
-
const y = Ft[
|
|
394
|
-
let
|
|
393
|
+
}), e(this, B).remove(), n(this, st, e(this, d)), n(this, d, f), e(this, G).forEach((r, k) => {
|
|
394
|
+
const y = Ft[k], _ = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
395
|
+
let z = [], U = [];
|
|
395
396
|
S ? S.forEach((u) => {
|
|
396
397
|
const g = r.querySelector(u), x = y.querySelector(u);
|
|
397
|
-
g && x && (U.push(g),
|
|
398
|
-
}) : (
|
|
398
|
+
g && x && (U.push(g), z.push(x));
|
|
399
|
+
}) : (z.push(...y.childNodes), U.push(...r.childNodes)), U.forEach((u) => {
|
|
399
400
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
400
|
-
}),
|
|
401
|
+
}), z.forEach((u) => {
|
|
401
402
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
402
|
-
}), S ?
|
|
403
|
+
}), S ? z.forEach((u, g) => {
|
|
403
404
|
var x;
|
|
404
405
|
(x = U[g].parentElement) == null || x.insertBefore(
|
|
405
406
|
u,
|
|
406
407
|
U[g]
|
|
407
408
|
);
|
|
408
|
-
}) : r.prepend(...
|
|
409
|
-
|
|
409
|
+
}) : r.prepend(...z), Wt(() => {
|
|
410
|
+
z.forEach((u) => {
|
|
410
411
|
var g;
|
|
411
412
|
u instanceof HTMLElement && ((g = u.parentElement) == null || g.style.setProperty(
|
|
412
413
|
"--new-content-height",
|
|
@@ -418,36 +419,36 @@ const tt = class tt {
|
|
|
418
419
|
morphElement: r,
|
|
419
420
|
pathname: f
|
|
420
421
|
};
|
|
421
|
-
|
|
422
|
+
V(document, "morphNewChildrenAdded", {
|
|
422
423
|
detail: at
|
|
423
424
|
});
|
|
424
425
|
const Ot = new Promise((u) => {
|
|
425
426
|
setTimeout(() => {
|
|
426
|
-
U.forEach((g) => g.remove()),
|
|
427
|
+
U.forEach((g) => g.remove()), z.forEach((g) => {
|
|
427
428
|
var x;
|
|
428
429
|
g instanceof HTMLElement && ((x = g.parentElement) == null || x.style.removeProperty(
|
|
429
430
|
"--new-content-height"
|
|
430
431
|
), g.classList.remove("in", "new"));
|
|
431
|
-
}),
|
|
432
|
+
}), V(document, "morphOldChildrenRemoved", {
|
|
432
433
|
detail: at
|
|
433
434
|
}), u();
|
|
434
435
|
}, (parseFloat(_) || 0) * 1e3 + 10);
|
|
435
436
|
});
|
|
436
437
|
e(this, W).push(Ot);
|
|
437
|
-
}), Y ? (v.clearScrollState(), m(this, c, vt).call(this, Y, { centerScroll: i, offsetScroll: h })) : e(this, T) ? v.restoreScrollPosition() : v.renewScrollPosition(),
|
|
438
|
+
}), Y ? (v.clearScrollState(), m(this, c, vt).call(this, Y, { centerScroll: i, offsetScroll: h })) : e(this, T) ? v.restoreScrollPosition() : v.renewScrollPosition(), V(document, "morphNavigationScroll", {
|
|
438
439
|
detail: v.scrollState
|
|
439
|
-
}), yield Promise.all(e(this, W)),
|
|
440
|
+
}), yield Promise.all(e(this, W)), kt.forEach((r) => r.remove()), n(this, W, []), e(this, G).forEach((r) => {
|
|
440
441
|
r.querySelectorAll("script").forEach((y) => {
|
|
441
442
|
const _ = document.createElement("script");
|
|
442
443
|
_.type = "module", _.src = y.getAttribute("src"), y.replaceWith(_);
|
|
443
444
|
});
|
|
444
|
-
}),
|
|
445
|
+
}), V(document, "morphComplete", {
|
|
445
446
|
detail: ut
|
|
446
447
|
}), window.dispatchEvent(new Event("resize"));
|
|
447
448
|
} catch (X) {
|
|
448
449
|
console.error(X);
|
|
449
450
|
}
|
|
450
|
-
n(this,
|
|
451
|
+
n(this, D, void 0);
|
|
451
452
|
});
|
|
452
453
|
}
|
|
453
454
|
addLink(t) {
|
|
@@ -479,17 +480,17 @@ const tt = class tt {
|
|
|
479
480
|
e(this, p).forEach((s) => s.destroy()), n(this, p, t.map((s) => new pt(s, this)));
|
|
480
481
|
}
|
|
481
482
|
};
|
|
482
|
-
|
|
483
|
-
return
|
|
484
|
-
let i = e(this,
|
|
483
|
+
A = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), D = new WeakMap(), d = new WeakMap(), st = new WeakMap(), W = new WeakMap(), T = new WeakMap(), P = new WeakMap(), it = new WeakMap(), R = new WeakMap(), B = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), rt = new WeakMap(), c = new WeakSet(), ot = function(t, s) {
|
|
484
|
+
return I(this, null, function* () {
|
|
485
|
+
let i = e(this, R).get(t);
|
|
485
486
|
return (!i || s != null && s.revalidate) && (i = yield m(this, c, qt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
|
|
486
487
|
});
|
|
487
488
|
}, qt = function(t, s) {
|
|
488
|
-
return
|
|
489
|
+
return I(this, null, function* () {
|
|
489
490
|
const h = yield (yield fetch(
|
|
490
491
|
`${t}${s ? "?" + s : ""}`
|
|
491
492
|
)).text(), w = e(this, lt).parseFromString(h, "text/html"), b = new Ht(this, t, w);
|
|
492
|
-
return e(this,
|
|
493
|
+
return e(this, R).set(t, b), b;
|
|
493
494
|
});
|
|
494
495
|
}, Et = function(t) {
|
|
495
496
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
@@ -513,7 +514,7 @@ k = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), N =
|
|
|
513
514
|
(s = e(this, P)) == null || s.removeEventListener(
|
|
514
515
|
"scroll",
|
|
515
516
|
e(this, Z)
|
|
516
|
-
), n(this, Q, 0), n(this, J, 0), n(this, P, e(this,
|
|
517
|
+
), n(this, Q, 0), n(this, J, 0), n(this, P, e(this, A).scrollSelector && t.querySelector(e(this, A).scrollSelector) || window), n(this, it, e(this, P) === window), (i = e(this, P)) == null || i.addEventListener("scroll", e(this, Z)), e(this, Z).call(this);
|
|
517
518
|
}, vt = function(t, s) {
|
|
518
519
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
519
520
|
(typeof i == "number" || i) && Yt(i, {
|
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=e=>{throw TypeError(e)};var
|
|
1
|
+
"use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var r=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-D_YeNqsI.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const b=require("../index-DekP7OZe.cjs"),p=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var i,a,n;class d extends E.SourceElement{constructor(){super(...arguments);u(this,i,0);u(this,a,!1);u(this,n,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>r(this,i)&&c(this,i,t),p.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:r(this,i)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(r(this,n)),r(this,a)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,a,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,a,!0)),o.ticker.subscribe(r(this,n))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(r(this,n)),c(this,i,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.hasAttribute("volume")&&(this.consumerElement.volume=parseFloat(this.getAttribute("volume")||"1"))}}i=new WeakMap,a=new WeakMap,n=new WeakMap;b.isBrowser&&!customElements.get("e-video")&&customElements.define("e-video",d);exports.VideoElement=d;
|
package/lib/video/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var r = (e, s, t) => (
|
|
4
|
+
var h = (e, s, t) => s.has(e) || l("Cannot " + t);
|
|
5
|
+
var r = (e, s, t) => (h(e, s, "read from private field"), t ? t.call(e) : s.get(e)), c = (e, s, t) => s.has(e) ? l("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), n = (e, s, t, m) => (h(e, s, "write to private field"), m ? m.call(e, t) : s.set(e, t), t);
|
|
6
6
|
import { a as d } from "../SourceElement-jbviggZp.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-0BVty6AZ.js";
|
|
@@ -10,26 +10,26 @@ import { i as p } from "../index-Bv9zgfdb.js";
|
|
|
10
10
|
import { d as E } from "../events-CsVF98U6.js";
|
|
11
11
|
import "construct-style-sheets-polyfill";
|
|
12
12
|
import { ticker as u } from "../ticker/index.js";
|
|
13
|
-
var i, a,
|
|
13
|
+
var i, a, o;
|
|
14
14
|
class f extends d {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
c(this, i, 0);
|
|
18
18
|
c(this, a, !1);
|
|
19
|
-
c(this,
|
|
19
|
+
c(this, o, () => {
|
|
20
20
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
21
21
|
const t = this.consumerElement.readyState / 4;
|
|
22
|
-
t > r(this, i) &&
|
|
22
|
+
t > r(this, i) && n(this, i, t), E(this, "videoReadyStateChange", {
|
|
23
23
|
detail: {
|
|
24
24
|
readyState: this.consumerElement.readyState,
|
|
25
25
|
progress: r(this, i)
|
|
26
26
|
}
|
|
27
|
-
}), this.consumerElement.readyState === 4 && (u.unsubscribe(r(this,
|
|
27
|
+
}), this.consumerElement.readyState === 4 && (u.unsubscribe(r(this, o)), r(this, a) && this.sourceManager.current && this.consumerElement.play());
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
connectedCallback() {
|
|
31
31
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
32
|
-
|
|
32
|
+
n(this, a, !1), this.hasAttribute("capture-autoplay") && (this.sourceManager.current ? this.consumerElement.play() : n(this, a, !0)), u.subscribe(r(this, o));
|
|
33
33
|
}), this.addEventListener("sourceRelease", () => {
|
|
34
34
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
35
35
|
"state-0",
|
|
@@ -41,16 +41,18 @@ class f extends d {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
disconnectedCallback() {
|
|
44
|
-
super.disconnectedCallback(), u.unsubscribe(r(this,
|
|
44
|
+
super.disconnectedCallback(), u.unsubscribe(r(this, o)), n(this, i, 0);
|
|
45
45
|
}
|
|
46
46
|
createConsumer() {
|
|
47
47
|
return document.createElement("video");
|
|
48
48
|
}
|
|
49
49
|
consumeSource(t) {
|
|
50
|
-
this.consumerElement.src = t || ""
|
|
50
|
+
this.consumerElement.src = t || "", this.hasAttribute("volume") && (this.consumerElement.volume = parseFloat(
|
|
51
|
+
this.getAttribute("volume") || "1"
|
|
52
|
+
));
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
i = new WeakMap(), a = new WeakMap(),
|
|
55
|
+
i = new WeakMap(), a = new WeakMap(), o = new WeakMap();
|
|
54
56
|
p && !customElements.get("e-video") && customElements.define("e-video", f);
|
|
55
57
|
export {
|
|
56
58
|
f as VideoElement
|