@ogygia/core 0.0.0 → 0.11.1

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 (548) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -1
  3. package/ambient.d.ts +194 -0
  4. package/dist/ClientBindingStub.svelte +6 -0
  5. package/dist/ClientBindingStub.svelte.d.ts +26 -0
  6. package/dist/KeepHost.svelte +19 -0
  7. package/dist/KeepHost.svelte.d.ts +10 -0
  8. package/dist/LakeBoundary.svelte +16 -0
  9. package/dist/LakeBoundary.svelte.d.ts +11 -0
  10. package/dist/LateIsland.svelte +22 -0
  11. package/dist/LateIsland.svelte.d.ts +15 -0
  12. package/dist/LateIslandAwait.svelte +17 -0
  13. package/dist/LateIslandAwait.svelte.d.ts +15 -0
  14. package/dist/LiveHost.svelte +19 -0
  15. package/dist/LiveHost.svelte.d.ts +10 -0
  16. package/dist/NestedProvider.svelte +13 -0
  17. package/dist/NestedProvider.svelte.d.ts +8 -0
  18. package/dist/OgygiaBoundary.svelte +5 -0
  19. package/dist/OgygiaBoundary.svelte.d.ts +17 -0
  20. package/dist/PromiseRegion.svelte +40 -0
  21. package/dist/PromiseRegion.svelte.d.ts +15 -0
  22. package/dist/PromiseRegionAwait.svelte +27 -0
  23. package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
  24. package/dist/Provide.svelte +27 -0
  25. package/dist/Provide.svelte.d.ts +8 -0
  26. package/dist/RawHtml.svelte +9 -0
  27. package/dist/RawHtml.svelte.d.ts +6 -0
  28. package/dist/Region.svelte +1173 -0
  29. package/dist/Region.svelte.d.ts +68 -0
  30. package/dist/SlotBoundary.svelte +13 -0
  31. package/dist/SlotBoundary.svelte.d.ts +7 -0
  32. package/dist/app.d.ts +4 -0
  33. package/dist/app.js +3 -0
  34. package/dist/boundary.d.ts +35 -0
  35. package/dist/boundary.js +127 -0
  36. package/dist/build-cache.d.ts +13 -0
  37. package/dist/build-cache.js +77 -0
  38. package/dist/compiler/blank-styles.d.ts +1 -0
  39. package/dist/compiler/blank-styles.js +63 -0
  40. package/dist/compiler/bom.d.ts +2 -0
  41. package/dist/compiler/bom.js +15 -0
  42. package/dist/compiler/browser-full.d.ts +8 -0
  43. package/dist/compiler/browser-full.js +8 -0
  44. package/dist/compiler/browser.d.ts +11 -0
  45. package/dist/compiler/browser.js +11 -0
  46. package/dist/compiler/content/transportables.d.ts +26 -0
  47. package/dist/compiler/content/transportables.js +219 -0
  48. package/dist/compiler/ctx.d.ts +185 -0
  49. package/dist/compiler/ctx.js +203 -0
  50. package/dist/compiler/debarrel/barrel.d.ts +55 -0
  51. package/dist/compiler/debarrel/barrel.js +248 -0
  52. package/dist/compiler/debarrel/options.d.ts +67 -0
  53. package/dist/compiler/debarrel/options.js +31 -0
  54. package/dist/compiler/debarrel/parse.d.ts +65 -0
  55. package/dist/compiler/debarrel/parse.js +256 -0
  56. package/dist/compiler/debarrel/plugin.d.ts +31 -0
  57. package/dist/compiler/debarrel/plugin.js +190 -0
  58. package/dist/compiler/debarrel/rewrite.d.ts +27 -0
  59. package/dist/compiler/debarrel/rewrite.js +118 -0
  60. package/dist/compiler/debarrel/svelte.d.ts +13 -0
  61. package/dist/compiler/debarrel/svelte.js +56 -0
  62. package/dist/compiler/dev/css-scope.d.ts +16 -0
  63. package/dist/compiler/dev/css-scope.js +38 -0
  64. package/dist/compiler/dev/dev-hmr.d.ts +25 -0
  65. package/dist/compiler/dev/dev-hmr.js +29 -0
  66. package/dist/compiler/dev/hmr.d.ts +34 -0
  67. package/dist/compiler/dev/hmr.js +57 -0
  68. package/dist/compiler/dev/region-bytes.d.ts +34 -0
  69. package/dist/compiler/dev/region-bytes.js +126 -0
  70. package/dist/compiler/driver.d.ts +280 -0
  71. package/dist/compiler/driver.js +1352 -0
  72. package/dist/compiler/flags.d.ts +16 -0
  73. package/dist/compiler/flags.js +101 -0
  74. package/dist/compiler/fouc-css.d.ts +97 -0
  75. package/dist/compiler/fouc-css.js +335 -0
  76. package/dist/compiler/free-vars.d.ts +20 -0
  77. package/dist/compiler/free-vars.js +327 -0
  78. package/dist/compiler/host.d.ts +65 -0
  79. package/dist/compiler/host.js +51 -0
  80. package/dist/compiler/ids.d.ts +84 -0
  81. package/dist/compiler/ids.js +86 -0
  82. package/dist/compiler/index.d.ts +11 -0
  83. package/dist/compiler/index.js +11 -0
  84. package/dist/compiler/kit.d.ts +129 -0
  85. package/dist/compiler/kit.js +563 -0
  86. package/dist/compiler/link/build-output.d.ts +44 -0
  87. package/dist/compiler/link/build-output.js +147 -0
  88. package/dist/compiler/link/caps.d.ts +48 -0
  89. package/dist/compiler/link/caps.js +64 -0
  90. package/dist/compiler/link/context-detect.d.ts +23 -0
  91. package/dist/compiler/link/context-detect.js +137 -0
  92. package/dist/compiler/link/emit-gate.d.ts +11 -0
  93. package/dist/compiler/link/emit-gate.js +40 -0
  94. package/dist/compiler/link/entry-shim.d.ts +4 -0
  95. package/dist/compiler/link/entry-shim.js +29 -0
  96. package/dist/compiler/link/island-deps.d.ts +142 -0
  97. package/dist/compiler/link/island-deps.js +525 -0
  98. package/dist/compiler/link/manifest.d.ts +5 -0
  99. package/dist/compiler/link/manifest.js +9 -0
  100. package/dist/compiler/link/page-keys.d.ts +64 -0
  101. package/dist/compiler/link/page-keys.js +683 -0
  102. package/dist/compiler/link/registry-stub.d.ts +41 -0
  103. package/dist/compiler/link/registry-stub.js +212 -0
  104. package/dist/compiler/link/router-config.d.ts +11 -0
  105. package/dist/compiler/link/router-config.js +15 -0
  106. package/dist/compiler/link/router-css.d.ts +22 -0
  107. package/dist/compiler/link/router-css.js +142 -0
  108. package/dist/compiler/link/runtime-entry.d.ts +71 -0
  109. package/dist/compiler/link/runtime-entry.js +132 -0
  110. package/dist/compiler/link/server-manifest.d.ts +12 -0
  111. package/dist/compiler/link/server-manifest.js +45 -0
  112. package/dist/compiler/link/speculation.d.ts +17 -0
  113. package/dist/compiler/link/speculation.js +36 -0
  114. package/dist/compiler/link/transport.d.ts +31 -0
  115. package/dist/compiler/link/transport.js +67 -0
  116. package/dist/compiler/macros/bake.d.ts +20 -0
  117. package/dist/compiler/macros/bake.js +317 -0
  118. package/dist/compiler/macros/browser.d.ts +11 -0
  119. package/dist/compiler/macros/browser.js +69 -0
  120. package/dist/compiler/macros/dedent.d.ts +12 -0
  121. package/dist/compiler/macros/dedent.js +36 -0
  122. package/dist/compiler/macros/dollar.d.ts +15 -0
  123. package/dist/compiler/macros/dollar.js +387 -0
  124. package/dist/compiler/macros/pipeline.d.ts +31 -0
  125. package/dist/compiler/macros/pipeline.js +106 -0
  126. package/dist/compiler/macros/source.d.ts +6 -0
  127. package/dist/compiler/macros/source.js +127 -0
  128. package/dist/compiler/macros/store.d.ts +17 -0
  129. package/dist/compiler/macros/store.js +244 -0
  130. package/dist/compiler/macros/wire.d.ts +14 -0
  131. package/dist/compiler/macros/wire.js +160 -0
  132. package/dist/compiler/ownership-stamps.d.ts +6 -0
  133. package/dist/compiler/ownership-stamps.js +144 -0
  134. package/dist/compiler/parse/oxc.d.ts +34 -0
  135. package/dist/compiler/parse/oxc.js +59 -0
  136. package/dist/compiler/parse/scan.d.ts +43 -0
  137. package/dist/compiler/parse/scan.js +232 -0
  138. package/dist/compiler/program.d.ts +140 -0
  139. package/dist/compiler/program.js +242 -0
  140. package/dist/compiler/region/emit.d.ts +169 -0
  141. package/dist/compiler/region/emit.js +286 -0
  142. package/dist/compiler/region/identity.d.ts +28 -0
  143. package/dist/compiler/region/identity.js +75 -0
  144. package/dist/compiler/region/ir.d.ts +65 -0
  145. package/dist/compiler/region/ir.js +0 -0
  146. package/dist/compiler/region/transform.d.ts +178 -0
  147. package/dist/compiler/region/transform.js +1933 -0
  148. package/dist/compiler/script-request.d.ts +1 -0
  149. package/dist/compiler/script-request.js +43 -0
  150. package/dist/context-bridge.d.ts +65 -0
  151. package/dist/context-bridge.js +217 -0
  152. package/dist/context-registry.d.ts +40 -0
  153. package/dist/context-registry.js +15 -0
  154. package/dist/context.d.ts +72 -0
  155. package/dist/context.js +158 -0
  156. package/dist/current-region.d.ts +14 -0
  157. package/dist/current-region.js +36 -0
  158. package/dist/document.d.ts +41 -0
  159. package/dist/document.js +125 -0
  160. package/dist/entry-hydrate.d.ts +5 -0
  161. package/dist/entry-hydrate.js +42 -0
  162. package/dist/escape.d.ts +18 -0
  163. package/dist/escape.js +37 -0
  164. package/dist/events/bus.d.ts +33 -0
  165. package/dist/events/bus.js +153 -0
  166. package/dist/events/index.d.ts +4 -0
  167. package/dist/events/index.js +4 -0
  168. package/dist/events/schema.d.ts +389 -0
  169. package/dist/events/schema.js +23 -0
  170. package/dist/events/server-registry.d.ts +7 -0
  171. package/dist/events/server-registry.js +13 -0
  172. package/dist/events/sinks.d.ts +64 -0
  173. package/dist/events/sinks.js +85 -0
  174. package/dist/fn-transport.d.ts +33 -0
  175. package/dist/fn-transport.js +140 -0
  176. package/dist/frame.d.ts +20 -0
  177. package/dist/frame.js +19 -0
  178. package/dist/holes-record.d.ts +6 -0
  179. package/dist/holes-record.js +8 -0
  180. package/dist/hooks.d.ts +43 -0
  181. package/dist/hooks.js +1191 -0
  182. package/dist/hydration-info.d.ts +1 -0
  183. package/dist/hydration-info.js +31 -0
  184. package/dist/index.d.ts +21 -0
  185. package/dist/index.js +17 -0
  186. package/dist/insights/attr-rules.d.ts +15 -0
  187. package/dist/insights/attr-rules.js +27 -0
  188. package/dist/insights/cpu.d.ts +82 -0
  189. package/dist/insights/cpu.js +177 -0
  190. package/dist/insights/fp-drift.d.ts +28 -0
  191. package/dist/insights/fp-drift.js +148 -0
  192. package/dist/insights/hole-segments.d.ts +26 -0
  193. package/dist/insights/hole-segments.js +50 -0
  194. package/dist/insights/html-diff.d.ts +25 -0
  195. package/dist/insights/html-diff.js +157 -0
  196. package/dist/insights/hydration-hazards.d.ts +36 -0
  197. package/dist/insights/hydration-hazards.js +136 -0
  198. package/dist/insights/hydration-status.d.ts +2 -0
  199. package/dist/insights/hydration-status.js +0 -0
  200. package/dist/insights/index.d.ts +14 -0
  201. package/dist/insights/index.js +12 -0
  202. package/dist/insights/page-assets.d.ts +211 -0
  203. package/dist/insights/page-assets.js +608 -0
  204. package/dist/insights/page-insights.d.ts +749 -0
  205. package/dist/insights/page-insights.js +2157 -0
  206. package/dist/insights/session-data.d.ts +108 -0
  207. package/dist/insights/session-data.js +0 -0
  208. package/dist/insights/session-insights.d.ts +121 -0
  209. package/dist/insights/session-insights.js +548 -0
  210. package/dist/insights/switch.d.ts +53 -0
  211. package/dist/insights/switch.js +91 -0
  212. package/dist/insights/testing-version.d.ts +19 -0
  213. package/dist/insights/testing-version.js +21 -0
  214. package/dist/insights/third-party.d.ts +75 -0
  215. package/dist/insights/third-party.js +160 -0
  216. package/dist/internal-instruments.d.ts +13 -0
  217. package/dist/internal-instruments.js +12 -0
  218. package/dist/internal-reconcile.d.ts +3 -0
  219. package/dist/internal-reconcile.js +3 -0
  220. package/dist/internal-register.d.ts +7 -0
  221. package/dist/internal-register.js +7 -0
  222. package/dist/internal-server.d.ts +7 -0
  223. package/dist/internal-server.js +7 -0
  224. package/dist/internal.d.ts +13 -0
  225. package/dist/internal.js +13 -0
  226. package/dist/island-graph.d.ts +36 -0
  227. package/dist/island-graph.js +89 -0
  228. package/dist/keep-fallback-marker.d.ts +7 -0
  229. package/dist/keep-fallback-marker.js +9 -0
  230. package/dist/keep-fallback.d.ts +13 -0
  231. package/dist/keep-fallback.js +39 -0
  232. package/dist/kit-paths.d.ts +2 -0
  233. package/dist/kit-paths.js +39 -0
  234. package/dist/late-region-registry.d.ts +40 -0
  235. package/dist/late-region-registry.js +36 -0
  236. package/dist/live-transport.d.ts +57 -0
  237. package/dist/live-transport.js +145 -0
  238. package/dist/markup.d.ts +4 -0
  239. package/dist/markup.js +4 -0
  240. package/dist/own-package.d.ts +15 -0
  241. package/dist/own-package.js +20 -0
  242. package/dist/page-defer.d.ts +33 -0
  243. package/dist/page-defer.js +35 -0
  244. package/dist/page-facts-script.d.ts +7 -0
  245. package/dist/page-facts-script.js +9 -0
  246. package/dist/page-seed-registry.d.ts +72 -0
  247. package/dist/page-seed-registry.js +31 -0
  248. package/dist/plugin/capability.d.ts +14 -0
  249. package/dist/plugin/capability.js +44 -0
  250. package/dist/plugin/client.d.ts +39 -0
  251. package/dist/plugin/client.js +6 -0
  252. package/dist/plugin/css.d.ts +3 -0
  253. package/dist/plugin/css.js +54 -0
  254. package/dist/plugin/facts.d.ts +42 -0
  255. package/dist/plugin/facts.js +37 -0
  256. package/dist/plugin/hooks.d.ts +33 -0
  257. package/dist/plugin/hooks.js +38 -0
  258. package/dist/plugin/index.d.ts +127 -0
  259. package/dist/plugin/index.js +26 -0
  260. package/dist/plugin/routes.d.ts +32 -0
  261. package/dist/plugin/routes.js +35 -0
  262. package/dist/plugin/server.d.ts +27 -0
  263. package/dist/plugin/server.js +92 -0
  264. package/dist/plugin/standard-schema.d.ts +27 -0
  265. package/dist/plugin/standard-schema.js +0 -0
  266. package/dist/plugin/testing.d.ts +13 -0
  267. package/dist/plugin/testing.js +54 -0
  268. package/dist/plugin/utils.d.ts +13 -0
  269. package/dist/plugin/utils.js +19 -0
  270. package/dist/portable-form.d.ts +22 -0
  271. package/dist/portable-form.js +52 -0
  272. package/dist/preference.d.ts +35 -0
  273. package/dist/preference.js +84 -0
  274. package/dist/preload.d.ts +1 -0
  275. package/dist/preload.js +21 -0
  276. package/dist/ref-watch.d.ts +31 -0
  277. package/dist/ref-watch.js +66 -0
  278. package/dist/ref.d.ts +124 -0
  279. package/dist/ref.js +272 -0
  280. package/dist/region-brand.d.ts +8 -0
  281. package/dist/region-brand.js +10 -0
  282. package/dist/region-core.d.ts +2 -0
  283. package/dist/region-core.js +1 -0
  284. package/dist/region-snippet.d.ts +73 -0
  285. package/dist/region-snippet.js +351 -0
  286. package/dist/region.d.ts +127 -0
  287. package/dist/region.js +162 -0
  288. package/dist/request-event.d.ts +1 -0
  289. package/dist/request-event.js +37 -0
  290. package/dist/router-css.d.ts +39 -0
  291. package/dist/router-css.js +66 -0
  292. package/dist/runtime/app-transport.d.ts +2 -0
  293. package/dist/runtime/app-transport.js +13 -0
  294. package/dist/runtime/beacon.d.ts +271 -0
  295. package/dist/runtime/beacon.js +2190 -0
  296. package/dist/runtime/boot-link.d.ts +1 -0
  297. package/dist/runtime/boot-link.js +44 -0
  298. package/dist/runtime/client-hooks.d.ts +5 -0
  299. package/dist/runtime/client-hooks.js +22 -0
  300. package/dist/runtime/client-plugins.d.ts +8 -0
  301. package/dist/runtime/client-plugins.js +34 -0
  302. package/dist/runtime/concurrency.d.ts +12 -0
  303. package/dist/runtime/concurrency.js +29 -0
  304. package/dist/runtime/connected.d.ts +12 -0
  305. package/dist/runtime/connected.js +16 -0
  306. package/dist/runtime/context.d.ts +1 -0
  307. package/dist/runtime/context.js +19 -0
  308. package/dist/runtime/core.d.ts +15 -0
  309. package/dist/runtime/core.js +1173 -0
  310. package/dist/runtime/drift-watch.d.ts +9 -0
  311. package/dist/runtime/drift-watch.js +60 -0
  312. package/dist/runtime/entry-locations.d.ts +33 -0
  313. package/dist/runtime/entry-locations.js +119 -0
  314. package/dist/runtime/foreign-props.d.ts +8 -0
  315. package/dist/runtime/foreign-props.js +14 -0
  316. package/dist/runtime/form-continuity.d.ts +10 -0
  317. package/dist/runtime/form-continuity.js +107 -0
  318. package/dist/runtime/frame-nav.d.ts +36 -0
  319. package/dist/runtime/frame-nav.js +225 -0
  320. package/dist/runtime/frame-store.d.ts +62 -0
  321. package/dist/runtime/frame-store.js +214 -0
  322. package/dist/runtime/frames.d.ts +1 -0
  323. package/dist/runtime/frames.js +25 -0
  324. package/dist/runtime/full.d.ts +4 -0
  325. package/dist/runtime/full.js +32 -0
  326. package/dist/runtime/hash.d.ts +41 -0
  327. package/dist/runtime/hash.js +79 -0
  328. package/dist/runtime/hole-facts.d.ts +8 -0
  329. package/dist/runtime/hole-facts.js +57 -0
  330. package/dist/runtime/host-classes.d.ts +24 -0
  331. package/dist/runtime/host-classes.js +43 -0
  332. package/dist/runtime/hydrate-core.d.ts +101 -0
  333. package/dist/runtime/hydrate-core.js +605 -0
  334. package/dist/runtime/index.d.ts +2 -0
  335. package/dist/runtime/index.js +1 -0
  336. package/dist/runtime/interaction-replay.d.ts +11 -0
  337. package/dist/runtime/interaction-replay.js +70 -0
  338. package/dist/runtime/interaction.d.ts +33 -0
  339. package/dist/runtime/interaction.js +217 -0
  340. package/dist/runtime/island-graph-preload.d.ts +13 -0
  341. package/dist/runtime/island-graph-preload.js +99 -0
  342. package/dist/runtime/kit-boot.d.ts +29 -0
  343. package/dist/runtime/kit-boot.js +60 -0
  344. package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
  345. package/dist/runtime/kit-page-thread.svelte.js +116 -0
  346. package/dist/runtime/lake-anchors.d.ts +13 -0
  347. package/dist/runtime/lake-anchors.js +19 -0
  348. package/dist/runtime/lakes.d.ts +15 -0
  349. package/dist/runtime/lakes.js +212 -0
  350. package/dist/runtime/live.d.ts +3 -0
  351. package/dist/runtime/live.js +17 -0
  352. package/dist/runtime/load-scheduler.d.ts +53 -0
  353. package/dist/runtime/load-scheduler.js +317 -0
  354. package/dist/runtime/morph.d.ts +42 -0
  355. package/dist/runtime/morph.js +671 -0
  356. package/dist/runtime/nav-handle.d.ts +25 -0
  357. package/dist/runtime/nav-handle.js +71 -0
  358. package/dist/runtime/nav-hooks.d.ts +2 -0
  359. package/dist/runtime/nav-hooks.js +23 -0
  360. package/dist/runtime/nearest-attr.d.ts +4 -0
  361. package/dist/runtime/nearest-attr.js +16 -0
  362. package/dist/runtime/observe.d.ts +27 -0
  363. package/dist/runtime/observe.js +63 -0
  364. package/dist/runtime/own-cost.d.ts +9 -0
  365. package/dist/runtime/own-cost.js +35 -0
  366. package/dist/runtime/ownership.d.ts +101 -0
  367. package/dist/runtime/ownership.js +115 -0
  368. package/dist/runtime/page-cache.d.ts +23 -0
  369. package/dist/runtime/page-cache.js +74 -0
  370. package/dist/runtime/page-defer.d.ts +14 -0
  371. package/dist/runtime/page-defer.js +103 -0
  372. package/dist/runtime/parse-html.d.ts +40 -0
  373. package/dist/runtime/parse-html.js +81 -0
  374. package/dist/runtime/reconcile.d.ts +41 -0
  375. package/dist/runtime/reconcile.js +194 -0
  376. package/dist/runtime/region-attrs.d.ts +95 -0
  377. package/dist/runtime/region-attrs.js +153 -0
  378. package/dist/runtime/region-endpoint-url.d.ts +76 -0
  379. package/dist/runtime/region-endpoint-url.js +169 -0
  380. package/dist/runtime/region-ids.d.ts +8 -0
  381. package/dist/runtime/region-ids.js +33 -0
  382. package/dist/runtime/remote-seeds.d.ts +2 -0
  383. package/dist/runtime/remote-seeds.js +21 -0
  384. package/dist/runtime/render-blocking.d.ts +2 -0
  385. package/dist/runtime/render-blocking.js +30 -0
  386. package/dist/runtime/restore.d.ts +34 -0
  387. package/dist/runtime/restore.js +390 -0
  388. package/dist/runtime/router-nav.d.ts +63 -0
  389. package/dist/runtime/router-nav.js +740 -0
  390. package/dist/runtime/router.d.ts +201 -0
  391. package/dist/runtime/router.js +593 -0
  392. package/dist/runtime/schedule.d.ts +49 -0
  393. package/dist/runtime/schedule.js +256 -0
  394. package/dist/runtime/seeds.d.ts +50 -0
  395. package/dist/runtime/seeds.js +208 -0
  396. package/dist/runtime/session.d.ts +52 -0
  397. package/dist/runtime/session.js +130 -0
  398. package/dist/runtime/sidecar.d.ts +3 -0
  399. package/dist/runtime/sidecar.js +56 -0
  400. package/dist/runtime/slots.d.ts +183 -0
  401. package/dist/runtime/slots.js +44 -0
  402. package/dist/runtime/spa-cacheable.d.ts +7 -0
  403. package/dist/runtime/spa-cacheable.js +18 -0
  404. package/dist/runtime/speculate-hint.d.ts +1 -0
  405. package/dist/runtime/speculate-hint.js +35 -0
  406. package/dist/runtime/svelte-warnings.d.ts +28 -0
  407. package/dist/runtime/svelte-warnings.js +71 -0
  408. package/dist/runtime/wire-classes.d.ts +3 -0
  409. package/dist/runtime/wire-classes.js +69 -0
  410. package/dist/runtime/wire-format.d.ts +7 -0
  411. package/dist/runtime/wire-format.js +22 -0
  412. package/dist/script.d.ts +134 -0
  413. package/dist/script.js +184 -0
  414. package/dist/seed-refs.d.ts +105 -0
  415. package/dist/seed-refs.js +487 -0
  416. package/dist/server/capability-lifetime.d.ts +28 -0
  417. package/dist/server/capability-lifetime.js +31 -0
  418. package/dist/server/dead-kit-resolves.d.ts +1 -0
  419. package/dist/server/dead-kit-resolves.js +39 -0
  420. package/dist/server/document-assembly.d.ts +30 -0
  421. package/dist/server/document-assembly.js +26 -0
  422. package/dist/server/document-tail.d.ts +113 -0
  423. package/dist/server/document-tail.js +208 -0
  424. package/dist/server/endpoint.d.ts +51 -0
  425. package/dist/server/endpoint.js +90 -0
  426. package/dist/server/entry-location.d.ts +8 -0
  427. package/dist/server/entry-location.js +29 -0
  428. package/dist/server/fingerprint.d.ts +1 -0
  429. package/dist/server/fingerprint.js +25 -0
  430. package/dist/server/head-presence.d.ts +45 -0
  431. package/dist/server/head-presence.js +156 -0
  432. package/dist/server/hmac.d.ts +38 -0
  433. package/dist/server/hmac.js +89 -0
  434. package/dist/server/hole-graph.d.ts +7 -0
  435. package/dist/server/hole-graph.js +71 -0
  436. package/dist/server/hole-urls.d.ts +3 -0
  437. package/dist/server/hole-urls.js +76 -0
  438. package/dist/server/html-scan.d.ts +19 -0
  439. package/dist/server/html-scan.js +60 -0
  440. package/dist/server/kit-context.d.ts +78 -0
  441. package/dist/server/kit-context.js +110 -0
  442. package/dist/server/late-wire.d.ts +22 -0
  443. package/dist/server/late-wire.js +28 -0
  444. package/dist/server/page-facts.d.ts +25 -0
  445. package/dist/server/page-facts.js +138 -0
  446. package/dist/server/page-seed.d.ts +33 -0
  447. package/dist/server/page-seed.js +60 -0
  448. package/dist/server/page-stream.d.ts +55 -0
  449. package/dist/server/page-stream.js +121 -0
  450. package/dist/server/payload.d.ts +6 -0
  451. package/dist/server/payload.js +22 -0
  452. package/dist/server/personal-response.d.ts +6 -0
  453. package/dist/server/personal-response.js +13 -0
  454. package/dist/server/props-wire.d.ts +56 -0
  455. package/dist/server/props-wire.js +178 -0
  456. package/dist/server/rate-limit.d.ts +22 -0
  457. package/dist/server/rate-limit.js +63 -0
  458. package/dist/server/region-css.d.ts +5 -0
  459. package/dist/server/region-css.js +30 -0
  460. package/dist/server/region-endpoint.d.ts +35 -0
  461. package/dist/server/region-endpoint.js +142 -0
  462. package/dist/server/region-props.d.ts +6 -0
  463. package/dist/server/region-props.js +44 -0
  464. package/dist/server/remote-seed-gate.d.ts +50 -0
  465. package/dist/server/remote-seed-gate.js +66 -0
  466. package/dist/server/render-cache.d.ts +26 -0
  467. package/dist/server/render-cache.js +51 -0
  468. package/dist/server/render-page.d.ts +51 -0
  469. package/dist/server/render-page.js +176 -0
  470. package/dist/server/render-region-html.d.ts +2 -0
  471. package/dist/server/render-region-html.js +19 -0
  472. package/dist/server/request-stats.d.ts +174 -0
  473. package/dist/server/request-stats.js +54 -0
  474. package/dist/server/reversible.d.ts +83 -0
  475. package/dist/server/reversible.js +994 -0
  476. package/dist/server/seed-shape.d.ts +22 -0
  477. package/dist/server/seed-shape.js +24 -0
  478. package/dist/server/shared-cache.d.ts +35 -0
  479. package/dist/server/shared-cache.js +104 -0
  480. package/dist/server/signing-key.d.ts +11 -0
  481. package/dist/server/signing-key.js +47 -0
  482. package/dist/server/sized-lru.d.ts +20 -0
  483. package/dist/server/sized-lru.js +68 -0
  484. package/dist/server/split-regions.d.ts +81 -0
  485. package/dist/server/split-regions.js +368 -0
  486. package/dist/server/stream-regions.d.ts +5 -0
  487. package/dist/server/stream-regions.js +36 -0
  488. package/dist/shared-state.d.ts +7 -0
  489. package/dist/shared-state.js +152 -0
  490. package/dist/shims/app-environment.d.ts +4 -0
  491. package/dist/shims/app-environment.js +6 -0
  492. package/dist/shims/app-navigation.d.ts +33 -0
  493. package/dist/shims/app-navigation.js +119 -0
  494. package/dist/shims/app-paths.d.ts +6 -0
  495. package/dist/shims/app-paths.js +18 -0
  496. package/dist/shims/app-state.svelte.d.ts +23 -0
  497. package/dist/shims/app-state.svelte.js +50 -0
  498. package/dist/shims/app-stores.d.ts +21 -0
  499. package/dist/shims/app-stores.js +54 -0
  500. package/dist/shims/kit-bridge.d.ts +29 -0
  501. package/dist/shims/kit-bridge.js +7 -0
  502. package/dist/shims/kit-remote/client-stub.d.ts +27 -0
  503. package/dist/shims/kit-remote/client-stub.js +43 -0
  504. package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
  505. package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
  506. package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
  507. package/dist/shims/kit-remote/remote-cache.js +73 -0
  508. package/dist/shims/kit-remote/state-stub.d.ts +8 -0
  509. package/dist/shims/kit-remote/state-stub.js +8 -0
  510. package/dist/shims/page-store.svelte.d.ts +39 -0
  511. package/dist/shims/page-store.svelte.js +77 -0
  512. package/dist/source.d.ts +29 -0
  513. package/dist/source.js +87 -0
  514. package/dist/store-transport.d.ts +86 -0
  515. package/dist/store-transport.js +229 -0
  516. package/dist/tool-fetches.d.ts +5 -0
  517. package/dist/tool-fetches.js +41 -0
  518. package/dist/transport.d.ts +48 -0
  519. package/dist/transport.js +181 -0
  520. package/dist/unscoped-css.d.ts +26 -0
  521. package/dist/unscoped-css.js +53 -0
  522. package/dist/vite/dev-maps.d.ts +33 -0
  523. package/dist/vite/dev-maps.js +140 -0
  524. package/dist/vite/index.d.ts +19 -0
  525. package/dist/vite/index.js +820 -0
  526. package/dist/vite/kit-dirs.d.ts +7 -0
  527. package/dist/vite/kit-dirs.js +67 -0
  528. package/dist/vite/late-island.d.ts +25 -0
  529. package/dist/vite/late-island.js +33 -0
  530. package/dist/vite/module-map.d.ts +8 -0
  531. package/dist/vite/module-map.js +144 -0
  532. package/dist/vite/options.d.ts +208 -0
  533. package/dist/vite/options.js +74 -0
  534. package/dist/vite/package-files.d.ts +3 -0
  535. package/dist/vite/package-files.js +84 -0
  536. package/dist/vite/paths.d.ts +45 -0
  537. package/dist/vite/paths.js +112 -0
  538. package/dist/vite/plugin-api.d.ts +166 -0
  539. package/dist/vite/plugin-api.js +212 -0
  540. package/dist/vite/profiler-maps.d.ts +23 -0
  541. package/dist/vite/profiler-maps.js +178 -0
  542. package/dist/vite/server-sourcemaps.d.ts +8 -0
  543. package/dist/vite/server-sourcemaps.js +80 -0
  544. package/dist/vite/sourcemaps.d.ts +18 -0
  545. package/dist/vite/sourcemaps.js +80 -0
  546. package/dist/vite/style-preprocess.d.ts +2 -0
  547. package/dist/vite/style-preprocess.js +96 -0
  548. package/package.json +180 -6
