@signaltree/core 6.0.0 → 6.0.1

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 (78) hide show
  1. package/README.md +76 -76
  2. package/dist/constants.js +6 -0
  3. package/dist/deep-equal.js +41 -0
  4. package/dist/enhancers/batching/batching.js +189 -0
  5. package/dist/enhancers/devtools/devtools.js +306 -0
  6. package/dist/enhancers/effects/effects.js +66 -0
  7. package/dist/enhancers/entities/entities.js +51 -0
  8. package/dist/enhancers/index.js +72 -0
  9. package/dist/enhancers/memoization/memoization.js +420 -0
  10. package/dist/enhancers/presets/lib/presets.js +27 -0
  11. package/dist/enhancers/serialization/constants.js +15 -0
  12. package/dist/enhancers/serialization/serialization.js +656 -0
  13. package/dist/enhancers/time-travel/time-travel.js +231 -0
  14. package/dist/enhancers/time-travel/utils.js +11 -0
  15. package/dist/index.js +19 -0
  16. package/dist/is-built-in-object.js +23 -0
  17. package/dist/lib/async-helpers.js +77 -0
  18. package/dist/lib/constants.js +56 -0
  19. package/dist/lib/entity-signal.js +283 -0
  20. package/dist/lib/memory/memory-manager.js +164 -0
  21. package/dist/lib/path-notifier.js +106 -0
  22. package/dist/lib/presets.js +21 -0
  23. package/dist/lib/security/security-validator.js +121 -0
  24. package/dist/lib/signal-tree.js +277 -0
  25. package/dist/lib/types.js +9 -0
  26. package/dist/lib/utils.js +299 -0
  27. package/dist/lru-cache.js +64 -0
  28. package/dist/parse-path.js +13 -0
  29. package/package.json +1 -1
  30. package/src/enhancers/batching/batching.d.ts +11 -0
  31. package/src/enhancers/batching/batching.types.d.ts +1 -0
  32. package/src/enhancers/batching/index.d.ts +1 -0
  33. package/src/enhancers/batching/test-setup.d.ts +3 -0
  34. package/src/enhancers/devtools/devtools.d.ts +68 -0
  35. package/src/enhancers/devtools/devtools.types.d.ts +1 -0
  36. package/src/enhancers/devtools/index.d.ts +1 -0
  37. package/src/enhancers/devtools/test-setup.d.ts +3 -0
  38. package/src/enhancers/effects/effects.d.ts +9 -0
  39. package/src/enhancers/effects/effects.types.d.ts +1 -0
  40. package/src/enhancers/effects/index.d.ts +1 -0
  41. package/src/enhancers/entities/entities.d.ts +11 -0
  42. package/src/enhancers/entities/entities.types.d.ts +1 -0
  43. package/src/enhancers/entities/index.d.ts +1 -0
  44. package/src/enhancers/entities/test-setup.d.ts +3 -0
  45. package/src/enhancers/index.d.ts +3 -0
  46. package/src/enhancers/memoization/index.d.ts +1 -0
  47. package/src/enhancers/memoization/memoization.d.ts +54 -0
  48. package/src/enhancers/memoization/memoization.types.d.ts +1 -0
  49. package/src/enhancers/memoization/test-setup.d.ts +3 -0
  50. package/src/enhancers/presets/index.d.ts +1 -0
  51. package/src/enhancers/presets/lib/presets.d.ts +8 -0
  52. package/src/enhancers/serialization/constants.d.ts +14 -0
  53. package/src/enhancers/serialization/index.d.ts +2 -0
  54. package/src/enhancers/serialization/serialization.d.ts +68 -0
  55. package/src/enhancers/serialization/test-setup.d.ts +3 -0
  56. package/src/enhancers/test-helpers/types-equals.d.ts +2 -0
  57. package/src/enhancers/time-travel/index.d.ts +1 -0
  58. package/src/enhancers/time-travel/test-setup.d.ts +3 -0
  59. package/src/enhancers/time-travel/time-travel.d.ts +10 -0
  60. package/src/enhancers/time-travel/time-travel.types.d.ts +1 -0
  61. package/src/enhancers/time-travel/utils.d.ts +2 -0
  62. package/src/enhancers/types.d.ts +1 -0
  63. package/src/enhancers/typing/helpers-types.d.ts +2 -0
  64. package/src/index.d.ts +17 -0
  65. package/src/lib/async-helpers.d.ts +8 -0
  66. package/src/lib/constants.d.ts +41 -0
  67. package/src/lib/dev-proxy.d.ts +3 -0
  68. package/src/lib/entity-signal.d.ts +1 -0
  69. package/src/lib/memory/memory-manager.d.ts +30 -0
  70. package/src/lib/path-notifier.d.ts +4 -0
  71. package/src/lib/performance/diff-engine.d.ts +33 -0
  72. package/src/lib/performance/path-index.d.ts +25 -0
  73. package/src/lib/performance/update-engine.d.ts +32 -0
  74. package/src/lib/presets.d.ts +34 -0
  75. package/src/lib/security/security-validator.d.ts +33 -0
  76. package/src/lib/signal-tree.d.ts +3 -0
  77. package/src/lib/types.d.ts +301 -0
  78. package/src/lib/utils.d.ts +32 -0
