@blac/core 2.0.0-rc.1 → 2.0.0-rc.3

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 (121) hide show
  1. package/dist/index.cjs +1361 -38
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +868 -0
  4. package/dist/index.d.ts +867 -16
  5. package/dist/index.js +1315 -37
  6. package/dist/index.js.map +1 -1
  7. package/package.json +17 -11
  8. package/dist/.tsbuildinfo +0 -1
  9. package/dist/Blac.d.ts +0 -246
  10. package/dist/Blac.d.ts.map +0 -1
  11. package/dist/Blac.js +0 -624
  12. package/dist/Blac.js.map +0 -1
  13. package/dist/Bloc.d.ts +0 -41
  14. package/dist/Bloc.d.ts.map +0 -1
  15. package/dist/Bloc.js +0 -140
  16. package/dist/Bloc.js.map +0 -1
  17. package/dist/BlocBase.d.ts +0 -110
  18. package/dist/BlocBase.d.ts.map +0 -1
  19. package/dist/BlocBase.js +0 -287
  20. package/dist/BlocBase.js.map +0 -1
  21. package/dist/Cubit.d.ts +0 -25
  22. package/dist/Cubit.d.ts.map +0 -1
  23. package/dist/Cubit.js +0 -64
  24. package/dist/Cubit.js.map +0 -1
  25. package/dist/adapter/BlacAdapter.d.ts +0 -67
  26. package/dist/adapter/BlacAdapter.d.ts.map +0 -1
  27. package/dist/adapter/BlacAdapter.js +0 -263
  28. package/dist/adapter/BlacAdapter.js.map +0 -1
  29. package/dist/adapter/ProxyFactory.d.ts +0 -50
  30. package/dist/adapter/ProxyFactory.d.ts.map +0 -1
  31. package/dist/adapter/ProxyFactory.js +0 -150
  32. package/dist/adapter/ProxyFactory.js.map +0 -1
  33. package/dist/adapter/index.d.ts +0 -3
  34. package/dist/adapter/index.d.ts.map +0 -1
  35. package/dist/adapter/index.js +0 -19
  36. package/dist/adapter/index.js.map +0 -1
  37. package/dist/errors/BlacError.d.ts +0 -38
  38. package/dist/errors/BlacError.d.ts.map +0 -1
  39. package/dist/errors/BlacError.js +0 -55
  40. package/dist/errors/BlacError.js.map +0 -1
  41. package/dist/errors/ErrorManager.d.ts +0 -39
  42. package/dist/errors/ErrorManager.d.ts.map +0 -1
  43. package/dist/errors/ErrorManager.js +0 -91
  44. package/dist/errors/ErrorManager.js.map +0 -1
  45. package/dist/errors/handleError.d.ts +0 -24
  46. package/dist/errors/handleError.d.ts.map +0 -1
  47. package/dist/errors/handleError.js +0 -62
  48. package/dist/errors/handleError.js.map +0 -1
  49. package/dist/errors/index.d.ts +0 -5
  50. package/dist/errors/index.d.ts.map +0 -1
  51. package/dist/errors/index.js +0 -13
  52. package/dist/errors/index.js.map +0 -1
  53. package/dist/events.d.ts +0 -11
  54. package/dist/events.d.ts.map +0 -1
  55. package/dist/events.js +0 -17
  56. package/dist/events.js.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/lifecycle/BlocLifecycle.d.ts +0 -51
  59. package/dist/lifecycle/BlocLifecycle.d.ts.map +0 -1
  60. package/dist/lifecycle/BlocLifecycle.js +0 -123
  61. package/dist/lifecycle/BlocLifecycle.js.map +0 -1
  62. package/dist/lifecycle/index.d.ts +0 -2
  63. package/dist/lifecycle/index.d.ts.map +0 -1
  64. package/dist/lifecycle/index.js +0 -18
  65. package/dist/lifecycle/index.js.map +0 -1
  66. package/dist/plugins/BlocPluginRegistry.d.ts +0 -58
  67. package/dist/plugins/BlocPluginRegistry.d.ts.map +0 -1
  68. package/dist/plugins/BlocPluginRegistry.js +0 -201
  69. package/dist/plugins/BlocPluginRegistry.js.map +0 -1
  70. package/dist/plugins/SystemPluginRegistry.d.ts +0 -79
  71. package/dist/plugins/SystemPluginRegistry.d.ts.map +0 -1
  72. package/dist/plugins/SystemPluginRegistry.js +0 -184
  73. package/dist/plugins/SystemPluginRegistry.js.map +0 -1
  74. package/dist/plugins/index.d.ts +0 -4
  75. package/dist/plugins/index.d.ts.map +0 -1
  76. package/dist/plugins/index.js +0 -26
  77. package/dist/plugins/index.js.map +0 -1
  78. package/dist/plugins/types.d.ts +0 -103
  79. package/dist/plugins/types.d.ts.map +0 -1
  80. package/dist/plugins/types.js +0 -3
  81. package/dist/plugins/types.js.map +0 -1
  82. package/dist/subscription/SubscriptionManager.d.ts +0 -67
  83. package/dist/subscription/SubscriptionManager.d.ts.map +0 -1
  84. package/dist/subscription/SubscriptionManager.js +0 -317
  85. package/dist/subscription/SubscriptionManager.js.map +0 -1
  86. package/dist/subscription/index.d.ts +0 -3
  87. package/dist/subscription/index.d.ts.map +0 -1
  88. package/dist/subscription/index.js +0 -19
  89. package/dist/subscription/index.js.map +0 -1
  90. package/dist/subscription/types.d.ts +0 -65
  91. package/dist/subscription/types.d.ts.map +0 -1
  92. package/dist/subscription/types.js +0 -3
  93. package/dist/subscription/types.js.map +0 -1
  94. package/dist/testing.d.ts +0 -33
  95. package/dist/testing.d.ts.map +0 -1
  96. package/dist/testing.js +0 -68
  97. package/dist/testing.js.map +0 -1
  98. package/dist/types.d.ts +0 -57
  99. package/dist/types.d.ts.map +0 -1
  100. package/dist/types.js +0 -3
  101. package/dist/types.js.map +0 -1
  102. package/dist/utils/BatchingManager.d.ts +0 -28
  103. package/dist/utils/BatchingManager.d.ts.map +0 -1
  104. package/dist/utils/BatchingManager.js +0 -48
  105. package/dist/utils/BatchingManager.js.map +0 -1
  106. package/dist/utils/RerenderLogger.d.ts +0 -60
  107. package/dist/utils/RerenderLogger.d.ts.map +0 -1
  108. package/dist/utils/RerenderLogger.js +0 -205
  109. package/dist/utils/RerenderLogger.js.map +0 -1
  110. package/dist/utils/generateInstanceId.d.ts +0 -11
  111. package/dist/utils/generateInstanceId.d.ts.map +0 -1
  112. package/dist/utils/generateInstanceId.js +0 -50
  113. package/dist/utils/generateInstanceId.js.map +0 -1
  114. package/dist/utils/shallowEqual.d.ts +0 -9
  115. package/dist/utils/shallowEqual.d.ts.map +0 -1
  116. package/dist/utils/shallowEqual.js +0 -35
  117. package/dist/utils/shallowEqual.js.map +0 -1
  118. package/dist/utils/uuid.d.ts +0 -10
  119. package/dist/utils/uuid.d.ts.map +0 -1
  120. package/dist/utils/uuid.js +0 -24
  121. package/dist/utils/uuid.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,17 +1,868 @@
