@blac/core 2.0.13 → 2.0.14

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 (379) hide show
  1. package/README.md +85 -3
  2. package/dist/Cubit-9jal5zdZ.cjs +1 -1
  3. package/dist/Cubit-BAUPiUF7.cjs +359 -286
  4. package/dist/Cubit-BBKF3PIg.js +269 -230
  5. package/dist/Cubit-BC70gaiA.js +453 -0
  6. package/dist/Cubit-BC70gaiA.js.map +1 -0
  7. package/dist/Cubit-BOgUZva7.js +342 -266
  8. package/dist/Cubit-BOxMvpfc.js +273 -232
  9. package/dist/Cubit-BTznt8zg.js +1 -1
  10. package/dist/Cubit-BogJXkLm.js +260 -225
  11. package/dist/Cubit-C-8R_8db.cjs +475 -0
  12. package/dist/Cubit-C-8R_8db.cjs.map +1 -0
  13. package/dist/Cubit-C3Mw3EoO.cjs +401 -0
  14. package/dist/Cubit-C3Mw3EoO.cjs.map +1 -0
  15. package/dist/Cubit-CO8Fr72L.cjs +447 -0
  16. package/dist/Cubit-CO8Fr72L.cjs.map +1 -0
  17. package/dist/Cubit-COfHT1Bm.cjs +300 -259
  18. package/dist/Cubit-CROWjjs9.js +481 -0
  19. package/dist/Cubit-CROWjjs9.js.map +1 -0
  20. package/dist/Cubit-CWP8Ddzx.cjs +510 -0
  21. package/dist/Cubit-CWP8Ddzx.cjs.map +1 -0
  22. package/dist/Cubit-CXxh9iol.js +284 -242
  23. package/dist/Cubit-CYOWfzQt.cjs +297 -254
  24. package/dist/Cubit-CZaf_fp4.cjs +1 -1
  25. package/dist/Cubit-C_dUEUdd.cjs +359 -286
  26. package/dist/Cubit-C_rxRCTN.cjs +523 -0
  27. package/dist/Cubit-C_rxRCTN.cjs.map +1 -0
  28. package/dist/Cubit-CcKgMEBO.js +281 -239
  29. package/dist/Cubit-CfT6Y1jl.js +328 -280
  30. package/dist/Cubit-CynJruuO.js +369 -0
  31. package/dist/Cubit-CynJruuO.js.map +1 -0
  32. package/dist/Cubit-D2vQ6nMb.js +342 -266
  33. package/dist/Cubit-D7jOZCoZ.js +342 -266
  34. package/dist/Cubit-D9j3IGPc.cjs +523 -0
  35. package/dist/Cubit-D9j3IGPc.cjs.map +1 -0
  36. package/dist/Cubit-DKEY9WYq.cjs +276 -240
  37. package/dist/Cubit-DMV_0TCp.js +481 -0
  38. package/dist/Cubit-DMV_0TCp.js.map +1 -0
  39. package/dist/Cubit-DP5DXPUK.js +342 -266
  40. package/dist/Cubit-DRFkzD2h.js +426 -0
  41. package/dist/Cubit-DRFkzD2h.js.map +1 -0
  42. package/dist/Cubit-DbnhTUaZ.cjs +359 -286
  43. package/dist/Cubit-DrqG3SP3.cjs +349 -300
  44. package/dist/Cubit-DsDkCo42.cjs +292 -250
  45. package/dist/Cubit-DwRw1E9D.cjs +289 -247
  46. package/dist/Cubit-Dw_kFBgc.js +1 -1
  47. package/dist/Cubit-KiXZCubP.cjs +1 -1
  48. package/dist/Cubit-Ksj7G4uR.js +342 -266
  49. package/dist/Cubit-MkjbpcPf.cjs +359 -286
  50. package/dist/Cubit-NRhvdDQ6.js +279 -239
  51. package/dist/Cubit-PMTXxI_u.js +1 -1
  52. package/dist/Cubit-VJuu2tt9.js +481 -0
  53. package/dist/Cubit-VJuu2tt9.js.map +1 -0
  54. package/dist/Cubit-jz922NKf.cjs +300 -257
  55. package/dist/Cubit-kU5_4jgC.cjs +359 -286
  56. package/dist/StateContainerRegistry-B4yVMYbx.cjs +1057 -0
  57. package/dist/StateContainerRegistry-B4yVMYbx.cjs.map +1 -0
  58. package/dist/StateContainerRegistry-BAcxouCu.js +683 -615
  59. package/dist/StateContainerRegistry-BK57H92E.js +701 -630
  60. package/dist/StateContainerRegistry-BRBATSrx.cjs +1030 -0
  61. package/dist/StateContainerRegistry-BRBATSrx.cjs.map +1 -0
  62. package/dist/StateContainerRegistry-BgBIKcQF.js +956 -0
  63. package/dist/StateContainerRegistry-BgBIKcQF.js.map +1 -0
  64. package/dist/StateContainerRegistry-BglEhqdA.js +669 -606
  65. package/dist/StateContainerRegistry-BhcnG0DF.js +625 -562
  66. package/dist/StateContainerRegistry-BpO5t-0i.js +642 -580
  67. package/dist/StateContainerRegistry-BqS-wpb_.js +957 -0
  68. package/dist/StateContainerRegistry-BqS-wpb_.js.map +1 -0
  69. package/dist/StateContainerRegistry-BrEGYPZT.cjs +1029 -0
  70. package/dist/StateContainerRegistry-BrEGYPZT.cjs.map +1 -0
  71. package/dist/StateContainerRegistry-Bxfne4A7.cjs +908 -0
  72. package/dist/StateContainerRegistry-Bxfne4A7.cjs.map +1 -0
  73. package/dist/StateContainerRegistry-C0E7vsgy.js +758 -0
  74. package/dist/StateContainerRegistry-C0E7vsgy.js.map +1 -0
  75. package/dist/StateContainerRegistry-C0I77Ndz.cjs +920 -0
  76. package/dist/StateContainerRegistry-C0I77Ndz.cjs.map +1 -0
  77. package/dist/StateContainerRegistry-CDH9mnQS.cjs +668 -614
  78. package/dist/StateContainerRegistry-CTOXUf75.cjs +695 -640
  79. package/dist/StateContainerRegistry-CX2CBOmv.cjs +739 -679
  80. package/dist/StateContainerRegistry-CXnnf2-l.js +867 -0
  81. package/dist/StateContainerRegistry-CXnnf2-l.js.map +1 -0
  82. package/dist/StateContainerRegistry-CehuIpK_.cjs +811 -0
  83. package/dist/StateContainerRegistry-CehuIpK_.cjs.map +1 -0
  84. package/dist/StateContainerRegistry-Ci0ajc5g.js +680 -612
  85. package/dist/StateContainerRegistry-Ck2-XmT_.js +587 -527
  86. package/dist/StateContainerRegistry-D1lVJFGL.cjs +706 -646
  87. package/dist/StateContainerRegistry-DC4N73O6.js +632 -569
  88. package/dist/StateContainerRegistry-DOuGI-l5.js +645 -582
  89. package/dist/StateContainerRegistry-DT66lr3I.cjs +651 -596
  90. package/dist/StateContainerRegistry-DmmzYa7S.js +974 -0
  91. package/dist/StateContainerRegistry-DmmzYa7S.js.map +1 -0
  92. package/dist/StateContainerRegistry-Upsrlg9G.cjs +709 -649
  93. package/dist/StateContainerRegistry-WznfcA-Q.js +855 -0
  94. package/dist/StateContainerRegistry-WznfcA-Q.js.map +1 -0
  95. package/dist/StateContainerRegistry-Yph6UCA_.js +637 -569
  96. package/dist/StateContainerRegistry-mseeTqSA.cjs +671 -616
  97. package/dist/StateContainerRegistry-pRNxHNFD.cjs +658 -603
  98. package/dist/StateContainerRegistry-vXMWtG7J.cjs +613 -561
  99. package/dist/StateContainerRegistry-v_prqMcI.cjs +663 -603
  100. package/dist/branded-BSeA_mZO.cjs.map +1 -1
  101. package/dist/branded-DCqi3De1.cjs +11 -11
  102. package/dist/branded-DwtzSsg0.js.map +1 -1
  103. package/dist/branded-Max3xOTA.js +6 -6
  104. package/dist/config-0ZD9i3wy.js +16 -0
  105. package/dist/config-0ZD9i3wy.js.map +1 -0
  106. package/dist/config-B3NIwDQv.cjs +20 -20
  107. package/dist/config-BKGHop0V.js +5 -5
  108. package/dist/config-BKoaAlmb.js +5 -5
  109. package/dist/config-BPj08-8h.cjs +32 -0
  110. package/dist/config-BPj08-8h.cjs.map +1 -0
  111. package/dist/config-BR0Xy-Tn.cjs +20 -20
  112. package/dist/config-B_4xXpvK.cjs +32 -0
  113. package/dist/config-B_4xXpvK.cjs.map +1 -0
  114. package/dist/config-BflrQM4_.cjs +32 -0
  115. package/dist/config-BflrQM4_.cjs.map +1 -0
  116. package/dist/config-BzObBsk2.cjs +32 -0
  117. package/dist/config-BzObBsk2.cjs.map +1 -0
  118. package/dist/config-C0yumL1H.cjs +32 -0
  119. package/dist/config-C0yumL1H.cjs.map +1 -0
  120. package/dist/config-C8xqVHTf.js +16 -0
  121. package/dist/config-C8xqVHTf.js.map +1 -0
  122. package/dist/config-CCUhIYIF.js +5 -5
  123. package/dist/config-CGo__MAt.js +16 -0
  124. package/dist/config-CGo__MAt.js.map +1 -0
  125. package/dist/config-CQH9fTY-.cjs +20 -20
  126. package/dist/config-CR_Bz7RD.js +5 -5
  127. package/dist/config-CTOa-yPN.cjs +20 -20
  128. package/dist/config-Cd7Q-B4g.js +16 -0
  129. package/dist/config-Cd7Q-B4g.js.map +1 -0
  130. package/dist/config-CmDEX-1o.js +16 -0
  131. package/dist/config-CmDEX-1o.js.map +1 -0
  132. package/dist/config-CoNMTnMA.cjs +32 -0
  133. package/dist/config-CoNMTnMA.cjs.map +1 -0
  134. package/dist/config-Cwj8-C1J.js +5 -5
  135. package/dist/config-D3jisfdj.cjs +20 -20
  136. package/dist/config-D4GifZQ4.js +5 -5
  137. package/dist/config-DDrSQGpQ.cjs +20 -20
  138. package/dist/config-DEcslxan.cjs +20 -20
  139. package/dist/config-DMNZ2YLV.cjs +20 -20
  140. package/dist/config-De9oQ6Ki.js +5 -5
  141. package/dist/config-DoHx0Xsl.js +16 -0
  142. package/dist/config-DoHx0Xsl.js.map +1 -0
  143. package/dist/config-DokTzpr8.cjs +20 -20
  144. package/dist/config-DslYBm4Z.js +5 -5
  145. package/dist/config-H6FAqbW4.cjs +20 -20
  146. package/dist/config-Yp645dGK.js +5 -5
  147. package/dist/config-ispAzOZV.js +5 -5
  148. package/dist/config.d.cts +72 -0
  149. package/dist/config.d.ts +72 -0
  150. package/dist/constants.d.cts +13 -0
  151. package/dist/constants.d.ts +13 -0
  152. package/dist/core/Cubit.d.ts +14 -4
  153. package/dist/core/StateContainer.d.ts +111 -11
  154. package/dist/core/StateContainerRegistry.d.ts +55 -11
  155. package/dist/core/symbols.d.ts +26 -0
  156. package/dist/debug.cjs +3 -3
  157. package/dist/debug.js +3 -3
  158. package/dist/decorators/blac.d.ts +17 -0
  159. package/dist/ensure-9VEq5H0L.js +3 -3
  160. package/dist/ensure-BB6xHQAF.cjs +14 -0
  161. package/dist/ensure-BB6xHQAF.cjs.map +1 -0
  162. package/dist/ensure-BNDfTzqg.cjs +8 -8
  163. package/dist/ensure-BVCnjU7r.js +343 -267
  164. package/dist/ensure-BbzGXjep.cjs +8 -8
  165. package/dist/ensure-BlIaQai6.js +9 -0
  166. package/dist/ensure-BlIaQai6.js.map +1 -0
  167. package/dist/ensure-Bm3oHxga.js +9 -0
  168. package/dist/ensure-Bm3oHxga.js.map +1 -0
  169. package/dist/ensure-C3eIRs6e.cjs +8 -8
  170. package/dist/ensure-CJZL7bcA.cjs +365 -292
  171. package/dist/ensure-CN6unBOe.cjs +8 -8
  172. package/dist/ensure-CU-B1ywv.js +3 -3
  173. package/dist/ensure-CWKzeno7.js +3 -3
  174. package/dist/ensure-CkENsuQ9.js +9 -0
  175. package/dist/ensure-CkENsuQ9.js.map +1 -0
  176. package/dist/ensure-Cm-4_LSh.cjs +14 -0
  177. package/dist/ensure-Cm-4_LSh.cjs.map +1 -0
  178. package/dist/ensure-Cqex5r1P.cjs +14 -0
  179. package/dist/ensure-Cqex5r1P.cjs.map +1 -0
  180. package/dist/ensure-Cv5AbNGZ.js +9 -0
  181. package/dist/ensure-Cv5AbNGZ.js.map +1 -0
  182. package/dist/ensure-D63lEMUK.cjs +8 -8
  183. package/dist/ensure-DGEtPU9A.cjs +8 -8
  184. package/dist/ensure-DM3qb336.cjs +14 -0
  185. package/dist/ensure-DM3qb336.cjs.map +1 -0
  186. package/dist/ensure-DME-_T0j.cjs +8 -8
  187. package/dist/ensure-DWd0GCYB.js +3 -3
  188. package/dist/ensure-DamKOP6q.cjs +8 -8
  189. package/dist/ensure-Dcfptl-A.js +9 -0
  190. package/dist/ensure-Dcfptl-A.js.map +1 -0
  191. package/dist/ensure-Def-EBWG.js +3 -3
  192. package/dist/ensure-DnHL5QiQ.cjs +14 -0
  193. package/dist/ensure-DnHL5QiQ.cjs.map +1 -0
  194. package/dist/ensure-Dr7I78Ku.cjs +8 -8
  195. package/dist/ensure-SLVdGd5b.js +3 -3
  196. package/dist/ensure-Sb92MCXu.js +3 -3
  197. package/dist/ensure-gFlvevGm.cjs +14 -0
  198. package/dist/ensure-gFlvevGm.cjs.map +1 -0
  199. package/dist/ensure-l2-H7S5W.js +3 -3
  200. package/dist/ensure-mkL-3qh8.js +9 -0
  201. package/dist/ensure-mkL-3qh8.js.map +1 -0
  202. package/dist/ensure-n80crSlX.js +3 -3
  203. package/dist/ensure-nCxg7MCN.js +3 -3
  204. package/dist/ensure-vS71MV4q.cjs +8 -8
  205. package/dist/index.cjs +37 -14
  206. package/dist/index.cjs.map +1 -1
  207. package/dist/index.d.cts +14 -4
  208. package/dist/index.d.ts +14 -4
  209. package/dist/index.js +23 -10
  210. package/dist/index.js.map +1 -1
  211. package/dist/management-6oQbmf0z.js +41 -0
  212. package/dist/management-6oQbmf0z.js.map +1 -0
  213. package/dist/management-B46QwA9Y.js +20 -11
  214. package/dist/management-B9yrRpeg.js +41 -0
  215. package/dist/management-B9yrRpeg.js.map +1 -0
  216. package/dist/management-BCKTEZ8Q.js +20 -11
  217. package/dist/management-BbMzdXbT.js +41 -0
  218. package/dist/management-BbMzdXbT.js.map +1 -0
  219. package/dist/management-Bg652agq.js +20 -11
  220. package/dist/management-BnedF5ZD.cjs +50 -50
  221. package/dist/management-BoUa99eB.cjs +79 -0
  222. package/dist/management-BoUa99eB.cjs.map +1 -0
  223. package/dist/management-C4SHcrJm.cjs +79 -0
  224. package/dist/management-C4SHcrJm.cjs.map +1 -0
  225. package/dist/management-CK-GL3wY.js +20 -11
  226. package/dist/management-CPhgY8OE.js +41 -0
  227. package/dist/management-CPhgY8OE.js.map +1 -0
  228. package/dist/management-CU_V3LIP.js +20 -11
  229. package/dist/management-CUwXDSi9.cjs +79 -0
  230. package/dist/management-CUwXDSi9.cjs.map +1 -0
  231. package/dist/management-CaqiyNzB.js +20 -11
  232. package/dist/management-Cin-JvYe.js +20 -11
  233. package/dist/management-ClaXym0F.cjs +50 -50
  234. package/dist/management-DL0Uzsoz.js +20 -11
  235. package/dist/management-DLdAQfqk.cjs +79 -0
  236. package/dist/management-DLdAQfqk.cjs.map +1 -0
  237. package/dist/management-DMZ8qpwr.cjs +50 -50
  238. package/dist/management-DTzcC6aD.cjs +79 -0
  239. package/dist/management-DTzcC6aD.cjs.map +1 -0
  240. package/dist/management-DYLNyj9p.cjs +50 -50
  241. package/dist/management-Dag9u4t6.cjs +50 -50
  242. package/dist/management-DbMRdDBo.cjs +50 -50
  243. package/dist/management-DfnDAKmP.js +41 -0
  244. package/dist/management-DfnDAKmP.js.map +1 -0
  245. package/dist/management-DjBU1gtb.cjs +50 -50
  246. package/dist/management-DwCozsY8.js +20 -11
  247. package/dist/management-H4m3ciJO.js +32 -0
  248. package/dist/management-H4m3ciJO.js.map +1 -0
  249. package/dist/management-Xo3A6Za3.cjs +79 -0
  250. package/dist/management-Xo3A6Za3.cjs.map +1 -0
  251. package/dist/management-ZU2YzOkr.js +18 -10
  252. package/dist/management-baPDwA9n.cjs +50 -50
  253. package/dist/management-jQGCvZNN.cjs +44 -44
  254. package/dist/management-ry_KteFK.cjs +50 -50
  255. package/dist/plugin/BlacPlugin.d.ts +89 -15
  256. package/dist/plugin/PluginManager.d.ts +65 -5
  257. package/dist/plugins.cjs +1 -1
  258. package/dist/plugins.d.cts +2 -2
  259. package/dist/plugins.d.ts +2 -2
  260. package/dist/plugins.js +1 -1
  261. package/dist/registry/acquire.d.ts +9 -2
  262. package/dist/registry/ensure.d.ts +2 -2
  263. package/dist/registry/index.d.ts +1 -1
  264. package/dist/resolve-dependencies-B2QggQAi.js +641 -558
  265. package/dist/resolve-dependencies-B6JDXvpr.js +651 -566
  266. package/dist/resolve-dependencies-BAKAoD0U.js +878 -0
  267. package/dist/resolve-dependencies-BAKAoD0U.js.map +1 -0
  268. package/dist/resolve-dependencies-BFZQq60Y.cjs +724 -666
  269. package/dist/resolve-dependencies-BGafS3Ww.js +643 -561
  270. package/dist/resolve-dependencies-BHd34gS3.cjs +724 -666
  271. package/dist/resolve-dependencies-BNeayhbQ.cjs +732 -671
  272. package/dist/resolve-dependencies-BWEMpuDy.js +641 -558
  273. package/dist/resolve-dependencies-BiWkW2eS.js +643 -561
  274. package/dist/resolve-dependencies-BjxCztYD.js +739 -0
  275. package/dist/resolve-dependencies-BjxCztYD.js.map +1 -0
  276. package/dist/resolve-dependencies-BlyBV0hB.cjs +969 -0
  277. package/dist/resolve-dependencies-BlyBV0hB.cjs.map +1 -0
  278. package/dist/resolve-dependencies-By26rT_i.js +651 -566
  279. package/dist/resolve-dependencies-C9Kf7AzY.cjs +724 -666
  280. package/dist/resolve-dependencies-CTzV1txG.js +643 -561
  281. package/dist/resolve-dependencies-CWjuGHiF.cjs +969 -0
  282. package/dist/resolve-dependencies-CWjuGHiF.cjs.map +1 -0
  283. package/dist/resolve-dependencies-ClSsP0DJ.cjs +722 -663
  284. package/dist/resolve-dependencies-D0vTzZgs.js +643 -561
  285. package/dist/resolve-dependencies-D2WnZMF-.cjs +724 -666
  286. package/dist/resolve-dependencies-DCBLTeza.cjs +969 -0
  287. package/dist/resolve-dependencies-DCBLTeza.cjs.map +1 -0
  288. package/dist/resolve-dependencies-DMlqYJR2.js +643 -561
  289. package/dist/resolve-dependencies-DP6U1EYB.cjs +840 -0
  290. package/dist/resolve-dependencies-DP6U1EYB.cjs.map +1 -0
  291. package/dist/resolve-dependencies-DSQNXvnV.cjs +724 -666
  292. package/dist/resolve-dependencies-DV3HO_uH.js +878 -0
  293. package/dist/resolve-dependencies-DV3HO_uH.js.map +1 -0
  294. package/dist/resolve-dependencies-DXwMhP0Y.js +878 -0
  295. package/dist/resolve-dependencies-DXwMhP0Y.js.map +1 -0
  296. package/dist/resolve-dependencies-DbRWlt9u.js +878 -0
  297. package/dist/resolve-dependencies-DbRWlt9u.js.map +1 -0
  298. package/dist/resolve-dependencies-DcUUva2P.cjs +724 -666
  299. package/dist/resolve-dependencies-Dd8T6TLt.cjs +724 -666
  300. package/dist/resolve-dependencies-Dfdp_DZd.cjs +732 -671
  301. package/dist/resolve-dependencies-GJ8PNyNB.cjs +969 -0
  302. package/dist/resolve-dependencies-GJ8PNyNB.cjs.map +1 -0
  303. package/dist/resolve-dependencies-KSpTt4jy.cjs +722 -663
  304. package/dist/resolve-dependencies-Nvjp4CwS.js +643 -561
  305. package/dist/resolve-dependencies-f-QUqYiL.js +643 -561
  306. package/dist/testing.cjs +27 -20
  307. package/dist/testing.cjs.map +1 -1
  308. package/dist/testing.d.cts +22 -1
  309. package/dist/testing.d.ts +22 -1
  310. package/dist/testing.js +27 -21
  311. package/dist/testing.js.map +1 -1
  312. package/dist/tracked-B77j2g9M.js +171 -151
  313. package/dist/tracked-BDVi2LKM.cjs +196 -175
  314. package/dist/tracked-BFdJCzL0.cjs +242 -0
  315. package/dist/tracked-BFdJCzL0.cjs.map +1 -0
  316. package/dist/tracked-BH-gX4T1.cjs +196 -175
  317. package/dist/tracked-BTHok3Dl.cjs +196 -175
  318. package/dist/tracked-BTbFkFeM.js +186 -166
  319. package/dist/tracked-BU_OBWqM.cjs +242 -0
  320. package/dist/tracked-BU_OBWqM.cjs.map +1 -0
  321. package/dist/tracked-BfctH2es.cjs +242 -0
  322. package/dist/tracked-BfctH2es.cjs.map +1 -0
  323. package/dist/tracked-BhQtzUhZ.js +186 -166
  324. package/dist/tracked-BnqrYXiO.js +212 -0
  325. package/dist/tracked-BnqrYXiO.js.map +1 -0
  326. package/dist/tracked-BtgFOGup.js +212 -0
  327. package/dist/tracked-BtgFOGup.js.map +1 -0
  328. package/dist/tracked-C3nIS4J7.cjs +242 -0
  329. package/dist/tracked-C3nIS4J7.cjs.map +1 -0
  330. package/dist/tracked-C52awNV9.js +171 -151
  331. package/dist/tracked-CGzduF2m.js +186 -166
  332. package/dist/tracked-CK_-ixtX.cjs +196 -175
  333. package/dist/tracked-CLlvURln.js +186 -166
  334. package/dist/tracked-CgHWmuGC.cjs +211 -190
  335. package/dist/tracked-CoAlC8fs.js +171 -151
  336. package/dist/tracked-D3Xjm1H1.cjs +211 -190
  337. package/dist/tracked-DB6yMV5F.js +212 -0
  338. package/dist/tracked-DB6yMV5F.js.map +1 -0
  339. package/dist/tracked-DBn-bs_G.js +171 -151
  340. package/dist/tracked-DMBTDF0P.js +171 -151
  341. package/dist/tracked-DN3h3Rp1.js +171 -151
  342. package/dist/tracked-DOGh1Q5Z.cjs +242 -0
  343. package/dist/tracked-DOGh1Q5Z.cjs.map +1 -0
  344. package/dist/tracked-DUkp4zve.cjs +196 -175
  345. package/dist/tracked-D_ou7mYG.js +212 -0
  346. package/dist/tracked-D_ou7mYG.js.map +1 -0
  347. package/dist/tracked-Dcu6EATB.js +171 -151
  348. package/dist/tracked-GvAJQVAI.cjs +227 -196
  349. package/dist/tracked-O2lv-kJV.cjs +211 -190
  350. package/dist/tracked-WF6aXuAo.js +186 -162
  351. package/dist/tracked-d_sQWU3c.cjs +196 -175
  352. package/dist/tracked-n9TMK-30.cjs +196 -175
  353. package/dist/tracked-njU-_pVa.cjs +211 -190
  354. package/dist/tracked-zAgmKIlC.js +212 -0
  355. package/dist/tracked-zAgmKIlC.js.map +1 -0
  356. package/dist/tracking/dependency-manager.d.ts +33 -29
  357. package/dist/tracking/index.d.ts +16 -1
  358. package/dist/tracking/iteration-perf.bench.d.ts +1 -0
  359. package/dist/tracking/path-utils.d.ts +18 -1
  360. package/dist/tracking/resolve-dependencies.d.ts +3 -1
  361. package/dist/tracking/tracked.d.ts +37 -34
  362. package/dist/tracking/tracking-proxy.d.ts +94 -47
  363. package/dist/tracking.cjs +12 -9
  364. package/dist/tracking.js +32 -2
  365. package/dist/types/utilities.d.ts +15 -3
  366. package/dist/types.cjs +1 -1
  367. package/dist/types.js +1 -1
  368. package/dist/utils/static-props.d.ts +14 -0
  369. package/dist/utils/structural-key.d.ts +14 -0
  370. package/dist/watch/watch.d.ts +1 -1
  371. package/dist/watch-BpwaUL8r.cjs +68 -0
  372. package/dist/watch-BpwaUL8r.cjs.map +1 -0
  373. package/dist/watch-DWCqXllW.js +57 -0
  374. package/dist/watch-DWCqXllW.js.map +1 -0
  375. package/dist/watch-entry.cjs +3 -6
  376. package/dist/watch-entry.d.cts +1 -3
  377. package/dist/watch-entry.d.ts +1 -3
  378. package/dist/watch-entry.js +2 -2
  379. package/package.json +4 -14
