mutts 1.0.6 → 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.
Files changed (196) hide show
  1. package/README.md +61 -23
  2. package/dist/async/browser.d.ts +2 -0
  3. package/dist/async/browser.d.ts.map +1 -0
  4. package/dist/async/index.d.ts +18 -0
  5. package/dist/async/index.d.ts.map +1 -0
  6. package/dist/async/node.d.ts +2 -0
  7. package/dist/async/node.d.ts.map +1 -0
  8. package/dist/{chunks/index-CDCOjzTy.js → browser.cjs} +5913 -4382
  9. package/dist/browser.cjs.map +1 -0
  10. package/dist/browser.d.ts +1655 -0
  11. package/dist/browser.esm.js +305 -0
  12. package/dist/browser.esm.js.map +1 -0
  13. package/dist/chunks/async-browser-CA0jPWIi.cjs +304 -0
  14. package/dist/chunks/async-browser-CA0jPWIi.cjs.map +1 -0
  15. package/dist/chunks/async-core-UqHzvJ-S.cjs +25 -0
  16. package/dist/chunks/async-core-UqHzvJ-S.cjs.map +1 -0
  17. package/dist/chunks/async-node-BYHuGTni.cjs +103 -0
  18. package/dist/chunks/async-node-BYHuGTni.cjs.map +1 -0
  19. package/dist/chunks/{index-DiP0RXoZ.esm.js → index-DhaOVusv.esm.js} +5851 -4345
  20. package/dist/chunks/index-DhaOVusv.esm.js.map +1 -0
  21. package/dist/decorator.d.ts +17 -18
  22. package/dist/decorator.d.ts.map +1 -0
  23. package/dist/destroyable.d.ts +12 -15
  24. package/dist/destroyable.d.ts.map +1 -0
  25. package/dist/devtools/devtool/devtools.d.ts +1 -0
  26. package/dist/devtools/devtool/devtools.d.ts.map +1 -0
  27. package/dist/devtools/devtool/panel.d.ts +2 -0
  28. package/dist/devtools/devtool/panel.d.ts.map +1 -0
  29. package/dist/devtools/panel.js.map +1 -1
  30. package/dist/entry-browser.d.ts +3 -0
  31. package/dist/entry-browser.d.ts.map +1 -0
  32. package/dist/entry-node.d.ts +3 -0
  33. package/dist/entry-node.d.ts.map +1 -0
  34. package/dist/eventful.d.ts +3 -5
  35. package/dist/eventful.d.ts.map +1 -0
  36. package/dist/index.d.ts +13 -19
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/indexable.d.ts +10 -10
  39. package/dist/indexable.d.ts.map +1 -0
  40. package/dist/introspection.d.ts +27 -0
  41. package/dist/introspection.d.ts.map +1 -0
  42. package/dist/iterableWeak.d.ts +53 -0
  43. package/dist/iterableWeak.d.ts.map +1 -0
  44. package/dist/mixins.d.ts +25 -0
  45. package/dist/mixins.d.ts.map +1 -0
  46. package/dist/mutts.umd.js +1 -1
  47. package/dist/mutts.umd.js.map +1 -1
  48. package/dist/mutts.umd.min.js +1 -1
  49. package/dist/mutts.umd.min.js.map +1 -1
  50. package/dist/node.cjs +105 -0
  51. package/dist/node.cjs.map +1 -0
  52. package/dist/node.d.ts +1 -0
  53. package/dist/node.esm.js +104 -0
  54. package/dist/node.esm.js.map +1 -0
  55. package/dist/promiseChain.d.ts +4 -5
  56. package/dist/promiseChain.d.ts.map +1 -0
  57. package/dist/reactive/array.d.ts +49 -0
  58. package/dist/reactive/array.d.ts.map +1 -0
  59. package/dist/reactive/buffer.d.ts +44 -0
  60. package/dist/reactive/buffer.d.ts.map +1 -0
  61. package/dist/reactive/change.d.ts +29 -0
  62. package/dist/reactive/change.d.ts.map +1 -0
  63. package/dist/reactive/debug.d.ts +111 -0
  64. package/dist/reactive/debug.d.ts.map +1 -0
  65. package/dist/reactive/deep-touch.d.ts +28 -0
  66. package/dist/reactive/deep-touch.d.ts.map +1 -0
  67. package/dist/reactive/deep-watch-state.d.ts +25 -0
  68. package/dist/reactive/deep-watch-state.d.ts.map +1 -0
  69. package/dist/reactive/deep-watch.d.ts +19 -0
  70. package/dist/reactive/deep-watch.d.ts.map +1 -0
  71. package/dist/reactive/effect-context.d.ts +7 -0
  72. package/dist/reactive/effect-context.d.ts.map +1 -0
  73. package/dist/reactive/effects.d.ts +151 -0
  74. package/dist/reactive/effects.d.ts.map +1 -0
  75. package/dist/reactive/index.d.ts +20 -0
  76. package/dist/reactive/index.d.ts.map +1 -0
  77. package/dist/reactive/interface.d.ts +64 -0
  78. package/dist/reactive/interface.d.ts.map +1 -0
  79. package/dist/reactive/map.d.ts +30 -0
  80. package/dist/reactive/map.d.ts.map +1 -0
  81. package/dist/reactive/memoize.d.ts +5 -0
  82. package/dist/reactive/memoize.d.ts.map +1 -0
  83. package/dist/reactive/non-reactive-state.d.ts +9 -0
  84. package/dist/reactive/non-reactive-state.d.ts.map +1 -0
  85. package/dist/reactive/non-reactive.d.ts +11 -0
  86. package/dist/reactive/non-reactive.d.ts.map +1 -0
  87. package/dist/reactive/project.d.ts +41 -0
  88. package/dist/reactive/project.d.ts.map +1 -0
  89. package/dist/reactive/proxy-state.d.ts +8 -0
  90. package/dist/reactive/proxy-state.d.ts.map +1 -0
  91. package/dist/reactive/proxy.d.ts +23 -0
  92. package/dist/reactive/proxy.d.ts.map +1 -0
  93. package/dist/reactive/record.d.ts +116 -0
  94. package/dist/reactive/record.d.ts.map +1 -0
  95. package/dist/reactive/register.d.ts +64 -0
  96. package/dist/reactive/register.d.ts.map +1 -0
  97. package/dist/reactive/registry.d.ts +20 -0
  98. package/dist/reactive/registry.d.ts.map +1 -0
  99. package/dist/reactive/set.d.ts +28 -0
  100. package/dist/reactive/set.d.ts.map +1 -0
  101. package/dist/reactive/tracking.d.ts +7 -0
  102. package/dist/reactive/tracking.d.ts.map +1 -0
  103. package/dist/reactive/types.d.ts +376 -0
  104. package/dist/reactive/types.d.ts.map +1 -0
  105. package/dist/std-decorators.d.ts +9 -11
  106. package/dist/std-decorators.d.ts.map +1 -0
  107. package/dist/utils.d.ts +49 -0
  108. package/dist/utils.d.ts.map +1 -0
  109. package/dist/zone.d.ts +40 -0
  110. package/dist/zone.d.ts.map +1 -0
  111. package/docs/ai/api-reference.md +0 -2
  112. package/docs/reactive/advanced.md +2 -5
  113. package/docs/reactive/collections.md +0 -125
  114. package/docs/reactive/core.md +27 -24
  115. package/docs/reactive/debugging.md +12 -2
  116. package/docs/reactive/project.md +1 -1
  117. package/docs/reactive/scan.md +78 -0
  118. package/docs/reactive.md +2 -1
  119. package/docs/std-decorators.md +69 -0
  120. package/docs/zone.md +95 -0
  121. package/package.json +67 -23
  122. package/src/async/browser.ts +319 -0
  123. package/src/async/index.ts +23 -0
  124. package/src/async/node.ts +104 -0
  125. package/src/decorator.ts +5 -1
  126. package/src/destroyable.ts +1 -1
  127. package/src/entry-browser.ts +5 -0
  128. package/src/entry-node.ts +5 -0
  129. package/src/index.d.ts +12 -9
  130. package/src/index.ts +23 -14
  131. package/src/indexable.ts +42 -0
  132. package/src/mixins.ts +2 -2
  133. package/src/reactive/array.ts +274 -179
  134. package/src/reactive/buffer.ts +168 -0
  135. package/src/reactive/change.ts +2 -2
  136. package/src/reactive/effect-context.ts +15 -91
  137. package/src/reactive/effects.ts +119 -179
  138. package/src/reactive/index.ts +11 -13
  139. package/src/reactive/interface.ts +19 -33
  140. package/src/reactive/map.ts +49 -62
  141. package/src/reactive/memoize.ts +19 -9
  142. package/src/reactive/project.ts +43 -22
  143. package/src/reactive/proxy.ts +16 -41
  144. package/src/reactive/record.ts +3 -3
  145. package/src/reactive/register.ts +5 -7
  146. package/src/reactive/registry.ts +9 -17
  147. package/src/reactive/set.ts +43 -57
  148. package/src/reactive/tracking.ts +1 -29
  149. package/src/reactive/types.ts +46 -23
  150. package/src/utils.ts +80 -37
  151. package/src/zone.ts +138 -0
  152. package/dist/chunks/_tslib-BgjropY9.js +0 -81
  153. package/dist/chunks/_tslib-BgjropY9.js.map +0 -1
  154. package/dist/chunks/_tslib-MCKDzsSq.esm.js +0 -75
  155. package/dist/chunks/_tslib-MCKDzsSq.esm.js.map +0 -1
  156. package/dist/chunks/decorator-BGILvPtN.esm.js +0 -627
  157. package/dist/chunks/decorator-BGILvPtN.esm.js.map +0 -1
  158. package/dist/chunks/decorator-BQ2eBTCj.js +0 -651
  159. package/dist/chunks/decorator-BQ2eBTCj.js.map +0 -1
  160. package/dist/chunks/index-CDCOjzTy.js.map +0 -1
  161. package/dist/chunks/index-DiP0RXoZ.esm.js.map +0 -1
  162. package/dist/decorator.esm.js +0 -2
  163. package/dist/decorator.esm.js.map +0 -1
  164. package/dist/decorator.js +0 -11
  165. package/dist/decorator.js.map +0 -1
  166. package/dist/destroyable.esm.js +0 -109
  167. package/dist/destroyable.esm.js.map +0 -1
  168. package/dist/destroyable.js +0 -116
  169. package/dist/destroyable.js.map +0 -1
  170. package/dist/eventful.esm.js +0 -66
  171. package/dist/eventful.esm.js.map +0 -1
  172. package/dist/eventful.js +0 -68
  173. package/dist/eventful.js.map +0 -1
  174. package/dist/index.esm.js +0 -53
  175. package/dist/index.esm.js.map +0 -1
  176. package/dist/index.js +0 -139
  177. package/dist/index.js.map +0 -1
  178. package/dist/indexable.esm.js +0 -285
  179. package/dist/indexable.esm.js.map +0 -1
  180. package/dist/indexable.js +0 -291
  181. package/dist/indexable.js.map +0 -1
  182. package/dist/promiseChain.esm.js +0 -78
  183. package/dist/promiseChain.esm.js.map +0 -1
  184. package/dist/promiseChain.js +0 -80
  185. package/dist/promiseChain.js.map +0 -1
  186. package/dist/reactive.d.ts +0 -910
  187. package/dist/reactive.esm.js +0 -5
  188. package/dist/reactive.esm.js.map +0 -1
  189. package/dist/reactive.js +0 -59
  190. package/dist/reactive.js.map +0 -1
  191. package/dist/std-decorators.esm.js +0 -196
  192. package/dist/std-decorators.esm.js.map +0 -1
  193. package/dist/std-decorators.js +0 -204
  194. package/dist/std-decorators.js.map +0 -1
  195. package/src/reactive/mapped.ts +0 -129
  196. package/src/reactive/zone.ts +0 -208
