@blac/core 2.0.0-rc.5 → 2.0.0-rc.8

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 (60) hide show
  1. package/dist/adapter/framework-adapter.d.ts +114 -0
  2. package/dist/adapter/framework-adapter.d.ts.map +1 -0
  3. package/dist/adapter/index.d.ts +8 -0
  4. package/dist/adapter/index.d.ts.map +1 -0
  5. package/dist/constants.d.ts +82 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/core/Cubit.d.ts +82 -0
  8. package/dist/core/Cubit.d.ts.map +1 -0
  9. package/dist/core/StateContainer.d.ts +200 -0
  10. package/dist/core/StateContainer.d.ts.map +1 -0
  11. package/dist/core/StateContainerRegistry.d.ts +176 -0
  12. package/dist/core/StateContainerRegistry.d.ts.map +1 -0
  13. package/dist/core/Vertex.d.ts +113 -0
  14. package/dist/core/Vertex.d.ts.map +1 -0
  15. package/dist/index.cjs +1158 -326
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +20 -885
  18. package/dist/index.d.ts +19 -884
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +1122 -327
  21. package/dist/index.js.map +1 -1
  22. package/dist/logging/Logger.d.ts +57 -0
  23. package/dist/logging/Logger.d.ts.map +1 -0
  24. package/dist/plugin/BlacPlugin.d.ts +115 -0
  25. package/dist/plugin/BlacPlugin.d.ts.map +1 -0
  26. package/dist/plugin/PluginManager.d.ts +63 -0
  27. package/dist/plugin/PluginManager.d.ts.map +1 -0
  28. package/dist/proxy/ProxyTracker.d.ts +71 -0
  29. package/dist/proxy/ProxyTracker.d.ts.map +1 -0
  30. package/dist/registry/index.d.ts +20 -0
  31. package/dist/registry/index.d.ts.map +1 -0
  32. package/dist/test-utils/index.d.ts +43 -0
  33. package/dist/test-utils/index.d.ts.map +1 -0
  34. package/dist/tracking/dependency-tracker.d.ts +21 -0
  35. package/dist/tracking/dependency-tracker.d.ts.map +1 -0
  36. package/dist/tracking/getter-tracker.d.ts +31 -0
  37. package/dist/tracking/getter-tracker.d.ts.map +1 -0
  38. package/dist/tracking/index.d.ts +38 -0
  39. package/dist/tracking/index.d.ts.map +1 -0
  40. package/dist/tracking/path-utils.d.ts +39 -0
  41. package/dist/tracking/path-utils.d.ts.map +1 -0
  42. package/dist/tracking/proxy-tracker.d.ts +88 -0
  43. package/dist/tracking/proxy-tracker.d.ts.map +1 -0
  44. package/dist/types/branded.d.ts +9 -0
  45. package/dist/types/branded.d.ts.map +1 -0
  46. package/dist/types/events.d.ts +13 -0
  47. package/dist/types/events.d.ts.map +1 -0
  48. package/dist/types/utilities.d.ts +18 -0
  49. package/dist/types/utilities.d.ts.map +1 -0
  50. package/dist/utils/equality.d.ts +9 -0
  51. package/dist/utils/equality.d.ts.map +1 -0
  52. package/dist/utils/idGenerator.d.ts +76 -0
  53. package/dist/utils/idGenerator.d.ts.map +1 -0
  54. package/dist/utils/immutable.d.ts +16 -0
  55. package/dist/utils/immutable.d.ts.map +1 -0
  56. package/dist/utils/stack-trace.d.ts +19 -0
  57. package/dist/utils/stack-trace.d.ts.map +1 -0
  58. package/dist/utils/static-props.d.ts +29 -0
  59. package/dist/utils/static-props.d.ts.map +1 -0
  60. package/package.json +17 -4
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Centralized ID Generation
3
+ *
4
+ * Provides consistent, collision-resistant ID generation for all BlaC subsystems.
5
+ * Uses timestamp + counter + random suffix for uniqueness.
6
+ */
7
+ /**
8
+ * Creates an ID generator with isolated counter state
9
+ *
10
+ * @param prefix - Prefix for generated IDs
11
+ * @returns Object with next(), nextSimple(), and reset() methods
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const generator = createIdGenerator('sub');
16
+ * const id1 = generator.next(); // "sub:1698765432100_1_a3k9d7f2q"
17
+ * const id2 = generator.next(); // "sub:1698765432101_2_b4n8e9g3r"
18
+ * ```
19
+ */
20
+ export declare function createIdGenerator(prefix: string): {
21
+ next: () => string;
22
+ nextSimple: () => string;
23
+ reset: () => void;
24
+ };
25
+ /**
26
+ * Generate ID with timestamp, counter, and random suffix (tree-shakeable)
27
+ *
28
+ * Format: `${prefix}:${timestamp}_${counter}_${random}`
29
+ *
30
+ * @param prefix - Prefix for the ID (e.g., 'sub', 'consumer', 'stage')
31
+ * @returns Branded ID string
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const id = generateId('sub');
36
+ * // Returns: "sub:1698765432100_1_a3k9d7f2q"
37
+ * ```
38
+ */
39
+ export declare function generateId(prefix: string): string;
40
+ /**
41
+ * Generate simple ID with timestamp and random (no counter tracking)
42
+ *
43
+ * Format: `${prefix}:${timestamp}_${random}`
44
+ *
45
+ * @param prefix - Prefix for the ID
46
+ * @returns Branded ID string
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const id = generateSimpleId('CounterBloc');
51
+ * // Returns: "CounterBloc:1698765432100_a3k9d7f2q"
52
+ * ```
53
+ */
54
+ export declare function generateSimpleId(prefix: string, affix?: string): string;
55
+ /**
56
+ * Reset all counters for testing purposes
57
+ * @internal
58
+ */
59
+ export declare function __resetIdCounters(): void;
60
+ /**
61
+ * Generate a unique isolated instance key
62
+ * Uses base36 encoding for compact, URL-safe identifiers
63
+ *
64
+ * Format: "isolated-{9-char-random-string}"
65
+ * Example: "isolated-k7x2m9p4q"
66
+ *
67
+ * @returns A unique isolated instance key
68
+ */
69
+ export declare function generateIsolatedKey(): string;
70
+ /**
71
+ * Check if a key is an isolated instance key
72
+ * @param key - The instance key to check
73
+ * @returns true if the key is an isolated instance key
74
+ */
75
+ export declare function isIsolatedKey(key: string): boolean;
76
+ //# sourceMappingURL=idGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/idGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM;;;;EAU/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Deep clone with circular reference handling
3
+ */
4
+ export declare function cloneDeep<T>(obj: T, cloned?: WeakMap<WeakKey, any>): T;
5
+ /**
6
+ * Deep freeze with circular reference handling
7
+ *
8
+ * Note: Currently disabled by default for proxy tracking compatibility.
9
+ * Proxies cannot intercept property access on frozen objects due to proxy invariants.
10
+ *
11
+ * @param obj - Object to freeze
12
+ * @param frozen - WeakSet for tracking circular references
13
+ * @param enabled - Whether to actually freeze (default: false for proxy compatibility)
14
+ */
15
+ export declare function deepFreeze<T>(obj: T, frozen?: WeakSet<WeakKey>, enabled?: boolean): T;
16
+ //# sourceMappingURL=immutable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../src/utils/immutable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,wBAAgB,GAAG,CAAC,CAyC9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,CAAC,EACN,MAAM,mBAAgB,EACtB,OAAO,UAAQ,GACd,CAAC,CAoBH"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Stack trace utilities for DevTools
3
+ */
4
+ /**
5
+ * Capture and parse the current call stack
6
+ * Filters out internal BlaC framework calls to show only user code
7
+ */
8
+ export declare function captureStackTrace(): string;
9
+ /**
10
+ * Parse a stack trace string into structured data
11
+ */
12
+ export interface StackFrame {
13
+ functionName: string;
14
+ fileName: string;
15
+ lineNumber: number | null;
16
+ columnNumber: number | null;
17
+ }
18
+ export declare function parseStackTrace(stack: string): StackFrame[];
19
+ //# sourceMappingURL=stack-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack-trace.d.ts","sourceRoot":"","sources":["../../src/utils/stack-trace.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CA+B1C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAiC3D"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Utility functions for accessing static properties on StateContainer classes
3
+ */
4
+ /**
5
+ * Get a static property from a class constructor
6
+ * Type-safe helper that avoids (Type as any) casts
7
+ *
8
+ * @param Type - The class constructor
9
+ * @param propName - The property name to access
10
+ * @param defaultValue - Optional default value if property is undefined
11
+ * @returns The property value or default
12
+ */
13
+ export declare function getStaticProp<T>(Type: new (...args: any[]) => any, propName: string, defaultValue?: T): T | undefined;
14
+ /**
15
+ * Check if a class is marked as isolated
16
+ * Isolated classes create separate instances per component
17
+ */
18
+ export declare function isIsolatedClass(Type: new (...args: any[]) => any): boolean;
19
+ /**
20
+ * Check if a class is marked as keepAlive
21
+ * KeepAlive classes are never auto-disposed when ref count reaches 0
22
+ */
23
+ export declare function isKeepAliveClass(Type: new (...args: any[]) => any): boolean;
24
+ /**
25
+ * Check if a class should be excluded from DevTools
26
+ * Used to prevent infinite loops when DevTools tracks itself
27
+ */
28
+ export declare function isExcludedFromDevTools(Type: new (...args: any[]) => any): boolean;
29
+ //# sourceMappingURL=static-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-props.d.ts","sourceRoot":"","sources":["../../src/utils/static-props.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACjC,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,CAAC,GACf,CAAC,GAAG,SAAS,CAEf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,OAAO,CAE1E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,OAAO,CAE3E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAChC,OAAO,CAKT"}
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@blac/core",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0-rc.8",
4
4
  "license": "MIT",