@@ -1,779 +1,840 @@
1
- const require_StateContainerRegistry = require("./StateContainerRegistry-Upsrlg9G.cjs");
2
- const require_config = require("./config-BR0Xy-Tn.cjs");
1
+ const require_StateContainerRegistry = require('./StateContainerRegistry-Upsrlg9G.cjs');
2
+ const require_config = require('./config-BR0Xy-Tn.cjs');
3
3
  //#region src/tracking/path-utils.ts
4
4
  /**
5
- * Path utilities for dependency tracking
6
- *
7
- * Provides utilities for parsing property paths and extracting values
8
- * from nested objects using path strings.
9
- *
10
- * @internal
11
- */
12
- /**
13
- * Parse a property path string into an array of segments
14
- *
15
- * @internal
16
- *
17
- * Handles both dot notation (a.b.c) and bracket notation (a[0].b)
18
- *
19
- * @example
20
- * ```ts
21
- * parsePath('user.name') // ['user', 'name']
22
- * parsePath('items[0].name') // ['items', '0', 'name']
23
- * parsePath('data.users[2].address.city') // ['data', 'users', '2', 'address', 'city']
24
- * ```
25
- */
5
+ * Path utilities for dependency tracking
6
+ *
7
+ * Provides utilities for parsing property paths and extracting values
8
+ * from nested objects using path strings.
9
+ *
10
+ * @internal
11
+ */
12
+ /**
13
+ * Parse a property path string into an array of segments
14
+ *
15
+ * @internal
16
+ *
17
+ * Handles both dot notation (a.b.c) and bracket notation (a[0].b)
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * parsePath('user.name') // ['user', 'name']
22
+ * parsePath('items[0].name') // ['items', '0', 'name']
23
+ * parsePath('data.users[2].address.city') // ['data', 'users', '2', 'address', 'city']
24
+ * ```
25
+ */
26
26
  function parsePath(path) {
27
- const segments = [];
28
- let current = "";
29
- let i = 0;
30
- while (i < path.length) {
31
- const char = path[i];
32
- if (char === ".") {
33
- if (current) segments.push(current);
34
- current = "";
35
- } else if (char === "[") {
36
- if (current) segments.push(current);
37
- current = "";
38
- i++;
39
- while (i < path.length && path[i] !== "]") current += path[i++];
40
- if (current) segments.push(current);
41
- current = "";
42
- } else current += char;
43
- i++;
44
- }
45
- if (current) segments.push(current);
46
- return segments;
47
- }
48
- /**
49
- * Get a value from an object using a path of segments
50
- *
51
- * @example
52
- * ```ts
53
- * const obj = { user: { name: 'Alice', age: 30 } }
54
- * getValueAtPath(obj, ['user', 'name']) // 'Alice'
55
- * getValueAtPath(obj, ['user', 'age']) // 30
56
- * getValueAtPath(obj, ['user', 'missing']) // undefined
57
- * ```
58
- *
59
- * @internal
60
- */
27
+ const segments = [];
28
+ let current = '';
29
+ let i = 0;
30
+ while (i < path.length) {
31
+ const char = path[i];
32
+ if (char === '.') {
33
+ if (current) segments.push(current);
34
+ current = '';
35
+ } else if (char === '[') {
36
+ if (current) segments.push(current);
37
+ current = '';
38
+ i++;
39
+ while (i < path.length && path[i] !== ']') current += path[i++];
40
+ if (current) segments.push(current);
41
+ current = '';
42
+ } else current += char;
43
+ i++;
44
+ }
45
+ if (current) segments.push(current);
46
+ return segments;
47
+ }
48
+ /**
49
+ * Get a value from an object using a path of segments
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const obj = { user: { name: 'Alice', age: 30 } }
54
+ * getValueAtPath(obj, ['user', 'name']) // 'Alice'
55
+ * getValueAtPath(obj, ['user', 'age']) // 30
56
+ * getValueAtPath(obj, ['user', 'missing']) // undefined
57
+ * ```
58
+ *
59
+ * @internal
60
+ */
61
61
  function getValueAtPath(obj, segments) {
62
- if (obj == null) return void 0;
63
- let current = obj;
64
- for (let i = 0; i < segments.length; i++) {
65
- current = current[segments[i]];
66
- if (current == null) return void 0;
67
- }
68
- return current;
69
- }
70
- /**
71
- * Shallow equality comparison for arrays
72
- *
73
- * Compares two arrays element-by-element using Object.is
74
- *
75
- * @example
76
- * ```ts
77
- * shallowEqual([1, 2, 3], [1, 2, 3]) // true
78
- * shallowEqual([1, 2, 3], [1, 2, 4]) // false
79
- * shallowEqual([1, 2], [1, 2, 3]) // false
80
- * ```
81
- *
82
- * @internal
83
- */
62
+ if (obj == null) return void 0;
63
+ let current = obj;
64
+ for (let i = 0; i < segments.length; i++) {
65
+ current = current[segments[i]];
66
+ if (current == null) return void 0;
67
+ }
68
+ return current;
69
+ }
70
+ /**
71
+ * Shallow equality comparison for arrays
72
+ *
73
+ * Compares two arrays element-by-element using Object.is
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * shallowEqual([1, 2, 3], [1, 2, 3]) // true
78
+ * shallowEqual([1, 2, 3], [1, 2, 4]) // false
79
+ * shallowEqual([1, 2], [1, 2, 3]) // false
80
+ * ```
81
+ *
82
+ * @internal
83
+ */
84
84
  function shallowEqual(arr1, arr2) {
85
- if (arr1.length !== arr2.length) return false;
86
- for (let i = 0; i < arr1.length; i++) if (!Object.is(arr1[i], arr2[i])) return false;
87
- return true;
85
+ if (arr1.length !== arr2.length) return false;
86
+ for (let i = 0; i < arr1.length; i++)
87
+ if (!Object.is(arr1[i], arr2[i])) return false;
88
+ return true;
88
89
  }