@@ -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,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,YAAY,CAAA;IAC1C,IAAI,EAAE,GAAG,CAAA;CACT,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,cAAc,CAAA;AAEtD,KAAK,KAAK,GACP;IACA,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,EAAE,KAAK,CAAA;CACV,GACD,EAAE,CAAA;AAGL,QAAA,MAAM,cAAc,eAA4B,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,eAAyB,CAAA;AACrD;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAkC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ,eAAsB,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,cAAc,eAA4B,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,OAAO,eAAoB,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,OAAO,eAAoB,CAAA;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,GAAG,CAAA;IACX,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC1B;AAGD,QAAA,MAAM,YAAY,eAA0B,CAAA;AAE5C;;GAEG;AACH,oBAAY,iBAAiB;IAC5B,aAAa,mBAAmB;IAChC,gBAAgB,uBAAuB;IACvC,mBAAmB,0BAA0B;IAC7C,eAAe,sBAAsB;IACrC,aAAa,mBAAmB;IAChC,aAAa,mBAAmB;CAChC;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,iBAAiB,CAAC,aAAa,CAAA;IACrC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,iBAAiB,CAAC,gBAAgB,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,EAAE,CAAA;CACf,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,iBAAiB,CAAC,mBAAmB,CAAA;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,iBAAiB,CAAC,aAAa,CAAA;IACrC,KAAK,EAAE,GAAG,CAAA;CACV,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,iBAAiB,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAC1B,cAAc,GACd,iBAAiB,GACjB,oBAAoB,GACpB,sBAAsB,GACtB,gBAAgB,CAAA;AAEnB;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAG/B,SAAS,CAAC,EAAE,iBAAiB;gBADpC,OAAO,EAAE,MAAM,EACR,SAAS,CAAC,EAAE,iBAAiB;IAMrC,IAAI,IAAI,IAAI,iBAAiB,GAAG,SAAS,CAExC;IAED,IAAI,KAAK,IAAI,GAAG,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"}
@@ -1,30 +1,29 @@
1
- import { LegacyPropertyDecorator, ModernGetterDecorator, ModernAccessorDecorator, ModernMethodDecorator, LegacyClassDecorator, ModernClassDecorator, ModernSetterDecorator, GenericClassDecorator } from './decorator.js';
2
-
1
+ import { type GenericClassDecorator } from './decorator';
3
2
  /**
4
3
  * Decorator that caches the result of a getter method and only recomputes when dependencies change
5
4
  * Prevents circular dependencies and provides automatic cache invalidation
6
5
  */
