@blac/core 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.md +19 -29
  2. package/dist/StateContainer-BUyuxKb3.cjs +667 -0
  3. package/dist/StateContainer-BUyuxKb3.cjs.map +1 -0
  4. package/dist/StateContainer-B_7UHc3I.js +632 -0
  5. package/dist/StateContainer-B_7UHc3I.js.map +1 -0
  6. package/dist/StateContainer-Bh2ipNYj.js +632 -0
  7. package/dist/StateContainer-Bh2ipNYj.js.map +1 -0
  8. package/dist/StateContainer-ClzwKnQZ.cjs +667 -0
  9. package/dist/StateContainer-ClzwKnQZ.cjs.map +1 -0
  10. package/dist/StateContainer-DiQATvZh.js +632 -0
  11. package/dist/StateContainer-DiQATvZh.js.map +1 -0
  12. package/dist/StateContainer-j16zciex.cjs +667 -0
  13. package/dist/StateContainer-j16zciex.cjs.map +1 -0
  14. package/dist/{StateContainerRegistry-CSNm2Ws5.cjs → StateContainerRegistry-141uHhtF.cjs} +300 -397
  15. package/dist/StateContainerRegistry-141uHhtF.cjs.map +1 -0
  16. package/dist/{StateContainerRegistry-DVIBTxGZ.js → StateContainerRegistry-BH7aOMWV.js} +299 -406
  17. package/dist/StateContainerRegistry-BH7aOMWV.js.map +1 -0
  18. package/dist/StateContainerRegistry-BX-DlHXO.js +747 -0
  19. package/dist/StateContainerRegistry-BX-DlHXO.js.map +1 -0
  20. package/dist/StateContainerRegistry-Bf5VuVjm.js +747 -0
  21. package/dist/StateContainerRegistry-Bf5VuVjm.js.map +1 -0
  22. package/dist/{StateContainerRegistry-Dj77cok9.js → StateContainerRegistry-BsH_s0pJ.js} +303 -413
  23. package/dist/StateContainerRegistry-BsH_s0pJ.js.map +1 -0
  24. package/dist/StateContainerRegistry-BvSRfhKv.cjs +866 -0
  25. package/dist/StateContainerRegistry-BvSRfhKv.cjs.map +1 -0
  26. package/dist/StateContainerRegistry-C8jxrcqk.cjs +866 -0
  27. package/dist/StateContainerRegistry-C8jxrcqk.cjs.map +1 -0
  28. package/dist/{StateContainerRegistry-lIwo-0m3.cjs → StateContainerRegistry-CBLeHObO.cjs} +326 -418
  29. package/dist/StateContainerRegistry-CBLeHObO.cjs.map +1 -0
  30. package/dist/StateContainerRegistry-DjQQtlCW.cjs +870 -0
  31. package/dist/StateContainerRegistry-DjQQtlCW.cjs.map +1 -0
  32. package/dist/{StateContainerRegistry-D9BIRjwv.cjs → StateContainerRegistry-MkT0W4C2.cjs} +322 -411
  33. package/dist/StateContainerRegistry-MkT0W4C2.cjs.map +1 -0
  34. package/dist/StateContainerRegistry-gQbEutkN.js +751 -0
  35. package/dist/StateContainerRegistry-gQbEutkN.js.map +1 -0
  36. package/dist/{StateContainerRegistry-CvBOhAT2.js → StateContainerRegistry-vWgsD-RP.js} +277 -392
  37. package/dist/StateContainerRegistry-vWgsD-RP.js.map +1 -0
  38. package/dist/config.d.cts +8 -8
  39. package/dist/config.d.ts +8 -8
  40. package/dist/constants.d.cts +18 -28
  41. package/dist/constants.d.ts +18 -28
  42. package/dist/core/Cubit.d.ts +14 -10
  43. package/dist/core/StateContainer.d.ts +83 -62
  44. package/dist/core/StateContainerRegistry.d.ts +87 -166
  45. package/dist/core/meta.d.ts +34 -47
  46. package/dist/core/symbols.d.ts +21 -1
  47. package/dist/decorators/blac.d.ts +31 -28
  48. package/dist/{acquire-B1LYXSGj.js → ensure-Bi_yXk6f.js} +16 -5
  49. package/dist/ensure-Bi_yXk6f.js.map +1 -0
  50. package/dist/{ensure-r1C_7K6_.cjs → ensure-BjhbDW8Z.cjs} +203 -160
  51. package/dist/ensure-BjhbDW8Z.cjs.map +1 -0
  52. package/dist/{ensure-BSJHkUNX.js → ensure-BnVyd6s4.js} +297 -122
  53. package/dist/ensure-BnVyd6s4.js.map +1 -0
  54. package/dist/{acquire-BZIs6tpN.cjs → ensure-Bx41d-il.cjs} +23 -6
  55. package/dist/ensure-Bx41d-il.cjs.map +1 -0
  56. package/dist/{acquire-BRIJVJaA.js → ensure-C7UQ_mKM.js} +16 -5
  57. package/dist/ensure-C7UQ_mKM.js.map +1 -0
  58. package/dist/{ensure-B59ri8oo.js → ensure-CneMkpbI.js} +298 -122
  59. package/dist/ensure-CneMkpbI.js.map +1 -0
  60. package/dist/{ensure-B2DYCbbI.cjs → ensure-D15vGnk5.cjs} +328 -123
  61. package/dist/ensure-D15vGnk5.cjs.map +1 -0
  62. package/dist/{acquire-B1Wuqla6.cjs → ensure-D1D4WjYf.cjs} +23 -6
  63. package/dist/ensure-D1D4WjYf.cjs.map +1 -0
  64. package/dist/{ensure-BKdq5xsY.cjs → ensure-D3w6YGp9.cjs} +329 -123
  65. package/dist/ensure-D3w6YGp9.cjs.map +1 -0
  66. package/dist/{acquire-BJ3xUEmh.cjs → ensure-DBnuRJ0R.cjs} +23 -6
  67. package/dist/ensure-DBnuRJ0R.cjs.map +1 -0
  68. package/dist/{acquire-BdsVZBSe.js → ensure-NTB9nnnj.js} +16 -5
  69. package/dist/ensure-NTB9nnnj.js.map +1 -0
  70. package/dist/{ensure-D3WWWwMo.cjs → ensure-ORVw-WRE.cjs} +194 -155
  71. package/dist/ensure-ORVw-WRE.cjs.map +1 -0
  72. package/dist/{ensure-BEeY5Ab7.js → ensure-dsqWhIuO.js} +182 -147
  73. package/dist/ensure-dsqWhIuO.js.map +1 -0
  74. package/dist/{ensure-11-asM1e.js → ensure-k-6q7O25.js} +173 -150
  75. package/dist/ensure-k-6q7O25.js.map +1 -0
  76. package/dist/index.cjs +234 -87
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.d.cts +5 -13
  79. package/dist/index.d.ts +5 -13
  80. package/dist/index.js +211 -52
  81. package/dist/index.js.map +1 -1
  82. package/dist/internal.cjs +10 -0
  83. package/dist/internal.d.cts +8 -0
  84. package/dist/internal.d.ts +8 -0
  85. package/dist/internal.js +3 -0
  86. package/dist/plugin/BlacPlugin.d.ts +22 -24
  87. package/dist/plugin/PluginManager.d.ts +47 -60
  88. package/dist/plugins.cjs +383 -3
  89. package/dist/plugins.cjs.map +1 -0
  90. package/dist/plugins.d.cts +10 -5
  91. package/dist/plugins.d.ts +10 -5
  92. package/dist/plugins.js +381 -1
  93. package/dist/plugins.js.map +1 -0
  94. package/dist/registry/acquire.d.ts +2 -2
  95. package/dist/registry/config.d.ts +12 -0
  96. package/dist/registry/index.d.ts +1 -1
  97. package/dist/registry/management.d.ts +3 -0
  98. package/dist/registry/queries.d.ts +15 -0
  99. package/dist/registry/release.d.ts +4 -20
  100. package/dist/testing.cjs +38 -38
  101. package/dist/testing.cjs.map +1 -1
  102. package/dist/testing.d.cts +5 -11
  103. package/dist/testing.d.ts +5 -11
  104. package/dist/testing.js +28 -28
  105. package/dist/testing.js.map +1 -1
  106. package/dist/types/branded.d.ts +6 -13
  107. package/dist/types/utilities.d.ts +40 -31
  108. package/dist/utils/idGenerator.d.ts +6 -13
  109. package/dist/utils/static-props.d.ts +22 -29
  110. package/dist/utils/structural-key.d.ts +0 -22
  111. package/dist/watch/index.d.ts +1 -2
  112. package/dist/watch/watch.d.ts +17 -3
  113. package/package.json +28 -54
  114. package/dist/StateContainerRegistry-4Ljd9EJx.js +0 -1018
  115. package/dist/StateContainerRegistry-4Ljd9EJx.js.map +0 -1
  116. package/dist/StateContainerRegistry-8zNFMAf7.js +0 -1067
  117. package/dist/StateContainerRegistry-8zNFMAf7.js.map +0 -1
  118. package/dist/StateContainerRegistry-B1GYx9Xo.js +0 -975
  119. package/dist/StateContainerRegistry-B1GYx9Xo.js.map +0 -1
  120. package/dist/StateContainerRegistry-B_ViBLvJ.js +0 -975
  121. package/dist/StateContainerRegistry-B_ViBLvJ.js.map +0 -1
  122. package/dist/StateContainerRegistry-Bx2ly-ba.cjs +0 -1162
  123. package/dist/StateContainerRegistry-Bx2ly-ba.cjs.map +0 -1
  124. package/dist/StateContainerRegistry-C0dCNlTF.js +0 -1005
  125. package/dist/StateContainerRegistry-C0dCNlTF.js.map +0 -1
  126. package/dist/StateContainerRegistry-C75QpeaO.cjs +0 -1260
  127. package/dist/StateContainerRegistry-C75QpeaO.cjs.map +0 -1
  128. package/dist/StateContainerRegistry-CEWpc1bj.cjs +0 -1113
  129. package/dist/StateContainerRegistry-CEWpc1bj.cjs.map +0 -1
  130. package/dist/StateContainerRegistry-CS18y4au.cjs +0 -1163
  131. package/dist/StateContainerRegistry-CS18y4au.cjs.map +0 -1
  132. package/dist/StateContainerRegistry-CSNm2Ws5.cjs.map +0 -1
  133. package/dist/StateContainerRegistry-CchRjnjX.cjs +0 -1094
  134. package/dist/StateContainerRegistry-CchRjnjX.cjs.map +0 -1
  135. package/dist/StateContainerRegistry-CvBOhAT2.js.map +0 -1
  136. package/dist/StateContainerRegistry-D8nu7Z0T.js +0 -1068
  137. package/dist/StateContainerRegistry-D8nu7Z0T.js.map +0 -1
  138. package/dist/StateContainerRegistry-D9BIRjwv.cjs.map +0 -1
  139. package/dist/StateContainerRegistry-DJQqLrli.cjs +0 -1046
  140. package/dist/StateContainerRegistry-DJQqLrli.cjs.map +0 -1
  141. package/dist/StateContainerRegistry-DL5Ai7wh.js +0 -1153
  142. package/dist/StateContainerRegistry-DL5Ai7wh.js.map +0 -1
  143. package/dist/StateContainerRegistry-DVIBTxGZ.js.map +0 -1
  144. package/dist/StateContainerRegistry-DWOzx7Gd.js +0 -1154
  145. package/dist/StateContainerRegistry-DWOzx7Gd.js.map +0 -1
  146. package/dist/StateContainerRegistry-Dj77cok9.js.map +0 -1
  147. package/dist/StateContainerRegistry-FWKzPfS-.cjs +0 -1046
  148. package/dist/StateContainerRegistry-FWKzPfS-.cjs.map +0 -1
  149. package/dist/StateContainerRegistry-G81GcCRm.cjs +0 -1261
  150. package/dist/StateContainerRegistry-G81GcCRm.cjs.map +0 -1
  151. package/dist/StateContainerRegistry-lIwo-0m3.cjs.map +0 -1
  152. package/dist/acquire-B1LYXSGj.js.map +0 -1
  153. package/dist/acquire-B1Wuqla6.cjs.map +0 -1
  154. package/dist/acquire-BJ3xUEmh.cjs.map +0 -1
  155. package/dist/acquire-BP-ZfUH2.js +0 -35
  156. package/dist/acquire-BP-ZfUH2.js.map +0 -1
  157. package/dist/acquire-BRIJVJaA.js.map +0 -1
  158. package/dist/acquire-BZIs6tpN.cjs.map +0 -1
  159. package/dist/acquire-B_p1fNEh.cjs +0 -46
  160. package/dist/acquire-B_p1fNEh.cjs.map +0 -1
  161. package/dist/acquire-BdsVZBSe.js.map +0 -1
  162. package/dist/acquire-C3nOb3XR.cjs +0 -46
  163. package/dist/acquire-C3nOb3XR.cjs.map +0 -1
  164. package/dist/acquire-C4WAS13G.cjs +0 -46
  165. package/dist/acquire-C4WAS13G.cjs.map +0 -1
  166. package/dist/acquire-C7beGI55.cjs +0 -46
  167. package/dist/acquire-C7beGI55.cjs.map +0 -1
  168. package/dist/acquire-CE0uq0Dx.cjs +0 -46
  169. package/dist/acquire-CE0uq0Dx.cjs.map +0 -1
  170. package/dist/acquire-CU0u8BMn.js +0 -35
  171. package/dist/acquire-CU0u8BMn.js.map +0 -1
  172. package/dist/acquire-CbMz7gWs.cjs +0 -46
  173. package/dist/acquire-CbMz7gWs.cjs.map +0 -1
  174. package/dist/acquire-CkgLJ8WL.cjs +0 -46
  175. package/dist/acquire-CkgLJ8WL.cjs.map +0 -1
  176. package/dist/acquire-CwB083au.js +0 -35
  177. package/dist/acquire-CwB083au.js.map +0 -1
  178. package/dist/acquire-DHEOEVcj.cjs +0 -46
  179. package/dist/acquire-DHEOEVcj.cjs.map +0 -1
  180. package/dist/acquire-DTvfYJ0y.js +0 -35
  181. package/dist/acquire-DTvfYJ0y.js.map +0 -1
  182. package/dist/acquire-DXEQDZGr.js +0 -35
  183. package/dist/acquire-DXEQDZGr.js.map +0 -1
  184. package/dist/acquire-Dg-uXwjF.js +0 -35
  185. package/dist/acquire-Dg-uXwjF.js.map +0 -1
  186. package/dist/acquire-Don7499S.js +0 -35
  187. package/dist/acquire-Don7499S.js.map +0 -1
  188. package/dist/acquire-G8aB3GAx.js +0 -35
  189. package/dist/acquire-G8aB3GAx.js.map +0 -1
  190. package/dist/branded-BybA0_xw.cjs +0 -18
  191. package/dist/branded-BybA0_xw.cjs.map +0 -1
  192. package/dist/branded-DkbUzncc.js +0 -13
  193. package/dist/branded-DkbUzncc.js.map +0 -1
  194. package/dist/config-8pyOC5gv.js +0 -16
  195. package/dist/config-8pyOC5gv.js.map +0 -1
  196. package/dist/config-B1l8ZGlU.cjs +0 -32
  197. package/dist/config-B1l8ZGlU.cjs.map +0 -1
  198. package/dist/config-C1T6Jw7n.cjs +0 -32
  199. package/dist/config-C1T6Jw7n.cjs.map +0 -1
  200. package/dist/config-C7Ktkjh2.cjs +0 -32
  201. package/dist/config-C7Ktkjh2.cjs.map +0 -1
  202. package/dist/config-COT4Xkbc.js +0 -16
  203. package/dist/config-COT4Xkbc.js.map +0 -1
  204. package/dist/config-CzcoAvBo.js +0 -16
  205. package/dist/config-CzcoAvBo.js.map +0 -1
  206. package/dist/config-D2A8ZYRM.js +0 -16
  207. package/dist/config-D2A8ZYRM.js.map +0 -1
  208. package/dist/config-D34BkraU.cjs +0 -32
  209. package/dist/config-D34BkraU.cjs.map +0 -1
  210. package/dist/config-D6BoWWPv.js +0 -16
  211. package/dist/config-D6BoWWPv.js.map +0 -1
  212. package/dist/config-DOO82lbZ.js +0 -16
  213. package/dist/config-DOO82lbZ.js.map +0 -1
  214. package/dist/config-DVM_ESQt.js +0 -16
  215. package/dist/config-DVM_ESQt.js.map +0 -1
  216. package/dist/config-DVMnlHLv.cjs +0 -32
  217. package/dist/config-DVMnlHLv.cjs.map +0 -1
  218. package/dist/config-DWUq7zEQ.cjs +0 -32
  219. package/dist/config-DWUq7zEQ.cjs.map +0 -1
  220. package/dist/config-DXI3kzmA.js +0 -16
  221. package/dist/config-DXI3kzmA.js.map +0 -1
  222. package/dist/config-Dk1FxfXj.js +0 -16
  223. package/dist/config-Dk1FxfXj.js.map +0 -1
  224. package/dist/config-ZVy_yFZ3.js +0 -16
  225. package/dist/config-ZVy_yFZ3.js.map +0 -1
  226. package/dist/config-b2z51Y_C.cjs +0 -32
  227. package/dist/config-b2z51Y_C.cjs.map +0 -1
  228. package/dist/config-buwpT7l3.js +0 -16
  229. package/dist/config-buwpT7l3.js.map +0 -1
  230. package/dist/config-cwaTn5oy.cjs +0 -32
  231. package/dist/config-cwaTn5oy.cjs.map +0 -1
  232. package/dist/config-d9_U58ef.cjs +0 -32
  233. package/dist/config-d9_U58ef.cjs.map +0 -1
  234. package/dist/config-hWTayX76.cjs +0 -32
  235. package/dist/config-hWTayX76.cjs.map +0 -1
  236. package/dist/config-sCPKPYxZ.cjs +0 -32
  237. package/dist/config-sCPKPYxZ.cjs.map +0 -1
  238. package/dist/debug.cjs +0 -14
  239. package/dist/debug.d.cts +0 -34
  240. package/dist/debug.d.ts +0 -34
  241. package/dist/debug.js +0 -4
  242. package/dist/ensure-11-asM1e.js.map +0 -1
  243. package/dist/ensure-B1dEDsZV.cjs +0 -559
  244. package/dist/ensure-B1dEDsZV.cjs.map +0 -1
  245. package/dist/ensure-B2DYCbbI.cjs.map +0 -1
  246. package/dist/ensure-B59ri8oo.js.map +0 -1
  247. package/dist/ensure-B9oOqpOB.cjs +0 -558
  248. package/dist/ensure-B9oOqpOB.cjs.map +0 -1
  249. package/dist/ensure-BEeY5Ab7.js.map +0 -1
  250. package/dist/ensure-BKdq5xsY.cjs.map +0 -1
  251. package/dist/ensure-BSJHkUNX.js.map +0 -1
  252. package/dist/ensure-BfYnvAsI.js +0 -709
  253. package/dist/ensure-BfYnvAsI.js.map +0 -1
  254. package/dist/ensure-Bm91o37h.js +0 -536
  255. package/dist/ensure-Bm91o37h.js.map +0 -1
  256. package/dist/ensure-C1a8IFWy.js +0 -535
  257. package/dist/ensure-C1a8IFWy.js.map +0 -1
  258. package/dist/ensure-CLQEx0Nn.cjs +0 -528
  259. package/dist/ensure-CLQEx0Nn.cjs.map +0 -1
  260. package/dist/ensure-CPMiGvov.js +0 -493
  261. package/dist/ensure-CPMiGvov.js.map +0 -1
  262. package/dist/ensure-CQimeD0I.cjs +0 -559
  263. package/dist/ensure-CQimeD0I.cjs.map +0 -1
  264. package/dist/ensure-D3WWWwMo.cjs.map +0 -1
  265. package/dist/ensure-DEXSmA-N.js +0 -526
  266. package/dist/ensure-DEXSmA-N.js.map +0 -1
  267. package/dist/ensure-DTTTd2h8.js +0 -536
  268. package/dist/ensure-DTTTd2h8.js.map +0 -1
  269. package/dist/ensure-Dx86f80B.cjs +0 -567
  270. package/dist/ensure-Dx86f80B.cjs.map +0 -1
  271. package/dist/ensure-DzqGej43.js +0 -526
  272. package/dist/ensure-DzqGej43.js.map +0 -1
  273. package/dist/ensure-VuiNPccZ.cjs +0 -559
  274. package/dist/ensure-VuiNPccZ.cjs.map +0 -1
  275. package/dist/ensure-_Oh8XPm4.cjs +0 -732
  276. package/dist/ensure-_Oh8XPm4.cjs.map +0 -1
  277. package/dist/ensure-fsQMjaQL.cjs +0 -567
  278. package/dist/ensure-fsQMjaQL.cjs.map +0 -1
  279. package/dist/ensure-r1C_7K6_.cjs.map +0 -1
  280. package/dist/ensure-vxAGa2v3.js +0 -536
  281. package/dist/ensure-vxAGa2v3.js.map +0 -1
  282. package/dist/events.d.cts +0 -42
  283. package/dist/events.d.ts +0 -42
  284. package/dist/management-14vsHr4t.cjs +0 -85
  285. package/dist/management-14vsHr4t.cjs.map +0 -1
  286. package/dist/management-444tdCBG.js +0 -38
  287. package/dist/management-444tdCBG.js.map +0 -1
  288. package/dist/management-7jLjVHJd.js +0 -38
  289. package/dist/management-7jLjVHJd.js.map +0 -1
  290. package/dist/management-8x1OVMi6.js +0 -38
  291. package/dist/management-8x1OVMi6.js.map +0 -1
  292. package/dist/management-AFuqQEwz.js +0 -38
  293. package/dist/management-AFuqQEwz.js.map +0 -1
  294. package/dist/management-BZgsi29F.js +0 -38
  295. package/dist/management-BZgsi29F.js.map +0 -1
  296. package/dist/management-BodVLAfJ.cjs +0 -85
  297. package/dist/management-BodVLAfJ.cjs.map +0 -1
  298. package/dist/management-BqGBdL01.js +0 -38
  299. package/dist/management-BqGBdL01.js.map +0 -1
  300. package/dist/management-BvUAjril.js +0 -38
  301. package/dist/management-BvUAjril.js.map +0 -1
  302. package/dist/management-C-WGcwPD.js +0 -38
  303. package/dist/management-C-WGcwPD.js.map +0 -1
  304. package/dist/management-C2wv4vGS.cjs +0 -85
  305. package/dist/management-C2wv4vGS.cjs.map +0 -1
  306. package/dist/management-D2pjr38g.js +0 -38
  307. package/dist/management-D2pjr38g.js.map +0 -1
  308. package/dist/management-D5WsZoTV.js +0 -38
  309. package/dist/management-D5WsZoTV.js.map +0 -1
  310. package/dist/management-DAV9sN-k.cjs +0 -85
  311. package/dist/management-DAV9sN-k.cjs.map +0 -1
  312. package/dist/management-Df7Y2sF1.cjs +0 -85
  313. package/dist/management-Df7Y2sF1.cjs.map +0 -1
  314. package/dist/management-Dg2SxUb6.cjs +0 -85
  315. package/dist/management-Dg2SxUb6.cjs.map +0 -1
  316. package/dist/management-DwO0nBzL.cjs +0 -85
  317. package/dist/management-DwO0nBzL.cjs.map +0 -1
  318. package/dist/management-GcnNJjnm.cjs +0 -85
  319. package/dist/management-GcnNJjnm.cjs.map +0 -1
  320. package/dist/management-P_Vi_cvw.js +0 -38
  321. package/dist/management-P_Vi_cvw.js.map +0 -1
  322. package/dist/management-QWLpbXlW.cjs +0 -85
  323. package/dist/management-QWLpbXlW.cjs.map +0 -1
  324. package/dist/management-hkY13log.cjs +0 -85
  325. package/dist/management-hkY13log.cjs.map +0 -1
  326. package/dist/management-iE4x6IQY.cjs +0 -85
  327. package/dist/management-iE4x6IQY.cjs.map +0 -1
  328. package/dist/types.cjs +0 -3
  329. package/dist/types.d.cts +0 -8
  330. package/dist/types.d.ts +0 -8
  331. package/dist/types.js +0 -2
  332. package/dist/watch/observe.d.ts +0 -13
  333. package/dist/watch-B0pUfh-v.cjs +0 -119
  334. package/dist/watch-B0pUfh-v.cjs.map +0 -1
  335. package/dist/watch-B91opmva.cjs +0 -70
  336. package/dist/watch-B91opmva.cjs.map +0 -1
  337. package/dist/watch-BDiwCPmb.js +0 -108
  338. package/dist/watch-BDiwCPmb.js.map +0 -1
  339. package/dist/watch-BHfCtbn1.cjs +0 -119
  340. package/dist/watch-BHfCtbn1.cjs.map +0 -1
  341. package/dist/watch-BW7gYiDf.js +0 -108
  342. package/dist/watch-BW7gYiDf.js.map +0 -1
  343. package/dist/watch-BmC-Tyqg.js +0 -59
  344. package/dist/watch-BmC-Tyqg.js.map +0 -1
  345. package/dist/watch-Bx0y-Kcc.js +0 -108
  346. package/dist/watch-Bx0y-Kcc.js.map +0 -1
  347. package/dist/watch-CKWt788i.cjs +0 -70
  348. package/dist/watch-CKWt788i.cjs.map +0 -1
  349. package/dist/watch-CfrSSrRY.js +0 -59
  350. package/dist/watch-CfrSSrRY.js.map +0 -1
  351. package/dist/watch-Cnh3PtQA.cjs +0 -70
  352. package/dist/watch-Cnh3PtQA.cjs.map +0 -1
  353. package/dist/watch-D01MdwKy.js +0 -108
  354. package/dist/watch-D01MdwKy.js.map +0 -1
  355. package/dist/watch-D8hwbFU1.js +0 -59
  356. package/dist/watch-D8hwbFU1.js.map +0 -1
  357. package/dist/watch-DPVUwPUY.js +0 -59
  358. package/dist/watch-DPVUwPUY.js.map +0 -1
  359. package/dist/watch-DVmvZBMD.cjs +0 -70
  360. package/dist/watch-DVmvZBMD.cjs.map +0 -1
  361. package/dist/watch-DkDGmGAx.cjs +0 -119
  362. package/dist/watch-DkDGmGAx.cjs.map +0 -1
  363. package/dist/watch-DttHqefn.js +0 -108
  364. package/dist/watch-DttHqefn.js.map +0 -1
  365. package/dist/watch-DxdIZjpt.cjs +0 -119
  366. package/dist/watch-DxdIZjpt.cjs.map +0 -1
  367. package/dist/watch-DztcJuUy.cjs +0 -119
  368. package/dist/watch-DztcJuUy.cjs.map +0 -1
  369. package/dist/watch-IrR8G28N.js +0 -108
  370. package/dist/watch-IrR8G28N.js.map +0 -1
  371. package/dist/watch-aoNLQAXp.cjs +0 -119
  372. package/dist/watch-aoNLQAXp.cjs.map +0 -1
  373. package/dist/watch-entry.cjs +0 -4
  374. package/dist/watch-entry.d.cts +0 -24
  375. package/dist/watch-entry.d.ts +0 -24
  376. package/dist/watch-entry.js +0 -2
  377. package/dist/watch-hx0r92Zc.js +0 -108
  378. package/dist/watch-hx0r92Zc.js.map +0 -1
  379. package/dist/watch-lEco5Tbl.cjs +0 -119
  380. package/dist/watch-lEco5Tbl.cjs.map +0 -1
