@signaltree/core 5.1.1 → 5.1.2

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 (70) hide show
  1. package/dist/constants.js +6 -0
  2. package/dist/deep-clone.js +80 -0
  3. package/dist/deep-equal.js +41 -0
  4. package/dist/enhancers/batching/lib/batching.js +161 -0
  5. package/dist/enhancers/computed/lib/computed.js +21 -0
  6. package/dist/enhancers/devtools/lib/devtools.js +321 -0
  7. package/dist/enhancers/entities/lib/entities.js +93 -0
  8. package/dist/enhancers/index.js +72 -0
  9. package/dist/enhancers/memoization/lib/memoization.js +410 -0
  10. package/dist/enhancers/presets/lib/presets.js +87 -0
  11. package/dist/enhancers/serialization/constants.js +15 -0
  12. package/dist/enhancers/serialization/lib/serialization.js +662 -0
  13. package/dist/enhancers/time-travel/lib/time-travel.js +193 -0
  14. package/dist/index.js +19 -0
  15. package/dist/is-built-in-object.js +23 -0
  16. package/dist/lib/async-helpers.js +77 -0
  17. package/dist/lib/constants.js +56 -0
  18. package/dist/lib/entity-signal.js +280 -0
  19. package/dist/lib/memory/memory-manager.js +164 -0
  20. package/dist/lib/path-notifier.js +106 -0
  21. package/dist/lib/performance/diff-engine.js +156 -0
  22. package/dist/lib/performance/path-index.js +156 -0
  23. package/dist/lib/performance/update-engine.js +188 -0
  24. package/dist/lib/security/security-validator.js +121 -0
  25. package/dist/lib/signal-tree.js +625 -0
  26. package/dist/lib/types.js +9 -0
  27. package/dist/lib/utils.js +258 -0
  28. package/dist/lru-cache.js +64 -0
  29. package/dist/parse-path.js +13 -0
  30. package/package.json +1 -1
  31. package/src/enhancers/batching/index.d.ts +1 -0
  32. package/src/enhancers/batching/lib/batching.d.ts +16 -0
  33. package/src/enhancers/batching/test-setup.d.ts +3 -0
  34. package/src/enhancers/computed/index.d.ts +1 -0
  35. package/src/enhancers/computed/lib/computed.d.ts +12 -0
  36. package/src/enhancers/devtools/index.d.ts +1 -0
  37. package/src/enhancers/devtools/lib/devtools.d.ts +77 -0
  38. package/src/enhancers/devtools/test-setup.d.ts +3 -0
  39. package/src/enhancers/entities/index.d.ts +1 -0
  40. package/src/enhancers/entities/lib/entities.d.ts +20 -0
  41. package/src/enhancers/entities/test-setup.d.ts +3 -0
  42. package/src/enhancers/index.d.ts +3 -0
  43. package/src/enhancers/memoization/index.d.ts +1 -0
  44. package/src/enhancers/memoization/lib/memoization.d.ts +65 -0
  45. package/src/enhancers/memoization/test-setup.d.ts +3 -0
  46. package/src/enhancers/presets/index.d.ts +1 -0
  47. package/src/enhancers/presets/lib/presets.d.ts +11 -0
  48. package/src/enhancers/presets/test-setup.d.ts +3 -0
  49. package/src/enhancers/serialization/constants.d.ts +14 -0
  50. package/src/enhancers/serialization/index.d.ts +2 -0
  51. package/src/enhancers/serialization/lib/serialization.d.ts +59 -0
  52. package/src/enhancers/serialization/test-setup.d.ts +3 -0
  53. package/src/enhancers/time-travel/index.d.ts +1 -0
  54. package/src/enhancers/time-travel/lib/time-travel.d.ts +36 -0
  55. package/src/enhancers/time-travel/lib/utils.d.ts +1 -0
  56. package/src/enhancers/time-travel/test-setup.d.ts +3 -0
  57. package/src/enhancers/types.d.ts +74 -0
  58. package/src/index.d.ts +18 -0
  59. package/src/lib/async-helpers.d.ts +8 -0
  60. package/src/lib/constants.d.ts +41 -0
  61. package/src/lib/entity-signal.d.ts +1 -0
  62. package/src/lib/memory/memory-manager.d.ts +30 -0
  63. package/src/lib/path-notifier.d.ts +4 -0
  64. package/src/lib/performance/diff-engine.d.ts +33 -0
  65. package/src/lib/performance/path-index.d.ts +25 -0
  66. package/src/lib/performance/update-engine.d.ts +32 -0
  67. package/src/lib/security/security-validator.d.ts +33 -0
  68. package/src/lib/signal-tree.d.ts +8 -0
  69. package/src/lib/types.d.ts +278 -0
  70. package/src/lib/utils.d.ts +28 -0