7
- declare const cached: LegacyPropertyDecorator<any> & ModernGetterDecorator<any> & ModernAccessorDecorator<any>;
6
+ export declare const cached: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any>;
8
7
  /**
9
8
  * Checks if a property is cached (has a cached value)
10
9
  * @param object - The object to check
11
10
  * @param propertyKey - The property key to check
12
11
  * @returns True if the property has a cached value
13
12
  */
14
- declare function isCached(object: Object, propertyKey: PropertyKey): boolean;
13
+ export declare function isCached(object: Object, propertyKey: PropertyKey): boolean;
15
14
  /**
16
15
  * Caches a value for a property on an object
17
16
  * @param object - The object to cache the value on
18
17
  * @param propertyKey - The property key to cache
19
18
  * @param value - The value to cache
20
19
  */
21
- declare function cache(object: Object, propertyKey: PropertyKey, value: any): void;
20
+ export declare function cache(object: Object, propertyKey: PropertyKey, value: any): void;
22
21
  /**
23
22
  * Creates a decorator that modifies property descriptors for specified properties
24
23
  * @param descriptor - The descriptor properties to apply
25
24
  * @returns A class decorator that applies the descriptor to specified properties
26
25
  */
27
- declare function describe(descriptor: {
26
+ export declare function describe(descriptor: {
28
27
  enumerable?: boolean;
29
28
  configurable?: boolean;
30
29
  writable?: boolean;
@@ -33,7 +32,7 @@ declare function describe(descriptor: {
33
32
  * Decorator that marks methods, properties, or classes as deprecated
34
33
  * Provides warning messages when deprecated items are used
35
34
  */
36
- declare const deprecated: LegacyPropertyDecorator<any> & ModernMethodDecorator<any> & LegacyClassDecorator<new (...args: any[]) => any> & ModernClassDecorator<new (...args: any[]) => any> & ModernGetterDecorator<any> & ModernAccessorDecorator<any> & ModernSetterDecorator<any> & ((message: string) => LegacyPropertyDecorator<any> & ModernMethodDecorator<any> & LegacyClassDecorator<new (...args: any[]) => any> & ModernClassDecorator<new (...args: any[]) => any> & ModernGetterDecorator<any> & ModernAccessorDecorator<any> & ModernSetterDecorator<any>) & {
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>) & {
37
36
  warn: (target: any, propertyKey: PropertyKey, message?: string) => void;
38
37
  };
39
38
  /**
@@ -41,12 +40,11 @@ declare const deprecated: LegacyPropertyDecorator<any> & ModernMethodDecorator<a
41
40
  * @param delay - The delay in milliseconds
42
41
  * @returns A method decorator that debounces method calls
43
42
  */
44
- declare function debounce(delay: number): LegacyPropertyDecorator<any> & ModernMethodDecorator<any>;
43
+ export declare function debounce(delay: number): import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any>;
45
44
  /**
46
45
  * Creates a throttled method decorator that limits execution to once per delay period
47
46
  * @param delay - The delay in milliseconds
48
47
  * @returns A method decorator that throttles method calls
49
48
  */
50
- declare function throttle(delay: number): LegacyPropertyDecorator<any> & ModernMethodDecorator<any>;
51
-
52
- export { cache, cached, debounce, deprecated, describe, isCached, throttle };
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"}
@@ -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,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAQnD;AA0BD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAMnD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAMnE;AACD,eAAO,MAAM,SAAS;aACZ,GAAG,QAAQ,GAAG,YAAY,GAAG;aAK7B,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG;CAiBlD,CAAA;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,WAGhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,2BAAiC,GAAG,OAAO,CAqI3F;AAID,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,OAW3C;AAED,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAc7D;AAED,wBAAgB,KAAK,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAOhE"}
package/dist/zone.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ export declare abstract class AZone<T> {
2
+ abstract active?: T;
3
+ protected enter(value?: T): unknown;
4
+ protected leave(entered: unknown): void;
5
+ with<R>(value: T, fn: () => R): R;
6
+ root<R>(fn: () => R): R;
7
+ get zoned(): FunctionWrapper;
8
+ }
9
+ export type FunctionWrapper = <R>(fn?: () => R) => R;
10
+ export declare class Zone<T> extends AZone<T> {
11
+ active: T | undefined;
12
+ }
13
+ type HistoryValue<T> = {
14
+ present: T | undefined;
15
+ history: Set<T>;
16
+ };
17
+ export declare class ZoneHistory<T> extends AZone<HistoryValue<T>> {
18
+ private controlled;
19
+ private history;
20
+ readonly present: AZone<T>;
21
+ has(value: T): boolean;
22
+ some(predicate: (value: T) => boolean): boolean;
23
+ constructor(controlled?: AZone<T>);
24
+ get active(): HistoryValue<T> | undefined;
25
+ set active(value: HistoryValue<T> | undefined);
26
+ }
27
+ export declare class ZoneAggregator extends AZone<Map<AZone<unknown>, unknown>> {
28
+ #private;
29
+ constructor(...zones: AZone<unknown>[]);
30
+ get active(): Map<AZone<unknown>, unknown> | undefined;
31
+ set active(value: Map<AZone<unknown>, unknown> | undefined);
32
+ enter(value?: Map<AZone<unknown>, unknown> | undefined): Map<AZone<unknown>, unknown>;
33
+ leave(entered: Map<AZone<unknown>, unknown>): void;
34
+ add(z: AZone<unknown>): void;
35
+ delete(z: AZone<unknown>): void;
36
+ clear(): void;
37
+ }
38
+ export declare const asyncZone: ZoneAggregator;
39
+ export {};
40
+ //# sourceMappingURL=zone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zone.d.ts","sourceRoot":"","sources":["../src/zone.ts"],"names":[],"mappings":"AAUA,8BAAsB,KAAK,CAAC,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACnB,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO;IAKnC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAGvC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAYjC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAQvB,IAAI,KAAK,IAAI,eAAe,CAG3B;CACD;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;AAEpD,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,GAAG,SAAS,CAAA;CACrB;AACD,KAAK,YAAY,CAAC,CAAC,IAAI;IAAC,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;CAAC,CAAA;AAChE,qBAAa,WAAW,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU7C,OAAO,CAAC,UAAU;IAT9B,OAAO,CAAC,OAAO,CAAe;IAC9B,SAAgB,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAGtB,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO;gBAIlC,UAAU,GAAE,KAAK,CAAC,CAAC,CAAiB;IAqBxD,IAAI,MAAM,IAGQ,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAD5C;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,EAG5C;CACD;AAED,qBAAa,cAAe,SAAQ,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;;gBAE1D,GAAG,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;IAItC,IAAI,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,CAKrD;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,EAEzD;IACD,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS;IAQtD,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI;IAGlD,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAGrB,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAGxB,KAAK;CAGL;AAED,eAAO,MAAM,SAAS,gBAAqC,CAAA"}
@@ -68,8 +68,6 @@ export interface Register<T, K extends PropertyKey = PropertyKey> extends Iterab
68
68
  }
69
69
 
70
70
  export declare function register<T, K extends PropertyKey = PropertyKey>(keyFn: (item: T) => K, initial?: Iterable<T>): Register<T, K>;
71
- export declare function mapped<T, U>(inputs: readonly T[], compute: (input: T, index: number, output: U[]) => U): readonly U[];
72
- export declare function reduced<T, U, R extends object = any>(inputs: readonly T[], compute: (input: T, factor: R) => readonly U[]): readonly U[];
73
71
  export declare function project<S, R>(source: S, apply: (access: any, target: any) => any): R;
74
72
  export declare function organized<S, T>(source: S, apply: (access: any, target: T) => any, baseTarget?: T): T;
75
73
 
@@ -1161,10 +1161,6 @@ class Example {
1161
1161
  }
1162
1162
  ```
1163
1163
 
1164
- ### Working with `mapped()`
1165
-
1166
- Pair `memoize()` with [`mapped()`](#mapped) to keep derived array elements stable across reorders (see [Identity-preserving mapped arrays](#identity-preserving-mapped-arrays)). Memoizing the mapper ensures each input object is processed at most once and its derived state persists while the input reference lives.
1167
-
1168
1164
  ## Debugging and Development
1169
1165
 
1170
1166
  The `mutts` reactive system includes built-in tools for troubleshooting complex dependency graphs and identifying performance bottlenecks.
@@ -1173,7 +1169,8 @@ For a full guide on debugging, including cycle detection and memoization discrep
1173
1169
 
1174
1170
  ### Quick Summary
1175
1171
 
1176
- - **Cycle Detection**: Automatically catch circular dependencies via `reactiveOptions.cycleHandling`.
1172
+ - **Cycle Detection**: Automatically catch circular dependencies via `reactiveOptions.cycleHandling`. Note: Instant mathematical detection requires choosing a mode other than `'none'`.
1173
+ - **Flat Mode**: The default `reactiveOptions.cycleHandling = 'none'` provides maximum performance in high-frequency update scenarios by disabling graph maintenance.
1177
1174
  - **Memoization Discrepancy**: Detect "missing dependencies" by running computations twice during development using `reactiveOptions.onMemoizationDiscrepancy`.
1178
1175
  - **Global Hooks**: Use `reactiveOptions.touched`, `enter`, and `leave` to observe system activity.
1179
1176