aptechka 0.5.6 → 0.5.8

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.
@@ -15,7 +15,7 @@ export interface AnimationOptions extends TickerAddOptions {
15
15
  equalize?: boolean;
16
16
  }
17
17
  export type AnimationConstructorOptions<Options extends AnimationOptions> = StoreOptions<number, 'number'> & Options;
18
- export declare abstract class Animation<Entry extends AnimationEntry = AnimationEntry> extends Store<number, 'number', Entry> {
18
+ export declare abstract class Animation<Entry extends AnimationEntry = AnimationEntry, Options extends AnimationOptions = AnimationOptions> extends Store<number, 'number', Entry> {
19
19
  #private;
20
20
  constructor(initial?: number, options?: StoreOptions<number, 'number'>);
21
21
  get linked(): Set<AnimationLink<AnimationLinkOptions>>;
@@ -43,8 +43,8 @@ export declare abstract class Animation<Entry extends AnimationEntry = Animation
43
43
  progress: number;
44
44
  };
45
45
  setTarget(value: number): void;
46
- set(value: number, options?: AnimationOptions): void;
47
- shift(value: number, options?: AnimationOptions): void;
46
+ set(value: number, options?: Options): void;
47
+ shift(value: number, options?: Options): void;
48
48
  reset(): void;
49
49
  close(): void;
50
50
  listenAnimationFrame(): void;
@@ -7,7 +7,7 @@ export interface AnimationLinkOptions extends Omit<AnimationOptions, keyof Store
7
7
  export declare class AnimationLink<Options extends AnimationLinkOptions = AnimationLinkOptions> {
8
8
  #private;
9
9
  constructor(triggerAnimation: Animation<any>, targetAnimation: Animation<any>, startValue: number, setValue: number, options?: Options | undefined);
10
- get targetAnimation(): Animation<any>;
11
- get triggerAnimation(): Animation<any>;
10
+ get targetAnimation(): Animation<any, AnimationOptions>;
11
+ get triggerAnimation(): Animation<any, AnimationOptions>;
12
12
  destroy(): void;
13
13
  }
@@ -10,7 +10,7 @@ export interface DampedEntry extends AnimationEntry {
10
10
  velocity: number;
11
11
  speed: number;
12
12
  }
13
- export declare class Damped extends Animation<DampedEntry> {
13
+ export declare class Damped extends Animation<DampedEntry, DampedOptions> {
14
14
  #private;
15
15
  damping: number;
16
16
  stiffness: number;
@@ -1,4 +1,4 @@
1
- import { Animation, AnimationConstructorOptions, AnimationOptions } from './Animation';
1
+ import { Animation, AnimationConstructorOptions, AnimationEntry, AnimationOptions } from './Animation';
2
2
  import { EasingFunction } from '../utils';
3
3
  import { TickerCallbackEntry } from '../ticker';
4
4
 
@@ -7,7 +7,7 @@ export interface TweenedOptions extends AnimationOptions {
7
7
  duration?: number;
8
8
  restart?: boolean;
9
9
  }
10
- export declare class Tweened extends Animation {
10
+ export declare class Tweened extends Animation<AnimationEntry, TweenedOptions> {
11
11
  #private;
12
12
  constructor(initial?: number, options?: AnimationConstructorOptions<TweenedOptions>);
13
13
  updateOptions(options?: TweenedOptions): void;
@@ -1,3 +1,5 @@
1
+ import { Link } from './Link';
2
+
1
3
  export type MorphHistoryAction = 'replace' | 'push' | 'none';
2
4
  export interface MorphParameters {
3
5
  base?: string;
@@ -21,6 +23,7 @@ export declare class Morph {
21
23
  postprocessor?: MorphPostprocessor;
22
24
  constructor(parameters?: MorphParameters);
23
25
  get currentPathname(): string;
26
+ get links(): Link[];
24
27
  normalizePath(path: string): {
25
28
  leaf: string;
26
29
  pathname: string;
@@ -1 +1 @@
1
- "use strict";var rt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var J=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var i=(n,t,e)=>(J(n,t,"read from private field"),e?e.call(n):t.get(n)),o=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},c=(n,t,e,r)=>(J(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e);var p=(n,t,e)=>(J(n,t,"access private method"),e);var T=(n,t,e)=>new Promise((r,s)=>{var h=d=>{try{u(e.next(d))}catch(m){s(m)}},f=d=>{try{u(e.throw(d))}catch(m){s(m)}},u=d=>d.done?r(d.value):Promise.resolve(d.value).then(h,f);u((e=e.apply(n,t)).next())});var ot=(n,t,e)=>(t=n[rt("asyncIterator")])?t.call(n):(n=n[rt("iterator")](),t={},e=(r,s)=>(s=n[r])&&(t[r]=h=>new Promise((f,u,d)=>(h=s.call(n,h),d=h.done,Promise.resolve(h.value).then(m=>f({value:m,done:d}),u)))),e("next"),e("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("../notifier/index.cjs"),mt=require("../browser-CpzFX2xg.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var P,l,w,H,N,M;class pt{constructor(t,e){o(this,P,void 0);o(this,l,void 0);o(this,w,void 0);o(this,H,void 0);o(this,N,t=>{t.preventDefault(),i(this,P).navigate(i(this,w),i(this,H))});o(this,M,()=>{i(this,P).prefetch(i(this,w)),i(this,l).removeEventListener("pointerenter",i(this,M))});var f;c(this,P,e),c(this,l,t),c(this,w,i(this,l).getAttribute("href")||"/"),c(this,H,i(this,l).getAttribute("data-history-action")||"push"),i(this,l).addEventListener("click",i(this,N));const r=e.normalizePath(i(this,w)),s=e.normalizePath(location.pathname),h=(f=i(this,l).getAttribute("data-match-paths"))==null?void 0:f.split(",").map(u=>e.normalizePath(u.trim()).pathname);i(this,l).hasAttribute("data-include")?s.pathname.includes(r.pathname)&&i(this,l).classList.add("current"):(r.pathname===s.pathname||h!=null&&h.includes(s.pathname))&&i(this,l).classList.add("current"),i(this,l).hasAttribute("data-prefetch")&&i(this,l).addEventListener("pointerenter",i(this,M))}destroy(){i(this,l).removeEventListener("click",i(this,N)),i(this,l).removeEventListener("pointerenter",i(this,M)),i(this,l).classList.remove("current")}}P=new WeakMap,l=new WeakMap,w=new WeakMap,H=new WeakMap,N=new WeakMap,M=new WeakMap;var g,S,C,k,z,$,y,v,L,W,q,x,Q,D,U,R,V,j,ht,F,X,B;class gt{constructor(t){o(this,x);o(this,D);o(this,R);o(this,j);o(this,F);o(this,g,null);o(this,S,null);o(this,C,null);o(this,k,null);o(this,z,[]);o(this,$,new DOMParser);o(this,y,new Map);o(this,v,void 0);o(this,L,null);o(this,W,new at.Notifier);o(this,q,new at.Notifier);o(this,B,t=>{t.state&&this.navigate(t.state,"none")});mt.isBrowser&&(c(this,g,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(c(this,g,t.base),t.base.endsWith("/")||c(this,g,i(this,g)+"/")):c(this,g,"/"),c(this,S,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,C,(t==null?void 0:t.cachePages)!==!1),c(this,k,p(this,R,V).call(this,document.body)),c(this,L,this.normalizePath(location.pathname).pathname),document.documentElement.setAttribute("data-current-pathname",i(this,L)),p(this,D,U).call(this),addEventListener("popstate",i(this,B)))}get currentPathname(){return i(this,L)}normalizePath(t){t=t.replace(i(this,g),""),t.startsWith("/")&&(t=t.slice(1));const e=t.split("#"),r=e[0].split("?"),s=r[0].endsWith("/")?r[0].slice(0,-1):r[0],h=i(this,g)+s,f=r==null?void 0:r[1],u=e==null?void 0:e[1];return{leaf:s,pathname:h,parameters:f,hash:u}}beforeNavigationEvent(t){return i(this,W).subscribe(t)}afterNavigationEvent(t){return i(this,q).subscribe(t)}prefetch(t){return T(this,null,function*(){const e=this.normalizePath(t);return p(this,x,Q).call(this,e.pathname)})}navigate(t,e="push"){return T(this,null,function*(){var d;const r=this.normalizePath(t);let{pathname:s,hash:h,parameters:f}=r;if(i(this,v)===s||i(this,L)===s)return;c(this,v,s);const u=i(this,y).has(s);try{let m=!0;if(i(this,W).notify({pathname:s,isCached:u}),this.preprocessor)try{yield new Promise((a,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:s,resolve:a,reject:E,isCached:u})})}catch(a){a?console.error(a):console.log("Route change canceled"),m=!1}if(!m||i(this,v)!==s)return;const Z=i(this,y).get(s)||(yield p(this,x,Q).call(this,s));if(i(this,v)!==s)return;const tt=Array.from(document.head.children),et=Array.from(Z.head.cloneNode(!0).children),it=p(this,j,ht).call(this,tt,et),ct=p(this,F,X).call(this,tt,it),I=p(this,F,X).call(this,et,it);I.forEach((a,E)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=a.getAttribute("src"),I[E]=b}}),I.forEach(a=>{document.head.appendChild(a)});const K=I.filter(a=>a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK");i(this,S)&&K.length&&(yield new Promise(a=>T(this,null,function*(){let E=0;try{for(var b=ot(K),ft,Y,A;ft=!(Y=yield b.next()).done;ft=!1){const _=Y.value;_.onload=()=>{E++,E===K.length&&a()}}}catch(Y){A=[Y]}finally{try{ft&&(Y=b.return)&&(yield Y.call(b))}finally{if(A)throw A[0]}}}))),ct.forEach(a=>{a.hasAttribute("data-permanent")||a.remove()}),c(this,L,s);const O=f||location.search,lt=h?h.startsWith("#")?h:"#"+h:"",ut=O?O.startsWith("?")?O:"?"+O:"",st=`${s}${lt}${ut}`;e==="push"?history.pushState(s,"",st):e==="replace"&&history.replaceState(s,"",st);const dt=p(this,R,V).call(this,Z.body.cloneNode(!0));i(this,k).forEach((a,E)=>{const b=dt[E];let ft=[...a.childNodes],Y=[...b.childNodes];ft.forEach(A=>{if(A instanceof HTMLElement){const _=A.hasAttribute("data-remain");let nt;Y=Y.filter(G=>G instanceof HTMLElement&&G.outerHTML===A.outerHTML?(nt=G,!1):!0),_&&nt||A.remove()}else A.remove()}),a.append(...Y)}),p(this,D,U).call(this),document.documentElement.setAttribute("data-current-pathname",s),(d=this.postprocessor)==null||d.call(this,{pathname:s,isCached:u}),i(this,q).notify({pathname:s,isCached:u})}catch(m){console.error(m)}c(this,v,void 0)})}}g=new WeakMap,S=new WeakMap,C=new WeakMap,k=new WeakMap,z=new WeakMap,$=new WeakMap,y=new WeakMap,v=new WeakMap,L=new WeakMap,W=new WeakMap,q=new WeakMap,x=new WeakSet,Q=function(t){return T(this,null,function*(){const e=i(this,y).get(t);if(e)return e;const s=yield(yield fetch(t)).text(),h=i(this,$).parseFromString(s,"text/html");return i(this,C)&&i(this,y).set(t,h),h})},D=new WeakSet,U=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(e=>{var r;return(r=e.getAttribute("href"))==null?void 0:r.startsWith("/")});i(this,z).forEach(e=>e.destroy()),c(this,z,t.map(e=>new pt(e,this)))},R=new WeakSet,V=function(t){return[...t.querySelectorAll("[data-morph]")]},j=new WeakSet,ht=function(t,e){return t.filter(r=>e.find(s=>s.outerHTML===r.outerHTML))},F=new WeakSet,X=function(t,e){return t.filter(r=>!e.find(s=>s.outerHTML===r.outerHTML))},B=new WeakMap;exports.Morph=gt;
1
+ "use strict";var at=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var Q=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var e=(r,t,s)=>(Q(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},l=(r,t,s,n)=>(Q(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var p=(r,t,s)=>(Q(r,t,"access private method"),s);var H=(r,t,s)=>new Promise((n,i)=>{var c=d=>{try{u(s.next(d))}catch(m){i(m)}},f=d=>{try{u(s.throw(d))}catch(m){i(m)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(c,f);u((s=s.apply(r,t)).next())});var ht=(r,t,s)=>(t=r[at("asyncIterator")])?t.call(r):(r=r[at("iterator")](),t={},s=(n,i)=>(i=r[n])&&(t[n]=c=>new Promise((f,u,d)=>(c=i.call(r,c),d=c.done,Promise.resolve(c.value).then(m=>f({value:m,done:d}),u)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),pt=require("../browser-CpzFX2xg.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var y,o,g,S,A,k,M;class gt{constructor(t,s){a(this,y,void 0);a(this,o,void 0);a(this,g,void 0);a(this,S,void 0);a(this,A,void 0);a(this,k,t=>{t.preventDefault(),e(this,y).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,A))!=null&&n.includes(e(this,g))?e(s,o).classList.add("clicked"):e(s,o).classList.remove("clicked")}),e(this,y).navigate(e(this,g),e(this,S))});a(this,M,()=>{e(this,y).prefetch(e(this,g)),e(this,o).removeEventListener("pointerenter",e(this,M))});var c,f;l(this,y,s),l(this,o,t),l(this,g,e(this,o).getAttribute("href")||"/"),l(this,S,e(this,o).getAttribute("data-history-action")||"push"),e(this,o).addEventListener("click",e(this,k));const n=s.normalizePath(e(this,g)),i=s.normalizePath(location.pathname);l(this,A,(c=e(this,o).getAttribute("data-match-paths"))==null?void 0:c.split(",").map(u=>s.normalizePath(u.trim()).pathname)),e(this,o).hasAttribute("data-include")?i.pathname.includes(n.pathname)&&e(this,o).classList.add("current"):n.pathname===i.pathname||(f=e(this,A))!=null&&f.includes(i.pathname)?(e(this,o).classList.add("current"),e(this,o).classList.add("clicked")):e(this,o).classList.remove("clicked"),e(this,o).hasAttribute("data-prefetch")&&e(this,o).addEventListener("pointerenter",e(this,M))}destroy(){e(this,o).removeEventListener("click",e(this,k)),e(this,o).removeEventListener("pointerenter",e(this,M)),e(this,o).classList.remove("current")}}y=new WeakMap,o=new WeakMap,g=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap;var E,C,z,W,N,B,P,L,w,q,x,D,U,R,V,F,X,K,ct,I,Z,Y;class Et{constructor(t){a(this,D);a(this,R);a(this,F);a(this,K);a(this,I);a(this,E,null);a(this,C,null);a(this,z,null);a(this,W,null);a(this,N,[]);a(this,B,new DOMParser);a(this,P,new Map);a(this,L,void 0);a(this,w,null);a(this,q,new ot.Notifier);a(this,x,new ot.Notifier);a(this,Y,t=>{t.state&&this.navigate(t.state,"none")});pt.isBrowser&&(l(this,E,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(l(this,E,t.base),t.base.endsWith("/")||l(this,E,e(this,E)+"/")):l(this,E,"/"),l(this,C,(t==null?void 0:t.waitForHeadToLoad)!==!1),l(this,z,(t==null?void 0:t.cachePages)!==!1),l(this,W,p(this,F,X).call(this,document.body)),l(this,w,this.normalizePath(location.pathname).pathname),document.documentElement.setAttribute("data-current-pathname",e(this,w)),p(this,R,V).call(this),addEventListener("popstate",e(this,Y)))}get currentPathname(){return e(this,w)}get links(){return e(this,N)}normalizePath(t){t=t.replace(e(this,E),""),t.startsWith("/")&&(t=t.slice(1));const s=t.split("#"),n=s[0].split("?"),i=n[0].endsWith("/")?n[0].slice(0,-1):n[0],c=e(this,E)+i,f=n==null?void 0:n[1],u=s==null?void 0:s[1];return{leaf:i,pathname:c,parameters:f,hash:u}}beforeNavigationEvent(t){return e(this,q).subscribe(t)}afterNavigationEvent(t){return e(this,x).subscribe(t)}prefetch(t){return H(this,null,function*(){const s=this.normalizePath(t);return p(this,D,U).call(this,s.pathname)})}navigate(t,s="push"){return H(this,null,function*(){var d;const n=this.normalizePath(t);let{pathname:i,hash:c,parameters:f}=n;if(e(this,L)===i||e(this,w)===i)return;l(this,L,i);const u=e(this,P).has(i);try{let m=!0;if(e(this,q).notify({pathname:i,isCached:u}),this.preprocessor)try{yield new Promise((h,b)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:i,resolve:h,reject:b,isCached:u})})}catch(h){h?console.error(h):console.log("Route change canceled"),m=!1}if(!m||e(this,L)!==i)return;const tt=e(this,P).get(i)||(yield p(this,D,U).call(this,i));if(e(this,L)!==i)return;const et=Array.from(document.head.children),st=Array.from(tt.head.cloneNode(!0).children),it=p(this,K,ct).call(this,et,st),lt=p(this,I,Z).call(this,et,it),O=p(this,I,Z).call(this,st,it);O.forEach((h,b)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),O[b]=v}}),O.forEach(h=>{document.head.appendChild(h)});const _=O.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");e(this,C)&&_.length&&(yield new Promise(h=>H(this,null,function*(){let b=0;try{for(var v=ht(_),mt,G,j;mt=!(G=yield v.next()).done;mt=!1){const T=G.value;T.onload=()=>{b++,b===_.length&&h()}}}catch(G){j=[G]}finally{try{mt&&(G=v.return)&&(yield G.call(v))}finally{if(j)throw j[0]}}}))),lt.forEach(h=>{h.hasAttribute("data-permanent")||h.remove()}),l(this,w,i);const $=f||location.search,ut=c?c.startsWith("#")?c:"#"+c:"",dt=$?$.startsWith("?")?$:"?"+$:"",nt=`${i}${ut}${dt}`;s==="push"?history.pushState(i,"",nt):s==="replace"&&history.replaceState(i,"",nt);const ft=p(this,F,X).call(this,tt.body.cloneNode(!0));e(this,W).forEach((h,b)=>{const v=ft[b];let mt=[...h.childNodes],G=[...v.childNodes];mt.forEach(j=>{if(j instanceof HTMLElement){const T=j.getAttribute("data-remain");let rt;G=G.filter(J=>J instanceof HTMLElement&&T&&J.getAttribute("data-remain")===T?(rt=J,!1):!0),T&&rt||j.remove()}else j.remove()}),h.append(...G)}),p(this,R,V).call(this),document.documentElement.setAttribute("data-current-pathname",i),(d=this.postprocessor)==null||d.call(this,{pathname:i,isCached:u}),e(this,x).notify({pathname:i,isCached:u})}catch(m){console.error(m)}l(this,L,void 0)})}}E=new WeakMap,C=new WeakMap,z=new WeakMap,W=new WeakMap,N=new WeakMap,B=new WeakMap,P=new WeakMap,L=new WeakMap,w=new WeakMap,q=new WeakMap,x=new WeakMap,D=new WeakSet,U=function(t){return H(this,null,function*(){const s=e(this,P).get(t);if(s)return s;const i=yield(yield fetch(t)).text(),c=e(this,B).parseFromString(i,"text/html");return e(this,z)&&e(this,P).set(t,c),c})},R=new WeakSet,V=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return(n=s.getAttribute("href"))==null?void 0:n.startsWith("/")});e(this,N).forEach(s=>s.destroy()),l(this,N,t.map(s=>new gt(s,this)))},F=new WeakSet,X=function(t){return[...t.querySelectorAll("[data-morph]")]},K=new WeakSet,ct=function(t,s){return t.filter(n=>s.find(i=>i.outerHTML===n.outerHTML))},I=new WeakSet,Z=function(t,s){return t.filter(n=>!s.find(i=>i.outerHTML===n.outerHTML))},Y=new WeakMap;exports.Morph=Et;
@@ -1,230 +1,237 @@
1
- var rt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n);
2
- var Q = (n, t, e) => {
3
- if (!t.has(n))
4
- throw TypeError("Cannot " + e);
1
+ var at = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r);
2
+ var U = (r, t, s) => {
3
+ if (!t.has(r))
4
+ throw TypeError("Cannot " + s);
5
5
  };
6
- var s = (n, t, e) => (Q(n, t, "read from private field"), e ? e.call(n) : t.get(n)), a = (n, t, e) => {
7
- if (t.has(n))
6
+ var e = (r, t, s) => (U(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => {
7
+ if (t.has(r))
8
8
  throw TypeError("Cannot add the same private member more than once");
9
- t instanceof WeakSet ? t.add(n) : t.set(n, e);
10
- }, c = (n, t, e, r) => (Q(n, t, "write to private field"), r ? r.call(n, e) : t.set(n, e), e);
11
- var p = (n, t, e) => (Q(n, t, "access private method"), e);
12
- var H = (n, t, e) => new Promise((r, i) => {
13
- var h = (d) => {
9
+ t instanceof WeakSet ? t.add(r) : t.set(r, s);
10
+ }, l = (r, t, s, n) => (U(r, t, "write to private field"), n ? n.call(r, s) : t.set(r, s), s);
11
+ var p = (r, t, s) => (U(r, t, "access private method"), s);
12
+ var T = (r, t, s) => new Promise((n, i) => {
13
+ var c = (d) => {
14
14
  try {
15
- u(e.next(d));
15
+ u(s.next(d));
16
16
  } catch (m) {
17
17
  i(m);
18
18
  }
19
19
  }, f = (d) => {
20
20
  try {
21
- u(e.throw(d));
21
+ u(s.throw(d));
22
22
  } catch (m) {
23
23
  i(m);
24
24
  }
25
- }, u = (d) => d.done ? r(d.value) : Promise.resolve(d.value).then(h, f);
26
- u((e = e.apply(n, t)).next());
25
+ }, u = (d) => d.done ? n(d.value) : Promise.resolve(d.value).then(c, f);
26
+ u((s = s.apply(r, t)).next());
27
27
  });
28
- var at = (n, t, e) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, e = (r, i) => (i = n[r]) && (t[r] = (h) => new Promise((f, u, d) => (h = i.call(n, h), d = h.done, Promise.resolve(h.value).then((m) => f({ value: m, done: d }), u)))), e("next"), e("return"), t);
28
+ var ht = (r, t, s) => (t = r[at("asyncIterator")]) ? t.call(r) : (r = r[at("iterator")](), t = {}, s = (n, i) => (i = r[n]) && (t[n] = (c) => new Promise((f, u, d) => (c = i.call(r, c), d = c.done, Promise.resolve(c.value).then((m) => f({ value: m, done: d }), u)))), s("next"), s("return"), t);
29
29
  import { Notifier as ot } from "../notifier/index.js";
30
- import { i as mt } from "../browser-0zX67oeU.js";
30
+ import { i as pt } from "../browser-0zX67oeU.js";
31
31
  import "../path-data-polyfill-DgeDWYeI.js";
32
- var P, l, w, T, N, A;
33
- class pt {
34
- constructor(t, e) {
35
- a(this, P, void 0);
36
- a(this, l, void 0);
37
- a(this, w, void 0);
38
- a(this, T, void 0);
39
- a(this, N, (t) => {
40
- t.preventDefault(), s(this, P).navigate(s(this, w), s(this, T));
32
+ var y, o, g, k, A, C, M;
33
+ class gt {
34
+ constructor(t, s) {
35
+ a(this, y, void 0);
36
+ a(this, o, void 0);
37
+ a(this, g, void 0);
38
+ a(this, k, void 0);
39
+ a(this, A, void 0);
40
+ a(this, C, (t) => {
41
+ t.preventDefault(), e(this, y).links.forEach((s) => {
42
+ var n;
43
+ e(this, g) === e(s, g) || (n = e(s, A)) != null && n.includes(e(this, g)) ? e(s, o).classList.add("clicked") : e(s, o).classList.remove("clicked");
44
+ }), e(this, y).navigate(e(this, g), e(this, k));
41
45
  });
42
- a(this, A, () => {
43
- s(this, P).prefetch(s(this, w)), s(this, l).removeEventListener("pointerenter", s(this, A));
46
+ a(this, M, () => {
47
+ e(this, y).prefetch(e(this, g)), e(this, o).removeEventListener("pointerenter", e(this, M));
44
48
  });
45
- var f;
46
- c(this, P, e), c(this, l, t), c(this, w, s(this, l).getAttribute("href") || "/"), c(this, T, s(this, l).getAttribute(
49
+ var c, f;
50
+ l(this, y, s), l(this, o, t), l(this, g, e(this, o).getAttribute("href") || "/"), l(this, k, e(this, o).getAttribute(
47
51
  "data-history-action"
48
- ) || "push"), s(this, l).addEventListener("click", s(this, N));
49
- const r = e.normalizePath(s(this, w)), i = e.normalizePath(location.pathname), h = (f = s(this, l).getAttribute("data-match-paths")) == null ? void 0 : f.split(",").map((u) => e.normalizePath(u.trim()).pathname);
50
- s(this, l).hasAttribute("data-include") ? i.pathname.includes(r.pathname) && s(this, l).classList.add("current") : (r.pathname === i.pathname || h != null && h.includes(i.pathname)) && s(this, l).classList.add("current"), s(this, l).hasAttribute("data-prefetch") && s(this, l).addEventListener("pointerenter", s(this, A));
52
+ ) || "push"), e(this, o).addEventListener("click", e(this, C));
53
+ const n = s.normalizePath(e(this, g)), i = s.normalizePath(location.pathname);
54
+ l(this, A, (c = e(this, o).getAttribute("data-match-paths")) == null ? void 0 : c.split(",").map((u) => s.normalizePath(u.trim()).pathname)), e(this, o).hasAttribute("data-include") ? i.pathname.includes(n.pathname) && e(this, o).classList.add("current") : n.pathname === i.pathname || (f = e(this, A)) != null && f.includes(i.pathname) ? (e(this, o).classList.add("current"), e(this, o).classList.add("clicked")) : e(this, o).classList.remove("clicked"), e(this, o).hasAttribute("data-prefetch") && e(this, o).addEventListener("pointerenter", e(this, M));
51
55
  }
52
56
  destroy() {
53
- s(this, l).removeEventListener("click", s(this, N)), s(this, l).removeEventListener("pointerenter", s(this, A)), s(this, l).classList.remove("current");
57
+ e(this, o).removeEventListener("click", e(this, C)), e(this, o).removeEventListener("pointerenter", e(this, M)), e(this, o).classList.remove("current");
54
58
  }
55
59
  }
56
- P = new WeakMap(), l = new WeakMap(), w = new WeakMap(), T = new WeakMap(), N = new WeakMap(), A = new WeakMap();
57
- var E, C, S, k, z, O, y, v, b, W, x, D, U, R, V, F, X, B, ht, I, Z, K;
58
- class bt {
60
+ y = new WeakMap(), o = new WeakMap(), g = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), M = new WeakMap();
61
+ var E, S, z, W, H, K, P, b, w, x, D, R, V, F, X, I, Z, Y, ct, $, _, j;
62
+ class wt {
59
63
  constructor(t) {
60
- a(this, D);
61
64
  a(this, R);
62
65
  a(this, F);
63
- a(this, B);
64
66
  a(this, I);
67
+ a(this, Y);
68
+ a(this, $);
65
69
  a(this, E, null);
66
- a(this, C, null);
67
70
  a(this, S, null);
68
- a(this, k, null);
69
- a(this, z, []);
70
- a(this, O, new DOMParser());
71
- a(this, y, /* @__PURE__ */ new Map());
72
- a(this, v, void 0);
73
- a(this, b, null);
74
- a(this, W, new ot());
71
+ a(this, z, null);
72
+ a(this, W, null);
73
+ a(this, H, []);
74
+ a(this, K, new DOMParser());
75
+ a(this, P, /* @__PURE__ */ new Map());
76
+ a(this, b, void 0);
77
+ a(this, w, null);
75
78
  a(this, x, new ot());
76
- a(this, K, (t) => {
79
+ a(this, D, new ot());
80
+ a(this, j, (t) => {
77
81
  t.state && this.navigate(t.state, "none");
78
82
  });
79
- mt && (c(this, E, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (c(this, E, t.base), t.base.endsWith("/") || c(this, E, s(this, E) + "/")) : c(this, E, "/"), c(this, C, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, S, (t == null ? void 0 : t.cachePages) !== !1), c(this, k, p(this, F, X).call(this, document.body)), c(this, b, this.normalizePath(location.pathname).pathname), document.documentElement.setAttribute(
83
+ pt && (l(this, E, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (l(this, E, t.base), t.base.endsWith("/") || l(this, E, e(this, E) + "/")) : l(this, E, "/"), l(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), l(this, z, (t == null ? void 0 : t.cachePages) !== !1), l(this, W, p(this, I, Z).call(this, document.body)), l(this, w, this.normalizePath(location.pathname).pathname), document.documentElement.setAttribute(
80
84
  "data-current-pathname",
81
- s(this, b)
82
- ), p(this, R, V).call(this), addEventListener("popstate", s(this, K)));
85
+ e(this, w)
86
+ ), p(this, F, X).call(this), addEventListener("popstate", e(this, j)));
83
87
  }
84
88
  get currentPathname() {
85
- return s(this, b);
89
+ return e(this, w);
90
+ }
91
+ get links() {
92
+ return e(this, H);
86
93
  }
87
94
  normalizePath(t) {
88
- t = t.replace(s(this, E), ""), t.startsWith("/") && (t = t.slice(1));
89
- const e = t.split("#"), r = e[0].split("?"), i = r[0].endsWith("/") ? r[0].slice(0, -1) : r[0], h = s(this, E) + i, f = r == null ? void 0 : r[1], u = e == null ? void 0 : e[1];
95
+ t = t.replace(e(this, E), ""), t.startsWith("/") && (t = t.slice(1));
96
+ const s = t.split("#"), n = s[0].split("?"), i = n[0].endsWith("/") ? n[0].slice(0, -1) : n[0], c = e(this, E) + i, f = n == null ? void 0 : n[1], u = s == null ? void 0 : s[1];
90
97
  return {
91
98
  leaf: i,
92
- pathname: h,
99
+ pathname: c,
93
100
  parameters: f,
94
101
  hash: u
95
102
  };
96
103
  }
97
104
  beforeNavigationEvent(t) {
98
- return s(this, W).subscribe(t);
105
+ return e(this, x).subscribe(t);
99
106
  }
100
107
  afterNavigationEvent(t) {
101
- return s(this, x).subscribe(t);
108
+ return e(this, D).subscribe(t);
102
109
  }
103
110
  prefetch(t) {
104
- return H(this, null, function* () {
105
- const e = this.normalizePath(t);
106
- return p(this, D, U).call(this, e.pathname);
111
+ return T(this, null, function* () {
112
+ const s = this.normalizePath(t);
113
+ return p(this, R, V).call(this, s.pathname);
107
114
  });
108
115
  }
109
- navigate(t, e = "push") {
110
- return H(this, null, function* () {
116
+ navigate(t, s = "push") {
117
+ return T(this, null, function* () {
111
118
  var d;
112
- const r = this.normalizePath(t);
113
- let { pathname: i, hash: h, parameters: f } = r;
114
- if (s(this, v) === i || s(this, b) === i)
119
+ const n = this.normalizePath(t);
120
+ let { pathname: i, hash: c, parameters: f } = n;
121
+ if (e(this, b) === i || e(this, w) === i)
115
122
  return;
116
- c(this, v, i);
117
- const u = s(this, y).has(i);
123
+ l(this, b, i);
124
+ const u = e(this, P).has(i);
118
125
  try {
119
126
  let m = !0;
120
- if (s(this, W).notify({
127
+ if (e(this, x).notify({
121
128
  pathname: i,
122
129
  isCached: u
123
130
  }), this.preprocessor)
124
131
  try {
125
- yield new Promise((o, g) => {
126
- var L;
127
- (L = this.preprocessor) == null || L.call(this, { pathname: i, resolve: o, reject: g, isCached: u });
132
+ yield new Promise((h, L) => {
133
+ var v;
134
+ (v = this.preprocessor) == null || v.call(this, { pathname: i, resolve: h, reject: L, isCached: u });
128
135
  });
129
- } catch (o) {
130
- o ? console.error(o) : console.log("Route change canceled"), m = !1;
136
+ } catch (h) {
137
+ h ? console.error(h) : console.log("Route change canceled"), m = !1;
131
138
  }
132
- if (!m || s(this, v) !== i)
139
+ if (!m || e(this, b) !== i)
133
140
  return;
134
- const _ = s(this, y).get(i) || (yield p(this, D, U).call(this, i));
135
- if (s(this, v) !== i)
141
+ const tt = e(this, P).get(i) || (yield p(this, R, V).call(this, i));
142
+ if (e(this, b) !== i)
136
143
  return;
137
- const tt = Array.from(document.head.children), et = Array.from(
138
- _.head.cloneNode(!0).children
139
- ), st = p(this, B, ht).call(this, tt, et), ct = p(this, I, Z).call(this, tt, st), $ = p(this, I, Z).call(this, et, st);
140
- $.forEach((o, g) => {
141
- if (o.tagName === "SCRIPT" && o.getAttribute("src")) {
142
- const L = document.createElement("script");
143
- L.type = "module", L.src = o.getAttribute("src"), $[g] = L;
144
+ const et = Array.from(document.head.children), st = Array.from(
145
+ tt.head.cloneNode(!0).children
146
+ ), it = p(this, Y, ct).call(this, et, st), lt = p(this, $, _).call(this, et, it), q = p(this, $, _).call(this, st, it);
147
+ q.forEach((h, L) => {
148
+ if (h.tagName === "SCRIPT" && h.getAttribute("src")) {
149
+ const v = document.createElement("script");
150
+ v.type = "module", v.src = h.getAttribute("src"), q[L] = v;
144
151
  }
145
- }), $.forEach((o) => {
146
- document.head.appendChild(o);
152
+ }), q.forEach((h) => {
153
+ document.head.appendChild(h);
147
154
  });
148
- const Y = $.filter(
149
- (o) => o.tagName === "STYLE" || o.tagName === "SCRIPT" || o.tagName === "LINK"
155
+ const G = q.filter(
156
+ (h) => h.tagName === "STYLE" || h.tagName === "SCRIPT" || h.tagName === "LINK"
150
157
  );
151
- s(this, C) && Y.length && (yield new Promise((o) => H(this, null, function* () {
152
- let g = 0;
158
+ e(this, S) && G.length && (yield new Promise((h) => T(this, null, function* () {
159
+ let L = 0;
153
160
  try {
154
- for (var L = at(Y), ft, j, M; ft = !(j = yield L.next()).done; ft = !1) {
155
- const G = j.value;
156
- G.onload = () => {
157
- g++, g === Y.length && o();
161
+ for (var v = ht(G), mt, J, B; mt = !(J = yield v.next()).done; mt = !1) {
162
+ const N = J.value;
163
+ N.onload = () => {
164
+ L++, L === G.length && h();
158
165
  };
159
166
  }
160
- } catch (j) {
161
- M = [j];
167
+ } catch (J) {
168
+ B = [J];
162
169
  } finally {
163
170
  try {
164
- ft && (j = L.return) && (yield j.call(L));
171
+ mt && (J = v.return) && (yield J.call(v));
165
172
  } finally {
166
- if (M)
167
- throw M[0];
173
+ if (B)
174
+ throw B[0];
168
175
  }
169
176
  }
170
- }))), ct.forEach((o) => {
171
- o.hasAttribute("data-permanent") || o.remove();
172
- }), c(this, b, i);
173
- const q = f || location.search, lt = h ? h.startsWith("#") ? h : "#" + h : "", ut = q ? q.startsWith("?") ? q : "?" + q : "", it = `${i}${lt}${ut}`;
174
- e === "push" ? history.pushState(i, "", it) : e === "replace" && history.replaceState(i, "", it);
175
- const dt = p(this, F, X).call(this, _.body.cloneNode(!0));
176
- s(this, k).forEach((o, g) => {
177
- const L = dt[g];
178
- let ft = [...o.childNodes], j = [...L.childNodes];
179
- ft.forEach((M) => {
180
- if (M instanceof HTMLElement) {
181
- const G = M.hasAttribute("data-remain");
182
- let nt;
183
- j = j.filter(
184
- (J) => J instanceof HTMLElement && J.outerHTML === M.outerHTML ? (nt = J, !1) : !0
185
- ), G && nt || M.remove();
177
+ }))), lt.forEach((h) => {
178
+ h.hasAttribute("data-permanent") || h.remove();
179
+ }), l(this, w, i);
180
+ const O = f || location.search, ut = c ? c.startsWith("#") ? c : "#" + c : "", dt = O ? O.startsWith("?") ? O : "?" + O : "", nt = `${i}${ut}${dt}`;
181
+ s === "push" ? history.pushState(i, "", nt) : s === "replace" && history.replaceState(i, "", nt);
182
+ const ft = p(this, I, Z).call(this, tt.body.cloneNode(!0));
183
+ e(this, W).forEach((h, L) => {
184
+ const v = ft[L];
185
+ let mt = [...h.childNodes], J = [...v.childNodes];
186
+ mt.forEach((B) => {
187
+ if (B instanceof HTMLElement) {
188
+ const N = B.getAttribute("data-remain");
189
+ let rt;
190
+ J = J.filter(
191
+ (Q) => Q instanceof HTMLElement && N && Q.getAttribute("data-remain") === N ? (rt = Q, !1) : !0
192
+ ), N && rt || B.remove();
186
193
  } else
187
- M.remove();
188
- }), o.append(...j);
189
- }), p(this, R, V).call(this), document.documentElement.setAttribute("data-current-pathname", i), (d = this.postprocessor) == null || d.call(this, { pathname: i, isCached: u }), s(this, x).notify({ pathname: i, isCached: u });
194
+ B.remove();
195
+ }), h.append(...J);
196
+ }), p(this, F, X).call(this), document.documentElement.setAttribute("data-current-pathname", i), (d = this.postprocessor) == null || d.call(this, { pathname: i, isCached: u }), e(this, D).notify({ pathname: i, isCached: u });
190
197
  } catch (m) {
191
198
  console.error(m);
192
199
  }
193
- c(this, v, void 0);
200
+ l(this, b, void 0);
194
201
  });
195
202
  }
196
203
  }
197
- E = new WeakMap(), C = new WeakMap(), S = new WeakMap(), k = new WeakMap(), z = new WeakMap(), O = new WeakMap(), y = new WeakMap(), v = new WeakMap(), b = new WeakMap(), W = new WeakMap(), x = new WeakMap(), D = new WeakSet(), U = function(t) {
198
- return H(this, null, function* () {
199
- const e = s(this, y).get(t);
200
- if (e)
201
- return e;
202
- const i = yield (yield fetch(t)).text(), h = s(this, O).parseFromString(i, "text/html");
203
- return s(this, S) && s(this, y).set(t, h), h;
204
+ E = new WeakMap(), S = new WeakMap(), z = new WeakMap(), W = new WeakMap(), H = new WeakMap(), K = new WeakMap(), P = new WeakMap(), b = new WeakMap(), w = new WeakMap(), x = new WeakMap(), D = new WeakMap(), R = new WeakSet(), V = function(t) {
205
+ return T(this, null, function* () {
206
+ const s = e(this, P).get(t);
207
+ if (s)
208
+ return s;
209
+ const i = yield (yield fetch(t)).text(), c = e(this, K).parseFromString(i, "text/html");
210
+ return e(this, z) && e(this, P).set(t, c), c;
204
211
  });
205
- }, R = new WeakSet(), V = function() {
212
+ }, F = new WeakSet(), X = function() {
206
213
  const t = [
207
214
  ...document.documentElement.querySelectorAll("a")
208
- ].filter((e) => {
209
- var r;
210
- return (r = e.getAttribute("href")) == null ? void 0 : r.startsWith("/");
215
+ ].filter((s) => {
216
+ var n;
217
+ return (n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/");
211
218
  });
212
- s(this, z).forEach((e) => e.destroy()), c(this, z, t.map((e) => new pt(e, this)));
213
- }, F = new WeakSet(), X = function(t) {
219
+ e(this, H).forEach((s) => s.destroy()), l(this, H, t.map((s) => new gt(s, this)));
220
+ }, I = new WeakSet(), Z = function(t) {
214
221
  return [...t.querySelectorAll("[data-morph]")];
215
- }, B = new WeakSet(), ht = function(t, e) {
222
+ }, Y = new WeakSet(), ct = function(t, s) {
216
223
  return t.filter(
217
- (r) => e.find(
218
- (i) => i.outerHTML === r.outerHTML
224
+ (n) => s.find(
225
+ (i) => i.outerHTML === n.outerHTML
219
226
  )
220
227
  );
221
- }, I = new WeakSet(), Z = function(t, e) {
228
+ }, $ = new WeakSet(), _ = function(t, s) {
222
229
  return t.filter(
223
- (r) => !e.find(
224
- (i) => i.outerHTML === r.outerHTML
230
+ (n) => !s.find(
231
+ (i) => i.outerHTML === n.outerHTML
225
232
  )
226
233
  );
227
- }, K = new WeakMap();
234
+ }, j = new WeakMap();
228
235
  export {
229
- bt as Morph
236
+ wt as Morph
230
237
  };
@@ -9,13 +9,15 @@ export interface PointerParameters {
9
9
  }
10
10
  export declare class Pointer {
11
11
  #private;
12
- cartesian: boolean;
13
- normalize: boolean;
14
12
  constructor(parameters: PointerParameters);
15
13
  get element(): HTMLElement;
16
14
  get x(): Damped;
17
15
  get y(): Damped;
18
16
  get z(): Damped;
17
+ get cartesian(): boolean;
18
+ set cartesian(value: boolean);
19
+ get normalize(): boolean;
20
+ set normalize(value: boolean);
19
21
  connect(): void;
20
22
  disconnect(): void;
21
23
  }
@@ -1 +1 @@
1
- "use strict";var E=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var i=(t,e,s)=>(E(t,e,"read from private field"),s?s.call(t):e.get(t)),p=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},m=(t,e,s,h)=>(E(t,e,"write to private field"),h?h.call(t,s):e.set(t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../Store-BQGNOHlY.cjs");const L=require("../coordinates-D8Np3cPD.cjs"),k=require("../dom-JBOkFLTh.cjs"),q=require("../math-GDWEqu7y.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");require("../ticker/index.cjs");const g=require("../Damped-CbWlWAbx.cjs"),M=require("../custom-element/index.cjs"),v=require("../css-property/index.cjs");var a,u,d,l,_,w,x;class W{constructor(e){p(this,a,void 0);p(this,u,void 0);p(this,d,void 0);p(this,l,void 0);p(this,_,e=>{i(this,l).set(1)});p(this,w,e=>{i(this,l).set(0)});p(this,x,e=>{const s={x:e.clientX,y:e.clientY},h={width:this.element.offsetWidth,height:this.element.offsetHeight},o={x:s.x,y:s.y};if(this.cartesian){const c=L.screenToCartesian(o,h);o.x=c.x,o.y=c.y}if(this.normalize){const c=L.normalize(o,h);o.x=q.clamp(c.x*2,-1,1),o.y=q.clamp(c.y*2,-1,1)}i(this,u).set(o.x),i(this,d).set(o.y)});m(this,a,k.getElement(e.element)),m(this,u,new g.Damped(0,e.damped)),m(this,d,new g.Damped(0,e.damped)),m(this,l,new g.Damped(0,e.damped)),this.cartesian=e.cartesian||!1,this.normalize=e.normalize||!1}get element(){return i(this,a)}get x(){return i(this,u)}get y(){return i(this,d)}get z(){return i(this,l)}connect(){i(this,a).addEventListener("pointerenter",i(this,_)),i(this,a).addEventListener("pointerleave",i(this,w)),i(this,a).addEventListener("pointermove",i(this,x))}disconnect(){i(this,a).removeEventListener("pointerenter",i(this,_)),i(this,a).removeEventListener("pointerleave",i(this,w)),i(this,a).removeEventListener("pointermove",i(this,x)),i(this,u).reset(),i(this,d).reset(),i(this,l).reset()}}a=new WeakMap,u=new WeakMap,d=new WeakMap,l=new WeakMap,_=new WeakMap,w=new WeakMap,x=new WeakMap;var O=Object.defineProperty,T=Object.getOwnPropertyDescriptor,A=(t,e,s,h)=>{for(var o=h>1?void 0:h?T(e,s):e,c=t.length-1,b;c>=0;c--)(b=t[c])&&(o=(h?b(e,s,o):b(o))||o);return h&&o&&O(e,s,o),o},D=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(D(t,e,"read from private field"),s?s.call(t):e.get(t)),y=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},G=(t,e,s,h)=>(D(t,e,"write to private field"),h?h.call(t,s):e.set(t,s),s),n,f,P,S,C,z;exports.PointerElement=class extends M.CustomElement{constructor(){super(),y(this,n,void 0),y(this,f,new v.CSSProperty(this,"--damping",20)),y(this,P,new v.CSSProperty(this,"--mass",0)),y(this,S,new v.CSSProperty(this,"--stiffness",0)),y(this,C,new v.CSSProperty(this,"--cartesian",!1)),y(this,z,new v.CSSProperty(this,"--normalize",!1)),G(this,n,new W({element:this})),r(this,f).subscribe(e=>{r(this,n).x.damping=e.current,r(this,n).y.damping=e.current,r(this,n).z.damping=e.current}),r(this,C).subscribe(e=>{r(this,n).cartesian=e.current}),r(this,z).subscribe(e=>{r(this,n).normalize=e.current}),r(this,P).subscribe(e=>{r(this,n).x.mass=e.current,r(this,n).y.mass=e.current,r(this,n).z.mass=e.current}),r(this,S).subscribe(e=>{r(this,n).x.stiffness=e.current,r(this,n).y.stiffness=e.current,r(this,n).z.stiffness=e.current}),r(this,n).x.subscribe(e=>{this.style.setProperty("--x",e.current.toString())}),r(this,n).y.subscribe(e=>{this.style.setProperty("--y",e.current.toString())}),r(this,n).z.subscribe(e=>{this.style.setProperty("--z",e.current.toString())})}get pointer(){return r(this,n)}connectedCallback(){r(this,n).connect(),r(this,f).observe(),r(this,P).observe(),r(this,S).observe()}disconnectedCallback(){r(this,n).disconnect(),r(this,f).unobserve(),r(this,P).unobserve(),r(this,S).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}};n=new WeakMap;f=new WeakMap;P=new WeakMap;S=new WeakMap;C=new WeakMap;z=new WeakMap;exports.PointerElement=A([M.define("e-pointer")],exports.PointerElement);exports.Pointer=W;
1
+ "use strict";var J=Object.defineProperty;var D=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var k=(i,e,s)=>e in i?J(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,O=(i,e)=>{for(var s in e||(e={}))K.call(e,s)&&k(i,s,e[s]);if(D)for(var s of D(e))N.call(e,s)&&k(i,s,e[s]);return i};var T=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)};var t=(i,e,s)=>(T(i,e,"read from private field"),s?s.call(i):e.get(i)),a=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},l=(i,e,s,o)=>(T(i,e,"write to private field"),o?o.call(i,s):e.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../Store-BQGNOHlY.cjs");const L=require("../coordinates-D8Np3cPD.cjs"),Q=require("../dom-JBOkFLTh.cjs"),A=require("../math-GDWEqu7y.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");require("../ticker/index.cjs");const M=require("../Damped-CbWlWAbx.cjs"),B=require("../element-resizer/index.cjs"),G=require("../window-resizer/index.cjs"),H=require("../custom-element/index.cjs"),S=require("../css-property/index.cjs");var c,u,m,v,f,d,P,w,_,C,E,y;class F{constructor(e){a(this,c,void 0);a(this,u,void 0);a(this,m,void 0);a(this,v,void 0);a(this,f,void 0);a(this,d,void 0);a(this,P,0);a(this,w,0);a(this,_,e=>{t(this,v).set(1)});a(this,C,e=>{t(this,v).set(0)});a(this,E,e=>{const s=L.getPointerPosition(e,t(this,c).getBoundingClientRect()),o={width:t(this,P),height:t(this,w)},n={x:s.x,y:s.y};if(t(this,f)){const p=L.screenToCartesian(n,o);n.x=p.x,n.y=p.y}if(t(this,d)){const p=L.normalize(n,o);n.x=A.clamp(p.x*2,-1,1),n.y=A.clamp(p.y*2,-1,1)}t(this,u).set(n.x),t(this,m).set(n.y)});a(this,y,()=>{l(this,P,this.element.clientWidth),l(this,w,this.element.clientHeight);let e=0,s=0,o=0,n=0;t(this,f)?t(this,d)?(e=-1,s=1,o=-1,n=1):(e=t(this,P)/2*-1,s=t(this,P)/2*1,o=t(this,w)/2*-1,n=t(this,w)/2*1):t(this,d)?(e=0,s=1,o=0,n=1):(e=0,s=t(this,P),o=0,n=t(this,w)),t(this,u).min=e,t(this,u).max=s,t(this,m).min=o,t(this,m).max=n});l(this,c,Q.getElement(e.element)),l(this,u,new M.Damped(0,e.damped)),l(this,m,new M.Damped(0,e.damped)),l(this,v,new M.Damped(0,O({min:0,max:1},e.damped))),l(this,f,e.cartesian||!1),l(this,d,e.normalize||!1)}get element(){return t(this,c)}get x(){return t(this,u)}get y(){return t(this,m)}get z(){return t(this,v)}get cartesian(){return t(this,f)}set cartesian(e){l(this,f,e),t(this,y).call(this)}get normalize(){return t(this,d)}set normalize(e){l(this,d,e),t(this,y).call(this)}connect(){t(this,c).addEventListener("pointerenter",t(this,_)),t(this,c).addEventListener("pointerleave",t(this,C)),t(this,c).addEventListener("pointermove",t(this,E)),B.elementResizer.subscribe(t(this,c),t(this,y)),G.windowResizer.subscribe(t(this,y))}disconnect(){t(this,c).removeEventListener("pointerenter",t(this,_)),t(this,c).removeEventListener("pointerleave",t(this,C)),t(this,c).removeEventListener("pointermove",t(this,E)),B.elementResizer.unsubscribe(t(this,y)),G.windowResizer.unsubscribe(t(this,y)),t(this,u).reset(),t(this,m).reset(),t(this,v).reset()}}c=new WeakMap,u=new WeakMap,m=new WeakMap,v=new WeakMap,f=new WeakMap,d=new WeakMap,P=new WeakMap,w=new WeakMap,_=new WeakMap,C=new WeakMap,E=new WeakMap,y=new WeakMap;var U=Object.defineProperty,V=Object.getOwnPropertyDescriptor,X=(i,e,s,o)=>{for(var n=o>1?void 0:o?V(e,s):e,p=i.length-1,q;p>=0;p--)(q=i[p])&&(n=(o?q(e,s,n):q(n))||n);return o&&n&&U(e,s,n),n},I=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},r=(i,e,s)=>(I(i,e,"read from private field"),s?s.call(i):e.get(i)),x=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},Y=(i,e,s,o)=>(I(i,e,"write to private field"),o?o.call(i,s):e.set(i,s),s),h,b,g,z,W,R;exports.PointerElement=class extends H.CustomElement{constructor(){super(),x(this,h,void 0),x(this,b,new S.CSSProperty(this,"--damping",20)),x(this,g,new S.CSSProperty(this,"--mass",0)),x(this,z,new S.CSSProperty(this,"--stiffness",0)),x(this,W,new S.CSSProperty(this,"--cartesian",!1)),x(this,R,new S.CSSProperty(this,"--normalize",!1)),Y(this,h,new F({element:this})),r(this,b).subscribe(e=>{r(this,h).x.damping=e.current,r(this,h).y.damping=e.current,r(this,h).z.damping=e.current}),r(this,W).subscribe(e=>{r(this,h).cartesian=e.current}),r(this,R).subscribe(e=>{r(this,h).normalize=e.current}),r(this,g).subscribe(e=>{r(this,h).x.mass=e.current,r(this,h).y.mass=e.current,r(this,h).z.mass=e.current}),r(this,z).subscribe(e=>{r(this,h).x.stiffness=e.current,r(this,h).y.stiffness=e.current,r(this,h).z.stiffness=e.current}),r(this,h).x.subscribe(e=>{this.style.setProperty("--x",e.current.toString())}),r(this,h).y.subscribe(e=>{this.style.setProperty("--y",e.current.toString())}),r(this,h).z.subscribe(e=>{this.style.setProperty("--z",e.current.toString())})}get pointer(){return r(this,h)}connectedCallback(){r(this,h).connect(),r(this,b).observe(),r(this,g).observe(),r(this,z).observe()}disconnectedCallback(){r(this,h).disconnect(),r(this,b).unobserve(),r(this,g).unobserve(),r(this,z).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}};h=new WeakMap;b=new WeakMap;g=new WeakMap;z=new WeakMap;W=new WeakMap;R=new WeakMap;exports.PointerElement=X([H.define("e-pointer")],exports.PointerElement);exports.Pointer=F;
@@ -1,137 +1,168 @@
1
- var E = (e, t, s) => {
1
+ var F = Object.defineProperty;
2
+ var D = Object.getOwnPropertySymbols;
3
+ var I = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
4
+ var O = (e, t, i) => t in e ? F(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, R = (e, t) => {
5
+ for (var i in t || (t = {}))
6
+ I.call(t, i) && O(e, i, t[i]);
7
+ if (D)
8
+ for (var i of D(t))
9
+ J.call(t, i) && O(e, i, t[i]);
10
+ return e;
11
+ };
12
+ var T = (e, t, i) => {
2
13
  if (!t.has(e))
3
- throw TypeError("Cannot " + s);
14
+ throw TypeError("Cannot " + i);
4
15
  };
5
- var r = (e, t, s) => (E(e, t, "read from private field"), s ? s.call(e) : t.get(e)), p = (e, t, s) => {
16
+ var s = (e, t, i) => (T(e, t, "read from private field"), i ? i.call(e) : t.get(e)), a = (e, t, i) => {
6
17
  if (t.has(e))
7
18
  throw TypeError("Cannot add the same private member more than once");
8
- t instanceof WeakSet ? t.add(e) : t.set(e, s);
9
- }, u = (e, t, s, h) => (E(e, t, "write to private field"), h ? h.call(e, s) : t.set(e, s), s);
19
+ t instanceof WeakSet ? t.add(e) : t.set(e, i);
20
+ }, p = (e, t, i, o) => (T(e, t, "write to private field"), o ? o.call(e, i) : t.set(e, i), i);
10
21
  import "../Store-Cd-E5W1z.js";
11
- import { s as k, n as D } from "../coordinates-CgdGoSYs.js";
12
- import { g as O } from "../dom-0S_WDL4g.js";
13
- import { c as L } from "../math-BOBiC4TN.js";
22
+ import { g as K, s as N, n as Q } from "../coordinates-CgdGoSYs.js";
23
+ import { g as U } from "../dom-0S_WDL4g.js";
24
+ import { c as A } from "../math-BOBiC4TN.js";
14
25
  import "../path-data-polyfill-DgeDWYeI.js";
15
26
  import "../ticker/index.js";
16
- import { D as b } from "../Damped-BJgyFENo.js";
17
- import { CustomElement as T, define as A } from "../custom-element/index.js";
18
- import { CSSProperty as y } from "../css-property/index.js";
19
- var a, m, v, l, x, P, g;
20
- class G {
27
+ import { D as W } from "../Damped-BJgyFENo.js";
28
+ import { elementResizer as B } from "../element-resizer/index.js";
29
+ import { windowResizer as G } from "../window-resizer/index.js";
30
+ import { CustomElement as V, define as X } from "../custom-element/index.js";
31
+ import { CSSProperty as x } from "../css-property/index.js";
32
+ var c, l, u, d, y, v, b, g, S, C, E, f;
33
+ class Y {
21
34
  constructor(t) {
22
- p(this, a, void 0);
23
- p(this, m, void 0);
24
- p(this, v, void 0);
25
- p(this, l, void 0);
26
- p(this, x, (t) => {
27
- r(this, l).set(1);
35
+ a(this, c, void 0);
36
+ a(this, l, void 0);
37
+ a(this, u, void 0);
38
+ a(this, d, void 0);
39
+ a(this, y, void 0);
40
+ a(this, v, void 0);
41
+ a(this, b, 0);
42
+ a(this, g, 0);
43
+ a(this, S, (t) => {
44
+ s(this, d).set(1);
28
45
  });
29
- p(this, P, (t) => {
30
- r(this, l).set(0);
46
+ a(this, C, (t) => {
47
+ s(this, d).set(0);
31
48
  });
32
- p(this, g, (t) => {
33
- const s = {
34
- x: t.clientX,
35
- y: t.clientY
36
- }, h = {
37
- width: this.element.offsetWidth,
38
- height: this.element.offsetHeight
39
- }, o = {
40
- x: s.x,
41
- y: s.y
49
+ a(this, E, (t) => {
50
+ const i = K(t, s(this, c).getBoundingClientRect()), o = {
51
+ width: s(this, b),
52
+ height: s(this, g)
53
+ }, n = {
54
+ x: i.x,
55
+ y: i.y
42
56
  };
43
- if (this.cartesian) {
44
- const c = k(o, h);
45
- o.x = c.x, o.y = c.y;
57
+ if (s(this, y)) {
58
+ const m = N(n, o);
59
+ n.x = m.x, n.y = m.y;
46
60
  }
47
- if (this.normalize) {
48
- const c = D(o, h);
49
- o.x = L(c.x * 2, -1, 1), o.y = L(c.y * 2, -1, 1);
61
+ if (s(this, v)) {
62
+ const m = Q(n, o);
63
+ n.x = A(m.x * 2, -1, 1), n.y = A(m.y * 2, -1, 1);
50
64
  }
51
- r(this, m).set(o.x), r(this, v).set(o.y);
65
+ s(this, l).set(n.x), s(this, u).set(n.y);
66
+ });
67
+ a(this, f, () => {
68
+ p(this, b, this.element.clientWidth), p(this, g, this.element.clientHeight);
69
+ let t = 0, i = 0, o = 0, n = 0;
70
+ s(this, y) ? s(this, v) ? (t = -1, i = 1, o = -1, n = 1) : (t = s(this, b) / 2 * -1, i = s(this, b) / 2 * 1, o = s(this, g) / 2 * -1, n = s(this, g) / 2 * 1) : s(this, v) ? (t = 0, i = 1, o = 0, n = 1) : (t = 0, i = s(this, b), o = 0, n = s(this, g)), s(this, l).min = t, s(this, l).max = i, s(this, u).min = o, s(this, u).max = n;
52
71
  });
53
- u(this, a, O(t.element)), u(this, m, new b(0, t.damped)), u(this, v, new b(0, t.damped)), u(this, l, new b(0, t.damped)), this.cartesian = t.cartesian || !1, this.normalize = t.normalize || !1;
72
+ p(this, c, U(t.element)), p(this, l, new W(0, t.damped)), p(this, u, new W(0, t.damped)), p(this, d, new W(0, R({ min: 0, max: 1 }, t.damped))), p(this, y, t.cartesian || !1), p(this, v, t.normalize || !1);
54
73
  }
55
74
  get element() {
56
- return r(this, a);
75
+ return s(this, c);
57
76
  }
58
77
  get x() {
59
- return r(this, m);
78
+ return s(this, l);
60
79
  }
61
80
  get y() {
62
- return r(this, v);
81
+ return s(this, u);
63
82
  }
64
83
  get z() {
65
- return r(this, l);
84
+ return s(this, d);
85
+ }
86
+ get cartesian() {
87
+ return s(this, y);
88
+ }
89
+ set cartesian(t) {
90
+ p(this, y, t), s(this, f).call(this);
91
+ }
92
+ get normalize() {
93
+ return s(this, v);
94
+ }
95
+ set normalize(t) {
96
+ p(this, v, t), s(this, f).call(this);
66
97
  }
67
98
  connect() {
68
- r(this, a).addEventListener("pointerenter", r(this, x)), r(this, a).addEventListener("pointerleave", r(this, P)), r(this, a).addEventListener("pointermove", r(this, g));
99
+ s(this, c).addEventListener("pointerenter", s(this, S)), s(this, c).addEventListener("pointerleave", s(this, C)), s(this, c).addEventListener("pointermove", s(this, E)), B.subscribe(s(this, c), s(this, f)), G.subscribe(s(this, f));
69
100
  }
70
101
  disconnect() {
71
- r(this, a).removeEventListener(
102
+ s(this, c).removeEventListener(
72
103
  "pointerenter",
73
- r(this, x)
74
- ), r(this, a).removeEventListener(
104
+ s(this, S)
105
+ ), s(this, c).removeEventListener(
75
106
  "pointerleave",
76
- r(this, P)
77
- ), r(this, a).removeEventListener("pointermove", r(this, g)), r(this, m).reset(), r(this, v).reset(), r(this, l).reset();
107
+ s(this, C)
108
+ ), s(this, c).removeEventListener("pointermove", s(this, E)), B.unsubscribe(s(this, f)), G.unsubscribe(s(this, f)), s(this, l).reset(), s(this, u).reset(), s(this, d).reset();
78
109
  }
79
110
  }
80
- a = new WeakMap(), m = new WeakMap(), v = new WeakMap(), l = new WeakMap(), x = new WeakMap(), P = new WeakMap(), g = new WeakMap();
81
- var H = Object.defineProperty, X = Object.getOwnPropertyDescriptor, Y = (e, t, s, h) => {
82
- for (var o = h > 1 ? void 0 : h ? X(t, s) : t, c = e.length - 1, S; c >= 0; c--)
83
- (S = e[c]) && (o = (h ? S(t, s, o) : S(o)) || o);
84
- return h && o && H(t, s, o), o;
85
- }, M = (e, t, s) => {
111
+ c = new WeakMap(), l = new WeakMap(), u = new WeakMap(), d = new WeakMap(), y = new WeakMap(), v = new WeakMap(), b = new WeakMap(), g = new WeakMap(), S = new WeakMap(), C = new WeakMap(), E = new WeakMap(), f = new WeakMap();
112
+ var Z = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, j = (e, t, i, o) => {
113
+ for (var n = o > 1 ? void 0 : o ? $(t, i) : t, m = e.length - 1, L; m >= 0; m--)
114
+ (L = e[m]) && (n = (o ? L(t, i, n) : L(n)) || n);
115
+ return o && n && Z(t, i, n), n;
116
+ }, q = (e, t, i) => {
86
117
  if (!t.has(e))
87
- throw TypeError("Cannot " + s);
88
- }, i = (e, t, s) => (M(e, t, "read from private field"), s ? s.call(e) : t.get(e)), f = (e, t, s) => {
118
+ throw TypeError("Cannot " + i);
119
+ }, r = (e, t, i) => (q(e, t, "read from private field"), i ? i.call(e) : t.get(e)), w = (e, t, i) => {
89
120
  if (t.has(e))
90
121
  throw TypeError("Cannot add the same private member more than once");
91
- t instanceof WeakSet ? t.add(e) : t.set(e, s);
92
- }, q = (e, t, s, h) => (M(e, t, "write to private field"), h ? h.call(e, s) : t.set(e, s), s), n, d, w, _, z, C;
93
- let W = class extends T {
122
+ t instanceof WeakSet ? t.add(e) : t.set(e, i);
123
+ }, tt = (e, t, i, o) => (q(e, t, "write to private field"), o ? o.call(e, i) : t.set(e, i), i), h, z, P, _, M, k;
124
+ let H = class extends V {
94
125
  constructor() {
95
- super(), f(this, n, void 0), f(this, d, new y(this, "--damping", 20)), f(this, w, new y(this, "--mass", 0)), f(this, _, new y(this, "--stiffness", 0)), f(this, z, new y(this, "--cartesian", !1)), f(this, C, new y(this, "--normalize", !1)), q(this, n, new G({
126
+ super(), w(this, h, void 0), w(this, z, new x(this, "--damping", 20)), w(this, P, new x(this, "--mass", 0)), w(this, _, new x(this, "--stiffness", 0)), w(this, M, new x(this, "--cartesian", !1)), w(this, k, new x(this, "--normalize", !1)), tt(this, h, new Y({
96
127
  element: this
97
- })), i(this, d).subscribe((e) => {
98
- i(this, n).x.damping = e.current, i(this, n).y.damping = e.current, i(this, n).z.damping = e.current;
99
- }), i(this, z).subscribe((e) => {
100
- i(this, n).cartesian = e.current;
101
- }), i(this, C).subscribe((e) => {
102
- i(this, n).normalize = e.current;
103
- }), i(this, w).subscribe((e) => {
104
- i(this, n).x.mass = e.current, i(this, n).y.mass = e.current, i(this, n).z.mass = e.current;
105
- }), i(this, _).subscribe((e) => {
106
- i(this, n).x.stiffness = e.current, i(this, n).y.stiffness = e.current, i(this, n).z.stiffness = e.current;
107
- }), i(this, n).x.subscribe((e) => {
128
+ })), r(this, z).subscribe((e) => {
129
+ r(this, h).x.damping = e.current, r(this, h).y.damping = e.current, r(this, h).z.damping = e.current;
130
+ }), r(this, M).subscribe((e) => {
131
+ r(this, h).cartesian = e.current;
132
+ }), r(this, k).subscribe((e) => {
133
+ r(this, h).normalize = e.current;
134
+ }), r(this, P).subscribe((e) => {
135
+ r(this, h).x.mass = e.current, r(this, h).y.mass = e.current, r(this, h).z.mass = e.current;
136
+ }), r(this, _).subscribe((e) => {
137
+ r(this, h).x.stiffness = e.current, r(this, h).y.stiffness = e.current, r(this, h).z.stiffness = e.current;
138
+ }), r(this, h).x.subscribe((e) => {
108
139
  this.style.setProperty("--x", e.current.toString());
109
- }), i(this, n).y.subscribe((e) => {
140
+ }), r(this, h).y.subscribe((e) => {
110
141
  this.style.setProperty("--y", e.current.toString());
111
- }), i(this, n).z.subscribe((e) => {
142
+ }), r(this, h).z.subscribe((e) => {
112
143
  this.style.setProperty("--z", e.current.toString());
113
144
  });
114
145
  }
115
146
  get pointer() {
116
- return i(this, n);
147
+ return r(this, h);
117
148
  }
118
149
  connectedCallback() {
119
- i(this, n).connect(), i(this, d).observe(), i(this, w).observe(), i(this, _).observe();
150
+ r(this, h).connect(), r(this, z).observe(), r(this, P).observe(), r(this, _).observe();
120
151
  }
121
152
  disconnectedCallback() {
122
- i(this, n).disconnect(), i(this, d).unobserve(), i(this, w).unobserve(), i(this, _).unobserve(), this.style.removeProperty("--x"), this.style.removeProperty("--y"), this.style.removeProperty("--z");
153
+ r(this, h).disconnect(), r(this, z).unobserve(), r(this, P).unobserve(), r(this, _).unobserve(), this.style.removeProperty("--x"), this.style.removeProperty("--y"), this.style.removeProperty("--z");
123
154
  }
124
155
  };
125
- n = /* @__PURE__ */ new WeakMap();
126
- d = /* @__PURE__ */ new WeakMap();
127
- w = /* @__PURE__ */ new WeakMap();
128
- _ = /* @__PURE__ */ new WeakMap();
156
+ h = /* @__PURE__ */ new WeakMap();
129
157
  z = /* @__PURE__ */ new WeakMap();
130
- C = /* @__PURE__ */ new WeakMap();
131
- W = Y([
132
- A("e-pointer")
133
- ], W);
158
+ P = /* @__PURE__ */ new WeakMap();
159
+ _ = /* @__PURE__ */ new WeakMap();
160
+ M = /* @__PURE__ */ new WeakMap();
161
+ k = /* @__PURE__ */ new WeakMap();
162
+ H = j([
163
+ X("e-pointer")
164
+ ], H);
134
165
  export {
135
- G as Pointer,
136
- W as PointerElement
166
+ Y as Pointer,
167
+ H as PointerElement
137
168
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"