aptechka 0.5.44 → 0.7.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.
Files changed (234) hide show
  1. package/lib/Animation-6Na1MCtM.cjs +1 -0
  2. package/lib/Animation-CELiTw3n.js +132 -0
  3. package/lib/Composed-DmLYTh1b.js +35 -0
  4. package/lib/Composed-Dx2hs-va.cjs +1 -0
  5. package/lib/{Damped-P4MkCGoY.js → Damped-Mx_FNNVz.js} +2 -5
  6. package/lib/Damped-loFiBsBy.cjs +1 -0
  7. package/lib/{Derived-kPJs5JC5.js → Derived-DlCvc0xQ.js} +1 -1
  8. package/lib/{Derived-B-g8dYgh.cjs → Derived-a6MDQEPY.cjs} +1 -1
  9. package/lib/ElementConstructor-CAZ2ra8m.cjs +1 -0
  10. package/lib/ElementConstructor-OYlPJf2L.js +366 -0
  11. package/lib/Resource-D3TQormz.cjs +1 -0
  12. package/lib/Resource-DIcoALGo.js +64 -0
  13. package/lib/{SourceManager-Q-PB-Rkh.js → SourceManager-Bz329f90.js} +1 -1
  14. package/lib/{SourceManager-vSlsMKUE.cjs → SourceManager-kxr5eUyL.cjs} +1 -1
  15. package/lib/Store-6s0YXK4o.cjs +1 -0
  16. package/lib/{Store-BQXXikps.js → Store-BI2xxXOA.js} +42 -42
  17. package/lib/Tweened-B_mclQ61.cjs +1 -0
  18. package/lib/Tweened-NE8M9onF.js +48 -0
  19. package/lib/{Viewport-DMB0dO-s.cjs → Viewport-CJeKnL5V.cjs} +1 -1
  20. package/lib/{Viewport-CFFhFKqX.js → Viewport-D9IL7kUQ.js} +1 -1
  21. package/lib/_createStore-Cf1MyeHa.cjs +1 -0
  22. package/lib/_createStore-Ck9bHolX.js +12 -0
  23. package/lib/accordion/AccordionElement.d.ts +3 -0
  24. package/lib/accordion/index.cjs +1 -1
  25. package/lib/accordion/index.js +140 -104
  26. package/lib/animation/Animation.d.ts +10 -18
  27. package/lib/animation/Damped.d.ts +3 -5
  28. package/lib/animation/Tweened.d.ts +0 -2
  29. package/lib/animation/index.cjs +1 -1
  30. package/lib/animation/index.js +3 -3
  31. package/lib/attribute/index.cjs +1 -1
  32. package/lib/attribute/index.js +31 -31
  33. package/lib/canvas/index.cjs +1 -1
  34. package/lib/canvas/index.js +3 -3
  35. package/lib/checkbox/index.cjs +1 -1
  36. package/lib/checkbox/index.js +3 -3
  37. package/lib/class-linked-status/index.cjs +1 -1
  38. package/lib/class-linked-status/index.js +1 -1
  39. package/lib/controls/index.cjs +1 -1
  40. package/lib/controls/index.js +3 -3
  41. package/lib/counter/index.d.ts +8 -0
  42. package/lib/{createStylesheet-DBCEbDjI.js → createStylesheet-CR_yi5tp.js} +1 -1
  43. package/lib/{createStylesheet-CqHU9_qv.cjs → createStylesheet-p23sZ7Ey.cjs} +1 -1
  44. package/lib/css-property/index.cjs +1 -1
  45. package/lib/css-property/index.d.ts +1 -0
  46. package/lib/css-property/index.js +36 -32
  47. package/lib/dev/index.cjs +1 -1
  48. package/lib/dev/index.js +1 -1
  49. package/lib/device/index.cjs +1 -1
  50. package/lib/device/index.js +1 -1
  51. package/lib/element-constructor/index.cjs +1 -1
  52. package/lib/element-constructor/index.js +114 -113
  53. package/lib/en3/core/En3Raycaster.d.ts +20 -0
  54. package/lib/en3/core/En3View.d.ts +1 -1
  55. package/lib/en3/core/en3.d.ts +5 -1
  56. package/lib/en3/helpers/En3Controls.d.ts +5 -0
  57. package/lib/en3/helpers/En3GridHelper.d.ts +8 -0
  58. package/lib/en3/helpers/En3Object3dManager.d.ts +12 -0
  59. package/lib/en3/helpers/En3OrbitControls.d.ts +8 -0
  60. package/lib/en3/helpers/En3TransformControls.d.ts +8 -0
  61. package/lib/en3/helpers/index.cjs +1 -0
  62. package/lib/en3/helpers/index.d.ts +2 -0
  63. package/lib/en3/helpers/index.js +1165 -0
  64. package/lib/en3/index.cjs +1 -213
  65. package/lib/en3/index.d.ts +1 -19
  66. package/lib/en3/index.js +4 -3305
  67. package/lib/en3/libs/index.d.ts +1 -0
  68. package/lib/en3/loaders/{en3GLTFLoader.d.ts → _En3GLTFLoader.d.ts} +2 -4
  69. package/lib/en3/loaders/_En3TextureLoader.d.ts +8 -0
  70. package/lib/en3/loaders/index.cjs +1 -0
  71. package/lib/en3/loaders/index.d.ts +3 -0
  72. package/lib/en3/loaders/index.js +1757 -0
  73. package/lib/en3/loaders/loaders.d.ts +13 -0
  74. package/lib/en3/misc/index.cjs +10 -0
  75. package/lib/en3/misc/index.d.ts +2 -0
  76. package/lib/en3/misc/index.js +115 -0
  77. package/lib/en3/objects/En3Clip.d.ts +1 -1
  78. package/lib/en3/objects/En3GLTF.d.ts +2 -1
  79. package/lib/en3/objects/En3ImageLike.d.ts +2 -1
  80. package/lib/en3/objects/En3SourceConsumer.d.ts +1 -1
  81. package/lib/en3/objects/fluid/index.d.ts +0 -3
  82. package/lib/en3/objects/index.d.ts +7 -0
  83. package/lib/en3/utils/index.cjs +1 -0
  84. package/lib/en3/utils/index.d.ts +5 -0
  85. package/lib/en3/utils/index.js +43 -0
  86. package/lib/en3-C4mzaF6q.cjs +8 -0
  87. package/lib/en3-hbkN1OPu.js +343 -0
  88. package/lib/globals-DMjysUXI.js +8 -0
  89. package/lib/globals-bYKki-b9.cjs +1 -0
  90. package/lib/image/index.cjs +1 -1
  91. package/lib/image/index.js +1 -1
  92. package/lib/{index-BN9X-l9M.js → index-BAH_fO2N.js} +3 -3
  93. package/lib/{index-BbgmbQ-5.cjs → index-D1LQUR-R.cjs} +1 -1
  94. package/lib/instantiate-D19Uvc31.js +125 -0
  95. package/lib/instantiate-Db5gGSYG.cjs +1 -0
  96. package/lib/jsx/ComponentElement.d.ts +18 -0
  97. package/lib/jsx/globals.d.ts +13 -0
  98. package/lib/jsx/h.d.ts +7 -0
  99. package/lib/jsx/hooks/basic/_createStore.d.ts +4 -0
  100. package/lib/jsx/hooks/basic/attachInternals.d.ts +1 -0
  101. package/lib/jsx/hooks/basic/attachShadow.d.ts +1 -0
  102. package/lib/jsx/hooks/basic/attachStylesheet.d.ts +3 -0
  103. package/lib/jsx/hooks/basic/createContext.d.ts +2 -0
  104. package/lib/jsx/hooks/basic/onConnect.d.ts +3 -0
  105. package/lib/jsx/hooks/basic/onDisconnect.d.ts +3 -0
  106. package/lib/jsx/hooks/onAnimationFrame.cjs +1 -0
  107. package/lib/jsx/hooks/onAnimationFrame.d.ts +6 -0
  108. package/lib/jsx/hooks/onAnimationFrame.js +22 -0
  109. package/lib/jsx/hooks/onElementResize.cjs +1 -0
  110. package/lib/jsx/hooks/onElementResize.d.ts +5 -0
  111. package/lib/jsx/hooks/onElementResize.js +11 -0
  112. package/lib/jsx/hooks/onIntersection.cjs +1 -0
  113. package/lib/jsx/hooks/onIntersection.d.ts +5 -0
  114. package/lib/jsx/hooks/onIntersection.js +11 -0
  115. package/lib/jsx/hooks/onWindowResize.cjs +1 -0
  116. package/lib/jsx/hooks/onWindowResize.d.ts +3 -0
  117. package/lib/jsx/hooks/onWindowResize.js +8 -0
  118. package/lib/jsx/hooks/store/createArrayStore.d.ts +3 -0
  119. package/lib/jsx/hooks/store/createComposed.d.ts +3 -0
  120. package/lib/jsx/hooks/store/createDerived.d.ts +3 -0
  121. package/lib/jsx/hooks/store/createDerivedArray.d.ts +3 -0
  122. package/lib/jsx/hooks/store/createDerivedComponent.d.ts +3 -0
  123. package/lib/jsx/hooks/store/createDerivedComponents.d.ts +3 -0
  124. package/lib/jsx/hooks/store/createResource.d.ts +3 -0
  125. package/lib/jsx/hooks/store/createStore.d.ts +3 -0
  126. package/lib/jsx/hooks/store/index.cjs +1 -0
  127. package/lib/jsx/hooks/store/index.d.ts +7 -0
  128. package/lib/jsx/hooks/store/index.js +49 -0
  129. package/lib/jsx/hooks/watchAttribute.cjs +1 -0
  130. package/lib/jsx/hooks/watchAttribute.d.ts +6 -0
  131. package/lib/jsx/hooks/watchAttribute.js +17 -0
  132. package/lib/jsx/hooks/watchCSSProperty.cjs +1 -0
  133. package/lib/jsx/hooks/watchCSSProperty.d.ts +7 -0
  134. package/lib/jsx/hooks/watchCSSProperty.js +17 -0
  135. package/lib/jsx/index.cjs +1 -0
  136. package/lib/jsx/index.d.ts +13 -0
  137. package/lib/jsx/index.js +91 -0
  138. package/lib/jsx/instantiate.d.ts +5 -0
  139. package/lib/jsx/register.d.ts +1 -0
  140. package/lib/jsx/render.d.ts +6 -0
  141. package/lib/jsx/type.d.ts +188 -0
  142. package/lib/ladder/index.cjs +1 -1
  143. package/lib/ladder/index.d.ts +2 -0
  144. package/lib/ladder/index.js +84 -66
  145. package/lib/layout-box/index.cjs +1 -1
  146. package/lib/layout-box/index.d.ts +9 -0
  147. package/lib/layout-box/index.js +190 -164
  148. package/lib/media/index.cjs +1 -1
  149. package/lib/media/index.js +1 -1
  150. package/lib/modal/index.cjs +1 -1
  151. package/lib/modal/index.js +7 -7
  152. package/lib/morph/Morph.d.ts +2 -2
  153. package/lib/morph/index.cjs +1 -1
  154. package/lib/morph/index.d.ts +1 -1
  155. package/lib/morph/index.js +135 -143
  156. package/lib/notifier/index.d.ts +2 -2
  157. package/lib/notifier/index.js +3 -1
  158. package/lib/onConnect-DGP866cj.cjs +1 -0
  159. package/lib/onConnect-y5DrxJ9P.js +7 -0
  160. package/lib/pointer/index.cjs +1 -1
  161. package/lib/pointer/index.js +2 -2
  162. package/lib/polyfills-CM4SCDTt.cjs +1 -0
  163. package/lib/polyfills-X6KXuHg-.js +33 -0
  164. package/lib/popover/index.cjs +1 -1
  165. package/lib/popover/index.js +2 -2
  166. package/lib/router/Router.d.ts +11 -3
  167. package/lib/router/index.cjs +1 -1
  168. package/lib/router/index.d.ts +1 -1
  169. package/lib/router/index.js +185 -165
  170. package/lib/scroll/ScrollElement.d.ts +2 -19
  171. package/lib/scroll/ScrollSection.d.ts +23 -0
  172. package/lib/scroll/index.cjs +1 -1
  173. package/lib/scroll/index.js +81 -77
  174. package/lib/select/index.cjs +1 -1
  175. package/lib/select/index.js +1 -1
  176. package/lib/sequence/index.cjs +1 -1
  177. package/lib/sequence/index.js +1 -1
  178. package/lib/source/index.cjs +1 -1
  179. package/lib/source/index.js +2 -2
  180. package/lib/store/ArrayStore.d.ts +21 -0
  181. package/lib/store/Store.d.ts +1 -7
  182. package/lib/store/index.cjs +1 -1
  183. package/lib/store/index.d.ts +2 -2
  184. package/lib/store/index.js +65 -139
  185. package/lib/tags-BqJKcIve.js +485 -0
  186. package/lib/tags-ld5jemJw.cjs +1 -0
  187. package/lib/theme/index.cjs +1 -1
  188. package/lib/theme/index.js +2 -2
  189. package/lib/tweaker/TweakerBooleanManagerElement.d.ts +1 -1
  190. package/lib/tweaker/TweakerColorManagerElement.d.ts +1 -1
  191. package/lib/tweaker/TweakerFolderElement.d.ts +2 -0
  192. package/lib/tweaker/TweakerLinkManagerElement.d.ts +1 -1
  193. package/lib/tweaker/TweakerNumberManagerElement.d.ts +4 -8
  194. package/lib/tweaker/TweakerSelectManagerElement.d.ts +1 -1
  195. package/lib/tweaker/TweakerStoreManagerElement.d.ts +7 -7
  196. package/lib/tweaker/TweakerStringManagerElement.d.ts +3 -5
  197. package/lib/tweaker/index.cjs +3 -3
  198. package/lib/tweaker/index.js +535 -412
  199. package/lib/tweaker/tweakerManagerConstructors.d.ts +2 -2
  200. package/lib/tweaker/tweakerStorage.d.ts +8 -1
  201. package/lib/url-C3dWnJQg.cjs +1 -0
  202. package/lib/url-DMNfW7uN.js +22 -0
  203. package/lib/utils/index.cjs +1 -1
  204. package/lib/utils/index.d.ts +1 -0
  205. package/lib/utils/index.js +39 -34
  206. package/lib/utils/number.d.ts +1 -0
  207. package/lib/utils/url.d.ts +9 -0
  208. package/lib/video/index.cjs +1 -1
  209. package/lib/video/index.js +1 -1
  210. package/package.json +107 -3
  211. package/lib/Animation-DDHjrbtL.cjs +0 -1
  212. package/lib/Animation-Dq_05jlR.js +0 -217
  213. package/lib/DRACOLoader-C2CFpMGS.cjs +0 -2
  214. package/lib/DRACOLoader-D2KY2dku.js +0 -241
  215. package/lib/Damped-l0mnlhar.cjs +0 -1
  216. package/lib/KTX2Loader-DdUl1XiY.cjs +0 -2
  217. package/lib/KTX2Loader-DqpAffDj.js +0 -536
  218. package/lib/Store-C-1ruEIm.cjs +0 -1
  219. package/lib/Tweened-CwDC2zl8.js +0 -51
  220. package/lib/Tweened-DIt9j9B-.cjs +0 -1
  221. package/lib/animation/AnimationLink.d.ts +0 -13
  222. package/lib/en3/loaders/en3TextureLoader.d.ts +0 -3
  223. package/lib/en3/test/En3HTML.d.ts +0 -10
  224. package/lib/polyfills-BA-CL_HF.js +0 -27
  225. package/lib/polyfills-DHs2SNbz.cjs +0 -1
  226. package/lib/store/CumulativeResource.d.ts +0 -13
  227. package/lib/tags-CMPg9ETZ.js +0 -848
  228. package/lib/tags-Djb6mb1o.cjs +0 -1
  229. package/lib/tweaker/TweakerRangeManagerElement.d.ts +0 -11
  230. /package/lib/en3/{loaders → core}/en3Cache.d.ts +0 -0
  231. /package/lib/{MeshoptDecoder-CMeN3oU0.cjs → en3/libs/index.cjs} +0 -0
  232. /package/lib/{MeshoptDecoder-6XfTpOG2.js → en3/libs/index.js} +0 -0
  233. /package/lib/en3/{test → misc}/En3ModifiedMaterial.d.ts +0 -0
  234. /package/lib/en3/{attachments → misc}/En3SourceManager.d.ts +0 -0