89
90
  //#endregion
90
91
  //#region src/tracking/tracking-proxy.ts
91
92
  /**
92
- * Consolidated Tracking System
93
- *
94
- * This module provides all dependency and getter tracking functionality:
95
- * - Proxy creation for automatic property access tracking
96
- * - Dependency path tracking and change detection
97
- * - Getter execution tracking for computed properties
98
- * - Combined tracking proxy for watch/waitUntil use cases
99
- */
100
- /**
101
- * Check if a value can be proxied
102
- * Returns true for plain objects and arrays only.
103
- * @internal
104
- */
93
+ * Consolidated Tracking System
94
+ *
95
+ * This module provides all dependency and getter tracking functionality:
96
+ * - Proxy creation for automatic property access tracking
97
+ * - Dependency path tracking and change detection
98
+ * - Getter execution tracking for computed properties
99
+ * - Combined tracking proxy for watch/waitUntil use cases
100
+ */
101
+ /**
102
+ * Check if a value can be proxied
103
+ * Returns true for plain objects and arrays only.
104
+ * @internal
105
+ */
105
106
  function isProxyable(value) {
106
- if (typeof value !== "object" || value === null) return false;
107
- const proto = Object.getPrototypeOf(value);
108
- return proto === Object.prototype || proto === Array.prototype;
107
+ if (typeof value !== 'object' || value === null) return false;
108
+ const proto = Object.getPrototypeOf(value);
109
+ return proto === Object.prototype || proto === Array.prototype;
109
110
  }
