@blac/core 2.0.18 → 2.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/StateContainerRegistry-8zNFMAf7.js +1067 -0
  2. package/dist/StateContainerRegistry-8zNFMAf7.js.map +1 -0
  3. package/dist/StateContainerRegistry-Bx2ly-ba.cjs +1162 -0
  4. package/dist/StateContainerRegistry-Bx2ly-ba.cjs.map +1 -0
  5. package/dist/StateContainerRegistry-C0dCNlTF.js +1005 -0
  6. package/dist/StateContainerRegistry-C0dCNlTF.js.map +1 -0
  7. package/dist/StateContainerRegistry-CS18y4au.cjs +1163 -0
  8. package/dist/StateContainerRegistry-CS18y4au.cjs.map +1 -0
  9. package/dist/StateContainerRegistry-CchRjnjX.cjs +1094 -0
  10. package/dist/StateContainerRegistry-CchRjnjX.cjs.map +1 -0
  11. package/dist/StateContainerRegistry-D8nu7Z0T.js +1068 -0
  12. package/dist/StateContainerRegistry-D8nu7Z0T.js.map +1 -0
  13. package/dist/StateContainerRegistry-D9BIRjwv.cjs +1088 -0
  14. package/dist/StateContainerRegistry-D9BIRjwv.cjs.map +1 -0
  15. package/dist/StateContainerRegistry-DVIBTxGZ.js +999 -0
  16. package/dist/StateContainerRegistry-DVIBTxGZ.js.map +1 -0
  17. package/dist/StateContainerRegistry-Dj77cok9.js +1005 -0
  18. package/dist/StateContainerRegistry-Dj77cok9.js.map +1 -0
  19. package/dist/StateContainerRegistry-lIwo-0m3.cjs +1094 -0
  20. package/dist/StateContainerRegistry-lIwo-0m3.cjs.map +1 -0
  21. package/dist/acquire-B1LYXSGj.js +35 -0
  22. package/dist/acquire-B1LYXSGj.js.map +1 -0
  23. package/dist/acquire-BJ3xUEmh.cjs +46 -0
  24. package/dist/acquire-BJ3xUEmh.cjs.map +1 -0
  25. package/dist/acquire-BRIJVJaA.js +35 -0
  26. package/dist/acquire-BRIJVJaA.js.map +1 -0
  27. package/dist/acquire-B_p1fNEh.cjs +46 -0
  28. package/dist/acquire-B_p1fNEh.cjs.map +1 -0
  29. package/dist/acquire-BdsVZBSe.js +35 -0
  30. package/dist/acquire-BdsVZBSe.js.map +1 -0
  31. package/dist/acquire-C3nOb3XR.cjs +46 -0
  32. package/dist/acquire-C3nOb3XR.cjs.map +1 -0
  33. package/dist/acquire-C4WAS13G.cjs +46 -0
  34. package/dist/acquire-C4WAS13G.cjs.map +1 -0
  35. package/dist/acquire-C7beGI55.cjs +46 -0
  36. package/dist/acquire-C7beGI55.cjs.map +1 -0
  37. package/dist/acquire-DXEQDZGr.js +35 -0
  38. package/dist/acquire-DXEQDZGr.js.map +1 -0
  39. package/dist/acquire-Dg-uXwjF.js +35 -0
  40. package/dist/acquire-Dg-uXwjF.js.map +1 -0
  41. package/dist/config-B1l8ZGlU.cjs +32 -0
  42. package/dist/config-B1l8ZGlU.cjs.map +1 -0
  43. package/dist/config-CzcoAvBo.js +16 -0
  44. package/dist/config-CzcoAvBo.js.map +1 -0
  45. package/dist/config-D6BoWWPv.js +16 -0
  46. package/dist/config-D6BoWWPv.js.map +1 -0
  47. package/dist/config-DOO82lbZ.js +16 -0
  48. package/dist/config-DOO82lbZ.js.map +1 -0
  49. package/dist/config-DVM_ESQt.js +16 -0
  50. package/dist/config-DVM_ESQt.js.map +1 -0
  51. package/dist/config-DWUq7zEQ.cjs +32 -0
  52. package/dist/config-DWUq7zEQ.cjs.map +1 -0
  53. package/dist/config-DXI3kzmA.js +16 -0
  54. package/dist/config-DXI3kzmA.js.map +1 -0
  55. package/dist/config-cwaTn5oy.cjs +32 -0
  56. package/dist/config-cwaTn5oy.cjs.map +1 -0
  57. package/dist/config-d9_U58ef.cjs +32 -0
  58. package/dist/config-d9_U58ef.cjs.map +1 -0
  59. package/dist/config-hWTayX76.cjs +32 -0
  60. package/dist/config-hWTayX76.cjs.map +1 -0
  61. package/dist/core/StateContainer.d.ts +7 -1
  62. package/dist/core/StateContainerRegistry.d.ts +31 -3
  63. package/dist/core/symbols.d.ts +6 -0
  64. package/dist/debug.cjs +3 -3
  65. package/dist/debug.js +3 -3
  66. package/dist/ensure-B1dEDsZV.cjs +559 -0
  67. package/dist/ensure-B1dEDsZV.cjs.map +1 -0
  68. package/dist/ensure-B2DYCbbI.cjs +578 -0
  69. package/dist/ensure-B2DYCbbI.cjs.map +1 -0
  70. package/dist/ensure-B59ri8oo.js +555 -0
  71. package/dist/ensure-B59ri8oo.js.map +1 -0
  72. package/dist/ensure-BKdq5xsY.cjs +578 -0
  73. package/dist/ensure-BKdq5xsY.cjs.map +1 -0
  74. package/dist/ensure-BSJHkUNX.js +555 -0
  75. package/dist/ensure-BSJHkUNX.js.map +1 -0
  76. package/dist/ensure-Bm91o37h.js +536 -0
  77. package/dist/ensure-Bm91o37h.js.map +1 -0
  78. package/dist/ensure-CQimeD0I.cjs +559 -0
  79. package/dist/ensure-CQimeD0I.cjs.map +1 -0
  80. package/dist/ensure-DTTTd2h8.js +536 -0
  81. package/dist/ensure-DTTTd2h8.js.map +1 -0
  82. package/dist/ensure-VuiNPccZ.cjs +559 -0
  83. package/dist/ensure-VuiNPccZ.cjs.map +1 -0
  84. package/dist/ensure-vxAGa2v3.js +536 -0
  85. package/dist/ensure-vxAGa2v3.js.map +1 -0
  86. package/dist/index.cjs +7 -6
  87. package/dist/index.d.cts +3 -3
  88. package/dist/index.d.ts +3 -3
  89. package/dist/index.js +7 -7
  90. package/dist/management-AFuqQEwz.js +38 -0
  91. package/dist/management-AFuqQEwz.js.map +1 -0
  92. package/dist/management-BodVLAfJ.cjs +85 -0
  93. package/dist/management-BodVLAfJ.cjs.map +1 -0
  94. package/dist/management-C-WGcwPD.js +38 -0
  95. package/dist/management-C-WGcwPD.js.map +1 -0
  96. package/dist/management-C2wv4vGS.cjs +85 -0
  97. package/dist/management-C2wv4vGS.cjs.map +1 -0
  98. package/dist/management-D2pjr38g.js +38 -0
  99. package/dist/management-D2pjr38g.js.map +1 -0
  100. package/dist/management-D5WsZoTV.js +38 -0
  101. package/dist/management-D5WsZoTV.js.map +1 -0
  102. package/dist/management-DwO0nBzL.cjs +85 -0
  103. package/dist/management-DwO0nBzL.cjs.map +1 -0
  104. package/dist/management-P_Vi_cvw.js +38 -0
  105. package/dist/management-P_Vi_cvw.js.map +1 -0
  106. package/dist/management-QWLpbXlW.cjs +85 -0
  107. package/dist/management-QWLpbXlW.cjs.map +1 -0
  108. package/dist/management-iE4x6IQY.cjs +85 -0
  109. package/dist/management-iE4x6IQY.cjs.map +1 -0
  110. package/dist/plugin/PluginManager.d.ts +14 -1
  111. package/dist/plugins.cjs +1 -1
  112. package/dist/plugins.js +1 -1
  113. package/dist/testing.cjs +4 -4
  114. package/dist/testing.js +4 -4
  115. package/dist/utils/idGenerator.d.ts +0 -36
  116. package/dist/watch/watch.d.ts +6 -0
  117. package/dist/watch-B0pUfh-v.cjs +119 -0
  118. package/dist/watch-B0pUfh-v.cjs.map +1 -0
  119. package/dist/watch-BHfCtbn1.cjs +119 -0
  120. package/dist/watch-BHfCtbn1.cjs.map +1 -0
  121. package/dist/watch-Bx0y-Kcc.js +108 -0
  122. package/dist/watch-Bx0y-Kcc.js.map +1 -0
  123. package/dist/watch-D01MdwKy.js +108 -0
  124. package/dist/watch-D01MdwKy.js.map +1 -0
  125. package/dist/watch-DkDGmGAx.cjs +119 -0
  126. package/dist/watch-DkDGmGAx.cjs.map +1 -0
  127. package/dist/watch-DttHqefn.js +108 -0
  128. package/dist/watch-DttHqefn.js.map +1 -0
  129. package/dist/watch-DxdIZjpt.cjs +119 -0
  130. package/dist/watch-DxdIZjpt.cjs.map +1 -0
  131. package/dist/watch-DztcJuUy.cjs +119 -0
  132. package/dist/watch-DztcJuUy.cjs.map +1 -0
  133. package/dist/watch-IrR8G28N.js +108 -0
  134. package/dist/watch-IrR8G28N.js.map +1 -0
  135. package/dist/watch-entry.cjs +1 -1
  136. package/dist/watch-entry.js +1 -1
  137. package/dist/watch-hx0r92Zc.js +108 -0
  138. package/dist/watch-hx0r92Zc.js.map +1 -0
  139. package/package.json +2 -2
