@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.
- package/README.md +19 -29
- package/dist/StateContainer-BUyuxKb3.cjs +667 -0
- package/dist/StateContainer-BUyuxKb3.cjs.map +1 -0
- package/dist/StateContainer-B_7UHc3I.js +632 -0
- package/dist/StateContainer-B_7UHc3I.js.map +1 -0
- package/dist/StateContainer-Bh2ipNYj.js +632 -0
- package/dist/StateContainer-Bh2ipNYj.js.map +1 -0
- package/dist/StateContainer-ClzwKnQZ.cjs +667 -0
- package/dist/StateContainer-ClzwKnQZ.cjs.map +1 -0
- package/dist/StateContainer-DiQATvZh.js +632 -0
- package/dist/StateContainer-DiQATvZh.js.map +1 -0
- package/dist/StateContainer-j16zciex.cjs +667 -0
- package/dist/StateContainer-j16zciex.cjs.map +1 -0
- package/dist/{StateContainerRegistry-CSNm2Ws5.cjs → StateContainerRegistry-141uHhtF.cjs} +300 -397
- package/dist/StateContainerRegistry-141uHhtF.cjs.map +1 -0
- package/dist/{StateContainerRegistry-DVIBTxGZ.js → StateContainerRegistry-BH7aOMWV.js} +299 -406
- package/dist/StateContainerRegistry-BH7aOMWV.js.map +1 -0
- package/dist/StateContainerRegistry-BX-DlHXO.js +747 -0
- package/dist/StateContainerRegistry-BX-DlHXO.js.map +1 -0
- package/dist/StateContainerRegistry-Bf5VuVjm.js +747 -0
- package/dist/StateContainerRegistry-Bf5VuVjm.js.map +1 -0
- package/dist/{StateContainerRegistry-Dj77cok9.js → StateContainerRegistry-BsH_s0pJ.js} +303 -413
- package/dist/StateContainerRegistry-BsH_s0pJ.js.map +1 -0
- package/dist/StateContainerRegistry-BvSRfhKv.cjs +866 -0
- package/dist/StateContainerRegistry-BvSRfhKv.cjs.map +1 -0
- package/dist/StateContainerRegistry-C8jxrcqk.cjs +866 -0
- package/dist/StateContainerRegistry-C8jxrcqk.cjs.map +1 -0
- package/dist/{StateContainerRegistry-lIwo-0m3.cjs → StateContainerRegistry-CBLeHObO.cjs} +326 -418
- package/dist/StateContainerRegistry-CBLeHObO.cjs.map +1 -0
- package/dist/StateContainerRegistry-DjQQtlCW.cjs +870 -0
- package/dist/StateContainerRegistry-DjQQtlCW.cjs.map +1 -0
- package/dist/{StateContainerRegistry-D9BIRjwv.cjs → StateContainerRegistry-MkT0W4C2.cjs} +322 -411
- package/dist/StateContainerRegistry-MkT0W4C2.cjs.map +1 -0
- package/dist/StateContainerRegistry-gQbEutkN.js +751 -0
- package/dist/StateContainerRegistry-gQbEutkN.js.map +1 -0
- package/dist/{StateContainerRegistry-CvBOhAT2.js → StateContainerRegistry-vWgsD-RP.js} +277 -392
- package/dist/StateContainerRegistry-vWgsD-RP.js.map +1 -0
- package/dist/config.d.cts +8 -8
- package/dist/config.d.ts +8 -8
- package/dist/constants.d.cts +18 -28
- package/dist/constants.d.ts +18 -28
- package/dist/core/Cubit.d.ts +14 -10
- package/dist/core/StateContainer.d.ts +83 -62
- package/dist/core/StateContainerRegistry.d.ts +87 -166
- package/dist/core/meta.d.ts +34 -47
- package/dist/core/symbols.d.ts +21 -1
- package/dist/decorators/blac.d.ts +31 -28
- package/dist/{acquire-B1LYXSGj.js → ensure-Bi_yXk6f.js} +16 -5
- package/dist/ensure-Bi_yXk6f.js.map +1 -0
- package/dist/{ensure-r1C_7K6_.cjs → ensure-BjhbDW8Z.cjs} +203 -160
- package/dist/ensure-BjhbDW8Z.cjs.map +1 -0
- package/dist/{ensure-BSJHkUNX.js → ensure-BnVyd6s4.js} +297 -122
- package/dist/ensure-BnVyd6s4.js.map +1 -0
- package/dist/{acquire-BZIs6tpN.cjs → ensure-Bx41d-il.cjs} +23 -6
- package/dist/ensure-Bx41d-il.cjs.map +1 -0
- package/dist/{acquire-BRIJVJaA.js → ensure-C7UQ_mKM.js} +16 -5
- package/dist/ensure-C7UQ_mKM.js.map +1 -0
- package/dist/{ensure-B59ri8oo.js → ensure-CneMkpbI.js} +298 -122
- package/dist/ensure-CneMkpbI.js.map +1 -0
- package/dist/{ensure-B2DYCbbI.cjs → ensure-D15vGnk5.cjs} +328 -123
- package/dist/ensure-D15vGnk5.cjs.map +1 -0
- package/dist/{acquire-B1Wuqla6.cjs → ensure-D1D4WjYf.cjs} +23 -6
- package/dist/ensure-D1D4WjYf.cjs.map +1 -0
- package/dist/{ensure-BKdq5xsY.cjs → ensure-D3w6YGp9.cjs} +329 -123
- package/dist/ensure-D3w6YGp9.cjs.map +1 -0
- package/dist/{acquire-BJ3xUEmh.cjs → ensure-DBnuRJ0R.cjs} +23 -6
- package/dist/ensure-DBnuRJ0R.cjs.map +1 -0
- package/dist/{acquire-BdsVZBSe.js → ensure-NTB9nnnj.js} +16 -5
- package/dist/ensure-NTB9nnnj.js.map +1 -0
- package/dist/{ensure-D3WWWwMo.cjs → ensure-ORVw-WRE.cjs} +194 -155
- package/dist/ensure-ORVw-WRE.cjs.map +1 -0
- package/dist/{ensure-BEeY5Ab7.js → ensure-dsqWhIuO.js} +182 -147
- package/dist/ensure-dsqWhIuO.js.map +1 -0
- package/dist/{ensure-11-asM1e.js → ensure-k-6q7O25.js} +173 -150
- package/dist/ensure-k-6q7O25.js.map +1 -0
- package/dist/index.cjs +234 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -13
- package/dist/index.d.ts +5 -13
- package/dist/index.js +211 -52
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +10 -0
- package/dist/internal.d.cts +8 -0
- package/dist/internal.d.ts +8 -0
- package/dist/internal.js +3 -0
- package/dist/plugin/BlacPlugin.d.ts +22 -24
- package/dist/plugin/PluginManager.d.ts +47 -60
- package/dist/plugins.cjs +383 -3
- package/dist/plugins.cjs.map +1 -0
- package/dist/plugins.d.cts +10 -5
- package/dist/plugins.d.ts +10 -5
- package/dist/plugins.js +381 -1
- package/dist/plugins.js.map +1 -0
- package/dist/registry/acquire.d.ts +2 -2
- package/dist/registry/config.d.ts +12 -0
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/management.d.ts +3 -0
- package/dist/registry/queries.d.ts +15 -0
- package/dist/registry/release.d.ts +4 -20
- package/dist/testing.cjs +38 -38
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +5 -11
- package/dist/testing.d.ts +5 -11
- package/dist/testing.js +28 -28
- package/dist/testing.js.map +1 -1
- package/dist/types/branded.d.ts +6 -13
- package/dist/types/utilities.d.ts +40 -31
- package/dist/utils/idGenerator.d.ts +6 -13
- package/dist/utils/static-props.d.ts +22 -29
- package/dist/utils/structural-key.d.ts +0 -22
- package/dist/watch/index.d.ts +1 -2
- package/dist/watch/watch.d.ts +17 -3
- package/package.json +28 -54
- package/dist/StateContainerRegistry-4Ljd9EJx.js +0 -1018
- package/dist/StateContainerRegistry-4Ljd9EJx.js.map +0 -1
- package/dist/StateContainerRegistry-8zNFMAf7.js +0 -1067
- package/dist/StateContainerRegistry-8zNFMAf7.js.map +0 -1
- package/dist/StateContainerRegistry-B1GYx9Xo.js +0 -975
- package/dist/StateContainerRegistry-B1GYx9Xo.js.map +0 -1
- package/dist/StateContainerRegistry-B_ViBLvJ.js +0 -975
- package/dist/StateContainerRegistry-B_ViBLvJ.js.map +0 -1
- package/dist/StateContainerRegistry-Bx2ly-ba.cjs +0 -1162
- package/dist/StateContainerRegistry-Bx2ly-ba.cjs.map +0 -1
- package/dist/StateContainerRegistry-C0dCNlTF.js +0 -1005
- package/dist/StateContainerRegistry-C0dCNlTF.js.map +0 -1
- package/dist/StateContainerRegistry-C75QpeaO.cjs +0 -1260
- package/dist/StateContainerRegistry-C75QpeaO.cjs.map +0 -1
- package/dist/StateContainerRegistry-CEWpc1bj.cjs +0 -1113
- package/dist/StateContainerRegistry-CEWpc1bj.cjs.map +0 -1
- package/dist/StateContainerRegistry-CS18y4au.cjs +0 -1163
- package/dist/StateContainerRegistry-CS18y4au.cjs.map +0 -1
- package/dist/StateContainerRegistry-CSNm2Ws5.cjs.map +0 -1
- package/dist/StateContainerRegistry-CchRjnjX.cjs +0 -1094
- package/dist/StateContainerRegistry-CchRjnjX.cjs.map +0 -1
- package/dist/StateContainerRegistry-CvBOhAT2.js.map +0 -1
- package/dist/StateContainerRegistry-D8nu7Z0T.js +0 -1068
- package/dist/StateContainerRegistry-D8nu7Z0T.js.map +0 -1
- package/dist/StateContainerRegistry-D9BIRjwv.cjs.map +0 -1
- package/dist/StateContainerRegistry-DJQqLrli.cjs +0 -1046
- package/dist/StateContainerRegistry-DJQqLrli.cjs.map +0 -1
- package/dist/StateContainerRegistry-DL5Ai7wh.js +0 -1153
- package/dist/StateContainerRegistry-DL5Ai7wh.js.map +0 -1
- package/dist/StateContainerRegistry-DVIBTxGZ.js.map +0 -1
- package/dist/StateContainerRegistry-DWOzx7Gd.js +0 -1154
- package/dist/StateContainerRegistry-DWOzx7Gd.js.map +0 -1
- package/dist/StateContainerRegistry-Dj77cok9.js.map +0 -1
- package/dist/StateContainerRegistry-FWKzPfS-.cjs +0 -1046
- package/dist/StateContainerRegistry-FWKzPfS-.cjs.map +0 -1
- package/dist/StateContainerRegistry-G81GcCRm.cjs +0 -1261
- package/dist/StateContainerRegistry-G81GcCRm.cjs.map +0 -1
- package/dist/StateContainerRegistry-lIwo-0m3.cjs.map +0 -1
- package/dist/acquire-B1LYXSGj.js.map +0 -1
- package/dist/acquire-B1Wuqla6.cjs.map +0 -1
- package/dist/acquire-BJ3xUEmh.cjs.map +0 -1
- package/dist/acquire-BP-ZfUH2.js +0 -35
- package/dist/acquire-BP-ZfUH2.js.map +0 -1
- package/dist/acquire-BRIJVJaA.js.map +0 -1
- package/dist/acquire-BZIs6tpN.cjs.map +0 -1
- package/dist/acquire-B_p1fNEh.cjs +0 -46
- package/dist/acquire-B_p1fNEh.cjs.map +0 -1
- package/dist/acquire-BdsVZBSe.js.map +0 -1
- package/dist/acquire-C3nOb3XR.cjs +0 -46
- package/dist/acquire-C3nOb3XR.cjs.map +0 -1
- package/dist/acquire-C4WAS13G.cjs +0 -46
- package/dist/acquire-C4WAS13G.cjs.map +0 -1
- package/dist/acquire-C7beGI55.cjs +0 -46
- package/dist/acquire-C7beGI55.cjs.map +0 -1
- package/dist/acquire-CE0uq0Dx.cjs +0 -46
- package/dist/acquire-CE0uq0Dx.cjs.map +0 -1
- package/dist/acquire-CU0u8BMn.js +0 -35
- package/dist/acquire-CU0u8BMn.js.map +0 -1
- package/dist/acquire-CbMz7gWs.cjs +0 -46
- package/dist/acquire-CbMz7gWs.cjs.map +0 -1
- package/dist/acquire-CkgLJ8WL.cjs +0 -46
- package/dist/acquire-CkgLJ8WL.cjs.map +0 -1
- package/dist/acquire-CwB083au.js +0 -35
- package/dist/acquire-CwB083au.js.map +0 -1
- package/dist/acquire-DHEOEVcj.cjs +0 -46
- package/dist/acquire-DHEOEVcj.cjs.map +0 -1
- package/dist/acquire-DTvfYJ0y.js +0 -35
- package/dist/acquire-DTvfYJ0y.js.map +0 -1
- package/dist/acquire-DXEQDZGr.js +0 -35
- package/dist/acquire-DXEQDZGr.js.map +0 -1
- package/dist/acquire-Dg-uXwjF.js +0 -35
- package/dist/acquire-Dg-uXwjF.js.map +0 -1
- package/dist/acquire-Don7499S.js +0 -35
- package/dist/acquire-Don7499S.js.map +0 -1
- package/dist/acquire-G8aB3GAx.js +0 -35
- package/dist/acquire-G8aB3GAx.js.map +0 -1
- package/dist/branded-BybA0_xw.cjs +0 -18
- package/dist/branded-BybA0_xw.cjs.map +0 -1
- package/dist/branded-DkbUzncc.js +0 -13
- package/dist/branded-DkbUzncc.js.map +0 -1
- package/dist/config-8pyOC5gv.js +0 -16
- package/dist/config-8pyOC5gv.js.map +0 -1
- package/dist/config-B1l8ZGlU.cjs +0 -32
- package/dist/config-B1l8ZGlU.cjs.map +0 -1
- package/dist/config-C1T6Jw7n.cjs +0 -32
- package/dist/config-C1T6Jw7n.cjs.map +0 -1
- package/dist/config-C7Ktkjh2.cjs +0 -32
- package/dist/config-C7Ktkjh2.cjs.map +0 -1
- package/dist/config-COT4Xkbc.js +0 -16
- package/dist/config-COT4Xkbc.js.map +0 -1
- package/dist/config-CzcoAvBo.js +0 -16
- package/dist/config-CzcoAvBo.js.map +0 -1
- package/dist/config-D2A8ZYRM.js +0 -16
- package/dist/config-D2A8ZYRM.js.map +0 -1
- package/dist/config-D34BkraU.cjs +0 -32
- package/dist/config-D34BkraU.cjs.map +0 -1
- package/dist/config-D6BoWWPv.js +0 -16
- package/dist/config-D6BoWWPv.js.map +0 -1
- package/dist/config-DOO82lbZ.js +0 -16
- package/dist/config-DOO82lbZ.js.map +0 -1
- package/dist/config-DVM_ESQt.js +0 -16
- package/dist/config-DVM_ESQt.js.map +0 -1
- package/dist/config-DVMnlHLv.cjs +0 -32
- package/dist/config-DVMnlHLv.cjs.map +0 -1
- package/dist/config-DWUq7zEQ.cjs +0 -32
- package/dist/config-DWUq7zEQ.cjs.map +0 -1
- package/dist/config-DXI3kzmA.js +0 -16
- package/dist/config-DXI3kzmA.js.map +0 -1
- package/dist/config-Dk1FxfXj.js +0 -16
- package/dist/config-Dk1FxfXj.js.map +0 -1
- package/dist/config-ZVy_yFZ3.js +0 -16
- package/dist/config-ZVy_yFZ3.js.map +0 -1
- package/dist/config-b2z51Y_C.cjs +0 -32
- package/dist/config-b2z51Y_C.cjs.map +0 -1
- package/dist/config-buwpT7l3.js +0 -16
- package/dist/config-buwpT7l3.js.map +0 -1
- package/dist/config-cwaTn5oy.cjs +0 -32
- package/dist/config-cwaTn5oy.cjs.map +0 -1
- package/dist/config-d9_U58ef.cjs +0 -32
- package/dist/config-d9_U58ef.cjs.map +0 -1
- package/dist/config-hWTayX76.cjs +0 -32
- package/dist/config-hWTayX76.cjs.map +0 -1
- package/dist/config-sCPKPYxZ.cjs +0 -32
- package/dist/config-sCPKPYxZ.cjs.map +0 -1
- package/dist/debug.cjs +0 -14
- package/dist/debug.d.cts +0 -34
- package/dist/debug.d.ts +0 -34
- package/dist/debug.js +0 -4
- package/dist/ensure-11-asM1e.js.map +0 -1
- package/dist/ensure-B1dEDsZV.cjs +0 -559
- package/dist/ensure-B1dEDsZV.cjs.map +0 -1
- package/dist/ensure-B2DYCbbI.cjs.map +0 -1
- package/dist/ensure-B59ri8oo.js.map +0 -1
- package/dist/ensure-B9oOqpOB.cjs +0 -558
- package/dist/ensure-B9oOqpOB.cjs.map +0 -1
- package/dist/ensure-BEeY5Ab7.js.map +0 -1
- package/dist/ensure-BKdq5xsY.cjs.map +0 -1
- package/dist/ensure-BSJHkUNX.js.map +0 -1
- package/dist/ensure-BfYnvAsI.js +0 -709
- package/dist/ensure-BfYnvAsI.js.map +0 -1
- package/dist/ensure-Bm91o37h.js +0 -536
- package/dist/ensure-Bm91o37h.js.map +0 -1
- package/dist/ensure-C1a8IFWy.js +0 -535
- package/dist/ensure-C1a8IFWy.js.map +0 -1
- package/dist/ensure-CLQEx0Nn.cjs +0 -528
- package/dist/ensure-CLQEx0Nn.cjs.map +0 -1
- package/dist/ensure-CPMiGvov.js +0 -493
- package/dist/ensure-CPMiGvov.js.map +0 -1
- package/dist/ensure-CQimeD0I.cjs +0 -559
- package/dist/ensure-CQimeD0I.cjs.map +0 -1
- package/dist/ensure-D3WWWwMo.cjs.map +0 -1
- package/dist/ensure-DEXSmA-N.js +0 -526
- package/dist/ensure-DEXSmA-N.js.map +0 -1
- package/dist/ensure-DTTTd2h8.js +0 -536
- package/dist/ensure-DTTTd2h8.js.map +0 -1
- package/dist/ensure-Dx86f80B.cjs +0 -567
- package/dist/ensure-Dx86f80B.cjs.map +0 -1
- package/dist/ensure-DzqGej43.js +0 -526
- package/dist/ensure-DzqGej43.js.map +0 -1
- package/dist/ensure-VuiNPccZ.cjs +0 -559
- package/dist/ensure-VuiNPccZ.cjs.map +0 -1
- package/dist/ensure-_Oh8XPm4.cjs +0 -732
- package/dist/ensure-_Oh8XPm4.cjs.map +0 -1
- package/dist/ensure-fsQMjaQL.cjs +0 -567
- package/dist/ensure-fsQMjaQL.cjs.map +0 -1
- package/dist/ensure-r1C_7K6_.cjs.map +0 -1
- package/dist/ensure-vxAGa2v3.js +0 -536
- package/dist/ensure-vxAGa2v3.js.map +0 -1
- package/dist/events.d.cts +0 -42
- package/dist/events.d.ts +0 -42
- package/dist/management-14vsHr4t.cjs +0 -85
- package/dist/management-14vsHr4t.cjs.map +0 -1
- package/dist/management-444tdCBG.js +0 -38
- package/dist/management-444tdCBG.js.map +0 -1
- package/dist/management-7jLjVHJd.js +0 -38
- package/dist/management-7jLjVHJd.js.map +0 -1
- package/dist/management-8x1OVMi6.js +0 -38
- package/dist/management-8x1OVMi6.js.map +0 -1
- package/dist/management-AFuqQEwz.js +0 -38
- package/dist/management-AFuqQEwz.js.map +0 -1
- package/dist/management-BZgsi29F.js +0 -38
- package/dist/management-BZgsi29F.js.map +0 -1
- package/dist/management-BodVLAfJ.cjs +0 -85
- package/dist/management-BodVLAfJ.cjs.map +0 -1
- package/dist/management-BqGBdL01.js +0 -38
- package/dist/management-BqGBdL01.js.map +0 -1
- package/dist/management-BvUAjril.js +0 -38
- package/dist/management-BvUAjril.js.map +0 -1
- package/dist/management-C-WGcwPD.js +0 -38
- package/dist/management-C-WGcwPD.js.map +0 -1
- package/dist/management-C2wv4vGS.cjs +0 -85
- package/dist/management-C2wv4vGS.cjs.map +0 -1
- package/dist/management-D2pjr38g.js +0 -38
- package/dist/management-D2pjr38g.js.map +0 -1
- package/dist/management-D5WsZoTV.js +0 -38
- package/dist/management-D5WsZoTV.js.map +0 -1
- package/dist/management-DAV9sN-k.cjs +0 -85
- package/dist/management-DAV9sN-k.cjs.map +0 -1
- package/dist/management-Df7Y2sF1.cjs +0 -85
- package/dist/management-Df7Y2sF1.cjs.map +0 -1
- package/dist/management-Dg2SxUb6.cjs +0 -85
- package/dist/management-Dg2SxUb6.cjs.map +0 -1
- package/dist/management-DwO0nBzL.cjs +0 -85
- package/dist/management-DwO0nBzL.cjs.map +0 -1
- package/dist/management-GcnNJjnm.cjs +0 -85
- package/dist/management-GcnNJjnm.cjs.map +0 -1
- package/dist/management-P_Vi_cvw.js +0 -38
- package/dist/management-P_Vi_cvw.js.map +0 -1
- package/dist/management-QWLpbXlW.cjs +0 -85
- package/dist/management-QWLpbXlW.cjs.map +0 -1
- package/dist/management-hkY13log.cjs +0 -85
- package/dist/management-hkY13log.cjs.map +0 -1
- package/dist/management-iE4x6IQY.cjs +0 -85
- package/dist/management-iE4x6IQY.cjs.map +0 -1
- package/dist/types.cjs +0 -3
- package/dist/types.d.cts +0 -8
- package/dist/types.d.ts +0 -8
- package/dist/types.js +0 -2
- package/dist/watch/observe.d.ts +0 -13
- package/dist/watch-B0pUfh-v.cjs +0 -119
- package/dist/watch-B0pUfh-v.cjs.map +0 -1
- package/dist/watch-B91opmva.cjs +0 -70
- package/dist/watch-B91opmva.cjs.map +0 -1
- package/dist/watch-BDiwCPmb.js +0 -108
- package/dist/watch-BDiwCPmb.js.map +0 -1
- package/dist/watch-BHfCtbn1.cjs +0 -119
- package/dist/watch-BHfCtbn1.cjs.map +0 -1
- package/dist/watch-BW7gYiDf.js +0 -108
- package/dist/watch-BW7gYiDf.js.map +0 -1
- package/dist/watch-BmC-Tyqg.js +0 -59
- package/dist/watch-BmC-Tyqg.js.map +0 -1
- package/dist/watch-Bx0y-Kcc.js +0 -108
- package/dist/watch-Bx0y-Kcc.js.map +0 -1
- package/dist/watch-CKWt788i.cjs +0 -70
- package/dist/watch-CKWt788i.cjs.map +0 -1
- package/dist/watch-CfrSSrRY.js +0 -59
- package/dist/watch-CfrSSrRY.js.map +0 -1
- package/dist/watch-Cnh3PtQA.cjs +0 -70
- package/dist/watch-Cnh3PtQA.cjs.map +0 -1
- package/dist/watch-D01MdwKy.js +0 -108
- package/dist/watch-D01MdwKy.js.map +0 -1
- package/dist/watch-D8hwbFU1.js +0 -59
- package/dist/watch-D8hwbFU1.js.map +0 -1
- package/dist/watch-DPVUwPUY.js +0 -59
- package/dist/watch-DPVUwPUY.js.map +0 -1
- package/dist/watch-DVmvZBMD.cjs +0 -70
- package/dist/watch-DVmvZBMD.cjs.map +0 -1
- package/dist/watch-DkDGmGAx.cjs +0 -119
- package/dist/watch-DkDGmGAx.cjs.map +0 -1
- package/dist/watch-DttHqefn.js +0 -108
- package/dist/watch-DttHqefn.js.map +0 -1
- package/dist/watch-DxdIZjpt.cjs +0 -119
- package/dist/watch-DxdIZjpt.cjs.map +0 -1
- package/dist/watch-DztcJuUy.cjs +0 -119
- package/dist/watch-DztcJuUy.cjs.map +0 -1
- package/dist/watch-IrR8G28N.js +0 -108
- package/dist/watch-IrR8G28N.js.map +0 -1
- package/dist/watch-aoNLQAXp.cjs +0 -119
- package/dist/watch-aoNLQAXp.cjs.map +0 -1
- package/dist/watch-entry.cjs +0 -4
- package/dist/watch-entry.d.cts +0 -24
- package/dist/watch-entry.d.ts +0 -24
- package/dist/watch-entry.js +0 -2
- package/dist/watch-hx0r92Zc.js +0 -108
- package/dist/watch-hx0r92Zc.js.map +0 -1
- package/dist/watch-lEco5Tbl.cjs +0 -119
- package/dist/watch-lEco5Tbl.cjs.map +0 -1
|
@@ -1,41 +1,37 @@
|
|
|
1
1
|
import type { HydrationStatus, StateContainer } from './StateContainer';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { InstanceReadonlyState, StateContainerConstructor } from '../types/utilities';
|
|
3
|
+
import { INSERT_INSTANCE } from './symbols';
|
|
4
4
|
/**
|
|
5
|
-
* Entry in the instance registry
|
|
6
|
-
* @
|
|
5
|
+
* Entry in the instance registry.
|
|
6
|
+
* @typeParam T - Instance type
|
|
7
|
+
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export interface InstanceEntry<T = any> {
|
|
9
|
-
/** The state container instance */
|
|
10
10
|
instance: T;
|
|
11
|
-
|
|
11
|
+
key: string;
|
|
12
|
+
/** refId to acquire count. */
|
|
12
13
|
refs: Map<string, number>;
|
|
13
|
-
/**
|
|
14
|
+
/** Args from creation, for the dev arg-mismatch warning. */
|
|
14
15
|
args?: unknown;
|
|
15
|
-
/** Memoized structuralKey(args) for the dev arg-mismatch warning. */
|
|
16
16
|
argsKey?: string;
|
|
17
|
-
/** `depend()`-owners
|
|
17
|
+
/** `depend()`-owners holding this instance. */
|
|
18
18
|
dependents?: Set<StateContainer<any, any, any>>;
|
|
19
|
-
|
|
20
|
-
* `$blac.id` this entry is indexed under in `_byId`, captured at index time.
|
|
21
|
-
* Removal always keys off THIS stored id (never a fresh `$blac.id` read),
|
|
22
|
-
* so an id that changes later (e.g. `INIT_CONFIG` running after insertion)
|
|
23
|
-
* can never orphan the index.
|
|
24
|
-
*/
|
|
25
|
-
id?: string;
|
|
19
|
+
sweepTimer?: ReturnType<typeof setTimeout>;
|
|
26
20
|
}
|
|
27
21
|
/**
|
|
28
22
|
* Lifecycle events emitted by the registry
|
|
23
|
+
* @public
|
|
29
24
|
*/
|
|
30
|
-
export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased' | 'depsChanged' | 'hydrationChanged';
|
|
25
|
+
export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased' | 'depsChanged' | 'hydrationChanged' | 'activated' | 'deactivated';
|
|
31
26
|
/**
|
|
32
27
|
* Listener function type for each lifecycle event
|
|
33
|
-
* @
|
|
28
|
+
* @typeParam E - The lifecycle event type
|
|
29
|
+
* @public
|
|
34
30
|
*/
|
|
35
|
-
export type LifecycleListener<E extends LifecycleEvent> = E extends 'created' ? (container: StateContainer<any, any, any>) => void : E extends 'stateChanged' ? (container: StateContainer<any, any, any>, previousState:
|
|
31
|
+
export type LifecycleListener<E extends LifecycleEvent> = E extends 'created' ? (container: StateContainer<any, any, any>) => void : E extends 'stateChanged' ? (container: StateContainer<any, any, any>, previousState: Readonly<Record<string, unknown>>, currentState: Readonly<Record<string, unknown>>) => void : E extends 'disposed' ? (container: StateContainer<any, any, any>) => void : E extends 'refAcquired' ? (container: StateContainer<any, any, any>, refId: string) => void : E extends 'refReleased' ? (container: StateContainer<any, any, any>, refId: string) => void : E extends 'depsChanged' ? (container: StateContainer<any, any, any>, previousDeps: Readonly<Record<string, unknown>>, currentDeps: Readonly<Record<string, unknown>>) => void : E extends 'hydrationChanged' ? (container: StateContainer<any, any, any>, status: HydrationStatus, previousStatus: HydrationStatus) => void : E extends 'activated' ? (container: StateContainer<any, any, any>, signal: AbortSignal) => void : E extends 'deactivated' ? (container: StateContainer<any, any, any>) => void : never;
|
|
36
32
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
33
|
+
* Owns StateContainer instances: creation, ref tracking, disposal and
|
|
34
|
+
* lifecycle events.
|
|
39
35
|
*
|
|
40
36
|
* @example
|
|
41
37
|
* ```ts
|
|
@@ -46,77 +42,47 @@ export type LifecycleListener<E extends LifecycleEvent> = E extends 'created' ?
|
|
|
46
42
|
* console.log('State changed:', prev, '->', next);
|
|
47
43
|
* });
|
|
48
44
|
* ```
|
|
45
|
+
*
|
|
46
|
+
* `stateChanged` fires once per emit (microtask-deferred, not coalesced).
|
|
47
|
+
* Plugins' `onStateChange` fires once per channel flush with coalesced
|
|
48
|
+
* `prev`/`next` and a `PathSet`.
|
|
49
49
|
*/
|
|
50
50
|
export declare class StateContainerRegistry {
|
|
51
51
|
private readonly instancesByConstructor;
|
|
52
|
+
private readonly types;
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
54
|
+
* `depend()`-owner to the (Type, key) entries it resolved, per key because
|
|
55
|
+
* one handle resolves a different key per `args`.
|
|
55
56
|
*/
|
|
56
|
-
private readonly
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
private readonly _dependentEdges;
|
|
58
|
+
private readonly _entryByInstance;
|
|
59
|
+
/**
|
|
60
|
+
* Only for `PluginContext.getRefIds`: ids can collide across same-named
|
|
61
|
+
* classes, so nothing else may rely on it.
|
|
62
|
+
*/
|
|
63
|
+
private readonly _entryById;
|
|
61
64
|
private readonly listeners;
|
|
62
|
-
private _stateChangedListenerCount;
|
|
63
65
|
get hasStateChangedListeners(): boolean;
|
|
64
66
|
private _pendingStateChanges;
|
|
65
67
|
private _autoRefIdCounter;
|
|
66
68
|
constructor();
|
|
67
|
-
/**
|
|
68
|
-
* Registry-internal reaction to any instance's `disposed` lifecycle event.
|
|
69
|
-
* Prunes its Map entry, if this registry was tracking it (i.e. it was
|
|
70
|
-
* `acquire()`/`ensure()`'d, not a bare `new`), and always releases its
|
|
71
|
-
* dependent edges on whatever it `depend()`'d on.
|
|
72
|
-
*/
|
|
69
|
+
/** Prune a tracked instance's entry and release its `depend()` edges. */
|
|
73
70
|
private _handleDisposed;
|
|
71
|
+
/** The single dispose decision: no refs, no dependents, not keepAlive. */
|
|
72
|
+
private _isUnowned;
|
|
73
|
+
/** Ignores keepAlive: a keepAlive instance still deactivates. */
|
|
74
|
+
private _hasNoOwners;
|
|
74
75
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* every entry for identity. Keeps an identity guard so a recreated entry
|
|
78
|
-
* under the same key (a fresh instance under a reused/derived key) is
|
|
79
|
-
* never deleted by a stale container's disposal.
|
|
80
|
-
* @returns true if an entry was found and removed
|
|
76
|
+
* Idempotent, so every acquire/release path calls it. The events fire after
|
|
77
|
+
* the instance's own `onActivate`/`onDeactivate`.
|
|
81
78
|
*/
|
|
79
|
+
private _syncActivation;
|
|
80
|
+
private _recordDependentEdge;
|
|
81
|
+
/** @returns true if this registry tracked `container`. */
|
|
82
82
|
private _pruneEntry;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* an `InstanceEntry` from the registry MUST route through this so the
|
|
86
|
-
* index can never leak a stale id -> entry mapping.
|
|
87
|
-
*/
|
|
88
|
-
private _forgetEntry;
|
|
89
|
-
/**
|
|
90
|
-
* O(1) entry lookup by `$blac.id`, used by `PluginContext.getRefIds`
|
|
91
|
-
* instead of a nested scan over every type x every instance.
|
|
92
|
-
*/
|
|
93
|
-
findEntryById(id: string): InstanceEntry | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Storage key `container` is CURRENTLY indexed under, or `undefined` if this
|
|
96
|
-
* registry never tracked it (bare `new`) or no longer does (disposed/pruned,
|
|
97
|
-
* or its key was taken over by a newer instance). Lets callers that hold only
|
|
98
|
-
* an instance address it without knowing the `args` it was acquired with.
|
|
99
|
-
*/
|
|
100
|
-
keyOf(instance: StateContainerInstance): string | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Drop `Type` from `types` once its instances map is empty, so constructors
|
|
103
|
-
* (and anything keyed on them, e.g. a per-class PathInterner) aren't held
|
|
104
|
-
* alive forever. Deliberate consequence: `getStats()`/`getTypes()` no
|
|
105
|
-
* longer list types with zero live instances.
|
|
106
|
-
*/
|
|
107
|
-
private _maybeDropType;
|
|
108
|
-
/**
|
|
109
|
-
* Drop `dependent`'s edge on the `Type`/`key` entry (a `depend()`-resolved
|
|
110
|
-
* instance). When that leaves the entry with no dependents AND no public
|
|
111
|
-
* refs AND it isn't keepAlive, dispose it — this recurses into the same
|
|
112
|
-
* `disposed` listener, so dep-of-dep chains unwind naturally.
|
|
113
|
-
*/
|
|
83
|
+
private _indexEntry;
|
|
84
|
+
/** Disposing here recurses through `disposed`, unwinding dep chains. */
|
|
114
85
|
private _releaseDependent;
|
|
115
|
-
/**
|
|
116
|
-
* Register a type for lifecycle event tracking
|
|
117
|
-
* @param constructor - The StateContainer class constructor
|
|
118
|
-
*/
|
|
119
|
-
registerType<T extends StateContainerConstructor>(constructor: T): void;
|
|
120
86
|
/**
|
|
121
87
|
* Register a StateContainer class with configuration
|
|
122
88
|
* @param constructor - The StateContainer class constructor
|
|
@@ -127,61 +93,37 @@ export declare class StateContainerRegistry {
|
|
|
127
93
|
/**
|
|
128
94
|
* Get the instances Map for a specific class (public API for stats/debugging)
|
|
129
95
|
*/
|
|
130
|
-
getInstancesMap<T extends StateContainerConstructor>(Type: T):
|
|
96
|
+
getInstancesMap<T extends StateContainerConstructor>(Type: T): ReadonlyMap<string, InstanceEntry>;
|
|
131
97
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* it does not exist yet. Replaces any existing entry for the same key.
|
|
135
|
-
*
|
|
136
|
-
* The provided instance is NOT configured or disposed here — callers are
|
|
137
|
-
* responsible for any initConfig / dispose calls. Intended for testing
|
|
138
|
-
* helpers that create stubs outside the normal acquisition path.
|
|
98
|
+
* Insert an entry, replacing the one at `instanceKey`. The instance is not
|
|
99
|
+
* configured here.
|
|
139
100
|
*
|
|
140
101
|
* @internal Used by testing helpers only.
|
|
141
102
|
*/
|
|
142
|
-
|
|
103
|
+
[INSERT_INSTANCE]<T extends StateContainerConstructor>(Type: T, instanceKey: string, instance: InstanceType<T>, refs?: Map<string, number>): void;
|
|
143
104
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* an args-derived key is never dropped (instance leaks).
|
|
147
|
-
*
|
|
148
|
-
* Resolution order (explicit beats derived):
|
|
149
|
-
* explicit key > `static key(args)` > structural hash of args > default sentinel.
|
|
105
|
+
* The single source of keying, so `acquire` and `release` agree: explicit
|
|
106
|
+
* key \> `static key(args)` \> structural hash of args \> default key.
|
|
150
107
|
*
|
|
151
108
|
* @param Type - The StateContainer class constructor
|
|
152
109
|
* @param instanceKey - Explicit key, or undefined to derive from args
|
|
153
110
|
* @param args - Construction args used for structural/`static key` derivation
|
|
154
111
|
*/
|
|
155
112
|
resolveKey<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey: string | undefined, args: unknown): string;
|
|
156
|
-
/**
|
|
157
|
-
* Circuit breaker for runaway instance creation. Throws when a single
|
|
158
|
-
* constructor would exceed `maxInstancesPerType` live instances — almost
|
|
159
|
-
* always an unstable instance key (e.g. a new object/array passed as `args`
|
|
160
|
-
* every render, or a missing `static key`) leaking an instance per render.
|
|
161
|
-
*/
|
|
162
113
|
private assertInstanceLimit;
|
|
163
|
-
/**
|
|
164
|
-
* Circuit breaker for runaway reference growth. Throws when one instance
|
|
165
|
-
* accumulates more than `maxRefsPerInstance` distinct live refs — almost
|
|
166
|
-
* always consumer cleanup (e.g. `useBloc`'s unmount `release`) never firing.
|
|
167
|
-
*/
|
|
168
114
|
private assertRefLimit;
|
|
169
115
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* You must call `release()` with the same refId when done.
|
|
116
|
+
* Get or create an instance and add a ref; `release()` it with the same
|
|
117
|
+
* refId.
|
|
173
118
|
*
|
|
174
119
|
* @internal Internal key tier. Public callers use the args-based `acquire`
|
|
175
120
|
* wrapper; `useBloc` and `watch` address a pre-resolved key here.
|
|
176
121
|
* @param Type - The StateContainer class constructor
|
|
177
122
|
* @param instanceKey - Pre-resolved instance key (defaults to 'default')
|
|
178
|
-
* @param options -
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* @param options.dependent - The `depend()`-owner resolving this instance, if any;
|
|
183
|
-
* recorded so its dependent edge can be released on the owner's disposal.
|
|
184
|
-
* @returns The state container instance
|
|
123
|
+
* @param options - `canCreate` and `countRef` default to true; `refId` is
|
|
124
|
+
* auto-generated when omitted; `dependent` is the `depend()`-owner, whose
|
|
125
|
+
* edge is released on its disposal; `sweepIfUnowned` is for speculative
|
|
126
|
+
* creates (see `_scheduleSweep`).
|
|
185
127
|
*/
|
|
186
128
|
acquire<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string, options?: {
|
|
187
129
|
canCreate?: boolean;
|
|
@@ -189,10 +131,17 @@ export declare class StateContainerRegistry {
|
|
|
189
131
|
refId?: string;
|
|
190
132
|
args?: unknown;
|
|
191
133
|
dependent?: StateContainer<any, any, any>;
|
|
134
|
+
sweepIfUnowned?: boolean;
|
|
192
135
|
}): InstanceType<T>;
|
|
193
136
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
137
|
+
* Dispose a speculative create (a render that never commits, SSR) that is
|
|
138
|
+
* still unowned after `unownedSweepDelayMs`. The delay must outlast a
|
|
139
|
+
* time-sliced render; a repeat speculative acquire restarts it. Opt-in, so a
|
|
140
|
+
* bare `ensure()` stays usable across an `await`.
|
|
141
|
+
*/
|
|
142
|
+
private _scheduleSweep;
|
|
143
|
+
/**
|
|
144
|
+
* Get an existing instance without adding a ref.
|
|
196
145
|
*
|
|
197
146
|
* @internal Internal key tier; public callers use the args-based `borrow`.
|
|
198
147
|
* @param Type - The StateContainer class constructor
|
|
@@ -202,8 +151,7 @@ export declare class StateContainerRegistry {
|
|
|
202
151
|
*/
|
|
203
152
|
borrow<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string): InstanceType<T>;
|
|
204
153
|
/**
|
|
205
|
-
*
|
|
206
|
-
* Returns discriminated union for type-safe conditional access.
|
|
154
|
+
* Like `borrow`, but returns the error instead of throwing.
|
|
207
155
|
*
|
|
208
156
|
* @internal Internal key tier; public callers use the args-based `borrowSafe`.
|
|
209
157
|
* @param Type - The StateContainer class constructor
|
|
@@ -218,12 +166,7 @@ export declare class StateContainerRegistry {
|
|
|
218
166
|
instance: InstanceType<T>;
|
|
219
167
|
};
|
|
220
168
|
/**
|
|
221
|
-
*
|
|
222
|
-
* Gets existing instance OR creates it if it doesn't exist, without adding a ref.
|
|
223
|
-
* Tracks cross-bloc dependency for reactive updates.
|
|
224
|
-
*
|
|
225
|
-
* Use this in bloc-to-bloc communication when you need to ensure an instance exists
|
|
226
|
-
* but don't want to claim ownership (no ref added).
|
|
169
|
+
* Get or create an instance without adding a ref.
|
|
227
170
|
*
|
|
228
171
|
* @internal Internal key tier; public callers use the args-based `ensure`.
|
|
229
172
|
* @param Type - The StateContainer class constructor
|
|
@@ -234,9 +177,8 @@ export declare class StateContainerRegistry {
|
|
|
234
177
|
*/
|
|
235
178
|
ensure<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string, args?: unknown): InstanceType<T>;
|
|
236
179
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* Releasing an already-removed refId is a no-op (idempotent).
|
|
180
|
+
* Remove a ref and dispose the instance once nothing owns it. Releasing a
|
|
181
|
+
* ref that isn't held is a no-op.
|
|
240
182
|
*
|
|
241
183
|
* @internal Internal key tier; public callers use the args-based `release`.
|
|
242
184
|
* @param Type - The StateContainer class constructor
|
|
@@ -245,23 +187,11 @@ export declare class StateContainerRegistry {
|
|
|
245
187
|
* @param refId - The specific ref to remove; removes one arbitrary ref if omitted
|
|
246
188
|
*/
|
|
247
189
|
release<T extends StateContainerConstructor>(Type: T, instanceKey?: string, forceDispose?: boolean, refId?: string): void;
|
|
248
|
-
/**
|
|
249
|
-
* Get all instances of a specific type.
|
|
250
|
-
* @param Type - The StateContainer class constructor
|
|
251
|
-
* @returns Array of all instances
|
|
252
|
-
*/
|
|
190
|
+
/** Live instances of `Type`. */
|
|
253
191
|
getAll<T extends StateContainerConstructor>(Type: T): InstanceReadonlyState<T>[];
|
|
254
|
-
/**
|
|
255
|
-
* Safely iterate over all instances of a type.
|
|
256
|
-
* Skips disposed instances and catches callback errors.
|
|
257
|
-
* @param Type - The StateContainer class constructor
|
|
258
|
-
* @param callback - Function to call for each instance
|
|
259
|
-
*/
|
|
192
|
+
/** Iterate live instances of `Type`; callback errors are logged. */
|
|
260
193
|
forEach<T extends StateContainerConstructor>(Type: T, callback: (instance: InstanceReadonlyState<T>) => void): void;
|
|
261
|
-
/**
|
|
262
|
-
* Clear all instances of a specific type (disposes them).
|
|
263
|
-
* @param Type - The StateContainer class constructor
|
|
264
|
-
*/
|
|
194
|
+
/** Dispose all instances of `Type`. */
|
|
265
195
|
clear<T extends StateContainerConstructor>(Type: T): void;
|
|
266
196
|
/**
|
|
267
197
|
* Get reference count for an instance (number of active refs).
|
|
@@ -281,40 +211,29 @@ export declare class StateContainerRegistry {
|
|
|
281
211
|
* @returns Array of ref ID strings (empty if instance doesn't exist)
|
|
282
212
|
*/
|
|
283
213
|
getRefIds<T extends StateContainerConstructor>(Type: T, instanceKey?: string): string[];
|
|
214
|
+
/** Ref ids by `$blac.id`, for `PluginContext.getRefIds`. */
|
|
215
|
+
getRefIdsById(instanceId: string): string[];
|
|
284
216
|
/**
|
|
285
217
|
* Check if an instance exists.
|
|
286
218
|
*
|
|
287
219
|
* @internal Internal key tier; public callers use the args-based `hasInstance`.
|
|
288
220
|
* @param Type - The StateContainer class constructor
|
|
289
221
|
* @param instanceKey - Pre-resolved instance key (defaults to 'default')
|
|
290
|
-
* @returns true if instance exists
|
|
222
|
+
* @returns true if a live (not disposed) instance exists
|
|
291
223
|
*/
|
|
292
224
|
hasInstance<T extends StateContainerConstructor>(Type: T, instanceKey?: string): boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Clear all instances from all types (for testing)
|
|
295
|
-
*
|
|
296
|
-
* Iterates all registered types and clears their instances.
|
|
297
|
-
* Also clears type tracking to reset the registry state.
|
|
298
|
-
*/
|
|
225
|
+
/** Dispose every instance and forget all types (for testing). */
|
|
299
226
|
clearAll(): void;
|
|
300
|
-
/**
|
|
301
|
-
* Get registry statistics for debugging.
|
|
302
|
-
* @returns Object with registeredTypes, totalInstances, and typeBreakdown
|
|
303
|
-
*/
|
|
227
|
+
/** Instance counts, for debugging. */
|
|
304
228
|
getStats(): {
|
|
305
229
|
registeredTypes: number;
|
|
306
230
|
totalInstances: number;
|
|
307
231
|
typeBreakdown: Record<string, number>;
|
|
308
232
|
};
|
|
309
|
-
/**
|
|
310
|
-
* Get all registered types (for plugin system).
|
|
311
|
-
* @returns Array of all registered StateContainer class constructors
|
|
312
|
-
*/
|
|
233
|
+
/** All registered types (for plugins). */
|
|
313
234
|
getTypes(): StateContainerConstructor[];
|
|
314
235
|
/**
|
|
315
|
-
* Subscribe to lifecycle
|
|
316
|
-
* @param event - The lifecycle event to listen for
|
|
317
|
-
* @param listener - The listener function to call when the event occurs
|
|
236
|
+
* Subscribe to a lifecycle event.
|
|
318
237
|
* @returns Unsubscribe function
|
|
319
238
|
*/
|
|
320
239
|
on<E extends LifecycleEvent>(event: E, listener: LifecycleListener<E>): () => void;
|
|
@@ -329,19 +248,21 @@ export declare class StateContainerRegistry {
|
|
|
329
248
|
emit(event: 'refReleased', container: StateContainer<any, any, any>, refId: string): void;
|
|
330
249
|
emit(event: 'depsChanged', container: StateContainer<any, any, any>, previousDeps: Readonly<Record<string, unknown>>, currentDeps: Readonly<Record<string, unknown>>): void;
|
|
331
250
|
emit(event: 'hydrationChanged', container: StateContainer<any, any, any>, status: HydrationStatus, previousStatus: HydrationStatus): void;
|
|
251
|
+
emit(event: 'activated', container: StateContainer<any, any, any>, signal: AbortSignal): void;
|
|
252
|
+
emit(event: 'deactivated', container: StateContainer<any, any, any>): void;
|
|
332
253
|
/**
|
|
333
|
-
*
|
|
334
|
-
* Skips entirely when no stateChanged listeners are registered.
|
|
254
|
+
* Queue a microtask-deferred `stateChanged`.
|
|
335
255
|
* @internal - Called by StateContainer.applyState
|
|
336
256
|
*/
|
|
337
257
|
notifyStateChanged(container: StateContainer<any, any, any>, previousState: any, newState: any): void;
|
|
258
|
+
/**
|
|
259
|
+
* One event per emit, deliberately not coalesced: devtools and time-travel
|
|
260
|
+
* need every intermediate transition. Plugins get the coalesced lane.
|
|
261
|
+
*/
|
|
338
262
|
private flushStateChanged;
|
|
339
263
|
}
|
|
340
264
|
/**
|
|
341
|
-
*
|
|
265
|
+
* The global default registry.
|
|
266
|
+
* @public
|
|
342
267
|
*/
|
|
343
268
|
export declare const globalRegistry: StateContainerRegistry;
|
|
344
|
-
/**
|
|
345
|
-
* Get the global plugin manager
|
|
346
|
-
*/
|
|
347
|
-
export declare function getPluginManager(): PluginManager;
|
package/dist/core/meta.d.ts
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `$blac` meta namespace for `StateContainer`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
* through a proxy receiver throws (`#x` brand checks fail on the proxy). The
|
|
10
|
-
* whole point of this meta object is to be proxy-safe: every getter/method
|
|
11
|
-
* here closes over the *real* container instance captured at `createMeta`
|
|
12
|
-
* time, NEVER over a `this`-receiver. Do not "modernize" the `_`-prefixed
|
|
13
|
-
* TS-private reads below into `#private` access.
|
|
14
|
-
* ──────────────────────────────────────────────────────────────────────────
|
|
4
|
+
* `BlacMeta` and `BlacHydration` are classes whose accessors live on the
|
|
5
|
+
* prototype and read the container through one `#private` back-reference, so
|
|
6
|
+
* a container allocates a single small object here instead of a literal with
|
|
7
|
+
* seven closures. Members are therefore not own-enumerable: `Object.keys` and
|
|
8
|
+
* `JSON.stringify` see an empty object. Read the fields by name.
|
|
15
9
|
*/
|
|
16
10
|
import type { HydrationStatus } from './StateContainer';
|
|
17
11
|
import type { StateContainerConstructor } from '../types/utilities';
|
|
12
|
+
/**
|
|
13
|
+
* Non-enumerable brand carried on every `$blac` object. Used by the clobber
|
|
14
|
+
* guard in `StateContainer` to detect a subclass class-field shadowing the
|
|
15
|
+
* base's own `$blac` property, and by the meta tests. Intentionally NOT
|
|
16
|
+
* re-exported from the package barrel.
|
|
17
|
+
*/
|
|
18
|
+
export declare const META_BRAND: unique symbol;
|
|
18
19
|
/**
|
|
19
20
|
* Hydration sub-surface of {@link BlacMeta}. Exposes the container's
|
|
20
21
|
* hydration state machine — the `begin`/`apply`/`finish`/`fail`/`wait`
|
|
21
22
|
* methods and the `status`/`error`/`isHydrated`/`changedWhileHydrating`
|
|
22
23
|
* getters — namespaced under `$blac`.
|
|
23
24
|
*/
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
export declare class BlacHydration<S extends object> {
|
|
26
|
+
#private;
|
|
27
|
+
/** @internal */
|
|
28
|
+
constructor(container: object);
|
|
29
|
+
get status(): HydrationStatus;
|
|
30
|
+
get error(): Error | undefined;
|
|
31
|
+
get isHydrated(): boolean;
|
|
32
|
+
get changedWhileHydrating(): boolean;
|
|
29
33
|
begin(): void;
|
|
30
34
|
apply(next: S): boolean;
|
|
31
35
|
finish(): void;
|
|
@@ -38,36 +42,19 @@ export interface BlacHydration<S extends object> {
|
|
|
38
42
|
* `createdAt`, `disposed`, `dependencies`, and the hydration methods) under one
|
|
39
43
|
* namespace, keeping the generic names free for userland blocs.
|
|
40
44
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* are never snapshotted.
|
|
45
|
+
* Allocated once per container and frozen. Every accessor reads the
|
|
46
|
+
* container's current `_`-private fields live — values are never snapshotted.
|
|
44
47
|
*/
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
export declare class BlacMeta<S extends object = any> {
|
|
49
|
+
#private;
|
|
50
|
+
/** @internal Called from the `StateContainer` field initializer. */
|
|
51
|
+
constructor(container: object);
|
|
52
|
+
get name(): string;
|
|
53
|
+
get id(): string;
|
|
54
|
+
get debug(): boolean;
|
|
55
|
+
get createdAt(): number;
|
|
56
|
+
get disposed(): boolean;
|
|
57
|
+
get dependencies(): ReadonlyMap<StateContainerConstructor, string>;
|
|
58
|
+
/** Built on first access; identity-stable afterwards. */
|
|
59
|
+
get hydration(): BlacHydration<S>;
|
|
53
60
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Non-enumerable brand carried on every `$blac` object produced by
|
|
56
|
-
* {@link createMeta}. Used by the clobber guard in `StateContainer` to detect
|
|
57
|
-
* a subclass class-field shadowing the base's own `$blac` property, and by the
|
|
58
|
-
* meta tests. Intentionally NOT re-exported from the package barrel.
|
|
59
|
-
*/
|
|
60
|
-
export declare const META_BRAND: unique symbol;
|
|
61
|
-
/**
|
|
62
|
-
* Build the frozen, branded `$blac` meta object for a container.
|
|
63
|
-
*
|
|
64
|
-
* Called from a `StateContainer` field initializer (`$blac = createMeta(this)`).
|
|
65
|
-
* Only the back-reference is captured at this point; every getter/method reads
|
|
66
|
-
* the container's `_`-private fields lazily on access, so field-initializer
|
|
67
|
-
* ordering relative to those private fields is irrelevant.
|
|
68
|
-
*
|
|
69
|
-
* The getters close over `container` (the real instance), never over a
|
|
70
|
-
* `this`-receiver — this is what keeps `$blac` reads safe through
|
|
71
|
-
* `buildTrackedProxy`.
|
|
72
|
-
*/
|
|
73
|
-
export declare function createMeta<S extends object>(container: object): BlacMeta<S>;
|
package/dist/core/symbols.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal Apply one owner's (consumer's) deps slice to an instance.
|
|
3
|
-
* Called by framework adapters (e.g.
|
|
3
|
+
* Called by framework adapters (e.g. `@blac/react` useBloc) — not public API.
|
|
4
4
|
*/
|
|
5
5
|
export declare const APPLY_DEPS: unique symbol;
|
|
6
6
|
/**
|
|
@@ -24,3 +24,23 @@ export declare const ON_DISPOSE: unique symbol;
|
|
|
24
24
|
* helpers are the sole callers, mirroring the `APPLY_DEPS` precedent.
|
|
25
25
|
*/
|
|
26
26
|
export declare const INIT_CONFIG: unique symbol;
|
|
27
|
+
/**
|
|
28
|
+
* @internal Run `fn` with `state` temporarily reporting a render's tracking
|
|
29
|
+
* proxy, so getters record the paths they read. Called by `@blac/react`'s
|
|
30
|
+
* `buildTrackedProxy` — not public API. Getters run with `this` bound to the
|
|
31
|
+
* real instance, so ES `#private` works in user blocs.
|
|
32
|
+
*/
|
|
33
|
+
export declare const WITH_TRACKED_STATE: unique symbol;
|
|
34
|
+
/**
|
|
35
|
+
* @internal Drive the activation lifecycle from the registry's 0↔1 ownership
|
|
36
|
+
* transition. Owns the per-instance AbortController so `onActivate`'s signal
|
|
37
|
+
* aborts on the matching deactivation and on dispose.
|
|
38
|
+
*
|
|
39
|
+
* Framework-only — `StateContainerRegistry` is the sole caller.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SET_ACTIVE: unique symbol;
|
|
42
|
+
/**
|
|
43
|
+
* @internal Insert an instance entry directly, bypassing acquire/release.
|
|
44
|
+
* Called by the testing helpers — not public API.
|
|
45
|
+
*/
|
|
46
|
+
export declare const INSERT_INSTANCE: unique symbol;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import type { EqualityFn } from '../config';
|
|
2
2
|
/**
|
|
3
|
-
* Configuration options for the
|
|
4
|
-
*
|
|
3
|
+
* Configuration options for the `@blac` decorator. Any combination may be
|
|
4
|
+
* given at once.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
excludeFromDevTools
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
export interface BlacOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Keep the bloc alive when its ref count reaches 0. `false` turns off a
|
|
9
|
+
* `keepAlive` inherited from a base class.
|
|
10
|
+
*/
|
|
11
|
+
keepAlive?: boolean;
|
|
12
|
+
/** Exclude bloc from DevTools tracking (prevents infinite loops) */
|
|
13
|
+
excludeFromDevTools?: true;
|
|
14
|
+
/**
|
|
15
|
+
* Override the global equality check for this bloc.
|
|
16
|
+
* Return `true` to skip the emit (states considered equal).
|
|
17
|
+
*/
|
|
18
|
+
equality?: EqualityFn;
|
|
19
|
+
/**
|
|
20
|
+
* Override the default structural-hash identity key.
|
|
21
|
+
* The function receives `args` and returns the instance key string.
|
|
22
|
+
* Distinct return values → distinct instances; identical values → shared instance.
|
|
23
|
+
* Non-identity fields can be excluded so they don't fork new instances.
|
|
24
|
+
*/
|
|
25
|
+
key?: (args: any) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Explicit, minification-safe identity for this bloc class. Falls back to
|
|
28
|
+
* `constructor.name` when unset, which collides across classes once a
|
|
29
|
+
* minifier shortens class names.
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
23
32
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Override the default structural-hash identity key.
|
|
26
|
-
* The function receives `args` and returns the instance key string.
|
|
27
|
-
* Distinct return values → distinct instances; identical values → shared instance.
|
|
28
|
-
* Non-identity fields can be excluded so they don't fork new instances.
|
|
29
|
-
*/
|
|
30
|
-
| {
|
|
31
|
-
key: (args: any) => string;
|
|
32
|
-
};
|
|
33
33
|
/**
|
|
34
34
|
* Decorator to configure StateContainer classes.
|
|
35
35
|
*
|
|
@@ -40,6 +40,9 @@ export type BlacOptions =
|
|
|
40
40
|
*
|
|
41
41
|
* @blac({ excludeFromDevTools: true })
|
|
42
42
|
* class InternalBloc extends Cubit<InternalState> {}
|
|
43
|
+
*
|
|
44
|
+
* @blac({ keepAlive: true, key: (args) => args.userId })
|
|
45
|
+
* class UserBloc extends Cubit<UserState> {}
|
|
43
46
|
* ```
|
|
44
47
|
*
|
|
45
48
|
* @example Function syntax (no decorator support needed)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as getRegistry } from "./StateContainer-Bh2ipNYj.js";
|
|
2
2
|
//#region src/registry/acquire.ts
|
|
3
3
|
/**
|
|
4
4
|
* Acquire an instance with ref tracking (ownership semantics). Instance
|
|
@@ -6,8 +6,8 @@ import { t as getRegistry } from "./config-DXI3kzmA.js";
|
|
|
6
6
|
* a structural hash of `args`, or the default sentinel when there are none).
|
|
7
7
|
*
|
|
8
8
|
* @param BlocClass - The StateContainer class constructor
|
|
9
|
-
* @param opts
|
|
10
|
-
*
|
|
9
|
+
* @param opts - `args` derives the instance key; `refId` names the reference
|
|
10
|
+
* for debugging and is auto-generated when omitted.
|
|
11
11
|
*/
|
|
12
12
|
function acquire(BlocClass, opts) {
|
|
13
13
|
const registry = getRegistry();
|
|
@@ -30,6 +30,17 @@ function resolveInstanceKey(BlocClass, args) {
|
|
|
30
30
|
return getRegistry().resolveKey(BlocClass, void 0, args);
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
|
-
|
|
33
|
+
//#region src/registry/ensure.ts
|
|
34
|
+
/**
|
|
35
|
+
* Ensure an instance exists without taking ownership (no ref added). Instance
|
|
36
|
+
* identity is derived purely from `args`, matching `acquire`.
|
|
37
|
+
*/
|
|
38
|
+
function ensure(BlocClass, opts) {
|
|
39
|
+
const registry = getRegistry();
|
|
40
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
41
|
+
return registry.ensure(BlocClass, key, opts?.args);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { acquire as n, resolveInstanceKey as r, ensure as t };
|
|
34
45
|
|
|
35
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=ensure-Bi_yXk6f.js.map
|