@noego/wood 0.4.9 → 0.5.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 (493) hide show
  1. package/README.md +118 -42
  2. package/bin/axe.js +313 -98
  3. package/dist/{loader/__fixtures__/layouts/app.load.cjs → automation/actions.cjs} +3 -13
  4. package/dist/automation/actions.cjs.map +1 -0
  5. package/dist/automation/actions.d.cts +57 -0
  6. package/dist/automation/actions.d.ts +57 -0
  7. package/dist/automation/actions.js +1 -0
  8. package/dist/automation/actions.js.map +1 -0
  9. package/dist/automation/actions_executor.cjs +101 -0
  10. package/dist/automation/actions_executor.cjs.map +1 -0
  11. package/dist/automation/actions_executor.d.cts +16 -0
  12. package/dist/automation/actions_executor.d.ts +16 -0
  13. package/dist/automation/actions_executor.js +76 -0
  14. package/dist/automation/actions_executor.js.map +1 -0
  15. package/dist/automation/connection.cjs +86 -0
  16. package/dist/automation/connection.cjs.map +1 -0
  17. package/dist/automation/connection.d.cts +18 -0
  18. package/dist/automation/connection.d.ts +18 -0
  19. package/dist/automation/connection.js +51 -0
  20. package/dist/automation/connection.js.map +1 -0
  21. package/dist/{middleware/__fixtures__/middleware/sequence.cjs → automation/errors.cjs} +25 -22
  22. package/dist/automation/errors.cjs.map +1 -0
  23. package/dist/automation/errors.d.cts +31 -0
  24. package/dist/automation/errors.d.ts +31 -0
  25. package/dist/automation/errors.js +24 -0
  26. package/dist/automation/errors.js.map +1 -0
  27. package/dist/automation/index.cjs +49 -0
  28. package/dist/automation/index.cjs.map +1 -0
  29. package/dist/automation/index.d.cts +16 -0
  30. package/dist/automation/index.d.ts +16 -0
  31. package/dist/automation/index.js +15 -0
  32. package/dist/automation/index.js.map +1 -0
  33. package/dist/automation/introspection_reader.cjs +75 -0
  34. package/dist/automation/introspection_reader.cjs.map +1 -0
  35. package/dist/automation/introspection_reader.d.cts +20 -0
  36. package/dist/automation/introspection_reader.d.ts +20 -0
  37. package/dist/automation/introspection_reader.js +48 -0
  38. package/dist/automation/introspection_reader.js.map +1 -0
  39. package/dist/automation/locator.cjs +102 -0
  40. package/dist/automation/locator.cjs.map +1 -0
  41. package/dist/automation/locator.d.cts +51 -0
  42. package/dist/automation/locator.d.ts +51 -0
  43. package/dist/automation/locator.js +75 -0
  44. package/dist/automation/locator.js.map +1 -0
  45. package/dist/{loader/__fixtures__/views/test/page.load.cjs → automation/observation.cjs} +3 -13
  46. package/dist/automation/observation.cjs.map +1 -0
  47. package/dist/automation/observation.d.cts +44 -0
  48. package/dist/automation/observation.d.ts +44 -0
  49. package/dist/automation/observation.js +1 -0
  50. package/dist/automation/observation.js.map +1 -0
  51. package/dist/{controller/__fixtures__/controllers/test.cjs → automation/receipts.cjs} +3 -15
  52. package/dist/automation/receipts.cjs.map +1 -0
  53. package/dist/automation/receipts.d.cts +27 -0
  54. package/dist/automation/receipts.d.ts +27 -0
  55. package/dist/automation/receipts.js +1 -0
  56. package/dist/automation/receipts.js.map +1 -0
  57. package/dist/automation/scenario.cjs +696 -0
  58. package/dist/automation/scenario.cjs.map +1 -0
  59. package/dist/automation/scenario.d.cts +89 -0
  60. package/dist/automation/scenario.d.ts +89 -0
  61. package/dist/automation/scenario.js +660 -0
  62. package/dist/automation/scenario.js.map +1 -0
  63. package/dist/automation/scrolling.cjs +17 -0
  64. package/dist/automation/scrolling.cjs.map +1 -0
  65. package/dist/automation/scrolling.d.cts +51 -0
  66. package/dist/automation/scrolling.d.ts +51 -0
  67. package/dist/automation/scrolling.js +1 -0
  68. package/dist/automation/scrolling.js.map +1 -0
  69. package/dist/automation/scrolling_executor.cjs +109 -0
  70. package/dist/automation/scrolling_executor.cjs.map +1 -0
  71. package/dist/automation/scrolling_executor.d.cts +13 -0
  72. package/dist/automation/scrolling_executor.d.ts +13 -0
  73. package/dist/automation/scrolling_executor.js +84 -0
  74. package/dist/automation/scrolling_executor.js.map +1 -0
  75. package/dist/automation/target_identity.cjs +17 -0
  76. package/dist/automation/target_identity.cjs.map +1 -0
  77. package/dist/automation/target_identity.d.cts +28 -0
  78. package/dist/automation/target_identity.d.ts +28 -0
  79. package/dist/automation/target_identity.js +1 -0
  80. package/dist/automation/target_identity.js.map +1 -0
  81. package/dist/automation/target_registry.cjs +148 -0
  82. package/dist/automation/target_registry.cjs.map +1 -0
  83. package/dist/automation/target_registry.d.cts +32 -0
  84. package/dist/automation/target_registry.d.ts +32 -0
  85. package/dist/automation/target_registry.js +122 -0
  86. package/dist/automation/target_registry.js.map +1 -0
  87. package/dist/automation/waits.cjs +17 -0
  88. package/dist/automation/waits.cjs.map +1 -0
  89. package/dist/automation/waits.d.cts +44 -0
  90. package/dist/automation/waits.d.ts +44 -0
  91. package/dist/automation/waits.js +1 -0
  92. package/dist/automation/waits.js.map +1 -0
  93. package/dist/automation/waits_executor.cjs +104 -0
  94. package/dist/automation/waits_executor.cjs.map +1 -0
  95. package/dist/automation/waits_executor.d.cts +14 -0
  96. package/dist/automation/waits_executor.d.ts +14 -0
  97. package/dist/automation/waits_executor.js +79 -0
  98. package/dist/automation/waits_executor.js.map +1 -0
  99. package/dist/bridge/backend_bridge.cjs.map +1 -1
  100. package/dist/bridge/backend_bridge.js.map +1 -1
  101. package/dist/client/index.cjs +78 -21
  102. package/dist/client/index.cjs.map +1 -1
  103. package/dist/client/index.d.cts +19 -3
  104. package/dist/client/index.d.ts +19 -3
  105. package/dist/client/index.js +80 -22
  106. package/dist/client/index.js.map +1 -1
  107. package/dist/client/renderer_log_transport.cjs +151 -0
  108. package/dist/client/renderer_log_transport.cjs.map +1 -0
  109. package/dist/client/renderer_log_transport.d.cts +54 -0
  110. package/dist/client/renderer_log_transport.d.ts +54 -0
  111. package/dist/client/renderer_log_transport.js +123 -0
  112. package/dist/client/renderer_log_transport.js.map +1 -0
  113. package/dist/codegen/controller_registration_generator.cjs +13 -2
  114. package/dist/codegen/controller_registration_generator.cjs.map +1 -1
  115. package/dist/codegen/controller_registration_generator.d.cts +12 -1
  116. package/dist/codegen/controller_registration_generator.d.ts +12 -1
  117. package/dist/codegen/controller_registration_generator.js +10 -1
  118. package/dist/codegen/controller_registration_generator.js.map +1 -1
  119. package/dist/codegen/index.d.cts +1 -0
  120. package/dist/codegen/index.d.ts +1 -0
  121. package/dist/codegen/preload_generator.cjs +13 -6
  122. package/dist/codegen/preload_generator.cjs.map +1 -1
  123. package/dist/codegen/preload_generator.d.cts +11 -2
  124. package/dist/codegen/preload_generator.d.ts +11 -2
  125. package/dist/codegen/preload_generator.js +13 -6
  126. package/dist/codegen/preload_generator.js.map +1 -1
  127. package/dist/codegen/renderer_app_generator.cjs +95 -44
  128. package/dist/codegen/renderer_app_generator.cjs.map +1 -1
  129. package/dist/codegen/renderer_app_generator.js +95 -44
  130. package/dist/codegen/renderer_app_generator.js.map +1 -1
  131. package/dist/codegen/type_generator.cjs +1 -0
  132. package/dist/codegen/type_generator.cjs.map +1 -1
  133. package/dist/codegen/type_generator.js +1 -0
  134. package/dist/codegen/type_generator.js.map +1 -1
  135. package/dist/config/config_parser.cjs +95 -4
  136. package/dist/config/config_parser.cjs.map +1 -1
  137. package/dist/config/config_parser.d.cts +10 -2
  138. package/dist/config/config_parser.d.ts +10 -2
  139. package/dist/config/config_parser.js +92 -3
  140. package/dist/config/config_parser.js.map +1 -1
  141. package/dist/config/index.cjs +6 -2
  142. package/dist/config/index.cjs.map +1 -1
  143. package/dist/config/index.d.cts +2 -2
  144. package/dist/config/index.d.ts +2 -2
  145. package/dist/config/index.js +8 -2
  146. package/dist/config/index.js.map +1 -1
  147. package/dist/controller/controller_resolver.cjs +51 -3
  148. package/dist/controller/controller_resolver.cjs.map +1 -1
  149. package/dist/controller/controller_resolver.d.cts +27 -4
  150. package/dist/controller/controller_resolver.d.ts +27 -4
  151. package/dist/controller/controller_resolver.js +48 -2
  152. package/dist/controller/controller_resolver.js.map +1 -1
  153. package/dist/controller/index.cjs +6 -2
  154. package/dist/controller/index.cjs.map +1 -1
  155. package/dist/controller/index.d.cts +1 -1
  156. package/dist/controller/index.d.ts +1 -1
  157. package/dist/controller/index.js +4 -2
  158. package/dist/controller/index.js.map +1 -1
  159. package/dist/dev/wood_dev_server.cjs +4 -1
  160. package/dist/dev/wood_dev_server.cjs.map +1 -1
  161. package/dist/dev/wood_dev_server.js +5 -2
  162. package/dist/dev/wood_dev_server.js.map +1 -1
  163. package/dist/dev/yaml_watcher.cjs +1 -1
  164. package/dist/dev/yaml_watcher.cjs.map +1 -1
  165. package/dist/dev/yaml_watcher.d.cts +4 -0
  166. package/dist/dev/yaml_watcher.d.ts +4 -0
  167. package/dist/dev/yaml_watcher.js +1 -1
  168. package/dist/dev/yaml_watcher.js.map +1 -1
  169. package/dist/frontend/frontend_lifecycle.cjs +74 -0
  170. package/dist/frontend/frontend_lifecycle.cjs.map +1 -0
  171. package/dist/frontend/frontend_lifecycle.d.cts +50 -0
  172. package/dist/frontend/frontend_lifecycle.d.ts +50 -0
  173. package/dist/frontend/frontend_lifecycle.js +50 -0
  174. package/dist/frontend/frontend_lifecycle.js.map +1 -0
  175. package/dist/frontend/frontend_page.cjs +122 -0
  176. package/dist/frontend/frontend_page.cjs.map +1 -0
  177. package/dist/frontend/frontend_page.d.cts +62 -0
  178. package/dist/frontend/frontend_page.d.ts +62 -0
  179. package/dist/frontend/frontend_page.js +98 -0
  180. package/dist/frontend/frontend_page.js.map +1 -0
  181. package/dist/frontend/frontend_surface.cjs +249 -0
  182. package/dist/frontend/frontend_surface.cjs.map +1 -0
  183. package/dist/frontend/frontend_surface.d.cts +64 -0
  184. package/dist/frontend/frontend_surface.d.ts +64 -0
  185. package/dist/frontend/frontend_surface.js +224 -0
  186. package/dist/frontend/frontend_surface.js.map +1 -0
  187. package/dist/frontend/index.cjs +52 -0
  188. package/dist/frontend/index.cjs.map +1 -0
  189. package/dist/frontend/index.d.cts +10 -0
  190. package/dist/frontend/index.d.ts +10 -0
  191. package/dist/frontend/index.js +19 -0
  192. package/dist/frontend/index.js.map +1 -0
  193. package/dist/frontend/page_catalog.cjs +135 -0
  194. package/dist/frontend/page_catalog.cjs.map +1 -0
  195. package/dist/frontend/page_catalog.d.cts +56 -0
  196. package/dist/frontend/page_catalog.d.ts +56 -0
  197. package/dist/frontend/page_catalog.js +108 -0
  198. package/dist/frontend/page_catalog.js.map +1 -0
  199. package/dist/frontend/tracked_transport.cjs +55 -0
  200. package/dist/frontend/tracked_transport.cjs.map +1 -0
  201. package/dist/frontend/tracked_transport.d.cts +36 -0
  202. package/dist/frontend/tracked_transport.d.ts +36 -0
  203. package/dist/frontend/tracked_transport.js +31 -0
  204. package/dist/frontend/tracked_transport.js.map +1 -0
  205. package/dist/frontend/work_registry.cjs +153 -0
  206. package/dist/frontend/work_registry.cjs.map +1 -0
  207. package/dist/frontend/work_registry.d.cts +70 -0
  208. package/dist/frontend/work_registry.d.ts +70 -0
  209. package/dist/frontend/work_registry.js +128 -0
  210. package/dist/frontend/work_registry.js.map +1 -0
  211. package/dist/index.cjs +24 -0
  212. package/dist/index.cjs.map +1 -1
  213. package/dist/index.d.cts +11 -7
  214. package/dist/index.d.ts +11 -7
  215. package/dist/index.js +27 -4
  216. package/dist/index.js.map +1 -1
  217. package/dist/main/index.cjs +10 -0
  218. package/dist/main/index.cjs.map +1 -1
  219. package/dist/main/index.d.cts +14 -2
  220. package/dist/main/index.d.ts +14 -2
  221. package/dist/main/index.js +16 -0
  222. package/dist/main/index.js.map +1 -1
  223. package/dist/middleware/middleware_resolver.cjs +22 -1
  224. package/dist/middleware/middleware_resolver.cjs.map +1 -1
  225. package/dist/middleware/middleware_resolver.d.cts +13 -1
  226. package/dist/middleware/middleware_resolver.d.ts +13 -1
  227. package/dist/middleware/middleware_resolver.js +22 -1
  228. package/dist/middleware/middleware_resolver.js.map +1 -1
  229. package/dist/navigation/automation_introspection.cjs +110 -0
  230. package/dist/navigation/automation_introspection.cjs.map +1 -0
  231. package/dist/navigation/automation_introspection.d.cts +60 -0
  232. package/dist/navigation/automation_introspection.d.ts +60 -0
  233. package/dist/navigation/automation_introspection.js +85 -0
  234. package/dist/navigation/automation_introspection.js.map +1 -0
  235. package/dist/navigation/index.cjs +10 -2
  236. package/dist/navigation/index.cjs.map +1 -1
  237. package/dist/navigation/index.d.cts +27 -1
  238. package/dist/navigation/index.d.ts +27 -1
  239. package/dist/navigation/index.js +6 -1
  240. package/dist/navigation/index.js.map +1 -1
  241. package/dist/{middleware/__fixtures__/middleware/auth.cjs → navigation/layout_preservation.cjs} +18 -20
  242. package/dist/navigation/layout_preservation.cjs.map +1 -0
  243. package/dist/navigation/layout_preservation.d.cts +2 -0
  244. package/dist/navigation/layout_preservation.d.ts +2 -0
  245. package/dist/navigation/layout_preservation.js +18 -0
  246. package/dist/navigation/layout_preservation.js.map +1 -0
  247. package/dist/parser/index.cjs +2 -0
  248. package/dist/parser/index.cjs.map +1 -1
  249. package/dist/parser/index.d.cts +1 -1
  250. package/dist/parser/index.d.ts +1 -1
  251. package/dist/parser/index.js +2 -1
  252. package/dist/parser/index.js.map +1 -1
  253. package/dist/parser/operations_parser.cjs +6 -0
  254. package/dist/parser/operations_parser.cjs.map +1 -1
  255. package/dist/parser/operations_parser.d.cts +9 -2
  256. package/dist/parser/operations_parser.d.ts +9 -2
  257. package/dist/parser/operations_parser.js +5 -0
  258. package/dist/parser/operations_parser.js.map +1 -1
  259. package/dist/parser/views_parser.cjs.map +1 -1
  260. package/dist/parser/views_parser.js.map +1 -1
  261. package/dist/router/index.d.cts +1 -0
  262. package/dist/router/index.d.ts +1 -0
  263. package/dist/router/wood_router.cjs +35 -3
  264. package/dist/router/wood_router.cjs.map +1 -1
  265. package/dist/router/wood_router.d.cts +15 -0
  266. package/dist/router/wood_router.d.ts +15 -0
  267. package/dist/router/wood_router.js +36 -4
  268. package/dist/router/wood_router.js.map +1 -1
  269. package/dist/runtime/get_container.cjs +9 -34
  270. package/dist/runtime/get_container.cjs.map +1 -1
  271. package/dist/runtime/get_container.d.cts +24 -4
  272. package/dist/runtime/get_container.d.ts +24 -4
  273. package/dist/runtime/get_container.js +8 -23
  274. package/dist/runtime/get_container.js.map +1 -1
  275. package/dist/runtime/index.cjs +9 -0
  276. package/dist/runtime/index.cjs.map +1 -1
  277. package/dist/runtime/index.d.cts +5 -2
  278. package/dist/runtime/index.d.ts +5 -2
  279. package/dist/runtime/index.js +10 -1
  280. package/dist/runtime/index.js.map +1 -1
  281. package/dist/runtime/renderer_config_extension.cjs +50 -0
  282. package/dist/runtime/renderer_config_extension.cjs.map +1 -0
  283. package/dist/runtime/renderer_config_extension.d.cts +19 -0
  284. package/dist/runtime/renderer_config_extension.d.ts +19 -0
  285. package/dist/runtime/renderer_config_extension.js +24 -0
  286. package/dist/runtime/renderer_config_extension.js.map +1 -0
  287. package/dist/runtime/renderer_log_batch_receiver.cjs +73 -0
  288. package/dist/runtime/renderer_log_batch_receiver.cjs.map +1 -0
  289. package/dist/runtime/renderer_log_batch_receiver.d.cts +29 -0
  290. package/dist/runtime/renderer_log_batch_receiver.d.ts +29 -0
  291. package/dist/runtime/renderer_log_batch_receiver.js +48 -0
  292. package/dist/runtime/renderer_log_batch_receiver.js.map +1 -0
  293. package/dist/runtime/renderer_trace_batch_receiver_registry.d.cts +1 -1
  294. package/dist/runtime/renderer_trace_batch_receiver_registry.d.ts +1 -1
  295. package/dist/runtime/runtime.cjs +14 -0
  296. package/dist/runtime/runtime.cjs.map +1 -1
  297. package/dist/runtime/runtime.d.cts +2 -1
  298. package/dist/runtime/runtime.d.ts +2 -1
  299. package/dist/runtime/runtime.js +14 -0
  300. package/dist/runtime/runtime.js.map +1 -1
  301. package/dist/stick/index.cjs.map +1 -1
  302. package/dist/stick/index.js.map +1 -1
  303. package/dist/testing/automation_assertions.cjs +417 -0
  304. package/dist/testing/automation_assertions.cjs.map +1 -0
  305. package/dist/testing/automation_assertions.d.cts +44 -0
  306. package/dist/testing/automation_assertions.d.ts +44 -0
  307. package/dist/testing/automation_assertions.js +385 -0
  308. package/dist/testing/automation_assertions.js.map +1 -0
  309. package/dist/testing/browser.cjs +130 -57
  310. package/dist/testing/browser.cjs.map +1 -1
  311. package/dist/testing/browser.d.cts +10 -4
  312. package/dist/testing/browser.d.ts +10 -4
  313. package/dist/testing/browser.js +132 -53
  314. package/dist/testing/browser.js.map +1 -1
  315. package/dist/testing/create_controller_harness.cjs +28 -8
  316. package/dist/testing/create_controller_harness.cjs.map +1 -1
  317. package/dist/testing/create_controller_harness.d.cts +18 -2
  318. package/dist/testing/create_controller_harness.d.ts +18 -2
  319. package/dist/testing/create_controller_harness.js +28 -8
  320. package/dist/testing/create_controller_harness.js.map +1 -1
  321. package/dist/testing/create_router_bridge.d.cts +1 -0
  322. package/dist/testing/create_router_bridge.d.ts +1 -0
  323. package/dist/testing/create_test_router.d.cts +1 -0
  324. package/dist/testing/create_test_router.d.ts +1 -0
  325. package/dist/testing/geometry.cjs +109 -0
  326. package/dist/testing/geometry.cjs.map +1 -0
  327. package/dist/testing/geometry.d.cts +45 -0
  328. package/dist/testing/geometry.d.ts +45 -0
  329. package/dist/testing/geometry.js +79 -0
  330. package/dist/testing/geometry.js.map +1 -0
  331. package/dist/testing/index.cjs +62 -2
  332. package/dist/testing/index.cjs.map +1 -1
  333. package/dist/testing/index.d.cts +23 -4
  334. package/dist/testing/index.d.ts +23 -4
  335. package/dist/testing/index.js +50 -2
  336. package/dist/testing/index.js.map +1 -1
  337. package/dist/{controller/__fixtures__/controllers/not_a_class.cjs → testing/test_wood.cjs} +15 -7
  338. package/dist/testing/test_wood.cjs.map +1 -0
  339. package/dist/testing/test_wood.d.cts +16 -0
  340. package/dist/testing/test_wood.d.ts +16 -0
  341. package/dist/testing/test_wood.js +12 -0
  342. package/dist/testing/test_wood.js.map +1 -0
  343. package/dist/testing/test_wood_config.cjs +272 -0
  344. package/dist/testing/test_wood_config.cjs.map +1 -0
  345. package/dist/testing/test_wood_config.d.cts +111 -0
  346. package/dist/testing/test_wood_config.d.ts +111 -0
  347. package/dist/testing/test_wood_config.js +247 -0
  348. package/dist/testing/test_wood_config.js.map +1 -0
  349. package/dist/testing/wood_config_source.cjs +146 -0
  350. package/dist/testing/wood_config_source.cjs.map +1 -0
  351. package/dist/testing/wood_config_source.d.cts +36 -0
  352. package/dist/testing/wood_config_source.d.ts +36 -0
  353. package/dist/testing/wood_config_source.js +112 -0
  354. package/dist/testing/wood_config_source.js.map +1 -0
  355. package/dist/testing/wood_env_renderer.cjs +210 -0
  356. package/dist/testing/wood_env_renderer.cjs.map +1 -0
  357. package/dist/testing/wood_env_renderer.d.cts +74 -0
  358. package/dist/testing/wood_env_renderer.d.ts +74 -0
  359. package/dist/testing/wood_env_renderer.js +188 -0
  360. package/dist/testing/wood_env_renderer.js.map +1 -0
  361. package/dist/testing/wood_test_selection.cjs +94 -0
  362. package/dist/testing/wood_test_selection.cjs.map +1 -0
  363. package/dist/testing/wood_test_selection.d.cts +39 -0
  364. package/dist/testing/wood_test_selection.d.ts +39 -0
  365. package/dist/testing/wood_test_selection.js +68 -0
  366. package/dist/testing/wood_test_selection.js.map +1 -0
  367. package/dist/trace-testing/index.d.cts +1 -2
  368. package/dist/trace-testing/index.d.ts +1 -2
  369. package/dist/trace-testing/trace_recorder.cjs +1 -1
  370. package/dist/trace-testing/trace_recorder.cjs.map +1 -1
  371. package/dist/trace-testing/trace_recorder.d.cts +1 -2
  372. package/dist/trace-testing/trace_recorder.d.ts +1 -2
  373. package/dist/trace-testing/trace_recorder.js +1 -1
  374. package/dist/trace-testing/trace_recorder.js.map +1 -1
  375. package/dist/trace-transport/index.d.cts +1 -1
  376. package/dist/trace-transport/index.d.ts +1 -1
  377. package/dist/{trace_hub-Cob54qRx.d.cts → trace_hub-Cpo_nVze.d.cts} +21 -1
  378. package/dist/{trace_hub-Cob54qRx.d.ts → trace_hub-Cpo_nVze.d.ts} +21 -1
  379. package/dist/tracing/index.cjs +9 -2
  380. package/dist/tracing/index.cjs.map +1 -1
  381. package/dist/tracing/index.d.cts +3 -2
  382. package/dist/tracing/index.d.ts +3 -2
  383. package/dist/tracing/index.js +7 -1
  384. package/dist/tracing/index.js.map +1 -1
  385. package/dist/tracing/renderer_trace_batch_host.d.cts +1 -1
  386. package/dist/tracing/renderer_trace_batch_host.d.ts +1 -1
  387. package/dist/tracing/renderer_trace_batch_transport.cjs +48 -6
  388. package/dist/tracing/renderer_trace_batch_transport.cjs.map +1 -1
  389. package/dist/tracing/renderer_trace_batch_transport.d.cts +17 -1
  390. package/dist/tracing/renderer_trace_batch_transport.d.ts +17 -1
  391. package/dist/tracing/renderer_trace_batch_transport.js +48 -6
  392. package/dist/tracing/renderer_trace_batch_transport.js.map +1 -1
  393. package/dist/tracing/trace_batch_adapter.cjs +110 -0
  394. package/dist/tracing/trace_batch_adapter.cjs.map +1 -0
  395. package/dist/tracing/trace_batch_adapter.d.cts +36 -0
  396. package/dist/tracing/trace_batch_adapter.d.ts +36 -0
  397. package/dist/tracing/trace_batch_adapter.js +86 -0
  398. package/dist/tracing/trace_batch_adapter.js.map +1 -0
  399. package/dist/tracing/trace_commit_writer.d.cts +1 -1
  400. package/dist/tracing/trace_commit_writer.d.ts +1 -1
  401. package/dist/tracing/trace_hub.cjs +87 -20
  402. package/dist/tracing/trace_hub.cjs.map +1 -1
  403. package/dist/tracing/trace_hub.d.cts +1 -1
  404. package/dist/tracing/trace_hub.d.ts +1 -1
  405. package/dist/tracing/trace_hub.js +85 -20
  406. package/dist/tracing/trace_hub.js.map +1 -1
  407. package/dist/tracing/trace_provider.cjs +21 -6
  408. package/dist/tracing/trace_provider.cjs.map +1 -1
  409. package/dist/tracing/trace_provider.d.cts +13 -4
  410. package/dist/tracing/trace_provider.d.ts +13 -4
  411. package/dist/tracing/trace_provider.js +22 -7
  412. package/dist/tracing/trace_provider.js.map +1 -1
  413. package/dist/tracing/types/wood_trace_batch.types.cjs.map +1 -1
  414. package/dist/tracing/types/wood_trace_batch.types.d.cts +15 -1
  415. package/dist/tracing/types/wood_trace_batch.types.d.ts +15 -1
  416. package/dist/tracing/types/wood_trace_sink.types.d.cts +1 -1
  417. package/dist/tracing/types/wood_trace_sink.types.d.ts +1 -1
  418. package/dist/tracing/wood_trace_batch_contract.cjs +2 -0
  419. package/dist/tracing/wood_trace_batch_contract.cjs.map +1 -1
  420. package/dist/tracing/wood_trace_batch_contract.d.cts +1 -1
  421. package/dist/tracing/wood_trace_batch_contract.d.ts +1 -1
  422. package/dist/tracing/wood_trace_batch_contract.js +2 -0
  423. package/dist/tracing/wood_trace_batch_contract.js.map +1 -1
  424. package/dist/transport/build_transport_bridge.cjs +4 -2
  425. package/dist/transport/build_transport_bridge.cjs.map +1 -1
  426. package/dist/transport/build_transport_bridge.d.cts +7 -1
  427. package/dist/transport/build_transport_bridge.d.ts +7 -1
  428. package/dist/transport/build_transport_bridge.js +2 -1
  429. package/dist/transport/build_transport_bridge.js.map +1 -1
  430. package/dist/transport/in_process_router_transport.d.cts +1 -0
  431. package/dist/transport/in_process_router_transport.d.ts +1 -0
  432. package/dist/transport/index.d.cts +1 -0
  433. package/dist/transport/index.d.ts +1 -0
  434. package/dist/types/config.cjs.map +1 -1
  435. package/dist/types/config.d.cts +47 -1
  436. package/dist/types/config.d.ts +47 -1
  437. package/dist/types/context.cjs +12 -0
  438. package/dist/types/context.cjs.map +1 -1
  439. package/dist/types/context.d.cts +27 -1
  440. package/dist/types/context.d.ts +27 -1
  441. package/dist/types/context.js +4 -0
  442. package/dist/types/context.js.map +1 -1
  443. package/dist/types/index.d.cts +2 -2
  444. package/dist/types/index.d.ts +2 -2
  445. package/dist/types/operations.cjs.map +1 -1
  446. package/dist/types/operations.d.cts +2 -0
  447. package/dist/types/operations.d.ts +2 -0
  448. package/docs/axe.md +706 -0
  449. package/package.json +19 -5
  450. package/src/components/NavigationShell.scopes.browser.test.ts +363 -0
  451. package/src/components/NavigationShell.svelte +126 -49
  452. package/dist/controller/__fixtures__/controllers/chat.cjs +0 -32
  453. package/dist/controller/__fixtures__/controllers/chat.cjs.map +0 -1
  454. package/dist/controller/__fixtures__/controllers/chat.d.cts +0 -11
  455. package/dist/controller/__fixtures__/controllers/chat.d.ts +0 -11
  456. package/dist/controller/__fixtures__/controllers/chat.js +0 -12
  457. package/dist/controller/__fixtures__/controllers/chat.js.map +0 -1
  458. package/dist/controller/__fixtures__/controllers/not_a_class.cjs.map +0 -1
  459. package/dist/controller/__fixtures__/controllers/not_a_class.d.cts +0 -3
  460. package/dist/controller/__fixtures__/controllers/not_a_class.d.ts +0 -3
  461. package/dist/controller/__fixtures__/controllers/not_a_class.js +0 -5
  462. package/dist/controller/__fixtures__/controllers/not_a_class.js.map +0 -1
  463. package/dist/controller/__fixtures__/controllers/settings.controller.cjs +0 -32
  464. package/dist/controller/__fixtures__/controllers/settings.controller.cjs.map +0 -1
  465. package/dist/controller/__fixtures__/controllers/settings.controller.d.cts +0 -12
  466. package/dist/controller/__fixtures__/controllers/settings.controller.d.ts +0 -12
  467. package/dist/controller/__fixtures__/controllers/settings.controller.js +0 -12
  468. package/dist/controller/__fixtures__/controllers/settings.controller.js.map +0 -1
  469. package/dist/controller/__fixtures__/controllers/test.cjs.map +0 -1
  470. package/dist/controller/__fixtures__/controllers/test.d.cts +0 -7
  471. package/dist/controller/__fixtures__/controllers/test.d.ts +0 -7
  472. package/dist/controller/__fixtures__/controllers/test.js +0 -9
  473. package/dist/controller/__fixtures__/controllers/test.js.map +0 -1
  474. package/dist/loader/__fixtures__/layouts/app.load.cjs.map +0 -1
  475. package/dist/loader/__fixtures__/layouts/app.load.d.cts +0 -5
  476. package/dist/loader/__fixtures__/layouts/app.load.d.ts +0 -5
  477. package/dist/loader/__fixtures__/layouts/app.load.js +0 -7
  478. package/dist/loader/__fixtures__/layouts/app.load.js.map +0 -1
  479. package/dist/loader/__fixtures__/views/test/page.load.cjs.map +0 -1
  480. package/dist/loader/__fixtures__/views/test/page.load.d.cts +0 -6
  481. package/dist/loader/__fixtures__/views/test/page.load.d.ts +0 -6
  482. package/dist/loader/__fixtures__/views/test/page.load.js +0 -7
  483. package/dist/loader/__fixtures__/views/test/page.load.js.map +0 -1
  484. package/dist/middleware/__fixtures__/middleware/auth.cjs.map +0 -1
  485. package/dist/middleware/__fixtures__/middleware/auth.d.cts +0 -6
  486. package/dist/middleware/__fixtures__/middleware/auth.d.ts +0 -6
  487. package/dist/middleware/__fixtures__/middleware/auth.js +0 -19
  488. package/dist/middleware/__fixtures__/middleware/auth.js.map +0 -1
  489. package/dist/middleware/__fixtures__/middleware/sequence.cjs.map +0 -1
  490. package/dist/middleware/__fixtures__/middleware/sequence.d.cts +0 -7
  491. package/dist/middleware/__fixtures__/middleware/sequence.d.ts +0 -7
  492. package/dist/middleware/__fixtures__/middleware/sequence.js +0 -21
  493. package/dist/middleware/__fixtures__/middleware/sequence.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The public projection of one mounted LAYOUT controller (18A D-FAS-05).
