mutts 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -23
- package/dist/async/browser.d.ts +2 -0
- package/dist/async/browser.d.ts.map +1 -0
- package/dist/async/index.d.ts +18 -0
- package/dist/async/index.d.ts.map +1 -0
- package/dist/async/node.d.ts +2 -0
- package/dist/async/node.d.ts.map +1 -0
- package/dist/{chunks/index-BFYK02LG.js → browser.cjs} +169 -60
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +1654 -1
- package/dist/browser.esm.js +260 -25
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/async-browser-CA0jPWIi.cjs +304 -0
- package/dist/chunks/async-browser-CA0jPWIi.cjs.map +1 -0
- package/dist/chunks/async-core-UqHzvJ-S.cjs +25 -0
- package/dist/chunks/async-core-UqHzvJ-S.cjs.map +1 -0
- package/dist/chunks/async-node-BYHuGTni.cjs +103 -0
- package/dist/chunks/async-node-BYHuGTni.cjs.map +1 -0
- package/dist/chunks/{index-CNR6QRUl.esm.js → index-DhaOVusv.esm.js} +173 -53
- package/dist/chunks/index-DhaOVusv.esm.js.map +1 -0
- package/dist/decorator.d.ts +106 -0
- package/dist/decorator.d.ts.map +1 -0
- package/dist/destroyable.d.ts +87 -0
- package/dist/destroyable.d.ts.map +1 -0
- package/dist/devtools/devtool/devtools.d.ts +1 -0
- package/dist/devtools/devtool/devtools.d.ts.map +1 -0
- package/dist/devtools/devtool/panel.d.ts +2 -0
- package/dist/devtools/devtool/panel.d.ts.map +1 -0
- package/dist/entry-browser.d.ts +3 -0
- package/dist/entry-browser.d.ts.map +1 -0
- package/dist/entry-node.d.ts +3 -0
- package/dist/entry-node.d.ts.map +1 -0
- package/dist/eventful.d.ts +18 -0
- package/dist/eventful.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/indexable.d.ts +243 -0
- package/dist/indexable.d.ts.map +1 -0
- package/dist/introspection.d.ts +27 -0
- package/dist/introspection.d.ts.map +1 -0
- package/dist/iterableWeak.d.ts +53 -0
- package/dist/iterableWeak.d.ts.map +1 -0
- package/dist/mixins.d.ts +25 -0
- package/dist/mixins.d.ts.map +1 -0
- package/dist/mutts.umd.js +1 -1
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/node.cjs +105 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.ts +1 -2
- package/dist/node.esm.js +91 -32
- package/dist/node.esm.js.map +1 -1
- package/dist/promiseChain.d.ts +20 -0
- package/dist/promiseChain.d.ts.map +1 -0
- package/dist/reactive/array.d.ts +49 -0
- package/dist/reactive/array.d.ts.map +1 -0
- package/dist/reactive/buffer.d.ts +44 -0
- package/dist/reactive/buffer.d.ts.map +1 -0
- package/dist/reactive/change.d.ts +29 -0
- package/dist/reactive/change.d.ts.map +1 -0
- package/dist/reactive/debug.d.ts +111 -0
- package/dist/reactive/debug.d.ts.map +1 -0
- package/dist/reactive/deep-touch.d.ts +28 -0
- package/dist/reactive/deep-touch.d.ts.map +1 -0
- package/dist/reactive/deep-watch-state.d.ts +25 -0
- package/dist/reactive/deep-watch-state.d.ts.map +1 -0
- package/dist/reactive/deep-watch.d.ts +19 -0
- package/dist/reactive/deep-watch.d.ts.map +1 -0
- package/dist/reactive/effect-context.d.ts +7 -0
- package/dist/reactive/effect-context.d.ts.map +1 -0
- package/dist/reactive/effects.d.ts +151 -0
- package/dist/reactive/effects.d.ts.map +1 -0
- package/dist/reactive/index.d.ts +20 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/interface.d.ts +64 -0
- package/dist/reactive/interface.d.ts.map +1 -0
- package/dist/reactive/map.d.ts +30 -0
- package/dist/reactive/map.d.ts.map +1 -0
- package/dist/reactive/memoize.d.ts +5 -0
- package/dist/reactive/memoize.d.ts.map +1 -0
- package/dist/reactive/non-reactive-state.d.ts +9 -0
- package/dist/reactive/non-reactive-state.d.ts.map +1 -0
- package/dist/reactive/non-reactive.d.ts +11 -0
- package/dist/reactive/non-reactive.d.ts.map +1 -0
- package/dist/reactive/project.d.ts +41 -0
- package/dist/reactive/project.d.ts.map +1 -0
- package/dist/reactive/proxy-state.d.ts +8 -0
- package/dist/reactive/proxy-state.d.ts.map +1 -0
- package/dist/reactive/proxy.d.ts +23 -0
- package/dist/reactive/proxy.d.ts.map +1 -0
- package/dist/reactive/record.d.ts +116 -0
- package/dist/reactive/record.d.ts.map +1 -0
- package/dist/reactive/register.d.ts +64 -0
- package/dist/reactive/register.d.ts.map +1 -0
- package/dist/reactive/registry.d.ts +20 -0
- package/dist/reactive/registry.d.ts.map +1 -0
- package/dist/reactive/set.d.ts +28 -0
- package/dist/reactive/set.d.ts.map +1 -0
- package/dist/reactive/tracking.d.ts +7 -0
- package/dist/reactive/tracking.d.ts.map +1 -0
- package/dist/reactive/types.d.ts +376 -0
- package/dist/reactive/types.d.ts.map +1 -0
- package/dist/std-decorators.d.ts +50 -0
- package/dist/std-decorators.d.ts.map +1 -0
- package/dist/utils.d.ts +49 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/zone.d.ts +40 -0
- package/dist/zone.d.ts.map +1 -0
- package/docs/std-decorators.md +69 -1
- package/docs/zone.md +7 -0
- package/package.json +39 -27
- package/src/async/browser.ts +266 -34
- package/src/async/index.ts +17 -2
- package/src/async/node.ts +89 -31
- package/src/entry-browser.ts +5 -0
- package/src/entry-node.ts +5 -0
- package/src/index.d.ts +12 -9
- package/src/index.ts +1 -0
- package/src/reactive/array.ts +139 -52
- package/src/reactive/effect-context.ts +3 -3
- package/src/reactive/index.ts +2 -1
- package/src/reactive/map.ts +1 -1
- package/src/reactive/set.ts +1 -1
- package/src/utils.ts +1 -1
- package/src/zone.ts +19 -8
- package/dist/browser.js +0 -161
- package/dist/browser.js.map +0 -1
- package/dist/chunks/index-BFYK02LG.js.map +0 -1
- package/dist/chunks/index-CNR6QRUl.esm.js.map +0 -1
- package/dist/node.js +0 -136
- package/dist/node.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ArrayReadForward, forwardArray, getAt, setAt } from '../indexable';
|
|
2
|
+
type KeyFunction<T, K extends PropertyKey> = (item: T) => K;
|
|
3
|
+
interface RegisterInstance<T> extends ArrayReadForward<T> {
|
|
4
|
+
[index: number]: T;
|
|
5
|
+
}
|
|
6
|
+
declare const RegisterClass_base: new () => ArrayReadForward<any> & {
|
|
7
|
+
[x: number]: any;
|
|
8
|
+
toArray(): any[];
|
|
9
|
+
};
|
|
10
|
+
declare class RegisterClass<T, K extends PropertyKey = PropertyKey> extends RegisterClass_base implements RegisterInstance<T> {
|
|
11
|
+
#private;
|
|
12
|
+
protected get [forwardArray](): readonly T[];
|
|
13
|
+
constructor(keyFn: KeyFunction<T, K>, initial?: Iterable<T>);
|
|
14
|
+
private ensureKey;
|
|
15
|
+
private assertValidKey;
|
|
16
|
+
private setKeyValue;
|
|
17
|
+
private cleanupValue;
|
|
18
|
+
private disposeKeyEffects;
|
|
19
|
+
private incrementUsage;
|
|
20
|
+
private decrementUsage;
|
|
21
|
+
private normalizeIndex;
|
|
22
|
+
private assignAt;
|
|
23
|
+
private insertKeyValue;
|
|
24
|
+
private rebuildFrom;
|
|
25
|
+
get length(): number;
|
|
26
|
+
[getAt](index: number): T | undefined;
|
|
27
|
+
[setAt](index: number, value: T): void;
|
|
28
|
+
push(...items: T[]): number;
|
|
29
|
+
pop(): T | undefined;
|
|
30
|
+
shift(): T | undefined;
|
|
31
|
+
unshift(...items: T[]): number;
|
|
32
|
+
splice(start: number, deleteCount?: number, ...items: T[]): T[];
|
|
33
|
+
clear(): void;
|
|
34
|
+
get(key: K): T | undefined;
|
|
35
|
+
set(key: K, value: T): void;
|
|
36
|
+
remove(key: K): void;
|
|
37
|
+
removeAt(index: number): T | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Keep only the items for which the predicate returns true.
|
|
40
|
+
* Items for which the predicate returns false are removed.
|
|
41
|
+
*
|
|
42
|
+
* The predicate is evaluated once per distinct key; duplicate keys
|
|
43
|
+
* will follow the same keep/remove decision.
|
|
44
|
+
*/
|
|
45
|
+
keep(predicate: (value: T) => boolean): void;
|
|
46
|
+
hasKey(key: K): boolean;
|
|
47
|
+
indexOfKey(key: K): number;
|
|
48
|
+
mapKeys(): IterableIterator<K>;
|
|
49
|
+
update(...values: T[]): void;
|
|
50
|
+
upsert(insert: (value: T) => void, ...values: T[]): void;
|
|
51
|
+
entries(): IterableIterator<[number, T]>;
|
|
52
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
53
|
+
toString(): string;
|
|
54
|
+
at(index: number): T | undefined;
|
|
55
|
+
reverse(): this;
|
|
56
|
+
sort(compareFn?: ((a: T, b: T) => number) | undefined): this;
|
|
57
|
+
fill(value: T, start?: number, end?: number): this;
|
|
58
|
+
copyWithin(target: number, start: number, end?: number): this;
|
|
59
|
+
}
|
|
60
|
+
export type Register<T, K extends PropertyKey = PropertyKey> = RegisterClass<T, K> & T[];
|
|
61
|
+
export declare const Register: new <T, K extends PropertyKey = PropertyKey>(keyFn: KeyFunction<T, K>, initial?: Iterable<T>) => Register<T, K>;
|
|
62
|
+
export declare function register<T, K extends PropertyKey = PropertyKey>(keyFn: KeyFunction<T, K>, initial?: Iterable<T>): Register<T, K>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/reactive/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAa,KAAK,EAAE,MAAM,cAAc,CAAA;AAQtF,KAAK,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;AA2B3D,UAAU,gBAAgB,CAA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AAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;AACxF,eAAO,MAAM,QAAQ,EAAoB,KAAK,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EACnF,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KACjB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEnB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAC9D,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GACnB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAEhB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ScopedCallback } from './types';
|
|
2
|
+
export declare const effectToReactiveObjects: WeakMap<ScopedCallback, Set<object>>;
|
|
3
|
+
export declare const watchers: WeakMap<object, Map<any, Set<ScopedCallback>>>;
|
|
4
|
+
export declare const effectChildren: WeakMap<ScopedCallback, Set<ScopedCallback>>;
|
|
5
|
+
export declare const effectParent: WeakMap<ScopedCallback, ScopedCallback>;
|
|
6
|
+
/**
|
|
7
|
+
* Marks a function with its root function for effect tracking
|
|
8
|
+
* Enforces strict unicity: A root function can only identify ONE function.
|
|
9
|
+
* @param fn - The function to mark
|
|
10
|
+
* @param root - The root function
|
|
11
|
+
* @returns The marked function
|
|
12
|
+
*/
|
|
13
|
+
export declare function markWithRoot<T extends Function>(fn: T, root: any): T;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the root function of a function for effect tracking
|
|
16
|
+
* @param fn - The function to get the root of
|
|
17
|
+
* @returns The root function
|
|
18
|
+
*/
|
|
19
|
+
export declare function getRoot<T extends Function | undefined>(fn: T): T;
|
|
20
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/reactive/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAG3D,eAAO,MAAM,uBAAuB,sCAA6C,CAAA;AAGjF,eAAO,MAAM,QAAQ,gDAAuD,CAAA;AAG5E,eAAO,MAAM,cAAc,8CAAqD,CAAA;AAGhF,eAAO,MAAM,YAAY,yCAA4D,CAAA;AAKrF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,CAwBpE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,QAAQ,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAGhE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive wrapper around JavaScript's WeakSet class
|
|
3
|
+
* Only tracks individual value operations, no size tracking (WeakSet limitation)
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class ReactiveWeakSet<T extends object> extends WeakSet<T> {
|
|
6
|
+
get [Symbol.toStringTag](): string;
|
|
7
|
+
add(value: T): this;
|
|
8
|
+
delete(value: T): boolean;
|
|
9
|
+
has(value: T): boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reactive wrapper around JavaScript's Set class
|
|
13
|
+
* Tracks size changes, individual value operations, and collection-wide operations
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class ReactiveSet<T> extends Set<T> {
|
|
16
|
+
get [Symbol.toStringTag](): string;
|
|
17
|
+
get size(): number;
|
|
18
|
+
add(value: T): this;
|
|
19
|
+
clear(): void;
|
|
20
|
+
delete(value: T): boolean;
|
|
21
|
+
has(value: T): boolean;
|
|
22
|
+
entries(): Generator<[T, T]>;
|
|
23
|
+
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
|
24
|
+
keys(): Generator<T>;
|
|
25
|
+
values(): Generator<T>;
|
|
26
|
+
[Symbol.iterator](): SetIterator<T>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/reactive/set.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,8BAAsB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IACD,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAWnB,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAOzB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;CAItB;AAED;;;GAGG;AACH,8BAAsB,WAAW,CAAC,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,IAAI,IAAI,IAAI,MAAM,CAIjB;IAED,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAanB,KAAK,IAAI,IAAI;IAUb,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAWzB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAKtB,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAK5B,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI;IAKpF,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC;IAKpB,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC;IAKtB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC;CAiBnC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a property as a dependency of the current effect
|
|
3
|
+
* @param obj - The object containing the property
|
|
4
|
+
* @param prop - The property name (defaults to allProps)
|
|
5
|
+
*/
|
|
6
|
+
export declare function dependant(obj: any, prop?: any): void;
|
|
7
|
+
//# sourceMappingURL=tracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../src/reactive/tracking.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAE,GAAc,QA8BvD"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { FunctionWrapper } from "../zone";
|
|
2
|
+
/**
|
|
3
|
+
* Dependency access passed to user callbacks within effects/watch
|
|
4
|
+
* Provides functions to track dependencies and information about the effect execution
|
|
5
|
+
*/
|
|
6
|
+
export interface DependencyAccess {
|
|
7
|
+
/**
|
|
8
|
+
* Tracks dependencies in the current effect context
|
|
9
|
+
* Use this for normal dependency tracking within the effect
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* effect(({ tracked }) => {
|
|
13
|
+
* // In async context, use tracked to restore dependency tracking
|
|
14
|
+
* await someAsyncOperation()
|
|
15
|
+
* const value = tracked(() => state.count) // Tracks state.count in this effect
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
tracked: FunctionWrapper;
|
|
20
|
+
/**
|
|
21
|
+
* Tracks dependencies in the parent effect context
|
|
22
|
+
* Use this when child effects should track dependencies in the parent,
|
|
23
|
+
* allowing parent cleanup to manage child effects while dependencies trigger the parent
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* effect(({ ascend }) => {
|
|
27
|
+
* const length = inputs.length
|
|
28
|
+
* if (length > 0) {
|
|
29
|
+
* ascend(() => {
|
|
30
|
+
* // Dependencies here are tracked in the parent effect
|
|
31
|
+
* inputs.forEach(item => console.log(item))
|
|
32
|
+
* })
|
|
33
|
+
* }
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
ascend: FunctionWrapper;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates whether the effect is running as a reaction (i.e. not the first call)
|
|
40
|
+
* - `false`: First execution when the effect is created
|
|
41
|
+
* - `true`: Subsequent executions triggered by dependency changes
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* effect(({ reaction }) => {
|
|
45
|
+
* if (!reaction) {
|
|
46
|
+
* console.log('Effect initialized')
|
|
47
|
+
* // Setup code that should only run once
|
|
48
|
+
* } else {
|
|
49
|
+
* console.log('Effect re-ran due to dependency change')
|
|
50
|
+
* // Code that runs on every update
|
|
51
|
+
* }
|
|
52
|
+
* })
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
reaction: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Type for effect cleanup functions
|
|
59
|
+
*/
|
|
60
|
+
export type ScopedCallback = () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Async execution mode for effects
|
|
63
|
+
* - `cancel`: Cancel previous async execution when dependencies change (default)
|
|
64
|
+
* - `queue`: Queue next execution to run after current completes
|
|
65
|
+
* - `ignore`: Ignore new executions while async work is running
|
|
66
|
+
*/
|
|
67
|
+
export type AsyncExecutionMode = 'cancel' | 'queue' | 'ignore';
|
|
68
|
+
/**
|
|
69
|
+
* Options for effect creation
|
|
70
|
+
*/
|
|
71
|
+
export interface EffectOptions {
|
|
72
|
+
/**
|
|
73
|
+
* How to handle async effect executions when dependencies change
|
|
74
|
+
* @default 'cancel'
|
|
75
|
+
*/
|
|
76
|
+
asyncMode?: AsyncExecutionMode;
|
|
77
|
+
/**
|
|
78
|
+
* If true, this effect is "opaque" to deep optimizations: it sees the object reference itself
|
|
79
|
+
* and must be notified when it changes, regardless of deep content similarity.
|
|
80
|
+
* Use this for effects that depend on object identity (like memoize).
|
|
81
|
+
*/
|
|
82
|
+
opaque?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Type for property evolution events
|
|
86
|
+
*/
|
|
87
|
+
export type PropEvolution = {
|
|
88
|
+
type: 'set' | 'del' | 'add' | 'invalidate';
|
|
89
|
+
prop: any;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Type for collection operation evolution events
|
|
93
|
+
*/
|
|
94
|
+
export type BunchEvolution = {
|
|
95
|
+
type: 'bunch';
|
|
96
|
+
method: string;
|
|
97
|
+
};
|
|
98
|
+
export type Evolution = PropEvolution | BunchEvolution;
|
|
99
|
+
type State = {
|
|
100
|
+
evolution: Evolution;
|
|
101
|
+
next: State;
|
|
102
|
+
} | {};
|
|
103
|
+
declare const nativeReactive: unique symbol;
|
|
104
|
+
/**
|
|
105
|
+
* Symbol to mark individual objects as non-reactive
|
|
106
|
+
*/
|
|
107
|
+
export declare const nonReactiveMark: unique symbol;
|
|
108
|
+
/**
|
|
109
|
+
* Symbol to mark class properties as non-reactive
|
|
110
|
+
*/
|
|
111
|
+
export declare const unreactiveProperties: unique symbol;
|
|
112
|
+
/**
|
|
113
|
+
* Symbol representing all properties in reactive tracking
|
|
114
|
+
*/
|
|
115
|
+
export declare const allProps: unique symbol;
|
|
116
|
+
/**
|
|
117
|
+
* Symbol for accessing projection information on reactive objects
|
|
118
|
+
*/
|
|
119
|
+
export declare const projectionInfo: unique symbol;
|
|
120
|
+
/**
|
|
121
|
+
* Symbol to check if an effect is stopped
|
|
122
|
+
*/
|
|
123
|
+
export declare const stopped: unique symbol;
|
|
124
|
+
/**
|
|
125
|
+
* Symbol to access effect cleanup function
|
|
126
|
+
*/
|
|
127
|
+
export declare const cleanup: unique symbol;
|
|
128
|
+
/**
|
|
129
|
+
* Context for a running projection item effect
|
|
130
|
+
*/
|
|
131
|
+
export interface ProjectionContext {
|
|
132
|
+
source: any;
|
|
133
|
+
key?: any;
|
|
134
|
+
target: any;
|
|
135
|
+
depth: number;
|
|
136
|
+
parent?: ProjectionContext;
|
|
137
|
+
}
|
|
138
|
+
declare const rootFunction: unique symbol;
|
|
139
|
+
/**
|
|
140
|
+
* Structured error codes for machine-readable diagnosis
|
|
141
|
+
*/
|
|
142
|
+
export declare enum ReactiveErrorCode {
|
|
143
|
+
CycleDetected = "CYCLE_DETECTED",
|
|
144
|
+
MaxDepthExceeded = "MAX_DEPTH_EXCEEDED",
|
|
145
|
+
MaxReactionExceeded = "MAX_REACTION_EXCEEDED",
|
|
146
|
+
WriteInComputed = "WRITE_IN_COMPUTED",
|
|
147
|
+
TrackingError = "TRACKING_ERROR",
|
|
148
|
+
BrokenEffects = "BROKEN_EFFECTS"
|
|
149
|
+
}
|
|
150
|
+
export type CycleDebugInfo = {
|
|
151
|
+
code: ReactiveErrorCode.CycleDetected;
|
|
152
|
+
cycle: string[];
|
|
153
|
+
details?: string;
|
|
154
|
+
};
|
|
155
|
+
export type MaxDepthDebugInfo = {
|
|
156
|
+
code: ReactiveErrorCode.MaxDepthExceeded;
|
|
157
|
+
depth: number;
|
|
158
|
+
chain: string[];
|
|
159
|
+
};
|
|
160
|
+
export type MaxReactionDebugInfo = {
|
|
161
|
+
code: ReactiveErrorCode.MaxReactionExceeded;
|
|
162
|
+
count: number;
|
|
163
|
+
effect: string;
|
|
164
|
+
};
|
|
165
|
+
export type BrokenEffectsDebugInfo = {
|
|
166
|
+
code: ReactiveErrorCode.BrokenEffects;
|
|
167
|
+
cause: any;
|
|
168
|
+
};
|
|
169
|
+
export type GenericDebugInfo = {
|
|
170
|
+
code: ReactiveErrorCode;
|
|
171
|
+
causalChain?: string[];
|
|
172
|
+
creationStack?: string;
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
};
|
|
175
|
+
export type ReactiveDebugInfo = CycleDebugInfo | MaxDepthDebugInfo | MaxReactionDebugInfo | BrokenEffectsDebugInfo | GenericDebugInfo;
|
|
176
|
+
/**
|
|
177
|
+
* Error class for reactive system errors
|
|
178
|
+
*/
|
|
179
|
+
export declare class ReactiveError extends Error {
|
|
180
|
+
debugInfo?: ReactiveDebugInfo;
|
|
181
|
+
constructor(message: string, debugInfo?: ReactiveDebugInfo);
|
|
182
|
+
get code(): ReactiveErrorCode | undefined;
|
|
183
|
+
get cause(): any;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Global options for the reactive system
|
|
187
|
+
*/
|
|
188
|
+
export declare const options: {
|
|
189
|
+
/**
|
|
190
|
+
* Debug purpose: called when an effect is entered
|
|
191
|
+
* @param effect - The effect that is entered
|
|
192
|
+
*/
|
|
193
|
+
enter: (_effect: Function) => void;
|
|
194
|
+
/**
|
|
195
|
+
* Debug purpose: called when an effect is left
|
|
196
|
+
* @param effect - The effect that is left
|
|
197
|
+
*/
|
|
198
|
+
leave: (_effect: Function) => void;
|
|
199
|
+
/**
|
|
200
|
+
* Debug purpose: called when an effect is chained
|
|
201
|
+
* @param target - The effect that is being triggered
|
|
202
|
+
* @param caller - The effect that is calling the target
|
|
203
|
+
*/
|
|
204
|
+
chain: (_targets: Function[], _caller?: Function) => void;
|
|
205
|
+
/**
|
|
206
|
+
* Debug purpose: called when an effect chain is started
|
|
207
|
+
* @param target - The effect that is being triggered
|
|
208
|
+
*/
|
|
209
|
+
beginChain: (_targets: Function[]) => void;
|
|
210
|
+
/**
|
|
211
|
+
* Debug purpose: called when an effect chain is ended
|
|
212
|
+
*/
|
|
213
|
+
endChain: () => void;
|
|
214
|
+
garbageCollected: (_fn: Function) => void;
|
|
215
|
+
/**
|
|
216
|
+
* Debug purpose: called when an object is touched
|
|
217
|
+
* @param obj - The object that is touched
|
|
218
|
+
* @param evolution - The type of change
|
|
219
|
+
* @param props - The properties that changed
|
|
220
|
+
* @param deps - The dependencies that changed
|
|
221
|
+
*/
|
|
222
|
+
touched: (_obj: any, _evolution: Evolution, _props?: any[], _deps?: Set<ScopedCallback>) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Debug purpose: called when an effect is skipped because it's already running
|
|
225
|
+
* @param effect - The effect that is already running
|
|
226
|
+
* @param runningChain - The array of effects from the detected one to the currently running one
|
|
227
|
+
*/
|
|
228
|
+
skipRunningEffect: (_effect: ScopedCallback) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Debug purpose: maximum effect chain (like call stack max depth)
|
|
231
|
+
* Used to prevent infinite loops
|
|
232
|
+
* @default 100
|
|
233
|
+
*/
|
|
234
|
+
maxEffectChain: number;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum number of times an effect can be triggered by the same cause in a single batch
|
|
237
|
+
* Used to detect aggressive re-computation or infinite loops
|
|
238
|
+
* @default 10
|
|
239
|
+
*/
|
|
240
|
+
maxTriggerPerBatch: number;
|
|
241
|
+
/**
|
|
242
|
+
* Debug purpose: maximum effect reaction (like call stack max depth)
|
|
243
|
+
* Used to prevent infinite loops
|
|
244
|
+
* @default 'throw'
|
|
245
|
+
*/
|
|
246
|
+
maxEffectReaction: "throw" | "debug" | "warn";
|
|
247
|
+
/**
|
|
248
|
+
* Callback called when a memoization discrepancy is detected (debug only)
|
|
249
|
+
* When defined, memoized functions will run a second time (untracked) to verify consistency.
|
|
250
|
+
* If the untracked run returns a different value than the cached one, this callback is triggered.
|
|
251
|
+
*
|
|
252
|
+
* This is the primary tool for detecting missing reactive dependencies in computed values.
|
|
253
|
+
*
|
|
254
|
+
* @param cached - The value currently in the memoization cache
|
|
255
|
+
* @param fresh - The value obtained by re-running the function untracked
|
|
256
|
+
* @param fn - The memoized function itself
|
|
257
|
+
* @param args - Arguments passed to the function
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* reactiveOptions.onMemoizationDiscrepancy = (cached, fresh, fn, args) => {
|
|
262
|
+
* throw new Error(`Memoization discrepancy in ${fn.name}!`);
|
|
263
|
+
* };
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
onMemoizationDiscrepancy: ((cached: any, fresh: any, fn: Function, args: any[], cause: "calculation" | "comparison") => void) | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* How to handle cycles detected in effect batches.
|
|
269
|
+
*
|
|
270
|
+
* - `'none'` (Default): High-performance mode. Disables dependency graph maintenance and
|
|
271
|
+
* Topological Sorting in favor of a simple FIFO queue. Use this for trustworthy, acyclic UI code.
|
|
272
|
+
* Cycle detection is heuristic (uses execution counts).
|
|
273
|
+
*
|
|
274
|
+
* - `'throw'`: Traditional Topological Sorting. Guarantees dependency order and catches
|
|
275
|
+
* circular dependencies mathematically before execution.
|
|
276
|
+
*
|
|
277
|
+
* - `'warn'`: Topological sorting, but logs a warning instead of throwing on cycles.
|
|
278
|
+
* - `'break'`: Topological sorting, but silently breaks cycles.
|
|
279
|
+
* - `'strict'`: Prevents cycle creation by checking the graph *during* dependency discovery.
|
|
280
|
+
*
|
|
281
|
+
* @default 'none'
|
|
282
|
+
*/
|
|
283
|
+
cycleHandling: "none" | "throw" | "warn" | "break" | "strict";
|
|
284
|
+
/**
|
|
285
|
+
* Internal flag used by memoization discrepancy detector to avoid counting calls in tests
|
|
286
|
+
* @warning Do not modify this flag manually, this flag is given by the engine
|
|
287
|
+
*/
|
|
288
|
+
isVerificationRun: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Maximum depth for deep watching traversal
|
|
291
|
+
* Used to prevent infinite recursion in circular references
|
|
292
|
+
* @default 100
|
|
293
|
+
*/
|
|
294
|
+
maxDeepWatchDepth: number;
|
|
295
|
+
/**
|
|
296
|
+
* Only react on instance members modification (not inherited properties)
|
|
297
|
+
* For instance, do not track class methods
|
|
298
|
+
* @default true
|
|
299
|
+
*/
|
|
300
|
+
instanceMembers: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Ignore accessors (getters and setters) and only track direct properties
|
|
303
|
+
* @default true
|
|
304
|
+
*/
|
|
305
|
+
ignoreAccessors: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Enable recursive touching when objects with the same prototype are replaced
|
|
308
|
+
* When enabled, replacing an object with another of the same prototype triggers
|
|
309
|
+
* recursive diffing instead of notifying parent effects
|
|
310
|
+
* @default true
|
|
311
|
+
*/
|
|
312
|
+
recursiveTouching: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Default async execution mode for effects that return Promises
|
|
315
|
+
* - 'cancel': Cancel previous async execution when dependencies change (default, enables async zone)
|
|
316
|
+
* - 'queue': Queue next execution to run after current completes (enables async zone)
|
|
317
|
+
* - 'ignore': Ignore new executions while async work is running (enables async zone)
|
|
318
|
+
* - false: Disable async zone and async mode handling (effects run concurrently)
|
|
319
|
+
*
|
|
320
|
+
* **When truthy:** Enables async zone (Promise.prototype wrapping) for automatic context
|
|
321
|
+
* preservation in Promise callbacks. Warning: This modifies Promise.prototype globally.
|
|
322
|
+
* Only enable if no other library modifies Promise.prototype.
|
|
323
|
+
*
|
|
324
|
+
* **When false:** Async zone is disabled. Use `tracked()` manually in Promise callbacks.
|
|
325
|
+
*
|
|
326
|
+
* Can be overridden per-effect via EffectOptions
|
|
327
|
+
* @default 'cancel'
|
|
328
|
+
*/
|
|
329
|
+
asyncMode: AsyncExecutionMode | false;
|
|
330
|
+
warn: (...args: any[]) => void;
|
|
331
|
+
/**
|
|
332
|
+
* Configuration for the introspection system
|
|
333
|
+
*/
|
|
334
|
+
introspection: {
|
|
335
|
+
/**
|
|
336
|
+
* Whether to keep a history of mutations for debugging
|
|
337
|
+
* @default false
|
|
338
|
+
*/
|
|
339
|
+
enableHistory: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Number of mutations to keep in history
|
|
342
|
+
* @default 50
|
|
343
|
+
*/
|
|
344
|
+
historySize: number;
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Configuration for zone hooks - control which async APIs are hooked
|
|
348
|
+
* Each option controls whether the corresponding async API is wrapped to preserve effect context
|
|
349
|
+
* Only applies when asyncMode is enabled (truthy)
|
|
350
|
+
* @deprecated Should take all when we made sure PIXI.create, Game.create, ... are -> .root()
|
|
351
|
+
*/
|
|
352
|
+
zones: {
|
|
353
|
+
/**
|
|
354
|
+
* Hook setTimeout to preserve effect context
|
|
355
|
+
* @default true
|
|
356
|
+
*/
|
|
357
|
+
setTimeout: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Hook setInterval to preserve effect context
|
|
360
|
+
* @default true
|
|
361
|
+
*/
|
|
362
|
+
setInterval: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Hook requestAnimationFrame (runs in untracked context when hooked)
|
|
365
|
+
* @default true
|
|
366
|
+
*/
|
|
367
|
+
requestAnimationFrame: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Hook queueMicrotask to preserve effect context
|
|
370
|
+
* @default true
|
|
371
|
+
*/
|
|
372
|
+
queueMicrotask: boolean;
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
export { type State, nativeReactive, rootFunction };
|
|
376
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reactive/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAGhC;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,eAAe,CAAA;IACxB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,eAAe,CAAA;IACvB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,OAAO,CAAA;CACjB;AAID;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB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AAG,CAEf;CACD;AAGD;;GAEG;AACH,eAAO,MAAM,OAAO;IACnB;;;OAGG;qBACc,QAAQ;IACzB;;;OAGG;qBACc,QAAQ;IACzB;;;;OAIG;sBACe,QAAQ,EAAE,YAAY,QAAQ;IAChD;;;OAGG;2BACoB,QAAQ,EAAE;IACjC;;OAEG;;4BAEqB,QAAQ;IAChC;;;;;;OAMG;oBACa,GAAG,cAAc,SAAS,WAAW,GAAG,EAAE,UAAU,GAAG,CAAC,cAAc,CAAC;IACvF;;;;OAIG;iCAC0B,cAAc;IAC3C;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;uBAC2B,OAAO,GAAG,OAAO,GAAG,MAAM;IACxD;;;;;;;;;;;;;;;;;;OAkBG;8BAEA,CAAC,CACD,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,GAAG,EACV,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,GAAG,EAAE,EACX,KAAK,EAAE,aAAa,GAAG,YAAY,KAC9B,IAAI,CAAC,GACV,SAAS;IACZ;;;;;;;;;;;;;;;OAeG;mBACsB,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;IACvE;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;IAEH;;;;;;;;;;;;;;;OAeG;eACoB,kBAAkB,GAAG,KAAK;oBAEjC,GAAG,EAAE;IAErB;;OAEG;;QAEF;;;WAGG;;QAEH;;;WAGG;;;IAIJ;;;;;OAKG;;QAEF;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;;CAGJ,CAAA;AAGD,OAAO,EAAE,KAAK,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type GenericClassDecorator } from './decorator';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that caches the result of a getter method and only recomputes when dependencies change
|
|
4
|
+
* Prevents circular dependencies and provides automatic cache invalidation
|
|
5
|
+
*/
|
|
6
|
+
export declare const cached: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a property is cached (has a cached value)
|
|
9
|
+
* @param object - The object to check
|
|
10
|
+
* @param propertyKey - The property key to check
|
|
11
|
+
* @returns True if the property has a cached value
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCached(object: Object, propertyKey: PropertyKey): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Caches a value for a property on an object
|
|
16
|
+
* @param object - The object to cache the value on
|
|
17
|
+
* @param propertyKey - The property key to cache
|
|
18
|
+
* @param value - The value to cache
|
|
19
|
+
*/
|
|
20
|
+
export declare function cache(object: Object, propertyKey: PropertyKey, value: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a decorator that modifies property descriptors for specified properties
|
|
23
|
+
* @param descriptor - The descriptor properties to apply
|
|
24
|
+
* @returns A class decorator that applies the descriptor to specified properties
|
|
25
|
+
*/
|
|
26
|
+
export declare function describe(descriptor: {
|
|
27
|
+
enumerable?: boolean;
|
|
28
|
+
configurable?: boolean;
|
|
29
|
+
writable?: boolean;
|
|
30
|
+
}): <T>(...properties: (keyof T)[]) => GenericClassDecorator<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Decorator that marks methods, properties, or classes as deprecated
|
|
33
|
+
* Provides warning messages when deprecated items are used
|
|
34
|
+
*/
|
|
35
|
+
export declare const deprecated: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any> & import("./decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any> & import("./decorator").ModernSetterDecorator<any> & ((message: string) => import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any> & import("./decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any> & import("./decorator").ModernSetterDecorator<any>) & {
|
|
36
|
+
warn: (target: any, propertyKey: PropertyKey, message?: string) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Creates a debounced method decorator that delays execution until after the delay period has passed
|
|
40
|
+
* @param delay - The delay in milliseconds
|
|
41
|
+
* @returns A method decorator that debounces method calls
|
|
42
|
+
*/
|
|
43
|
+
export declare function debounce(delay: number): import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a throttled method decorator that limits execution to once per delay period
|
|
46
|
+
* @param delay - The delay in milliseconds
|
|
47
|
+
* @returns A method decorator that throttles method calls
|
|
48
|
+
*/
|
|
49
|
+
export declare function throttle(delay: number): import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any>;
|
|
50
|
+
//# sourceMappingURL=std-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"std-decorators.d.ts","sourceRoot":"","sources":["../src/std-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAInE;;;GAGG;AACH,eAAO,MAAM,MAAM,4JAuBjB,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,WAEhE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,QAEzE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,IACQ,CAAC,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,KAAG,qBAAqB,CAAC,CAAC,CAAC,CAchE;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,oaA4BJ,MAAM;mBAgCR,GAAG,eAAe,WAAW,YAAY,MAAM;CAO/D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,yGAmBrC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,yGAiCrC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
type ElementTypes<T extends readonly unknown[]> = {
|
|
2
|
+
[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K];
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Combines multiple arrays into an array of tuples, stopping at the shortest array length
|
|
6
|
+
* @param args - Arrays to zip together
|
|
7
|
+
* @returns Array of tuples containing elements from each input array
|
|
8
|
+
*/
|
|
9
|
+
export declare function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[];
|
|
10
|
+
/**
|
|
11
|
+
* Checks if two arrays are strictly equal (shallow comparison)
|
|
12
|
+
* @param a - First value
|
|
13
|
+
* @param b - Second value
|
|
14
|
+
* @returns True if arrays are equal or values are strictly equal
|
|
15
|
+
*/
|
|
16
|
+
export declare function arrayEquals(a: any, b: any): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if a function is a constructor (class or constructor function)
|
|
19
|
+
* @param fn - The function to check
|
|
20
|
+
* @returns True if the function is a constructor
|
|
21
|
+
*/
|
|
22
|
+
export declare function isConstructor(fn: Function): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Renames a function with a new name
|
|
25
|
+
* @param fct - The function to rename
|
|
26
|
+
* @param name - The new name for the function
|
|
27
|
+
* @returns The function with the new name
|
|
28
|
+
*/
|
|
29
|
+
export declare function renamed<F extends Function>(fct: F, name: string): F;
|
|
30
|
+
export declare const FoolProof: {
|
|
31
|
+
get(obj: any, prop: any, receiver: any): any;
|
|
32
|
+
set(obj: any, prop: any, value: any, receiver: any): boolean;
|
|
33
|
+
};
|
|
34
|
+
export declare function isOwnAccessor(obj: any, prop: any): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Deeply compares two values.
|
|
37
|
+
* For objects, compares prototypes with === and then own properties recursively.
|
|
38
|
+
* Uses a cache to handle circular references.
|
|
39
|
+
* @param a - First value
|
|
40
|
+
* @param b - Second value
|
|
41
|
+
* @param cache - Map for circular reference protection (internal use)
|
|
42
|
+
* @returns True if values are deeply equal
|
|
43
|
+
*/
|
|
44
|
+
export declare function deepCompare(a: any, b: any, cache?: Map<object, Set<object>>): boolean;
|
|
45
|
+
export declare function contentRef(container: object): any;
|
|
46
|
+
export declare function tag<T extends object>(name: string, obj: T): T;
|
|
47
|
+
export declare function named<T extends Function>(name: string, fn: T): T;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI;KAChD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,CAWnF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,E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