@@ -0,0 +1,593 @@
1
+ import { kit_hydrates_page } from "./kit-boot.js";
2
+ import { slots } from "./slots.js";
3
+ import { publish_nav } from "./nav-handle.js";
4
+ import { nearest_attr } from "./nearest-attr.js";
5
+ // src/runtime/router.ts
6
+ /**
7
+ * Minimal SPA router for ogygia (Astro's ClientRouter equivalent).
8
+ *
9
+ * Intercepts same-origin <a> clicks, fetches the target page, swaps <body>,
10
+ * merges <head>, and updates history. `data-ogygia-keep` keeps matching chrome.
11
+ * Islands on the new page auto-initialise via custom-element connection; old ones
12
+ * auto-unmount via disconnection (except inside persisted subtrees).
13
+ *
14
+ * This module is the router's BOOT half — the listeners, the lifecycle hooks, the link-preload
15
+ * policy, and the pure helpers — and it stays small: the navigation itself (fetch + cache, head
16
+ * merge, body reconcile, seeds, a11y) is ./router-nav.ts, loaded on the first prefetch or
17
+ * intercepted click. A visitor who never leaves the page never downloads it.
18
+ */
19
+ const WS = /\s+/;
20
+ /**
21
+ * The `<a>` a pointer event is about — through SHADOW ROOTS. A click inside a web component's
22
+ * shadow tree (a web component such as `<x-link>`, `<x-button href>`, a breadcrumb item)
23
+ * reaches the document with `event.target` retargeted to the host, so `target.closest('a')` finds
24
+ * nothing and the browser navigates natively — a full reload instead of a body swap. The composed
25
+ * path still holds the real anchor; Kit's own router reads it the same way.
26
+ */
27
+ function anchor_of(event) {
28
+ const path = typeof event.composedPath === "function" ? event.composedPath() : [];
29
+ for (const n of path) if (n instanceof Element && n.tagName === "A") return n;
30
+ const t = event.target;
31
+ return t instanceof Element ? t.closest("a") : null;
32
+ }
33
+ /**
34
+ * The anchor a HOVER is about, cheaply: `mouseover` fires for every element the pointer crosses,
35
+ * so the common case — not over a link at all — must cost one `closest('a')` and nothing else.
36
+ * Only when the retargeted `target` is a shadow HOST (the anchor may be inside its shadow tree)
37
+ * is the composed path read.
38
+ */
39
+ function hovered_anchor(event) {
40
+ const t = event.target;
41
+ if (!(t instanceof Element)) return null;
42
+ const a = t.closest("a");
43
+ if (a) return a;
44
+ return t.shadowRoot ? anchor_of(event) : null;
45
+ }
46
+ const native_push = typeof History !== "undefined" ? History.prototype.pushState : null;
47
+ const native_replace = typeof History !== "undefined" ? History.prototype.replaceState : null;
48
+ const push_state = (state, url) => (native_push ?? history.pushState).call(history, state, "", url);
49
+ const replace_state = (state, url) => {
50
+ const fn = native_replace ?? history.replaceState;
51
+ return url === void 0 ? fn.call(history, state, "") : fn.call(history, state, "", url);
52
+ };
53
+ const PRELOAD_RANK = {
54
+ eager: 0,
55
+ viewport: 1,
56
+ hover: 2,
57
+ tap: 3,
58
+ off: 4,
59
+ false: 4
60
+ };
61
+ /** Anchors that can carry a preload policy at all — under (or on) a marked element. The post-nav
62
+ * scan reads only these; an unmarked anchor has no trigger and was a wasted rank computation. */
63
+ const PRELOAD_MARKED_ANCHORS = "[data-sveltekit-preload-data] a[href], [data-sveltekit-preload-code] a[href], a[href][data-sveltekit-preload-data], a[href][data-sveltekit-preload-code]";
64
+ /** Does the page hold an element the fragment points at? `#top` and an empty `#` mean "the top",
65
+ * which the browser handles. A fragment that matches nothing is an app-managed one (a table row
66
+ * keyed by the hash): the browser would scroll to the top for it, so the router takes it over. */
67
+ function hash_target_exists(hash) {
68
+ if (!hash || hash === "#") return true;
69
+ const raw = hash.slice(1);
70
+ let dec = raw;
71
+ try {
72
+ dec = decodeURIComponent(raw);
73
+ } catch {}
74
+ if (raw === "top" || dec === "top") return true;
75
+ return !!(document.getElementById(dec) || document.getElementById(raw) || document.getElementsByName(dec).length);
76
+ }
77
+ /** Same document = pathname + search. Hash is not part of document identity. */
78
+ function same_document(a, b) {
79
+ return a.pathname === b.pathname && a.search === b.search;
80
+ }
81
+ /**
82
+ * Kit's `data-sveltekit-reload` grammar, nearest ancestor wins (Kit walks up from the anchor and
83
+ * takes the first element that carries the attribute): `""` / `"true"` = full-page load, `"off"` /
84
+ * `"false"` = SPA navigation — so a layout can opt a whole subtree OUT of the SPA and a child
85
+ * subtree can opt back IN. Presence alone used to force a reload, which turned a
86
+ * `data-sveltekit-reload="false"` subtree (an app's way of saying "SPA here") into full loads.
87
+ * Across shadow roots: a link a web component renders in its own shadow tree sits under the page's
88
+ * markup all the same (a card's link in a full-load subtree was swapped in place).
89
+ */
90
+ function reload_opt_out(anchor) {
91
+ const v = nearest_attr(anchor, "data-sveltekit-reload");
92
+ return v !== null && v !== "off" && v !== "false";
93
+ }
94
+ /**
95
+ * What a click on a link to the CURRENT document means. `hash`: a fragment jump — the browser's.
96
+ * `swallow`: the navigation to this exact address is already in flight — a web-component link
97
+ * (`<x-link>`, `<x-button href>`) handles the click itself and re-dispatches one on
98
+ * its inner anchor; the router pushed the URL for the first click, so the second one looks like a
99
+ * link to the current page — left to the browser it would RELOAD the document mid-swap. `refresh`:
100
+ * a real click on a link to the page one is on — re-render in place (Kit re-runs the navigation
101
+ * too; a full reload is never the answer for a same-origin link).
102
+ */
103
+ function same_document_link(url, current, in_flight) {
104
+ if (url.hash && url.href !== current.href) return "hash";
105
+ if (in_flight === url.href) return "swallow";
106
+ return "refresh";
107
+ }
108
+ function document_key(url) {
109
+ return url.pathname + url.search;
110
+ }
111
+ /** Instant scroll to a hash target (or top). Ignores CSS `scroll-behavior: smooth`. */
112
+ function jump_to_hash(hash) {
113
+ const html_el = document.documentElement;
114
+ const prev = html_el.style.scrollBehavior;
115
+ html_el.style.scrollBehavior = "auto";
116
+ try {
117
+ if (hash) {
118
+ let id;
119
+ try {
120
+ id = decodeURIComponent(hash.startsWith("#") ? hash.slice(1) : hash);
121
+ } catch {
122
+ id = hash.startsWith("#") ? hash.slice(1) : hash;
123
+ }
124
+ const el = document.getElementById(id);
125
+ if (el) {
126
+ el.scrollIntoView();
127
+ return;
128
+ }
129
+ }
130
+ window.scrollTo(0, 0);
131
+ } finally {
132
+ html_el.style.scrollBehavior = prev;
133
+ }
134
+ }
135
+ /** Run `fn` when the browser is idle (bounded), else soon. */
136
+ function on_idle(fn, timeout = 1e3) {
137
+ if (typeof requestIdleCallback === "function") requestIdleCallback(fn, { timeout });
138
+ else setTimeout(fn, 50);
139
+ }
140
+ let nav_promise = null;
141
+ let loaded_nav = null;
142
+ function nav() {
143
+ slots.router_link ??= {
144
+ document_key,
145
+ jump_to_hash,
146
+ push_state,
147
+ replace_state
148
+ };
149
+ if (!nav_promise) nav_promise = import("./router-nav.js").then((m) => loaded_nav = m, (err) => {
150
+ nav_promise = null;
151
+ throw err;
152
+ });
153
+ return nav_promise;
154
+ }
155
+ var SpaRouter = class {
156
+ #started = false;
157
+ #before_hooks = /* @__PURE__ */ new Set();
158
+ #after_hooks = /* @__PURE__ */ new Set();
159
+ /** href of the navigation in flight (set before the fetch, cleared when applied or aborted) */
160
+ nav_target = null;
161
+ /** The in-flight navigation's cancel handle: router-nav bumps `nav_gen` and sets `nav_abort` for
162
+ * each navigation it starts, and stops at its next step once `nav_gen` moved on. */
163
+ nav_gen = 0;
164
+ nav_abort = null;
165
+ #viewport_io = null;
166
+ #viewport_seen = /* @__PURE__ */ new WeakSet();
167
+ /** pathname+search of the document currently in the DOM (hash ignored). */
168
+ doc_key = "";
169
+ /**
170
+ * Full URL of the document currently displayed in the DOM. `navigate()` uses this as its `from`
171
+ * instead of `location.href`, because on a `popstate` (back/forward) the browser has ALREADY
172
+ * changed `location` to the target — so `location.href` would equal the target and the
173
+ * same-document guard would wrongly bail into the hash-only branch, never swapping the body
174
+ * (browser back left the old page's DOM in place). POP-FROM.
175
+ */
176
+ current_url = null;
177
+ beforeNavigate(fn) {
178
+ this.#before_hooks.add(fn);
179
+ return () => this.#before_hooks.delete(fn);
180
+ }
181
+ afterNavigate(fn) {
182
+ this.#after_hooks.add(fn);
183
+ try {
184
+ fn({
185
+ from: null,
186
+ to: this.#build_nav_target(new URL(location.href)),
187
+ type: "enter",
188
+ willUnload: false
189
+ });
190
+ } catch {}
191
+ return () => this.#after_hooks.delete(fn);
192
+ }
193
+ /**
194
+ * Keep the document in the DOM: the navigation in flight (if any) never swaps. The document key
195
+ * moves only when a swap commits, so every "same document" decision is about the page still on
196
+ * screen — and one made while the next page loads (back to this page, a link to it) must cancel
197
+ * that load, or it lands under this page's address (back pressed before `/plain` finished
198
+ * swapping left the URL on the old page and `/plain` in the DOM).
199
+ */
200
+ supersede() {
201
+ if (this.nav_target === null && this.nav_abort === null) return;
202
+ this.nav_gen++;
203
+ this.nav_abort?.abort();
204
+ this.nav_abort = null;
205
+ this.nav_target = null;
206
+ }
207
+ bust_page_cache() {
208
+ loaded_nav?.bust_page_cache();
209
+ }
210
+ _page_cache_size() {
211
+ return loaded_nav?.page_cache_size() ?? 0;
212
+ }
213
+ fetch_page(href, signal, purpose) {
214
+ return nav().then((n) => n.fetch_page(href, signal, purpose));
215
+ }
216
+ async navigate(url, opts = {}) {
217
+ const { push = true, type = "link", replace = false } = opts;
218
+ const from = this.current_url ?? new URL(location.href);
219
+ if (same_document(url, from) && !replace) {
220
+ if (!this.run_before(from, url, type)) return;
221
+ this.supersede();
222
+ if (push && url.href !== location.href) push_state({
223
+ ...history.state,
224
+ ogygia: true
225
+ }, url.href);
226
+ else if (url.href !== location.href) replace_state({
227
+ ...history.state,
228
+ ogygia: true
229
+ }, url.href);
230
+ jump_to_hash(url.hash);
231
+ this.current_url = url;
232
+ this.run_after(from, url, type);
233
+ return;
234
+ }
235
+ this.nav_target = url.href;
236
+ const gen = this.nav_gen;
237
+ let n;
238
+ try {
239
+ n = await nav();
240
+ } catch {
241
+ if (this.nav_target === url.href) this.nav_target = null;
242
+ location.href = url.href;
243
+ return;
244
+ }
245
+ if (gen !== this.nav_gen) return;
246
+ return n.navigate(this, url, from, opts);
247
+ }
248
+ goto(url, opts = {}) {
249
+ const target = new URL(url, location.href);
250
+ if (target.protocol !== "http:" && target.protocol !== "https:") throw new Error("[ogygia] goto() only supports http(s) URLs");
251
+ if (target.origin !== location.origin) {
252
+ if (opts.external) {
253
+ location.assign(target.href);
254
+ return Promise.resolve();
255
+ }
256
+ throw new Error("[ogygia] goto() only supports same-origin URLs (pass { external: true } to leave)");
257
+ }
258
+ return this.navigate(target, {
259
+ push: !opts.replaceState,
260
+ replace: false,
261
+ type: "goto"
262
+ });
263
+ }
264
+ invalidateAll() {
265
+ return nav().then((n) => n.invalidate_all());
266
+ }
267
+ invalidate() {
268
+ return this.invalidateAll();
269
+ }
270
+ preloadData(url) {
271
+ const target = new URL(url, location.href);
272
+ if (target.origin !== location.origin) return Promise.resolve({
273
+ type: "loaded",
274
+ status: 200,
275
+ data: {}
276
+ });
277
+ this.fetch_page(target.href, void 0, "prefetch");
278
+ return Promise.resolve({
279
+ type: "loaded",
280
+ status: 200,
281
+ data: {}
282
+ });
283
+ }
284
+ preloadCode() {
285
+ return Promise.resolve();
286
+ }
287
+ disableScrollHandling() {
288
+ if (typeof console !== "undefined") console.warn("[ogygia] disableScrollHandling() is a no-op in the islands SPA router.");
289
+ }
290
+ pushState() {
291
+ console.warn("[ogygia] pushState() shallow routing is not supported; use goto().");
292
+ }
293
+ replaceState() {
294
+ console.warn("[ogygia] replaceState() shallow routing is not supported; use goto().");
295
+ }
296
+ start() {
297
+ if (this.#started || typeof document === "undefined") return;
298
+ if (!document.querySelector("meta[name=\"ogygia-router\"]")) return;
299
+ if (kit_hydrates_page()) return;
300
+ this.#started = true;
301
+ this.doc_key = document_key(new URL(location.href));
302
+ this.current_url = new URL(location.href);
303
+ document.addEventListener("click", (event) => {
304
+ const anchor = anchor_of(event);
305
+ const url = this.#should_intercept(event, anchor);
306
+ if (!url) return;
307
+ if (this.nav_target === url.href) {
308
+ event.preventDefault();
309
+ return;
310
+ }
311
+ if (same_document(url, new URL(location.href))) {
312
+ const kind = same_document_link(url, new URL(location.href), this.nav_target);
313
+ if (kind === "hash") {
314
+ if (!hash_target_exists(url.hash)) {
315
+ event.preventDefault();
316
+ if (location.hash !== url.hash) {
317
+ push_state(history.state || {}, url.href);
318
+ window.dispatchEvent(new HashChangeEvent("hashchange", {
319
+ oldURL: location.href,
320
+ newURL: url.href
321
+ }));
322
+ }
323
+ }
324
+ return;
325
+ }
326
+ event.preventDefault();
327
+ if (kind === "refresh") this.navigate(url, {
328
+ push: false,
329
+ replace: true
330
+ });
331
+ return;
332
+ }
333
+ event.preventDefault();
334
+ this.navigate(url, { push: true });
335
+ });
336
+ this.#install_prefetch();
337
+ window.addEventListener("popstate", () => {
338
+ const url = new URL(location.href);
339
+ if (document_key(url) === this.doc_key) {
340
+ this.supersede();
341
+ jump_to_hash(url.hash);
342
+ return;
343
+ }
344
+ const pop_scroll = history.state?.scroll || null;
345
+ this.navigate(url, {
346
+ push: false,
347
+ pop_scroll,
348
+ type: "popstate"
349
+ });
350
+ });
351
+ replace_state({
352
+ ...history.state,
353
+ ogygia: true
354
+ });
355
+ }
356
+ #should_intercept(event, anchor) {
357
+ if (event.defaultPrevented) return false;
358
+ if (event.button !== 0) return false;
359
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return false;
360
+ if (!anchor || !anchor.href) return false;
361
+ if (anchor.target && anchor.target !== "_self") return false;
362
+ if (anchor.hasAttribute("download")) return false;
363
+ if (anchor.hasAttribute("data-no-spa")) return false;
364
+ if (reload_opt_out(anchor)) return false;
365
+ if ((anchor.getAttribute("rel") || "").split(WS).includes("external")) return false;
366
+ const url = new URL(anchor.href);
367
+ if (url.origin !== location.origin) return false;
368
+ return url;
369
+ }
370
+ run_before(from, to, type) {
371
+ let cancelled = false;
372
+ const nav = {
373
+ from: this.#build_nav_target(from),
374
+ to: this.#build_nav_target(to),
375
+ type,
376
+ cancel: () => cancelled = true,
377
+ willUnload: false
378
+ };
379
+ for (const fn of this.#before_hooks) try {
380
+ fn(nav);
381
+ } catch {}
382
+ return !cancelled;
383
+ }
384
+ run_after(from, to, type) {
385
+ for (const fn of this.#after_hooks) try {
386
+ fn({
387
+ from: this.#build_nav_target(from),
388
+ to: this.#build_nav_target(to),
389
+ type,
390
+ willUnload: false
391
+ });
392
+ } catch {}
393
+ }
394
+ #install_prefetch() {
395
+ document.addEventListener("mouseover", (event) => {
396
+ const anchor = hovered_anchor(event);
397
+ if (anchor && this.#preload_rank(anchor) <= PRELOAD_RANK.hover) this.#warm_anchor(anchor);
398
+ }, { passive: true });
399
+ const on_press = (event) => {
400
+ const anchor = anchor_of(event);
401
+ if (anchor && this.#preload_rank(anchor) <= PRELOAD_RANK.tap) this.#warm_anchor(anchor);
402
+ };
403
+ document.addEventListener("mousedown", on_press, { passive: true });
404
+ document.addEventListener("touchstart", on_press, { passive: true });
405
+ this.scan_preload_links();
406
+ }
407
+ /** After start + every navigation: drop detached IO targets, then re-observe the live body. */
408
+ #reset_viewport_io() {
409
+ this.#viewport_io?.disconnect();
410
+ this.#viewport_seen = /* @__PURE__ */ new WeakSet();
411
+ this.#viewport_io = new IntersectionObserver((entries) => {
412
+ for (const e of entries) if (e.isIntersecting) {
413
+ this.#viewport_io.unobserve(e.target);
414
+ this.#warm_anchor(e.target);
415
+ }
416
+ }, { rootMargin: "0px" });
417
+ }
418
+ /**
419
+ * After start + every navigation, in IDLE: eager links warm now; viewport links get observed.
420
+ * Only anchors under a preload-marked element are read — an unmarked anchor has no trigger. Idle,
421
+ * because the scan competes with the freshly swapped page's own islands for the main thread and
422
+ * a warm is speculation by definition.
423
+ */
424
+ scan_preload_links() {
425
+ on_idle(() => {
426
+ this.#reset_viewport_io();
427
+ if (!this.#viewport_io) return;
428
+ for (const anchor of Array.from(document.querySelectorAll(PRELOAD_MARKED_ANCHORS))) {
429
+ const rank = this.#preload_rank(anchor);
430
+ if (rank === PRELOAD_RANK.eager) this.#warm_anchor(anchor);
431
+ else if (rank === PRELOAD_RANK.viewport && !this.#viewport_seen.has(anchor)) {
432
+ this.#viewport_seen.add(anchor);
433
+ this.#viewport_io.observe(anchor);
434
+ }
435
+ }
436
+ });
437
+ }
438
+ /** Warm the page-HTML cache for an anchor if it's a same-origin SPA target. */
439
+ #warm_anchor(anchor) {
440
+ const url = this.#should_intercept({
441
+ button: 0,
442
+ defaultPrevented: false
443
+ }, anchor);
444
+ if (!url) return;
445
+ if (same_document(url, new URL(location.href))) return;
446
+ if (url.href !== location.href) this.fetch_page(url.href, void 0, "prefetch");
447
+ }
448
+ /** Rank of the most-eager preload trigger that applies to `anchor` (5 = none). */
449
+ #preload_rank(anchor) {
450
+ let rank = 5;
451
+ const d = this.#preload_attr(anchor, "data-sveltekit-preload-data");
452
+ const c = this.#preload_attr(anchor, "data-sveltekit-preload-code");
453
+ if (d != null) rank = Math.min(rank, PRELOAD_RANK[d] ?? 5);
454
+ if (c != null) rank = Math.min(rank, PRELOAD_RANK[c] ?? 5);
455
+ return rank;
456
+ }
457
+ /** Nearest-ancestor value of `name` (Kit inheritance); empty value -> 'hover'. null if unset. */
458
+ #preload_attr(el, name) {
459
+ const holder = el.closest("[" + name + "]");
460
+ if (!holder) return null;
461
+ const v = holder.getAttribute(name);
462
+ return v === "" || v == null ? "hover" : v;
463
+ }
464
+ #build_nav_target(url) {
465
+ return {
466
+ url,
467
+ params: {},
468
+ route: { id: null }
469
+ };
470
+ }
471
+ };
472
+ const spa = new SpaRouter();
473
+ /**
474
+ * Register a callback before a client-side navigation.
475
+ * Call `nav.cancel()` to abort. Returns an unsubscribe function. Inside a component, prefer the
476
+ * `$app/navigation` / `ogygia/app` export, which unsubscribes on destroy.
477
+ */
478
+ function beforeNavigate(fn) {
479
+ return spa.beforeNavigate(fn);
480
+ }
481
+ /**
482
+ * Register a callback after a successful client-side navigation.
483
+ * Returns an unsubscribe function. Inside a component, prefer the `$app/navigation` /
484
+ * `ogygia/app` export, which unsubscribes on destroy.
485
+ */
486
+ function afterNavigate(fn) {
487
+ return spa.afterNavigate(fn);
488
+ }
489
+ /** Drop all warmed page HTML (call after mutations / auth changes). */
490
+ function bust_page_cache() {
491
+ spa.bust_page_cache();
492
+ }
493
+ /** Test helper — current warmed entry count. */
494
+ function _page_cache_size() {
495
+ return spa._page_cache_size();
496
+ }
497
+ /**
498
+ * Programmatic same-origin navigation. Mirrors Kit's `goto()` subset.
499
+ * @param url - Absolute or relative URL (http(s) only).
500
+ * @param opts.replaceState - Replace the current history entry instead of pushing.
501
+ */
502
+ function goto(url, opts = {}) {
503
+ return spa.goto(url, opts);
504
+ }
505
+ /**
506
+ * Soft-refresh the current URL's document seeds + head (not a navigation).
507
+ * Busts the SPA HTML cache so the next real route change is fresh. Coarser than
508
+ * Kit's dependency-scoped invalidate — see `invalidate_all` in ./router-nav.ts.
509
+ */
510
+ function invalidateAll() {
511
+ return spa.invalidateAll();
512
+ }
513
+ /**
514
+ * Refresh navigation data. Without Kit's client we cannot invalidate a single
515
+ * dependency, so this refreshes everything (same as {@link invalidateAll}).
516
+ */
517
+ function invalidate() {
518
+ return spa.invalidate();
519
+ }
520
+ /**
521
+ * Warm the next page: fetch it into the swap-readable HTML cache (+ its island modules) — this is
522
+ * what makes the eventual click instant, and no browser cache can feed a body swap. (Router OFF —
523
+ * the browser owns navigation — is the MPA navigation handle's Speculation Rules hint, not this
524
+ * module: ./nav-handle.ts. This module only loads with the router feature.)
525
+ */
526
+ function preloadData(url) {
527
+ return spa.preloadData(url);
528
+ }
529
+ /** No-op with the router on: page “code” arrives with the HTML body swap (+ island chunks on
530
+ * connect). Router OFF is the MPA navigation handle's prefetch hint (./nav-handle.ts). */
531
+ function preloadCode(_url) {
532
+ return spa.preloadCode();
533
+ }
534
+ /** Skip scroll restoration / scroll-to-top on the next client-side navigation. */
535
+ function disableScrollHandling() {
536
+ spa.disableScrollHandling();
537
+ }
538
+ /**
539
+ * Shallow routing is not supported without Kit's client runtime.
540
+ * @throws Always — use full navigations instead.
541
+ */
542
+ function pushState() {
543
+ spa.pushState();
544
+ }
545
+ /**
546
+ * Shallow routing is not supported without Kit's client runtime.
547
+ * @throws Always — use full navigations instead.
548
+ */
549
+ function replaceState() {
550
+ spa.replaceState();
551
+ }
552
+ /**
553
+ * Install click/popstate listeners and start SPA navigation.
554
+ * Invoked by the runtime once the module loads (handle-injected on every ogygia page, or by an island).
555
+ * @internal
556
+ */
557
+ function startRouter() {
558
+ spa.start();
559
+ }
560
+ /**
561
+ * Feature entry: start the SPA router once the DOM is ready, but only when the page carries
562
+ * `<meta name="ogygia-router">` (the handle injects it globally unless `ogygia({ router: false })`)
563
+ * and Kit is not already booting it.
564
+ */
565
+ function install() {
566
+ if (typeof document === "undefined") return;
567
+ slots.nav = {
568
+ goto,
569
+ invalidateAll
570
+ };
571
+ publish_nav({
572
+ goto,
573
+ invalidate,
574
+ invalidateAll,
575
+ preloadData,
576
+ preloadCode,
577
+ disableScrollHandling,
578
+ pushState,
579
+ replaceState,
580
+ beforeNavigate,
581
+ afterNavigate,
582
+ bust_page_cache
583
+ });
584
+ const start = () => {
585
+ if (!document.querySelector("meta[name=\"ogygia-router\"]")) return;
586
+ if (kit_hydrates_page()) return;
587
+ startRouter();
588
+ document.dispatchEvent(new Event("og:page-load"));
589
+ };
590
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start, { once: true });
591
+ else start();
592
+ }
593
+ export { SpaRouter, _page_cache_size, afterNavigate, anchor_of, beforeNavigate, bust_page_cache, disableScrollHandling, document_key, goto, install, invalidate, invalidateAll, jump_to_hash, preloadCode, preloadData, pushState, push_state, reload_opt_out, replaceState, replace_state, same_document, same_document_link, startRouter };
@@ -0,0 +1,49 @@
1
+ export declare function yield_task(): Promise<void>;
2
+ /**
3
+ * Run `fn` at background priority, off the current task: `scheduler.postTask` at 'background' where
4
+ * it exists, else a macrotask. This orders MAIN-THREAD work only — it lets a pending render or input
5
+ * task go first. It does not hold back the network: while the page's resources download the main
6
+ * thread is idle, so a background task runs at once and an `import()` it starts competes with them.
7
+ * Holding island code back until the page has painted is `after_document_painted`'s job.
8
+ */
9
+ export declare function background_start(fn: () => void): void;
10
+ /**
11
+ * Resolves once the document is parsed AND painted: after `DOMContentLoaded`, then one rendered
12
+ * frame. This is the moment SvelteKit starts hydrating (its start runs from a deferred module
13
+ * script, so never before DOMContentLoaded), and an island's wake starts no earlier: the runtime
14
+ * boots from a module script that runs BEFORE DOMContentLoaded — the app's other deferred scripts
15
+ * may still be executing and the first paint (and its LCP image) not yet happened — and an island
16
+ * `import()` started there takes bandwidth from both.
17
+ *
18
+ * `readyState` cannot tell "DOMContentLoaded fired" from "about to fire" (it reads `interactive` for
19
+ * both), so the navigation timing entry decides; `load` backs up the listener where there is none.
20
+ * A hidden document paints no frame (`requestAnimationFrame` never fires there) — nothing to protect,
21
+ * so it waits one task instead. Once resolved it stays resolved: a late region (SPA swap, a hole's
22
+ * answer) passes straight through.
23
+ */
24
+ export declare function after_document_painted(): Promise<void>;
25
+ /** Test seam: forget the resolved gate (a test that fakes a fresh document). */
26
+ export declare function reset_document_painted(): void;
27
+ /**
28
+ * Register a region with the scheduler at connect: stamp its order, start its viewport snapshot.
29
+ * Cheap on purpose (a stamp and an `observe`) — connect runs for every region in one task.
30
+ */
31
+ export declare function register_region(el: Element): void;
32
+ /**
33
+ * Drop a region from the scheduler (disconnect): its snapshot stops and any pending turn is handed
34
+ * out at once — the waiting hydrate step then sees `isConnected === false` and stands down (or, if
35
+ * the element was re-attached meanwhile, runs — exactly what an un-scheduled wait would have done).
36
+ */
37
+ export declare function unregister_region(el: Element): void;
38
+ /** The island's module is in flight: a viewport island here holds ready islands below the fold. */
39
+ export declare function hydrate_started(el: Element): void;
40
+ /** The hydrate attempt is over (turn taken, or it never got there — no entry, a failed import). */
41
+ export declare function hydrate_settled(el: Element): void;
42
+ /**
43
+ * Wait for this region's turn. Resolves in a task of its own, after every region ahead of it in
44
+ * priority has had its task. Call it when the island can hydrate right now (module loaded) — the
45
+ * continuation after the `await` IS the turn: keep the whole synchronous hydrate step in it.
46
+ */
47
+ export declare function hydrate_turn(el: Element): Promise<void>;
48
+ /** Test seam: is a hydration turn queued or being drained right now? */
49
+ export declare function schedule_idle(): boolean;