@@ -0,0 +1,258 @@
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('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 (isEntityMapMarker(value)) return value;
75
+ if (memoryManager) {
76
+ const cached = memoryManager.getSignal(path);
77
+ if (cached) return cached;
78
+ }
79
+ if (signalCache.has(path)) return signalCache.get(path);
80
+ if (nestedProxies.has(path)) return nestedProxies.get(path);
81
+ if (value && typeof value === 'object' && !Array.isArray(value) && !isSignal(value) && !isBuiltInObject(value)) {
82
+ try {
83
+ const nestedProxy = createLazySignalTree(value, equalityFn, path, memoryManager);
84
+ nestedProxies.set(path, nestedProxy);
85
+ const proxyWithCleanup = nestedProxy;
86
+ if (typeof proxyWithCleanup.__cleanup__ === 'function') {
87
+ nestedCleanups.set(path, proxyWithCleanup.__cleanup__);
88
+ }
89
+ return nestedProxy;
90
+ } catch (error) {
91
+ console.warn(`Failed to create lazy proxy for path "${path}":`, error);
92
+ const fallbackSignal = signal(value, {
93
+ equal: equalityFn
94
+ });
95
+ signalCache.set(path, fallbackSignal);
96
+ if (memoryManager) {
97
+ memoryManager.cacheSignal(path, fallbackSignal);
98
+ }
99
+ return fallbackSignal;
100
+ }
101
+ }
102
+ try {
103
+ const newSignal = signal(value, {
104
+ equal: equalityFn
105
+ });
106
+ signalCache.set(path, newSignal);
107
+ if (memoryManager) {
108
+ memoryManager.cacheSignal(path, newSignal);
109
+ }
110
+ return newSignal;
111
+ } catch (error) {
112
+ console.warn(`Failed to create signal for path "${path}":`, error);
113
+ return value;
114
+ }
115
+ },
116
+ set(target, prop, value) {
117
+ if (typeof prop === 'symbol') {
118
+ target[prop] = value;
119
+ return true;
120
+ }
121
+ const key = prop;
122
+ const path = basePath ? `${basePath}.${key}` : key;
123
+ try {
124
+ target[key] = value;
125
+ const cachedSignal = signalCache.get(path);
126
+ if (cachedSignal && 'set' in cachedSignal) {
127
+ cachedSignal.set(value);
128
+ }
129
+ if (nestedProxies.has(path)) {
130
+ const nestedCleanup = nestedCleanups.get(path);
131
+ if (nestedCleanup) {
132
+ nestedCleanup();
133
+ nestedCleanups.delete(path);
134
+ }
135
+ nestedProxies.delete(path);
136
+ }
137
+ return true;
138
+ } catch (error) {
139
+ console.warn(`Failed to set value for path "${path}":`, error);
140
+ return false;
141
+ }
142
+ },
143
+ has(target, prop) {
144
+ return prop in target;
145
+ },
146
+ ownKeys(target) {
147
+ return Reflect.ownKeys(target);
148
+ },
149
+ getOwnPropertyDescriptor(target, prop) {
150
+ return Reflect.getOwnPropertyDescriptor(target, prop);
151
+ }
152
+ });
153
+ return proxy;
154
+ }
155
+ function unwrap(node) {
156
+ if (node === null || node === undefined) {
157
+ return node;
158
+ }
159
+ if (isNodeAccessor(node)) {
160
+ const result = {};
161
+ for (const key in node) {
162
+ if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
163
+ if (key === 'length' || key === 'prototype') continue;
164
+ if (key === 'name') {
165
+ const value = node[key];
166
+ if (!isSignal(value) && !isNodeAccessor(value)) {
167
+ continue;
168
+ }
169
+ }
170
+ const value = node[key];
171
+ if (isNodeAccessor(value)) {
172
+ result[key] = unwrap(value);
173
+ } else if (isSignal(value)) {
174
+ const unwrappedValue = value();
175
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
176
+ result[key] = unwrap(unwrappedValue);
177
+ } else {
178
+ result[key] = unwrappedValue;
179
+ }
180
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
181
+ result[key] = unwrap(value);
182
+ } else {
183
+ result[key] = value;
184
+ }
185
+ }
186
+ return result;
187
+ }
188
+ if (isSignal(node)) {
189
+ const value = node();
190
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
191
+ return unwrap(value);
192
+ }
193
+ return value;
194
+ }
195
+ if (typeof node !== 'object') {
196
+ return node;
197
+ }
198
+ if (Array.isArray(node)) {
199
+ return node;
200
+ }
201
+ if (isBuiltInObject(node)) {
202
+ return node;
203
+ }
204
+ const result = {};
205
+ for (const key in node) {
206
+ if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
207
+ if (key === 'set' || key === 'update') {
208
+ const v = node[key];
209
+ if (typeof v === 'function') continue;
210
+ }
211
+ const value = node[key];
212
+ if (isNodeAccessor(value)) {
213
+ const unwrappedValue = value();
214
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
215
+ result[key] = unwrap(unwrappedValue);
216
+ } else {
217
+ result[key] = unwrappedValue;
218
+ }
219
+ } else if (isSignal(value)) {
220
+ const unwrappedValue = value();
221
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
222
+ result[key] = unwrap(unwrappedValue);
223
+ } else {
224
+ result[key] = unwrappedValue;
225
+ }
226
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
227
+ result[key] = unwrap(value);
228
+ } else {
229
+ result[key] = value;
230
+ }
231
+ }
232
+ const symbols = Object.getOwnPropertySymbols(node);
233
+ for (const sym of symbols) {
234
+ const value = node[sym];
235
+ if (isNodeAccessor(value)) {
236
+ const unwrappedValue = value();
237
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
238
+ result[sym] = unwrap(unwrappedValue);
239
+ } else {
240
+ result[sym] = unwrappedValue;
241
+ }
242
+ } else if (isSignal(value)) {
243
+ const unwrappedValue = value();
244
+ if (typeof unwrappedValue === 'object' && unwrappedValue !== null && !Array.isArray(unwrappedValue) && !isBuiltInObject(unwrappedValue)) {
245
+ result[sym] = unwrap(unwrappedValue);
246
+ } else {
247
+ result[sym] = unwrappedValue;
248
+ }
249
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value) && !isBuiltInObject(value)) {
250
+ result[sym] = unwrap(value);
251
+ } else {
252
+ result[sym] = value;
253
+ }
254
+ }
255
+ return result;
256
+ }
257
+
258
+ export { composeEnhancers, createLazySignalTree, isAnySignal, isBuiltInObject, isNodeAccessor, 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": "5.1.1",
3
+ "version": "5.1.2",
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 @@
1
+ export * from './lib/batching';
@@ -0,0 +1,16 @@
1
+ import type { SignalTree } from '../../../lib/types';
2
+ interface BatchingConfig {
3
+ enabled?: boolean;
4
+ maxBatchSize?: number;
5
+ autoFlushDelay?: number;
6
+ batchTimeoutMs?: number;
7
+ }
8
+ interface BatchingSignalTree<T> extends SignalTree<T> {
9
+ batchUpdate(updater: (current: T) => Partial<T>): void;
10
+ }
11
+ export declare function withBatching<T>(config?: BatchingConfig): (tree: SignalTree<T>) => BatchingSignalTree<T>;
12
+ export declare function withHighPerformanceBatching<T>(): (tree: SignalTree<T>) => BatchingSignalTree<T>;
13
+ export declare function flushBatchedUpdates(): void;
14
+ export declare function hasPendingUpdates(): boolean;
15
+ export declare function getBatchQueueSize(): number;
16
+ 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/computed';
@@ -0,0 +1,12 @@
1
+ import { Signal } from '@angular/core';
2
+ import type { TreeNode, SignalTree } from '../../../lib/types';
3
+ export interface ComputedConfig {
4
+ lazy?: boolean;
5
+ memoize?: boolean;
6
+ }
7
+ export type ComputedSignal<T> = Signal<T>;
8
+ export interface ComputedSignalTree<T extends Record<string, unknown>> extends SignalTree<T> {
9
+ computed<U>(computeFn: (tree: TreeNode<T>) => U): ComputedSignal<U>;
10
+ }
11
+ export declare function computedEnhancer(_config?: ComputedConfig): import("../../../lib/types").EnhancerWithMeta<SignalTree<Record<string, unknown>>, ComputedSignalTree<Record<string, unknown>>>;
12
+ export declare function createComputed<T>(dependencies: readonly Signal<unknown>[], computeFn: () => T): ComputedSignal<T>;
@@ -0,0 +1 @@
1
+ export * from './lib/devtools';
@@ -0,0 +1,77 @@
1
+ import { Signal } from '@angular/core';
2
+ import type { SignalTree } 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<_T = unknown> {
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 withDevTools<T>(config?: {
61
+ enabled?: boolean;
62
+ treeName?: string;
63
+ enableBrowserDevTools?: boolean;
64
+ enableLogging?: boolean;
65
+ performanceThreshold?: number;
66
+ }): (tree: SignalTree<T>) => SignalTree<T> & {
67
+ __devTools: ModularDevToolsInterface<T>;
68
+ };
69
+ export declare function enableDevTools<T>(treeName?: string): (tree: SignalTree<T>) => SignalTree<T> & {
70
+ __devTools: ModularDevToolsInterface<T>;
71
+ };
72
+ export declare function withFullDevTools<T>(treeName?: string): (tree: SignalTree<T>) => SignalTree<T> & {
73
+ __devTools: ModularDevToolsInterface<T>;
74
+ };
75
+ export declare function withProductionDevTools<T>(): (tree: SignalTree<T>) => SignalTree<T> & {
76
+ __devTools: ModularDevToolsInterface<T>;
77
+ };
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -0,0 +1 @@
1
+ export * from './lib/entities';
@@ -0,0 +1,20 @@
1
+ import type { EntitySignal, SignalTree, EntityAwareTreeNode } from '../../../lib/types';
2
+ interface EntitiesEnhancerConfig {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function withEntities(config?: EntitiesEnhancerConfig): <T>(tree: SignalTree<T>) => Omit<SignalTree<T>, "state" | "$"> & {
6
+ state: EntityAwareTreeNode<T>;
7
+ $: EntityAwareTreeNode<T>;
8
+ entities<E, K extends string | number>(path: keyof T | string): EntitySignal<E, K>;
9
+ };
10
+ export declare function enableEntities(): <T>(tree: SignalTree<T>) => Omit<SignalTree<T>, "state" | "$"> & {
11
+ state: EntityAwareTreeNode<T>;
12
+ $: EntityAwareTreeNode<T>;
13
+ entities<E, K extends string | number>(path: keyof T | string): EntitySignal<E, K>;
14
+ };
15
+ export declare function withHighPerformanceEntities(): <T>(tree: SignalTree<T>) => Omit<SignalTree<T>, "state" | "$"> & {
16
+ state: EntityAwareTreeNode<T>;
17
+ $: EntityAwareTreeNode<T>;
18
+ entities<E, K extends string | number>(path: keyof T | string): EntitySignal<E, K>;
19
+ };
20
+ export {};
@@ -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 } from '../lib/types';
2
+ export declare function createEnhancer<I = unknown, O = unknown>(meta: EnhancerMeta, enhancerFn: (input: I) => O): EnhancerWithMeta<I, O>;
3
+ export declare function resolveEnhancerOrder(enhancers: EnhancerWithMeta<unknown, unknown>[], availableCapabilities?: Set<string>, debugMode?: boolean): EnhancerWithMeta<unknown, unknown>[];
@@ -0,0 +1 @@
1
+ export * from './lib/memoization';
@@ -0,0 +1,65 @@
1
+ import type { SignalTree } from '../../../lib/types';
2
+ export interface MemoizedSignalTree<T> extends SignalTree<T> {
3
+ memoizedUpdate: (updater: (current: T) => Partial<T>, cacheKey?: string) => void;
4
+ clearMemoCache: (key?: string) => void;
5
+ getCacheStats: () => {
6
+ size: number;
7
+ hitRate: number;
8
+ totalHits: number;
9
+ totalMisses: number;
10
+ keys: string[];
11
+ };
12
+ }
13
+ export declare function cleanupMemoizationCache(): void;
14
+ export interface MemoizationConfig {
15
+ enabled?: boolean;
16
+ maxCacheSize?: number;
17
+ ttl?: number;
18
+ equality?: 'deep' | 'shallow' | 'reference';
19
+ enableLRU?: boolean;
20
+ }
21
+ export declare function memoize<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string, config?: MemoizationConfig): (...args: TArgs) => TReturn;
22
+ export declare function memoizeShallow<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
23
+ export declare function memoizeReference<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, keyFn?: (...args: TArgs) => string): (...args: TArgs) => TReturn;
24
+ export declare const MEMOIZATION_PRESETS: {
25
+ readonly selector: {
26
+ readonly equality: "reference";
27
+ readonly maxCacheSize: 10;
28
+ readonly enableLRU: false;
29
+ readonly ttl: undefined;
30
+ };
31
+ readonly computed: {
32
+ readonly equality: "shallow";
33
+ readonly maxCacheSize: 100;
34
+ readonly enableLRU: false;
35
+ readonly ttl: undefined;
36
+ };
37
+ readonly deepState: {
38
+ readonly equality: "deep";
39
+ readonly maxCacheSize: 1000;
40
+ readonly enableLRU: true;
41
+ readonly ttl: number;
42
+ };
43
+ readonly highFrequency: {
44
+ readonly equality: "reference";
45
+ readonly maxCacheSize: 5;
46
+ readonly enableLRU: false;
47
+ readonly ttl: undefined;
48
+ };
49
+ };
50
+ export declare function withSelectorMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
51
+ export declare function withComputedMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
52
+ export declare function withDeepStateMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
53
+ export declare function withHighFrequencyMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
54
+ export declare function withMemoization<T>(config?: MemoizationConfig): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
55
+ export declare function enableMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
56
+ export declare function withHighPerformanceMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
57
+ export declare function withLightweightMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
58
+ export declare function withShallowMemoization<T>(): (tree: SignalTree<T>) => MemoizedSignalTree<T>;
59
+ export declare function clearAllCaches(): void;
60
+ export declare function getGlobalCacheStats(): {
61
+ treeCount: number;
62
+ totalSize: number;
63
+ totalHits: number;
64
+ averageCacheSize: number;
65
+ };
@@ -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,11 @@
1
+ import type { TreeConfig } from '../../../lib/types';
2
+ export type TreePreset = 'basic' | 'performance' | 'development' | 'production';
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 declare function createDevTree(overrides?: Partial<TreeConfig>): {
9
+ readonly config: TreeConfig;
10
+ readonly enhancer: (tree: import("../../memoization/lib/memoization").MemoizedSignalTree<unknown>) => import("../../memoization/lib/memoization").MemoizedSignalTree<unknown>;
11
+ };
@@ -0,0 +1,3 @@
1
+ import '@angular/compiler';
2
+ import 'zone.js';
3
+ import 'zone.js/testing';
@@ -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 './lib/serialization';
2
+ export * from './constants';