@@ -0,0 +1,35 @@
1
+ import { t as getRegistry } from "./config-DVM_ESQt.js";
2
+ //#region src/registry/acquire.ts
3
+ /**
4
+ * Acquire an instance with ref tracking (ownership semantics). Instance
5
+ * identity is derived purely from `args` (via the class's `static key(args)`,
6
+ * a structural hash of `args`, or the default sentinel when there are none).
7
+ *
8
+ * @param BlocClass - The StateContainer class constructor
9
+ * @param opts.args - Construction/identity args; derives the instance key
10
+ * @param opts.refId - Named reference ID for debugging; auto-generated if omitted
11
+ */
12
+ function acquire(BlocClass, opts) {
13
+ const registry = getRegistry();
14
+ const key = registry.resolveKey(BlocClass, void 0, opts?.args);
15
+ return registry.acquire(BlocClass, key, {
16
+ canCreate: true,
17
+ countRef: true,
18
+ refId: opts?.refId,
19
+ args: opts?.args
20
+ });
21
+ }
22
+ /**
23
+ * Resolve the storage key an instance would be acquired under, given its
24
+ * construction `args`. This is the canonical key-computation path. Callers that
25
+ * both acquire and release against the `@internal` registry tier (e.g.
26
+ * `@blac/react` `useBloc`) must use this once and pass the same resolved key to
27
+ * both, so the ref is dropped under the key it was taken.
28
+ */
29
+ function resolveInstanceKey(BlocClass, args) {
30
+ return getRegistry().resolveKey(BlocClass, void 0, args);
31
+ }
32
+ //#endregion
33
+ export { resolveInstanceKey as n, acquire as t };
34
+
35
+ //# sourceMappingURL=acquire-Dg-uXwjF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquire-Dg-uXwjF.js","names":[],"sources":["../src/registry/acquire.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 - Construction/identity args; derives the instance key\n * @param opts.refId - Named reference ID for debugging; auto-generated if 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"],"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"}
@@ -0,0 +1,32 @@
1
+ //#region src/registry/config.ts
2
+ let _registry = require("./StateContainerRegistry-lIwo-0m3.cjs").globalRegistry;
3
+ function getRegistry() {
4
+ return _registry;
5
+ }
6
+ function setRegistry(registry) {
7
+ _registry = registry;
8
+ }
9
+ function getStats() {
10
+ return _registry.getStats();
11
+ }
12
+ //#endregion
13
+ Object.defineProperty(exports, "getRegistry", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return getRegistry;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "getStats", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return getStats;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "setRegistry", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return setRegistry;
29
+ }
30
+ });
31
+
32
+ //# sourceMappingURL=config-B1l8ZGlU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-B1l8ZGlU.cjs","names":["globalRegistry"],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";AAKA,IAAI,2DAAYA,EAAAA;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,16 @@
1
+ import { r as globalRegistry } from "./StateContainerRegistry-Dj77cok9.js";
2
+ //#region src/registry/config.ts
3
+ let _registry = globalRegistry;
4
+ function getRegistry() {
5
+ return _registry;
6
+ }
7
+ function setRegistry(registry) {
8
+ _registry = registry;
9
+ }
10
+ function getStats() {
11
+ return _registry.getStats();
12
+ }
13
+ //#endregion
14
+ export { getStats as n, setRegistry as r, getRegistry as t };
15
+
16
+ //# sourceMappingURL=config-CzcoAvBo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CzcoAvBo.js","names":[],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";;AAKA,IAAI,YAAY;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,16 @@
1
+ import { r as globalRegistry } from "./StateContainerRegistry-C0dCNlTF.js";
2
+ //#region src/registry/config.ts
3
+ let _registry = globalRegistry;
4
+ function getRegistry() {
5
+ return _registry;
6
+ }
7
+ function setRegistry(registry) {
8
+ _registry = registry;
9
+ }
10
+ function getStats() {
11
+ return _registry.getStats();
12
+ }
13
+ //#endregion
14
+ export { getStats as n, setRegistry as r, getRegistry as t };
15
+
16
+ //# sourceMappingURL=config-D6BoWWPv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-D6BoWWPv.js","names":[],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";;AAKA,IAAI,YAAY;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,16 @@
1
+ import { r as globalRegistry } from "./StateContainerRegistry-8zNFMAf7.js";
2
+ //#region src/registry/config.ts
3
+ let _registry = globalRegistry;
4
+ function getRegistry() {
5
+ return _registry;
6
+ }
7
+ function setRegistry(registry) {
8
+ _registry = registry;
9
+ }
10
+ function getStats() {
11
+ return _registry.getStats();
12
+ }
13
+ //#endregion
14
+ export { getStats as n, setRegistry as r, getRegistry as t };
15
+
16
+ //# sourceMappingURL=config-DOO82lbZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DOO82lbZ.js","names":[],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";;AAKA,IAAI,YAAY;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,16 @@
1
+ import { r as globalRegistry } from "./StateContainerRegistry-DVIBTxGZ.js";
2
+ //#region src/registry/config.ts
3
+ let _registry = globalRegistry;
4
+ function getRegistry() {
5
+ return _registry;
6
+ }
7
+ function setRegistry(registry) {
8
+ _registry = registry;
9
+ }
10
+ function getStats() {
11
+ return _registry.getStats();
12
+ }
13
+ //#endregion
14
+ export { getStats as n, setRegistry as r, getRegistry as t };
15
+
16
+ //# sourceMappingURL=config-DVM_ESQt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DVM_ESQt.js","names":[],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";;AAKA,IAAI,YAAY;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,32 @@
1
+ //#region src/registry/config.ts
2
+ let _registry = require("./StateContainerRegistry-CS18y4au.cjs").globalRegistry;
3
+ function getRegistry() {
4
+ return _registry;
5
+ }
6
+ function setRegistry(registry) {
7
+ _registry = registry;
8
+ }
9
+ function getStats() {
10
+ return _registry.getStats();
11
+ }
12
+ //#endregion
13
+ Object.defineProperty(exports, "getRegistry", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return getRegistry;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "getStats", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return getStats;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "setRegistry", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return setRegistry;
29
+ }
30
+ });
31
+
32
+ //# sourceMappingURL=config-DWUq7zEQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DWUq7zEQ.cjs","names":["globalRegistry"],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";AAKA,IAAI,2DAAYA,EAAAA;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,16 @@
1
+ import { r as globalRegistry } from "./StateContainerRegistry-D8nu7Z0T.js";
2
+ //#region src/registry/config.ts
3
+ let _registry = globalRegistry;
4
+ function getRegistry() {
5
+ return _registry;
6
+ }
7
+ function setRegistry(registry) {
8
+ _registry = registry;
9
+ }
10
+ function getStats() {
11
+ return _registry.getStats();
12
+ }
13
+ //#endregion
14
+ export { getStats as n, setRegistry as r, getRegistry as t };
15
+
16
+ //# sourceMappingURL=config-DXI3kzmA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DXI3kzmA.js","names":[],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";;AAKA,IAAI,YAAY;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,32 @@
1
+ //#region src/registry/config.ts
2
+ let _registry = require("./StateContainerRegistry-Bx2ly-ba.cjs").globalRegistry;
3
+ function getRegistry() {
4
+ return _registry;
5
+ }
6
+ function setRegistry(registry) {
7
+ _registry = registry;
8
+ }
9
+ function getStats() {
10
+ return _registry.getStats();
11
+ }
12
+ //#endregion
13
+ Object.defineProperty(exports, "getRegistry", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return getRegistry;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "getStats", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return getStats;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "setRegistry", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return setRegistry;
29
+ }
30
+ });
31
+
32
+ //# sourceMappingURL=config-cwaTn5oy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-cwaTn5oy.cjs","names":["globalRegistry"],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";AAKA,IAAI,2DAAYA,EAAAA;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,32 @@
1
+ //#region src/registry/config.ts
2
+ let _registry = require("./StateContainerRegistry-CchRjnjX.cjs").globalRegistry;
3
+ function getRegistry() {
4
+ return _registry;
5
+ }
6
+ function setRegistry(registry) {
7
+ _registry = registry;
8
+ }
9
+ function getStats() {
10
+ return _registry.getStats();
11
+ }
12
+ //#endregion
13
+ Object.defineProperty(exports, "getRegistry", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return getRegistry;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "getStats", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return getStats;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "setRegistry", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return setRegistry;
29
+ }
30
+ });
31
+
32
+ //# sourceMappingURL=config-d9_U58ef.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-d9_U58ef.cjs","names":["globalRegistry"],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";AAKA,IAAI,2DAAYA,EAAAA;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -0,0 +1,32 @@
1
+ //#region src/registry/config.ts
2
+ let _registry = require("./StateContainerRegistry-D9BIRjwv.cjs").globalRegistry;
3
+ function getRegistry() {
4
+ return _registry;
5
+ }
6
+ function setRegistry(registry) {
7
+ _registry = registry;
8
+ }
9
+ function getStats() {
10
+ return _registry.getStats();
11
+ }
12
+ //#endregion
13
+ Object.defineProperty(exports, "getRegistry", {
14
+ enumerable: true,
15
+ get: function() {
16
+ return getRegistry;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "getStats", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return getStats;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "setRegistry", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return setRegistry;
29
+ }
30
+ });
31
+
32
+ //# sourceMappingURL=config-hWTayX76.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-hWTayX76.cjs","names":["globalRegistry"],"sources":["../src/registry/config.ts"],"sourcesContent":["import {\n globalRegistry,\n StateContainerRegistry,\n} from '../core/StateContainerRegistry';\n\nlet _registry = globalRegistry;\n\nexport function getRegistry(): StateContainerRegistry {\n return _registry;\n}\n\nexport function setRegistry(registry: StateContainerRegistry): void {\n _registry = registry;\n}\n\nexport function getStats(): {\n registeredTypes: number;\n totalInstances: number;\n typeBreakdown: Record<string, number>;\n} {\n return _registry.getStats();\n}\n"],"mappings":";AAKA,IAAI,2DAAYA,EAAAA;AAEhB,SAAgB,cAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,YAAY,UAAwC;CAClE,YAAY;AACd;AAEA,SAAgB,WAId;CACA,OAAO,UAAU,SAAS;AAC5B"}
@@ -1,6 +1,6 @@
1
1
  import { StructuralContainer, type DeepPartial, type StructuralContainerOptions } from '@dirtytalk/structural';