@@ -0,0 +1,299 @@
1
+ import { isSignal, signal, runInInjectionContext, effect } from '@angular/core';
2
+ import { isBuiltInObject } from '../is-built-in-object.js';
3
+
4
+ const CALLABLE_SIGNAL_SYMBOL = Symbol.for('SignalTree:NodeAccessor');
5
+ function isEntityMapMarker(value) {
6
+ return Boolean(value && typeof value === 'object' && value.__isEntityMap === true);
7
+ }
8
+ function isNodeAccessor(value) {
9
+ return typeof value === 'function' && value && CALLABLE_SIGNAL_SYMBOL in value;
10
+ }
11
+ function isAnySignal(value) {
12
+ return isSignal(value) || isNodeAccessor(value);
13
+ }
14
+ function toWritableSignal(node, injector) {
15
+ const sig = signal(node());
16
+ const originalSet = sig.set.bind(sig);
17
+ const runner = () => {
18
+ originalSet(node());
19
+ };
20
+ if (injector) {
21
+ runInInjectionContext(injector, () => effect(runner));
22
+ } else {
23
+ try {
24
+ effect(runner);
25
+ } catch {
26
+ console.warn('[SignalTree] toWritableSignal called without injection context; pass Injector for reactivity.');
27
+ }
28
+ }
29
+ sig.set = value => {
30
+ node(value);
31
+ originalSet(value);
32
+ };
33
+ sig.update = updater => {
34
+ sig.set(updater(sig()));
35
+ };
36
+ return sig;
37
+ }
38
+ function composeEnhancers(...enhancers) {
39
+ return tree => enhancers.reduce((t, e) => e(t), tree);
40
+ }
41
+ function createLazySignalTree(obj, equalityFn, basePath = '', memoryManager) {
42
+ const signalCache = new Map();
43
+ const nestedProxies = new Map();
44
+ const nestedCleanups = new Map();
45
+ const cleanup = () => {
46
+ nestedCleanups.forEach(fn => {
47
+ try {
48
+ fn();
49
+ } catch (error) {
50
+ console.warn('Error during nested cleanup:', error);
51
+ }
52
+ });
53
+ nestedCleanups.clear();
54
+ signalCache.clear();
55
+ nestedProxies.clear();
56
+ if (memoryManager) {
57
+ memoryManager.dispose();
58
+ }
59
+ };
60
+ const proxy = new Proxy(obj, {
61
+ get(target, prop) {
62
+ if (prop === '__cleanup__') return cleanup;
63
+ if (typeof prop === 'symbol') {
64
+ return target[prop];
65
+ }
66
+ if (prop === 'valueOf' || prop === 'toString') {
67
+ return target[prop];
68
+ }
69
+ const key = prop;
70
+ const path = basePath ? `${basePath}.${key}` : key;
71
+ if (!(key in target)) return undefined;
72
+ const value = target[key];
73
+ if (isSignal(value)) return value;
74
+ if (value && typeof value === 'object' && typeof value.addOne === 'function' && typeof value.all === 'function') {
75
+ return value;
76
+ }
77
+ if (isEntityMapMarker(value)) return value;
78
+ if (memoryManager) {
79
+ const cached = memoryManager.getSignal(path);
80
+ if (cached) return cached;
81
+ }
82
+ if (signalCache.has(path)) return signalCache.get(path);
83
+ if (nestedProxies.has(path)) return nestedProxies.get(path);
84
+ if (value && typeof value === 'object' && !Array.isArray(value) && !isSignal(value) && !isBuiltInObject(value)) {
85
+ try {
86
+ const nestedProxy = createLazySignalTree(value, equalityFn, path, memoryManager);
87
+ nestedProxies.set(path, nestedProxy);
88
+ const proxyWithCleanup = nestedProxy;
89
+ if (typeof proxyWithCleanup.__cleanup__ === 'function') {
90
+ nestedCleanups.set(path, proxyWithCleanup.__cleanup__);
91
+ }
92
+ return nestedProxy;
93
+ } catch (error) {
94
+ console.warn(`Failed to create lazy proxy for path "${path}":`, error);
95
+ const fallbackSignal = signal(value, {
96
+ equal: equalityFn
97
+ });
98
+ signalCache.set(path, fallbackSignal);
99
+ if (memoryManager) {
100
+ memoryManager.cacheSignal(path, fallbackSignal);
101
+ }
102
+ return fallbackSignal;
103
+ }
104
+ }
105
+ try {
106
+ const newSignal = signal(value, {
107
+ equal: equalityFn
108
+ });
109
+ signalCache.set(path, newSignal);
110
+ if (memoryManager) {
111
+ memoryManager.cacheSignal(path, newSignal);
112
+ }
113
+ return newSignal;
114
+ } catch (error) {
115
+ console.warn(`Failed to create signal for path "${path}":`, error);
116
+ return value;
117
+ }
118
+ },
119
+ set(target, prop, value) {
120
+ if (typeof prop === 'symbol') {
121
+ target[prop] = value;
122
+ return true;
123
+ }
124
+ const key = prop;
125
+ const path = basePath ? `${basePath}.${key}` : key;
126
+ try {
127
+ target[key] = value;
128
+ const cachedSignal = signalCache.get(path);
129
+ if (cachedSignal && 'set' in cachedSignal) {
130
+ cachedSignal.set(value);
131
+ }
132
+ if (nestedProxies.has(path)) {
133
+ const nestedCleanup = nestedCleanups.get(path);
134
+ if (nestedCleanup) {
135
+ nestedCleanup();
136
+ nestedCleanups.delete(path);
137
+ }
138
+ nestedProxies.delete(path);
139
+ }
140
+ return true;
141
+ } catch (error) {
142
+ console.warn(`Failed to set value for path "${path}":`, error);
143
+ return false;
144
+ }
145
+ },
146
+ has(target, prop) {
147
+ return prop in target;
148
+ },
149
+ ownKeys(target) {
150
+ return Reflect.ownKeys(target);
151
+ },
152
+ getOwnPropertyDescriptor(target, prop) {
153
+ return Reflect.getOwnPropertyDescriptor(target, prop);
154
+ }
155
+ });
156
+ return proxy;
157
+ }
158
+ function unwrap(node) {
159
+ if (node === null || node === undefined) {
160
+ return node;
161
+ }
162
+ if (isNodeAccessor(node)) {
163
+ const result = {};
164
+ for (const key in node) {
165
+ if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
166
+ if (key === 'length' || key === 'prototype') continue;
167
+ if (key === 'name') {
168
+ const value = node[key];
169
+ if (!isSignal(value) && !isNodeAccessor(value)) {
170
+ continue;
171
+ }
172
+ }
173
+ const value = node[key];
174
+ if (isNodeAccessor(value)) {
175
+ result[key] = unwrap(value);
176
+ } else if (isSignal(value)) {
177
+ const unwrappedValue = value();
178
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
179
+ result[key] = unwrap(unwrappedValue);
180
+ } else {
181
+ result[key] = unwrappedValue;
182
+ }
183
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
184
+ result[key] = unwrap(value);
185
+ } else {
186
+ result[key] = value;
187
+ }
188
+ }
189
+ return result;
190
+ }
191
+ if (isSignal(node)) {
192
+ const value = node();
193
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
194
+ return unwrap(value);
195
+ }
196
+ return value;
197
+ }
198
+ if (typeof node !== 'object') {
199
+ return node;
200
+ }
201
+ if (Array.isArray(node)) {
202
+ return node;
203
+ }
204
+ if (isBuiltInObject(node)) {
205
+ return node;
206
+ }
207
+ const result = {};
208
+ for (const key in node) {
209
+ if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
210
+ if (key === 'set' || key === 'update') {
211
+ const v = node[key];
212
+ if (typeof v === 'function') continue;
213
+ }
214
+ const value = node[key];
215
+ if (isNodeAccessor(value)) {
216
+ const unwrappedValue = value();
217
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
218
+ result[key] = unwrap(unwrappedValue);
219
+ } else {
220
+ result[key] = unwrappedValue;
221
+ }
222
+ } else if (isSignal(value)) {
223
+ const unwrappedValue = value();
224
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
225
+ result[key] = unwrap(unwrappedValue);
226
+ } else {
227
+ result[key] = unwrappedValue;
228
+ }
229
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
230
+ result[key] = unwrap(value);
231
+ } else {
232
+ result[key] = value;
233
+ }
234
+ }
235
+ const symbols = Object.getOwnPropertySymbols(node);
236
+ for (const sym of symbols) {
237
+ const value = node[sym];
238
+ if (isNodeAccessor(value)) {
239
+ const unwrappedValue = value();
240
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
241
+ result[sym] = unwrap(unwrappedValue);
242
+ } else {
243
+ result[sym] = unwrappedValue;
244
+ }
245
+ } else if (isSignal(value)) {
246
+ const unwrappedValue = value();
247
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
248
+ result[sym] = unwrap(unwrappedValue);
249
+ } else {
250
+ result[sym] = unwrappedValue;
251
+ }
252
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
253
+ result[sym] = unwrap(value);
254
+ } else {
255
+ result[sym] = value;
256
+ }
257
+ }
258
+ return result;
259
+ }
260
+ function snapshotState(state) {
261
+ return unwrap(state);
262
+ }
263
+ function applyState(stateNode, snapshot) {
264
+ if (snapshot === null || snapshot === undefined) return;
265
+ if (typeof snapshot !== 'object') return;
266
+ for (const key of Object.keys(snapshot)) {
267
+ const val = snapshot[key];
268
+ const target = stateNode[key];
269
+ if (isNodeAccessor(target)) {
270
+ if (val && typeof val === 'object') {
271
+ try {
272
+ applyState(target, val);
273
+ } catch {
274
+ try {
275
+ target(val);
276
+ } catch {}
277
+ }
278
+ } else {
279
+ try {
280
+ target(val);
281
+ } catch {}
282
+ }
283
+ } else if (isSignal(target)) {
284
+ try {
285
+ target.set?.(val);
286
+ } catch {
287
+ try {
288
+ target(val);
289
+ } catch {}
290
+ }
291
+ } else {
292
+ try {
293
+ stateNode[key] = val;
294
+ } catch {}
295
+ }
296
+ }
297
+ }
298
+
299
+ export { applyState, composeEnhancers, createLazySignalTree, isAnySignal, isBuiltInObject, isEntityMapMarker, isNodeAccessor, snapshotState, toWritableSignal, unwrap };
@@ -0,0 +1,64 @@
1
+ class LRUCache {
2
+ constructor(maxSize) {
3
+ this.maxSize = maxSize;
4
+ this.cache = new Map();
5
+ if (!Number.isFinite(maxSize) || maxSize <= 0) {
6
+ throw new Error('LRUCache maxSize must be a positive, finite number');
7
+ }
8
+ }
9
+ set(key, value) {
10
+ if (this.cache.has(key)) {
11
+ this.cache.delete(key);
12
+ }
13
+ this.cache.set(key, value);
14
+ if (this.cache.size > this.maxSize) {
15
+ const oldestKey = this.cache.keys().next().value;
16
+ if (oldestKey !== undefined) {
17
+ this.cache.delete(oldestKey);
18
+ }
19
+ }
20
+ }
21
+ get(key) {
22
+ if (!this.cache.has(key)) return undefined;
23
+ const value = this.cache.get(key);
24
+ if (value !== undefined) {
25
+ this.cache.delete(key);
26
+ this.cache.set(key, value);
27
+ }
28
+ return value;
29
+ }
30
+ delete(key) {
31
+ this.cache.delete(key);
32
+ }
33
+ has(key) {
34
+ return this.cache.has(key);
35
+ }
36
+ clear() {
37
+ this.cache.clear();
38
+ }
39
+ size() {
40
+ return this.cache.size;
41
+ }
42
+ forEach(callback) {
43
+ this.cache.forEach((value, key) => callback(value, key));
44
+ }
45
+ entries() {
46
+ return this.cache.entries();
47
+ }
48
+ keys() {
49
+ return this.cache.keys();
50
+ }
51
+ resize(newSize) {
52
+ if (!Number.isFinite(newSize) || newSize <= 0) {
53
+ throw new Error('LRUCache newSize must be a positive, finite number');
54
+ }
55
+ this.maxSize = newSize;
56
+ while (this.cache.size > this.maxSize) {
57
+ const oldestKey = this.cache.keys().next().value;
58
+ if (oldestKey === undefined) break;
59
+ this.cache.delete(oldestKey);
60
+ }
61
+ }
62
+ }
63
+
64
+ export { LRUCache };
@@ -0,0 +1,13 @@
1
+ import { DEFAULT_PATH_CACHE_SIZE } from './constants.js';
2
+ import { LRUCache } from './lru-cache.js';
3
+
4
+ const pathCache = new LRUCache(DEFAULT_PATH_CACHE_SIZE);
5
+ function parsePath(path) {
6
+ const cached = pathCache.get(path);
7
+ if (cached) return cached;
8
+ const segments = path.split('.');
9
+ pathCache.set(path, segments);
10
+ return segments;
11
+ }
12
+
13
+ export { parsePath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaltree/core",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Lightweight, type-safe signal-based state management for Angular. Core package providing hierarchical signal trees, basic entity management, and async actions.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,11 @@
1
+ import type { ISignalTree, Enhancer, BatchingConfig } from '../../lib/types';
2
+ export type BatchingMethods<T> = import('../../lib/types').BatchingMethods<T>;
3
+ export declare function batchingWithConfig<T>(config?: BatchingConfig): Enhancer<BatchingMethods<T>>;
4
+ export declare function batching(config?: BatchingConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & BatchingMethods<any>;
5
+ export declare function highPerformanceBatching<T>(): Enhancer<import("../../lib/types").BatchingMethods<T>>;
6
+ export declare function flushBatchedUpdates(): void;
7
+ export declare function hasPendingUpdates(): boolean;
8
+ export declare function getBatchQueueSize(): number;
9
+ export declare const withBatching: ((config?: BatchingConfig) => Enhancer<import("../../lib/types").BatchingMethods<unknown>>) & {
10
+ highPerformance: typeof highPerformanceBatching;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './batching';
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -0,0 +1,68 @@
1
+ import { Signal } from '@angular/core';
2
+ import type { ISignalTree, DevToolsConfig, DevToolsMethods } from '../../lib/types';
3
+ export interface ModuleMetadata {
4
+ name: string;
5
+ methods: string[];
6
+ addedAt: Date;
7
+ lastActivity: Date;
8
+ operationCount: number;
9
+ averageExecutionTime: number;
10
+ errorCount: number;
11
+ }
12
+ export interface ModularPerformanceMetrics {
13
+ totalUpdates: number;
14
+ moduleUpdates: Record<string, number>;
15
+ modulePerformance: Record<string, number>;
16
+ compositionChain: string[];
17
+ signalGrowth: Record<string, number>;
18
+ memoryDelta: Record<string, number>;
19
+ moduleCacheStats: Record<string, {
20
+ hits: number;
21
+ misses: number;
22
+ }>;
23
+ }
24
+ export interface ModuleActivityTracker {
25
+ trackMethodCall: (module: string, method: string, duration: number) => void;
26
+ trackError: (module: string, error: Error, context?: string) => void;
27
+ getModuleActivity: (module: string) => ModuleMetadata | undefined;
28
+ getAllModules: () => ModuleMetadata[];
29
+ }
30
+ export interface CompositionLogger {
31
+ logComposition: (modules: string[], action: 'with' | 'enhance') => void;
32
+ logMethodExecution: (module: string, method: string, args: unknown[], result: unknown) => void;
33
+ logStateChange: (module: string, path: string, oldValue: unknown, newValue: unknown) => void;
34
+ logPerformanceWarning: (module: string, operation: string, duration: number, threshold: number) => void;
35
+ exportLogs: () => Array<{
36
+ timestamp: Date;
37
+ module: string;
38
+ type: 'composition' | 'method' | 'state' | 'performance';
39
+ data: unknown;
40
+ }>;
41
+ }
42
+ export interface ModularDevToolsInterface {
43
+ activityTracker: ModuleActivityTracker;
44
+ logger: CompositionLogger;
45
+ metrics: Signal<ModularPerformanceMetrics>;
46
+ trackComposition: (modules: string[]) => void;
47
+ startModuleProfiling: (module: string) => string;
48
+ endModuleProfiling: (profileId: string) => void;
49
+ connectDevTools: (treeName: string) => void;
50
+ exportDebugSession: () => {
51
+ metrics: ModularPerformanceMetrics;
52
+ modules: ModuleMetadata[];
53
+ logs: Array<unknown>;
54
+ compositionHistory: Array<{
55
+ timestamp: Date;
56
+ chain: string[];
57
+ }>;
58
+ };
59
+ }
60
+ export declare function devTools(config?: DevToolsConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & DevToolsMethods;
61
+ export declare function enableDevTools(treeName?: string): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & DevToolsMethods;
62
+ export declare function fullDevTools(treeName?: string): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & DevToolsMethods;
63
+ export declare function productionDevTools(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & DevToolsMethods;
64
+ export declare const withDevTools: typeof devTools & {
65
+ production: typeof productionDevTools;
66
+ full: typeof fullDevTools;
67
+ enable: typeof enableDevTools;
68
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './devtools';
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -0,0 +1,9 @@
1
+ import type { ISignalTree, EffectsMethods } from '../../lib/types';
2
+ export interface EffectsConfig {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function effects(config?: EffectsConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EffectsMethods<any>;
6
+ export declare function enableEffects(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EffectsMethods<any>;
7
+ export declare const withEffects: ((config?: EffectsConfig) => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EffectsMethods<any>) & {
8
+ enable: typeof enableEffects;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './effects';
@@ -0,0 +1,11 @@
1
+ import type { ISignalTree, EntitiesEnabled } from '../../lib/types';
2
+ export interface EntitiesEnhancerConfig {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function entities(config?: EntitiesEnhancerConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EntitiesEnabled;
6
+ export declare function enableEntities(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EntitiesEnabled;
7
+ export declare function highPerformanceEntities(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EntitiesEnabled;
8
+ export declare const withEntities: typeof entities & {
9
+ highPerformance: typeof highPerformanceEntities;
10
+ enable: typeof enableEntities;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './entities';
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -0,0 +1,3 @@
1
+ import type { EnhancerMeta, EnhancerWithMeta, Enhancer } from '../lib/types';
2
+ export declare function createEnhancer<TAdded = unknown>(meta: EnhancerMeta, enhancerFn: Enhancer<TAdded>): EnhancerWithMeta<TAdded>;
3
+ export declare function resolveEnhancerOrder(enhancers: EnhancerWithMeta<unknown>[], availableCapabilities?: Set<string>, debugMode?: boolean): EnhancerWithMeta<unknown>[];
@@ -0,0 +1 @@
1
+ export * from './memoization';
@@ -0,0 +1,54 @@
1
+ import type { ISignalTree } from '../../lib/types';
2
+ export declare function cleanupMemoizationCache(): void;
3
+ import type { MemoizationConfig, MemoizationMethods } from '../../lib/types';
4
+ export declare function memoize<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string, config?: MemoizationConfig): (...args: TArgs) => TReturn;
5
+ export declare function memoizeShallow<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
6
+ export declare function memoizeReference<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
7
+ export declare const MEMOIZATION_PRESETS: {
8
+ readonly selector: {
9
+ readonly equality: "reference";
10
+ readonly maxCacheSize: 10;
11
+ readonly enableLRU: false;
12
+ readonly ttl: undefined;
13
+ };
14
+ readonly computed: {
15
+ readonly equality: "shallow";
16
+ readonly maxCacheSize: 100;
17
+ readonly enableLRU: false;
18
+ readonly ttl: undefined;
19
+ };
20
+ readonly deepState: {
21
+ readonly equality: "deep";
22
+ readonly maxCacheSize: 1000;
23
+ readonly enableLRU: true;
24
+ readonly ttl: number;
25
+ };
26
+ readonly highFrequency: {
27
+ readonly equality: "reference";
28
+ readonly maxCacheSize: 5;
29
+ readonly enableLRU: false;
30
+ readonly ttl: undefined;
31
+ };
32
+ };
33
+ export declare function selectorMemoization(): <S>(tree: ISignalTree<S>) => ISignalTree<S> & MemoizationMethods<S>;
34
+ export declare function computedMemoization(): <S>(tree: ISignalTree<S>) => ISignalTree<S> & MemoizationMethods<S>;
35
+ export declare function deepStateMemoization(): <S>(tree: ISignalTree<S>) => ISignalTree<S> & MemoizationMethods<S>;
36
+ export declare function highFrequencyMemoization(): <S>(tree: ISignalTree<S>) => ISignalTree<S> & MemoizationMethods<S>;
37
+ export declare const withMemoization: ((config?: MemoizationConfig) => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>) & {
38
+ selector: typeof selectorMemoization;
39
+ computed: typeof computedMemoization;
40
+ deep: typeof deepStateMemoization;
41
+ fast: typeof highFrequencyMemoization;
42
+ };
43
+ export declare function memoization(config?: MemoizationConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>;
44
+ export declare function enableMemoization(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>;
45
+ export declare function highPerformanceMemoization(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>;
46
+ export declare function lightweightMemoization(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>;
47
+ export declare function shallowMemoization(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & MemoizationMethods<any>;
48
+ export declare function clearAllCaches(): void;
49
+ export declare function getGlobalCacheStats(): {
50
+ treeCount: number;
51
+ totalSize: number;
52
+ totalHits: number;
53
+ averageCacheSize: number;
54
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -0,0 +1 @@
1
+ export * from './lib/presets';
@@ -0,0 +1,8 @@
1
+ import { createDevTree, createMinimalTree, createProdTree } from '../../../lib/presets';
2
+ import type { TreeConfig, TreePreset } from '../../../lib/types';
3
+ export declare const TREE_PRESETS: Record<TreePreset, Partial<TreeConfig>>;
4
+ export declare function createPresetConfig(preset: TreePreset, overrides?: Partial<TreeConfig>): TreeConfig;
5
+ export declare function validatePreset(preset: TreePreset): boolean;
6
+ export declare function getAvailablePresets(): TreePreset[];
7
+ export declare function combinePresets(presets: TreePreset[], overrides?: Partial<TreeConfig>): TreeConfig;
8
+ export { createDevTree, createProdTree, createMinimalTree };
@@ -0,0 +1,14 @@
1
+ export declare const TYPE_MARKERS: {
2
+ readonly DATE: "§d";
3
+ readonly REGEXP: "§r";
4
+ readonly MAP: "§m";
5
+ readonly SET: "§s";
6
+ readonly UNDEFINED: "§u";
7
+ readonly NAN: "§n";
8
+ readonly INFINITY: "§i";
9
+ readonly NEG_INFINITY: "§-i";
10
+ readonly BIGINT: "§b";
11
+ readonly SYMBOL: "§y";
12
+ readonly FUNCTION: "§f";
13
+ readonly CIRCULAR: "§c";
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from './serialization';
2
+ export * from './constants';