@blac/core 2.0.17 → 2.0.18

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 (73) hide show
  1. package/README.md +7 -1
  2. package/dist/StateContainerRegistry-4Ljd9EJx.js +1018 -0
  3. package/dist/StateContainerRegistry-4Ljd9EJx.js.map +1 -0
  4. package/dist/StateContainerRegistry-CEWpc1bj.cjs +1113 -0
  5. package/dist/StateContainerRegistry-CEWpc1bj.cjs.map +1 -0
  6. package/dist/StateContainerRegistry-CSNm2Ws5.cjs +1085 -0
  7. package/dist/StateContainerRegistry-CSNm2Ws5.cjs.map +1 -0
  8. package/dist/StateContainerRegistry-CvBOhAT2.js +996 -0
  9. package/dist/StateContainerRegistry-CvBOhAT2.js.map +1 -0
  10. package/dist/acquire-B1Wuqla6.cjs +46 -0
  11. package/dist/acquire-B1Wuqla6.cjs.map +1 -0
  12. package/dist/acquire-BP-ZfUH2.js +35 -0
  13. package/dist/acquire-BP-ZfUH2.js.map +1 -0
  14. package/dist/acquire-BZIs6tpN.cjs +46 -0
  15. package/dist/acquire-BZIs6tpN.cjs.map +1 -0
  16. package/dist/acquire-CwB083au.js +35 -0
  17. package/dist/acquire-CwB083au.js.map +1 -0
  18. package/dist/config-C7Ktkjh2.cjs +32 -0
  19. package/dist/config-C7Ktkjh2.cjs.map +1 -0
  20. package/dist/config-COT4Xkbc.js +16 -0
  21. package/dist/config-COT4Xkbc.js.map +1 -0
  22. package/dist/config-b2z51Y_C.cjs +32 -0
  23. package/dist/config-b2z51Y_C.cjs.map +1 -0
  24. package/dist/config-buwpT7l3.js +16 -0
  25. package/dist/config-buwpT7l3.js.map +1 -0
  26. package/dist/core/Cubit.d.ts +4 -4
  27. package/dist/core/StateContainer.d.ts +34 -38
  28. package/dist/core/StateContainerRegistry.d.ts +1 -1
  29. package/dist/core/meta.d.ts +73 -0
  30. package/dist/core/symbols.d.ts +10 -17
  31. package/dist/debug.cjs +3 -3
  32. package/dist/debug.js +3 -3
  33. package/dist/ensure-B9oOqpOB.cjs +558 -0
  34. package/dist/ensure-B9oOqpOB.cjs.map +1 -0
  35. package/dist/ensure-BfYnvAsI.js +709 -0
  36. package/dist/ensure-BfYnvAsI.js.map +1 -0
  37. package/dist/ensure-C1a8IFWy.js +535 -0
  38. package/dist/ensure-C1a8IFWy.js.map +1 -0
  39. package/dist/ensure-_Oh8XPm4.cjs +732 -0
  40. package/dist/ensure-_Oh8XPm4.cjs.map +1 -0
  41. package/dist/index.cjs +9 -9
  42. package/dist/index.d.cts +4 -7
  43. package/dist/index.d.ts +4 -7
  44. package/dist/index.js +7 -7
  45. package/dist/management-14vsHr4t.cjs +85 -0
  46. package/dist/management-14vsHr4t.cjs.map +1 -0
  47. package/dist/management-BqGBdL01.js +38 -0
  48. package/dist/management-BqGBdL01.js.map +1 -0
  49. package/dist/management-BvUAjril.js +38 -0
  50. package/dist/management-BvUAjril.js.map +1 -0
  51. package/dist/management-Df7Y2sF1.cjs +85 -0
  52. package/dist/management-Df7Y2sF1.cjs.map +1 -0
  53. package/dist/plugin/BlacPlugin.d.ts +11 -12
  54. package/dist/plugin/PluginManager.d.ts +3 -4
  55. package/dist/plugins.cjs +1 -1
  56. package/dist/plugins.js +1 -1
  57. package/dist/testing.cjs +10 -15
  58. package/dist/testing.cjs.map +1 -1
  59. package/dist/testing.d.cts +4 -6
  60. package/dist/testing.d.ts +4 -6
  61. package/dist/testing.js +10 -14
  62. package/dist/testing.js.map +1 -1
  63. package/dist/watch-CfrSSrRY.js +59 -0
  64. package/dist/watch-CfrSSrRY.js.map +1 -0
  65. package/dist/watch-Cnh3PtQA.cjs +70 -0
  66. package/dist/watch-Cnh3PtQA.cjs.map +1 -0
  67. package/dist/watch-D8hwbFU1.js +59 -0
  68. package/dist/watch-D8hwbFU1.js.map +1 -0
  69. package/dist/watch-DVmvZBMD.cjs +70 -0
  70. package/dist/watch-DVmvZBMD.cjs.map +1 -0
  71. package/dist/watch-entry.cjs +1 -1
  72. package/dist/watch-entry.js +1 -1
  73. package/package.json +3 -3
