mutts 1.0.3 → 1.0.5
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 +1 -1
- package/dist/chunks/{index-HNVqPzjz.js → index-Cvxdw6Ax.js} +230 -61
- package/dist/chunks/index-Cvxdw6Ax.js.map +1 -0
- package/dist/chunks/{index-DzUDtFc7.esm.js → index-qiWwozOc.esm.js} +228 -62
- package/dist/chunks/index-qiWwozOc.esm.js.map +1 -0
- package/dist/destroyable.esm.js.map +1 -1
- package/dist/destroyable.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- 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/reactive.d.ts +30 -1
- package/dist/reactive.esm.js +1 -1
- package/dist/reactive.js +4 -1
- package/dist/reactive.js.map +1 -1
- package/dist/std-decorators.esm.js.map +1 -1
- package/dist/std-decorators.js.map +1 -1
- package/docs/reactive/core.md +16 -16
- package/docs/reactive.md +7 -0
- package/package.json +1 -1
- package/src/destroyable.ts +2 -2
- package/src/reactive/array.ts +3 -5
- package/src/reactive/change.ts +6 -2
- package/src/reactive/effects.ts +132 -51
- package/src/reactive/index.ts +3 -1
- package/src/reactive/interface.ts +1 -1
- package/src/reactive/map.ts +6 -6
- package/src/reactive/mapped.ts +2 -3
- package/src/reactive/project.ts +103 -6
- package/src/reactive/proxy.ts +5 -1
- package/src/reactive/set.ts +6 -6
- package/src/reactive/types.ts +22 -0
- package/src/reactive/zone.ts +1 -1
- package/src/std-decorators.ts +1 -1
- package/dist/chunks/index-DzUDtFc7.esm.js.map +0 -1
- package/dist/chunks/index-HNVqPzjz.js.map +0 -1
- /package/{src/reactive/project.project.md → docs/reactive/project.md} +0 -0
|
@@ -352,6 +352,10 @@ const prototypeForwarding = Symbol('prototype-forwarding');
|
|
|
352
352
|
* Symbol representing all properties in reactive tracking
|
|
353
353
|
*/
|
|
354
354
|
const allProps = Symbol('all-props');
|
|
355
|
+
/**
|
|
356
|
+
* Symbol for accessing projection information on reactive objects
|
|
357
|
+
*/
|
|
358
|
+
const projectionInfo = Symbol('projection-info');
|
|
355
359
|
// Symbol to mark functions with their root function
|
|
356
360
|
const rootFunction = Symbol('root-function');
|
|
357
361
|
/**
|
|
@@ -426,6 +430,12 @@ const options = {
|
|
|
426
430
|
* @default 100
|
|
427
431
|
*/
|
|
428
432
|
maxEffectChain: 100,
|
|
433
|
+
/**
|
|
434
|
+
* Maximum number of times an effect can be triggered by the same cause in a single batch
|
|
435
|
+
* Used to detect aggressive re-computation or infinite loops
|
|
436
|
+
* @default 10
|
|
437
|
+
*/
|
|
438
|
+
maxTriggerPerBatch: 10,
|
|
429
439
|
/**
|
|
430
440
|
* Debug purpose: maximum effect reaction (like call stack max depth)
|
|
431
441
|
* Used to prevent infinite loops
|
|
@@ -1258,6 +1268,50 @@ function formatRoots(roots, limit = 20) {
|
|
|
1258
1268
|
const end = names.slice(-10);
|
|
1259
1269
|
return `${start.join(' → ')} ... (${names.length - 15} more) ... ${end.join(' → ')}`;
|
|
1260
1270
|
}
|
|
1271
|
+
// Nested map structure for efficient counting and batch cleanup
|
|
1272
|
+
// batchId -> effect root -> obj -> prop -> count
|
|
1273
|
+
let activationRegistry;
|
|
1274
|
+
const activationLog = new Array(100);
|
|
1275
|
+
function getActivationLog() {
|
|
1276
|
+
return activationLog;
|
|
1277
|
+
}
|
|
1278
|
+
function recordActivation(effect, obj, evolution, prop) {
|
|
1279
|
+
const root = getRoot(effect);
|
|
1280
|
+
if (!activationRegistry)
|
|
1281
|
+
return;
|
|
1282
|
+
let effectData = activationRegistry.get(root);
|
|
1283
|
+
if (!effectData) {
|
|
1284
|
+
effectData = new Map();
|
|
1285
|
+
activationRegistry.set(root, effectData);
|
|
1286
|
+
}
|
|
1287
|
+
let objData = effectData.get(obj);
|
|
1288
|
+
if (!objData) {
|
|
1289
|
+
objData = new Map();
|
|
1290
|
+
effectData.set(obj, objData);
|
|
1291
|
+
}
|
|
1292
|
+
const count = (objData.get(prop) ?? 0) + 1;
|
|
1293
|
+
objData.set(prop, count);
|
|
1294
|
+
// Keep a limited history for diagnostics
|
|
1295
|
+
activationLog.unshift({
|
|
1296
|
+
effect,
|
|
1297
|
+
obj,
|
|
1298
|
+
evolution,
|
|
1299
|
+
prop,
|
|
1300
|
+
});
|
|
1301
|
+
activationLog.pop();
|
|
1302
|
+
if (count >= options.maxTriggerPerBatch) {
|
|
1303
|
+
const effectName = root?.name || 'anonymous';
|
|
1304
|
+
const message = `Aggressive trigger detected: effect "${effectName}" triggered ${count} times in the batch by the same cause.`;
|
|
1305
|
+
if (options.maxEffectReaction === 'throw') {
|
|
1306
|
+
throw new ReactiveError(message, {
|
|
1307
|
+
code: ReactiveErrorCode.MaxReactionExceeded,
|
|
1308
|
+
count,
|
|
1309
|
+
effect: effectName,
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
options.warn(`[reactive] ${message}`);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1261
1315
|
/**
|
|
1262
1316
|
* Registers a debug callback that is called when the current effect is triggered by a dependency change
|
|
1263
1317
|
*
|
|
@@ -1547,6 +1601,9 @@ function cleanupEffectFromGraph(effect) {
|
|
|
1547
1601
|
// Track currently executing effects to prevent re-execution
|
|
1548
1602
|
// These are all the effects triggered under `activeEffect`
|
|
1549
1603
|
let batchQueue;
|
|
1604
|
+
function hasBatched(effect) {
|
|
1605
|
+
return batchQueue?.all.has(getRoot(effect));
|
|
1606
|
+
}
|
|
1550
1607
|
const batchCleanups = new Set();
|
|
1551
1608
|
/**
|
|
1552
1609
|
* Computes and caches in-degrees for all effects in the batch
|
|
@@ -1953,21 +2010,29 @@ function batch(effect, immediate) {
|
|
|
1953
2010
|
addToBatch(effect[i], caller, immediate === 'immediate');
|
|
1954
2011
|
}
|
|
1955
2012
|
if (immediate) {
|
|
2013
|
+
const firstReturn = {};
|
|
1956
2014
|
// Execute immediately (before batch returns)
|
|
1957
2015
|
for (let i = 0; i < effect.length; i++) {
|
|
1958
2016
|
try {
|
|
1959
|
-
effect[i]();
|
|
2017
|
+
const rv = effect[i]();
|
|
2018
|
+
if (rv !== undefined && !('value' in firstReturn))
|
|
2019
|
+
firstReturn.value = rv;
|
|
1960
2020
|
}
|
|
1961
2021
|
finally {
|
|
1962
2022
|
const root = getRoot(effect[i]);
|
|
1963
2023
|
batchQueue.all.delete(root);
|
|
1964
2024
|
}
|
|
1965
2025
|
}
|
|
2026
|
+
return firstReturn.value;
|
|
1966
2027
|
}
|
|
1967
2028
|
// Otherwise, effects will be picked up in next executeNext() call
|
|
1968
2029
|
}
|
|
1969
2030
|
else {
|
|
1970
2031
|
// New batch - initialize
|
|
2032
|
+
if (!activationRegistry)
|
|
2033
|
+
activationRegistry = new Map();
|
|
2034
|
+
else
|
|
2035
|
+
throw new Error('Batch already in progress');
|
|
1971
2036
|
options.beginChain(roots);
|
|
1972
2037
|
batchQueue = {
|
|
1973
2038
|
all: new Map(),
|
|
@@ -2046,6 +2111,7 @@ function batch(effect, immediate) {
|
|
|
2046
2111
|
return firstReturn.value;
|
|
2047
2112
|
}
|
|
2048
2113
|
finally {
|
|
2114
|
+
activationRegistry = undefined;
|
|
2049
2115
|
batchQueue = undefined;
|
|
2050
2116
|
options.endChain();
|
|
2051
2117
|
}
|
|
@@ -2054,60 +2120,69 @@ function batch(effect, immediate) {
|
|
|
2054
2120
|
// Execute in dependency order
|
|
2055
2121
|
const firstReturn = {};
|
|
2056
2122
|
try {
|
|
2057
|
-
while
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
:
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2123
|
+
// Outer loop: continue while there are effects OR cleanups pending.
|
|
2124
|
+
// This ensures effects triggered by cleanups are not lost.
|
|
2125
|
+
while (batchQueue.all.size > 0 || batchCleanups.size > 0) {
|
|
2126
|
+
// Inner loop: execute all pending effects
|
|
2127
|
+
while (batchQueue.all.size > 0) {
|
|
2128
|
+
if (effectuatedRoots.length > options.maxEffectChain) {
|
|
2129
|
+
const cycle = findCycleInChain(effectuatedRoots);
|
|
2130
|
+
const trace = formatRoots(effectuatedRoots);
|
|
2131
|
+
const message = cycle
|
|
2132
|
+
? `Max effect chain reached (cycle detected: ${formatRoots(cycle)})`
|
|
2133
|
+
: `Max effect chain reached (trace: ${trace})`;
|
|
2134
|
+
const queuedRoots = batchQueue ? Array.from(batchQueue.all.keys()) : [];
|
|
2135
|
+
const queued = queuedRoots.map((r) => r.name || '<anonymous>');
|
|
2136
|
+
const debugInfo = {
|
|
2137
|
+
code: ReactiveErrorCode.MaxDepthExceeded,
|
|
2138
|
+
effectuatedRoots,
|
|
2139
|
+
cycle,
|
|
2140
|
+
trace,
|
|
2141
|
+
maxEffectChain: options.maxEffectChain,
|
|
2142
|
+
queued: queued.slice(0, 50),
|
|
2143
|
+
queuedCount: queued.length,
|
|
2144
|
+
// Try to get causation for the last effect
|
|
2145
|
+
causalChain: effectuatedRoots.length > 0
|
|
2146
|
+
? getTriggerChain(batchQueue.all.get(effectuatedRoots[effectuatedRoots.length - 1]))
|
|
2147
|
+
: [],
|
|
2148
|
+
};
|
|
2149
|
+
switch (options.maxEffectReaction) {
|
|
2150
|
+
case 'throw':
|
|
2151
|
+
throw new ReactiveError(`[reactive] ${message}`, debugInfo);
|
|
2152
|
+
case 'debug':
|
|
2153
|
+
// biome-ignore lint/suspicious/noDebugger: This is the whole point here
|
|
2154
|
+
debugger;
|
|
2155
|
+
throw new ReactiveError(`[reactive] ${message}`, debugInfo);
|
|
2156
|
+
case 'warn':
|
|
2157
|
+
options.warn(`[reactive] ${message} (queued: ${queued.slice(0, 10).join(', ')}${queued.length > 10 ? ', …' : ''})`);
|
|
2158
|
+
break;
|
|
2159
|
+
}
|
|
2089
2160
|
}
|
|
2161
|
+
const rv = executeNext(effectuatedRoots);
|
|
2162
|
+
// executeNext() returns null when batch is complete or cycle detected (throws error)
|
|
2163
|
+
// But functions can legitimately return null, so we check batchQueue.all.size instead
|
|
2164
|
+
if (batchQueue.all.size === 0) {
|
|
2165
|
+
// Batch complete
|
|
2166
|
+
break;
|
|
2167
|
+
}
|
|
2168
|
+
// If executeNext() returned null but batch is not empty, it means a cycle was detected
|
|
2169
|
+
// and an error was thrown, so we won't reach here
|
|
2170
|
+
if (rv !== undefined && !('value' in firstReturn))
|
|
2171
|
+
firstReturn.value = rv;
|
|
2172
|
+
// Note: executeNext() already removed it from batchQueue, so we track by count
|
|
2090
2173
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2174
|
+
// Process cleanups. If they trigger new effects, the outer loop will catch them.
|
|
2175
|
+
if (batchCleanups.size > 0) {
|
|
2176
|
+
const cleanups = Array.from(batchCleanups);
|
|
2177
|
+
batchCleanups.clear();
|
|
2178
|
+
for (const cleanup of cleanups)
|
|
2179
|
+
cleanup();
|
|
2097
2180
|
}
|
|
2098
|
-
// If executeNext() returned null but batch is not empty, it means a cycle was detected
|
|
2099
|
-
// and an error was thrown, so we won't reach here
|
|
2100
|
-
if (rv !== undefined && !('value' in firstReturn))
|
|
2101
|
-
firstReturn.value = rv;
|
|
2102
|
-
// Note: executeNext() already removed it from batchQueue, so we track by count
|
|
2103
2181
|
}
|
|
2104
|
-
const cleanups = Array.from(batchCleanups);
|
|
2105
|
-
batchCleanups.clear();
|
|
2106
|
-
for (const cleanup of cleanups)
|
|
2107
|
-
cleanup();
|
|
2108
2182
|
return firstReturn.value;
|
|
2109
2183
|
}
|
|
2110
2184
|
finally {
|
|
2185
|
+
activationRegistry = undefined;
|
|
2111
2186
|
batchQueue = undefined;
|
|
2112
2187
|
options.endChain();
|
|
2113
2188
|
}
|
|
@@ -2477,7 +2552,11 @@ function collectEffects(obj, evolution, effects, objectWatchers, ...keyChains) {
|
|
|
2477
2552
|
options.skipRunningEffect(effect, runningChain);
|
|
2478
2553
|
continue;
|
|
2479
2554
|
}
|
|
2480
|
-
effects.
|
|
2555
|
+
if (!effects.has(effect)) {
|
|
2556
|
+
effects.add(effect);
|
|
2557
|
+
if (!hasBatched(effect))
|
|
2558
|
+
recordActivation(effect, obj, evolution, key);
|
|
2559
|
+
}
|
|
2481
2560
|
const trackers = effectTrackers.get(effect);
|
|
2482
2561
|
recordTriggerLink(sourceEffect, effect, obj, key, evolution);
|
|
2483
2562
|
if (trackers) {
|
|
@@ -2545,6 +2624,7 @@ function touchedOpaque(obj, evolution, prop) {
|
|
|
2545
2624
|
continue;
|
|
2546
2625
|
}
|
|
2547
2626
|
effects.add(effect);
|
|
2627
|
+
recordActivation(effect, obj, evolution, prop);
|
|
2548
2628
|
const trackers = effectTrackers.get(effect);
|
|
2549
2629
|
recordTriggerLink(sourceEffect, effect, obj, prop, evolution);
|
|
2550
2630
|
if (trackers) {
|
|
@@ -2864,7 +2944,11 @@ const reactiveHandlers = {
|
|
|
2864
2944
|
dependant(current, prop);
|
|
2865
2945
|
if (Object.hasOwn(current, prop))
|
|
2866
2946
|
break;
|
|
2867
|
-
|
|
2947
|
+
let next = reactiveObject(Object.getPrototypeOf(current));
|
|
2948
|
+
if (next === current) {
|
|
2949
|
+
next = reactiveObject(Object.getPrototypeOf(unwrap(current)));
|
|
2950
|
+
}
|
|
2951
|
+
current = next;
|
|
2868
2952
|
}
|
|
2869
2953
|
}
|
|
2870
2954
|
const value = ReflectGet(obj, prop, receiver);
|
|
@@ -3329,7 +3413,6 @@ function* makeReactiveEntriesIterator(iterator) {
|
|
|
3329
3413
|
const native$2 = Symbol('native');
|
|
3330
3414
|
const isArray = Array.isArray;
|
|
3331
3415
|
Array.isArray = ((value) => isArray(value) ||
|
|
3332
|
-
// biome-ignore lint/suspicious/useIsArray: We are defining it
|
|
3333
3416
|
(value &&
|
|
3334
3417
|
typeof value === 'object' &&
|
|
3335
3418
|
prototypeForwarding in value &&
|
|
@@ -4225,6 +4308,17 @@ function register(keyFn, initial) {
|
|
|
4225
4308
|
return new RegisterClass(keyFn, initial);
|
|
4226
4309
|
}
|
|
4227
4310
|
|
|
4311
|
+
/**
|
|
4312
|
+
* Maps projection effects (item effects) to their projection context
|
|
4313
|
+
*/
|
|
4314
|
+
const effectProjectionMetadata = new WeakMap();
|
|
4315
|
+
/**
|
|
4316
|
+
* Returns the projection context of the currently running effect, if any.
|
|
4317
|
+
*/
|
|
4318
|
+
function getActiveProjection() {
|
|
4319
|
+
const active = getActiveEffect();
|
|
4320
|
+
return active ? effectProjectionMetadata.get(active) : undefined;
|
|
4321
|
+
}
|
|
4228
4322
|
function defineAccessValue(access) {
|
|
4229
4323
|
Object.defineProperty(access, 'value', {
|
|
4230
4324
|
get: access.get,
|
|
@@ -4233,7 +4327,15 @@ function defineAccessValue(access) {
|
|
|
4233
4327
|
enumerable: true,
|
|
4234
4328
|
});
|
|
4235
4329
|
}
|
|
4236
|
-
function makeCleanup(target, effectMap, onDispose) {
|
|
4330
|
+
function makeCleanup(target, effectMap, onDispose, metadata) {
|
|
4331
|
+
if (metadata) {
|
|
4332
|
+
Object.defineProperty(target, projectionInfo, {
|
|
4333
|
+
value: metadata,
|
|
4334
|
+
writable: false,
|
|
4335
|
+
enumerable: false,
|
|
4336
|
+
configurable: true,
|
|
4337
|
+
});
|
|
4338
|
+
}
|
|
4237
4339
|
return cleanedBy(target, () => {
|
|
4238
4340
|
onDispose();
|
|
4239
4341
|
for (const stop of effectMap.values())
|
|
@@ -4256,6 +4358,8 @@ function projectArray(source, apply) {
|
|
|
4256
4358
|
Reflect.deleteProperty(target, index);
|
|
4257
4359
|
}
|
|
4258
4360
|
}
|
|
4361
|
+
const parent = getActiveProjection();
|
|
4362
|
+
const depth = parent ? parent.depth + 1 : 0;
|
|
4259
4363
|
const cleanupLength = effect(function projectArrayLengthEffect({ ascend }) {
|
|
4260
4364
|
const length = observedSource.length;
|
|
4261
4365
|
normalizeTargetLength(length);
|
|
@@ -4278,6 +4382,14 @@ function projectArray(source, apply) {
|
|
|
4278
4382
|
const produced = apply(accessBase, target);
|
|
4279
4383
|
target[index] = produced;
|
|
4280
4384
|
});
|
|
4385
|
+
setEffectName(stop, `project[${depth}]:${index}`);
|
|
4386
|
+
effectProjectionMetadata.set(stop, {
|
|
4387
|
+
source: observedSource,
|
|
4388
|
+
key: index,
|
|
4389
|
+
target,
|
|
4390
|
+
depth,
|
|
4391
|
+
parent,
|
|
4392
|
+
});
|
|
4281
4393
|
indexEffects.set(i, stop);
|
|
4282
4394
|
});
|
|
4283
4395
|
}
|
|
@@ -4285,7 +4397,13 @@ function projectArray(source, apply) {
|
|
|
4285
4397
|
if (index >= length)
|
|
4286
4398
|
disposeIndex(index);
|
|
4287
4399
|
});
|
|
4288
|
-
return makeCleanup(target, indexEffects, () => cleanupLength()
|
|
4400
|
+
return makeCleanup(target, indexEffects, () => cleanupLength(), {
|
|
4401
|
+
source: observedSource,
|
|
4402
|
+
target,
|
|
4403
|
+
apply,
|
|
4404
|
+
depth,
|
|
4405
|
+
parent,
|
|
4406
|
+
});
|
|
4289
4407
|
}
|
|
4290
4408
|
function projectRegister(source, apply) {
|
|
4291
4409
|
const observedSource = reactive(source);
|
|
@@ -4300,6 +4418,8 @@ function projectRegister(source, apply) {
|
|
|
4300
4418
|
target.delete(key);
|
|
4301
4419
|
}
|
|
4302
4420
|
}
|
|
4421
|
+
const parent = getActiveProjection();
|
|
4422
|
+
const depth = parent ? parent.depth + 1 : 0;
|
|
4303
4423
|
const cleanupKeys = effect(function projectRegisterEffect({ ascend }) {
|
|
4304
4424
|
const keys = new Set();
|
|
4305
4425
|
for (const key of observedSource.mapKeys())
|
|
@@ -4324,6 +4444,14 @@ function projectRegister(source, apply) {
|
|
|
4324
4444
|
const produced = apply(accessBase, target);
|
|
4325
4445
|
target.set(key, produced);
|
|
4326
4446
|
});
|
|
4447
|
+
setEffectName(stop, `project[${depth}]:${String(key)}`);
|
|
4448
|
+
effectProjectionMetadata.set(stop, {
|
|
4449
|
+
source: observedSource,
|
|
4450
|
+
key,
|
|
4451
|
+
target,
|
|
4452
|
+
depth,
|
|
4453
|
+
parent,
|
|
4454
|
+
});
|
|
4327
4455
|
keyEffects.set(key, stop);
|
|
4328
4456
|
});
|
|
4329
4457
|
}
|
|
@@ -4331,7 +4459,13 @@ function projectRegister(source, apply) {
|
|
|
4331
4459
|
if (!keys.has(key))
|
|
4332
4460
|
disposeKey(key);
|
|
4333
4461
|
});
|
|
4334
|
-
return makeCleanup(target, keyEffects, () => cleanupKeys()
|
|
4462
|
+
return makeCleanup(target, keyEffects, () => cleanupKeys(), {
|
|
4463
|
+
source: observedSource,
|
|
4464
|
+
target,
|
|
4465
|
+
apply,
|
|
4466
|
+
depth,
|
|
4467
|
+
parent,
|
|
4468
|
+
});
|
|
4335
4469
|
}
|
|
4336
4470
|
function projectRecord(source, apply) {
|
|
4337
4471
|
const observedSource = reactive(source);
|
|
@@ -4345,6 +4479,8 @@ function projectRecord(source, apply) {
|
|
|
4345
4479
|
Reflect.deleteProperty(target, key);
|
|
4346
4480
|
}
|
|
4347
4481
|
}
|
|
4482
|
+
const parent = getActiveProjection();
|
|
4483
|
+
const depth = parent ? parent.depth + 1 : 0;
|
|
4348
4484
|
const cleanupKeys = effect(function projectRecordEffect({ ascend }) {
|
|
4349
4485
|
const keys = new Set();
|
|
4350
4486
|
for (const key in observedSource)
|
|
@@ -4370,6 +4506,14 @@ function projectRecord(source, apply) {
|
|
|
4370
4506
|
const produced = apply(accessBase, target);
|
|
4371
4507
|
target[sourceKey] = produced;
|
|
4372
4508
|
});
|
|
4509
|
+
setEffectName(stop, `project[${depth}]:${String(key)}`);
|
|
4510
|
+
effectProjectionMetadata.set(stop, {
|
|
4511
|
+
source: observedSource,
|
|
4512
|
+
key,
|
|
4513
|
+
target,
|
|
4514
|
+
depth,
|
|
4515
|
+
parent,
|
|
4516
|
+
});
|
|
4373
4517
|
keyEffects.set(key, stop);
|
|
4374
4518
|
});
|
|
4375
4519
|
}
|
|
@@ -4377,7 +4521,13 @@ function projectRecord(source, apply) {
|
|
|
4377
4521
|
if (!keys.has(key))
|
|
4378
4522
|
disposeKey(key);
|
|
4379
4523
|
});
|
|
4380
|
-
return makeCleanup(target, keyEffects, () => cleanupKeys()
|
|
4524
|
+
return makeCleanup(target, keyEffects, () => cleanupKeys(), {
|
|
4525
|
+
source: observedSource,
|
|
4526
|
+
target,
|
|
4527
|
+
apply,
|
|
4528
|
+
depth,
|
|
4529
|
+
parent,
|
|
4530
|
+
});
|
|
4381
4531
|
}
|
|
4382
4532
|
function projectMap(source, apply) {
|
|
4383
4533
|
const observedSource = reactive(source);
|
|
@@ -4392,6 +4542,8 @@ function projectMap(source, apply) {
|
|
|
4392
4542
|
target.delete(key);
|
|
4393
4543
|
}
|
|
4394
4544
|
}
|
|
4545
|
+
const parent = getActiveProjection();
|
|
4546
|
+
const depth = parent ? parent.depth + 1 : 0;
|
|
4395
4547
|
const cleanupKeys = effect(function projectMapEffect({ ascend }) {
|
|
4396
4548
|
const keys = new Set();
|
|
4397
4549
|
for (const key of observedSource.keys())
|
|
@@ -4416,6 +4568,14 @@ function projectMap(source, apply) {
|
|
|
4416
4568
|
const produced = apply(accessBase, target);
|
|
4417
4569
|
target.set(key, produced);
|
|
4418
4570
|
});
|
|
4571
|
+
setEffectName(stop, `project[${depth}]:${String(key)}`);
|
|
4572
|
+
effectProjectionMetadata.set(stop, {
|
|
4573
|
+
source: observedSource,
|
|
4574
|
+
key,
|
|
4575
|
+
target,
|
|
4576
|
+
depth,
|
|
4577
|
+
parent,
|
|
4578
|
+
});
|
|
4419
4579
|
keyEffects.set(key, stop);
|
|
4420
4580
|
});
|
|
4421
4581
|
}
|
|
@@ -4423,7 +4583,13 @@ function projectMap(source, apply) {
|
|
|
4423
4583
|
if (!keys.has(key))
|
|
4424
4584
|
disposeKey(key);
|
|
4425
4585
|
});
|
|
4426
|
-
return makeCleanup(target, keyEffects, () => cleanupKeys()
|
|
4586
|
+
return makeCleanup(target, keyEffects, () => cleanupKeys(), {
|
|
4587
|
+
source: observedSource,
|
|
4588
|
+
target,
|
|
4589
|
+
apply,
|
|
4590
|
+
depth,
|
|
4591
|
+
parent,
|
|
4592
|
+
});
|
|
4427
4593
|
}
|
|
4428
4594
|
function projectCore(source, apply) {
|
|
4429
4595
|
if (Array.isArray(source))
|
|
@@ -4571,7 +4737,7 @@ class ReactiveWeakMap {
|
|
|
4571
4737
|
Object.defineProperties(this, {
|
|
4572
4738
|
[native$1]: { value: original },
|
|
4573
4739
|
[prototypeForwarding]: { value: original },
|
|
4574
|
-
content: { value: Symbol('
|
|
4740
|
+
content: { value: Symbol('WeakMapContent') },
|
|
4575
4741
|
[Symbol.toStringTag]: { value: 'ReactiveWeakMap' },
|
|
4576
4742
|
});
|
|
4577
4743
|
}
|
|
@@ -4611,7 +4777,7 @@ class ReactiveMap {
|
|
|
4611
4777
|
Object.defineProperties(this, {
|
|
4612
4778
|
[native$1]: { value: original },
|
|
4613
4779
|
[prototypeForwarding]: { value: original },
|
|
4614
|
-
content: { value: Symbol('
|
|
4780
|
+
content: { value: Symbol('MapContent') },
|
|
4615
4781
|
[Symbol.toStringTag]: { value: 'ReactiveMap' },
|
|
4616
4782
|
});
|
|
4617
4783
|
}
|
|
@@ -4706,7 +4872,7 @@ class ReactiveWeakSet {
|
|
|
4706
4872
|
Object.defineProperties(this, {
|
|
4707
4873
|
[native]: { value: original },
|
|
4708
4874
|
[prototypeForwarding]: { value: original },
|
|
4709
|
-
content: { value: Symbol('
|
|
4875
|
+
content: { value: Symbol('WeakSetContent') },
|
|
4710
4876
|
[Symbol.toStringTag]: { value: 'ReactiveWeakSet' },
|
|
4711
4877
|
});
|
|
4712
4878
|
}
|
|
@@ -4741,7 +4907,7 @@ class ReactiveSet {
|
|
|
4741
4907
|
Object.defineProperties(this, {
|
|
4742
4908
|
[native]: { value: original },
|
|
4743
4909
|
[prototypeForwarding]: { value: original },
|
|
4744
|
-
content: { value: Symbol('
|
|
4910
|
+
content: { value: Symbol('SetContent') },
|
|
4745
4911
|
[Symbol.toStringTag]: { value: 'ReactiveSet' },
|
|
4746
4912
|
});
|
|
4747
4913
|
}
|
|
@@ -4837,5 +5003,5 @@ const profileInfo = {
|
|
|
4837
5003
|
nonReactiveObjects,
|
|
4838
5004
|
};
|
|
4839
5005
|
|
|
4840
|
-
export {
|
|
4841
|
-
//# sourceMappingURL=index-
|
|
5006
|
+
export { cleanup as A, derived as B, unreactive as C, watch as D, mapped as E, reduced as F, memoize as G, immutables as H, IterableWeakMap as I, isNonReactive as J, registerNativeReactivity as K, getActiveProjection as L, project as M, isReactive as N, ReactiveBase as O, reactive as P, unwrap as Q, ReadOnlyError as R, organize as S, organized as T, Register as U, register as V, options as W, ReactiveError as X, isZoneEnabled as Y, setZoneEnabled as Z, IterableWeakSet as a, touched1 as b, buildReactivityGraph as c, registerObjectForDebug as d, enableDevTools as e, setObjectName as f, getState as g, deepWatch as h, isDevtoolsEnabled as i, addBatchCleanup as j, atomic as k, batch as l, mixin as m, biDi as n, defer as o, profileInfo as p, effect as q, registerEffectForDebug as r, setEffectName as s, touched as t, getActivationLog as u, getActiveEffect as v, root as w, trackEffect as x, untracked as y, cleanedBy as z };
|
|
5007
|
+
//# sourceMappingURL=index-qiWwozOc.esm.js.map
|