1
- export * from './Blac';
2
- export * from './Bloc';
3
- export * from './BlocBase';
4
- export * from './Cubit';
5
- export * from './types';
6
- export * from './events';
7
- export * from './subscription';
8
- export * from './lifecycle';
9
- export * from './utils/uuid';
10
- export * from './utils/shallowEqual';
11
- export * from './utils/generateInstanceId';
12
- export * from './utils/RerenderLogger';
13
- export * from './testing';
14
- export * from './adapter';
15
- export * from './plugins';
16
- export * from './errors';
1
+ //#region src/core/StateContainerRegistry.d.ts
2
+
3
+ /**
4
+ * Registry for managing StateContainer instances
5
+ */
6
+ declare class StateContainerRegistry {
7
+ private readonly instances;
8
+ private readonly types;
9
+ /**
10
+ * Register a type with isolation mode
11
+ */
12
+ register<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, isolated?: boolean): void;
13
+ /**
14
+ * Get or create a StateContainer instance
15
+ * For isolated: always creates new
16
+ * For shared: singleton per key
17
+ */
18
+ getOrCreate<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string, ...args: any[]): T;
19
+ /**
20
+ * Release a reference to an instance
21
+ * Disposes when ref count reaches zero (unless keepAlive)
22
+ */
23
+ release<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string, forceDispose?: boolean): void;
24
+ /**
25
+ * Get all instances of a type (shared only, isolated aren't tracked)
26
+ */
27
+ getAll<T extends StateContainer<any>>(constructor: new (...args: any[]) => T): T[];
28
+ /**
29
+ * Clear all instances of a type
30
+ */
31
+ clear<T extends StateContainer<any>>(constructor: new (...args: any[]) => T): void;
32
+ /**
33
+ * Clear all instances from all types (for testing)
34
+ */
35
+ clearAll(): void;
36
+ /**
37
+ * Get registry statistics (for debugging)
38
+ */
39
+ getStats(): {
40
+ registeredTypes: number;
41
+ totalInstances: number;
42
+ typeBreakdown: Record<string, number>;
43
+ };
44
+ /**
45
+ * Get reference count for an instance
46
+ */
47
+ getRefCount<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string): number;
48
+ /**
49
+ * Check if an instance exists
50
+ */
51
+ hasInstance<T extends StateContainer<any>>(constructor: new (...args: any[]) => T, key?: string): boolean;
52
+ }
53
+ /**
54
+ * Global default registry instance
55
+ */
56
+ declare const globalRegistry: StateContainerRegistry;
57
+ //#endregion
58
+ //#region src/core/StateContainer.d.ts
59
+ /**
60
+ * Configuration options for StateContainer
61
+ */
62
+ interface StateContainerConfig {
63
+ /** Container name for debugging */
64
+ name?: string;
65
+ /** Whether to keep container alive when no consumers */
66
+ keepAlive?: boolean;
67
+ /** Enable debug logging */
68
+ debug?: boolean;
69
+ /** Custom instance identifier */
70
+ instanceId?: string;
71
+ /** Whether this instance should be isolated (not shared) */
72
+ isolated?: boolean;
73
+ }
74
+ /**
75
+ * Listener function for state changes
76
+ */
77
+ type StateListener<S$1> = (state: S$1) => void;
78
+ /**
79
+ * Base abstract class for all state containers
80
+ */
81
+ declare abstract class StateContainer<S$1> {
82
+ private static _registry;
83
+ /**
84
+ * Set a custom registry (mainly for testing)
85
+ */
86
+ static setRegistry(registry: StateContainerRegistry): void;
87
+ /**
88
+ * Register a type as isolated or shared
89
+ */
90
+ static register<T extends StateContainer<any>>(this: new (...args: any[]) => T, isolated?: boolean): void;
91
+ /**
92
+ * Get or create an instance
93
+ * @param key - Optional instance key for shared instances
94
+ * @param args - Constructor arguments
95
+ */
96
+ static getOrCreate<T extends StateContainer<any>>(this: new (...args: any[]) => T, key?: string, ...args: any[]): T;
97
+ /**
98
+ * Release a reference to an instance
99
+ * @param key - Optional instance key
100
+ * @param forceDispose - Force dispose regardless of ref count or keepAlive
101
+ */
102
+ static release<T extends StateContainer<any>>(this: new (...args: any[]) => T, key?: string, forceDispose?: boolean): void;
103
+ /**
104
+ * Get all instances of this type
105
+ */
106
+ static getAll<T extends StateContainer<any>>(this: new (...args: any[]) => T): T[];
107
+ /**
108
+ * Clear all instances of this type
109
+ */
110
+ static clear<T extends StateContainer<any>>(this: new (...args: any[]) => T): void;
111
+ /**
112
+ * Clear all instances from all types (for testing)
113
+ */
114
+ static clearAllInstances(): void;
115
+ /**
116
+ * Get registry statistics (for debugging)
117
+ */
118
+ static getStats(): {
119
+ registeredTypes: number;
120
+ totalInstances: number;
121
+ typeBreakdown: Record<string, number>;
122
+ };
123
+ /**
124
+ * Get reference count for an instance
125
+ * @param key - Optional instance key
126
+ */
127
+ static getRefCount<T extends StateContainer<any>>(this: new (...args: any[]) => T, key?: string): number;
128
+ /**
129
+ * Check if an instance exists
130
+ * @param key - Optional instance key
131
+ */
132
+ static hasInstance<T extends StateContainer<any>>(this: new (...args: any[]) => T, key?: string): boolean;
133
+ private _state;
134
+ private readonly listeners;
135
+ private _disposed;
136
+ private readonly config;
137
+ readonly name: string;
138
+ readonly keepAlive: boolean;
139
+ readonly debug: boolean;
140
+ readonly instanceId: string;
141
+ /**
142
+ * Create a new StateContainer
143
+ */
144
+ constructor(initialState: S$1, config?: StateContainerConfig);
145
+ /**
146
+ * Get the current state
147
+ */
148
+ get state(): S$1;
149
+ /**
150
+ * Check if disposed
151
+ */
152
+ get isDisposed(): boolean;
153
+ /**
154
+ * Subscribe to state changes
155
+ * @returns Unsubscribe function
156
+ */
157
+ subscribe(listener: StateListener<S$1>): () => void;
158
+ /**
159
+ * Dispose the container
160
+ */
161
+ dispose(): void;
162
+ /**
163
+ * Emit a new state (with change detection)
164
+ */
165
+ protected emit(newState: S$1): void;
166
+ /**
167
+ * Update state using a function
168
+ */
169
+ protected update(updater: (current: S$1) => S$1): void;
170
+ /**
171
+ * Optional disposal hook for subclasses
172
+ */
173
+ protected onDispose?(): void;
174
+ /**
175
+ * Optional state change hook for subclasses
176
+ */
177
+ protected onStateChange?(newState: S$1, previousState: S$1): void;
178
+ }
179
+ //#endregion
180
+ //#region src/core/Cubit.d.ts
181
+ /**
182
+ * Cubit is a simple state container that allows direct state emission
183
+ *
184
+ * Unlike StateContainer (where emit is protected), Cubit exposes emit and update
185
+ * as public methods to allow direct state management.
186
+ */
187
+ declare abstract class Cubit<S$1> extends StateContainer<S$1> {
188
+ /**
189
+ * Create a new Cubit
190
+ * @param initialState Initial state value
191
+ * @param config Configuration options
192
+ */
193
+ constructor(initialState: S$1, config?: StateContainerConfig);
194
+ /**
195
+ * Emit a new state (public override of protected parent method)
196
+ */
197
+ emit(newState: S$1): void;
198
+ /**
199
+ * Update state using a function (public override of protected parent method)
200
+ */
201
+ update(updater: (current: S$1) => S$1): void;
202
+ /**
203
+ * Patch state with partial updates (shallow merge)
204
+ * Only available when state is an object type
205
+ * Arrow function to maintain correct 'this' binding in React
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * // Update single field
210
+ * this.patch({ count: 5 });
211
+ *
212
+ * // Update multiple fields
213
+ * this.patch({ count: 5, name: 'Updated' });
214
+ * ```
215
+ */
216
+ patch: S$1 extends object ? (partial: Partial<S$1>) => void : never;
217
+ }
218
+ /**
219
+ * Example: Counter Cubit
220
+ */
221
+ declare class CounterCubit extends Cubit<number> {
222
+ constructor();
223
+ increment: () => void;
224
+ decrement: () => void;
225
+ reset: () => void;
226
+ addAmount: (amount: number) => void;
227
+ }
228
+ /**
229
+ * Example: Complex State Cubit
230
+ */
231
+ interface TodoState {
232
+ todos: Array<{
233
+ id: string;
234
+ text: string;
235
+ done: boolean;
236
+ }>;
237
+ filter: 'all' | 'active' | 'completed';
238
+ isLoading: boolean;
239
+ }
240
+ declare class TodoCubit extends Cubit<TodoState> {
241
+ private nextId;
242
+ constructor();
243
+ addTodo: (text: string) => void;
244
+ toggleTodo: (id: string) => void;
245
+ removeTodo: (id: string) => void;
246
+ setFilter: (filter: TodoState["filter"]) => void;
247
+ setLoading: (isLoading: boolean) => void;
248
+ get visibleTodos(): {
249
+ id: string;
250
+ text: string;
251
+ done: boolean;
252
+ }[];
253
+ get activeTodoCount(): number;
254
+ }
255
+ //#endregion
256
+ //#region src/types/events.d.ts
257
+ /**
258
+ * Base event interface for type-safe event system
259
+ */
260
+ /**
261
+ * Base event interface
262
+ * Used by Vertex for event-driven state management
263
+ */
264
+ interface BaseEvent {
265
+ readonly type: string;
266
+ readonly timestamp: number;
267
+ readonly source?: string;
268
+ }
269
+ //#endregion
270
+ //#region src/core/Vertex.d.ts
271
+ /**
272
+ * Event handler signature (synchronous only)
273
+ */
274
+ type EventHandler<E extends BaseEvent, S$1> = (event: E, emit: (state: S$1) => void) => void;
275
+ /**
276
+ * Type-safe event constructor
277
+ */
278
+ type EventConstructor<T$1 extends BaseEvent = BaseEvent> = new (...args: never[]) => T$1;
279
+ /**
280
+ * Vertex is an event-driven state container (Bloc pattern)
281
+ *
282
+ * Includes its own simple event system since events are only needed
283
+ * for the Vertex pattern, not for the base StateContainer.
284
+ */
285
+ declare abstract class Vertex<S$1, E extends BaseEvent = BaseEvent> extends StateContainer<S$1> {
286
+ private eventHandlers;
287
+ private isProcessing;
288
+ private eventQueue;
289
+ /**
290
+ * Create a new Vertex
291
+ * @param initialState Initial state value
292
+ * @param config Configuration options
293
+ */
294
+ constructor(initialState: S$1, config?: StateContainerConfig);
295
+ /**
296
+ * Register an event handler
297
+ * Arrow function to maintain correct 'this' binding
298
+ */
299
+ protected on: <T extends E>(EventClass: EventConstructor<T>, handler: EventHandler<T, S$1>) => void;
300
+ /**
301
+ * Add an event to be processed
302
+ * Arrow function to maintain correct 'this' binding in React
303
+ */
304
+ add: (event: E) => void;
305
+ /**
306
+ * Process an event (synchronously)
307
+ */
308
+ private processEvent;
309
+ /**
310
+ * Handle a single event (synchronously)
311
+ */
312
+ private handleEvent;
313
+ /**
314
+ * Hook for handling event processing errors
315
+ */
316
+ protected onEventError(event: E, error: Error): void;
317
+ }
318
+ /**
319
+ * Example: Counter Events
320
+ */
321
+ declare class IncrementEvent implements BaseEvent {
322
+ readonly amount: number;
323
+ readonly type = "increment";
324
+ readonly timestamp: number;
325
+ constructor(amount?: number);
326
+ }
327
+ declare class DecrementEvent implements BaseEvent {
328
+ readonly amount: number;
329
+ readonly type = "decrement";
330
+ readonly timestamp: number;
331
+ constructor(amount?: number);
332
+ }
333
+ declare class ResetEvent implements BaseEvent {
334
+ readonly type = "reset";
335
+ readonly timestamp: number;
336
+ }
337
+ /**
338
+ * Example: Counter Vertex
339
+ * Demonstrates proper typing and event handling
340
+ */
341
+ declare class CounterVertex extends Vertex<number> {
342
+ constructor();
343
+ increment: (amount?: number) => void;
344
+ decrement: (amount?: number) => void;
345
+ reset: () => void;
346
+ }
347
+ /**
348
+ * Auth State and Events for testing async handlers
349
+ */
350
+ interface AuthState {
351
+ isAuthenticated: boolean;
352
+ isLoading: boolean;
353
+ user: {
354
+ id: string;
355
+ name: string;
356
+ email: string;
357
+ } | null;
358
+ error: string | null;
359
+ }
360
+ declare class LoginEvent implements BaseEvent {
361
+ readonly email: string;
362
+ readonly password: string;
363
+ readonly type = "login";
364
+ readonly timestamp: number;
365
+ constructor(email: string, password: string);
366
+ }
367
+ declare class LogoutEvent implements BaseEvent {
368
+ readonly type = "logout";
369
+ readonly timestamp: number;
370
+ }
371
+ declare class AuthVertex extends Vertex<AuthState> {
372
+ constructor();
373
+ login: (email: string, password: string) => void;
374
+ logout: () => void;
375
+ }
376
+ //#endregion
377
+ //#region src/types/branded.d.ts
378
+ /**
379
+ * Branded types for type-safe IDs
380
+ * These types ensure that IDs can't be accidentally mixed up
381
+ */
382
+ /**
383
+ * Helper type for cases where any object type is acceptable
384
+ * Used sparingly only where type cannot be more specific
385
+ * eslint-disable-next-line @typescript-eslint/no-explicit-any
386
+ */
387
+ type AnyObject = any;
388
+ /** Unique symbol for branding */
389
+ declare const brand: unique symbol;
390
+ /** Type branding utility */
391
+ type Brand<T$1, B> = T$1 & {
392
+ [brand]: B;
393
+ };
394
+ /** Generic branded ID type */
395
+ type BrandedId<B> = Brand<string, B>;
396
+ /** Branded instance ID type */
397
+ type InstanceId = Brand<string, 'InstanceId'>;
398
+ //#endregion
399
+ //#region src/tracking/proxy-tracker.d.ts
400
+ /**
401
+ * Functional proxy tracker for automatic dependency tracking
402
+ *
403
+ * This module provides a functional approach to proxy-based dependency tracking.
404
+ * Unlike the class-based ProxyTracker, this uses a state object pattern that's
405
+ * easier to integrate with functional programming patterns and framework hooks.
406
+ */
407
+ /**
408
+ * Check if a value can be proxied
409
+ *
410
+ * Returns true for plain objects and arrays only.
411
+ * Excludes built-in objects like Date, Map, Set, etc.
412
+ */
413
+ declare function isProxyable(value: unknown): value is object;
414
+ /**
415
+ * State container for proxy tracking
416
+ */
417
+ interface ProxyTrackerState<T$1> {
418
+ /** Set of all tracked property paths */
419
+ trackedPaths: Set<string>;
420
+ /** Whether tracking is currently active */
421
+ isTracking: boolean;
422
+ /** Cache of created proxies to avoid duplicates */
423
+ proxyCache: WeakMap<object, any>;
424
+ /** Cache of bound functions to maintain referential equality */
425
+ boundFunctionsCache: WeakMap<Function, Function> | null;
426
+ /** Last state object that was proxied (for cache invalidation) */
427
+ lastProxiedState: T$1 | null;
428
+ /** Last proxy created (for cache reuse) */
429
+ lastProxy: T$1 | null;
430
+ /** Maximum depth for nested proxy creation */
431
+ maxDepth: number;
432
+ }
433
+ /**
434
+ * Create a new proxy tracker state
435
+ *
436
+ * @example
437
+ * const state = createProxyTrackerState<MyState>();
438
+ * startProxyTracking(state);
439
+ * const proxy = createProxyForTarget(state, myObject);
440
+ * // ... use proxy ...
441
+ * const paths = stopProxyTracking(state);
442
+ */
443
+ declare function createProxyTrackerState<T$1>(): ProxyTrackerState<T$1>;
444
+ /**
445
+ * Start tracking property accesses
446
+ *
447
+ * Clears previous tracked paths and enables tracking mode.
448
+ */
449
+ declare function startProxyTracking<T$1>(state: ProxyTrackerState<T$1>): void;
450
+ /**
451
+ * Stop tracking and return the tracked paths
452
+ *
453
+ * Returns a new Set containing all tracked paths.
454
+ */
455
+ declare function stopProxyTracking<T$1>(state: ProxyTrackerState<T$1>): Set<string>;
456
+ /**
457
+ * Create a proxy for an array with property access tracking
458
+ *
459
+ * Tracks:
460
+ * - Array element access (arr[0])
461
+ * - Length access (arr.length)
462
+ * - Array method calls (arr.map, arr.filter, etc.)
463
+ */
464
+ declare function createArrayProxy<T$1, U>(state: ProxyTrackerState<T$1>, target: U[], path: string, depth?: number): U[];
465
+ /**
466
+ * Create a proxy for an object with property access tracking
467
+ *
468
+ * This is the core proxy creation function that recursively creates proxies
469
+ * for nested objects and arrays.
470
+ *
471
+ * Tracks:
472
+ * - Property access (obj.prop)
473
+ * - Nested property access (obj.nested.prop)
474
+ * - 'in' operator usage ('prop' in obj)
475
+ * - Object.keys, Object.entries, etc.
476
+ */
477
+ declare function createProxyInternal<T$1>(state: ProxyTrackerState<T$1>, target: T$1, path?: string, depth?: number): T$1;
478
+ /**
479
+ * Create a proxy for a target with caching
480
+ *
481
+ * If the target hasn't changed since the last call, returns the cached proxy.
482
+ * Otherwise, creates a new proxy and caches it.
483
+ *
484
+ * This is the main entry point for creating tracked proxies.
485
+ */
486
+ declare function createProxyForTarget<T$1>(state: ProxyTrackerState<T$1>, target: T$1): T$1;
487
+ //#endregion
488
+ //#region src/tracking/dependency-tracker.d.ts
489
+ /**
490
+ * Information about a tracked path
491
+ */
492
+ interface PathInfo {
493
+ /** Parsed path segments */
494
+ segments: string[];
495
+ /** Last known value at this path */
496
+ value: any;
497
+ }
498
+ /**
499
+ * State for dependency tracking
500
+ */
501
+ interface TrackerState<T$1 extends AnyObject> {
502
+ /** Internal proxy tracker state */
503
+ proxyTrackerState: ProxyTrackerState<T$1>;
504
+ /** Paths tracked in the previous render */
505
+ previousRenderPaths: Set<string>;
506
+ /** Paths tracked in the current render */
507
+ currentRenderPaths: Set<string>;
508
+ /** Cache of parsed paths and their values */
509
+ pathCache: Map<string, PathInfo>;
510
+ /** Last state object that was checked for changes */
511
+ lastCheckedState: T$1 | null;
512
+ /** Values from the last change check (optimization) */
513
+ lastCheckedValues: Map<string, any>;
514
+ /** Counter for periodic cleanup of unused paths */
515
+ cleanupCounter: number;
516
+ }
517
+ /**
518
+ * Create a new tracker state
519
+ */
520
+ declare function createTrackerState<T$1 extends AnyObject>(): TrackerState<T$1>;
521
+ /**
522
+ * Start tracking property accesses
523
+ */
524
+ declare function startTracking<T$1 extends AnyObject>(tracker: TrackerState<T$1>): void;
525
+ /**
526
+ * Create a proxy for the given state
527
+ */
528
+ declare function createProxy<T$1 extends AnyObject>(tracker: TrackerState<T$1>, state: T$1): T$1;
529
+ /**
530
+ * Capture the paths that were tracked during a render
531
+ *
532
+ * This should be called after each render to record which paths were accessed.
533
+ * It also performs periodic cleanup of unused paths to prevent memory leaks.
534
+ */
535
+ declare function captureTrackedPaths<T$1 extends AnyObject>(tracker: TrackerState<T$1>, state: T$1): void;
536
+ /**
537
+ * Check if any tracked paths have changed
538
+ *
539
+ * This is called when state changes to determine if a re-render is needed.
540
+ * Returns true if any tracked path has a different value than before.
541
+ */
542
+ declare function hasChanges<T$1 extends AnyObject>(tracker: TrackerState<T$1>, state: T$1): boolean;
543
+ /**
544
+ * Check if tracker has any tracked data
545
+ *
546
+ * Returns true if there are any tracked paths or cached paths.
547
+ */
548
+ declare function hasTrackedData<T$1 extends AnyObject>(tracker: TrackerState<T$1>): boolean;
549
+ //#endregion
550
+ //#region src/tracking/path-utils.d.ts
551
+ /**
552
+ * Path utilities for dependency tracking
553
+ *
554
+ * Provides utilities for parsing property paths and extracting values
555
+ * from nested objects using path strings.
556
+ */
557
+ /**
558
+ * Parse a property path string into an array of segments
559
+ *
560
+ * Handles both dot notation (a.b.c) and bracket notation (a[0].b)
561
+ *
562
+ * @example
563
+ * parsePath('user.name') // ['user', 'name']
564
+ * parsePath('items[0].name') // ['items', '0', 'name']
565
+ * parsePath('data.users[2].address.city') // ['data', 'users', '2', 'address', 'city']
566
+ */
567
+ declare function parsePath(path: string): string[];
568
+ /**
569
+ * Get a value from an object using a path of segments
570
+ *
571
+ * @example
572
+ * const obj = { user: { name: 'Alice', age: 30 } }
573
+ * getValueAtPath(obj, ['user', 'name']) // 'Alice'
574
+ * getValueAtPath(obj, ['user', 'age']) // 30
575
+ * getValueAtPath(obj, ['user', 'missing']) // undefined
576
+ */
577
+ declare function getValueAtPath(obj: any, segments: string[]): any;
578
+ /**
579
+ * Shallow equality comparison for arrays
580
+ *
581
+ * Compares two arrays element-by-element using Object.is
582
+ *
583
+ * @example
584
+ * shallowEqual([1, 2, 3], [1, 2, 3]) // true
585
+ * shallowEqual([1, 2, 3], [1, 2, 4]) // false
586
+ * shallowEqual([1, 2], [1, 2, 3]) // false
587
+ */
588
+ declare function shallowEqual(arr1: unknown[], arr2: unknown[]): boolean;
589
+ //#endregion
590
+ //#region src/proxy/ProxyTracker.d.ts
591
+ /**
592
+ * ProxyTracker - Automatic dependency tracking through Proxies
593
+ *
594
+ * Tracks property access on state objects to automatically determine
595
+ * which parts of the state a component depends on.
596
+ */
597
+ /**
598
+ * Tracks property access on state objects
599
+ */
600
+ declare class ProxyTracker<T$1> {
601
+ private trackedPaths;
602
+ private isTracking;
603
+ private proxyCache;
604
+ private maxDepth;
605
+ /**
606
+ * Create a proxy that tracks property access
607
+ */
608
+ createProxy(target: T$1, path?: string, depth?: number): T$1;
609
+ /**
610
+ * Create a proxy for arrays with special handling
611
+ */
612
+ private createArrayProxy;
613
+ /**
614
+ * Start tracking property access
615
+ */
616
+ startTracking(): void;
617
+ /**
618
+ * Stop tracking and return tracked paths
619
+ */
620
+ stopTracking(): Set<string>;
621
+ /**
622
+ * Get currently tracked paths
623
+ */
624
+ getTrackedPaths(): ReadonlySet<string>;
625
+ /**
626
+ * Check if currently tracking
627
+ */
628
+ isCurrentlyTracking(): boolean;
629
+ /**
630
+ * Clear proxy cache (useful for memory management)
631
+ */
632
+ clearCache(): void;
633
+ /**
634
+ * Set maximum tracking depth
635
+ */
636
+ setMaxDepth(depth: number): void;
637
+ /**
638
+ * Add a path manually (useful for forcing dependencies)
639
+ */
640
+ addPath(path: string): void;
641
+ /**
642
+ * Remove a path manually
643
+ */
644
+ removePath(path: string): void;
645
+ /**
646
+ * Clear all tracked paths
647
+ */
648
+ clearPaths(): void;
649
+ }
650
+ /**
651
+ * Global proxy tracker instance for convenience
652
+ */
653
+ declare const globalProxyTracker: ProxyTracker<unknown>;
654
+ /**
655
+ * Utility function to track property access in a callback
656
+ */
657
+ declare function trackAccess<T$1, R>(state: T$1, callback: (proxiedState: T$1) => R): {
658
+ result: R;
659
+ trackedPaths: Set<string>;
660
+ };
661
+ //#endregion
662
+ //#region src/types/utilities.d.ts
663
+ /**
664
+ * Extract state type from StateContainer
665
+ *
666
+ * @example
667
+ * ```ts
668
+ * class CounterBloc extends Cubit<number> { ... }
669
+ * type State = ExtractState<CounterBloc>; // number
670
+ * ```
671
+ */
672
+ type ExtractState<T$1> = T$1 extends StateContainer<infer S> ? S : never;
673
+ /**
674
+ * Extract constructor parameter types from a Bloc class
675
+ *
676
+ * @example
677
+ * ```ts
678
+ * class UserBloc extends Cubit<UserState> {
679
+ * constructor(userId: string, config: Config) { ... }
680
+ * }
681
+ * type Args = ExtractConstructorArgs<typeof UserBloc>; // [string, Config]
682
+ * ```
683
+ */
684
+ type ExtractConstructorArgs<T$1> = T$1 extends (new (...args: infer P) => AnyObject) ? P : never[];
685
+ /**
686
+ * Bloc constructor type - represents a class constructor for StateContainer subclasses
687
+ * Includes static methods from StateContainer for instance management
688
+ *
689
+ * Note: Uses `any` for state type to support variance - the actual Bloc instance
690
+ * will have the correct specific types inferred at usage sites.
691
+ *
692
+ * @example
693
+ * ```ts
694
+ * function createBloc<TBloc extends StateContainer<any>>(
695
+ * BlocClass: BlocConstructor<TBloc>
696
+ * ): TBloc {
697
+ * return BlocClass.getOrCreate();
698
+ * }
699
+ * ```
700
+ */
701
+ type BlocConstructor<TBloc extends StateContainer<any>> = (new (...args: any[]) => TBloc) & {
702
+ getOrCreate?(instanceKey?: string, ...args: any[]): TBloc;
703
+ release?(instanceKey?: string): void;
704
+ isolated?: boolean;
705
+ keepAlive?: boolean;
706
+ };
707
+ //#endregion
708
+ //#region src/logging/Logger.d.ts
709
+ declare enum LogLevel {
710
+ ERROR = 0,
711
+ WARN = 1,
712
+ INFO = 2,
713
+ DEBUG = 3,
714
+ }
715
+ interface LogEntry {
716
+ level: string;
717
+ context: string;
718
+ message: string;
719
+ data?: any;
720
+ timestamp: number;
721
+ }
722
+ interface LogConfig {
723
+ enabled: boolean;
724
+ level: LogLevel;
725
+ output: (entry: LogEntry) => void;
726
+ }
727
+ /**
728
+ * Creates a logger instance with given configuration
729
+ *
730
+ * @param config - Logger configuration
731
+ * @returns Logger instance with debug, info, warn, error, and configure methods
732
+ *
733
+ * @example
734
+ * ```ts
735
+ * const logger = createLogger({
736
+ * enabled: true,
737
+ * level: LogLevel.DEBUG,
738
+ * output: (entry) => console.log(JSON.stringify(entry))
739
+ * });
740
+ * logger.debug('MyComponent', 'Rendering', { props: { foo: 'bar' } });
741
+ * ```
742
+ */
743
+ declare function createLogger(config: LogConfig): {
744
+ debug: (context: string, message: string, data?: any) => void;
745
+ info: (context: string, message: string, data?: any) => void;
746
+ warn: (context: string, message: string, data?: any) => void;
747
+ error: (context: string, message: string, data?: any) => void;
748
+ configure: (opts: Partial<LogConfig>) => void;
749
+ };
750
+ declare const debug: (context: string, message: string, data?: any) => void;
751
+ declare const info: (context: string, message: string, data?: any) => void;
752
+ declare const warn: (context: string, message: string, data?: any) => void;
753
+ declare const error: (context: string, message: string, data?: any) => void;
754
+ /**
755
+ * Configuration function that recreates the default logger
756
+ *
757
+ * @param opts - Partial logger configuration
758
+ *
759
+ * @example
760
+ * ```ts
761
+ * configureLogger({ enabled: true, level: LogLevel.DEBUG });
762
+ * ```
763
+ */
764
+ declare function configureLogger(opts: Partial<LogConfig>): void;
765
+ //#endregion
766
+ //#region src/constants.d.ts
767
+ /**
768
+ * Default configuration constants for BlaC
769
+ *
770
+ * Centralized location for all magic numbers and default values.
771
+ */
772
+ /**
773
+ * Default configuration constants for BlaC
774
+ */
775
+ declare const BLAC_DEFAULTS: {
776
+ /**
777
+ * Default cleanup interval for subscriptions (30 seconds)
778
+ */
779
+ readonly CLEANUP_INTERVAL_MS: 30000;
780
+ /**
781
+ * Cleanup interval for weak reference stage (10 seconds)
782
+ */
783
+ readonly WEAKREF_CLEANUP_INTERVAL_MS: 10000;
784
+ /**
785
+ * Default maximum subscriptions per container
786
+ */
787
+ readonly MAX_SUBSCRIPTIONS: 1000;
788
+ /**
789
+ * Maximum subscriptions for high-performance mode
790
+ */
791
+ readonly MAX_SUBSCRIPTIONS_HIGH_PERF: 10000;
792
+ /**
793
+ * Default timeout for pipeline execution (5 seconds)
794
+ */
795
+ readonly PIPELINE_TIMEOUT_MS: 5000;
796
+ /**
797
+ * Cleanup interval for high-performance mode (5 seconds)
798
+ */
799
+ readonly CLEANUP_INTERVAL_HIGH_PERF_MS: 5000;
800
+ /**
801
+ * Maximum number of stages in a pipeline
802
+ */
803
+ readonly MAX_PIPELINE_STAGES: 30;
804
+ };
805
+ //#endregion
806
+ //#region src/utils/idGenerator.d.ts
807
+ /**
808
+ * Centralized ID Generation
809
+ *
810
+ * Provides consistent, collision-resistant ID generation for all BlaC subsystems.
811
+ * Uses timestamp + counter + random suffix for uniqueness.
812
+ */
813
+ /**
814
+ * Creates an ID generator with isolated counter state
815
+ *
816
+ * @param prefix - Prefix for generated IDs
817
+ * @returns Object with next(), nextSimple(), and reset() methods
818
+ *
819
+ * @example
820
+ * ```ts
821
+ * const generator = createIdGenerator('sub');
822
+ * const id1 = generator.next(); // "sub_1698765432100_1_a3k9d7f2q"
823
+ * const id2 = generator.next(); // "sub_1698765432101_2_b4n8e9g3r"
824
+ * ```
825
+ */
826
+ declare function createIdGenerator(prefix: string): {
827
+ next: () => string;
828
+ nextSimple: () => string;
829
+ reset: () => void;
830
+ };
831
+ /**
832
+ * Generate ID with timestamp, counter, and random suffix (tree-shakeable)
833
+ *
834
+ * Format: `${prefix}_${timestamp}_${counter}_${random}`
835
+ *
836
+ * @param prefix - Prefix for the ID (e.g., 'sub', 'consumer', 'stage')
837
+ * @returns Branded ID string
838
+ *
839
+ * @example
840
+ * ```ts
841
+ * const id = generateId('sub');
842
+ * // Returns: "sub_1698765432100_1_a3k9d7f2q"
843
+ * ```
844
+ */
845
+ declare function generateId(prefix: string): string;
846
+ /**
847
+ * Generate simple ID with timestamp and random (no counter tracking)
848
+ *
849
+ * Format: `${prefix}_${timestamp}_${random}`
850
+ *
851
+ * @param prefix - Prefix for the ID
852
+ * @returns Branded ID string
853
+ *
854
+ * @example
855
+ * ```ts
856
+ * const id = generateSimpleId('CounterBloc');
857
+ * // Returns: "CounterBloc_1698765432100_a3k9d7f2q"
858
+ * ```
859
+ */
860
+ declare function generateSimpleId(prefix: string): string;
861
+ /**
862
+ * Reset all counters for testing purposes
863
+ * @internal
864
+ */
865
+ declare function __resetIdCounters(): void;
866
+ //#endregion
867
+ export { type AnyObject, AuthState, AuthVertex, BLAC_DEFAULTS, type BaseEvent, BlocConstructor, type Brand, type BrandedId, CounterCubit, CounterVertex, Cubit, DecrementEvent, EventConstructor, EventHandler, ExtractConstructorArgs, ExtractState, IncrementEvent, type InstanceId, type LogConfig, type LogEntry, LogLevel, LoginEvent, LogoutEvent, PathInfo, ProxyTracker, ProxyTrackerState, ResetEvent, StateContainer, StateContainerConfig, StateContainerRegistry, TodoCubit, TodoState, TrackerState, Vertex, __resetIdCounters, captureTrackedPaths, configureLogger, createArrayProxy, createIdGenerator, createLogger, createProxy, createProxyForTarget, createProxyInternal, createProxyTrackerState, createTrackerState, debug, error, generateId, generateSimpleId, getValueAtPath, globalProxyTracker, globalRegistry, hasChanges, hasTrackedData, info, isProxyable, parsePath, shallowEqual, startProxyTracking, startTracking, stopProxyTracking, trackAccess, warn };
17
868
  //# sourceMappingURL=index.d.ts.map