mutts 1.0.7 → 1.0.9

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 (191) hide show
  1. package/README.md +72 -17
  2. package/dist/browser.cjs +3111 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.ts +1391 -1
  5. package/dist/browser.esm.js +264 -35
  6. package/dist/browser.esm.js.map +1 -1
  7. package/dist/chunks/async-browser-lvzLOCgk.cjs +297 -0
  8. package/dist/chunks/async-browser-lvzLOCgk.cjs.map +1 -0
  9. package/dist/chunks/async-core-CRLKP3l-.cjs +29 -0
  10. package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
  11. package/dist/chunks/async-node-C3DeIb0y.cjs +96 -0
  12. package/dist/chunks/async-node-C3DeIb0y.cjs.map +1 -0
  13. package/dist/chunks/index-2vea86wD.esm.js +3011 -0
  14. package/dist/chunks/index-2vea86wD.esm.js.map +1 -0
  15. package/dist/chunks/index-CtA2AWl3.esm.js +4376 -0
  16. package/dist/chunks/index-CtA2AWl3.esm.js.map +1 -0
  17. package/dist/chunks/index-VTO-b2vR.cjs +4461 -0
  18. package/dist/chunks/index-VTO-b2vR.cjs.map +1 -0
  19. package/dist/debug/debug.d.ts +122 -0
  20. package/dist/debug/debug.d.ts.map +1 -0
  21. package/dist/debug/index.d.ts +4 -0
  22. package/dist/debug/index.d.ts.map +1 -0
  23. package/dist/debug/lineage-panel.d.ts +5 -0
  24. package/dist/debug/lineage-panel.d.ts.map +1 -0
  25. package/dist/debug/lineage.d.ts +79 -0
  26. package/dist/debug/lineage.d.ts.map +1 -0
  27. package/dist/debug.cjs +35 -0
  28. package/dist/debug.cjs.map +1 -0
  29. package/dist/debug.d.ts +209 -0
  30. package/dist/debug.esm.js +2 -0
  31. package/dist/debug.esm.js.map +1 -0
  32. package/dist/devtools/devtool/devtools.d.ts +1 -0
  33. package/dist/devtools/devtool/devtools.d.ts.map +1 -0
  34. package/dist/devtools/devtool/panel.d.ts +2 -0
  35. package/dist/devtools/devtool/panel.d.ts.map +1 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/mutts.umd.js +1 -1
  38. package/dist/mutts.umd.js.map +1 -1
  39. package/dist/mutts.umd.min.js +1 -1
  40. package/dist/mutts.umd.min.js.map +1 -1
  41. package/dist/node.cjs +107 -0
  42. package/dist/node.cjs.map +1 -0
  43. package/dist/node.d.ts +2 -2
  44. package/dist/node.esm.js +86 -33
  45. package/dist/node.esm.js.map +1 -1
  46. package/dist/src/async/browser.d.ts +2 -0
  47. package/dist/src/async/browser.d.ts.map +1 -0
  48. package/dist/src/async/index.d.ts +19 -0
  49. package/dist/src/async/index.d.ts.map +1 -0
  50. package/dist/src/async/node.d.ts +2 -0
  51. package/dist/src/async/node.d.ts.map +1 -0
  52. package/dist/src/decorator.d.ts +106 -0
  53. package/dist/src/decorator.d.ts.map +1 -0
  54. package/dist/src/destroyable.d.ts +87 -0
  55. package/dist/src/destroyable.d.ts.map +1 -0
  56. package/dist/src/entry-browser.d.ts +3 -0
  57. package/dist/src/entry-browser.d.ts.map +1 -0
  58. package/dist/src/entry-node.d.ts +3 -0
  59. package/dist/src/entry-node.d.ts.map +1 -0
  60. package/dist/src/eventful.d.ts +20 -0
  61. package/dist/src/eventful.d.ts.map +1 -0
  62. package/dist/src/flavored.d.ts +33 -0
  63. package/dist/src/flavored.d.ts.map +1 -0
  64. package/dist/src/index.d.ts +14 -0
  65. package/dist/src/index.d.ts.map +1 -0
  66. package/dist/src/indexable.d.ts +243 -0
  67. package/dist/src/indexable.d.ts.map +1 -0
  68. package/dist/src/introspection.d.ts +27 -0
  69. package/dist/src/introspection.d.ts.map +1 -0
  70. package/dist/src/iterableWeak.d.ts +53 -0
  71. package/dist/src/iterableWeak.d.ts.map +1 -0
  72. package/dist/src/mixins.d.ts +25 -0
  73. package/dist/src/mixins.d.ts.map +1 -0
  74. package/dist/src/promiseChain.d.ts +20 -0
  75. package/dist/src/promiseChain.d.ts.map +1 -0
  76. package/dist/src/reactive/array.d.ts +48 -0
  77. package/dist/src/reactive/array.d.ts.map +1 -0
  78. package/dist/src/reactive/buffer.d.ts +120 -0
  79. package/dist/src/reactive/buffer.d.ts.map +1 -0
  80. package/dist/src/reactive/change.d.ts +29 -0
  81. package/dist/src/reactive/change.d.ts.map +1 -0
  82. package/dist/src/reactive/deep-touch.d.ts +28 -0
  83. package/dist/src/reactive/deep-touch.d.ts.map +1 -0
  84. package/dist/src/reactive/deep-watch-state.d.ts +25 -0
  85. package/dist/src/reactive/deep-watch-state.d.ts.map +1 -0
  86. package/dist/src/reactive/deep-watch.d.ts +20 -0
  87. package/dist/src/reactive/deep-watch.d.ts.map +1 -0
  88. package/dist/src/reactive/describe.d.ts +12 -0
  89. package/dist/src/reactive/describe.d.ts.map +1 -0
  90. package/dist/src/reactive/effect-context.d.ts +34 -0
  91. package/dist/src/reactive/effect-context.d.ts.map +1 -0
  92. package/dist/src/reactive/effects.d.ts +164 -0
  93. package/dist/src/reactive/effects.d.ts.map +1 -0
  94. package/dist/src/reactive/index.d.ts +19 -0
  95. package/dist/src/reactive/index.d.ts.map +1 -0
  96. package/dist/src/reactive/map.d.ts +28 -0
  97. package/dist/src/reactive/map.d.ts.map +1 -0
  98. package/dist/src/reactive/memoize.d.ts +28 -0
  99. package/dist/src/reactive/memoize.d.ts.map +1 -0
  100. package/dist/src/reactive/non-reactive-state.d.ts +9 -0
  101. package/dist/src/reactive/non-reactive-state.d.ts.map +1 -0
  102. package/dist/src/reactive/non-reactive.d.ts +11 -0
  103. package/dist/src/reactive/non-reactive.d.ts.map +1 -0
  104. package/dist/src/reactive/project.d.ts +40 -0
  105. package/dist/src/reactive/project.d.ts.map +1 -0
  106. package/dist/src/reactive/proxy-state.d.ts +8 -0
  107. package/dist/src/reactive/proxy-state.d.ts.map +1 -0
  108. package/dist/src/reactive/proxy.d.ts +23 -0
  109. package/dist/src/reactive/proxy.d.ts.map +1 -0
  110. package/dist/src/reactive/record.d.ts +115 -0
  111. package/dist/src/reactive/record.d.ts.map +1 -0
  112. package/dist/src/reactive/register.d.ts +125 -0
  113. package/dist/src/reactive/register.d.ts.map +1 -0
  114. package/dist/src/reactive/registry.d.ts +21 -0
  115. package/dist/src/reactive/registry.d.ts.map +1 -0
  116. package/dist/src/reactive/set.d.ts +26 -0
  117. package/dist/src/reactive/set.d.ts.map +1 -0
  118. package/dist/src/reactive/tracking.d.ts +7 -0
  119. package/dist/src/reactive/tracking.d.ts.map +1 -0
  120. package/dist/src/reactive/types.d.ts +424 -0
  121. package/dist/src/reactive/types.d.ts.map +1 -0
  122. package/dist/src/reactive/watch.d.ts +48 -0
  123. package/dist/src/reactive/watch.d.ts.map +1 -0
  124. package/dist/src/std-decorators.d.ts +45 -0
  125. package/dist/src/std-decorators.d.ts.map +1 -0
  126. package/dist/src/utils.d.ts +49 -0
  127. package/dist/src/utils.d.ts.map +1 -0
  128. package/dist/src/zone.d.ts +40 -0
  129. package/dist/src/zone.d.ts.map +1 -0
  130. package/dist/types-DaHFfhlN.d.ts +414 -0
  131. package/docs/ai/api-reference.md +1 -1
  132. package/docs/ai/manual.md +443 -17
  133. package/docs/events.md +57 -2
  134. package/docs/flavored.md +210 -0
  135. package/docs/reactive/advanced.md +2 -3
  136. package/docs/reactive/attend.md +143 -0
  137. package/docs/reactive/collections.md +55 -0
  138. package/docs/reactive/core.md +120 -4
  139. package/docs/reactive/debugging.md +8 -10
  140. package/docs/reactive/describe.md +85 -0
  141. package/docs/reactive/error-handling.md +121 -0
  142. package/docs/reactive/project.md +1 -1
  143. package/docs/reactive/scan.md +215 -0
  144. package/docs/reactive.md +2 -0
  145. package/docs/std-decorators.md +171 -52
  146. package/docs/zone.md +9 -6
  147. package/package.json +44 -27
  148. package/src/async/browser.ts +277 -41
  149. package/src/async/index.ts +23 -4
  150. package/src/async/node.ts +78 -32
  151. package/src/entry-browser.ts +5 -0
  152. package/src/entry-node.ts +5 -0
  153. package/src/eventful.ts +82 -49
  154. package/src/flavored.ts +106 -0
  155. package/src/index.d.ts +12 -9
  156. package/src/index.ts +2 -1
  157. package/src/introspection.ts +1 -1
  158. package/src/reactive/array.ts +160 -80
  159. package/src/reactive/buffer.ts +187 -27
  160. package/src/reactive/change.ts +16 -23
  161. package/src/reactive/deep-touch.ts +19 -14
  162. package/src/reactive/deep-watch-state.ts +3 -3
  163. package/src/reactive/deep-watch.ts +7 -4
  164. package/src/reactive/describe.ts +39 -0
  165. package/src/reactive/effect-context.ts +71 -6
  166. package/src/reactive/effects.ts +445 -393
  167. package/src/reactive/index.ts +12 -14
  168. package/src/reactive/map.ts +8 -24
  169. package/src/reactive/memoize.ts +26 -3
  170. package/src/reactive/project.md +107 -0
  171. package/src/reactive/project.ts +48 -71
  172. package/src/reactive/proxy.ts +21 -3
  173. package/src/reactive/record.ts +30 -45
  174. package/src/reactive/register.ts +138 -19
  175. package/src/reactive/registry.ts +22 -9
  176. package/src/reactive/set.ts +7 -20
  177. package/src/reactive/tracking.ts +9 -12
  178. package/src/reactive/types.ts +104 -24
  179. package/src/reactive/{interface.ts → watch.ts} +29 -59
  180. package/src/std-decorators.ts +56 -17
  181. package/src/utils.ts +3 -4
  182. package/src/zone.ts +43 -28
  183. package/dist/browser.js +0 -161
  184. package/dist/browser.js.map +0 -1
  185. package/dist/chunks/index-BFYK02LG.js +0 -6378
  186. package/dist/chunks/index-BFYK02LG.js.map +0 -1
  187. package/dist/chunks/index-CNR6QRUl.esm.js +0 -6291
  188. package/dist/chunks/index-CNR6QRUl.esm.js.map +0 -1
  189. package/dist/node.js +0 -136
  190. package/dist/node.js.map +0 -1
  191. package/src/reactive/debug.ts +0 -517
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,1392 @@
1
+ import { c as cleanup, S as ScopedCallback, d as EffectCloser, e as EffectAccess, f as State, a as Evolution, b as EffectCleanup, Z as ZoneAggregator, g as EffectOptions, E as EffectTrigger, C as CatchFunction, P as ProjectionContext } from './types-DaHFfhlN.js';
2
+ export { A as AZone, F as FunctionWrapper, R as ReactiveError, h as ReactiveErrorCode, i as Zone, j as ZoneHistory, k as asyncZone, o as reactiveOptions } from './types-DaHFfhlN.js';
1
3
 
