@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,368 @@
1
+ import { escape_amp_quot } from "../escape.js";
2
+ import { is_space as is_space$1 } from "./html-scan.js";
3
+ // src/server/split-regions.ts
4
+ /**
5
+ * REGIONS in the SSR HTML, for an app that runs a THIRD-PARTY SSR/hydration pass over the final
6
+ * document (a web-component server-render, a translation proxy, an A/B injector). The one
7
+ * integration rule such a pass must honour: **never reshape the bytes inside an island.** An island
8
+ * hydrates against its exact server markup; a reshaped node sequence makes the hydration walk
9
+ * mismatch, so the island discards its server DOM and re-renders client-side, and the first
10
+ * interaction lands on the discarded tree (the classic tell: a dropdown that needs two clicks).
11
+ * Lakes and holes are NOT hydrated — their bytes are safe to touch.
12
+ *
13
+ * Apps that hand-rolled this with a regex balance-count (`<ogygia-region>` opens vs closes) get
14
+ * fooled by tag-like TEXT: a literal `<ogygia-region>` inside a CSS comment in an inlined `<style>`,
15
+ * or an HTML comment, or an attribute value, throws the count off, the island skip silently stops
16
+ * applying, and the pass reshapes island bytes — in dev but not in prod (where the comment minifies
17
+ * away), so it passes every local test and breaks on the deploy.
18
+ *
19
+ * `scanRegions(html)` is a generator, not a regex: it tracks REAL element nesting of `<ogygia-region>`
20
+ * and skips `<!-- … -->`, the raw-text bodies of `<script>` / `<style>`, and quoted attribute
21
+ * values, so tag-like text in any of those is never counted. Each region is yielded once, a region
22
+ * AFTER the regions nested inside it (post-order, by closing-tag position). An island's own span is
23
+ * yielded — including an island nested inside a lake or hole, the header-lake login island being
24
+ * exactly that case, so the caller can protect it — but the regions STRICTLY INSIDE an island are
25
+ * not, because a reshape anywhere in an island's subtree breaks the same hydration walk.
26
+ *
27
+ * The pattern this is built for, robust at any nesting depth: protect every island's bytes, edit
28
+ * everything else.
29
+ *
30
+ * ```ts
31
+ * import { scanRegions } from 'ogygia/server';
32
+ * const protect = [];
33
+ * for (const r of scanRegions(html)) {
34
+ * if (r.kind === 'island') protect.push([r.start, r.end]); // its bytes stay verbatim
35
+ * }
36
+ * // reshape `html` everywhere EXCEPT the protected ranges …
37
+ * ```
38
+ *
39
+ * If you edit by offset instead, splice in reverse `start` order so earlier offsets stay valid:
40
+ * `[...scanRegions(html)].sort((a, b) => b.start - a.start)`.
41
+ *
42
+ * Malformed input never throws and never loses a region: an unterminated `<ogygia-region>` (no
43
+ * matching close) is still yielded, with `innerStart === innerEnd` and `end` at the `>` of its
44
+ * opening tag — i.e. its span is just the opening tag. A caller reshaping `[innerStart, innerEnd)`
45
+ * of such a region edits nothing, which is the safe outcome.
46
+ *
47
+ * For the FULL round-trip — lift the regions out, run the foreign renderer over what is left, splice
48
+ * them back — use {@link liftRegions} / {@link restoreRegions} (below). Restore transplants the marks
49
+ * a scoped renderer stamps on the placeholder onto the region, unions `class`, and touches only
50
+ * attributes, never light DOM. All three are also exported, Kit-free, from `ogygia/markup`, for the
51
+ * non-SvelteKit half of a monorepo where these SSR passes usually live.
52
+ */
53
+ const REGION_TAG = "ogygia-region";
54
+ const RAW_TEXT_TAGS = ["script", "style"];
55
+ /** ASCII whitespace that can follow a tag name. */
56
+ function is_space(code) {
57
+ return code === 32 || code === 9 || code === 10 || code === 12 || code === 13;
58
+ }
59
+ /** ASCII letter — what a real tag name begins with (`<a…` / `</a…`). A `<` followed by anything
60
+ * else (space, digit, `=`) is text, not a tag, per the HTML tokenizer. */
61
+ function is_ascii_alpha(code) {
62
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122;
63
+ }
64
+ /** True when `tag`'s NAME sits at `name` as a real element name (followed by whitespace, `>`, or
65
+ * `/`), case-insensitive — so `ogygia-region-foo` or `styles` don't match a shorter tag. Callers
66
+ * pass the index of the tag name: for `<tag` that is `i + 1`, for `</tag` it is `i + 2`. */
67
+ function name_at(html, name, tag) {
68
+ for (let k = 0; k < tag.length; k++) {
69
+ const c = html.charCodeAt(name + k);
70
+ if ((c >= 65 && c <= 90 ? c + 32 : c) !== tag.charCodeAt(k)) return false;
71
+ }
72
+ const after = html.charCodeAt(name + tag.length);
73
+ return Number.isNaN(after) || is_space(after) || after === 62 || after === 47;
74
+ }
75
+ /** True when an OPENING tag `<tag…` starts at `i`. */
76
+ function open_tag_at(html, i, tag) {
77
+ return html.charCodeAt(i) === 60 && name_at(html, i + 1, tag);
78
+ }
79
+ /** True when a CLOSING tag `</tag…` starts at `i`. */
80
+ function close_tag_at(html, i, tag) {
81
+ return html.charCodeAt(i) === 60 && html.charCodeAt(i + 1) === 47 && name_at(html, i + 2, tag);
82
+ }
83
+ /** Index of the `>` that ends the tag whose `<` is at `open`, respecting `"…"` / `'…'` attribute
84
+ * values (a `>` inside a value does not end the tag). `html.length` if the tag is unterminated. */
85
+ function tag_end(html, open) {
86
+ let quote = 0;
87
+ for (let i = open + 1; i < html.length; i++) {
88
+ const c = html.charCodeAt(i);
89
+ if (quote) {
90
+ if (c === quote) quote = 0;
91
+ } else if (c === 34 || c === 39) quote = c;
92
+ else if (c === 62) return i;
93
+ }
94
+ return html.length;
95
+ }
96
+ /** Index of the `<` of the closing `</style>` / `<\/script>` at or after `from`, or -1. Allocation
97
+ * free: a native `indexOf('<')` scan (SIMD-fast in V8) plus a bounded tag check — never a substring
98
+ * copy or a per-call RegExp (this runs once per raw-text element on every SSR response, some of
99
+ * them megabytes). */
100
+ function raw_text_end(html, from, tag) {
101
+ let at = from;
102
+ for (;;) {
103
+ const lt = html.indexOf("<", at);
104
+ if (lt === -1) return -1;
105
+ if (close_tag_at(html, lt, tag)) return lt;
106
+ at = lt + 1;
107
+ }
108
+ }
109
+ /** A char that ends an attribute NAME: `\s`, `/`, `>`, `=`. */
110
+ function name_stop(c) {
111
+ return c === 47 || c === 62 || c === 61 || is_space$1(c);
112
+ }
113
+ /** A char that ends an UNQUOTED value: `\s`, `/`, `>`. */
114
+ function value_stop(c) {
115
+ return c === 47 || c === 62 || is_space$1(c);
116
+ }
117
+ /**
118
+ * Parse a tag's attribute run (everything between the tag name and its `>`) into a lower-cased map
119
+ * with quotes stripped. Shared by the region opener and the `<og-lift>` placeholder on restore.
120
+ *
121
+ * Hand-written (measured faster, no match arrays) with the rules the pattern
122
+ * `([^\s/>=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s/>]+))?` had, quirks included: a value is a closed
123
+ * `"…"`, else a closed `'…'`, else an unquoted run (which may start with an unclosed quote — then
124
+ * the first and last characters are stripped, as before); `=` with no value leaves the name valueless.
125
+ * @internal Exported for test/regex-replacements.test.ts.
126
+ */
127
+ function parse_attr_string(inner) {
128
+ const attrs = {};
129
+ const n = inner.length;
130
+ let i = 0;
131
+ while (i < n) {
132
+ if (name_stop(inner.charCodeAt(i))) {
133
+ i++;
134
+ continue;
135
+ }
136
+ const name_start = i;
137
+ while (i < n && !name_stop(inner.charCodeAt(i))) i++;
138
+ const name = inner.slice(name_start, i);
139
+ let value = "";
140
+ let j = i;
141
+ while (j < n && is_space$1(inner.charCodeAt(j))) j++;
142
+ if (inner.charCodeAt(j) === 61) {
143
+ j++;
144
+ while (j < n && is_space$1(inner.charCodeAt(j))) j++;
145
+ const q = inner.charCodeAt(j);
146
+ let end = -1;
147
+ if (q === 34 || q === 39) {
148
+ const close = inner.indexOf(q === 34 ? "\"" : "'", j + 1);
149
+ if (close !== -1) end = close + 1;
150
+ }
151
+ if (end === -1) {
152
+ let k = j;
153
+ while (k < n && !value_stop(inner.charCodeAt(k))) k++;
154
+ if (k > j) end = k;
155
+ }
156
+ if (end !== -1) {
157
+ value = inner.slice(j, end);
158
+ i = end;
159
+ const f = value.charCodeAt(0);
160
+ if (f === 34 || f === 39) value = value.slice(1, -1);
161
+ }
162
+ }
163
+ attrs[name.toLowerCase()] = value;
164
+ }
165
+ return attrs;
166
+ }
167
+ /** Parse the attributes out of an opening tag whose `<` is at `open` and `>` at `gt`. */
168
+ function parse_attrs(html, open, gt) {
169
+ return parse_attr_string(html.slice(open + 1 + 13, gt));
170
+ }
171
+ /** The classification the whole framework agrees on (runtime region-attrs, the compiled tag): a
172
+ * region with an `endpoint` is a deferred HOLE; `wake="none"` is a frozen LAKE; anything else that
173
+ * wakes is an ISLAND. Matches `region_hydrate_schedule` / `is_deferred` / `is_frozen`. */
174
+ function classify(attrs) {
175
+ if ("endpoint" in attrs) return "hole";
176
+ if (attrs.wake === "none") return "lake";
177
+ return "island";
178
+ }
179
+ /**
180
+ * Yield every `<ogygia-region>` in `html`, in document order, an island's subtree treated as atomic
181
+ * (its nested regions are not yielded). One linear pass, O(html length); allocates no copy of the
182
+ * document. See the module doc for why this exists and how to use it.
183
+ */
184
+ function* scanRegions(html) {
185
+ const stack = [];
186
+ const n = html.length;
187
+ let i = 0;
188
+ while (i < n) {
189
+ const lt = html.indexOf("<", i);
190
+ if (lt === -1) break;
191
+ i = lt;
192
+ if (html.startsWith("<!--", i)) {
193
+ const close = html.indexOf("-->", i + 4);
194
+ i = close === -1 ? n : close + 3;
195
+ continue;
196
+ }
197
+ let raw = null;
198
+ for (const t of RAW_TEXT_TAGS) if (open_tag_at(html, i, t)) raw = t;
199
+ if (raw) {
200
+ const gt = tag_end(html, i);
201
+ if (html.charCodeAt(gt - 1) === 47) {
202
+ i = gt + 1;
203
+ continue;
204
+ }
205
+ const close = raw_text_end(html, gt + 1, raw);
206
+ i = close === -1 ? n : tag_end(html, close) + 1;
207
+ continue;
208
+ }
209
+ if (close_tag_at(html, i, REGION_TAG)) {
210
+ const gt = tag_end(html, i);
211
+ const frame = stack.pop();
212
+ if (frame?.emit) {
213
+ frame.node.innerEnd = i;
214
+ frame.node.end = gt + 1;
215
+ yield frame.node;
216
+ }
217
+ i = gt + 1;
218
+ continue;
219
+ }
220
+ if (open_tag_at(html, i, REGION_TAG)) {
221
+ const gt = tag_end(html, i);
222
+ const parent_sealed = stack.length > 0 && stack[stack.length - 1].sealed;
223
+ const attrs = parse_attrs(html, i, gt);
224
+ const kind = classify(attrs);
225
+ const self_closing = html.charCodeAt(gt - 1) === 47;
226
+ const emit = !parent_sealed;
227
+ const sealed = parent_sealed || kind === "island";
228
+ const node = {
229
+ kind,
230
+ start: i,
231
+ end: gt + 1,
232
+ innerStart: gt + 1,
233
+ innerEnd: gt + 1,
234
+ attrs,
235
+ depth: stack.length
236
+ };
237
+ if (self_closing) {
238
+ if (emit) yield node;
239
+ } else stack.push({
240
+ node,
241
+ emit,
242
+ sealed
243
+ });
244
+ i = gt + 1;
245
+ continue;
246
+ }
247
+ const c1 = html.charCodeAt(i + 1);
248
+ i = is_ascii_alpha(c1) || c1 === 47 && is_ascii_alpha(html.charCodeAt(i + 2)) ? tag_end(html, i) + 1 : i + 1;
249
+ }
250
+ while (stack.length) {
251
+ const frame = stack.pop();
252
+ if (frame.emit) yield frame.node;
253
+ }
254
+ }
255
+ const LIFT_TAG = "og-lift";
256
+ const LIFT_PLACEHOLDER_RE = /<og-lift\b([^>]*)>(?:<\/og-lift>)?/gi;
257
+ const WS_SPLIT_RE = /\s+/;
258
+ const CLASS_ATTR_RE = /(\sclass\s*=\s*)("[^"]*"|'[^']*'|[^\s/>]+)/i;
259
+ const TRAILING_SELF_CLOSE_RE = /\s*\/\s*$/;
260
+ const TRAILING_WS_RE = /\s+$/;
261
+ function make_region(kind, attrs, openTag, innerHtml, closeTag, index) {
262
+ return {
263
+ kind,
264
+ attrs,
265
+ openTag,
266
+ innerHtml,
267
+ closeTag,
268
+ outerHtml: openTag + innerHtml + closeTag,
269
+ index,
270
+ withInner(next) {
271
+ return make_region(kind, attrs, openTag, next, closeTag, index);
272
+ }
273
+ };
274
+ }
275
+ /**
276
+ * Lift every TOP-LEVEL `<ogygia-region>` out of `html`, leaving an `<og-lift>` placeholder where each
277
+ * was. Hand `shell` to the foreign renderer (and, to render a lake / hole, its `innerHtml` — recurse
278
+ * with `liftRegions` there so islands nested inside it stay protected), then {@link restoreRegions}.
279
+ * Islands come back verbatim. A region deeper than top level rides inside its parent's `outerHtml`.
280
+ */
281
+ function liftRegions(html) {
282
+ const regions = [];
283
+ if (!html.includes(`<${REGION_TAG}`)) return {
284
+ shell: html,
285
+ regions
286
+ };
287
+ let shell = "";
288
+ let cursor = 0;
289
+ for (const span of scanRegions(html)) {
290
+ if (span.depth !== 0) continue;
291
+ const openTag = html.slice(span.start, span.innerStart);
292
+ const innerHtml = html.slice(span.innerStart, span.innerEnd);
293
+ const closeTag = html.slice(span.innerEnd, span.end);
294
+ const index = regions.length;
295
+ shell += html.slice(cursor, span.start) + `<${LIFT_TAG} data-i="${index}"></${LIFT_TAG}>`;
296
+ regions.push(make_region(span.kind, span.attrs, openTag, innerHtml, closeTag, index));
297
+ cursor = span.end;
298
+ }
299
+ if (regions.length === 0) return {
300
+ shell: html,
301
+ regions
302
+ };
303
+ return {
304
+ shell: shell + html.slice(cursor),
305
+ regions
306
+ };
307
+ }
308
+ /** Escape a value for re-emission inside a double-quoted attribute. */
309
+ function escape_attr(value) {
310
+ return escape_amp_quot(value);
311
+ }
312
+ /** Merge the renderer's `class` marks into the region's opening-tag head, unioning tokens with any
313
+ * class the region already carries. Returns the head unchanged when nothing new is added. */
314
+ function merge_class(head, existing, added) {
315
+ const added_tokens = added.split(WS_SPLIT_RE).filter(Boolean);
316
+ if (added_tokens.length === 0) return [head, false];
317
+ if (existing === void 0) return [`${head} class="${escape_attr(added)}"`, true];
318
+ const have = new Set(existing.split(WS_SPLIT_RE).filter(Boolean));
319
+ let changed = false;
320
+ for (const token of added_tokens) if (!have.has(token)) {
321
+ have.add(token);
322
+ changed = true;
323
+ }
324
+ if (!changed) return [head, false];
325
+ const merged = [...have].join(" ");
326
+ return [head.replace(CLASS_ATTR_RE, (_m, prefix) => `${prefix}"${escape_attr(merged)}"`), true];
327
+ }
328
+ /** Transplant a placeholder's renderer-stamped marks onto the region's opening tag. Only marks the
329
+ * region does not already own are added; `class` is unioned; the region's light DOM is untouched. */
330
+ function merge_marks(region, marks) {
331
+ const gt = region.openTag.lastIndexOf(">");
332
+ if (gt === -1) return region.outerHtml;
333
+ let head = region.openTag.slice(0, gt).replace(TRAILING_SELF_CLOSE_RE, "").replace(TRAILING_WS_RE, "");
334
+ const additions = [];
335
+ let changed = false;
336
+ for (const name in marks) {
337
+ if (name === "data-i") continue;
338
+ if (name === "class") {
339
+ const [next, did] = merge_class(head, region.attrs.class, marks.class);
340
+ head = next;
341
+ changed ||= did;
342
+ continue;
343
+ }
344
+ if (name in region.attrs) continue;
345
+ additions.push(`${name}="${escape_attr(marks[name])}"`);
346
+ changed = true;
347
+ }
348
+ if (!changed) return region.outerHtml;
349
+ return (additions.length ? `${head} ${additions.join(" ")}>` : `${head}>`) + region.innerHtml + region.closeTag;
350
+ }
351
+ /**
352
+ * Splice lifted regions back over their `<og-lift>` placeholders, transplanting any attributes the
353
+ * foreign renderer stamped on a placeholder (scoped slot marks — a `sc-*` class, `c-id`, `s-sn`)
354
+ * onto the region's opening tag. The placeholder is matched loosely because the renderer annotates
355
+ * it; only opening-tag attributes are merged, never the region's light DOM. An unknown placeholder
356
+ * is left in place rather than dropped.
357
+ */
358
+ function restoreRegions(shell, regions) {
359
+ if (regions.length === 0) return shell;
360
+ const by_index = new Map(regions.map((r) => [r.index, r]));
361
+ LIFT_PLACEHOLDER_RE.lastIndex = 0;
362
+ return shell.replace(LIFT_PLACEHOLDER_RE, (whole, raw) => {
363
+ const marks = parse_attr_string(raw);
364
+ const region = by_index.get(Number(marks["data-i"]));
365
+ return region === void 0 ? whole : merge_marks(region, marks);
366
+ });
367
+ }
368
+ export { liftRegions, parse_attr_string, restoreRegions, scanRegions };
@@ -0,0 +1,5 @@
1
+ /** Build a parcel `<template data-ogygia-slot="…">…rendered html…</template>` (length-framed when
2
+ * the html carries a `</template` of its own). */
3
+ export declare function build_parcel(slot: string, html: string): string;
4
+ /** The done-sentinel parcel (empty template) the client watches to end the batch. */
5
+ export declare function done_parcel(): string;
@@ -0,0 +1,36 @@
1
+ // src/server/stream-regions.ts
2
+ /**
3
+ * Region parcels for the batch endpoint (single-flight navigation, a page's first-load holes, OOO).
4
+ * Each rendered region call is boxed as a `<template data-ogygia-slot>` parcel keyed by its capability
5
+ * signature; the client frame stream reads them out of order and drops each into the matching region.
6
+ * A done-sentinel ends the batch.
7
+ *
8
+ * The client reads a parcel as TEXT (runtime/frame-nav.ts), never as DOM. A plain parcel ends at the
9
+ * first `</template>`; an answer that itself carries `</template` (a web component's declarative
10
+ * shadow root) is LENGTH-FRAMED instead — `data-og-len` is its UTF-16 length, the unit the client's
11
+ * decoded string counts in — so its content can never close the box or forge a parcel for another
12
+ * slot, and it no longer falls back to a second request.
13
+ *
14
+ * Pure (no I/O, no Kit) so it stays unit-testable.
15
+ */
16
+ /** Sentinel slot appended once a batch finishes, so waiting regions know it is complete. */
17
+ const STREAM_DONE_SLOT = "__ogygia_done__";
18
+ /** Does `html` carry a `</template` (any case) — one that would close a plain parcel early? */
19
+ function has_template_close(html) {
20
+ for (let i = html.indexOf("</"); i !== -1; i = html.indexOf("</", i + 2)) {
21
+ if (html.length - i < 10) return false;
22
+ if (html.slice(i + 2, i + 10).toLowerCase() === "template") return true;
23
+ }
24
+ return false;
25
+ }
26
+ /** Build a parcel `<template data-ogygia-slot="…">…rendered html…</template>` (length-framed when
27
+ * the html carries a `</template` of its own). */
28
+ function build_parcel(slot, html) {
29
+ if (has_template_close(html)) return `<template data-ogygia-slot="${slot}" data-og-len="${html.length}">${html}</template>`;
30
+ return `<template data-ogygia-slot="${slot}">${html}</template>`;
31
+ }
32
+ /** The done-sentinel parcel (empty template) the client watches to end the batch. */
33
+ function done_parcel() {
34
+ return `<template data-ogygia-slot="${STREAM_DONE_SLOT}"></template>`;
35
+ }
36
+ export { build_parcel, done_parcel };
@@ -0,0 +1,7 @@
1
+ export declare class SharedState<T extends object> {
2
+ #private;
3
+ constructor(name: string, initial: T);
4
+ /** The value — reactive wherever Svelte is watching, plain everywhere else. */
5
+ get current(): T;
6
+ set current(v: T);
7
+ }
@@ -0,0 +1,152 @@
1
+ import { parse, stringify } from "devalue";
2
+ import { createSubscriber } from "svelte/reactivity";
3
+ // src/shared-state.ts
4
+ /**
5
+ * EXPERIMENTAL — cross-fragment shared state: the Svelte-native cross-BUILD primitive.
6
+ *
7
+ * `new SharedState(name, initial)` in a tiny CONTRACT package every team depends on; each build
8
+ * compiles its own copy of the class, but all copies meet at ONE page-global store keyed by
9
+ * `Symbol.for` (same key in every realm/build). Reads are `.current` (the Svelte convention —
10
+ * MediaQuery/Spring), reactive via `createSubscriber`; nested writes (`cart.current.items.push`)
11
+ * publish through a mutation proxy. No subscriptions, no callbacks, no server involved: one
12
+ * page, one value, every island of every team re-renders on write.
13
+ *
14
+ * Cross-language: any server can SEED the opening value by printing
15
+ * `<script type="application/json" data-og-shared="<name>">{…}<\/script>`, and any vanilla JS on
16
+ * the page can join via `globalThis.ogygia.shared(name)` → { get, set, subscribe }.
17
+ */
18
+ const STORE_KEY = Symbol.for("ogygia.shared.v1");
19
+ function page_store() {
20
+ const g = globalThis;
21
+ if (!g[STORE_KEY]) g[STORE_KEY] = {
22
+ map: /* @__PURE__ */ new Map(),
23
+ target: new EventTarget()
24
+ };
25
+ return g[STORE_KEY];
26
+ }
27
+ /** Read a server-printed seed: `<script type="application/json" data-og-shared="<name>">`. */
28
+ function read_seed(name) {
29
+ if (typeof document === "undefined") return void 0;
30
+ const el = document.querySelector(`script[type="application/json"][data-og-shared=${JSON.stringify(name)}]`);
31
+ if (!el?.textContent) return void 0;
32
+ try {
33
+ return JSON.parse(el.textContent);
34
+ } catch {
35
+ return;
36
+ }
37
+ }
38
+ /** THE MEMBRANE: only inert data enters the page store — the two builds' svelte runtimes must
39
+ * never see each other's live values. A devalue ROUND-TRIP is the membrane on purpose:
40
+ * devalue-representable is ogygia's definition of "can cross a boundary" (props sidecars, page
41
+ * seeds, transport — one vocabulary), so a value that passes here is also seedable/serializable
42
+ * everywhere else. A reactive proxy degrades to a plain snapshot (safe — and what you meant);
43
+ * functions, class instances, and DOM nodes THROW here, loudly, at the write site — with
44
+ * devalue's path detail — never weirdly at a distance inside another team's render. */
45
+ function snapshot(name, value) {
46
+ try {
47
+ return parse(stringify(value));
48
+ } catch (e) {
49
+ throw new Error(`[ogygia] SharedState '${name}': values must be plain data (devalue-serializable — JSON, Date, Map, Set, BigInt, RegExp). Functions, class instances, and DOM nodes do not cross build boundaries — share facts, not live objects. (${e instanceof Error ? e.message : e})`);
50
+ }
51
+ }
52
+ var SharedState = class {
53
+ #name;
54
+ #subscribe;
55
+ #publish_queued = false;
56
+ constructor(name, initial) {
57
+ this.#name = name;
58
+ const store = page_store();
59
+ if (!store.map.has(name)) {
60
+ const seed = read_seed(name);
61
+ store.map.set(name, {
62
+ value: seed !== void 0 ? seed : snapshot(name, initial),
63
+ version: 0
64
+ });
65
+ }
66
+ this.#subscribe = createSubscriber((update) => {
67
+ const on = (e) => {
68
+ if (e.detail === name) update();
69
+ };
70
+ store.target.addEventListener("og:shared", on);
71
+ return () => store.target.removeEventListener("og:shared", on);
72
+ });
73
+ }
74
+ #publish() {
75
+ if (this.#publish_queued) return;
76
+ this.#publish_queued = true;
77
+ queueMicrotask(() => {
78
+ this.#publish_queued = false;
79
+ const store = page_store();
80
+ const entry = store.map.get(this.#name);
81
+ entry.version++;
82
+ store.target.dispatchEvent(new CustomEvent("og:shared", { detail: this.#name }));
83
+ });
84
+ }
85
+ /** Deep mutation proxy: any nested write publishes. Functions pass through raw (their `this`
86
+ * is the proxy, so array methods still trip the set traps). */
87
+ #proxy(value) {
88
+ if (value === null || typeof value !== "object") return value;
89
+ const publish = () => this.#publish();
90
+ const wrap = this.#proxy.bind(this);
91
+ if (value instanceof Map || value instanceof Set || value instanceof Date || value instanceof RegExp) return new Proxy(value, { get: (t, p) => {
92
+ const v = Reflect.get(t, p);
93
+ if (typeof v !== "function") return v;
94
+ return (...args) => {
95
+ const r = v.apply(t, args);
96
+ publish();
97
+ return r;
98
+ };
99
+ } });
100
+ return new Proxy(value, {
101
+ get: (t, p) => wrap(Reflect.get(t, p)),
102
+ set: (t, p, v) => {
103
+ Reflect.set(t, p, v);
104
+ publish();
105
+ return true;
106
+ },
107
+ deleteProperty: (t, p) => {
108
+ Reflect.deleteProperty(t, p);
109
+ publish();
110
+ return true;
111
+ }
112
+ });
113
+ }
114
+ /** The value — reactive wherever Svelte is watching, plain everywhere else. */
115
+ get current() {
116
+ this.#subscribe();
117
+ return this.#proxy(page_store().map.get(this.#name).value);
118
+ }
119
+ set current(v) {
120
+ page_store().map.get(this.#name).value = snapshot(this.#name, v);
121
+ this.#publish();
122
+ }
123
+ };
124
+ function vanilla(name) {
125
+ const store = page_store();
126
+ if (!store.map.has(name)) store.map.set(name, {
127
+ value: read_seed(name),
128
+ version: 0
129
+ });
130
+ return {
131
+ get: () => store.map.get(name).value,
132
+ set: (v) => {
133
+ const entry = store.map.get(name);
134
+ entry.value = snapshot(name, v);
135
+ entry.version++;
136
+ store.target.dispatchEvent(new CustomEvent("og:shared", { detail: name }));
137
+ },
138
+ subscribe: (fn) => {
139
+ const on = (e) => {
140
+ if (e.detail === name) fn(store.map.get(name).value);
141
+ };
142
+ store.target.addEventListener("og:shared", on);
143
+ return () => store.target.removeEventListener("og:shared", on);
144
+ }
145
+ };
146
+ }
147
+ if (typeof globalThis !== "undefined") {
148
+ const g = globalThis;
149
+ g.ogygia ??= {};
150
+ g.ogygia.shared ??= vanilla;
151
+ }
152
+ export { SharedState };
@@ -0,0 +1,4 @@
1
+ export declare const browser: boolean;
2
+ export declare const building: boolean;
3
+ export declare const dev: boolean;
4
+ export declare const version = "ogygia";
@@ -0,0 +1,6 @@
1
+ // src/shims/app-environment.ts
2
+ const browser = true;
3
+ const building = false;
4
+ const dev = false;
5
+ const version = "ogygia";
6
+ export { browser, building, dev, version };
@@ -0,0 +1,33 @@
1
+ import { AfterNavigateCallback, BeforeNavigateCallback } from "../runtime/router.js";
2
+ export declare function goto(url: string | URL, opts?: {
3
+ replaceState?: boolean;
4
+ external?: boolean;
5
+ }): Promise<void>;
6
+ export declare function invalidate(resource?: unknown): Promise<void>;
7
+ export declare function invalidateAll(): Promise<void>;
8
+ /**
9
+ * Kit's `refreshAll` (Kit 2.7x, Kit 3), which Kit 3's remote `form()` also calls after a successful
10
+ * submit (through the remote client stub). Island queries live in ogygia's remote cache, not Kit's,
11
+ * so they refresh here on every document; the page's data then refreshes through whoever owns the
12
+ * document. With neither runtime, the queries alone refresh: never a reload.
13
+ */
14
+ export declare function refreshAll(): Promise<void>;
15
+ export declare function preloadData(url: string | URL): Promise<unknown>;
16
+ export declare function preloadCode(url?: string): Promise<void>;
17
+ export declare function pushState(url: string | URL, state: unknown): void;
18
+ export declare function replaceState(url: string | URL, state: unknown): void;
19
+ export declare function disableScrollHandling(): void;
20
+ export declare function beforeNavigate(fn: BeforeNavigateCallback): () => void;
21
+ export declare function afterNavigate(fn: AfterNavigateCallback): () => void;
22
+ export declare function onNavigate(fn: (navigation: unknown) => unknown): () => void;
23
+ type SnapshotOptions = {
24
+ id?: string;
25
+ capture: () => unknown;
26
+ restore: (value: never) => void;
27
+ reset?: () => void;
28
+ };
29
+ export declare function snapshot(options: SnapshotOptions): void;
30
+ /** `ogygia/app`'s `bust_page_cache`: drop the SPA router's warmed page HTML (after mutations / auth
31
+ * changes). A no-op without the router — there is no page cache. */
32
+ export declare function bust_page_cache(): void;
33
+ export {};