@omerdlw/base-framework 3.4.0 → 4.0.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 (840) hide show
  1. package/README.md +56 -72
  2. package/dist/ambient/index.js +9 -10
  3. package/dist/ambient/server/index.js +3 -3
  4. package/dist/ambient/server/index.js.map +1 -1
  5. package/dist/ambient/worker/index.js +7 -4
  6. package/dist/ambient/worker/index.js.map +1 -1
  7. package/dist/background/index.js +8 -9
  8. package/dist/{chunk-KOYTJW5E.js → chunk-3FSDBJ7V.js} +7 -7
  9. package/dist/chunk-3FSDBJ7V.js.map +1 -0
  10. package/dist/{chunk-CRKJAACG.js → chunk-4QQ3QVY7.js} +10 -10
  11. package/dist/{chunk-CRKJAACG.js.map → chunk-4QQ3QVY7.js.map} +1 -1
  12. package/dist/{chunk-UQLTP3XB.js → chunk-5TQSH6KE.js} +143 -144
  13. package/dist/chunk-5TQSH6KE.js.map +1 -0
  14. package/dist/{chunk-HFR6YROB.js → chunk-6P3F4JU3.js} +1160 -1172
  15. package/dist/chunk-6P3F4JU3.js.map +1 -0
  16. package/dist/chunk-AKPH5CEJ.js +357 -0
  17. package/dist/chunk-AKPH5CEJ.js.map +1 -0
  18. package/dist/{chunk-QGPRTUED.js → chunk-AWLK2I56.js} +35 -39
  19. package/dist/chunk-AWLK2I56.js.map +1 -0
  20. package/dist/{chunk-ZXRE2KZO.js → chunk-C3SEBNF5.js} +11 -15
  21. package/dist/chunk-C3SEBNF5.js.map +1 -0
  22. package/dist/{chunk-R4K6VAOK.js → chunk-C527JOJQ.js} +11 -18
  23. package/dist/chunk-C527JOJQ.js.map +1 -0
  24. package/dist/{chunk-VNSMNGWP.js → chunk-DMQKXBWO.js} +5 -5
  25. package/dist/{chunk-VNSMNGWP.js.map → chunk-DMQKXBWO.js.map} +1 -1
  26. package/dist/{chunk-IH3STE7W.js → chunk-ED32WLAD.js} +1168 -1215
  27. package/dist/chunk-ED32WLAD.js.map +1 -0
  28. package/dist/{chunk-67MOKJFZ.js → chunk-EXB7VFD3.js} +16 -16
  29. package/dist/chunk-EXB7VFD3.js.map +1 -0
  30. package/dist/chunk-FG2AKFXP.js +108 -0
  31. package/dist/chunk-FG2AKFXP.js.map +1 -0
  32. package/dist/chunk-GA5SZ6E2.js +17 -0
  33. package/dist/{chunk-AZ2ZDFNP.js.map → chunk-GA5SZ6E2.js.map} +1 -1
  34. package/dist/chunk-GG2ILNK2.js +44 -0
  35. package/dist/chunk-GG2ILNK2.js.map +1 -0
  36. package/dist/{chunk-6IP6YFQX.js → chunk-JA75E4BG.js} +21 -31
  37. package/dist/chunk-JA75E4BG.js.map +1 -0
  38. package/dist/{chunk-WQTMOUCA.js → chunk-JWUKAZ3A.js} +45 -67
  39. package/dist/chunk-JWUKAZ3A.js.map +1 -0
  40. package/dist/{chunk-LKYW4LH6.js → chunk-QZA5AIT6.js} +37 -47
  41. package/dist/chunk-QZA5AIT6.js.map +1 -0
  42. package/dist/{chunk-D222OCTV.js → chunk-S67HGKJ2.js} +49 -55
  43. package/dist/chunk-S67HGKJ2.js.map +1 -0
  44. package/dist/chunk-T53WFIZN.js +29 -0
  45. package/dist/chunk-T53WFIZN.js.map +1 -0
  46. package/dist/{chunk-RDYYP36I.js → chunk-TMKA5ZHO.js} +7 -6
  47. package/dist/chunk-TMKA5ZHO.js.map +1 -0
  48. package/dist/{chunk-XGAYTDSI.js → chunk-UWX7GCNX.js} +23 -26
  49. package/dist/chunk-UWX7GCNX.js.map +1 -0
  50. package/dist/{chunk-QRXDXAQI.js → chunk-WVED7PDH.js} +161 -165
  51. package/dist/chunk-WVED7PDH.js.map +1 -0
  52. package/dist/{chunk-FFJWJ4OB.js → chunk-XIFQMK2Z.js} +12317 -12355
  53. package/dist/chunk-XIFQMK2Z.js.map +1 -0
  54. package/dist/{chunk-BMFHS3GV.js → chunk-YHWA7FXX.js} +22 -12
  55. package/dist/chunk-YHWA7FXX.js.map +1 -0
  56. package/dist/{chunk-YZS2B6YE.js → chunk-YKHAFHB7.js} +9 -12
  57. package/dist/chunk-YKHAFHB7.js.map +1 -0
  58. package/dist/{chunk-GKAJ4EM2.js → chunk-ZQI4ZCVU.js} +83 -83
  59. package/dist/chunk-ZQI4ZCVU.js.map +1 -0
  60. package/dist/context-menu/index.js +13 -15
  61. package/dist/controls/index.js +7 -6
  62. package/dist/core/error/boundary.d.ts.map +1 -1
  63. package/dist/core/error/constants.d.ts +9 -0
  64. package/dist/core/error/constants.d.ts.map +1 -1
  65. package/dist/core/error/index.d.ts +2 -3
  66. package/dist/core/error/index.d.ts.map +1 -1
  67. package/dist/core/error/listener.d.ts.map +1 -1
  68. package/dist/core/error/reporter.d.ts +7 -6
  69. package/dist/core/error/reporter.d.ts.map +1 -1
  70. package/dist/core/error/utils.d.ts.map +1 -1
  71. package/dist/core/kernel/constants.d.ts +1 -1
  72. package/dist/core/kernel/constants.d.ts.map +1 -1
  73. package/dist/core/kernel/{compose.d.ts → host/compose.d.ts} +0 -4
  74. package/dist/core/kernel/host/compose.d.ts.map +1 -0
  75. package/dist/core/kernel/{installed.d.ts → host/installed.d.ts} +1 -1
  76. package/dist/core/kernel/host/installed.d.ts.map +1 -0
  77. package/dist/core/kernel/{module.d.ts → host/module.d.ts} +2 -5
  78. package/dist/core/kernel/host/module.d.ts.map +1 -0
  79. package/dist/core/kernel/{adapters.d.ts → host/registration.d.ts} +2 -2
  80. package/dist/core/kernel/host/registration.d.ts.map +1 -0
  81. package/dist/core/kernel/index.d.ts +12 -12
  82. package/dist/core/kernel/index.d.ts.map +1 -1
  83. package/dist/core/kernel/{page-controller.d.ts → page.d.ts} +2 -2
  84. package/dist/core/kernel/page.d.ts.map +1 -0
  85. package/dist/core/kernel/{handlers.d.ts → registry/apply.d.ts} +2 -2
  86. package/dist/core/kernel/registry/apply.d.ts.map +1 -0
  87. package/dist/core/kernel/{hooks.d.ts → registry/hooks.d.ts} +1 -1
  88. package/dist/core/kernel/registry/hooks.d.ts.map +1 -0
  89. package/dist/core/kernel/{operations.d.ts → registry/operations.d.ts} +2 -2
  90. package/dist/core/kernel/registry/operations.d.ts.map +1 -0
  91. package/dist/core/kernel/{provider.d.ts → registry/provider.d.ts} +2 -2
  92. package/dist/core/kernel/registry/provider.d.ts.map +1 -0
  93. package/dist/core/kernel/{operations-records.d.ts → registry/records.d.ts} +2 -2
  94. package/dist/core/kernel/registry/records.d.ts.map +1 -0
  95. package/dist/core/kernel/registry/registration.d.ts +13 -0
  96. package/dist/core/kernel/registry/registration.d.ts.map +1 -0
  97. package/dist/core/kernel/{schema.d.ts → registry/schema.d.ts} +1 -1
  98. package/dist/core/kernel/registry/schema.d.ts.map +1 -0
  99. package/dist/core/kernel/{store-snapshots.d.ts → registry/snapshots.d.ts} +3 -3
  100. package/dist/core/kernel/registry/snapshots.d.ts.map +1 -0
  101. package/dist/core/kernel/{stabilize.d.ts → registry/stabilize.d.ts} +1 -1
  102. package/dist/core/kernel/registry/stabilize.d.ts.map +1 -0
  103. package/dist/core/kernel/{store.d.ts → registry/store.d.ts} +2 -2
  104. package/dist/core/kernel/registry/store.d.ts.map +1 -0
  105. package/dist/core/kernel/{store-subscriptions.d.ts → registry/subscriptions.d.ts} +2 -6
  106. package/dist/core/kernel/registry/subscriptions.d.ts.map +1 -0
  107. package/dist/core/kernel/{runtime.d.ts → registry/transaction.d.ts} +2 -2
  108. package/dist/core/kernel/registry/transaction.d.ts.map +1 -0
  109. package/dist/core/kernel/{types-modules.d.ts → types/modules.d.ts} +4 -4
  110. package/dist/core/kernel/types/modules.d.ts.map +1 -0
  111. package/dist/core/kernel/{types-page.d.ts → types/page.d.ts} +3 -3
  112. package/dist/core/kernel/types/page.d.ts.map +1 -0
  113. package/dist/core/kernel/{types.d.ts → types/registry.d.ts} +4 -4
  114. package/dist/core/kernel/types/registry.d.ts.map +1 -0
  115. package/dist/core/kernel/{types-store.d.ts → types/store.d.ts} +3 -3
  116. package/dist/core/kernel/types/store.d.ts.map +1 -0
  117. package/dist/core/kernel/utils.d.ts +1 -1
  118. package/dist/core/kernel/utils.d.ts.map +1 -1
  119. package/dist/core/navigation/{navigator-holds.d.ts → holds.d.ts} +2 -1
  120. package/dist/core/navigation/holds.d.ts.map +1 -0
  121. package/dist/core/navigation/navigator.d.ts.map +1 -1
  122. package/dist/core/navigation/{navigator-patience.d.ts → patience.d.ts} +1 -1
  123. package/dist/core/navigation/patience.d.ts.map +1 -0
  124. package/dist/core/navigation/{navigator-payload.d.ts → payload.d.ts} +2 -1
  125. package/dist/core/navigation/payload.d.ts.map +1 -0
  126. package/dist/core/navigation/{navigator-prefetch.d.ts → prefetch.d.ts} +2 -1
  127. package/dist/core/navigation/prefetch.d.ts.map +1 -0
  128. package/dist/core/navigation/settings.d.ts.map +1 -1
  129. package/dist/core/navigation/state.d.ts.map +1 -1
  130. package/dist/core/navigation/utils.d.ts +3 -0
  131. package/dist/core/navigation/utils.d.ts.map +1 -1
  132. package/dist/core/provider/index.d.ts +4 -9
  133. package/dist/core/provider/index.d.ts.map +1 -1
  134. package/dist/dock/index.js +12 -14
  135. package/dist/error/index.js +4 -7
  136. package/dist/events/index.js +24 -20
  137. package/dist/events/index.js.map +1 -1
  138. package/dist/foundation/events/index.d.ts.map +1 -1
  139. package/dist/foundation/recipes/index.d.ts +0 -7
  140. package/dist/foundation/recipes/index.d.ts.map +1 -1
  141. package/dist/foundation/recipes/recipe.d.ts.map +1 -1
  142. package/dist/foundation/result/index.d.ts.map +1 -1
  143. package/dist/foundation/utils/collections.d.ts +11 -0
  144. package/dist/foundation/utils/collections.d.ts.map +1 -0
  145. package/dist/foundation/utils/dom.d.ts.map +1 -1
  146. package/dist/foundation/utils/report.d.ts.map +1 -1
  147. package/dist/foundation/utils/scheduler.d.ts.map +1 -1
  148. package/dist/foundation/utils/store.d.ts.map +1 -1
  149. package/dist/foundation/utils/string.d.ts.map +1 -1
  150. package/dist/foundation/utils/tempo.d.ts.map +1 -1
  151. package/dist/foundation/utils/timing.d.ts.map +1 -1
  152. package/dist/foundation/utils/user-message.d.ts.map +1 -1
  153. package/dist/hooks/index.js +3 -3
  154. package/dist/index.js +22 -24
  155. package/dist/kernel/index.js +4 -4
  156. package/dist/loading/index.js +6 -8
  157. package/dist/media/index.js +5 -5
  158. package/dist/modal/index.js +153 -166
  159. package/dist/modal/index.js.map +1 -1
  160. package/dist/modules/ambient/{analyze.d.ts → analysis/analyze.d.ts} +3 -3
  161. package/dist/modules/ambient/analysis/analyze.d.ts.map +1 -0
  162. package/dist/modules/ambient/{analyze-bounds.d.ts → analysis/bounds.d.ts} +2 -2
  163. package/dist/modules/ambient/analysis/bounds.d.ts.map +1 -0
  164. package/dist/modules/ambient/{analyze-clusters.d.ts → analysis/clusters.d.ts} +3 -3
  165. package/dist/modules/ambient/analysis/clusters.d.ts.map +1 -0
  166. package/dist/modules/ambient/{analyze-ground.d.ts → analysis/ground.d.ts} +3 -3
  167. package/dist/modules/ambient/analysis/ground.d.ts.map +1 -0
  168. package/dist/modules/ambient/{analyze-measures.d.ts → analysis/measures.d.ts} +2 -2
  169. package/dist/modules/ambient/analysis/measures.d.ts.map +1 -0
  170. package/dist/modules/ambient/{oklab.d.ts → analysis/oklab.d.ts} +1 -3
  171. package/dist/modules/ambient/analysis/oklab.d.ts.map +1 -0
  172. package/dist/modules/ambient/analysis/quantize.d.ts.map +1 -0
  173. package/dist/modules/ambient/{analyze-swatches.d.ts → analysis/swatches.d.ts} +3 -3
  174. package/dist/modules/ambient/analysis/swatches.d.ts.map +1 -0
  175. package/dist/modules/ambient/hooks.d.ts +0 -1
  176. package/dist/modules/ambient/hooks.d.ts.map +1 -1
  177. package/dist/modules/ambient/index.d.ts +2 -2
  178. package/dist/modules/ambient/index.d.ts.map +1 -1
  179. package/dist/modules/ambient/module.d.ts +0 -3
  180. package/dist/modules/ambient/module.d.ts.map +1 -1
  181. package/dist/modules/ambient/pipeline.d.ts +6 -5
  182. package/dist/modules/ambient/pipeline.d.ts.map +1 -1
  183. package/dist/modules/ambient/server/index.d.ts +2 -2
  184. package/dist/modules/ambient/server/index.d.ts.map +1 -1
  185. package/dist/modules/ambient/settings.d.ts +0 -2
  186. package/dist/modules/ambient/settings.d.ts.map +1 -1
  187. package/dist/modules/ambient/worker/index.d.ts.map +1 -1
  188. package/dist/modules/background/constants.d.ts +3 -1
  189. package/dist/modules/background/constants.d.ts.map +1 -1
  190. package/dist/modules/background/context.d.ts +1 -1
  191. package/dist/modules/background/context.d.ts.map +1 -1
  192. package/dist/modules/background/hooks.d.ts +929 -0
  193. package/dist/modules/background/hooks.d.ts.map +1 -1
  194. package/dist/modules/background/index.d.ts +6 -6
  195. package/dist/modules/background/index.d.ts.map +1 -1
  196. package/dist/modules/background/module.d.ts +1 -1
  197. package/dist/modules/background/module.d.ts.map +1 -1
  198. package/dist/modules/background/{hooks/use-native-video-model.d.ts → native-video.d.ts} +4 -8
  199. package/dist/modules/background/native-video.d.ts.map +1 -0
  200. package/dist/modules/background/overlay.d.ts.map +1 -0
  201. package/dist/modules/background/playback.d.ts.map +1 -0
  202. package/dist/modules/background/{model/state.d.ts → state.d.ts} +11 -1
  203. package/dist/modules/background/state.d.ts.map +1 -0
  204. package/dist/modules/background/{model/visual.d.ts → visual.d.ts} +43 -6
  205. package/dist/modules/background/visual.d.ts.map +1 -0
  206. package/dist/modules/background/youtube/audio.d.ts.map +1 -0
  207. package/dist/modules/background/youtube/iframe.d.ts +92 -0
  208. package/dist/modules/background/youtube/iframe.d.ts.map +1 -0
  209. package/dist/modules/background/youtube/{lib/parse.d.ts → parse.d.ts} +1 -1
  210. package/dist/modules/background/youtube/parse.d.ts.map +1 -0
  211. package/dist/modules/background/youtube/{components/player.d.ts → player.d.ts} +1 -1
  212. package/dist/modules/background/youtube/player.d.ts.map +1 -0
  213. package/dist/modules/background/youtube/{lib/timing.d.ts → timing.d.ts} +0 -2
  214. package/dist/modules/background/youtube/timing.d.ts.map +1 -0
  215. package/dist/modules/background/youtube/use-iframe-player.d.ts +37 -0
  216. package/dist/modules/background/youtube/use-iframe-player.d.ts.map +1 -0
  217. package/dist/modules/background/youtube/{hooks/use-youtube-background-player-model.d.ts → use-player.d.ts} +2 -2
  218. package/dist/modules/background/youtube/use-player.d.ts.map +1 -0
  219. package/dist/modules/background/youtube/{hooks/use-youtube-video-sync.d.ts → use-video-sync.d.ts} +8 -4
  220. package/dist/modules/background/youtube/use-video-sync.d.ts.map +1 -0
  221. package/dist/modules/background/youtube/{lib/video-events.d.ts → video-events.d.ts} +8 -8
  222. package/dist/modules/background/youtube/video-events.d.ts.map +1 -0
  223. package/dist/modules/context-menu/dom.d.ts.map +1 -1
  224. package/dist/modules/context-menu/items.d.ts.map +1 -1
  225. package/dist/modules/context-menu/overlay.d.ts +3 -10
  226. package/dist/modules/context-menu/overlay.d.ts.map +1 -1
  227. package/dist/modules/context-menu/resolver.d.ts.map +1 -1
  228. package/dist/modules/controls/overlay.d.ts +0 -10
  229. package/dist/modules/controls/overlay.d.ts.map +1 -1
  230. package/dist/modules/dock/{lib → card}/banner.d.ts +3 -16
  231. package/dist/modules/dock/card/banner.d.ts.map +1 -0
  232. package/dist/modules/dock/{components/card-item.d.ts → card/card.d.ts} +5 -2
  233. package/dist/modules/dock/card/card.d.ts.map +1 -0
  234. package/dist/modules/dock/card/compact.d.ts.map +1 -0
  235. package/dist/modules/dock/{components/item-content.d.ts → card/content.d.ts} +1 -1
  236. package/dist/modules/dock/card/content.d.ts.map +1 -0
  237. package/dist/modules/dock/card/header.d.ts +8 -0
  238. package/dist/modules/dock/card/header.d.ts.map +1 -0
  239. package/dist/modules/dock/{components → card}/icon.d.ts +1 -1
  240. package/dist/modules/dock/card/icon.d.ts.map +1 -0
  241. package/dist/modules/dock/{lib/card-item.d.ts → card/model.d.ts} +20 -2
  242. package/dist/modules/dock/card/model.d.ts.map +1 -0
  243. package/dist/modules/dock/{hooks/use-card-item-model.d.ts → card/use-card.d.ts} +44 -43
  244. package/dist/modules/dock/{hooks/use-card-item-model.d.ts.map → card/use-card.d.ts.map} +1 -1
  245. package/dist/modules/dock/commands/command-bar.d.ts.map +1 -0
  246. package/dist/modules/dock/{runtime/commands.d.ts → commands/registry.d.ts} +1 -1
  247. package/dist/modules/dock/commands/registry.d.ts.map +1 -0
  248. package/dist/modules/dock/constants.d.ts +4 -7
  249. package/dist/modules/dock/constants.d.ts.map +1 -1
  250. package/dist/modules/dock/context.d.ts +1 -1
  251. package/dist/modules/dock/context.d.ts.map +1 -1
  252. package/dist/modules/dock/hooks.d.ts +47 -0
  253. package/dist/modules/dock/hooks.d.ts.map +1 -0
  254. package/dist/modules/dock/{hud.d.ts → hud/hud.d.ts} +14 -7
  255. package/dist/modules/dock/hud/hud.d.ts.map +1 -0
  256. package/dist/modules/dock/{model/hud-definition.d.ts → hud/model.d.ts} +7 -1
  257. package/dist/modules/dock/hud/model.d.ts.map +1 -0
  258. package/dist/modules/dock/{components/hud-view.d.ts → hud/view.d.ts} +1 -1
  259. package/dist/modules/dock/hud/view.d.ts.map +1 -0
  260. package/dist/modules/dock/index.d.ts +22 -22
  261. package/dist/modules/dock/index.d.ts.map +1 -1
  262. package/dist/modules/dock/items/attention.d.ts +43 -0
  263. package/dist/modules/dock/items/attention.d.ts.map +1 -0
  264. package/dist/modules/dock/{runtime/model/items.d.ts → items/build.d.ts} +2 -2
  265. package/dist/modules/dock/items/build.d.ts.map +1 -0
  266. package/dist/modules/dock/{runtime → items}/display.d.ts +2 -5
  267. package/dist/modules/dock/items/display.d.ts.map +1 -0
  268. package/dist/modules/dock/items/operations.d.ts +22 -0
  269. package/dist/modules/dock/items/operations.d.ts.map +1 -0
  270. package/dist/modules/dock/{runtime → items}/pipeline.d.ts +1 -1
  271. package/dist/modules/dock/items/pipeline.d.ts.map +1 -0
  272. package/dist/modules/dock/{components/media-action.d.ts → media/controls.d.ts} +5 -2
  273. package/dist/modules/dock/media/controls.d.ts.map +1 -0
  274. package/dist/modules/dock/{lib/media.d.ts → media/model.d.ts} +1 -3
  275. package/dist/modules/dock/media/model.d.ts.map +1 -0
  276. package/dist/modules/dock/{components/media-scrubber.d.ts → media/scrubber.d.ts} +1 -1
  277. package/dist/modules/dock/media/scrubber.d.ts.map +1 -0
  278. package/dist/modules/dock/{hooks/use-media-controls-model.d.ts → media/use-controls.d.ts} +8 -8
  279. package/dist/modules/dock/media/use-controls.d.ts.map +1 -0
  280. package/dist/modules/dock/module.d.ts.map +1 -1
  281. package/dist/modules/dock/motion.d.ts +27 -28
  282. package/dist/modules/dock/motion.d.ts.map +1 -1
  283. package/dist/modules/dock/provider.d.ts.map +1 -1
  284. package/dist/modules/dock/routing/breadcrumbs-card.d.ts.map +1 -0
  285. package/dist/modules/dock/routing/{model/continuity.d.ts → continuity-state.d.ts} +2 -2
  286. package/dist/modules/dock/routing/continuity-state.d.ts.map +1 -0
  287. package/dist/modules/dock/routing/continuity.d.ts +8 -8
  288. package/dist/modules/dock/routing/continuity.d.ts.map +1 -1
  289. package/dist/modules/dock/routing/navigation.d.ts +0 -10
  290. package/dist/modules/dock/routing/navigation.d.ts.map +1 -1
  291. package/dist/modules/dock/routing/paths.d.ts.map +1 -0
  292. package/dist/modules/dock/routing/{model/policy.d.ts → policy.d.ts} +1 -1
  293. package/dist/modules/dock/routing/policy.d.ts.map +1 -0
  294. package/dist/modules/dock/routing/{hooks/use-route-prefetch.d.ts → prefetch.d.ts} +3 -3
  295. package/dist/modules/dock/routing/prefetch.d.ts.map +1 -0
  296. package/dist/modules/dock/routing/route-bridge.d.ts +8 -0
  297. package/dist/modules/dock/routing/route-bridge.d.ts.map +1 -0
  298. package/dist/modules/dock/routing/{model/topology.d.ts → topology.d.ts} +1 -1
  299. package/dist/modules/dock/routing/topology.d.ts.map +1 -0
  300. package/dist/modules/dock/{runtime/model → stack}/cards.d.ts +8 -5
  301. package/dist/modules/dock/stack/cards.d.ts.map +1 -0
  302. package/dist/modules/dock/stack/dock.d.ts.map +1 -0
  303. package/dist/modules/dock/stack/focus.d.ts +22 -0
  304. package/dist/modules/dock/stack/focus.d.ts.map +1 -0
  305. package/dist/modules/dock/{model → stack}/layout.d.ts +8 -2
  306. package/dist/modules/dock/stack/layout.d.ts.map +1 -0
  307. package/dist/modules/dock/{runtime/dock.d.ts → stack/use-dock-model.d.ts} +2 -1
  308. package/dist/modules/dock/stack/use-dock-model.d.ts.map +1 -0
  309. package/dist/modules/dock/{runtime/hooks → stack}/use-dock.d.ts +9 -9
  310. package/dist/modules/dock/stack/use-dock.d.ts.map +1 -0
  311. package/dist/modules/dock/stack/use-height.d.ts +12 -0
  312. package/dist/modules/dock/stack/use-height.d.ts.map +1 -0
  313. package/dist/modules/dock/{components/status-actions.d.ts → status/actions.d.ts} +1 -1
  314. package/dist/modules/dock/status/actions.d.ts.map +1 -0
  315. package/dist/modules/dock/status/events.d.ts +4 -4
  316. package/dist/modules/dock/status/events.d.ts.map +1 -1
  317. package/dist/modules/dock/status/hooks.d.ts.map +1 -1
  318. package/dist/modules/dock/status/model.d.ts +34 -4
  319. package/dist/modules/dock/status/model.d.ts.map +1 -1
  320. package/dist/modules/dock/surface/{model/builder.d.ts → builder.d.ts} +13 -7
  321. package/dist/modules/dock/surface/builder.d.ts.map +1 -0
  322. package/dist/modules/dock/{components/surface/item-content.d.ts → surface/content.d.ts} +2 -2
  323. package/dist/modules/dock/surface/content.d.ts.map +1 -0
  324. package/dist/modules/dock/surface/context.d.ts +12 -3
  325. package/dist/modules/dock/surface/context.d.ts.map +1 -1
  326. package/dist/modules/dock/surface/controls.d.ts +26 -0
  327. package/dist/modules/dock/surface/controls.d.ts.map +1 -0
  328. package/dist/modules/dock/surface/definition.d.ts.map +1 -1
  329. package/dist/modules/dock/{components/surface → surface}/extensions-bar.d.ts +1 -1
  330. package/dist/modules/dock/surface/extensions-bar.d.ts.map +1 -0
  331. package/dist/modules/dock/{components/surface/action.d.ts → surface/extensions.d.ts} +4 -2
  332. package/dist/modules/dock/surface/extensions.d.ts.map +1 -0
  333. package/dist/modules/dock/{components/surface → surface}/header-button.d.ts +3 -3
  334. package/dist/modules/dock/surface/header-button.d.ts.map +1 -0
  335. package/dist/modules/dock/surface/helpers.d.ts +13 -1
  336. package/dist/modules/dock/surface/helpers.d.ts.map +1 -1
  337. package/dist/modules/dock/surface/{model/normalize.d.ts → normalize.d.ts} +1 -1
  338. package/dist/modules/dock/surface/normalize.d.ts.map +1 -0
  339. package/dist/modules/dock/surface/runtime/choreography.d.ts +28 -2
  340. package/dist/modules/dock/surface/runtime/choreography.d.ts.map +1 -1
  341. package/dist/modules/dock/surface/runtime/flows.d.ts +1 -1
  342. package/dist/modules/dock/surface/runtime/flows.d.ts.map +1 -1
  343. package/dist/modules/dock/surface/{machine.d.ts → runtime/machine.d.ts} +1 -1
  344. package/dist/modules/dock/surface/runtime/machine.d.ts.map +1 -0
  345. package/dist/modules/dock/surface/runtime/open.d.ts +1 -2
  346. package/dist/modules/dock/surface/runtime/open.d.ts.map +1 -1
  347. package/dist/modules/dock/surface/{model → runtime}/records.d.ts +1 -1
  348. package/dist/modules/dock/surface/runtime/records.d.ts.map +1 -0
  349. package/dist/modules/dock/surface/{stack.d.ts → runtime/stack.d.ts} +10 -10
  350. package/dist/modules/dock/surface/runtime/stack.d.ts.map +1 -0
  351. package/dist/modules/dock/surface/runtime/steps.d.ts +1 -1
  352. package/dist/modules/dock/surface/runtime/steps.d.ts.map +1 -1
  353. package/dist/modules/dock/surface/{model/transition-state.d.ts → runtime/transition.d.ts} +1 -1
  354. package/dist/modules/dock/surface/runtime/transition.d.ts.map +1 -0
  355. package/dist/modules/dock/surface/runtime/url.d.ts.map +1 -0
  356. package/dist/modules/dock/surface/{hooks/use-surface-shell-model.d.ts → shell.d.ts} +9 -3
  357. package/dist/modules/dock/surface/shell.d.ts.map +1 -0
  358. package/dist/modules/dock/surface/{hooks/use-surface-flow.d.ts → use-flow.d.ts} +2 -2
  359. package/dist/modules/dock/surface/use-flow.d.ts.map +1 -0
  360. package/dist/modules/dock/surface/view-model.d.ts.map +1 -1
  361. package/dist/modules/dock/{lib/styles.d.ts → theme.d.ts} +22 -18
  362. package/dist/modules/dock/theme.d.ts.map +1 -0
  363. package/dist/modules/dock/types/card.d.ts +12 -3
  364. package/dist/modules/dock/types/card.d.ts.map +1 -1
  365. package/dist/modules/dock/types/index.d.ts +1 -1
  366. package/dist/modules/dock/types/index.d.ts.map +1 -1
  367. package/dist/modules/dock/types/surface.d.ts +2 -2
  368. package/dist/modules/dock/types/surface.d.ts.map +1 -1
  369. package/dist/modules/dock/{lib/helpers.d.ts → utils.d.ts} +10 -3
  370. package/dist/modules/dock/utils.d.ts.map +1 -0
  371. package/dist/modules/index.js +20 -22
  372. package/dist/modules/loading/hooks.d.ts +2 -1
  373. package/dist/modules/loading/hooks.d.ts.map +1 -1
  374. package/dist/modules/loading/state.d.ts.map +1 -1
  375. package/dist/modules/media/hooks.d.ts.map +1 -1
  376. package/dist/modules/media/playback.d.ts.map +1 -1
  377. package/dist/modules/modal/constants.d.ts +3 -1
  378. package/dist/modules/modal/constants.d.ts.map +1 -1
  379. package/dist/modules/modal/{components/modal-container.d.ts → container.d.ts} +2 -2
  380. package/dist/modules/modal/container.d.ts.map +1 -0
  381. package/dist/modules/modal/context.d.ts +5 -1
  382. package/dist/modules/modal/context.d.ts.map +1 -1
  383. package/dist/modules/modal/dom.d.ts.map +1 -0
  384. package/dist/modules/modal/hooks.d.ts +3 -2
  385. package/dist/modules/modal/hooks.d.ts.map +1 -1
  386. package/dist/modules/modal/index.d.ts +7 -7
  387. package/dist/modules/modal/index.d.ts.map +1 -1
  388. package/dist/modules/modal/{model/layout.d.ts → layout.d.ts} +1 -1
  389. package/dist/modules/modal/layout.d.ts.map +1 -0
  390. package/dist/modules/modal/module.d.ts +1 -1
  391. package/dist/modules/modal/module.d.ts.map +1 -1
  392. package/dist/modules/modal/overlay.d.ts.map +1 -0
  393. package/dist/modules/modal/state.d.ts +52 -0
  394. package/dist/modules/modal/state.d.ts.map +1 -0
  395. package/dist/modules/navigation/hooks.d.ts.map +1 -1
  396. package/dist/modules/notification/hooks.d.ts.map +1 -1
  397. package/dist/modules/notification/overlay.d.ts +0 -1
  398. package/dist/modules/notification/overlay.d.ts.map +1 -1
  399. package/dist/navigation/index.js +33 -41
  400. package/dist/navigation/index.js.map +1 -1
  401. package/dist/notification/index.js +8 -7
  402. package/dist/overlay-ZCMQVNYT.js +12 -0
  403. package/dist/{overlay-7QLGWHCH.js.map → overlay-ZCMQVNYT.js.map} +1 -1
  404. package/dist/provider/index.js +7 -11
  405. package/dist/react/hooks/index.d.ts +3 -1
  406. package/dist/react/hooks/index.d.ts.map +1 -1
  407. package/dist/react/hooks/use-client-value.d.ts +15 -0
  408. package/dist/react/hooks/use-client-value.d.ts.map +1 -0
  409. package/dist/react/hooks/use-controllable-state.d.ts +8 -1
  410. package/dist/react/hooks/use-controllable-state.d.ts.map +1 -1
  411. package/dist/react/hooks/use-fullscreen-state.d.ts +0 -2
  412. package/dist/react/hooks/use-fullscreen-state.d.ts.map +1 -1
  413. package/dist/react/hooks/use-global-event.d.ts +7 -1
  414. package/dist/react/hooks/use-global-event.d.ts.map +1 -1
  415. package/dist/react/hooks/use-hotkey.d.ts +9 -1
  416. package/dist/react/hooks/use-hotkey.d.ts.map +1 -1
  417. package/dist/react/hooks/use-scroll-lock.d.ts.map +1 -1
  418. package/dist/react/hooks/use-store.d.ts +3 -0
  419. package/dist/react/hooks/use-store.d.ts.map +1 -1
  420. package/dist/react/theme/index.d.ts +7 -2
  421. package/dist/react/theme/index.d.ts.map +1 -1
  422. package/dist/react/theme/parts.d.ts +89 -0
  423. package/dist/react/theme/parts.d.ts.map +1 -0
  424. package/dist/recipes/index.js +6 -121
  425. package/dist/recipes/index.js.map +1 -1
  426. package/dist/result/index.js +12 -15
  427. package/dist/result/index.js.map +1 -1
  428. package/dist/theme/index.js +2 -2
  429. package/dist/utils/index.js +31 -34
  430. package/dist/utils/index.js.map +1 -1
  431. package/docs/README.md +11 -12
  432. package/docs/architecture-and-rules.md +43 -32
  433. package/docs/core-engine.md +11 -13
  434. package/docs/custom-modules.md +1 -1
  435. package/docs/design.md +60 -153
  436. package/docs/getting-started.md +3 -5
  437. package/docs/modules/README.md +16 -16
  438. package/docs/modules/ambient.md +23 -23
  439. package/docs/modules/background.md +24 -19
  440. package/docs/modules/context-menu.md +1 -1
  441. package/docs/modules/dock.md +47 -43
  442. package/docs/modules/error-boundary.md +2 -3
  443. package/docs/modules/kernel.md +28 -30
  444. package/docs/modules/loading.md +1 -1
  445. package/docs/modules/modal.md +17 -16
  446. package/docs/modules/navigation.md +14 -14
  447. package/docs/testing.md +1 -1
  448. package/package.json +1 -8
  449. package/templates/AGENTS.md +4 -3
  450. package/MIGRATION.md +0 -99
  451. package/dist/chunk-67MOKJFZ.js.map +0 -1
  452. package/dist/chunk-6IP6YFQX.js.map +0 -1
  453. package/dist/chunk-7VU2OAJB.js +0 -464
  454. package/dist/chunk-7VU2OAJB.js.map +0 -1
  455. package/dist/chunk-AZ2ZDFNP.js +0 -17
  456. package/dist/chunk-BMFHS3GV.js.map +0 -1
  457. package/dist/chunk-D222OCTV.js.map +0 -1
  458. package/dist/chunk-ESD5EQ5H.js +0 -178
  459. package/dist/chunk-ESD5EQ5H.js.map +0 -1
  460. package/dist/chunk-FFJWJ4OB.js.map +0 -1
  461. package/dist/chunk-GKAJ4EM2.js.map +0 -1
  462. package/dist/chunk-HFR6YROB.js.map +0 -1
  463. package/dist/chunk-IH3STE7W.js.map +0 -1
  464. package/dist/chunk-KOYTJW5E.js.map +0 -1
  465. package/dist/chunk-LKYW4LH6.js.map +0 -1
  466. package/dist/chunk-QGPRTUED.js.map +0 -1
  467. package/dist/chunk-QRXDXAQI.js.map +0 -1
  468. package/dist/chunk-R4K6VAOK.js.map +0 -1
  469. package/dist/chunk-RDYYP36I.js.map +0 -1
  470. package/dist/chunk-RGC2VFQO.js +0 -139
  471. package/dist/chunk-RGC2VFQO.js.map +0 -1
  472. package/dist/chunk-TAWTGCWJ.js +0 -113
  473. package/dist/chunk-TAWTGCWJ.js.map +0 -1
  474. package/dist/chunk-UDJ7ARCH.js +0 -140
  475. package/dist/chunk-UDJ7ARCH.js.map +0 -1
  476. package/dist/chunk-UQLTP3XB.js.map +0 -1
  477. package/dist/chunk-WQTMOUCA.js.map +0 -1
  478. package/dist/chunk-WZ5T2NXH.js +0 -702
  479. package/dist/chunk-WZ5T2NXH.js.map +0 -1
  480. package/dist/chunk-XGAYTDSI.js.map +0 -1
  481. package/dist/chunk-YZS2B6YE.js.map +0 -1
  482. package/dist/chunk-ZXRE2KZO.js.map +0 -1
  483. package/dist/core/error/theme.d.ts +0 -10
  484. package/dist/core/error/theme.d.ts.map +0 -1
  485. package/dist/core/kernel/adapters.d.ts.map +0 -1
  486. package/dist/core/kernel/compose.d.ts.map +0 -1
  487. package/dist/core/kernel/handlers.d.ts.map +0 -1
  488. package/dist/core/kernel/hooks.d.ts.map +0 -1
  489. package/dist/core/kernel/installed.d.ts.map +0 -1
  490. package/dist/core/kernel/module.d.ts.map +0 -1
  491. package/dist/core/kernel/operations-records.d.ts.map +0 -1
  492. package/dist/core/kernel/operations-resolve.d.ts +0 -5
  493. package/dist/core/kernel/operations-resolve.d.ts.map +0 -1
  494. package/dist/core/kernel/operations.d.ts.map +0 -1
  495. package/dist/core/kernel/page-controller.d.ts.map +0 -1
  496. package/dist/core/kernel/provider.d.ts.map +0 -1
  497. package/dist/core/kernel/runtime.d.ts.map +0 -1
  498. package/dist/core/kernel/schema.d.ts.map +0 -1
  499. package/dist/core/kernel/stabilize.d.ts.map +0 -1
  500. package/dist/core/kernel/store-batch.d.ts +0 -17
  501. package/dist/core/kernel/store-batch.d.ts.map +0 -1
  502. package/dist/core/kernel/store-entries.d.ts +0 -6
  503. package/dist/core/kernel/store-entries.d.ts.map +0 -1
  504. package/dist/core/kernel/store-handles.d.ts +0 -4
  505. package/dist/core/kernel/store-handles.d.ts.map +0 -1
  506. package/dist/core/kernel/store-registration.d.ts +0 -14
  507. package/dist/core/kernel/store-registration.d.ts.map +0 -1
  508. package/dist/core/kernel/store-snapshots.d.ts.map +0 -1
  509. package/dist/core/kernel/store-subscriptions.d.ts.map +0 -1
  510. package/dist/core/kernel/store.d.ts.map +0 -1
  511. package/dist/core/kernel/types-modules.d.ts.map +0 -1
  512. package/dist/core/kernel/types-page.d.ts.map +0 -1
  513. package/dist/core/kernel/types-store.d.ts.map +0 -1
  514. package/dist/core/kernel/types.d.ts.map +0 -1
  515. package/dist/core/navigation/navigator-defaults.d.ts +0 -4
  516. package/dist/core/navigation/navigator-defaults.d.ts.map +0 -1
  517. package/dist/core/navigation/navigator-holds.d.ts.map +0 -1
  518. package/dist/core/navigation/navigator-patience.d.ts.map +0 -1
  519. package/dist/core/navigation/navigator-payload.d.ts.map +0 -1
  520. package/dist/core/navigation/navigator-prefetch.d.ts.map +0 -1
  521. package/dist/foundation/recipes/anatomy.d.ts +0 -139
  522. package/dist/foundation/recipes/anatomy.d.ts.map +0 -1
  523. package/dist/foundation/recipes/define.d.ts +0 -133
  524. package/dist/foundation/recipes/define.d.ts.map +0 -1
  525. package/dist/modules/ambient/analyze-bounds.d.ts.map +0 -1
  526. package/dist/modules/ambient/analyze-clusters.d.ts.map +0 -1
  527. package/dist/modules/ambient/analyze-ground.d.ts.map +0 -1
  528. package/dist/modules/ambient/analyze-measures.d.ts.map +0 -1
  529. package/dist/modules/ambient/analyze-swatches.d.ts.map +0 -1
  530. package/dist/modules/ambient/analyze.d.ts.map +0 -1
  531. package/dist/modules/ambient/oklab.d.ts.map +0 -1
  532. package/dist/modules/ambient/quantize.d.ts.map +0 -1
  533. package/dist/modules/background/components/background-gradients.d.ts +0 -8
  534. package/dist/modules/background/components/background-gradients.d.ts.map +0 -1
  535. package/dist/modules/background/components/edge-gradient.d.ts +0 -9
  536. package/dist/modules/background/components/edge-gradient.d.ts.map +0 -1
  537. package/dist/modules/background/components/native-video.d.ts +0 -4
  538. package/dist/modules/background/components/native-video.d.ts.map +0 -1
  539. package/dist/modules/background/components/noise-overlay.d.ts +0 -11
  540. package/dist/modules/background/components/noise-overlay.d.ts.map +0 -1
  541. package/dist/modules/background/components/overlay.d.ts.map +0 -1
  542. package/dist/modules/background/components/solid-overlay.d.ts +0 -10
  543. package/dist/modules/background/components/solid-overlay.d.ts.map +0 -1
  544. package/dist/modules/background/hooks/use-background-media-source.d.ts +0 -4
  545. package/dist/modules/background/hooks/use-background-media-source.d.ts.map +0 -1
  546. package/dist/modules/background/hooks/use-background-motion-model.d.ts +0 -15
  547. package/dist/modules/background/hooks/use-background-motion-model.d.ts.map +0 -1
  548. package/dist/modules/background/hooks/use-background-overlay-model.d.ts +0 -929
  549. package/dist/modules/background/hooks/use-background-overlay-model.d.ts.map +0 -1
  550. package/dist/modules/background/hooks/use-native-video-model.d.ts.map +0 -1
  551. package/dist/modules/background/lib/theme.d.ts +0 -4
  552. package/dist/modules/background/lib/theme.d.ts.map +0 -1
  553. package/dist/modules/background/model/override.d.ts +0 -14
  554. package/dist/modules/background/model/override.d.ts.map +0 -1
  555. package/dist/modules/background/model/playback.d.ts.map +0 -1
  556. package/dist/modules/background/model/state.d.ts.map +0 -1
  557. package/dist/modules/background/model/video-frame.d.ts +0 -31
  558. package/dist/modules/background/model/video-frame.d.ts.map +0 -1
  559. package/dist/modules/background/model/visual.d.ts.map +0 -1
  560. package/dist/modules/background/youtube/components/player.d.ts.map +0 -1
  561. package/dist/modules/background/youtube/hooks/use-youtube-background-player-model.d.ts.map +0 -1
  562. package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts +0 -20
  563. package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts.map +0 -1
  564. package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts +0 -8
  565. package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts.map +0 -1
  566. package/dist/modules/background/youtube/hooks/use-youtube-video-sync.d.ts.map +0 -1
  567. package/dist/modules/background/youtube/lib/audio.d.ts.map +0 -1
  568. package/dist/modules/background/youtube/lib/iframe-engine.d.ts +0 -29
  569. package/dist/modules/background/youtube/lib/iframe-engine.d.ts.map +0 -1
  570. package/dist/modules/background/youtube/lib/iframe-proxy.d.ts +0 -47
  571. package/dist/modules/background/youtube/lib/iframe-proxy.d.ts.map +0 -1
  572. package/dist/modules/background/youtube/lib/iframe.d.ts +0 -47
  573. package/dist/modules/background/youtube/lib/iframe.d.ts.map +0 -1
  574. package/dist/modules/background/youtube/lib/parse.d.ts.map +0 -1
  575. package/dist/modules/background/youtube/lib/timing.d.ts.map +0 -1
  576. package/dist/modules/background/youtube/lib/video-events.d.ts.map +0 -1
  577. package/dist/modules/dock/components/badge.d.ts +0 -5
  578. package/dist/modules/dock/components/badge.d.ts.map +0 -1
  579. package/dist/modules/dock/components/breadcrumbs-card.d.ts.map +0 -1
  580. package/dist/modules/dock/components/card-banner.d.ts +0 -4
  581. package/dist/modules/dock/components/card-banner.d.ts.map +0 -1
  582. package/dist/modules/dock/components/card-header.d.ts +0 -4
  583. package/dist/modules/dock/components/card-header.d.ts.map +0 -1
  584. package/dist/modules/dock/components/card-item.d.ts.map +0 -1
  585. package/dist/modules/dock/components/command-bar.d.ts.map +0 -1
  586. package/dist/modules/dock/components/compact.d.ts.map +0 -1
  587. package/dist/modules/dock/components/description.d.ts +0 -4
  588. package/dist/modules/dock/components/description.d.ts.map +0 -1
  589. package/dist/modules/dock/components/dock.d.ts.map +0 -1
  590. package/dist/modules/dock/components/hud-view.d.ts.map +0 -1
  591. package/dist/modules/dock/components/icon.d.ts.map +0 -1
  592. package/dist/modules/dock/components/item-content.d.ts.map +0 -1
  593. package/dist/modules/dock/components/media-action.d.ts.map +0 -1
  594. package/dist/modules/dock/components/media-controls.d.ts +0 -4
  595. package/dist/modules/dock/components/media-controls.d.ts.map +0 -1
  596. package/dist/modules/dock/components/media-scrubber.d.ts.map +0 -1
  597. package/dist/modules/dock/components/status-actions.d.ts.map +0 -1
  598. package/dist/modules/dock/components/surface/action.d.ts.map +0 -1
  599. package/dist/modules/dock/components/surface/controls.d.ts +0 -12
  600. package/dist/modules/dock/components/surface/controls.d.ts.map +0 -1
  601. package/dist/modules/dock/components/surface/extensions-bar.d.ts.map +0 -1
  602. package/dist/modules/dock/components/surface/header-button.d.ts.map +0 -1
  603. package/dist/modules/dock/components/surface/item-content.d.ts.map +0 -1
  604. package/dist/modules/dock/components/surface/shell.d.ts +0 -3
  605. package/dist/modules/dock/components/surface/shell.d.ts.map +0 -1
  606. package/dist/modules/dock/components/title.d.ts +0 -4
  607. package/dist/modules/dock/components/title.d.ts.map +0 -1
  608. package/dist/modules/dock/hooks/use-action-slot.d.ts +0 -6
  609. package/dist/modules/dock/hooks/use-action-slot.d.ts.map +0 -1
  610. package/dist/modules/dock/hooks/use-badge.d.ts +0 -4
  611. package/dist/modules/dock/hooks/use-badge.d.ts.map +0 -1
  612. package/dist/modules/dock/hooks/use-card-banner-model.d.ts +0 -18
  613. package/dist/modules/dock/hooks/use-card-banner-model.d.ts.map +0 -1
  614. package/dist/modules/dock/hooks/use-card-header-model.d.ts +0 -7
  615. package/dist/modules/dock/hooks/use-card-header-model.d.ts.map +0 -1
  616. package/dist/modules/dock/hooks/use-command-bar-model.d.ts +0 -12
  617. package/dist/modules/dock/hooks/use-command-bar-model.d.ts.map +0 -1
  618. package/dist/modules/dock/hooks/use-dock-banner.d.ts +0 -11
  619. package/dist/modules/dock/hooks/use-dock-banner.d.ts.map +0 -1
  620. package/dist/modules/dock/hooks/use-dock-config.d.ts +0 -19
  621. package/dist/modules/dock/hooks/use-dock-config.d.ts.map +0 -1
  622. package/dist/modules/dock/hooks/use-dock-dimensions.d.ts +0 -7
  623. package/dist/modules/dock/hooks/use-dock-dimensions.d.ts.map +0 -1
  624. package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts +0 -7
  625. package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts.map +0 -1
  626. package/dist/modules/dock/hooks/use-dock-height-controller.d.ts +0 -6
  627. package/dist/modules/dock/hooks/use-dock-height-controller.d.ts.map +0 -1
  628. package/dist/modules/dock/hooks/use-dock-keyboard.d.ts +0 -11
  629. package/dist/modules/dock/hooks/use-dock-keyboard.d.ts.map +0 -1
  630. package/dist/modules/dock/hooks/use-dock-registration.d.ts +0 -8
  631. package/dist/modules/dock/hooks/use-dock-registration.d.ts.map +0 -1
  632. package/dist/modules/dock/hooks/use-dock-route-reset.d.ts +0 -2
  633. package/dist/modules/dock/hooks/use-dock-route-reset.d.ts.map +0 -1
  634. package/dist/modules/dock/hooks/use-dock-theme.d.ts +0 -6
  635. package/dist/modules/dock/hooks/use-dock-theme.d.ts.map +0 -1
  636. package/dist/modules/dock/hooks/use-dock-viewport.d.ts +0 -6
  637. package/dist/modules/dock/hooks/use-dock-viewport.d.ts.map +0 -1
  638. package/dist/modules/dock/hooks/use-element-height.d.ts +0 -3
  639. package/dist/modules/dock/hooks/use-element-height.d.ts.map +0 -1
  640. package/dist/modules/dock/hooks/use-hud-registry.d.ts +0 -16
  641. package/dist/modules/dock/hooks/use-hud-registry.d.ts.map +0 -1
  642. package/dist/modules/dock/hooks/use-hud-view-model.d.ts +0 -9
  643. package/dist/modules/dock/hooks/use-hud-view-model.d.ts.map +0 -1
  644. package/dist/modules/dock/hooks/use-media-controls-model.d.ts.map +0 -1
  645. package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts +0 -27
  646. package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts.map +0 -1
  647. package/dist/modules/dock/hooks/use-pending-skeleton.d.ts +0 -7
  648. package/dist/modules/dock/hooks/use-pending-skeleton.d.ts.map +0 -1
  649. package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts +0 -12
  650. package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts.map +0 -1
  651. package/dist/modules/dock/hooks/use-surface-return.d.ts +0 -8
  652. package/dist/modules/dock/hooks/use-surface-return.d.ts.map +0 -1
  653. package/dist/modules/dock/hud.d.ts.map +0 -1
  654. package/dist/modules/dock/lib/banner.d.ts.map +0 -1
  655. package/dist/modules/dock/lib/card-item.d.ts.map +0 -1
  656. package/dist/modules/dock/lib/card.d.ts +0 -20
  657. package/dist/modules/dock/lib/card.d.ts.map +0 -1
  658. package/dist/modules/dock/lib/command-bar.d.ts +0 -8
  659. package/dist/modules/dock/lib/command-bar.d.ts.map +0 -1
  660. package/dist/modules/dock/lib/dom.d.ts +0 -7
  661. package/dist/modules/dock/lib/dom.d.ts.map +0 -1
  662. package/dist/modules/dock/lib/element-helpers.d.ts +0 -8
  663. package/dist/modules/dock/lib/element-helpers.d.ts.map +0 -1
  664. package/dist/modules/dock/lib/helpers.d.ts.map +0 -1
  665. package/dist/modules/dock/lib/media.d.ts.map +0 -1
  666. package/dist/modules/dock/lib/styles.d.ts.map +0 -1
  667. package/dist/modules/dock/model/hud-definition.d.ts.map +0 -1
  668. package/dist/modules/dock/model/hud.d.ts +0 -10
  669. package/dist/modules/dock/model/hud.d.ts.map +0 -1
  670. package/dist/modules/dock/model/layout.d.ts.map +0 -1
  671. package/dist/modules/dock/model/page-entry.d.ts +0 -11
  672. package/dist/modules/dock/model/page-entry.d.ts.map +0 -1
  673. package/dist/modules/dock/model/page-surface.d.ts +0 -4
  674. package/dist/modules/dock/model/page-surface.d.ts.map +0 -1
  675. package/dist/modules/dock/model/paths.d.ts.map +0 -1
  676. package/dist/modules/dock/model/state.d.ts +0 -28
  677. package/dist/modules/dock/model/state.d.ts.map +0 -1
  678. package/dist/modules/dock/model/surface-return.d.ts +0 -14
  679. package/dist/modules/dock/model/surface-return.d.ts.map +0 -1
  680. package/dist/modules/dock/routing/hooks/use-route-prefetch.d.ts.map +0 -1
  681. package/dist/modules/dock/routing/lib/restore.d.ts +0 -7
  682. package/dist/modules/dock/routing/lib/restore.d.ts.map +0 -1
  683. package/dist/modules/dock/routing/model/continuity.d.ts.map +0 -1
  684. package/dist/modules/dock/routing/model/policy.d.ts.map +0 -1
  685. package/dist/modules/dock/routing/model/topology.d.ts.map +0 -1
  686. package/dist/modules/dock/runtime/commands.d.ts.map +0 -1
  687. package/dist/modules/dock/runtime/display.d.ts.map +0 -1
  688. package/dist/modules/dock/runtime/dock.d.ts.map +0 -1
  689. package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts +0 -10
  690. package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts.map +0 -1
  691. package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts +0 -10
  692. package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts.map +0 -1
  693. package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts +0 -14
  694. package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts.map +0 -1
  695. package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts +0 -7
  696. package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts.map +0 -1
  697. package/dist/modules/dock/runtime/hooks/use-dock.d.ts.map +0 -1
  698. package/dist/modules/dock/runtime/model/attention.d.ts +0 -25
  699. package/dist/modules/dock/runtime/model/attention.d.ts.map +0 -1
  700. package/dist/modules/dock/runtime/model/cards.d.ts.map +0 -1
  701. package/dist/modules/dock/runtime/model/items.d.ts.map +0 -1
  702. package/dist/modules/dock/runtime/model/layout.d.ts +0 -10
  703. package/dist/modules/dock/runtime/model/layout.d.ts.map +0 -1
  704. package/dist/modules/dock/runtime/pipeline.d.ts.map +0 -1
  705. package/dist/modules/dock/runtime/provider-actions.d.ts +0 -38
  706. package/dist/modules/dock/runtime/provider-actions.d.ts.map +0 -1
  707. package/dist/modules/dock/status/action-options.d.ts +0 -35
  708. package/dist/modules/dock/status/action-options.d.ts.map +0 -1
  709. package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts +0 -5
  710. package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts.map +0 -1
  711. package/dist/modules/dock/surface/components/surface-flow-provider.d.ts +0 -7
  712. package/dist/modules/dock/surface/components/surface-flow-provider.d.ts.map +0 -1
  713. package/dist/modules/dock/surface/constants.d.ts +0 -5
  714. package/dist/modules/dock/surface/constants.d.ts.map +0 -1
  715. package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts +0 -15
  716. package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts.map +0 -1
  717. package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts +0 -7
  718. package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts.map +0 -1
  719. package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts +0 -14
  720. package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts.map +0 -1
  721. package/dist/modules/dock/surface/hooks/use-surface-flow.d.ts.map +0 -1
  722. package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts +0 -13
  723. package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts.map +0 -1
  724. package/dist/modules/dock/surface/hooks/use-surface-shell-model.d.ts.map +0 -1
  725. package/dist/modules/dock/surface/lib/drag.d.ts +0 -9
  726. package/dist/modules/dock/surface/lib/drag.d.ts.map +0 -1
  727. package/dist/modules/dock/surface/lib/target.d.ts +0 -8
  728. package/dist/modules/dock/surface/lib/target.d.ts.map +0 -1
  729. package/dist/modules/dock/surface/machine.d.ts.map +0 -1
  730. package/dist/modules/dock/surface/model/builder.d.ts.map +0 -1
  731. package/dist/modules/dock/surface/model/normalize.d.ts.map +0 -1
  732. package/dist/modules/dock/surface/model/open.d.ts +0 -26
  733. package/dist/modules/dock/surface/model/open.d.ts.map +0 -1
  734. package/dist/modules/dock/surface/model/records.d.ts.map +0 -1
  735. package/dist/modules/dock/surface/model/steps.d.ts +0 -9
  736. package/dist/modules/dock/surface/model/steps.d.ts.map +0 -1
  737. package/dist/modules/dock/surface/model/transition-state.d.ts.map +0 -1
  738. package/dist/modules/dock/surface/model/url.d.ts.map +0 -1
  739. package/dist/modules/dock/surface/runtime/context.d.ts +0 -29
  740. package/dist/modules/dock/surface/runtime/context.d.ts.map +0 -1
  741. package/dist/modules/dock/surface/runtime/release.d.ts +0 -9
  742. package/dist/modules/dock/surface/runtime/release.d.ts.map +0 -1
  743. package/dist/modules/dock/surface/stack.d.ts.map +0 -1
  744. package/dist/modules/dock/types/compact.d.ts +0 -13
  745. package/dist/modules/dock/types/compact.d.ts.map +0 -1
  746. package/dist/modules/modal/components/close-button.d.ts +0 -6
  747. package/dist/modules/modal/components/close-button.d.ts.map +0 -1
  748. package/dist/modules/modal/components/modal-container.d.ts.map +0 -1
  749. package/dist/modules/modal/components/modal-layer-switcher.d.ts +0 -9
  750. package/dist/modules/modal/components/modal-layer-switcher.d.ts.map +0 -1
  751. package/dist/modules/modal/components/modal-layer.d.ts +0 -17
  752. package/dist/modules/modal/components/modal-layer.d.ts.map +0 -1
  753. package/dist/modules/modal/components/overlay.d.ts.map +0 -1
  754. package/dist/modules/modal/components/resolve-header.d.ts +0 -10
  755. package/dist/modules/modal/components/resolve-header.d.ts.map +0 -1
  756. package/dist/modules/modal/components/slot-row.d.ts +0 -12
  757. package/dist/modules/modal/components/slot-row.d.ts.map +0 -1
  758. package/dist/modules/modal/hooks/use-mobile-viewport.d.ts +0 -3
  759. package/dist/modules/modal/hooks/use-mobile-viewport.d.ts.map +0 -1
  760. package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts +0 -12
  761. package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts.map +0 -1
  762. package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts +0 -3
  763. package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts.map +0 -1
  764. package/dist/modules/modal/lib/dom.d.ts.map +0 -1
  765. package/dist/modules/modal/lib/theme.d.ts +0 -4
  766. package/dist/modules/modal/lib/theme.d.ts.map +0 -1
  767. package/dist/modules/modal/model/entry.d.ts +0 -18
  768. package/dist/modules/modal/model/entry.d.ts.map +0 -1
  769. package/dist/modules/modal/model/header.d.ts +0 -16
  770. package/dist/modules/modal/model/header.d.ts.map +0 -1
  771. package/dist/modules/modal/model/identity.d.ts +0 -13
  772. package/dist/modules/modal/model/identity.d.ts.map +0 -1
  773. package/dist/modules/modal/model/layout.d.ts.map +0 -1
  774. package/dist/modules/modal/model/state.d.ts +0 -10
  775. package/dist/modules/modal/model/state.d.ts.map +0 -1
  776. package/dist/overlay-7QLGWHCH.js +0 -13
  777. package/dist/react/hooks/types.d.ts +0 -25
  778. package/dist/react/hooks/types.d.ts.map +0 -1
  779. package/dist/react/ui/components/avatar.d.ts +0 -6
  780. package/dist/react/ui/components/avatar.d.ts.map +0 -1
  781. package/dist/react/ui/components/button.d.ts +0 -6
  782. package/dist/react/ui/components/button.d.ts.map +0 -1
  783. package/dist/react/ui/components/carousel.d.ts +0 -6
  784. package/dist/react/ui/components/carousel.d.ts.map +0 -1
  785. package/dist/react/ui/components/checkbox.d.ts +0 -10
  786. package/dist/react/ui/components/checkbox.d.ts.map +0 -1
  787. package/dist/react/ui/components/icon.d.ts +0 -6
  788. package/dist/react/ui/components/icon.d.ts.map +0 -1
  789. package/dist/react/ui/components/image.d.ts +0 -6
  790. package/dist/react/ui/components/image.d.ts.map +0 -1
  791. package/dist/react/ui/components/indicator.d.ts +0 -45
  792. package/dist/react/ui/components/indicator.d.ts.map +0 -1
  793. package/dist/react/ui/components/input.d.ts +0 -10
  794. package/dist/react/ui/components/input.d.ts.map +0 -1
  795. package/dist/react/ui/components/loader.d.ts +0 -10
  796. package/dist/react/ui/components/loader.d.ts.map +0 -1
  797. package/dist/react/ui/components/segmented.d.ts +0 -6
  798. package/dist/react/ui/components/segmented.d.ts.map +0 -1
  799. package/dist/react/ui/components/select-parts.d.ts +0 -22
  800. package/dist/react/ui/components/select-parts.d.ts.map +0 -1
  801. package/dist/react/ui/components/select.d.ts +0 -6
  802. package/dist/react/ui/components/select.d.ts.map +0 -1
  803. package/dist/react/ui/components/skeleton.d.ts +0 -10
  804. package/dist/react/ui/components/skeleton.d.ts.map +0 -1
  805. package/dist/react/ui/components/switch.d.ts +0 -6
  806. package/dist/react/ui/components/switch.d.ts.map +0 -1
  807. package/dist/react/ui/components/tooltip-group.d.ts +0 -34
  808. package/dist/react/ui/components/tooltip-group.d.ts.map +0 -1
  809. package/dist/react/ui/components/tooltip-placement.d.ts +0 -43
  810. package/dist/react/ui/components/tooltip-placement.d.ts.map +0 -1
  811. package/dist/react/ui/components/tooltip-slot.d.ts +0 -23
  812. package/dist/react/ui/components/tooltip-slot.d.ts.map +0 -1
  813. package/dist/react/ui/components/tooltip.d.ts +0 -13
  814. package/dist/react/ui/components/tooltip.d.ts.map +0 -1
  815. package/dist/react/ui/index.d.ts +0 -19
  816. package/dist/react/ui/index.d.ts.map +0 -1
  817. package/dist/react/ui/provider.d.ts +0 -22
  818. package/dist/react/ui/provider.d.ts.map +0 -1
  819. package/dist/react/ui/types-controls.d.ts +0 -133
  820. package/dist/react/ui/types-controls.d.ts.map +0 -1
  821. package/dist/react/ui/types.d.ts +0 -213
  822. package/dist/react/ui/types.d.ts.map +0 -1
  823. package/dist/react/ui/utils.d.ts +0 -65
  824. package/dist/react/ui/utils.d.ts.map +0 -1
  825. package/dist/ui/index.d.ts +0 -1
  826. package/dist/ui/index.js +0 -2268
  827. package/dist/ui/index.js.map +0 -1
  828. package/docs/proposals/navigation.md +0 -210
  829. /package/dist/modules/ambient/{quantize.d.ts → analysis/quantize.d.ts} +0 -0
  830. /package/dist/modules/background/{components/overlay.d.ts → overlay.d.ts} +0 -0
  831. /package/dist/modules/background/{model/playback.d.ts → playback.d.ts} +0 -0
  832. /package/dist/modules/background/youtube/{lib/audio.d.ts → audio.d.ts} +0 -0
  833. /package/dist/modules/dock/{components → card}/compact.d.ts +0 -0
  834. /package/dist/modules/dock/{components → commands}/command-bar.d.ts +0 -0
  835. /package/dist/modules/dock/{components → routing}/breadcrumbs-card.d.ts +0 -0
  836. /package/dist/modules/dock/{model → routing}/paths.d.ts +0 -0
  837. /package/dist/modules/dock/{components → stack}/dock.d.ts +0 -0
  838. /package/dist/modules/dock/surface/{model → runtime}/url.d.ts +0 -0
  839. /package/dist/modules/modal/{lib/dom.d.ts → dom.d.ts} +0 -0
  840. /package/dist/modules/modal/{components/overlay.d.ts → overlay.d.ts} +0 -0
