@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,9 @@
1
+ /** A region kept its server copy: watch until it wakes (pair with {@link unwatch_region}). */
2
+ export declare function watch_region(): void;
3
+ /** A region woke (or left): stop watching once none sleeps. */
4
+ export declare function unwatch_region(): void;
5
+ /** The region's copy is stale (it left the document while it slept): compare it at the wake. */
6
+ export declare function mark_region_changed(region: Element): void;
7
+ /** Was anything in this region's markup touched since it kept its copy? Read at the wake, BEFORE the
8
+ * runtime itself edits the island (lakes lifted): the pending records are taken first. */
9
+ export declare function region_changed(region: Element): boolean;
@@ -0,0 +1,60 @@
1
+ import { walk_enters } from "./ownership.js";
2
+ // src/runtime/drift-watch.ts
3
+ /**
4
+ * WHICH SLEEPING ISLANDS WERE TOUCHED. An island keeps its server markup from its first connect and,
5
+ * at its wake, used to parse that copy and walk it against the live DOM (hydrate-core
6
+ * `repair_if_drifted`) — every island, though almost always nothing had touched it: two thirds of
7
+ * Svelte's own hydrate time on a page of heavy islands, measured. One `MutationObserver` over the
8
+ * document now marks an island CHANGED when a node or a text in it changes (the comparison ignores
9
+ * attributes, and so does this); the wake runs the comparison, and the repair, only for a changed
10
+ * one. Nothing is decided by timing: the wake takes the observer's pending records first.
11
+ *
12
+ * The observer runs only while some island sleeps with a copy (a page whose islands are all awake
13
+ * pays nothing for later DOM work). An island that leaves the document while it sleeps is marked
14
+ * changed: nothing watched it meanwhile. A browser without MutationObserver: every island compares,
15
+ * as before.
16
+ */
17
+ const REGION = "ogygia-region";
18
+ const changed = /* @__PURE__ */ new WeakSet();
19
+ let observer = null;
20
+ let sleeping = 0;
21
+ const supported = typeof MutationObserver !== "undefined";
22
+ function mark(records) {
23
+ for (const r of records) {
24
+ let hidden = false;
25
+ for (let n = r.target; n; n = n.parentNode) {
26
+ if (n.nodeType !== 1) continue;
27
+ const el = n;
28
+ if (el.localName === REGION && !hidden) changed.add(el);
29
+ if (!hidden && !walk_enters(el)) hidden = true;
30
+ }
31
+ }
32
+ }
33
+ /** A region kept its server copy: watch until it wakes (pair with {@link unwatch_region}). */
34
+ function watch_region() {
35
+ if (!supported || ++sleeping > 1) return;
36
+ observer ??= new MutationObserver(mark);
37
+ observer.observe(document.documentElement, {
38
+ childList: true,
39
+ characterData: true,
40
+ subtree: true
41
+ });
42
+ }
43
+ /** A region woke (or left): stop watching once none sleeps. */
44
+ function unwatch_region() {
45
+ if (!supported || sleeping === 0 || --sleeping > 0) return;
46
+ if (observer) mark(observer.takeRecords());
47
+ observer?.disconnect();
48
+ }
49
+ /** The region's copy is stale (it left the document while it slept): compare it at the wake. */
50
+ function mark_region_changed(region) {
51
+ changed.add(region);
52
+ }
53
+ /** Was anything in this region's markup touched since it kept its copy? Read at the wake, BEFORE the
54
+ * runtime itself edits the island (lakes lifted): the pending records are taken first. */
55
+ function region_changed(region) {
56
+ if (!supported) return true;
57
+ if (observer && sleeping > 0) mark(observer.takeRecords());
58
+ return changed.has(region);
59
+ }
60
+ export { mark_region_changed, region_changed, unwatch_region, watch_region };
@@ -0,0 +1,33 @@
1
+ /** A load that fell back to its identity: who hears about it (the runtime registers the devtools
2
+ * and beacon reporter at boot). This module imports nothing: app code (a portable snippet) uses it
3
+ * too, and must not pull the runtime's reporting into the app's chunks. */
4
+ export type EntryFallbackReport = {
5
+ entry: string;
6
+ src: string;
7
+ recovered: boolean;
8
+ };
9
+ export declare function on_entry_fallback(reporter: (report: EntryFallbackReport) => void): void;
10
+ /** Remember where an entry is served from. `base`: the document the pair was read from. */
11
+ export declare function note_entry_location(entry: string | null | undefined, src: string | null | undefined, base?: string): void;
12
+ /** The known location of an entry, or undefined. */
13
+ export declare function entry_location(entry: string, base?: string): string | undefined;
14
+ /**
15
+ * PIN A REGION'S URLS TO THE PAGE THAT WROTE THEM. With Kit's default `paths.relative`, the server
16
+ * writes `entry` / `src` / `endpoint` relative to the page it rendered (`../../_app/immutable/…`,
17
+ * `../../__ogygia__?…`), and every reader resolves them against `location.href`. A region that stays
18
+ * on the page through a client navigation (Kit's, or the router's) then resolved them against the
19
+ * NEW address: its island imported `/a/b/_app/…` (a redirect to an HTML page), and a hole's key
20
+ * changed with the depth of the page, so a swap kept the old region beside the new one. Resolved
21
+ * once, where the address is still the right one — the element's connect, and a fetched document
22
+ * against its own URL — they read the same on every page. Same origin only (a federated entry stays
23
+ * as written); an absolute or root-absolute value is already pinned.
24
+ */
25
+ export declare function pin_region_urls(el: Element, base?: string): void;
26
+ /** An island element's identity, its location noted on the way (the one read every loader uses). */
27
+ export declare function island_entry_of(el: Element): string | null;
28
+ /**
29
+ * Import an entry: its location when known, else `url` (what the caller resolved for the identity);
30
+ * the location failing, once, the identity fetched fresh — so an island on a page that outlived its
31
+ * build still wakes, on the current code. No location known → the error stands.
32
+ */
33
+ export declare function import_entry<T>(entry: string, url?: string): Promise<T>;
@@ -0,0 +1,119 @@
1
+ // src/runtime/entry-locations.ts
2
+ /**
3
+ * ENTRY IDENTITY → LOCATION, the browser's half (server/entry-location.ts is the server's).
4
+ *
5
+ * An island's `entry` is its IDENTITY: the stable URL every key uses (the island graph, the
6
+ * fingerprint, the devtools' names). The file to import is its LOCATION — content-hashed, so an
7
+ * `immutable` cache never serves a stale one. The server writes it beside the identity: the region
8
+ * element's `src`, and the island graph's `s` map for an entry no element carries (a portable
9
+ * snippet's). Every loader resolves through `island_module_url` (region-endpoint-url.ts), which asks
10
+ * here first: the location once one is known, else the identity (the dev server, or a page from
11
+ * before hashing — whose stable name is a shim that reaches the current build).
12
+ */
13
+ /** absolute identity → absolute location */
14
+ const locations = /* @__PURE__ */ new Map();
15
+ let fallback_reporter = null;
16
+ function on_entry_fallback(reporter) {
17
+ fallback_reporter = reporter;
18
+ }
19
+ /** Resolved URLs by base + url: every wake, warm and graph read asks again for the same few
20
+ * entries, and each ask was a `new URL()` parse (bounded: cleared past a few thousand). */
21
+ const resolved_urls = /* @__PURE__ */ new Map();
22
+ function absolute(url, base) {
23
+ const b = base ?? location.href;
24
+ const key = b + "\n" + url;
25
+ const hit = resolved_urls.get(key);
26
+ if (hit !== void 0) return hit;
27
+ let out;
28
+ try {
29
+ out = new URL(url, b).href;
30
+ } catch {
31
+ out = url;
32
+ }
33
+ if (resolved_urls.size > 4e3) resolved_urls.clear();
34
+ resolved_urls.set(key, out);
35
+ return out;
36
+ }
37
+ /** Remember where an entry is served from. `base`: the document the pair was read from. */
38
+ function note_entry_location(entry, src, base) {
39
+ if (!entry || !src || src === entry) return;
40
+ locations.set(absolute(entry, base), absolute(src, base));
41
+ }
42
+ /** The known location of an entry, or undefined. */
43
+ function entry_location(entry, base) {
44
+ return locations.size ? locations.get(absolute(entry, base)) : void 0;
45
+ }
46
+ /** The region attributes that hold a URL: its identity, its location, its hole's endpoint. */
47
+ const REGION_URL_ATTRS = [
48
+ "entry",
49
+ "src",
50
+ "endpoint"
51
+ ];
52
+ /**
53
+ * PIN A REGION'S URLS TO THE PAGE THAT WROTE THEM. With Kit's default `paths.relative`, the server
54
+ * writes `entry` / `src` / `endpoint` relative to the page it rendered (`../../_app/immutable/…`,
55
+ * `../../__ogygia__?…`), and every reader resolves them against `location.href`. A region that stays
56
+ * on the page through a client navigation (Kit's, or the router's) then resolved them against the
57
+ * NEW address: its island imported `/a/b/_app/…` (a redirect to an HTML page), and a hole's key
58
+ * changed with the depth of the page, so a swap kept the old region beside the new one. Resolved
59
+ * once, where the address is still the right one — the element's connect, and a fetched document
60
+ * against its own URL — they read the same on every page. Same origin only (a federated entry stays
61
+ * as written); an absolute or root-absolute value is already pinned.
62
+ */
63
+ function pin_region_urls(el, base) {
64
+ for (const name of REGION_URL_ATTRS) {
65
+ const value = el.getAttribute(name);
66
+ if (!value || !(value.startsWith("./") || value.startsWith("../"))) continue;
67
+ let url;
68
+ try {
69
+ url = new URL(absolute(value, base));
70
+ } catch {
71
+ continue;
72
+ }
73
+ if (url.origin === location.origin) el.setAttribute(name, url.pathname + url.search + url.hash);
74
+ }
75
+ }
76
+ /** An island element's identity, its location noted on the way (the one read every loader uses). */
77
+ function island_entry_of(el) {
78
+ const entry = el.getAttribute("entry");
79
+ if (entry) note_entry_location(entry, el.getAttribute("src"));
80
+ return entry;
81
+ }
82
+ /**
83
+ * The identity itself, past every cache: what a load falls back to when its location failed (a page
84
+ * a cache kept outlived the build that made it, and that build's files are gone). The stable name
85
+ * is a shim of the CURRENT build's file; the query makes the browser fetch it fresh rather than the
86
+ * copy an `immutable` cache may hold. Null when no location was known (nothing to fall back to).
87
+ */
88
+ function fresh_identity_url(entry, base) {
89
+ if (!entry_location(entry, base)) return null;
90
+ const identity = absolute(entry, base);
91
+ return identity + (identity.includes("?") ? "&" : "?") + "og-fresh=" + Date.now().toString(36);
92
+ }
93
+ /**
94
+ * Import an entry: its location when known, else `url` (what the caller resolved for the identity);
95
+ * the location failing, once, the identity fetched fresh — so an island on a page that outlived its
96
+ * build still wakes, on the current code. No location known → the error stands.
97
+ */
98
+ function import_entry(entry, url = entry_location(entry) ?? entry) {
99
+ const loaded = import(
100
+ /* @vite-ignore */
101
+ url
102
+ );
103
+ const fresh = fresh_identity_url(entry);
104
+ if (!fresh) return loaded;
105
+ return loaded.catch(() => {
106
+ const retry = import(
107
+ /* @vite-ignore */
108
+ fresh
109
+ );
110
+ const report = (recovered) => fallback_reporter?.({
111
+ entry,
112
+ src: url,
113
+ recovered
114
+ });
115
+ retry.then(() => report(true), () => report(false));
116
+ return retry;
117
+ });
118
+ }
119
+ export { entry_location, import_entry, island_entry_of, note_entry_location, on_entry_fallback, pin_region_urls };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * THE MEMBRANE for foreign islands (fragment federation) — a pure module (no DOM, no virtual
3
+ * imports) so it is unit-testable and safe in any bundle. A FOREIGN-origin island's props parse
4
+ * with wire revivers OFF: reviving a wired ref would construct a class instance from THIS
5
+ * build's codec and hand it to ANOTHER build's svelte — the exact live-value crossing the
6
+ * boundary laws forbid. A ref in a foreign sidecar fails HERE, loudly, at the boundary.
7
+ */
8
+ export declare function foreign_region_prop_revivers(): Record<string, (d: never) => unknown>;
@@ -0,0 +1,14 @@
1
+ // src/runtime/foreign-props.ts
2
+ /**
3
+ * THE MEMBRANE for foreign islands (fragment federation) — a pure module (no DOM, no virtual
4
+ * imports) so it is unit-testable and safe in any bundle. A FOREIGN-origin island's props parse
5
+ * with wire revivers OFF: reviving a wired ref would construct a class instance from THIS
6
+ * build's codec and hand it to ANOTHER build's svelte — the exact live-value crossing the
7
+ * boundary laws forbid. A ref in a foreign sidecar fails HERE, loudly, at the boundary.
8
+ */
9
+ function foreign_region_prop_revivers() {
10
+ return { OgygiaRef: () => {
11
+ throw new Error("[ogygia] a wired class crossed a build boundary: foreign (stitched-fragment) island props must be plain data — wired live objects cannot reunite across two svelte runtimes. Pass the underlying data instead.");
12
+ } };
13
+ }
14
+ export { foreign_region_prop_revivers };
@@ -0,0 +1,10 @@
1
+ /** Feature entry: enable form-field survival across SPA nav (unless the build disabled it). */
2
+ export declare function install(): void;
3
+ /** Snapshot changed island fields in `root` under `pathKey`. Call BEFORE the body is swapped out. */
4
+ export declare function snapshot_forms(root: ParentNode, pathKey: string): void;
5
+ /**
6
+ * Arm restoration for `pathKey` on the freshly-connected page. Restores already-hydrated islands
7
+ * immediately and hooks `ogygia:hydrated` for those still waking. Auto-detaches after a short
8
+ * window (the page's islands have all hydrated by then, or never will).
9
+ */
10
+ export declare function arm_form_restore(pathKey: string): void;
@@ -0,0 +1,107 @@
1
+ import { element_address, resolve_address } from "./interaction.js";
2
+ import { slots } from "./slots.js";
3
+ // src/runtime/form-continuity.ts
4
+ /**
5
+ * CONTINUITY — ambient island form-field survival across SPA navigation.
6
+ *
7
+ * Leaving a page, every island input whose value differs from its SSR default is snapshotted into a
8
+ * tab-session store, keyed by the page's path + a positional address (nth region + child-index path,
9
+ * the same addressing `interaction` uses, because hydration can replace nodes). Returning to that
10
+ * page, each field is restored when its island (re)hydrates, with `input`/`change` fired so `bind:`
11
+ * syncs. Session-scoped: survives navigation and back/forward, dies with the tab, never persisted.
12
+ *
13
+ * Only DIFFS are stored (default → nothing), bounded page count, so this stays cheap.
14
+ */
15
+ /** Feature entry: enable form-field survival across SPA nav (unless the build disabled it). */
16
+ function install() {
17
+ if (!(typeof __OGYGIA_CONTINUITY_FORMS__ !== "undefined" ? __OGYGIA_CONTINUITY_FORMS__ : true)) return;
18
+ slots.forms = {
19
+ enabled: true,
20
+ snapshot: snapshot_forms,
21
+ restore: arm_form_restore
22
+ };
23
+ }
24
+ const VALUE_SELECTOR = "input, textarea, select";
25
+ const MAX_PAGES = 20;
26
+ /** pathKey → the fields a visitor changed on that page (in this tab session). */
27
+ const store = /* @__PURE__ */ new Map();
28
+ const is_checkable = (f) => f.type === "checkbox" || f.type === "radio";
29
+ /** Snapshot changed island fields in `root` under `pathKey`. Call BEFORE the body is swapped out. */
30
+ function snapshot_forms(root, pathKey) {
31
+ const regions = Array.from(root.querySelectorAll("ogygia-region"));
32
+ const recs = [];
33
+ regions.forEach((region, ri) => {
34
+ for (const el of region.querySelectorAll(VALUE_SELECTOR)) {
35
+ const f = el;
36
+ if (f.closest("[data-ogygia-no-keep]")) continue;
37
+ if (!(is_checkable(f) ? f.checked !== f.defaultChecked : f.value !== f.defaultValue)) continue;
38
+ const addr = element_address(region, el);
39
+ if (!addr) continue;
40
+ recs.push({
41
+ region: ri,
42
+ addr,
43
+ tag: el.tagName,
44
+ value: f.value,
45
+ checked: is_checkable(f) ? f.checked : void 0
46
+ });
47
+ }
48
+ });
49
+ if (recs.length) {
50
+ store.delete(pathKey);
51
+ store.set(pathKey, recs);
52
+ while (store.size > MAX_PAGES) store.delete(store.keys().next().value);
53
+ } else store.delete(pathKey);
54
+ }
55
+ function apply_region(region, ri, recs) {
56
+ for (const r of recs) {
57
+ if (r.region !== ri) continue;
58
+ const el = resolve_address(region, r.addr);
59
+ if (!el || el.tagName !== r.tag) continue;
60
+ const f = el;
61
+ let changed = false;
62
+ if (r.checked !== void 0) {
63
+ if (f.checked !== r.checked) {
64
+ f.checked = r.checked;
65
+ changed = true;
66
+ }
67
+ } else if (f.value !== r.value) {
68
+ f.value = r.value;
69
+ changed = true;
70
+ }
71
+ if (changed) {
72
+ f.dispatchEvent(new Event("input", { bubbles: true }));
73
+ f.dispatchEvent(new Event("change", { bubbles: true }));
74
+ }
75
+ }
76
+ }
77
+ /**
78
+ * Arm restoration for `pathKey` on the freshly-connected page. Restores already-hydrated islands
79
+ * immediately and hooks `ogygia:hydrated` for those still waking. Auto-detaches after a short
80
+ * window (the page's islands have all hydrated by then, or never will).
81
+ */
82
+ function arm_form_restore(pathKey) {
83
+ const recs = store.get(pathKey);
84
+ if (!recs) return;
85
+ let regions = Array.from(document.querySelectorAll("ogygia-region"));
86
+ regions.forEach((region, ri) => {
87
+ if (region.hasAttribute("data-hydrated")) apply_region(region, ri, recs);
88
+ });
89
+ const on_hydrated = (e) => {
90
+ const region = e.target;
91
+ if (!(region instanceof Element) || region.localName !== "ogygia-region") return;
92
+ let ri = regions.indexOf(region);
93
+ if (ri < 0) {
94
+ regions = Array.from(document.querySelectorAll("ogygia-region"));
95
+ ri = regions.indexOf(region);
96
+ }
97
+ if (ri >= 0) apply_region(region, ri, recs);
98
+ };
99
+ const on_answer = () => regions = Array.from(document.querySelectorAll("ogygia-region"));
100
+ document.addEventListener("ogygia:hydrated", on_hydrated, true);
101
+ document.addEventListener("ogygia:server", on_answer, true);
102
+ setTimeout(() => {
103
+ document.removeEventListener("ogygia:hydrated", on_hydrated, true);
104
+ document.removeEventListener("ogygia:server", on_answer, true);
105
+ }, 5e3);
106
+ }
107
+ export { arm_form_restore, install, snapshot_forms };
@@ -0,0 +1,36 @@
1
+ /** How the batch that carried `endpoint` timed it, or undefined (it rode no batch). */
2
+ export declare function batch_times(endpoint: string): {
3
+ left: number;
4
+ at: number;
5
+ size: number;
6
+ } | undefined;
7
+ type Parcel = {
8
+ slot: string;
9
+ html: string;
10
+ end: number;
11
+ };
12
+ /**
13
+ * The next whole parcel in `buf` from `from` (server/stream-regions.ts), or `null` when it has not
14
+ * fully arrived yet. A plain parcel ends at the first `</template>` (the server length-frames any
15
+ * answer carrying one of its own); a length-framed one is exactly `data-og-len` characters.
16
+ */
17
+ export declare function read_parcel(buf: string, from: number): Parcel | null;
18
+ /**
19
+ * Stream a batch of region calls into the frame store. Endpoints must share an endpoint path (they
20
+ * do — all are minted against the app's one islands endpoint, `handle({ endpoint })`, read here off
21
+ * the first URL). Frames apply as they land; the promise resolves when
22
+ * the response ends.
23
+ */
24
+ export declare function streamFrames(endpoints: string[], kind?: "page" | "nav"): Promise<void>;
25
+ /**
26
+ * THE PAGE'S HOLES, ONE REQUEST. Holes that start fetching together (the above-the-fold `visible`
27
+ * ones fire in one observer callback; `idle` and media ones in one task) join here
28
+ * and, at the end of that task, go out as ONE batch — reserved in the store first, so each hole's
29
+ * own fetch then JOINS its address instead of starting a request. One request instead of N: one pass
30
+ * through the app's handle chain (its session lookup, its auth) instead of N, and no per-hole slot in
31
+ * the browser's own few-at-a-time gate. A lone hole goes out on its own (a GET, as before); so does
32
+ * any hole the batch does not deliver (release → its fetch runs). Resolves when the batch is on its
33
+ * way, never with its content.
34
+ */
35
+ export declare function join_batch(endpoint: string): Promise<void>;
36
+ export {};
@@ -0,0 +1,225 @@
1
+ import { frameAddress } from "../frame.js";
2
+ import { is_idle, release, reserve, ticket, write } from "./frame-store.js";
3
+ import { emit } from "../events/bus.js";
4
+ import { beacon_hole_batch_missed } from "./beacon.js";
5
+ // src/runtime/frame-nav.ts
6
+ const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== "undefined" ? __OGYGIA_DEVTOOLS__ : false;
7
+ const BEACON = typeof __OGYGIA_BEACON__ !== "undefined" ? __OGYGIA_BEACON__ : true;
8
+ /** this page's batches, numbered (the devtools join a batch's parts and its end to it) */
9
+ let batch_seq = 0;
10
+ /** A batched hole's timing, for the hole's own report of its answer (beacon `holes_answered`): the
11
+ * batch left at `left`, this hole's part landed at `at` (page time), `size` holes rode it. Bounded:
12
+ * the newest 64 endpoints (the measuring browser only). */
13
+ const batched = /* @__PURE__ */ new Map();
14
+ /** How the batch that carried `endpoint` timed it, or undefined (it rode no batch). */
15
+ function batch_times(endpoint) {
16
+ return batched.get(endpoint);
17
+ }
18
+ const STREAM_DONE_SLOT = "__ogygia_done__";
19
+ const OPEN = "<template data-ogygia-slot=\"";
20
+ const LEN = "\" data-og-len=\"";
21
+ const CLOSE = "</template>";
22
+ /**
23
+ * The next whole parcel in `buf` from `from` (server/stream-regions.ts), or `null` when it has not
24
+ * fully arrived yet. A plain parcel ends at the first `</template>` (the server length-frames any
25
+ * answer carrying one of its own); a length-framed one is exactly `data-og-len` characters.
26
+ */
27
+ function read_parcel(buf, from) {
28
+ const open = buf.indexOf(OPEN, from);
29
+ if (open === -1) return null;
30
+ const slot_at = open + 28;
31
+ const quote = buf.indexOf("\"", slot_at);
32
+ if (quote === -1) return null;
33
+ const slot = buf.slice(slot_at, quote);
34
+ if (buf.startsWith("\">", quote)) {
35
+ const close = buf.indexOf(CLOSE, quote + 2);
36
+ if (close === -1) return null;
37
+ return {
38
+ slot,
39
+ html: buf.slice(quote + 2, close),
40
+ end: close + 11
41
+ };
42
+ }
43
+ if (!buf.startsWith(LEN, quote)) return buf.length - quote < 15 ? null : read_parcel(buf, slot_at);
44
+ let i = quote + 15;
45
+ let len = 0;
46
+ for (let c = buf.charCodeAt(i); c >= 48 && c <= 57; c = buf.charCodeAt(++i)) len = len * 10 + (c - 48);
47
+ if (i + 2 > buf.length) return null;
48
+ if (!buf.startsWith("\">", i)) return read_parcel(buf, slot_at);
49
+ const start = i + 2;
50
+ const end = start + len + 11;
51
+ if (end > buf.length) return null;
52
+ return {
53
+ slot,
54
+ html: buf.slice(start, start + len),
55
+ end
56
+ };
57
+ }
58
+ function sigOf(endpoint) {
59
+ const q = endpoint.indexOf("?");
60
+ return q === -1 ? null : new URLSearchParams(endpoint.slice(q + 1)).get("sig");
61
+ }
62
+ /**
63
+ * Stream a batch of region calls into the frame store. Endpoints must share an endpoint path (they
64
+ * do — all are minted against the app's one islands endpoint, `handle({ endpoint })`, read here off
65
+ * the first URL). Frames apply as they land; the promise resolves when
66
+ * the response ends.
67
+ */
68
+ async function streamFrames(endpoints, kind = "nav") {
69
+ if (!endpoints.length) return;
70
+ const first = endpoints[0];
71
+ const q = first.indexOf("?");
72
+ const path = q === -1 ? first : first.slice(0, q);
73
+ const bySig = /* @__PURE__ */ new Map();
74
+ const endpoint_of = DEVTOOLS || BEACON ? /* @__PURE__ */ new Map() : null;
75
+ const reserved = [];
76
+ for (const e of endpoints) {
77
+ const s = sigOf(e);
78
+ if (s) {
79
+ const a = frameAddress(e);
80
+ bySig.set(s, a);
81
+ endpoint_of?.set(s, e);
82
+ reserved.push(a);
83
+ reserve(a);
84
+ }
85
+ }
86
+ const batch = DEVTOOLS ? ++batch_seq : 0;
87
+ if (DEVTOOLS) emit({
88
+ domain: "runtime",
89
+ name: "region.batch.sent",
90
+ batch,
91
+ kind,
92
+ endpoints: endpoints.slice()
93
+ });
94
+ const left = BEACON ? performance.now() : 0;
95
+ let delivered = 0;
96
+ let status = 0;
97
+ let refused;
98
+ let final_url;
99
+ try {
100
+ let res;
101
+ try {
102
+ res = await fetch(path, {
103
+ method: "POST",
104
+ credentials: "same-origin",
105
+ headers: { "content-type": "application/json" },
106
+ body: JSON.stringify(endpoints)
107
+ });
108
+ } catch {
109
+ return;
110
+ }
111
+ status = res.status;
112
+ if ((DEVTOOLS || BEACON) && res.redirected) {
113
+ refused = "redirected";
114
+ final_url = res.url;
115
+ }
116
+ if (!res.ok || !res.body) return;
117
+ const reader = res.body.getReader();
118
+ const decoder = new TextDecoder();
119
+ let buffer = "";
120
+ let parcels = false;
121
+ for (;;) {
122
+ const { done, value } = await reader.read();
123
+ if (done) break;
124
+ buffer += decoder.decode(value, { stream: true });
125
+ let consumed = 0;
126
+ for (let p = read_parcel(buffer, 0); p; p = read_parcel(buffer, consumed)) {
127
+ consumed = p.end;
128
+ parcels = true;
129
+ if (p.slot === STREAM_DONE_SLOT) return;
130
+ const a = bySig.get(p.slot);
131
+ if (a) {
132
+ if (BEACON) {
133
+ const ep = endpoint_of.get(p.slot);
134
+ batched.delete(ep);
135
+ batched.set(ep, {
136
+ left,
137
+ at: performance.now(),
138
+ size: reserved.length
139
+ });
140
+ if (batched.size > 64) batched.delete(batched.keys().next().value);
141
+ }
142
+ write({
143
+ a,
144
+ v: ticket(a),
145
+ html: p.html
146
+ });
147
+ delivered++;
148
+ if (DEVTOOLS) emit({
149
+ domain: "runtime",
150
+ name: "region.batch.part",
151
+ batch,
152
+ endpoint: endpoint_of.get(p.slot)
153
+ });
154
+ }
155
+ }
156
+ if (consumed) buffer = buffer.slice(consumed);
157
+ }
158
+ if ((DEVTOOLS || BEACON) && !parcels && !refused) {
159
+ refused = "document";
160
+ final_url = res.url;
161
+ }
162
+ } finally {
163
+ for (const a of reserved) release(a);
164
+ if (BEACON && delivered < reserved.length) beacon_hole_batch_missed({
165
+ sent: reserved.length,
166
+ delivered,
167
+ status,
168
+ ...refused ? {
169
+ refused,
170
+ ...final_url ? { final_url } : {}
171
+ } : {},
172
+ endpoints
173
+ });
174
+ if (DEVTOOLS) emit({
175
+ domain: "runtime",
176
+ name: "region.batch.done",
177
+ batch,
178
+ sent: reserved.length,
179
+ delivered,
180
+ status,
181
+ ...refused ? {
182
+ refused,
183
+ ...final_url ? { final_url } : {}
184
+ } : {}
185
+ });
186
+ }
187
+ }
188
+ /** The server renders at most this many calls per batch (hooks.ts `render_batch`). */
189
+ const MAX_BATCH = 32;
190
+ let queued = null;
191
+ let flushed = Promise.resolve();
192
+ /**
193
+ * THE PAGE'S HOLES, ONE REQUEST. Holes that start fetching together (the above-the-fold `visible`
194
+ * ones fire in one observer callback; `idle` and media ones in one task) join here
195
+ * and, at the end of that task, go out as ONE batch — reserved in the store first, so each hole's
196
+ * own fetch then JOINS its address instead of starting a request. One request instead of N: one pass
197
+ * through the app's handle chain (its session lookup, its auth) instead of N, and no per-hole slot in
198
+ * the browser's own few-at-a-time gate. A lone hole goes out on its own (a GET, as before); so does
199
+ * any hole the batch does not deliver (release → its fetch runs). Resolves when the batch is on its
200
+ * way, never with its content.
201
+ */
202
+ function join_batch(endpoint) {
203
+ if (!queued) {
204
+ queued = [];
205
+ flushed = new Promise((resolve) => queueMicrotask(() => {
206
+ const list = queued;
207
+ queued = null;
208
+ const fresh = [];
209
+ const seen = /* @__PURE__ */ new Set();
210
+ const hinted = /* @__PURE__ */ new Set();
211
+ for (const l of document.querySelectorAll("link[rel=\"preload\"][as=\"fetch\"]")) if (l.href) hinted.add(l.href);
212
+ for (const e of list) {
213
+ const a = frameAddress(e);
214
+ if (seen.has(a) || hinted.size && hinted.has(new URL(e, document.baseURI).href) || !is_idle(a)) continue;
215
+ seen.add(a);
216
+ fresh.push(e);
217
+ }
218
+ if (fresh.length >= 2) for (let i = 0; i < fresh.length; i += MAX_BATCH) streamFrames(fresh.slice(i, i + MAX_BATCH), "page");
219
+ resolve();
220
+ }));
221
+ }
222
+ queued.push(endpoint);
223
+ return flushed;
224
+ }
225
+ export { batch_times, join_batch, read_parcel, streamFrames };