aberdeen 1.18.2 → 1.19.0
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 +9 -0
- package/dist/src/aberdeen.d.ts +27 -0
- package/{dist-docs/assets/aberdeen/aberdeen.js → dist/src/aberdeen.dev.js} +776 -15
- package/dist/src/aberdeen.dev.js.map +12 -0
- package/dist/src/aberdeen.js +59 -13
- package/dist/src/aberdeen.js.map +3 -3
- package/dist/src/devtools.d.ts +26 -0
- package/html-to-aberdeen +9 -5
- package/package.json +17 -10
- package/skill/A.md +127 -0
- package/skill/Dispatcher.md +51 -0
- package/skill/OPAQUE.md +15 -0
- package/skill/PromiseProxy.md +25 -0
- package/skill/Route.md +50 -0
- package/skill/SKILL.md +272 -156
- package/skill/applyCanon.md +20 -0
- package/skill/applyPrediction.md +15 -0
- package/skill/back.md +11 -0
- package/skill/clean.md +43 -0
- package/skill/clone.md +15 -0
- package/skill/copy.md +40 -0
- package/skill/count.md +32 -0
- package/skill/cssVars.md +15 -0
- package/skill/darkMode.md +26 -0
- package/skill/derive.md +56 -0
- package/skill/developer-tools.md +23 -0
- package/skill/disableCreateDestroy.md +11 -0
- package/skill/dump.md +37 -0
- package/skill/freeze.md +20 -0
- package/skill/full-example-multi-page-app.md +146 -0
- package/skill/go.md +25 -0
- package/skill/grow.md +13 -0
- package/skill/html-to-aberdeen.md +9 -0
- package/skill/insertCss.md +79 -0
- package/skill/insertGlobalCss.md +68 -0
- package/skill/interceptLinks.md +19 -0
- package/skill/invertString.md +32 -0
- package/skill/isEmpty.md +38 -0
- package/skill/map.md +16 -0
- package/skill/matchCurrent.md +27 -0
- package/skill/merge.md +27 -0
- package/skill/mount.md +48 -0
- package/skill/multiMap.md +15 -0
- package/skill/onEach.md +14 -0
- package/skill/partition.md +15 -0
- package/skill/peek.md +36 -0
- package/skill/persistScroll.md +13 -0
- package/skill/proxy.md +11 -0
- package/skill/push.md +13 -0
- package/skill/ref.md +39 -0
- package/skill/runQueue.md +34 -0
- package/skill/setErrorHandler.md +48 -0
- package/skill/setLog.md +9 -0
- package/skill/setSpacingCssVars.md +31 -0
- package/skill/shrink.md +13 -0
- package/skill/unmountAll.md +9 -0
- package/skill/unproxy.md +43 -0
- package/skill/up.md +13 -0
- package/src/aberdeen.ts +194 -73
- package/src/devtools.ts +685 -0
- package/dist-docs/.nojekyll +0 -1
- package/dist-docs/Tutorial/index.html +0 -305
- package/dist-docs/aberdeen/A/index.html +0 -116
- package/dist-docs/aberdeen/CUSTOM_DUMP/index.html +0 -7
- package/dist-docs/aberdeen/NO_COPY/index.html +0 -2
- package/dist-docs/aberdeen/OPAQUE/index.html +0 -12
- package/dist-docs/aberdeen/PromiseProxy/index.html +0 -8
- package/dist-docs/aberdeen/clean/index.html +0 -11
- package/dist-docs/aberdeen/clone/index.html +0 -5
- package/dist-docs/aberdeen/copy/index.html +0 -22
- package/dist-docs/aberdeen/count/index.html +0 -7
- package/dist-docs/aberdeen/cssVars/index.html +0 -11
- package/dist-docs/aberdeen/darkMode/index.html +0 -9
- package/dist-docs/aberdeen/default/index.html +0 -342
- package/dist-docs/aberdeen/derive/index.html +0 -18
- package/dist-docs/aberdeen/disableCreateDestroy/index.html +0 -6
- package/dist-docs/aberdeen/dump/index.html +0 -11
- package/dist-docs/aberdeen/index.html +0 -54
- package/dist-docs/aberdeen/insertCss/index.html +0 -30
- package/dist-docs/aberdeen/insertGlobalCss/index.html +0 -19
- package/dist-docs/aberdeen/invertString/index.html +0 -13
- package/dist-docs/aberdeen/isEmpty/index.html +0 -12
- package/dist-docs/aberdeen/map/index.html +0 -26
- package/dist-docs/aberdeen/merge/index.html +0 -11
- package/dist-docs/aberdeen/mount/index.html +0 -17
- package/dist-docs/aberdeen/multiMap/index.html +0 -28
- package/dist-docs/aberdeen/onEach/index.html +0 -19
- package/dist-docs/aberdeen/partition/index.html +0 -36
- package/dist-docs/aberdeen/peek/index.html +0 -40
- package/dist-docs/aberdeen/proxy/index.html +0 -35
- package/dist-docs/aberdeen/ref/index.html +0 -13
- package/dist-docs/aberdeen/runQueue/index.html +0 -13
- package/dist-docs/aberdeen/setErrorHandler/index.html +0 -16
- package/dist-docs/aberdeen/setSpacingCssVars/index.html +0 -8
- package/dist-docs/aberdeen/unmountAll/index.html +0 -5
- package/dist-docs/aberdeen/unproxy/index.html +0 -11
- package/dist-docs/assets/aberdeen/aberdeen.d.ts +0 -963
- package/dist-docs/assets/aberdeen/aberdeen.js.map +0 -11
- package/dist-docs/assets/aberdeen/dispatcher.d.ts +0 -57
- package/dist-docs/assets/aberdeen/dispatcher.js +0 -66
- package/dist-docs/assets/aberdeen/dispatcher.js.map +0 -10
- package/dist-docs/assets/aberdeen/helpers/reverseSortedSet.d.ts +0 -96
- package/dist-docs/assets/aberdeen/prediction.d.ts +0 -33
- package/dist-docs/assets/aberdeen/prediction.js +0 -112
- package/dist-docs/assets/aberdeen/prediction.js.map +0 -10
- package/dist-docs/assets/aberdeen/route.d.ts +0 -137
- package/dist-docs/assets/aberdeen/route.js +0 -287
- package/dist-docs/assets/aberdeen/route.js.map +0 -10
- package/dist-docs/assets/aberdeen/transitions.d.ts +0 -18
- package/dist-docs/assets/aberdeen/transitions.js +0 -47
- package/dist-docs/assets/aberdeen/transitions.js.map +0 -10
- package/dist-docs/assets/custom.js +0 -573
- package/dist-docs/assets/favicon.png +0 -0
- package/dist-docs/assets/hierarchy.js +0 -1
- package/dist-docs/assets/highlight.css +0 -134
- package/dist-docs/assets/icons.js +0 -18
- package/dist-docs/assets/icons.svg +0 -1
- package/dist-docs/assets/main.js +0 -60
- package/dist-docs/assets/navigation.js +0 -1
- package/dist-docs/assets/search.js +0 -1
- package/dist-docs/assets/style.css +0 -1640
- package/dist-docs/dispatcher/Dispatcher/index.html +0 -21
- package/dist-docs/dispatcher/MATCH_FAILED/index.html +0 -2
- package/dist-docs/dispatcher/MATCH_REST/index.html +0 -2
- package/dist-docs/dispatcher/index.html +0 -4
- package/dist-docs/hierarchy.html +0 -1
- package/dist-docs/index.html +0 -61
- package/dist-docs/media/CHANGELOG.md +0 -266
- package/dist-docs/modules.html +0 -1
- package/dist-docs/prediction/applyCanon/index.html +0 -13
- package/dist-docs/prediction/applyPrediction/index.html +0 -8
- package/dist-docs/prediction/index.html +0 -9
- package/dist-docs/route/Route/index.html +0 -23
- package/dist-docs/route/back/index.html +0 -4
- package/dist-docs/route/current/index.html +0 -2
- package/dist-docs/route/go/index.html +0 -14
- package/dist-docs/route/index.html +0 -15
- package/dist-docs/route/interceptLinks/index.html +0 -8
- package/dist-docs/route/matchCurrent/index.html +0 -10
- package/dist-docs/route/persistScroll/index.html +0 -6
- package/dist-docs/route/push/index.html +0 -6
- package/dist-docs/route/setLog/index.html +0 -3
- package/dist-docs/route/up/index.html +0 -5
- package/dist-docs/sitemap.xml +0 -239
- package/dist-docs/transitions/grow/index.html +0 -6
- package/dist-docs/transitions/index.html +0 -5
- package/dist-docs/transitions/shrink/index.html +0 -6
- package/skill/aberdeen.md +0 -4586
- package/skill/dispatcher.md +0 -129
- package/skill/prediction.md +0 -73
- package/skill/route.md +0 -322
- package/skill/transitions.md +0 -59
package/dist/src/aberdeen.js
CHANGED
|
@@ -101,6 +101,7 @@ class ReverseSortedSet {
|
|
|
101
101
|
// src/aberdeen.ts
|
|
102
102
|
var sortedQueue;
|
|
103
103
|
var runQueueDepth = 0;
|
|
104
|
+
var freezeCount = 0;
|
|
104
105
|
var topRedrawScope;
|
|
105
106
|
var survivingEl;
|
|
106
107
|
function recordSideEffect(scope, type, key, value) {
|
|
@@ -145,6 +146,8 @@ function queue(runner) {
|
|
|
145
146
|
sortedQueue.add(runner);
|
|
146
147
|
}
|
|
147
148
|
function runQueue() {
|
|
149
|
+
if (freezeCount)
|
|
150
|
+
return;
|
|
148
151
|
let time = Date.now();
|
|
149
152
|
while (sortedQueue) {
|
|
150
153
|
const runner = sortedQueue.fetchLast();
|
|
@@ -160,6 +163,17 @@ function runQueue() {
|
|
|
160
163
|
if (time > 9)
|
|
161
164
|
console.debug(`Aberdeen queue took ${time}ms`);
|
|
162
165
|
}
|
|
166
|
+
function freeze() {
|
|
167
|
+
freezeCount++;
|
|
168
|
+
let released = false;
|
|
169
|
+
return () => {
|
|
170
|
+
if (released)
|
|
171
|
+
return;
|
|
172
|
+
released = true;
|
|
173
|
+
if (!--freezeCount)
|
|
174
|
+
runQueue();
|
|
175
|
+
};
|
|
176
|
+
}
|
|
163
177
|
function arrayToStr(parts) {
|
|
164
178
|
let result = "";
|
|
165
179
|
for (const part of parts) {
|
|
@@ -248,6 +262,7 @@ class ContentScope extends Scope {
|
|
|
248
262
|
if (!this.changes) {
|
|
249
263
|
this.changes = new Map;
|
|
250
264
|
queue(this);
|
|
265
|
+
dev?.schedule(this, index, oldData, newData, new Error);
|
|
251
266
|
}
|
|
252
267
|
let targetDelta = this.changes.get(target);
|
|
253
268
|
if (!targetDelta) {
|
|
@@ -305,6 +320,7 @@ class ChainedScope extends ContentScope {
|
|
|
305
320
|
}
|
|
306
321
|
if (!useParentCleaners)
|
|
307
322
|
currentScope.cleaners.push(this);
|
|
323
|
+
dev?.create(this, currentScope, new Error);
|
|
308
324
|
}
|
|
309
325
|
getPrecedingNode() {
|
|
310
326
|
return findLastNodeInPrevSiblings(this.prevSibling);
|
|
@@ -324,6 +340,7 @@ class RegularScope extends ChainedScope {
|
|
|
324
340
|
redraw() {
|
|
325
341
|
const savedScope = currentScope;
|
|
326
342
|
currentScope = this;
|
|
343
|
+
dev?.render(this);
|
|
327
344
|
try {
|
|
328
345
|
this.renderer();
|
|
329
346
|
} catch (e) {
|
|
@@ -350,6 +367,7 @@ class MountScope extends ContentScope {
|
|
|
350
367
|
this.el = el;
|
|
351
368
|
this.renderer = renderer;
|
|
352
369
|
this.svg = el.namespaceURI === "http://www.w3.org/2000/svg";
|
|
370
|
+
dev?.create(this, currentScope, new Error);
|
|
353
371
|
const oldTopRedrawScope = topRedrawScope;
|
|
354
372
|
topRedrawScope = this;
|
|
355
373
|
this.redraw();
|
|
@@ -454,6 +472,7 @@ class OnEachScope extends Scope {
|
|
|
454
472
|
this.prevSibling = currentScope.getChildPrevSibling();
|
|
455
473
|
currentScope.lastChild = this;
|
|
456
474
|
currentScope.cleaners.push(this);
|
|
475
|
+
dev?.create(this, currentScope, new Error);
|
|
457
476
|
if (target instanceof Array) {
|
|
458
477
|
for (let i = 0;i < target.length; i++) {
|
|
459
478
|
new OnEachItemScope(this, i, false);
|
|
@@ -484,8 +503,10 @@ class OnEachScope extends Scope {
|
|
|
484
503
|
this.changedIndexes = new Map;
|
|
485
504
|
for (const index of indexes.keys()) {
|
|
486
505
|
const oldScope = this.byIndex.get(index);
|
|
487
|
-
if (oldScope)
|
|
506
|
+
if (oldScope) {
|
|
488
507
|
oldScope.remove();
|
|
508
|
+
dev?.delete(oldScope);
|
|
509
|
+
}
|
|
489
510
|
if (this.target instanceof Set || this.target instanceof Map ? this.target.has(index) : (index in this.target)) {
|
|
490
511
|
new OnEachItemScope(this, index, true);
|
|
491
512
|
} else {
|
|
@@ -527,6 +548,7 @@ class OnEachItemScope extends ContentScope {
|
|
|
527
548
|
this.svg = currentScope.svg;
|
|
528
549
|
this.parent.byIndex.set(this.itemIndex, this);
|
|
529
550
|
this.lastChild = this;
|
|
551
|
+
dev?.create(this, this.parent, new Error);
|
|
530
552
|
if (topRedraw)
|
|
531
553
|
topRedrawScope = this;
|
|
532
554
|
this.redraw();
|
|
@@ -585,6 +607,7 @@ class OnEachItemScope extends ContentScope {
|
|
|
585
607
|
}
|
|
586
608
|
const savedScope = currentScope;
|
|
587
609
|
currentScope = this;
|
|
610
|
+
dev?.render(this);
|
|
588
611
|
let sortKey;
|
|
589
612
|
try {
|
|
590
613
|
if (this.parent.makeSortKey) {
|
|
@@ -629,15 +652,31 @@ class OnEachItemScope extends ContentScope {
|
|
|
629
652
|
function addNode(el, node) {
|
|
630
653
|
if (el !== currentScope.el) {
|
|
631
654
|
el.appendChild(node);
|
|
655
|
+
dev?.node(currentScope, node, false);
|
|
632
656
|
return;
|
|
633
657
|
}
|
|
634
658
|
const parentEl = currentScope.el;
|
|
635
659
|
const prevNode = currentScope.getInsertAfterNode();
|
|
636
660
|
parentEl.insertBefore(node, prevNode ? prevNode.nextSibling : parentEl.firstChild);
|
|
637
661
|
currentScope.lastChild = node;
|
|
662
|
+
dev?.node(currentScope, node, true);
|
|
638
663
|
}
|
|
639
664
|
var ROOT_SCOPE = new RootScope;
|
|
640
665
|
var currentScope = ROOT_SCOPE;
|
|
666
|
+
var dev;
|
|
667
|
+
function _setDev(hooks) {
|
|
668
|
+
dev = hooks;
|
|
669
|
+
if (!hooks)
|
|
670
|
+
return;
|
|
671
|
+
const childScopes = (scope) => scope instanceof OnEachScope ? [...scope.byIndex.values()] : scope.cleaners.filter((c) => c instanceof Scope);
|
|
672
|
+
const replay = (scope, parent) => {
|
|
673
|
+
hooks.create(scope, parent, undefined);
|
|
674
|
+
for (const child of childScopes(scope))
|
|
675
|
+
replay(child, scope);
|
|
676
|
+
};
|
|
677
|
+
for (const child of childScopes(ROOT_SCOPE))
|
|
678
|
+
replay(child, ROOT_SCOPE);
|
|
679
|
+
}
|
|
641
680
|
function leakScope(func) {
|
|
642
681
|
const savedScope = currentScope;
|
|
643
682
|
currentScope = new RootScope;
|
|
@@ -655,6 +694,8 @@ var peeking = 0;
|
|
|
655
694
|
function subscribe(target, index, observer = currentScope) {
|
|
656
695
|
if (observer === ROOT_SCOPE || peeking)
|
|
657
696
|
return;
|
|
697
|
+
if (observer === currentScope)
|
|
698
|
+
dev?.read(currentScope, target, index);
|
|
658
699
|
let byTarget = subscribers.get(target);
|
|
659
700
|
if (!byTarget)
|
|
660
701
|
subscribers.set(target, byTarget = new Map);
|
|
@@ -1560,12 +1601,22 @@ function insertCss(style) {
|
|
|
1560
1601
|
const prefix = `.AbdStl${++cssCount}`;
|
|
1561
1602
|
const css = typeof style === "string" ? styleStringToCss(style, prefix) : objectToCss(style, prefix);
|
|
1562
1603
|
if (css) {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1604
|
+
const cnt = cssSnippetCount++;
|
|
1605
|
+
const key = arrayToStr([currentScope.prio, cnt]);
|
|
1606
|
+
cssSnippets[key] = css;
|
|
1607
|
+
clean(() => delete cssSnippets[key]);
|
|
1566
1608
|
}
|
|
1567
1609
|
return prefix;
|
|
1568
1610
|
}
|
|
1611
|
+
function insertGlobalCss(style) {
|
|
1612
|
+
const css = objectToCss(style, "");
|
|
1613
|
+
if (css) {
|
|
1614
|
+
const cnt = cssSnippetCount++;
|
|
1615
|
+
const key = arrayToStr([currentScope.prio, cnt]);
|
|
1616
|
+
cssSnippets[key] = css;
|
|
1617
|
+
clean(() => delete cssSnippets[key]);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1569
1620
|
var cssSnippets = proxy({});
|
|
1570
1621
|
var cssSnippetCount = 0;
|
|
1571
1622
|
function combinePrefixSelector(prefix, key) {
|
|
@@ -1637,14 +1688,6 @@ function styleStringToCss(styleStr, selector) {
|
|
|
1637
1688
|
return props ? `${selector}{${props}}
|
|
1638
1689
|
` : "";
|
|
1639
1690
|
}
|
|
1640
|
-
function insertGlobalCss(style) {
|
|
1641
|
-
const css = objectToCss(style, "");
|
|
1642
|
-
if (css) {
|
|
1643
|
-
let cnt = cssSnippetCount++;
|
|
1644
|
-
cssSnippets[cnt] = css;
|
|
1645
|
-
clean(() => delete cssSnippets[cnt]);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
1691
|
var CSS_SHORT = {
|
|
1649
1692
|
m: "margin",
|
|
1650
1693
|
mt: "margin-top",
|
|
@@ -1938,6 +1981,7 @@ var aberdeen_default = Object.assign(A, {
|
|
|
1938
1981
|
derive,
|
|
1939
1982
|
disableCreateDestroy,
|
|
1940
1983
|
dump,
|
|
1984
|
+
freeze,
|
|
1941
1985
|
insertCss,
|
|
1942
1986
|
insertGlobalCss,
|
|
1943
1987
|
invertString,
|
|
@@ -1980,6 +2024,7 @@ export {
|
|
|
1980
2024
|
invertString,
|
|
1981
2025
|
insertGlobalCss,
|
|
1982
2026
|
insertCss,
|
|
2027
|
+
freeze,
|
|
1983
2028
|
dump,
|
|
1984
2029
|
disableCreateDestroy,
|
|
1985
2030
|
derive,
|
|
@@ -1991,6 +2036,7 @@ export {
|
|
|
1991
2036
|
copy,
|
|
1992
2037
|
clone,
|
|
1993
2038
|
clean,
|
|
2039
|
+
_setDev,
|
|
1994
2040
|
OPAQUE,
|
|
1995
2041
|
NO_COPY,
|
|
1996
2042
|
MAP_SIZE_SYMBOL,
|
|
@@ -1999,5 +2045,5 @@ export {
|
|
|
1999
2045
|
A
|
|
2000
2046
|
};
|
|
2001
2047
|
|
|
2002
|
-
//# debugId=
|
|
2048
|
+
//# debugId=BFB325AE18E8016D64756E2164756E21
|
|
2003
2049
|
//# sourceMappingURL=aberdeen.js.map
|