aptechka 0.64.8 → 0.65.0

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.
@@ -8,8 +8,8 @@ import { g as Z } from "./dom-CVWzyXPH.js";
8
8
  import "construct-style-sheets-polyfill";
9
9
  import { ticker as D } from "./ticker/index.js";
10
10
  import "./Store-0BVty6AZ.js";
11
- import { a as ee } from "./easings-BEmRlrDd.js";
12
- import { T as te } from "./Tweened-_pF0zXXN.js";
11
+ import { a as ee } from "./easings-DngMp9IN.js";
12
+ import { T as te } from "./Tweened-CtbUoAvI.js";
13
13
  import { s as ie } from "./gestures-CcXV6fCp.js";
14
14
  import { p as se } from "./number-CbdpfO3u.js";
15
15
  import { TICK_ORDER as he } from "./order/index.js";
@@ -15,7 +15,7 @@ var c = (a, r, e) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writab
15
15
  }, g = (a, r) => b(a, x(r));
16
16
  var A = (a, r, e) => r.has(a) || f("Cannot " + e);
17
17
  var s = (a, r, e) => (A(a, r, "read from private field"), e ? e.call(a) : r.get(a)), n = (a, r, e) => r.has(a) ? f("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, e), u = (a, r, e, i) => (A(a, r, "write to private field"), i ? i.call(a, e) : r.set(a, e), e);
18
- import { l as h, e as T } from "./easings-BEmRlrDd.js";
18
+ import { l as h, e as T } from "./easings-DngMp9IN.js";
19
19
  import { c as q } from "./math-BOBiC4TN.js";
20
20
  import { p as w } from "./number-CbdpfO3u.js";
21
21
  import { n as z } from "./polyfills-DJrTJQky.js";
@@ -1,6 +1,6 @@
1
1
  import { A as r } from "../Animation-D29tc5VS.js";
2
2
  import { D as m } from "../Damped-YrqW5V4w.js";
3
- import { T as t } from "../Tweened-_pF0zXXN.js";
3
+ import { T as t } from "../Tweened-CtbUoAvI.js";
4
4
  export {
5
5
  r as Animation,
6
6
  m as Damped,
@@ -1 +1 @@
1
- "use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../index-DekP7OZe.cjs"),K=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");const M=require("../css-property/index.cjs"),W=require("../events-KVanG9sR.cjs"),X=require("../gestures-C7gbKx11.cjs"),Y=require("../math-GDWEqu7y.cjs"),Z=require("../number-DyefJ5a1.cjs");var P,k,f,E,L,S,o,h,u,$,A,_,B,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,P,new M.CSSProperty(this,"--resize",!0));s(this,k,new M.CSSProperty(this,"--loop",!0));s(this,f,new M.CSSProperty(this,"--autoplay",!1));s(this,E,new M.CSSProperty(this,"--swipe","x"));s(this,L);s(this,S,!1);s(this,o,[]);s(this,h,0);s(this,A,e=>{d(this,S,e.isIntersecting),t(this,S)?m(this,u,$).call(this):clearInterval(t(this,L))});s(this,_,()=>{clearInterval(t(this,L)),t(this,S)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,u,B).call(this,t(this,h)+1)});s(this,F,e=>{if(!t(this,E).current)return;let n=0;X.setupDrag(l=>{const a=e.x-l.x,x=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(x)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(x)>Math.abs(a)&&Math.abs(x)>10&&(n=Math.sign(x))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,k)}get autoplay(){return t(this,f)}get swipe(){return t(this,E)}get itemElements(){return t(this,o)}addItem(e){t(this,o).push(e),m(this,u,B).call(this)}set(e){(!this.handleSet||this.handleSet(e))&&(m(this,u,B).call(this,e),m(this,u,$).call(this))}shift(e){this.set(t(this,h)+e)}connectedCallback(){var e;d(this,o,[...this.querySelectorAll(`[data-billboard-item${this.id?`="${this.id}"`:""}]`)]),(e=t(this,o)[0])==null||e.classList.add("current"),t(this,f).subscribe(n=>{n.current?(I.intersector.subscribe(this,t(this,A)),m(this,u,$).call(this)):(d(this,S,!0),I.intersector.unsubscribe(t(this,A)),clearInterval(t(this,L)),m(this,u,B).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,k).observe(),t(this,P).observe(),m(this,u,B).call(this,0),this.addEventListener("pointerdown",t(this,F))}disconnectedCallback(){t(this,f).unobserve(),t(this,E).unobserve(),t(this,k).unobserve(),t(this,P).unobserve(),I.intersector.unsubscribe(t(this,A)),clearInterval(t(this,L))}}P=new WeakMap,k=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,S=new WeakMap,o=new WeakMap,h=new WeakMap,u=new WeakSet,$=function(){t(this,f).current!==!1&&t(this,_).call(this)},A=new WeakMap,_=new WeakMap,B=function(e=t(this,h)){const n=t(this,h);t(this,k).current?d(this,h,Z.loopNumber(e,t(this,o).length)):d(this,h,Y.clamp(e,0,t(this,o).length-1)),this.classList.remove("forward","backward"),t(this,h)-n>=0?this.classList.add("forward"):t(this,h)-n<0&&this.classList.add("backward"),t(this,o).forEach((l,a)=>{l.classList.remove("current","previous","next"),a===t(this,h)?l.classList.add("current"):a<t(this,h)?l.classList.add("previous"):a>t(this,h)&&l.classList.add("next")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,h)===0),this.classList.toggle("end",t(this,h)===t(this,o).length-1),this.style.setProperty("--counter",t(this,h).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,h)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,h)}}),t(this,P).current&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0))},j=new WeakMap,F=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",z);var b,T,p,H,q;class R extends HTMLElement{constructor(){super(...arguments);s(this,b,null);s(this,T,null);s(this,p,[]);s(this,H,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,b).set(l)});s(this,q,()=>{t(this,p).forEach((e,n)=>{n===t(this,b).counter?e.classList.add("current"):e.classList.remove("current")})})}connectedCallback(){return J(this,null,function*(){var e;if(d(this,b,K.findParentElement(this,z)),t(this,b)&&(yield customElements.whenDefined("e-billboard"),this.isConnected)){this.innerHTML="";const n=t(this,b).itemElements.length;d(this,T,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${l+1}`),t(this,p).push(a),t(this,T).appendChild(a)}this.appendChild(t(this,T)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,H))}),(e=t(this,b))==null||e.addEventListener("billboardChange",t(this,q)),t(this,q).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,H))}),(e=t(this,b))==null||e.removeEventListener("billboardChange",t(this,q)),this.innerHTML="",d(this,p,[])}}b=new WeakMap,T=new WeakMap,p=new WeakMap,H=new WeakMap,q=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,w;class U extends HTMLElement{constructor(){super();s(this,v,new M.CSSProperty(this,"--index",0));s(this,g,null);s(this,w,()=>{var e;t(this,v).current===((e=t(this,g))==null?void 0:e.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",e=>{t(this,g)&&(!this.handleClick||this.handleClick(e))&&t(this,g).set(t(this,v).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){var e;this.tabIndex=0,d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,w)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,w).call(this)}),t(this,v).subscribe(t(this,w)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,v).unsubscribe(t(this,w)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,w))}}v=new WeakMap,g=new WeakMap,w=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var C,c,D;class V extends HTMLElement{constructor(){super();s(this,C,new M.CSSProperty(this,"--step",1));s(this,c,null);s(this,D,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,C).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,C).current>=0)?this.setAttribute("disabled",""):this.removeAttribute("disabled"))});this.addEventListener("click",e=>{t(this,c)&&(!this.handleClick||this.handleClick(e))&&t(this,c).shift(t(this,C).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),t(this,C).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,D)),setTimeout(()=>{t(this,D).call(this)},0)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,C).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,D))}}C=new WeakMap,c=new WeakMap,D=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",V);exports.BillboardBulletsElement=R;exports.BillboardElement=z;exports.BillboardSetButtonElement=U;exports.BillboardStepButtonElement=V;
1
+ "use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("../index-DekP7OZe.cjs"),K=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");const B=require("../css-property/index.cjs"),W=require("../events-KVanG9sR.cjs"),X=require("../gestures-C7gbKx11.cjs"),Y=require("../math-GDWEqu7y.cjs"),Z=require("../number-DyefJ5a1.cjs");var P,k,f,E,L,S,o,h,b,$,I,_,A,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,b);s(this,P,new B.CSSProperty(this,"--resize",!0));s(this,k,new B.CSSProperty(this,"--loop",!0));s(this,f,new B.CSSProperty(this,"--autoplay",!1));s(this,E,new B.CSSProperty(this,"--swipe","x"));s(this,L);s(this,S,!1);s(this,o,[]);s(this,h,0);s(this,I,e=>{d(this,S,e.isIntersecting),t(this,S)?m(this,b,$).call(this):clearInterval(t(this,L))});s(this,_,()=>{clearInterval(t(this,L)),t(this,S)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,b,A).call(this,t(this,h)+1)});s(this,F,e=>{if(!t(this,E).current)return;let n=0;X.setupDrag(l=>{const a=e.x-l.x,x=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(x)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(x)>Math.abs(a)&&Math.abs(x)>10&&(n=Math.sign(x))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,k)}get autoplay(){return t(this,f)}get swipe(){return t(this,E)}get itemElements(){return t(this,o)}addItem(e){t(this,o).push(e),m(this,b,A).call(this)}set(e){(!this.handleSet||this.handleSet(e))&&(m(this,b,A).call(this,e),m(this,b,$).call(this))}shift(e){this.set(t(this,h)+e)}connectedCallback(){var e;d(this,o,[...this.querySelectorAll(`[data-billboard-item${this.id?`="${this.id}"`:""}]`)]),(e=t(this,o)[0])==null||e.classList.add("current"),t(this,f).subscribe(n=>{n.current?(M.intersector.subscribe(this,t(this,I)),m(this,b,$).call(this)):(d(this,S,!0),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L)),m(this,b,A).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,k).observe(),t(this,P).observe(),m(this,b,A).call(this,0),this.addEventListener("pointerdown",t(this,F))}disconnectedCallback(){t(this,f).unobserve(),t(this,E).unobserve(),t(this,k).unobserve(),t(this,P).unobserve(),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L))}}P=new WeakMap,k=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,S=new WeakMap,o=new WeakMap,h=new WeakMap,b=new WeakSet,$=function(){t(this,f).current!==!1&&t(this,_).call(this)},I=new WeakMap,_=new WeakMap,A=function(e=t(this,h)){const n=t(this,h);t(this,k).current?d(this,h,Z.loopNumber(e,t(this,o).length)):d(this,h,Y.clamp(e,0,t(this,o).length-1)),this.classList.remove("forward","backward"),t(this,h)-n>=0?this.classList.add("forward"):t(this,h)-n<0&&this.classList.add("backward"),t(this,o).forEach((l,a)=>{l.classList.remove("current","previous","next"),a===t(this,h)?l.classList.add("current"):a<t(this,h)?l.classList.add("previous"):a>t(this,h)&&l.classList.add("next")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,h)===0),this.classList.toggle("end",t(this,h)===t(this,o).length-1),this.style.setProperty("--counter",t(this,h).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,h)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,h)}}),t(this,P).current&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0))},j=new WeakMap,F=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",z);var u,T,p,H,q;class R extends HTMLElement{constructor(){super(...arguments);s(this,u,null);s(this,T,null);s(this,p,[]);s(this,H,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,u).set(l)});s(this,q,()=>{t(this,p).forEach((e,n)=>{n===t(this,u).counter?e.classList.add("current"):e.classList.remove("current")})})}connectedCallback(){return J(this,null,function*(){var e;if(d(this,u,K.findParentElement(this,z)),t(this,u)&&(yield customElements.whenDefined("e-billboard"),this.isConnected)){this.innerHTML="";const n=t(this,u).itemElements.length;d(this,T,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${l+1}`),t(this,p).push(a),t(this,T).appendChild(a)}this.appendChild(t(this,T)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,H))}),(e=t(this,u))==null||e.addEventListener("billboardChange",t(this,q)),t(this,q).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,H))}),(e=t(this,u))==null||e.removeEventListener("billboardChange",t(this,q)),this.innerHTML="",d(this,p,[])}}u=new WeakMap,T=new WeakMap,p=new WeakMap,H=new WeakMap,q=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,w;class U extends HTMLElement{constructor(){super();s(this,v,new B.CSSProperty(this,"--index",0));s(this,g,null);s(this,w,()=>{var e;t(this,v).current===((e=t(this,g))==null?void 0:e.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",e=>{t(this,g)&&(!this.handleClick||this.handleClick(e))&&t(this,g).set(t(this,v).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){var e;this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,w)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,w).call(this)}),t(this,v).subscribe(t(this,w)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,v).unsubscribe(t(this,w)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,w))}}v=new WeakMap,g=new WeakMap,w=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var C,c,D;class V extends HTMLElement{constructor(){super();s(this,C,new B.CSSProperty(this,"--step",1));s(this,c,null);s(this,D,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,C).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,C).current>=0)?this.setAttribute("disabled",""):this.removeAttribute("disabled"))});this.addEventListener("click",e=>{t(this,c)&&(!this.handleClick||this.handleClick(e))&&t(this,c).shift(t(this,C).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),t(this,C).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,D)),setTimeout(()=>{t(this,D).call(this)},0)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,C).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,D))}}C=new WeakMap,c=new WeakMap,D=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",V);exports.BillboardBulletsElement=R;exports.BillboardElement=z;exports.BillboardSetButtonElement=U;exports.BillboardStepButtonElement=V;
@@ -10,32 +10,32 @@ var K = (i, r, e) => new Promise((n, l) => {
10
10
  } catch (j) {
11
11
  l(j);
12
12
  }
13
- }, M = (C) => {
13
+ }, A = (C) => {
14
14
  try {
15
15
  N(e.throw(C));
16
16
  } catch (j) {
17
17
  l(j);
18
18
  }
19
- }, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a, M);
19
+ }, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a, A);
20
20
  N((e = e.apply(i, r)).next());
21
21
  });