3
+ *
4
+ * Layout controllers are production page members — the views YAML binds
5
+ * them, the renderer mounts them alongside the view controller, and a
6
+ * `preserve: true` layout outlives page transitions. They therefore expose
7
+ * the same public `data / input / events` contract as the page controller,
8
+ * never their instance.
9
+ */
10
+ interface FrontendLayout<Data = unknown, Input = unknown, Events = unknown> {
11
+ /** The layout view path as declared in the views source. */
12
+ readonly path: string;
13
+ /** The layout controller identity as declared in the views source. */
14
+ readonly controller: string;
15
+ /** Whether the views source declares this layout preservable. */
16
+ readonly preserve: boolean;
17
+ readonly data: Data;
18
+ readonly input: Input;
19
+ readonly events: Events | undefined;
20
+ }
21
+ interface FrontendPage<Data = unknown, Input = unknown, Events = unknown> {
22
+ /** Canonical `window.page` production identity. */
23
+ readonly identity: string;
24
+ readonly data: Data;
25
+ readonly input: Input;
26
+ readonly events: Events | undefined;
27
+ /** Every mounted layout controller of this page, outermost first. */
28
+ readonly layouts: readonly FrontendLayout[];
29
+ /**
30
+ * The page's sole layout controller. Throws when the page declares none,
31
+ * or more than one — use `layouts` and name the layout explicitly there.
32
+ */
33
+ readonly layout: FrontendLayout;
34
+ close(): Promise<void>;
35
+ }
36
+ interface PageControllerLike {
37
+ data?: unknown;
38
+ input?: unknown;
39
+ events?: unknown;
40
+ }
41
+ interface FrontendPageHandle<Data = unknown, Input = unknown, Events = unknown> {
42
+ page: FrontendPage<Data, Input, Events>;
43
+ /** Mark the projection stale without disposing (navigation already disposed the scope). */
44
+ invalidate: () => void;
45
+ }
46
+ /** One mounted layout controller with the scope its handlers run under. */
47
+ interface MountedLayout {
48
+ path: string;
49
+ controller: string;
50
+ preserve: boolean;
51
+ instance: PageControllerLike;
52
+ scope: unknown;
53
+ }
54
+ declare function createFrontendPage<Data, Input, Events>(options: {
55
+ identity: string;
56
+ controller: PageControllerLike;
57
+ scope: unknown;
58
+ layouts?: readonly MountedLayout[];
59
+ onClose: () => Promise<void>;
60
+ }): FrontendPageHandle<Data, Input, Events>;
61
+
62
+ export { type FrontendLayout, type FrontendPage, type FrontendPageHandle, type MountedLayout, createFrontendPage };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The public projection of one mounted LAYOUT controller (18A D-FAS-05).
3
+ *
4
+ * Layout controllers are production page members — the views YAML binds
5
+ * them, the renderer mounts them alongside the view controller, and a
6
+ * `preserve: true` layout outlives page transitions. They therefore expose
7
+ * the same public `data / input / events` contract as the page controller,
8
+ * never their instance.
9
+ */
10
+ interface FrontendLayout<Data = unknown, Input = unknown, Events = unknown> {
11
+ /** The layout view path as declared in the views source. */
12
+ readonly path: string;
13
+ /** The layout controller identity as declared in the views source. */
14
+ readonly controller: string;
15
+ /** Whether the views source declares this layout preservable. */
16
+ readonly preserve: boolean;
17
+ readonly data: Data;
18
+ readonly input: Input;
19
+ readonly events: Events | undefined;
20
+ }
21
+ interface FrontendPage<Data = unknown, Input = unknown, Events = unknown> {
22
+ /** Canonical `window.page` production identity. */
23
+ readonly identity: string;
24
+ readonly data: Data;
25
+ readonly input: Input;
26
+ readonly events: Events | undefined;
27
+ /** Every mounted layout controller of this page, outermost first. */
28
+ readonly layouts: readonly FrontendLayout[];
29
+ /**
30
+ * The page's sole layout controller. Throws when the page declares none,
31
+ * or more than one — use `layouts` and name the layout explicitly there.
32
+ */
33
+ readonly layout: FrontendLayout;
34
+ close(): Promise<void>;
35
+ }
36
+ interface PageControllerLike {
37
+ data?: unknown;
38
+ input?: unknown;
39
+ events?: unknown;
40
+ }
41
+ interface FrontendPageHandle<Data = unknown, Input = unknown, Events = unknown> {
42
+ page: FrontendPage<Data, Input, Events>;
43
+ /** Mark the projection stale without disposing (navigation already disposed the scope). */
44
+ invalidate: () => void;
45
+ }
46
+ /** One mounted layout controller with the scope its handlers run under. */
47
+ interface MountedLayout {
48
+ path: string;
49
+ controller: string;
50
+ preserve: boolean;
51
+ instance: PageControllerLike;
52
+ scope: unknown;
53
+ }
54
+ declare function createFrontendPage<Data, Input, Events>(options: {
55
+ identity: string;
56
+ controller: PageControllerLike;
57
+ scope: unknown;
58
+ layouts?: readonly MountedLayout[];
59
+ onClose: () => Promise<void>;
60
+ }): FrontendPageHandle<Data, Input, Events>;
61
+
62
+ export { type FrontendLayout, type FrontendPage, type FrontendPageHandle, type MountedLayout, createFrontendPage };
@@ -0,0 +1,98 @@
1
+ import { ExecutionContext } from "@noego/ioc";
2
+ import { FrontendWorkError } from "./work_registry.js";
3
+ function bridgeSurface(surface, scope) {
4
+ if (!surface || typeof surface !== "object") return surface;
5
+ const wrapped = /* @__PURE__ */ new WeakMap();
6
+ return new Proxy(surface, {
7
+ get(target, property, receiver) {
8
+ const value = Reflect.get(target, property, receiver === void 0 ? target : target);
9
+ if (typeof value !== "function") return value;
10
+ const fn = value;
11
+ const cached = wrapped.get(fn);
12
+ if (cached) return cached;
13
+ const bridged = (...args) => ExecutionContext.current() !== void 0 ? fn.apply(target, args) : ExecutionContext.run(scope, () => fn.apply(target, args));
14
+ wrapped.set(fn, bridged);
15
+ return bridged;
16
+ }
17
+ });
18
+ }
19
+ function createFrontendPage(options) {
20
+ const { identity, controller, scope } = options;
21
+ let closed = false;
22
+ const bridgedInput = bridgeSurface(controller.input, scope);
23
+ const bridgedEvents = bridgeSurface(controller.events, scope);
24
+ const layouts = (options.layouts ?? []).map((mounted) => {
25
+ const layoutInput = bridgeSurface(mounted.instance.input, mounted.scope);
26
+ const layoutEvents = bridgeSurface(mounted.instance.events, mounted.scope);
27
+ return {
28
+ path: mounted.path,
29
+ controller: mounted.controller,
30
+ preserve: mounted.preserve,
31
+ get data() {
32
+ guard();
33
+ return mounted.instance.data;
34
+ },
35
+ get input() {
36
+ guard();
37
+ return layoutInput;
38
+ },
39
+ get events() {
40
+ guard();
41
+ return layoutEvents;
42
+ }
43
+ };
44
+ });
45
+ const guard = () => {
46
+ if (closed) {
47
+ throw new FrontendWorkError(
48
+ `page "${identity}" is closed; a closed/navigated-away page handle must not be used. Re-open the page or use frontend.current().`
49
+ );
50
+ }
51
+ };
52
+ const page = {
53
+ identity,
54
+ get data() {
55
+ guard();
56
+ return controller.data;
57
+ },
58
+ get input() {
59
+ guard();
60
+ return bridgedInput;
61
+ },
62
+ get events() {
63
+ guard();
64
+ return bridgedEvents;
65
+ },
66
+ get layouts() {
67
+ guard();
68
+ return layouts;
69
+ },
70
+ get layout() {
71
+ guard();
72
+ if (layouts.length === 1) return layouts[0];
73
+ if (!layouts.length) {
74
+ throw new FrontendWorkError(
75
+ `page "${identity}" mounts no layout controller; its views entry binds none.`
76
+ );
77
+ }
78
+ throw new FrontendWorkError(
79
+ `page "${identity}" mounts ${layouts.length} layout controllers (${layouts.map((entry) => entry.controller).join(", ")}); use page.layouts and name the one you mean.`
80
+ );
81
+ },
82
+ close: async () => {
83
+ if (closed) return;
84
+ closed = true;
85
+ await options.onClose();
86
+ }
87
+ };
88
+ return {
89
+ page,
90
+ invalidate: () => {
91
+ closed = true;
92
+ }
93
+ };
94
+ }
95
+ export {
96
+ createFrontendPage
97
+ };
98
+ //# sourceMappingURL=frontend_page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/frontend/frontend_page.ts"],"sourcesContent":["/**\n * The public frontend page projection (18A D-FAS-05).\n *\n * `FrontendPage` exposes the production `data / input / events` contract of\n * the selected PageController — never the controller instance itself, never\n * private or IoC-only members. References are not cloned (reactivity is\n * preserved); `input`/`events` handlers are bridged so they execute under\n * the page scope's IoC execution context, exactly as the production\n * renderer runtime invokes them (they are plain data properties holding\n * arrow functions, which would otherwise run context-less from a test).\n */\nimport { ExecutionContext } from '@noego/ioc';\nimport { FrontendWorkError } from './work_registry.js';\n\n/**\n * The public projection of one mounted LAYOUT controller (18A D-FAS-05).\n *\n * Layout controllers are production page members — the views YAML binds\n * them, the renderer mounts them alongside the view controller, and a\n * `preserve: true` layout outlives page transitions. They therefore expose\n * the same public `data / input / events` contract as the page controller,\n * never their instance.\n */\nexport interface FrontendLayout<Data = unknown, Input = unknown, Events = unknown> {\n /** The layout view path as declared in the views source. */\n readonly path: string;\n /** The layout controller identity as declared in the views source. */\n readonly controller: string;\n /** Whether the views source declares this layout preservable. */\n readonly preserve: boolean;\n readonly data: Data;\n readonly input: Input;\n readonly events: Events | undefined;\n}\n\nexport interface FrontendPage<Data = unknown, Input = unknown, Events = unknown> {\n /** Canonical `window.page` production identity. */\n readonly identity: string;\n readonly data: Data;\n readonly input: Input;\n readonly events: Events | undefined;\n /** Every mounted layout controller of this page, outermost first. */\n readonly layouts: readonly FrontendLayout[];\n /**\n * The page's sole layout controller. Throws when the page declares none,\n * or more than one — use `layouts` and name the layout explicitly there.\n */\n readonly layout: FrontendLayout;\n close(): Promise<void>;\n}\n\ninterface PageControllerLike {\n data?: unknown;\n input?: unknown;\n events?: unknown;\n}\n\nfunction bridgeSurface(surface: unknown, scope: unknown): unknown {\n if (!surface || typeof surface !== 'object') return surface;\n // Proxy, not a copy: input/events surfaces are often class instances\n // (methods on the prototype) or reactive objects (accessor-backed state);\n // a proxy preserves both while wrapping function reads so handlers run\n // under the page scope's execution context.\n const wrapped = new WeakMap<object, unknown>();\n return new Proxy(surface as object, {\n get(target, property, receiver) {\n const value = Reflect.get(target, property, receiver === undefined ? target : target);\n if (typeof value !== 'function') return value;\n const fn = value as (...args: unknown[]) => unknown;\n const cached = wrapped.get(fn);\n if (cached) return cached;\n const bridged = (...args: unknown[]) =>\n ExecutionContext.current() !== undefined\n ? fn.apply(target, args)\n : ExecutionContext.run(scope as never, () => fn.apply(target, args));\n wrapped.set(fn, bridged);\n return bridged;\n },\n });\n}\n\nexport interface FrontendPageHandle<Data = unknown, Input = unknown, Events = unknown> {\n page: FrontendPage<Data, Input, Events>;\n /** Mark the projection stale without disposing (navigation already disposed the scope). */\n invalidate: () => void;\n}\n\n/** One mounted layout controller with the scope its handlers run under. */\nexport interface MountedLayout {\n path: string;\n controller: string;\n preserve: boolean;\n instance: PageControllerLike;\n scope: unknown;\n}\n\nexport function createFrontendPage<Data, Input, Events>(options: {\n identity: string;\n controller: PageControllerLike;\n scope: unknown;\n layouts?: readonly MountedLayout[];\n onClose: () => Promise<void>;\n}): FrontendPageHandle<Data, Input, Events> {\n const { identity, controller, scope } = options;\n let closed = false;\n\n const bridgedInput = bridgeSurface(controller.input, scope);\n const bridgedEvents = bridgeSurface(controller.events, scope);\n\n const layouts: FrontendLayout[] = (options.layouts ?? []).map((mounted) => {\n const layoutInput = bridgeSurface(mounted.instance.input, mounted.scope);\n const layoutEvents = bridgeSurface(mounted.instance.events, mounted.scope);\n return {\n path: mounted.path,\n controller: mounted.controller,\n preserve: mounted.preserve,\n get data() {\n guard();\n return mounted.instance.data;\n },\n get input() {\n guard();\n return layoutInput;\n },\n get events() {\n guard();\n return layoutEvents;\n },\n };\n });\n\n const guard = (): void => {\n if (closed) {\n throw new FrontendWorkError(\n `page \"${identity}\" is closed; a closed/navigated-away page handle must not be used. ` +\n 'Re-open the page or use frontend.current().',\n );\n }\n };\n\n const page: FrontendPage<Data, Input, Events> = {\n identity,\n get data(): Data {\n guard();\n return controller.data as Data;\n },\n get input(): Input {\n guard();\n return bridgedInput as Input;\n },\n get events(): Events | undefined {\n guard();\n return bridgedEvents as Events | undefined;\n },\n get layouts(): readonly FrontendLayout[] {\n guard();\n return layouts;\n },\n get layout(): FrontendLayout {\n guard();\n if (layouts.length === 1) return layouts[0];\n if (!layouts.length) {\n throw new FrontendWorkError(\n `page \"${identity}\" mounts no layout controller; its views entry binds none.`,\n );\n }\n throw new FrontendWorkError(\n `page \"${identity}\" mounts ${layouts.length} layout controllers ` +\n `(${layouts.map((entry) => entry.controller).join(', ')}); ` +\n 'use page.layouts and name the one you mean.',\n );\n },\n close: async () => {\n if (closed) return;\n closed = true;\n await options.onClose();\n },\n };\n\n return {\n page,\n invalidate: () => {\n closed = true;\n },\n };\n}\n"],"mappings":"AAWA,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AA6ClC,SAAS,cAAc,SAAkB,OAAyB;AAChE,MAAI,CAAC,WAAW,OAAO,YAAY,SAAU,QAAO;AAKpD,QAAM,UAAU,oBAAI,QAAyB;AAC7C,SAAO,IAAI,MAAM,SAAmB;AAAA,IAClC,IAAI,QAAQ,UAAU,UAAU;AAC9B,YAAM,QAAQ,QAAQ,IAAI,QAAQ,UAAU,aAAa,SAAY,SAAS,MAAM;AACpF,UAAI,OAAO,UAAU,WAAY,QAAO;AACxC,YAAM,KAAK;AACX,YAAM,SAAS,QAAQ,IAAI,EAAE;AAC7B,UAAI,OAAQ,QAAO;AACnB,YAAM,UAAU,IAAI,SAClB,iBAAiB,QAAQ,MAAM,SAC3B,GAAG,MAAM,QAAQ,IAAI,IACrB,iBAAiB,IAAI,OAAgB,MAAM,GAAG,MAAM,QAAQ,IAAI,CAAC;AACvE,cAAQ,IAAI,IAAI,OAAO;AACvB,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAiBO,SAAS,mBAAwC,SAMZ;AAC1C,QAAM,EAAE,UAAU,YAAY,MAAM,IAAI;AACxC,MAAI,SAAS;AAEb,QAAM,eAAe,cAAc,WAAW,OAAO,KAAK;AAC1D,QAAM,gBAAgB,cAAc,WAAW,QAAQ,KAAK;AAE5D,QAAM,WAA6B,QAAQ,WAAW,CAAC,GAAG,IAAI,CAAC,YAAY;AACzE,UAAM,cAAc,cAAc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A,IACL;AAAA,IACA,YAAY,MAAM;AAChB,eAAS;AAAA,IACX;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var frontend_surface_exports = {};
20
+ __export(frontend_surface_exports, {
21
+ FrontendWorkError: () => import_work_registry.FrontendWorkError,
22
+ createFrontendSurface: () => createFrontendSurface
23
+ });
24
+ module.exports = __toCommonJS(frontend_surface_exports);
25
+ var import_ioc = require("@noego/ioc");
26
+ var import_layout_preservation = require("../navigation/layout_preservation.js");
27
+ var import_controller_lifecycle = require("../controller/controller_lifecycle.js");
28
+ var import_page_catalog = require("./page_catalog.js");
29
+ var import_work_registry = require("./work_registry.js");
30
+ var import_frontend_lifecycle = require("./frontend_lifecycle.js");
31
+ var import_frontend_page = require("./frontend_page.js");
32
+ function registerControllerUnlessBound(scope, ControllerClass) {
33
+ const registrable = scope;
34
+ if (typeof registrable.isRegistered === "function" && registrable.isRegistered(ControllerClass)) return;
35
+ if (typeof scope.registerClass === "function") scope.registerClass(ControllerClass);
36
+ }
37
+ function guardControllerLifecycleOnce(instance) {
38
+ if (!instance || typeof instance !== "object") return;
39
+ const target = instance;
40
+ for (const hook of ["dispose", "destroy"]) {
41
+ const original = target[hook];
42
+ if (typeof original !== "function") continue;
43
+ if (Object.prototype.hasOwnProperty.call(target, hook)) continue;
44
+ let called = false;
45
+ Object.defineProperty(target, hook, {
46
+ configurable: true,
47
+ writable: true,
48
+ enumerable: false,
49
+ value: function guarded(...args) {
50
+ if (called) return void 0;
51
+ called = true;
52
+ return original.apply(this, args);
53
+ }
54
+ });
55
+ }
56
+ }
57
+ function createFrontendSurface(options) {
58
+ const { catalog, rendererRoot, registry, navigation } = options;
59
+ const flushHooks = options.flushHooks ?? [];
60
+ const application = new import_frontend_lifecycle.FrontendLifecycleOwner(registry, "application");
61
+ let active = null;
62
+ let transitioning = false;
63
+ let disposed = false;
64
+ const currentOwner = () => active ? `page ${active.identity}` : "application";
65
+ async function constructPage(view, params, query, preserved = []) {
66
+ const identity = (0, import_page_catalog.pageIdentity)(view);
67
+ if (!view.controller) {
68
+ throw new import_page_catalog.PageCatalogError(
69
+ `page "${identity}" declares no controller in its view definition; the Node application slice drives public PageController input and needs one.`
70
+ );
71
+ }
72
+ const ControllerClass = await options.resolveController(view.controller, view);
73
+ const scope = rendererRoot.extend();
74
+ const lifecycle = new import_frontend_lifecycle.FrontendLifecycleOwner(registry, `page ${identity}`);
75
+ scope.registerFunction?.(import_frontend_lifecycle.FrontendLifecycleOwner, () => lifecycle, { loadAs: import_ioc.LoadAs.Scoped });
76
+ await options.configurePageScope?.(scope, view, {
77
+ kind: "page",
78
+ controller: view.controller
79
+ });
80
+ registerControllerUnlessBound(scope, ControllerClass);
81
+ const layouts = [...preserved];
82
+ for (let index = preserved.length; index < view.layouts.length; index += 1) {
83
+ const layoutIdentity = view.layoutControllers?.[index];
84
+ if (!layoutIdentity) continue;
85
+ const preserve = view.layoutPreserve?.[index] === true;
86
+ const LayoutClass = await options.resolveController(layoutIdentity, view);
87
+ const ownScope = preserve ? rendererRoot.extend() : null;
88
+ const ownLifecycle = ownScope ? new import_frontend_lifecycle.FrontendLifecycleOwner(registry, `layout ${layoutIdentity}`) : null;
89
+ const layoutScope = ownScope ?? scope;
90
+ if (ownScope) {
91
+ ownScope.registerFunction?.(import_frontend_lifecycle.FrontendLifecycleOwner, () => ownLifecycle, { loadAs: import_ioc.LoadAs.Scoped });
92
+ await options.configurePageScope?.(ownScope, view, {
93
+ kind: "layout",
94
+ layoutIndex: index,
95
+ controller: layoutIdentity
96
+ });
97
+ }
98
+ registerControllerUnlessBound(layoutScope, LayoutClass);
99
+ const instance = await import_ioc.ExecutionContext.run(
100
+ layoutScope,
101
+ () => layoutScope.get(LayoutClass)
102
+ );
103
+ guardControllerLifecycleOnce(instance);
104
+ layouts.push({
105
+ index,
106
+ path: view.layouts[index],
107
+ controller: layoutIdentity,
108
+ preserve,
109
+ instance,
110
+ scope: layoutScope,
111
+ ownScope,
112
+ ownLifecycle
113
+ });
114
+ }
115
+ const controller = await import_ioc.ExecutionContext.run(
116
+ scope,
117
+ () => scope.get(ControllerClass)
118
+ );
119
+ guardControllerLifecycleOnce(controller);
120
+ if (typeof controller.initialize === "function") {
121
+ await registry.track(
122
+ Promise.resolve(
123
+ import_ioc.ExecutionContext.run(
124
+ scope,
125
+ () => controller.initialize({ params, query })
126
+ )
127
+ ).then(() => void 0),
128
+ { label: `initialize ${identity}`, kind: "initialize", owner: `page ${identity}` }
129
+ );
130
+ }
131
+ const handle = (0, import_frontend_page.createFrontendPage)({
132
+ identity,
133
+ controller,
134
+ scope,
135
+ layouts,
136
+ onClose: async () => {
137
+ await disposePage(identity);
138
+ }
139
+ });
140
+ return { identity, view, scope, lifecycle, handle, controller, layouts };
141
+ }
142
+ async function endPage(page, preservedDepth = 0) {
143
+ page.handle.invalidate();
144
+ await (0, import_controller_lifecycle.disposeControllerLifecycle)(page.controller);
145
+ for (const layout of page.layouts) {
146
+ if (layout.index < preservedDepth) continue;
147
+ await (0, import_controller_lifecycle.disposeControllerLifecycle)(layout.instance);
148
+ }
149
+ await page.lifecycle.dispose();
150
+ if (typeof page.scope.dispose === "function") {
151
+ await page.scope.dispose();
152
+ }
153
+ for (const layout of page.layouts) {
154
+ if (layout.index < preservedDepth) continue;
155
+ await layout.ownLifecycle?.dispose();
156
+ if (layout.ownScope && typeof layout.ownScope.dispose === "function") {
157
+ await layout.ownScope.dispose();
158
+ }
159
+ }
160
+ }
161
+ async function disposePage(identity) {
162
+ if (!active || active.identity !== identity) return;
163
+ const ended = active;
164
+ active = null;
165
+ await endPage(ended);
166
+ }
167
+ async function transitionTo(entry) {
168
+ const view = catalog.resolve(entry.page);
169
+ const previous = active;
170
+ const depth = previous ? (0, import_layout_preservation.computePreservedLayoutDepth)(
171
+ { layoutPaths: previous.view.layouts, layoutControllers: previous.view.layoutControllers, layoutPreserve: previous.view.layoutPreserve },
172
+ { layoutPaths: view.layouts, layoutControllers: view.layoutControllers, layoutPreserve: view.layoutPreserve },
173
+ entry.options ?? {}
174
+ ) : 0;
175
+ const carried = previous ? previous.layouts.filter((layout) => layout.index < depth) : [];
176
+ const next = await constructPage(view, entry.params, entry.query, carried);
177
+ active = next;
178
+ if (previous) {
179
+ await endPage(previous, depth);
180
+ }
181
+ }
182
+ navigation.subscribe((entry) => {
183
+ if (!entry || transitioning || disposed) return;
184
+ if (active && entry.page === active.identity) return;
185
+ if (!active) return;
186
+ registry.track(transitionTo(entry), {
187
+ label: `navigate ${active.identity} -> ${entry.page}`,
188
+ kind: "navigation",
189
+ owner: currentOwner()
190
+ });
191
+ });
192
+ return {
193
+ navigation,
194
+ async open(openOptions) {
195
+ if (!openOptions || typeof openOptions.page !== "string" || !openOptions.page.length) {
196
+ throw new import_page_catalog.PageCatalogError("frontend.open() requires an explicit { page } identity");
197
+ }
198
+ if (active) {
199
+ throw new import_page_catalog.PageCatalogError(
200
+ `frontend.open() is test bootstrap; page "${active.identity}" is already open. Drive production navigation for subsequent route changes, or close() the page first.`
201
+ );
202
+ }
203
+ const view = catalog.resolve(openOptions.page);
204
+ const params = openOptions.params ?? {};
205
+ const query = openOptions.query ?? {};
206
+ transitioning = true;
207
+ try {
208
+ navigation.replace((0, import_page_catalog.pageIdentity)(view), params, query);
209
+ active = await constructPage(view, params, query);
210
+ } finally {
211
+ transitioning = false;
212
+ }
213
+ return active.handle.page;
214
+ },
215
+ current() {
216
+ return active ? active.handle.page : null;
217
+ },
218
+ async act(action) {
219
+ await registry.track(
220
+ Promise.resolve().then(() => action()).then(() => void 0),
221
+ { label: "act()", kind: "tracked", owner: currentOwner() }
222
+ ).catch(() => {
223
+ });
224
+ await registry.drain(flushHooks);
225
+ },
226
+ async settle() {
227
+ await registry.drain(flushHooks);
228
+ },
229
+ get errors() {
230
+ return registry.errors();
231
+ },
232
+ async dispose() {
233
+ if (disposed) return;
234
+ disposed = true;
235
+ if (active) {
236
+ const ended = active;
237
+ active = null;
238
+ await endPage(ended);
239
+ }
240
+ await application.dispose();
241
+ }
242
+ };
243
+ }
244
+ // Annotate the CommonJS export names for ESM import in node:
245
+ 0 && (module.exports = {
246
+ FrontendWorkError,
247
+ createFrontendSurface
248
+ });
249
+ //# sourceMappingURL=frontend_surface.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/frontend/frontend_surface.ts"],"sourcesContent":["/**\n * The Node frontend application surface (spec 18 §12–13, 18A D-FAS-01/02).\n *\n * frontend.open({ page, params, query }) — explicit initial page\n * frontend.current() — production navigation result\n * frontend.act(fn) / frontend.settle() — owned-work fixed-point drains\n * frontend.errors — observed owned-work failures\n *\n * Runtime honesty (D-FAS-02): this is the plain-Node tier. It proves\n * explicit PageController behavior, $state/$derived reachable through it,\n * backend calls, events, and navigation identity/lifecycle. It does not\n * create a Svelte component/root context and therefore proves no $effect,\n * mount/unmount, or DOM behavior — those belong to the happy-dom tier.\n *\n * Isolation: every environment owns its own Navigation instance, renderer\n * root, transport, and work registry. Nothing here writes globalThis and\n * nothing calls the production client getters — two environments run\n * concurrently without cross-talk. A controller that calls the module-level\n * `go()`/`getNavigation()` free functions bypasses its environment; this\n * tier requires constructor-injected `Navigation`.\n */\nimport { ExecutionContext, LoadAs } from '@noego/ioc';\nimport { Navigation, type NavigationEntry } from '../navigation/index.js';\nimport { computePreservedLayoutDepth } from '../navigation/layout_preservation.js';\nimport { disposeControllerLifecycle } from '../controller/controller_lifecycle.js';\nimport type { ViewDef } from '../types/index.cjs';\nimport { PageCatalog, PageCatalogError, pageIdentity } from './page_catalog.js';\nimport { WorkRegistry, FrontendWorkError, type WorkFailure } from './work_registry.js';\nimport { FrontendLifecycleOwner, type FrontendLifecycle } from './frontend_lifecycle.js';\nimport { createFrontendPage, type FrontendPage, type FrontendPageHandle, type MountedLayout } from './frontend_page.js';\n\nexport interface FrontendOpenOptions {\n /** Required production page identity (`window.page`, or unambiguous leaf). */\n page: string;\n params?: Record<string, string>;\n query?: Record<string, string>;\n}\n\nexport interface FrontendApplicationSurface {\n open(options: FrontendOpenOptions): Promise<FrontendPage>;\n current(): FrontendPage | null;\n act(action: () => unknown | Promise<unknown>): Promise<void>;\n settle(): Promise<void>;\n readonly errors: readonly WorkFailure[];\n /** The environment-local production Navigation instance. */\n readonly navigation: Navigation;\n /** Internal: dispose the active page and application lifecycles. */\n dispose(): Promise<void>;\n}\n\ninterface ScopeLike {\n extend(): ScopeLike;\n get(token: unknown): Promise<unknown>;\n registerClass?(target: unknown, options?: unknown): void;\n registerFunction?(token: unknown, factory: () => unknown, options?: unknown): void;\n registerValue?(token: unknown, value: unknown): void;\n dispose?(): Promise<void>;\n}\n\n/**\n * A mounted layout controller and the scope that owns it. A layout declared\n * `preserve: true` owns a DEDICATED scope that survives page transitions\n * (production parity: `createControllerSet`); every other layout shares the\n * page scope and dies with the page.\n */\ninterface ActiveLayout extends MountedLayout {\n index: number;\n /** Non-null only for a preserved layout that owns its scope. */\n ownScope: ScopeLike | null;\n /**\n * A preserved layout outlives the page that built it, so it cannot borrow\n * that page's lifecycle owner — it owns one, disposed when the layout is\n * finally dropped.\n */\n ownLifecycle: FrontendLifecycleOwner | null;\n}\n\ninterface ActivePage {\n identity: string;\n view: ViewDef;\n scope: ScopeLike;\n lifecycle: FrontendLifecycleOwner;\n handle: FrontendPageHandle;\n controller: unknown;\n layouts: ActiveLayout[];\n}\n\nexport interface PageScopeContext {\n kind: 'page' | 'layout';\n /** Layout index within the view's layout stack (layout scopes only). */\n layoutIndex?: number;\n /** Controller identity bound to this scope. */\n controller: string;\n}\n\nexport interface CreateFrontendSurfaceOptions {\n /** The selected renderer aperture. */\n catalog: PageCatalog;\n /** Fresh renderer root for this environment (separate from the main root). */\n rendererRoot: ScopeLike;\n registry: WorkRegistry;\n /** Environment-local Navigation (also registered on the renderer root). */\n navigation: Navigation;\n /** Resolve a production controller identity to its class. */\n resolveController: (identity: string, view: ViewDef) => Promise<new (...args: never[]) => unknown>;\n /** Per-pass reactive flush hooks from the active runtime adapter (Node: none). */\n flushHooks?: ReadonlyArray<() => void | Promise<void>>;\n /**\n * Register per-scope services on a newly created scope (bridge client,\n * etc.). Called for the page scope, and once for each PRESERVED layout\n * that owns a dedicated scope — `context.kind` says which, so a caller\n * that tracks \"the page scope\" does not mistake a layout scope for it.\n */\n configurePageScope?: (\n scope: ScopeLike,\n view: ViewDef,\n context: PageScopeContext,\n ) => void | Promise<void>;\n}\n\n/**\n * Plain (undecorated) controller classes are registered on their scope so\n * they resolve — unless the hierarchy already decided how the token resolves\n * (a renderer-root substitution of the controller class), which keeps\n * winning inside the page scope.\n */\nfunction registerControllerUnlessBound(scope: ScopeLike, ControllerClass: unknown): void {\n const registrable = scope as { isRegistered?(token: unknown): boolean };\n if (typeof registrable.isRegistered === 'function' && registrable.isRegistered(ControllerClass)) return;\n if (typeof scope.registerClass === 'function') scope.registerClass(ControllerClass);\n}\n\n/**\n * Make a controller's production teardown hook run at most once.\n *\n * Two owners legitimately end a controller: this surface (production\n * parity — the renderer's NavigationShell calls the hook explicitly, and\n * for a Transient controller that is the ONLY call) and IoC scope\n * disposal (which calls `dispose()`/`destroy()` on the scoped instances it\n * owns). Shadowing the hook with a once-guard means a controller sees the\n * same single teardown whichever way it was registered.\n */\nfunction guardControllerLifecycleOnce(instance: unknown): void {\n if (!instance || typeof instance !== 'object') return;\n const target = instance as Record<string, unknown>;\n for (const hook of ['dispose', 'destroy'] as const) {\n const original = target[hook];\n if (typeof original !== 'function') continue;\n if (Object.prototype.hasOwnProperty.call(target, hook)) continue;\n let called = false;\n Object.defineProperty(target, hook, {\n configurable: true,\n writable: true,\n enumerable: false,\n value: function guarded(this: unknown, ...args: unknown[]) {\n if (called) return undefined;\n called = true;\n return (original as (...rest: unknown[]) => unknown).apply(this, args);\n },\n });\n }\n}\n\nexport function createFrontendSurface(options: CreateFrontendSurfaceOptions): FrontendApplicationSurface {\n const { catalog, rendererRoot, registry, navigation } = options;\n const flushHooks = options.flushHooks ?? [];\n const application = new FrontendLifecycleOwner(registry, 'application');\n\n let active: ActivePage | null = null;\n let transitioning = false;\n let disposed = false;\n\n const currentOwner = (): string => (active ? `page ${active.identity}` : 'application');\n\n async function constructPage(\n view: ViewDef,\n params: Record<string, string>,\n query: Record<string, string>,\n preserved: ActiveLayout[] = [],\n ): Promise<ActivePage> {\n const identity = pageIdentity(view);\n if (!view.controller) {\n throw new PageCatalogError(\n `page \"${identity}\" declares no controller in its view definition; ` +\n 'the Node application slice drives public PageController input and needs one.',\n );\n }\n\n const ControllerClass = await options.resolveController(view.controller, view);\n const scope = rendererRoot.extend();\n const lifecycle = new FrontendLifecycleOwner(registry, `page ${identity}`);\n\n // The page lifecycle is injectable so controllers can register\n // deliberately detached finite work (D-FAS-01 §2.2). Scoped, not\n // Singleton: the lifecycle belongs to this page scope alone — a\n // Singleton would store at the hierarchy root and leak the first\n // page's lifecycle into every later page.\n scope.registerFunction?.(FrontendLifecycleOwner, () => lifecycle, { loadAs: LoadAs.Scoped });\n await options.configurePageScope?.(scope, view, {\n kind: 'page',\n controller: view.controller,\n });\n registerControllerUnlessBound(scope, ControllerClass);\n\n // Layout controllers mount BEFORE the view controller (production\n // ordering in `createControllerSet`): a page controller may legitimately\n // read state a layout controller published during construction.\n const layouts: ActiveLayout[] = [...preserved];\n for (let index = preserved.length; index < view.layouts.length; index += 1) {\n const layoutIdentity = view.layoutControllers?.[index];\n if (!layoutIdentity) continue;\n const preserve = view.layoutPreserve?.[index] === true;\n const LayoutClass = await options.resolveController(layoutIdentity, view);\n const ownScope = preserve ? rendererRoot.extend() : null;\n const ownLifecycle = ownScope\n ? new FrontendLifecycleOwner(registry, `layout ${layoutIdentity}`)\n : null;\n const layoutScope = ownScope ?? scope;\n if (ownScope) {\n ownScope.registerFunction?.(FrontendLifecycleOwner, () => ownLifecycle!, { loadAs: LoadAs.Scoped });\n await options.configurePageScope?.(ownScope, view, {\n kind: 'layout',\n layoutIndex: index,\n controller: layoutIdentity,\n });\n }\n registerControllerUnlessBound(layoutScope, LayoutClass);\n const instance = (await ExecutionContext.run(layoutScope as never, () =>\n layoutScope.get(LayoutClass),\n )) as Record<string, unknown>;\n guardControllerLifecycleOnce(instance);\n layouts.push({\n index,\n path: view.layouts[index],\n controller: layoutIdentity,\n preserve,\n instance,\n scope: layoutScope,\n ownScope,\n ownLifecycle,\n });\n }\n\n const controller = (await ExecutionContext.run(scope as never, () =>\n scope.get(ControllerClass),\n )) as Record<string, unknown>;\n\n guardControllerLifecycleOnce(controller);\n\n if (typeof controller.initialize === 'function') {\n await registry.track(\n Promise.resolve(\n ExecutionContext.run(scope as never, () =>\n (controller.initialize as (load: unknown) => unknown)({ params, query }),\n ),\n ).then(() => undefined),\n { label: `initialize ${identity}`, kind: 'initialize', owner: `page ${identity}` },\n );\n }\n\n const handle = createFrontendPage({\n identity,\n controller,\n scope,\n layouts,\n onClose: async () => {\n await disposePage(identity);\n },\n });\n\n return { identity, view, scope, lifecycle, handle, controller, layouts };\n }\n\n /**\n * End a page: the page lifecycle owner first (abort signal, owned\n * resources), then the IoC scopes — scope disposal is what runs each\n * controller's production `dispose()`/`destroy()` hook, so nothing here\n * calls those directly. Layouts in the preserved prefix keep running:\n * they belong to the next page now.\n */\n async function endPage(page: ActivePage, preservedDepth = 0): Promise<void> {\n page.handle.invalidate();\n // Production teardown order (NavigationShell.disposeControllerSet): the\n // page controller's hook, then each ending layout's, then the lifecycle\n // owner and the IoC scopes. The hooks are once-guarded, so the scope\n // disposal below does not run them a second time.\n await disposeControllerLifecycle(page.controller);\n for (const layout of page.layouts) {\n if (layout.index < preservedDepth) continue;\n await disposeControllerLifecycle(layout.instance);\n }\n await page.lifecycle.dispose();\n // Page scope first, then dropped preserved layouts — production's\n // disposeControllerSet order (view controller, then layouts).\n if (typeof page.scope.dispose === 'function') {\n await page.scope.dispose();\n }\n for (const layout of page.layouts) {\n if (layout.index < preservedDepth) continue;\n await layout.ownLifecycle?.dispose();\n if (layout.ownScope && typeof layout.ownScope.dispose === 'function') {\n await layout.ownScope.dispose();\n }\n }\n }\n\n async function disposePage(identity: string): Promise<void> {\n if (!active || active.identity !== identity) return;\n const ended = active;\n active = null;\n await endPage(ended);\n }\n\n async function transitionTo(entry: NavigationEntry): Promise<void> {\n // Resolve the destination through the selected aperture — navigation\n // outside it fails without widening the environment.\n const view = catalog.resolve(entry.page);\n const previous = active;\n // Preserved layouts carry over as live instances — the transition never\n // reconstructs them (production `preserve: true` semantics).\n // Same preservation rule the renderer's NavigationShell applies.\n const depth = previous\n ? computePreservedLayoutDepth(\n { layoutPaths: previous.view.layouts, layoutControllers: previous.view.layoutControllers, layoutPreserve: previous.view.layoutPreserve },\n { layoutPaths: view.layouts, layoutControllers: view.layoutControllers, layoutPreserve: view.layoutPreserve },\n entry.options ?? {},\n )\n : 0;\n const carried = previous ? previous.layouts.filter((layout) => layout.index < depth) : [];\n const next = await constructPage(view, entry.params, entry.query, carried);\n active = next;\n if (previous) {\n await endPage(previous, depth);\n }\n }\n\n // Production navigation drives page transitions: a controller calling its\n // injected Navigation.go()/replace() inside the aperture triggers one\n // tracked finite navigation transition (18A D-FAS-01 §2.2).\n navigation.subscribe((entry) => {\n if (!entry || transitioning || disposed) return;\n if (active && entry.page === active.identity) return;\n if (!active) return; // initial open() seeds navigation itself\n registry.track(transitionTo(entry), {\n label: `navigate ${active.identity} -> ${entry.page}`,\n kind: 'navigation',\n owner: currentOwner(),\n });\n });\n\n return {\n navigation,\n\n async open(openOptions: FrontendOpenOptions): Promise<FrontendPage> {\n if (!openOptions || typeof openOptions.page !== 'string' || !openOptions.page.length) {\n throw new PageCatalogError('frontend.open() requires an explicit { page } identity');\n }\n if (active) {\n throw new PageCatalogError(\n `frontend.open() is test bootstrap; page \"${active.identity}\" is already open. ` +\n 'Drive production navigation for subsequent route changes, or close() the page first.',\n );\n }\n const view = catalog.resolve(openOptions.page);\n const params = openOptions.params ?? {};\n const query = openOptions.query ?? {};\n\n transitioning = true;\n try {\n // Seed production navigation state BEFORE construction: controllers\n // and their services legitimately read the current route (params,\n // query) during construction/initialize, exactly as in production\n // where the route exists before the page loads.\n navigation.replace(pageIdentity(view), params, query);\n active = await constructPage(view, params, query);\n } finally {\n transitioning = false;\n }\n return active.handle.page;\n },\n\n current(): FrontendPage | null {\n return active ? active.handle.page : null;\n },\n\n async act(action: () => unknown | Promise<unknown>): Promise<void> {\n await registry.track(\n Promise.resolve().then(() => action()).then(() => undefined),\n { label: 'act()', kind: 'tracked', owner: currentOwner() },\n ).catch(() => {\n // The failure is recorded by the registry; drain reports it with\n // its owner rather than losing the aggregate view.\n });\n await registry.drain(flushHooks);\n },\n\n async settle(): Promise<void> {\n await registry.drain(flushHooks);\n },\n\n get errors(): readonly WorkFailure[] {\n return registry.errors();\n },\n\n async dispose(): Promise<void> {\n if (disposed) return;\n disposed = true;\n if (active) {\n const ended = active;\n active = null;\n // Environment teardown ends everything, preserved layouts included.\n await endPage(ended);\n }\n await application.dispose();\n },\n };\n}\n\nexport type { FrontendLifecycle };\nexport { FrontendWorkError };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA,iBAAyC;AAEzC,iCAA4C;AAC5C,kCAA2C;AAE3C,0BAA4D;AAC5D,2BAAkE;AAClE,gCA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A,MACF;AACA,YAAM,OAAO,QAAQ,QAAQ,YAAY,IAAI;AAC7C,YAAM,SAAS,YAAY,UAAU,CAAC;AACtC,YAAM,QAAQ,YAAY,SAAS,CAAC;AAEpC,sBAAgB;AAChB,UAAI;AAKF,mBAAW,YAAQ,kCAAa,IAAI,GAAG,QAAQ,KAAK;AACpD,iBAAS,MAAM,cAAc,MAAM,QAAQ,KAAK;AAAA,MAClD,UAAE;AACA,wBAAgB;AAAA,MAClB;AACA,aAAO,OAAO,OAAO;AAAA,IACvB;AAAA,IAEA,UAA+B;AAC7B,aAAO,SAAS,OAAO,OAAO,OAAO;AAAA,IACvC;AAAA,IAEA,MAAM,IAAI,QAAyD;AACjE,YAAM,SAAS;AAAA,QACb,QAAQ,QAAQ,EAAE,KAAK,MAAM,OAAO,CAAC,EAAE,KAAK,MAAM,MAAS;AAAA,QAC3D,EAAE,OAAO,SAAS,MAAM,WAAW,OAAO,aAAa,EAAE;AAAA,MAC3D,EAAE,MAAM,MAAM;AAAA,MAGd,CAAC;AACD,YAAM,SAAS,MAAM,UAAU;AAAA,IACjC;AAAA,IAEA,MAAM,SAAwB;AAC5B,YAAM,SAAS,MAAM,UAAU;AAAA,IACjC;AAAA,IAEA,IAAI,SAAiC;AACnC,aAAO,SAAS,OAAO;AAAA,IACzB;AAAA,IAEA,MAAM,UAAyB;AAC7B,UAAI,SAAU;AACd,iBAAW;AACX,UAAI,QAAQ;AACV,cAAM,QAAQ;AACd,iBAAS;AAET,cAAM,QAAQ,KAAK;AAAA,MACrB;AACA,YAAM,YAAY,QAAQ;AAAA,IAC5B;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,64 @@
1
+ import { Navigation } from '../navigation/index.cjs';
2
+ import { ViewDef } from '../types/views.cjs';
3
+ import { PageCatalog } from './page_catalog.cjs';
4
+ import { WorkRegistry, WorkFailure } from './work_registry.cjs';
5
+ export { FrontendWorkError } from './work_registry.cjs';
6
+ export { FrontendLifecycle } from './frontend_lifecycle.cjs';
7
+ import { FrontendPage } from './frontend_page.cjs';
8
+ import '../navigation/automation_introspection.cjs';
9
+
10
+ interface FrontendOpenOptions {
11
+ /** Required production page identity (`window.page`, or unambiguous leaf). */
12
+ page: string;
13
+ params?: Record<string, string>;
14
+ query?: Record<string, string>;
15
+ }
16
+ interface FrontendApplicationSurface {
17
+ open(options: FrontendOpenOptions): Promise<FrontendPage>;
18
+ current(): FrontendPage | null;
19
+ act(action: () => unknown | Promise<unknown>): Promise<void>;
20
+ settle(): Promise<void>;
21
+ readonly errors: readonly WorkFailure[];
22
+ /** The environment-local production Navigation instance. */
23
+ readonly navigation: Navigation;
24
+ /** Internal: dispose the active page and application lifecycles. */
25
+ dispose(): Promise<void>;
26
+ }
27
+ interface ScopeLike {
28
+ extend(): ScopeLike;
29
+ get(token: unknown): Promise<unknown>;
30
+ registerClass?(target: unknown, options?: unknown): void;
31
+ registerFunction?(token: unknown, factory: () => unknown, options?: unknown): void;
32
+ registerValue?(token: unknown, value: unknown): void;
33
+ dispose?(): Promise<void>;
34
+ }
35
+ interface PageScopeContext {
36
+ kind: 'page' | 'layout';
37
+ /** Layout index within the view's layout stack (layout scopes only). */
38
+ layoutIndex?: number;
39
+ /** Controller identity bound to this scope. */
40
+ controller: string;
41
+ }
42
+ interface CreateFrontendSurfaceOptions {
43
+ /** The selected renderer aperture. */
44
+ catalog: PageCatalog;
45
+ /** Fresh renderer root for this environment (separate from the main root). */
46
+ rendererRoot: ScopeLike;
47
+ registry: WorkRegistry;
48
+ /** Environment-local Navigation (also registered on the renderer root). */
49
+ navigation: Navigation;
50
+ /** Resolve a production controller identity to its class. */
51
+ resolveController: (identity: string, view: ViewDef) => Promise<new (...args: never[]) => unknown>;
52
+ /** Per-pass reactive flush hooks from the active runtime adapter (Node: none). */
53
+ flushHooks?: ReadonlyArray<() => void | Promise<void>>;
54
+ /**
55
+ * Register per-scope services on a newly created scope (bridge client,
56
+ * etc.). Called for the page scope, and once for each PRESERVED layout
57
+ * that owns a dedicated scope — `context.kind` says which, so a caller
58
+ * that tracks "the page scope" does not mistake a layout scope for it.
59
+ */
60
+ configurePageScope?: (scope: ScopeLike, view: ViewDef, context: PageScopeContext) => void | Promise<void>;
61
+ }
62
+ declare function createFrontendSurface(options: CreateFrontendSurfaceOptions): FrontendApplicationSurface;
63
+
64
+ export { type CreateFrontendSurfaceOptions, type FrontendApplicationSurface, type FrontendOpenOptions, type PageScopeContext, createFrontendSurface };