110
111
  /**
111
- * Create a new proxy tracker state
112
- * @internal
113
- */
112
+ * Create a new proxy tracker state
113
+ * @internal
114
+ */
114
115
  function createProxyState() {
115
- return {
116
- trackedPaths: /* @__PURE__ */ new Set(),
117
- isTracking: false,
118
- proxyCache: /* @__PURE__ */ new WeakMap(),
119
- boundFunctionsCache: null,
120
- lastProxiedState: null,
121
- lastProxy: null,
122
- maxDepth: 10
123
- };
124
- }
125
- /**
126
- * Start tracking property accesses
127
- * @internal
128
- */
116
+ return {
117
+ trackedPaths: /* @__PURE__ */ new Set(),
118
+ isTracking: false,
119
+ proxyCache: /* @__PURE__ */ new WeakMap(),
120
+ boundFunctionsCache: null,
121
+ lastProxiedState: null,
122
+ lastProxy: null,
123
+ maxDepth: 10,
124
+ };
125
+ }
126
+ /**
127
+ * Start tracking property accesses
128
+ * @internal
129
+ */
129
130
  function startProxy(state) {
130
- state.isTracking = true;
131
- state.trackedPaths.clear();
131
+ state.isTracking = true;
132
+ state.trackedPaths.clear();
132
133
  }
133
134
  /**
134
- * Stop tracking and return the tracked paths
135
- * @internal
136
- */
135
+ * Stop tracking and return the tracked paths
136
+ * @internal
137
+ */
137
138
  function stopProxy(state) {
138
- state.isTracking = false;
139
- const paths = state.trackedPaths;
140
- state.trackedPaths = /* @__PURE__ */ new Set();
141
- return paths;
139
+ state.isTracking = false;
140
+ const paths = state.trackedPaths;
141
+ state.trackedPaths = /* @__PURE__ */ new Set();
142
+ return paths;
142
143
  }
143
144
  /**
144
- * Create a proxy for an array with property access tracking
145
- * @internal
146
- */
145
+ * Create a proxy for an array with property access tracking
146
+ * @internal
147
+ */
147
148
  function createArrayProxy(state, target, path, depth = 0) {
148
- const proxy = new Proxy(target, { get: (arr, prop) => {
149
- if (typeof prop === "symbol") return Reflect.get(arr, prop);
150
- const value = Reflect.get(arr, prop);
151
- if (typeof value === "function") {
152
- if (!state.boundFunctionsCache) state.boundFunctionsCache = /* @__PURE__ */ new WeakMap();
153
- const cached = state.boundFunctionsCache.get(value);
154
- if (cached) return cached;
155
- const bound = value.bind(arr);
156
- state.boundFunctionsCache.set(value, bound);
157
- return bound;
158
- }
159
- if (prop === "length") {
160
- if (state.isTracking) {
161
- const fullPath = path ? `${path}.length` : "length";
162
- state.trackedPaths.add(fullPath);
163
- }
164
- return value;
165
- }
166
- let fullPath;
167
- if (typeof prop === "string") {
168
- const index = Number(prop);
169
- if (!isNaN(index) && index >= 0) fullPath = path ? `${path}[${index}]` : `[${index}]`;
170
- else fullPath = path ? `${path}.${prop}` : prop;
171
- } else return value;
172
- if (isProxyable(value)) return createInternal(state, value, fullPath, depth + 1);
173
- if (state.isTracking) state.trackedPaths.add(fullPath);
174
- return value;
175
- } });
176
- state.proxyCache.set(target, proxy);
177
- return proxy;
178
- }
179
- /**
180
- * Create a proxy for an object with property access tracking
181
- * @internal
182
- */
183
- function createInternal(state, target, path = "", depth = 0) {
184
- if (!state.isTracking || !isProxyable(target)) return target;
185
- if (depth >= state.maxDepth) {
186
- console.warn(`${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Proxy depth limit (${state.maxDepth}) reached at path "${path}". Deeper property accesses won't be tracked for re-renders.`);
187
- return target;
188
- }
189
- if (state.proxyCache.has(target)) return state.proxyCache.get(target);
190
- if (Array.isArray(target)) return createArrayProxy(state, target, path, depth);
191
- const proxy = new Proxy(target, {
192
- get: (obj, prop) => {
193
- if (typeof prop === "symbol") return Reflect.get(obj, prop);
194
- const value = Reflect.get(obj, prop);
195
- if (typeof value === "function") {
196
- if (!state.boundFunctionsCache) state.boundFunctionsCache = /* @__PURE__ */ new WeakMap();
197
- const cached = state.boundFunctionsCache.get(value);
198
- if (cached) return cached;
199
- const bound = value.bind(obj);
200
- state.boundFunctionsCache.set(value, bound);
201
- return bound;
202
- }
203
- const fullPath = path ? `${path}.${String(prop)}` : String(prop);
204
- if (typeof prop === "string" && state.isTracking) {
205
- if (!prop.startsWith("_") && !prop.startsWith("$$")) state.trackedPaths.add(fullPath);
206
- }
207
- if (isProxyable(value)) return createInternal(state, value, fullPath, depth + 1);
208
- return value;
209
- },
210
- has: (obj, prop) => {
211
- if (typeof prop === "string" && state.isTracking) {
212
- const fullPath = path ? `${path}.${prop}` : prop;
213
- state.trackedPaths.add(fullPath);
214
- }
215
- return Reflect.has(obj, prop);
216
- },
217
- ownKeys: (obj) => {
218
- if (state.isTracking && path) state.trackedPaths.add(path);
219
- return Reflect.ownKeys(obj);
220
- }
221
- });
222
- state.proxyCache.set(target, proxy);
223
- return proxy;
224
- }
225
- /**
226
- * Create a proxy for a target with caching
227
- * @internal
228
- */
149
+ const proxy = new Proxy(target, {
150
+ get: (arr, prop) => {
151
+ if (typeof prop === 'symbol') return Reflect.get(arr, prop);
152
+ const value = Reflect.get(arr, prop);
153
+ if (typeof value === 'function') {
154
+ if (!state.boundFunctionsCache)
155
+ state.boundFunctionsCache = /* @__PURE__ */ new WeakMap();
156
+ const cached = state.boundFunctionsCache.get(value);
157
+ if (cached) return cached;
158
+ const bound = value.bind(arr);
159
+ state.boundFunctionsCache.set(value, bound);
160
+ return bound;
161
+ }
162
+ if (prop === 'length') {
163
+ if (state.isTracking) {
164
+ const fullPath = path ? `${path}.length` : 'length';
165
+ state.trackedPaths.add(fullPath);
166
+ }
167
+ return value;
168
+ }
169
+ let fullPath;
170
+ if (typeof prop === 'string') {
171
+ const index = Number(prop);
172
+ if (!isNaN(index) && index >= 0)
173
+ fullPath = path ? `${path}[${index}]` : `[${index}]`;
174
+ else fullPath = path ? `${path}.${prop}` : prop;
175
+ } else return value;
176
+ if (isProxyable(value))
177
+ return createInternal(state, value, fullPath, depth + 1);
178
+ if (state.isTracking) state.trackedPaths.add(fullPath);
179
+ return value;
180
+ },
181
+ });
182
+ state.proxyCache.set(target, proxy);
183
+ return proxy;
184
+ }
185
+ /**
186
+ * Create a proxy for an object with property access tracking
187
+ * @internal
188
+ */
189
+ function createInternal(state, target, path = '', depth = 0) {
190
+ if (!state.isTracking || !isProxyable(target)) return target;
191
+ if (depth >= state.maxDepth) {
192
+ console.warn(
193
+ `${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Proxy depth limit (${state.maxDepth}) reached at path "${path}". Deeper property accesses won't be tracked for re-renders.`,
194
+ );
195
+ return target;
196
+ }
197
+ if (state.proxyCache.has(target)) return state.proxyCache.get(target);
198
+ if (Array.isArray(target))
199
+ return createArrayProxy(state, target, path, depth);
200
+ const proxy = new Proxy(target, {
201
+ get: (obj, prop) => {
202
+ if (typeof prop === 'symbol') return Reflect.get(obj, prop);
203
+ const value = Reflect.get(obj, prop);
204
+ if (typeof value === 'function') {
205
+ if (!state.boundFunctionsCache)
206
+ state.boundFunctionsCache = /* @__PURE__ */ new WeakMap();
207
+ const cached = state.boundFunctionsCache.get(value);
208
+ if (cached) return cached;
209
+ const bound = value.bind(obj);
210
+ state.boundFunctionsCache.set(value, bound);
211
+ return bound;
212
+ }
213
+ const fullPath = path ? `${path}.${String(prop)}` : String(prop);
214
+ if (typeof prop === 'string' && state.isTracking) {
215
+ if (!prop.startsWith('_') && !prop.startsWith('$$'))
216
+ state.trackedPaths.add(fullPath);
217
+ }
218
+ if (isProxyable(value))
219
+ return createInternal(state, value, fullPath, depth + 1);
220
+ return value;
221
+ },
222
+ has: (obj, prop) => {
223
+ if (typeof prop === 'string' && state.isTracking) {
224
+ const fullPath = path ? `${path}.${prop}` : prop;
225
+ state.trackedPaths.add(fullPath);
226
+ }
227
+ return Reflect.has(obj, prop);
228
+ },
229
+ ownKeys: (obj) => {
230
+ if (state.isTracking && path) state.trackedPaths.add(path);
231
+ return Reflect.ownKeys(obj);
232
+ },
233
+ });
234
+ state.proxyCache.set(target, proxy);
235
+ return proxy;
236
+ }
237
+ /**
238
+ * Create a proxy for a target with caching
239
+ * @internal
240
+ */
229
241
  function createForTarget(state, target) {
230
- if (state.lastProxiedState === target && state.lastProxy) return state.lastProxy;
231
- if (state.lastProxiedState !== null) state.proxyCache.delete(state.lastProxiedState);
232
- state.boundFunctionsCache = null;
233
- const proxy = createInternal(state, target, "", 0);
234
- state.lastProxiedState = target;
235
- state.lastProxy = proxy;
236
- return proxy;
242
+ if (state.lastProxiedState === target && state.lastProxy)
243
+ return state.lastProxy;
244
+ if (state.lastProxiedState !== null)
245
+ state.proxyCache.delete(state.lastProxiedState);
246
+ state.boundFunctionsCache = null;
247
+ const proxy = createInternal(state, target, '', 0);
248
+ state.lastProxiedState = target;
249
+ state.lastProxy = proxy;
250
+ return proxy;
237
251
  }