2
- export { };
4
+ /**
5
+ * Error thrown when decorator operations fail
6
+ */
7
+ declare class DecoratorError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ /**
11
+ * Legacy property decorator type for methods, getters, and setters
12
+ */
13
+ type LegacyPropertyDecorator<T> = (target: T, name: string | symbol, descriptor: PropertyDescriptor) => any;
14
+ /**
15
+ * Legacy class decorator type
16
+ */
17
+ type LegacyClassDecorator<T> = (target: T) => any;
18
+ /**
19
+ * Modern method decorator type
20
+ */
21
+ type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any;
22
+ /**
23
+ * Modern getter decorator type
24
+ */
25
+ type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any;
26
+ /**
27
+ * Modern setter decorator type
28
+ */
29
+ type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any;
30
+ /**
31
+ * Modern accessor decorator type
32
+ */
33
+ type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any;
34
+ /**
35
+ * Modern class decorator type
36
+ */
37
+ type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any;
38
+ type DDMethod<T> = (original: (this: T, ...args: any[]) => any, target: any, name: PropertyKey) => ((this: T, ...args: any[]) => any) | void;
39
+ type DDGetter<T> = (original: (this: T) => any, target: any, name: PropertyKey) => ((this: T) => any) | void;
40
+ type DDSetter<T> = (original: (this: T, value: any) => void, target: any, name: PropertyKey) => ((this: T, value: any) => void) | void;
41
+ type DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(target: Ctor) => Ctor | void;
42
+ /**
43
+ * Description object for creating decorators that work with both Legacy and Modern decorator proposals
44
+ */
45
+ interface DecoratorDescription<T> {
46
+ /** Handler for method decorators */
47
+ method?: DDMethod<T>;
48
+ /** Handler for class decorators */
49
+ class?: DDClass<T>;
50
+ /** Handler for getter decorators */
51
+ getter?: DDGetter<T>;
52
+ /** Handler for setter decorators */
53
+ setter?: DDSetter<T>;
54
+ /** Default handler for any decorator type not explicitly defined */
55
+ default?: (...args: any[]) => any;
56
+ }
57
+ /**
58
+ * Type for decorators that work with both Legacy and Modern decorator proposals
59
+ * Automatically infers the correct decorator type based on the description
60
+ */
61
+ type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {
62
+ method: DDMethod<T>;
63
+ } ? LegacyPropertyDecorator<T> & ModernMethodDecorator<T> : unknown) & (Description extends {
64
+ class: DDClass<new (...args: any[]) => T>;
65
+ } ? LegacyClassDecorator<new (...args: any[]) => T> & ModernClassDecorator<new (...args: any[]) => T> : unknown) & (Description extends {
66
+ getter: DDGetter<T>;
67
+ } ? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
68
+ setter: DDSetter<T>;
69
+ } ? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
70
+ default: infer Signature;
71
+ } ? Signature : unknown);
72
+ /**
73
+ * Factory type for creating decorators that work with both Legacy and Modern decorator proposals
74
+ */
75
+ type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(description: Description) => (Description extends {
76
+ method: DDMethod<T>;
77
+ } ? LegacyPropertyDecorator<T> & ModernMethodDecorator<T> : unknown) & (Description extends {
78
+ class: DDClass<new (...args: any[]) => T>;
79
+ } ? LegacyClassDecorator<new (...args: any[]) => T> & ModernClassDecorator<new (...args: any[]) => T> : unknown) & (Description extends {
80
+ getter: DDGetter<T>;
81
+ } ? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
82
+ setter: DDSetter<T>;
83
+ } ? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
84
+ default: infer Signature;
85
+ } ? Signature : unknown);
86
+ /**
87
+ * Creates a decorator that works with Legacy decorator proposals
88
+ * @param description - The decorator description object
89
+ * @returns A decorator function compatible with Legacy decorators
90
+ */
91
+ declare function legacyDecorator<T = any>(description: DecoratorDescription<T>): any;
92
+ /**
93
+ * Creates a decorator that works with Modern decorator proposals
94
+ * @param description - The decorator description object
95
+ * @returns A decorator function compatible with Modern decorators
96
+ */
97
+ declare function modernDecorator<T = any>(description: DecoratorDescription<T>): any;
98
+ /**
99
+ * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals
100
+ * @param description - The decorator description object
101
+ * @returns A decorator that works in both Legacy and Modern environments
102
+ */
103
+ declare const decorator: DecoratorFactory<any>;
104
+ /**
105
+ * Generic class decorator type that works with both Legacy and Modern decorator proposals
106
+ */
107
+ type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> & ModernClassDecorator<abstract new (...args: any[]) => T>;
108
+
109
+ /**
110
+ * Symbol for marking destructor methods
111
+ */
112
+ declare const destructor: unique symbol;
113
+ /**
114
+ * Symbol for accessing allocated values in destroyable objects
115
+ */
116
+ declare const allocatedValues: unique symbol;
117
+ /**
118
+ * Error thrown when attempting to access a destroyed object
119
+ */
120
+ declare class DestructionError extends Error {
121
+ static throw<_T = void>(msg: string): () => never;
122
+ constructor(msg: string);
123
+ }
124
+ declare abstract class AbstractDestroyable<Allocated> {
125
+ abstract [destructor](allocated: Allocated): void;
126
+ [Symbol.dispose](): void;
127
+ }
128
+ interface Destructor<Allocated> {
129
+ destructor(allocated: Allocated): void;
130
+ }
131
+ /**
132
+ * Creates a destroyable class with a base class and destructor object
133
+ * @param base - The base class to extend
134
+ * @param destructorObj - Object containing the destructor method
135
+ * @returns A destroyable class with static destroy and isDestroyable methods
136
+ */
137
+ declare function Destroyable<T extends new (...args: any[]) => any, Allocated extends Partial<InstanceType<T>>>(base: T, destructorObj: Destructor<Allocated>): (new (...args: ConstructorParameters<T>) => InstanceType<T> & {
138
+ [allocatedValues]: Allocated;
139
+ }) & {
140
+ destroy(obj: InstanceType<T>): boolean;
141
+ isDestroyable(obj: InstanceType<T>): boolean;
142
+ };
143
+ /**
144
+ * Creates a destroyable class with only a destructor object (no base class)
145
+ * @param destructorObj - Object containing the destructor method
146
+ * @returns A destroyable class with static destroy and isDestroyable methods
147
+ */
148
+ declare function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(destructorObj: Destructor<Allocated>): (new () => {
149
+ [allocatedValues]: Allocated;
150
+ }) & {
151
+ destroy(obj: any): boolean;
152
+ isDestroyable(obj: any): boolean;
153
+ };
154
+ /**
155
+ * Creates a destroyable class with a base class (requires [destructor] method)
156
+ * @param base - The base class to extend
157
+ * @returns A destroyable class with static destroy and isDestroyable methods
158
+ */
159
+ declare function Destroyable<T extends new (...args: any[]) => any, Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(base: T): (new (...args: ConstructorParameters<T>) => AbstractDestroyable<Allocated> & InstanceType<T> & {
160
+ [allocatedValues]: Allocated;
161
+ }) & {
162
+ destroy(obj: InstanceType<T>): boolean;
163
+ isDestroyable(obj: InstanceType<T>): boolean;
164
+ };
165
+ /**
166
+ * Creates an abstract destroyable base class
167
+ * @returns An abstract destroyable class with static destroy and isDestroyable methods
168
+ */
169
+ declare function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(): abstract new () => (AbstractDestroyable<Allocated> & {
170
+ [allocatedValues]: Allocated;
171
+ }) & {
172
+ destroy(obj: any): boolean;
173
+ isDestroyable(obj: any): boolean;
174
+ };
175
+ /**
176
+ * Decorator that marks properties to be stored in the allocated object and passed to the destructor
177
+ * Use with accessor properties or explicit get/set pairs
178
+ */
179
+ declare const allocated: LegacyPropertyDecorator<any> & ModernSetterDecorator<any> & ModernAccessorDecorator<any>;
180
+ /**
181
+ * Registers a callback to be called when an object is garbage collected
182
+ * @param cb - The callback function to execute on garbage collection
183
+ * @returns The object whose reference can be collected
184
+ */
185
+ declare function callOnGC(cb: () => void): () => void;
186
+ /**
187
+ * Context Manager Protocol for `using` statement integration
188
+ * Provides automatic resource cleanup when used with the `using` statement
189
+ */
190
+ interface ContextManager<T = any> {
191
+ [Symbol.dispose](): void;
192
+ value?: T;
193
+ }
194
+
195
+ /**
196
+ * Base type for event maps - all event handlers must be functions
197
+ */
198
+ type EventsBase = Record<string, (...args: any[]) => void>;
199
+ declare const events: unique symbol;
200
+ declare const hooks$1: unique symbol;
201
+ /**
202
+ * A type-safe event system that provides a clean API for event handling
203
+ * @template Events - The event map defining event names and their handler signatures
204
+ */
205
+ declare class Eventful<Events extends EventsBase> {
206
+ private readonly [events];
207
+ private readonly [hooks$1];
208
+ hook(cb: <EventType extends keyof Events>(event: EventType, ...args: Parameters<Events[EventType]>) => void): () => void;
209
+ on: ((events: Partial<Events>) => void) & (<EventType extends keyof Events>(event: EventType, cb: Events[EventType]) => () => void) & { [event in keyof Events]: (cb: Events[event]) => () => void; };
210
+ off: ((events: Partial<Events>) => void) & (<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]) => void) & { [event in keyof Events]: (cb?: Events[event]) => void; };
211
+ emit: (<EventType extends keyof Events>(event: EventType, ...args: Parameters<Events[EventType]>) => void) & Events;
212
+ }
213
+
214
+ /**
215
+ * Symbol for defining custom getter logic for numeric index access
216
+ */
217
+ declare const getAt: unique symbol;
218
+ /**
219
+ * Symbol for defining custom setter logic for numeric index access
220
+ */
221
+ declare const setAt: unique symbol;
222
+ interface IndexingAt<Items = any> {
223
+ [getAt](index: number): Items;
224
+ }
225
+ interface Accessor<T, Items> {
226
+ get(this: T, index: number): Items;
227
+ set?(this: T, index: number, value: Items): void;
228
+ getLength?(this: T): number;
229
+ setLength?(this: T, value: number): void;
230
+ }
231
+ declare abstract class AbstractGetAt<Items = any> {
232
+ abstract [getAt](index: number): Items;
233
+ }
234
+ /**
235
+ * Creates an indexable class with a base class and accessor object
236
+ * @param base - The base class to extend
237
+ * @param accessor - Object containing get/set methods for numeric index access
238
+ * @returns A class that supports numeric index access
239
+ */
240
+ declare function Indexable<Items, Base extends abstract new (...args: any[]) => any>(base: Base, accessor: Accessor<InstanceType<Base>, Items>): new (...args: ConstructorParameters<Base>) => InstanceType<Base> & {
241
+ [x: number]: Items;
242
+ };
243
+ /**
244
+ * Creates an indexable class with only an accessor object (no base class)
245
+ * @param accessor - Object containing get/set methods for numeric index access
246
+ * @returns A class that supports numeric index access
247
+ */
248
+ declare function Indexable<Items>(accessor: Accessor<any, Items>): new () => {
249
+ [x: number]: Items;
250
+ };
251
+ /**
252
+ * Creates an indexable class with a base class that has [getAt] method
253
+ * @param base - The base class that implements [getAt] method
254
+ * @returns A class that supports numeric index access using the base class's [getAt] method
255
+ */
256
+ declare function Indexable<Base extends new (...args: any[]) => IndexingAt>(base: Base): new (...args: ConstructorParameters<Base>) => InstanceType<Base> & {
257
+ [x: number]: AtReturnType<InstanceType<Base>>;
258
+ };
259
+ /**
260
+ * Creates an abstract indexable base class
261
+ * @returns An abstract class that supports numeric index access
262
+ */
263
+ declare function Indexable<Items>(): abstract new (...args: any[]) => AbstractGetAt & {
264
+ [x: number]: Items;
265
+ };
266
+ type AtReturnType<T> = T extends {
267
+ [getAt](index: number): infer R;
268
+ } ? R : never;
269
+ /**
270
+ * Symbol for accessing the forwarded array in ArrayReadForward
271
+ */
272
+ declare const forwardArray: unique symbol;
273
+ /**
274
+ * A read-only array forwarder that implements all reading/iterating methods of Array
275
+ * but does not implement modification methods.
276
+ *
277
+ * The constructor takes a callback that returns an array, and all methods forward
278
+ * their behavior to the result of that callback.
279
+ */
280
+ declare class ArrayReadForward<T> {
281
+ protected get [forwardArray](): readonly T[];
282
+ /**
283
+ * Get the length of the array
284
+ */
285
+ get length(): number;
286
+ /**
287
+ * Get an element at a specific index
288
+ */
289
+ [index: number]: T | undefined;
290
+ /**
291
+ * Iterator protocol support
292
+ */
293
+ [Symbol.iterator](): Iterator<T>;
294
+ /**
295
+ * Creates a new array with the results of calling a provided function on every element
296
+ */
297
+ map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
298
+ /**
299
+ * Creates a new array with all elements that pass the test implemented by the provided function
300
+ */
301
+ filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
302
+ filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];
303
+ /**
304
+ * Executes a reducer function on each element of the array, resulting in a single output value
305
+ */
306
+ reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
307
+ reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
308
+ reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
309
+ /**
310
+ * Executes a reducer function on each element of the array (right-to-left), resulting in a single output value
311
+ */
312
+ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
313
+ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
314
+ reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
315
+ /**
316
+ * Executes a provided function once for each array element
317
+ */
318
+ forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;
319
+ /**
320
+ * Returns the value of the first element in the array that satisfies the provided testing function
321
+ */
322
+ find<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
323
+ find(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
324
+ /**
325
+ * Returns the index of the first element in the array that satisfies the provided testing function
326
+ */
327
+ findIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
328
+ /**
329
+ * Returns the value of the last element in the array that satisfies the provided testing function
330
+ */
331
+ findLast<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
332
+ findLast(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
333
+ /**
334
+ * Returns the index of the last element in the array that satisfies the provided testing function
335
+ */
336
+ findLastIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
337
+ /**
338
+ * Determines whether an array includes a certain value among its entries
339
+ */
340
+ includes(searchElement: T, fromIndex?: number): boolean;
341
+ /**
342
+ * Returns the first index at which a given element can be found in the array
343
+ */
344
+ indexOf(searchElement: T, fromIndex?: number): number;
345
+ /**
346
+ * Returns the last index at which a given element can be found in the array
347
+ */
348
+ lastIndexOf(searchElement: T, fromIndex?: number): number;
349
+ /**
350
+ * Returns a shallow copy of a portion of an array into a new array object
351
+ */
352
+ slice(start?: number, end?: number): T[];
353
+ /**
354
+ * Returns a new array comprised of this array joined with other array(s) and/or value(s)
355
+ */
356
+ concat(...items: ConcatArray<T>[]): T[];
357
+ concat(...items: (T | ConcatArray<T>)[]): T[];
358
+ /**
359
+ * Tests whether all elements in the array pass the test implemented by the provided function
360
+ */
361
+ every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
362
+ /**
363
+ * Tests whether at least one element in the array passes the test implemented by the provided function
364
+ */
365
+ some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
366
+ /**
367
+ * Joins all elements of an array into a string
368
+ */
369
+ join(separator?: string): string;
370
+ /**
371
+ * Returns a new array iterator that contains the keys for each index in the array
372
+ */
373
+ keys(): IterableIterator<number>;
374
+ /**
375
+ * Returns a new array iterator that contains the values for each index in the array
376
+ */
377
+ values(): IterableIterator<T>;
378
+ /**
379
+ * Returns a new array iterator that contains the key/value pairs for each index in the array
380
+ */
381
+ entries(): IterableIterator<[number, T]>;
382
+ /**
383
+ * Returns a string representation of the array
384
+ */
385
+ toString(): string;
386
+ /**
387
+ * Returns a localized string representing the array
388
+ */
389
+ toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions): string;
390
+ /**
391
+ * Returns the element at the specified index, or undefined if the index is out of bounds
392
+ */
393
+ at(index: number): T | undefined;
394
+ /**
395
+ * Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth
396
+ */
397
+ flat(depth?: number): T[];
398
+ /**
399
+ * Returns a new array formed by applying a given callback function to each element of the array,
400
+ * and then flattening the result by one level
401
+ */
402
+ flatMap<U, This = undefined>(callback: (this: This, value: T, index: number, array: readonly T[]) => U | ReadonlyArray<U>, thisArg?: This): U[];
403
+ /**
404
+ * Returns a new array with elements in reversed order (ES2023)
405
+ */
406
+ toReversed(): T[];
407
+ /**
408
+ * Returns a new array with elements sorted (ES2023)
409
+ */
410
+ toSorted(compareFn?: ((a: T, b: T) => number) | undefined): T[];
411
+ /**
412
+ * Returns a new array with some elements removed and/or replaced at a given index (ES2023)
413
+ */
414
+ toSpliced(start: number, deleteCount?: number, ...items: T[]): T[];
415
+ /**
416
+ * Returns a new array with the element at the given index replaced with the given value (ES2023)
417
+ */
418
+ with(index: number, value: T): T[];
419
+ get [Symbol.unscopables](): {
420
+ readonly [x: number]: boolean;
421
+ readonly length?: boolean;
422
+ toString?: boolean;
423
+ toLocaleString?: boolean;
424
+ concat?: boolean;
425
+ join?: boolean;
426
+ slice?: boolean;
427
+ indexOf?: boolean;
428
+ lastIndexOf?: boolean;
429
+ every?: boolean;
430
+ some?: boolean;
431
+ forEach?: boolean;
432
+ map?: boolean;
433
+ filter?: boolean;
434
+ reduce?: boolean;
435
+ reduceRight?: boolean;
436
+ find?: boolean;
437
+ findIndex?: boolean;
438
+ entries?: boolean;
439
+ keys?: boolean;
440
+ values?: boolean;
441
+ includes?: boolean;
442
+ flatMap?: boolean;
443
+ flat?: boolean;
444
+ at?: boolean;
445
+ findLast?: boolean;
446
+ findLastIndex?: boolean;
447
+ toReversed?: boolean;
448
+ toSorted?: boolean;
449
+ toSpliced?: boolean;
450
+ with?: boolean;
451
+ [Symbol.iterator]?: boolean;
452
+ readonly [Symbol.unscopables]?: boolean;
453
+ };
454
+ }
455
+
456
+ /**
457
+ * Uses weak references but still may iterate through them
458
+ * Note: The behavior is highly dependant on the garbage collector - some entries are perhaps deemed to be collected: don't resuscitate them
459
+ */
460
+ declare class IterableWeakMap<K extends WeakKey, V> implements Map<K, V> {
461
+ private uuids;
462
+ private refs;
463
+ private readonly registry;
464
+ constructor(entries?: Iterable<[K, V]>);
465
+ private createIterator;
466
+ clear(): void;
467
+ delete(key: K): boolean;
468
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
469
+ get(key: K): V | undefined;
470
+ has(key: K): boolean;
471
+ set(key: K, value: V): this;
472
+ get size(): number;
473
+ entries(): MapIterator<[K, V]>;
474
+ keys(): MapIterator<K>;
475
+ values(): MapIterator<V>;
476
+ [Symbol.iterator](): MapIterator<[K, V]>;
477
+ readonly [Symbol.toStringTag]: string;
478
+ }
479
+ /**
480
+ * Uses weak references but still may iterate through them
481
+ * Note: The behavior is highly dependant on the garbage collector - some entries are perhaps deemed to be collected: don't resuscitate them
482
+ */
483
+ declare class IterableWeakSet<K extends WeakKey> implements Set<K> {
484
+ private uuids;
485
+ private refs;
486
+ private readonly registry;
487
+ constructor(entries?: Iterable<K>);
488
+ private createIterator;
489
+ clear(): void;
490
+ add(value: K): this;
491
+ delete(value: K): boolean;
492
+ forEach(callbackfn: (value: K, value2: K, set: Set<K>) => void, thisArg?: any): void;
493
+ has(value: K): boolean;
494
+ get size(): number;
495
+ entries(): SetIterator<[K, K]>;
496
+ keys(): SetIterator<K>;
497
+ values(): SetIterator<K>;
498
+ [Symbol.iterator](): SetIterator<K>;
499
+ readonly [Symbol.toStringTag]: string;
500
+ union<U>(other: ReadonlySetLike<U>): Set<K | U>;
501
+ intersection<U>(other: ReadonlySetLike<U>): Set<K & U>;
502
+ difference<U>(other: ReadonlySetLike<U>): Set<K>;
503
+ symmetricDifference<U>(other: ReadonlySetLike<U>): Set<K | U>;
504
+ isSubsetOf(other: ReadonlySetLike<unknown>): boolean;
505
+ isSupersetOf(other: ReadonlySetLike<unknown>): boolean;
506
+ isDisjointFrom(other: ReadonlySetLike<unknown>): boolean;
507
+ }
508
+
509
+ /**
510
+ * A mixin function that takes a base class and returns a new class with mixed-in functionality
511
+ * @template Mixed - The functionality to be mixed in
512
+ */
513
+ type MixinFunction<Mixed> = <Base>(base: new (...args: any[]) => Base) => new (...args: any[]) => Base & Mixed;
514
+ /**
515
+ * A mixin class that can be used both as a base class and as a mixin function
516
+ * @template Mixed - The functionality to be mixed in
517
+ */
518
+ type MixinClass<Mixed> = new (...args: any[]) => Mixed;
519
+ /**
520
+ * Creates a mixin that can be used both as a class (extends) and as a function (mixin)
521
+ *
522
+ * This function supports:
523
+ * - Using mixins as base classes: `class MyClass extends MyMixin`
524
+ * - Using mixins as functions: `class MyClass extends MyMixin(SomeBase)`
525
+ * - Composing mixins: `const Composed = MixinA(MixinB)`
526
+ * - Type-safe property inference for all patterns
527
+ *
528
+ * @param mixinFunction - The function that creates the mixin
529
+ * @param unwrapFunction - Optional function to unwrap reactive objects for method calls
530
+ * @returns A mixin that can be used both as a class and as a function
531
+ */
532
+ declare function mixin<MixinFn extends (base: any) => new (...args: any[]) => any>(mixinFunction: MixinFn, unwrapFunction?: (obj: any) => any): (new (...args: any[]) => InstanceType<ReturnType<MixinFn>>) & (<Base>(base: abstract new (...args: any[]) => Base) => new (...args: any[]) => InstanceType<ReturnType<MixinFn>> & Base);
533
+
534
+ type Resolved<T> = T extends Promise<infer U> ? Resolved<U> : T extends (...args: infer Args) => infer R ? (...args: Args) => Resolved<R> : T extends object ? {
535
+ [k in keyof T]: k extends 'then' | 'catch' | 'finally' ? T[k] : Resolved<T[k]>;
536
+ } : T;
537
+ type PromiseAnd<T> = Resolved<T> & Promise<Resolved<T>>;
538
+ /**
539
+ * Type that transforms promises into chainable objects
540
+ * Allows calling methods directly on promise results without awaiting them first
541
+ */
542
+ type PromiseChain<T> = T extends (...args: infer Args) => infer R ? PromiseAnd<(...args: Args) => PromiseChain<Resolved<R>>> : T extends object ? PromiseAnd<{
543
+ [k in keyof T]: k extends 'then' | 'catch' | 'finally' ? T[k] : PromiseChain<Resolved<T[k]>>;
544
+ }> : Promise<Resolved<T>>;
545
+ /**
546
+ * Transforms a promise or value into a chainable object
547
+ * Allows calling methods directly on promise results without awaiting them first
548
+ * @param given - The promise or value to make chainable
549
+ * @returns A chainable version of the input
550
+ */
551
+ declare function chainPromise<T>(given: Promise<T> | T): PromiseChain<T>;
552
+
553
+ /**
554
+ * Reactively attends to each entry of a collection or each key yielded by an
555
+ * enumeration callback. For each key, an inner effect runs the callback. When a
556
+ * key disappears, its inner effect is disposed. The callback may return a cleanup
557
+ * (like a regular effect closer).
558
+ *
559
+ * Accepts arrays, records, Maps, Sets, or a raw `() => Iterable<Key>` callback.
560
+ *
561
+ * @example
562
+ * ```typescript
563
+ * // Record shorthand
564
+ * attend(record, (key) => { console.log(key, record[key]) })
565
+ *
566
+ * // Array shorthand
567
+ * attend(array, (index) => { console.log(index, array[index]) })
568
+ *
569
+ * // Raw enumeration callback
570
+ * attend(() => Object.keys(record), (key) => { ... })
571
+ * ```
572
+ */
573
+ declare function attend<T>(source: readonly T[], callback: (index: number) => EffectCloser | void): ScopedCallback;
574
+ declare function attend<K, V>(source: Map<K, V>, callback: (key: K) => EffectCloser | void): ScopedCallback;
575
+ declare function attend<T>(source: Set<T>, callback: (value: T) => EffectCloser | void): ScopedCallback;
576
+ declare function attend<S extends Record<PropertyKey, any>>(source: S, callback: (key: keyof S & string) => EffectCloser | void): ScopedCallback;
577
+ declare function attend<Key>(enumerate: () => Iterable<Key>, callback: (key: Key) => EffectCloser | void): ScopedCallback;
578
+ /**
579
+ * Result of a reactive scan, which is a reactive array of accumulated values
580
+ * with an attached cleanup function.
581
+ */
582
+ type ScanResult<Output> = readonly Output[] & {
583
+ [cleanup]: ScopedCallback;
584
+ };
585
+ /**
586
+ * Perform a reactive scan over an array of items.
587
+ *
588
+ * This implementation is highly optimized for performance and fine-grained reactivity:
589
+ * - **Incremental Updates**: Changes to an item only trigger re-computation from that
590
+ * point onwards in the result chain.
591
+ * - **Move Optimization**: If items are moved within the array, their accumulated
592
+ * values are reused as long as their predecessor remains the same.
593
+ * - **Duplicate Support**: Correctly handles multiple occurrences of the same object
594
+ * instance using an internal occurrence tracking mechanism.
595
+ * - **Memory Efficient**: Uses `WeakMap` for caching intermediates, which are
596
+ * automatically cleared when source items are garbage collected.
597
+ *
598
+ * @example
599
+ * ```typescript
600
+ * const source = reactive([{ val: 1 }, { val: 2 }, { val: 3 }])
601
+ * const sum = scan(source, (acc, item) => acc + item.val, 0)
602
+ *
603
+ * expect([...sum]).toEqual([1, 3, 6])
604
+ *
605
+ * // Modifying an item only re-computes subsequent sums
606
+ * source[1].val = 10
607
+ * expect([...sum]).toEqual([1, 11, 14])
608
+ * ```
609
+ *
610
+ * @param source The source array of objects (will be made reactive)
611
+ * @param callback The accumulator function called with (accumulator, currentItem)
612
+ * @param initialValue The starting value for the accumulation
613
+ * @returns A reactive array of accumulated values, with a [cleanup] property to stop the tracking
614
+ */
615
+ declare function scan<Input extends object, Output>(source: readonly Input[], callback: (acc: Output, val: Input) => Output, initialValue: Output): ScanResult<Output>;
616
+ /**
617
+ * Lifts a callback that returns an array into a reactive array that automatically
618
+ * synchronizes with the source array returned by the callback.
619
+ *
620
+ * The returned reactive array will update whenever the callback's dependencies change,
621
+ * efficiently syncing only the elements that differ from the previous result.
622
+ *
623
+ * @example
624
+ * ```typescript
625
+ * const items = reactive([1, 2, 3])
626
+ * const doubled = lift(() => items.map(x => x * 2))
627
+ *
628
+ * console.log([...doubled]) // [2, 4, 6]
629
+ *
630
+ * items.push(4)
631
+ * console.log([...doubled]) // [2, 4, 6, 8]
632
+ * ```
633
+ *
634
+ * @param cb Callback function that returns an array
635
+ * @returns A reactive array synchronized with the callback's result, with a [cleanup] property to stop tracking
636
+ */
637
+ declare function lift<Output extends any[]>(cb: (access: EffectAccess) => Output): Output & {
638
+ [cleanup]: ScopedCallback;
639
+ };
640
+ /**
641
+ * Lifts a callback that returns an object into a reactive object that automatically
642
+ * synchronizes with the source object returned by the callback.
643
+ *
644
+ * The returned reactive object will update whenever the callback's dependencies change,
645
+ * efficiently syncing only the properties that differ from the previous result using
646
+ * Object.assign(). Properties that no longer exist in the source are automatically removed.
647
+ *
648
+ * @example
649
+ * ```typescript
650
+ * const user = reactive({ name: 'John', age: 30 })
651
+ * const profile = lift(() => ({
652
+ * displayName: user.name.toUpperCase(),
653
+ * isAdult: user.age >= 18,
654
+ * description: `${user.name} is ${user.age} years old`
655
+ * }))
656
+ *
657
+ * console.log(profile.displayName) // JOHN
658
+ * console.log(profile.isAdult) // true
659
+ *
660
+ * user.name = 'Jane'
661
+ * console.log(profile.displayName) // JANE
662
+ * console.log(profile.description) // Jane is 30 years old
663
+ * ```
664
+ *
665
+ * @param cb Callback function that returns an object
666
+ * @returns A reactive object synchronized with the callback's result, with a [cleanup] property to stop tracking
667
+ */
668
+ declare function lift<Output extends object>(cb: (access: EffectAccess) => Output): Output & {
669
+ [cleanup]: ScopedCallback;
670
+ };
671
+
672
+ /**
673
+ * Gets the current state of a reactive object for evolution tracking
674
+ * @param obj - The reactive object
675
+ * @returns The current state object
676
+ */
677
+ declare function getState(obj: any): State;
678
+ /**
679
+ * Triggers effects for a single property change
680
+ * @param obj - The object that changed
681
+ * @param evolution - The type of change
682
+ * @param prop - The property that changed
683
+ */
684
+ declare function touched1(obj: any, evolution: Evolution, prop: any): void;
685
+ /**
686
+ * Triggers effects for property changes
687
+ * @param obj - The object that changed
688
+ * @param evolution - The type of change
689
+ * @param props - The properties that changed
690
+ */
691
+ declare function touched(obj: any, evolution: Evolution, props?: Iterable<any>): void;
692
+
693
+ /**
694
+ * Deep watch an object and all its nested properties
695
+ * @param target - The object to watch deeply
696
+ * @param callback - The callback to call when any nested property changes
697
+ * @param options - Options for the deep watch
698
+ * @returns A cleanup function to stop watching
699
+ */
700
+ /**
701
+ * Sets up deep watching for an object, tracking all nested property changes
702
+ * @param target - The object to watch
703
+ * @param callback - The callback to call when changes occur
704
+ * @param options - Options for deep watching
705
+ * @returns A cleanup function to stop deep watching
706
+ */
707
+ declare function deepWatch<T extends object>(target: T, callback: (value: T) => void, { immediate }?: {
708
+ immediate?: boolean;
709
+ }): EffectCleanup | undefined;
710
+
711
+ /**
712
+ * Aggregator for zones that need to be tracked along effects.
713
+ * ie. in each effect, the active zone of the given zoning will be the one active at effect's definition
714
+ */
715
+ declare const effectAggregator: ZoneAggregator;
716
+ declare function getActiveEffect(): ScopedCallback;
717
+ /**
718
+ * ADD a cleanup function to an object using the cleanup symbol.
719
+ * The cleanup function will be called when the object needs to be disposed.
720
+ *
721
+ * Note: most of the time, you don't need to use this function directly.
722
+ * The main use if for the cleanup function to be stored with the object, as GC calls the cleanup function when the *function* is garbage collected.
723
+ *
724
+ * @param obj - The object to attach the cleanup function to
725
+ * @param cleanupFn - The cleanup function to attach
726
+ * @returns The object with the cleanup function attached
727
+ */
728
+ declare function cleanedBy<T extends object>(obj: T, cleanupFn: ScopedCallback): T & {
729
+ [cleanup]: ScopedCallback;
730
+ };
731
+ /**
732
+ * Creates a derived value that automatically recomputes when dependencies change
733
+ * @param compute - Function that computes the derived value
734
+ * @returns Object with value and cleanup function
735
+ */
736
+ declare function derived<T>(compute: (dep: EffectAccess) => T): {
737
+ value: T;
738
+ [cleanup]: ScopedCallback;
739
+ };
740
+
741
+ type EffectTracking = (obj: any, evolution: Evolution, prop: any, effect: EffectTrigger) => void;
742
+ interface ActivationRecord {
743
+ effect: EffectTrigger;
744
+ obj: any;
745
+ evolution: Evolution;
746
+ prop: any;
747
+ batchId: number;
748
+ }
749
+ /**
750
+ * Returns the activation log containing recent effect activations for debugging.
751
+ * The log is a circular buffer of the last 100 activations.
752
+ *
753
+ * @returns Array of activation records
754
+ */
755
+ declare function getActivationLog(): Omit<ActivationRecord, "batchId">[];
756
+ /**
757
+ * Registers a debug callback that is called when the current effect is triggered by a dependency change
758
+ *
759
+ * This function is useful for debugging purposes as it pin-points exactly which reactive property
760
+ * change triggered the effect. The callback receives information about:
761
+ * - The object that changed
762
+ * - The type of change (evolution)
763
+ * - The specific property that changed
764
+ *
765
+ * **Note:** The tracker callback is automatically removed after being called once. If you need
766
+ * to track multiple triggers, call `onEffectTrigger` again within the effect.
767
+ *
768
+ * @param onTouch - Callback function that receives (obj, evolution, prop) when the effect is triggered
769
+ * @throws {Error} If called outside of an effect context
770
+ *
771
+ * @example
772
+ * ```typescript
773
+ * const state = reactive({ count: 0, name: 'John' })
774
+ *
775
+ * effect(() => {
776
+ * // Register a tracker to see what triggers this effect
777
+ * onEffectTrigger((obj, evolution, prop) => {
778
+ * console.log(`Effect triggered by:`, {
779
+ * object: obj,
780
+ * change: evolution.type,
781
+ * property: prop
782
+ * })
783
+ * })
784
+ *
785
+ * // Access reactive properties
786
+ * console.log(state.count, state.name)
787
+ * })
788
+ *
789
+ * state.count = 5
790
+ * ```
791
+ */
792
+ declare function onEffectTrigger(onTouch: EffectTracking, effect?: EffectTrigger): void;
793
+ declare function onEffectThrow(onThrow: CatchFunction, effect?: EffectTrigger): void;
794
+ /**
795
+ * Adds a cleanup function to be called when the current batch of effects completes
796
+ * @param cleanup - The cleanup function to add
797
+ */
798
+ declare function addBatchCleanup(cleanup: EffectCleanup): void;
799
+ /**
800
+ * Semantic alias for `addBatchCleanup` - defers work to the end of the current reactive batch.
801
+ *
802
+ * Use this when an effect needs to perform an action that would modify state the effect depends on,
803
+ * which would create a reactive cycle. The deferred callback runs after all effects complete.
804
+ *
805
+ * @param callback - The callback to defer until after the current batch completes
806
+ *
807
+ * @example
808
+ * ```typescript
809
+ * effect(() => {
810
+ * processData()
811
+ *
812
+ * // Defer to avoid cycle (createMovement modifies state this effect reads)
813
+ * defer(() => {
814
+ * createMovement(data)
815
+ * })
816
+ * })
817
+ * ```
818
+ */
819
+ declare const defer: typeof addBatchCleanup;
820
+ /**
821
+ * Resets the reactive system to a consistent state.
822
+ * Call this after an unrecoverable error has set the system to "broken".
823
+ * This clears all batch state, effect dependency graphs, and watcher registrations.
824
+ * All existing effects become orphaned and must be recreated.
825
+ */
826
+ declare function reset(): void;
827
+
828
+ /**
829
+ * Decorator that makes methods atomic - batches all effects triggered within the method
830
+ */
831
+ declare const atomic: LegacyPropertyDecorator<any> & ModernMethodDecorator<any> & (<Args extends any[], Return>(original: (...args: Args) => Return) => (...args: Args) => Return);
832
+ /**
833
+ * @param fn - The effect function to run - provides the cleaner
834
+ * @returns The cleanup function
835
+ */
836
+ /**
837
+ * Creates a reactive effect that automatically re-runs when dependencies change
838
+ * @param fn - The effect function that provides dependencies and may return a cleanup function or Promise
839
+ * @param options - Options for effect execution
840
+ * @returns A cleanup function to stop the effect
841
+ */
842
+ declare const effect: ((fn: (access: EffectAccess) => EffectCloser | undefined | void | Promise<any>, effectOptions?: EffectOptions) => EffectCleanup) & {
843
+ readonly opaque: any;
844
+ named(name: string): any;
845
+ };
846
+ /**
847
+ * Executes a function without tracking dependencies but maintains parent cleanup relationship
848
+ * Effects created inside will still be cleaned up when the parent effect is destroyed
849
+ * @param fn - The function to execute
850
+ */
851
+ declare function untracked<T>(fn: () => T): T;
852
+ /**
853
+ * Executes a function from a virgin/root context - no parent effect, no tracking
854
+ * Creates completely independent effects that won't be cleaned up by any parent
855
+ * @param fn - The function to execute
856
+ */
857
+ declare function root<T>(fn: () => T): T;
858
+ /**
859
+ * Creates a bidirectional binding between a reactive value and a non-reactive external value
860
+ * Prevents infinite loops by automatically suppressing circular notifications
861
+ *
862
+ * @param received - Function called when the reactive value changes (external setter)
863
+ * @param get - Getter for the reactive value OR an object with `{ get, set }` properties
864
+ * @param set - Setter for the reactive value (required if `get` is a function)
865
+ * @returns A function to manually provide updates from the external side
866
+ *
867
+ * @example
868
+ * ```typescript
869
+ * const model = reactive({ value: '' })
870
+ * const input = { value: '' }
871
+ *
872
+ * // Bidirectional binding
873
+ * const provide = biDi(
874
+ * (v) => input.value = v, // external setter
875
+ * () => model.value, // reactive getter
876
+ * (v) => model.value = v // reactive setter
877
+ * )
878
+ *
879
+ * // External notification (e.g., from input event)
880
+ * provide('new value') // Updates model.value, doesn't trigger circular loop
881
+ * ```
882
+ *
883
+ * @example Using object syntax
884
+ * ```typescript
885
+ * const provide = biDi(
886
+ * (v) => setHTMLValue(v),
887
+ * { get: () => reactiveObj.value, set: (v) => reactiveObj.value = v }
888
+ * )
889
+ * ```
890
+ */
891
+ declare function biDi<T>(received: (value: T) => void, value: {
892
+ get: () => T;
893
+ set: (value: T) => void;
894
+ }): (value: T) => void;
895
+ declare function biDi<T>(received: (value: T) => void, get: () => T, set: (value: T) => void): (value: T) => void;
896
+
897
+ type Memoizable = object | any[] | symbol | ((...args: any[]) => any);
898
+ declare function memoizeFunction<Result, Args extends Memoizable[]>(fn: (...args: Args) => Result): (...args: Args) => Result;
899
+ /**
900
+ * Decorator and function wrapper for memoizing computed values based on reactive dependencies.
901
+ *
902
+ * When used as a decorator on getters or methods, it caches the result and automatically
903
+ * invalidates the cache when reactive dependencies change.
904
+ *
905
+ * When used as a function wrapper, it memoizes based on object arguments (WeakMap-based cache).
906
+ *
907
+ * @example
908
+ * ```typescript
909
+ * class User {
910
+ * @memoize
911
+ * get fullName() {
912
+ * return `${this.firstName} ${this.lastName}`
913
+ * }
914
+ * }
915
+ *
916
+ * // Or as a function wrapper
917
+ * const expensive = memoize((obj: SomeObject) => {
918
+ * return heavyComputation(obj)
919
+ * })
920
+ * ```
921
+ */
922
+ declare const memoize: LegacyPropertyDecorator<any> & ModernMethodDecorator<any> & ModernGetterDecorator<any> & ModernAccessorDecorator<any> & typeof memoizeFunction;
923
+
924
+ declare const immutables: Set<(tested: any) => boolean>;
925
+ declare function isNonReactive(obj: any): boolean;
926
+ declare function registerNativeReactivity(originalClass: new (...args: any[]) => any, reactiveClass: new (...args: any[]) => any): void;
927
+
928
+ type KeyFunction<T, K extends PropertyKey> = (item: T) => K;
929
+ /**
930
+ * Events emitted by the Register for CRUD operations
931
+ */
932
+ interface RegisterEvents<T, K extends PropertyKey> {
933
+ /**
934
+ * Emitted when a new item is added to the register
935
+ */
936
+ add: (item: T, key: K, index: number) => void;
937
+ /**
938
+ * Emitted when an item is removed from the register
939
+ */
940
+ delete: (item: T, key: K, index: number) => void;
941
+ /**
942
+ * Emitted when an item's value is updated (same key, new value)
943
+ */
944
+ update: (oldItem: T, newItem: T, key: K, index: number) => void;
945
+ /**
946
+ * Emitted when an item's key changes (rekey operation)
947
+ */
948
+ rekey: (item: T, oldKey: K, newKey: K, index: number) => void;
949
+ /**
950
+ * Index signature for EventsBase compatibility
951
+ */
952
+ [key: string]: (...args: any[]) => void;
953
+ }
954
+ interface RegisterInstance<T> extends ArrayReadForward<T> {
955
+ [index: number]: T;
956
+ }
957
+ declare const RegisterClass_base: new () => ArrayReadForward<any> & {
958
+ [x: number]: any;
959
+ toArray(): any[];
960
+ };
961
+ declare class RegisterClass<T, K extends PropertyKey = PropertyKey> extends RegisterClass_base implements RegisterInstance<T> {
962
+ #private;
963
+ protected get [forwardArray](): readonly T[];
964
+ /**
965
+ * Register event listeners for CRUD operations
966
+ */
967
+ on(events: Partial<RegisterEvents<T, K>>): void;
968
+ on<EventType extends keyof RegisterEvents<T, K>>(event: EventType, cb: RegisterEvents<T, K>[EventType]): () => void;
969
+ /**
970
+ * Remove event listeners
971
+ */
972
+ off(events: Partial<RegisterEvents<T, K>>): void;
973
+ off<EventType extends keyof RegisterEvents<T, K>>(event: EventType, cb?: RegisterEvents<T, K>[EventType]): void;
974
+ /**
975
+ * Register a global hook that receives all events
976
+ */
977
+ hook(cb: <EventType extends keyof RegisterEvents<T, K>>(event: EventType, ...args: Parameters<RegisterEvents<T, K>[EventType]>) => void): () => void;
978
+ constructor(keyFn: KeyFunction<T, K>, initial?: Iterable<T>);
979
+ private ensureKey;
980
+ private assertValidKey;
981
+ private setKeyValue;
982
+ private cleanupValue;
983
+ private disposeKeyEffects;
984
+ private incrementUsage;
985
+ private decrementUsage;
986
+ private normalizeIndex;
987
+ private assignAt;
988
+ private insertKeyValue;
989
+ private rebuildFrom;
990
+ get length(): number;
991
+ [getAt](index: number): T | undefined;
992
+ [setAt](index: number, value: T): void;
993
+ push(...items: T[]): number;
994
+ pop(): T | undefined;
995
+ shift(): T | undefined;
996
+ unshift(...items: T[]): number;
997
+ splice(start: number, deleteCount?: number, ...items: T[]): T[];
998
+ clear(): void;
999
+ get(key: K): T | undefined;
1000
+ set(key: K, value: T): void;
1001
+ remove(key: K): void;
1002
+ removeAt(index: number): T | undefined;
1003
+ /**
1004
+ * Keep only the items for which the predicate returns true.
1005
+ * Items for which the predicate returns false are removed.
1006
+ *
1007
+ * The predicate is evaluated once per distinct key; duplicate keys
1008
+ * will follow the same keep/remove decision.
1009
+ */
1010
+ keep(predicate: (value: T) => boolean): void;
1011
+ hasKey(key: K): boolean;
1012
+ indexOfKey(key: K): number;
1013
+ mapKeys(): IterableIterator<K>;
1014
+ update(...values: T[]): void;
1015
+ upsert(insert: (value: T) => void, ...values: T[]): void;
1016
+ entries(): IterableIterator<[number, T]>;
1017
+ [Symbol.iterator](): IterableIterator<T>;
1018
+ toString(): string;
1019
+ at(index: number): T | undefined;
1020
+ reverse(): this;
1021
+ sort(compareFn?: ((a: T, b: T) => number) | undefined): this;
1022
+ fill(value: T, start?: number, end?: number): this;
1023
+ copyWithin(target: number, start: number, end?: number): this;
1024
+ }
1025
+ type Register<T, K extends PropertyKey = PropertyKey> = RegisterClass<T, K> & T[];
1026
+ declare const Register: new <T, K extends PropertyKey = PropertyKey>(keyFn: KeyFunction<T, K>, initial?: Iterable<T>) => Register<T, K>;
1027
+ /**
1028
+ * Creates a reactive Register - an ordered, array-like collection with stable key-based identity.
1029
+ *
1030
+ * Register combines array semantics (indexable access, ordering, iteration) with Map-like
1031
+ * key-based lookups. Items with the same key share the same value instance, making it ideal
1032
+ * for UI lists keyed by IDs or when you need to preserve identity across reorders.
1033
+ *
1034
+ * @param keyFn - Function that extracts the key from each item
1035
+ * @param initial - Optional initial items to populate the register
1036
+ * @returns A reactive Register instance
1037
+ *
1038
+ * @example
1039
+ * ```typescript
1040
+ * const users = register(
1041
+ * (user: User) => user.id,
1042
+ * [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]
1043
+ * )
1044
+ *
1045
+ * users.push({ id: 3, name: 'Charlie' })
1046
+ * const bob = users.get(2) // Get by key
1047
+ * ```
1048
+ */
1049
+ declare function register<T, K extends PropertyKey = PropertyKey>(keyFn: KeyFunction<T, K>, initial?: Iterable<T>): Register<T, K>;
1050
+
1051
+ /**
1052
+ * Returns the projection context of the currently running effect, if any.
1053
+ */
1054
+ declare function getActiveProjection(): ProjectionContext | undefined;
1055
+ type ProjectOldValue<Target> = Target extends readonly (infer Item)[] ? Item : Target extends Map<any, infer Item> ? Item : Target extends Record<PropertyKey, infer Item> ? Item : unknown;
1056
+ type ProjectAccess<SourceValue, Key, SourceType, Target> = {
1057
+ readonly key: Key;
1058
+ get(): SourceValue;
1059
+ set(value: SourceValue): boolean;
1060
+ readonly source: SourceType;
1061
+ readonly old?: ProjectOldValue<Target>;
1062
+ value: SourceValue;
1063
+ };
1064
+ type ProjectCallback<SourceValue, Key, Target extends object, SourceType, Result> = (access: ProjectAccess<SourceValue, Key, SourceType, Target>, target: Target) => Result;
1065
+ type ProjectResult<Target extends object> = Target & {
1066
+ [cleanup]: ScopedCallback;
1067
+ };
1068
+ declare function projectArray<SourceValue, ResultValue>(source: readonly SourceValue[], apply: ProjectCallback<SourceValue, number, ResultValue[], readonly SourceValue[], ResultValue>): ProjectResult<ResultValue[]>;
1069
+ declare function projectRegister<Key extends PropertyKey, SourceValue, ResultValue>(source: Register<SourceValue, Key>, apply: ProjectCallback<SourceValue, Key, Map<Key, ResultValue>, Register<SourceValue, Key>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
1070
+ declare function projectRecord<Source extends Record<PropertyKey, any>, ResultValue>(source: Source, apply: ProjectCallback<Source[keyof Source], keyof Source, Record<keyof Source, ResultValue>, Source, ResultValue>): ProjectResult<Record<keyof Source, ResultValue>>;
1071
+ declare function projectMap<Key, Value, ResultValue>(source: Map<Key, Value>, apply: ProjectCallback<Value, Key, Map<Key, ResultValue>, Map<Key, Value>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
1072
+ type ProjectOverload = {
1073
+ <SourceValue, ResultValue>(source: readonly SourceValue[], apply: ProjectCallback<SourceValue, number, ResultValue[], readonly SourceValue[], ResultValue>): ProjectResult<ResultValue[]>;
1074
+ <Key extends PropertyKey, SourceValue, ResultValue>(source: Register<SourceValue, Key>, apply: ProjectCallback<SourceValue, Key, Map<Key, ResultValue>, Register<SourceValue, Key>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
1075
+ <Source extends Record<PropertyKey, any>, ResultValue>(source: Source, apply: ProjectCallback<Source[keyof Source], keyof Source, Record<keyof Source, ResultValue>, Source, ResultValue>): ProjectResult<Record<keyof Source, ResultValue>>;
1076
+ <Key, Value, ResultValue>(source: Map<Key, Value>, apply: ProjectCallback<Value, Key, Map<Key, ResultValue>, Map<Key, Value>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
1077
+ array: typeof projectArray;
1078
+ register: typeof projectRegister;
1079
+ record: typeof projectRecord;
1080
+ map: typeof projectMap;
1081
+ };
1082
+ declare const project: ProjectOverload;
1083
+
1084
+ declare function unwrap<T>(obj: T): T;
1085
+ declare function isReactive(obj: any): boolean;
1086
+
1087
+ /**
1088
+ * Base mixin for reactive classes that provides proper constructor reactivity
1089
+ * Solves constructor reactivity issues in complex inheritance trees
1090
+ */
1091
+ declare const ReactiveBase: (new (...args: any[]) => {
1092
+ [x: string]: any;
1093
+ }) & (<Base>(base: abstract new (...args: any[]) => Base) => new (...args: any[]) => {
1094
+ [x: string]: any;
1095
+ } & Base);
1096
+ declare function reactiveObject<T>(anyTarget: T): T;
1097
+ /**
1098
+ * Main decorator for making classes reactive
1099
+ * Automatically makes class instances reactive when created
1100
+ */
1101
+ declare const reactive: LegacyClassDecorator<new (...args: any[]) => any> & ModernClassDecorator<new (...args: any[]) => any> & typeof reactiveObject;
1102
+
1103
+ /**
1104
+ * Provides type-safe access to a source object's property within the organized callback.
1105
+ * @template Source - The type of the source object
1106
+ * @template Key - The type of the property key in the source object
1107
+ */
1108
+ type OrganizedAccess<Source extends Record<PropertyKey, any>, Key extends keyof Source> = {
1109
+ /** The property key being accessed */
1110
+ readonly key: Key;
1111
+ /**
1112
+ * Gets the current value of the property from the source object
1113
+ * @returns The current value of the property
1114
+ */
1115
+ get(): Source[Key];
1116
+ /**
1117
+ * Updates the property value in the source object
1118
+ * @param value - The new value to set
1119
+ * @returns {boolean} True if the update was successful
1120
+ */
1121
+ set(value: Source[Key]): boolean;
1122
+ /**
1123
+ * The current value of the property (equivalent to using get()/set() directly)
1124
+ */
1125
+ value: Source[Key];
1126
+ };
1127
+ /**
1128
+ * Callback function type for the organized function that processes each source property.
1129
+ * @template Source - The type of the source object
1130
+ * @template Target - The type of the target object
1131
+ */
1132
+ type OrganizedCallback<Source extends Record<PropertyKey, any>, Target extends object> = <Key extends keyof Source>(
1133
+ /**
1134
+ * Accessor object for the current source property
1135
+ */
1136
+ access: OrganizedAccess<Source, Key>,
1137
+ /**
1138
+ * The target object where organized data will be stored
1139
+ */
1140
+ target: Target) => EffectCloser | undefined;
1141
+ /**
1142
+ * The result type of the organized function, combining the target object with cleanup capability.
1143
+ * @template Target - The type of the target object
1144
+ */
1145
+ type OrganizedResult<Target extends object> = Target & {
1146
+ /**
1147
+ * Cleanup function to dispose of all reactive bindings created by organized().
1148
+ * This is automatically called when the effect that created the organized binding is disposed.
1149
+ */
1150
+ [cleanup]: ScopedCallback;
1151
+ };
1152
+ /**
1153
+ * Organizes a source object's properties into a target object using a callback function.
1154
+ * This creates a reactive mapping between source properties and a target object,
1155
+ * automatically handling property additions, updates, and removals.
1156
+ *
1157
+ * @template Source - The type of the source object
1158
+ * @template Target - The type of the target object (defaults to Record<PropertyKey, any>)
1159
+ *
1160
+ * @param {Source} source - The source object to organize
1161
+ * @param {OrganizedCallback<Source, Target>} apply - Callback function that defines how each source property is mapped to the target
1162
+ * @param {Target} [baseTarget={}] - Optional base target object to use (will be made reactive if not already)
1163
+ *
1164
+ * @returns {OrganizedResult<Target>} The target object with cleanup capability
1165
+ *
1166
+ * @example
1167
+ * // Organize user permissions into role-based access
1168
+ * const user = reactive({ isAdmin: true, canEdit: false });
1169
+ * const permissions = organized(
1170
+ * user,
1171
+ * (access, target) => {
1172
+ * if (access.key === 'isAdmin') {
1173
+ * target.hasFullAccess = access.value;
1174
+ * }
1175
+ * target[`can${access.key.charAt(0).toUpperCase() + access.key.slice(1)}`] = access.value;
1176
+ * }
1177
+ * );
1178
+ *
1179
+ * @example
1180
+ * // Transform object structure with cleanup
1181
+ * const source = reactive({ firstName: 'John', lastName: 'Doe' });
1182
+ * const formatted = organized(
1183
+ * source,
1184
+ * (access, target) => {
1185
+ * if (access.key === 'firstName' || access.key === 'lastName') {
1186
+ * target.fullName = `${source.firstName} ${source.lastName}`.trim();
1187
+ * }
1188
+ * }
1189
+ * );
1190
+ *
1191
+ * @example
1192
+ * // Using with cleanup in a component
1193
+ * effect(() => {
1194
+ * const data = fetchData();
1195
+ * const organizedData = organized(data, (access, target) => {
1196
+ * // Transform data
1197
+ * });
1198
+ *
1199
+ * // The cleanup will be called automatically when the effect is disposed
1200
+ * return () => organizedData[cleanup]();
1201
+ * });
1202
+ */
1203
+ declare function organized<Source extends Record<PropertyKey, any>, Target extends object = Record<PropertyKey, any>>(source: Source, apply: OrganizedCallback<Source, Target>, baseTarget?: Target): OrganizedResult<Target>;
1204
+ /**
1205
+ * Organizes a property on a target object
1206
+ * Shortcut for defineProperty/delete with touched signal
1207
+ * @param target - The target object
1208
+ * @param property - The property to organize
1209
+ * @param access - The access object
1210
+ * @returns The property descriptor
1211
+ */
1212
+ declare function organize<T>(target: object, property: PropertyKey, access: {
1213
+ get?(): T;
1214
+ set?(value: T): boolean;
1215
+ }): () => boolean;
1216
+
1217
+ /**
1218
+ * Options for the watch function
1219
+ */
1220
+ interface WatchOptions {
1221
+ /** Whether to call the callback immediately */
1222
+ immediate?: boolean;
1223
+ /** Whether to watch nested properties */
1224
+ deep?: boolean;
1225
+ }
1226
+ /**
1227
+ * Watches a reactive value and calls a callback when it changes
1228
+ * @param value - Function that returns the value to watch
1229
+ * @param changed - Callback to call when the value changes
1230
+ * @param options - Watch options
1231
+ * @returns Cleanup function to stop watching
1232
+ */
1233
+ declare function watch<T>(value: (dep: EffectAccess) => T, changed: (value: T, oldValue?: T) => void, options?: Omit<WatchOptions, 'deep'> & {
1234
+ deep?: false;
1235
+ }): EffectCleanup;
1236
+ /**
1237
+ * Watches a reactive value with deep watching enabled
1238
+ * @param value - Function that returns the value to watch
1239
+ * @param changed - Callback to call when the value changes
1240
+ * @param options - Watch options with deep watching enabled
1241
+ * @returns Cleanup function to stop watching
1242
+ */
1243
+ declare function watch<T extends object | any[]>(value: (dep: EffectAccess) => T, changed: (value: T, oldValue?: T) => void, options?: Omit<WatchOptions, 'deep'> & {
1244
+ deep: true;
1245
+ }): EffectCleanup;
1246
+ /**
1247
+ * Watches a reactive object directly
1248
+ * @param value - The reactive object to watch
1249
+ * @param changed - Callback to call when the object changes
1250
+ * @param options - Watch options
1251
+ * @returns Cleanup function to stop watching
1252
+ */
1253
+ declare function watch<T extends object | any[]>(value: T, changed: (value: T) => void, options?: WatchOptions): EffectCleanup;
1254
+ declare function unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>;
1255
+ declare function unreactiveApplication<T extends object>(obj: T): T;
1256
+ /**
1257
+ * Decorator that marks classes or properties as non-reactive
1258
+ * Prevents objects from being made reactive
1259
+ */
1260
+ declare const unreactive: LegacyClassDecorator<new (...args: any[]) => any> & ModernClassDecorator<new (...args: any[]) => any> & typeof unreactiveApplication;
1261
+
1262
+ /**
1263
+ * Reactively defines properties on a target object based on a descriptors record.
1264
+ *
1265
+ * It tracks the keys of the descriptors record and defines/updates/removes
1266
+ * properties on the target object as they change.
1267
+ *
1268
+ * @param descriptors - A reactive record of property descriptors.
1269
+ * @param target - The object to define properties on (defaults to a new object).
1270
+ * @returns The target object with reactive property definitions.
1271
+ */
1272
+ declare function describe<T extends object>(descriptors: Record<PropertyKey, PropertyDescriptor>, target?: T): T;
1273
+
1274
+ /**
1275
+ * Object containing internal reactive system state for debugging and profiling
1276
+ */
1277
+ declare const profileInfo: any;
1278
+
1279
+ /**
1280
+ * Decorator that caches the result of a getter method and only recomputes when dependencies change
1281
+ * Prevents circular dependencies and provides automatic cache invalidation
1282
+ */
1283
+ declare const cached: LegacyPropertyDecorator<any> & ModernGetterDecorator<any> & ModernAccessorDecorator<any>;
1284
+ /**
1285
+ * Checks if a property is cached (has a cached value)
1286
+ * @param object - The object to check
1287
+ * @param propertyKey - The property key to check
1288
+ * @returns True if the property has a cached value
1289
+ */
1290
+ declare function isCached(object: Object, propertyKey: PropertyKey): boolean;
1291
+ /**
1292
+ * Caches a value for a property on an object
1293
+ * @param object - The object to cache the value on
1294
+ * @param propertyKey - The property key to cache
1295
+ * @param value - The value to cache
1296
+ */
1297
+ declare function cache(object: Object, propertyKey: PropertyKey, value: any): void;
1298
+ /**
1299
+ * Creates a decorator that modifies property descriptors for specified properties
1300
+ * @param descriptor - The descriptor properties to apply
1301
+ * @returns A class decorator that applies the descriptor to specified properties
1302
+ */
1303
+ declare const descriptor: any;
1304
+ /**
1305
+ * Decorator that marks methods, properties, or classes as deprecated
1306
+ * Provides warning messages when deprecated items are used
1307
+ */
1308
+ 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>) & {
1309
+ warn: (target: any, propertyKey: PropertyKey, message?: string) => void;
1310
+ };
1311
+ /**
1312
+ * Creates a debounced method decorator that delays execution until after the delay period has passed
1313
+ * @param delay - The delay in milliseconds
1314
+ * @returns A method decorator that debounces method calls
1315
+ */
1316
+ declare function debounce(delay: number): LegacyPropertyDecorator<any> & ModernMethodDecorator<any>;
1317
+ /**
1318
+ * Creates a throttled method decorator that limits execution to once per delay period
1319
+ * @param delay - The delay in milliseconds
1320
+ * @returns A method decorator that throttles method calls
1321
+ */
1322
+ declare function throttle(delay: number): LegacyPropertyDecorator<any> & ModernMethodDecorator<any>;
1323
+
1324
+ type ElementTypes<T extends readonly unknown[]> = {
1325
+ [K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K];
1326
+ };
1327
+ /**
1328
+ * Combines multiple arrays into an array of tuples, stopping at the shortest array length
1329
+ * @param args - Arrays to zip together
1330
+ * @returns Array of tuples containing elements from each input array
1331
+ */
1332
+ declare function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[];
1333
+ /**
1334
+ * Checks if two arrays are strictly equal (shallow comparison)
1335
+ * @param a - First value
1336
+ * @param b - Second value
1337
+ * @returns True if arrays are equal or values are strictly equal
1338
+ */
1339
+ declare function arrayEquals(a: any, b: any): boolean;
1340
+ /**
1341
+ * Checks if a function is a constructor (class or constructor function)
1342
+ * @param fn - The function to check
1343
+ * @returns True if the function is a constructor
1344
+ */
1345
+ declare function isConstructor(fn: Function): boolean;
1346
+ /**
1347
+ * Renames a function with a new name
1348
+ * @param fct - The function to rename
1349
+ * @param name - The new name for the function
1350
+ * @returns The function with the new name
1351
+ */
1352
+ declare function renamed<F extends Function>(fct: F, name: string): F;
1353
+ declare const FoolProof: {
1354
+ get(obj: any, prop: any, receiver: any): any;
1355
+ set(obj: any, prop: any, value: any, receiver: any): boolean;
1356
+ };
1357
+ declare function isOwnAccessor(obj: any, prop: any): boolean;
1358
+ /**
1359
+ * Deeply compares two values.
1360
+ * For objects, compares prototypes with === and then own properties recursively.
1361
+ * Uses a cache to handle circular references.
1362
+ * @param a - First value
1363
+ * @param b - Second value
1364
+ * @param cache - Map for circular reference protection (internal use)
1365
+ * @returns True if values are deeply equal
1366
+ */
1367
+ declare function deepCompare(a: any, b: any, cache?: Map<object, Set<object>>): boolean;
1368
+ declare function contentRef(container: object): any;
1369
+ declare function tag<T extends object>(name: string, obj: T): T;
1370
+ declare function named<T extends Function>(name: string, fn: T): T;
1371
+
1372
+ type Restorer = () => () => void;
1373
+ type Hook = () => Restorer;
1374
+ declare const hooks: Set<Hook>;
1375
+ declare const asyncHooks: {
1376
+ addHook(hook: Hook): () => void;
1377
+ /**
1378
+ * [Hack] Sanitize a promise (or value) to prevent context leaks.
1379
+ * Default: Identity function.
1380
+ * Browser: Uses Macrotask wrapping to break microtask chains.
1381
+ */
1382
+ sanitizePromise(p: any): any;
1383
+ };
1384
+ /**
1385
+ * Register a hook that will be called whenever an asynchronous operation is initiated.
1386
+ * The hook should return a restorer function which will be called just before the async callback runs.
1387
+ * That restorer should in turn return an undoer function which will be called just after the async callback finishes.
1388
+ */
1389
+ declare const asyncHook: (hook: Hook) => () => void;
1390
+
1391
+ export { ArrayReadForward, DecoratorError, EffectAccess as DependencyAccess, Destroyable, DestructionError, EffectCleanup, EffectOptions, EffectTrigger, Eventful, Evolution, FoolProof, Indexable, IterableWeakMap, IterableWeakSet, ReactiveBase, Register, ScopedCallback, ZoneAggregator, addBatchCleanup, allocated, allocatedValues, arrayEquals, asyncHook, asyncHooks, atomic, attend, biDi, cache, cached, callOnGC, chainPromise, cleanedBy, cleanup, contentRef, debounce, decorator, deepCompare, deepWatch, defer, deprecated, derived, describe, descriptor, destructor, effect, effectAggregator, forwardArray, getActivationLog, getActiveEffect, getActiveProjection, getAt, getState, hooks, immutables, isCached, isConstructor, isNonReactive, isOwnAccessor, isReactive, legacyDecorator, lift, memoize, mixin, modernDecorator, named, onEffectThrow, onEffectTrigger, organize, organized, profileInfo, project, reactive, register, registerNativeReactivity, renamed, reset, root, scan, setAt, tag, throttle, touched, touched1, unreactive, untracked, unwrap, watch, zip };
1392
+ export type { ContextManager, Decorator, DecoratorDescription, DecoratorFactory, EventsBase, GenericClassDecorator, Hook, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, PromiseChain, Restorer, ScanResult };