mutts 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -23
- package/dist/async/browser.d.ts +2 -0
- package/dist/async/browser.d.ts.map +1 -0
- package/dist/async/index.d.ts +18 -0
- package/dist/async/index.d.ts.map +1 -0
- package/dist/async/node.d.ts +2 -0
- package/dist/async/node.d.ts.map +1 -0
- package/dist/{chunks/index-BFYK02LG.js → browser.cjs} +169 -60
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +1654 -1
- package/dist/browser.esm.js +260 -25
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/async-browser-CA0jPWIi.cjs +304 -0
- package/dist/chunks/async-browser-CA0jPWIi.cjs.map +1 -0
- package/dist/chunks/async-core-UqHzvJ-S.cjs +25 -0
- package/dist/chunks/async-core-UqHzvJ-S.cjs.map +1 -0
- package/dist/chunks/async-node-BYHuGTni.cjs +103 -0
- package/dist/chunks/async-node-BYHuGTni.cjs.map +1 -0
- package/dist/chunks/{index-CNR6QRUl.esm.js → index-DhaOVusv.esm.js} +173 -53
- package/dist/chunks/index-DhaOVusv.esm.js.map +1 -0
- package/dist/decorator.d.ts +106 -0
- package/dist/decorator.d.ts.map +1 -0
- package/dist/destroyable.d.ts +87 -0
- package/dist/destroyable.d.ts.map +1 -0
- package/dist/devtools/devtool/devtools.d.ts +1 -0
- package/dist/devtools/devtool/devtools.d.ts.map +1 -0
- package/dist/devtools/devtool/panel.d.ts +2 -0
- package/dist/devtools/devtool/panel.d.ts.map +1 -0
- package/dist/entry-browser.d.ts +3 -0
- package/dist/entry-browser.d.ts.map +1 -0
- package/dist/entry-node.d.ts +3 -0
- package/dist/entry-node.d.ts.map +1 -0
- package/dist/eventful.d.ts +18 -0
- package/dist/eventful.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/indexable.d.ts +243 -0
- package/dist/indexable.d.ts.map +1 -0
- package/dist/introspection.d.ts +27 -0
- package/dist/introspection.d.ts.map +1 -0
- package/dist/iterableWeak.d.ts +53 -0
- package/dist/iterableWeak.d.ts.map +1 -0
- package/dist/mixins.d.ts +25 -0
- package/dist/mixins.d.ts.map +1 -0
- package/dist/mutts.umd.js +1 -1
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/node.cjs +105 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.ts +1 -2
- package/dist/node.esm.js +91 -32
- package/dist/node.esm.js.map +1 -1
- package/dist/promiseChain.d.ts +20 -0
- package/dist/promiseChain.d.ts.map +1 -0
- package/dist/reactive/array.d.ts +49 -0
- package/dist/reactive/array.d.ts.map +1 -0
- package/dist/reactive/buffer.d.ts +44 -0
- package/dist/reactive/buffer.d.ts.map +1 -0
- package/dist/reactive/change.d.ts +29 -0
- package/dist/reactive/change.d.ts.map +1 -0
- package/dist/reactive/debug.d.ts +111 -0
- package/dist/reactive/debug.d.ts.map +1 -0
- package/dist/reactive/deep-touch.d.ts +28 -0
- package/dist/reactive/deep-touch.d.ts.map +1 -0
- package/dist/reactive/deep-watch-state.d.ts +25 -0
- package/dist/reactive/deep-watch-state.d.ts.map +1 -0
- package/dist/reactive/deep-watch.d.ts +19 -0
- package/dist/reactive/deep-watch.d.ts.map +1 -0
- package/dist/reactive/effect-context.d.ts +7 -0
- package/dist/reactive/effect-context.d.ts.map +1 -0
- package/dist/reactive/effects.d.ts +151 -0
- package/dist/reactive/effects.d.ts.map +1 -0
- package/dist/reactive/index.d.ts +20 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/interface.d.ts +64 -0
- package/dist/reactive/interface.d.ts.map +1 -0
- package/dist/reactive/map.d.ts +30 -0
- package/dist/reactive/map.d.ts.map +1 -0
- package/dist/reactive/memoize.d.ts +5 -0
- package/dist/reactive/memoize.d.ts.map +1 -0
- package/dist/reactive/non-reactive-state.d.ts +9 -0
- package/dist/reactive/non-reactive-state.d.ts.map +1 -0
- package/dist/reactive/non-reactive.d.ts +11 -0
- package/dist/reactive/non-reactive.d.ts.map +1 -0
- package/dist/reactive/project.d.ts +41 -0
- package/dist/reactive/project.d.ts.map +1 -0
- package/dist/reactive/proxy-state.d.ts +8 -0
- package/dist/reactive/proxy-state.d.ts.map +1 -0
- package/dist/reactive/proxy.d.ts +23 -0
- package/dist/reactive/proxy.d.ts.map +1 -0
- package/dist/reactive/record.d.ts +116 -0
- package/dist/reactive/record.d.ts.map +1 -0
- package/dist/reactive/register.d.ts +64 -0
- package/dist/reactive/register.d.ts.map +1 -0
- package/dist/reactive/registry.d.ts +20 -0
- package/dist/reactive/registry.d.ts.map +1 -0
- package/dist/reactive/set.d.ts +28 -0
- package/dist/reactive/set.d.ts.map +1 -0
- package/dist/reactive/tracking.d.ts +7 -0
- package/dist/reactive/tracking.d.ts.map +1 -0
- package/dist/reactive/types.d.ts +376 -0
- package/dist/reactive/types.d.ts.map +1 -0
- package/dist/std-decorators.d.ts +50 -0
- package/dist/std-decorators.d.ts.map +1 -0
- package/dist/utils.d.ts +49 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/zone.d.ts +40 -0
- package/dist/zone.d.ts.map +1 -0
- package/docs/std-decorators.md +69 -1
- package/docs/zone.md +7 -0
- package/package.json +39 -27
- package/src/async/browser.ts +266 -34
- package/src/async/index.ts +17 -2
- package/src/async/node.ts +89 -31
- package/src/entry-browser.ts +5 -0
- package/src/entry-node.ts +5 -0
- package/src/index.d.ts +12 -9
- package/src/index.ts +1 -0
- package/src/reactive/array.ts +139 -52
- package/src/reactive/effect-context.ts +3 -3
- package/src/reactive/index.ts +2 -1
- package/src/reactive/map.ts +1 -1
- package/src/reactive/set.ts +1 -1
- package/src/utils.ts +1 -1
- package/src/zone.ts +19 -8
- package/dist/browser.js +0 -161
- package/dist/browser.js.map +0 -1
- package/dist/chunks/index-BFYK02LG.js.map +0 -1
- package/dist/chunks/index-CNR6QRUl.esm.js.map +0 -1
- package/dist/node.js +0 -136
- package/dist/node.js.map +0 -1
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./chunks/async-node-BYHuGTni.cjs');
|
|
4
|
+
var browser = require('./browser.cjs');
|
|
5
|
+
var asyncCore = require('./chunks/async-core-UqHzvJ-S.cjs');
|
|
6
|
+
require('node:async_hooks');
|
|
7
|
+
require('./chunks/async-browser-CA0jPWIi.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.AZone = browser.AZone;
|
|
12
|
+
exports.ArrayReadForward = browser.ArrayReadForward;
|
|
13
|
+
exports.DecoratorError = browser.DecoratorError;
|
|
14
|
+
exports.Destroyable = browser.Destroyable;
|
|
15
|
+
exports.DestructionError = browser.DestructionError;
|
|
16
|
+
exports.Eventful = browser.Eventful;
|
|
17
|
+
exports.FoolProof = browser.FoolProof;
|
|
18
|
+
exports.Indexable = browser.Indexable;
|
|
19
|
+
exports.IterableWeakMap = browser.IterableWeakMap;
|
|
20
|
+
exports.IterableWeakSet = browser.IterableWeakSet;
|
|
21
|
+
exports.ReactiveBase = browser.ReactiveBase;
|
|
22
|
+
exports.ReactiveError = browser.ReactiveError;
|
|
23
|
+
Object.defineProperty(exports, "ReactiveErrorCode", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return browser.ReactiveErrorCode; }
|
|
26
|
+
});
|
|
27
|
+
exports.Register = browser.Register;
|
|
28
|
+
exports.Zone = browser.Zone;
|
|
29
|
+
exports.ZoneAggregator = browser.ZoneAggregator;
|
|
30
|
+
exports.ZoneHistory = browser.ZoneHistory;
|
|
31
|
+
exports.addBatchCleanup = browser.addBatchCleanup;
|
|
32
|
+
exports.allocated = browser.allocated;
|
|
33
|
+
exports.allocatedValues = browser.allocatedValues;
|
|
34
|
+
exports.arrayEquals = browser.arrayEquals;
|
|
35
|
+
exports.asyncZone = browser.asyncZone;
|
|
36
|
+
exports.atomic = browser.atomic;
|
|
37
|
+
exports.biDi = browser.biDi;
|
|
38
|
+
exports.buildReactivityGraph = browser.buildReactivityGraph;
|
|
39
|
+
exports.cache = browser.cache;
|
|
40
|
+
exports.cached = browser.cached;
|
|
41
|
+
exports.callOnGC = browser.callOnGC;
|
|
42
|
+
exports.chainPromise = browser.chainPromise;
|
|
43
|
+
exports.cleanedBy = browser.cleanedBy;
|
|
44
|
+
exports.cleanup = browser.cleanup;
|
|
45
|
+
exports.contentRef = browser.contentRef;
|
|
46
|
+
exports.debounce = browser.debounce;
|
|
47
|
+
exports.decorator = browser.decorator;
|
|
48
|
+
exports.deepCompare = browser.deepCompare;
|
|
49
|
+
exports.deepWatch = browser.deepWatch;
|
|
50
|
+
exports.defer = browser.defer;
|
|
51
|
+
exports.deprecated = browser.deprecated;
|
|
52
|
+
exports.derived = browser.derived;
|
|
53
|
+
exports.describe = browser.describe;
|
|
54
|
+
exports.destructor = browser.destructor;
|
|
55
|
+
exports.effect = browser.effect;
|
|
56
|
+
exports.effectAggregator = browser.effectAggregator;
|
|
57
|
+
exports.enableDevTools = browser.enableDevTools;
|
|
58
|
+
exports.forwardArray = browser.forwardArray;
|
|
59
|
+
exports.getActivationLog = browser.getActivationLog;
|
|
60
|
+
exports.getActiveEffect = browser.getActiveEffect;
|
|
61
|
+
exports.getActiveProjection = browser.getActiveProjection;
|
|
62
|
+
exports.getAt = browser.getAt;
|
|
63
|
+
exports.getState = browser.getState;
|
|
64
|
+
exports.immutables = browser.immutables;
|
|
65
|
+
exports.isCached = browser.isCached;
|
|
66
|
+
exports.isConstructor = browser.isConstructor;
|
|
67
|
+
exports.isDevtoolsEnabled = browser.isDevtoolsEnabled;
|
|
68
|
+
exports.isNonReactive = browser.isNonReactive;
|
|
69
|
+
exports.isOwnAccessor = browser.isOwnAccessor;
|
|
70
|
+
exports.isReactive = browser.isReactive;
|
|
71
|
+
exports.legacyDecorator = browser.legacyDecorator;
|
|
72
|
+
exports.memoize = browser.memoize;
|
|
73
|
+
exports.mixin = browser.mixin;
|
|
74
|
+
exports.modernDecorator = browser.modernDecorator;
|
|
75
|
+
exports.named = browser.named;
|
|
76
|
+
exports.organize = browser.organize;
|
|
77
|
+
exports.organized = browser.organized;
|
|
78
|
+
exports.profileInfo = browser.profileInfo;
|
|
79
|
+
exports.project = browser.project;
|
|
80
|
+
exports.reactive = browser.reactive;
|
|
81
|
+
exports.reactiveOptions = browser.reactiveOptions;
|
|
82
|
+
exports.register = browser.register;
|
|
83
|
+
exports.registerEffectForDebug = browser.registerEffectForDebug;
|
|
84
|
+
exports.registerNativeReactivity = browser.registerNativeReactivity;
|
|
85
|
+
exports.registerObjectForDebug = browser.registerObjectForDebug;
|
|
86
|
+
exports.renamed = browser.renamed;
|
|
87
|
+
exports.resolve = browser.resolve;
|
|
88
|
+
exports.root = browser.root;
|
|
89
|
+
exports.scan = browser.scan;
|
|
90
|
+
exports.setAt = browser.setAt;
|
|
91
|
+
exports.setEffectName = browser.setEffectName;
|
|
92
|
+
exports.setObjectName = browser.setObjectName;
|
|
93
|
+
exports.tag = browser.tag;
|
|
94
|
+
exports.throttle = browser.throttle;
|
|
95
|
+
exports.touched = browser.touched;
|
|
96
|
+
exports.touched1 = browser.touched1;
|
|
97
|
+
exports.trackEffect = browser.trackEffect;
|
|
98
|
+
exports.unreactive = browser.unreactive;
|
|
99
|
+
exports.untracked = browser.untracked;
|
|
100
|
+
exports.unwrap = browser.unwrap;
|
|
101
|
+
exports.watch = browser.watch;
|
|
102
|
+
exports.zip = browser.zip;
|
|
103
|
+
exports.asyncHook = asyncCore.asyncHook;
|
|
104
|
+
exports.asyncHooks = asyncCore.asyncHooks;
|
|
105
|
+
//# sourceMappingURL=node.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/node.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { };
|
|
1
|
+
export { AZone, ArrayReadForward, ContextManager, Decorator, DecoratorDescription, DecoratorError, DecoratorFactory, DependencyAccess, Destroyable, DestructionError, Eventful, EventsBase, Evolution, FoolProof, FunctionWrapper, GenericClassDecorator, Hook, Indexable, IterableWeakMap, IterableWeakSet, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, PromiseChain, ReactiveBase, ReactiveError, ReactiveErrorCode, ReactivityGraph, Register, Restorer, ScanResult, ScopedCallback, Zone, ZoneAggregator, ZoneHistory, addBatchCleanup, allocated, allocatedValues, arrayEquals, asyncHook, asyncHooks, asyncZone, atomic, biDi, buildReactivityGraph, cache, cached, callOnGC, chainPromise, cleanedBy, cleanup, contentRef, debounce, decorator, deepCompare, deepWatch, defer, deprecated, derived, describe, destructor, effect, effectAggregator, enableDevTools, forwardArray, getActivationLog, getActiveEffect, getActiveProjection, getAt, getState, immutables, isCached, isConstructor, isDevtoolsEnabled, isNonReactive, isOwnAccessor, isReactive, legacyDecorator, memoize, mixin, modernDecorator, named, organize, organized, profileInfo, project, reactive, reactiveOptions, register, registerEffectForDebug, registerNativeReactivity, registerObjectForDebug, renamed, resolve, root, scan, setAt, setEffectName, setObjectName, tag, throttle, touched, touched1, trackEffect, unreactive, untracked, unwrap, watch, zip } from './browser.js';
|
package/dist/node.esm.js
CHANGED
|
@@ -1,45 +1,104 @@
|
|
|
1
1
|
import { createHook } from 'node:async_hooks';
|
|
2
|
-
import { a as asyncHooks } from './chunks/index-
|
|
3
|
-
export { A as AZone, b as ArrayReadForward, D as DecoratorError, c as Destroyable, d as DestructionError, E as Eventful, F as FoolProof, I as Indexable, e as IterableWeakMap, f as IterableWeakSet, R as ReactiveBase, g as ReactiveError, h as ReactiveErrorCode, i as Register, Z as Zone, j as ZoneAggregator, k as ZoneHistory, l as addBatchCleanup, m as allocated, n as allocatedValues, o as arrayEquals, p as
|
|
2
|
+
import { a as asyncHooks } from './chunks/index-DhaOVusv.esm.js';
|
|
3
|
+
export { A as AZone, b as ArrayReadForward, D as DecoratorError, c as Destroyable, d as DestructionError, E as Eventful, F as FoolProof, I as Indexable, e as IterableWeakMap, f as IterableWeakSet, R as ReactiveBase, g as ReactiveError, h as ReactiveErrorCode, i as Register, Z as Zone, j as ZoneAggregator, k as ZoneHistory, l as addBatchCleanup, m as allocated, n as allocatedValues, o as arrayEquals, p as asyncHook, q as asyncZone, r as atomic, s as biDi, t as buildReactivityGraph, u as cache, v as cached, w as callOnGC, x as chainPromise, y as cleanedBy, z as cleanup, B as contentRef, C as debounce, G as decorator, H as deepCompare, J as deepWatch, K as defer, L as deprecated, M as derived, N as describe, O as destructor, P as effect, Q as effectAggregator, S as enableDevTools, T as forwardArray, U as getActivationLog, V as getActiveEffect, W as getActiveProjection, X as getAt, Y as getState, _ as immutables, $ as isCached, a0 as isConstructor, a1 as isDevtoolsEnabled, a2 as isNonReactive, a3 as isOwnAccessor, a4 as isReactive, a5 as legacyDecorator, a6 as memoize, a7 as mixin, a8 as modernDecorator, a9 as named, aa as organize, ab as organized, ac as profileInfo, ad as project, ae as reactive, af as reactiveOptions, ag as register, ah as registerEffectForDebug, ai as registerNativeReactivity, aj as registerObjectForDebug, ak as renamed, al as resolve, am as root, an as scan, ao as setAt, ap as setEffectName, aq as setObjectName, ar as tag, as as throttle, at as touched, au as touched1, av as trackEffect, aw as unreactive, ax as untracked, ay as unwrap, az as watch, aA as zip } from './chunks/index-DhaOVusv.esm.js';
|
|
4
4
|
|
|
5
|
+
// 1. Generic async_hooks implementation for Hooks
|
|
6
|
+
// This maintains support for 'asyncHooks.addHook' for generic use cases.
|
|
5
7
|
const hooks = new Set();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
asyncHooks.addHook = function (hook) {
|
|
9
|
+
hooks.add(hook);
|
|
10
|
+
return () => {
|
|
11
|
+
hooks.delete(hook);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const contexts = new Map();
|
|
15
|
+
const activeUndoers = new Map();
|
|
16
|
+
// Helper to capture current hooks state
|
|
17
|
+
function captureRestorers() {
|
|
18
|
+
if (hooks.size === 0)
|
|
19
|
+
return [];
|
|
20
|
+
const restorers = [];
|
|
21
|
+
for (const h of hooks) {
|
|
22
|
+
const r = h();
|
|
23
|
+
if (r)
|
|
24
|
+
restorers.push(r);
|
|
25
|
+
}
|
|
26
|
+
return restorers;
|
|
27
|
+
}
|
|
28
|
+
// Manual Wrap function to handle Promise callbacks
|
|
29
|
+
function wrap(fn) {
|
|
30
|
+
if (typeof fn !== 'function')
|
|
31
|
+
return fn;
|
|
32
|
+
const restorers = captureRestorers();
|
|
33
|
+
if (restorers.length === 0)
|
|
34
|
+
return fn;
|
|
35
|
+
return function (...args) {
|
|
36
|
+
const undoers = [];
|
|
37
|
+
for (const restore of restorers) {
|
|
38
|
+
const u = restore();
|
|
39
|
+
if (u)
|
|
40
|
+
undoers.push(u);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return fn.apply(this, args);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
for (let i = undoers.length - 1; i >= 0; i--)
|
|
47
|
+
undoers[i]();
|
|
13
48
|
}
|
|
14
|
-
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const hook = createHook({
|
|
52
|
+
init(asyncId, type, triggerId, resource) {
|
|
53
|
+
// Used for native resources like Timers
|
|
54
|
+
const restorers = captureRestorers();
|
|
55
|
+
if (restorers.length > 0)
|
|
56
|
+
contexts.set(asyncId, restorers);
|
|
15
57
|
},
|
|
16
58
|
before(asyncId) {
|
|
17
|
-
const restorers =
|
|
18
|
-
if (restorers)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
59
|
+
const restorers = contexts.get(asyncId);
|
|
60
|
+
if (!restorers)
|
|
61
|
+
return;
|
|
62
|
+
const undoers = [];
|
|
63
|
+
for (const restore of restorers) {
|
|
64
|
+
const u = restore();
|
|
65
|
+
if (u)
|
|
66
|
+
undoers.push(u);
|
|
24
67
|
}
|
|
68
|
+
if (undoers.length > 0)
|
|
69
|
+
activeUndoers.set(asyncId, undoers);
|
|
25
70
|
},
|
|
26
71
|
after(asyncId) {
|
|
27
|
-
const undoers =
|
|
28
|
-
if (undoers)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
72
|
+
const undoers = activeUndoers.get(asyncId);
|
|
73
|
+
if (!undoers)
|
|
74
|
+
return;
|
|
75
|
+
for (let i = undoers.length - 1; i >= 0; i--)
|
|
76
|
+
undoers[i]();
|
|
77
|
+
activeUndoers.delete(asyncId);
|
|
33
78
|
},
|
|
34
79
|
destroy(asyncId) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
80
|
+
contexts.delete(asyncId);
|
|
81
|
+
activeUndoers.delete(asyncId);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
hook.enable();
|
|
85
|
+
// 2. Shadow Promise Implementation
|
|
86
|
+
// Ensures V8 await resumptions are visible as .then callbacks, wrapping them to restore context.
|
|
87
|
+
const OriginalPromise = globalThis.Promise;
|
|
88
|
+
const originalMethods = {
|
|
89
|
+
then: OriginalPromise.prototype.then,
|
|
90
|
+
catch: OriginalPromise.prototype.catch,
|
|
91
|
+
finally: OriginalPromise.prototype.finally};
|
|
92
|
+
// Patch prototype
|
|
93
|
+
OriginalPromise.prototype.then = function (onFulfilled, onRejected) {
|
|
94
|
+
return originalMethods.then.call(this, wrap(onFulfilled), wrap(onRejected));
|
|
95
|
+
};
|
|
96
|
+
OriginalPromise.prototype.catch = function (onRejected) {
|
|
97
|
+
return originalMethods.catch.call(this, wrap(onRejected));
|
|
44
98
|
};
|
|
99
|
+
OriginalPromise.prototype.finally = function (onFinally) {
|
|
100
|
+
return originalMethods.finally.call(this, wrap(onFinally));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { asyncHooks };
|
|
45
104
|
//# sourceMappingURL=node.esm.js.map
|
package/dist/node.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.esm.js","sources":["../src/async/node.ts"],"sourcesContent":["import { createHook } from 'node:async_hooks'\nimport { Hook, Restorer, asyncHooks } from '.'\n\nconst hooks = new Set<Hook>()\nconst
|
|
1
|
+
{"version":3,"file":"node.esm.js","sources":["../src/async/node.ts"],"sourcesContent":["import { createHook } from 'node:async_hooks'\nimport { Hook, Restorer, asyncHooks } from '.'\n\n// 1. Generic async_hooks implementation for Hooks\n// This maintains support for 'asyncHooks.addHook' for generic use cases.\n\nconst hooks = new Set<Hook>()\nasyncHooks.addHook = function (hook: Hook) {\n\thooks.add(hook)\n\treturn () => {\n\t\thooks.delete(hook)\n\t}\n}\n\nconst contexts = new Map<number, Restorer[]>()\nconst activeUndoers = new Map<number, (() => void)[]>()\n\n// Helper to capture current hooks state\nfunction captureRestorers() {\n\tif (hooks.size === 0) return []\n\tconst restorers: Restorer[] = []\n\tfor (const h of hooks) {\n\t\tconst r = h()\n\t\tif (r) restorers.push(r)\n\t}\n\treturn restorers\n}\n\n// Manual Wrap function to handle Promise callbacks\nfunction wrap<Args extends any[], R>(fn: ((...args: Args) => R) | null | undefined) {\n\tif (typeof fn !== 'function') return fn\n\tconst restorers = captureRestorers()\n\tif (restorers.length === 0) return fn\n\n\treturn function (this: any, ...args: Args) {\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) {\n\t\t\tconst u = restore()\n\t\t\tif (u) undoers.push(u)\n\t\t}\n\t\ttry {\n\t\t\treturn fn.apply(this, args)\n\t\t} finally {\n\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t}\n\t}\n}\n\nconst hook = createHook({\n\tinit(asyncId, type, triggerId, resource) {\n\t\t// Used for native resources like Timers\n\t\tconst restorers = captureRestorers()\n\t\tif (restorers.length > 0) contexts.set(asyncId, restorers)\n\t},\n\tbefore(asyncId) {\n\t\tconst restorers = contexts.get(asyncId)\n\t\tif (!restorers) return\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) {\n\t\t\tconst u = restore()\n\t\t\tif (u) undoers.push(u)\n\t\t}\n\t\tif (undoers.length > 0) activeUndoers.set(asyncId, undoers)\n\t},\n\tafter(asyncId) {\n\t\tconst undoers = activeUndoers.get(asyncId)\n\t\tif (!undoers) return\n\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\tactiveUndoers.delete(asyncId)\n\t},\n\tdestroy(asyncId) {\n\t\tcontexts.delete(asyncId)\n\t\tactiveUndoers.delete(asyncId)\n\t},\n})\nhook.enable()\n\n// 2. Shadow Promise Implementation\n// Ensures V8 await resumptions are visible as .then callbacks, wrapping them to restore context.\n\nconst OriginalPromise = globalThis.Promise\nconst originalMethods = {\n\tthen: OriginalPromise.prototype.then,\n\tcatch: OriginalPromise.prototype.catch,\n\tfinally: OriginalPromise.prototype.finally,\n\tresolve: OriginalPromise.resolve,\n\treject: OriginalPromise.reject,\n\tall: OriginalPromise.all,\n}\n\n\n\n// Patch prototype\nOriginalPromise.prototype.then = function(onFulfilled, onRejected) {\n\treturn originalMethods.then.call(this, wrap(onFulfilled), wrap(onRejected))\n} as any\nOriginalPromise.prototype.catch = function(onRejected) {\n\treturn originalMethods.catch.call(this, wrap(onRejected))\n} as any\nOriginalPromise.prototype.finally = function(onFinally) {\n\treturn originalMethods.finally.call(this, wrap(onFinally))\n} as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MAAM,CAAC,OAAO,CAAC;IAC9B,CAAC;AACD,IAAA,OAAO,CAAC,OAAO,EAAA;AACd,QAAA,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;AACxB,QAAA,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;IAC9B,CAAC;AACD,CAAA,CAAC;AACF,IAAI,CAAC,MAAM,EAAE;AAEb;AACA;AAEA,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO;AAC1C,MAAM,eAAe,GAAG;AACvB,IAAA,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,IAAI;AACpC,IAAA,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK;AACtC,IAAA,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,QAInC;AAID;AACA,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG,UAAS,WAAW,EAAE,UAAU,EAAA;AAChE,IAAA,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5E,CAAQ;AACR,eAAe,CAAC,SAAS,CAAC,KAAK,GAAG,UAAS,UAAU,EAAA;AACpD,IAAA,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAQ;AACR,eAAe,CAAC,SAAS,CAAC,OAAO,GAAG,UAAS,SAAS,EAAA;AACrD,IAAA,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAC3D,CAAQ;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Resolved<T> = T extends Promise<infer U> ? Resolved<U> : T extends (...args: infer Args) => infer R ? (...args: Args) => Resolved<R> : T extends object ? {
|
|
2
|
+
[k in keyof T]: k extends 'then' | 'catch' | 'finally' ? T[k] : Resolved<T[k]>;
|
|
3
|
+
} : T;
|
|
4
|
+
type PromiseAnd<T> = Resolved<T> & Promise<Resolved<T>>;
|
|
5
|
+
/**
|
|
6
|
+
* Type that transforms promises into chainable objects
|
|
7
|
+
* Allows calling methods directly on promise results without awaiting them first
|
|
8
|
+
*/
|
|
9
|
+
export type PromiseChain<T> = T extends (...args: infer Args) => infer R ? PromiseAnd<(...args: Args) => PromiseChain<Resolved<R>>> : T extends object ? PromiseAnd<{
|
|
10
|
+
[k in keyof T]: k extends 'then' | 'catch' | 'finally' ? T[k] : PromiseChain<Resolved<T[k]>>;
|
|
11
|
+
}> : Promise<Resolved<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Transforms a promise or value into a chainable object
|
|
14
|
+
* Allows calling methods directly on promise results without awaiting them first
|
|
15
|
+
* @param given - The promise or value to make chainable
|
|
16
|
+
* @returns A chainable version of the input
|
|
17
|
+
*/
|
|
18
|
+
export declare function chainPromise<T>(given: Promise<T> | T): PromiseChain<T>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=promiseChain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseChain.d.ts","sourceRoot":"","sources":["../src/promiseChain.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,IACd,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GACvB,QAAQ,CAAC,CAAC,CAAC,GACX,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,MAAM,CAAC,GACzC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAC9B,CAAC,SAAS,MAAM,GACf;KACC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9E,GACA,CAAC,CAAA;AACP,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACvD;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,MAAM,CAAC,GACrE,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GACxD,CAAC,SAAS,MAAM,GACf,UAAU,CAAC;KACV,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5F,CAAC,GACD,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AA6DxB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAqBtE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare abstract class Indexer extends Array {
|
|
2
|
+
get(i: number): any;
|
|
3
|
+
set(i: number, value: any): void;
|
|
4
|
+
getLength(): number;
|
|
5
|
+
setLength(value: number): void;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class ReactiveArray extends Array {
|
|
8
|
+
toJSON(): this;
|
|
9
|
+
get [Symbol.toStringTag](): string;
|
|
10
|
+
at(index: number): any;
|
|
11
|
+
toReversed(): any[];
|
|
12
|
+
toSorted(compareFn?: (a: any, b: any) => number): any[];
|
|
13
|
+
toSpliced(start: number, deleteCount?: number, ...items: any[]): any[];
|
|
14
|
+
with(index: number, value: any): any[];
|
|
15
|
+
entries(): any;
|
|
16
|
+
keys(): any;
|
|
17
|
+
values(): any;
|
|
18
|
+
[Symbol.iterator](): ArrayIterator<any>;
|
|
19
|
+
indexOf(searchElement: any, fromIndex?: number): number;
|
|
20
|
+
lastIndexOf(searchElement: any, fromIndex?: number): number;
|
|
21
|
+
includes(searchElement: any, fromIndex?: number): boolean;
|
|
22
|
+
find(predicate: (this: any, value: any, index: number, obj: any[]) => boolean, thisArg?: any): any;
|
|
23
|
+
find(searchElement: any, fromIndex?: number): any;
|
|
24
|
+
findIndex(predicate: (this: any, value: any, index: number, obj: any[]) => boolean, thisArg?: any): number;
|
|
25
|
+
findIndex(searchElement: any, fromIndex?: number): number;
|
|
26
|
+
flat(depth?: number): any[];
|
|
27
|
+
flatMap(callbackfn: (this: any, value: any, index: number, array: any[]) => any[], thisArg?: any): any[];
|
|
28
|
+
filter(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): any[];
|
|
29
|
+
map(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[];
|
|
30
|
+
reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any;
|
|
31
|
+
reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any;
|
|
32
|
+
slice(start?: number, end?: number): any[];
|
|
33
|
+
concat(...items: any[]): any[];
|
|
34
|
+
join(separator?: string): string;
|
|
35
|
+
forEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void;
|
|
36
|
+
every<S>(predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): this is S[];
|
|
37
|
+
every(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean;
|
|
38
|
+
some(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean;
|
|
39
|
+
push(...items: any[]): any;
|
|
40
|
+
pop(): any;
|
|
41
|
+
shift(): any;
|
|
42
|
+
unshift(...items: any[]): any;
|
|
43
|
+
splice(start: number, deleteCount?: number, ...items: any[]): any;
|
|
44
|
+
reverse(): any;
|
|
45
|
+
sort(compareFn?: (a: any, b: any) => number): any;
|
|
46
|
+
fill(value: any, start?: number, end?: number): any;
|
|
47
|
+
copyWithin(target: number, start: number, end?: number): any;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/reactive/array.ts"],"names":[],"mappings":"AAsBA,8BAAsB,OAAQ,SAAQ,KAAK;IAC1C,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG;IAInB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAKzB,SAAS;IAIT,SAAS,CAAC,KAAK,EAAE,MAAM;CAQvB;AAqBD,8BAAsB,aAAc,SAAQ,KAAK;IAChD,MAAM;IAGN,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG;IAStB,UAAU,IAAI,GAAG,EAAE;IAKnB,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE;IAKvD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAOtE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,EAAE;IAMtC,OAAO;IAKP,IAAI;IAKJ,MAAM;IAKN,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC;IAkBvC,OAAO,CAAC,aAAa,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAmBvD,WAAW,CAAC,aAAa,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,M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AE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO;IAc9F,IAAI,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE;IAapB,GAAG;IASH,KAAK;IASL,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE;IAYvB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE;IAgC3D,OAAO;IAQP,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM;IAS3C,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAqB7C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;CA+BtD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cleanup } from './interface';
|
|
2
|
+
import type { ScopedCallback } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Result of a reactive scan, which is a reactive array of accumulated values
|
|
5
|
+
* with an attached cleanup function.
|
|
6
|
+
*/
|
|
7
|
+
export type ScanResult<Output> = readonly Output[] & {
|
|
8
|
+
[cleanup]: ScopedCallback;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Perform a reactive scan over an array of items.
|
|
12
|
+
*
|
|
13
|
+
* This implementation is highly optimized for performance and fine-grained reactivity:
|
|
14
|
+
* - **Incremental Updates**: Changes to an item only trigger re-computation from that
|
|
15
|
+
* point onwards in the result chain.
|
|
16
|
+
* - **Move Optimization**: If items are moved within the array, their accumulated
|
|
17
|
+
* values are reused as long as their predecessor remains the same.
|
|
18
|
+
* - **Duplicate Support**: Correctly handles multiple occurrences of the same object
|
|
19
|
+
* instance using an internal occurrence tracking mechanism.
|
|
20
|
+
* - **Memory Efficient**: Uses `WeakMap` for caching intermediates, which are
|
|
21
|
+
* automatically cleared when source items are garbage collected.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const source = reactive([{ val: 1 }, { val: 2 }, { val: 3 }])
|
|
26
|
+
* const sum = scan(source, (acc, item) => acc + item.val, 0)
|
|
27
|
+
*
|
|
28
|
+
* expect([...sum]).toEqual([1, 3, 6])
|
|
29
|
+
*
|
|
30
|
+
* // Modifying an item only re-computes subsequent sums
|
|
31
|
+
* source[1].val = 10
|
|
32
|
+
* expect([...sum]).toEqual([1, 11, 14])
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param source The source array of objects (will be made reactive)
|
|
36
|
+
* @param callback The accumulator function called with (accumulator, currentItem)
|
|
37
|
+
* @param initialValue The starting value for the accumulation
|
|
38
|
+
* @returns A reactive array of accumulated values, with a [cleanup] property to stop the tracking
|
|
39
|
+
*/
|
|
40
|
+
export declare function scan<Input extends object, Output>(source: readonly Input[], callback: (acc: Output, val: Input) => Output, initialValue: Output): ScanResult<Output>;
|
|
41
|
+
export declare function resolve<Output>(cb: () => Output[]): Output[] & {
|
|
42
|
+
[cleanup]: ScopedCallback;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/reactive/buffer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,IAAI,SAAS,MAAM,EAAE,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,IAAI,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,EAChD,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,KAAK,MAAM,EAC7C,YAAY,EAAE,MAAM,GAClB,UAAU,CAAC,MAAM,CAAC,CA8GpB;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAQ5F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Evolution, type ScopedCallback, type State } from './types';
|
|
2
|
+
export declare function addState(obj: any, evolution: Evolution): void;
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current state of a reactive object for evolution tracking
|
|
5
|
+
* @param obj - The reactive object
|
|
6
|
+
* @returns The current state object
|
|
7
|
+
*/
|
|
8
|
+
export declare function getState(obj: any): State;
|
|
9
|
+
export declare function collectEffects(obj: any, evolution: Evolution, effects: Set<ScopedCallback>, objectWatchers: Map<any, Set<ScopedCallback>>, ...keyChains: Iterable<any>[]): void;
|
|
10
|
+
/**
|
|
11
|
+
* Triggers effects for a single property change
|
|
12
|
+
* @param obj - The object that changed
|
|
13
|
+
* @param evolution - The type of change
|
|
14
|
+
* @param prop - The property that changed
|
|
15
|
+
*/
|
|
16
|
+
export declare function touched1(obj: any, evolution: Evolution, prop: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Triggers effects for property changes
|
|
19
|
+
* @param obj - The object that changed
|
|
20
|
+
* @param evolution - The type of change
|
|
21
|
+
* @param props - The properties that changed
|
|
22
|
+
*/
|
|
23
|
+
export declare function touched(obj: any, evolution: Evolution, props?: Iterable<any>): void;
|
|
24
|
+
/**
|
|
25
|
+
* Triggers only opaque effects for property changes
|
|
26
|
+
* Used by deep-touch to ensure opaque listeners are notified even when deep optimization is active
|
|
27
|
+
*/
|
|
28
|
+
export declare function touchedOpaque(obj: any, evolution: Evolution, prop: any): void;
|
|
29
|
+
//# sourceMappingURL=change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/reactive/change.ts"],"names":[],"mappings":"AAMA,OAAO,EAAY,KAAK,SAAS,EAAW,KAAK,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAI5F,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,QAMtD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,SAQhC;AAED,wBAAgB,cAAc,CAC7B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,EAC5B,cAAc,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAC7C,GAAG,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAyB7B;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,QAEjE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,QAiB5E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,QAiCtE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug utilities for the reactivity system
|
|
3
|
+
* - Captures effect metadata (names, parent relationships)
|
|
4
|
+
* - Records cause → consequence edges with object/prop labels
|
|
5
|
+
* - Provides graph data for tooling (DevTools panel, etc.)
|
|
6
|
+
*/
|
|
7
|
+
import { type Evolution, type ScopedCallback } from './types';
|
|
8
|
+
export type NodeKind = 'effect' | 'external' | 'state';
|
|
9
|
+
export type EdgeKind = 'cause' | 'dependency' | 'trigger';
|
|
10
|
+
export interface EffectNode {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
type: NodeKind;
|
|
14
|
+
depth: number;
|
|
15
|
+
parentId?: string;
|
|
16
|
+
debugName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ObjectNode {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
type: NodeKind;
|
|
22
|
+
debugName?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GraphEdge {
|
|
25
|
+
id: string;
|
|
26
|
+
source: string;
|
|
27
|
+
target: string;
|
|
28
|
+
type: EdgeKind;
|
|
29
|
+
label: string;
|
|
30
|
+
count?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ReactivityGraph {
|
|
33
|
+
nodes: Array<EffectNode | ObjectNode>;
|
|
34
|
+
edges: GraphEdge[];
|
|
35
|
+
meta: {
|
|
36
|
+
generatedAt: number;
|
|
37
|
+
devtoolsEnabled: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Assign a debug-friendly name to an effect (shown in DevTools)
|
|
42
|
+
*/
|
|
43
|
+
export declare function setEffectName(effect: ScopedCallback, name: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Assign a debug-friendly name to a reactive object
|
|
46
|
+
*/
|
|
47
|
+
export declare function setObjectName(obj: object, name: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Register an effect so it appears in the DevTools graph
|
|
50
|
+
*/
|
|
51
|
+
export declare function registerEffectForDebug(effect: ScopedCallback): void;
|
|
52
|
+
/**
|
|
53
|
+
* Register a reactive object so it appears in the DevTools graph
|
|
54
|
+
*/
|
|
55
|
+
export declare function registerObjectForDebug(obj: object): void;
|
|
56
|
+
/**
|
|
57
|
+
* Records a cause → consequence relationship between effects.
|
|
58
|
+
* @param source - The effect performing the write (undefined if external/user input)
|
|
59
|
+
* @param target - The effect that re-ran because of the write
|
|
60
|
+
* @param obj - The reactive object that changed
|
|
61
|
+
* @param prop - The property that changed
|
|
62
|
+
* @param evolution - The type of change (set/add/del/bunch)
|
|
63
|
+
*/
|
|
64
|
+
export declare function recordTriggerLink(source: ScopedCallback | undefined, target: ScopedCallback, obj: object, prop: any, evolution: Evolution): void;
|
|
65
|
+
/**
|
|
66
|
+
* Traces back the chain of triggers that led to a specific effect
|
|
67
|
+
* @param effect The effect to trace back
|
|
68
|
+
* @param limit Max depth
|
|
69
|
+
*/
|
|
70
|
+
export declare function getTriggerChain(effect: ScopedCallback, limit?: number): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Builds a graph representing current reactive state (effects, objects, and trigger edges)
|
|
73
|
+
*/
|
|
74
|
+
export declare function buildReactivityGraph(): ReactivityGraph;
|
|
75
|
+
/**
|
|
76
|
+
* Enables the DevTools bridge and exposes the debug API on window.
|
|
77
|
+
* Call as early as possible in development builds.
|
|
78
|
+
*/
|
|
79
|
+
export declare function enableDevTools(): void;
|
|
80
|
+
export declare function forceEnableGraphTracking(): void;
|
|
81
|
+
export declare function isDevtoolsEnabled(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the raw dependency graph data structure.
|
|
84
|
+
* This is useful for programmatic analysis of the reactive system.
|
|
85
|
+
*/
|
|
86
|
+
export declare function getDependencyGraph(): {
|
|
87
|
+
nodes: (EffectNode | ObjectNode)[];
|
|
88
|
+
edges: GraphEdge[];
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Returns a list of effects that depend on the given object.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getDependents(obj: object): ScopedCallback[];
|
|
94
|
+
/**
|
|
95
|
+
* Returns a list of objects that the given effect depends on.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getDependencies(effect: ScopedCallback): object[];
|
|
98
|
+
export interface MutationRecord {
|
|
99
|
+
id: number;
|
|
100
|
+
timestamp: number;
|
|
101
|
+
source: string;
|
|
102
|
+
target: string;
|
|
103
|
+
objectName: string;
|
|
104
|
+
prop: string;
|
|
105
|
+
type: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get the recent mutation history
|
|
109
|
+
*/
|
|
110
|
+
export declare function getMutationHistory(): MutationRecord[];
|
|
111
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/reactive/debug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAY,KAAK,SAAS,EAAW,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AA6BhF,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAA;AACtD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAA;AAEzD,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,KAAK,CAAC,UA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E,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACZ;AA4BD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAErD"}
|
|
@@ -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,EAAY,KAAK,SAAS,EAAgC,MAAM,SAAS,CAAA;AAoBhF,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;AA2FD,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,EAAE,QA0DzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Evolution, ScopedCallback } 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<ScopedCallback>>;
|
|
8
|
+
export declare const effectToDeepWatchedObjects: WeakMap<ScopedCallback, 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,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxD,eAAO,MAAM,aAAa;YAAqC,MAAM;UAAQ,WAAW;GAAM,CAAA;AAG9F,eAAO,MAAM,uBAAuB,iBAAwB,CAAA;AAG5D,eAAO,MAAM,YAAY,sCAA6C,CAAA;AAGtE,eAAO,MAAM,0BAA0B,sCAA6C,CAAA;AAEpF;;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"}
|