238
252
  function isChildPath(child, parent) {
239
- if (child === parent) return false;
240
- return child.startsWith(parent + ".") || child.startsWith(parent + "[");
253
+ if (child === parent) return false;
254
+ return child.startsWith(parent + '.') || child.startsWith(parent + '[');
241
255
  }
242
256
  function getArrayParentPath(path) {
243
- if (path.endsWith(".length")) return path.slice(0, -7);
244
- const arrayIndexMatch = path.match(/^(.+?)\[\d+\]/);
245
- if (arrayIndexMatch) return arrayIndexMatch[1];
246
- return null;
257
+ if (path.endsWith('.length')) return path.slice(0, -7);
258
+ const arrayIndexMatch = path.match(/^(.+?)\[\d+\]/);
259
+ if (arrayIndexMatch) return arrayIndexMatch[1];
260
+ return null;
247
261
  }
248
262
  /**
249
- * @internal
250
- */
263
+ * @internal
264
+ */
251
265
  function optimizeTrackedPaths(paths) {
252
- if (paths.size <= 1) return paths;
253
- let allFlat = true;
254
- for (const path of paths) if (path.charCodeAt(path.length - 1) === 93 || path.includes(".")) {
255
- allFlat = false;
256
- break;
257
- }
258
- if (allFlat) return paths;
259
- const sortedPaths = Array.from(paths).sort((a, b) => a > b ? -1 : a < b ? 1 : 0);
260
- const optimized = /* @__PURE__ */ new Set();
261
- let lastKept;
262
- for (const path of sortedPaths) {
263
- if (lastKept !== void 0 && isChildPath(lastKept, path)) continue;
264
- optimized.add(path);
265
- lastKept = path;
266
- }
267
- const arrayParents = /* @__PURE__ */ new Set();
268
- for (const path of optimized) {
269
- const arrayParent = getArrayParentPath(path);
270
- if (arrayParent) arrayParents.add(arrayParent);
271
- }
272
- for (const arrayParent of arrayParents) optimized.add(arrayParent);
273
- return optimized;
274
- }
275
- /**
276
- * @internal
277
- */
266
+ if (paths.size <= 1) return paths;
267
+ let allFlat = true;
268
+ for (const path of paths)
269
+ if (path.charCodeAt(path.length - 1) === 93 || path.includes('.')) {
270
+ allFlat = false;
271
+ break;
272
+ }
273
+ if (allFlat) return paths;
274
+ const sortedPaths = Array.from(paths).sort((a, b) =>
275
+ a > b ? -1 : a < b ? 1 : 0,
276
+ );
277
+ const optimized = /* @__PURE__ */ new Set();
278
+ let lastKept;
279
+ for (const path of sortedPaths) {
280
+ if (lastKept !== void 0 && isChildPath(lastKept, path)) continue;
281
+ optimized.add(path);
282
+ lastKept = path;
283
+ }
284
+ const arrayParents = /* @__PURE__ */ new Set();
285
+ for (const path of optimized) {
286
+ const arrayParent = getArrayParentPath(path);
287
+ if (arrayParent) arrayParents.add(arrayParent);
288
+ }
289
+ for (const arrayParent of arrayParents) optimized.add(arrayParent);
290
+ return optimized;
291
+ }
292
+ /**
293
+ * @internal
294
+ */
278
295
  function createDependencyState() {
279
- return {
280
- proxyState: createProxyState(),
281
- previousRenderPaths: /* @__PURE__ */ new Set(),
282
- currentRenderPaths: /* @__PURE__ */ new Set(),
283
- pathCache: /* @__PURE__ */ new Map(),
284
- lastCheckedState: null,
285
- lastCheckedValues: /* @__PURE__ */ new Map()
286
- };
287
- }
288
- /**
289
- * @internal
290
- */
296
+ return {
297
+ proxyState: createProxyState(),
298
+ previousRenderPaths: /* @__PURE__ */ new Set(),
299
+ currentRenderPaths: /* @__PURE__ */ new Set(),
300
+ pathCache: /* @__PURE__ */ new Map(),
301
+ lastCheckedState: null,
302
+ lastCheckedValues: /* @__PURE__ */ new Map(),
303
+ };
304
+ }
305
+ /**
306
+ * @internal
307
+ */
291
308
  function startDependency(tracker) {
292
- startProxy(tracker.proxyState);
309
+ startProxy(tracker.proxyState);
293
310
  }
294
311
  /**
295
- * @internal
296
- */
312
+ * @internal
313
+ */
297
314
  function createDependencyProxy(tracker, state) {
298
- return createForTarget(tracker.proxyState, state);
315
+ return createForTarget(tracker.proxyState, state);
299
316
  }
300
317
  /**
301
- * @internal
302
- */
318
+ * @internal
319
+ */
303
320
  function capturePaths(tracker, state) {
304
- tracker.previousRenderPaths = tracker.currentRenderPaths;
305
- tracker.currentRenderPaths = optimizeTrackedPaths(stopProxy(tracker.proxyState));
306
- if (tracker.previousRenderPaths.size === 0 && tracker.currentRenderPaths.size === 0) return;
307
- const trackedPathsUnion = new Set(tracker.previousRenderPaths);
308
- for (const path of tracker.currentRenderPaths) trackedPathsUnion.add(path);
309
- const canReuseCache = tracker.lastCheckedState === state;
310
- for (const path of trackedPathsUnion) if (!tracker.pathCache.has(path)) {
311
- const segments = parsePath(path);
312
- const value = canReuseCache && tracker.lastCheckedValues.has(path) ? tracker.lastCheckedValues.get(path) : getValueAtPath(state, segments);
313
- tracker.pathCache.set(path, {
314
- segments,
315
- value
316
- });
317
- } else {
318
- const info = tracker.pathCache.get(path);
319
- if (!info) continue;
320
- info.value = canReuseCache && tracker.lastCheckedValues.has(path) ? tracker.lastCheckedValues.get(path) : getValueAtPath(state, info.segments);
321
- }
322
- tracker.lastCheckedValues.clear();
323
- }
324
- /**
325
- * @internal
326
- */
321
+ tracker.previousRenderPaths = tracker.currentRenderPaths;
322
+ tracker.currentRenderPaths = optimizeTrackedPaths(
323
+ stopProxy(tracker.proxyState),
324
+ );
325
+ if (
326
+ tracker.previousRenderPaths.size === 0 &&
327
+ tracker.currentRenderPaths.size === 0
328
+ )
329
+ return;
330
+ const trackedPathsUnion = new Set(tracker.previousRenderPaths);
331
+ for (const path of tracker.currentRenderPaths) trackedPathsUnion.add(path);
332
+ const canReuseCache = tracker.lastCheckedState === state;
333
+ for (const path of trackedPathsUnion)
334
+ if (!tracker.pathCache.has(path)) {
335
+ const segments = parsePath(path);
336
+ const value =
337
+ canReuseCache && tracker.lastCheckedValues.has(path)
338
+ ? tracker.lastCheckedValues.get(path)
339
+ : getValueAtPath(state, segments);
340
+ tracker.pathCache.set(path, {
341
+ segments,
342
+ value,
343
+ });
344
+ } else {
345
+ const info = tracker.pathCache.get(path);
346
+ if (!info) continue;
347
+ info.value =
348
+ canReuseCache && tracker.lastCheckedValues.has(path)
349
+ ? tracker.lastCheckedValues.get(path)
350
+ : getValueAtPath(state, info.segments);
351
+ }
352
+ tracker.lastCheckedValues.clear();
353
+ }
354
+ /**
355
+ * @internal
356
+ */
327
357
  function hasDependencyChanges(tracker, state) {
328
- if (tracker.pathCache.size === 0) return true;
329
- tracker.lastCheckedValues.clear();
330
- for (const [path, info] of tracker.pathCache.entries()) {
331
- const currentValue = getValueAtPath(state, info.segments);
332
- tracker.lastCheckedValues.set(path, currentValue);
333
- if (!Object.is(currentValue, info.value)) {
334
- tracker.lastCheckedState = state;
335
- return true;
336
- }
337
- }
338
- tracker.lastCheckedState = state;
339
- return false;
340
- }
341
- /**
342
- * @internal
343
- */
358
+ if (tracker.pathCache.size === 0) return true;
359
+ tracker.lastCheckedValues.clear();
360
+ for (const [path, info] of tracker.pathCache.entries()) {
361
+ const currentValue = getValueAtPath(state, info.segments);
362
+ tracker.lastCheckedValues.set(path, currentValue);
363
+ if (!Object.is(currentValue, info.value)) {
364
+ tracker.lastCheckedState = state;
365
+ return true;
366
+ }
367
+ }
368
+ tracker.lastCheckedState = state;
369
+ return false;
370
+ }
371
+ /**
372
+ * @internal
373
+ */
344
374
  function hasTrackedData(tracker) {
345
- return tracker.proxyState.trackedPaths.size > 0 || tracker.pathCache.size > 0 || tracker.previousRenderPaths.size > 0;
375
+ return (
376
+ tracker.proxyState.trackedPaths.size > 0 ||
377
+ tracker.pathCache.size > 0 ||
378
+ tracker.previousRenderPaths.size > 0
379
+ );
346
380
  }