2
2
  import type { ExtractArgs, ExtractState, StateContainerConstructor } from '../types/utilities';
3
- import { APPLY_DEPS, INIT_CONFIG, REMOVE_DEPS_OWNER } from './symbols';
3
+ import { APPLY_DEPS, INIT_CONFIG, ON_DISPOSE, REMOVE_DEPS_OWNER } from './symbols';
4
4
  import { type BlacMeta } from './meta';
5
5
  /**
6
6
  * Brand symbol carried (non-enumerable) on every handle returned by
@@ -104,6 +104,12 @@ export declare abstract class StateContainer<S extends object = any, Args = void
104
104
  * @internal Withdraw an owner's entire deps slice (consumer unmounted).
105
105
  */
106
106
  [REMOVE_DEPS_OWNER](ownerId: string): void;
107
+ /**
108
+ * @internal Subscribe to this instance's own disposal. Delegates to the
109
+ * per-instance `'dispose'` system event — used by `watch()` in place of
110
+ * filtering the global registry `'disposed'` event.
111
+ */
112
+ [ON_DISPOSE](handler: () => void): () => void;
107
113
  private reconcileDeps;
108
114
  protected onDepsChanged(_next: Readonly<Deps>, _prev: Readonly<Deps>): void;
109
115
  private _disposed;