@@ -1,11 +1,11 @@
1
- import { useStore, useRequiredContext } from './chunk-WQTMOUCA.js';
2
- import { createStore, report, trimToNull } from './chunk-D222OCTV.js';
1
+ import { useStore, useRequiredContext } from './chunk-JWUKAZ3A.js';
2
+ import { createStore, report, trimToNull } from './chunk-S67HGKJ2.js';
3
3
  import { getOrCreateGlobalContext } from './chunk-J3VTDBC6.js';
4
- import { isObject, shallowEqual, isPlainObject } from './chunk-BMFHS3GV.js';
4
+ import { isObject, getOrInsert, isPlainObject, shallowEqual } from './chunk-YHWA7FXX.js';
5
5
  import { c } from 'react/compiler-runtime';
6
- import { useState, useSyncExternalStore, use, useId, useRef, useLayoutEffect, useEffect, createElement, Fragment, useMemo, isValidElement, cloneElement, Children } from 'react';
7
- import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
8
6
  import { usePathname } from 'next/navigation';
7
+ import { useState, useSyncExternalStore, createElement, Fragment, use, useId, useRef, useLayoutEffect, useEffect, useMemo, isValidElement, cloneElement, Children } from 'react';
8
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
9
9
 
10
10
  // src/core/kernel/constants.ts