5
5
  "author": "Brendan Mullins <jsnanigans@gmail.com>",
6
- "main": "./dist/index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/jsnanigans/blac.git",
9
+ "directory": "packages/blac"
10
+ },
11
+ "homepage": "https://github.com/jsnanigans/blac#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/jsnanigans/blac/issues"
14
+ },
15
+ "main": "./dist/index.cjs",
7
16
  "module": "./dist/index.js",
8
17
  "types": "./dist/index.d.ts",
9
18
  "exports": {
@@ -19,7 +28,11 @@
19
28
  }
20
29
  },
21
30
  "files": [
22
- "dist",
31
+ "dist/**/*.js",
32
+ "dist/**/*.cjs",
33
+ "dist/**/*.d.ts",
34
+ "dist/**/*.d.cts",
35
+ "dist/**/*.map",
23
36
  "README.md",
24
37
  "LICENSE"
25
38
  ],
@@ -47,7 +60,7 @@
47
60
  },
48
61
  "scripts": {
49
62
  "dev": "tsdown --watch",
50
- "build": "tsdown",
63
+ "build": "tsdown && tsc -p tsconfig.build.json && cp dist/index.d.ts dist/index.d.cts",
51
64
  "clean": "rm -rf dist",
52
65
  "format": "prettier --write \".\"",
53
66
  "lint": "eslint src --ext .ts,.tsx",