@@ -1,4 +1,4 @@
1
- import type { StateContainer } from './StateContainer';
1
+ import type { HydrationStatus, StateContainer } from './StateContainer';
2
2
  import { type PluginManager } from '../plugin/PluginManager';
3
3
  import { InstanceReadonlyState, StateContainerConstructor } from '../types/utilities';
4
4
  /**
@@ -12,16 +12,20 @@ export interface InstanceEntry<T = any> {
12
12
  refs: Map<string, number>;
13
13
  /** The args used when this entry was first created; used for dev-warn on arg mismatch. */
14
14
  args?: unknown;
15
+ /** Memoized structuralKey(args) for the dev arg-mismatch warning. */
16
+ argsKey?: string;
17
+ /** `depend()`-owners currently holding this instance (see `acquire`'s `dependent` option). */
18
+ dependents?: Set<StateContainer<any, any, any>>;
15
19
  }
16
20
  /**
17
21
  * Lifecycle events emitted by the registry
18
22
  */
19
- export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased' | 'depsChanged';
23
+ export type LifecycleEvent = 'created' | 'stateChanged' | 'disposed' | 'refAcquired' | 'refReleased' | 'depsChanged' | 'hydrationChanged';
20
24
  /**
21
25
  * Listener function type for each lifecycle event
22
26
  * @template E - The lifecycle event type
23
27
  */
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;
28
+ 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 : E extends 'hydrationChanged' ? (container: StateContainer<any, any, any>, status: HydrationStatus, previousStatus: HydrationStatus) => void : never;
25
29
  /**
26
30
  * Central registry for managing StateContainer instances.
27
31
  * Handles instance lifecycle, named ref tracking, and lifecycle event emission.
@@ -45,6 +49,26 @@ export declare class StateContainerRegistry {
45
49
  get hasStateChangedListeners(): boolean;
46
50
  private _pendingStateChanges;
47
51
  private _autoRefIdCounter;
52
+ constructor();
53
+ /**
54
+ * Registry-internal reaction to any instance's `disposed` lifecycle event.
55
+ * If the disposing container is itself tracked in this registry (i.e. it
56
+ * was `acquire()`/`ensure()`'d, not a bare `new`), prune its Map entry and
57
+ * release its dependent edges on whatever it `depend()`'d on.
58
+ */
59
+ private _handleDisposed;
60
+ /**
61
+ * Remove the Map entry for `container`, if this registry is tracking it.
62
+ * @returns true if an entry was found and removed
63
+ */
64
+ private _pruneEntry;
65
+ /**
66
+ * Drop `dependent`'s edge on the `Type`/`key` entry (a `depend()`-resolved
67
+ * instance). When that leaves the entry with no dependents AND no public
68
+ * refs AND it isn't keepAlive, dispose it — this recurses into the same
69
+ * `disposed` listener, so dep-of-dep chains unwind naturally.
70
+ */
71
+ private _releaseDependent;
48
72
  /**
49
73
  * Register a type for lifecycle event tracking
50
74
  * @param constructor - The StateContainer class constructor
@@ -112,6 +136,8 @@ export declare class StateContainerRegistry {
112
136
  * @param options.canCreate - Whether to create new instance if not found (default: true)
113
137
  * @param options.countRef - Whether to add a reference (default: true)
114
138
  * @param options.refId - Named reference ID for debugging; auto-generated if omitted
139
+ * @param options.dependent - The `depend()`-owner resolving this instance, if any;
140
+ * recorded so its dependent edge can be released on the owner's disposal.
115
141
  * @returns The state container instance
116
142
  */