22
22
  import { a as O, i as Q } from "../index-Bv9zgfdb.js";
23
23
  import { b as R } from "../dom-CVWzyXPH.js";
24
24
  import "construct-style-sheets-polyfill";
25
- import { CSSProperty as S } from "../css-property/index.js";
25
+ import { CSSProperty as I } from "../css-property/index.js";
26
26
  import { d as V } from "../events-CsVF98U6.js";
27
27
  import { s as W } from "../gestures-CcXV6fCp.js";
28
28
  import { c as X } from "../math-BOBiC4TN.js";
29
29
  import { l as Y } from "../number-CbdpfO3u.js";
30
- var A, x, f, p, L, y, o, h, b, z, T, $, I, q, F;
30
+ var S, x, f, p, L, y, o, h, b, z, T, $, M, q, F;
31
31
  class G extends HTMLElement {
32
32
  constructor() {
33
33
  super(...arguments);
34
34
  s(this, b);
35
- s(this, A, new S(this, "--resize", !0));
36
- s(this, x, new S(this, "--loop", !0));
37
- s(this, f, new S(this, "--autoplay", !1));
38
- s(this, p, new S(this, "--swipe", "x"));
35
+ s(this, S, new I(this, "--resize", !0));
36
+ s(this, x, new I(this, "--loop", !0));
37
+ s(this, f, new I(this, "--autoplay", !1));
38
+ s(this, p, new I(this, "--swipe", "x"));
39
39
  s(this, L);
40
40
  s(this, y, !1);
41
41
  s(this, o, []);
@@ -50,7 +50,7 @@ class G extends HTMLElement {
50
50
  ));
51
51
  });