@@ -1,7 +1,9 @@
1
+ import { splitPath, ChangeHistoryAction } from '../utils';
1
2
  import { Route, RouteModule } from './Route';
3
+ import { Link } from './Link';
2
4
 
3
5
  export interface RouterPreprocessorEntry {
4
- pathname: string;
6
+ path: ReturnType<typeof splitPath>;
5
7
  resolve: () => void;
6
8
  reject: () => void;
7
9
  }
@@ -14,7 +16,6 @@ export interface RouterAfterNavigationEntry {
14
16
  pathname: string;
15
17
  }
16
18
  export type RouterAfterNavigationCallback = (entry: RouterAfterNavigationEntry) => void;
17
- export type RouterHistoryAction = 'push' | 'replace' | 'none';
18
19
  export interface RouterParameters {
19
20
  rootElement?: HTMLElement;
20
21
  base?: string;
@@ -28,7 +29,14 @@ export declare class Router {
28
29
  get currentPathname(): string;
29
30
  get candidatePathname(): string | undefined;
30
31
  get routes(): Route[];
32
+ get links(): Link[];
31
33
  navigationEvent(callback: RouterAfterNavigationCallback): () => void;
32
34
  defineRoute(pattern: string, module: RouteModule): void;
33
- navigate(pathname: string, action?: RouterHistoryAction): Promise<void>;
35
+ navigate(path: string, action?: ChangeHistoryAction): Promise<void>;
36
+ normalizePath(path: string): {
37
+ leaf: string;
38
+ pathname: string;
39
+ parameters: string;
40
+ hash: string;
41
+ };
34
42
  }
@@ -1 +1 @@
1
- "use strict";var X=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var z=(n,t,s)=>{if(!t.has(n))throw TypeError("Cannot "+s)};var e=(n,t,s)=>(z(n,t,"read from private field"),s?s.call(n):t.get(n)),r=(n,t,s)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,s)},o=(n,t,s,i)=>(z(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s);var F=(n,t,s)=>(z(n,t,"access private method"),s);var B=(n,t,s)=>new Promise((i,u)=>{var h=f=>{try{d(s.next(f))}catch(T){u(T)}},a=f=>{try{d(s.throw(f))}catch(T){u(T)}},d=f=>f.done?i(f.value):Promise.resolve(f.value).then(h,a);d((s=s.apply(n,t)).next())});var G=(n,t,s)=>(t=n[X("asyncIterator")])?t.call(n):(n=n[X("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=h=>new Promise((a,d,f)=>(h=u.call(n,h),f=h.done,Promise.resolve(h.value).then(T=>a({value:T,done:f}),d)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const tt=require("urlpattern-polyfill"),et=require("../notifier/index.cjs"),Z=require("../browser-CpzFX2xg.cjs"),st=require("../function-MthRj-GJ.cjs"),it=require("../object-CCiXnER2.cjs");var b,O,R,m,l,v,S,p,P,y,I,_;class nt{constructor(t,s){r(this,I);r(this,b,void 0);r(this,O,void 0);r(this,R,void 0);r(this,m,void 0);r(this,l,void 0);r(this,v,void 0);r(this,S,void 0);r(this,p,null);r(this,P,[]);r(this,y,[]);o(this,b,t),o(this,O,s),o(this,R,new URLPattern({pathname:e(this,b)})),o(this,m,null),o(this,l,null),o(this,v,!1),o(this,S,null),Z.isBrowser&&o(this,p,new MutationObserver(i=>{i[0].addedNodes.forEach(h=>{e(this,m)?e(this,y).push(h):e(this,P).push(h)})}))}get pattern(){return e(this,b)}get urlPattern(){return e(this,R)}get isActive(){return e(this,v)}get element(){return e(this,l)}get nest(){return e(this,S)}testPathname(t){return this.urlPattern.test({pathname:t})}render(t,s){return B(this,null,function*(){var i,u;if(e(this,p).observe(document.head,{childList:!0,subtree:!0}),e(this,m))e(this,P).forEach(h=>{document.head.appendChild(h)});else{const h=yield e(this,O).call(this);if(o(this,y,[...e(this,P)]),typeof h.default=="function"&&(o(this,m,h.default),it.isESClass(h.default))){const a="e-"+((i=e(this,m))==null?void 0:i.name.toLowerCase());customElements.get(a)||customElements.define(a,h.default)}}if(yield F(this,I,_).call(this),e(this,m)){const h=e(this,R).exec({pathname:s}),a=(h==null?void 0:h.pathname.groups)||{},d=Object.fromEntries(new URLSearchParams(location.search)),f={pathnameParams:a,searchParams:d};o(this,l,new(e(this,m))(f)),t.appendChild(e(this,l)),o(this,S,e(this,l).querySelector("[data-nest]")||((u=e(this,l).shadowRoot)==null?void 0:u.querySelector("[data-nest]"))||e(this,l).shadowRoot||e(this,l)),o(this,v,!0)}e(this,p).disconnect()})}close(){var t;e(this,p).disconnect(),(t=e(this,l))==null||t.remove(),o(this,v,!1),e(this,y).forEach(s=>document.head.removeChild(s)),o(this,y,[])}getAnchorElements(){var s;let t=[];return e(this,l)&&(t=[...e(this,l).querySelectorAll("a")]),(s=e(this,l))!=null&&s.shadowRoot&&(t=[...t,...e(this,l).shadowRoot.querySelectorAll("a")]),t}}b=new WeakMap,O=new WeakMap,R=new WeakMap,m=new WeakMap,l=new WeakMap,v=new WeakMap,S=new WeakMap,p=new WeakMap,P=new WeakMap,y=new WeakMap,I=new WeakSet,_=function(){return B(this,null,function*(){const t=e(this,P).filter(a=>a instanceof HTMLElement?a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK":!1);try{for(var s=G(t),i,u,h;i=!(u=yield s.next()).done;i=!1){const a=u.value;yield new Promise(d=>{a.onload=()=>{d()}})}}catch(u){h=[u]}finally{try{i&&(u=s.return)&&(yield u.call(s))}finally{if(h)throw h[0]}}})};var H,g,A,U,j;class rt{constructor(t,s){r(this,H,void 0);r(this,g,void 0);r(this,A,void 0);r(this,U,void 0);r(this,j,t=>{t.preventDefault(),e(this,H).navigate(e(this,A),e(this,U))});o(this,H,t),o(this,g,s),o(this,A,e(this,g).getAttribute("href")||"/"),o(this,U,e(this,g).getAttribute("data-history-action")||"push"),e(this,g).addEventListener("click",e(this,j)),location.pathname===e(this,A)&&e(this,g).classList.add("current")}destroy(){e(this,g).removeEventListener("click",e(this,j)),e(this,g).classList.remove("current")}}H=new WeakMap,g=new WeakMap,A=new WeakMap,U=new WeakMap,j=new WeakMap;globalThis.URLPattern=tt.URLPattern;var k,q,w,N,M,E,C,x,D,K,$,W;const Y=class Y{constructor(t){r(this,K);r(this,k,null);r(this,q,void 0);r(this,w,[]);r(this,N,null);r(this,M,[]);r(this,E,void 0);r(this,C,null);r(this,x,new et.Notifier);r(this,D,st.debounce(()=>{const t=s=>s.split("/").length;o(this,w,e(this,w).sort((s,i)=>t(s.pattern)-t(i.pattern))),this.navigate(location.pathname.replace(e(this,q),""))},0));r(this,W,t=>{t.state&&this.navigate(t.state,"none")});o(this,q,(t==null?void 0:t.base)||""),Y.active=this,Z.isBrowser&&(o(this,k,(t==null?void 0:t.rootElement)||document.body),addEventListener("popstate",e(this,W)))}get currentPathname(){return e(this,C)}get candidatePathname(){return e(this,E)}get routes(){return e(this,w)}navigationEvent(t){return e(this,x).subscribe(t)}defineRoute(t,s){const i=new nt(t,s);e(this,w).push(i),e(this,D).call(this)}navigate(t,s="push"){return B(this,null,function*(){var f,Q;if(e(this,E)===t||e(this,C)===t)return;Y.active=this,o(this,E,t);const i=e(this,w).filter(c=>c.isActive),u=e(this,w).filter(c=>!i.includes(c)&&c.testPathname(t)),h=i.filter(c=>!c.testPathname(t)),a=i.filter(c=>c.testPathname(t));let d=!0;if(this.preprocessor)try{yield new Promise((c,L)=>{var V;(V=this.preprocessor)==null||V.call(this,{pathname:t,resolve:c,reject:L})})}catch(c){c?console.error(c):console.log("Route change canceled"),d=!1}if(d&&e(this,E)===t){o(this,N,a[a.length-1]),h.forEach(L=>{L.close()}),o(this,C,t);try{for(var T=G(u),at,ct,lt;at=!(ct=yield T.next()).done;at=!1){const L=ct.value;yield L.render(((f=e(this,N))==null?void 0:f.nest)||e(this,k),t),o(this,N,L)}}catch(ct){lt=[ct]}finally{try{at&&(ct=T.return)&&(yield ct.call(T))}finally{if(lt)throw lt[0]}}const c=e(this,q)+t+location.search;s==="push"?history.pushState(c,"",c):s==="replace"&&history.replaceState(c,"",c),F(this,K,$).call(this),(Q=this.postprocessor)==null||Q.call(this,{pathname:t}),e(this,x).notify({pathname:t})}})}};k=new WeakMap,q=new WeakMap,w=new WeakMap,N=new WeakMap,M=new WeakMap,E=new WeakMap,C=new WeakMap,x=new WeakMap,D=new WeakMap,K=new WeakSet,$=function(){const t=e(this,w).filter(i=>i.isActive),s=Array.from(new Set([...e(this,k).querySelectorAll("a"),...t.map(i=>i.getAnchorElements()).flat()].filter(i=>{var u;return(u=i.getAttribute("href"))==null?void 0:u.startsWith("/")})));e(this,M).forEach(i=>{i.destroy()}),o(this,M,s.map(i=>new rt(this,i)))},W=new WeakMap;let J=Y;exports.Router=J;
1
+ "use strict";var tt=(a,e)=>(e=Symbol[a])?e:Symbol.for("Symbol."+a);var Y=(a,e,s)=>{if(!e.has(a))throw TypeError("Cannot "+s)};var t=(a,e,s)=>(Y(a,e,"read from private field"),s?s.call(a):e.get(a)),h=(a,e,s)=>{if(e.has(a))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(a):e.set(a,s)},n=(a,e,s,i)=>(Y(a,e,"write to private field"),i?i.call(a,s):e.set(a,s),s);var F=(a,e,s)=>(Y(a,e,"access private method"),s);var M=(a,e,s)=>new Promise((i,r)=>{var o=u=>{try{f(s.next(u))}catch(v){r(v)}},c=u=>{try{f(s.throw(u))}catch(v){r(v)}},f=u=>u.done?i(u.value):Promise.resolve(u.value).then(o,c);f((s=s.apply(a,e)).next())});var G=(a,e,s)=>(e=a[tt("asyncIterator")])?e.call(a):(a=a[tt("iterator")](),e={},s=(i,r)=>(r=a[i])&&(e[i]=o=>new Promise((c,f,u)=>(o=r.call(a,o),u=o.done,Promise.resolve(o.value).then(v=>c({value:v,done:u}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("urlpattern-polyfill"),ot=require("../notifier/index.cjs"),st=require("../browser-CpzFX2xg.cjs"),ct=require("../function-MthRj-GJ.cjs"),J=require("../url-C3dWnJQg.cjs"),lt=require("../instantiate-Db5gGSYG.cjs"),et=require("../object-CCiXnER2.cjs");var R,O,A,p,d,w,S,L,b,E,x,it;class ut{constructor(e,s){h(this,x);h(this,R,void 0);h(this,O,void 0);h(this,A,void 0);h(this,p,void 0);h(this,d,void 0);h(this,w,void 0);h(this,S,void 0);h(this,L,null);h(this,b,[]);h(this,E,[]);n(this,R,e),n(this,O,s),n(this,A,new URLPattern({pathname:t(this,R)})),n(this,p,null),n(this,d,null),n(this,w,!1),n(this,S,null),st.isBrowser&&n(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,w)}get element(){return t(this,d)}get nest(){return t(this,S)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,r;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(n(this,E,[...t(this,b)]),typeof o.default=="function"&&(n(this,p,o.default),et.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield F(this,x,it).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),u={pathnameParams:c,searchParams:f};et.isESClass(t(this,p))?n(this,d,new(t(this,p))(u)):n(this,d,lt.instantiate(t(this,p),{attributes:u})),e.appendChild(t(this,d)),n(this,S,t(this,d).querySelector("[data-nest]")||((r=t(this,d).shadowRoot)==null?void 0:r.querySelector("[data-nest]"))||t(this,d).shadowRoot||t(this,d)),n(this,w,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,d))==null||e.remove(),n(this,w,!1),t(this,E).forEach(s=>document.head.removeChild(s)),n(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,d)&&(e=[...t(this,d).querySelectorAll("a")]),(s=t(this,d))!=null&&s.shadowRoot&&(e=[...e,...t(this,d).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,d=new WeakMap,w=new WeakMap,S=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,it=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=G(e),i,r,o;i=!(r=yield s.next()).done;i=!1){const c=r.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(r){o=[r]}finally{try{i&&(r=s.return)&&(yield r.call(s))}finally{if(o)throw o[0]}}})};var k,m,P,U,q,j;class dt{constructor(e,s){h(this,k,void 0);h(this,m,void 0);h(this,P,void 0);h(this,U,void 0);h(this,q,void 0);h(this,j,e=>{e.preventDefault(),t(this,k).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,m).classList.add("clicked"):t(s,m).classList.remove("clicked")}),t(this,k).navigate(t(this,P),t(this,U))});var o,c;n(this,k,e),n(this,m,s),n(this,P,t(this,m).getAttribute("href")||"/"),n(this,U,t(this,m).getAttribute("data-history-action")||"push"),t(this,m).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),r=e.normalizePath(location.pathname);n(this,q,(o=t(this,m).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,m).hasAttribute("data-include")?r.pathname.includes(i.pathname)&&t(this,m).classList.add("current"):i.pathname===r.pathname||(c=t(this,q))!=null&&c.includes(r.pathname)?(t(this,m).classList.add("current"),t(this,m).classList.add("clicked")):t(this,m).classList.remove("clicked")}destroy(){t(this,m).removeEventListener("click",t(this,j)),t(this,m).classList.remove("current")}}k=new WeakMap,m=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=rt.URLPattern;var C,N,g,z,T,y,H,B,I,D,nt,K;const W=class W{constructor(e){h(this,D);h(this,C,null);h(this,N,null);h(this,g,[]);h(this,z,null);h(this,T,[]);h(this,y,void 0);h(this,H,null);h(this,B,new ot.Notifier);h(this,I,ct.debounce(()=>{const e=s=>s.split("/").length;n(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));h(this,K,e=>{e.state&&this.navigate(e.state,"none")});st.isBrowser&&(e!=null&&e.base?n(this,N,J.normalizeBase(e.base)):n(this,N,"/"),W.active=this,n(this,C,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,K)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ut(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Z,_;const i=this.normalizePath(e);let{pathname:r,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===r||t(this,H)===r)return;W.active=this,n(this,y,r);const u=t(this,g).filter(l=>l.isActive),v=t(this,g).filter(l=>!u.includes(l)&&l.testPathname(f)),at=u.filter(l=>!l.testPathname(f)),V=u.filter(l=>l.testPathname(f));let X=!0;if(this.preprocessor)try{yield new Promise((l,ht)=>{var $;($=this.preprocessor)==null||$.call(this,{path:i,resolve:l,reject:ht})})}catch(l){l?console.error(l):console.log("Route change canceled"),X=!1}if(X&&t(this,y)===r){n(this,z,V[V.length-1]),at.forEach(l=>{l.close()}),n(this,H,r);try{for(var pt=G(v),gt,Pt,vt;gt=!(Pt=yield pt.next()).done;gt=!1){const l=Pt.value;yield l.render(((Z=t(this,z))==null?void 0:Z.nest)||t(this,C),r),n(this,z,l)}}catch(Pt){vt=[Pt]}finally{try{gt&&(Pt=pt.return)&&(yield Pt.call(pt))}finally{if(vt)throw vt[0]}}J.changeHistory(s,r,c,o),F(this,D,nt).call(this),(_=this.postprocessor)==null||_.call(this,{pathname:r}),t(this,B).notify({pathname:r})}})}normalizePath(e){return J.splitPath(e,t(this,N))}};C=new WeakMap,N=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,D=new WeakSet,nt=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,C).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var r;return(r=i.getAttribute("href"))==null?void 0:r.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),n(this,T,s.map(i=>new dt(this,i)))},K=new WeakMap;let Q=W;exports.Router=Q;
@@ -1,2 +1,2 @@
1
- export { Router, type RouterPreprocessorEntry, type RouterPreprocessor, type RouterPostprocessor, type RouterAfterNavigationCallback, type RouterHistoryAction, type RouterParameters, } from './Router';
1
+ export { Router, type RouterPreprocessorEntry, type RouterPreprocessor, type RouterPostprocessor, type RouterAfterNavigationCallback, type RouterParameters, } from './Router';
2
2
  export { type RouteModule, type RouteParameters, type RouteURLParams, } from './Route';
@@ -1,256 +1,276 @@
1
- var Q = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n);
2
- var $ = (n, t, s) => {
3
- if (!t.has(n))
1
+ var Z = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n);
2
+ var Y = (n, e, s) => {
3
+ if (!e.has(n))
4
4
  throw TypeError("Cannot " + s);
5
5
  };
6
- var e = (n, t, s) => ($(n, t, "read from private field"), s ? s.call(n) : t.get(n)), r = (n, t, s) => {
7
- if (t.has(n))
6
+ var t = (n, e, s) => (Y(n, e, "read from private field"), s ? s.call(n) : e.get(n)), h = (n, e, s) => {
7
+ if (e.has(n))
8
8
  throw TypeError("Cannot add the same private member more than once");
9
- t instanceof WeakSet ? t.add(n) : t.set(n, s);
10
- }, o = (n, t, s, i) => ($(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s);
11
- var z = (n, t, s) => ($(n, t, "access private method"), s);
12
- var j = (n, t, s) => new Promise((i, u) => {
13
- var h = (f) => {
9
+ e instanceof WeakSet ? e.add(n) : e.set(n, s);
10
+ }, a = (n, e, s, i) => (Y(n, e, "write to private field"), i ? i.call(n, s) : e.set(n, s), s);
11
+ var $ = (n, e, s) => (Y(n, e, "access private method"), s);
12
+ var I = (n, e, s) => new Promise((i, r) => {
13
+ var o = (u) => {
14
14
  try {
15
- d(s.next(f));
16
- } catch (T) {
17
- u(T);
15
+ f(s.next(u));
16
+ } catch (v) {
17
+ r(v);
18
18
  }
19
- }, a = (f) => {
19
+ }, c = (u) => {
20
20
  try {
21
- d(s.throw(f));
22
- } catch (T) {
23
- u(T);
21
+ f(s.throw(u));
22
+ } catch (v) {
23
+ r(v);
24
24
  }
25
- }, d = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(h, a);
26
- d((s = s.apply(n, t)).next());
25
+ }, f = (u) => u.done ? i(u.value) : Promise.resolve(u.value).then(o, c);
26
+ f((s = s.apply(n, e)).next());
27
27
  });
28
- var F = (n, t, s) => (t = n[Q("asyncIterator")]) ? t.call(n) : (n = n[Q("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (h) => new Promise((a, d, f) => (h = u.call(n, h), f = h.done, Promise.resolve(h.value).then((T) => a({ value: T, done: f }), d)))), s("next"), s("return"), t);
29
- import { URLPattern as tt } from "urlpattern-polyfill";
30
- import { Notifier as et } from "../notifier/index.js";
31
- import { i as X } from "../browser-0zX67oeU.js";
32
- import { d as st } from "../function-C10DGppn.js";
33
- import { i as it } from "../object-D6MVWB4l.js";
34
- var R, U, b, m, l, w, A, v, P, E, B, Z;
35
- class nt {
36
- constructor(t, s) {
37
- r(this, B);
38
- r(this, R, void 0);
39
- r(this, U, void 0);
40
- r(this, b, void 0);
41
- r(this, m, void 0);
42
- r(this, l, void 0);
43
- r(this, w, void 0);
44
- r(this, A, void 0);
45
- r(this, v, null);
46
- r(this, P, []);
47
- r(this, E, []);
48
- o(this, R, t), o(this, U, s), o(this, b, new URLPattern({ pathname: e(this, R) })), o(this, m, null), o(this, l, null), o(this, w, !1), o(this, A, null), X && o(this, v, new MutationObserver((i) => {
49
- i[0].addedNodes.forEach((h) => {
50
- e(this, m) ? e(this, E).push(h) : e(this, P).push(h);
28
+ var F = (n, e, s) => (e = n[Z("asyncIterator")]) ? e.call(n) : (n = n[Z("iterator")](), e = {}, s = (i, r) => (r = n[i]) && (e[i] = (o) => new Promise((c, f, u) => (o = r.call(n, o), u = o.done, Promise.resolve(o.value).then((v) => c({ value: v, done: u }), f)))), s("next"), s("return"), e);
29
+ import { URLPattern as ht } from "urlpattern-polyfill";
30
+ import { Notifier as rt } from "../notifier/index.js";
31
+ import { i as et } from "../browser-0zX67oeU.js";
32
+ import { d as ot } from "../function-C10DGppn.js";
33
+ import { n as ct, c as lt, s as ut } from "../url-DMNfW7uN.js";
34
+ import { i as mt } from "../instantiate-D19Uvc31.js";
35
+ import { i as _ } from "../object-D6MVWB4l.js";
36
+ var R, U, A, p, m, w, k, L, E, b, M, st;
37
+ class dt {
38
+ constructor(e, s) {
39
+ h(this, M);
40
+ h(this, R, void 0);
41
+ h(this, U, void 0);
42
+ h(this, A, void 0);
43
+ h(this, p, void 0);
44
+ h(this, m, void 0);
45
+ h(this, w, void 0);
46
+ h(this, k, void 0);
47
+ h(this, L, null);
48
+ h(this, E, []);
49
+ h(this, b, []);
50
+ a(this, R, e), a(this, U, s), a(this, A, new URLPattern({ pathname: t(this, R) })), a(this, p, null), a(this, m, null), a(this, w, !1), a(this, k, null), et && a(this, L, new MutationObserver((i) => {
51
+ i[0].addedNodes.forEach((o) => {
52
+ t(this, p) ? t(this, b).push(o) : t(this, E).push(o);
51
53
  });
52
54
  }));
53
55
  }
54
56
  get pattern() {
55
- return e(this, R);
57
+ return t(this, R);
56
58
  }
57
59
  get urlPattern() {
58
- return e(this, b);
60
+ return t(this, A);
59
61
  }
60
62
  get isActive() {
61
- return e(this, w);
63
+ return t(this, w);
62
64
  }
63
65
  get element() {
64
- return e(this, l);
66
+ return t(this, m);
65
67
  }
66
68
  get nest() {
67
- return e(this, A);
69
+ return t(this, k);
68
70
  }
69
- testPathname(t) {
70
- return this.urlPattern.test({ pathname: t });
71
+ testPathname(e) {
72
+ return this.urlPattern.test({ pathname: e });
71
73
  }
72
- render(t, s) {
73
- return j(this, null, function* () {
74
- var i, u;
75
- if (e(this, v).observe(document.head, {
74
+ render(e, s) {
75
+ return I(this, null, function* () {
76
+ var i, r;
77
+ if (t(this, L).observe(document.head, {
76
78
  childList: !0,
77
79
  subtree: !0
78
- }), e(this, m))
79
- e(this, P).forEach((h) => {
80
- document.head.appendChild(h);
80
+ }), t(this, p))
81
+ t(this, E).forEach((o) => {
82
+ document.head.appendChild(o);
81
83
  });
82
84
  else {
83
- const h = yield e(this, U).call(this);
84
- if (o(this, E, [...e(this, P)]), typeof h.default == "function" && (o(this, m, h.default), it(h.default))) {
85
- const a = "e-" + ((i = e(this, m)) == null ? void 0 : i.name.toLowerCase());
86
- customElements.get(a) || customElements.define(a, h.default);
85
+ const o = yield t(this, U).call(this);
86
+ if (a(this, b, [...t(this, E)]), typeof o.default == "function" && (a(this, p, o.default), _(o.default))) {
87
+ const c = "e-" + ((i = t(this, p)) == null ? void 0 : i.name.toLowerCase());
88
+ customElements.get(c) || customElements.define(c, o.default);
87
89
  }
88
90
  }
89
- if (yield z(this, B, Z).call(this), e(this, m)) {
90
- const h = e(this, b).exec({ pathname: s }), a = (h == null ? void 0 : h.pathname.groups) || {}, d = Object.fromEntries(
91
+ if (yield $(this, M, st).call(this), t(this, p)) {
92
+ const o = t(this, A).exec({ pathname: s }), c = (o == null ? void 0 : o.pathname.groups) || {}, f = Object.fromEntries(
91
93
  new URLSearchParams(location.search)
92
- ), f = {
93
- pathnameParams: a,
94
- searchParams: d
94
+ ), u = {
95
+ pathnameParams: c,
96
+ searchParams: f
95
97
  };
96
- o(this, l, new (e(this, m))(f)), t.appendChild(e(this, l)), o(this, A, e(this, l).querySelector("[data-nest]") || ((u = e(this, l).shadowRoot) == null ? void 0 : u.querySelector("[data-nest]")) || e(this, l).shadowRoot || e(this, l)), o(this, w, !0);
98
+ _(t(this, p)) ? a(this, m, new (t(this, p))(u)) : a(this, m, mt(t(this, p), {
99
+ attributes: u
100
+ })), e.appendChild(t(this, m)), a(this, k, t(this, m).querySelector("[data-nest]") || ((r = t(this, m).shadowRoot) == null ? void 0 : r.querySelector("[data-nest]")) || t(this, m).shadowRoot || t(this, m)), a(this, w, !0);
97
101
  }
98
- e(this, v).disconnect();
102
+ t(this, L).disconnect();
99
103
  });
100
104
  }
101
105
  close() {
102
- var t;
103
- e(this, v).disconnect(), (t = e(this, l)) == null || t.remove(), o(this, w, !1), e(this, E).forEach((s) => document.head.removeChild(s)), o(this, E, []);
106
+ var e;
107
+ t(this, L).disconnect(), (e = t(this, m)) == null || e.remove(), a(this, w, !1), t(this, b).forEach((s) => document.head.removeChild(s)), a(this, b, []);
104
108
  }
105
109
  getAnchorElements() {
106
110
  var s;
107
- let t = [];
108
- return e(this, l) && (t = [...e(this, l).querySelectorAll("a")]), (s = e(this, l)) != null && s.shadowRoot && (t = [
109
- ...t,
110
- ...e(this, l).shadowRoot.querySelectorAll("a")
111
- ]), t;
111
+ let e = [];
112
+ return t(this, m) && (e = [...t(this, m).querySelectorAll("a")]), (s = t(this, m)) != null && s.shadowRoot && (e = [
113
+ ...e,
114
+ ...t(this, m).shadowRoot.querySelectorAll("a")
115
+ ]), e;
112
116
  }
113
117
  }
114
- R = new WeakMap(), U = new WeakMap(), b = new WeakMap(), m = new WeakMap(), l = new WeakMap(), w = new WeakMap(), A = new WeakMap(), v = new WeakMap(), P = new WeakMap(), E = new WeakMap(), B = new WeakSet(), Z = function() {
115
- return j(this, null, function* () {
116
- const t = e(this, P).filter((a) => a instanceof HTMLElement ? a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK" : !1);
118
+ R = new WeakMap(), U = new WeakMap(), A = new WeakMap(), p = new WeakMap(), m = new WeakMap(), w = new WeakMap(), k = new WeakMap(), L = new WeakMap(), E = new WeakMap(), b = new WeakMap(), M = new WeakSet(), st = function() {
119
+ return I(this, null, function* () {
120
+ const e = t(this, E).filter((c) => c instanceof HTMLElement ? c.tagName === "STYLE" || c.tagName === "SCRIPT" || c.tagName === "LINK" : !1);
117
121
  try {
118
- for (var s = F(t), i, u, h; i = !(u = yield s.next()).done; i = !1) {
119
- const a = u.value;
120
- yield new Promise((d) => {
121
- a.onload = () => {
122
- d();
122
+ for (var s = F(e), i, r, o; i = !(r = yield s.next()).done; i = !1) {
123
+ const c = r.value;
124
+ yield new Promise((f) => {
125
+ c.onload = () => {
126
+ f();
123
127
  };
124
128
  });
125
129
  }
126
- } catch (u) {
127
- h = [u];
130
+ } catch (r) {
131
+ o = [r];
128
132
  } finally {
129
133
  try {
130
- i && (u = s.return) && (yield u.call(s));
134
+ i && (r = s.return) && (yield r.call(s));
131
135
  } finally {
132
- if (h)
133
- throw h[0];
136
+ if (o)
137
+ throw o[0];
134
138
  }
135
139
  }
136
140
  });
137
141
  };
138
- var H, g, S, O, x;
139
- class rt {
140
- constructor(t, s) {
141
- r(this, H, void 0);
142
- r(this, g, void 0);
143
- r(this, S, void 0);
144
- r(this, O, void 0);
145
- r(this, x, (t) => {
146
- t.preventDefault(), e(this, H).navigate(e(this, S), e(this, O));
142
+ var S, d, P, O, N, x;
143
+ class ft {
144
+ constructor(e, s) {
145
+ h(this, S, void 0);
146
+ h(this, d, void 0);
147
+ h(this, P, void 0);
148
+ h(this, O, void 0);
149
+ h(this, N, void 0);
150
+ h(this, x, (e) => {
151
+ e.preventDefault(), t(this, S).links.forEach((s) => {
152
+ var i;
153
+ t(this, P) === t(s, P) || (i = t(s, N)) != null && i.includes(t(this, P)) ? t(s, d).classList.add("clicked") : t(s, d).classList.remove("clicked");
154
+ }), t(this, S).navigate(t(this, P), t(this, O));
147
155
  });
148
- o(this, H, t), o(this, g, s), o(this, S, e(this, g).getAttribute("href") || "/"), o(this, O, e(this, g).getAttribute("data-history-action") || "push"), e(this, g).addEventListener("click", e(this, x)), location.pathname === e(this, S) && e(this, g).classList.add("current");
156
+ var o, c;
157
+ a(this, S, e), a(this, d, s), a(this, P, t(this, d).getAttribute("href") || "/"), a(this, O, t(this, d).getAttribute(
158
+ "data-history-action"
159
+ ) || "push"), t(this, d).addEventListener("click", t(this, x));
160
+ const i = e.normalizePath(t(this, P)), r = e.normalizePath(location.pathname);
161
+ a(this, N, (o = t(this, d).getAttribute("data-match-paths")) == null ? void 0 : o.split(",").map((f) => e.normalizePath(f.trim()).pathname)), t(this, d).hasAttribute("data-include") ? r.pathname.includes(i.pathname) && t(this, d).classList.add("current") : i.pathname === r.pathname || (c = t(this, N)) != null && c.includes(r.pathname) ? (t(this, d).classList.add("current"), t(this, d).classList.add("clicked")) : t(this, d).classList.remove("clicked");
149
162
  }
150
163
  destroy() {
151
- e(this, g).removeEventListener("click", e(this, x)), e(this, g).classList.remove("current");
164
+ t(this, d).removeEventListener("click", t(this, x)), t(this, d).classList.remove("current");
152
165
  }
153
166
  }
154
- H = new WeakMap(), g = new WeakMap(), S = new WeakMap(), O = new WeakMap(), x = new WeakMap();
155
- globalThis.URLPattern = tt;
156
- var k, N, p, C, I, L, q, M, D, K, _, W;
157
- const Y = class Y {
158
- constructor(t) {
159
- r(this, K);
160
- r(this, k, null);
161
- r(this, N, void 0);
162
- r(this, p, []);
163
- r(this, C, null);
164
- r(this, I, []);
165
- r(this, L, void 0);
166
- r(this, q, null);
167
- r(this, M, new et());
168
- r(this, D, st(() => {
169
- const t = (s) => s.split("/").length;
170
- o(this, p, e(this, p).sort((s, i) => t(s.pattern) - t(i.pattern))), this.navigate(location.pathname.replace(e(this, N), ""));
167
+ S = new WeakMap(), d = new WeakMap(), P = new WeakMap(), O = new WeakMap(), N = new WeakMap(), x = new WeakMap();
168
+ globalThis.URLPattern = ht;
169
+ var C, z, g, q, H, y, T, B, j, D, it, K;
170
+ const W = class W {
171
+ constructor(e) {
172
+ h(this, D);
173
+ h(this, C, null);
174
+ h(this, z, null);
175
+ h(this, g, []);
176
+ h(this, q, null);
177
+ h(this, H, []);
178
+ h(this, y, void 0);
179
+ h(this, T, null);
180
+ h(this, B, new rt());
181
+ h(this, j, ot(() => {
182
+ const e = (s) => s.split("/").length;
183
+ a(this, g, t(this, g).sort((s, i) => e(s.pattern) - e(i.pattern))), this.navigate(location.pathname);
171
184
  }, 0));
172
- r(this, W, (t) => {
173
- t.state && this.navigate(t.state, "none");
185
+ h(this, K, (e) => {
186
+ e.state && this.navigate(e.state, "none");
174
187
  });
175
- o(this, N, (t == null ? void 0 : t.base) || ""), Y.active = this, X && (o(this, k, (t == null ? void 0 : t.rootElement) || document.body), addEventListener("popstate", e(this, W)));
188
+ et && (e != null && e.base ? a(this, z, ct(e.base)) : a(this, z, "/"), W.active = this, a(this, C, (e == null ? void 0 : e.rootElement) || document.body), addEventListener("popstate", t(this, K)));
176
189
  }
177
190
  get currentPathname() {
178
- return e(this, q);
191
+ return t(this, T);
179
192
  }
180
193
  get candidatePathname() {
181
- return e(this, L);
194
+ return t(this, y);
182
195
  }
183
196
  get routes() {
184
- return e(this, p);
197
+ return t(this, g);
185
198
  }
186
- navigationEvent(t) {
187
- return e(this, M).subscribe(t);
199
+ get links() {
200
+ return t(this, H);
188
201
  }
189
- defineRoute(t, s) {
190
- const i = new nt(t, s);
191
- e(this, p).push(i), e(this, D).call(this);
202
+ navigationEvent(e) {
203
+ return t(this, B).subscribe(e);
192
204
  }
193
- navigate(t, s = "push") {
194
- return j(this, null, function* () {
195
- var f, G;
196
- if (e(this, L) === t || e(this, q) === t)
205
+ defineRoute(e, s) {
206
+ const i = new dt(e, s);
207
+ t(this, g).push(i), t(this, j).call(this);
208
+ }
209
+ navigate(e, s = "push") {
210
+ return I(this, null, function* () {
211
+ var Q, V;
212
+ const i = this.normalizePath(e);
213
+ let { pathname: r, hash: o, parameters: c, leaf: f } = i;
214
+ if (t(this, y) === r || t(this, T) === r)
197
215
  return;
198
- Y.active = this, o(this, L, t);
199
- const i = e(this, p).filter((c) => c.isActive), u = e(this, p).filter(
200
- (c) => !i.includes(c) && c.testPathname(t)
201
- ), h = i.filter((c) => !c.testPathname(t)), a = i.filter((c) => c.testPathname(t));
202
- let d = !0;
216
+ W.active = this, a(this, y, r);
217
+ const u = t(this, g).filter((l) => l.isActive), v = t(this, g).filter(
218
+ (l) => !u.includes(l) && l.testPathname(f)
219
+ ), at = u.filter((l) => !l.testPathname(f)), G = u.filter((l) => l.testPathname(f));
220
+ let J = !0;
203
221
  if (this.preprocessor)
204
222
  try {
205
- yield new Promise((c, y) => {
206
- var J;
207
- (J = this.preprocessor) == null || J.call(this, { pathname: t, resolve: c, reject: y });
223
+ yield new Promise((l, nt) => {
224
+ var X;
225
+ (X = this.preprocessor) == null || X.call(this, { path: i, resolve: l, reject: nt });
208
226
  });
209
- } catch (c) {
210
- c ? console.error(c) : console.log("Route change canceled"), d = !1;
227
+ } catch (l) {
228
+ l ? console.error(l) : console.log("Route change canceled"), J = !1;
211
229
  }
212
- if (d && e(this, L) === t) {
213
- o(this, C, a[a.length - 1]), h.forEach((y) => {
214
- y.close();
215
- }), o(this, q, t);
230
+ if (J && t(this, y) === r) {
231
+ a(this, q, G[G.length - 1]), at.forEach((l) => {
232
+ l.close();
233
+ }), a(this, T, r);
216
234
  try {
217
- for (var T = F(u), mt, gt, pt; mt = !(gt = yield T.next()).done; mt = !1) {
218
- const y = gt.value;
219
- yield y.render(((f = e(this, C)) == null ? void 0 : f.nest) || e(this, k), t), o(this, C, y);
235
+ for (var At = F(v), kt, St, Nt; kt = !(St = yield At.next()).done; kt = !1) {
236
+ const l = St.value;
237
+ yield l.render(((Q = t(this, q)) == null ? void 0 : Q.nest) || t(this, C), r), a(this, q, l);
220
238
  }
221
- } catch (gt) {
222
- pt = [gt];
239
+ } catch (St) {
240
+ Nt = [St];
223
241
  } finally {
224
242
  try {
225
- mt && (gt = T.return) && (yield gt.call(T));
243
+ kt && (St = At.return) && (yield St.call(At));
226
244
  } finally {
227
- if (pt)
228
- throw pt[0];
245
+ if (Nt)
246
+ throw Nt[0];
229
247
  }
230
248
  }
231
- const c = e(this, N) + t + location.search;
232
- s === "push" ? history.pushState(c, "", c) : s === "replace" && history.replaceState(c, "", c), z(this, K, _).call(this), (G = this.postprocessor) == null || G.call(this, { pathname: t }), e(this, M).notify({ pathname: t });
249
+ lt(s, r, c, o), $(this, D, it).call(this), (V = this.postprocessor) == null || V.call(this, { pathname: r }), t(this, B).notify({ pathname: r });
233
250
  }
234
251
  });
235
252
  }
253
+ normalizePath(e) {
254
+ return ut(e, t(this, z));
255
+ }
236
256
  };
237
- k = new WeakMap(), N = new WeakMap(), p = new WeakMap(), C = new WeakMap(), I = new WeakMap(), L = new WeakMap(), q = new WeakMap(), M = new WeakMap(), D = new WeakMap(), K = new WeakSet(), _ = function() {
238
- const t = e(this, p).filter((i) => i.isActive), s = Array.from(
257
+ C = new WeakMap(), z = new WeakMap(), g = new WeakMap(), q = new WeakMap(), H = new WeakMap(), y = new WeakMap(), T = new WeakMap(), B = new WeakMap(), j = new WeakMap(), D = new WeakSet(), it = function() {
258
+ const e = t(this, g).filter((i) => i.isActive), s = Array.from(
239
259
  new Set(
240
260
  [
241
- ...e(this, k).querySelectorAll("a"),
242
- ...t.map((i) => i.getAnchorElements()).flat()
261
+ ...t(this, C).querySelectorAll("a"),
262
+ ...e.map((i) => i.getAnchorElements()).flat()
243
263
  ].filter((i) => {
244
- var u;
245
- return (u = i.getAttribute("href")) == null ? void 0 : u.startsWith("/");
264
+ var r;
265
+ return (r = i.getAttribute("href")) == null ? void 0 : r.startsWith("/");
246
266
  })
247
267
  )
248
268
  );
249
- e(this, I).forEach((i) => {
269
+ t(this, H).forEach((i) => {
250
270
  i.destroy();
251
- }), o(this, I, s.map((i) => new rt(this, i)));
252
- }, W = new WeakMap();
253
- let V = Y;
271
+ }), a(this, H, s.map((i) => new ft(this, i)));
272
+ }, K = new WeakMap();
273
+ let tt = W;
254
274
  export {
255
- V as Router
275
+ tt as Router
256
276
  };
@@ -3,6 +3,7 @@ import { CustomElement } from '../custom-element';
3
3
  import { Store } from '../store';
4
4
  import { Axes2D, EasingFunction } from '../utils';
5
5
  import { CSSProperty } from '../css-property';
6
+ import { ScrollSection } from './ScrollSection';
6
7
 
7
8
  export type ScrollBehaviour = 'smooth' | 'instant';
8
9
  export interface ScrollSetOptions {
@@ -12,22 +13,6 @@ export interface ScrollSetOptions {
12
13
  duration: number;
13
14
  };
14
15
  }
15
- export type SectionMark = 'current' | 'previous' | 'next' | null;
16
- export type SectionmarkChangeEvent = CustomEvent<{
17
- mark: SectionMark;
18
- }>;
19
- declare class Section {
20
- #private;
21
- constructor(element: HTMLElement, index: number, scrollElement: ScrollElement);
22
- get index(): number;
23
- get size(): number;
24
- get position(): number;
25
- destroy(): void;
26
- setSize(value?: number): void;
27
- resize(): void;
28
- transform(): void;
29
- mark(mark: SectionMark): void;
30
- }
31
16
  export declare class ScrollElement extends CustomElement {
32
17
  #private;
33
18
  constructor();
@@ -60,7 +45,7 @@ export declare class ScrollElement extends CustomElement {
60
45
  get currentScrollValue(): number;
61
46
  get targetScrollValue(): number;
62
47
  get contentElement(): HTMLElement;
63
- get sections(): Section[];
48
+ get sections(): ScrollSection[];
64
49
  get position(): number;
65
50
  get contentPosition(): number;
66
51
  get viewportSize(): number;
@@ -94,7 +79,5 @@ declare global {
94
79
  }
95
80
  interface HTMLElementEventMap {
96
81
  sectionsChange: CustomEvent;
97
- sectionMarkChange: SectionmarkChangeEvent;
98
82
  }
99
83
  }
100
- export {};
@@ -0,0 +1,23 @@
1
+ import { ScrollElement } from './ScrollElement';
2
+
3
+ export type ScrollSectionMark = 'current' | 'previous' | 'next' | null;
4
+ export type ScrollSectionMarkChangeEvent = CustomEvent<{
5
+ mark: ScrollSectionMark;
6
+ }>;
7
+ export declare class ScrollSection {
8
+ #private;
9
+ constructor(element: HTMLElement, index: number, scrollElement: ScrollElement);
10
+ get index(): number;
11
+ get size(): number;
12
+ get position(): number;
13
+ destroy(): void;
14
+ setSize(value?: number): void;
15
+ resize(): void;
16
+ transform(): void;
17
+ mark(mark: ScrollSectionMark): void;
18
+ }
19
+ declare global {
20
+ interface HTMLElementEventMap {
21
+ sectionMarkChange: ScrollSectionMarkChangeEvent;
22
+ }
23
+ }