@@ -105,7 +105,7 @@ export declare class StateContainerRegistry {
105
105
  * You must call `release()` with the same refId when done.
106
106
  *
107
107
  * @internal Internal key tier. Public callers use the args-based `acquire`
108
- * wrapper; `useBloc`/`compat`/`watch` address a pre-resolved key here.
108
+ * wrapper; `useBloc` and `watch` address a pre-resolved key here.
109
109
  * @param Type - The StateContainer class constructor
110
110
  * @param instanceKey - Pre-resolved instance key (defaults to 'default')
111
111
  * @param options - Acquisition options
@@ -0,0 +1,73 @@
1
+ /**
2
+ * `$blac` meta namespace for `StateContainer`.
3
+ *
4
+ * ──────────────────────────────────────────────────────────────────────────
5
+ * CONSTRAINT — NO ES `#private` FIELDS, ANYWHERE IN THIS FILE.
6
+ *
7
+ * `@blac/react`'s `buildTrackedProxy` invokes prototype getters with a
8
+ * `Proxy(instance)` as the `this`-receiver. Accessing an ES `#private` field
9
+ * through a proxy receiver throws (`#x` brand checks fail on the proxy). The
10
+ * whole point of this meta object is to be proxy-safe: every getter/method
11
+ * here closes over the *real* container instance captured at `createMeta`
12
+ * time, NEVER over a `this`-receiver. Do not "modernize" the `_`-prefixed
13
+ * TS-private reads below into `#private` access.
14
+ * ──────────────────────────────────────────────────────────────────────────
15
+ */
16
+ import type { HydrationStatus } from './StateContainer';
17
+ import type { StateContainerConstructor } from '../types/utilities';
18
+ /**
19
+ * Hydration sub-surface of {@link BlacMeta}. Exposes the container's
20
+ * hydration state machine — the `begin`/`apply`/`finish`/`fail`/`wait`
21
+ * methods and the `status`/`error`/`isHydrated`/`changedWhileHydrating`
22
+ * getters — namespaced under `$blac`.
23
+ */
24
+ export interface BlacHydration<S extends object> {
25
+ readonly status: HydrationStatus;
26
+ readonly error: Error | undefined;
27
+ readonly isHydrated: boolean;
28
+ readonly changedWhileHydrating: boolean;
29
+ begin(): void;
30
+ apply(next: S): boolean;
31
+ finish(): void;
32
+ fail(error: Error): void;
33
+ wait(): Promise<void>;
34
+ }
35
+ /**
36
+ * The reserved `$blac` instance member on every `StateContainer`. Gathers the
37
+ * container's identity/lifecycle/hydration surface (`name`, `id`, `debug`,
38
+ * `createdAt`, `disposed`, `dependencies`, and the hydration methods) under one
39
+ * namespace, keeping the generic names free for userland blocs.
40
+ *
41
+ * The object is allocated once per container, frozen, branded, and exposes
42
+ * live getters that read the container's current `_`-private fields — values
43
+ * are never snapshotted.
44
+ */
45
+ export interface BlacMeta<S extends object = any> {
46
+ readonly name: string;
47
+ readonly id: string;
48
+ readonly debug: boolean;
49
+ readonly createdAt: number;
50
+ readonly disposed: boolean;
51
+ readonly dependencies: ReadonlyMap<StateContainerConstructor, string>;
52
+ readonly hydration: BlacHydration<S>;
53
+ }
54
+ /**
55
+ * Non-enumerable brand carried on every `$blac` object produced by
56
+ * {@link createMeta}. Used by the clobber guard in `StateContainer` to detect
57
+ * a subclass class-field shadowing the base's own `$blac` property, and by the
58
+ * meta tests. Intentionally NOT re-exported from the package barrel.
59
+ */
60
+ export declare const META_BRAND: unique symbol;
61
+ /**
62
+ * Build the frozen, branded `$blac` meta object for a container.
63
+ *
64
+ * Called from a `StateContainer` field initializer (`$blac = createMeta(this)`).
65
+ * Only the back-reference is captured at this point; every getter/method reads
66
+ * the container's `_`-private fields lazily on access, so field-initializer
67
+ * ordering relative to those private fields is irrelevant.
68
+ *
69
+ * The getters close over `container` (the real instance), never over a
70
+ * `this`-receiver — this is what keeps `$blac` reads safe through
71
+ * `buildTrackedProxy`.
72
+ */
73
+ export declare function createMeta<S extends object>(container: object): BlacMeta<S>;
@@ -1,27 +1,20 @@
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
- */
12
- export declare const EMIT: unique symbol;
13
1
  /**
14
2
  * @internal Apply one owner's (consumer's) deps slice to an instance.
15
3
  * 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
4
  */
20
5
  export declare const APPLY_DEPS: unique symbol;
21
6
  /**
22
7
  * @internal Withdraw one owner's entire deps slice (consumer unmounted).
23
8
  * Called by framework adapters — not public API.
24
- *
25
- * Kept until D0 ports `useBloc`. See A2 audit for the consumer list.
26
9
  */
27
10
  export declare const REMOVE_DEPS_OWNER: unique symbol;
11
+ /**
12
+ * @internal Symbol-keyed configuration entry point on `StateContainer`.
13
+ * Writes the instance's identity fields (`_name`/`_debug`/`_instanceId`),
14
+ * resolves per-class equality, emits the registry `created` event, and runs
15
+ * `init()` once.
16
+ *
17
+ * Framework-only — the registry (`StateContainerRegistry.ensure`) and testing
18
+ * helpers are the sole callers, mirroring the `APPLY_DEPS` precedent.
19
+ */
20
+ export declare const INIT_CONFIG: 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-DJQqLrli.cjs");
3
- const require_config = require("./config-sCPKPYxZ.cjs");
4
- const require_management = require("./management-DAV9sN-k.cjs");
2
+ const require_StateContainerRegistry = require("./StateContainerRegistry-CSNm2Ws5.cjs");
3
+ const require_config = require("./config-C7Ktkjh2.cjs");
4
+ const require_management = require("./management-14vsHr4t.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-B1GYx9Xo.js";
2
- import { n as getStats, r as setRegistry, t as getRegistry } from "./config-Dk1FxfXj.js";
3
- import { a as getAll, c as hasInstance, i as forEach, o as getRefCount, r as register, s as getRefIds } from "./management-444tdCBG.js";
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";
4
4
  export { forEach, getAll, getRefCount, getRefIds, getRegistry, getStats, globalRegistry, hasInstance, register, setRegistry };