essor 0.0.16-beta.2 → 0.0.16-beta.4
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/dist/{chunk-FIBC7TTZ.esm.js → chunk-CLZAPZAN.esm.js} +265 -118
- package/dist/chunk-CLZAPZAN.esm.js.map +1 -0
- package/dist/chunk-U57E4YNR.dev.esm.js +19 -0
- package/dist/chunk-U57E4YNR.dev.esm.js.map +1 -0
- package/dist/essor.cjs.js +267 -115
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs.js +8 -8
- package/dist/essor.dev.cjs.js.map +1 -1
- package/dist/essor.dev.esm.js +3 -3
- package/dist/essor.esm.js +4 -4
- package/dist/server.cjs.js +203 -105
- package/dist/server.cjs.js.map +1 -1
- package/dist/server.dev.cjs.js +4 -4
- package/dist/server.dev.cjs.js.map +1 -1
- package/dist/server.dev.esm.js +5 -5
- package/dist/server.dev.esm.js.map +1 -1
- package/dist/server.esm.js +100 -104
- package/dist/server.esm.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-FIBC7TTZ.esm.js.map +0 -1
- package/dist/chunk-LKZM76RW.dev.esm.js +0 -19
- package/dist/chunk-LKZM76RW.dev.esm.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.16-beta.
|
|
3
|
-
* build time 2026-05-
|
|
2
|
+
* essor v0.0.16-beta.4
|
|
3
|
+
* build time 2026-05-11T07:25:26.556Z
|
|
4
4
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
**/
|
|
7
7
|
|
|
8
8
|
// src/version.ts
|
|
9
|
-
var __version = "0.0.16-beta.
|
|
9
|
+
var __version = "0.0.16-beta.4";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/shared.esm.js
|
|
12
12
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -246,75 +246,6 @@ var COLLECTION_KEY = /* @__PURE__ */ Symbol("Collection_Key");
|
|
|
246
246
|
var WEAK_COLLECTION_KEY = /* @__PURE__ */ Symbol("WeakCollection_Key");
|
|
247
247
|
var ITERATE_KEY = /* @__PURE__ */ Symbol("Iterate_Key");
|
|
248
248
|
var ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol("Array_Iterate_Key");
|
|
249
|
-
function enqueueEffect(effect2) {
|
|
250
|
-
var _a52;
|
|
251
|
-
(_a52 = effect2 == null ? void 0 : effect2.notify) == null ? void 0 : _a52.call(effect2);
|
|
252
|
-
}
|
|
253
|
-
function propagate(link) {
|
|
254
|
-
let next2 = link.nextSubLink;
|
|
255
|
-
let stack;
|
|
256
|
-
top: do {
|
|
257
|
-
const sub = link.subNode;
|
|
258
|
-
const watcherBit = sub.flag & 2;
|
|
259
|
-
let flags = sub.flag;
|
|
260
|
-
if (!(flags & (16 | 32 | 8 | 4))) {
|
|
261
|
-
sub.flag = flags | 32;
|
|
262
|
-
if (watcherBit) {
|
|
263
|
-
enqueueEffect(sub);
|
|
264
|
-
}
|
|
265
|
-
} else if (!(flags & (8 | 4))) {
|
|
266
|
-
flags = 0;
|
|
267
|
-
} else if (!(flags & 4)) {
|
|
268
|
-
sub.flag = flags & -9 | 32;
|
|
269
|
-
} else if (!(flags & (16 | 32)) && isValidLink(link, sub)) {
|
|
270
|
-
sub.flag = flags | (8 | 32);
|
|
271
|
-
if (watcherBit) {
|
|
272
|
-
enqueueEffect(sub);
|
|
273
|
-
}
|
|
274
|
-
flags &= 1;
|
|
275
|
-
} else {
|
|
276
|
-
flags = 0;
|
|
277
|
-
}
|
|
278
|
-
if (flags & 1) {
|
|
279
|
-
const subSubs = sub.subLink;
|
|
280
|
-
if (subSubs !== void 0) {
|
|
281
|
-
const nextSub = subSubs.nextSubLink;
|
|
282
|
-
if (nextSub !== void 0) {
|
|
283
|
-
stack = { value: next2, prev: stack };
|
|
284
|
-
next2 = nextSub;
|
|
285
|
-
}
|
|
286
|
-
link = subSubs;
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if ((link = next2) !== void 0) {
|
|
291
|
-
next2 = link.nextSubLink;
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
while (stack !== void 0) {
|
|
295
|
-
link = stack.value;
|
|
296
|
-
stack = stack.prev;
|
|
297
|
-
if (link !== void 0) {
|
|
298
|
-
next2 = link.nextSubLink;
|
|
299
|
-
continue top;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
} while (true);
|
|
304
|
-
}
|
|
305
|
-
function shallowPropagate(link) {
|
|
306
|
-
while (link) {
|
|
307
|
-
const sub = link.subNode;
|
|
308
|
-
const flags = sub.flag;
|
|
309
|
-
if ((flags & (32 | 16)) === 32) {
|
|
310
|
-
sub.flag = flags | 16;
|
|
311
|
-
if ((flags & (2 | 4)) === 2) {
|
|
312
|
-
enqueueEffect(sub);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
link = link.nextSubLink;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
249
|
var currentLinkVersion = 0;
|
|
319
250
|
var activeSub;
|
|
320
251
|
var isUntracking = false;
|
|
@@ -335,6 +266,10 @@ var Dep = class {
|
|
|
335
266
|
}
|
|
336
267
|
}
|
|
337
268
|
};
|
|
269
|
+
function enqueueEffect(effect2) {
|
|
270
|
+
var _a52;
|
|
271
|
+
(_a52 = effect2 == null ? void 0 : effect2.notify) == null ? void 0 : _a52.call(effect2);
|
|
272
|
+
}
|
|
338
273
|
function linkReactiveNode(depNode, subNode) {
|
|
339
274
|
if (isUntracking) {
|
|
340
275
|
return void 0;
|
|
@@ -358,10 +293,8 @@ function linkReactiveNode(depNode, subNode) {
|
|
|
358
293
|
version: currentLinkVersion,
|
|
359
294
|
depNode,
|
|
360
295
|
subNode,
|
|
361
|
-
// Subscriber chain pointers (horizontal)
|
|
362
296
|
prevSubLink: prevSub,
|
|
363
297
|
nextSubLink: void 0,
|
|
364
|
-
// Dependency chain pointers (vertical)
|
|
365
298
|
prevDepLink: prevDep,
|
|
366
299
|
nextDepLink: nextDep
|
|
367
300
|
};
|
|
@@ -380,15 +313,13 @@ function linkReactiveNode(depNode, subNode) {
|
|
|
380
313
|
}
|
|
381
314
|
depNode.subLinkTail = newLink;
|
|
382
315
|
subNode.depLinkTail = newLink;
|
|
383
|
-
{
|
|
384
|
-
|
|
385
|
-
subNode
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
});
|
|
391
|
-
}
|
|
316
|
+
if (subNode.onTrack && isFunction(subNode.onTrack)) {
|
|
317
|
+
subNode.onTrack({
|
|
318
|
+
effect: subNode,
|
|
319
|
+
target: depNode,
|
|
320
|
+
type: "get",
|
|
321
|
+
key: void 0
|
|
322
|
+
});
|
|
392
323
|
}
|
|
393
324
|
return newLink;
|
|
394
325
|
}
|
|
@@ -426,12 +357,10 @@ function unlinkReactiveNode(linkNode, subNode = linkNode.subNode) {
|
|
|
426
357
|
if (!depNode.isDep) {
|
|
427
358
|
depNode.flag |= 16;
|
|
428
359
|
}
|
|
429
|
-
{
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
);
|
|
434
|
-
}
|
|
360
|
+
if (depNode.depLink) {
|
|
361
|
+
error(
|
|
362
|
+
"[Link] Cascading cleanup failed: depNode still has dependency links. This indicates a bug in the unlinking logic."
|
|
363
|
+
);
|
|
435
364
|
}
|
|
436
365
|
}
|
|
437
366
|
}
|
|
@@ -451,7 +380,7 @@ function checkDirty(link, sub) {
|
|
|
451
380
|
if ((depFlags & (1 | 16)) === (1 | 16)) {
|
|
452
381
|
const subs = dep.subLink;
|
|
453
382
|
if (subs && subs.nextSubLink) {
|
|
454
|
-
|
|
383
|
+
shallowPropagate(subs);
|
|
455
384
|
}
|
|
456
385
|
currentDirty = true;
|
|
457
386
|
} else if ((depFlags & (1 | 32)) === (1 | 32)) {
|
|
@@ -499,16 +428,71 @@ function checkDirty(link, sub) {
|
|
|
499
428
|
return dirty;
|
|
500
429
|
} while (true);
|
|
501
430
|
}
|
|
502
|
-
function
|
|
431
|
+
function shallowPropagate(link) {
|
|
503
432
|
while (link) {
|
|
504
433
|
const sub = link.subNode;
|
|
505
434
|
const flags = sub.flag;
|
|
506
435
|
if ((flags & (32 | 16)) === 32) {
|
|
507
436
|
sub.flag = flags | 16;
|
|
437
|
+
if ((flags & (2 | 4)) === 2) {
|
|
438
|
+
enqueueEffect(sub);
|
|
439
|
+
}
|
|
508
440
|
}
|
|
509
441
|
link = link.nextSubLink;
|
|
510
442
|
}
|
|
511
443
|
}
|
|
444
|
+
function propagate(link) {
|
|
445
|
+
let next2 = link.nextSubLink;
|
|
446
|
+
let stack;
|
|
447
|
+
top: do {
|
|
448
|
+
const sub = link.subNode;
|
|
449
|
+
const watcherBit = sub.flag & 2;
|
|
450
|
+
let flags = sub.flag;
|
|
451
|
+
if (!(flags & (16 | 32 | 8 | 4))) {
|
|
452
|
+
sub.flag = flags | 32;
|
|
453
|
+
if (watcherBit) {
|
|
454
|
+
enqueueEffect(sub);
|
|
455
|
+
}
|
|
456
|
+
} else if (!(flags & (8 | 4))) {
|
|
457
|
+
flags = 0;
|
|
458
|
+
} else if (!(flags & 4)) {
|
|
459
|
+
sub.flag = flags & -9 | 32;
|
|
460
|
+
} else if (!(flags & (16 | 32)) && isValidLink(link, sub)) {
|
|
461
|
+
sub.flag = flags | (8 | 32);
|
|
462
|
+
if (watcherBit) {
|
|
463
|
+
enqueueEffect(sub);
|
|
464
|
+
}
|
|
465
|
+
flags &= 1;
|
|
466
|
+
} else {
|
|
467
|
+
flags = 0;
|
|
468
|
+
}
|
|
469
|
+
if (flags & 1) {
|
|
470
|
+
const subSubs = sub.subLink;
|
|
471
|
+
if (subSubs !== void 0) {
|
|
472
|
+
const nextSub = subSubs.nextSubLink;
|
|
473
|
+
if (nextSub !== void 0) {
|
|
474
|
+
stack = { value: next2, prev: stack };
|
|
475
|
+
next2 = nextSub;
|
|
476
|
+
}
|
|
477
|
+
link = subSubs;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if ((link = next2) !== void 0) {
|
|
482
|
+
next2 = link.nextSubLink;
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
while (stack !== void 0) {
|
|
486
|
+
link = stack.value;
|
|
487
|
+
stack = stack.prev;
|
|
488
|
+
if (link !== void 0) {
|
|
489
|
+
next2 = link.nextSubLink;
|
|
490
|
+
continue top;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
break;
|
|
494
|
+
} while (true);
|
|
495
|
+
}
|
|
512
496
|
function setActiveSub(sub) {
|
|
513
497
|
const prev = activeSub;
|
|
514
498
|
activeSub = sub;
|
|
@@ -1270,7 +1254,7 @@ var SignalImpl = class {
|
|
|
1270
1254
|
if (flags & 16 && this.shouldUpdate()) {
|
|
1271
1255
|
const subs = this.subLink;
|
|
1272
1256
|
if (subs) {
|
|
1273
|
-
|
|
1257
|
+
shallowPropagate(subs);
|
|
1274
1258
|
}
|
|
1275
1259
|
}
|
|
1276
1260
|
return this._value;
|
|
@@ -1486,6 +1470,133 @@ function isBatching() {
|
|
|
1486
1470
|
function getBatchDepth() {
|
|
1487
1471
|
return batchDepth;
|
|
1488
1472
|
}
|
|
1473
|
+
var activeEffectScope;
|
|
1474
|
+
var EffectScope = class {
|
|
1475
|
+
constructor(detached = false, parent = void 0) {
|
|
1476
|
+
this.detached = detached;
|
|
1477
|
+
this.parent = parent;
|
|
1478
|
+
this._active = true;
|
|
1479
|
+
this.effects = [];
|
|
1480
|
+
this.scopes = [];
|
|
1481
|
+
this.cleanups = [];
|
|
1482
|
+
if (!detached && activeEffectScope) {
|
|
1483
|
+
this.parent = activeEffectScope;
|
|
1484
|
+
activeEffectScope.scopes.push(this);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
get active() {
|
|
1488
|
+
return this._active;
|
|
1489
|
+
}
|
|
1490
|
+
pause() {
|
|
1491
|
+
var _a52, _b2;
|
|
1492
|
+
if (!this._active) {
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
for (let i = 0; i < this.scopes.length; i++) {
|
|
1496
|
+
this.scopes[i].pause();
|
|
1497
|
+
}
|
|
1498
|
+
for (let i = 0; i < this.effects.length; i++) {
|
|
1499
|
+
(_b2 = (_a52 = this.effects[i]).pause) == null ? void 0 : _b2.call(_a52);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
resume() {
|
|
1503
|
+
var _a52, _b2;
|
|
1504
|
+
if (!this._active) {
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
for (let i = 0; i < this.scopes.length; i++) {
|
|
1508
|
+
this.scopes[i].resume();
|
|
1509
|
+
}
|
|
1510
|
+
for (let i = 0; i < this.effects.length; i++) {
|
|
1511
|
+
(_b2 = (_a52 = this.effects[i]).resume) == null ? void 0 : _b2.call(_a52);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
run(fn) {
|
|
1515
|
+
if (!this._active) {
|
|
1516
|
+
{
|
|
1517
|
+
warn("cannot run an inactive effect scope.");
|
|
1518
|
+
}
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const prevScope = activeEffectScope;
|
|
1522
|
+
activeEffectScope = this;
|
|
1523
|
+
try {
|
|
1524
|
+
return fn();
|
|
1525
|
+
} finally {
|
|
1526
|
+
activeEffectScope = prevScope;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
stop(fromParent = false) {
|
|
1530
|
+
if (!this._active) {
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
this._active = false;
|
|
1534
|
+
for (let i = 0; i < this.scopes.length; i++) {
|
|
1535
|
+
this.scopes[i].stop(true);
|
|
1536
|
+
}
|
|
1537
|
+
this.scopes.length = 0;
|
|
1538
|
+
const effects = this.effects.slice();
|
|
1539
|
+
this.effects.length = 0;
|
|
1540
|
+
for (const effect2 of effects) {
|
|
1541
|
+
effect2.stop();
|
|
1542
|
+
}
|
|
1543
|
+
for (let i = 0; i < this.cleanups.length; i++) {
|
|
1544
|
+
this.cleanups[i]();
|
|
1545
|
+
}
|
|
1546
|
+
this.cleanups.length = 0;
|
|
1547
|
+
if (!fromParent && this.parent) {
|
|
1548
|
+
const index = this.parent.scopes.indexOf(this);
|
|
1549
|
+
if (index >= 0) {
|
|
1550
|
+
this.parent.scopes.splice(index, 1);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
this.parent = void 0;
|
|
1554
|
+
}
|
|
1555
|
+
_record(effect2) {
|
|
1556
|
+
this.effects.push(effect2);
|
|
1557
|
+
effect2.scope = this;
|
|
1558
|
+
}
|
|
1559
|
+
_remove(effect2) {
|
|
1560
|
+
const index = this.effects.indexOf(effect2);
|
|
1561
|
+
if (index >= 0) {
|
|
1562
|
+
this.effects.splice(index, 1);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
_pushCleanup(fn) {
|
|
1566
|
+
this.cleanups.push(fn);
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
function effectScope(detached = false) {
|
|
1570
|
+
return new EffectScope(detached);
|
|
1571
|
+
}
|
|
1572
|
+
function getCurrentScope() {
|
|
1573
|
+
return activeEffectScope;
|
|
1574
|
+
}
|
|
1575
|
+
function setCurrentScope(scope) {
|
|
1576
|
+
const prevScope = activeEffectScope;
|
|
1577
|
+
activeEffectScope = scope;
|
|
1578
|
+
return prevScope;
|
|
1579
|
+
}
|
|
1580
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
1581
|
+
if (activeEffectScope) {
|
|
1582
|
+
activeEffectScope._pushCleanup(fn);
|
|
1583
|
+
} else if (!failSilently) {
|
|
1584
|
+
warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function recordDisposable(effect2, scope = activeEffectScope) {
|
|
1588
|
+
if (scope && scope.active) {
|
|
1589
|
+
scope._record(effect2);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
function releaseDisposable(effect2) {
|
|
1593
|
+
const scope = effect2.scope;
|
|
1594
|
+
if (!scope) {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
effect2.scope = void 0;
|
|
1598
|
+
scope._remove(effect2);
|
|
1599
|
+
}
|
|
1489
1600
|
var _a2;
|
|
1490
1601
|
_a2 = "_IS_EFFECT";
|
|
1491
1602
|
var EffectImpl = class {
|
|
@@ -1511,6 +1622,7 @@ var EffectImpl = class {
|
|
|
1511
1622
|
if (options.onTrigger) this.onTrigger = options.onTrigger;
|
|
1512
1623
|
}
|
|
1513
1624
|
}
|
|
1625
|
+
recordDisposable(this);
|
|
1514
1626
|
}
|
|
1515
1627
|
/**
|
|
1516
1628
|
* Check if the Effect is active.
|
|
@@ -1674,12 +1786,10 @@ var EffectImpl = class {
|
|
|
1674
1786
|
stop() {
|
|
1675
1787
|
var _a52;
|
|
1676
1788
|
if (!this._active) {
|
|
1677
|
-
{
|
|
1678
|
-
warn("[Effect] Attempting to stop an already stopped effect.");
|
|
1679
|
-
}
|
|
1680
1789
|
return;
|
|
1681
1790
|
}
|
|
1682
1791
|
this._active = false;
|
|
1792
|
+
releaseDisposable(this);
|
|
1683
1793
|
let dep = this.depLink;
|
|
1684
1794
|
while (dep) {
|
|
1685
1795
|
dep = unlinkReactiveNode(dep, this);
|
|
@@ -1761,11 +1871,13 @@ var ComputedImpl = class {
|
|
|
1761
1871
|
this.flag = 1 | 16;
|
|
1762
1872
|
this[_a3] = true;
|
|
1763
1873
|
this._value = NO_VALUE;
|
|
1874
|
+
this._active = true;
|
|
1764
1875
|
this.getter = getter;
|
|
1765
1876
|
this.setter = setter;
|
|
1766
1877
|
this.onTrack = onTrack;
|
|
1767
1878
|
this.onTrigger = onTrigger;
|
|
1768
1879
|
this.flag |= 16;
|
|
1880
|
+
recordDisposable(this);
|
|
1769
1881
|
}
|
|
1770
1882
|
/**
|
|
1771
1883
|
* Returns the current value.
|
|
@@ -1773,6 +1885,9 @@ var ComputedImpl = class {
|
|
|
1773
1885
|
* @returns {T} The current value.
|
|
1774
1886
|
*/
|
|
1775
1887
|
get value() {
|
|
1888
|
+
if (!this.active) {
|
|
1889
|
+
return this._value === NO_VALUE ? this.getter() : this._value;
|
|
1890
|
+
}
|
|
1776
1891
|
if (activeSub) {
|
|
1777
1892
|
linkReactiveNode(this, activeSub);
|
|
1778
1893
|
}
|
|
@@ -1814,11 +1929,17 @@ var ComputedImpl = class {
|
|
|
1814
1929
|
* @returns {T} The current value.
|
|
1815
1930
|
*/
|
|
1816
1931
|
peek() {
|
|
1932
|
+
if (!this.active) {
|
|
1933
|
+
return this._value === NO_VALUE ? this.getter() : this._value;
|
|
1934
|
+
}
|
|
1817
1935
|
if (this._value === NO_VALUE) {
|
|
1818
1936
|
this.recompute();
|
|
1819
1937
|
}
|
|
1820
1938
|
return this._value;
|
|
1821
1939
|
}
|
|
1940
|
+
get active() {
|
|
1941
|
+
return this._active;
|
|
1942
|
+
}
|
|
1822
1943
|
/**
|
|
1823
1944
|
* Recompute the value
|
|
1824
1945
|
*
|
|
@@ -1831,6 +1952,12 @@ var ComputedImpl = class {
|
|
|
1831
1952
|
* @private
|
|
1832
1953
|
*/
|
|
1833
1954
|
recompute() {
|
|
1955
|
+
if (!this._active) {
|
|
1956
|
+
if (this._value === NO_VALUE) {
|
|
1957
|
+
this._value = this.getter();
|
|
1958
|
+
}
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1834
1961
|
const oldValue = this._value;
|
|
1835
1962
|
const hadValue = oldValue !== NO_VALUE;
|
|
1836
1963
|
const prevSub = startTracking(this);
|
|
@@ -1889,6 +2016,24 @@ var ComputedImpl = class {
|
|
|
1889
2016
|
}
|
|
1890
2017
|
return hasChanged(this._value, oldValue);
|
|
1891
2018
|
}
|
|
2019
|
+
stop() {
|
|
2020
|
+
if (!this._active) {
|
|
2021
|
+
return;
|
|
2022
|
+
}
|
|
2023
|
+
this._active = false;
|
|
2024
|
+
releaseDisposable(this);
|
|
2025
|
+
let dep = this.depLink;
|
|
2026
|
+
while (dep) {
|
|
2027
|
+
dep = unlinkReactiveNode(dep, this);
|
|
2028
|
+
}
|
|
2029
|
+
let sub = this.subLink;
|
|
2030
|
+
while (sub) {
|
|
2031
|
+
sub = unlinkReactiveNode(sub);
|
|
2032
|
+
}
|
|
2033
|
+
this.depLinkTail = void 0;
|
|
2034
|
+
this.subLinkTail = void 0;
|
|
2035
|
+
this.flag &= -49;
|
|
2036
|
+
}
|
|
1892
2037
|
};
|
|
1893
2038
|
function computed(getterOrOptions) {
|
|
1894
2039
|
if (isComputed(getterOrOptions)) {
|
|
@@ -2247,7 +2392,7 @@ function watch(source, callback, options = {}) {
|
|
|
2247
2392
|
};
|
|
2248
2393
|
}
|
|
2249
2394
|
|
|
2250
|
-
// ../template/dist/chunk-
|
|
2395
|
+
// ../template/dist/chunk-JT6RSDKI.dev.esm.js
|
|
2251
2396
|
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
2252
2397
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
2253
2398
|
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
@@ -2289,8 +2434,10 @@ function getActiveScope() {
|
|
|
2289
2434
|
return activeScope;
|
|
2290
2435
|
}
|
|
2291
2436
|
function createScope(parent = activeScope) {
|
|
2437
|
+
const reactiveScope = parent ? parent.effectScope.run(() => effectScope()) : effectScope(true);
|
|
2292
2438
|
const scope = {
|
|
2293
2439
|
id: ++scopeId,
|
|
2440
|
+
effectScope: reactiveScope,
|
|
2294
2441
|
parent,
|
|
2295
2442
|
children: null,
|
|
2296
2443
|
// Lazy initialized
|
|
@@ -2319,7 +2466,7 @@ function runWithScope(scope, fn) {
|
|
|
2319
2466
|
const prevScope = activeScope;
|
|
2320
2467
|
activeScope = scope;
|
|
2321
2468
|
try {
|
|
2322
|
-
return fn
|
|
2469
|
+
return scope.effectScope.run(fn);
|
|
2323
2470
|
} finally {
|
|
2324
2471
|
activeScope = prevScope;
|
|
2325
2472
|
}
|
|
@@ -2339,15 +2486,13 @@ function disposeScope(scope) {
|
|
|
2339
2486
|
}
|
|
2340
2487
|
scope.children.clear();
|
|
2341
2488
|
}
|
|
2342
|
-
|
|
2343
|
-
activeScope = scope;
|
|
2344
|
-
try {
|
|
2489
|
+
runWithScope(scope, () => {
|
|
2345
2490
|
if (scope.onDestroy) {
|
|
2346
2491
|
for (let i = 0; i < scope.onDestroy.length; i++) {
|
|
2347
2492
|
try {
|
|
2348
2493
|
scope.onDestroy[i]();
|
|
2349
2494
|
} catch (error_) {
|
|
2350
|
-
|
|
2495
|
+
{
|
|
2351
2496
|
error(`Scope(${scope.id}): Error in destroy hook:`, error_);
|
|
2352
2497
|
}
|
|
2353
2498
|
}
|
|
@@ -2359,16 +2504,15 @@ function disposeScope(scope) {
|
|
|
2359
2504
|
try {
|
|
2360
2505
|
scope.cleanup[i]();
|
|
2361
2506
|
} catch (error_) {
|
|
2362
|
-
|
|
2507
|
+
{
|
|
2363
2508
|
error(`Scope(${scope.id}): Error in cleanup:`, error_);
|
|
2364
2509
|
}
|
|
2365
2510
|
}
|
|
2366
2511
|
}
|
|
2367
2512
|
scope.cleanup = null;
|
|
2368
2513
|
}
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
|
-
}
|
|
2514
|
+
});
|
|
2515
|
+
scope.effectScope.stop();
|
|
2372
2516
|
if ((_a6 = scope.parent) == null ? void 0 : _a6.children) {
|
|
2373
2517
|
scope.parent.children.delete(scope);
|
|
2374
2518
|
}
|
|
@@ -2931,7 +3075,7 @@ function normalizeNode(node) {
|
|
|
2931
3075
|
}
|
|
2932
3076
|
function insert(parent, nodeFactory, before) {
|
|
2933
3077
|
if (!parent) return;
|
|
2934
|
-
const
|
|
3078
|
+
const parentScope = getActiveScope();
|
|
2935
3079
|
let renderedNodes = [];
|
|
2936
3080
|
let isFirstRun = true;
|
|
2937
3081
|
const resolveNodes = (raw) => {
|
|
@@ -2955,8 +3099,8 @@ function insert(parent, nodeFactory, before) {
|
|
|
2955
3099
|
renderedNodes = reconcileArrays(parent, renderedNodes, nodes, before);
|
|
2956
3100
|
isFirstRun = false;
|
|
2957
3101
|
};
|
|
2958
|
-
if (
|
|
2959
|
-
runWithScope(
|
|
3102
|
+
if (parentScope && !parentScope.isDestroyed) {
|
|
3103
|
+
runWithScope(parentScope, executeUpdate);
|
|
2960
3104
|
} else {
|
|
2961
3105
|
executeUpdate();
|
|
2962
3106
|
}
|
|
@@ -3153,7 +3297,9 @@ var Component = class {
|
|
|
3153
3297
|
if (isFunction(result)) {
|
|
3154
3298
|
result = result(this.reactiveProps);
|
|
3155
3299
|
}
|
|
3156
|
-
if (isSignal(result)
|
|
3300
|
+
if (isSignal(result)) {
|
|
3301
|
+
result = result.value;
|
|
3302
|
+
} else if (isComputed(result)) {
|
|
3157
3303
|
result = result.value;
|
|
3158
3304
|
}
|
|
3159
3305
|
return (_a32 = insert(parentNode, result, beforeNode)) != null ? _a32 : [];
|
|
@@ -3254,11 +3400,12 @@ var Component = class {
|
|
|
3254
3400
|
return () => value(null);
|
|
3255
3401
|
}
|
|
3256
3402
|
if (isSignal(value)) {
|
|
3257
|
-
const
|
|
3258
|
-
|
|
3403
|
+
const ref2 = value;
|
|
3404
|
+
const previousValue = ref2.value;
|
|
3405
|
+
ref2.value = root;
|
|
3259
3406
|
return () => {
|
|
3260
|
-
if (
|
|
3261
|
-
|
|
3407
|
+
if (ref2.value === root) {
|
|
3408
|
+
ref2.value = previousValue;
|
|
3262
3409
|
}
|
|
3263
3410
|
};
|
|
3264
3411
|
}
|
|
@@ -3679,10 +3826,10 @@ function Portal(props) {
|
|
|
3679
3826
|
placeholder[PORTAL_COMPONENT] = true;
|
|
3680
3827
|
const { children } = props;
|
|
3681
3828
|
if (children == null) return placeholder;
|
|
3682
|
-
const
|
|
3829
|
+
const parentScope = getActiveScope();
|
|
3683
3830
|
let innerScope = null;
|
|
3684
3831
|
const mountAt = (parent, before) => {
|
|
3685
|
-
innerScope = createScope(
|
|
3832
|
+
innerScope = createScope(parentScope);
|
|
3686
3833
|
runWithScope(innerScope, () => {
|
|
3687
3834
|
insert(parent, () => children, before);
|
|
3688
3835
|
});
|
|
@@ -4356,6 +4503,6 @@ function For(props) {
|
|
|
4356
4503
|
}
|
|
4357
4504
|
For[FOR_COMPONENT] = true;
|
|
4358
4505
|
|
|
4359
|
-
export { Component, For, Fragment, Portal, Suspense, TriggerOpTypes, __version, addEvent, addEventListener, batch, beginHydration, bindElement, child, clearDelegatedEvents, computed, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, createStore, defineAsyncComponent, delegateEvents, effect, endBatch, endHydration, error, escapeHTML, getBatchDepth, getHydrationKey, getRenderedElement, hydrate, inject, insert, isArray, isBatching, isComponent, isComputed, isEffect, isFragment, isFunction, isHydrating, isNil, isObject, isPortal, isPromise, isReactive, isRef, isShallow, isSignal, isString, isSuspense, memoEffect, next, nextTick, normalizeClass, normalizeClassName, normalizeStyle, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, provide, queueJob, queuePreFlushCb, reactive, ref, resetHydrationKey, setStyle, shallowReactive, shallowSignal, signal, startBatch, stop, styleToString, template, toRaw, toReactive, trigger, untrack, watch };
|
|
4360
|
-
//# sourceMappingURL=chunk-
|
|
4361
|
-
//# sourceMappingURL=chunk-
|
|
4506
|
+
export { Component, EffectScope, For, Fragment, Portal, Suspense, TriggerOpTypes, __version, addEvent, addEventListener, batch, beginHydration, bindElement, child, clearDelegatedEvents, computed, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, createStore, defineAsyncComponent, delegateEvents, effect, effectScope, endBatch, endHydration, error, escapeHTML, getBatchDepth, getCurrentScope, getHydrationKey, getRenderedElement, hydrate, inject, insert, isArray, isBatching, isComponent, isComputed, isEffect, isFragment, isFunction, isHydrating, isNil, isObject, isPortal, isPromise, isReactive, isRef, isShallow, isSignal, isString, isSuspense, memoEffect, next, nextTick, normalizeClass, normalizeClassName, normalizeStyle, nthChild, omitProps, onDestroy, onMount, onScopeDispose, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, provide, queueJob, queuePreFlushCb, reactive, ref, resetHydrationKey, setCurrentScope, setStyle, shallowReactive, shallowSignal, signal, startBatch, stop, styleToString, template, toRaw, toReactive, trigger, untrack, watch };
|
|
4507
|
+
//# sourceMappingURL=chunk-CLZAPZAN.esm.js.map
|
|
4508
|
+
//# sourceMappingURL=chunk-CLZAPZAN.esm.js.map
|