aoye 0.0.22 → 0.0.23
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/aoye.cjs.js +68 -93
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +68 -93
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.umd.js +68 -93
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.cjs.js
CHANGED
|
@@ -339,66 +339,6 @@ const _scheduler = {
|
|
|
339
339
|
globalThis["sche"] = _scheduler[Scheduler.Sync];
|
|
340
340
|
const registerScheduler = (key, Ctor) => _scheduler[key] = new Ctor();
|
|
341
341
|
|
|
342
|
-
const DefaultDFSOpt = {
|
|
343
|
-
isUp: false,
|
|
344
|
-
begin: null,
|
|
345
|
-
complete: null,
|
|
346
|
-
breakStack: [],
|
|
347
|
-
breakLine: null,
|
|
348
|
-
breakNode: null
|
|
349
|
-
};
|
|
350
|
-
function dfs(root, opt = {}) {
|
|
351
|
-
const _DefaultDFSOpt$opt = {
|
|
352
|
-
...DefaultDFSOpt,
|
|
353
|
-
...opt
|
|
354
|
-
},
|
|
355
|
-
isUp = _DefaultDFSOpt$opt.isUp,
|
|
356
|
-
begin = _DefaultDFSOpt$opt.begin,
|
|
357
|
-
complete = _DefaultDFSOpt$opt.complete,
|
|
358
|
-
lineStack = _DefaultDFSOpt$opt.breakStack,
|
|
359
|
-
breakLine = _DefaultDFSOpt$opt.breakLine;
|
|
360
|
-
let node = opt.breakNode || root;
|
|
361
|
-
let line = breakLine;
|
|
362
|
-
const listKey = isUp ? "recStart" : "emitStart";
|
|
363
|
-
const nodeKey = isUp ? "upstream" : "downstream";
|
|
364
|
-
const nextLineKey = isUp ? "nextRecLine" : "nextEmitLine";
|
|
365
|
-
const reverseNodeKey = isUp ? "downstream" : "upstream";
|
|
366
|
-
while (true) {
|
|
367
|
-
let notGoDeep = begin?.({
|
|
368
|
-
node,
|
|
369
|
-
lineFromUp: line,
|
|
370
|
-
walkedLine: lineStack
|
|
371
|
-
});
|
|
372
|
-
lineStack.push(line);
|
|
373
|
-
line = node[listKey];
|
|
374
|
-
if (line && !notGoDeep) {
|
|
375
|
-
const firstChild = line[nodeKey];
|
|
376
|
-
node = firstChild;
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
while (true) {
|
|
380
|
-
const noGoSibling = complete?.({
|
|
381
|
-
node,
|
|
382
|
-
lineToDeep: line,
|
|
383
|
-
walkedLine: lineStack,
|
|
384
|
-
notGoDeep
|
|
385
|
-
});
|
|
386
|
-
line = lineStack.pop();
|
|
387
|
-
if (node === root) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
notGoDeep = false;
|
|
391
|
-
const nextLine = line[nextLineKey];
|
|
392
|
-
if (!noGoSibling && nextLine) {
|
|
393
|
-
line = nextLine;
|
|
394
|
-
node = nextLine[nodeKey];
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
node = line[reverseNodeKey];
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
342
|
class Line {
|
|
403
343
|
constructor() {
|
|
404
344
|
/** 上游顶点 */
|
|
@@ -587,29 +527,46 @@ function unlinkSingleLine(line) {
|
|
|
587
527
|
}
|
|
588
528
|
function unlinkSingleRefedNode(delRoot) {
|
|
589
529
|
let toUnlink;
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
node
|
|
603
|
-
|
|
604
|
-
|
|
530
|
+
let node = delRoot,
|
|
531
|
+
i = -1,
|
|
532
|
+
parent;
|
|
533
|
+
const stack = [];
|
|
534
|
+
outer: do {
|
|
535
|
+
let noGoDeep = false;
|
|
536
|
+
doUnlink(toUnlink);
|
|
537
|
+
toUnlink = null;
|
|
538
|
+
noGoDeep = node.emitStart !== node.emitEnd;
|
|
539
|
+
const recStart = node.recStart;
|
|
540
|
+
if (recStart && !noGoDeep) {
|
|
541
|
+
stack[++i] = recStart;
|
|
542
|
+
parent = node;
|
|
543
|
+
node = recStart.upstream;
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
while (true) {
|
|
605
547
|
doUnlink(toUnlink);
|
|
606
548
|
toUnlink = null;
|
|
607
|
-
|
|
608
|
-
if (isSingleRefed) {
|
|
549
|
+
if (!noGoDeep) {
|
|
609
550
|
toUnlink = node.emitStart;
|
|
610
551
|
}
|
|
552
|
+
noGoDeep = false;
|
|
553
|
+
if (i === -1) {
|
|
554
|
+
break outer;
|
|
555
|
+
}
|
|
556
|
+
const backLine = stack[i];
|
|
557
|
+
const nextLine = backLine.nextRecLine;
|
|
558
|
+
if (nextLine) {
|
|
559
|
+
node = nextLine.upstream;
|
|
560
|
+
stack[i] = nextLine;
|
|
561
|
+
break;
|
|
562
|
+
} else {
|
|
563
|
+
node = parent;
|
|
564
|
+
if (--i !== -1) {
|
|
565
|
+
parent = stack[i].downstream;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
611
568
|
}
|
|
612
|
-
});
|
|
569
|
+
} while (true);
|
|
613
570
|
doUnlink(toUnlink);
|
|
614
571
|
}
|
|
615
572
|
function doUnlink(line) {
|
|
@@ -624,23 +581,41 @@ function dispose() {
|
|
|
624
581
|
const memoNext = toDel.nextRecLine;
|
|
625
582
|
const upstream = toDel.upstream;
|
|
626
583
|
if (upstream.state & State.IsScope) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
584
|
+
let node = upstream,
|
|
585
|
+
i = -1,
|
|
586
|
+
parent;
|
|
587
|
+
const stack = [];
|
|
588
|
+
outer: do {
|
|
589
|
+
let noGoDeep = (node.state & State.IsScope) === 0 || node.state & ScopeAbort;
|
|
590
|
+
const recStart = node.recStart;
|
|
591
|
+
if (recStart && !noGoDeep) {
|
|
592
|
+
stack[++i] = recStart;
|
|
593
|
+
parent = node;
|
|
594
|
+
node = recStart.upstream;
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
while (true) {
|
|
598
|
+
if (!noGoDeep) {
|
|
599
|
+
releaseScope(node);
|
|
600
|
+
}
|
|
601
|
+
noGoDeep = false;
|
|
602
|
+
if (i === -1) {
|
|
603
|
+
break outer;
|
|
604
|
+
}
|
|
605
|
+
const backLine = stack[i];
|
|
606
|
+
const nextLine = backLine.nextRecLine;
|
|
607
|
+
if (nextLine) {
|
|
608
|
+
node = nextLine.upstream;
|
|
609
|
+
stack[i] = nextLine;
|
|
610
|
+
break;
|
|
611
|
+
} else {
|
|
612
|
+
node = parent;
|
|
613
|
+
if (--i !== -1) {
|
|
614
|
+
parent = stack[i].downstream;
|
|
615
|
+
}
|
|
641
616
|
}
|
|
642
617
|
}
|
|
643
|
-
});
|
|
618
|
+
} while (true);
|
|
644
619
|
} else {
|
|
645
620
|
unlinkSingleLine(toDel);
|
|
646
621
|
}
|