package/dist/plugins.js CHANGED
@@ -1,2 +1,382 @@
1
- import { m as PluginManager, n as getPluginManager } from "./StateContainerRegistry-DWOzx7Gd.js";
1
+ import { g as readNodeEnv, h as IS_DEV, n as globalRegistry, u as getBlacName } from "./StateContainerRegistry-gQbEutkN.js";
2
+ import { ALL_PATHS } from "@dirtytalk/structural";
3
+ //#region src/plugin/PluginManager.ts
4
+ /**
5
+ * Manages plugin lifecycle for the BlaC state management system.
6
+ *
7
+ * Hooks into registry lifecycle events (synchronous) and per-container
8
+ * channel flushes (microtask-coalesced): while at least one installed
9
+ * plugin implements `onStateChange`, the manager subscribes each container
10
+ * with `ALL_PATHS` interest and dispatches
11
+ * `onStateChange(ctx, prev, next, paths)` on every flush.
12
+ *
13
+ * `ALL_PATHS` interest defeats the single-consumer-skip optimization in
14
+ * `StructuralContainer` — an intended trade-off for plugins that genuinely
15
+ * want every change (devtools/persist). Plugins that want low overhead
16
+ * should remain uninstalled or environment-gated.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const manager = createPluginManager(registry);
21
+ * manager.install(myPlugin, { environment: 'development' });
22
+ * ```
23
+ */
24
+ var PluginManager = class {
25
+ /**
26
+ * Create a new PluginManager
27
+ * @param registry - The StateContainerRegistry to monitor for lifecycle events
28
+ */
29
+ constructor(registry) {
30
+ this.plugins = /* @__PURE__ */ new Map();
31
+ this.lifecycleUnsubscribers = [];
32
+ this.containerBridges = /* @__PURE__ */ new Map();
33
+ this.contextCache = /* @__PURE__ */ new WeakMap();
34
+ this.registry = registry;
35
+ this.setupLifecycleHooks();
36
+ }
37
+ /**
38
+ * Install a plugin with optional configuration
39
+ * @param plugin - The plugin to install
40
+ * @param config - Optional plugin configuration
41
+ * @throws Error if plugin is already installed
42
+ */
43
+ install(plugin, config = {}) {
44
+ const effectiveConfig = {
45
+ enabled: true,
46
+ environment: "all",
47
+ ...config
48
+ };
49
+ if (!this.shouldEnablePlugin(effectiveConfig)) {
50
+ if (IS_DEV) console.log(`[BlaC] Plugin "${plugin.name}" skipped (environment mismatch)`);
51
+ return;
52
+ }
53
+ if (this.plugins.has(plugin.name)) throw new Error(`Plugin "${plugin.name}" is already installed`);
54
+ const installContext = this.buildContext(void 0);
55
+ if (plugin.onInstall) try {
56
+ plugin.onInstall(installContext);
57
+ } catch (error) {
58
+ console.error(`[BlaC] Error installing plugin "${plugin.name}":`, error);
59
+ throw error;
60
+ }
61
+ this.plugins.set(plugin.name, {
62
+ plugin,
63
+ config: effectiveConfig,
64
+ installContext
65
+ });
66
+ this.backfillPlugin(plugin);
67
+ if (IS_DEV) console.log(`[BlaC] Plugin "${plugin.name}" v${plugin.version} installed`);
68
+ }
69
+ /**
70
+ * Uninstall a plugin by name
71
+ * @param pluginName - The name of the plugin to uninstall
72
+ * @throws Error if plugin is not installed
73
+ */
74
+ uninstall(pluginName) {
75
+ const installed = this.plugins.get(pluginName);
76
+ if (!installed) throw new Error(`Plugin "${pluginName}" is not installed`);
77
+ if (installed.plugin.onUninstall) try {
78
+ installed.plugin.onUninstall();
79
+ } catch (error) {
80
+ console.error(`[BlaC] Error uninstalling plugin "${pluginName}":`, error);
81
+ }
82
+ this.plugins.delete(pluginName);
83
+ if (!this.hasStateChangePlugin()) this.detachAllStateBridges();
84
+ if (IS_DEV) console.log(`[BlaC] Plugin "${pluginName}" uninstalled`);
85
+ }
86
+ /**
87
+ * Get an installed plugin by name
88
+ * @param pluginName - The name of the plugin to retrieve
89
+ * @returns The plugin instance or undefined if not found
90
+ */
91
+ getPlugin(pluginName) {
92
+ return this.plugins.get(pluginName)?.plugin;
93
+ }
94
+ /**
95
+ * Get all installed plugins
96
+ * @returns Array of all installed plugins
97
+ */
98
+ getAllPlugins() {
99
+ return Array.from(this.plugins.values()).map((p) => p.plugin);
100
+ }
101
+ /**
102
+ * Check if a plugin is installed
103
+ * @param pluginName - The name of the plugin to check
104
+ * @returns true if the plugin is installed
105
+ */
106
+ hasPlugin(pluginName) {
107
+ return this.plugins.has(pluginName);
108
+ }
109
+ /**
110
+ * Uninstall all plugins
111
+ */
112
+ clear() {
113
+ for (const name of this.plugins.keys()) this.uninstall(name);
114
+ }
115
+ destroy() {
116
+ this.clear();
117
+ for (const unsub of this.lifecycleUnsubscribers) unsub();
118
+ this.lifecycleUnsubscribers = [];
119
+ }
120
+ /**
121
+ * Wire registry lifecycle events into plugin dispatch.
122
+ *
123
+ * `onStateChange` is not wired through `registry.on('stateChanged', …)` —
124
+ * that event lacks the `PathSet` payload. Instead each `created` subscribes
125
+ * to the container's channel directly for `paths`, pairing it with
126
+ * `(prev, next)` from the per-container snapshot.
127
+ */
128
+ setupLifecycleHooks() {
129
+ this.lifecycleUnsubscribers = [
130
+ this.registry.on("created", (instance) => {
131
+ if (this.hasStateChangePlugin()) this.attachStateBridge(instance);
132
+ this.notifyPlugins("onCreated", instance);
133
+ }),
134
+ this.registry.on("disposed", (instance) => {
135
+ this.notifyPlugins("onDestroyed", instance);
136
+ this.detachStateBridge(instance);
137
+ }),
138
+ this.registry.on("refAcquired", (instance, refId) => {
139
+ this.notifyPlugins("onRefAcquired", instance, refId);
140
+ }),
141
+ this.registry.on("refReleased", (instance, refId) => {
142
+ this.notifyPlugins("onRefReleased", instance, refId);
143
+ }),
144
+ this.registry.on("depsChanged", (instance, previousDeps, currentDeps) => {
145
+ this.notifyPlugins("onDepsChanged", instance, previousDeps, currentDeps);
146
+ }),
147
+ this.registry.on("hydrationChanged", (instance, status, previousStatus) => {
148
+ this.notifyPlugins("onHydrationChange", instance, status, previousStatus);
149
+ }),
150
+ this.registry.on("activated", (instance, signal) => {
151
+ this.notifyPlugins("onActivate", instance, signal);
152
+ }),
153
+ this.registry.on("deactivated", (instance) => {
154
+ this.notifyPlugins("onDeactivate", instance);
155
+ })
156
+ ];
157
+ }
158
+ /**
159
+ * Subscribe to the container's channel with `ALL_PATHS` interest so it
160
+ * fires on every flush. `prev` is the snapshot from the previous flush (or
161
+ * create-time for the first); the channel's `paths` is passed straight
162
+ * through to plugins.
163
+ */
164
+ attachStateBridge(container) {
165
+ if (this.containerBridges.has(container)) return;
166
+ const bridge = {
167
+ unsub: () => {},
168
+ prevState: container.state
169
+ };
170
+ this.containerBridges.set(container, bridge);
171
+ bridge.unsub = container.channel.subscribe(() => ALL_PATHS, (paths) => this.dispatchStateChange(container, paths));
172
+ }
173
+ detachStateBridge(container) {
174
+ const bridge = this.containerBridges.get(container);
175
+ if (!bridge) return;
176
+ bridge.unsub();
177
+ this.containerBridges.delete(container);
178
+ }
179
+ hasStateChangePlugin() {
180
+ for (const { plugin } of this.plugins.values()) if (plugin.onStateChange) return true;
181
+ return false;
182
+ }
183
+ detachAllStateBridges() {
184
+ for (const bridge of this.containerBridges.values()) bridge.unsub();
185
+ this.containerBridges.clear();
186
+ }
187
+ /**
188
+ * Backfill a newly-installed plugin with existing instances: attach the
189
+ * state bridge (idempotent) if it implements `onStateChange`, and invoke
190
+ * `onCreated` for each. Scoped to this plugin only — `notifyPlugins` would
191
+ * wrongly re-notify every plugin of every instance.
192
+ */
193
+ backfillPlugin(plugin) {
194
+ if (!plugin.onStateChange && !plugin.onCreated) return;
195
+ for (const Type of this.registry.getTypes()) for (const instance of this.registry.getAll(Type)) {
196
+ const container = instance;
197
+ if (plugin.onStateChange) this.attachStateBridge(container);
198
+ if (!plugin.onCreated) continue;
199
+ try {
200
+ plugin.onCreated(this.buildContext(container));
201
+ } catch (error) {
202
+ console.error(`[BlaC] Error in plugin "${plugin.name}" onCreated (backfill):`, error);
203
+ }
204
+ }
205
+ }
206
+ /**
207
+ * Channel-flush callback. Hands `(prev, next, paths)` to every enabled
208
+ * plugin's `onStateChange`, then updates `prevState` for the next flush.
209
+ * `prev` is captured once and reused across plugins, so every plugin sees
210
+ * the same values regardless of dispatch order.
211
+ */
212
+ dispatchStateChange(container, paths) {
213
+ const bridge = this.containerBridges.get(container);
214
+ if (!bridge) return;
215
+ const prev = bridge.prevState;
216
+ const next = container.state;
217
+ bridge.prevState = next;
218
+ let ctx;
219
+ for (const { plugin, config } of this.plugins.values()) {
220
+ if (!config.enabled) continue;
221
+ const hook = plugin.onStateChange;
222
+ if (typeof hook !== "function") continue;
223
+ try {
224
+ ctx ??= this.buildContext(container);
225
+ hook.call(plugin, ctx, prev, next, paths);
226
+ } catch (error) {
227
+ console.error(`[BlaC] Error in plugin "${plugin.name}" onStateChange:`, error);
228
+ }
229
+ }
230
+ }
231
+ /**
232
+ * Notify all plugins of a lifecycle event. Builds a `PluginContext` lazily
233
+ * on the first matching hook and reuses it for the rest of this dispatch —
234
+ * zero builds if no enabled plugin implements `hookName`.
235
+ */
236
+ notifyPlugins(hookName, instance, ...extraArgs) {
237
+ let ctx;
238
+ for (const { plugin, config } of this.plugins.values()) {
239
+ if (!config.enabled) continue;
240
+ const hook = plugin[hookName];
241
+ if (typeof hook !== "function") continue;
242
+ try {
243
+ ctx ??= this.buildContext(instance);
244
+ hook.call(plugin, ctx, ...extraArgs);
245
+ } catch (error) {
246
+ console.error(`[BlaC] Error in plugin "${plugin.name}" ${hookName}:`, error);
247
+ }
248
+ }
249
+ }
250
+ /**
251
+ * Get the `PluginContext` for a focal container, building it once and
252
+ * reusing it thereafter (evicted via the `WeakMap` when the container
253
+ * dies). `undefined` (install-time) is never cached.
254
+ */
255
+ buildContext(container) {
256
+ if (container !== void 0) {
257
+ const cached = this.contextCache.get(container);
258
+ if (cached) return cached;
259
+ }
260
+ const context = this.createContext(container);
261
+ if (container !== void 0) this.contextCache.set(container, context);
262
+ return context;
263
+ }
264
+ createContext(container) {
265
+ const registry = this.registry;
266
+ return {
267
+ container,
268
+ getInstanceMetadata: (instance) => {
269
+ return {
270
+ id: instance.$blac.id,
271
+ className: getBlacName(instance.constructor),
272
+ isDisposed: instance.$blac.disposed,
273
+ name: instance.$blac.name,
274
+ createdAt: instance.$blac.createdAt,
275
+ state: instance.state,
276
+ hydrationStatus: instance.$blac.hydration.status,
277
+ isHydrated: instance.$blac.hydration.isHydrated,
278
+ hydrationError: instance.$blac.hydration.error,
279
+ changedWhileHydrating: instance.$blac.hydration.changedWhileHydrating,
280
+ args: instance.args
281
+ };
282
+ },
283
+ getState: (instance) => {
284
+ return instance.state;
285
+ },
286
+ getHydrationStatus: (instance) => {
287
+ return instance.$blac.hydration.status;
288
+ },
289
+ startHydration: (instance) => {
290
+ instance.$blac.hydration.begin();
291
+ },
292
+ applyHydratedState: (instance, state) => {
293
+ return instance.$blac.hydration.apply(state);
294
+ },
295
+ finishHydration: (instance) => {
296
+ instance.$blac.hydration.finish();
297
+ },
298
+ failHydration: (instance, error) => {
299
+ instance.$blac.hydration.fail(error);
300
+ },
301
+ waitForHydration: (instance) => {
302
+ return instance.$blac.hydration.wait();
303
+ },
304
+ queryInstances: (typeClass) => {
305
+ return registry.getAll(typeClass);
306
+ },
307
+ getAllTypes: () => {
308
+ return registry.getTypes();
309
+ },
310
+ getStats: () => {
311
+ return registry.getStats();
312
+ },
313
+ getRefIds: (instanceId) => {
314
+ return registry.getRefIdsById(instanceId);
315
+ }
316
+ };
317
+ }
318
+ /**
319
+ * Check if plugin should be enabled based on environment
320
+ */
321
+ shouldEnablePlugin(config) {
322
+ if (!config.enabled) return false;
323
+ if (config.environment === "all") return true;
324
+ return this.getCurrentEnvironment() === config.environment;
325
+ }
326
+ /**
327
+ * Same rule as `IS_DEV`: an unknown environment counts as production.
328
+ */
329
+ getCurrentEnvironment() {
330
+ const env = readNodeEnv();
331
+ if (env === void 0 || env === "production") return "production";
332
+ return env === "test" ? "test" : "development";
333
+ }
334
+ };
335
+ /**
336
+ * Create a plugin manager instance
337
+ * @param registry - The StateContainerRegistry to monitor for lifecycle events
338
+ * @returns A new PluginManager instance
339
+ */
340
+ function createPluginManager(registry) {
341
+ return new PluginManager(registry);
342
+ }
343
+ //#endregion
344
+ //#region src/plugins.ts
345
+ /**
346
+ * Plugin system utilities for extending BlaC functionality.
347
+ * Import from `@blac/core/plugins`.
348
+ *
349
+ * @example
350
+ * ```typescript
351
+ * import { PluginManager, getPluginManager, type BlacPlugin } from '@blac/core/plugins';
352
+ *
353
+ * const myPlugin: BlacPlugin = {
354
+ * name: 'my-plugin',
355
+ * onCreated(context) {
356
+ * console.log('Instance created:', context.container);
357
+ * },
358
+ * };
359
+ *
360
+ * getPluginManager().install(myPlugin);
361
+ * ```
362
+ *
363
+ * @packageDocumentation
364
+ */
365
+ const pluginManagers = /* @__PURE__ */ new WeakMap();
366
+ /**
367
+ * Get the plugin manager for a registry (the global one by default). Plugins
368
+ * only observe the registry they are installed on, so install them again on
369
+ * a scoped registry (e.g. one passed to `RegistryProvider`).
370
+ */
371
+ function getPluginManager(registry = globalRegistry) {
372
+ let manager = pluginManagers.get(registry);
373
+ if (!manager) {
374
+ manager = createPluginManager(registry);
375
+ pluginManagers.set(registry, manager);
376
+ }
377
+ return manager;
378
+ }
379
+ //#endregion
2
380
  export { PluginManager, getPluginManager };
