aptechka 0.83.1 → 0.84.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 (285) hide show
  1. package/lib/Animation-BAiM6_n1.js +111 -0
  2. package/lib/Animation-DMWabSR0.cjs +1 -0
  3. package/lib/Composed-B0fvCtZz.cjs +1 -0
  4. package/lib/Composed-CgA9lLWA.js +75 -0
  5. package/lib/Damped-BLo-OAVb.cjs +1 -0
  6. package/lib/Damped-Dcz5UdMH.js +57 -0
  7. package/lib/DerivedArray-DFhxap_z.js +63 -0
  8. package/lib/DerivedArray-DYtWMW0n.cjs +1 -0
  9. package/lib/DragControls-BPHsDeH6.cjs +1 -0
  10. package/lib/DragControls-D2a1Cifp.js +234 -0
  11. package/lib/LocalLinks-BWFJYhGX.cjs +1 -0
  12. package/lib/LocalLinks-Dwgf3No6.js +65 -0
  13. package/lib/PageAnnouncerElement-DPMlVJZG.cjs +1 -0
  14. package/lib/PageAnnouncerElement-DV9pm_od.js +28 -0
  15. package/lib/PageScroll-BAatKJx6.cjs +1 -0
  16. package/lib/PageScroll-m3TsHnzR.js +65 -0
  17. package/lib/SourceElement-941MrYpq.js +265 -0
  18. package/lib/SourceElement-DBLZ7b5k.cjs +5 -0
  19. package/lib/Store-BCW70G3Z.cjs +1 -0
  20. package/lib/Store-uLDYY9ed.js +158 -0
  21. package/lib/Tweened-BvtjLCa3.js +48 -0
  22. package/lib/Tweened-DdXm1dbF.cjs +1 -0
  23. package/lib/Viewport-BiDoiU8M.js +113 -0
  24. package/lib/Viewport-CXGKUyDy.cjs +1 -0
  25. package/lib/accordion/index.cjs +1 -1
  26. package/lib/accordion/index.js +97 -93
  27. package/lib/animation/index.cjs +1 -1
  28. package/lib/animation/index.js +6 -6
  29. package/lib/api-fetcher/index.cjs +1 -1
  30. package/lib/api-fetcher/index.js +67 -66
  31. package/lib/attribute/index.cjs +1 -1
  32. package/lib/attribute/index.js +37 -34
  33. package/lib/attributes-BADnRZpK.cjs +1 -0
  34. package/lib/attributes-FObgMNCf.js +36 -0
  35. package/lib/billboard/index.cjs +1 -1
  36. package/lib/billboard/index.js +240 -232
  37. package/lib/cache/index.cjs +1 -1
  38. package/lib/cache/index.js +26 -23
  39. package/lib/canvas/index.cjs +1 -1
  40. package/lib/canvas/index.js +62 -59
  41. package/lib/canvas-BP1ceie3.cjs +1 -0
  42. package/lib/canvas-DsglKco1.js +40 -0
  43. package/lib/connector/index.cjs +1 -1
  44. package/lib/connector/index.js +44 -41
  45. package/lib/controls/index.cjs +1 -1
  46. package/lib/controls/index.js +6 -6
  47. package/lib/coordinates--JG1U6kQ.js +29 -0
  48. package/lib/coordinates-DQ9XV9M1.cjs +1 -0
  49. package/lib/css-property/index.cjs +1 -1
  50. package/lib/css-property/index.d.ts +1 -1
  51. package/lib/css-property/index.js +40 -37
  52. package/lib/css-unit-parser/index.cjs +2 -2
  53. package/lib/css-unit-parser/index.js +22 -19
  54. package/lib/css-value-parser/index.cjs +1 -1
  55. package/lib/css-value-parser/index.js +13 -11
  56. package/lib/custom-elements-BfZCJde6.cjs +1 -0
  57. package/lib/custom-elements-HEMuF7yH.js +27 -0
  58. package/lib/dev/index.cjs +2 -1
  59. package/lib/dev/index.d.ts +1 -0
  60. package/lib/dev/index.js +25 -10
  61. package/lib/device/index.cjs +1 -1
  62. package/lib/device/index.js +5 -5
  63. package/lib/dom-B40i6NXw.cjs +1 -0
  64. package/lib/dom-D8D-_9ty.js +108 -0
  65. package/lib/easings-BSGJFMAo.js +40 -0
  66. package/lib/easings-BWq0pPLq.cjs +1 -0
  67. package/lib/element-CqD0jqBJ.cjs +1 -0
  68. package/lib/element-DKw5H-Tu.js +10 -0
  69. package/lib/element-linked-store/index.cjs +1 -1
  70. package/lib/element-linked-store/index.js +53 -52
  71. package/lib/element-resizer/index.cjs +1 -1
  72. package/lib/element-resizer/index.js +47 -44
  73. package/lib/en3/index.cjs +4 -4
  74. package/lib/en3/index.js +192 -185
  75. package/lib/events-Ds-TuvYW.js +9 -0
  76. package/lib/events-UlGk63iC.cjs +1 -0
  77. package/lib/file-DwQs6bB6.js +28 -0
  78. package/lib/file-RHfA3OS-.cjs +1 -0
  79. package/lib/function-H4b_gTg6.cjs +1 -0
  80. package/lib/function-UmbPrOHm.js +19 -0
  81. package/lib/gestures-DmKKNnh4.js +14 -0
  82. package/lib/gestures-DtYbQr49.cjs +1 -0
  83. package/lib/history/index.cjs +1 -1
  84. package/lib/history/index.js +24 -21
  85. package/lib/iframe/index.cjs +1 -1
  86. package/lib/iframe/index.js +27 -24
  87. package/lib/image/index.cjs +1 -1
  88. package/lib/image/index.js +17 -13
  89. package/lib/index-BpO2RJ__.cjs +1 -0
  90. package/lib/index-DpKsHe97.js +68 -0
  91. package/lib/intersector/index.cjs +1 -1
  92. package/lib/intersector/index.js +3 -3
  93. package/lib/jsx/ComponentElement.d.ts +4 -0
  94. package/lib/jsx/h.d.ts +7 -16
  95. package/lib/jsx/hooks/component/useStylesheet.d.ts +1 -1
  96. package/lib/jsx/hooks/cssProperty.d.ts +6 -0
  97. package/lib/jsx/hooks/resize.d.ts +4 -0
  98. package/lib/jsx/hooks/store.d.ts +1 -2
  99. package/lib/jsx/hooks/ticker.d.ts +5 -0
  100. package/lib/jsx/index.cjs +1 -1
  101. package/lib/jsx/index.d.ts +4 -4
  102. package/lib/jsx/index.js +171 -349
  103. package/lib/jsx/plugins/vite/index.cjs +49 -0
  104. package/lib/jsx/plugins/vite/index.d.ts +38 -0
  105. package/lib/jsx/plugins/vite/index.js +104 -0
  106. package/lib/jsx/render.d.ts +2 -0
  107. package/lib/jsx/type.d.ts +228 -190
  108. package/lib/ladder/index.cjs +1 -1
  109. package/lib/ladder/index.js +86 -84
  110. package/lib/layout-C26zkY7D.js +35 -0
  111. package/lib/layout-CnGLl7oe.cjs +1 -0
  112. package/lib/layout-box/index.cjs +1 -1
  113. package/lib/layout-box/index.js +221 -217
  114. package/lib/loading/index.cjs +1 -1
  115. package/lib/loading/index.js +48 -45
  116. package/lib/local-links/index.cjs +1 -1
  117. package/lib/local-links/index.js +2 -2
  118. package/lib/masonry-layout/index.cjs +1 -1
  119. package/lib/masonry-layout/index.js +48 -45
  120. package/lib/math-C-knY2TL.cjs +1 -0
  121. package/lib/math-r8V23YFe.js +57 -0
  122. package/lib/media/index.cjs +1 -1
  123. package/lib/media/index.js +28 -25
  124. package/lib/metadata-BNdkmeeD.js +15 -0
  125. package/lib/metadata-BrHUfpV9.cjs +1 -0
  126. package/lib/morph/index.cjs +1 -1
  127. package/lib/morph/index.js +561 -556
  128. package/lib/morph-BtgB1YQP.js +256 -0
  129. package/lib/morph-Buhxq-X0.cjs +1 -0
  130. package/lib/need_redo_tweaker/index.cjs +4 -4
  131. package/lib/need_redo_tweaker/index.js +862 -834
  132. package/lib/notifier/index.cjs +1 -1
  133. package/lib/notifier/index.js +29 -26
  134. package/lib/number-Bu4sGvW7.cjs +1 -0
  135. package/lib/number-DiVt2xnh.js +47 -0
  136. package/lib/object-CiIdEmJx.js +98 -0
  137. package/lib/object-DTY_W6xG.cjs +1 -0
  138. package/lib/order/index.cjs +1 -1
  139. package/lib/order/index.js +3 -3
  140. package/lib/page-announcer/index.cjs +1 -1
  141. package/lib/page-announcer/index.js +2 -2
  142. package/lib/page-scroll/index.cjs +1 -1
  143. package/lib/page-scroll/index.js +2 -2
  144. package/lib/pixel-perfect/index.cjs +4 -4
  145. package/lib/pixel-perfect/index.js +43 -40
  146. package/lib/pointer/index.cjs +1 -1
  147. package/lib/pointer/index.js +125 -122
  148. package/lib/polyfills-CG1XJNia.js +28 -0
  149. package/lib/polyfills-DZCuDBkA.cjs +1 -0
  150. package/lib/popover/index.cjs +1 -1
  151. package/lib/popover/index.js +249 -245
  152. package/lib/radio/index.cjs +1 -1
  153. package/lib/radio/index.js +58 -55
  154. package/lib/render-DLcWVnuH.js +355 -0
  155. package/lib/render-DdomypCo.cjs +1 -0
  156. package/lib/router/index.cjs +1 -1
  157. package/lib/router/index.js +196 -194
  158. package/lib/scroll/index.cjs +1 -1
  159. package/lib/scroll/index.js +890 -877
  160. package/lib/scroll-BvIWh1xB.js +41 -0
  161. package/lib/scroll-CT0lpyRZ.cjs +1 -0
  162. package/lib/scroll-entries/index.cjs +1 -1
  163. package/lib/scroll-entries/index.js +37 -34
  164. package/lib/scroll-kit/index.cjs +1 -1
  165. package/lib/scroll-kit/index.js +214 -209
  166. package/lib/sequence/index.cjs +1 -1
  167. package/lib/sequence/index.js +102 -98
  168. package/lib/size-element/index.cjs +1 -1
  169. package/lib/size-element/index.js +29 -26
  170. package/lib/slicer/index.cjs +1 -1
  171. package/lib/slicer/index.js +118 -113
  172. package/lib/source/index.cjs +1 -1
  173. package/lib/source/index.js +5 -5
  174. package/lib/spa/index.cjs +1 -1
  175. package/lib/spa/index.js +94 -94
  176. package/lib/store/index.cjs +1 -1
  177. package/lib/store/index.d.ts +2 -2
  178. package/lib/store/index.js +10 -8
  179. package/lib/string-B3lm2b7v.js +84 -0
  180. package/lib/string-CbRNzmd9.cjs +1 -0
  181. package/lib/style-DBoQWK0d.js +14 -0
  182. package/lib/style-IDJ6db6n.cjs +1 -0
  183. package/lib/stylesheet-CHvuef16.js +28 -0
  184. package/lib/stylesheet-CQdBaIAA.cjs +1 -0
  185. package/lib/ticker/index.cjs +1 -1
  186. package/lib/ticker/index.js +96 -92
  187. package/lib/url-CPCO10Sy.cjs +1 -0
  188. package/lib/url-CWCY_qe_.js +124 -0
  189. package/lib/utils/attributes.d.ts +2 -0
  190. package/lib/utils/dom.d.ts +1 -0
  191. package/lib/utils/index.cjs +1 -1
  192. package/lib/utils/index.js +245 -226
  193. package/lib/utils/polyfills.d.ts +1 -1
  194. package/lib/video/index.cjs +1 -1
  195. package/lib/video/index.js +36 -33
  196. package/lib/window-resizer/index.cjs +1 -1
  197. package/lib/window-resizer/index.js +27 -24
  198. package/lib/youtube/index.cjs +1 -1
  199. package/lib/youtube/index.js +56 -54
  200. package/package.json +11 -24
  201. package/lib/Animation-BzTjZIE-.js +0 -108
  202. package/lib/Animation-C39Ah-LM.cjs +0 -1
  203. package/lib/Composed-C-TV9te3.cjs +0 -1
  204. package/lib/Composed-DyAWjEXE.js +0 -121
  205. package/lib/Damped-CRusiRIV.js +0 -56
  206. package/lib/Damped-Prr0iKu1.cjs +0 -1
  207. package/lib/DragControls-8rNZwQrs.cjs +0 -1
  208. package/lib/DragControls-DBNdMBA4.js +0 -228
  209. package/lib/LocalLinks-BxhSFv_Q.cjs +0 -1
  210. package/lib/LocalLinks-DFZFpbjs.js +0 -62
  211. package/lib/PageAnnouncerElement-0LxZjtVH.js +0 -24
  212. package/lib/PageAnnouncerElement-AQ0Ja6HM.cjs +0 -1
  213. package/lib/PageScroll-0LxFblry.js +0 -62
  214. package/lib/PageScroll-BXJUQwG7.cjs +0 -1
  215. package/lib/SourceElement-BHqPFbna.cjs +0 -5
  216. package/lib/SourceElement-DjbHjynf.js +0 -260
  217. package/lib/Store-Blf4msDz.cjs +0 -1
  218. package/lib/Store-ZThXYBQd.js +0 -152
  219. package/lib/Tweened-Bw1Cn1PJ.js +0 -47
  220. package/lib/Tweened-DWtk9E-O.cjs +0 -1
  221. package/lib/Viewport-BxCr0GlB.cjs +0 -1
  222. package/lib/Viewport-Dt-d9DPi.js +0 -109
  223. package/lib/attributes-69we3byR.js +0 -10
  224. package/lib/attributes-Bf2svn4j.cjs +0 -1
  225. package/lib/canvas-CU5Xjahf.cjs +0 -1
  226. package/lib/canvas-DeZ0SLUJ.js +0 -34
  227. package/lib/coordinates-CgdGoSYs.js +0 -24
  228. package/lib/coordinates-D8Np3cPD.cjs +0 -1
  229. package/lib/custom-elements-DBnCK7Zx.js +0 -24
  230. package/lib/custom-elements-Dh4TWRDJ.cjs +0 -1
  231. package/lib/dom-BETkVSSZ.js +0 -82
  232. package/lib/dom-CBLlqORw.cjs +0 -1
  233. package/lib/easings-BEmRlrDd.js +0 -38
  234. package/lib/easings-GegIwET5.cjs +0 -1
  235. package/lib/element-CGVl1jA-.js +0 -7
  236. package/lib/element-yhcBhsho.cjs +0 -1
  237. package/lib/events-CsVF98U6.js +0 -6
  238. package/lib/events-KVanG9sR.cjs +0 -1
  239. package/lib/file-DSpfWdd9.cjs +0 -1
  240. package/lib/file-GHShUlue.js +0 -24
  241. package/lib/function-C10DGppn.js +0 -17
  242. package/lib/function-MthRj-GJ.cjs +0 -1
  243. package/lib/gestures-C7gbKx11.cjs +0 -1
  244. package/lib/gestures-CcXV6fCp.js +0 -11
  245. package/lib/index-OE2INULi.cjs +0 -1
  246. package/lib/index-e9eDuagL.js +0 -65
  247. package/lib/jsx/hydrate.d.ts +0 -1
  248. package/lib/jsx/integrations/astro/client.cjs +0 -1
  249. package/lib/jsx/integrations/astro/client.d.ts +0 -2
  250. package/lib/jsx/integrations/astro/client.js +0 -50
  251. package/lib/jsx/integrations/astro/index.cjs +0 -1
  252. package/lib/jsx/integrations/astro/index.d.ts +0 -2
  253. package/lib/jsx/integrations/astro/index.js +0 -54
  254. package/lib/jsx/integrations/astro/server.cjs +0 -1
  255. package/lib/jsx/integrations/astro/server.d.ts +0 -3
  256. package/lib/jsx/integrations/astro/server.js +0 -35
  257. package/lib/jsx/plugins/vite.d.ts +0 -21
  258. package/lib/layout-BSMtwCga.js +0 -29
  259. package/lib/layout-Ctc2p3uz.cjs +0 -1
  260. package/lib/math-BOBiC4TN.js +0 -45
  261. package/lib/math-GDWEqu7y.cjs +0 -1
  262. package/lib/metadata-BcYZ5w3T.cjs +0 -1
  263. package/lib/metadata-jfowcCyz.js +0 -12
  264. package/lib/morph-B6sGhLCi.cjs +0 -1
  265. package/lib/morph-BQErz7qP.js +0 -242
  266. package/lib/number-ChAm68cm.cjs +0 -1
  267. package/lib/number-CumqY64S.js +0 -40
  268. package/lib/object-CcMK4y_r.js +0 -87
  269. package/lib/object-baN9pgbU.cjs +0 -1
  270. package/lib/polyfills-DJrTJQky.js +0 -24
  271. package/lib/polyfills-Df4r-ETT.cjs +0 -1
  272. package/lib/render-DQs7rIoN.cjs +0 -1
  273. package/lib/render-D_0FCWEu.js +0 -18
  274. package/lib/scroll-BA2WnUrb.cjs +0 -1
  275. package/lib/scroll-DY5senkF.js +0 -37
  276. package/lib/string-BlMQbe8b.js +0 -70
  277. package/lib/string-DUXXtU8v.cjs +0 -1
  278. package/lib/style-At6aDoqG.cjs +0 -1
  279. package/lib/style-j2TwriJ_.js +0 -10
  280. package/lib/stylesheet-5_o7PFzM.cjs +0 -1
  281. package/lib/stylesheet-DdBzowZY.js +0 -24
  282. package/lib/url-CHgcNwJ1.cjs +0 -1
  283. package/lib/url-CYgo5vrG.js +0 -113
  284. package/lib/vite-C-i3hVDL.js +0 -75
  285. package/lib/vite-DzanPumM.cjs +0 -44
