@ogygia/core 0.0.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +180 -0
  49. package/dist/compiler/ctx.js +183 -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,13 @@
1
+ import { fnv1a32 } from "../runtime/hash.js";
2
+ import { escape_amp_quot, escape_text } from "../escape.js";
3
+ import { SizedLru } from "../server/sized-lru.js";
4
+ import { source_tag_of } from "../source.js";
5
+ import { StandardIssue, StandardResult, StandardSchemaV1 } from "./standard-schema.js";
6
+ /**
7
+ * The stable cross-build key for a markup module's own scoped CSS (a `.svx` body with a `<style>`):
8
+ * the path from the first `/src/` segment, POSIX (`/…/proj/src/content/docs/x.svx` →
9
+ * `content/docs/x.svx`). The preprocessor that bakes the key into the module and the build that emits
10
+ * the CSS and writes the handoff compute it identically from the same absolute filename.
11
+ */
12
+ export declare function content_css_key(abs: string): string;
13
+ export { SizedLru, type StandardIssue, type StandardResult, type StandardSchemaV1, content_css_key as contentCssKey, escape_amp_quot as escapeAttr, escape_text as escapeText, fnv1a32, source_tag_of as sourceTag };
@@ -0,0 +1,19 @@
1
+ import { fnv1a32 } from "../runtime/hash.js";
2
+ import { escape_amp_quot, escape_text } from "../escape.js";
3
+ import { SizedLru } from "../server/sized-lru.js";
4
+ import { source_tag_of } from "../source.js";
5
+ // src/plugin/utils.ts
6
+ const BACKSLASHES = /\\/g;
7
+ const LEADING_SLASH = /^\//;
8
+ /**
9
+ * The stable cross-build key for a markup module's own scoped CSS (a `.svx` body with a `<style>`):
10
+ * the path from the first `/src/` segment, POSIX (`/…/proj/src/content/docs/x.svx` →
11
+ * `content/docs/x.svx`). The preprocessor that bakes the key into the module and the build that emits
12
+ * the CSS and writes the handoff compute it identically from the same absolute filename.
13
+ */
14
+ function content_css_key(abs) {
15
+ const p = abs.replace(BACKSLASHES, "/").split("?")[0];
16
+ const i = p.indexOf("/src/");
17
+ return i >= 0 ? p.slice(i + 5) : p.replace(LEADING_SLASH, "");
18
+ }
19
+ export { SizedLru, content_css_key as contentCssKey, content_css_key, escape_amp_quot as escapeAttr, escape_text as escapeText, fnv1a32, source_tag_of as sourceTag };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * THE PORTABLE FORM of a live region snippet — swapped in only where the snippet CROSSES.
3
+ *
4
+ * A `{#snippet}` handed to a component that may carry it into an island is branded at its definition
5
+ * site (region-snippet.ts `og_portable`), but it stays the snippet as written: rendered where it is
6
+ * written it runs in place, in the host's tree — the host's context, its scoped CSS, and any island
7
+ * inside it a plain page island. Only a boundary needs the other shape: the body compiled to its own
8
+ * entry, rendered in isolation on the server and hydrated alone on the client. That shape rides on the
9
+ * snippet as `__ogPortable`, and the ONE thing that knows a value is crossing — the code preparing an
10
+ * island's props (or a server-picked region's) for its render and its wire — swaps it in here, so the
11
+ * server markup and the client's revived snippet are the same shape.
12
+ *
13
+ * Leaf module (no svelte imports): region.ts reaches it on both legs.
14
+ */
15
+ /** Where a branded snippet carries its portable form. */
16
+ export declare const PORTABLE_FORM = "__ogPortable";
17
+ /**
18
+ * `value` with every branded snippet in it (at any depth of plain objects and arrays) replaced by its
19
+ * portable form. Copy-on-write: returns the SAME object when nothing in it is branded, and never
20
+ * mutates the input.
21
+ */
22
+ export declare function with_portable_forms<T>(value: T): T;
@@ -0,0 +1,52 @@
1
+ // src/portable-form.ts
2
+ /**
3
+ * THE PORTABLE FORM of a live region snippet — swapped in only where the snippet CROSSES.
4
+ *
5
+ * A `{#snippet}` handed to a component that may carry it into an island is branded at its definition
6
+ * site (region-snippet.ts `og_portable`), but it stays the snippet as written: rendered where it is
7
+ * written it runs in place, in the host's tree — the host's context, its scoped CSS, and any island
8
+ * inside it a plain page island. Only a boundary needs the other shape: the body compiled to its own
9
+ * entry, rendered in isolation on the server and hydrated alone on the client. That shape rides on the
10
+ * snippet as `__ogPortable`, and the ONE thing that knows a value is crossing — the code preparing an
11
+ * island's props (or a server-picked region's) for its render and its wire — swaps it in here, so the
12
+ * server markup and the client's revived snippet are the same shape.
13
+ *
14
+ * Leaf module (no svelte imports): region.ts reaches it on both legs.
15
+ */
16
+ /** Where a branded snippet carries its portable form. */
17
+ const PORTABLE_FORM = "__ogPortable";
18
+ function is_plain(v) {
19
+ const proto = Object.getPrototypeOf(v);
20
+ return proto === Object.prototype || proto === null;
21
+ }
22
+ /**
23
+ * `value` with every branded snippet in it (at any depth of plain objects and arrays) replaced by its
24
+ * portable form. Copy-on-write: returns the SAME object when nothing in it is branded, and never
25
+ * mutates the input.
26
+ */
27
+ function with_portable_forms(value) {
28
+ return swap(value, /* @__PURE__ */ new WeakSet());
29
+ }
30
+ function swap(v, seen) {
31
+ if (typeof v === "function") return v[PORTABLE_FORM] ?? v;
32
+ if (!v || typeof v !== "object" || seen.has(v)) return v;
33
+ if (Array.isArray(v)) {
34
+ seen.add(v);
35
+ let out = null;
36
+ for (let i = 0; i < v.length; i++) {
37
+ const next = swap(v[i], seen);
38
+ if (next !== v[i]) (out ??= v.slice())[i] = next;
39
+ }
40
+ return out ?? v;
41
+ }
42
+ if (!is_plain(v)) return v;
43
+ seen.add(v);
44
+ let out = null;
45
+ for (const k of Object.keys(v)) {
46
+ const cur = v[k];
47
+ const next = swap(cur, seen);
48
+ if (next !== cur) (out ??= { ...v })[k] = next;
49
+ }
50
+ return out ?? v;
51
+ }
52
+ export { PORTABLE_FORM, with_portable_forms };
@@ -0,0 +1,35 @@
1
+ /** A preference declaration: its name, allowed values, and default (which must be one of the values). */
2
+ export type PreferenceSpec = {
3
+ name: string;
4
+ values: readonly string[];
5
+ default: string;
6
+ };
7
+ /** A live preference handle — SSR `head()`, client `get()`/`set()`, and the `attr` CSS authors target. */
8
+ export interface Preference {
9
+ readonly name: string;
10
+ readonly values: readonly string[];
11
+ readonly default: string;
12
+ /** The attribute set on `<html>`: `data-pref-<name>`. CSS targets `:root[<attr>="<value>"]`. */
13
+ readonly attr: string;
14
+ /** No-flash inline `<script>` string — reads localStorage and applies the attr before paint.
15
+ * `{@html}` it once in `<svelte:head>`. Idempotent, so emitting it more than once is harmless. */
16
+ head(): string;
17
+ /** CLIENT: persist + apply a new value (wire a control's handler to this). No-op on the server. */
18
+ set(value: string): void;
19
+ /** CLIENT: the current value (from the applied attr), or the default. Returns the default on the server. */
20
+ get(): string;
21
+ }
22
+ /**
23
+ * ONE delegated click handler that wires every preference switcher on the page: a click on any
24
+ * `[data-pref][data-pref-set]` control (the buttons a variant switcher / package-manager tabs emit)
25
+ * persists + applies that preference. Event delegation, so it survives SPA body-swaps and needs no
26
+ * island. `{@html preference.switch()}` once in the layout, alongside each `preference(spec).head()`.
27
+ * (`switch` is a property, not a binding — reserved words are fine there; mirrors `region.snippet`.)
28
+ */
29
+ declare function preference_switch(): string;
30
+ /** Declare a site-wide client preference. Throws at creation if `default` isn't one of `values`. */
31
+ declare function preference_impl(spec: PreferenceSpec): Preference;
32
+ export declare const preference: typeof preference_impl & {
33
+ switch: typeof preference_switch;
34
+ };
35
+ export {};
@@ -0,0 +1,84 @@
1
+ import { script } from "./script.js";
2
+ // src/preference.ts
3
+ /**
4
+ * `preference()` — a persisted, site-wide client CHOICE that flips a CSS state, with zero shipped JS
5
+ * beyond one pre-paint inline script. The csr=false-native primitive behind the JS↔TS code toggle,
6
+ * package-manager tabs, site-wide tab memory, and the theme toggle: one mechanism, many features.
7
+ *
8
+ * A preference is a NAME, its allowed VALUES, and a DEFAULT. On the client the current value lives in
9
+ * `localStorage` and is mirrored onto `<html data-pref-<name>="<value>">` — set BEFORE first paint by
10
+ * {@link Preference.head} (no flash), so CSS can show/hide variants with pure `:root[data-pref-…]`
11
+ * selectors and no hydration. A control calls {@link Preference.set} to change it.
12
+ *
13
+ * ```ts
14
+ * const codeLang = preference({ name: 'code-language', values: ['ts', 'js'], default: 'ts' });
15
+ * // layout <svelte:head>: {@html codeLang.head()} ← no-flash apply
16
+ * // a toggle's onchange: codeLang.set(checked ? 'ts' : 'js')
17
+ * // CSS: :root[data-pref-code-language="js"] [data-variant="ts"] { display: none }
18
+ * ```
19
+ */
20
+ const KEY = (name) => "og-pref-" + name;
21
+ const ATTR = (name) => "data-pref-" + name;
22
+ /**
23
+ * ONE delegated click handler that wires every preference switcher on the page: a click on any
24
+ * `[data-pref][data-pref-set]` control (the buttons a variant switcher / package-manager tabs emit)
25
+ * persists + applies that preference. Event delegation, so it survives SPA body-swaps and needs no
26
+ * island. `{@html preference.switch()}` once in the layout, alongside each `preference(spec).head()`.
27
+ * (`switch` is a property, not a binding — reserved words are fine there; mirrors `region.snippet`.)
28
+ */
29
+ function preference_switch() {
30
+ return script(() => {
31
+ document.addEventListener("click", function(e) {
32
+ var t = e.target;
33
+ var btn = t && t.closest ? t.closest("[data-pref][data-pref-set]") : null;
34
+ if (!btn) return;
35
+ var name = btn.getAttribute("data-pref");
36
+ var val = btn.getAttribute("data-pref-set");
37
+ if (!name || !val) return;
38
+ try {
39
+ localStorage.setItem("og-pref-" + name, val);
40
+ } catch {}
41
+ document.documentElement.setAttribute("data-pref-" + name, val);
42
+ });
43
+ });
44
+ }
45
+ /** Declare a site-wide client preference. Throws at creation if `default` isn't one of `values`. */
46
+ function preference_impl(spec) {
47
+ if (!spec.values.includes(spec.default)) throw new Error(`[ogygia] preference('${spec.name}'): default '${spec.default}' is not one of values [${spec.values.join(", ")}]`);
48
+ const name = spec.name;
49
+ const values = spec.values;
50
+ const def = spec.default;
51
+ const attr = ATTR(name);
52
+ return {
53
+ name,
54
+ values,
55
+ default: def,
56
+ attr,
57
+ head() {
58
+ return script((n, vs, d) => {
59
+ try {
60
+ var v = localStorage.getItem("og-pref-" + n);
61
+ if (!v || vs.indexOf(v) < 0) v = d;
62
+ document.documentElement.setAttribute("data-pref-" + n, v);
63
+ } catch {
64
+ document.documentElement.setAttribute("data-pref-" + n, d);
65
+ }
66
+ }, name, values, def);
67
+ },
68
+ set(value) {
69
+ if (typeof document === "undefined") return;
70
+ const v = values.includes(value) ? value : def;
71
+ try {
72
+ localStorage.setItem(KEY(name), v);
73
+ } catch {}
74
+ document.documentElement.setAttribute(attr, v);
75
+ },
76
+ get() {
77
+ if (typeof document === "undefined") return def;
78
+ const v = document.documentElement.getAttribute(attr);
79
+ return v && values.includes(v) ? v : def;
80
+ }
81
+ };
82
+ }
83
+ const preference = Object.assign(preference_impl, { switch: preference_switch });
84
+ export { preference };
@@ -0,0 +1 @@
1
+ export declare function preload(region: unknown): void;
@@ -0,0 +1,21 @@
1
+ import { REGION_BRAND } from "./region-brand.js";
2
+ import { frameAddress } from "./frame.js";
3
+ import { ensure } from "./runtime/frame-store.js";
4
+ // src/preload.ts
5
+ function preload(region) {
6
+ if (typeof document === "undefined") return;
7
+ const r = region;
8
+ if (!r || r[REGION_BRAND] !== true) return;
9
+ const url = typeof r.url === "string" ? r.url : "";
10
+ if (!url || r.html != null) return;
11
+ const address = frameAddress(url);
12
+ ensure(address, async (signal) => {
13
+ const res = await fetch(url, {
14
+ credentials: "same-origin",
15
+ signal
16
+ });
17
+ if (!res.ok) throw new Error("status " + res.status);
18
+ return res.text();
19
+ }).catch(() => {});
20
+ }
21
+ export { preload };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * THE HUB'S WATCH CHANNEL (hub v2, phases W and B) — split out of ref.ts so the boot, which needs only
3
+ * "subscribe to an id / tell its watchers" (runtime/frame-store.ts: region frames), never carries the
4
+ * whole identity hub. ref.ts re-exports all of it: one channel either way.
5
+ *
6
+ * WATCH — subscribe to fresh data settling for a hub id. THE one subscription primitive: region
7
+ * frames, streamed page-data, live refresh — every "a value arrives later for this identity" channel
8
+ * routes through here instead of owning its own subscriber set. Browser-only in practice (the
9
+ * request-scoped server never re-settles an id within one render).
10
+ */
11
+ type Watcher = (live: unknown) => void;
12
+ export declare function watchers(): Map<string, Set<Watcher>>;
13
+ /** Subscribe to fresh data settling for `id`. Returns an unsubscribe fn. */
14
+ export declare function watch(id: string, cb: Watcher): () => void;
15
+ /**
16
+ * Notify watchers that fresh data settled for `id`. Called by resolve's live-merge path AND
17
+ * directly by subsystems that push a value in (a region frame landing, a streamed promise
18
+ * resolving) — those pass the settled value; resolve's path passes the merged live instance.
19
+ * A throwing watcher never blocks the others.
20
+ */
21
+ export declare function notify(id: string, live: unknown): void;
22
+ /**
23
+ * Run `fn` with watch notifications BUFFERED, flushing them once when the outermost batch exits.
24
+ * Wrap any operation that resolves several refs at once (a context parse, a props decode, a nav's
25
+ * ref bag) so cross-ref invariants hold before any watcher reacts. Returns `fn`'s result.
26
+ */
27
+ export declare function batch<T>(fn: () => T): T;
28
+ /** How many watchers are registered for `id` — lets a subsystem that owns lifecycle around a
29
+ * hub id (fetch dedupe, eviction TTL) make refcount decisions without a parallel subscriber set. */
30
+ export declare function watcher_count(id: string): number;
31
+ export {};
@@ -0,0 +1,66 @@
1
+ // src/ref-watch.ts
2
+ /** id → callbacks. One per realm (a second bundle evaluating this module shares it). */
3
+ const WATCHERS_KEY = Symbol.for("ogygia.hub.watchers");
4
+ function watchers() {
5
+ const g = globalThis;
6
+ return g[WATCHERS_KEY] ??= /* @__PURE__ */ new Map();
7
+ }
8
+ /** Subscribe to fresh data settling for `id`. Returns an unsubscribe fn. */
9
+ function watch(id, cb) {
10
+ const all = watchers();
11
+ let set = all.get(id);
12
+ if (set === void 0) all.set(id, set = /* @__PURE__ */ new Set());
13
+ set.add(cb);
14
+ return () => {
15
+ const s = all.get(id);
16
+ if (s === void 0) return;
17
+ s.delete(cb);
18
+ if (s.size === 0) all.delete(id);
19
+ };
20
+ }
21
+ /**
22
+ * Notify watchers that fresh data settled for `id`. Called by resolve's live-merge path AND
23
+ * directly by subsystems that push a value in (a region frame landing, a streamed promise
24
+ * resolving) — those pass the settled value; resolve's path passes the merged live instance.
25
+ * A throwing watcher never blocks the others.
26
+ */
27
+ function notify(id, live) {
28
+ if (batch_depth > 0) {
29
+ (batch_pending ??= /* @__PURE__ */ new Map()).set(id, live);
30
+ return;
31
+ }
32
+ notify_now(id, live);
33
+ }
34
+ function notify_now(id, live) {
35
+ const set = watchers().get(id);
36
+ if (set === void 0) return;
37
+ for (const cb of Array.from(set)) try {
38
+ cb(live);
39
+ } catch {}
40
+ }
41
+ let batch_depth = 0;
42
+ let batch_pending = null;
43
+ /**
44
+ * Run `fn` with watch notifications BUFFERED, flushing them once when the outermost batch exits.
45
+ * Wrap any operation that resolves several refs at once (a context parse, a props decode, a nav's
46
+ * ref bag) so cross-ref invariants hold before any watcher reacts. Returns `fn`'s result.
47
+ */
48
+ function batch(fn) {
49
+ batch_depth++;
50
+ try {
51
+ return fn();
52
+ } finally {
53
+ batch_depth--;
54
+ if (batch_depth === 0) {
55
+ const pending = batch_pending;
56
+ batch_pending = null;
57
+ if (pending !== void 0 && pending !== null) for (const [id, live] of pending) notify_now(id, live);
58
+ }
59
+ }
60
+ }
61
+ /** How many watchers are registered for `id` — lets a subsystem that owns lifecycle around a
62
+ * hub id (fetch dedupe, eviction TTL) make refcount decisions without a parallel subscriber set. */
63
+ function watcher_count(id) {
64
+ return watchers().get(id)?.size ?? 0;
65
+ }
66
+ export { batch, notify, watch, watcher_count, watchers };
package/dist/ref.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ import { batch, notify, watch, watcher_count } from "./ref-watch.js";
2
+ /**
3
+ * THE HUB — ogygia's identity layer. One primitive carries everything that crosses an
4
+ * island boundary:
5
+ *
6
+ * Ref = { k: kind, i: identity, t: code tag, d: data }
7
+ *
8
+ * A held region, a portable snippet, a store, a `[og.wire]` class, a hoisted function —
9
+ * each is a Ref of a different KIND. A kind teaches the hub how its values travel
10
+ * (`match`/`encode`/`decode`); the hub owns everything identity:
11
+ *
12
+ * - MINT: every live instance gets ONE id (WeakMap-memoized), however many props or
13
+ * context keys carry it — which is what lets the client reunite all copies.
14
+ * - RESOLVE: the browser memoizes decode by id (`remember: true`), so five islands
15
+ * decoding one handle share ONE live object. The server never memoizes
16
+ * (`remember: false`): each request decodes fresh — nothing leaks between users.
17
+ * - THE KEEP: a kind may name a ref for SESSION continuity (`keep_name`); the tab then
18
+ * reunites navigations with the same live instance, reconciling fresh server data via
19
+ * the kind's `merge`. Browser-only; the server never touches it.
20
+ *
21
+ * Everything interesting in the framework is an operation on `i`, not `d`: reunify across
22
+ * islands = same id; survive a navigation = same id in the Keep; dedupe = same id; the
23
+ * future region reconciler = diff two id sets. Kinds are plugins; identity is the spine.
24
+ *
25
+ * All registry state lives on `globalThis` under `Symbol.for` keys — the runtime and each
26
+ * island entry are separate bundles, and per-module state would silently fork.
27
+ */
28
+ /** The wire shape. `k` picks the kind, `i` is identity, `t` names code (module tag /
29
+ * chunk / factory), `d` is devalue-safe data (value, snapshot, props, bound captures). */
30
+ export interface Ref {
31
+ k: string;
32
+ i: string;
33
+ t?: string;
34
+ d?: unknown;
35
+ /** Scope hint (hub v2, phase S) — which lifetime bucket governs this instance:
36
+ * 'request' (server, never memoized) | 'page' (this render) | 'session' (cross-nav, tab).
37
+ * Optional on the wire; when absent, resolve derives it (keep_name ⇒ session, else the
38
+ * caller's page/request choice). Present so a scope can be DISPOSED as a unit (phase D). */
39
+ sc?: Scope;
40
+ }
41
+ /** The three identity lifetimes, one axis of the hub's policy space. */
42
+ export type Scope = "request" | "page" | "session";
43
+ /** A kind teaches the hub one family of transportable values. */
44
+ export interface RefKind {
45
+ /** Kind discriminator carried in `Ref.k` ('wire' | 'store' | 'snippet' | 'region' | 'fn' | …). */
46
+ k: string;
47
+ /** Claim a live value (mint dispatch, first registered wins). */
48
+ match(value: unknown): boolean;
49
+ /** Sending side: code tag + devalue-safe data. */
50
+ encode(value: object): {
51
+ t?: string;
52
+ d?: unknown;
53
+ };
54
+ /** Receiving side: rebuild a live value from the ref. */
55
+ decode(ref: Ref): unknown;
56
+ /** An id DERIVED from the descriptor, for a kind whose decode reads only `d` and whose instances
57
+ * hold no state: equal descriptors ARE the same value, so they may share the id — and a render
58
+ * mints the same id every time (the HTML, the island's fingerprint and every cache keyed on them
59
+ * stay put across requests). `undefined` (or no hook) → a fresh random id, as every stateful kind
60
+ * needs (a store, a class instance: identity is the point). */
61
+ stable_id?(d: unknown): string | undefined;
62
+ /** SESSION continuity: name this ref to promote its instance to tab lifetime (browser only). */
63
+ keep_name?(ref: Ref): string | undefined;
64
+ /** Reconcile a kept live instance with a freshly arrived ref (default: kept wins untouched). */
65
+ merge?(kept: object, ref: Ref): void;
66
+ /** Tear down a live instance when its scope is disposed (hub v2, phase D) — close a channel,
67
+ * abort a fetch, drop a subscription. Most kinds have nothing to release (GC handles the
68
+ * object); implement only when the instance owns a resource beyond memory. */
69
+ dispose?(live: object): void;
70
+ }
71
+ /** Register a kind. Idempotent by discriminator — a re-registration (second bundle evaluating
72
+ * the same module) keeps the FIRST, so identity state never forks. */
73
+ export declare function register_kind(kind: RefKind): void;
74
+ /**
75
+ * Mint: live value → Ref, or undefined to fall through to devalue's normal handling.
76
+ * `only` restricts the dispatch to named kinds — a seam may deliberately exclude a family
77
+ * (the drop-in context path excludes snippets so a stray function THROWS instead of being
78
+ * silently mis-read as one). Same instance → same id, always.
79
+ */
80
+ export declare function mint(value: unknown, only?: ReadonlySet<string>): Ref | undefined;
81
+ export declare function set_resolve_sink(fn: ((id: string) => void) | null): void;
82
+ /**
83
+ * DISPOSE a whole scope (hub v2, phase D) — tear down every instance in its bucket via the
84
+ * instance's `kind.dispose`, run any registered scope-disposers (side-effect cleanups like the
85
+ * remote cache), then empty the bucket. `dispose_scope('page')` on nav is what replaces the old
86
+ * MAX_LIVE cap: stale page-scoped aliases go, session/forever instances stay.
87
+ *
88
+ * SAFETY: a page-bucket instance that is ALSO in a longer-lived bucket (a wire class aliased into
89
+ * 'session' for continuity) is NOT torn down — only its page alias is dropped. Its resources
90
+ * belong to the session and outlive the nav.
91
+ */
92
+ export declare function dispose_scope(scope: Scope): void;
93
+ /**
94
+ * DISPOSE specific page-scoped ids (reconciler R3) — the SELECTIVE counterpart to dispose_scope.
95
+ * A reconcile nav keeps matched islands mounted, so it can't blanket-dispose the page scope; it
96
+ * disposes only the ids owned by REMOVED regions. Each id's instance is torn down via its
97
+ * kind.dispose and removed from the page bucket, instance_kind, and dep_index — UNLESS it is also
98
+ * session-aliased (continuity), in which case only nothing happens (the session bucket keeps it).
99
+ * ids not present in the page bucket are skipped silently.
100
+ */
101
+ export declare function dispose_ids(ids: Iterable<string>): void;
102
+ /** Register a side-effect cleanup to run whenever `scope` is disposed. Returns an unregister fn.
103
+ * Lets subsystems (the remote cache) fold their nav-time clearing into scope disposal. */
104
+ export declare function register_scope_disposer(scope: Scope, fn: () => void): () => void;
105
+ /**
106
+ * Resolve: Ref → live value.
107
+ *
108
+ * Second arg is a {@link Scope} (or a legacy boolean shim: `true` ⇒ 'page', `false` ⇒ 'request').
109
+ * 'page'/'session' (browser) memoize by id — decoding the same ref twice returns the SAME instance
110
+ * (the liveness mechanism), and a kind-named ref reunites with the session bucket across
111
+ * navigations (the kind's `merge` reconciles fresh server data in; default kept-wins). 'request'
112
+ * (server, defer/streaming renders) always decodes fresh: memoizing across requests would leak one
113
+ * user's state into another's HTML.
114
+ */
115
+ export declare function resolve(ref: Ref, scope_or_remember: boolean | Scope): unknown;
116
+ /** Resolve a bag of refs as one transaction (sugar over {@link batch}). */
117
+ export declare function resolve_batch(refs: readonly Ref[], scope: boolean | Scope): unknown[];
118
+ /** Devalue custom-type name for hub refs on the wire (the ONE key every seam will converge on). */
119
+ export declare const REF_WIRE_KEY = "OgygiaRef";
120
+ /** Devalue reducer for a seam. `only` deliberately restricts which families may cross there. */
121
+ export declare function ref_reducer(only?: ReadonlySet<string>): (value: unknown) => Ref | undefined;
122
+ /** Devalue reviver for a seam. Browser passes `remember: true`; the server must pass `false`. */
123
+ export declare function ref_reviver(remember: boolean): (ref: Ref) => unknown;
124
+ export { batch, notify, watch, watcher_count };