@blac/core 2.0.16 → 2.0.17
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/dist/StateContainerRegistry-B1GYx9Xo.js +975 -0
- package/dist/StateContainerRegistry-B1GYx9Xo.js.map +1 -0
- package/dist/StateContainerRegistry-DJQqLrli.cjs +1046 -0
- package/dist/StateContainerRegistry-DJQqLrli.cjs.map +1 -0
- package/dist/acquire-CbMz7gWs.cjs +46 -0
- package/dist/acquire-CbMz7gWs.cjs.map +1 -0
- package/dist/acquire-G8aB3GAx.js +35 -0
- package/dist/acquire-G8aB3GAx.js.map +1 -0
- package/dist/config-Dk1FxfXj.js +16 -0
- package/dist/config-Dk1FxfXj.js.map +1 -0
- package/dist/config-sCPKPYxZ.cjs +32 -0
- package/dist/config-sCPKPYxZ.cjs.map +1 -0
- package/dist/core/StateContainer.d.ts +51 -10
- package/dist/core/StateContainerRegistry.d.ts +2 -2
- package/dist/debug.cjs +3 -3
- package/dist/debug.js +3 -3
- package/dist/ensure-DEXSmA-N.js +526 -0
- package/dist/ensure-DEXSmA-N.js.map +1 -0
- package/dist/ensure-Dx86f80B.cjs +567 -0
- package/dist/ensure-Dx86f80B.cjs.map +1 -0
- package/dist/ensure-DzqGej43.js +526 -0
- package/dist/ensure-DzqGej43.js.map +1 -0
- package/dist/ensure-fsQMjaQL.cjs +567 -0
- package/dist/ensure-fsQMjaQL.cjs.map +1 -0
- package/dist/index.cjs +7 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/management-444tdCBG.js +38 -0
- package/dist/management-444tdCBG.js.map +1 -0
- package/dist/management-DAV9sN-k.cjs +85 -0
- package/dist/management-DAV9sN-k.cjs.map +1 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/testing.cjs +4 -4
- package/dist/testing.js +4 -4
- package/dist/watch-B91opmva.cjs +70 -0
- package/dist/watch-B91opmva.cjs.map +1 -0
- package/dist/watch-DPVUwPUY.js +59 -0
- package/dist/watch-DPVUwPUY.js.map +1 -0
- package/dist/watch-entry.cjs +1 -1
- package/dist/watch-entry.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_StateContainerRegistry = require("./StateContainerRegistry-
|
|
3
|
-
const require_ensure = require("./ensure-
|
|
4
|
-
const require_config = require("./config-
|
|
5
|
-
const require_acquire = require("./acquire-
|
|
6
|
-
const require_management = require("./management-
|
|
7
|
-
const require_watch = require("./watch-
|
|
2
|
+
const require_StateContainerRegistry = require("./StateContainerRegistry-DJQqLrli.cjs");
|
|
3
|
+
const require_ensure = require("./ensure-Dx86f80B.cjs");
|
|
4
|
+
const require_config = require("./config-sCPKPYxZ.cjs");
|
|
5
|
+
const require_acquire = require("./acquire-CbMz7gWs.cjs");
|
|
6
|
+
const require_management = require("./management-DAV9sN-k.cjs");
|
|
7
|
+
const require_watch = require("./watch-B91opmva.cjs");
|
|
8
8
|
const require_branded = require("./branded-BybA0_xw.cjs");
|
|
9
9
|
let _dirtytalk_structural = require("@dirtytalk/structural");
|
|
10
10
|
//#region src/registry/borrow.ts
|
|
@@ -71,6 +71,7 @@ Object.defineProperty(exports, "ALL_PATHS", {
|
|
|
71
71
|
});
|
|
72
72
|
exports.APPLY_DEPS = require_ensure.APPLY_DEPS;
|
|
73
73
|
exports.Cubit = require_ensure.Cubit;
|
|
74
|
+
exports.DEP_BRAND = require_ensure.DEP_BRAND;
|
|
74
75
|
exports.EMIT = require_ensure.EMIT;
|
|
75
76
|
exports.PluginManager = require_StateContainerRegistry.PluginManager;
|
|
76
77
|
exports.REMOVE_DEPS_OWNER = require_ensure.REMOVE_DEPS_OWNER;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { configureBlac, getBlacConfig, resetBlacConfig, shallowEqualState, type BlacConfig, type EqualityFn, } from './config';
|
|
2
|
-
export { StateContainer } from './core/StateContainer';
|
|
3
|
-
export type { HydrationStatus, StateContainerConfig, SystemEvent, SystemEventPayloads, } from './core/StateContainer';
|
|
2
|
+
export { StateContainer, DEP_BRAND } from './core/StateContainer';
|
|
3
|
+
export type { HydrationStatus, StateContainerConfig, SystemEvent, SystemEventPayloads, DepHandle, } from './core/StateContainer';
|
|
4
4
|
export { Cubit } from './core/Cubit';
|
|
5
5
|
/**
|
|
6
6
|
* @internal symbols — read by framework adapters (`@blac/react` via the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { configureBlac, getBlacConfig, resetBlacConfig, shallowEqualState, type BlacConfig, type EqualityFn, } from './config';
|
|
2
|
-
export { StateContainer } from './core/StateContainer';
|
|
3
|
-
export type { HydrationStatus, StateContainerConfig, SystemEvent, SystemEventPayloads, } from './core/StateContainer';
|
|
2
|
+
export { StateContainer, DEP_BRAND } from './core/StateContainer';
|
|
3
|
+
export type { HydrationStatus, StateContainerConfig, SystemEvent, SystemEventPayloads, DepHandle, } from './core/StateContainer';
|
|
4
4
|
export { Cubit } from './core/Cubit';
|
|
5
5
|
/**
|
|
6
6
|
* @internal symbols — read by framework adapters (`@blac/react` via the
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as isExcludedFromDevTools, c as PluginManager, d as resetBlacConfig, f as shallowEqualState, l as configureBlac, n as getPluginManager, o as isKeepAliveClass, r as globalRegistry, s as BLAC_STATIC_PROPS, t as StateContainerRegistry, u as getBlacConfig } from "./StateContainerRegistry-
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as getStats, r as setRegistry, t as getRegistry } from "./config-
|
|
4
|
-
import { n as resolveInstanceKey, t as acquire } from "./acquire-
|
|
5
|
-
import { a as getAll, c as hasInstance, i as forEach, n as clearAll, o as getRefCount, r as register, s as getRefIds, t as clear } from "./management-
|
|
6
|
-
import { n as watch, t as instance } from "./watch-
|
|
1
|
+
import { a as isExcludedFromDevTools, c as PluginManager, d as resetBlacConfig, f as shallowEqualState, l as configureBlac, n as getPluginManager, o as isKeepAliveClass, r as globalRegistry, s as BLAC_STATIC_PROPS, t as StateContainerRegistry, u as getBlacConfig } from "./StateContainerRegistry-B1GYx9Xo.js";
|
|
2
|
+
import { a as APPLY_DEPS, i as StateContainer, n as Cubit, o as EMIT, r as DEP_BRAND, s as REMOVE_DEPS_OWNER, t as ensure } from "./ensure-DzqGej43.js";
|
|
3
|
+
import { n as getStats, r as setRegistry, t as getRegistry } from "./config-Dk1FxfXj.js";
|
|
4
|
+
import { n as resolveInstanceKey, t as acquire } from "./acquire-G8aB3GAx.js";
|
|
5
|
+
import { a as getAll, c as hasInstance, i as forEach, n as clearAll, o as getRefCount, r as register, s as getRefIds, t as clear } from "./management-444tdCBG.js";
|
|
6
|
+
import { n as watch, t as instance } from "./watch-DPVUwPUY.js";
|
|
7
7
|
import { t as instanceId } from "./branded-DkbUzncc.js";
|
|
8
8
|
import { ALL_PATHS } from "@dirtytalk/structural";
|
|
9
9
|
//#region src/registry/borrow.ts
|
|
@@ -62,6 +62,6 @@ function blac(options) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
|
-
export { ALL_PATHS, APPLY_DEPS, Cubit, EMIT, PluginManager, REMOVE_DEPS_OWNER, StateContainer, StateContainerRegistry, acquire, blac, borrow, borrowSafe, clear, clearAll, configureBlac, ensure, forEach, getAll, getBlacConfig, getPluginManager, getRefCount, getRefIds, getRegistry, getStats, globalRegistry, hasInstance, instance, instanceId, isExcludedFromDevTools, isKeepAliveClass, register, release, resetBlacConfig, resolveInstanceKey, setRegistry, shallowEqualState, watch };
|
|
65
|
+
export { ALL_PATHS, APPLY_DEPS, Cubit, DEP_BRAND, EMIT, PluginManager, REMOVE_DEPS_OWNER, StateContainer, StateContainerRegistry, acquire, blac, borrow, borrowSafe, clear, clearAll, configureBlac, ensure, forEach, getAll, getBlacConfig, getPluginManager, getRefCount, getRefIds, getRegistry, getStats, globalRegistry, hasInstance, instance, instanceId, isExcludedFromDevTools, isKeepAliveClass, register, release, resetBlacConfig, resolveInstanceKey, setRegistry, shallowEqualState, watch };
|
|
66
66
|
|
|
67
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as getRegistry } from "./config-Dk1FxfXj.js";
|
|
2
|
+
//#region src/registry/queries.ts
|
|
3
|
+
function hasInstance(BlocClass, opts) {
|
|
4
|
+
const registry = getRegistry();
|
|
5
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
6
|
+
return registry.hasInstance(BlocClass, key);
|
|
7
|
+
}
|
|
8
|
+
function getRefCount(BlocClass, opts) {
|
|
9
|
+
const registry = getRegistry();
|
|
10
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
11
|
+
return registry.getRefCount(BlocClass, key);
|
|
12
|
+
}
|
|
13
|
+
function getRefIds(BlocClass, opts) {
|
|
14
|
+
const registry = getRegistry();
|
|
15
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
16
|
+
return registry.getRefIds(BlocClass, key);
|
|
17
|
+
}
|
|
18
|
+
function getAll(BlocClass) {
|
|
19
|
+
return getRegistry().getAll(BlocClass);
|
|
20
|
+
}
|
|
21
|
+
function forEach(BlocClass, callback) {
|
|
22
|
+
getRegistry().forEach(BlocClass, callback);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/registry/management.ts
|
|
26
|
+
function clear(BlocClass) {
|
|
27
|
+
getRegistry().clear(BlocClass);
|
|
28
|
+
}
|
|
29
|
+
function clearAll() {
|
|
30
|
+
getRegistry().clearAll();
|
|
31
|
+
}
|
|
32
|
+
function register(BlocClass) {
|
|
33
|
+
getRegistry().register(BlocClass);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { getAll as a, hasInstance as c, forEach as i, clearAll as n, getRefCount as o, register as r, getRefIds as s, clear as t };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=management-444tdCBG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"management-444tdCBG.js","names":[],"sources":["../src/registry/queries.ts","../src/registry/management.ts"],"sourcesContent":["import { getRegistry } from './config';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n InstanceReadonlyState,\n} from '../types/utilities';\n\nexport function hasInstance<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): boolean {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.hasInstance(BlocClass, key);\n}\n\nexport function getRefCount<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): number {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.getRefCount(BlocClass, key);\n}\n\nexport function getRefIds<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): string[] {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.getRefIds(BlocClass, key);\n}\n\nexport function getAll<T extends StateContainerConstructor>(\n BlocClass: T,\n): InstanceReadonlyState<T>[] {\n return getRegistry().getAll(BlocClass);\n}\n\nexport function forEach<T extends StateContainerConstructor>(\n BlocClass: T,\n callback: (instance: InstanceReadonlyState<T>) => void,\n): void {\n getRegistry().forEach(BlocClass, callback);\n}\n","import { getRegistry } from './config';\nimport type { StateContainerConstructor } from '../types/utilities';\n\nexport function clear<T extends StateContainerConstructor>(BlocClass: T): void {\n getRegistry().clear(BlocClass);\n}\n\nexport function clearAll(): void {\n getRegistry().clearAll();\n}\n\nexport function register<T extends StateContainerConstructor>(\n BlocClass: T,\n): void {\n getRegistry().register(BlocClass);\n}\n"],"mappings":";;AAOA,SAAgB,YACd,WACA,MACS;CACT,MAAM,WAAW,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,YAAY,WAAW,GAAG;AAC5C;AAEA,SAAgB,YACd,WACA,MACQ;CACR,MAAM,WAAW,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,YAAY,WAAW,GAAG;AAC5C;AAEA,SAAgB,UACd,WACA,MACU;CACV,MAAM,WAAW,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,UAAU,WAAW,GAAG;AAC1C;AAEA,SAAgB,OACd,WAC4B;CAC5B,OAAO,YAAY,EAAE,OAAO,SAAS;AACvC;AAEA,SAAgB,QACd,WACA,UACM;CACN,YAAY,EAAE,QAAQ,WAAW,QAAQ;AAC3C;;;AC1CA,SAAgB,MAA2C,WAAoB;CAC7E,YAAY,EAAE,MAAM,SAAS;AAC/B;AAEA,SAAgB,WAAiB;CAC/B,YAAY,EAAE,SAAS;AACzB;AAEA,SAAgB,SACd,WACM;CACN,YAAY,EAAE,SAAS,SAAS;AAClC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const require_config = require("./config-sCPKPYxZ.cjs");
|
|
2
|
+
//#region src/registry/queries.ts
|
|
3
|
+
function hasInstance(BlocClass, opts) {
|
|
4
|
+
const registry = require_config.getRegistry();
|
|
5
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
6
|
+
return registry.hasInstance(BlocClass, key);
|
|
7
|
+
}
|
|
8
|
+
function getRefCount(BlocClass, opts) {
|
|
9
|
+
const registry = require_config.getRegistry();
|
|
10
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
11
|
+
return registry.getRefCount(BlocClass, key);
|
|
12
|
+
}
|
|
13
|
+
function getRefIds(BlocClass, opts) {
|
|
14
|
+
const registry = require_config.getRegistry();
|
|
15
|
+
const key = registry.resolveKey(BlocClass, void 0, opts?.args);
|
|
16
|
+
return registry.getRefIds(BlocClass, key);
|
|
17
|
+
}
|
|
18
|
+
function getAll(BlocClass) {
|
|
19
|
+
return require_config.getRegistry().getAll(BlocClass);
|
|
20
|
+
}
|
|
21
|
+
function forEach(BlocClass, callback) {
|
|
22
|
+
require_config.getRegistry().forEach(BlocClass, callback);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/registry/management.ts
|
|
26
|
+
function clear(BlocClass) {
|
|
27
|
+
require_config.getRegistry().clear(BlocClass);
|
|
28
|
+
}
|
|
29
|
+
function clearAll() {
|
|
30
|
+
require_config.getRegistry().clearAll();
|
|
31
|
+
}
|
|
32
|
+
function register(BlocClass) {
|
|
33
|
+
require_config.getRegistry().register(BlocClass);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
Object.defineProperty(exports, "clear", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return clear;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "clearAll", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return clearAll;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "forEach", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function() {
|
|
51
|
+
return forEach;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "getAll", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function() {
|
|
57
|
+
return getAll;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "getRefCount", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function() {
|
|
63
|
+
return getRefCount;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "getRefIds", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function() {
|
|
69
|
+
return getRefIds;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "hasInstance", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function() {
|
|
75
|
+
return hasInstance;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "register", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function() {
|
|
81
|
+
return register;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=management-DAV9sN-k.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"management-DAV9sN-k.cjs","names":["getRegistry"],"sources":["../src/registry/queries.ts","../src/registry/management.ts"],"sourcesContent":["import { getRegistry } from './config';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n InstanceReadonlyState,\n} from '../types/utilities';\n\nexport function hasInstance<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): boolean {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.hasInstance(BlocClass, key);\n}\n\nexport function getRefCount<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): number {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.getRefCount(BlocClass, key);\n}\n\nexport function getRefIds<T extends StateContainerConstructor>(\n BlocClass: T,\n opts?: { args?: ExtractArgs<T> },\n): string[] {\n const registry = getRegistry();\n const key = registry.resolveKey(BlocClass, undefined, opts?.args);\n return registry.getRefIds(BlocClass, key);\n}\n\nexport function getAll<T extends StateContainerConstructor>(\n BlocClass: T,\n): InstanceReadonlyState<T>[] {\n return getRegistry().getAll(BlocClass);\n}\n\nexport function forEach<T extends StateContainerConstructor>(\n BlocClass: T,\n callback: (instance: InstanceReadonlyState<T>) => void,\n): void {\n getRegistry().forEach(BlocClass, callback);\n}\n","import { getRegistry } from './config';\nimport type { StateContainerConstructor } from '../types/utilities';\n\nexport function clear<T extends StateContainerConstructor>(BlocClass: T): void {\n getRegistry().clear(BlocClass);\n}\n\nexport function clearAll(): void {\n getRegistry().clearAll();\n}\n\nexport function register<T extends StateContainerConstructor>(\n BlocClass: T,\n): void {\n getRegistry().register(BlocClass);\n}\n"],"mappings":";;AAOA,SAAgB,YACd,WACA,MACS;CACT,MAAM,WAAWA,eAAAA,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,YAAY,WAAW,GAAG;AAC5C;AAEA,SAAgB,YACd,WACA,MACQ;CACR,MAAM,WAAWA,eAAAA,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,YAAY,WAAW,GAAG;AAC5C;AAEA,SAAgB,UACd,WACA,MACU;CACV,MAAM,WAAWA,eAAAA,YAAY;CAC7B,MAAM,MAAM,SAAS,WAAW,WAAW,KAAA,GAAW,MAAM,IAAI;CAChE,OAAO,SAAS,UAAU,WAAW,GAAG;AAC1C;AAEA,SAAgB,OACd,WAC4B;CAC5B,OAAOA,eAAAA,YAAY,EAAE,OAAO,SAAS;AACvC;AAEA,SAAgB,QACd,WACA,UACM;CACN,eAAA,YAAY,EAAE,QAAQ,WAAW,QAAQ;AAC3C;;;AC1CA,SAAgB,MAA2C,WAAoB;CAC7E,eAAA,YAAY,EAAE,MAAM,SAAS;AAC/B;AAEA,SAAgB,WAAiB;CAC/B,eAAA,YAAY,EAAE,SAAS;AACzB;AAEA,SAAgB,SACd,WACM;CACN,eAAA,YAAY,EAAE,SAAS,SAAS;AAClC"}
|
package/dist/plugins.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_StateContainerRegistry = require("./StateContainerRegistry-
|
|
2
|
+
const require_StateContainerRegistry = require("./StateContainerRegistry-DJQqLrli.cjs");
|
|
3
3
|
exports.PluginManager = require_StateContainerRegistry.PluginManager;
|
|
4
4
|
exports.getPluginManager = require_StateContainerRegistry.getPluginManager;
|
package/dist/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as PluginManager, n as getPluginManager } from "./StateContainerRegistry-
|
|
1
|
+
import { c as PluginManager, n as getPluginManager } from "./StateContainerRegistry-B1GYx9Xo.js";
|
|
2
2
|
export { PluginManager, getPluginManager };
|
package/dist/testing.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_StateContainerRegistry = require("./StateContainerRegistry-
|
|
3
|
-
const require_ensure = require("./ensure-
|
|
4
|
-
const require_config = require("./config-
|
|
5
|
-
const require_acquire = require("./acquire-
|
|
2
|
+
const require_StateContainerRegistry = require("./StateContainerRegistry-DJQqLrli.cjs");
|
|
3
|
+
const require_ensure = require("./ensure-Dx86f80B.cjs");
|
|
4
|
+
const require_config = require("./config-sCPKPYxZ.cjs");
|
|
5
|
+
const require_acquire = require("./acquire-CbMz7gWs.cjs");
|
|
6
6
|
//#region src/testing.ts
|
|
7
7
|
/** Synthetic owner id used by test helpers for pre-wired deps. */
|
|
8
8
|
const TESTING_DEPS_OWNER = "testing-deps";
|
package/dist/testing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as StateContainerRegistry } from "./StateContainerRegistry-
|
|
2
|
-
import {
|
|
3
|
-
import { r as setRegistry, t as getRegistry } from "./config-
|
|
4
|
-
import { n as resolveInstanceKey } from "./acquire-
|
|
1
|
+
import { t as StateContainerRegistry } from "./StateContainerRegistry-B1GYx9Xo.js";
|
|
2
|
+
import { a as APPLY_DEPS, n as Cubit, t as ensure } from "./ensure-DzqGej43.js";
|
|
3
|
+
import { r as setRegistry, t as getRegistry } from "./config-Dk1FxfXj.js";
|
|
4
|
+
import { n as resolveInstanceKey } from "./acquire-G8aB3GAx.js";
|
|
5
5
|
//#region src/testing.ts
|
|
6
6
|
/** Synthetic owner id used by test helpers for pre-wired deps. */
|
|
7
7
|
const TESTING_DEPS_OWNER = "testing-deps";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const require_config = require("./config-sCPKPYxZ.cjs");
|
|
2
|
+
const require_acquire = require("./acquire-CbMz7gWs.cjs");
|
|
3
|
+
let _dirtytalk_structural = require("@dirtytalk/structural");
|
|
4
|
+
//#region src/watch/watch.ts
|
|
5
|
+
const STOP = Symbol("watch.STOP");
|
|
6
|
+
const BLOC_REF_MARKER = Symbol("BlocRef");
|
|
7
|
+
/**
|
|
8
|
+
* Create a reference to a specific bloc instance, identified by its `args`.
|
|
9
|
+
* The key is derived the same way `useBloc`/`acquire` derive it.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* watch(instance(UserBloc, { userId: 'user-123' }), (userBloc) => {
|
|
14
|
+
* console.log(userBloc.state.name);
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function instance(BlocClass, args) {
|
|
19
|
+
return {
|
|
20
|
+
[BLOC_REF_MARKER]: true,
|
|
21
|
+
blocClass: BlocClass,
|
|
22
|
+
instanceId: require_acquire.resolveInstanceKey(BlocClass, args)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isBlocRef(input) {
|
|
26
|
+
return typeof input === "object" && input !== null && BLOC_REF_MARKER in input;
|
|
27
|
+
}
|
|
28
|
+
function resolveBloc(input) {
|
|
29
|
+
const registry = require_config.getRegistry();
|
|
30
|
+
if (isBlocRef(input)) return registry.ensure(input.blocClass, input.instanceId);
|
|
31
|
+
return registry.ensure(input, registry.resolveKey(input, void 0, void 0));
|
|
32
|
+
}
|
|
33
|
+
function isArray(input) {
|
|
34
|
+
return Array.isArray(input);
|
|
35
|
+
}
|
|
36
|
+
function watchImpl(blocsOrBloc, callback) {
|
|
37
|
+
const isSingle = !isArray(blocsOrBloc);
|
|
38
|
+
const instances = (isSingle ? [blocsOrBloc] : blocsOrBloc).map(resolveBloc);
|
|
39
|
+
let disposed = false;
|
|
40
|
+
const subscriptions = [];
|
|
41
|
+
const cleanup = () => {
|
|
42
|
+
if (disposed) return;
|
|
43
|
+
disposed = true;
|
|
44
|
+
for (const unsub of subscriptions) unsub();
|
|
45
|
+
subscriptions.length = 0;
|
|
46
|
+
};
|
|
47
|
+
const runCallback = () => {
|
|
48
|
+
if (disposed) return;
|
|
49
|
+
if (callback(isSingle ? instances[0] : instances) === STOP) cleanup();
|
|
50
|
+
};
|
|
51
|
+
for (const inst of instances) subscriptions.push(inst.channel.subscribe(() => _dirtytalk_structural.ALL_PATHS, runCallback));
|
|
52
|
+
runCallback();
|
|
53
|
+
return cleanup;
|
|
54
|
+
}
|
|
55
|
+
const watch = Object.assign(watchImpl, { STOP });
|
|
56
|
+
//#endregion
|
|
57
|
+
Object.defineProperty(exports, "instance", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return instance;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "watch", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function() {
|
|
66
|
+
return watch;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=watch-B91opmva.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch-B91opmva.cjs","names":["resolveInstanceKey","getRegistry","ALL_PATHS"],"sources":["../src/watch/watch.ts"],"sourcesContent":["import { ALL_PATHS } from '@dirtytalk/structural';\nimport { getRegistry } from '../registry';\nimport { resolveInstanceKey } from '../registry/acquire';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n StateContainerInstance,\n} from '../types/utilities';\n\nconst STOP: unique symbol = Symbol('watch.STOP');\ntype StopSymbol = typeof STOP;\n\nconst BLOC_REF_MARKER = Symbol('BlocRef');\n\n/**\n * Reference to a specific bloc instance, identified by class + the resolved\n * key derived from its `args`.\n */\nexport interface BlocRef<T extends StateContainerConstructor> {\n [BLOC_REF_MARKER]: true;\n blocClass: T;\n /** @internal The resolved instance key (derived from `args`). */\n instanceId: string;\n}\n\n/**\n * Create a reference to a specific bloc instance, identified by its `args`.\n * The key is derived the same way `useBloc`/`acquire` derive it.\n *\n * @example\n * ```ts\n * watch(instance(UserBloc, { userId: 'user-123' }), (userBloc) => {\n * console.log(userBloc.state.name);\n * });\n * ```\n */\nexport function instance<T extends StateContainerConstructor>(\n BlocClass: T,\n args?: ExtractArgs<T>,\n): BlocRef<T> {\n return {\n [BLOC_REF_MARKER]: true,\n blocClass: BlocClass,\n instanceId: resolveInstanceKey(BlocClass, args),\n };\n}\n\nfunction isBlocRef(\n input: unknown,\n): input is BlocRef<StateContainerConstructor> {\n return (\n typeof input === 'object' && input !== null && BLOC_REF_MARKER in input\n );\n}\n\ntype BlocInput = StateContainerConstructor | BlocRef<StateContainerConstructor>;\n\ntype ExtractInstance<T> =\n T extends BlocRef<infer C>\n ? InstanceType<C>\n : T extends StateContainerConstructor\n ? InstanceType<T>\n : never;\n\ntype ExtractInstances<T extends readonly BlocInput[]> = {\n [K in keyof T]: ExtractInstance<T[K]>;\n};\n\n/**\n * Watch function signature for single bloc.\n */\nexport interface WatchSingleFn {\n <T extends StateContainerConstructor>(\n bloc: T | BlocRef<T>,\n callback: (bloc: InstanceType<T>) => void | StopSymbol,\n ): () => void;\n\n STOP: StopSymbol;\n}\n\n/**\n * Watch function signature for multiple blocs.\n */\nexport interface WatchMultipleFn {\n <T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n ): () => void;\n\n STOP: StopSymbol;\n}\n\n/**\n * Combined watch function type.\n */\nexport interface WatchFn extends WatchSingleFn {\n <T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n ): () => void;\n}\n\nfunction resolveBloc(input: BlocInput): StateContainerInstance {\n const registry = getRegistry();\n if (isBlocRef(input)) {\n return registry.ensure(input.blocClass, input.instanceId);\n }\n return registry.ensure(\n input,\n registry.resolveKey(input, undefined, undefined),\n );\n}\n\nfunction isArray(input: unknown): input is readonly BlocInput[] {\n return Array.isArray(input);\n}\n\n/**\n * Watch one or more blocs for state changes.\n *\n * Thin wrapper around `container.channel.subscribe(ALL_PATHS, ...)`. The\n * callback fires once immediately, then on every state change of any of the\n * passed blocs. Returning `watch.STOP` from the callback tears down all\n * subscriptions.\n *\n * Note: subscriptions are microtask-deferred (per the DirtyChannel default\n * scheduler), so callbacks land asynchronously after `emit()`.\n *\n * @example Single bloc\n * ```ts\n * const unwatch = watch(UserBloc, (userBloc) => {\n * console.log(userBloc.state.name);\n * });\n * ```\n *\n * @example Multiple blocs\n * ```ts\n * const unwatch = watch(\n * [UserBloc, SettingsBloc] as const,\n * ([userBloc, settingsBloc]) => {\n * console.log(userBloc.state.name, settingsBloc.state.theme);\n * }\n * );\n * ```\n *\n * @example With specific instance\n * ```ts\n * const unwatch = watch(\n * instance(UserBloc, { userId: 'user-123' }),\n * (userBloc) => {\n * console.log(userBloc.state.name);\n * }\n * );\n * ```\n *\n * @example Stop watching from callback\n * ```ts\n * const unwatch = watch(UserBloc, (userBloc) => {\n * if (userBloc.state.done) {\n * return watch.STOP;\n * }\n * });\n * ```\n */\nfunction watchImpl<T extends StateContainerConstructor>(\n bloc: T | BlocRef<T>,\n callback: (bloc: InstanceType<T>) => void | StopSymbol,\n): () => void;\n\nfunction watchImpl<T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n): () => void;\n\nfunction watchImpl(\n blocsOrBloc: BlocInput | readonly BlocInput[],\n callback: (blocsOrBloc: any) => void | StopSymbol,\n): () => void {\n const isSingle = !isArray(blocsOrBloc);\n const inputs = isSingle ? [blocsOrBloc] : blocsOrBloc;\n\n const instances = inputs.map(resolveBloc);\n\n let disposed = false;\n const subscriptions: (() => void)[] = [];\n\n const cleanup = () => {\n if (disposed) return;\n disposed = true;\n for (const unsub of subscriptions) unsub();\n subscriptions.length = 0;\n };\n\n const runCallback = () => {\n if (disposed) return;\n const arg = isSingle ? instances[0] : instances;\n const result = callback(arg);\n if (result === STOP) cleanup();\n };\n\n for (const inst of instances) {\n subscriptions.push(inst.channel.subscribe(() => ALL_PATHS, runCallback));\n }\n\n // Fire once immediately so the consumer sees the current state.\n runCallback();\n\n return cleanup;\n}\n\nexport const watch: WatchFn = Object.assign(watchImpl, { STOP }) as WatchFn;\n"],"mappings":";;;;AASA,MAAM,OAAsB,OAAO,YAAY;AAG/C,MAAM,kBAAkB,OAAO,SAAS;;;;;;;;;;;;AAwBxC,SAAgB,SACd,WACA,MACY;CACZ,OAAO;GACJ,kBAAkB;EACnB,WAAW;EACX,YAAYA,gBAAAA,mBAAmB,WAAW,IAAI;CAChD;AACF;AAEA,SAAS,UACP,OAC6C;CAC7C,OACE,OAAO,UAAU,YAAY,UAAU,QAAQ,mBAAmB;AAEtE;AAiDA,SAAS,YAAY,OAA0C;CAC7D,MAAM,WAAWC,eAAAA,YAAY;CAC7B,IAAI,UAAU,KAAK,GACjB,OAAO,SAAS,OAAO,MAAM,WAAW,MAAM,UAAU;CAE1D,OAAO,SAAS,OACd,OACA,SAAS,WAAW,OAAO,KAAA,GAAW,KAAA,CAAS,CACjD;AACF;AAEA,SAAS,QAAQ,OAA+C;CAC9D,OAAO,MAAM,QAAQ,KAAK;AAC5B;AA2DA,SAAS,UACP,aACA,UACY;CACZ,MAAM,WAAW,CAAC,QAAQ,WAAW;CAGrC,MAAM,aAFS,WAAW,CAAC,WAAW,IAAI,aAEjB,IAAI,WAAW;CAExC,IAAI,WAAW;CACf,MAAM,gBAAgC,CAAC;CAEvC,MAAM,gBAAgB;EACpB,IAAI,UAAU;EACd,WAAW;EACX,KAAK,MAAM,SAAS,eAAe,MAAM;EACzC,cAAc,SAAS;CACzB;CAEA,MAAM,oBAAoB;EACxB,IAAI,UAAU;EAGd,IADe,SADH,WAAW,UAAU,KAAK,SAE7B,MAAM,MAAM,QAAQ;CAC/B;CAEA,KAAK,MAAM,QAAQ,WACjB,cAAc,KAAK,KAAK,QAAQ,gBAAgBC,sBAAAA,WAAW,WAAW,CAAC;CAIzE,YAAY;CAEZ,OAAO;AACT;AAEA,MAAa,QAAiB,OAAO,OAAO,WAAW,EAAE,KAAK,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { t as getRegistry } from "./config-Dk1FxfXj.js";
|
|
2
|
+
import { n as resolveInstanceKey } from "./acquire-G8aB3GAx.js";
|
|
3
|
+
import { ALL_PATHS } from "@dirtytalk/structural";
|
|
4
|
+
//#region src/watch/watch.ts
|
|
5
|
+
const STOP = Symbol("watch.STOP");
|
|
6
|
+
const BLOC_REF_MARKER = Symbol("BlocRef");
|
|
7
|
+
/**
|
|
8
|
+
* Create a reference to a specific bloc instance, identified by its `args`.
|
|
9
|
+
* The key is derived the same way `useBloc`/`acquire` derive it.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* watch(instance(UserBloc, { userId: 'user-123' }), (userBloc) => {
|
|
14
|
+
* console.log(userBloc.state.name);
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function instance(BlocClass, args) {
|
|
19
|
+
return {
|
|
20
|
+
[BLOC_REF_MARKER]: true,
|
|
21
|
+
blocClass: BlocClass,
|
|
22
|
+
instanceId: resolveInstanceKey(BlocClass, args)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isBlocRef(input) {
|
|
26
|
+
return typeof input === "object" && input !== null && BLOC_REF_MARKER in input;
|
|
27
|
+
}
|
|
28
|
+
function resolveBloc(input) {
|
|
29
|
+
const registry = getRegistry();
|
|
30
|
+
if (isBlocRef(input)) return registry.ensure(input.blocClass, input.instanceId);
|
|
31
|
+
return registry.ensure(input, registry.resolveKey(input, void 0, void 0));
|
|
32
|
+
}
|
|
33
|
+
function isArray(input) {
|
|
34
|
+
return Array.isArray(input);
|
|
35
|
+
}
|
|
36
|
+
function watchImpl(blocsOrBloc, callback) {
|
|
37
|
+
const isSingle = !isArray(blocsOrBloc);
|
|
38
|
+
const instances = (isSingle ? [blocsOrBloc] : blocsOrBloc).map(resolveBloc);
|
|
39
|
+
let disposed = false;
|
|
40
|
+
const subscriptions = [];
|
|
41
|
+
const cleanup = () => {
|
|
42
|
+
if (disposed) return;
|
|
43
|
+
disposed = true;
|
|
44
|
+
for (const unsub of subscriptions) unsub();
|
|
45
|
+
subscriptions.length = 0;
|
|
46
|
+
};
|
|
47
|
+
const runCallback = () => {
|
|
48
|
+
if (disposed) return;
|
|
49
|
+
if (callback(isSingle ? instances[0] : instances) === STOP) cleanup();
|
|
50
|
+
};
|
|
51
|
+
for (const inst of instances) subscriptions.push(inst.channel.subscribe(() => ALL_PATHS, runCallback));
|
|
52
|
+
runCallback();
|
|
53
|
+
return cleanup;
|
|
54
|
+
}
|
|
55
|
+
const watch = Object.assign(watchImpl, { STOP });
|
|
56
|
+
//#endregion
|
|
57
|
+
export { watch as n, instance as t };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=watch-DPVUwPUY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch-DPVUwPUY.js","names":[],"sources":["../src/watch/watch.ts"],"sourcesContent":["import { ALL_PATHS } from '@dirtytalk/structural';\nimport { getRegistry } from '../registry';\nimport { resolveInstanceKey } from '../registry/acquire';\nimport type {\n ExtractArgs,\n StateContainerConstructor,\n StateContainerInstance,\n} from '../types/utilities';\n\nconst STOP: unique symbol = Symbol('watch.STOP');\ntype StopSymbol = typeof STOP;\n\nconst BLOC_REF_MARKER = Symbol('BlocRef');\n\n/**\n * Reference to a specific bloc instance, identified by class + the resolved\n * key derived from its `args`.\n */\nexport interface BlocRef<T extends StateContainerConstructor> {\n [BLOC_REF_MARKER]: true;\n blocClass: T;\n /** @internal The resolved instance key (derived from `args`). */\n instanceId: string;\n}\n\n/**\n * Create a reference to a specific bloc instance, identified by its `args`.\n * The key is derived the same way `useBloc`/`acquire` derive it.\n *\n * @example\n * ```ts\n * watch(instance(UserBloc, { userId: 'user-123' }), (userBloc) => {\n * console.log(userBloc.state.name);\n * });\n * ```\n */\nexport function instance<T extends StateContainerConstructor>(\n BlocClass: T,\n args?: ExtractArgs<T>,\n): BlocRef<T> {\n return {\n [BLOC_REF_MARKER]: true,\n blocClass: BlocClass,\n instanceId: resolveInstanceKey(BlocClass, args),\n };\n}\n\nfunction isBlocRef(\n input: unknown,\n): input is BlocRef<StateContainerConstructor> {\n return (\n typeof input === 'object' && input !== null && BLOC_REF_MARKER in input\n );\n}\n\ntype BlocInput = StateContainerConstructor | BlocRef<StateContainerConstructor>;\n\ntype ExtractInstance<T> =\n T extends BlocRef<infer C>\n ? InstanceType<C>\n : T extends StateContainerConstructor\n ? InstanceType<T>\n : never;\n\ntype ExtractInstances<T extends readonly BlocInput[]> = {\n [K in keyof T]: ExtractInstance<T[K]>;\n};\n\n/**\n * Watch function signature for single bloc.\n */\nexport interface WatchSingleFn {\n <T extends StateContainerConstructor>(\n bloc: T | BlocRef<T>,\n callback: (bloc: InstanceType<T>) => void | StopSymbol,\n ): () => void;\n\n STOP: StopSymbol;\n}\n\n/**\n * Watch function signature for multiple blocs.\n */\nexport interface WatchMultipleFn {\n <T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n ): () => void;\n\n STOP: StopSymbol;\n}\n\n/**\n * Combined watch function type.\n */\nexport interface WatchFn extends WatchSingleFn {\n <T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n ): () => void;\n}\n\nfunction resolveBloc(input: BlocInput): StateContainerInstance {\n const registry = getRegistry();\n if (isBlocRef(input)) {\n return registry.ensure(input.blocClass, input.instanceId);\n }\n return registry.ensure(\n input,\n registry.resolveKey(input, undefined, undefined),\n );\n}\n\nfunction isArray(input: unknown): input is readonly BlocInput[] {\n return Array.isArray(input);\n}\n\n/**\n * Watch one or more blocs for state changes.\n *\n * Thin wrapper around `container.channel.subscribe(ALL_PATHS, ...)`. The\n * callback fires once immediately, then on every state change of any of the\n * passed blocs. Returning `watch.STOP` from the callback tears down all\n * subscriptions.\n *\n * Note: subscriptions are microtask-deferred (per the DirtyChannel default\n * scheduler), so callbacks land asynchronously after `emit()`.\n *\n * @example Single bloc\n * ```ts\n * const unwatch = watch(UserBloc, (userBloc) => {\n * console.log(userBloc.state.name);\n * });\n * ```\n *\n * @example Multiple blocs\n * ```ts\n * const unwatch = watch(\n * [UserBloc, SettingsBloc] as const,\n * ([userBloc, settingsBloc]) => {\n * console.log(userBloc.state.name, settingsBloc.state.theme);\n * }\n * );\n * ```\n *\n * @example With specific instance\n * ```ts\n * const unwatch = watch(\n * instance(UserBloc, { userId: 'user-123' }),\n * (userBloc) => {\n * console.log(userBloc.state.name);\n * }\n * );\n * ```\n *\n * @example Stop watching from callback\n * ```ts\n * const unwatch = watch(UserBloc, (userBloc) => {\n * if (userBloc.state.done) {\n * return watch.STOP;\n * }\n * });\n * ```\n */\nfunction watchImpl<T extends StateContainerConstructor>(\n bloc: T | BlocRef<T>,\n callback: (bloc: InstanceType<T>) => void | StopSymbol,\n): () => void;\n\nfunction watchImpl<T extends readonly BlocInput[]>(\n blocs: T,\n callback: (blocs: ExtractInstances<T>) => void | StopSymbol,\n): () => void;\n\nfunction watchImpl(\n blocsOrBloc: BlocInput | readonly BlocInput[],\n callback: (blocsOrBloc: any) => void | StopSymbol,\n): () => void {\n const isSingle = !isArray(blocsOrBloc);\n const inputs = isSingle ? [blocsOrBloc] : blocsOrBloc;\n\n const instances = inputs.map(resolveBloc);\n\n let disposed = false;\n const subscriptions: (() => void)[] = [];\n\n const cleanup = () => {\n if (disposed) return;\n disposed = true;\n for (const unsub of subscriptions) unsub();\n subscriptions.length = 0;\n };\n\n const runCallback = () => {\n if (disposed) return;\n const arg = isSingle ? instances[0] : instances;\n const result = callback(arg);\n if (result === STOP) cleanup();\n };\n\n for (const inst of instances) {\n subscriptions.push(inst.channel.subscribe(() => ALL_PATHS, runCallback));\n }\n\n // Fire once immediately so the consumer sees the current state.\n runCallback();\n\n return cleanup;\n}\n\nexport const watch: WatchFn = Object.assign(watchImpl, { STOP }) as WatchFn;\n"],"mappings":";;;;AASA,MAAM,OAAsB,OAAO,YAAY;AAG/C,MAAM,kBAAkB,OAAO,SAAS;;;;;;;;;;;;AAwBxC,SAAgB,SACd,WACA,MACY;CACZ,OAAO;GACJ,kBAAkB;EACnB,WAAW;EACX,YAAY,mBAAmB,WAAW,IAAI;CAChD;AACF;AAEA,SAAS,UACP,OAC6C;CAC7C,OACE,OAAO,UAAU,YAAY,UAAU,QAAQ,mBAAmB;AAEtE;AAiDA,SAAS,YAAY,OAA0C;CAC7D,MAAM,WAAW,YAAY;CAC7B,IAAI,UAAU,KAAK,GACjB,OAAO,SAAS,OAAO,MAAM,WAAW,MAAM,UAAU;CAE1D,OAAO,SAAS,OACd,OACA,SAAS,WAAW,OAAO,KAAA,GAAW,KAAA,CAAS,CACjD;AACF;AAEA,SAAS,QAAQ,OAA+C;CAC9D,OAAO,MAAM,QAAQ,KAAK;AAC5B;AA2DA,SAAS,UACP,aACA,UACY;CACZ,MAAM,WAAW,CAAC,QAAQ,WAAW;CAGrC,MAAM,aAFS,WAAW,CAAC,WAAW,IAAI,aAEjB,IAAI,WAAW;CAExC,IAAI,WAAW;CACf,MAAM,gBAAgC,CAAC;CAEvC,MAAM,gBAAgB;EACpB,IAAI,UAAU;EACd,WAAW;EACX,KAAK,MAAM,SAAS,eAAe,MAAM;EACzC,cAAc,SAAS;CACzB;CAEA,MAAM,oBAAoB;EACxB,IAAI,UAAU;EAGd,IADe,SADH,WAAW,UAAU,KAAK,SAE7B,MAAM,MAAM,QAAQ;CAC/B;CAEA,KAAK,MAAM,QAAQ,WACjB,cAAc,KAAK,KAAK,QAAQ,gBAAgB,WAAW,WAAW,CAAC;CAIzE,YAAY;CAEZ,OAAO;AACT;AAEA,MAAa,QAAiB,OAAO,OAAO,WAAW,EAAE,KAAK,CAAC"}
|
package/dist/watch-entry.cjs
CHANGED
package/dist/watch-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as watch, t as instance } from "./watch-
|
|
1
|
+
import { n as watch, t as instance } from "./watch-DPVUwPUY.js";
|
|
2
2
|
export { instance, watch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blac/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Brendan Mullins <jsnanigans@gmail.com>",
|
|
6
6
|
"description": "Type-safe, class-based state management with proxy tracking and plugin system",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
}
|
|
123
123
|
],
|
|
124
124
|
"dependencies": {
|
|
125
|
-
"@dirtytalk/structural": "^0.0.
|
|
125
|
+
"@dirtytalk/structural": "^0.0.5"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@size-limit/preset-small-lib": "^11.1.6",
|