@@ -1,158 +1,163 @@
1
- var P = (i) => {
2
- throw TypeError(i);
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
3
4
  };
4
- var b = (i, e, s) => e.has(i) || P("Cannot " + s);
5
- var t = (i, e, s) => (b(i, e, "read from private field"), s ? s.call(i) : e.get(i)), h = (i, e, s) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, s), o = (i, e, s, g) => (b(i, e, "write to private field"), g ? g.call(i, s) : e.set(i, s), s), L = (i, e, s) => (b(i, e, "access private method"), s);
6
- import { Media as $ } from "../media/index.js";
7
- import { i as S } from "../index-e9eDuagL.js";
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
6
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
8
+ import { Media } from "../media/index.js";
9
+ import { i as isBrowser } from "../index-DpKsHe97.js";
8
10
  import "construct-style-sheets-polyfill";
9
- var A, u;
10
- class _ {
11
- constructor(e) {
12
- h(this, A);
13
- h(this, u);
14
- o(this, A, e.index), o(this, u, document.createElement("span")), t(this, u).classList.add("letter"), e.clone ? t(this, u).innerHTML = `<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>` : t(this, u).innerHTML = `<span class="original"><span class="value">${e.text}</span></span>`;
11
+ var _index, _element;
12
+ const _Letter = class _Letter {
13
+ constructor(parameters) {
14
+ __privateAdd(this, _index);
15
+ __privateAdd(this, _element);
16
+ __privateSet(this, _index, parameters.index), __privateSet(this, _element, document.createElement("span")), __privateGet(this, _element).classList.add("letter"), parameters.clone ? __privateGet(this, _element).innerHTML = `<span class="original"><span class="value">${parameters.text}</span></span><span class="clone" aria-hidden><span class="value">${parameters.text}</span></span>` : __privateGet(this, _element).innerHTML = `<span class="original"><span class="value">${parameters.text}</span></span>`;
15
17
  }
16
18
  get index() {
17
- return t(this, A);
19
+ return __privateGet(this, _index);
18
20
  }
19
21
  get element() {
20
- return t(this, u);
22
+ return __privateGet(this, _element);
21
23
  }
22
- }
23
- A = new WeakMap(), u = new WeakMap();
24
- var M, c, p, m;
25
- class k {
26
- constructor(e) {
27
- h(this, M);
28
- h(this, c);
29
- h(this, p);
30
- h(this, m);
31
- if (o(this, M, e.index), o(this, c, document.createElement("span")), o(this, p, []), o(this, m, e.text.endsWith("\\n")), t(this, m) && (e.text = e.text.replace("\\n", "")), e.letters && e.lettersAcc !== void 0) {
32
- let s = 0;
33
- const g = /([\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF\-–—])/, T = e.text.split(g).filter((y) => y.trim() !== "");
34
- T.length > 1 && t(this, c).classList.add("words-inside"), T.forEach((y, w, n) => {
35
- const l = y.split("").map((r) => {
36
- if (r !== " ")
37
- return new _({
38
- index: e.lettersAcc + s++,
39
- text: r,
40
- clone: e.clone
24
+ };
25
+ _index = new WeakMap(), _element = new WeakMap(), __name(_Letter, "Letter");
26
+ let Letter = _Letter;
27
+ var _index2, _element2, _letters, _hasNewLine;
28
+ const _Word = class _Word {
29
+ constructor(parameters) {
30
+ __privateAdd(this, _index2);
31
+ __privateAdd(this, _element2);
32
+ __privateAdd(this, _letters);
33
+ __privateAdd(this, _hasNewLine);
34
+ if (__privateSet(this, _index2, parameters.index), __privateSet(this, _element2, document.createElement("span")), __privateSet(this, _letters, []), __privateSet(this, _hasNewLine, parameters.text.endsWith("\\n")), __privateGet(this, _hasNewLine) && (parameters.text = parameters.text.replace("\\n", "")), parameters.letters && parameters.lettersAcc !== void 0) {
35
+ let i = 0;
36
+ const reg1 = /([\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF\-–—])/, wordParts = parameters.text.split(reg1).filter((part) => part.trim() !== "");
37
+ wordParts.length > 1 && __privateGet(this, _element2).classList.add("words-inside"), wordParts.forEach((word, wordIndex, wordArray) => {
38
+ const letters = word.split("").map((letter) => {
39
+ if (letter !== " ")
40
+ return new Letter({
41
+ index: parameters.lettersAcc + i++,
42
+ text: letter,
43
+ clone: parameters.clone
41
44
  });
42
45
  });
43
- if (o(this, p, l.filter((r) => r instanceof _)), n.length > 1) {
44
- const r = document.createElement("span");
45
- r.append(
46
- ...t(this, p).map((a) => a.element)
47
- ), t(this, c).append(r), w !== n.length - 1 && t(this, c).append(r);
46
+ if (__privateSet(this, _letters, letters.filter((l) => l instanceof Letter)), wordArray.length > 1) {
47
+ const el = document.createElement("span");
48
+ el.append(
49
+ ...__privateGet(this, _letters).map((l) => l.element)
50
+ ), __privateGet(this, _element2).append(el), wordIndex !== wordArray.length - 1 && __privateGet(this, _element2).append(el);
48
51
  } else
49
- t(this, c).append(
50
- ...t(this, p).map((r) => r.element)
52
+ __privateGet(this, _element2).append(
53
+ ...__privateGet(this, _letters).map((l) => l.element)
51
54
  );
52
55
  });
53
56
  } else
54
- e.clone ? t(this, c).innerHTML = `<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>` : t(this, c).innerHTML = `<span class="original"><span class="value">${e.text}</span></span>`;
55
- t(this, c).classList.add("word");
57
+ parameters.clone ? __privateGet(this, _element2).innerHTML = `<span class="original"><span class="value">${parameters.text}</span></span><span class="clone" aria-hidden><span class="value">${parameters.text}</span></span>` : __privateGet(this, _element2).innerHTML = `<span class="original"><span class="value">${parameters.text}</span></span>`;
58
+ __privateGet(this, _element2).classList.add("word");
56
59
  }
57
60
  get index() {
58
- return t(this, M);
61
+ return __privateGet(this, _index2);
59
62
  }
60
63
  get element() {
61
- return t(this, c);
64
+ return __privateGet(this, _element2);
62
65
  }
63
66
  get letters() {
64
- return t(this, p);
67
+ return __privateGet(this, _letters);
65
68
  }
66
69
  get hasNewLine() {
67
- return t(this, m);
70
+ return __privateGet(this, _hasNewLine);
68
71
  }
69
- }
70
- M = new WeakMap(), c = new WeakMap(), p = new WeakMap(), m = new WeakMap();
71
- var x, d, E, N, f, D, O;
72
- class G extends HTMLElement {
72
+ };
73
+ _index2 = new WeakMap(), _element2 = new WeakMap(), _letters = new WeakMap(), _hasNewLine = new WeakMap(), __name(_Word, "Word");
74
+ let Word = _Word;
75
+ var _originalHTML, _words, _letters2, _media, _SlicerElement_instances, split_fn, unsplit_fn;
76
+ const _SlicerElement = class _SlicerElement extends HTMLElement {
73
77
  constructor() {
74
78
  super(...arguments);
75
- h(this, f);
76
- h(this, x, "");
77
- h(this, d, []);
78
- h(this, E, []);
79
- h(this, N, null);
79
+ __privateAdd(this, _SlicerElement_instances);
80
+ __privateAdd(this, _originalHTML, "");
81
+ __privateAdd(this, _words, []);
82
+ __privateAdd(this, _letters2, []);
83
+ __privateAdd(this, _media, null);
80
84
  }
81
85
  get wordsArray() {
82
- return t(this, d);
86
+ return __privateGet(this, _words);
83
87
  }
84
88
  get lettersArray() {
85
- return t(this, E);
89
+ return __privateGet(this, _letters2);
86
90
  }
87
91
  get originalHTML() {
88
- return t(this, x);
92
+ return __privateGet(this, _originalHTML);
89
93
  }
90
94
  connectedCallback() {
91
- this.classList.contains("splitted") || (o(this, x, this.innerHTML.trim()), this.hasAttribute("media") ? (o(this, N, new $(this.getAttribute("media"))), t(this, N).subscribe((s) => {
92
- s.current ? L(this, f, D).call(this) : !s.current && s.previous && L(this, f, O).call(this);
93
- })) : L(this, f, D).call(this), this.classList.add("splitted"));
95
+ this.classList.contains("splitted") || (__privateSet(this, _originalHTML, this.innerHTML.trim()), this.hasAttribute("media") ? (__privateSet(this, _media, new Media(this.getAttribute("media"))), __privateGet(this, _media).subscribe((e) => {
96
+ e.current ? __privateMethod(this, _SlicerElement_instances, split_fn).call(this) : !e.current && e.previous && __privateMethod(this, _SlicerElement_instances, unsplit_fn).call(this);
97
+ })) : __privateMethod(this, _SlicerElement_instances, split_fn).call(this), this.classList.add("splitted"));
94
98
  }
95
99
  disconnectedCallback() {
96
- var s;
97
- L(this, f, O).call(this), (s = t(this, N)) == null || s.close();
100
+ var _a;
101
+ __privateMethod(this, _SlicerElement_instances, unsplit_fn).call(this), (_a = __privateGet(this, _media)) == null || _a.close();
98
102
  }
99
- }
100
- x = new WeakMap(), d = new WeakMap(), E = new WeakMap(), N = new WeakMap(), f = new WeakSet(), D = function() {
101
- const s = [];
102
- o(this, d, []);
103
- let g = 0, T = 0;
104
- const y = (n) => {
105
- var a;
106
- const l = (a = n.textContent) == null ? void 0 : a.trim();
107
- if (!l) return document.createDocumentFragment();
108
- const r = document.createDocumentFragment();
109
- return l.replace(
103
+ };
104
+ _originalHTML = new WeakMap(), _words = new WeakMap(), _letters2 = new WeakMap(), _media = new WeakMap(), _SlicerElement_instances = new WeakSet(), split_fn = /* @__PURE__ */ __name(function() {
105
+ const nodes = [];
106
+ __privateSet(this, _words, []);
107
+ let wordsAcc = 0, lettersAcc = 0;
108
+ const processTextNode = /* @__PURE__ */ __name((textNode) => {
109
+ var _a;
110
+ const text = (_a = textNode.textContent) == null ? void 0 : _a.trim();
111
+ if (!text) return document.createDocumentFragment();
112
+ const fragment = document.createDocumentFragment();
113
+ return text.replace(
110
114
  /[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g,
111
115
  " "
112
- ).split(" ").forEach((F, C, H) => {
113
- if (!F) return;
114
- const v = new k({
115
- index: g,
116
- text: F + (C < H.length - 1 ? " " : ""),
116
+ ).split(" ").forEach((wordText, i, arr) => {
117
+ if (!wordText) return;
118
+ const word = new Word({
119
+ index: wordsAcc,
120
+ text: wordText + (i < arr.length - 1 ? " " : ""),
117
121
  letters: this.hasAttribute("letters"),
118
- lettersAcc: T,
122
+ lettersAcc,
119
123
  clone: this.hasAttribute("clone")
120
124
  });
121
- T += v.letters.length, g += 1, t(this, E).push(...v.letters), t(this, d).push(v), r.appendChild(v.element);
122
- }), r;
123
- }, w = (n) => {
124
- if (n.nodeType === Node.TEXT_NODE)
125
- return y(n);
126
- if (n.nodeType === Node.ELEMENT_NODE) {
127
- const l = n.cloneNode(!1);
128
- return Array.from(n.childNodes).forEach((r) => {
129
- const a = w(r);
130
- a && (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(a.childNodes).forEach((F, C, H) => {
131
- l.append(F), C !== H.length - 1 && l.append(new Text(" "));
132
- }) : l.appendChild(a));
133
- }), l;
125
+ lettersAcc += word.letters.length, wordsAcc += 1, __privateGet(this, _letters2).push(...word.letters), __privateGet(this, _words).push(word), fragment.appendChild(word.element);
126
+ }), fragment;
127
+ }, "processTextNode"), walk = /* @__PURE__ */ __name((node) => {
128
+ if (node.nodeType === Node.TEXT_NODE)
129
+ return processTextNode(node);
130
+ if (node.nodeType === Node.ELEMENT_NODE) {
131
+ const clone = node.cloneNode(!1);
132
+ return Array.from(node.childNodes).forEach((child) => {
133
+ const processedChild = walk(child);
134
+ processedChild && (processedChild.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(processedChild.childNodes).forEach((node2, i, arr) => {
135
+ clone.append(node2), i !== arr.length - 1 && clone.append(new Text(" "));
136
+ }) : clone.appendChild(processedChild));
137
+ }), clone;
134
138
  }
135
- return n.cloneNode();
136
- };
137
- Array.from(this.childNodes).forEach((n) => {
138
- const l = w(n);
139
- l.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? s.push(...Array.from(l.childNodes)) : s.push(l);
140
- }), this.hasAttribute("index") && (t(this, d).forEach((n) => {
141
- n.element.style.setProperty("--word-index", n.index.toString());
142
- }), t(this, E).forEach((n) => {
143
- n.element.style.setProperty(
139
+ return node.cloneNode();
140
+ }, "walk");
141
+ Array.from(this.childNodes).forEach((node) => {
142
+ const processedNode = walk(node);
143
+ processedNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? nodes.push(...Array.from(processedNode.childNodes)) : nodes.push(processedNode);
144
+ }), this.hasAttribute("index") && (__privateGet(this, _words).forEach((word) => {
145
+ word.element.style.setProperty("--word-index", word.index.toString());
146
+ }), __privateGet(this, _letters2).forEach((letter) => {
147
+ letter.element.style.setProperty(
144
148
  "--letter-index",
145
- n.index.toString()
149
+ letter.index.toString()
146
150
  );
147
- })), this.innerHTML = "", s.forEach((n, l) => {
148
- this.appendChild(n), l < s.length - 1 && n.nodeType === Node.ELEMENT_NODE && this.appendChild(new Text(" "));
149
- }), this.style.setProperty("--words-length", t(this, d).length.toString()), this.style.setProperty("--letters-length", t(this, E).length.toString());
150
- }, O = function() {
151
- o(this, d, []), this.innerHTML = t(this, x), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
152
- };
153
- S && !customElements.get("e-slicer") && customElements.define("e-slicer", G);
151
+ })), this.innerHTML = "", nodes.forEach((node, i) => {
152
+ this.appendChild(node), i < nodes.length - 1 && node.nodeType === Node.ELEMENT_NODE && this.appendChild(new Text(" "));
153
+ }), this.style.setProperty("--words-length", __privateGet(this, _words).length.toString()), this.style.setProperty("--letters-length", __privateGet(this, _letters2).length.toString());
154
+ }, "#split"), unsplit_fn = /* @__PURE__ */ __name(function() {
155
+ __privateSet(this, _words, []), this.innerHTML = __privateGet(this, _originalHTML), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
156
+ }, "#unsplit"), __name(_SlicerElement, "SlicerElement");
157
+ let SlicerElement = _SlicerElement;
158
+ isBrowser && !customElements.get("e-slicer") && customElements.define("e-slicer", SlicerElement);
154
159
  export {
155
- _ as Letter,
156
- G as SlicerElement,
157
- k as Word
160
+ Letter,
161
+ SlicerElement,
162
+ Word
158
163
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../SourceElement-BHqPFbna.cjs");exports.Source=e.Source;exports.SourceElement=e.SourceElement;exports.SourceManager=e.SourceManager;exports.SourceSet=e.SourceSet;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const SourceElement=require("../SourceElement-DBLZ7b5k.cjs");exports.Source=SourceElement.Source;exports.SourceElement=SourceElement.SourceElement;exports.SourceManager=SourceElement.SourceManager;exports.SourceSet=SourceElement.SourceSet;
@@ -1,7 +1,7 @@
1
- import { S as r, a as o, c as S, b as c } from "../SourceElement-DjbHjynf.js";
1
+ import { S, a, c, b } from "../SourceElement-941MrYpq.js";
2
2
  export {
3
- r as Source,
4
- o as SourceElement,
5
- S as SourceManager,
6
- c as SourceSet
3
+ S as Source,
4
+ a as SourceElement,
5
+ c as SourceManager,
6
+ b as SourceSet
7
7
  };
package/lib/spa/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var X=Object.defineProperty,$=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var D=i=>{throw TypeError(i)};var z=(i,t,e)=>t in i?X(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,R=(i,t)=>{for(var e in t||(t={}))J.call(t,e)&&z(i,e,t[e]);if(M)for(var e of M(t))K.call(t,e)&&z(i,e,t[e]);return i},I=(i,t)=>$(i,G(t));var O=(i,t,e)=>t.has(i)||D("Cannot "+e);var r=(i,t,e)=>(O(i,t,"read from private field"),e?e.call(i):t.get(i)),u=(i,t,e)=>t.has(i)?D("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),f=(i,t,e,c)=>(O(i,t,"write to private field"),c?c.call(i,e):t.set(i,e),e);var V=(i,t,e,c)=>({set _(o){f(i,t,o,e)},get _(){return r(i,t,c)}});var j=(i,t,e)=>new Promise((c,o)=>{var s=a=>{try{l(e.next(a))}catch(w){o(w)}},m=a=>{try{l(e.throw(a))}catch(w){o(w)}},l=a=>a.done?c(a.value):Promise.resolve(a.value).then(s,m);l((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../cache/index.cjs"),Q=require("../history/index.cjs"),W=require("../LocalLinks-BxhSFv_Q.cjs"),Y=require("../PageAnnouncerElement-AQ0Ja6HM.cjs"),Z=require("../PageScroll-BXJUQwG7.cjs"),F=require("../events-KVanG9sR.cjs"),H=require("../morph-B6sGhLCi.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const k=require("../url-CHgcNwJ1.cjs");var y,P,n,d,S,g,v,q;const b=class b{constructor(t){u(this,y,new N.Cache);u(this,P,new DOMParser);u(this,n,null);u(this,d,null);u(this,S,null);u(this,g,null);u(this,v,null);u(this,q,0);b.instance||(b.instance=this,f(this,n,I(R({},t),{base:k.normalizeBase(t==null?void 0:t.base)})),f(this,v,new Y.PageAnnouncerElement),f(this,d,new Z.PageScroll(r(this,n).scrollSelector)),r(this,d).update(),f(this,S,new W.LocalLinks({base:r(this,n).base,trailingSlash:r(this,n).trailingSlash,includeAnchor:t==null?void 0:t.includeAnchor,onClick:(e,c)=>{try{this.navigate(e,c)}catch(o){window.location.assign(e)}}})),r(this,S).update(),f(this,g,new Q.History({onPop:e=>{this.navigate(e)}})))}history(){return r(this,g)}get scroll(){return r(this,d)}navigate(t,e){return j(this,null,function*(){var w,L,T,A,E,U,B,C;const c=r(this,g).isBack,o=++V(this,q)._;let s=k.normalizeURL(t,{base:r(this,n).base,trailingSlash:r(this,n).trailingSlash});r(this,n).urlModifier&&(s=r(this,n).urlModifier(s));let m=r(this,y).get(s.toString());if((!m||e!=null&&e.revalidate)&&(m=yield fetch(`${s}`,{headers:{"X-SPA":"true"}}).then(h=>h.text()).catch(()=>{window.location.assign(s)})),!m||(e!=null&&e.cache&&r(this,y).set(s.toString(),m),r(this,q)!==o))return;c||(r(this,g).push(s),((w=e==null?void 0:e.keepScrollPosition)==null||w)&&r(this,d).element.scrollTo({top:0,behavior:"instant"}));const l=r(this,P).parseFromString(m,"text/html");if(k.normalizeRelativeURLs(l,s),yield(T=(L=r(this,n)).beforeDiff)==null?void 0:T.call(L,l),r(this,q)!==o)return;F.dispatchEvent(document,"spaBeforeUpdate",{custom:!0});let a=(A=l.querySelector("title"))==null?void 0:A.textContent;if(a)document.title=a;else{const h=document.querySelector("h1");a=(U=(E=h==null?void 0:h.innerText)!=null?E:h==null?void 0:h.textContent)!=null?U:s.pathname}r(this,v).create(l,a),r(this,n).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>H.morph(document,l)).finished:yield H.morph(document,l),r(this,d).update(),r(this,S).update(),r(this,v).done(),yield(C=(B=r(this,n)).afterDiff)==null?void 0:C.call(B),F.dispatchEvent(document,"spaAfterUpdate",{custom:!0})})}};y=new WeakMap,P=new WeakMap,n=new WeakMap,d=new WeakMap,S=new WeakMap,g=new WeakMap,v=new WeakMap,q=new WeakMap,b.instance=null;let x=b;exports.SPA=x;
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);var __privateWrapper=(obj,member,setter,getter)=>({set _(value){__privateSet(obj,member,value,setter)},get _(){return __privateGet(obj,member,getter)}});var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cache_index=require("../cache/index.cjs"),history_index=require("../history/index.cjs"),LocalLinks=require("../LocalLinks-BWFJYhGX.cjs"),PageAnnouncerElement=require("../PageAnnouncerElement-DPMlVJZG.cjs"),PageScroll=require("../PageScroll-BAatKJx6.cjs"),events=require("../events-UlGk63iC.cjs"),morph=require("../morph-Buhxq-X0.cjs");require("construct-style-sheets-polyfill");require("../index-BpO2RJ__.cjs");const url=require("../url-CPCO10Sy.cjs");var _cache,_domParser,_options,_scroll,_links,_history,_announcerElement,_updateId;const _SPA=class _SPA{constructor(options){__privateAdd(this,_cache,new cache_index.Cache);__privateAdd(this,_domParser,new DOMParser);__privateAdd(this,_options,null);__privateAdd(this,_scroll,null);__privateAdd(this,_links,null);__privateAdd(this,_history,null);__privateAdd(this,_announcerElement,null);__privateAdd(this,_updateId,0);_SPA.instance||(_SPA.instance=this,__privateSet(this,_options,__spreadProps(__spreadValues({},options),{base:url.normalizeBase(options==null?void 0:options.base)})),__privateSet(this,_announcerElement,new PageAnnouncerElement.PageAnnouncerElement),__privateSet(this,_scroll,new PageScroll.PageScroll(__privateGet(this,_options).scrollSelector)),__privateGet(this,_scroll).update(),__privateSet(this,_links,new LocalLinks.LocalLinks({base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,includeAnchor:options==null?void 0:options.includeAnchor,onClick:__name((url2,options2)=>{try{this.navigate(url2,options2)}catch(e){window.location.assign(url2)}},"onClick")})),__privateGet(this,_links).update(),__privateSet(this,_history,new history_index.History({onPop:__name(url2=>{this.navigate(url2)},"onPop")})))}history(){return __privateGet(this,_history)}get scroll(){return __privateGet(this,_scroll)}navigate(url$1,options){return __async(this,null,function*(){var _a,_b,_c,_d,_e,_f,_g,_h;const isBack=__privateGet(this,_history).isBack,updateId=++__privateWrapper(this,_updateId)._;let fullUrl=url.normalizeURL(url$1,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash});__privateGet(this,_options).urlModifier&&(fullUrl=__privateGet(this,_options).urlModifier(fullUrl));let contents=__privateGet(this,_cache).get(fullUrl.toString());if((!contents||options!=null&&options.revalidate)&&(contents=yield fetch(`${fullUrl}`,{headers:{"X-SPA":"true"}}).then(res=>res.text()).catch(()=>{window.location.assign(fullUrl)})),!contents||(options!=null&&options.cache&&__privateGet(this,_cache).set(fullUrl.toString(),contents),__privateGet(this,_updateId)!==updateId))return;isBack||(__privateGet(this,_history).push(fullUrl),((_a=options==null?void 0:options.keepScrollPosition)==null||_a)&&__privateGet(this,_scroll).element.scrollTo({top:0,behavior:"instant"}));const html=__privateGet(this,_domParser).parseFromString(contents,"text/html");if(url.normalizeRelativeURLs(html,fullUrl),yield(_c=(_b=__privateGet(this,_options)).beforeDiff)==null?void 0:_c.call(_b,html),__privateGet(this,_updateId)!==updateId)return;events.dispatchEvent(document,"spaBeforeUpdate",{custom:!0});let title=(_d=html.querySelector("title"))==null?void 0:_d.textContent;if(title)document.title=title;else{const h1=document.querySelector("h1");title=(_f=(_e=h1==null?void 0:h1.innerText)!=null?_e:h1==null?void 0:h1.textContent)!=null?_f:fullUrl.pathname}__privateGet(this,_announcerElement).create(html,title),__privateGet(this,_options).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>morph.morph(document,html)).finished:yield morph.morph(document,html),__privateGet(this,_scroll).update(),__privateGet(this,_links).update(),__privateGet(this,_announcerElement).done(),yield(_h=(_g=__privateGet(this,_options)).afterDiff)==null?void 0:_h.call(_g),events.dispatchEvent(document,"spaAfterUpdate",{custom:!0})})}};_cache=new WeakMap,_domParser=new WeakMap,_options=new WeakMap,_scroll=new WeakMap,_links=new WeakMap,_history=new WeakMap,_announcerElement=new WeakMap,_updateId=new WeakMap,__name(_SPA,"SPA"),_SPA.instance=null;let SPA=_SPA;exports.SPA=SPA;
package/lib/spa/index.js CHANGED
@@ -1,130 +1,130 @@
1
- var O = Object.defineProperty, X = Object.defineProperties;
2
- var $ = Object.getOwnPropertyDescriptors;
3
- var z = Object.getOwnPropertySymbols;
4
- var j = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
5
- var D = (i) => {
6
- throw TypeError(i);
1
+ var __defProp = Object.defineProperty, __defProps = Object.defineProperties;
2
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __typeError = (msg) => {
6
+ throw TypeError(msg);
7
7
  };
8
- var A = (i, e, t) => e in i ? O(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, E = (i, e) => {
9
- for (var t in e || (e = {}))
10
- j.call(e, t) && A(i, t, e[t]);
11
- if (z)
12
- for (var t of z(e))
13
- G.call(e, t) && A(i, t, e[t]);
14
- return i;
15
- }, M = (i, e) => X(i, $(e));
16
- var R = (i, e, t) => e.has(i) || D("Cannot " + t);
17
- var a = (i, e, t) => (R(i, e, "read from private field"), t ? t.call(i) : e.get(i)), u = (i, e, t) => e.has(i) ? D("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), d = (i, e, t, l) => (R(i, e, "write to private field"), l ? l.call(i, t) : e.set(i, t), t);
18
- var q = (i, e, t, l) => ({
19
- set _(m) {
20
- d(i, e, m, t);
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b))
13
+ __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
14
+ return a;
15
+ }, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)), __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
16
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
17
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
18
+ var __privateWrapper = (obj, member, setter, getter) => ({
19
+ set _(value) {
20
+ __privateSet(obj, member, value, setter);
21
21
  },
22
22
  get _() {
23
- return a(i, e, l);
23
+ return __privateGet(obj, member, getter);
24
24
  }
25
25
  });
26
- var I = (i, e, t) => new Promise((l, m) => {
27
- var n = (s) => {
26
+ var __async = (__this, __arguments, generator) => new Promise((resolve, reject) => {
27
+ var fulfilled = (value) => {
28
28
  try {
29
- h(t.next(s));
30
- } catch (g) {
31
- m(g);
29
+ step(generator.next(value));
30
+ } catch (e) {
31
+ reject(e);
32
32
  }
33
- }, f = (s) => {
33
+ }, rejected = (value) => {
34
34
  try {
35
- h(t.throw(s));
36
- } catch (g) {
37
- m(g);
35
+ step(generator.throw(value));
36
+ } catch (e) {
37
+ reject(e);
38
38
  }
39
- }, h = (s) => s.done ? l(s.value) : Promise.resolve(s.value).then(n, f);
40
- h((t = t.apply(i, e)).next());
39
+ }, step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
40
+ step((generator = generator.apply(__this, __arguments)).next());
41
41
  });
42
- import { Cache as J } from "../cache/index.js";
43
- import { History as K } from "../history/index.js";
44
- import { L as N } from "../LocalLinks-DFZFpbjs.js";
45
- import { P as Q } from "../PageAnnouncerElement-0LxZjtVH.js";
46
- import { P as W } from "../PageScroll-0LxFblry.js";
47
- import { d as V } from "../events-CsVF98U6.js";
48
- import { m as F } from "../morph-BQErz7qP.js";
42
+ import { Cache } from "../cache/index.js";
43
+ import { History } from "../history/index.js";
44
+ import { L as LocalLinks } from "../LocalLinks-Dwgf3No6.js";
45
+ import { P as PageAnnouncerElement } from "../PageAnnouncerElement-DV9pm_od.js";
46
+ import { P as PageScroll } from "../PageScroll-m3TsHnzR.js";
47
+ import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
48
+ import { m as morph } from "../morph-BtgB1YQP.js";
49
49
  import "construct-style-sheets-polyfill";
50
- import "../index-e9eDuagL.js";
51
- import { a as Y, n as Z, b as _ } from "../url-CYgo5vrG.js";
52
- var P, k, r, o, S, w, v, b;
53
- const y = class y {
54
- constructor(e) {
55
- u(this, P, new J());
56
- u(this, k, new DOMParser());
57
- u(this, r, null);
58
- u(this, o, null);
59
- u(this, S, null);
60
- u(this, w, null);
61
- u(this, v, null);
62
- u(this, b, 0);
63
- y.instance || (y.instance = this, d(this, r, M(E({}, e), {
64
- base: Y(e == null ? void 0 : e.base)
65
- })), d(this, v, new Q()), d(this, o, new W(a(this, r).scrollSelector)), a(this, o).update(), d(this, S, new N({
66
- base: a(this, r).base,
67
- trailingSlash: a(this, r).trailingSlash,
68
- includeAnchor: e == null ? void 0 : e.includeAnchor,
69
- onClick: (t, l) => {
50
+ import "../index-DpKsHe97.js";
51
+ import { a as normalizeBase, n as normalizeURL, b as normalizeRelativeURLs } from "../url-CWCY_qe_.js";
52
+ var _cache, _domParser, _options, _scroll, _links, _history, _announcerElement, _updateId;
53
+ const _SPA = class _SPA {
54
+ constructor(options) {
55
+ __privateAdd(this, _cache, new Cache());
56
+ __privateAdd(this, _domParser, new DOMParser());
57
+ __privateAdd(this, _options, null);
58
+ __privateAdd(this, _scroll, null);
59
+ __privateAdd(this, _links, null);
60
+ __privateAdd(this, _history, null);
61
+ __privateAdd(this, _announcerElement, null);
62
+ __privateAdd(this, _updateId, 0);
63
+ _SPA.instance || (_SPA.instance = this, __privateSet(this, _options, __spreadProps(__spreadValues({}, options), {
64
+ base: normalizeBase(options == null ? void 0 : options.base)
65
+ })), __privateSet(this, _announcerElement, new PageAnnouncerElement()), __privateSet(this, _scroll, new PageScroll(__privateGet(this, _options).scrollSelector)), __privateGet(this, _scroll).update(), __privateSet(this, _links, new LocalLinks({
66
+ base: __privateGet(this, _options).base,
67
+ trailingSlash: __privateGet(this, _options).trailingSlash,
68
+ includeAnchor: options == null ? void 0 : options.includeAnchor,
69
+ onClick: /* @__PURE__ */ __name((url, options2) => {
70
70
  try {
71
- this.navigate(t, l);
72
- } catch (m) {
73
- window.location.assign(t);
71
+ this.navigate(url, options2);
72
+ } catch (e) {
73
+ window.location.assign(url);
74
74
  }
75
- }
76
- })), a(this, S).update(), d(this, w, new K({
77
- onPop: (t) => {
78
- this.navigate(t);
79
- }
75
+ }, "onClick")
76
+ })), __privateGet(this, _links).update(), __privateSet(this, _history, new History({
77
+ onPop: /* @__PURE__ */ __name((url) => {
78
+ this.navigate(url);
79
+ }, "onPop")
80
80
  })));
81
81
  }
82
82
  history() {
83
- return a(this, w);
83
+ return __privateGet(this, _history);
84
84
  }
85
85
  get scroll() {
86
- return a(this, o);
86
+ return __privateGet(this, _scroll);
87
87
  }
88
- navigate(e, t) {
89
- return I(this, null, function* () {
90
- var g, p, x, L, T, U, B, C;
91
- const l = a(this, w).isBack, m = ++q(this, b)._;
92
- let n = Z(e, {
93
- base: a(this, r).base,
94
- trailingSlash: a(this, r).trailingSlash
88
+ navigate(url, options) {
89
+ return __async(this, null, function* () {
90
+ var _a, _b, _c, _d, _e, _f, _g, _h;
91
+ const isBack = __privateGet(this, _history).isBack, updateId = ++__privateWrapper(this, _updateId)._;
92
+ let fullUrl = normalizeURL(url, {
93
+ base: __privateGet(this, _options).base,
94
+ trailingSlash: __privateGet(this, _options).trailingSlash
95
95
  });
96
- a(this, r).urlModifier && (n = a(this, r).urlModifier(n));
97
- let f = a(this, P).get(n.toString());
98
- if ((!f || t != null && t.revalidate) && (f = yield fetch(`${n}`, {
96
+ __privateGet(this, _options).urlModifier && (fullUrl = __privateGet(this, _options).urlModifier(fullUrl));
97
+ let contents = __privateGet(this, _cache).get(fullUrl.toString());
98
+ if ((!contents || options != null && options.revalidate) && (contents = yield fetch(`${fullUrl}`, {
99
99
  headers: {
100
100
  "X-SPA": "true"
101
101
  }
102
- }).then((c) => c.text()).catch(() => {
103
- window.location.assign(n);
104
- })), !f || (t != null && t.cache && a(this, P).set(n.toString(), f), a(this, b) !== m))
102
+ }).then((res) => res.text()).catch(() => {
103
+ window.location.assign(fullUrl);
104
+ })), !contents || (options != null && options.cache && __privateGet(this, _cache).set(fullUrl.toString(), contents), __privateGet(this, _updateId) !== updateId))
105
105
  return;
106
- l || (a(this, w).push(n), ((g = t == null ? void 0 : t.keepScrollPosition) == null || g) && a(this, o).element.scrollTo({ top: 0, behavior: "instant" }));
107
- const h = a(this, k).parseFromString(f, "text/html");
108
- if (_(h, n), yield (x = (p = a(this, r)).beforeDiff) == null ? void 0 : x.call(p, h), a(this, b) !== m)
106
+ isBack || (__privateGet(this, _history).push(fullUrl), ((_a = options == null ? void 0 : options.keepScrollPosition) == null || _a) && __privateGet(this, _scroll).element.scrollTo({ top: 0, behavior: "instant" }));
107
+ const html = __privateGet(this, _domParser).parseFromString(contents, "text/html");
108
+ if (normalizeRelativeURLs(html, fullUrl), yield (_c = (_b = __privateGet(this, _options)).beforeDiff) == null ? void 0 : _c.call(_b, html), __privateGet(this, _updateId) !== updateId)
109
109
  return;
110
- V(document, "spaBeforeUpdate", {
110
+ dispatchEvent(document, "spaBeforeUpdate", {
111
111
  custom: !0
112
112
  });
113
- let s = (L = h.querySelector("title")) == null ? void 0 : L.textContent;
114
- if (s)
115
- document.title = s;
113
+ let title = (_d = html.querySelector("title")) == null ? void 0 : _d.textContent;
114
+ if (title)
115
+ document.title = title;
116
116
  else {
117
- const c = document.querySelector("h1");
118
- s = (U = (T = c == null ? void 0 : c.innerText) != null ? T : c == null ? void 0 : c.textContent) != null ? U : n.pathname;
117
+ const h1 = document.querySelector("h1");
118
+ title = (_f = (_e = h1 == null ? void 0 : h1.innerText) != null ? _e : h1 == null ? void 0 : h1.textContent) != null ? _f : fullUrl.pathname;
119
119
  }
120
- a(this, v).create(h, s), a(this, r).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => F(document, h)).finished : yield F(document, h), a(this, o).update(), a(this, S).update(), a(this, v).done(), yield (C = (B = a(this, r)).afterDiff) == null ? void 0 : C.call(B), V(document, "spaAfterUpdate", {
120
+ __privateGet(this, _announcerElement).create(html, title), __privateGet(this, _options).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => morph(document, html)).finished : yield morph(document, html), __privateGet(this, _scroll).update(), __privateGet(this, _links).update(), __privateGet(this, _announcerElement).done(), yield (_h = (_g = __privateGet(this, _options)).afterDiff) == null ? void 0 : _h.call(_g), dispatchEvent(document, "spaAfterUpdate", {
121
121
  custom: !0
122
122
  });
123
123
  });
124
124
  }
125
125
  };
126
- P = new WeakMap(), k = new WeakMap(), r = new WeakMap(), o = new WeakMap(), S = new WeakMap(), w = new WeakMap(), v = new WeakMap(), b = new WeakMap(), y.instance = null;
127
- let H = y;
126
+ _cache = new WeakMap(), _domParser = new WeakMap(), _options = new WeakMap(), _scroll = new WeakMap(), _links = new WeakMap(), _history = new WeakMap(), _announcerElement = new WeakMap(), _updateId = new WeakMap(), __name(_SPA, "SPA"), _SPA.instance = null;
127
+ let SPA = _SPA;
128
128
  export {
129
- H as SPA
129
+ SPA
130
130
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../Store-Blf4msDz.cjs"),e=require("../Composed-C-TV9te3.cjs");exports.Store=r.Store;exports.activeStores=r.activeStores;exports.storeRegistry=r.storeRegistry;exports.Composed=e.Composed;exports.Derived=e.Derived;exports.DerivedArray=e.DerivedArray;exports.Resource=e.Resource;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Store=require("../Store-BCW70G3Z.cjs"),Composed=require("../Composed-B0fvCtZz.cjs"),DerivedArray=require("../DerivedArray-DYtWMW0n.cjs");exports.Store=Store.Store;exports.activeStores=Store.activeStores;exports.storeRegistry=Store.storeRegistry;exports.Composed=Composed.Composed;exports.Derived=Composed.Derived;exports.Resource=Composed.Resource;exports.DerivedArray=DerivedArray.DerivedArray;exports.DerivedKeyedArray=DerivedArray.DerivedKeyedArray;
@@ -1,6 +1,6 @@
1
- export { Store, activeStores, type StoreState, type StoreSubscribeCallback, type StoreMiddleware, type StoreOptions, type StoreEqualityCheckCallback, } from './Store';
1
+ export { Store, activeStores, type StoreEqualityCheckCallback, type StoreMiddleware, type StoreOptions, type StoreState, type StoreSubscribeCallback, } from './Store';
2
2
  export { Derived, type DerivedCallback } from './Derived';
3
- export { DerivedArray, type DerivedArrayCallback } from './DerivedArray';
3
+ export { DerivedArray, DerivedKeyedArray, type DerivedArrayCallback, } from './DerivedArray';
4
4
  export { Resource, type ResourceFetcher } from './Resource';
5
5
  export { Composed, type ComposedCallback } from './Composed';
6
6
  export { storeRegistry, type StoreRegistryState, type StoreRegistryStateStore, } from './StoreRegistry';