@blac/core 2.1.0 → 2.1.2
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-CwByTd5L.js +656 -0
- package/dist/StateContainer-CwByTd5L.js.map +1 -0
- package/dist/StateContainer-D2b10eR4.cjs +691 -0
- package/dist/StateContainer-D2b10eR4.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-B6O6cfJd.cjs +903 -0
- package/dist/StateContainerRegistry-B6O6cfJd.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-CrTtRX5V.js +772 -0
- package/dist/StateContainerRegistry-CrTtRX5V.js.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 +20 -28
- package/dist/constants.d.ts +20 -28
- package/dist/core/Cubit.d.ts +14 -10
- package/dist/core/StateContainer.d.ts +89 -62
- package/dist/core/StateContainerRegistry.d.ts +89 -166
- package/dist/core/meta.d.ts +37 -47
- package/dist/core/onActivated.d.ts +10 -0
- package/dist/core/symbols.d.ts +26 -1
- package/dist/decorators/blac.d.ts +38 -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/{acquire-BdsVZBSe.js → ensure-CwtQVTam.js} +16 -5
- package/dist/ensure-CwtQVTam.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-B_p1fNEh.cjs → ensure-DShrbIYY.cjs} +23 -6
- package/dist/ensure-DShrbIYY.cjs.map +1 -0
- package/dist/{acquire-BP-ZfUH2.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 +257 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -13
- package/dist/index.d.ts +6 -13
- package/dist/index.js +232 -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 +25 -25
- package/dist/plugin/PluginManager.d.ts +46 -59
- 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 +2 -2
- package/dist/registry/management.d.ts +5 -0
- package/dist/registry/queries.d.ts +15 -0
- package/dist/registry/release.d.ts +4 -20
- package/dist/testing.cjs +63 -38
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +14 -12
- package/dist/testing.d.ts +14 -12
- package/dist/testing.js +53 -29
- 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 +28 -29
- package/dist/utils/structural-key.d.ts +0 -22
- package/dist/watch/index.d.ts +1 -2
- package/dist/watch/watch.d.ts +23 -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.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.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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-Bi_yXk6f.js","names":[],"sources":["../src/registry/acquire.ts","../src/registry/ensure.ts"],"sourcesContent":["import { getRegistry } from './config';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n} from '../types/utilities';\n\n/**\n * Acquire an instance with ref tracking (ownership semantics). Instance\n * identity is derived purely from `args` (via the class's `static key(args)`,\n * a structural hash of `args`, or the default sentinel when there are none).\n *\n * @param BlocClass - The StateContainer class constructor\n * @param opts - `args` derives the instance key; `refId` names the reference\n * for debugging and is auto-generated when omitted.\n */\nexport function acquire<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T>; refId?: string },\n): InstanceType<T> {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.acquire(BlocClass, key, {\n canCreate: true,\n countRef: true,\n refId: opts?.refId,\n args: opts?.args,\n });\n}\n\n/**\n * Resolve the storage key an instance would be acquired under, given its\n * construction `args`. This is the canonical key-computation path. Callers that\n * both acquire and release against the `@internal` registry tier (e.g.\n * `@blac/react` `useBloc`) must use this once and pass the same resolved key to\n * both, so the ref is dropped under the key it was taken.\n */\nexport function resolveInstanceKey<T extends StateContainerConstructor>(\n BlocClass: T,\n args?: ExtractArgs<T>,\n): string {\n return getRegistry().resolveKey(BlocClass, undefined, args);\n}\n","import { getRegistry } from './config';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n} from '../types/utilities';\n\n/**\n * Ensure an instance exists without taking ownership (no ref added). Instance\n * identity is derived purely from `args`, matching `acquire`.\n */\nexport function ensure<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): InstanceType<T> {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.ensure(BlocClass, key, opts?.args);\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,QACd,WACA,MACiB;CACjB,MAAM,WAAW,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,QAAQ,WAAW,KAAK;EACtC,WAAW;EACX,UAAU;EACV,OAAO,MAAM;EACb,MAAM,MAAM;CACd,CAAC;AACH;;;;;;;;AASA,SAAgB,mBACd,WACA,MACQ;CACR,OAAO,YAAY,EAAE,WAAW,WAAW,KAAA,GAAW,IAAI;AAC5D;;;;;;;AC/BA,SAAgB,OACd,WACA,MACiB;CACjB,MAAM,WAAW,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,OAAO,WAAW,KAAK,MAAM,IAAI;AACnD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_StateContainerRegistry = require("./StateContainerRegistry-
|
|
2
|
-
const require_config = require("./config-C1T6Jw7n.cjs");
|
|
1
|
+
const require_StateContainerRegistry = require("./StateContainerRegistry-141uHhtF.cjs");
|
|
3
2
|
let _dirtytalk_structural = require("@dirtytalk/structural");
|
|
4
3
|
//#region src/utils/idGenerator.ts
|
|
5
4
|
/**
|
|
@@ -27,83 +26,38 @@ function generateSimpleId(prefix, affix) {
|
|
|
27
26
|
return `${prefix}:${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
28
27
|
}
|
|
29
28
|
//#endregion
|
|
30
|
-
//#region src/
|
|
29
|
+
//#region src/registry/config.ts
|
|
30
|
+
let _registry = require_StateContainerRegistry.globalRegistry;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* `StateContainerRegistry`. This gives registry-swap isolation (a test's
|
|
34
|
-
* `withTestRegistry`/`blacTestSetup` scope gets an independent subscriber
|
|
35
|
-
* set) for free, through machinery that already exists, with zero new
|
|
36
|
-
* public surface on `StateContainerRegistry`.
|
|
32
|
+
* @public
|
|
37
33
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return { name };
|
|
34
|
+
function getRegistry() {
|
|
35
|
+
return _registry;
|
|
41
36
|
}
|
|
42
37
|
/**
|
|
43
|
-
* @
|
|
44
|
-
* so a container always listens on the bus of the registry it belongs to,
|
|
45
|
-
* not the ambient one. Not part of the public API.
|
|
38
|
+
* @public
|
|
46
39
|
*/
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
if (!bus) {
|
|
50
|
-
bus = /* @__PURE__ */ new Map();
|
|
51
|
-
busByRegistry.set(registry, bus);
|
|
52
|
-
}
|
|
53
|
-
let handlers = bus.get(token);
|
|
54
|
-
if (!handlers) {
|
|
55
|
-
handlers = /* @__PURE__ */ new Set();
|
|
56
|
-
bus.set(token, handlers);
|
|
57
|
-
}
|
|
58
|
-
handlers.add(handler);
|
|
59
|
-
const tokenMap = bus;
|
|
60
|
-
const handlerSet = handlers;
|
|
61
|
-
let removed = false;
|
|
62
|
-
return () => {
|
|
63
|
-
if (removed) return;
|
|
64
|
-
removed = true;
|
|
65
|
-
handlerSet.delete(handler);
|
|
66
|
-
if (handlerSet.size === 0) tokenMap.delete(token);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/** Subscribe on the ambient registry (`getRegistry()`). */
|
|
70
|
-
function onEvent(token, handler) {
|
|
71
|
-
return onEventFor(require_config.getRegistry(), token, handler);
|
|
40
|
+
function setRegistry(registry) {
|
|
41
|
+
_registry = registry;
|
|
72
42
|
}
|
|
73
43
|
/**
|
|
74
|
-
*
|
|
75
|
-
* registration order.
|
|
76
|
-
*
|
|
77
|
-
* Cost is O(subscribers for this token) — a token with no subscribers (or no
|
|
78
|
-
* bus yet on this registry) returns immediately, never touching live
|
|
79
|
-
* instances.
|
|
80
|
-
*
|
|
81
|
-
* Dispatch iterates a SNAPSHOT of the handler `Set`, so it is safe for a
|
|
82
|
-
* handler to synchronously call `emitEvent`/`onEvent` re-entrantly: a nested
|
|
83
|
-
* `emitEvent` for the same token completes against its own snapshot, and a
|
|
84
|
-
* handler registered via `onEvent` during dispatch is NOT invoked for the
|
|
85
|
-
* in-flight emit (it only sees emits that start after it subscribed).
|
|
86
|
-
*
|
|
87
|
-
* The variadic tuple means a `void`-payload token needs no second argument,
|
|
88
|
-
* and a typed-payload token requires one. It wraps both sides in a tuple
|
|
89
|
-
* (`[P] extends [void]`, not `void extends P`) because the naive form is true
|
|
90
|
-
* for every `P` that `void` is assignable to — `unknown`, `any`, `number |
|
|
91
|
-
* void` — which collapsed the tuple to `[]` and made their payload
|
|
92
|
-
* un-passable. `any` is special-cased first so it accepts either form.
|
|
44
|
+
* @public
|
|
93
45
|
*/
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
if (!handlers) return;
|
|
97
|
-
const value = payload[0];
|
|
98
|
-
for (const handler of Array.from(handlers)) try {
|
|
99
|
-
handler(value);
|
|
100
|
-
} catch (error) {
|
|
101
|
-
console.error(`${require_StateContainerRegistry.BLAC_ERROR_PREFIX} event handler error for '${token.name}':`, error);
|
|
102
|
-
}
|
|
46
|
+
function getStats() {
|
|
47
|
+
return _registry.getStats();
|
|
103
48
|
}
|
|
104
49
|
//#endregion
|
|
105
50
|
//#region src/core/meta.ts
|
|
106
51
|
/**
|
|
52
|
+
* `$blac` meta namespace for `StateContainer`.
|
|
53
|
+
*
|
|
54
|
+
* Getters/methods here close over the *real* container instance captured at
|
|
55
|
+
* `createMeta` time rather than reading a `this`-receiver. `buildTrackedProxy`
|
|
56
|
+
* no longer uses a `this`-Proxy (getters run with `this` = the real instance),
|
|
57
|
+
* so ES `#private` is safe here now; the closure style is kept because it also
|
|
58
|
+
* keeps this own, frozen property independent of the proxy entirely.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
107
61
|
* Non-enumerable brand carried on every `$blac` object produced by
|
|
108
62
|
* {@link createMeta}. Used by the clobber guard in `StateContainer` to detect
|
|
109
63
|
* a subclass class-field shadowing the base's own `$blac` property, and by the
|
|
@@ -130,7 +84,7 @@ function createMeta(container) {
|
|
|
130
84
|
return c._name;
|
|
131
85
|
},
|
|
132
86
|
get id() {
|
|
133
|
-
return c._instanceId;
|
|
87
|
+
return c._instanceId ??= generateSimpleId(require_StateContainerRegistry.getBlacName(c.constructor), "main");
|
|
134
88
|
},
|
|
135
89
|
get debug() {
|
|
136
90
|
return c._debug;
|
|
@@ -248,7 +202,7 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
248
202
|
const owners = this._depsByOwner ??= /* @__PURE__ */ new Map();
|
|
249
203
|
const prevSlice = owners.get(ownerId);
|
|
250
204
|
if (prevSlice && shallowEqualRecord(prevSlice, slice)) return;
|
|
251
|
-
if (
|
|
205
|
+
if (require_StateContainerRegistry.IS_DEV) for (const key of Object.keys(slice)) for (const [otherOwner, otherSlice] of owners) {
|
|
252
206
|
if (otherOwner === ownerId) continue;
|
|
253
207
|
if (key in otherSlice && otherSlice[key] !== slice[key]) console.warn(`[${this._name}] multiple owners writing dep \`${String(key)}\`; last write wins`);
|
|
254
208
|
}
|
|
@@ -271,6 +225,34 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
271
225
|
[require_StateContainerRegistry.ON_DISPOSE](handler) {
|
|
272
226
|
return this.onSystemEvent("dispose", handler);
|
|
273
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* @internal Drive the 0↔1 ownership transition. Idempotent: repeated calls
|
|
230
|
+
* with the same value are no-ops, so the registry can call it from every
|
|
231
|
+
* acquire/release without tracking edges itself.
|
|
232
|
+
*
|
|
233
|
+
* Returns which real transition (if any) just happened, so the registry can
|
|
234
|
+
* emit the matching `activated`/`deactivated` plugin event without exposing
|
|
235
|
+
* `_activation` itself — `'none'` for an idempotent no-op call.
|
|
236
|
+
*/
|
|
237
|
+
[require_StateContainerRegistry.SET_ACTIVE](active) {
|
|
238
|
+
if (this._disposed) return "none";
|
|
239
|
+
if (active === (this._activation !== null)) return "none";
|
|
240
|
+
if (active) {
|
|
241
|
+
this._activation = new AbortController();
|
|
242
|
+
this.onActivate(this._activation.signal);
|
|
243
|
+
return {
|
|
244
|
+
kind: "activated",
|
|
245
|
+
signal: this._activation.signal
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
this._abortActivation();
|
|
249
|
+
this.onDeactivate();
|
|
250
|
+
return "deactivated";
|
|
251
|
+
}
|
|
252
|
+
_abortActivation() {
|
|
253
|
+
this._activation?.abort();
|
|
254
|
+
this._activation = null;
|
|
255
|
+
}
|
|
274
256
|
reconcileDeps() {
|
|
275
257
|
const prev = this._deps;
|
|
276
258
|
const next = {};
|
|
@@ -282,6 +264,30 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
282
264
|
this._registry.emit("depsChanged", this, prev, next);
|
|
283
265
|
}
|
|
284
266
|
onDepsChanged(_next, _prev) {}
|
|
267
|
+
get state() {
|
|
268
|
+
return this._stateOverride ?? super.state;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @internal Run `fn` with `state` reporting `tracked`, and with dep handles
|
|
272
|
+
* read off `this` routed through `onDepHandle`. Restored in `finally`, and
|
|
273
|
+
* nestable — getters reading other getters stay in tracked context.
|
|
274
|
+
*
|
|
275
|
+
* The dep hook lives here rather than in the adapter's proxy because getters
|
|
276
|
+
* now run with `this` = the real instance (so ES `#private` works), which
|
|
277
|
+
* means a `this.someDep` read never passes through the proxy's trap.
|
|
278
|
+
*/
|
|
279
|
+
[require_StateContainerRegistry.WITH_TRACKED_STATE](tracked, fn, onDepHandle) {
|
|
280
|
+
const prevState = this._stateOverride;
|
|
281
|
+
const prevHook = this._depHandleHook;
|
|
282
|
+
this._stateOverride = tracked;
|
|
283
|
+
this._depHandleHook = onDepHandle;
|
|
284
|
+
try {
|
|
285
|
+
return fn();
|
|
286
|
+
} finally {
|
|
287
|
+
this._stateOverride = prevState;
|
|
288
|
+
this._depHandleHook = prevHook;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
285
291
|
get args() {
|
|
286
292
|
return this._config.args;
|
|
287
293
|
}
|
|
@@ -307,13 +313,6 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
307
313
|
const resolve = (args) => {
|
|
308
314
|
const effectiveArgs = args ?? defaultArgs;
|
|
309
315
|
const key = this._registry.resolveKey(Type, void 0, effectiveArgs);
|
|
310
|
-
const edges = this._depEdges ??= /* @__PURE__ */ new Map();
|
|
311
|
-
let resolvedKeys = edges.get(Type);
|
|
312
|
-
if (resolvedKeys === void 0) {
|
|
313
|
-
resolvedKeys = /* @__PURE__ */ new Set();
|
|
314
|
-
edges.set(Type, resolvedKeys);
|
|
315
|
-
}
|
|
316
|
-
resolvedKeys.add(key);
|
|
317
316
|
return this._registry.acquire(Type, key, {
|
|
318
317
|
canCreate: true,
|
|
319
318
|
countRef: false,
|
|
@@ -323,6 +322,8 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
323
322
|
};
|
|
324
323
|
const handle = {
|
|
325
324
|
track: (options) => {
|
|
325
|
+
const wrapped = this._depHandleHook?.(handle);
|
|
326
|
+
if (wrapped !== void 0 && wrapped !== handle) return wrapped.track(options);
|
|
326
327
|
const instance = resolve(options?.args);
|
|
327
328
|
return [instance.state, instance];
|
|
328
329
|
},
|
|
@@ -350,19 +351,18 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
350
351
|
this._hydrationPromiseSettled = false;
|
|
351
352
|
this._config = {};
|
|
352
353
|
this._initCalled = false;
|
|
354
|
+
this._activation = null;
|
|
353
355
|
this._emitWindowStart = 0;
|
|
354
356
|
this._emitCount = 0;
|
|
355
357
|
this._emitRateWarned = false;
|
|
356
358
|
this._systemEventHandlers = /* @__PURE__ */ new Map();
|
|
357
359
|
this._dependencies = null;
|
|
358
|
-
this._depEdges = null;
|
|
359
360
|
this._pendingChange = null;
|
|
360
361
|
this._bridgeUnsub = null;
|
|
361
|
-
this._registry =
|
|
362
|
+
this._registry = getRegistry();
|
|
362
363
|
this._equalityFn = require_StateContainerRegistry.getBlacConfig().equality;
|
|
363
|
-
this._name = this.constructor
|
|
364
|
+
this._name = require_StateContainerRegistry.getBlacName(this.constructor);
|
|
364
365
|
this._debug = false;
|
|
365
|
-
this._instanceId = generateSimpleId(this.constructor.name, "main");
|
|
366
366
|
this._createdAt = Date.now();
|
|
367
367
|
this.$blac = createMeta(this);
|
|
368
368
|
this.onSystemEvent = (event, handler) => {
|
|
@@ -371,42 +371,17 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
371
371
|
handlers = /* @__PURE__ */ new Set();
|
|
372
372
|
this._systemEventHandlers.set(event, handlers);
|
|
373
373
|
}
|
|
374
|
-
const wasFirst = event === "stateChanged" && handlers.size === 0;
|
|
375
374
|
handlers.add(handler);
|
|
376
|
-
if (
|
|
377
|
-
let removed = false;
|
|
375
|
+
if (event === "stateChanged" && this._bridgeUnsub === null) this._bridgeUnsub = this.channel.subscribe(() => _dirtytalk_structural.ALL_PATHS, () => this._drainPending());
|
|
378
376
|
return () => {
|
|
379
|
-
if (removed) return;
|
|
380
|
-
removed = true;
|
|
381
377
|
handlers?.delete(handler);
|
|
382
|
-
if (event === "stateChanged" &&
|
|
378
|
+
if (event === "stateChanged" && handlers?.size === 0) {
|
|
383
379
|
this._bridgeUnsub?.();
|
|
384
380
|
this._bridgeUnsub = null;
|
|
385
381
|
this._pendingChange = null;
|
|
386
382
|
}
|
|
387
383
|
};
|
|
388
384
|
};
|
|
389
|
-
this.on = (token, handler) => {
|
|
390
|
-
if (this._disposed) return () => {};
|
|
391
|
-
const unsub = onEventFor(this._registry, token, handler);
|
|
392
|
-
this.onSystemEvent("dispose", unsub);
|
|
393
|
-
return unsub;
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* @internal Subscribe the channel bridge that turns flushes into
|
|
398
|
-
* 'stateChanged' system events. Interest is ALL_PATHS so we wake on every
|
|
399
|
-
* flush. Coalesced via `_pendingChange`: if no emit happened (e.g. a no-op
|
|
400
|
-
* patch), the bridge sees null and skips. Lazy: only subscribed while at
|
|
401
|
-
* least one 'stateChanged' handler exists.
|
|
402
|
-
*/
|
|
403
|
-
_subscribeBridge() {
|
|
404
|
-
if (this._bridgeUnsub) return;
|
|
405
|
-
this._bridgeUnsub = this.channel.subscribe(() => _dirtytalk_structural.ALL_PATHS, () => this._drainPending());
|
|
406
|
-
}
|
|
407
|
-
_hasStateChangedHandlers() {
|
|
408
|
-
const handlers = this._systemEventHandlers.get("stateChanged");
|
|
409
|
-
return !!handlers && handlers.size > 0;
|
|
410
385
|
}
|
|
411
386
|
/**
|
|
412
387
|
* Called once after construction with the args passed at acquire time, before the first
|
|
@@ -415,6 +390,24 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
415
390
|
*/
|
|
416
391
|
init(_args) {}
|
|
417
392
|
/**
|
|
393
|
+
* Called when this instance goes from unowned to owned (first ref or first
|
|
394
|
+
* `depend()` dependent). Override to start work that should only run while
|
|
395
|
+
* something is actually using the instance — fetches, timers, listeners.
|
|
396
|
+
*
|
|
397
|
+
* `signal` aborts on the matching {@link onDeactivate} and on dispose, so
|
|
398
|
+
* async work started here can be cancelled without extra bookkeeping.
|
|
399
|
+
*
|
|
400
|
+
* Runs before the first `useBlocDeps` slice is applied, so `this.deps` is
|
|
401
|
+
* empty on first activation — use `onDepsChanged` for deps-driven work.
|
|
402
|
+
*/
|
|
403
|
+
onActivate(_signal) {}
|
|
404
|
+
/**
|
|
405
|
+
* Called when this instance goes from owned back to unowned while surviving
|
|
406
|
+
* in the registry (i.e. `keepAlive`). A disposed instance does NOT get this
|
|
407
|
+
* callback — `dispose()` is the teardown path for that case.
|
|
408
|
+
*/
|
|
409
|
+
onDeactivate() {}
|
|
410
|
+
/**
|
|
418
411
|
* @internal Framework-only configuration entry point (registry + testing
|
|
419
412
|
* helpers). Writes the `_`-private identity fields directly, resolves
|
|
420
413
|
* per-class equality, emits the registry `created` event, and runs `init()`
|
|
@@ -422,17 +415,17 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
422
415
|
*/
|
|
423
416
|
[require_StateContainerRegistry.INIT_CONFIG](config) {
|
|
424
417
|
this._config = { ...config };
|
|
425
|
-
this._name = this._config.name || this.constructor
|
|
418
|
+
this._name = this._config.name || require_StateContainerRegistry.getBlacName(this.constructor);
|
|
426
419
|
this._debug = this._config.debug ?? false;
|
|
427
|
-
this._instanceId = generateSimpleId(this.constructor
|
|
420
|
+
this._instanceId = generateSimpleId(require_StateContainerRegistry.getBlacName(this.constructor), this._config.instanceId);
|
|
428
421
|
const perClass = require_StateContainerRegistry.getClassEquality(this.constructor);
|
|
429
422
|
this._equalityFn = perClass ?? require_StateContainerRegistry.getBlacConfig().equality;
|
|
430
|
-
this._registry.emit("created", this);
|
|
431
423
|
if (!this._initCalled) {
|
|
432
424
|
this._initCalled = true;
|
|
433
425
|
this.init(this._config.args);
|
|
434
426
|
}
|
|
435
|
-
|
|
427
|
+
this._registry.emit("created", this);
|
|
428
|
+
if (require_StateContainerRegistry.IS_DEV) {
|
|
436
429
|
if (!this.$blac?.[META_BRAND]) console.warn(`[blac] ${this.constructor.name} appears to declare its own \`$blac\` member, which shadows the reserved meta namespace. \`$blac\` is reserved by StateContainer — remove the subclass field.`);
|
|
437
430
|
}
|
|
438
431
|
}
|
|
@@ -448,11 +441,12 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
448
441
|
this.emitSystemEvent("dispose", void 0);
|
|
449
442
|
this._bridgeUnsub?.();
|
|
450
443
|
this._bridgeUnsub = null;
|
|
444
|
+
this._abortActivation();
|
|
451
445
|
this._systemEventHandlers.clear();
|
|
452
446
|
this._pendingChange = null;
|
|
453
447
|
this._registry.emit("disposed", this);
|
|
454
|
-
if (this._debug) console.log(`[${this._name}] Disposed successfully`);
|
|
455
448
|
super.dispose();
|
|
449
|
+
if (this._debug) console.log(`[${this._name}] Disposed successfully`);
|
|
456
450
|
}
|
|
457
451
|
emit(next) {
|
|
458
452
|
this.applyState(next, "default");
|
|
@@ -467,25 +461,17 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
467
461
|
* preserved.
|
|
468
462
|
*/
|
|
469
463
|
patch(partial) {
|
|
470
|
-
if (this._disposed)
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
let allEqual = true;
|
|
474
|
-
for (const key in partial) {
|
|
475
|
-
hasKeys = true;
|
|
476
|
-
if (!Object.is(prev[key], partial[key])) {
|
|
477
|
-
allEqual = false;
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
464
|
+
if (this._disposed) {
|
|
465
|
+
this._warnDisposedMutation("patch");
|
|
466
|
+
return;
|
|
480
467
|
}
|
|
481
|
-
|
|
482
|
-
if (allEqual) return;
|
|
483
|
-
if (process.env.NODE_ENV !== "production") this._checkEmitRate();
|
|
468
|
+
const prev = this.state;
|
|
484
469
|
super.patch(partial);
|
|
485
470
|
const next = this.state;
|
|
486
471
|
if (Object.is(prev, next)) return;
|
|
472
|
+
if (require_StateContainerRegistry.IS_DEV) this._checkEmitRate();
|
|
487
473
|
if (this._hydrationStatus === "hydrating") this._changedWhileHydrating = true;
|
|
488
|
-
if (this.
|
|
474
|
+
if (this._bridgeUnsub !== null) if (this._pendingChange) this._pendingChange.next = next;
|
|
489
475
|
else this._pendingChange = {
|
|
490
476
|
prev,
|
|
491
477
|
next
|
|
@@ -493,13 +479,16 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
493
479
|
if (this._registry.hasStateChangedListeners) this._registry.notifyStateChanged(this, prev, next);
|
|
494
480
|
}
|
|
495
481
|
applyState(next, source) {
|
|
496
|
-
if (this._disposed)
|
|
482
|
+
if (this._disposed) {
|
|
483
|
+
this._warnDisposedMutation("emit");
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
497
486
|
const prev = this.state;
|
|
498
487
|
if (prev === next) return;
|
|
499
488
|
if (this._equalityFn(prev, next)) return;
|
|
500
|
-
if (
|
|
489
|
+
if (require_StateContainerRegistry.IS_DEV) this._checkEmitRate();
|
|
501
490
|
if (this._hydrationStatus === "hydrating" && source !== "hydration") this._changedWhileHydrating = true;
|
|
502
|
-
if (this.
|
|
491
|
+
if (this._bridgeUnsub !== null) if (this._pendingChange) this._pendingChange.next = next;
|
|
503
492
|
else this._pendingChange = {
|
|
504
493
|
prev,
|
|
505
494
|
next
|
|
@@ -545,9 +534,15 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
545
534
|
this.ensureHydrationPromise();
|
|
546
535
|
this.setHydrationStatus("hydrating");
|
|
547
536
|
}
|
|
537
|
+
_warnDisposedMutation(op) {
|
|
538
|
+
if (require_StateContainerRegistry.IS_DEV) console.warn(`[blac] ${this._name}: ${op}() after dispose ignored. This usually means an async method resolved after the last consumer unmounted. Guard with \`if (this.$blac.disposed) return\` after each \`await\`, or abort the work from \`onSystemEvent('dispose', ...)\`.`);
|
|
539
|
+
}
|
|
548
540
|
_applyHydratedState(next) {
|
|
549
541
|
if (this._disposed) return false;
|
|
550
|
-
if (this._hydrationStatus !== "hydrating" || this._changedWhileHydrating)
|
|
542
|
+
if (this._hydrationStatus !== "hydrating" || this._changedWhileHydrating) {
|
|
543
|
+
if (require_StateContainerRegistry.IS_DEV && this._changedWhileHydrating) console.warn(`[blac] ${this._name}: persisted state discarded because the container emitted while hydrating.`);
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
551
546
|
this.applyState(next, "hydration");
|
|
552
547
|
return true;
|
|
553
548
|
}
|
|
@@ -611,15 +606,10 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
611
606
|
emitSystemEvent(event, payload) {
|
|
612
607
|
const handlers = this._systemEventHandlers.get(event);
|
|
613
608
|
if (!handlers) return;
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
try {
|
|
619
|
-
handler(payload);
|
|
620
|
-
} catch (error) {
|
|
621
|
-
console.error(`[${this._name}] Error in system event handler:`, error);
|
|
622
|
-
}
|
|
609
|
+
for (const handler of handlers) try {
|
|
610
|
+
handler(payload);
|
|
611
|
+
} catch (error) {
|
|
612
|
+
console.error(`[${this._name}] Error in system event handler:`, error);
|
|
623
613
|
}
|
|
624
614
|
}
|
|
625
615
|
/**
|
|
@@ -647,19 +637,60 @@ var StateContainer = class extends _dirtytalk_structural.StructuralContainer {
|
|
|
647
637
|
//#endregion
|
|
648
638
|
//#region src/core/Cubit.ts
|
|
649
639
|
/**
|
|
650
|
-
* `Cubit<S>` is a `StateContainer<S>`
|
|
651
|
-
* public mutation surface. Today it adds nothing structurally beyond
|
|
652
|
-
* `StateContainer` — both are inherited from the underlying
|
|
653
|
-
* `StructuralContainer<S>`. Kept as a real class (not a type alias) because
|
|
654
|
-
* downstream code does `instance instanceof Cubit` checks.
|
|
640
|
+
* `Cubit<S>` is a `StateContainer<S>` that exposes mutation publicly.
|
|
655
641
|
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
642
|
+
* That is the whole difference, and it is a real one: on `StateContainer`
|
|
643
|
+
* `emit` / `patch` / `update` are `protected`, so a container mutates itself
|
|
644
|
+
* from its own methods and callers go through the API it chooses to publish.
|
|
645
|
+
* `Cubit` re-declares the three as `public` for the cases where a caller
|
|
646
|
+
* legitimately drives state from outside — test helpers, devtools
|
|
647
|
+
* time-travel, benchmarks.
|
|
648
|
+
*
|
|
649
|
+
* Reach for `StateContainer` when business logic should live in the class,
|
|
650
|
+
* and `Cubit` when the caller owns the transitions.
|
|
661
651
|
*/
|
|
662
|
-
var Cubit = class extends StateContainer {
|
|
652
|
+
var Cubit = class extends StateContainer {
|
|
653
|
+
emit(next) {
|
|
654
|
+
super.emit(next);
|
|
655
|
+
}
|
|
656
|
+
patch(partial) {
|
|
657
|
+
super.patch(partial);
|
|
658
|
+
}
|
|
659
|
+
update(fn) {
|
|
660
|
+
super.update(fn);
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/registry/acquire.ts
|
|
665
|
+
/**
|
|
666
|
+
* Acquire an instance with ref tracking (ownership semantics). Instance
|
|
667
|
+
* identity is derived purely from `args` (via the class's `static key(args)`,
|
|
668
|
+
* a structural hash of `args`, or the default sentinel when there are none).
|
|
669
|
+
*
|
|
670
|
+
* @param BlocClass - The StateContainer class constructor
|
|
671
|
+
* @param opts - `args` derives the instance key; `refId` names the reference
|
|
672
|
+
* for debugging and is auto-generated when omitted.
|
|
673
|
+
*/
|
|
674
|
+
function acquire(BlocClass, opts) {
|
|
675
|
+
const registry = getRegistry();
|
|
676
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
677
|
+
return registry.acquire(BlocClass, key, {
|
|
678
|
+
canCreate: true,
|
|
679
|
+
countRef: true,
|
|
680
|
+
refId: opts?.refId,
|
|
681
|
+
args: opts?.args
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Resolve the storage key an instance would be acquired under, given its
|
|
686
|
+
* construction `args`. This is the canonical key-computation path. Callers that
|
|
687
|
+
* both acquire and release against the `@internal` registry tier (e.g.
|
|
688
|
+
* `@blac/react` `useBloc`) must use this once and pass the same resolved key to
|
|
689
|
+
* both, so the ref is dropped under the key it was taken.
|
|
690
|
+
*/
|
|
691
|
+
function resolveInstanceKey(BlocClass, args) {
|
|
692
|
+
return getRegistry().resolveKey(BlocClass, void 0, args);
|
|
693
|
+
}
|
|
663
694
|
//#endregion
|
|
664
695
|
//#region src/registry/ensure.ts
|
|
665
696
|
/**
|
|
@@ -667,7 +698,7 @@ var Cubit = class extends StateContainer {};
|
|
|
667
698
|
* identity is derived purely from `args`, matching `acquire`.
|
|
668
699
|
*/
|
|
669
700
|
function ensure(BlocClass, opts) {
|
|
670
|
-
const registry =
|
|
701
|
+
const registry = getRegistry();
|
|
671
702
|
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
672
703
|
return registry.ensure(BlocClass, key, opts?.args);
|
|
673
704
|
}
|
|
@@ -690,29 +721,41 @@ Object.defineProperty(exports, "StateContainer", {
|
|
|
690
721
|
return StateContainer;
|
|
691
722
|
}
|
|
692
723
|
});
|
|
693
|
-
Object.defineProperty(exports, "
|
|
724
|
+
Object.defineProperty(exports, "acquire", {
|
|
694
725
|
enumerable: true,
|
|
695
726
|
get: function() {
|
|
696
|
-
return
|
|
727
|
+
return acquire;
|
|
697
728
|
}
|
|
698
729
|
});
|
|
699
|
-
Object.defineProperty(exports, "
|
|
730
|
+
Object.defineProperty(exports, "ensure", {
|
|
700
731
|
enumerable: true,
|
|
701
732
|
get: function() {
|
|
702
|
-
return
|
|
733
|
+
return ensure;
|
|
703
734
|
}
|
|
704
735
|
});
|
|
705
|
-
Object.defineProperty(exports, "
|
|
736
|
+
Object.defineProperty(exports, "getRegistry", {
|
|
706
737
|
enumerable: true,
|
|
707
738
|
get: function() {
|
|
708
|
-
return
|
|
739
|
+
return getRegistry;
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
Object.defineProperty(exports, "getStats", {
|
|
743
|
+
enumerable: true,
|
|
744
|
+
get: function() {
|
|
745
|
+
return getStats;
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
Object.defineProperty(exports, "resolveInstanceKey", {
|
|
749
|
+
enumerable: true,
|
|
750
|
+
get: function() {
|
|
751
|
+
return resolveInstanceKey;
|
|
709
752
|
}
|
|
710
753
|
});
|
|
711
|
-
Object.defineProperty(exports, "
|
|
754
|
+
Object.defineProperty(exports, "setRegistry", {
|
|
712
755
|
enumerable: true,
|
|
713
756
|
get: function() {
|
|
714
|
-
return
|
|
757
|
+
return setRegistry;
|
|
715
758
|
}
|
|
716
759
|
});
|
|
717
760
|
|
|
718
|
-
//# sourceMappingURL=ensure-
|
|
761
|
+
//# sourceMappingURL=ensure-BjhbDW8Z.cjs.map
|