117
143
  acquire<T extends StateContainerConstructor = StateContainerConstructor>(Type: T, instanceKey?: string, options?: {
@@ -119,6 +145,7 @@ export declare class StateContainerRegistry {
119
145
  countRef?: boolean;
120
146
  refId?: string;
121
147
  args?: unknown;
148
+ dependent?: StateContainer<any, any, any>;
122
149
  }): InstanceType<T>;
123
150
  /**
124
151
  * Borrow an existing instance without adding a ref (borrowing semantics).
@@ -258,6 +285,7 @@ export declare class StateContainerRegistry {
258
285
  emit(event: 'refAcquired', container: StateContainer<any, any, any>, refId: string): void;
259
286
  emit(event: 'refReleased', container: StateContainer<any, any, any>, refId: string): void;
260
287
  emit(event: 'depsChanged', container: StateContainer<any, any, any>, previousDeps: Readonly<Record<string, unknown>>, currentDeps: Readonly<Record<string, unknown>>): void;
288
+ emit(event: 'hydrationChanged', container: StateContainer<any, any, any>, status: HydrationStatus, previousStatus: HydrationStatus): void;
261
289
  /**
262
290
  * Schedule a deferred stateChanged notification via microtask.
263
291
  * Skips entirely when no stateChanged listeners are registered.
@@ -8,6 +8,12 @@ export declare const APPLY_DEPS: unique symbol;
8
8
  * Called by framework adapters — not public API.
9
9
  */
10
10
  export declare const REMOVE_DEPS_OWNER: unique symbol;
11
+ /**
12
+ * @internal Subscribe to this specific instance's own disposal, bypassing
13
+ * the global registry `'disposed'` event. Called by `watch()` — not public
14
+ * API.
15
+ */
16
+ export declare const ON_DISPOSE: unique symbol;
11
17
  /**
12
18
  * @internal Symbol-keyed configuration entry point on `StateContainer`.
13
19
  * Writes the instance's identity fields (`_name`/`_debug`/`_instanceId`),
package/dist/debug.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_StateContainerRegistry = require("./StateContainerRegistry-CSNm2Ws5.cjs");
3
- const require_config = require("./config-C7Ktkjh2.cjs");
4
- const require_management = require("./management-14vsHr4t.cjs");
2
+ const require_StateContainerRegistry = require("./StateContainerRegistry-CS18y4au.cjs");
3
+ const require_config = require("./config-DWUq7zEQ.cjs");
4
+ const require_management = require("./management-QWLpbXlW.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-CvBOhAT2.js";
2
- import { n as getStats, r as setRegistry, t as getRegistry } from "./config-buwpT7l3.js";
3
- import { a as getAll, c as hasInstance, i as forEach, o as getRefCount, r as register, s as getRefIds } from "./management-BvUAjril.js";
1
+ import { r as globalRegistry } from "./StateContainerRegistry-D8nu7Z0T.js";
2
+ import { n as getStats, r as setRegistry, t as getRegistry } from "./config-DXI3kzmA.js";
3
+ import { a as getAll, c as hasInstance, i as forEach, o as getRefCount, r as register, s as getRefIds } from "./management-C-WGcwPD.js";
4
4
  export { forEach, getAll, getRefCount, getRefIds, getRegistry, getStats, globalRegistry, hasInstance, register, setRegistry };