381
+
382
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","names":[],"sources":["../src/plugin/PluginManager.ts","../src/plugins.ts"],"sourcesContent":["import { ALL_PATHS, type PathSet } from '@dirtytalk/structural';\nimport type { StateContainer } from '../core/StateContainer';\nimport { IS_DEV, readNodeEnv } from '../constants';\nimport { getBlacName } from '../utils/static-props';\nimport type { StateContainerConstructor } from '../types/utilities';\nimport type { StateContainerRegistry } from '../core/StateContainerRegistry';\nimport type {\n BlacPlugin,\n PluginContext,\n PluginConfig,\n InstanceMetadata,\n} from './BlacPlugin';\n\n/**\n * Internal structure for tracking installed plugins.\n *\n * `installContext` is the context handed to `onInstall` — it has no\n * `container`. Per-container contexts are built on demand by\n * `buildContext()` so each event carries the right focal container\n * without mutating a shared object.\n * @internal\n */\ninterface InstalledPlugin {\n plugin: BlacPlugin;\n config: PluginConfig;\n installContext: PluginContext;\n}\n\n/**\n * Per-container bookkeeping for the channel-bridge plugin dispatcher.\n *\n * - `unsub` tears down the channel subscription on dispose.\n * - `prevState` is the state snapshot the manager will hand plugins as\n * `prev` on the next flush; it is updated to the post-flush state after\n * each dispatch.\n * @internal\n */\ninterface ContainerBridge {\n unsub: () => void;\n prevState: any;\n}\n\n/**\n * Manages plugin lifecycle for the BlaC state management system.\n *\n * Hooks into registry lifecycle events (synchronous) and per-container\n * channel flushes (microtask-coalesced): while at least one installed\n * plugin implements `onStateChange`, the manager subscribes each container\n * with `ALL_PATHS` interest and dispatches\n * `onStateChange(ctx, prev, next, paths)` on every flush.\n *\n * `ALL_PATHS` interest defeats the single-consumer-skip optimization in\n * `StructuralContainer` — an intended trade-off for plugins that genuinely\n * want every change (devtools/persist). Plugins that want low overhead\n * should remain uninstalled or environment-gated.\n *\n * @example\n * ```ts\n * const manager = createPluginManager(registry);\n * manager.install(myPlugin, { environment: 'development' });\n * ```\n */\nexport class PluginManager {\n private plugins = new Map<string, InstalledPlugin>();\n private registry: StateContainerRegistry;\n private lifecycleUnsubscribers: (() => void)[] = [];\n\n /**\n * Per-container channel-bridge bookkeeping, subscribed at `created` and\n * torn down at `disposed`/`destroy()`. Holds the rolling `prevState`\n * snapshot handed to plugins on each flush.\n *\n * Strong, not a `WeakMap`, because `destroy()` must enumerate live bridges\n * to unsubscribe them; entries are removed on `disposed`, so this never\n * outlives the registry's own reference.\n */\n private containerBridges = new Map<\n StateContainer<any, any, any>,\n ContainerBridge\n >();\n\n /**\n * One `PluginContext` per container, safe to reuse since it closes only\n * over `registry`/`container`, both stable for the container's lifetime.\n */\n private contextCache = new WeakMap<\n StateContainer<any, any, any>,\n PluginContext\n >();\n\n /**\n * Create a new PluginManager\n * @param registry - The StateContainerRegistry to monitor for lifecycle events\n */\n constructor(registry: StateContainerRegistry) {\n this.registry = registry;\n this.setupLifecycleHooks();\n }\n\n /**\n * Install a plugin with optional configuration\n * @param plugin - The plugin to install\n * @param config - Optional plugin configuration\n * @throws Error if plugin is already installed\n */\n install(plugin: BlacPlugin, config: PluginConfig = {}): void {\n const effectiveConfig: PluginConfig = {\n enabled: true,\n environment: 'all',\n ...config,\n };\n\n if (!this.shouldEnablePlugin(effectiveConfig)) {\n if (IS_DEV) {\n console.log(\n `[BlaC] Plugin \"${plugin.name}\" skipped (environment mismatch)`,\n );\n }\n return;\n }\n\n if (this.plugins.has(plugin.name)) {\n throw new Error(`Plugin \"${plugin.name}\" is already installed`);\n }\n\n const installContext = this.buildContext(undefined);\n\n if (plugin.onInstall) {\n try {\n plugin.onInstall(installContext);\n } catch (error) {\n console.error(\n `[BlaC] Error installing plugin \"${plugin.name}\":`,\n error,\n );\n throw error;\n }\n }\n\n this.plugins.set(plugin.name, {\n plugin,\n config: effectiveConfig,\n installContext,\n });\n this.backfillPlugin(plugin);\n\n if (IS_DEV) {\n console.log(\n `[BlaC] Plugin \"${plugin.name}\" v${plugin.version} installed`,\n );\n }\n }\n\n /**\n * Uninstall a plugin by name\n * @param pluginName - The name of the plugin to uninstall\n * @throws Error if plugin is not installed\n */\n uninstall(pluginName: string): void {\n const installed = this.plugins.get(pluginName);\n if (!installed) {\n throw new Error(`Plugin \"${pluginName}\" is not installed`);\n }\n\n if (installed.plugin.onUninstall) {\n try {\n installed.plugin.onUninstall();\n } catch (error) {\n console.error(\n `[BlaC] Error uninstalling plugin \"${pluginName}\":`,\n error,\n );\n }\n }\n\n this.plugins.delete(pluginName);\n if (!this.hasStateChangePlugin()) this.detachAllStateBridges();\n if (IS_DEV) {\n console.log(`[BlaC] Plugin \"${pluginName}\" uninstalled`);\n }\n }\n\n /**\n * Get an installed plugin by name\n * @param pluginName - The name of the plugin to retrieve\n * @returns The plugin instance or undefined if not found\n */\n getPlugin(pluginName: string): BlacPlugin | undefined {\n return this.plugins.get(pluginName)?.plugin;\n }\n\n /**\n * Get all installed plugins\n * @returns Array of all installed plugins\n */\n getAllPlugins(): BlacPlugin[] {\n return Array.from(this.plugins.values()).map((p) => p.plugin);\n }\n\n /**\n * Check if a plugin is installed\n * @param pluginName - The name of the plugin to check\n * @returns true if the plugin is installed\n */\n hasPlugin(pluginName: string): boolean {\n return this.plugins.has(pluginName);\n }\n\n /**\n * Uninstall all plugins\n */\n clear(): void {\n for (const name of this.plugins.keys()) {\n this.uninstall(name);\n }\n }\n\n destroy(): void {\n this.clear();\n for (const unsub of this.lifecycleUnsubscribers) {\n unsub();\n }\n this.lifecycleUnsubscribers = [];\n }\n\n /**\n * Wire registry lifecycle events into plugin dispatch.\n *\n * `onStateChange` is not wired through `registry.on('stateChanged', …)` —\n * that event lacks the `PathSet` payload. Instead each `created` subscribes\n * to the container's channel directly for `paths`, pairing it with\n * `(prev, next)` from the per-container snapshot.\n */\n private setupLifecycleHooks(): void {\n this.lifecycleUnsubscribers = [\n this.registry.on('created', (instance) => {\n if (this.hasStateChangePlugin()) this.attachStateBridge(instance);\n this.notifyPlugins('onCreated', instance);\n }),\n this.registry.on('disposed', (instance) => {\n this.notifyPlugins('onDestroyed', instance);\n this.detachStateBridge(instance);\n }),\n this.registry.on('refAcquired', (instance, refId) => {\n this.notifyPlugins('onRefAcquired', instance, refId);\n }),\n this.registry.on('refReleased', (instance, refId) => {\n this.notifyPlugins('onRefReleased', instance, refId);\n }),\n this.registry.on('depsChanged', (instance, previousDeps, currentDeps) => {\n this.notifyPlugins(\n 'onDepsChanged',\n instance,\n previousDeps,\n currentDeps,\n );\n }),\n this.registry.on(\n 'hydrationChanged',\n (instance, status, previousStatus) => {\n this.notifyPlugins(\n 'onHydrationChange',\n instance,\n status,\n previousStatus,\n );\n },\n ),\n this.registry.on('activated', (instance, signal) => {\n this.notifyPlugins('onActivate', instance, signal);\n }),\n this.registry.on('deactivated', (instance) => {\n this.notifyPlugins('onDeactivate', instance);\n }),\n ];\n }\n\n /**\n * Subscribe to the container's channel with `ALL_PATHS` interest so it\n * fires on every flush. `prev` is the snapshot from the previous flush (or\n * create-time for the first); the channel's `paths` is passed straight\n * through to plugins.\n */\n private attachStateBridge(container: StateContainer<any, any, any>): void {\n // Defensive: if a container is somehow created twice (it shouldn't be),\n // don't double-subscribe — the existing bridge is canonical.\n if (this.containerBridges.has(container)) return;\n\n const bridge: ContainerBridge = {\n unsub: () => {},\n prevState: container.state,\n };\n this.containerBridges.set(container, bridge);\n\n bridge.unsub = container.channel.subscribe(\n () => ALL_PATHS,\n (paths) => this.dispatchStateChange(container, paths),\n );\n }\n\n private detachStateBridge(container: StateContainer<any, any, any>): void {\n const bridge = this.containerBridges.get(container);\n if (!bridge) return;\n bridge.unsub();\n this.containerBridges.delete(container);\n }\n\n // Bridges cost every container its single-consumer skip, so they exist only\n // while some installed plugin implements `onStateChange`.\n private hasStateChangePlugin(): boolean {\n for (const { plugin } of this.plugins.values()) {\n if (plugin.onStateChange) return true;\n }\n return false;\n }\n\n private detachAllStateBridges(): void {\n for (const bridge of this.containerBridges.values()) {\n bridge.unsub();\n }\n this.containerBridges.clear();\n }\n\n /**\n * Backfill a newly-installed plugin with existing instances: attach the\n * state bridge (idempotent) if it implements `onStateChange`, and invoke\n * `onCreated` for each. Scoped to this plugin only — `notifyPlugins` would\n * wrongly re-notify every plugin of every instance.\n */\n private backfillPlugin(plugin: BlacPlugin): void {\n if (!plugin.onStateChange && !plugin.onCreated) return;\n for (const Type of this.registry.getTypes()) {\n for (const instance of this.registry.getAll(Type)) {\n // getAll returns the readonly public view; internal bridging needs the\n // real container (same friction the `as any` in queryInstances handles).\n const container = instance as StateContainer<any, any, any>;\n if (plugin.onStateChange) this.attachStateBridge(container);\n\n if (!plugin.onCreated) continue;\n try {\n plugin.onCreated(this.buildContext(container));\n } catch (error) {\n console.error(\n `[BlaC] Error in plugin \"${plugin.name}\" onCreated (backfill):`,\n error,\n );\n }\n }\n }\n }\n\n /**\n * Channel-flush callback. Hands `(prev, next, paths)` to every enabled\n * plugin's `onStateChange`, then updates `prevState` for the next flush.\n * `prev` is captured once and reused across plugins, so every plugin sees\n * the same values regardless of dispatch order.\n */\n private dispatchStateChange(\n container: StateContainer<any, any, any>,\n paths: PathSet,\n ): void {\n const bridge = this.containerBridges.get(container);\n if (!bridge) return;\n\n const prev = bridge.prevState;\n const next = container.state;\n bridge.prevState = next;\n\n let ctx: PluginContext | undefined;\n for (const { plugin, config } of this.plugins.values()) {\n if (!config.enabled) continue;\n // eslint-disable-next-line @typescript-eslint/unbound-method -- invoked via .call below\n const hook = plugin.onStateChange;\n if (typeof hook !== 'function') continue;\n\n try {\n ctx ??= this.buildContext(container);\n hook.call(plugin, ctx, prev, next, paths);\n } catch (error) {\n console.error(\n `[BlaC] Error in plugin \"${plugin.name}\" onStateChange:`,\n error,\n );\n }\n }\n }\n\n /**\n * Notify all plugins of a lifecycle event. Builds a `PluginContext` lazily\n * on the first matching hook and reuses it for the rest of this dispatch —\n * zero builds if no enabled plugin implements `hookName`.\n */\n private notifyPlugins(\n hookName: Exclude<keyof BlacPlugin, 'onStateChange'>,\n instance: StateContainer<any, any, any>,\n ...extraArgs: any[]\n ): void {\n let ctx: PluginContext | undefined;\n for (const { plugin, config } of this.plugins.values()) {\n if (!config.enabled) continue;\n\n const hook = plugin[hookName];\n if (typeof hook !== 'function') continue;\n\n try {\n ctx ??= this.buildContext(instance);\n (hook as any).call(plugin, ctx, ...extraArgs);\n } catch (error) {\n console.error(\n `[BlaC] Error in plugin \"${plugin.name}\" ${hookName}:`,\n error,\n );\n }\n }\n }\n\n /**\n * Get the `PluginContext` for a focal container, building it once and\n * reusing it thereafter (evicted via the `WeakMap` when the container\n * dies). `undefined` (install-time) is never cached.\n */\n private buildContext(\n container: StateContainer<any, any, any> | undefined,\n ): PluginContext {\n if (container !== undefined) {\n const cached = this.contextCache.get(container);\n if (cached) return cached;\n }\n const context = this.createContext(container);\n if (container !== undefined) this.contextCache.set(container, context);\n return context;\n }\n\n private createContext(\n container: StateContainer<any, any, any> | undefined,\n ): PluginContext {\n const registry = this.registry;\n return {\n container,\n\n getInstanceMetadata: (\n instance: StateContainer<any, any, any>,\n ): InstanceMetadata => {\n return {\n id: instance.$blac.id,\n className: getBlacName(\n instance.constructor as StateContainerConstructor,\n ),\n isDisposed: instance.$blac.disposed,\n name: instance.$blac.name,\n createdAt: instance.$blac.createdAt,\n state: instance.state,\n hydrationStatus: instance.$blac.hydration.status,\n isHydrated: instance.$blac.hydration.isHydrated,\n hydrationError: instance.$blac.hydration.error,\n changedWhileHydrating: instance.$blac.hydration.changedWhileHydrating,\n args: instance.args,\n };\n },\n\n getState: <S extends object = any>(instance: StateContainer<S>): S => {\n return instance.state;\n },\n\n getHydrationStatus: (instance: StateContainer<any, any, any>) => {\n return instance.$blac.hydration.status;\n },\n\n startHydration: (instance: StateContainer<any, any, any>) => {\n instance.$blac.hydration.begin();\n },\n\n applyHydratedState: <S extends object = any>(\n instance: StateContainer<S>,\n state: S,\n ): boolean => {\n return instance.$blac.hydration.apply(state);\n },\n\n finishHydration: (instance: StateContainer<any, any, any>) => {\n instance.$blac.hydration.finish();\n },\n\n failHydration: (\n instance: StateContainer<any, any, any>,\n error: Error,\n ) => {\n instance.$blac.hydration.fail(error);\n },\n\n waitForHydration: (instance: StateContainer<any, any, any>) => {\n return instance.$blac.hydration.wait();\n },\n\n queryInstances: <T extends StateContainer<any, any, any>>(\n typeClass: new (...args: any[]) => T,\n ): T[] => {\n return registry.getAll(typeClass as any);\n },\n\n getAllTypes: () => {\n return registry.getTypes();\n },\n\n getStats: () => {\n return registry.getStats();\n },\n\n getRefIds: (instanceId: string): string[] => {\n return registry.getRefIdsById(instanceId);\n },\n };\n }\n\n /**\n * Check if plugin should be enabled based on environment\n */\n private shouldEnablePlugin(config: PluginConfig): boolean {\n if (!config.enabled) return false;\n if (config.environment === 'all') return true;\n\n const currentEnv = this.getCurrentEnvironment();\n return currentEnv === config.environment;\n }\n\n /**\n * Same rule as `IS_DEV`: an unknown environment counts as production.\n */\n private getCurrentEnvironment(): 'development' | 'production' | 'test' {\n const env = readNodeEnv();\n if (env === undefined || env === 'production') return 'production';\n return env === 'test' ? 'test' : 'development';\n }\n}\n\n/**\n * Create a plugin manager instance\n * @param registry - The StateContainerRegistry to monitor for lifecycle events\n * @returns A new PluginManager instance\n */\nexport function createPluginManager(\n registry: StateContainerRegistry,\n): PluginManager {\n return new PluginManager(registry);\n}\n","/**\n * Plugin system utilities for extending BlaC functionality.\n * Import from `@blac/core/plugins`.\n *\n * @example\n * ```typescript\n * import { PluginManager, getPluginManager, type BlacPlugin } from '@blac/core/plugins';\n *\n * const myPlugin: BlacPlugin = {\n * name: 'my-plugin',\n * onCreated(context) {\n * console.log('Instance created:', context.container);\n * },\n * };\n *\n * getPluginManager().install(myPlugin);\n * ```\n *\n * @packageDocumentation\n */\n\nimport { createPluginManager, PluginManager } from './plugin/PluginManager';\nimport {\n globalRegistry,\n type StateContainerRegistry,\n} from './core/StateContainerRegistry';\n\nexport { PluginManager } from './plugin/PluginManager';\nexport type {\n BlacPlugin,\n BlacPluginWithInit,\n PluginContext,\n PluginConfig,\n InstanceMetadata,\n} from './plugin/BlacPlugin';\n\nconst pluginManagers = new WeakMap<StateContainerRegistry, PluginManager>();\n\n/**\n * Get the plugin manager for a registry (the global one by default). Plugins\n * only observe the registry they are installed on, so install them again on\n * a scoped registry (e.g. one passed to `RegistryProvider`).\n */\nexport function getPluginManager(\n registry: StateContainerRegistry = globalRegistry,\n): PluginManager {\n let manager = pluginManagers.get(registry);\n if (!manager) {\n manager = createPluginManager(registry);\n pluginManagers.set(registry, manager);\n }\n return manager;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAa,gBAAb,MAA2B;;;;;CAgCzB,YAAY,UAAkC;iCA/B5B,IAAI,IAA6B;gCAEF,CAAC;0CAWvB,IAAI,IAG7B;s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,eAAe,IAAI,UAAU,OAAO;CACtC;CACA,OAAO;AACT"}
@@ -5,8 +5,8 @@ import type { ExtractArgs, StateContainerConstructor } from '../types/utilities'
5
5
  * a structural hash of `args`, or the default sentinel when there are none).
6
6
  *
7
7
  * @param BlocClass - The StateContainer class constructor
8
- * @param opts.args - Construction/identity args; derives the instance key
9
- * @param opts.refId - Named reference ID for debugging; auto-generated if omitted
8
+ * @param opts - `args` derives the instance key; `refId` names the reference
9
+ * for debugging and is auto-generated when omitted.
10
10
  */
11
11
  export declare function acquire<T extends StateContainerConstructor>(BlocClass: T, opts?: {
12
12
  args?: ExtractArgs<T>;
@@ -1,6 +1,18 @@
1
1
  import { StateContainerRegistry } from '../core/StateContainerRegistry';
2
+ /**
3
+ * The registry every plain helper (`acquire`, `ensure`, `watch`, …) uses.
4
+ * `RegistryProvider` from `@blac/react` does not change it; components use
5
+ * `useRegistry()` for the provider's registry.
6
+ * @public
7
+ */
2
8
  export declare function getRegistry(): StateContainerRegistry;
9
+ /**
10
+ * @public
11
+ */
3
12
  export declare function setRegistry(registry: StateContainerRegistry): void;
13
+ /**
14
+ * @public
15
+ */
4
16
  export declare function getStats(): {
5
17
  registeredTypes: number;
6
18
  totalInstances: number;
@@ -2,7 +2,7 @@ export { acquire, resolveInstanceKey } from './acquire';
2
2
  export { borrow, borrowSafe } from './borrow';
3
3
  export type { BorrowTarget } from './borrow';
4
4
  export { ensure } from './ensure';
5
- export { release, releaseInstance } from './release';
5
+ export { release } from './release';
6
6
  export { hasInstance, getRefCount, getRefIds, getAll, forEach, } from './queries';
7
7
  export { clear, clearAll, register } from './management';
8
8
  export { getRegistry, setRegistry, getStats } from './config';
@@ -1,4 +1,7 @@
1
1
  import type { StateContainerConstructor } from '../types/utilities';
2
2
  export declare function clear<T extends StateContainerConstructor>(BlocClass: T): void;
3
3
  export declare function clearAll(): void;
4
+ /**
5
+ * @public
6
+ */
4
7
  export declare function register<T extends StateContainerConstructor>(BlocClass: T): void;
@@ -1,12 +1,27 @@
1
1
  import type { ExtractArgs, StateContainerConstructor, InstanceReadonlyState } from '../types/utilities';
2
+ /**
3
+ * @public
4
+ */
2
5
  export declare function hasInstance<T extends StateContainerConstructor>(BlocClass: T, opts?: {
3
6
  args?: ExtractArgs<T>;
4
7
  }): boolean;
8
+ /**
9
+ * @public
10
+ */
5
11
  export declare function getRefCount<T extends StateContainerConstructor>(BlocClass: T, opts?: {
6
12
  args?: ExtractArgs<T>;
7
13
  }): number;
14
+ /**
15
+ * @public
16
+ */
8
17
  export declare function getRefIds<T extends StateContainerConstructor>(BlocClass: T, opts?: {
9
18
  args?: ExtractArgs<T>;
10
19
  }): string[];
20
+ /**
21
+ * @public
22
+ */
11
23
  export declare function getAll<T extends StateContainerConstructor>(BlocClass: T): InstanceReadonlyState<T>[];
24
+ /**
25
+ * @public
26
+ */
12
27
  export declare function forEach<T extends StateContainerConstructor>(BlocClass: T, callback: (instance: InstanceReadonlyState<T>) => void): void;
@@ -1,30 +1,14 @@
1
- import type { ExtractArgs, StateContainerConstructor, StateContainerInstance } from '../types/utilities';
1
+ import type { ExtractArgs, StateContainerConstructor } from '../types/utilities';
2
2
  /**
3
3
  * Release a reference to an instance. Instance identity is derived purely from
4
4
  * `args` (must match the `args` it was acquired with).
5
5
  *
6
- * @param opts.args - Construction/identity args; derives the instance key
7
- * @param opts.refId - The specific ref to drop; drops one arbitrary ref if omitted
8
- * @param opts.forceDispose - Force immediate disposal regardless of refs
6
+ * @param opts - `args` derives the instance key (must match acquire);
7
+ * `refId` picks the ref to drop, otherwise one arbitrary ref goes;
8
+ * `forceDispose` disposes immediately regardless of remaining refs.
9
9
  */
10
10
  export declare function release<T extends StateContainerConstructor>(BlocClass: T, opts?: {
11
11
  args?: ExtractArgs<T>;
12
12
  refId?: string;
13
13
  forceDispose?: boolean;
14
14
  }): void;
15
- /**
16
- * Release a reference using the INSTANCE as the identity, for callers that
17
- * hold a container but not the `args` it was acquired with (teardown loops).
18
- *
19
- * Never throws — safe on an unknown, transient, already-disposed, or
20
- * non-registry instance, and idempotent. Teardown loops depend on this.
21
- *
22
- * Idempotence is structural, not guarded here: once the instance is gone from
23
- * the registry `registry.release` returns early on its own missing-entry check
24
- * (`StateContainerRegistry.ts:636`), so a second call is a no-op. Do not add a
25
- * redundant guard.
26
- */
27
- export declare function releaseInstance(instance: StateContainerInstance, opts?: {
28
- forceDispose?: boolean;
29
- refId?: string;
30
- }): void;