mutts 1.0.12 → 1.0.14

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