347
381
  const descriptorCache = /* @__PURE__ */ new WeakMap();
348
382
  const blocProxyCache = /* @__PURE__ */ new WeakMap();
349
383
  const activeTrackerMap = /* @__PURE__ */ new WeakMap();
350
- const MAX_GETTER_DEPTH = require_StateContainerRegistry.BLAC_DEFAULTS.MAX_GETTER_DEPTH;
384
+ const MAX_GETTER_DEPTH =
385
+ require_StateContainerRegistry.BLAC_DEFAULTS.MAX_GETTER_DEPTH;
351
386
  /**
352
- * @internal
353
- */
387
+ * @internal
388
+ */
354
389
  function getDescriptor(obj, prop) {
355
- const constructor = obj.constructor;
356
- let constructorCache = descriptorCache.get(constructor);
357
- if (constructorCache?.has(prop)) return constructorCache.get(prop);
358
- let current = obj;
359
- let descriptor;
360
- while (current && current !== Object.prototype) {
361
- descriptor = Object.getOwnPropertyDescriptor(current, prop);
362
- if (descriptor) break;
363
- current = Object.getPrototypeOf(current);
364
- }
365
- if (!constructorCache) {
366
- constructorCache = /* @__PURE__ */ new Map();
367
- descriptorCache.set(constructor, constructorCache);
368
- }
369
- constructorCache.set(prop, descriptor);
370
- return descriptor;
371
- }
372
- /**
373
- * @internal
374
- */
390
+ const constructor = obj.constructor;
391
+ let constructorCache = descriptorCache.get(constructor);
392
+ if (constructorCache?.has(prop)) return constructorCache.get(prop);
393
+ let current = obj;
394
+ let descriptor;
395
+ while (current && current !== Object.prototype) {
396
+ descriptor = Object.getOwnPropertyDescriptor(current, prop);
397
+ if (descriptor) break;
398
+ current = Object.getPrototypeOf(current);
399
+ }
400
+ if (!constructorCache) {
401
+ constructorCache = /* @__PURE__ */ new Map();
402
+ descriptorCache.set(constructor, constructorCache);
403
+ }
404
+ constructorCache.set(prop, descriptor);
405
+ return descriptor;
406
+ }
407
+ /**
408
+ * @internal
409
+ */
375
410
  function isGetter(obj, prop) {
376
- return getDescriptor(obj, prop)?.get !== void 0;
411
+ return getDescriptor(obj, prop)?.get !== void 0;
377
412
  }
378
413
  /**
379
- * @internal
380
- */
414
+ * @internal
415
+ */
381
416
  function createGetterState() {
382
- return {
383
- trackedValues: /* @__PURE__ */ new Map(),
384
- currentlyAccessing: /* @__PURE__ */ new Set(),
385
- trackedGetters: /* @__PURE__ */ new Set(),
386
- isTracking: false,
387
- renderCache: /* @__PURE__ */ new Map(),
388
- cacheValid: false,
389
- depth: 0,
390
- visitedBlocs: /* @__PURE__ */ new Set()
391
- };
392
- }
393
- /**
394
- * @internal
395
- */
417
+ return {
418
+ trackedValues: /* @__PURE__ */ new Map(),
419
+ currentlyAccessing: /* @__PURE__ */ new Set(),
420
+ trackedGetters: /* @__PURE__ */ new Set(),
421
+ isTracking: false,
422
+ renderCache: /* @__PURE__ */ new Map(),
423
+ cacheValid: false,
424
+ depth: 0,
425
+ visitedBlocs: /* @__PURE__ */ new Set(),
426
+ };
427
+ }
428
+ /**
429
+ * @internal
430
+ */
396
431
  function setActiveTracker(bloc, tracker) {
397
- activeTrackerMap.set(bloc, tracker);
432
+ activeTrackerMap.set(bloc, tracker);
398
433
  }
399
434
  /**
400
- * @internal
401
- */
435
+ * @internal
436
+ */
402
437
  function clearActiveTracker(bloc) {
403
- activeTrackerMap.delete(bloc);
438
+ activeTrackerMap.delete(bloc);
404
439
  }
405
440
  /**
406
- * @internal
407
- */
441
+ * @internal
442
+ */
408
443
  function commitTrackedGetters(tracker) {
409
- if (tracker.currentlyAccessing.size > 0) tracker.trackedGetters = new Set(tracker.currentlyAccessing);
410
- tracker.currentlyAccessing.clear();
444
+ if (tracker.currentlyAccessing.size > 0)
445
+ tracker.trackedGetters = new Set(tracker.currentlyAccessing);
446
+ tracker.currentlyAccessing.clear();
411
447
  }
412
448
  /**
413
- * Execute a tracked getter with depth/circular dependency checks and context management.
414
- * @internal
415
- */
449
+ * Execute a tracked getter with depth/circular dependency checks and context management.
450
+ * @internal
451
+ */
416
452
  function executeTrackedGetter(target, prop, tracker) {
417
- tracker.currentlyAccessing.add(prop);
418
- if (tracker.cacheValid && tracker.renderCache.has(prop)) {
419
- const cachedValue = tracker.renderCache.get(prop);
420
- tracker.trackedValues.set(prop, cachedValue);
421
- return cachedValue;
422
- }
423
- if (tracker.depth >= MAX_GETTER_DEPTH) throw new Error(`${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Maximum getter depth (${MAX_GETTER_DEPTH}) exceeded. Possible circular dependency in getter "${String(prop)}" on ${target.constructor.name}.`);
424
- if (tracker.visitedBlocs.has(target)) throw new Error(`${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Circular dependency detected: getter "${String(prop)}" on ${target.constructor.name}.`);
425
- const prevDepth = tracker.depth;
426
- const prevVisited = new Set(tracker.visitedBlocs);
427
- tracker.depth++;
428
- tracker.visitedBlocs.add(target);
429
- try {
430
- const descriptor = getDescriptor(target, prop);
431
- if (!descriptor?.get) return target[prop];
432
- const value = descriptor.get.call(target);
433
- tracker.trackedValues.set(prop, value);
434
- return value;
435
- } catch (error) {
436
- tracker.currentlyAccessing.delete(prop);
437
- throw error;
438
- } finally {
439
- tracker.depth = prevDepth;
440
- tracker.visitedBlocs = prevVisited;
441
- }
442
- }
443
- /**
444
- * @internal
445
- */
453
+ tracker.currentlyAccessing.add(prop);
454
+ if (tracker.cacheValid && tracker.renderCache.has(prop)) {
455
+ const cachedValue = tracker.renderCache.get(prop);
456
+ tracker.trackedValues.set(prop, cachedValue);
457
+ return cachedValue;
458
+ }
459
+ if (tracker.depth >= MAX_GETTER_DEPTH)
460
+ throw new Error(
461
+ `${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Maximum getter depth (${MAX_GETTER_DEPTH}) exceeded. Possible circular dependency in getter "${String(prop)}" on ${target.constructor.name}.`,
462
+ );
463
+ if (tracker.visitedBlocs.has(target))
464
+ throw new Error(
465
+ `${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Circular dependency detected: getter "${String(prop)}" on ${target.constructor.name}.`,
466
+ );
467
+ const prevDepth = tracker.depth;
468
+ const prevVisited = new Set(tracker.visitedBlocs);
469
+ tracker.depth++;
470
+ tracker.visitedBlocs.add(target);
471
+ try {
472
+ const descriptor = getDescriptor(target, prop);
473
+ if (!descriptor?.get) return target[prop];
474
+ const value = descriptor.get.call(target);
475
+ tracker.trackedValues.set(prop, value);
476
+ return value;
477
+ } catch (error) {
478
+ tracker.currentlyAccessing.delete(prop);
479
+ throw error;
480
+ } finally {
481
+ tracker.depth = prevDepth;
482
+ tracker.visitedBlocs = prevVisited;
483
+ }
484
+ }
485
+ /**
486
+ * @internal
487
+ */
446
488
  function createBlocProxy(bloc) {
447
- const cached = blocProxyCache.get(bloc);
448
- if (cached) return cached;
449
- const proxy = new Proxy(bloc, { get(target, prop, receiver) {
450
- const tracker = activeTrackerMap.get(target);
451
- if (tracker?.isTracking && isGetter(target, prop)) return executeTrackedGetter(target, prop, tracker);
452
- return Reflect.get(target, prop, receiver);
453
- } });
454
- blocProxyCache.set(bloc, proxy);
455
- return proxy;
456
- }
457
- /**
458
- * @internal
459
- */
489
+ const cached = blocProxyCache.get(bloc);
490
+ if (cached) return cached;
491
+ const proxy = new Proxy(bloc, {
492
+ get(target, prop, receiver) {
493
+ const tracker = activeTrackerMap.get(target);
494
+ if (tracker?.isTracking && isGetter(target, prop))
495
+ return executeTrackedGetter(target, prop, tracker);
496
+ return Reflect.get(target, prop, receiver);
497
+ },
498
+ });
499
+ blocProxyCache.set(bloc, proxy);
500
+ return proxy;
501
+ }
502
+ /**
503
+ * @internal
504
+ */
460
505
  function hasGetterChanges(bloc, tracker) {
461
- if (!tracker || tracker.trackedGetters.size === 0) return false;
462
- tracker.renderCache.clear();
463
- let hasAnyChange = false;
464
- for (const prop of tracker.trackedGetters) try {
465
- const descriptor = getDescriptor(bloc, prop);
466
- if (!descriptor?.get) continue;
467
- const newValue = descriptor.get.call(bloc);
468
- const oldValue = tracker.trackedValues.get(prop);
469
- tracker.renderCache.set(prop, newValue);
470
- tracker.trackedValues.set(prop, newValue);
471
- if (!Object.is(newValue, oldValue)) hasAnyChange = true;
472
- } catch (error) {
473
- console.warn(`${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Getter "${String(prop)}" threw error during change detection. Stopping tracking for this getter.`, error);
474
- tracker.trackedGetters.delete(prop);
475
- tracker.trackedValues.delete(prop);
476
- tracker.cacheValid = false;
477
- return true;
478
- }
479
- tracker.cacheValid = true;
480
- return hasAnyChange;
481
- }
482
- /**
483
- * @internal
484
- */
506
+ if (!tracker || tracker.trackedGetters.size === 0) return false;
507
+ tracker.renderCache.clear();
508
+ let hasAnyChange = false;
509
+ for (const prop of tracker.trackedGetters)
510
+ try {
511
+ const descriptor = getDescriptor(bloc, prop);
512
+ if (!descriptor?.get) continue;
513
+ const newValue = descriptor.get.call(bloc);
514
+ const oldValue = tracker.trackedValues.get(prop);
515
+ tracker.renderCache.set(prop, newValue);
516
+ tracker.trackedValues.set(prop, newValue);
517
+ if (!Object.is(newValue, oldValue)) hasAnyChange = true;
518
+ } catch (error) {
519
+ console.warn(
520
+ `${require_StateContainerRegistry.BLAC_ERROR_PREFIX} Getter "${String(prop)}" threw error during change detection. Stopping tracking for this getter.`,
521
+ error,
522
+ );
523
+ tracker.trackedGetters.delete(prop);
524
+ tracker.trackedValues.delete(prop);
525
+ tracker.cacheValid = false;
526
+ return true;
527
+ }
528
+ tracker.cacheValid = true;
529
+ return hasAnyChange;
530
+ }
531
+ /**
532
+ * @internal
533
+ */
485
534
  function invalidateRenderCache(tracker) {
486
- tracker.cacheValid = false;
535
+ tracker.cacheValid = false;
487
536
  }