11
11
  var DEFAULT_SOURCE = "dynamic";
@@ -47,6 +47,8 @@ var REGISTRY_SCOPE_KINDS = Object.freeze({
47
47
  var DEFAULT_REGISTRY_SCOPE = REGISTRY_SCOPE_KINDS.APP;
48
48
 
49
49
  // src/core/kernel/utils.ts
50
+ var trimmedString = (value) => typeof value === "string" ? value.trim() || null : null;
51
+ var sourceOf = (options) => typeof options.source === "string" ? options.source : DEFAULT_SOURCE;
50
52
  function hasOwnProperty(target, key) {
51
53
  return Object.prototype.hasOwnProperty.call(target, key);
52
54
  }
@@ -72,7 +74,7 @@ function resolveRegisterInput(sourceOrOptions, optionsArg) {
72
74
  }
73
75
  if (isObject(sourceOrOptions)) {
74
76
  return {
75
- source: typeof sourceOrOptions.source === "string" ? sourceOrOptions.source : DEFAULT_SOURCE,
77
+ source: sourceOf(sourceOrOptions),
76
78
  options: sourceOrOptions
77
79
  };
78
80
  }
@@ -82,7 +84,7 @@ function resolveRegisterInput(sourceOrOptions, optionsArg) {
82
84
  };
83
85
  }
84
86
  function resolveScope(options) {
85
- return typeof options?.scope === "string" && options.scope.trim() ? options.scope.trim() : DEFAULT_REGISTRY_SCOPE;
87
+ return trimmedString(options?.scope) ?? DEFAULT_REGISTRY_SCOPE;
86
88
  }
87
89
  function resolveUnregisterInput(sourceOrOptions) {
88
90
  if (typeof sourceOrOptions === "string") {
@@ -95,8 +97,8 @@ function resolveUnregisterInput(sourceOrOptions) {
95
97
  if (isObject(sourceOrOptions)) {
96
98
  return {
97
99
  instanceId: resolveInstanceId(sourceOrOptions),
98
- scope: typeof sourceOrOptions.scope === "string" && sourceOrOptions.scope.trim() ? sourceOrOptions.scope.trim() : null,
99
- source: typeof sourceOrOptions.source === "string" ? sourceOrOptions.source : DEFAULT_SOURCE
100
+ scope: trimmedString(sourceOrOptions.scope),
101
+ source: sourceOf(sourceOrOptions)
100
102
  };
101
103
  }
102
104
  return {
@@ -111,250 +113,20 @@ function mergeModuleConfigs(base, patch) {
111
113
  const result = {
112
114
  ...source
113
115
  };
114
- Object.keys(changes).forEach((key) => {
116
+ for (const [key, patchVal] of Object.entries(changes)) {
115
117
  const baseVal = source[key];
116
- const patchVal = changes[key];
117
- if (baseVal && typeof baseVal === "object" && !Array.isArray(baseVal) && patchVal && typeof patchVal === "object" && !Array.isArray(patchVal)) {
118
- result[key] = {
119
- ...baseVal,
120
- ...patchVal
121
- };
122
- } else {
123
- result[key] = patchVal;
124
- }
125
- });
126
- return result;
127
- }
128
-
129
- // src/core/kernel/operations-records.ts
130
- function createInitialRegistriesFor(definitions) {
131
- return Object.fromEntries(Array.from(definitions.keys(), (type) => [type, {}]));
132
- }
133
- function buildSourceRecord({
134
- source,
135
- value,
136
- instanceId = null,
137
- priority,
138
- timestamp,
139
- sequence,
140
- scope = DEFAULT_REGISTRY_SCOPE
141
- }) {
142
- return {
143
- updatedAt: timestamp,
144
- sequence: Number.isFinite(sequence) ? sequence : timestamp,
145
- instanceId: typeof instanceId === "string" ? instanceId : null,
146
- priority,
147
- value,
148
- source,
149
- scope
150
- };
151
- }
152
- var SEP = "\0";
153
- function createRecordKey(source, instanceId = null, scope = DEFAULT_REGISTRY_SCOPE) {
154
- const hasInstance = typeof instanceId === "string" && instanceId.length > 0;
155
- if (scope === DEFAULT_REGISTRY_SCOPE) {
156
- return hasInstance ? `i${SEP}${source}${SEP}${instanceId}` : `s${SEP}${source}`;
157
- }
158
- return hasInstance ? `I${SEP}${scope}${SEP}${source}${SEP}${instanceId}` : `S${SEP}${scope}${SEP}${source}`;
159
- }
160
- function getSourceRecords(entry, source, scope = null) {
161
- if (!entry) return [];
162
- const matches = [];
163
- for (const recordKey in entry) {
164
- if (!hasOwnProperty(entry, recordKey)) continue;
165
- const record = toSourceRecord(entry[recordKey], recordKey);
166
- if (record?.source === source && (scope === null || record.scope === scope)) {
167
- matches.push({
168
- recordKey,
169
- record
170
- });
171
- }
172
- }
173
- return matches;
174
- }
175
- function getSourceRecord(entry, source, instanceId = null, scope = DEFAULT_REGISTRY_SCOPE) {
176
- const recordKey = createRecordKey(source, instanceId, scope);
177
- return toSourceRecord(entry?.[recordKey], source);
178
- }
179
- function resolveRecordPriority(options, source) {
180
- if (isObject(options) && hasOwnProperty(options, "priority")) {
181
- const parsedPriority = Number(options.priority);
182
- if (Number.isFinite(parsedPriority)) return parsedPriority;
183
- }
184
- return REGISTRY_SOURCE_PRIORITY[source] ?? 0;
185
- }
186
- function isNormalizedRecord(value) {
187
- if (!isObject(value)) return false;
188
- const record = value;
189
- return typeof record.priority === "number" && Number.isFinite(record.priority) && typeof record.updatedAt === "number" && typeof record.sequence === "number" && typeof record.source === "string" && typeof record.scope === "string" && (record.instanceId === null || typeof record.instanceId === "string") && hasOwnProperty(record, "value");
190
- }
191
- function toSourceRecord(rawValue, source = DEFAULT_SOURCE) {
192
- if (rawValue === void 0) return null;
193
- if (isNormalizedRecord(rawValue)) return rawValue;
194
- const rawRecord = rawValue;
195
- const isWrappedRecord = isObject(rawValue) && hasOwnProperty(rawRecord, "value") && hasOwnProperty(rawRecord, "updatedAt") && hasOwnProperty(rawRecord, "priority") && hasOwnProperty(rawRecord, "source");
196
- if (isWrappedRecord) {
197
- const parsedPriority = Number(rawRecord.priority);
198
- return {
199
- updatedAt: Number(rawRecord.updatedAt) || 0,
200
- sequence: Number(rawRecord.sequence) || Number(rawRecord.updatedAt) || 0,
201
- instanceId: typeof rawRecord.instanceId === "string" ? rawRecord.instanceId : null,
202
- priority: Number.isFinite(parsedPriority) ? parsedPriority : REGISTRY_SOURCE_PRIORITY[source] ?? 0,
203
- source: typeof rawRecord.source === "string" ? rawRecord.source : source,
204
- scope: typeof rawRecord.scope === "string" ? rawRecord.scope : DEFAULT_REGISTRY_SCOPE,
205
- value: rawRecord.value
206
- };
207
- }
208
- return {
209
- updatedAt: 0,
210
- sequence: 0,
211
- instanceId: null,
212
- priority: REGISTRY_SOURCE_PRIORITY[source] ?? 0,
213
- source,
214
- scope: DEFAULT_REGISTRY_SCOPE,
215
- value: rawValue
216
- };
217
- }
218
- function compareRecords(a, b) {
219
- if (a.priority !== b.priority) return a.priority - b.priority;
220
- const rankDiff = getSourceRank(a.source) - getSourceRank(b.source);
221
- if (rankDiff !== 0) return rankDiff;
222
- return (a.sequence ?? a.updatedAt) - (b.sequence ?? b.updatedAt);
223
- }
224
- function recordsHaveSameValue(prevRecord, nextRecord) {
225
- if (Object.is(prevRecord?.value, nextRecord?.value)) return true;
226
- if (isObject(prevRecord?.value) && isObject(nextRecord?.value)) {
227
- return shallowEqual(prevRecord.value, nextRecord.value);
228
- }
229
- return false;
230
- }
231
- function hasRecordChanged(prevRecord, nextRecord) {
232
- if (!prevRecord) return true;
233
- return prevRecord.priority !== nextRecord.priority || prevRecord.source !== nextRecord.source || prevRecord.instanceId !== nextRecord.instanceId || prevRecord.scope !== nextRecord.scope || !recordsHaveSameValue(prevRecord, nextRecord);
234
- }
235
- function hasAnySourceRecord(entry) {
236
- if (!entry) return false;
237
- for (const recordKey in entry) {
238
- if (hasOwnProperty(entry, recordKey) && entry[recordKey] !== void 0) {
239
- return true;
240
- }
241
- }
242
- return false;
243
- }
244
- function setSourceRecord(state, type, key, source, record) {
245
- const typeRegistry = state[type] || {};
246
- const currentEntry = typeRegistry[key] || {};
247
- const recordKey = createRecordKey(source, record.instanceId, record.scope);
248
- const prevRecord = toSourceRecord(currentEntry[recordKey], source);
249
- if (!hasRecordChanged(prevRecord, record)) {
250
- return state;
251
- }
252
- return {
253
- ...state,
254
- [type]: {
255
- ...typeRegistry,
256
- [key]: {
257
- ...currentEntry,
258
- [recordKey]: record
259
- }
260
- }
261
- };
262
- }
263
- function findRecordsToRemove(entry, source, instanceId, scope) {
264
- if (typeof instanceId === "string" && instanceId.length > 0 && scope !== null) {
265
- const safeScope = scope || DEFAULT_REGISTRY_SCOPE;
266
- const record = getSourceRecord(entry, source, instanceId, safeScope);
267
- if (!record) return [];
268
- return [{
269
- recordKey: createRecordKey(source, instanceId, safeScope),
270
- record
271
- }];
272
- }
273
- return getSourceRecords(entry, source, scope).filter(({
274
- record
275
- }) => !instanceId || record?.instanceId === instanceId).filter((candidate) => Boolean(candidate.record));
276
- }
277
- function removeSourceRecord(state, type, key, source, instanceId = null, scope = null) {
278
- const typeRegistry = state[type];
279
- const currentEntry = typeRegistry?.[key];
280
- if (!typeRegistry || !currentEntry) return state;
281
- const activeRecords = findRecordsToRemove(currentEntry, source, instanceId, scope);
282
- if (activeRecords.length === 0) return state;
283
- const nextEntry = {
284
- ...currentEntry
285
- };
286
- activeRecords.forEach(({
287
- recordKey
288
- }) => {
289
- delete nextEntry[recordKey];
290
- });
291
- if (!hasAnySourceRecord(nextEntry)) {
292
- const nextTypeRegistry = {
293
- ...typeRegistry
294
- };
295
- delete nextTypeRegistry[key];
296
- return {
297
- ...state,
298
- [type]: nextTypeRegistry
299
- };
118
+ result[key] = isObject(baseVal) && isObject(patchVal) ? {
119
+ ...baseVal,
120
+ ...patchVal
121
+ } : patchVal;
300
122
  }
301
- return {
302
- ...state,
303
- [type]: {
304
- ...typeRegistry,
305
- [key]: nextEntry
306
- }
307
- };
123
+ return result;
308
124
  }
309
125
 
310
- // src/core/kernel/operations-resolve.ts
311
- function resolveEntryValueFor(definitions, type, entry, scope = null) {
312
- if (!entry) return void 0;
313
- const activeRecords = [];
314
- for (const recordKey in entry) {
315
- if (!Object.prototype.hasOwnProperty.call(entry, recordKey)) continue;
316
- const record = toSourceRecord(entry[recordKey], recordKey);
317
- if (record !== null && (scope === null || record.scope === scope)) {
318
- activeRecords.push(record);
319
- }
320
- }
321
- if (activeRecords.length === 0) return void 0;
322
- const merge = definitions.get(type)?.merge;
323
- if (activeRecords.length === 1) {
324
- const [only] = activeRecords;
325
- return merge && isObject(only.value) ? merge([only.value]) : only.value;
326
- }
327
- if (merge) {
328
- const sortedRecords = activeRecords.sort(compareRecords);
329
- const mergeCandidate = sortedRecords.every((record) => isObject(record.value));
330
- if (mergeCandidate) {
331
- const values = sortedRecords.map((record) => record.value);
332
- return merge(values);
333
- }
334
- return sortedRecords[sortedRecords.length - 1].value;
335
- }
336
- return activeRecords.reduce((winner, current) => compareRecords(current, winner) > 0 ? current : winner).value;
337
- }
338
- function createResolverCacheFor(definitions) {
339
- const entryCache = /* @__PURE__ */ new WeakMap();
340
- return (type, entry, scope = null) => {
341
- if (!entry || typeof entry !== "object") {
342
- return resolveEntryValueFor(definitions, type, entry, scope);
343
- }
344
- let typeCache = entryCache.get(entry);
345
- if (!typeCache) {
346
- typeCache = /* @__PURE__ */ new Map();
347
- entryCache.set(entry, typeCache);
348
- }
349
- const cacheKey = scope || "default";
350
- if (typeCache.has(cacheKey)) return typeCache.get(cacheKey);
351
- const value = resolveEntryValueFor(definitions, type, entry, scope);
352
- typeCache.set(cacheKey, value);
353
- return value;
354
- };
126
+ // src/core/kernel/registry/schema.ts
127
+ function isValidationMode(value) {
128
+ return Object.values(REGISTRY_VALIDATION_MODES).includes(value);
355
129
  }
356
-
357
- // src/core/kernel/schema.ts
358
130
  function resolveLifecycle(metadata, fallback) {
359
131
  const lifecycle = metadata?.lifecycle ?? metadata?.cleanup;
360
132
  return lifecycle && REGISTRY_LIFECYCLE_VALUES.has(lifecycle) ? lifecycle : fallback;
@@ -373,11 +145,11 @@ function checkNumbers(metadata, issues) {
373
145
  }
374
146
  function checkEnums(metadata, issues) {
375
147
  const lifecycle = metadata.lifecycle ?? metadata.cleanup;
376
- if (lifecycle !== void 0 && // eslint-disable-next-line @typescript-eslint/no-base-to-string -- lifecycle comes from unvalidated metadata; an object stringifies to "[object Object]" and fails the membership check, which is the intended rejection
148
+ if (lifecycle !== void 0 && // eslint-disable-next-line @typescript-eslint/no-base-to-string -- unvalidated input; an object becomes "[object Object]" and is rejected
377
149
  !REGISTRY_LIFECYCLE_VALUES.has(String(lifecycle))) {
378
150
  issues.push(`lifecycle must be one of: ${[...REGISTRY_LIFECYCLE_VALUES].join(", ")}`);
379
151
  }
380
- if (metadata.validation !== void 0 && !Object.values(REGISTRY_VALIDATION_MODES).includes(metadata.validation)) {
152
+ if (metadata.validation !== void 0 && !isValidationMode(metadata.validation)) {
381
153
  issues.push(`validation must be one of: ${Object.values(REGISTRY_VALIDATION_MODES).join(", ")}`);
382
154
  }
383
155
  }
@@ -488,412 +260,626 @@ function normalizeRegistryMetadata(metadata, {
488
260
  }
489
261
  };
490
262
  }
491
- function isValidationMode(value) {
492
- return Object.values(REGISTRY_VALIDATION_MODES).includes(value);
493
- }
494
263
  function pickRegistryMetadata(options) {
495
264
  if (!isObject(options)) return {};
496
265
  return Object.fromEntries(REGISTRY_METADATA_KEYS.filter((key) => options[key] !== void 0).map((key) => [key, options[key]]));
497
266
  }
498
267
 
499
- // src/core/kernel/operations.ts
500
- function createRegisterOperation(type, key, item, sourceOrOptions, optionsArg, timestamp, sequence = timestamp) {
501
- const {
502
- source,
503
- options
504
- } = resolveRegisterInput(sourceOrOptions, optionsArg);
505
- const instanceId = resolveInstanceId(options);
506
- const scope = resolveScope(options);
507
- return {
508
- kind: "register",
509
- validation: options.validation,
510
- source,
511
- scope,
512
- record: buildSourceRecord({
513
- source,
514
- value: item,
515
- instanceId,
516
- priority: resolveRecordPriority(options, source),
517
- scope,
518
- timestamp,
519
- sequence
520
- }),
521
- instanceId,
522
- type,
523
- key: typeof key === "string" ? key.trim() : key
524
- };
268
+ // src/core/kernel/registry/apply.ts
269
+ var NO_CLEANUP = () => {
270
+ };
271
+ function isPersistentLifecycle(lifecycle) {
272
+ return lifecycle === REGISTRY_LIFECYCLES.PERSISTENT;
525
273
  }
526
- function createUnregisterOperation(type, key, sourceOrOptions) {
527
- const {
528
- scope,
529
- source,
530
- instanceId
531
- } = resolveUnregisterInput(sourceOrOptions);
532
- return {
533
- kind: "unregister",
534
- instanceId,
535
- scope,
536
- source,
537
- type,
538
- key: typeof key === "string" ? key.trim() : key
539
- };
274
+ function runRegistrationBatch(context, executor) {
275
+ return typeof context.batch === "function" ? context.batch(executor) : executor(context);
540
276
  }
541
- function isValidRegistryTargetFor(definitions, type, key) {
542
- return validateRegistryKey(type, key, definitions).valid;
277
+ function createEntryCleanupKey(type, key, source, instanceId, scope) {
278
+ return JSON.stringify(["entry", type, key, scope ?? null, source, instanceId]);
543
279
  }
544
- function applyOperationFor(definitions, state, operation) {
545
- if (!isValidRegistryTargetFor(definitions, operation?.type, operation?.key)) return state;
546
- if (operation.kind === "register") {
547
- return setSourceRecord(state, operation.type, operation.key, operation.source, operation.record);
548
- }
549
- if (operation.kind === "unregister") {
550
- return removeSourceRecord(state, operation.type, operation.key, operation.source, operation.instanceId, operation.scope);
551
- }
552
- return state;
280
+ function getCleanupScope(context) {
281
+ return context?.cleanupScope || /* @__PURE__ */ new Map();
553
282
  }
554
- function unregisterHasEffect(entry, operation) {
555
- const {
556
- instanceId,
557
- scope,
558
- source
559
- } = operation;
560
- if (typeof instanceId !== "string" || instanceId.length === 0) {
561
- return getSourceRecords(entry, source, scope).length > 0;
562
- }
563
- if (scope === null) {
564
- return getSourceRecords(entry, source).some(({
565
- record
566
- }) => record?.instanceId === instanceId);
567
- }
568
- return Boolean(getSourceRecord(entry, source, instanceId, scope));
283
+ function clearCleanupTimer(scope, cleanupKey) {
284
+ const lifecycle = scope.get(cleanupKey);
285
+ if (!lifecycle) return;
286
+ lifecycle.cancelled = true;
287
+ if (lifecycle.timerId !== null) clearTimeout(lifecycle.timerId);
288
+ scope.delete(cleanupKey);
569
289
  }
570
- function hasOperationEffectFor(definitions, state, operation) {
571
- if (!isValidRegistryTargetFor(definitions, operation?.type, operation?.key)) return false;
572
- if (operation.kind === "register") {
573
- const currentRecord = getSourceRecord(state[operation.type]?.[operation.key], operation.source, operation.instanceId, operation.scope);
574
- return hasRecordChanged(currentRecord, operation.record);
575
- }
576
- if (operation.kind === "unregister") {
577
- return unregisterHasEffect(state[operation.type]?.[operation.key], operation);
578
- }
579
- return false;
290
+ function scheduleCleanup(scope, cleanupKey, callback, delayMs) {
291
+ clearCleanupTimer(scope, cleanupKey);
292
+ const lifecycle = {
293
+ cancelled: false,
294
+ timerId: null
295
+ };
296
+ lifecycle.timerId = setTimeout(() => {
297
+ if (lifecycle.cancelled || scope.get(cleanupKey) !== lifecycle) return;
298
+ scope.delete(cleanupKey);
299
+ callback();
300
+ }, delayMs);
301
+ scope.set(cleanupKey, lifecycle);
580
302
  }
581
- function writableEntry(draft, type, key) {
582
- if (draft.state === draft.base) draft.state = {
583
- ...draft.base
303
+ function resolveItemMetadata(item, pageMetadata) {
304
+ const itemMetadata = isObject(item) && isObject(item.registry) ? item.registry : {};
305
+ return {
306
+ ...pageMetadata,
307
+ ...itemMetadata
584
308
  };
585
- if (!draft.types.has(type)) {
586
- draft.state[type] = {
587
- ...draft.state[type] || {}
588
- };
589
- draft.types.add(type);
590
- }
591
- const registry = draft.state[type];
592
- const id = `${type}\0${key}`;
593
- let entry = registry[key];
594
- if (!draft.entries.has(id) || !entry) {
595
- entry = {
596
- ...entry || {}
597
- };
598
- registry[key] = entry;
599
- draft.entries.add(id);
600
- }
601
- return entry;
602
309
  }
603
- function applyOperationToDraft(draft, operation) {
604
- if (operation.kind === "register") {
605
- const entry2 = writableEntry(draft, operation.type, operation.key);
606
- const recordKey = createRecordKey(operation.source, operation.record.instanceId, operation.record.scope);
607
- entry2[recordKey] = operation.record;
608
- return;
609
- }
610
- const current = draft.state[operation.type]?.[operation.key];
611
- if (!current) return;
612
- const records = findRecordsToRemove(current, operation.source, operation.instanceId, operation.scope);
613
- if (records.length === 0) return;
614
- const entry = writableEntry(draft, operation.type, operation.key);
615
- for (const {
616
- recordKey
617
- } of records) delete entry[recordKey];
618
- if (!hasAnySourceRecord(entry)) delete draft.state[operation.type][operation.key];
310
+ function stripRegistryKey(item) {
311
+ if (!isObject(item)) return item;
312
+ return Object.fromEntries(Object.entries(item).filter(([key]) => key !== "registry"));
619
313
  }
620
- function resolveEffectiveOperationsFor(definitions, state, operations) {
621
- const effectiveOperations = [];
622
- const draft = {
623
- base: state,
624
- entries: /* @__PURE__ */ new Set(),
625
- state,
626
- types: /* @__PURE__ */ new Set()
627
- };
628
- for (const operation of operations) {
629
- if (!hasOperationEffectFor(definitions, draft.state, operation)) continue;
630
- effectiveOperations.push(operation);
631
- applyOperationToDraft(draft, operation);
314
+ function collectModuleRegistrations(coreModule, slice, pageMetadata, context) {
315
+ const definition = coreModule.registry;
316
+ const toEntries = coreModule.page?.entries;
317
+ if (!definition || !toEntries || slice == null || slice === false) return [];
318
+ const type = coreModule.id;
319
+ const items = Array.isArray(slice) ? slice : [slice];
320
+ const registrations = [];
321
+ for (const item of items) {
322
+ if (item == null || item === false) continue;
323
+ const metadata = resolveItemMetadata(item, pageMetadata);
324
+ if (metadata.validation === REGISTRY_VALIDATION_MODES.STRICT && !validateRegistryMetadata(metadata).valid) {
325
+ continue;
326
+ }
327
+ const payload = stripRegistryKey(item);
328
+ const {
329
+ cleanupDelayMs,
330
+ lifecycle,
331
+ registerOptions,
332
+ scope,
333
+ source
334
+ } = normalizeRegistryMetadata(metadata, {
335
+ defaultCleanupDelayMs: definition.cleanupDelayMs ?? null,
336
+ defaultLifecycle: definition.lifecycle,
337
+ defaultSource: DEFAULT_SOURCE
338
+ });
339
+ for (const {
340
+ key,
341
+ value
342
+ } of toEntries(payload, context) ?? []) {
343
+ const validation = definition.validate?.(value);
344
+ if (validation && !validation.valid) {
345
+ report(`Registry ${type} config is invalid`, validation.issues, "warn");
346
+ continue;
347
+ }
348
+ registrations.push({
349
+ cleanupDelayMs,
350
+ cleanupKey: createEntryCleanupKey(type, key, source, context.instanceId, scope),
351
+ key,
352
+ lifecycle,
353
+ registerOptions,
354
+ scope,
355
+ source,
356
+ type,
357
+ value
358
+ });
359
+ }
632
360
  }
633
- return {
634
- effectiveOperations,
635
- nextState: draft.state
636
- };
361
+ return registrations;
637
362
  }
638
- function createRegistryOperations(definitions) {
639
- return Object.freeze({
640
- applyOperation: (state, operation) => applyOperationFor(definitions, state, operation),
641
- createInitialRegistries: () => createInitialRegistriesFor(definitions),
642
- createResolverCache: () => createResolverCacheFor(definitions),
643
- hasOperationEffect: (state, operation) => hasOperationEffectFor(definitions, state, operation),
644
- isRegistryType: (type) => definitions.get(type) !== void 0,
645
- isValidRegistryTarget: (type, key) => isValidRegistryTargetFor(definitions, type, key),
646
- resolveEffectiveOperations: (state, operations) => resolveEffectiveOperationsFor(definitions, state, operations),
647
- resolveEntryValue: (type, entry, scope = null) => resolveEntryValueFor(definitions, type, entry, scope)
363
+ function collectRegistrations(modules, config, context) {
364
+ const pageMetadata = isObject(config.registry) ? config.registry : {};
365
+ const slices = config;
366
+ return modules.flatMap((coreModule) => {
367
+ try {
368
+ return collectModuleRegistrations(coreModule, slices[coreModule.id], pageMetadata, context);
369
+ } catch (error) {
370
+ report(`Registry apply (${coreModule.id})`, error);
371
+ return [];
372
+ }
648
373
  });
649
374
  }
650
-
651
- // src/core/kernel/runtime.ts
652
- var TRACE_RADIX = 36;
653
- var TRACE_SUFFIX_LENGTH = 6;
654
- function createTraceId() {
655
- const time = Date.now().toString(TRACE_RADIX);
656
- const suffix = Math.random().toString(TRACE_RADIX).slice(2, 2 + TRACE_SUFFIX_LENGTH);
657
- return `tx-${time}-${suffix}`;
375
+ function hasCleanupDelay(delayMs) {
376
+ return typeof delayMs === "number" && delayMs > 0;
658
377
  }
659
- function withTransactionDefaults(metadata, options) {
660
- const baseOpts = options && typeof options === "object" ? options : {};
661
- const needsSource = metadata.source && !baseOpts.source;
662
- const needsScope = metadata.scope && !baseOpts.scope;
663
- if (!needsSource && !needsScope) return baseOpts;
664
- return {
665
- ...baseOpts,
666
- ...needsSource ? {
667
- source: metadata.source
668
- } : {},
669
- ...needsScope ? {
670
- scope: metadata.scope
671
- } : {}
378
+ function createTeardown(registrations, context, cleanupScope) {
379
+ const owner = (registration) => ({
380
+ instanceId: context.instanceId,
381
+ scope: registration.scope,
382
+ source: registration.source
383
+ });
384
+ return () => {
385
+ const immediate = [];
386
+ registrations.forEach((registration) => {
387
+ if (isPersistentLifecycle(registration.lifecycle)) return;
388
+ const {
389
+ cleanupDelayMs,
390
+ cleanupKey,
391
+ key,
392
+ type
393
+ } = registration;
394
+ if (hasCleanupDelay(cleanupDelayMs)) {
395
+ scheduleCleanup(cleanupScope, cleanupKey, () => context.unregister(type, key, owner(registration)), cleanupDelayMs);
396
+ } else {
397
+ immediate.push(registration);
398
+ }
399
+ });
400
+ if (immediate.length === 0) return;
401
+ runRegistrationBatch(context, (queue) => {
402
+ immediate.forEach((registration) => queue.unregister(registration.type, registration.key, owner(registration)));
403
+ });
672
404
  };
673
405
  }
674
- function createRegistryTransaction(store, metadata = {}) {
675
- const operations = [];
676
- let status = "open";
677
- const traceId = metadata.traceId || createTraceId();
678
- const ensureOpen = () => status === "open";
679
- const mergeOptions = (options) => withTransactionDefaults(metadata, options);
680
- const register = (type, key, value, sourceOrOptions, optionsArg) => {
681
- if (!ensureOpen()) return {
682
- index: -1,
683
- status,
684
- traceId
685
- };
686
- const options = typeof sourceOrOptions === "string" ? mergeOptions({
687
- ...optionsArg || {},
688
- source: sourceOrOptions
689
- }) : mergeOptions(sourceOrOptions);
690
- operations.push({
406
+ function applyRegistryConfig(config, context) {
407
+ const modules = context.modules ?? [];
408
+ if (!config || modules.length === 0) return NO_CLEANUP;
409
+ const registrations = collectRegistrations(modules, config, context);
410
+ if (registrations.length === 0) return NO_CLEANUP;
411
+ const cleanupScope = getCleanupScope(context);
412
+ runRegistrationBatch(context, (queue) => {
413
+ registrations.forEach(({
414
+ cleanupKey,
691
415
  key,
692
- item: value,
693
- options,
694
- type
416
+ registerOptions,
417
+ source,
418
+ type,
419
+ value
420
+ }) => {
421
+ clearCleanupTimer(cleanupScope, cleanupKey);
422
+ queue.register(type, key, value, source, registerOptions);
695
423
  });
424
+ });
425
+ return createTeardown(registrations, context, cleanupScope);
426
+ }
427
+ var EMPTY_MODULES = Object.freeze([]);
428
+ var PassthroughBoundary = ({
429
+ children
430
+ }) => children;
431
+ var ModuleHostContext = getOrCreateGlobalContext("ModuleHostContext", null);
432
+ var MODULE_ID_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
433
+ function selectModuleSlice(coreModule, config) {
434
+ const slice = coreModule.page?.select ? coreModule.page.select(config) : config[coreModule.id];
435
+ return slice ?? null;
436
+ }
437
+ function createModulePayload(modules, config, metadata = {}) {
438
+ const payload = {};
439
+ let hasSlices = false;
440
+ for (const coreModule of modules) {
441
+ if (!coreModule.page?.entries) continue;
442
+ const slice = selectModuleSlice(coreModule, config);
443
+ if (slice === null) continue;
444
+ payload[coreModule.id] = slice;
445
+ hasSlices = true;
446
+ }
447
+ if (!hasSlices) return null;
448
+ return {
449
+ ...payload,
450
+ registry: {
451
+ ...metadata,
452
+ ...isObject(config.registry) ? config.registry : {}
453
+ }
454
+ };
455
+ }
456
+ function sortModules(modules) {
457
+ const byId = /* @__PURE__ */ new Map();
458
+ for (const coreModule of modules) {
459
+ if (!MODULE_ID_PATTERN.test(coreModule.id)) {
460
+ throw new Error(`[Core] Invalid module id "${coreModule.id}": use a camelCase name such as "contextMenu".`);
461
+ }
462
+ if (byId.has(coreModule.id)) {
463
+ throw new Error(`[Core] Module "${coreModule.id}" is installed twice.`);
464
+ }
465
+ byId.set(coreModule.id, coreModule);
466
+ }
467
+ const sorted = [];
468
+ const state = /* @__PURE__ */ new Map();
469
+ const visit = (coreModule, path) => {
470
+ const current = state.get(coreModule.id);
471
+ if (current === "done") return;
472
+ if (current === "visiting") {
473
+ throw new Error(`[Core] Module dependency cycle: ${[...path, coreModule.id].join(" -> ")}`);
474
+ }
475
+ state.set(coreModule.id, "visiting");
476
+ for (const id of coreModule.uses ?? []) {
477
+ const dependency = byId.get(id);
478
+ if (dependency) visit(dependency, [...path, coreModule.id]);
479
+ }
480
+ state.set(coreModule.id, "done");
481
+ sorted.push(coreModule);
482
+ };
483
+ modules.forEach((coreModule) => visit(coreModule, []));
484
+ return sorted;
485
+ }
486
+ function createModuleRegistryDefinitions(modules) {
487
+ const definitions = /* @__PURE__ */ new Map();
488
+ for (const coreModule of modules) {
489
+ if (coreModule.registry) definitions.set(coreModule.id, coreModule.registry);
490
+ }
491
+ return definitions;
492
+ }
493
+ function useInstalledModules() {
494
+ return use(ModuleHostContext)?.modules ?? EMPTY_MODULES;
495
+ }
496
+
497
+ // src/core/kernel/registry/records.ts
498
+ var SEP = "\0";
499
+ function createInitialRegistriesFor(definitions) {
500
+ return Object.fromEntries(Array.from(definitions.keys(), (type) => [type, {}]));
501
+ }
502
+ function buildSourceRecord({
503
+ source,
504
+ value,
505
+ instanceId = null,
506
+ priority,
507
+ timestamp,
508
+ sequence,
509
+ scope = DEFAULT_REGISTRY_SCOPE
510
+ }) {
511
+ return {
512
+ updatedAt: timestamp,
513
+ sequence: Number.isFinite(sequence) ? sequence : timestamp,
514
+ instanceId: typeof instanceId === "string" ? instanceId : null,
515
+ priority,
516
+ value,
517
+ source,
518
+ scope
519
+ };
520
+ }
521
+ function createRecordKey(source, instanceId = null, scope = DEFAULT_REGISTRY_SCOPE) {
522
+ const hasInstance = typeof instanceId === "string" && instanceId.length > 0;
523
+ if (scope === DEFAULT_REGISTRY_SCOPE) {
524
+ return hasInstance ? `i${SEP}${source}${SEP}${instanceId}` : `s${SEP}${source}`;
525
+ }
526
+ return hasInstance ? `I${SEP}${scope}${SEP}${source}${SEP}${instanceId}` : `S${SEP}${scope}${SEP}${source}`;
527
+ }
528
+ function getSourceRecords(entry, source, scope = null) {
529
+ if (!entry) return [];
530
+ const matches = [];
531
+ for (const recordKey in entry) {
532
+ if (!hasOwnProperty(entry, recordKey)) continue;
533
+ const record = toSourceRecord(entry[recordKey], recordKey);
534
+ if (record?.source === source && (scope === null || record.scope === scope)) {
535
+ matches.push({
536
+ recordKey,
537
+ record
538
+ });
539
+ }
540
+ }
541
+ return matches;
542
+ }
543
+ function getSourceRecord(entry, source, instanceId = null, scope = DEFAULT_REGISTRY_SCOPE) {
544
+ const recordKey = createRecordKey(source, instanceId, scope);
545
+ return toSourceRecord(entry?.[recordKey], source);
546
+ }
547
+ function resolveRecordPriority(options, source) {
548
+ if (isObject(options) && hasOwnProperty(options, "priority")) {
549
+ const parsedPriority = Number(options.priority);
550
+ if (Number.isFinite(parsedPriority)) return parsedPriority;
551
+ }
552
+ return REGISTRY_SOURCE_PRIORITY[source] ?? 0;
553
+ }
554
+ function isNormalizedRecord(value) {
555
+ if (!isObject(value)) return false;
556
+ const record = value;
557
+ return typeof record.priority === "number" && Number.isFinite(record.priority) && typeof record.updatedAt === "number" && typeof record.sequence === "number" && typeof record.source === "string" && typeof record.scope === "string" && (record.instanceId === null || typeof record.instanceId === "string") && hasOwnProperty(record, "value");
558
+ }
559
+ function toSourceRecord(rawValue, source = DEFAULT_SOURCE) {
560
+ if (rawValue === void 0) return null;
561
+ if (isNormalizedRecord(rawValue)) return rawValue;
562
+ const rawRecord = rawValue;
563
+ const isWrappedRecord = isObject(rawValue) && hasOwnProperty(rawRecord, "value") && hasOwnProperty(rawRecord, "updatedAt") && hasOwnProperty(rawRecord, "priority") && hasOwnProperty(rawRecord, "source");
564
+ if (isWrappedRecord) {
565
+ const parsedPriority = Number(rawRecord.priority);
696
566
  return {
697
- index: operations.length - 1,
698
- status: "queued",
699
- traceId
567
+ updatedAt: Number(rawRecord.updatedAt) || 0,
568
+ sequence: Number(rawRecord.sequence) || Number(rawRecord.updatedAt) || 0,
569
+ instanceId: typeof rawRecord.instanceId === "string" ? rawRecord.instanceId : null,
570
+ priority: Number.isFinite(parsedPriority) ? parsedPriority : REGISTRY_SOURCE_PRIORITY[source] ?? 0,
571
+ source: typeof rawRecord.source === "string" ? rawRecord.source : source,
572
+ scope: typeof rawRecord.scope === "string" ? rawRecord.scope : DEFAULT_REGISTRY_SCOPE,
573
+ value: rawRecord.value
700
574
  };
575
+ }
576
+ return {
577
+ updatedAt: 0,
578
+ sequence: 0,
579
+ instanceId: null,
580
+ priority: REGISTRY_SOURCE_PRIORITY[source] ?? 0,
581
+ source,
582
+ scope: DEFAULT_REGISTRY_SCOPE,
583
+ value: rawValue
701
584
  };
702
- const unregister = (type, key, sourceOrOptions) => {
703
- if (!ensureOpen()) return {
704
- index: -1,
705
- status,
706
- traceId
585
+ }
586
+ function compareRecords(a, b) {
587
+ if (a.priority !== b.priority) return a.priority - b.priority;
588
+ const rankDiff = getSourceRank(a.source) - getSourceRank(b.source);
589
+ if (rankDiff !== 0) return rankDiff;
590
+ return (a.sequence ?? a.updatedAt) - (b.sequence ?? b.updatedAt);
591
+ }
592
+ function recordsHaveSameValue(prevRecord, nextRecord) {
593
+ if (Object.is(prevRecord?.value, nextRecord?.value)) return true;
594
+ if (isObject(prevRecord?.value) && isObject(nextRecord?.value)) {
595
+ return shallowEqual(prevRecord.value, nextRecord.value);
596
+ }
597
+ return false;
598
+ }
599
+ function hasRecordChanged(prevRecord, nextRecord) {
600
+ if (!prevRecord) return true;
601
+ return prevRecord.priority !== nextRecord.priority || prevRecord.source !== nextRecord.source || prevRecord.instanceId !== nextRecord.instanceId || prevRecord.scope !== nextRecord.scope || !recordsHaveSameValue(prevRecord, nextRecord);
602
+ }
603
+ function hasAnySourceRecord(entry) {
604
+ if (!entry) return false;
605
+ for (const recordKey in entry) {
606
+ if (hasOwnProperty(entry, recordKey) && entry[recordKey] !== void 0) {
607
+ return true;
608
+ }
609
+ }
610
+ return false;
611
+ }
612
+ function setSourceRecord(state, type, key, source, record) {
613
+ const typeRegistry = state[type] || {};
614
+ const currentEntry = typeRegistry[key] || {};
615
+ const recordKey = createRecordKey(source, record.instanceId, record.scope);
616
+ const prevRecord = toSourceRecord(currentEntry[recordKey], source);
617
+ if (!hasRecordChanged(prevRecord, record)) {
618
+ return state;
619
+ }
620
+ return {
621
+ ...state,
622
+ [type]: {
623
+ ...typeRegistry,
624
+ [key]: {
625
+ ...currentEntry,
626
+ [recordKey]: record
627
+ }
628
+ }
629
+ };
630
+ }
631
+ function findRecordsToRemove(entry, source, instanceId, scope) {
632
+ if (typeof instanceId === "string" && instanceId.length > 0 && scope !== null) {
633
+ const safeScope = scope || DEFAULT_REGISTRY_SCOPE;
634
+ const record = getSourceRecord(entry, source, instanceId, safeScope);
635
+ if (!record) return [];
636
+ return [{
637
+ recordKey: createRecordKey(source, instanceId, safeScope),
638
+ record
639
+ }];
640
+ }
641
+ return getSourceRecords(entry, source, scope).filter(({
642
+ record
643
+ }) => !instanceId || record?.instanceId === instanceId).filter((candidate) => Boolean(candidate.record));
644
+ }
645
+ function removeSourceRecord(state, type, key, source, instanceId = null, scope = null) {
646
+ const typeRegistry = state[type];
647
+ const currentEntry = typeRegistry?.[key];
648
+ if (!typeRegistry || !currentEntry) return state;
649
+ const activeRecords = findRecordsToRemove(currentEntry, source, instanceId, scope);
650
+ if (activeRecords.length === 0) return state;
651
+ const nextEntry = {
652
+ ...currentEntry
653
+ };
654
+ activeRecords.forEach(({
655
+ recordKey
656
+ }) => {
657
+ delete nextEntry[recordKey];
658
+ });
659
+ if (!hasAnySourceRecord(nextEntry)) {
660
+ const nextTypeRegistry = {
661
+ ...typeRegistry
707
662
  };
708
- const options = mergeOptions(typeof sourceOrOptions === "string" ? {
709
- source: sourceOrOptions
710
- } : sourceOrOptions);
711
- operations.push({
712
- key,
713
- options,
714
- type,
715
- unregister: true
716
- });
663
+ delete nextTypeRegistry[key];
717
664
  return {
718
- index: operations.length - 1,
719
- status: "queued",
720
- traceId
665
+ ...state,
666
+ [type]: nextTypeRegistry
721
667
  };
668
+ }
669
+ return {
670
+ ...state,
671
+ [type]: {
672
+ ...typeRegistry,
673
+ [key]: nextEntry
674
+ }
722
675
  };
723
- const rollback = (_reason = "manual") => {
724
- if (!ensureOpen()) return {
725
- index: -1,
726
- status,
727
- traceId
676
+ }
677
+
678
+ // src/core/kernel/registry/operations.ts
679
+ function createRegisterOperation(type, key, item, sourceOrOptions, optionsArg, timestamp, sequence = timestamp) {
680
+ const {
681
+ source,
682
+ options
683
+ } = resolveRegisterInput(sourceOrOptions, optionsArg);
684
+ const instanceId = resolveInstanceId(options);
685
+ const scope = resolveScope(options);
686
+ return {
687
+ kind: "register",
688
+ validation: options.validation,
689
+ source,
690
+ scope,
691
+ record: buildSourceRecord({
692
+ source,
693
+ value: item,
694
+ instanceId,
695
+ priority: resolveRecordPriority(options, source),
696
+ scope,
697
+ timestamp,
698
+ sequence
699
+ }),
700
+ instanceId,
701
+ type,
702
+ key: typeof key === "string" ? key.trim() : key
703
+ };
704
+ }
705
+ function createUnregisterOperation(type, key, sourceOrOptions) {
706
+ const {
707
+ scope,
708
+ source,
709
+ instanceId
710
+ } = resolveUnregisterInput(sourceOrOptions);
711
+ return {
712
+ kind: "unregister",
713
+ instanceId,
714
+ scope,
715
+ source,
716
+ type,
717
+ key: typeof key === "string" ? key.trim() : key
718
+ };
719
+ }
720
+ function isValidRegistryTargetFor(definitions, type, key) {
721
+ return validateRegistryKey(type, key, definitions).valid;
722
+ }
723
+ function applyOperationFor(definitions, state, operation) {
724
+ if (!isValidRegistryTargetFor(definitions, operation?.type, operation?.key)) return state;
725
+ if (operation.kind === "register") {
726
+ return setSourceRecord(state, operation.type, operation.key, operation.source, operation.record);
727
+ }
728
+ if (operation.kind === "unregister") {
729
+ return removeSourceRecord(state, operation.type, operation.key, operation.source, operation.instanceId, operation.scope);
730
+ }
731
+ return state;
732
+ }
733
+ function unregisterHasEffect(entry, operation) {
734
+ const {
735
+ instanceId,
736
+ scope,
737
+ source
738
+ } = operation;
739
+ if (typeof instanceId !== "string" || instanceId.length === 0) {
740
+ return getSourceRecords(entry, source, scope).length > 0;
741
+ }
742
+ if (scope === null) {
743
+ return getSourceRecords(entry, source).some(({
744
+ record
745
+ }) => record?.instanceId === instanceId);
746
+ }
747
+ return Boolean(getSourceRecord(entry, source, instanceId, scope));
748
+ }
749
+ function hasOperationEffectFor(definitions, state, operation) {
750
+ if (!isValidRegistryTargetFor(definitions, operation?.type, operation?.key)) return false;
751
+ if (operation.kind === "register") {
752
+ const currentRecord = getSourceRecord(state[operation.type]?.[operation.key], operation.source, operation.instanceId, operation.scope);
753
+ return hasRecordChanged(currentRecord, operation.record);
754
+ }
755
+ if (operation.kind === "unregister") {
756
+ return unregisterHasEffect(state[operation.type]?.[operation.key], operation);
757
+ }
758
+ return false;
759
+ }
760
+ function writableEntry(draft, type, key) {
761
+ if (draft.state === draft.base) draft.state = {
762
+ ...draft.base
763
+ };
764
+ if (!draft.types.has(type)) {
765
+ draft.state[type] = {
766
+ ...draft.state[type] || {}
728
767
  };
729
- status = "rolled-back";
730
- operations.length = 0;
731
- return {
732
- index: -1,
733
- status,
734
- traceId
768
+ draft.types.add(type);
769
+ }
770
+ const registry = draft.state[type];
771
+ const id = `${type}\0${key}`;
772
+ let entry = registry[key];
773
+ if (!draft.entries.has(id) || !entry) {
774
+ entry = {
775
+ ...entry || {}
735
776
  };
777
+ registry[key] = entry;
778
+ draft.entries.add(id);
779
+ }
780
+ return entry;
781
+ }
782
+ function applyOperationToDraft(draft, operation) {
783
+ if (operation.kind === "register") {
784
+ const entry2 = writableEntry(draft, operation.type, operation.key);
785
+ const recordKey = createRecordKey(operation.source, operation.record.instanceId, operation.record.scope);
786
+ entry2[recordKey] = operation.record;
787
+ return;
788
+ }
789
+ const current = draft.state[operation.type]?.[operation.key];
790
+ if (!current) return;
791
+ const records = findRecordsToRemove(current, operation.source, operation.instanceId, operation.scope);
792
+ if (records.length === 0) return;
793
+ const entry = writableEntry(draft, operation.type, operation.key);
794
+ for (const {
795
+ recordKey
796
+ } of records) delete entry[recordKey];
797
+ if (!hasAnySourceRecord(entry)) delete draft.state[operation.type][operation.key];
798
+ }
799
+ function resolveEffectiveOperationsFor(definitions, state, operations) {
800
+ const effectiveOperations = [];
801
+ const draft = {
802
+ base: state,
803
+ entries: /* @__PURE__ */ new Set(),
804
+ state,
805
+ types: /* @__PURE__ */ new Set()
736
806
  };
737
- const commit = () => {
738
- if (!ensureOpen()) return {
739
- status,
740
- traceId
741
- };
742
- status = "committed";
743
- const result = store.batch((queue) => {
744
- operations.forEach((op) => {
745
- if (op.unregister) queue.unregister(op.type, op.key, op.options);
746
- else queue.register(op.type, op.key, op.item, op.options);
747
- });
748
- });
749
- const applied = typeof result === "number" && Number.isFinite(result) ? result : 0;
750
- return {
751
- applied,
752
- queued: operations.length,
753
- status,
754
- traceId
755
- };
807
+ for (const operation of operations) {
808
+ if (!hasOperationEffectFor(definitions, draft.state, operation)) continue;
809
+ effectiveOperations.push(operation);
810
+ applyOperationToDraft(draft, operation);
811
+ }
812
+ return {
813
+ effectiveOperations,
814
+ nextState: draft.state
756
815
  };
757
- const run = (executor) => {
758
- if (typeof executor !== "function") {
759
- rollback("invalid-executor");
760
- return {
761
- status,
762
- traceId
763
- };
816
+ }
817
+ function resolveEntryValueFor(definitions, type, entry, scope = null) {
818
+ if (!entry) return void 0;
819
+ const activeRecords = [];
820
+ for (const recordKey in entry) {
821
+ if (!hasOwnProperty(entry, recordKey)) continue;
822
+ const record = toSourceRecord(entry[recordKey], recordKey);
823
+ if (record !== null && (scope === null || record.scope === scope)) {
824
+ activeRecords.push(record);
764
825
  }
765
- try {
766
- executor({
767
- register,
768
- unregister
769
- });
770
- return commit();
771
- } catch (error) {
772
- rollback(error instanceof Error ? error.message : String(error));
773
- throw error;
826
+ }
827
+ if (activeRecords.length === 0) return void 0;
828
+ const merge = definitions.get(type)?.merge;
829
+ if (activeRecords.length === 1) {
830
+ const [only] = activeRecords;
831
+ return merge && isObject(only.value) ? merge([only.value]) : only.value;
832
+ }
833
+ if (merge) {
834
+ const sortedRecords = activeRecords.sort(compareRecords);
835
+ const mergeCandidate = sortedRecords.every((record) => isObject(record.value));
836
+ if (mergeCandidate) {
837
+ const values = sortedRecords.map((record) => record.value);
838
+ return merge(values);
774
839
  }
775
- };
776
- return {
777
- commit,
778
- get operations() {
779
- return operations.slice();
780
- },
781
- register,
782
- rollback,
783
- run,
784
- get status() {
785
- return status;
786
- },
787
- traceId,
788
- unregister
840
+ return sortedRecords[sortedRecords.length - 1].value;
841
+ }
842
+ return activeRecords.reduce((winner, current) => compareRecords(current, winner) > 0 ? current : winner).value;
843
+ }
844
+ function createResolverCacheFor(definitions) {
845
+ const entryCache = /* @__PURE__ */ new WeakMap();
846
+ return (type, entry, scope = null) => {
847
+ if (!entry || typeof entry !== "object") {
848
+ return resolveEntryValueFor(definitions, type, entry, scope);
849
+ }
850
+ const typeCache = getOrInsert(entryCache, entry, () => /* @__PURE__ */ new Map());
851
+ const cacheKey = scope || "default";
852
+ if (typeCache.has(cacheKey)) return typeCache.get(cacheKey);
853
+ const value = resolveEntryValueFor(definitions, type, entry, scope);
854
+ typeCache.set(cacheKey, value);
855
+ return value;
789
856
  };
790
857
  }
791
-
792
- // src/core/kernel/store-handles.ts
793
- var DEFAULT_VALIDATION = REGISTRY_VALIDATION_MODES.WARN;
794
- function createNoopHandle(status = "rejected", reason = "unknown") {
795
- const handle = Object.assign(() => false, {
796
- active: false,
797
- dispose: () => false,
798
- instanceId: null,
799
- key: "",
800
- priority: 0,
801
- reason,
802
- source: "",
803
- status,
804
- type: "",
805
- update: () => handle,
806
- updatedAt: 0,
807
- validation: DEFAULT_VALIDATION
858
+ function createRegistryOperations(definitions) {
859
+ return Object.freeze({
860
+ applyOperation: (state, operation) => applyOperationFor(definitions, state, operation),
861
+ createInitialRegistries: () => createInitialRegistriesFor(definitions),
862
+ createResolverCache: () => createResolverCacheFor(definitions),
863
+ hasOperationEffect: (state, operation) => hasOperationEffectFor(definitions, state, operation),
864
+ isRegistryType: (type) => definitions.get(type) !== void 0,
865
+ isValidRegistryTarget: (type, key) => isValidRegistryTargetFor(definitions, type, key),
866
+ resolveEffectiveOperations: (state, operations) => resolveEffectiveOperationsFor(definitions, state, operations),
867
+ resolveEntryValue: (type, entry, scope = null) => resolveEntryValueFor(definitions, type, entry, scope)
808
868
  });
809
- return handle;
810
869
  }
870
+ var DEFAULT_VALIDATION = REGISTRY_VALIDATION_MODES.WARN;
811
871
  var NOOP_HANDLE = createNoopHandle();
812
- function isNoopHandle(handle) {
813
- return handle === NOOP_HANDLE || handle?.status === "rejected" || handle?.status === "ignored";
814
- }
815
- function createRegistrationHandle(store, operation) {
816
- let disposed = false;
817
- const dispose = (reason = "manual") => {
818
- if (disposed) return false;
819
- disposed = true;
820
- return store.dispose(operation, reason);
821
- };
822
- const handle = (reason) => dispose(reason);
823
- handle.dispose = dispose;
824
- handle.update = (value, options = {}) => {
825
- if (disposed || !store.isCurrent(operation)) return NOOP_HANDLE;
826
- const nextHandle = store.register(operation.type, operation.key, value, operation.source, {
827
- ...typeof options === "object" ? options : {},
828
- instanceId: operation.instanceId,
829
- priority: operation.record.priority,
830
- ...operation.scope ? {
831
- scope: operation.scope
832
- } : {},
833
- ...operation.validation ? {
834
- validation: operation.validation
835
- } : {}
836
- });
837
- if (isNoopHandle(nextHandle)) return handle;
838
- disposed = true;
839
- return nextHandle;
840
- };
841
- Object.defineProperties(handle, {
842
- active: {
843
- enumerable: true,
844
- get: () => !disposed && store.isCurrent(operation)
845
- },
846
- instanceId: {
847
- enumerable: true,
848
- value: operation.instanceId
849
- },
850
- key: {
851
- enumerable: true,
852
- value: operation.key
853
- },
854
- priority: {
855
- enumerable: true,
856
- value: operation.record.priority
857
- },
858
- source: {
859
- enumerable: true,
860
- value: operation.source
861
- },
862
- status: {
863
- enumerable: true,
864
- get: () => {
865
- if (disposed) return "disposed";
866
- return store.isCurrent(operation) ? "active" : "superseded";
867
- }
868
- },
869
- type: {
870
- enumerable: true,
871
- value: operation.type
872
- },
873
- updatedAt: {
874
- enumerable: true,
875
- value: operation.record.updatedAt
876
- },
877
- validation: {
878
- enumerable: true,
879
- value: operation.validation || DEFAULT_VALIDATION
880
- }
881
- });
882
- return handle;
883
- }
884
872
  function cloneRegistryValue(value, seen = /* @__PURE__ */ new WeakMap()) {
885
873
  if (value === null || typeof value !== "object" || isValidElement(value)) {
886
874
  return value;
887
875
  }
888
- const prototype = Object.getPrototypeOf(value);
889
- const isPlainObject2 = !Array.isArray(value) && (prototype === Object.prototype || prototype === null);
890
- if (!Array.isArray(value) && !isPlainObject2) return value;
876
+ if (!Array.isArray(value) && !isPlainObject(value)) return value;
891
877
  if (seen.has(value)) return seen.get(value);
892
878
  const source = value;
893
879
  const clone = Array.isArray(value) ? [] : {};
894
880
  seen.set(value, clone);
895
881
  for (const key in source) {
896
- if (Object.prototype.hasOwnProperty.call(source, key)) {
882
+ if (hasOwnProperty(source, key)) {
897
883
  clone[key] = cloneRegistryValue(source[key], seen);
898
884
  }
899
885
  }
@@ -943,31 +929,95 @@ function prepareRegisterOperation(ops, definitions, type, key, item, sourceOrOpt
943
929
  operation: createRegisterOperation(type, key, cloneRegistryValue(item), sourceOrOptions, optionsArg, timestamp, sequence)
944
930
  };
945
931
  }
946
-
947
- // src/core/kernel/store-batch.ts
948
- function createBatchQueue({
949
- definitions,
950
- getStore,
951
- nextSequence,
952
- operations,
953
- ops,
954
- timestamp
955
- }) {
956
- return {
957
- register: (type, key, item, sourceOrOptions = DEFAULT_SOURCE, optionsArg = {}) => {
958
- const prepared = prepareRegisterOperation(ops, definitions, type, key, item, sourceOrOptions, optionsArg, timestamp, nextSequence());
959
- if ("rejected" in prepared) return prepared.rejected;
960
- operations.push(prepared.operation);
961
- return createRegistrationHandle(getStore(), prepared.operation);
932
+ function createNoopHandle(status = "rejected", reason = "unknown") {
933
+ const handle = Object.assign(() => false, {
934
+ active: false,
935
+ dispose: () => false,
936
+ instanceId: null,
937
+ key: "",
938
+ priority: 0,
939
+ reason,
940
+ source: "",
941
+ status,
942
+ type: "",
943
+ update: () => handle,
944
+ updatedAt: 0,
945
+ validation: DEFAULT_VALIDATION
946
+ });
947
+ return handle;
948
+ }
949
+ function isNoopHandle(handle) {
950
+ return handle?.status === "rejected" || handle?.status === "ignored";
951
+ }
952
+ function createRegistrationHandle(store, operation) {
953
+ let disposed = false;
954
+ const dispose = (reason = "manual") => {
955
+ if (disposed) return false;
956
+ disposed = true;
957
+ return store.dispose(operation, reason);
958
+ };
959
+ const handle = (reason) => dispose(reason);
960
+ handle.dispose = dispose;
961
+ handle.update = (value, options = {}) => {
962
+ if (disposed || !store.isCurrent(operation)) return NOOP_HANDLE;
963
+ const nextHandle = store.register(operation.type, operation.key, value, operation.source, {
964
+ ...typeof options === "object" ? options : {},
965
+ instanceId: operation.instanceId,
966
+ priority: operation.record.priority,
967
+ ...operation.scope ? {
968
+ scope: operation.scope
969
+ } : {},
970
+ ...operation.validation ? {
971
+ validation: operation.validation
972
+ } : {}
973
+ });
974
+ if (isNoopHandle(nextHandle)) return handle;
975
+ disposed = true;
976
+ return nextHandle;
977
+ };
978
+ Object.defineProperties(handle, {
979
+ active: {
980
+ enumerable: true,
981
+ get: () => !disposed && store.isCurrent(operation)
962
982
  },
963
- unregister: (type, key, sourceOrOptions = DEFAULT_SOURCE) => {
964
- if (!ops.isValidRegistryTarget(type, key)) return;
965
- operations.push(createUnregisterOperation(type, key, sourceOrOptions));
983
+ instanceId: {
984
+ enumerable: true,
985
+ value: operation.instanceId
986
+ },
987
+ key: {
988
+ enumerable: true,
989
+ value: operation.key
990
+ },
991
+ priority: {
992
+ enumerable: true,
993
+ value: operation.record.priority
994
+ },
995
+ source: {
996
+ enumerable: true,
997
+ value: operation.source
998
+ },
999
+ status: {
1000
+ enumerable: true,
1001
+ get: () => {
1002
+ if (disposed) return "disposed";
1003
+ return store.isCurrent(operation) ? "active" : "superseded";
1004
+ }
1005
+ },
1006
+ type: {
1007
+ enumerable: true,
1008
+ value: operation.type
1009
+ },
1010
+ updatedAt: {
1011
+ enumerable: true,
1012
+ value: operation.record.updatedAt
1013
+ },
1014
+ validation: {
1015
+ enumerable: true,
1016
+ value: operation.validation || DEFAULT_VALIDATION
966
1017
  }
967
- };
1018
+ });
1019
+ return handle;
968
1020
  }
969
-
970
- // src/core/kernel/store-entries.ts
971
1021
  function normalizeInitialEntries(entries) {
972
1022
  return (Array.isArray(entries) ? entries : []).filter((entry) => Boolean(entry?.type && entry?.items && typeof entry.items === "object"));
973
1023
  }
@@ -995,18 +1045,14 @@ function createInitialState(ops, definitions, entries) {
995
1045
  return state;
996
1046
  }
997
1047
 
998
- // src/core/kernel/store-snapshots.ts
1048
+ // src/core/kernel/registry/snapshots.ts
999
1049
  var SCOPE_KEY_SEPARATOR = "\0";
1000
1050
  function createSnapshotReaders(getState, resolveValue) {
1001
1051
  const entrySnapshots = /* @__PURE__ */ new Map();
1002
1052
  const valueSnapshots = /* @__PURE__ */ new Map();
1003
1053
  const getSnapshot = (type, key, scope = null) => {
1004
1054
  const entry = getState()[type]?.[key];
1005
- let snapshots = valueSnapshots.get(type);
1006
- if (!snapshots) {
1007
- snapshots = /* @__PURE__ */ new Map();
1008
- valueSnapshots.set(type, snapshots);
1009
- }
1055
+ const snapshots = getOrInsert(valueSnapshots, type, () => /* @__PURE__ */ new Map());
1010
1056
  const cacheKey = scope === null ? key : `${scope}${SCOPE_KEY_SEPARATOR}${key}`;
1011
1057
  if (entry === void 0) {
1012
1058
  snapshots.delete(cacheKey);
@@ -1037,543 +1083,455 @@ function createSnapshotReaders(getState, resolveValue) {
1037
1083
  entrySnapshots.set(cacheKey, {
1038
1084
  typeRegistry,
1039
1085
  value: finalValue
1040
- });
1041
- return finalValue;
1042
- };
1043
- return {
1044
- getEntriesSnapshot,
1045
- getSnapshot
1046
- };
1047
- }
1048
-
1049
- // src/core/kernel/store-subscriptions.ts
1050
- function notifyListeners(listeners) {
1051
- if (!listeners) return;
1052
- for (const listener of listeners) {
1053
- try {
1054
- listener();
1055
- } catch (error) {
1056
- report("Registry listener", error);
1057
- }
1058
- }
1059
- }
1060
- function getOrCreateKeyListeners(listenersByType, type, key) {
1061
- let listeners = listenersByType.get(type);
1062
- if (!listeners) {
1063
- listeners = /* @__PURE__ */ new Map();
1064
- listenersByType.set(type, listeners);
1065
- }
1066
- let keyListeners = listeners.get(key);
1067
- if (!keyListeners) {
1068
- keyListeners = /* @__PURE__ */ new Set();
1069
- listeners.set(key, keyListeners);
1070
- }
1071
- return keyListeners;
1072
- }
1073
- function collectChangedKeys(operations, isValidTarget) {
1074
- const changedKeysByType = /* @__PURE__ */ new Map();
1075
- for (const operation of operations) {
1076
- if (!isValidTarget(operation?.type, operation?.key)) continue;
1077
- let keys = changedKeysByType.get(operation.type);
1078
- if (!keys) {
1079
- keys = /* @__PURE__ */ new Set();
1080
- changedKeysByType.set(operation.type, keys);
1081
- }
1082
- keys.add(operation.key);
1083
- }
1084
- return changedKeysByType;
1085
- }
1086
- function createListenerRegistry() {
1087
- const listenersByType = /* @__PURE__ */ new Map();
1088
- function subscribe(type, key, listener) {
1089
- const keyListeners = getOrCreateKeyListeners(listenersByType, type, key ?? null);
1090
- keyListeners.add(listener);
1091
- return () => {
1092
- keyListeners.delete(listener);
1093
- if (keyListeners.size > 0) return;
1094
- const listeners = listenersByType.get(type);
1095
- if (listeners) {
1096
- listeners.delete(key ?? null);
1097
- if (listeners.size === 0) listenersByType.delete(type);
1098
- }
1099
- };
1100
- }
1101
- function notifyChanged(previousState, nextState, changedKeysByType) {
1102
- for (const [type, changedKeys] of changedKeysByType) {
1103
- const previousRegistry = previousState[type] || {};
1104
- const nextRegistry = nextState[type] || {};
1105
- const typeListeners = listenersByType.get(type);
1106
- let typeChanged = false;
1107
- if (!typeListeners) continue;
1108
- for (const key of changedKeys) {
1109
- if (previousRegistry[key] === nextRegistry[key]) continue;
1110
- typeChanged = true;
1111
- notifyListeners(typeListeners.get(key));
1112
- }
1113
- if (typeChanged) {
1114
- notifyListeners(typeListeners.get(null));
1115
- }
1116
- }
1117
- }
1118
- return {
1119
- notifyChanged,
1120
- subscribe
1121
- };
1122
- }
1123
-
1124
- // src/core/kernel/store.ts
1125
- var NO_DEFINITIONS = /* @__PURE__ */ new Map();
1126
- function createRegistryStore(initialEntries = [], definitions = NO_DEFINITIONS) {
1127
- const ops = createRegistryOperations(definitions);
1128
- let registries = createInitialState(ops, definitions, initialEntries);
1129
- let sequence = normalizeInitialEntries(initialEntries).reduce((count, entry) => count + Object.keys(entry.items).length, 0);
1130
- const listeners = createListenerRegistry();
1131
- const resolveCachedValue = ops.createResolverCache();
1132
- const {
1133
- getEntriesSnapshot,
1134
- getSnapshot
1135
- } = createSnapshotReaders(() => registries, resolveCachedValue);
1136
- const commit = (nextState, operations = []) => {
1137
- if (registries === nextState) return;
1138
- const previousState = registries;
1139
- registries = nextState;
1140
- listeners.notifyChanged(previousState, nextState, collectChangedKeys(operations, ops.isValidRegistryTarget));
1141
- };
1142
- const isCurrent = (operation) => {
1143
- const entry = registries[operation.type]?.[operation.key];
1144
- const recordKey = createRecordKey(operation.source, operation.instanceId, operation.scope);
1145
- return entry?.[recordKey] === operation.record;
1146
- };
1147
- const dispose = (operation, _reason = "manual") => {
1148
- if (!isCurrent(operation)) return false;
1149
- const unregisterOperation = createUnregisterOperation(operation.type, operation.key, {
1150
- source: operation.source,
1151
- instanceId: operation.instanceId,
1152
- scope: operation.scope
1153
- });
1154
- if (!ops.hasOperationEffect(registries, unregisterOperation)) return false;
1155
- commit(ops.applyOperation(registries, unregisterOperation), [unregisterOperation]);
1156
- return true;
1157
- };
1158
- const register = (type, key, item, sourceOrOptions = DEFAULT_SOURCE, optionsArg = {}) => {
1159
- const prepared = prepareRegisterOperation(ops, definitions, type, key, item, sourceOrOptions, optionsArg, Date.now(), ++sequence);
1160
- if ("rejected" in prepared) return prepared.rejected;
1161
- const {
1162
- operation
1163
- } = prepared;
1164
- if (!ops.hasOperationEffect(registries, operation)) {
1165
- return createNoopHandle("ignored", "unchanged");
1166
- }
1167
- commit(ops.applyOperation(registries, operation), [operation]);
1168
- return createRegistrationHandle(store, operation);
1169
- };
1170
- const unregister = (type, key, sourceOrOptions = DEFAULT_SOURCE) => {
1171
- if (!ops.isValidRegistryTarget(type, key)) return;
1172
- const operation = createUnregisterOperation(type, key, sourceOrOptions);
1173
- if (!ops.hasOperationEffect(registries, operation)) return;
1174
- commit(ops.applyOperation(registries, operation), [operation]);
1175
- };
1176
- const batch = (executor) => {
1177
- if (typeof executor !== "function") return 0;
1178
- const operations = [];
1179
- executor(createBatchQueue({
1180
- definitions,
1181
- getStore: () => store,
1182
- nextSequence: () => ++sequence,
1183
- operations,
1184
- ops,
1185
- timestamp: Date.now()
1186
- }));
1187
- if (operations.length === 0) return 0;
1188
- const {
1189
- effectiveOperations,
1190
- nextState
1191
- } = ops.resolveEffectiveOperations(registries, operations);
1192
- if (effectiveOperations.length === 0) return 0;
1193
- commit(nextState, effectiveOperations);
1194
- return effectiveOperations.length;
1195
- };
1196
- const store = {
1197
- batch,
1198
- dispose,
1199
- getEntriesSnapshot,
1200
- getSnapshot,
1201
- isCurrent,
1202
- register,
1203
- subscribe: listeners.subscribe,
1204
- transaction: (executor, metadata = {}) => createRegistryTransaction(store, metadata).run(executor),
1205
- unregister
1206
- };
1207
- return store;
1208
- }
1209
- var keyedSubscriptions = /* @__PURE__ */ new WeakMap();
1210
- function keyedSubscription(subscription, id, create) {
1211
- let byId = keyedSubscriptions.get(subscription);
1212
- if (!byId) {
1213
- byId = /* @__PURE__ */ new Map();
1214
- keyedSubscriptions.set(subscription, byId);
1215
- }
1216
- let entry = byId.get(id);
1217
- if (!entry) {
1218
- entry = create();
1219
- byId.set(id, entry);
1220
- }
1221
- return entry;
1222
- }
1223
- function createRegistryContextValue(store) {
1224
- return {
1225
- actions: {
1226
- batch: store.batch,
1227
- register: store.register,
1228
- transaction: store.transaction,
1229
- unregister: store.unregister
1230
- },
1231
- subscription: {
1232
- getEntriesSnapshot: store.getEntriesSnapshot,
1233
- getSnapshot: store.getSnapshot,
1234
- subscribe: store.subscribe
1235
- }
1236
- };
1237
- }
1238
- var RegistryContext = getOrCreateGlobalContext("RegistryContext", null);
1239
- function RegistryProvider(t0) {
1240
- const $ = c(8);
1241
- const {
1242
- children,
1243
- definitions,
1244
- initialEntries: t1
1245
- } = t0;
1246
- let t2;
1247
- if ($[0] !== t1) {
1248
- t2 = t1 === void 0 ? [] : t1;
1249
- $[0] = t1;
1250
- $[1] = t2;
1251
- } else {
1252
- t2 = $[1];
1253
- }
1254
- const initialEntries = t2;
1255
- let t3;
1256
- if ($[2] !== definitions || $[3] !== initialEntries) {
1257
- t3 = () => createRegistryContextValue(createRegistryStore(initialEntries, definitions));
1258
- $[2] = definitions;
1259
- $[3] = initialEntries;
1260
- $[4] = t3;
1261
- } else {
1262
- t3 = $[4];
1263
- }
1264
- const [contextValue] = useState(t3);
1265
- let t4;
1266
- if ($[5] !== children || $[6] !== contextValue) {
1267
- t4 = /* @__PURE__ */ jsx(RegistryContext, { value: contextValue, children });
1268
- $[5] = children;
1269
- $[6] = contextValue;
1270
- $[7] = t4;
1271
- } else {
1272
- t4 = $[7];
1273
- }
1274
- return t4;
1086
+ });
1087
+ return finalValue;
1088
+ };
1089
+ return {
1090
+ getEntriesSnapshot,
1091
+ getSnapshot
1092
+ };
1275
1093
  }
1276
- function useRegistryActions() {
1277
- return useRequiredContext(RegistryContext, "useRegistryActions", "RegistryProvider").actions;
1094
+
1095
+ // src/core/kernel/registry/subscriptions.ts
1096
+ function notifyListeners(listeners) {
1097
+ if (!listeners) return;
1098
+ for (const listener of listeners) {
1099
+ try {
1100
+ listener();
1101
+ } catch (error) {
1102
+ report("Registry listener", error);
1103
+ }
1104
+ }
1278
1105
  }
1279
- function useRegistrySubscription() {
1280
- return useRequiredContext(RegistryContext, "useRegistrySubscription", "RegistryProvider").subscription;
1106
+ function getOrCreateKeyListeners(listenersByType, type, key) {
1107
+ const listeners = getOrInsert(listenersByType, type, () => /* @__PURE__ */ new Map());
1108
+ return getOrInsert(listeners, key, () => /* @__PURE__ */ new Set());
1281
1109
  }
1282
- function useRegistryValue(type, key) {
1283
- const $ = c(8);
1284
- const subscription = useRegistrySubscription();
1285
- const t0 = `value\0${type}\0${key}`;
1286
- let t1;
1287
- if ($[0] !== key || $[1] !== subscription || $[2] !== type) {
1288
- t1 = () => ({
1289
- getSnapshot: () => subscription.getSnapshot(type, key),
1290
- subscribe: (listener) => subscription.subscribe(type, key, listener)
1291
- });
1292
- $[0] = key;
1293
- $[1] = subscription;
1294
- $[2] = type;
1295
- $[3] = t1;
1296
- } else {
1297
- t1 = $[3];
1298
- }
1299
- let t2;
1300
- if ($[4] !== subscription || $[5] !== t0 || $[6] !== t1) {
1301
- t2 = keyedSubscription(subscription, t0, t1);
1302
- $[4] = subscription;
1303
- $[5] = t0;
1304
- $[6] = t1;
1305
- $[7] = t2;
1306
- } else {
1307
- t2 = $[7];
1110
+ function collectChangedKeys(operations, isValidTarget) {
1111
+ const changedKeysByType = /* @__PURE__ */ new Map();
1112
+ for (const operation of operations) {
1113
+ if (!isValidTarget(operation?.type, operation?.key)) continue;
1114
+ const keys = getOrInsert(changedKeysByType, operation.type, () => /* @__PURE__ */ new Set());
1115
+ keys.add(operation.key);
1308
1116
  }
1309
- const {
1310
- getSnapshot,
1311
- subscribe
1312
- } = t2;
1313
- return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
1117
+ return changedKeysByType;
1314
1118
  }
1315
- function useRegistryEntries(type) {
1316
- const $ = c(7);
1317
- const subscription = useRegistrySubscription();
1318
- const t0 = `entries\0${type}`;
1319
- let t1;
1320
- if ($[0] !== subscription || $[1] !== type) {
1321
- t1 = () => ({
1322
- getSnapshot: () => subscription.getEntriesSnapshot(type),
1323
- subscribe: (listener) => subscription.subscribe(type, null, listener)
1324
- });
1325
- $[0] = subscription;
1326
- $[1] = type;
1327
- $[2] = t1;
1328
- } else {
1329
- t1 = $[2];
1119
+ function createListenerRegistry() {
1120
+ const listenersByType = /* @__PURE__ */ new Map();
1121
+ function subscribe(type, key, listener) {
1122
+ const keyListeners = getOrCreateKeyListeners(listenersByType, type, key ?? null);
1123
+ keyListeners.add(listener);
1124
+ return () => {
1125
+ keyListeners.delete(listener);
1126
+ if (keyListeners.size > 0) return;
1127
+ const listeners = listenersByType.get(type);
1128
+ if (listeners) {
1129
+ listeners.delete(key ?? null);
1130
+ if (listeners.size === 0) listenersByType.delete(type);
1131
+ }
1132
+ };
1330
1133
  }
1331
- let t2;
1332
- if ($[3] !== subscription || $[4] !== t0 || $[5] !== t1) {
1333
- t2 = keyedSubscription(subscription, t0, t1);
1334
- $[3] = subscription;
1335
- $[4] = t0;
1336
- $[5] = t1;
1337
- $[6] = t2;
1338
- } else {
1339
- t2 = $[6];
1134
+ function notifyChanged(previousState, nextState, changedKeysByType) {
1135
+ for (const [type, changedKeys] of changedKeysByType) {
1136
+ const previousRegistry = previousState[type] || {};
1137
+ const nextRegistry = nextState[type] || {};
1138
+ const typeListeners = listenersByType.get(type);
1139
+ let typeChanged = false;
1140
+ if (!typeListeners) continue;
1141
+ for (const key of changedKeys) {
1142
+ if (previousRegistry[key] === nextRegistry[key]) continue;
1143
+ typeChanged = true;
1144
+ notifyListeners(typeListeners.get(key));
1145
+ }
1146
+ if (typeChanged) {
1147
+ notifyListeners(typeListeners.get(null));
1148
+ }
1149
+ }
1340
1150
  }
1341
- const {
1342
- getSnapshot,
1151
+ return {
1152
+ notifyChanged,
1343
1153
  subscribe
1344
- } = t2;
1345
- return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
1154
+ };
1346
1155
  }
1347
- var EMPTY_MODULES = Object.freeze([]);
1348
- var PassthroughBoundary = ({
1349
- children
1350
- }) => children;
1351
- var ModuleHostContext = getOrCreateGlobalContext("ModuleHostContext", null);
1352
- function selectModuleSlice(coreModule, config) {
1353
- const slice = coreModule.page?.select ? coreModule.page.select(config) : config[coreModule.id];
1354
- return slice ?? null;
1156
+
1157
+ // src/core/kernel/registry/transaction.ts
1158
+ var TRACE_RADIX = 36;
1159
+ var TRACE_SUFFIX_LENGTH = 6;
1160
+ function createTraceId() {
1161
+ const time = Date.now().toString(TRACE_RADIX);
1162
+ const suffix = Math.random().toString(TRACE_RADIX).slice(2, 2 + TRACE_SUFFIX_LENGTH);
1163
+ return `tx-${time}-${suffix}`;
1355
1164
  }
1356
- function createModulePayload(modules, config, metadata = {}) {
1357
- const payload = {};
1358
- let hasSlices = false;
1359
- for (const coreModule of modules) {
1360
- if (!coreModule.page?.entries) continue;
1361
- const slice = selectModuleSlice(coreModule, config);
1362
- if (slice === null) continue;
1363
- payload[coreModule.id] = slice;
1364
- hasSlices = true;
1365
- }
1366
- if (!hasSlices) return null;
1165
+ function withTransactionDefaults(metadata, options) {
1166
+ const baseOpts = options && typeof options === "object" ? options : {};
1167
+ const needsSource = metadata.source && !baseOpts.source;
1168
+ const needsScope = metadata.scope && !baseOpts.scope;
1169
+ if (!needsSource && !needsScope) return baseOpts;
1367
1170
  return {
1368
- ...payload,
1369
- registry: {
1370
- ...metadata,
1371
- ...isObject(config.registry) ? config.registry : {}
1372
- }
1171
+ ...baseOpts,
1172
+ ...needsSource ? {
1173
+ source: metadata.source
1174
+ } : {},
1175
+ ...needsScope ? {
1176
+ scope: metadata.scope
1177
+ } : {}
1373
1178
  };
1374
1179
  }
1375
- var MODULE_ID_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
1376
- function sortModules(modules) {
1377
- const byId = /* @__PURE__ */ new Map();
1378
- for (const coreModule of modules) {
1379
- if (!MODULE_ID_PATTERN.test(coreModule.id)) {
1380
- throw new Error(`[Core] Invalid module id "${coreModule.id}": use a camelCase name such as "contextMenu".`);
1381
- }
1382
- if (byId.has(coreModule.id)) {
1383
- throw new Error(`[Core] Module "${coreModule.id}" is installed twice.`);
1384
- }
1385
- byId.set(coreModule.id, coreModule);
1386
- }
1387
- const sorted = [];
1388
- const state = /* @__PURE__ */ new Map();
1389
- const visit = (coreModule, path) => {
1390
- const current = state.get(coreModule.id);
1391
- if (current === "done") return;
1392
- if (current === "visiting") {
1393
- throw new Error(`[Core] Module dependency cycle: ${[...path, coreModule.id].join(" -> ")}`);
1180
+ function createRegistryTransaction(store, metadata = {}) {
1181
+ const operations = [];
1182
+ let status = "open";
1183
+ const traceId = metadata.traceId || createTraceId();
1184
+ const ensureOpen = () => status === "open";
1185
+ const mergeOptions = (options) => withTransactionDefaults(metadata, options);
1186
+ const register = (type, key, value, sourceOrOptions, optionsArg) => {
1187
+ if (!ensureOpen()) return {
1188
+ index: -1,
1189
+ status,
1190
+ traceId
1191
+ };
1192
+ const options = typeof sourceOrOptions === "string" ? mergeOptions({
1193
+ ...optionsArg || {},
1194
+ source: sourceOrOptions
1195
+ }) : mergeOptions(sourceOrOptions);
1196
+ operations.push({
1197
+ key,
1198
+ item: value,
1199
+ options,
1200
+ type
1201
+ });
1202
+ return {
1203
+ index: operations.length - 1,
1204
+ status: "queued",
1205
+ traceId
1206
+ };
1207
+ };
1208
+ const unregister = (type, key, sourceOrOptions) => {
1209
+ if (!ensureOpen()) return {
1210
+ index: -1,
1211
+ status,
1212
+ traceId
1213
+ };
1214
+ const options = mergeOptions(typeof sourceOrOptions === "string" ? {
1215
+ source: sourceOrOptions
1216
+ } : sourceOrOptions);
1217
+ operations.push({
1218
+ key,
1219
+ options,
1220
+ type,
1221
+ unregister: true
1222
+ });
1223
+ return {
1224
+ index: operations.length - 1,
1225
+ status: "queued",
1226
+ traceId
1227
+ };
1228
+ };
1229
+ const rollback = (_reason = "manual") => {
1230
+ if (!ensureOpen()) return {
1231
+ index: -1,
1232
+ status,
1233
+ traceId
1234
+ };
1235
+ status = "rolled-back";
1236
+ operations.length = 0;
1237
+ return {
1238
+ index: -1,
1239
+ status,
1240
+ traceId
1241
+ };
1242
+ };
1243
+ const commit = () => {
1244
+ if (!ensureOpen()) return {
1245
+ status,
1246
+ traceId
1247
+ };
1248
+ status = "committed";
1249
+ const result = store.batch((queue) => {
1250
+ operations.forEach((op) => {
1251
+ if (op.unregister) queue.unregister(op.type, op.key, op.options);
1252
+ else queue.register(op.type, op.key, op.item, op.options);
1253
+ });
1254
+ });
1255
+ const applied = typeof result === "number" && Number.isFinite(result) ? result : 0;
1256
+ return {
1257
+ applied,
1258
+ queued: operations.length,
1259
+ status,
1260
+ traceId
1261
+ };
1262
+ };
1263
+ const run = (executor) => {
1264
+ if (typeof executor !== "function") {
1265
+ rollback("invalid-executor");
1266
+ return {
1267
+ status,
1268
+ traceId
1269
+ };
1394
1270
  }
1395
- state.set(coreModule.id, "visiting");
1396
- for (const id of coreModule.uses ?? []) {
1397
- const dependency = byId.get(id);
1398
- if (dependency) visit(dependency, [...path, coreModule.id]);
1271
+ try {
1272
+ executor({
1273
+ register,
1274
+ unregister
1275
+ });
1276
+ return commit();
1277
+ } catch (error) {
1278
+ rollback(error instanceof Error ? error.message : String(error));
1279
+ throw error;
1399
1280
  }
1400
- state.set(coreModule.id, "done");
1401
- sorted.push(coreModule);
1402
1281
  };
1403
- modules.forEach((coreModule) => visit(coreModule, []));
1404
- return sorted;
1405
- }
1406
- function createModuleRegistryDefinitions(modules) {
1407
- const definitions = /* @__PURE__ */ new Map();
1408
- for (const coreModule of modules) {
1409
- if (coreModule.registry) definitions.set(coreModule.id, coreModule.registry);
1410
- }
1411
- return definitions;
1412
- }
1413
- function useInstalledModules() {
1414
- return use(ModuleHostContext)?.modules ?? EMPTY_MODULES;
1282
+ return {
1283
+ commit,
1284
+ get operations() {
1285
+ return operations.slice();
1286
+ },
1287
+ register,
1288
+ rollback,
1289
+ run,
1290
+ get status() {
1291
+ return status;
1292
+ },
1293
+ traceId,
1294
+ unregister
1295
+ };
1415
1296
  }
1416
1297
 
1417
- // src/core/kernel/handlers.ts
1418
- function isPersistentLifecycle(lifecycle) {
1419
- return lifecycle === REGISTRY_LIFECYCLES.PERSISTENT;
1420
- }
1421
- function runRegistrationBatch(context, executor) {
1422
- return typeof context.batch === "function" ? context.batch(executor) : executor(context);
1423
- }
1424
- function createEntryCleanupKey(type, key, source, instanceId, scope) {
1425
- return JSON.stringify(["entry", type, key, scope ?? null, source, instanceId]);
1426
- }
1427
- function getCleanupScope(context) {
1428
- return context?.cleanupScope || /* @__PURE__ */ new Map();
1429
- }
1430
- function clearCleanupTimer(scope, cleanupKey) {
1431
- const lifecycle = scope.get(cleanupKey);
1432
- if (!lifecycle) return;
1433
- lifecycle.cancelled = true;
1434
- if (lifecycle.timerId !== null) clearTimeout(lifecycle.timerId);
1435
- scope.delete(cleanupKey);
1436
- }
1437
- function scheduleCleanup(scope, cleanupKey, callback, delayMs) {
1438
- clearCleanupTimer(scope, cleanupKey);
1439
- const lifecycle = {
1440
- cancelled: false,
1441
- timerId: null
1298
+ // src/core/kernel/registry/store.ts
1299
+ var NO_DEFINITIONS = /* @__PURE__ */ new Map();
1300
+ function createRegistryStore(initialEntries = [], definitions = NO_DEFINITIONS) {
1301
+ const ops = createRegistryOperations(definitions);
1302
+ let registries = createInitialState(ops, definitions, initialEntries);
1303
+ let sequence = normalizeInitialEntries(initialEntries).reduce((count, entry) => count + Object.keys(entry.items).length, 0);
1304
+ const listeners = createListenerRegistry();
1305
+ const resolveCachedValue = ops.createResolverCache();
1306
+ const {
1307
+ getEntriesSnapshot,
1308
+ getSnapshot
1309
+ } = createSnapshotReaders(() => registries, resolveCachedValue);
1310
+ const commit = (nextState, operations = []) => {
1311
+ if (registries === nextState) return;
1312
+ const previousState = registries;
1313
+ registries = nextState;
1314
+ listeners.notifyChanged(previousState, nextState, collectChangedKeys(operations, ops.isValidRegistryTarget));
1442
1315
  };
1443
- lifecycle.timerId = setTimeout(() => {
1444
- if (lifecycle.cancelled || scope.get(cleanupKey) !== lifecycle) return;
1445
- scope.delete(cleanupKey);
1446
- callback();
1447
- }, delayMs);
1448
- scope.set(cleanupKey, lifecycle);
1316
+ const isCurrent = (operation) => {
1317
+ const entry = registries[operation.type]?.[operation.key];
1318
+ const recordKey = createRecordKey(operation.source, operation.instanceId, operation.scope);
1319
+ return entry?.[recordKey] === operation.record;
1320
+ };
1321
+ const dispose = (operation, _reason = "manual") => {
1322
+ if (!isCurrent(operation)) return false;
1323
+ const unregisterOperation = createUnregisterOperation(operation.type, operation.key, {
1324
+ source: operation.source,
1325
+ instanceId: operation.instanceId,
1326
+ scope: operation.scope
1327
+ });
1328
+ if (!ops.hasOperationEffect(registries, unregisterOperation)) return false;
1329
+ commit(ops.applyOperation(registries, unregisterOperation), [unregisterOperation]);
1330
+ return true;
1331
+ };
1332
+ const register = (type, key, item, sourceOrOptions = DEFAULT_SOURCE, optionsArg = {}) => {
1333
+ const prepared = prepareRegisterOperation(ops, definitions, type, key, item, sourceOrOptions, optionsArg, Date.now(), ++sequence);
1334
+ if ("rejected" in prepared) return prepared.rejected;
1335
+ const {
1336
+ operation
1337
+ } = prepared;
1338
+ if (!ops.hasOperationEffect(registries, operation)) {
1339
+ return createNoopHandle("ignored", "unchanged");
1340
+ }
1341
+ commit(ops.applyOperation(registries, operation), [operation]);
1342
+ return createRegistrationHandle(store, operation);
1343
+ };
1344
+ const unregister = (type, key, sourceOrOptions = DEFAULT_SOURCE) => {
1345
+ if (!ops.isValidRegistryTarget(type, key)) return;
1346
+ const operation = createUnregisterOperation(type, key, sourceOrOptions);
1347
+ if (!ops.hasOperationEffect(registries, operation)) return;
1348
+ commit(ops.applyOperation(registries, operation), [operation]);
1349
+ };
1350
+ const batch = (executor) => {
1351
+ if (typeof executor !== "function") return 0;
1352
+ const operations = [];
1353
+ executor(createBatchQueue({
1354
+ definitions,
1355
+ getStore: () => store,
1356
+ nextSequence: () => ++sequence,
1357
+ operations,
1358
+ ops,
1359
+ timestamp: Date.now()
1360
+ }));
1361
+ if (operations.length === 0) return 0;
1362
+ const {
1363
+ effectiveOperations,
1364
+ nextState
1365
+ } = ops.resolveEffectiveOperations(registries, operations);
1366
+ if (effectiveOperations.length === 0) return 0;
1367
+ commit(nextState, effectiveOperations);
1368
+ return effectiveOperations.length;
1369
+ };
1370
+ const store = {
1371
+ batch,
1372
+ dispose,
1373
+ getEntriesSnapshot,
1374
+ getSnapshot,
1375
+ isCurrent,
1376
+ register,
1377
+ subscribe: listeners.subscribe,
1378
+ transaction: (executor, metadata = {}) => createRegistryTransaction(store, metadata).run(executor),
1379
+ unregister
1380
+ };
1381
+ return store;
1449
1382
  }
1450
- function resolveItemMetadata(item, pageMetadata) {
1451
- const itemMetadata = isObject(item) && isObject(item.registry) ? item.registry : {};
1383
+ function createBatchQueue({
1384
+ definitions,
1385
+ getStore,
1386
+ nextSequence,
1387
+ operations,
1388
+ ops,
1389
+ timestamp
1390
+ }) {
1452
1391
  return {
1453
- ...pageMetadata,
1454
- ...itemMetadata
1392
+ register: (type, key, item, sourceOrOptions = DEFAULT_SOURCE, optionsArg = {}) => {
1393
+ const prepared = prepareRegisterOperation(ops, definitions, type, key, item, sourceOrOptions, optionsArg, timestamp, nextSequence());
1394
+ if ("rejected" in prepared) return prepared.rejected;
1395
+ operations.push(prepared.operation);
1396
+ return createRegistrationHandle(getStore(), prepared.operation);
1397
+ },
1398
+ unregister: (type, key, sourceOrOptions = DEFAULT_SOURCE) => {
1399
+ if (!ops.isValidRegistryTarget(type, key)) return;
1400
+ operations.push(createUnregisterOperation(type, key, sourceOrOptions));
1401
+ }
1455
1402
  };
1456
1403
  }
1457
- function stripRegistryKey(item) {
1458
- if (!isObject(item)) return item;
1459
- return Object.fromEntries(Object.entries(item).filter(([key]) => key !== "registry"));
1404
+ var keyedSubscriptions = /* @__PURE__ */ new WeakMap();
1405
+ function keyedSubscription(subscription, id, create) {
1406
+ const byId = getOrInsert(keyedSubscriptions, subscription, () => /* @__PURE__ */ new Map());
1407
+ return getOrInsert(byId, id, create);
1460
1408
  }
1461
- function collectModuleRegistrations(coreModule, slice, pageMetadata, context) {
1462
- const definition = coreModule.registry;
1463
- const toEntries = coreModule.page?.entries;
1464
- if (!definition || !toEntries || slice == null || slice === false) return [];
1465
- const type = coreModule.id;
1466
- const items = Array.isArray(slice) ? slice : [slice];
1467
- const registrations = [];
1468
- for (const item of items) {
1469
- if (item == null || item === false) continue;
1470
- const metadata = resolveItemMetadata(item, pageMetadata);
1471
- if (metadata.validation === REGISTRY_VALIDATION_MODES.STRICT && !validateRegistryMetadata(metadata).valid) {
1472
- continue;
1473
- }
1474
- const payload = stripRegistryKey(item);
1475
- const {
1476
- cleanupDelayMs,
1477
- lifecycle,
1478
- registerOptions,
1479
- scope,
1480
- source
1481
- } = normalizeRegistryMetadata(metadata, {
1482
- defaultCleanupDelayMs: definition.cleanupDelayMs ?? null,
1483
- defaultLifecycle: definition.lifecycle,
1484
- defaultSource: DEFAULT_SOURCE
1485
- });
1486
- for (const {
1487
- key,
1488
- value
1489
- } of toEntries(payload, context) ?? []) {
1490
- const validation = definition.validate?.(value);
1491
- if (validation && !validation.valid) {
1492
- report(`Registry ${type} config is invalid`, validation.issues, "warn");
1493
- continue;
1494
- }
1495
- registrations.push({
1496
- cleanupDelayMs,
1497
- cleanupKey: createEntryCleanupKey(type, key, source, context.instanceId, scope),
1498
- key,
1499
- lifecycle,
1500
- registerOptions,
1501
- scope,
1502
- source,
1503
- type,
1504
- value
1505
- });
1409
+ function createRegistryContextValue(store) {
1410
+ return {
1411
+ actions: {
1412
+ batch: store.batch,
1413
+ register: store.register,
1414
+ transaction: store.transaction,
1415
+ unregister: store.unregister
1416
+ },
1417
+ subscription: {
1418
+ getEntriesSnapshot: store.getEntriesSnapshot,
1419
+ getSnapshot: store.getSnapshot,
1420
+ subscribe: store.subscribe
1506
1421
  }
1422
+ };
1423
+ }
1424
+ var RegistryContext = getOrCreateGlobalContext("RegistryContext", null);
1425
+ function RegistryProvider(t0) {
1426
+ const $ = c(8);
1427
+ const {
1428
+ children,
1429
+ definitions,
1430
+ initialEntries: t1
1431
+ } = t0;
1432
+ let t2;
1433
+ if ($[0] !== t1) {
1434
+ t2 = t1 === void 0 ? [] : t1;
1435
+ $[0] = t1;
1436
+ $[1] = t2;
1437
+ } else {
1438
+ t2 = $[1];
1507
1439
  }
1508
- return registrations;
1440
+ const initialEntries = t2;
1441
+ let t3;
1442
+ if ($[2] !== definitions || $[3] !== initialEntries) {
1443
+ t3 = () => createRegistryContextValue(createRegistryStore(initialEntries, definitions));
1444
+ $[2] = definitions;
1445
+ $[3] = initialEntries;
1446
+ $[4] = t3;
1447
+ } else {
1448
+ t3 = $[4];
1449
+ }
1450
+ const [contextValue] = useState(t3);
1451
+ let t4;
1452
+ if ($[5] !== children || $[6] !== contextValue) {
1453
+ t4 = /* @__PURE__ */ jsx(RegistryContext, { value: contextValue, children });
1454
+ $[5] = children;
1455
+ $[6] = contextValue;
1456
+ $[7] = t4;
1457
+ } else {
1458
+ t4 = $[7];
1459
+ }
1460
+ return t4;
1509
1461
  }
1510
- function collectRegistrations(modules, config, context) {
1511
- const pageMetadata = isObject(config.registry) ? config.registry : {};
1512
- const slices = config;
1513
- return modules.flatMap((coreModule) => {
1514
- try {
1515
- return collectModuleRegistrations(coreModule, slices[coreModule.id], pageMetadata, context);
1516
- } catch (error) {
1517
- report(`Registry apply (${coreModule.id})`, error);
1518
- return [];
1519
- }
1520
- });
1462
+ function useRegistryActions() {
1463
+ return useRequiredContext(RegistryContext, "useRegistryActions", "RegistryProvider").actions;
1521
1464
  }
1522
- function hasCleanupDelay(delayMs) {
1523
- return typeof delayMs === "number" && delayMs > 0;
1465
+ function useRegistrySubscription() {
1466
+ return useRequiredContext(RegistryContext, "useRegistrySubscription", "RegistryProvider").subscription;
1524
1467
  }
1525
- function createTeardown(registrations, context, cleanupScope) {
1526
- const owner = (registration) => ({
1527
- instanceId: context.instanceId,
1528
- scope: registration.scope,
1529
- source: registration.source
1530
- });
1531
- return () => {
1532
- const immediate = [];
1533
- registrations.forEach((registration) => {
1534
- if (isPersistentLifecycle(registration.lifecycle)) return;
1535
- const {
1536
- cleanupDelayMs,
1537
- cleanupKey,
1538
- key,
1539
- type
1540
- } = registration;
1541
- if (hasCleanupDelay(cleanupDelayMs)) {
1542
- scheduleCleanup(cleanupScope, cleanupKey, () => context.unregister(type, key, owner(registration)), cleanupDelayMs);
1543
- } else {
1544
- immediate.push(registration);
1545
- }
1546
- });
1547
- if (immediate.length === 0) return;
1548
- runRegistrationBatch(context, (queue) => {
1549
- immediate.forEach((registration) => queue.unregister(registration.type, registration.key, owner(registration)));
1468
+ function useRegistryValue(type, key) {
1469
+ const $ = c(8);
1470
+ const subscription = useRegistrySubscription();
1471
+ const t0 = `value\0${type}\0${key}`;
1472
+ let t1;
1473
+ if ($[0] !== key || $[1] !== subscription || $[2] !== type) {
1474
+ t1 = () => ({
1475
+ getSnapshot: () => subscription.getSnapshot(type, key),
1476
+ subscribe: (listener) => subscription.subscribe(type, key, listener)
1550
1477
  });
1551
- };
1478
+ $[0] = key;
1479
+ $[1] = subscription;
1480
+ $[2] = type;
1481
+ $[3] = t1;
1482
+ } else {
1483
+ t1 = $[3];
1484
+ }
1485
+ let t2;
1486
+ if ($[4] !== subscription || $[5] !== t0 || $[6] !== t1) {
1487
+ t2 = keyedSubscription(subscription, t0, t1);
1488
+ $[4] = subscription;
1489
+ $[5] = t0;
1490
+ $[6] = t1;
1491
+ $[7] = t2;
1492
+ } else {
1493
+ t2 = $[7];
1494
+ }
1495
+ const {
1496
+ getSnapshot,
1497
+ subscribe
1498
+ } = t2;
1499
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
1552
1500
  }
1553
- var NO_CLEANUP = () => {
1554
- };
1555
- function applyRegistryConfig(config, context) {
1556
- const modules = context.modules ?? [];
1557
- if (!config || modules.length === 0) return NO_CLEANUP;
1558
- const registrations = collectRegistrations(modules, config, context);
1559
- if (registrations.length === 0) return NO_CLEANUP;
1560
- const cleanupScope = getCleanupScope(context);
1561
- runRegistrationBatch(context, (queue) => {
1562
- registrations.forEach(({
1563
- cleanupKey,
1564
- key,
1565
- registerOptions,
1566
- source,
1567
- type,
1568
- value
1569
- }) => {
1570
- clearCleanupTimer(cleanupScope, cleanupKey);
1571
- queue.register(type, key, value, source, registerOptions);
1501
+ function useRegistryEntries(type) {
1502
+ const $ = c(7);
1503
+ const subscription = useRegistrySubscription();
1504
+ const t0 = `entries\0${type}`;
1505
+ let t1;
1506
+ if ($[0] !== subscription || $[1] !== type) {
1507
+ t1 = () => ({
1508
+ getSnapshot: () => subscription.getEntriesSnapshot(type),
1509
+ subscribe: (listener) => subscription.subscribe(type, null, listener)
1572
1510
  });
1573
- });
1574
- return createTeardown(registrations, context, cleanupScope);
1511
+ $[0] = subscription;
1512
+ $[1] = type;
1513
+ $[2] = t1;
1514
+ } else {
1515
+ t1 = $[2];
1516
+ }
1517
+ let t2;
1518
+ if ($[3] !== subscription || $[4] !== t0 || $[5] !== t1) {
1519
+ t2 = keyedSubscription(subscription, t0, t1);
1520
+ $[3] = subscription;
1521
+ $[4] = t0;
1522
+ $[5] = t1;
1523
+ $[6] = t2;
1524
+ } else {
1525
+ t2 = $[6];
1526
+ }
1527
+ const {
1528
+ getSnapshot,
1529
+ subscribe
1530
+ } = t2;
1531
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
1575
1532
  }
1576
1533
  var MAX_STABILIZATION_DEPTH = 64;
1534
+ var DIRECT_COMPONENT_PATH = /^config\.([^.[]+)\.[^.[]+$/;
1577
1535
  function createStableFunctionEntry(fn) {
1578
1536
  const entry = {
1579
1537
  current: fn,
@@ -1583,7 +1541,6 @@ function createStableFunctionEntry(fn) {
1583
1541
  };
1584
1542
  return entry;
1585
1543
  }
1586
- var DIRECT_COMPONENT_PATH = /^config\.([^.[]+)\.[^.[]+$/;
1587
1544
  function isDirectRegistryComponentPath(path, componentSlices) {
1588
1545
  if (componentSlices.size === 0) return false;
1589
1546
  const match = DIRECT_COMPONENT_PATH.exec(path);
@@ -1593,7 +1550,7 @@ function isReactNodeLike(value) {
1593
1550
  return value === null || value === void 0 || typeof value === "boolean" || typeof value === "string" || typeof value === "number" || isValidElement(value);
1594
1551
  }
1595
1552
  function isStabilizableObject(value) {
1596
- return typeof value === "object" && value !== null && !Array.isArray(value) && !isValidElement(value);
1553
+ return isObject(value) && !isValidElement(value);
1597
1554
  }
1598
1555
  function hasSameObjectKeys(previousValue, nextValue) {
1599
1556
  if (!isStabilizableObject(previousValue) || !isStabilizableObject(nextValue)) {
@@ -1602,7 +1559,7 @@ function hasSameObjectKeys(previousValue, nextValue) {
1602
1559
  const previousKeys = Object.keys(previousValue);
1603
1560
  const nextKeys = Object.keys(nextValue);
1604
1561
  if (previousKeys.length !== nextKeys.length) return false;
1605
- return nextKeys.every((key) => Object.prototype.hasOwnProperty.call(previousValue, key));
1562
+ return nextKeys.every((key) => hasOwnProperty(previousValue, key));
1606
1563
  }
1607
1564
  function stabilizeFunction(fn, path, scope) {
1608
1565
  const first = fn.name.charCodeAt(0);
@@ -1679,33 +1636,26 @@ function stabilizeRegistryValue(value, path, scope, previousValue, seen = /* @__
1679
1636
  }, depth);
1680
1637
  }
1681
1638
 
1682
- // src/core/kernel/hooks.ts
1639
+ // src/core/kernel/registry/hooks.ts
1640
+ var NO_METADATA = Object.freeze({});
1683
1641
  function withInstanceId(instanceId, sourceOrOptions, optionsArg) {
1642
+ const options = isObject(optionsArg) ? optionsArg : {};
1684
1643
  if (typeof sourceOrOptions === "string") {
1685
- return {
1686
- optionsArg: {
1687
- ...isObject(optionsArg) ? optionsArg : {},
1688
- instanceId
1689
- },
1690
- sourceOrOptions
1691
- };
1644
+ return [sourceOrOptions, {
1645
+ ...options,
1646
+ instanceId
1647
+ }];
1692
1648
  }
1693
1649
  if (isObject(sourceOrOptions)) {
1694
- return {
1695
- optionsArg,
1696
- sourceOrOptions: {
1697
- ...sourceOrOptions,
1698
- instanceId
1699
- }
1700
- };
1701
- }
1702
- return {
1703
- optionsArg: void 0,
1704
- sourceOrOptions: {
1705
- ...isObject(optionsArg) ? optionsArg : {},
1650
+ return [{
1651
+ ...sourceOrOptions,
1706
1652
  instanceId
1707
- }
1708
- };
1653
+ }, optionsArg];
1654
+ }
1655
+ return [{
1656
+ ...options,
1657
+ instanceId
1658
+ }, void 0];
1709
1659
  }
1710
1660
  function withInstanceIdForUnregister(instanceId, sourceOrOptions) {
1711
1661
  if (typeof sourceOrOptions === "string") {
@@ -1724,10 +1674,6 @@ function withInstanceIdForUnregister(instanceId, sourceOrOptions) {
1724
1674
  instanceId
1725
1675
  };
1726
1676
  }
1727
- function resolveRegisterArgsWithInstance(instanceId, sourceOrOptions, optionsArg) {
1728
- const input = withInstanceId(instanceId, sourceOrOptions, optionsArg);
1729
- return [input.sourceOrOptions, input.optionsArg];
1730
- }
1731
1677
  function useShallowStable(value) {
1732
1678
  const ref = useRef(value);
1733
1679
  if (ref.current !== value && !shallowEqual(ref.current, value)) {
@@ -1735,7 +1681,6 @@ function useShallowStable(value) {
1735
1681
  }
1736
1682
  return ref.current;
1737
1683
  }
1738
- var NO_METADATA = Object.freeze({});
1739
1684
  function sameContextInputs(a, b) {
1740
1685
  return a.actions.batch === b.actions.batch && a.actions.register === b.actions.register && a.actions.unregister === b.actions.unregister && a.cleanupScope === b.cleanupScope && a.instanceId === b.instanceId && a.modules === b.modules && a.pathname === b.pathname;
1741
1686
  }
@@ -1744,12 +1689,7 @@ function samePayloadInputs(a, b) {
1744
1689
  }
1745
1690
  var componentSlicesByModules = /* @__PURE__ */ new WeakMap();
1746
1691
  function componentSliceIds(modules) {
1747
- let ids = componentSlicesByModules.get(modules);
1748
- if (!ids) {
1749
- ids = new Set(modules.filter((coreModule) => coreModule.registry?.valueKind === "component").map((coreModule) => coreModule.id));
1750
- componentSlicesByModules.set(modules, ids);
1751
- }
1752
- return ids;
1692
+ return getOrInsert(componentSlicesByModules, modules, () => new Set(modules.filter((coreModule) => coreModule.registry?.valueKind === "component").map((coreModule) => coreModule.id)));
1753
1693
  }
1754
1694
  function useAppliedRegistryConfig(inputs) {
1755
1695
  const $ = c(5);
@@ -1821,7 +1761,7 @@ function useAppliedRegistryConfig(inputs) {
1821
1761
  }
1822
1762
  function stampQueue(queue, instanceId) {
1823
1763
  return {
1824
- register: (type, key, item, sourceOrOptions, optionsArg) => queue.register(type, key, item, ...resolveRegisterArgsWithInstance(instanceId, sourceOrOptions, optionsArg)),
1764
+ register: (type, key, item, sourceOrOptions, optionsArg) => queue.register(type, key, item, ...withInstanceId(instanceId, sourceOrOptions, optionsArg)),
1825
1765
  unregister: (type, key, sourceOrOptions) => queue.unregister(type, key, withInstanceIdForUnregister(instanceId, sourceOrOptions))
1826
1766
  };
1827
1767
  }
@@ -1892,7 +1832,41 @@ function useRegistry(config, metadata) {
1892
1832
  function _temp() {
1893
1833
  return /* @__PURE__ */ new Map();
1894
1834
  }
1835
+ function Compose({
1836
+ providers,
1837
+ children
1838
+ }) {
1839
+ return providers.reduceRight((acc, entry) => {
1840
+ if (Array.isArray(entry)) {
1841
+ const [Component2, props] = entry;
1842
+ return createElement(Component2, props, acc);
1843
+ }
1844
+ const Component = entry;
1845
+ return createElement(Component, null, acc);
1846
+ }, createElement(Fragment, null, children));
1847
+ }
1895
1848
  var EMPTY_OBJECT = Object.freeze({});
1849
+ var noopHook = () => {
1850
+ };
1851
+ var emptySubscribe = () => () => {
1852
+ };
1853
+ var getNullSnapshot = () => null;
1854
+ var PassthroughProvider = ({
1855
+ children
1856
+ }) => children;
1857
+ var PageControllerContext = getOrCreateGlobalContext("PageControllerContext", null);
1858
+ var PageControllerStoreContext = getOrCreateGlobalContext(
1859
+ "PageControllerStoreContext",
1860
+ // Pages outside any PageControllerProvider share one standalone store.
1861
+ createPageControllerStore()
1862
+ );
1863
+ var FALLBACK_PAGE_CONTROLLER = Object.freeze({
1864
+ Provider: PassthroughProvider,
1865
+ config: EMPTY_OBJECT,
1866
+ modules: Object.freeze({}),
1867
+ reset: noopHook,
1868
+ set: noopHook
1869
+ });
1896
1870
  function createPageControllerStore() {
1897
1871
  const listeners = /* @__PURE__ */ new Set();
1898
1872
  let stack = [];
@@ -1967,14 +1941,6 @@ function createControllerScope() {
1967
1941
  }
1968
1942
  };
1969
1943
  }
1970
- var fallbackStandaloneStore = createPageControllerStore();
1971
- var noopHook = () => {
1972
- };
1973
- var PassthroughProvider = ({
1974
- children
1975
- }) => children;
1976
- var PageControllerContext = getOrCreateGlobalContext("PageControllerContext", null);
1977
- var PageControllerStoreContext = getOrCreateGlobalContext("PageControllerStoreContext", fallbackStandaloneStore);
1978
1944
  function PageControllerProvider(t0) {
1979
1945
  const $ = c(3);
1980
1946
  const {
@@ -1995,16 +1961,6 @@ function PageControllerProvider(t0) {
1995
1961
  function _temp2() {
1996
1962
  return createPageControllerStore();
1997
1963
  }
1998
- var emptySubscribe = () => () => {
1999
- };
2000
- var getNullSnapshot = () => null;
2001
- var FALLBACK_PAGE_CONTROLLER = Object.freeze({
2002
- Provider: PassthroughProvider,
2003
- config: EMPTY_OBJECT,
2004
- modules: Object.freeze({}),
2005
- reset: noopHook,
2006
- set: noopHook
2007
- });
2008
1964
  function usePageController() {
2009
1965
  const scopedContext = use(PageControllerContext);
2010
1966
  const controllerStore = use(PageControllerStoreContext);
@@ -2168,6 +2124,7 @@ function usePage(t0, options) {
2168
2124
  useEffect(t5, t6);
2169
2125
  return controller;
2170
2126
  }
2127
+ var NO_MODULE_STORE = createStore(void 0);
2171
2128
  function defineModule(coreModule) {
2172
2129
  return Object.freeze({
2173
2130
  ...coreModule
@@ -2319,7 +2276,6 @@ function definePeer(id, inert) {
2319
2276
  useState: (selector, isEqual) => useStore(useRuntime().store, selector, isEqual)
2320
2277
  };
2321
2278
  }
2322
- var NO_MODULE_STORE = createStore(void 0);
2323
2279
  function useModuleState(id, selector, fallback, t0) {
2324
2280
  const $ = c(4);
2325
2281
  const isEqual = t0 === void 0 ? Object.is : t0;
@@ -2336,14 +2292,24 @@ function useModuleState(id, selector, fallback, t0) {
2336
2292
  }
2337
2293
  return useStore(runtime?.store ?? NO_MODULE_STORE, t1, isEqual);
2338
2294
  }
2339
- function ModuleBoundary({
2340
- children,
2341
- name
2342
- }) {
2343
- const Boundary = use(ModuleHostContext)?.Boundary ?? PassthroughBoundary;
2344
- return createElement(Boundary, {
2295
+ function ModuleBoundary(t0) {
2296
+ const $ = c(4);
2297
+ const {
2298
+ children,
2345
2299
  name
2346
- }, children);
2300
+ } = t0;
2301
+ const Boundary = use(ModuleHostContext)?.Boundary ?? PassthroughBoundary;
2302
+ let t1;
2303
+ if ($[0] !== Boundary || $[1] !== children || $[2] !== name) {
2304
+ t1 = /* @__PURE__ */ jsx(Boundary, { name, children });
2305
+ $[0] = Boundary;
2306
+ $[1] = children;
2307
+ $[2] = name;
2308
+ $[3] = t1;
2309
+ } else {
2310
+ t1 = $[3];
2311
+ }
2312
+ return t1;
2347
2313
  }
2348
2314
  function useIsModuleInstalled(id) {
2349
2315
  return use(ModuleHostContext)?.byId.has(id) ?? false;
@@ -2393,20 +2359,7 @@ function useModuleRegistration(id, value, options) {
2393
2359
  }
2394
2360
  useRegistry(config, t3);
2395
2361
  }
2396
- function Compose({
2397
- providers,
2398
- children
2399
- }) {
2400
- return providers.reduceRight((acc, entry) => {
2401
- if (Array.isArray(entry)) {
2402
- const [Component2, props] = entry;
2403
- return createElement(Component2, props, acc);
2404
- }
2405
- const Component = entry;
2406
- return createElement(Component, null, acc);
2407
- }, createElement(Fragment, null, children));
2408
- }
2409
2362
 
2410
2363
  export { Compose, ModuleBoundary, ModuleHost, PageControllerProvider, REGISTRY_SOURCES, RegistryProvider, applyRegistryConfig, createModuleRegistryDefinitions, createRegistryApplyContext, createRegistryOperations, createRegistryStore, defineModule, definePeer, hasOwnProperty, sortModules, useIsModuleInstalled, useModule, useModuleRegistration, useModuleState, usePage, usePageController, useRegistryEntries, useRegistryValue };
2411
- //# sourceMappingURL=chunk-IH3STE7W.js.map
2412
- //# sourceMappingURL=chunk-IH3STE7W.js.map
2364
+ //# sourceMappingURL=chunk-ED32WLAD.js.map
2365
+ //# sourceMappingURL=chunk-ED32WLAD.js.map