52
52
  s(this, q, () => {
53
- m(this, b, I).call(this, t(this, h) + 1);
53
+ m(this, b, M).call(this, t(this, h) + 1);
54
54
  });
55
55
  s(this, F, (e) => {
56
56
  if (!t(this, p).current)
@@ -58,8 +58,8 @@ class G extends HTMLElement {
58
58
  let n = 0;
59
59
  W(
60
60
  (l) => {
61
- const a = e.x - l.x, M = e.y - l.y;
62
- t(this, p).current === "x" ? Math.abs(a) > Math.abs(M) && Math.abs(a) > 10 && (n = Math.sign(a)) : t(this, p).current === "y" && Math.abs(M) > Math.abs(a) && Math.abs(M) > 10 && (n = Math.sign(M));
61
+ const a = e.x - l.x, A = e.y - l.y;
62
+ t(this, p).current === "x" ? Math.abs(a) > Math.abs(A) && Math.abs(a) > 10 && (n = Math.sign(a)) : t(this, p).current === "y" && Math.abs(A) > Math.abs(a) && Math.abs(A) > 10 && (n = Math.sign(A));
63
63
  },
64
64
  () => {
65
65
  n && this.shift(n);
@@ -83,10 +83,10 @@ class G extends HTMLElement {
83
83
  return t(this, o);
84
84
  }
85
85
  addItem(e) {
86
- t(this, o).push(e), m(this, b, I).call(this);
86
+ t(this, o).push(e), m(this, b, M).call(this);
87
87
  }
88
88
  set(e) {
89
- (!this.handleSet || this.handleSet(e)) && (m(this, b, I).call(this, e), m(this, b, z).call(this));
89
+ (!this.handleSet || this.handleSet(e)) && (m(this, b, M).call(this, e), m(this, b, z).call(this));
90
90
  }
91
91
  shift(e) {
92
92
  this.set(t(this, h) + e);
@@ -98,16 +98,16 @@ class G extends HTMLElement {
98
98
  `[data-billboard-item${this.id ? `="${this.id}"` : ""}]`
99
99
  )
100
100
  ]), (e = t(this, o)[0]) == null || e.classList.add("current"), t(this, f).subscribe((n) => {
101
- n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b, I).call(this, 0));
102
- }), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this, A).observe(), m(this, b, I).call(this, 0), this.addEventListener("pointerdown", t(this, F));
101
+ n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b, M).call(this, 0));
102
+ }), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this, S).observe(), m(this, b, M).call(this, 0), this.addEventListener("pointerdown", t(this, F));
103
103
  }
104
104
  disconnectedCallback() {
105
- t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this, A).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
105
+ t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this, S).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
106
106
  }
107
107
  }
108
- A = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(), y = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakSet(), z = function() {
108
+ S = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(), y = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakSet(), z = function() {
109
109
  t(this, f).current !== !1 && t(this, $).call(this);
110
- }, T = new WeakMap(), $ = new WeakMap(), I = function(e = t(this, h)) {
110
+ }, T = new WeakMap(), $ = new WeakMap(), M = function(e = t(this, h)) {
111
111
  const n = t(this, h);
112
112
  t(this, x).current ? d(this, h, Y(e, t(this, o).length)) : d(this, h, X(e, 0, t(this, o).length - 1)), this.classList.remove("forward", "backward"), t(this, h) - n >= 0 ? this.classList.add("forward") : t(this, h) - n < 0 && this.classList.add("backward"), t(this, o).forEach((l, a) => {
113
113
  l.classList.remove("current", "previous", "next"), a === t(this, h) ? l.classList.add("current") : a < t(this, h) ? l.classList.add("previous") : a > t(this, h) && l.classList.add("next");
@@ -118,7 +118,7 @@ A = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L =
118
118
  detail: {
119
119
  counter: t(this, h)
120
120
  }
121
- }), t(this, A).current && setTimeout(() => {
121
+ }), t(this, S).current && setTimeout(() => {
122
122
  window.dispatchEvent(new Event("resize"));
123
123
  }, 0));
124
124
  }, q = new WeakMap(), F = new WeakMap();