488
537
  /**
489
- * Create a new tracking proxy state.
490
- */
538
+ * Create a new tracking proxy state.
539
+ */
491
540
  function createState() {
492
- return {
493
- dependencyState: createDependencyState(),
494
- getterState: createGetterState(),
495
- dependencies: /* @__PURE__ */ new Set(),
496
- isTracking: false
497
- };
541
+ return {
542
+ dependencyState: createDependencyState(),
543
+ getterState: createGetterState(),
544
+ dependencies: /* @__PURE__ */ new Set(),
545
+ isTracking: false,
546
+ };
498
547
  }
499
548
  /**
500
- * Start tracking on a tracking proxy.
501
- */
549
+ * Start tracking on a tracking proxy.
550
+ */
502
551
  function startTracking(tracker) {
503
- tracker.isTracking = true;
504
- tracker.dependencies.clear();
505
- tracker.getterState.isTracking = true;
506
- startDependency(tracker.dependencyState);
552
+ tracker.isTracking = true;
553
+ tracker.dependencies.clear();
554
+ tracker.getterState.isTracking = true;
555
+ startDependency(tracker.dependencyState);
507
556
  }
508
557
  /**
509
- * Stop tracking and collect all dependencies.
510
- */
558
+ * Stop tracking and collect all dependencies.
559
+ */
511
560
  function stopTracking(tracker, bloc) {
512
- tracker.isTracking = false;
513
- tracker.getterState.isTracking = false;
514
- capturePaths(tracker.dependencyState, bloc.state);
515
- commitTrackedGetters(tracker.getterState);
516
- return new Set(tracker.dependencies);
561
+ tracker.isTracking = false;
562
+ tracker.getterState.isTracking = false;
563
+ capturePaths(tracker.dependencyState, bloc.state);
564
+ commitTrackedGetters(tracker.getterState);
565
+ return new Set(tracker.dependencies);
517
566
  }
518
567
  /**
519
- * Check if tracked state or getters have changed.
520
- */
568
+ * Check if tracked state or getters have changed.
569
+ */
521
570
  function hasChanges(tracker, bloc) {
522
- invalidateRenderCache(tracker.getterState);
523
- const stateChanged = hasDependencyChanges(tracker.dependencyState, bloc.state);
524
- const getterChanged = hasGetterChanges(bloc, tracker.getterState);
525
- return stateChanged || getterChanged;
526
- }
527
- /**
528
- * Create a tracking proxy for a bloc instance.
529
- * Tracks both state property access and getter access.
530
- */
571
+ invalidateRenderCache(tracker.getterState);
572
+ const stateChanged = hasDependencyChanges(
573
+ tracker.dependencyState,
574
+ bloc.state,
575
+ );
576
+ const getterChanged = hasGetterChanges(bloc, tracker.getterState);
577
+ return stateChanged || getterChanged;
578
+ }
579
+ /**
580
+ * Create a tracking proxy for a bloc instance.
581
+ * Tracks both state property access and getter access.
582
+ */
531
583
  function createTrackingProxy(bloc, tracker) {
532
- tracker.dependencies.add(bloc);
533
- const stateProxyCache = /* @__PURE__ */ new WeakMap();
534
- return new Proxy(bloc, { get(target, prop, receiver) {
535
- if (prop === "state") {
536
- if (!tracker.isTracking) return target.state;
537
- const rawState = target.state;
538
- if (rawState === null || typeof rawState !== "object") return rawState;
539
- if (stateProxyCache.has(rawState)) return stateProxyCache.get(rawState);
540
- const stateProxy = createDependencyProxy(tracker.dependencyState, rawState);
541
- stateProxyCache.set(rawState, stateProxy);
542
- return stateProxy;
543
- }
544
- if (typeof prop === "symbol") return Reflect.get(target, prop, receiver);
545
- const value = Reflect.get(target, prop, receiver);
546
- if (typeof value === "function") return value.bind(target);
547
- if (tracker.isTracking && isGetter(target, prop)) return executeTrackedGetter(target, prop, tracker.getterState);
548
- return value;
549
- } });
584
+ tracker.dependencies.add(bloc);
585
+ const stateProxyCache = /* @__PURE__ */ new WeakMap();
586
+ return new Proxy(bloc, {
587
+ get(target, prop, receiver) {
588
+ if (prop === 'state') {
589
+ if (!tracker.isTracking) return target.state;
590
+ const rawState = target.state;
591
+ if (rawState === null || typeof rawState !== 'object') return rawState;
592
+ if (stateProxyCache.has(rawState)) return stateProxyCache.get(rawState);
593
+ const stateProxy = createDependencyProxy(
594
+ tracker.dependencyState,
595
+ rawState,
596
+ );
597
+ stateProxyCache.set(rawState, stateProxy);
598
+ return stateProxy;
599
+ }
600
+ if (typeof prop === 'symbol') return Reflect.get(target, prop, receiver);
601
+ const value = Reflect.get(target, prop, receiver);
602
+ if (typeof value === 'function') return value.bind(target);
603
+ if (tracker.isTracking && isGetter(target, prop))
604
+ return executeTrackedGetter(target, prop, tracker.getterState);
605
+ return value;
606
+ },
607
+ });
550
608
  }
551
609
  //#endregion
552
610
  //#region src/tracking/dependency-manager.ts
553
611
  /**
554
- * Manages subscriptions to state container dependencies.
555
- * Provides efficient sync mechanism to add/remove subscriptions
556
- * as dependencies change between callback invocations.
557
- */
612
+ * Manages subscriptions to state container dependencies.
613
+ * Provides efficient sync mechanism to add/remove subscriptions
614
+ * as dependencies change between callback invocations.
615
+ */
558
616
  var DependencyManager = class {
559
- constructor() {
560
- this.subscriptions = /* @__PURE__ */ new Map();
561
- this.currentDeps = /* @__PURE__ */ new Set();
562
- }
563
- /**
564
- * Sync subscriptions with a new set of dependencies.
565
- * Adds subscriptions for new deps, removes subscriptions for stale deps.
566
- *
567
- * @param newDeps - The new set of dependencies to subscribe to
568
- * @param onChange - Callback to invoke when any dependency changes
569
- * @param exclude - Optional instance to exclude from subscriptions (e.g., primary bloc)
570
- * @returns true if the dependency set changed, false if unchanged
571
- */
572
- sync(newDeps, onChange, exclude) {
573
- const filteredNewDeps = /* @__PURE__ */ new Set();
574
- for (const dep of newDeps) if (dep !== exclude && !dep.isDisposed) filteredNewDeps.add(dep);
575
- if (this.areSetsEqual(this.currentDeps, filteredNewDeps)) return false;
576
- for (const dep of this.currentDeps) if (!filteredNewDeps.has(dep)) {
577
- const unsub = this.subscriptions.get(dep);
578
- if (unsub) {
579
- unsub();
580
- this.subscriptions.delete(dep);
581
- }
582
- }
583
- for (const dep of filteredNewDeps) if (!this.currentDeps.has(dep) && !this.subscriptions.has(dep)) {
584
- const unsub = dep.subscribe(onChange);
585
- this.subscriptions.set(dep, unsub);
586
- }
587
- this.currentDeps = filteredNewDeps;
588
- return true;
589
- }
590
- /**
591
- * Add a single dependency subscription.
592
- */
593
- add(dep, onChange) {
594
- if (this.subscriptions.has(dep) || dep.isDisposed) return;
595
- const unsub = dep.subscribe(onChange);
596
- this.subscriptions.set(dep, unsub);
597
- this.currentDeps.add(dep);
598
- }
599
- /**
600
- * Check if a dependency is currently subscribed.
601
- */
602
- has(dep) {
603
- return this.currentDeps.has(dep);
604
- }
605
- /**
606
- * Get the current set of dependencies.
607
- */
608
- getDependencies() {
609
- return new Set(this.currentDeps);
610
- }
611
- /**
612
- * Clean up all active subscriptions.
613
- */
614
- cleanup() {
615
- for (const unsub of this.subscriptions.values()) unsub();
616
- this.subscriptions.clear();
617
- this.currentDeps.clear();
618
- }
619
- areSetsEqual(a, b) {
620
- if (a.size !== b.size) return false;
621
- for (const item of a) if (!b.has(item)) return false;
622
- return true;
623
- }
617
+ constructor() {
618
+ this.subscriptions = /* @__PURE__ */ new Map();
619
+ this.currentDeps = /* @__PURE__ */ new Set();
620
+ }
621
+ /**
622
+ * Sync subscriptions with a new set of dependencies.
623
+ * Adds subscriptions for new deps, removes subscriptions for stale deps.
624
+ *
625
+ * @param newDeps - The new set of dependencies to subscribe to
626
+ * @param onChange - Callback to invoke when any dependency changes
627
+ * @param exclude - Optional instance to exclude from subscriptions (e.g., primary bloc)
628
+ * @returns true if the dependency set changed, false if unchanged
629
+ */
630
+ sync(newDeps, onChange, exclude) {
631
+ const filteredNewDeps = /* @__PURE__ */ new Set();
632
+ for (const dep of newDeps)
633
+ if (dep !== exclude && !dep.isDisposed) filteredNewDeps.add(dep);
634
+ if (this.areSetsEqual(this.currentDeps, filteredNewDeps)) return false;
635
+ for (const dep of this.currentDeps)
636
+ if (!filteredNewDeps.has(dep)) {
637
+ const unsub = this.subscriptions.get(dep);
638
+ if (unsub) {
639
+ unsub();
640
+ this.subscriptions.delete(dep);
641
+ }
642
+ }
643
+ for (const dep of filteredNewDeps)
644
+ if (!this.currentDeps.has(dep) && !this.subscriptions.has(dep)) {
645
+ const unsub = dep.subscribe(onChange);
646
+ this.subscriptions.set(dep, unsub);
647
+ }
648
+ this.currentDeps = filteredNewDeps;
649
+ return true;
650
+ }
651
+ /**
652
+ * Add a single dependency subscription.
653
+ */
654
+ add(dep, onChange) {
655
+ if (this.subscriptions.has(dep) || dep.isDisposed) return;
656
+ const unsub = dep.subscribe(onChange);
657
+ this.subscriptions.set(dep, unsub);
658
+ this.currentDeps.add(dep);
659
+ }
660
+ /**
661
+ * Check if a dependency is currently subscribed.
662
+ */
663
+ has(dep) {
664
+ return this.currentDeps.has(dep);
665
+ }
666
+ /**
667
+ * Get the current set of dependencies.
668
+ */
669
+ getDependencies() {
670
+ return new Set(this.currentDeps);
671
+ }
672
+ /**
673
+ * Clean up all active subscriptions.
674
+ */
675
+ cleanup() {
676
+ for (const unsub of this.subscriptions.values()) unsub();
677
+ this.subscriptions.clear();
678
+ this.currentDeps.clear();
679
+ }
680
+ areSetsEqual(a, b) {
681
+ if (a.size !== b.size) return false;
682
+ for (const item of a) if (!b.has(item)) return false;
683
+ return true;
684
+ }
624
685
  };
