@signaltree/core 6.0.3 → 6.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaltree/core",
3
- "version": "6.0.3",
3
+ "version": "6.0.6",
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,
@@ -1,11 +1,11 @@
1
- import type { ISignalTree, Enhancer, BatchingConfig } from '../../lib/types';
1
+ import type { ISignalTree, BatchingConfig } from '../../lib/types';
2
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>>;
3
+ export declare function batchingWithConfig(config?: BatchingConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
4
+ export declare function batching(config?: BatchingConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
5
+ export declare function highPerformanceBatching(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>;
6
6
  export declare function flushBatchedUpdates(): void;
7
7
  export declare function hasPendingUpdates(): boolean;
8
8
  export declare function getBatchQueueSize(): number;
9
- export declare const withBatching: ((config?: BatchingConfig) => Enhancer<import("../../lib/types").BatchingMethods<unknown>>) & {
9
+ export declare const withBatching: ((config?: BatchingConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & BatchingMethods<T>) & {
10
10
  highPerformance: typeof highPerformanceBatching;
11
11
  };
@@ -57,10 +57,10 @@ export interface ModularDevToolsInterface {
57
57
  }>;
58
58
  };
59
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;
60
+ export declare function devTools(config?: DevToolsConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
61
+ export declare function enableDevTools(treeName?: string): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
62
+ export declare function fullDevTools(treeName?: string): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
63
+ export declare function productionDevTools(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & DevToolsMethods;
64
64
  export declare const withDevTools: typeof devTools & {
65
65
  production: typeof productionDevTools;
66
66
  full: typeof fullDevTools;
@@ -2,8 +2,8 @@ import type { ISignalTree, EffectsMethods } from '../../lib/types';
2
2
  export interface EffectsConfig {
3
3
  enabled?: boolean;
4
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>) & {
5
+ export declare function effects(config?: EffectsConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>;
6
+ export declare function enableEffects(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>;
7
+ export declare const withEffects: ((config?: EffectsConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T>) & {
8
8
  enable: typeof enableEffects;
9
9
  };
@@ -2,9 +2,9 @@ import type { ISignalTree, EntitiesEnabled } from '../../lib/types';
2
2
  export interface EntitiesEnhancerConfig {
3
3
  enabled?: boolean;
4
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;
5
+ export declare function entities(config?: EntitiesEnhancerConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
6
+ export declare function enableEntities(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
7
+ export declare function highPerformanceEntities(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & EntitiesEnabled;
8
8
  export declare const withEntities: typeof entities & {
9
9
  highPerformance: typeof highPerformanceEntities;
10
10
  enable: typeof enableEntities;
@@ -30,21 +30,21 @@ export declare const MEMOIZATION_PRESETS: {
30
30
  readonly ttl: undefined;
31
31
  };
32
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>) & {
33
+ export declare function selectorMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
34
+ export declare function computedMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
35
+ export declare function deepStateMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
36
+ export declare function highFrequencyMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
37
+ export declare const withMemoization: ((config?: MemoizationConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>) & {
38
38
  selector: typeof selectorMemoization;
39
39
  computed: typeof computedMemoization;
40
40
  deep: typeof deepStateMemoization;
41
41
  fast: typeof highFrequencyMemoization;
42
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>;
43
+ export declare function memoization(config?: MemoizationConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
44
+ export declare function enableMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
45
+ export declare function highPerformanceMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
46
+ export declare function lightweightMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
47
+ export declare function shallowMemoization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & MemoizationMethods<T>;
48
48
  export declare function clearAllCaches(): void;
49
49
  export declare function getGlobalCacheStats(): {
50
50
  treeCount: number;
@@ -44,9 +44,9 @@ export interface PersistenceMethods {
44
44
  clear(): Promise<void>;
45
45
  __flushAutoSave?: () => Promise<void>;
46
46
  }
47
- export declare function serialization(defaultConfig?: SerializationConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & SerializationMethods;
48
- export declare const withSerialization: (defaultConfig?: SerializationConfig) => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & SerializationMethods;
49
- export declare function enableSerialization(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & SerializationMethods;
47
+ export declare function serialization(defaultConfig?: SerializationConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
48
+ export declare const withSerialization: (defaultConfig?: SerializationConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
49
+ export declare function enableSerialization(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods;
50
50
  export interface StorageAdapter {
51
51
  getItem(key: string): string | null | Promise<string | null>;
52
52
  setItem(key: string, value: string): void | Promise<void>;
@@ -60,8 +60,8 @@ export interface PersistenceConfig extends SerializationConfig {
60
60
  autoLoad?: boolean;
61
61
  skipCache?: boolean;
62
62
  }
63
- export declare function persistence(config: PersistenceConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & SerializationMethods & PersistenceMethods;
64
- export declare const withPersistence: (cfg: PersistenceConfig) => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & SerializationMethods & PersistenceMethods;
63
+ export declare function persistence(config: PersistenceConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods & PersistenceMethods;
64
+ export declare const withPersistence: (cfg: PersistenceConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & SerializationMethods & PersistenceMethods;
65
65
  export declare function createStorageAdapter(getItem: (key: string) => string | null | Promise<string | null>, setItem: (key: string, value: string) => void | Promise<void>, removeItem: (key: string) => void | Promise<void>): StorageAdapter;
66
66
  export declare function createIndexedDBAdapter(dbName?: string, storeName?: string): StorageAdapter;
67
67
  export declare function applySerialization<T extends Record<string, unknown>>(tree: ISignalTree<T>): ISignalTree<T> & SerializationMethods;
@@ -1,10 +1,10 @@
1
1
  import type { ISignalTree, TimeTravelMethods, TimeTravelConfig, TimeTravelEntry } from '../../lib/types';
2
2
  export type { TimeTravelConfig, TimeTravelEntry };
3
- export declare function timeTravel(config?: TimeTravelConfig): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods;
4
- export declare function enableTimeTravel(): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods;
5
- export declare function timeTravelHistory(maxHistorySize: number): <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods;
6
- export declare const withTimeTravel: ((config?: TimeTravelConfig) => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods) & {
7
- minimal: () => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods;
8
- debug: () => <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TimeTravelMethods;
3
+ export declare function timeTravel(config?: TimeTravelConfig): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
4
+ export declare function enableTimeTravel(): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
5
+ export declare function timeTravelHistory(maxHistorySize: number): <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
6
+ export declare const withTimeTravel: ((config?: TimeTravelConfig) => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>) & {
7
+ minimal: () => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
8
+ debug: () => <T>(tree: ISignalTree<T>) => ISignalTree<T> & TimeTravelMethods<T>;
9
9
  history: typeof timeTravelHistory;
10
10
  };
@@ -21,7 +21,7 @@ export type ProdSignalTree<T> = ISignalTree<T> & EffectsMethods<T> & BatchingMet
21
21
  export type MinimalSignalTree<T> = ISignalTree<T> & EffectsMethods<T>;
22
22
  export declare function createDevTree<T extends object>(initialState: T, config?: DevTreeConfig): FullSignalTree<T>;
23
23
  export declare function createDevTree(): {
24
- enhancer: <Tree extends ISignalTree<any>>(tree: Tree) => Tree & EffectsMethods<any> & BatchingMethods & MemoizationMethods<any> & EntitiesEnabled & TimeTravelMethods & DevToolsMethods;
24
+ enhancer: <T>(tree: ISignalTree<T>) => ISignalTree<T> & EffectsMethods<T> & BatchingMethods<T> & MemoizationMethods<T> & EntitiesEnabled & TimeTravelMethods<T> & DevToolsMethods;
25
25
  };
26
26
  export declare function createProdTree<T extends object>(initialState: T, config?: ProdTreeConfig): ProdSignalTree<T>;
27
27
  export declare function createMinimalTree<T extends object>(initialState: T, config?: MinimalTreeConfig): MinimalSignalTree<T>;
@@ -37,7 +37,7 @@ export type TreeNode<T> = {
37
37
  export interface ISignalTree<T> extends NodeAccessor<T> {
38
38
  readonly state: TreeNode<T>;
39
39
  readonly $: TreeNode<T>;
40
- with<R>(enhancer: (tree: this) => R): R;
40
+ with<E extends (tree: this) => any>(enhancer: E): this & Omit<ReturnType<E>, keyof ISignalTree<T>>;
41
41
  bind(thisArg?: unknown): NodeAccessor<T>;
42
42
  destroy(): void;
43
43
  }
@@ -282,7 +282,7 @@ export type CallableWritableSignal<T> = WritableSignal<T> & {
282
282
  };
283
283
  export type AccessibleNode<T> = NodeAccessor<T> & TreeNode<T>;
284
284
  export declare const ENHANCER_META: unique symbol;
285
- export type Enhancer<TAdded> = <Tree extends ISignalTree<any>>(tree: Tree) => Tree & TAdded;
285
+ export type Enhancer<TAdded> = <T>(tree: ISignalTree<T>) => ISignalTree<T> & TAdded;
286
286
  export type EnhancerWithMeta<TAdded> = Enhancer<TAdded> & {
287
287
  metadata?: EnhancerMeta;
288
288
  };