@@ -176,7 +176,7 @@ var E, g, w;
176
176
  class _ extends HTMLElement {
177
177
  constructor() {
178
178
  super();
179
- s(this, E, new S(this, "--index", 0));
179
+ s(this, E, new I(this, "--index", 0));
180
180
  s(this, g, null);
181
181
  s(this, w, () => {
182
182
  var e;
@@ -190,7 +190,7 @@ class _ extends HTMLElement {
190
190
  }
191
191
  connectedCallback() {
192
192
  var e;
193
- this.tabIndex = 0, d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
193
+ this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
194
194
  "billboardChange",
195
195
  t(this, w)
196
196
  ), customElements.whenDefined("e-billboard").then(() => {
@@ -199,7 +199,7 @@ class _ extends HTMLElement {
199
199
  }
200
200
  disconnectedCallback() {
201
201
  var e;
202
- this.removeAttribute("tabindex"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
202
+ this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
203
203
  "billboardChange",
204
204
  t(this, w)
205
205
  );
@@ -211,7 +211,7 @@ var k, c, H;
211
211
  class tt extends HTMLElement {
212
212
  constructor() {
213
213
  super();
214
- s(this, k, new S(this, "--step", 1));
214
+ s(this, k, new I(this, "--step", 1));
215
215
  s(this, c, null);
216
216
  s(this, H, () => {
217
217
  t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this, k).current <= 0 || t(this, c).counter === t(this, c).itemElements.length - 1 && t(this, k).current >= 0) ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"));
@@ -225,7 +225,7 @@ class tt extends HTMLElement {
225
225
  connectedCallback() {
226
226
  return K(this, null, function* () {
227
227
  var e;
228
- yield customElements.whenDefined("e-billboard"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
228
+ yield customElements.whenDefined("e-billboard"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
229
229
  "billboardChange",
230
230
  t(this, H)
231
231
  ), setTimeout(() => {
@@ -235,7 +235,7 @@ class tt extends HTMLElement {
235
235
  }
236
236
  disconnectedCallback() {
237
237
  var e;
238
- this.removeAttribute("tabindex"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
238
+ this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
239
239
  "billboardChange",
240
240
  t(this, H)
241
241
  );
@@ -1,4 +1,4 @@
1
- import { A as r, C as a, D as l, K as t, W as C } from "../DragControls-DGDUw6bM.js";
1
+ import { A as r, C as a, D as l, K as t, W as C } from "../DragControls-DNwpgJ9b.js";
2
2
  export {
3
3
  r as AutoplayControls,
4
4
  a as Controls,
@@ -0,0 +1,20 @@
1
+ import { whenDefined } from '../utils';
2
+ export type CustomElementDisconnectCallback = () => void;
3
+ export type CustomElementConnectCallback = () => void | CustomElementDisconnectCallback;
4
+ export interface CustomElementAttributeChangeCallbackEntry {
5
+ name: string;
6
+ oldValue: string | null;
7
+ newValue: string;
8
+ }
9
+ export type CustomElementAttributeChangeCallback = (entry: CustomElementAttributeChangeCallbackEntry) => void;
10
+ export type CustomElementQueryCallback<T extends Element = Element> = (element: T) => void | CustomElementDisconnectCallback;
11
+ export declare class CustomElement extends HTMLElement {
12
+ #private;
13
+ protected dependsOn(...args: Parameters<typeof whenDefined>): void;
14
+ protected onConnect(callback: CustomElementConnectCallback): void;
15
+ protected onDisconnect(callback: CustomElementDisconnectCallback): void;
16
+ protected onAttributeChange(callback: CustomElementAttributeChangeCallback): void;
17
+ protected connectedCallback(): Promise<void>;
18
+ protected disconnectedCallback(): void;
19
+ protected attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
20
+ }
@@ -1 +1 @@
1
- "use strict";var v=l=>{throw TypeError(l)};var k=(l,o,s)=>o.has(l)||v("Cannot "+s);var t=(l,o,s)=>(k(l,o,"read from private field"),s?s.call(l):o.get(l)),h=(l,o,s)=>o.has(l)?v("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,s),c=(l,o,s,e)=>(k(l,o,"write to private field"),e?e.call(l,s):o.set(l,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("../index-DekP7OZe.cjs"),H=require("../dom-JBOkFLTh.cjs"),w=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const E=require("../ticker/index.cjs");var i,n,m,a,r,d,f,y,p,u,g;class T extends HTMLElement{constructor(){super(...arguments);h(this,i,null);h(this,n,null);h(this,m,0);h(this,a,0);h(this,r,!1);h(this,d);h(this,f,()=>{this.classList.add("active"),clearTimeout(t(this,d));const e=(t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop)/t(this,a)*t(this,m);t(this,r)?t(this,n).style.transform=`translate3d(${e}px, 0px, 0px)`:t(this,n).style.transform=`translate3d(0px, ${e}px, 0px)`,c(this,d,setTimeout(()=>{this.classList.remove("active")},1e3))});h(this,y,()=>{const s=t(this,r)?this.offsetWidth:this.offsetHeight;c(this,a,t(this,r)?t(this,i).scrollWidth-t(this,i).offsetWidth:t(this,i).scrollHeight-t(this,i).offsetHeight);let e=s*s/(t(this,a)+s);e=Math.max(e,30),t(this,r)?(t(this,n).style.width=e+"px",t(this,n).style.height="100%"):(t(this,n).style.width="100%",t(this,n).style.height=e+"px"),c(this,m,s-e),t(this,r)&&!(t(this,i).scrollWidth>t(this,i).offsetWidth)||!t(this,r)&&!(t(this,i).scrollHeight>t(this,i).offsetHeight)?this.style.display="none":this.style.display="block"});h(this,p,s=>{document.documentElement.classList.add("grabbing");const e=t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop,b=t(this,r)?s.x:s.y;w.setupDrag(x=>{const q=t(this,a)/t(this,m),S=(t(this,r)?x.x-b:x.y-b)*q;t(this,r)?t(this,i).scroll({left:e+S,behavior:"instant"}):t(this,i).scroll({top:e+S,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});h(this,u,()=>{t(this,y).call(this)});h(this,g,s=>{s.isIntersecting?(E.ticker.subscribe(t(this,u),{maxFPS:5}),t(this,u).call(this)):E.ticker.unsubscribe(t(this,u))})}connectedCallback(){const s=this.getAttribute("data-scroll");c(this,r,this.hasAttribute("horisontal"));let e=null;s&&(s==="parent"?e=this.parentElement:e=document.querySelector(s)),e||(e=H.findScrollParentElement(this));const b=this.querySelector("[data-thumb]");e&&b&&(c(this,i,e),c(this,n,b),t(this,i).addEventListener("scroll",t(this,f)),t(this,n).addEventListener("pointerdown",t(this,p)),L.intersector.subscribe(this.parentElement,t(this,g)))}disconnectedCallback(){t(this,i).removeEventListener("scroll",t(this,f)),t(this,n).removeEventListener("pointerdown",t(this,p)),clearTimeout(t(this,d)),L.intersector.unsubscribe(t(this,g)),E.ticker.unsubscribe(t(this,u))}}i=new WeakMap,n=new WeakMap,m=new WeakMap,a=new WeakMap,r=new WeakMap,d=new WeakMap,f=new WeakMap,y=new WeakMap,p=new WeakMap,u=new WeakMap,g=new WeakMap;L.isBrowser&&!customElements.get("e-custom-scrollbar")&&customElements.define("e-custom-scrollbar",T);exports.CustomScrollbarElement=T;
1
+ "use strict";var T=n=>{throw TypeError(n)};var W=(n,l,e)=>l.has(n)||T("Cannot "+e);var t=(n,l,e)=>(W(n,l,"read from private field"),e?e.call(n):l.get(n)),r=(n,l,e)=>l.has(n)?T("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,e),u=(n,l,e,s)=>(W(n,l,"write to private field"),s?s.call(n,e):l.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../index-DekP7OZe.cjs"),q=require("../dom-JBOkFLTh.cjs"),P=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const x=require("../ticker/index.cjs");var i,c,f,a,o,g,h,H,z,k,E,L,y,b,p;class w extends HTMLElement{constructor(){super(...arguments);r(this,h);r(this,i,null);r(this,c,null);r(this,f,0);r(this,a,0);r(this,o,!1);r(this,g);r(this,E,()=>{this.classList.add("active"),clearTimeout(t(this,g));const s=t(this,h,H)/t(this,a)*t(this,f);t(this,o)?t(this,c).style.transform=`translate3d(${s}px, 0px, 0px)`:t(this,c).style.transform=`translate3d(0px, ${s}px, 0px)`,u(this,g,setTimeout(()=>{this.classList.remove("active")},1e3))});r(this,L,()=>{const e=t(this,o)?this.offsetWidth:this.offsetHeight,s=t(this,h,z),m=t(this,h,k);u(this,a,s-m);let d=e*e/(t(this,a)+e);d=Math.max(d,30),t(this,o)?(t(this,c).style.width=d+"px",t(this,c).style.height="100%"):(t(this,c).style.width="100%",t(this,c).style.height=d+"px"),u(this,f,e-d),s<=m?this.style.display="none":this.style.display="block"});r(this,y,e=>{document.documentElement.classList.add("grabbing");const s=t(this,h,H),m=t(this,o)?e.x:e.y;P.setupDrag(d=>{const M=t(this,a)/t(this,f),v=(t(this,o)?d.x-m:d.y-m)*M;t(this,o)?t(this,i).scroll({left:s+v,behavior:"instant"}):t(this,i).scroll({top:s+v,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});r(this,b,()=>{t(this,L).call(this)});r(this,p,e=>{e.isIntersecting?(x.ticker.subscribe(t(this,b),{maxFPS:5}),t(this,b).call(this)):x.ticker.unsubscribe(t(this,b))})}connectedCallback(){const e=this.getAttribute("data-scroll");u(this,o,this.hasAttribute("horisontal"));let s=null;e&&(e==="parent"?s=this.parentElement:s=document.querySelector(e)),s||(s=q.findScrollParentElement(this),s===document.body&&(s=window));const m=this.querySelector("[data-thumb]");s&&m&&(u(this,i,s),u(this,c,m),t(this,i).addEventListener("scroll",t(this,E)),t(this,c).addEventListener("pointerdown",t(this,y)),S.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,p)))}disconnectedCallback(){t(this,i).removeEventListener("scroll",t(this,E)),t(this,c).removeEventListener("pointerdown",t(this,y)),clearTimeout(t(this,g)),S.intersector.unsubscribe(t(this,p)),x.ticker.unsubscribe(t(this,b))}}i=new WeakMap,c=new WeakMap,f=new WeakMap,a=new WeakMap,o=new WeakMap,g=new WeakMap,h=new WeakSet,H=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).scrollLeft:t(this,i).scrollTop:t(this,o)?t(this,i).scrollX:t(this,i).scrollY},z=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).scrollWidth:t(this,i).scrollHeight:t(this,o)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},k=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).offsetWidth:t(this,i).offsetHeight:t(this,o)?innerWidth:innerHeight},E=new WeakMap,L=new WeakMap,y=new WeakMap,b=new WeakMap,p=new WeakMap;S.isBrowser&&!customElements.get("e-custom-scrollbar")&&customElements.define("e-custom-scrollbar",w);exports.CustomScrollbarElement=w;
@@ -1,47 +1,48 @@
1
- var v = (l) => {
2
- throw TypeError(l);
1
+ var v = (o) => {
2
+ throw TypeError(o);
3
3
  };
4
- var S = (l, h, s) => h.has(l) || v("Cannot " + s);
5
- var t = (l, h, s) => (S(l, h, "read from private field"), s ? s.call(l) : h.get(l)), r = (l, h, s) => h.has(l) ? v("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(l) : h.set(l, s), c = (l, h, s, i) => (S(l, h, "write to private field"), i ? i.call(l, s) : h.set(l, s), s);
6
- import { i as k, a as H } from "../index-Bv9zgfdb.js";
7
- import { f as w } from "../dom-CVWzyXPH.js";
8
- import { s as z } from "../gestures-CcXV6fCp.js";
4
+ var W = (o, n, e) => n.has(o) || v("Cannot " + e);
5
+ var t = (o, n, e) => (W(o, n, "read from private field"), e ? e.call(o) : n.get(o)), r = (o, n, e) => n.has(o) ? v("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, e), a = (o, n, e, s) => (W(o, n, "write to private field"), s ? s.call(o, e) : n.set(o, e), e);
6
+ import { i as k, a as w } from "../index-Bv9zgfdb.js";
7
+ import { f as P } from "../dom-CVWzyXPH.js";
8
+ import { s as C } from "../gestures-CcXV6fCp.js";
9
9
  import "construct-style-sheets-polyfill";
10
- import { ticker as E } from "../ticker/index.js";
11
- var e, n, u, a, o, d, b, L, p, m, g;
12
- class W extends HTMLElement {
10
+ import { ticker as x } from "../ticker/index.js";
11
+ var i, h, b, u, l, p, c, H, z, T, E, L, g, f, y;
12
+ class q extends HTMLElement {
13
13
  constructor() {
14
14
  super(...arguments);
15
- r(this, e, null);
16
- r(this, n, null);
15
+ r(this, c);
16
+ r(this, i, null);
17
+ r(this, h, null);
18
+ r(this, b, 0);
17
19
  r(this, u, 0);
18
- r(this, a, 0);
19
- r(this, o, !1);
20
- r(this, d);
21
- r(this, b, () => {
22
- this.classList.add("active"), clearTimeout(t(this, d));
23
- const i = (t(this, o) ? t(this, e).scrollLeft : t(this, e).scrollTop) / t(this, a) * t(this, u);
24
- t(this, o) ? t(this, n).style.transform = `translate3d(${i}px, 0px, 0px)` : t(this, n).style.transform = `translate3d(0px, ${i}px, 0px)`, c(this, d, setTimeout(() => {
20
+ r(this, l, !1);
21
+ r(this, p);
22
+ r(this, E, () => {
23
+ this.classList.add("active"), clearTimeout(t(this, p));
24
+ const s = t(this, c, H) / t(this, u) * t(this, b);
25
+ t(this, l) ? t(this, h).style.transform = `translate3d(${s}px, 0px, 0px)` : t(this, h).style.transform = `translate3d(0px, ${s}px, 0px)`, a(this, p, setTimeout(() => {
25
26
  this.classList.remove("active");
26
27
  }, 1e3));
27
28
  });
28
29
  r(this, L, () => {
29
- const s = t(this, o) ? this.offsetWidth : this.offsetHeight;
30
- c(this, a, t(this, o) ? t(this, e).scrollWidth - t(this, e).offsetWidth : t(this, e).scrollHeight - t(this, e).offsetHeight);
31
- let i = s * s / (t(this, a) + s);
32
- i = Math.max(i, 30), t(this, o) ? (t(this, n).style.width = i + "px", t(this, n).style.height = "100%") : (t(this, n).style.width = "100%", t(this, n).style.height = i + "px"), c(this, u, s - i), t(this, o) && !(t(this, e).scrollWidth > t(this, e).offsetWidth) || !t(this, o) && !(t(this, e).scrollHeight > t(this, e).offsetHeight) ? this.style.display = "none" : this.style.display = "block";
30
+ const e = t(this, l) ? this.offsetWidth : this.offsetHeight, s = t(this, c, z), m = t(this, c, T);
31
+ a(this, u, s - m);
32
+ let d = e * e / (t(this, u) + e);
33
+ d = Math.max(d, 30), t(this, l) ? (t(this, h).style.width = d + "px", t(this, h).style.height = "100%") : (t(this, h).style.width = "100%", t(this, h).style.height = d + "px"), a(this, b, e - d), s <= m ? this.style.display = "none" : this.style.display = "block";
33
34
  });
34
- r(this, p, (s) => {
35
+ r(this, g, (e) => {
35
36
  document.documentElement.classList.add("grabbing");
36
- const i = t(this, o) ? t(this, e).scrollLeft : t(this, e).scrollTop, f = t(this, o) ? s.x : s.y;
37
- z(
38
- (x) => {
39
- const T = t(this, a) / t(this, u), y = (t(this, o) ? x.x - f : x.y - f) * T;
40
- t(this, o) ? t(this, e).scroll({
41
- left: i + y,
37
+ const s = t(this, c, H), m = t(this, l) ? e.x : e.y;
38
+ C(
39
+ (d) => {
40
+ const M = t(this, u) / t(this, b), S = (t(this, l) ? d.x - m : d.y - m) * M;
41
+ t(this, l) ? t(this, i).scroll({
42
+ left: s + S,
42
43
  behavior: "instant"
43
- }) : t(this, e).scroll({
44
- top: i + y,
44
+ }) : t(this, i).scroll({
45
+ top: s + S,
45
46
  behavior: "instant"
46
47
  });
47
48
  },
@@ -50,27 +51,50 @@ class W extends HTMLElement {
50
51
  }
51
52
  );
52
53
  });
53
- r(this, m, () => {
54
+ r(this, f, () => {
54
55
  t(this, L).call(this);
55
56
  });
56
- r(this, g, (s) => {
57
- s.isIntersecting ? (E.subscribe(t(this, m), { maxFPS: 5 }), t(this, m).call(this)) : E.unsubscribe(t(this, m));
57
+ r(this, y, (e) => {
58
+ e.isIntersecting ? (x.subscribe(t(this, f), { maxFPS: 5 }), t(this, f).call(this)) : x.unsubscribe(t(this, f));
58
59
  });
59
60
  }
60
61
  connectedCallback() {
61
- const s = this.getAttribute("data-scroll");
62
- c(this, o, this.hasAttribute("horisontal"));
63
- let i = null;
64
- s && (s === "parent" ? i = this.parentElement : i = document.querySelector(s)), i || (i = w(this));
65
- const f = this.querySelector("[data-thumb]");
66
- i && f && (c(this, e, i), c(this, n, f), t(this, e).addEventListener("scroll", t(this, b)), t(this, n).addEventListener("pointerdown", t(this, p)), H.subscribe(this.parentElement, t(this, g)));
62
+ const e = this.getAttribute("data-scroll");
63
+ a(this, l, this.hasAttribute("horisontal"));
64
+ let s = null;
65
+ e && (e === "parent" ? s = this.parentElement : s = document.querySelector(e)), s || (s = P(this), s === document.body && (s = window));
66
+ const m = this.querySelector("[data-thumb]");
67
+ s && m && (a(this, i, s), a(this, h, m), t(this, i).addEventListener("scroll", t(this, E)), t(this, h).addEventListener("pointerdown", t(this, g)), w.subscribe(
68
+ this.parentElement === document.body ? this : this.parentElement,
69
+ t(this, y)
70
+ ));
67
71
  }
68
72
  disconnectedCallback() {
69
- t(this, e).removeEventListener("scroll", t(this, b)), t(this, n).removeEventListener("pointerdown", t(this, p)), clearTimeout(t(this, d)), H.unsubscribe(t(this, g)), E.unsubscribe(t(this, m));
73
+ t(this, i).removeEventListener("scroll", t(this, E)), t(this, h).removeEventListener("pointerdown", t(this, g)), clearTimeout(t(this, p)), w.unsubscribe(t(this, y)), x.unsubscribe(t(this, f));
70
74
  }
71
75
  }
72
- e = new WeakMap(), n = new WeakMap(), u = new WeakMap(), a = new WeakMap(), o = new WeakMap(), d = new WeakMap(), b = new WeakMap(), L = new WeakMap(), p = new WeakMap(), m = new WeakMap(), g = new WeakMap();
73
- k && !customElements.get("e-custom-scrollbar") && customElements.define("e-custom-scrollbar", W);
76
+ i = new WeakMap(), h = new WeakMap(), b = new WeakMap(), u = new WeakMap(), l = new WeakMap(), p = new WeakMap(), c = new WeakSet(), H = function() {
77
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).scrollLeft : t(this, i).scrollTop : t(this, l) ? t(this, i).scrollX : t(this, i).scrollY;
78
+ }, z = function() {
79
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).scrollWidth : t(this, i).scrollHeight : t(this, l) ? Math.max(
80
+ document.body.scrollWidth,
81
+ document.documentElement.scrollWidth,
82
+ document.body.offsetWidth,
83
+ document.documentElement.offsetWidth,
84
+ document.body.clientWidth,
85
+ document.documentElement.clientWidth
86
+ ) : Math.max(
87
+ document.body.scrollHeight,
88
+ document.documentElement.scrollHeight,
89
+ document.body.offsetHeight,
90
+ document.documentElement.offsetHeight,
91
+ document.body.clientHeight,
92
+ document.documentElement.clientHeight
93
+ );
94
+ }, T = function() {
95
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).offsetWidth : t(this, i).offsetHeight : t(this, l) ? innerWidth : innerHeight;
96
+ }, E = new WeakMap(), L = new WeakMap(), g = new WeakMap(), f = new WeakMap(), y = new WeakMap();
97
+ k && !customElements.get("e-custom-scrollbar") && customElements.define("e-custom-scrollbar", q);
74
98
  export {
75
- W as CustomScrollbarElement
99
+ q as CustomScrollbarElement
76
100
  };
@@ -19,20 +19,20 @@ const n = (e) => e, s = (e) => e * e, a = (e) => e * (2 - e), r = (e) => e < 0.5
19
19
  }, Symbol.toStringTag, { value: "Module" }));
20
20
  export {
21
21
  s as a,
22
- a as b,
23
- r as c,
24
- u as d,
22
+ g as b,
23
+ a as c,
24
+ r as d,
25
25
  x as e,
26
- o as f,
27
- c as g,
28
- O as h,
29
- i,
30
- I as j,
31
- Q as k,
26
+ u as f,
27
+ o as g,
28
+ c as h,
29
+ O as i,
30
+ i as j,
31
+ I as k,
32
32
  n as l,
33
- b as m,
34
- l as n,
35
- p as o,
36
- d as p,
37
- g as q
33
+ Q as m,
34
+ b as n,
35
+ l as o,
36
+ p,
37
+ d as q
38
38
  };
@@ -1,11 +1,12 @@
1
1
  import { ChangeHistoryAction, ElementOrSelector } from '../utils';
2
2
  import { MorphLink } from './MorphLink';
3
+ import { MorphRouteScrollState } from './MorphRoute';
3
4
  export interface MorphOptions {
4
5
  base: string;
5
6
  waitForHeadToLoad: boolean;
6
7
  cachePages: boolean;
7
8
  trailingSlash: boolean;
8
- scrollSelector: string;
9
+ scrollSelector: string | undefined;
9
10
  morphInsideScrollContainer: boolean;
10
11
  }
11
12
  export interface MorphNavigationEntry {
@@ -42,6 +43,7 @@ export interface MorphEvents {
42
43
  morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
43
44
  morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
44
45
  morphScroll: CustomEvent<MorphScrollDetail>;
46
+ morphNavigationScroll: CustomEvent<MorphRouteScrollState>;
45
47
  }
46
48
  export interface MorphGetRouteOptions {
47
49
  searchParameters?: string;
@@ -56,8 +58,12 @@ export declare class Morph {
56
58
  get currentPathname(): string;
57
59
  get previousPathname(): string | undefined;
58
60
  get links(): MorphLink[];
59
- get scrollElement(): HTMLElement;
61
+ get scrollElement(): HTMLElement | Window;
60
62
  get isPopstateNavigation(): boolean;
63
+ get scrollValue(): {
64
+ top: number;
65
+ left: number;
66
+ };
61
67
  saveState(state: any): void;
62
68
  getState(): any;
63
69
  normalizePath(path: string): {
@@ -1 +1 @@
1
- "use strict";var kt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Ct=n=>{throw TypeError(n)};var dt=(n,t,s)=>t.has(n)||Ct("Cannot "+s);var e=(n,t,s)=>(dt(n,t,"read from private field"),s?s.call(n):t.get(n)),a=(n,t,s)=>t.has(n)?Ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),o=(n,t,s,i)=>(dt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),m=(n,t,s)=>(dt(n,t,"access private method"),s);var z=(n,t,s)=>new Promise((i,d)=>{var v=E=>{try{S(s.next(E))}catch(D){d(D)}},b=E=>{try{S(s.throw(E))}catch(D){d(D)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(n,t)).next())});var Tt=(n,t,s)=>(t=n[kt("asyncIterator")])?t.call(n):(n=n[kt("iterator")](),t={},s=(i,d)=>(d=n[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=d.call(n,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 xt=require("../index-DekP7OZe.cjs"),$=require("../events-KVanG9sR.cjs"),Bt=require("../polyfills-Df4r-ETT.cjs"),Mt=require("../scroll-CFDCeArT.cjs");require("construct-style-sheets-polyfill");const rt=require("../url-lnBE_6yf.cjs"),Ft=require("../css-value-parser/index.cjs");class Nt 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)}}xt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Nt);var k,l,I,_,K;class mt{constructor(t,s){a(this,k);a(this,l);a(this,I);a(this,_,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,k).previousPathname)history.back();else{const d=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?Ft.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),D=e(this,l).hasAttribute("data-keep-search-parameters"),lt=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(W=>W.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,k).navigate(e(this,I),{historyAction:d,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:D,submorph:lt,clearState:f})}});a(this,K,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,k).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,K))});o(this,k,s),o(this,l,t),o(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,_)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,K))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,k).normalizePath(t),i=e(this,k).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,_)),e(this,l).removeEventListener("pointerenter",e(this,K)),e(this,l).classList.remove("current")}}k=new WeakMap,l=new WeakMap,I=new WeakMap,_=new WeakMap,K=new WeakMap;var H,Y,w,O,B,x,G;class Ht{constructor(t,s,i){a(this,H);a(this,Y);a(this,w,{x:0,y:0});a(this,O);a(this,B,null);a(this,x,null);a(this,G,null);o(this,H,t),o(this,Y,s),o(this,O,i.cloneNode(!0))}get pathname(){return e(this,Y)}get scrollState(){return e(this,w)}get document(){return e(this,x)}cloneDocument(){o(this,x,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,x).title)t=e(this,x).title;else{const s=e(this,x).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,Y)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){o(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,H).scrollElement.scrollLeft,e(this,w).y=e(this,H).scrollElement.scrollTop)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?o(this,B,null):o(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){o(this,G,t)}clearState(){const t=e(this,G);return o(this,G,null),t}}H=new WeakMap,Y=new WeakMap,w=new WeakMap,O=new WeakMap,B=new WeakMap,x=new WeakMap,G=new WeakMap;var C,J,p,at,N,u,tt,F,T,P,q,V,et,c,nt,qt,pt,Dt,Et,gt,St,vt,ot,Q;const Z=class Z{constructor(t){a(this,c);a(this,C,null);a(this,J,null);a(this,p,[]);a(this,at,new DOMParser);a(this,N);a(this,u,null);a(this,tt);a(this,F,[]);a(this,T,!1);a(this,P,null);a(this,q,new Map);a(this,V,null);a(this,et,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,ot,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),o(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),o(this,T,!1))}));a(this,Q,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),$.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(xt.isBrowser&&!Z.instance){Z.instance=this,o(this,C,{base:rt.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),o(this,J,m(this,c,pt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);o(this,u,s.pathname),e(this,q).set(e(this,u),new Ht(this,e(this,u),document)),document.documentElement.setAttribute("data-current-pathname",e(this,u)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),rt.changeHistory({action:"replace",pathname:e(this,u),searchParameters:s.parameters||location.search,hash:s.hash}),o(this,V,new Nt),m(this,c,St).call(this,document)}}get currentPathname(){return e(this,u)}get previousPathname(){return e(this,tt)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}saveState(t){const s=e(this,q).get(e(this,u));s&&s.saveState(t)}getState(){const t=e(this,q).get(e(this,u));return t==null?void 0:t.clearState()}normalizePath(t){return rt.splitPath(t,{base:e(this,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,nt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(D){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var wt;if(e(this,F).length)return;const lt=this.normalizePath(((wt=this.pathnameModifier)==null?void 0:wt.call(this,t))||t);let{pathname:f,hash:W,parameters:yt,leaf:Rt}=lt;if(e(this,N)===f||e(this,u)===f){e(this,T)||m(this,c,vt).call(this,W||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"});return}o(this,N,f),e(this,p).forEach(j=>{j.checkCurrent(f)});try{let j=!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"),j=!1}if(!j||e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}const ct={pathname:f,submorph:S};$.dispatchEvent(document,"morphNavigation",{detail:ct});const ht=yield m(this,c,nt).call(this,e(this,u)),L=yield m(this,c,nt).call(this,f,{searchParameters:yt,revalidate:v});if(e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}ht.clearState(),ht.saveScrollState(),ht.saveDocumentState(),e(this,T)||(L.clearScrollState(),L.clearDocumentState()),E&&L.clearState(),L.cloneDocument(),e(this,V).textContent=L.title,document.body.appendChild(e(this,V)),$.dispatchEvent(document,"morphStart",{detail:ct});const bt=Array.from(document.head.children),Lt=Array.from(L.document.head.children),Pt=m(this,c,Dt).call(this,bt,Lt),zt=m(this,c,Et).call(this,bt,Pt),st=m(this,c,Et).call(this,Lt,Pt);st.forEach((r,A)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),st[A]=y}}),st.forEach(r=>{document.head.appendChild(r)});const ut=st.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,gt).call(this,r))return!0});e(this,C).waitForHeadToLoad&&ut.length&&(yield new Promise(r=>z(this,null,function*(){let A=0;try{for(var y=Tt(ut),X,R,U;X=!(R=yield y.next()).done;X=!1){const it=R.value;it.onload=()=>{A++,A===ut.length&&r()}}}catch(R){U=[R]}finally{try{X&&(R=y.return)&&(yield R.call(y))}finally{if(U)throw U[0]}}}))),yield Mt.wait(10);const At=[];zt.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,gt).call(this,r)?At.push(r):r.remove())});const It=m(this,c,pt).call(this,L.document.body);e(this,C).morphInsideScrollContainer||m(this,c,St).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",Rt),rt.changeHistory({action:s,pathname:f,searchParameters:yt||(b?location.search:""),hash:W}),e(this,V).remove(),o(this,tt,e(this,u)),o(this,u,f),e(this,J).forEach((r,A)=>{const y=It[A],X=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],U=[];S?S.forEach(h=>{const g=r.querySelector(h),M=y.querySelector(h);g&&M&&(U.push(g),R.push(M))}):(R.push(...y.childNodes),U.push(...r.childNodes)),U.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),R.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),S?R.forEach((h,g)=>{var M;(M=U[g].parentElement)==null||M.insertBefore(h,U[g])}):r.prepend(...R),Bt.requestIdleCallback(()=>{R.forEach(h=>{var g;h instanceof HTMLElement&&((g=h.parentElement)==null||g.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const it={morphElement:r,pathname:f};$.dispatchEvent(document,"morphNewChildrenAdded",{detail:it});const Ot=new Promise(h=>{setTimeout(()=>{U.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"))}),$.dispatchEvent(document,"morphOldChildrenRemoved",{detail:it}),h()},(parseFloat(X)||0)*1e3+10)});e(this,F).push(Ot)}),W?(L.clearScrollState(),m(this,c,vt).call(this,W,{centerScroll:i,offsetScroll:d})):e(this,T)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,F)),At.forEach(r=>r.remove()),o(this,F,[]),e(this,J).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const X=document.createElement("script");X.type="module",X.src=y.getAttribute("src"),y.replaceWith(X)})}),$.dispatchEvent(document,"morphComplete",{detail:ct}),window.dispatchEvent(new Event("resize"))}catch(j){console.error(j)}o(this,N,void 0)})}addLink(t){e(this,p).push(new mt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){o(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){o(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,et));e(this,p).push(...s.map(i=>new mt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,et));e(this,p).forEach(s=>s.destroy()),o(this,p,t.map(s=>new mt(s,this)))}};C=new WeakMap,J=new WeakMap,p=new WeakMap,at=new WeakMap,N=new WeakMap,u=new WeakMap,tt=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,V=new WeakMap,et=new WeakMap,c=new WeakSet,nt=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,qt).call(this,t,s==null?void 0:s.searchParameters)),i})},qt=function(t,s){return z(this,null,function*(){const d=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,at).parseFromString(d,"text/html"),b=new Ht(this,t,v);return e(this,q).set(t,b),b})},pt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Dt=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},Et=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},gt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},St=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Q)),o(this,P,t.querySelector(e(this,C).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Q)),e(this,Q).call(this)},vt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Mt.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})},ot=new WeakMap,Q=new WeakMap,Z.instance=null;let ft=Z;exports.Morph=ft;
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;