@blac/core 2.0.13 → 2.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -3
- package/dist/Cubit-9jal5zdZ.cjs +1 -1
- package/dist/Cubit-BAUPiUF7.cjs +359 -286
- package/dist/Cubit-BBKF3PIg.js +269 -230
- package/dist/Cubit-BC70gaiA.js +453 -0
- package/dist/Cubit-BC70gaiA.js.map +1 -0
- package/dist/Cubit-BOgUZva7.js +342 -266
- package/dist/Cubit-BOxMvpfc.js +273 -232
- package/dist/Cubit-BTznt8zg.js +1 -1
- package/dist/Cubit-BogJXkLm.js +260 -225
- package/dist/Cubit-C-8R_8db.cjs +475 -0
- package/dist/Cubit-C-8R_8db.cjs.map +1 -0
- package/dist/Cubit-C3Mw3EoO.cjs +401 -0
- package/dist/Cubit-C3Mw3EoO.cjs.map +1 -0
- package/dist/Cubit-CO8Fr72L.cjs +447 -0
- package/dist/Cubit-CO8Fr72L.cjs.map +1 -0
- package/dist/Cubit-COfHT1Bm.cjs +300 -259
- package/dist/Cubit-CROWjjs9.js +481 -0
- package/dist/Cubit-CROWjjs9.js.map +1 -0
- package/dist/Cubit-CWP8Ddzx.cjs +510 -0
- package/dist/Cubit-CWP8Ddzx.cjs.map +1 -0
- package/dist/Cubit-CXxh9iol.js +284 -242
- package/dist/Cubit-CYOWfzQt.cjs +297 -254
- package/dist/Cubit-CZaf_fp4.cjs +1 -1
- package/dist/Cubit-C_dUEUdd.cjs +359 -286
- package/dist/Cubit-C_rxRCTN.cjs +523 -0
- package/dist/Cubit-C_rxRCTN.cjs.map +1 -0
- package/dist/Cubit-CcKgMEBO.js +281 -239
- package/dist/Cubit-CfT6Y1jl.js +328 -280
- package/dist/Cubit-CynJruuO.js +369 -0
- package/dist/Cubit-CynJruuO.js.map +1 -0
- package/dist/Cubit-D2vQ6nMb.js +342 -266
- package/dist/Cubit-D7jOZCoZ.js +342 -266
- package/dist/Cubit-D9j3IGPc.cjs +523 -0
- package/dist/Cubit-D9j3IGPc.cjs.map +1 -0
- package/dist/Cubit-DKEY9WYq.cjs +276 -240
- package/dist/Cubit-DMV_0TCp.js +481 -0
- package/dist/Cubit-DMV_0TCp.js.map +1 -0
- package/dist/Cubit-DP5DXPUK.js +342 -266
- package/dist/Cubit-DRFkzD2h.js +426 -0
- package/dist/Cubit-DRFkzD2h.js.map +1 -0
- package/dist/Cubit-DbnhTUaZ.cjs +359 -286
- package/dist/Cubit-DrqG3SP3.cjs +349 -300
- package/dist/Cubit-DsDkCo42.cjs +292 -250
- package/dist/Cubit-DwRw1E9D.cjs +289 -247
- package/dist/Cubit-Dw_kFBgc.js +1 -1
- package/dist/Cubit-KiXZCubP.cjs +1 -1
- package/dist/Cubit-Ksj7G4uR.js +342 -266
- package/dist/Cubit-MkjbpcPf.cjs +359 -286
- package/dist/Cubit-NRhvdDQ6.js +279 -239
- package/dist/Cubit-PMTXxI_u.js +1 -1
- package/dist/Cubit-VJuu2tt9.js +481 -0
- package/dist/Cubit-VJuu2tt9.js.map +1 -0
- package/dist/Cubit-jz922NKf.cjs +300 -257
- package/dist/Cubit-kU5_4jgC.cjs +359 -286
- package/dist/StateContainerRegistry-B4yVMYbx.cjs +1057 -0
- package/dist/StateContainerRegistry-B4yVMYbx.cjs.map +1 -0
- package/dist/StateContainerRegistry-BAcxouCu.js +683 -615
- package/dist/StateContainerRegistry-BK57H92E.js +701 -630
- package/dist/StateContainerRegistry-BRBATSrx.cjs +1030 -0
- package/dist/StateContainerRegistry-BRBATSrx.cjs.map +1 -0
- package/dist/StateContainerRegistry-BgBIKcQF.js +956 -0
- package/dist/StateContainerRegistry-BgBIKcQF.js.map +1 -0
- package/dist/StateContainerRegistry-BglEhqdA.js +669 -606
- package/dist/StateContainerRegistry-BhcnG0DF.js +625 -562
- package/dist/StateContainerRegistry-BpO5t-0i.js +642 -580
- package/dist/StateContainerRegistry-BqS-wpb_.js +957 -0
- package/dist/StateContainerRegistry-BqS-wpb_.js.map +1 -0
- package/dist/StateContainerRegistry-BrEGYPZT.cjs +1029 -0
- package/dist/StateContainerRegistry-BrEGYPZT.cjs.map +1 -0
- package/dist/StateContainerRegistry-Bxfne4A7.cjs +908 -0
- package/dist/StateContainerRegistry-Bxfne4A7.cjs.map +1 -0
- package/dist/StateContainerRegistry-C0E7vsgy.js +758 -0
- package/dist/StateContainerRegistry-C0E7vsgy.js.map +1 -0
- package/dist/StateContainerRegistry-C0I77Ndz.cjs +920 -0
- package/dist/StateContainerRegistry-C0I77Ndz.cjs.map +1 -0
- package/dist/StateContainerRegistry-CDH9mnQS.cjs +668 -614
- package/dist/StateContainerRegistry-CTOXUf75.cjs +695 -640
- package/dist/StateContainerRegistry-CX2CBOmv.cjs +739 -679
- package/dist/StateContainerRegistry-CXnnf2-l.js +867 -0
- package/dist/StateContainerRegistry-CXnnf2-l.js.map +1 -0
- package/dist/StateContainerRegistry-CehuIpK_.cjs +811 -0
- package/dist/StateContainerRegistry-CehuIpK_.cjs.map +1 -0
- package/dist/StateContainerRegistry-Ci0ajc5g.js +680 -612
- package/dist/StateContainerRegistry-Ck2-XmT_.js +587 -527
- package/dist/StateContainerRegistry-D1lVJFGL.cjs +706 -646
- package/dist/StateContainerRegistry-DC4N73O6.js +632 -569
- package/dist/StateContainerRegistry-DOuGI-l5.js +645 -582
- package/dist/StateContainerRegistry-DT66lr3I.cjs +651 -596
- package/dist/StateContainerRegistry-DmmzYa7S.js +974 -0
- package/dist/StateContainerRegistry-DmmzYa7S.js.map +1 -0
- package/dist/StateContainerRegistry-Upsrlg9G.cjs +709 -649
- package/dist/StateContainerRegistry-WznfcA-Q.js +855 -0
- package/dist/StateContainerRegistry-WznfcA-Q.js.map +1 -0
- package/dist/StateContainerRegistry-Yph6UCA_.js +637 -569
- package/dist/StateContainerRegistry-mseeTqSA.cjs +671 -616
- package/dist/StateContainerRegistry-pRNxHNFD.cjs +658 -603
- package/dist/StateContainerRegistry-vXMWtG7J.cjs +613 -561
- package/dist/StateContainerRegistry-v_prqMcI.cjs +663 -603
- package/dist/branded-BSeA_mZO.cjs.map +1 -1
- package/dist/branded-DCqi3De1.cjs +11 -11
- package/dist/branded-DwtzSsg0.js.map +1 -1
- package/dist/branded-Max3xOTA.js +6 -6
- package/dist/config-0ZD9i3wy.js +16 -0
- package/dist/config-0ZD9i3wy.js.map +1 -0
- package/dist/config-B3NIwDQv.cjs +20 -20
- package/dist/config-BKGHop0V.js +5 -5
- package/dist/config-BKoaAlmb.js +5 -5
- package/dist/config-BPj08-8h.cjs +32 -0
- package/dist/config-BPj08-8h.cjs.map +1 -0
- package/dist/config-BR0Xy-Tn.cjs +20 -20
- package/dist/config-B_4xXpvK.cjs +32 -0
- package/dist/config-B_4xXpvK.cjs.map +1 -0
- package/dist/config-BflrQM4_.cjs +32 -0
- package/dist/config-BflrQM4_.cjs.map +1 -0
- package/dist/config-BzObBsk2.cjs +32 -0
- package/dist/config-BzObBsk2.cjs.map +1 -0
- package/dist/config-C0yumL1H.cjs +32 -0
- package/dist/config-C0yumL1H.cjs.map +1 -0
- package/dist/config-C8xqVHTf.js +16 -0
- package/dist/config-C8xqVHTf.js.map +1 -0
- package/dist/config-CCUhIYIF.js +5 -5
- package/dist/config-CGo__MAt.js +16 -0
- package/dist/config-CGo__MAt.js.map +1 -0
- package/dist/config-CQH9fTY-.cjs +20 -20
- package/dist/config-CR_Bz7RD.js +5 -5
- package/dist/config-CTOa-yPN.cjs +20 -20
- package/dist/config-Cd7Q-B4g.js +16 -0
- package/dist/config-Cd7Q-B4g.js.map +1 -0
- package/dist/config-CmDEX-1o.js +16 -0
- package/dist/config-CmDEX-1o.js.map +1 -0
- package/dist/config-CoNMTnMA.cjs +32 -0
- package/dist/config-CoNMTnMA.cjs.map +1 -0
- package/dist/config-Cwj8-C1J.js +5 -5
- package/dist/config-D3jisfdj.cjs +20 -20
- package/dist/config-D4GifZQ4.js +5 -5
- package/dist/config-DDrSQGpQ.cjs +20 -20
- package/dist/config-DEcslxan.cjs +20 -20
- package/dist/config-DMNZ2YLV.cjs +20 -20
- package/dist/config-De9oQ6Ki.js +5 -5
- package/dist/config-DoHx0Xsl.js +16 -0
- package/dist/config-DoHx0Xsl.js.map +1 -0
- package/dist/config-DokTzpr8.cjs +20 -20
- package/dist/config-DslYBm4Z.js +5 -5
- package/dist/config-H6FAqbW4.cjs +20 -20
- package/dist/config-Yp645dGK.js +5 -5
- package/dist/config-ispAzOZV.js +5 -5
- package/dist/config.d.cts +72 -0
- package/dist/config.d.ts +72 -0
- package/dist/constants.d.cts +13 -0
- package/dist/constants.d.ts +13 -0
- package/dist/core/Cubit.d.ts +14 -4
- package/dist/core/StateContainer.d.ts +111 -11
- package/dist/core/StateContainerRegistry.d.ts +55 -11
- package/dist/core/symbols.d.ts +26 -0
- package/dist/debug.cjs +3 -3
- package/dist/debug.js +3 -3
- package/dist/decorators/blac.d.ts +17 -0
- package/dist/ensure-9VEq5H0L.js +3 -3
- package/dist/ensure-BB6xHQAF.cjs +14 -0
- package/dist/ensure-BB6xHQAF.cjs.map +1 -0
- package/dist/ensure-BNDfTzqg.cjs +8 -8
- package/dist/ensure-BVCnjU7r.js +343 -267
- package/dist/ensure-BbzGXjep.cjs +8 -8
- package/dist/ensure-BlIaQai6.js +9 -0
- package/dist/ensure-BlIaQai6.js.map +1 -0
- package/dist/ensure-Bm3oHxga.js +9 -0
- package/dist/ensure-Bm3oHxga.js.map +1 -0
- package/dist/ensure-C3eIRs6e.cjs +8 -8
- package/dist/ensure-CJZL7bcA.cjs +365 -292
- package/dist/ensure-CN6unBOe.cjs +8 -8
- package/dist/ensure-CU-B1ywv.js +3 -3
- package/dist/ensure-CWKzeno7.js +3 -3
- package/dist/ensure-CkENsuQ9.js +9 -0
- package/dist/ensure-CkENsuQ9.js.map +1 -0
- package/dist/ensure-Cm-4_LSh.cjs +14 -0
- package/dist/ensure-Cm-4_LSh.cjs.map +1 -0
- package/dist/ensure-Cqex5r1P.cjs +14 -0
- package/dist/ensure-Cqex5r1P.cjs.map +1 -0
- package/dist/ensure-Cv5AbNGZ.js +9 -0
- package/dist/ensure-Cv5AbNGZ.js.map +1 -0
- package/dist/ensure-D63lEMUK.cjs +8 -8
- package/dist/ensure-DGEtPU9A.cjs +8 -8
- package/dist/ensure-DM3qb336.cjs +14 -0
- package/dist/ensure-DM3qb336.cjs.map +1 -0
- package/dist/ensure-DME-_T0j.cjs +8 -8
- package/dist/ensure-DWd0GCYB.js +3 -3
- package/dist/ensure-DamKOP6q.cjs +8 -8
- package/dist/ensure-Dcfptl-A.js +9 -0
- package/dist/ensure-Dcfptl-A.js.map +1 -0
- package/dist/ensure-Def-EBWG.js +3 -3
- package/dist/ensure-DnHL5QiQ.cjs +14 -0
- package/dist/ensure-DnHL5QiQ.cjs.map +1 -0
- package/dist/ensure-Dr7I78Ku.cjs +8 -8
- package/dist/ensure-SLVdGd5b.js +3 -3
- package/dist/ensure-Sb92MCXu.js +3 -3
- package/dist/ensure-gFlvevGm.cjs +14 -0
- package/dist/ensure-gFlvevGm.cjs.map +1 -0
- package/dist/ensure-l2-H7S5W.js +3 -3
- package/dist/ensure-mkL-3qh8.js +9 -0
- package/dist/ensure-mkL-3qh8.js.map +1 -0
- package/dist/ensure-n80crSlX.js +3 -3
- package/dist/ensure-nCxg7MCN.js +3 -3
- package/dist/ensure-vS71MV4q.cjs +8 -8
- package/dist/index.cjs +37 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/dist/management-6oQbmf0z.js +41 -0
- package/dist/management-6oQbmf0z.js.map +1 -0
- package/dist/management-B46QwA9Y.js +20 -11
- package/dist/management-B9yrRpeg.js +41 -0
- package/dist/management-B9yrRpeg.js.map +1 -0
- package/dist/management-BCKTEZ8Q.js +20 -11
- package/dist/management-BbMzdXbT.js +41 -0
- package/dist/management-BbMzdXbT.js.map +1 -0
- package/dist/management-Bg652agq.js +20 -11
- package/dist/management-BnedF5ZD.cjs +50 -50
- package/dist/management-BoUa99eB.cjs +79 -0
- package/dist/management-BoUa99eB.cjs.map +1 -0
- package/dist/management-C4SHcrJm.cjs +79 -0
- package/dist/management-C4SHcrJm.cjs.map +1 -0
- package/dist/management-CK-GL3wY.js +20 -11
- package/dist/management-CPhgY8OE.js +41 -0
- package/dist/management-CPhgY8OE.js.map +1 -0
- package/dist/management-CU_V3LIP.js +20 -11
- package/dist/management-CUwXDSi9.cjs +79 -0
- package/dist/management-CUwXDSi9.cjs.map +1 -0
- package/dist/management-CaqiyNzB.js +20 -11
- package/dist/management-Cin-JvYe.js +20 -11
- package/dist/management-ClaXym0F.cjs +50 -50
- package/dist/management-DL0Uzsoz.js +20 -11
- package/dist/management-DLdAQfqk.cjs +79 -0
- package/dist/management-DLdAQfqk.cjs.map +1 -0
- package/dist/management-DMZ8qpwr.cjs +50 -50
- package/dist/management-DTzcC6aD.cjs +79 -0
- package/dist/management-DTzcC6aD.cjs.map +1 -0
- package/dist/management-DYLNyj9p.cjs +50 -50
- package/dist/management-Dag9u4t6.cjs +50 -50
- package/dist/management-DbMRdDBo.cjs +50 -50
- package/dist/management-DfnDAKmP.js +41 -0
- package/dist/management-DfnDAKmP.js.map +1 -0
- package/dist/management-DjBU1gtb.cjs +50 -50
- package/dist/management-DwCozsY8.js +20 -11
- package/dist/management-H4m3ciJO.js +32 -0
- package/dist/management-H4m3ciJO.js.map +1 -0
- package/dist/management-Xo3A6Za3.cjs +79 -0
- package/dist/management-Xo3A6Za3.cjs.map +1 -0
- package/dist/management-ZU2YzOkr.js +18 -10
- package/dist/management-baPDwA9n.cjs +50 -50
- package/dist/management-jQGCvZNN.cjs +44 -44
- package/dist/management-ry_KteFK.cjs +50 -50
- package/dist/plugin/BlacPlugin.d.ts +89 -15
- package/dist/plugin/PluginManager.d.ts +65 -5
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +1 -1
- package/dist/registry/acquire.d.ts +9 -2
- package/dist/registry/ensure.d.ts +2 -2
- package/dist/registry/index.d.ts +1 -1
- package/dist/resolve-dependencies-B2QggQAi.js +641 -558
- package/dist/resolve-dependencies-B6JDXvpr.js +651 -566
- package/dist/resolve-dependencies-BAKAoD0U.js +878 -0
- package/dist/resolve-dependencies-BAKAoD0U.js.map +1 -0
- package/dist/resolve-dependencies-BFZQq60Y.cjs +724 -666
- package/dist/resolve-dependencies-BGafS3Ww.js +643 -561
- package/dist/resolve-dependencies-BHd34gS3.cjs +724 -666
- package/dist/resolve-dependencies-BNeayhbQ.cjs +732 -671
- package/dist/resolve-dependencies-BWEMpuDy.js +641 -558
- package/dist/resolve-dependencies-BiWkW2eS.js +643 -561
- package/dist/resolve-dependencies-BjxCztYD.js +739 -0
- package/dist/resolve-dependencies-BjxCztYD.js.map +1 -0
- package/dist/resolve-dependencies-BlyBV0hB.cjs +969 -0
- package/dist/resolve-dependencies-BlyBV0hB.cjs.map +1 -0
- package/dist/resolve-dependencies-By26rT_i.js +651 -566
- package/dist/resolve-dependencies-C9Kf7AzY.cjs +724 -666
- package/dist/resolve-dependencies-CTzV1txG.js +643 -561
- package/dist/resolve-dependencies-CWjuGHiF.cjs +969 -0
- package/dist/resolve-dependencies-CWjuGHiF.cjs.map +1 -0
- package/dist/resolve-dependencies-ClSsP0DJ.cjs +722 -663
- package/dist/resolve-dependencies-D0vTzZgs.js +643 -561
- package/dist/resolve-dependencies-D2WnZMF-.cjs +724 -666
- package/dist/resolve-dependencies-DCBLTeza.cjs +969 -0
- package/dist/resolve-dependencies-DCBLTeza.cjs.map +1 -0
- package/dist/resolve-dependencies-DMlqYJR2.js +643 -561
- package/dist/resolve-dependencies-DP6U1EYB.cjs +840 -0
- package/dist/resolve-dependencies-DP6U1EYB.cjs.map +1 -0
- package/dist/resolve-dependencies-DSQNXvnV.cjs +724 -666
- package/dist/resolve-dependencies-DV3HO_uH.js +878 -0
- package/dist/resolve-dependencies-DV3HO_uH.js.map +1 -0
- package/dist/resolve-dependencies-DXwMhP0Y.js +878 -0
- package/dist/resolve-dependencies-DXwMhP0Y.js.map +1 -0
- package/dist/resolve-dependencies-DbRWlt9u.js +878 -0
- package/dist/resolve-dependencies-DbRWlt9u.js.map +1 -0
- package/dist/resolve-dependencies-DcUUva2P.cjs +724 -666
- package/dist/resolve-dependencies-Dd8T6TLt.cjs +724 -666
- package/dist/resolve-dependencies-Dfdp_DZd.cjs +732 -671
- package/dist/resolve-dependencies-GJ8PNyNB.cjs +969 -0
- package/dist/resolve-dependencies-GJ8PNyNB.cjs.map +1 -0
- package/dist/resolve-dependencies-KSpTt4jy.cjs +722 -663
- package/dist/resolve-dependencies-Nvjp4CwS.js +643 -561
- package/dist/resolve-dependencies-f-QUqYiL.js +643 -561
- package/dist/testing.cjs +27 -20
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +22 -1
- package/dist/testing.d.ts +22 -1
- package/dist/testing.js +27 -21
- package/dist/testing.js.map +1 -1
- package/dist/tracked-B77j2g9M.js +171 -151
- package/dist/tracked-BDVi2LKM.cjs +196 -175
- package/dist/tracked-BFdJCzL0.cjs +242 -0
- package/dist/tracked-BFdJCzL0.cjs.map +1 -0
- package/dist/tracked-BH-gX4T1.cjs +196 -175
- package/dist/tracked-BTHok3Dl.cjs +196 -175
- package/dist/tracked-BTbFkFeM.js +186 -166
- package/dist/tracked-BU_OBWqM.cjs +242 -0
- package/dist/tracked-BU_OBWqM.cjs.map +1 -0
- package/dist/tracked-BfctH2es.cjs +242 -0
- package/dist/tracked-BfctH2es.cjs.map +1 -0
- package/dist/tracked-BhQtzUhZ.js +186 -166
- package/dist/tracked-BnqrYXiO.js +212 -0
- package/dist/tracked-BnqrYXiO.js.map +1 -0
- package/dist/tracked-BtgFOGup.js +212 -0
- package/dist/tracked-BtgFOGup.js.map +1 -0
- package/dist/tracked-C3nIS4J7.cjs +242 -0
- package/dist/tracked-C3nIS4J7.cjs.map +1 -0
- package/dist/tracked-C52awNV9.js +171 -151
- package/dist/tracked-CGzduF2m.js +186 -166
- package/dist/tracked-CK_-ixtX.cjs +196 -175
- package/dist/tracked-CLlvURln.js +186 -166
- package/dist/tracked-CgHWmuGC.cjs +211 -190
- package/dist/tracked-CoAlC8fs.js +171 -151
- package/dist/tracked-D3Xjm1H1.cjs +211 -190
- package/dist/tracked-DB6yMV5F.js +212 -0
- package/dist/tracked-DB6yMV5F.js.map +1 -0
- package/dist/tracked-DBn-bs_G.js +171 -151
- package/dist/tracked-DMBTDF0P.js +171 -151
- package/dist/tracked-DN3h3Rp1.js +171 -151
- package/dist/tracked-DOGh1Q5Z.cjs +242 -0
- package/dist/tracked-DOGh1Q5Z.cjs.map +1 -0
- package/dist/tracked-DUkp4zve.cjs +196 -175
- package/dist/tracked-D_ou7mYG.js +212 -0
- package/dist/tracked-D_ou7mYG.js.map +1 -0
- package/dist/tracked-Dcu6EATB.js +171 -151
- package/dist/tracked-GvAJQVAI.cjs +227 -196
- package/dist/tracked-O2lv-kJV.cjs +211 -190
- package/dist/tracked-WF6aXuAo.js +186 -162
- package/dist/tracked-d_sQWU3c.cjs +196 -175
- package/dist/tracked-n9TMK-30.cjs +196 -175
- package/dist/tracked-njU-_pVa.cjs +211 -190
- package/dist/tracked-zAgmKIlC.js +212 -0
- package/dist/tracked-zAgmKIlC.js.map +1 -0
- package/dist/tracking/dependency-manager.d.ts +33 -29
- package/dist/tracking/index.d.ts +16 -1
- package/dist/tracking/iteration-perf.bench.d.ts +1 -0
- package/dist/tracking/path-utils.d.ts +18 -1
- package/dist/tracking/resolve-dependencies.d.ts +3 -1
- package/dist/tracking/tracked.d.ts +37 -34
- package/dist/tracking/tracking-proxy.d.ts +94 -47
- package/dist/tracking.cjs +12 -9
- package/dist/tracking.js +32 -2
- package/dist/types/utilities.d.ts +15 -3
- package/dist/types.cjs +1 -1
- package/dist/types.js +1 -1
- package/dist/utils/static-props.d.ts +14 -0
- package/dist/utils/structural-key.d.ts +14 -0
- package/dist/watch/watch.d.ts +1 -1
- package/dist/watch-BpwaUL8r.cjs +68 -0
- package/dist/watch-BpwaUL8r.cjs.map +1 -0
- package/dist/watch-DWCqXllW.js +57 -0
- package/dist/watch-DWCqXllW.js.map +1 -0
- package/dist/watch-entry.cjs +3 -6
- package/dist/watch-entry.d.cts +1 -3
- package/dist/watch-entry.d.ts +1 -3
- package/dist/watch-entry.js +2 -2
- package/package.json +4 -14
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global configuration for @blac/core
|
|
3
|
+
*/
|
|
4
|
+
export type EqualityFn = <S>(prev: S, next: S) => boolean;
|
|
5
|
+
export interface BlacConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Equality check used by `StateContainer.applyState` to skip emits when
|
|
8
|
+
* `prev` and `next` are structurally equal. Default: `shallowEqualState`.
|
|
9
|
+
*
|
|
10
|
+
* Return `true` to skip the emit (states considered equal).
|
|
11
|
+
*/
|
|
12
|
+
equality: EqualityFn;
|
|
13
|
+
/**
|
|
14
|
+
* Circuit breaker: maximum number of live instances allowed under a single
|
|
15
|
+
* bloc constructor before `acquire` throws. Guards against runaway instance
|
|
16
|
+
* creation — typically an unstable/args-derived key churning out instances
|
|
17
|
+
* that are never disposed (a memory leak that eventually freezes the app).
|
|
18
|
+
*
|
|
19
|
+
* Default: `1000`. Set to `Infinity` (or any non-positive value) to disable.
|
|
20
|
+
*/
|
|
21
|
+
maxInstancesPerType: number;
|
|
22
|
+
/**
|
|
23
|
+
* Circuit breaker: maximum number of distinct live references (consumers)
|
|
24
|
+
* allowed on a single instance before `acquire` throws. Guards against the
|
|
25
|
+
* other leak shape — consumer cleanup (e.g. `useBloc` unmount `release`)
|
|
26
|
+
* never firing, so refs accumulate without bound on one instance.
|
|
27
|
+
*
|
|
28
|
+
* Default: `1000`. Set to `Infinity` (or any non-positive value) to disable.
|
|
29
|
+
*/
|
|
30
|
+
maxRefsPerInstance: number;
|
|
31
|
+
/**
|
|
32
|
+
* Dev-only soft circuit breaker: if a single instance emits more than this
|
|
33
|
+
* many *real* state changes within a rolling one-second window, log a single
|
|
34
|
+
* `console.warn`. This is the "frozen app" smell — almost always a tight loop
|
|
35
|
+
* (RAF/animation, or an effect that emits on every commit) pushing
|
|
36
|
+
* high-frequency data through bloc state, which then saturates subscribers,
|
|
37
|
+
* plugins (logging/devtools), and the main thread.
|
|
38
|
+
*
|
|
39
|
+
* Heuristic by nature — warns, never throws, since high-frequency state can
|
|
40
|
+
* occasionally be legitimate. No-op in production. Default: `100`. Set to
|
|
41
|
+
* `Infinity` (or any non-positive value) to disable.
|
|
42
|
+
*/
|
|
43
|
+
maxEmitsPerSecond: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Default equality: shallow per-key `Object.is` comparison.
|
|
47
|
+
* Falls through to `false` for primitives/null so reference-only state still
|
|
48
|
+
* behaves correctly.
|
|
49
|
+
*/
|
|
50
|
+
export declare const shallowEqualState: EqualityFn;
|
|
51
|
+
/**
|
|
52
|
+
* Configure global defaults for @blac/core.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { configureBlac, shallowEqualState } from '@blac/core';
|
|
57
|
+
*
|
|
58
|
+
* // Swap in a deep-equality check for all blocs
|
|
59
|
+
* configureBlac({ equality: myDeepEqual });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function configureBlac(config: Partial<BlacConfig>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get the current global configuration.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare function getBlacConfig(): BlacConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Reset configuration to defaults (useful for testing).
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export declare function resetBlacConfig(): void;
|
package/dist/constants.d.cts
CHANGED
|
@@ -34,6 +34,19 @@ export declare const BLAC_STATIC_PROPS: {
|
|
|
34
34
|
* The React adapter auto-keys via `useId()` when this is set.
|
|
35
35
|
*/
|
|
36
36
|
readonly ISOLATED: "isolated";
|
|
37
|
+
/**
|
|
38
|
+
* Per-class equality function used to short-circuit `emit`/`patch` when the
|
|
39
|
+
* new state is structurally equal to the previous state. Falls back to the
|
|
40
|
+
* global `configureBlac({ equality })` value when unset.
|
|
41
|
+
*/
|
|
42
|
+
readonly EQUALITY: "__equality";
|
|
43
|
+
/**
|
|
44
|
+
* Per-class key function: `static key = (args) => string`.
|
|
45
|
+
* When set, the registry calls `Type.key(args)` to derive the instance key
|
|
46
|
+
* instead of using a structural hash of `args`. Allows blocs to ignore
|
|
47
|
+
* non-identity fields (e.g., `readonly` flags) while still keying by id.
|
|
48
|
+
*/
|
|
49
|
+
readonly KEY: "key";
|
|
37
50
|
};
|
|
38
51
|
/**
|
|
39
52
|
* ID generation patterns and constants
|
package/dist/constants.d.ts
CHANGED
|
@@ -34,6 +34,19 @@ export declare const BLAC_STATIC_PROPS: {
|
|
|
34
34
|
* The React adapter auto-keys via `useId()` when this is set.
|
|
35
35
|
*/
|
|
36
36
|
readonly ISOLATED: "isolated";
|
|
37
|
+
/**
|
|
38
|
+
* Per-class equality function used to short-circuit `emit`/`patch` when the
|
|
39
|
+
* new state is structurally equal to the previous state. Falls back to the
|
|
40
|
+
* global `configureBlac({ equality })` value when unset.
|
|
41
|
+
*/
|
|
42
|
+
readonly EQUALITY: "__equality";
|
|
43
|
+
/**
|
|
44
|
+
* Per-class key function: `static key = (args) => string`.
|
|
45
|
+
* When set, the registry calls `Type.key(args)` to derive the instance key
|
|
46
|
+
* instead of using a structural hash of `args`. Allows blocs to ignore
|
|
47
|
+
* non-identity fields (e.g., `readonly` flags) while still keying by id.
|
|
48
|
+
*/
|
|
49
|
+
readonly KEY: "key";
|
|
37
50
|
};
|
|
38
51
|
/**
|
|
39
52
|
* ID generation patterns and constants
|
package/dist/core/Cubit.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { StateContainer } from './StateContainer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `Cubit<S>` is a `StateContainer<S>` with `emit` / `patch` exposed as
|
|
4
|
+
* public mutation surface. Today it adds nothing structurally beyond
|
|
5
|
+
* `StateContainer` — both are inherited from the underlying
|
|
6
|
+
* `StructuralContainer<S>`. Kept as a real class (not a type alias) because
|
|
7
|
+
* downstream code does `instance instanceof Cubit` checks (see A2 audit).
|
|
8
|
+
*
|
|
9
|
+
* The class body is intentionally empty: a no-op `emit` override would
|
|
10
|
+
* still go through `applyState`, and `patch` is inherited from
|
|
11
|
+
* `StructuralContainer` (path-diffed, microtask-flushed). If a caller
|
|
12
|
+
* needs the old "skip if no real change" patch semantics, they can wrap
|
|
13
|
+
* `patch` themselves or call `emit` after a manual equality check.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class Cubit<S extends object = any, Args = void, Deps extends object = Record<string, never>> extends StateContainer<S, Args, Deps> {
|
|
6
16
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { StructuralContainer, type DeepPartial, type StructuralContainerOptions } from '@dirtytalk/structural';
|
|
1
2
|
import type { StateContainerConstructor } from '../types/utilities';
|
|
2
|
-
import { EMIT } from './symbols';
|
|
3
|
+
import { APPLY_DEPS, EMIT, REMOVE_DEPS_OWNER } from './symbols';
|
|
3
4
|
export interface StateContainerConfig {
|
|
4
5
|
name?: string;
|
|
5
6
|
debug?: boolean;
|
|
6
7
|
instanceId?: string;
|
|
8
|
+
/** Args passed at acquire time; forwarded to init(). */
|
|
9
|
+
args?: unknown;
|
|
7
10
|
}
|
|
8
11
|
export type HydrationStatus = 'idle' | 'hydrating' | 'hydrated' | 'error';
|
|
9
12
|
type StateListener<S> = (state: S) => void;
|
|
@@ -22,10 +25,55 @@ export interface SystemEventPayloads<S> {
|
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
type SystemEventHandler<S, E extends SystemEvent> = (payload: SystemEventPayloads<S>[E]) => void;
|
|
25
|
-
|
|
28
|
+
/**
|
|
29
|
+
* BlaC's lifecycle/identity/dependency layer on top of `StructuralContainer`.
|
|
30
|
+
*
|
|
31
|
+
* StructuralContainer provides:
|
|
32
|
+
* - `state` getter
|
|
33
|
+
* - `emit` / `patch` / `update` (path-tracked, microtask-flushed)
|
|
34
|
+
* - `channel` (the underlying `DirtyChannel`)
|
|
35
|
+
* - `registerConsumerPaths` / `unregisterConsumer` (for fine-grained consumers)
|
|
36
|
+
* - per-class `PathInterner`
|
|
37
|
+
*
|
|
38
|
+
* StateContainer layers on:
|
|
39
|
+
* - identity (`name`, `instanceId`, `createdAt`, `debug`)
|
|
40
|
+
* - lifecycle (`dispose`, `isDisposed`, `onSystemEvent`)
|
|
41
|
+
* - hydration (`beginHydration` / `applyHydratedState` / `finishHydration` / `failHydration` / `waitForHydration`)
|
|
42
|
+
* - cross-bloc deps (`depend()`, `dependencies` getter)
|
|
43
|
+
* - per-consumer deps slices (`APPLY_DEPS` / `REMOVE_DEPS_OWNER` / `onDepsChanged`)
|
|
44
|
+
* - registry integration (config-driven equality, emit-rate circuit breaker)
|
|
45
|
+
*
|
|
46
|
+
* Subscribers can attach via:
|
|
47
|
+
* - `subscribe(listener)` — legacy state listener (back-compat); fires on
|
|
48
|
+
* every flush with the latest state.
|
|
49
|
+
* - `onSystemEvent('stateChanged' | 'dispose' | 'hydrationChanged', cb)` —
|
|
50
|
+
* coarse lifecycle events.
|
|
51
|
+
* - `this.channel.subscribe(interest, cb)` — path-scoped (new code).
|
|
52
|
+
*/
|
|
53
|
+
export declare abstract class StateContainer<S extends object = any, Args = void, Deps extends object = Record<string, never>> extends StructuralContainer<S> {
|
|
26
54
|
static __excludeFromDevTools: boolean;
|
|
27
|
-
|
|
28
|
-
|
|
55
|
+
/** @internal phantom — the args type this bloc is constructed with (see init()) */
|
|
56
|
+
readonly __args: Args;
|
|
57
|
+
/** @internal phantom — the injected deps type */
|
|
58
|
+
readonly __deps: Deps;
|
|
59
|
+
private _depsByOwner;
|
|
60
|
+
private _deps;
|
|
61
|
+
get deps(): Readonly<Deps>;
|
|
62
|
+
/**
|
|
63
|
+
* @internal Apply one owner's (consumer's) deps slice. Shallow-merges the
|
|
64
|
+
* slice, reconciles keys the owner dropped since its last apply (other
|
|
65
|
+
* owners' keys untouched), dev-warns on cross-owner key collisions, then
|
|
66
|
+
* recomputes the merged view and fires onDepsChanged if it changed.
|
|
67
|
+
*
|
|
68
|
+
* Idempotent: re-applying an identical slice for the same owner is a no-op.
|
|
69
|
+
*/
|
|
70
|
+
[APPLY_DEPS](ownerId: string, slice: Partial<Deps>): void;
|
|
71
|
+
/**
|
|
72
|
+
* @internal Withdraw an owner's entire deps slice (consumer unmounted).
|
|
73
|
+
*/
|
|
74
|
+
[REMOVE_DEPS_OWNER](ownerId: string): void;
|
|
75
|
+
private reconcileDeps;
|
|
76
|
+
protected onDepsChanged(_next: Readonly<Deps>, _prev: Readonly<Deps>): void;
|
|
29
77
|
private _disposed;
|
|
30
78
|
private _hydrationStatus;
|
|
31
79
|
private _hydrationError?;
|
|
@@ -35,19 +83,43 @@ export declare abstract class StateContainer<S extends object = any> {
|
|
|
35
83
|
private _rejectHydrationPromise?;
|
|
36
84
|
private _hydrationPromiseSettled;
|
|
37
85
|
private _config;
|
|
86
|
+
private _initCalled;
|
|
87
|
+
private _emitWindowStart;
|
|
88
|
+
private _emitCount;
|
|
89
|
+
private _emitRateWarned;
|
|
90
|
+
private readonly _listeners;
|
|
38
91
|
private readonly _systemEventHandlers;
|
|
39
92
|
private _dependencies;
|
|
40
|
-
private
|
|
93
|
+
private _pendingChange;
|
|
94
|
+
private _bridgeUnsub;
|
|
41
95
|
private _registry;
|
|
96
|
+
private _equalityFn;
|
|
42
97
|
name: string;
|
|
43
98
|
debug: boolean;
|
|
44
99
|
instanceId: string;
|
|
45
100
|
createdAt: number;
|
|
46
101
|
get dependencies(): ReadonlyMap<StateContainerConstructor, string>;
|
|
102
|
+
get args(): Args | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Declare a cross-bloc dependency. Returns a getter so callers write
|
|
105
|
+
* `this.user()` lazily — the dep is resolved against the registry on each
|
|
106
|
+
* call, which keeps the surface immune to dep-instance churn.
|
|
107
|
+
*
|
|
108
|
+
* Note: this does NOT auto-resubscribe to the dep's channel. Consumers that
|
|
109
|
+
* need reactive updates from a dep should subscribe explicitly (typically
|
|
110
|
+
* via the framework adapter / `useBloc`'s tracker). A naive auto-bridge
|
|
111
|
+
* here would cycle on mutual deps; the channel's same-tick coalescing
|
|
112
|
+
* limits the blast radius but a true mutual cycle is still a user bug.
|
|
113
|
+
*/
|
|
47
114
|
protected depend<T extends StateContainerConstructor>(Type: T, instanceKey?: string): () => InstanceType<T>;
|
|
48
|
-
constructor(initialState: S);
|
|
115
|
+
constructor(initialState: S, options?: StructuralContainerOptions);
|
|
116
|
+
/**
|
|
117
|
+
* Called once after construction with the args passed at acquire time, before the first
|
|
118
|
+
* state snapshot is read by any consumer. Override to seed args-derived state (via
|
|
119
|
+
* this.emit(...)) or kick off loads.
|
|
120
|
+
*/
|
|
121
|
+
protected init(_args: Args): void;
|
|
49
122
|
initConfig(config: StateContainerConfig): void;
|
|
50
|
-
get state(): Readonly<S>;
|
|
51
123
|
get isDisposed(): boolean;
|
|
52
124
|
get hydrationStatus(): HydrationStatus;
|
|
53
125
|
get hydrationError(): Error | undefined;
|
|
@@ -55,19 +127,47 @@ export declare abstract class StateContainer<S extends object = any> {
|
|
|
55
127
|
get changedWhileHydrating(): boolean;
|
|
56
128
|
subscribe(listener: StateListener<S>): () => void;
|
|
57
129
|
dispose(): void;
|
|
58
|
-
|
|
59
|
-
|
|
130
|
+
emit(next: S): void;
|
|
131
|
+
/**
|
|
132
|
+
* Override of `StructuralContainer.patch` that routes through the
|
|
133
|
+
* StateContainer concerns: disposed guard, dev-only emit-rate check,
|
|
134
|
+
* `_changedWhileHydrating` flag, pending-change capture (so legacy
|
|
135
|
+
* listeners and `stateChanged` system events see the merged prev/next),
|
|
136
|
+
* and the registry-level `stateChanged` notification. We still call
|
|
137
|
+
* `super.patch` so path-marking semantics (the whole point of patch) are
|
|
138
|
+
* preserved.
|
|
139
|
+
*/
|
|
140
|
+
patch(partial: DeepPartial<S>): void;
|
|
141
|
+
/**
|
|
142
|
+
* @internal @deprecated Symbol-keyed alias for `emit`. Kept only so legacy
|
|
143
|
+
* in-package tests that index with `[EMIT]` typecheck/run unchanged. C5
|
|
144
|
+
* removes this along with the `EMIT` symbol.
|
|
145
|
+
*/
|
|
146
|
+
protected [EMIT](next: S): void;
|
|
147
|
+
private applyState;
|
|
148
|
+
/**
|
|
149
|
+
* Called by the channel-bridge subscriber on each flush. Drains the
|
|
150
|
+
* pending change (if any) into legacy listeners and the 'stateChanged'
|
|
151
|
+
* system event. No pending change == flush from a no-op patch == skip.
|
|
152
|
+
*/
|
|
153
|
+
private _drainPending;
|
|
60
154
|
beginHydration(): void;
|
|
61
|
-
applyHydratedState(
|
|
155
|
+
applyHydratedState(next: S): boolean;
|
|
62
156
|
finishHydration(): void;
|
|
63
157
|
failHydration(error: Error): void;
|
|
64
158
|
waitForHydration(): Promise<void>;
|
|
65
|
-
private applyState;
|
|
66
159
|
private setHydrationStatus;
|
|
67
160
|
private ensureHydrationPromise;
|
|
68
161
|
private resolveHydration;
|
|
69
162
|
private rejectHydration;
|
|
70
163
|
protected onSystemEvent: <E extends SystemEvent>(event: E, handler: SystemEventHandler<S, E>) => (() => void);
|
|
71
164
|
private emitSystemEvent;
|
|
165
|
+
/**
|
|
166
|
+
* Dev-only soft circuit breaker. Counts real state changes in a rolling 1s
|
|
167
|
+
* window and warns once if the rate exceeds `maxEmitsPerSecond` — the
|
|
168
|
+
* signature of a runaway loop (RAF/animation or emit-on-every-commit) pushing
|
|
169
|
+
* high-frequency data through state, which freezes subscribers/plugins.
|
|
170
|
+
*/
|
|
171
|
+
private _checkEmitRate;
|
|
72
172
|
}
|
|
73
173
|
export {};
|
|
@@ -10,16 +10,18 @@ export interface InstanceEntry<T = any> {
|
|
|
10
10
|
instance: T;
|
|
11
11
|
/** Map of active reference IDs to their acquire count (supports paired acquire/release) */
|
|
12
12
|
refs: Map<string, number>;
|
|
13
|
+
/** The args used when this entry was first created; used for dev-warn on arg mismatch. */
|
|
14
|
+
args?: unknown;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Lifecycle events emitted by the registry
|
|
16
18
|
*/
|
|
17
|
-
export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased';
|
|
19
|
+
export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased' | 'depsChanged';
|
|
18
20
|
/**
|
|
19
21
|
* Listener function type for each lifecycle event
|
|
20
22
|
* @template E - The lifecycle event type
|
|
21
23
|
*/
|
|
22
|
-
export type LifecycleListener<E extends LifecycleEvent> = E extends 'created' ? (container: StateContainer<any>) => void : E extends 'stateChanged' ? (container: StateContainer<any>, previousState: any, currentState: any) => void : E extends 'disposed' ? (container: StateContainer<any>) => void : E extends 'refAcquired' ? (container: StateContainer<any>, refId: string) => void : E extends 'refReleased' ? (container: StateContainer<any>, refId: string) => void : never;
|
|
24
|
+
export type LifecycleListener<E extends LifecycleEvent> = E extends 'created' ? (container: StateContainer<any, any, any>) => void : E extends 'stateChanged' ? (container: StateContainer<any, any, any>, previousState: any, currentState: any) => 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 : never;
|
|
23
25
|
/**
|
|
24
26
|
* Central registry for managing StateContainer instances.
|
|
25
27
|
* Handles instance lifecycle, named ref tracking, and lifecycle event emission.
|
|
@@ -59,6 +61,44 @@ export declare class StateContainerRegistry {
|
|
|
59
61
|
* Get the instances Map for a specific class (public API for stats/debugging)
|
|
60
62
|
*/
|
|
61
63
|
getInstancesMap<T extends StateContainerConstructor>(Type: T): Map<string, InstanceEntry>;
|
|
64
|
+
/**
|
|
65
|
+
* Directly insert an instance entry into the registry without going through
|
|
66
|
+
* acquire/release. Creates the internal WeakMap bucket for the constructor if
|
|
67
|
+
* it does not exist yet. Replaces any existing entry for the same key.
|
|
68
|
+
*
|
|
69
|
+
* The provided instance is NOT configured or disposed here — callers are
|
|
70
|
+
* responsible for any initConfig / dispose calls. Intended for testing
|
|
71
|
+
* helpers that create stubs outside the normal acquisition path.
|
|
72
|
+
*
|
|
73
|
+
* @internal Used by testing helpers only.
|
|
74
|
+
*/
|
|
75
|
+
insertInstance<T extends StateContainerConstructor>(Type: T, instanceKey: string, instance: InstanceType<T>, refs?: Map<string, number>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve the storage key for an instance. This is the single source of truth
|
|
78
|
+
* for keying — `acquire` and `release` MUST agree, otherwise a ref taken under
|
|
79
|
+
* an args-derived key is never dropped (instance leaks).
|
|
80
|
+
*
|
|
81
|
+
* Resolution order (explicit beats derived):
|
|
82
|
+
* explicit key > `static key(args)` > structural hash of args > default sentinel.
|
|
83
|
+
*
|
|
84
|
+
* @param Type - The StateContainer class constructor
|
|
85
|
+
* @param instanceKey - Explicit key, or undefined to derive from args
|
|
86
|
+
* @param args - Construction args used for structural/`static key` derivation
|
|
87
|
+
*/
|
|
88
|
+
resolveKey<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey: string | undefined, args: unknown): string;
|
|
89
|
+
/**
|
|
90
|
+
* Circuit breaker for runaway instance creation. Throws when a single
|
|
91
|
+
* constructor would exceed `maxInstancesPerType` live instances — almost
|
|
92
|
+
* always an unstable instance key (e.g. a new object/array passed as `args`
|
|
93
|
+
* every render, or a missing `static key`) leaking an instance per render.
|
|
94
|
+
*/
|
|
95
|
+
private assertInstanceLimit;
|
|
96
|
+
/**
|
|
97
|
+
* Circuit breaker for runaway reference growth. Throws when one instance
|
|
98
|
+
* accumulates more than `maxRefsPerInstance` distinct live refs — almost
|
|
99
|
+
* always consumer cleanup (e.g. `useBloc`'s unmount `release`) never firing.
|
|
100
|
+
*/
|
|
101
|
+
private assertRefLimit;
|
|
62
102
|
/**
|
|
63
103
|
* Acquire an instance with ref tracking (ownership semantics).
|
|
64
104
|
* Creates a new instance if one doesn't exist, or returns existing and adds a ref.
|
|
@@ -71,10 +111,11 @@ export declare class StateContainerRegistry {
|
|
|
71
111
|
* @param options.refId - Named reference ID for debugging; auto-generated if omitted
|
|
72
112
|
* @returns The state container instance
|
|
73
113
|
*/
|
|
74
|
-
acquire<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string, options?: {
|
|
114
|
+
acquire<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string | undefined, options?: {
|
|
75
115
|
canCreate?: boolean;
|
|
76
116
|
countRef?: boolean;
|
|
77
117
|
refId?: string;
|
|
118
|
+
args?: unknown;
|
|
78
119
|
}): InstanceType<T>;
|
|
79
120
|
/**
|
|
80
121
|
* Borrow an existing instance without adding a ref (borrowing semantics).
|
|
@@ -107,10 +148,12 @@ export declare class StateContainerRegistry {
|
|
|
107
148
|
* Use this in bloc-to-bloc communication when you need to ensure an instance exists
|
|
108
149
|
* but don't want to claim ownership (no ref added).
|
|
109
150
|
* @param Type - The StateContainer class constructor
|
|
110
|
-
* @param instanceKey -
|
|
151
|
+
* @param instanceKey - Explicit instance key, or undefined to derive from `args`
|
|
152
|
+
* (`static key(args)` / structural hash), matching `acquire`.
|
|
153
|
+
* @param args - Construction args; used for keying when no explicit key is given
|
|
111
154
|
* @returns The state container instance
|
|
112
155
|
*/
|
|
113
|
-
ensure<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string): InstanceType<T>;
|
|
156
|
+
ensure<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string | undefined, args?: unknown): InstanceType<T>;
|
|
114
157
|
/**
|
|
115
158
|
* Release a reference to an instance.
|
|
116
159
|
* Removes the ref and disposes when refs is empty (unless keepAlive).
|
|
@@ -192,17 +235,18 @@ export declare class StateContainerRegistry {
|
|
|
192
235
|
* Emit lifecycle event to all listeners
|
|
193
236
|
* @internal - Called by StateContainer lifecycle methods
|
|
194
237
|
*/
|
|
195
|
-
emit(event: 'created', container: StateContainer<any>): void;
|
|
196
|
-
emit(event: 'disposed', container: StateContainer<any>): void;
|
|
197
|
-
emit(event: 'stateChanged', container: StateContainer<any>, previousState: any, currentState: any): void;
|
|
198
|
-
emit(event: 'refAcquired', container: StateContainer<any>, refId: string): void;
|
|
199
|
-
emit(event: 'refReleased', container: StateContainer<any>, refId: string): void;
|
|
238
|
+
emit(event: 'created', container: StateContainer<any, any, any>): void;
|
|
239
|
+
emit(event: 'disposed', container: StateContainer<any, any, any>): void;
|
|
240
|
+
emit(event: 'stateChanged', container: StateContainer<any, any, any>, previousState: any, currentState: any): void;
|
|
241
|
+
emit(event: 'refAcquired', container: StateContainer<any, any, any>, refId: string): void;
|
|
242
|
+
emit(event: 'refReleased', container: StateContainer<any, any, any>, refId: string): void;
|
|
243
|
+
emit(event: 'depsChanged', container: StateContainer<any, any, any>, previousDeps: Readonly<Record<string, unknown>>, currentDeps: Readonly<Record<string, unknown>>): void;
|
|
200
244
|
/**
|
|
201
245
|
* Schedule a deferred stateChanged notification via microtask.
|
|
202
246
|
* Skips entirely when no stateChanged listeners are registered.
|
|
203
247
|
* @internal - Called by StateContainer.applyState
|
|
204
248
|
*/
|
|
205
|
-
notifyStateChanged(container: StateContainer<any>, previousState: any, newState: any): void;
|
|
249
|
+
notifyStateChanged(container: StateContainer<any, any, any>, previousState: any, newState: any): void;
|
|
206
250
|
private flushStateChanged;
|
|
207
251
|
}
|
|
208
252
|
/**
|
package/dist/core/symbols.d.ts
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal @deprecated Symbol-keyed mutation entry point on `StateContainer`.
|
|
3
|
+
*
|
|
4
|
+
* Per A2 audit (`plans/blac-core-migration/_audit.md`), this symbol has zero
|
|
5
|
+
* external consumers — only in-package tests still reference it. C0 keeps it
|
|
6
|
+
* as a thin alias for `emit()` so the existing test files typecheck and run
|
|
7
|
+
* unchanged; C5 will port those tests to use `emit()` directly and delete
|
|
8
|
+
* this symbol along with its `[EMIT]` method on `StateContainer`.
|
|
9
|
+
*
|
|
10
|
+
* Do not add new uses of this symbol.
|
|
11
|
+
*/
|
|
1
12
|
export declare const EMIT: unique symbol;
|
|
13
|
+
/**
|
|
14
|
+
* @internal Apply one owner's (consumer's) deps slice to an instance.
|
|
15
|
+
* Called by framework adapters (e.g. @blac/react useBloc) — not public API.
|
|
16
|
+
*
|
|
17
|
+
* Kept until D0 ports `useBloc` off the legacy adapter surface. See A2 audit
|
|
18
|
+
* (`plans/blac-core-migration/_audit.md`) for the consumer list.
|
|
19
|
+
*/
|
|
20
|
+
export declare const APPLY_DEPS: unique symbol;
|
|
21
|
+
/**
|
|
22
|
+
* @internal Withdraw one owner's entire deps slice (consumer unmounted).
|
|
23
|
+
* Called by framework adapters — not public API.
|
|
24
|
+
*
|
|
25
|
+
* Kept until D0 ports `useBloc`. See A2 audit for the consumer list.
|
|
26
|
+
*/
|
|
27
|
+
export declare const REMOVE_DEPS_OWNER: unique symbol;
|
package/dist/debug.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_StateContainerRegistry = require("./StateContainerRegistry-
|
|
3
|
-
const require_config = require("./config-
|
|
4
|
-
const require_management = require("./management-
|
|
2
|
+
const require_StateContainerRegistry = require("./StateContainerRegistry-B4yVMYbx.cjs");
|
|
3
|
+
const require_config = require("./config-B_4xXpvK.cjs");
|
|
4
|
+
const require_management = require("./management-DTzcC6aD.cjs");
|
|
5
5
|
exports.forEach = require_management.forEach;
|
|
6
6
|
exports.getAll = require_management.getAll;
|
|
7
7
|
exports.getRefCount = require_management.getRefCount;
|
package/dist/debug.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as globalRegistry } from "./StateContainerRegistry-
|
|
2
|
-
import { n as getStats, r as setRegistry, t as getRegistry } from "./config-
|
|
3
|
-
import { a as getAll, c as hasInstance, i as forEach, o as getRefCount, r as register, s as getRefIds } from "./management-
|
|
1
|
+
import { r as globalRegistry } from "./StateContainerRegistry-DmmzYa7S.js";
|
|
2
|
+
import { n as getStats, r as setRegistry, t as getRegistry } from "./config-DoHx0Xsl.js";
|
|
3
|
+
import { a as getAll, c as hasInstance, i as forEach, o as getRefCount, r as register, s as getRefIds } from "./management-H4m3ciJO.js";
|
|
4
4
|
export { forEach, getAll, getRefCount, getRefIds, getRegistry, getStats, globalRegistry, hasInstance, register, setRegistry };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EqualityFn } from '../config';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration options for the @blac decorator.
|
|
3
4
|
* Only one option can be specified at a time (union type).
|
|
@@ -10,6 +11,22 @@ export type BlacOptions =
|
|
|
10
11
|
/** Exclude bloc from DevTools tracking (prevents infinite loops) */
|
|
11
12
|
| {
|
|
12
13
|
excludeFromDevTools: true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Override the global equality check for this bloc.
|
|
17
|
+
* Return `true` to skip the emit (states considered equal).
|
|
18
|
+
*/
|
|
19
|
+
| {
|
|
20
|
+
equality: EqualityFn;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Override the default structural-hash identity key.
|
|
24
|
+
* The function receives `args` and returns the instance key string.
|
|
25
|
+
* Distinct return values → distinct instances; identical values → shared instance.
|
|
26
|
+
* Non-identity fields can be excluded so they don't fork new instances.
|
|
27
|
+
*/
|
|
28
|
+
| {
|
|
29
|
+
key: (args: any) => string;
|
|
13
30
|
};
|
|
14
31
|
/**
|
|
15
32
|
* Decorator to configure StateContainer classes.
|
package/dist/ensure-9VEq5H0L.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as getRegistry } from
|
|
1
|
+
import { t as getRegistry } from './config-CR_Bz7RD.js';
|
|
2
2
|
//#region src/registry/ensure.ts
|
|
3
3
|
function ensure(BlocClass, instanceKey) {
|
|
4
|
-
|
|
4
|
+
return getRegistry().ensure(BlocClass, instanceKey);
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ensure as t };
|
|
8
8
|
|
|
9
|
-
//# sourceMappingURL=ensure-9VEq5H0L.js.map
|
|
9
|
+
//# sourceMappingURL=ensure-9VEq5H0L.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_config = require("./config-B_4xXpvK.cjs");
|
|
2
|
+
//#region src/registry/ensure.ts
|
|
3
|
+
function ensure(BlocClass, instanceKey, args) {
|
|
4
|
+
return require_config.getRegistry().ensure(BlocClass, instanceKey, args);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
Object.defineProperty(exports, "ensure", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function() {
|
|
10
|
+
return ensure;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=ensure-BB6xHQAF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-BB6xHQAF.cjs","names":["getRegistry"],"sources":["../src/registry/ensure.ts"],"sourcesContent":["import { getRegistry } from './config';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n} from '../types/utilities';\n\nexport function ensure<T extends StateContainerConstructor>(\n BlocClass: T,\n instanceKey?: string,\n args?: ExtractArgs<T>,\n): InstanceType<T> {\n return getRegistry().ensure(BlocClass, instanceKey, args);\n}\n"],"mappings":";;AAMA,SAAgB,OACd,WACA,aACA,MACiB;CACjB,OAAOA,eAAAA,aAAa,CAAC,OAAO,WAAW,aAAa,KAAK"}
|
package/dist/ensure-BNDfTzqg.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const require_config = require(
|
|
1
|
+
const require_config = require('./config-CTOa-yPN.cjs');
|
|
2
2
|
//#region src/registry/ensure.ts
|
|
3
3
|
function ensure(BlocClass, instanceKey) {
|
|
4
|
-
|
|
4
|
+
return require_config.getRegistry().ensure(BlocClass, instanceKey);
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
Object.defineProperty(exports,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Object.defineProperty(exports, 'ensure', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return ensure;
|
|
11
|
+
},
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=ensure-BNDfTzqg.cjs.map
|
|
14
|
+
//# sourceMappingURL=ensure-BNDfTzqg.cjs.map
|