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
@@ -0,0 +1,28 @@
1
+ import { type Evolution } from './types';
2
+ export declare function shouldRecurseTouch(oldValue: any, newValue: any): boolean;
3
+ /**
4
+ * Centralized function to handle property change notifications with optional recursive touch
5
+ * @param targetObj - The object whose property changed
6
+ * @param prop - The property that changed
7
+ * @param oldValue - The old value (before change)
8
+ * @param newValue - The new value (after change)
9
+ * @param hadProperty - Whether the property existed before (for add vs set)
10
+ */
11
+ export declare function notifyPropertyChange(targetObj: any, prop: any, oldValue: any, newValue: any, hadProperty: boolean): void;
12
+ type VisitedPairs = WeakMap<object, WeakSet<object>>;
13
+ type PendingNotification = {
14
+ target: any;
15
+ evolution: Evolution;
16
+ prop: any;
17
+ origin?: {
18
+ obj: object;
19
+ prop: PropertyKey;
20
+ };
21
+ };
22
+ export declare function recursiveTouch(oldValue: any, newValue: any, visited?: VisitedPairs, notifications?: PendingNotification[], origin?: {
23
+ obj: object;
24
+ prop: PropertyKey;
25
+ }): PendingNotification[];
26
+ export declare function dispatchNotifications(notifications: PendingNotification[]): void;
27
+ export {};
28
+ //# sourceMappingURL=deep-touch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-touch.d.ts","sourceRoot":"","sources":["../../../src/reactive/deep-touch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoD,KAAK,SAAS,EAAuB,MAAM,SAAS,CAAA;AAoB/G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAKxE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CACnC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,GAAG,EACb,WAAW,EAAE,OAAO,QAoBpB;AAED,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AACpD,KAAK,mBAAmB,GAAG;IAC1B,MAAM,EAAE,GAAG,CAAA;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,EAAE,GAAG,CAAA;IACT,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,CAAA;CAC3C,CAAA;AA0BD,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,GAAG,EACb,OAAO,GAAE,YAA4B,EACrC,aAAa,GAAE,mBAAmB,EAAO,EACzC,MAAM,CAAC,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACzC,mBAAmB,EAAE,CAYvB;AA+FD,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,EAAE,QA2DzE"}
@@ -0,0 +1,25 @@
1
+ import type { EffectTrigger, Evolution } from './types';
2
+ export declare const objectParents: WeakMap<object, Set<{
3
+ parent: object;
4
+ prop: PropertyKey;
5
+ }>>;
6
+ export declare const objectsWithDeepWatchers: WeakSet<object>;
7
+ export declare const deepWatchers: WeakMap<object, Set<EffectTrigger>>;
8
+ export declare const effectToDeepWatchedObjects: WeakMap<EffectTrigger, Set<object>>;
9
+ /**
10
+ * Add a back-reference from child to parent
11
+ */
12
+ export declare function addBackReference(child: object, parent: object, prop: any): void;
13
+ /**
14
+ * Remove a back-reference from child to parent
15
+ */
16
+ export declare function removeBackReference(child: object, parent: object, prop: any): void;
17
+ /**
18
+ * Check if an object needs back-references (has deep watchers or parents with deep watchers)
19
+ */
20
+ export declare function needsBackReferences(obj: object): boolean;
21
+ /**
22
+ * Bubble up changes through the back-reference chain
23
+ */
24
+ export declare function bubbleUpChange(changedObject: object, evolution: Evolution): void;
25
+ //# sourceMappingURL=deep-watch-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-watch-state.d.ts","sourceRoot":"","sources":["../../../src/reactive/deep-watch-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGvD,eAAO,MAAM,aAAa;YAAqC,MAAM;UAAQ,WAAW;GAAM,CAAA;AAG9F,eAAO,MAAM,uBAAuB,iBAAwB,CAAA;AAG5D,eAAO,MAAM,YAAY,qCAA4C,CAAA;AAGrE,eAAO,MAAM,0BAA0B,qCAA4C,CAAA;AAEnF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAOxE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAa3E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,QAYzE"}
@@ -0,0 +1,20 @@
1
+ import { type EffectCleanup } from './types';
2
+ export { addBackReference, bubbleUpChange, deepWatchers, effectToDeepWatchedObjects, needsBackReferences, objectParents, objectsWithDeepWatchers, removeBackReference, } from './deep-watch-state';
3
+ /**
4
+ * Deep watch an object and all its nested properties
5
+ * @param target - The object to watch deeply
6
+ * @param callback - The callback to call when any nested property changes
7
+ * @param options - Options for the deep watch
8
+ * @returns A cleanup function to stop watching
9
+ */
10
+ /**
11
+ * Sets up deep watching for an object, tracking all nested property changes
12
+ * @param target - The object to watch
13
+ * @param callback - The callback to call when changes occur
14
+ * @param options - Options for deep watching
15
+ * @returns A cleanup function to stop deep watching
16
+ */
17
+ export declare function deepWatch<T extends object>(target: T, callback: (value: T) => void, { immediate }?: {
18
+ immediate?: boolean;
19
+ }): EffectCleanup | undefined;
20
+ //# sourceMappingURL=deep-watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-watch.d.ts","sourceRoot":"","sources":["../../../src/reactive/deep-watch.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,aAAa,EAA+B,MAAM,SAAS,CAAA;AAMzE,OAAO,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,oBAAoB,CAAA;AAE3B;;;;;;GAMG;AACH;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACzC,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC5B,EAAE,SAAiB,EAAE;;CAAK,GACxB,aAAa,GAAG,SAAS,CA8H3B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Reactively defines properties on a target object based on a descriptors record.
3
+ *
4
+ * It tracks the keys of the descriptors record and defines/updates/removes
5
+ * properties on the target object as they change.
6
+ *
7
+ * @param descriptors - A reactive record of property descriptors.
8
+ * @param target - The object to define properties on (defaults to a new object).
9
+ * @returns The target object with reactive property definitions.
10
+ */
11
+ export declare function describe<T extends object>(descriptors: Record<PropertyKey, PropertyDescriptor>, target?: T): T;
12
+ //# sourceMappingURL=describe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/reactive/describe.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACxC,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,EACpD,MAAM,GAAE,CAA4B,GAClC,CAAC,CAoBH"}
@@ -0,0 +1,34 @@
1
+ import { ZoneAggregator, ZoneHistory } from '../zone';
2
+ import { cleanup, type EffectAccess, type EffectTrigger, type ScopedCallback } from './types';
3
+ export declare const effectHistory: ZoneHistory<EffectTrigger>;
4
+ /**
5
+ * Aggregator for zones that need to be tracked along effects.
6
+ * ie. in each effect, the active zone of the given zoning will be the one active at effect's definition
7
+ */
8
+ export declare const effectAggregator: ZoneAggregator;
9
+ export declare function isRunning(effect: EffectTrigger): boolean;
10
+ export declare function getActiveEffect(): EffectTrigger;
11
+ /**
12
+ * ADD a cleanup function to an object using the cleanup symbol.
13
+ * The cleanup function will be called when the object needs to be disposed.
14
+ *
15
+ * Note: most of the time, you don't need to use this function directly.
16
+ * 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.
17
+ *
18
+ * @param obj - The object to attach the cleanup function to
19
+ * @param cleanupFn - The cleanup function to attach
20
+ * @returns The object with the cleanup function attached
21
+ */
22
+ export declare function cleanedBy<T extends object>(obj: T, cleanupFn: ScopedCallback): T & {
23
+ [cleanup]: ScopedCallback;
24
+ };
25
+ /**
26
+ * Creates a derived value that automatically recomputes when dependencies change
27
+ * @param compute - Function that computes the derived value
28
+ * @returns Object with value and cleanup function
29
+ */
30
+ export declare function derived<T>(compute: (dep: EffectAccess) => T): {
31
+ value: T;
32
+ [cleanup]: ScopedCallback;
33
+ };
34
+ //# sourceMappingURL=effect-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-context.d.ts","sourceRoot":"","sources":["../../../src/reactive/effect-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGhE,OAAO,EACN,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,aAAa,4BAAyD,CAAA;AAInF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gBAAqE,CAAA;AAElG,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAGxD;AAED,wBAAgB,eAAe,kBAE9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,cAAc,GAiBtE,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CACvC;AAID;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,CAAC,GAAG;IAC9D,KAAK,EAAE,CAAC,CAAA;IACR,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB,CAUA"}
@@ -0,0 +1,164 @@
1
+ import { type StackFrame } from '../../debug/lineage';
2
+ import { type CatchFunction, type EffectAccess, type EffectCleanup, type EffectCloser, type EffectOptions, type EffectTrigger, type Evolution } from './types';
3
+ type EffectTracking = (obj: any, evolution: Evolution, prop: any, effect: EffectTrigger) => void;
4
+ export interface ActivationRecord {
5
+ effect: EffectTrigger;
6
+ obj: any;
7
+ evolution: Evolution;
8
+ prop: any;
9
+ batchId: number;
10
+ }
11
+ export declare const activationLog: Omit<ActivationRecord, 'batchId'>[];
12
+ /**
13
+ * Returns the activation log containing recent effect activations for debugging.
14
+ * The log is a circular buffer of the last 100 activations.
15
+ *
16
+ * @returns Array of activation records
17
+ */
18
+ export declare function getActivationLog(): Omit<ActivationRecord, "batchId">[];
19
+ export declare function recordActivation(effect: EffectTrigger, obj: any, evolution: Evolution, prop: any): void;
20
+ /**
21
+ * Registers a debug callback that is called when the current effect is triggered by a dependency change
22
+ *
23
+ * This function is useful for debugging purposes as it pin-points exactly which reactive property
24
+ * change triggered the effect. The callback receives information about:
25
+ * - The object that changed
26
+ * - The type of change (evolution)
27
+ * - The specific property that changed
28
+ *
29
+ * **Note:** The tracker callback is automatically removed after being called once. If you need
30
+ * to track multiple triggers, call `onEffectTrigger` again within the effect.
31
+ *
32
+ * @param onTouch - Callback function that receives (obj, evolution, prop) when the effect is triggered
33
+ * @throws {Error} If called outside of an effect context
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const state = reactive({ count: 0, name: 'John' })
38
+ *
39
+ * effect(() => {
40
+ * // Register a tracker to see what triggers this effect
41
+ * onEffectTrigger((obj, evolution, prop) => {
42
+ * console.log(`Effect triggered by:`, {
43
+ * object: obj,
44
+ * change: evolution.type,
45
+ * property: prop
46
+ * })
47
+ * })
48
+ *
49
+ * // Access reactive properties
50
+ * console.log(state.count, state.name)
51
+ * })
52
+ *
53
+ * state.count = 5
54
+ * ```
55
+ */
56
+ export declare function onEffectTrigger(onTouch: EffectTracking, effect?: EffectTrigger): void;
57
+ export declare function raiseEffectTrackers(effect: EffectTrigger, obj: any, evolution: Evolution, prop: any): void;
58
+ export declare function onEffectThrow(onThrow: CatchFunction, effect?: EffectTrigger): void;
59
+ export declare const effectCreationStacks: WeakMap<Function, StackFrame[]>;
60
+ export declare function hasBatched(effect: EffectTrigger): boolean;
61
+ /**
62
+ * Adds a cleanup function to be called when the current batch of effects completes
63
+ * @param cleanup - The cleanup function to add
64
+ */
65
+ export declare function addBatchCleanup(cleanup: EffectCleanup): void;
66
+ /**
67
+ * Semantic alias for `addBatchCleanup` - defers work to the end of the current reactive batch.
68
+ *
69
+ * Use this when an effect needs to perform an action that would modify state the effect depends on,
70
+ * which would create a reactive cycle. The deferred callback runs after all effects complete.
71
+ *
72
+ * @param callback - The callback to defer until after the current batch completes
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * effect(() => {
77
+ * processData()
78
+ *
79
+ * // Defer to avoid cycle (createMovement modifies state this effect reads)
80
+ * defer(() => {
81
+ * createMovement(data)
82
+ * })
83
+ * })
84
+ * ```
85
+ */
86
+ export declare const defer: typeof addBatchCleanup;
87
+ export declare function batch(effect: EffectTrigger | EffectTrigger[], immediate?: 'immediate'): any;
88
+ /**
89
+ * Resets the reactive system to a consistent state.
90
+ * Call this after an unrecoverable error has set the system to "broken".
91
+ * This clears all batch state, effect dependency graphs, and watcher registrations.
92
+ * All existing effects become orphaned and must be recreated.
93
+ */
94
+ export declare function reset(): void;
95
+ export { reset as resetBatchQueueForTest };
96
+ /**
97
+ * Decorator that makes methods atomic - batches all effects triggered within the method
98
+ */
99
+ export declare const atomic: import("../decorator").LegacyPropertyDecorator<any> & import("../decorator").ModernMethodDecorator<any> & (<Args extends any[], Return>(original: (...args: Args) => Return) => (...args: Args) => Return);
100
+ /**
101
+ * @param fn - The effect function to run - provides the cleaner
102
+ * @returns The cleanup function
103
+ */
104
+ /**
105
+ * Creates a reactive effect that automatically re-runs when dependencies change
106
+ * @param fn - The effect function that provides dependencies and may return a cleanup function or Promise
107
+ * @param options - Options for effect execution
108
+ * @returns A cleanup function to stop the effect
109
+ */
110
+ export declare const effect: ((fn: (access: EffectAccess) => EffectCloser | undefined | void | Promise<any>, effectOptions?: EffectOptions) => EffectCleanup) & {
111
+ readonly opaque: any;
112
+ named(name: string): any;
113
+ };
114
+ /**
115
+ * Executes a function without tracking dependencies but maintains parent cleanup relationship
116
+ * Effects created inside will still be cleaned up when the parent effect is destroyed
117
+ * @param fn - The function to execute
118
+ */
119
+ export declare function untracked<T>(fn: () => T): T;
120
+ /**
121
+ * Executes a function from a virgin/root context - no parent effect, no tracking
122
+ * Creates completely independent effects that won't be cleaned up by any parent
123
+ * @param fn - The function to execute
124
+ */
125
+ export declare function root<T>(fn: () => T): T;
126
+ /**
127
+ * Creates a bidirectional binding between a reactive value and a non-reactive external value
128
+ * Prevents infinite loops by automatically suppressing circular notifications
129
+ *
130
+ * @param received - Function called when the reactive value changes (external setter)
131
+ * @param get - Getter for the reactive value OR an object with `{ get, set }` properties
132
+ * @param set - Setter for the reactive value (required if `get` is a function)
133
+ * @returns A function to manually provide updates from the external side
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * const model = reactive({ value: '' })
138
+ * const input = { value: '' }
139
+ *
140
+ * // Bidirectional binding
141
+ * const provide = biDi(
142
+ * (v) => input.value = v, // external setter
143
+ * () => model.value, // reactive getter
144
+ * (v) => model.value = v // reactive setter
145
+ * )
146
+ *
147
+ * // External notification (e.g., from input event)
148
+ * provide('new value') // Updates model.value, doesn't trigger circular loop
149
+ * ```
150
+ *
151
+ * @example Using object syntax
152
+ * ```typescript
153
+ * const provide = biDi(
154
+ * (v) => setHTMLValue(v),
155
+ * { get: () => reactiveObj.value, set: (v) => reactiveObj.value = v }
156
+ * )
157
+ * ```
158
+ */
159
+ export declare function biDi<T>(received: (value: T) => void, value: {
160
+ get: () => T;
161
+ set: (value: T) => void;
162
+ }): (value: T) => void;
163
+ export declare function biDi<T>(received: (value: T) => void, get: () => T, set: (value: T) => void): (value: T) => void;
164
+ //# sourceMappingURL=effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../src/reactive/effects.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAclF,OAAO,EACN,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EAQd,MAAM,SAAS,CAAA;AA4BhB,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,KAAK,IAAI,CAAA;AAEhG,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,GAAG,CAAA;IACR,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,MAAM,CAAA;CACf;AAMD,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAmB,CAAA;AAEhF;;;;;GAKG;AACH,wBAAgB,gBAAgB,wCAE/B;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,QAsChG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,aAAa,QAM9E;AAED,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE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,KAAK,IAAI,EAC5B,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;CAAE,GAC9C,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;AACrB,wBAAgB,IAAI,CAAC,CAAC,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC5B,GAAG,EAAE,MAAM,CAAC,EACZ,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GACrB,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA"}
@@ -0,0 +1,19 @@
1
+ export { attend, lift, type ScanResult, scan } from './buffer';
2
+ export { getState, touched, touched1 } from './change';
3
+ export { deepWatch } from './deep-watch';
4
+ export { cleanedBy, derived, effectAggregator, getActiveEffect } from './effect-context';
5
+ export { addBatchCleanup, atomic, biDi, defer, effect, getActivationLog, onEffectThrow, onEffectTrigger, reset, root, untracked, } from './effects';
6
+ export { type Memoizable, memoize } from './memoize';
7
+ export { immutables, isNonReactive, registerNativeReactivity } from './non-reactive';
8
+ export { getActiveProjection, project } from './project';
9
+ export { isReactive, ReactiveBase, reactive, unwrap } from './proxy';
10
+ export { organize, organized } from './record';
11
+ export { Register, register } from './register';
12
+ export { cleanup, type EffectAccess as DependencyAccess, type EffectCleanup, type EffectOptions, type EffectTrigger, type Evolution, options as reactiveOptions, ReactiveError, ReactiveErrorCode, type ScopedCallback, } from './types';
13
+ export { unreactive, watch } from './watch';
14
+ export { describe } from './describe';
15
+ /**
16
+ * Object containing internal reactive system state for debugging and profiling
17
+ */
18
+ export declare const profileInfo: any;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reactive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,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 /**
2
+ * Reactive wrapper around JavaScript's WeakMap class
3
+ * Only tracks individual key operations, no size tracking (WeakMap limitation)
4
+ */
5
+ export declare abstract class ReactiveWeakMap<K extends object, V> extends WeakMap<K, V> {
6
+ delete(key: K): boolean;
7
+ get(key: K): V | undefined;
8
+ has(key: K): boolean;
9
+ set(key: K, value: V): this;
10
+ }
11
+ /**
12
+ * Reactive wrapper around JavaScript's Map class
13
+ * Tracks size changes, individual key operations, and collection-wide operations
14
+ */
15
+ export declare abstract class ReactiveMap<K, V> extends Map<K, V> {
16
+ get size(): number;
17
+ clear(): void;
18
+ entries(): Generator<[K, V]>;
19
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
20
+ keys(): MapIterator<K>;
21
+ values(): Generator<V>;
22
+ [Symbol.iterator](): MapIterator<[K, V]>;
23
+ delete(key: K): boolean;
24
+ get(key: K): V | undefined;
25
+ has(key: K): boolean;
26
+ set(key: K, value: V): this;
27
+ }
28
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/reactive/map.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,8BAAsB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAE/E,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IASvB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAK1B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAKpB,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;CAY3B;AAED;;;GAGG;AACH,8BAAsB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAExD,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,KAAK,IAAI,IAAI;IAYb,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAK5B,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI;IAKpF,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC;IAKtB,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC;IAKtB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAcxC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAavB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAK1B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO;IAKpB,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;CAe3B"}
@@ -0,0 +1,28 @@
1
+ export type Memoizable = object | any[] | symbol | ((...args: any[]) => any);
2
+ declare function memoizeFunction<Result, Args extends Memoizable[]>(fn: (...args: Args) => Result): (...args: Args) => Result;
3
+ /**
4
+ * Decorator and function wrapper for memoizing computed values based on reactive dependencies.
5
+ *
6
+ * When used as a decorator on getters or methods, it caches the result and automatically
7
+ * invalidates the cache when reactive dependencies change.
8
+ *
9
+ * When used as a function wrapper, it memoizes based on object arguments (WeakMap-based cache).
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * class User {
14
+ * @memoize
15
+ * get fullName() {
16
+ * return `${this.firstName} ${this.lastName}`
17
+ * }
18
+ * }
19
+ *
20
+ * // Or as a function wrapper
21
+ * const expensive = memoize((obj: SomeObject) => {
22
+ * return heavyComputation(obj)
23
+ * })
24
+ * ```
25
+ */
26
+ export declare const memoize: import("../decorator").LegacyPropertyDecorator<any> & import("../decorator").ModernMethodDecorator<any> & import("../decorator").ModernGetterDecorator<any> & import("../decorator").ModernAccessorDecorator<any> & typeof memoizeFunction;
27
+ export {};
28
+ //# sourceMappingURL=memoize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../../src/reactive/memoize.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAA;AAqB5E,iBAAS,eAAe,CAAC,MAAM,EAAE,IAAI,SAAS,UAAU,EAAE,EACzD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,GAC3B,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CA6E3B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO,4OAoDlB,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const nonReactiveObjects: WeakSet<object>;
2
+ export declare const immutables: Set<(tested: any) => boolean>;
3
+ export declare const absent: unique symbol;
4
+ declare function markNonReactive<T extends object[]>(...obj: T): T[0];
5
+ export declare function nonReactiveClass<T extends (new (...args: any[]) => any)[]>(...cls: T): T[0];
6
+ export declare function isNonReactive(obj: any): boolean;
7
+ export declare function registerNativeReactivity(originalClass: new (...args: any[]) => any, reactiveClass: new (...args: any[]) => any): void;
8
+ export { markNonReactive as nonReactive };
9
+ //# sourceMappingURL=non-reactive-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-reactive-state.d.ts","sourceRoot":"","sources":["../../../src/reactive/non-reactive-state.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,iBAAwB,CAAA;AACvD,eAAO,MAAM,UAAU,eAAoB,GAAG,KAAK,OAAO,CAAG,CAAA;AAC7D,eAAO,MAAM,MAAM,eAAmB,CAAA;AAEtC,iBAAS,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAa5D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAG3F;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAM/C;AAED,wBAAgB,wBAAwB,CACvC,aAAa,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAC1C,aAAa,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,QAI1C;AAQD,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { absent, immutables, isNonReactive, nonReactive, nonReactiveClass, nonReactiveObjects, registerNativeReactivity } from './non-reactive-state';
2
+ /**
3
+ * Converts an iterator to a generator that yields reactive values
4
+ */
5
+ export declare function makeReactiveIterator<T>(iterator: Iterator<T>): Generator<T>;
6
+ /**
7
+ * Converts an iterator of key-value pairs to a generator that yields reactive key-value pairs
8
+ */
9
+ export declare function makeReactiveEntriesIterator<K, V>(iterator: Iterator<[K, V]>): Generator<[K, V]>;
10
+ export { absent, immutables, isNonReactive, nonReactive, nonReactiveClass, nonReactiveObjects, registerNativeReactivity, };
11
+ //# sourceMappingURL=non-reactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-reactive.d.ts","sourceRoot":"","sources":["../../../src/reactive/non-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,MAAM,sBAAsB,CAAA;AAG7B;;GAEG;AACH,wBAAiB,oBAAoB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAM5E;AAED;;GAEG;AACH,wBAAiB,2BAA2B,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAOhG;AAED,OAAO,EACN,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACxB,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { Register } from './register';
2
+ import { cleanup, type ProjectionContext, type ScopedCallback } from './types';
3
+ /**
4
+ * Maps projection effects (item effects) to their projection context
5
+ */
6
+ export declare const effectProjectionMetadata: WeakMap<ScopedCallback, ProjectionContext>;
7
+ /**
8
+ * Returns the projection context of the currently running effect, if any.
9
+ */
10
+ export declare function getActiveProjection(): ProjectionContext | undefined;
11
+ type ProjectOldValue<Target> = Target extends readonly (infer Item)[] ? Item : Target extends Map<any, infer Item> ? Item : Target extends Record<PropertyKey, infer Item> ? Item : unknown;
12
+ export type ProjectAccess<SourceValue, Key, SourceType, Target> = {
13
+ readonly key: Key;
14
+ get(): SourceValue;
15
+ set(value: SourceValue): boolean;
16
+ readonly source: SourceType;
17
+ readonly old?: ProjectOldValue<Target>;
18
+ value: SourceValue;
19
+ };
20
+ export type ProjectCallback<SourceValue, Key, Target extends object, SourceType, Result> = (access: ProjectAccess<SourceValue, Key, SourceType, Target>, target: Target) => Result;
21
+ export type ProjectResult<Target extends object> = Target & {
22
+ [cleanup]: ScopedCallback;
23
+ };
24
+ declare function projectArray<SourceValue, ResultValue>(source: readonly SourceValue[], apply: ProjectCallback<SourceValue, number, ResultValue[], readonly SourceValue[], ResultValue>): ProjectResult<ResultValue[]>;
25
+ 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>>;
26
+ 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>>;
27
+ 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>>;
28
+ type ProjectOverload = {
29
+ <SourceValue, ResultValue>(source: readonly SourceValue[], apply: ProjectCallback<SourceValue, number, ResultValue[], readonly SourceValue[], ResultValue>): ProjectResult<ResultValue[]>;
30
+ <Key extends PropertyKey, SourceValue, ResultValue>(source: Register<SourceValue, Key>, apply: ProjectCallback<SourceValue, Key, Map<Key, ResultValue>, Register<SourceValue, Key>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
31
+ <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>>;
32
+ <Key, Value, ResultValue>(source: Map<Key, Value>, apply: ProjectCallback<Value, Key, Map<Key, ResultValue>, Map<Key, Value>, ResultValue>): ProjectResult<Map<Key, ResultValue>>;
33
+ array: typeof projectArray;
34
+ register: typeof projectRegister;
35
+ record: typeof projectRecord;
36
+ map: typeof projectMap;
37
+ };
38
+ export declare const project: ProjectOverload;
39
+ export {};
40
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/reactive/project.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EACN,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Aa,CAAA;IAC5B,GAAG,EAAE,OAAO,UAAU,CAAA;CACtB,CAAA;AAuCD,eAAO,MAAM,OAAO,EAAE,eAKpB,CAAA"}
@@ -0,0 +1,8 @@
1
+ export declare const objectToProxy: WeakMap<object, object>;
2
+ export declare const proxyToObject: WeakMap<object, object>;
3
+ export declare function storeProxyRelationship(target: object, proxy: object): void;
4
+ export declare function getExistingProxy<T extends object>(target: T): T | undefined;
5
+ export declare function trackProxyObject(proxy: object, target: object): void;
6
+ export declare function unwrap<T>(obj: T): T;
7
+ export declare function isReactive(obj: any): boolean;
8
+ //# sourceMappingURL=proxy-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-state.d.ts","sourceRoot":"","sources":["../../../src/reactive/proxy-state.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,yBAAgC,CAAA;AAC1D,eAAO,MAAM,aAAa,yBAAgC,CAAA;AAE1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAGnE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAE3E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAE7D;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAMnC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE5C"}
@@ -0,0 +1,23 @@
1
+ export declare const metaProtos: WeakMap<WeakKey, any>;
2
+ /**
3
+ * Base mixin for reactive classes that provides proper constructor reactivity
4
+ * Solves constructor reactivity issues in complex inheritance trees
5
+ */
6
+ export declare const ReactiveBase: (new (...args: any[]) => {
7
+ [x: string]: any;
8
+ }) & (<Base>(base: abstract new (...args: any[]) => Base) => new (...args: any[]) => {
9
+ [x: string]: any;
10
+ } & Base);
11
+ declare function reactiveObject<T>(anyTarget: T): T;
12
+ /**
13
+ * Main decorator for making classes reactive
14
+ * Automatically makes class instances reactive when created
15
+ */
16
+ export declare const reactive: import("../decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("../decorator").ModernClassDecorator<new (...args: any[]) => any> & typeof reactiveObject;
17
+ /**
18
+ * Gets the original, non-reactive object from a reactive proxy
19
+ * @param proxy - The reactive proxy
20
+ * @returns The original object
21
+ */
22
+ export { isReactive, objectToProxy, proxyToObject, unwrap } from './proxy-state';
23
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/reactive/proxy.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,UAAU,uBAAgB,CAAA;AA2KvC;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;SAWvB,CAAA;AACF,iBAAS,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAsB1C;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,6KA4BnB,CAAA;AAEF;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA"}