625
686
  //#endregion
626
687
  //#region src/tracking/resolve-dependencies.ts
627
688
  /**
628
- * Resolve all transitive dependencies of a bloc via BFS over `dependencies` maps.
629
- * Uses cycle detection to avoid infinite loops.
630
- * @internal
631
- */
689
+ * Resolve all transitive dependencies of a bloc via BFS over `dependencies` maps.
690
+ * Uses cycle detection to avoid infinite loops.
691
+ * @internal
692
+ */
632
693
  function resolveDependencies(bloc) {
633
- const result = /* @__PURE__ */ new Set();
634
- const visited = /* @__PURE__ */ new Set();
635
- const queue = [bloc];
636
- let head = 0;
637
- while (head < queue.length) {
638
- const current = queue[head++];
639
- for (const [Type, key] of current.dependencies) {
640
- const visitKey = `${Type.name}::${key}`;
641
- if (visited.has(visitKey)) continue;
642
- visited.add(visitKey);
643
- const dep = require_config.getRegistry().ensure(Type, key);
644
- result.add(dep);
645
- if (dep.dependencies.size > 0) queue.push(dep);
646
- }
647
- }
648
- result.delete(bloc);
649
- return result;
694
+ const result = /* @__PURE__ */ new Set();
695
+ const visited = /* @__PURE__ */ new Set();
696
+ const queue = [bloc];
697
+ let head = 0;
698
+ while (head < queue.length) {
699
+ const current = queue[head++];
700
+ for (const [Type, key] of current.dependencies) {
701
+ const visitKey = `${Type.name}::${key}`;
702
+ if (visited.has(visitKey)) continue;
703
+ visited.add(visitKey);
704
+ const dep = require_config.getRegistry().ensure(Type, key);
705
+ result.add(dep);
706
+ if (dep.dependencies.size > 0) queue.push(dep);
707
+ }
708
+ }
709
+ result.delete(bloc);
710
+ return result;
650
711
  }
651
712
  //#endregion
652
- Object.defineProperty(exports, "DependencyManager", {
653
- enumerable: true,
654
- get: function() {
655
- return DependencyManager;
656
- }
713
+ Object.defineProperty(exports, 'DependencyManager', {
714
+ enumerable: true,
715
+ get: function () {
716
+ return DependencyManager;
717
+ },
657
718
  });
658
- Object.defineProperty(exports, "capturePaths", {
659
- enumerable: true,
660
- get: function() {
661
- return capturePaths;
662
- }
719
+ Object.defineProperty(exports, 'capturePaths', {
720
+ enumerable: true,
721
+ get: function () {
722
+ return capturePaths;
723
+ },
663
724
  });
664
- Object.defineProperty(exports, "clearActiveTracker", {
665
- enumerable: true,
666
- get: function() {
667
- return clearActiveTracker;
668
- }
725
+ Object.defineProperty(exports, 'clearActiveTracker', {
726
+ enumerable: true,
727
+ get: function () {
728
+ return clearActiveTracker;
729
+ },
669
730
  });
670
- Object.defineProperty(exports, "commitTrackedGetters", {
671
- enumerable: true,
672
- get: function() {
673
- return commitTrackedGetters;
674
- }
731
+ Object.defineProperty(exports, 'commitTrackedGetters', {
732
+ enumerable: true,
733
+ get: function () {
734
+ return commitTrackedGetters;
735
+ },
675
736
  });
676
- Object.defineProperty(exports, "createBlocProxy", {
677
- enumerable: true,
678
- get: function() {
679
- return createBlocProxy;
680
- }
737
+ Object.defineProperty(exports, 'createBlocProxy', {
738
+ enumerable: true,
739
+ get: function () {
740
+ return createBlocProxy;
741
+ },
681
742
  });
682
- Object.defineProperty(exports, "createDependencyProxy", {
683
- enumerable: true,
684
- get: function() {
685
- return createDependencyProxy;
686
- }
743
+ Object.defineProperty(exports, 'createDependencyProxy', {
744
+ enumerable: true,
745
+ get: function () {
746
+ return createDependencyProxy;
747
+ },
687
748
  });
688
- Object.defineProperty(exports, "createDependencyState", {
689
- enumerable: true,
690
- get: function() {
691
- return createDependencyState;
692
- }
749
+ Object.defineProperty(exports, 'createDependencyState', {
750
+ enumerable: true,
751
+ get: function () {
752
+ return createDependencyState;
753
+ },
693
754
  });
694
- Object.defineProperty(exports, "createGetterState", {
695
- enumerable: true,
696
- get: function() {
697
- return createGetterState;
698
- }
755
+ Object.defineProperty(exports, 'createGetterState', {
756
+ enumerable: true,
757
+ get: function () {
758
+ return createGetterState;
759
+ },
699
760
  });
700
- Object.defineProperty(exports, "createState", {
701
- enumerable: true,
702
- get: function() {
703
- return createState;
704
- }
761
+ Object.defineProperty(exports, 'createState', {
762
+ enumerable: true,
763
+ get: function () {
764
+ return createState;
765
+ },
705
766
  });
706
- Object.defineProperty(exports, "createTrackingProxy", {
707
- enumerable: true,
708
- get: function() {
709
- return createTrackingProxy;
710
- }
767
+ Object.defineProperty(exports, 'createTrackingProxy', {
768
+ enumerable: true,
769
+ get: function () {
770
+ return createTrackingProxy;
771
+ },
711
772
  });
712
- Object.defineProperty(exports, "hasChanges", {
713
- enumerable: true,
714
- get: function() {
715
- return hasChanges;
716
- }
773
+ Object.defineProperty(exports, 'hasChanges', {
774
+ enumerable: true,
775
+ get: function () {
776
+ return hasChanges;
777
+ },
717
778
  });
718
- Object.defineProperty(exports, "hasDependencyChanges", {
719
- enumerable: true,
720
- get: function() {
721
- return hasDependencyChanges;
722
- }
779
+ Object.defineProperty(exports, 'hasDependencyChanges', {
780
+ enumerable: true,
781
+ get: function () {
782
+ return hasDependencyChanges;
783
+ },
723
784
  });
724
- Object.defineProperty(exports, "hasGetterChanges", {
725
- enumerable: true,
726
- get: function() {
727
- return hasGetterChanges;
728
- }
785
+ Object.defineProperty(exports, 'hasGetterChanges', {
786
+ enumerable: true,
787
+ get: function () {
788
+ return hasGetterChanges;
789
+ },
729
790
  });
730
- Object.defineProperty(exports, "hasTrackedData", {
731
- enumerable: true,
732
- get: function() {
733
- return hasTrackedData;
734
- }
791
+ Object.defineProperty(exports, 'hasTrackedData', {
792
+ enumerable: true,
793
+ get: function () {
794
+ return hasTrackedData;
795
+ },
735
796
  });
736
- Object.defineProperty(exports, "invalidateRenderCache", {
737
- enumerable: true,
738
- get: function() {
739
- return invalidateRenderCache;
740
- }
797
+ Object.defineProperty(exports, 'invalidateRenderCache', {
798
+ enumerable: true,
799
+ get: function () {
800
+ return invalidateRenderCache;
801
+ },
741
802
  });
742
- Object.defineProperty(exports, "resolveDependencies", {
743
- enumerable: true,
744
- get: function() {
745
- return resolveDependencies;
746
- }
803
+ Object.defineProperty(exports, 'resolveDependencies', {
804
+ enumerable: true,
805
+ get: function () {
806
+ return resolveDependencies;
807
+ },
747
808
  });
748
- Object.defineProperty(exports, "setActiveTracker", {
749
- enumerable: true,
750
- get: function() {
751
- return setActiveTracker;
752
- }
809
+ Object.defineProperty(exports, 'setActiveTracker', {
810
+ enumerable: true,
811
+ get: function () {
812
+ return setActiveTracker;
813
+ },
753
814
  });
754
- Object.defineProperty(exports, "shallowEqual", {
755
- enumerable: true,
756
- get: function() {
757
- return shallowEqual;
758
- }
815
+ Object.defineProperty(exports, 'shallowEqual', {
816
+ enumerable: true,
817
+ get: function () {
818
+ return shallowEqual;
819
+ },
759
820
  });
760
- Object.defineProperty(exports, "startDependency", {
761
- enumerable: true,
762
- get: function() {
763
- return startDependency;
764
- }
821
+ Object.defineProperty(exports, 'startDependency', {
822
+ enumerable: true,
823
+ get: function () {
824
+ return startDependency;
825
+ },
765
826
  });
766
- Object.defineProperty(exports, "startTracking", {
767
- enumerable: true,
768
- get: function() {
769
- return startTracking;
770
- }
827
+ Object.defineProperty(exports, 'startTracking', {
828
+ enumerable: true,
829
+ get: function () {
830
+ return startTracking;
831
+ },
771
832
  });
772
- Object.defineProperty(exports, "stopTracking", {
773
- enumerable: true,
774
- get: function() {
775
- return stopTracking;
776
- }
833
+ Object.defineProperty(exports, 'stopTracking', {
834
+ enumerable: true,
835
+ get: function () {
836
+ return stopTracking;
837
+ },
777
838
  });
778
839
 
779
- //# sourceMappingURL=resolve-dependencies-BNeayhbQ.cjs.map
840
+ //# sourceMappingURL=resolve-dependencies-BNeayhbQ.cjs.map