aberdeen 1.10.1 → 1.10.2
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/src/aberdeen.d.ts +20 -20
- package/dist/src/aberdeen.js +16 -17
- package/dist/src/aberdeen.js.map +3 -3
- package/dist/src/aberdeen.min.js +8 -8
- package/dist/src/aberdeen.min.js.map +3 -3
- package/dist/src/route.js +24 -9
- package/dist/src/route.js.map +3 -3
- package/dist/src/route.min.js +2 -2
- package/dist/src/route.min.js.map +3 -3
- package/dist-docs/Tutorial/index.html +10 -10
- package/dist-docs/aberdeen/{_ → A}/index.html +2 -2
- package/dist-docs/aberdeen/NO_COPY/index.html +2 -2
- package/dist-docs/aberdeen/PromiseProxy/index.html +5 -5
- package/dist-docs/aberdeen/clean/index.html +3 -3
- package/dist-docs/aberdeen/clone/index.html +2 -2
- package/dist-docs/aberdeen/copy/index.html +3 -3
- package/dist-docs/aberdeen/count/index.html +2 -2
- package/dist-docs/aberdeen/cssVars/index.html +2 -2
- package/dist-docs/aberdeen/darkMode/index.html +3 -3
- package/dist-docs/aberdeen/default/index.html +18 -18
- package/dist-docs/aberdeen/derive/index.html +3 -3
- package/dist-docs/aberdeen/disableCreateDestroy/index.html +2 -2
- package/dist-docs/aberdeen/dump/index.html +3 -3
- package/dist-docs/aberdeen/index.html +7 -7
- package/dist-docs/aberdeen/insertCss/index.html +5 -5
- package/dist-docs/aberdeen/insertGlobalCss/index.html +2 -2
- package/dist-docs/aberdeen/invertString/index.html +2 -2
- package/dist-docs/aberdeen/isEmpty/index.html +2 -2
- package/dist-docs/aberdeen/map/index.html +4 -4
- package/dist-docs/aberdeen/merge/index.html +3 -3
- package/dist-docs/aberdeen/mount/index.html +7 -7
- package/dist-docs/aberdeen/multiMap/index.html +4 -4
- package/dist-docs/aberdeen/onEach/index.html +2 -2
- package/dist-docs/aberdeen/partition/index.html +4 -4
- package/dist-docs/aberdeen/peek/index.html +9 -9
- package/dist-docs/aberdeen/proxy/index.html +3 -3
- package/dist-docs/aberdeen/ref/index.html +4 -4
- package/dist-docs/aberdeen/runQueue/index.html +2 -2
- package/dist-docs/aberdeen/setErrorHandler/index.html +3 -3
- package/dist-docs/aberdeen/setSpacingCssVars/index.html +2 -2
- package/dist-docs/aberdeen/unmountAll/index.html +3 -3
- package/dist-docs/aberdeen/unproxy/index.html +2 -2
- package/dist-docs/assets/aberdeen/aberdeen.d.ts +20 -20
- package/dist-docs/assets/aberdeen/aberdeen.js +16 -17
- package/dist-docs/assets/aberdeen/aberdeen.js.map +3 -3
- package/dist-docs/assets/aberdeen/aberdeen.min.js +8 -8
- package/dist-docs/assets/aberdeen/aberdeen.min.js.map +3 -3
- package/dist-docs/assets/aberdeen/route.js +24 -9
- package/dist-docs/assets/aberdeen/route.js.map +3 -3
- package/dist-docs/assets/aberdeen/route.min.js +2 -2
- package/dist-docs/assets/aberdeen/route.min.js.map +3 -3
- package/dist-docs/assets/navigation.js +1 -1
- package/dist-docs/assets/search.js +1 -1
- package/dist-docs/dispatcher/Dispatcher/index.html +4 -4
- package/dist-docs/dispatcher/MATCH_FAILED/index.html +2 -2
- package/dist-docs/dispatcher/MATCH_REST/index.html +2 -2
- package/dist-docs/dispatcher/index.html +2 -2
- package/dist-docs/hierarchy.html +1 -1
- package/dist-docs/index.html +2 -2
- package/dist-docs/modules.html +1 -1
- package/dist-docs/prediction/applyCanon/index.html +2 -2
- package/dist-docs/prediction/applyPrediction/index.html +2 -2
- package/dist-docs/prediction/index.html +2 -2
- package/dist-docs/route/Route/index.html +9 -9
- package/dist-docs/route/back/index.html +2 -2
- package/dist-docs/route/current/index.html +2 -2
- package/dist-docs/route/go/index.html +2 -2
- package/dist-docs/route/index.html +2 -2
- package/dist-docs/route/interceptLinks/index.html +2 -2
- package/dist-docs/route/persistScroll/index.html +2 -2
- package/dist-docs/route/push/index.html +2 -2
- package/dist-docs/route/setLog/index.html +2 -2
- package/dist-docs/route/up/index.html +2 -2
- package/dist-docs/sitemap.xml +57 -57
- package/dist-docs/transitions/grow/index.html +2 -2
- package/dist-docs/transitions/index.html +2 -2
- package/dist-docs/transitions/shrink/index.html +2 -2
- package/package.json +6 -6
- package/skill/SKILL.md +11 -10
- package/skill/aberdeen.md +111 -111
- package/skill/dispatcher.md +6 -6
- package/skill/prediction.md +3 -3
- package/skill/route.md +17 -17
- package/skill/transitions.md +3 -3
- package/src/aberdeen.ts +32 -34
- package/src/route.ts +27 -8
package/dist/src/aberdeen.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ export declare function setSpacingCssVars(base?: number, unit?: string): void;
|
|
|
306
306
|
* This function is reactive - scopes that call it will re-execute when the
|
|
307
307
|
* browser's color scheme preference changes (via the `prefers-color-scheme` media query).
|
|
308
308
|
*
|
|
309
|
-
* Use this in combination with {@link
|
|
309
|
+
* Use this in combination with {@link A | A} and {@link cssVars} to implement theme switching:
|
|
310
310
|
*
|
|
311
311
|
* @returns `true` if the browser prefers dark mode, `false` if it prefers light mode.
|
|
312
312
|
*
|
|
@@ -336,8 +336,8 @@ export declare function clone<T extends object>(src: T): T;
|
|
|
336
336
|
* Creates a reactive reference (`{ value: T }`-like object) to a specific value
|
|
337
337
|
* within a proxied object or array.
|
|
338
338
|
*
|
|
339
|
-
* This is primarily used for the `bind` property in {@link
|
|
340
|
-
* with form elements, and for passing a reactive property to any of the {@link
|
|
339
|
+
* This is primarily used for the `bind` property in {@link A | A} to create two-way data bindings
|
|
340
|
+
* with form elements, and for passing a reactive property to any of the {@link A | A} key-value pairs.
|
|
341
341
|
*
|
|
342
342
|
* Reading `ref.value` accesses the property from the underlying proxy (and subscribes the current scope).
|
|
343
343
|
* Assigning to `ref.value` updates the property in the underlying proxy (triggering reactive updates).
|
|
@@ -490,7 +490,7 @@ export declare function disableCreateDestroy(): void;
|
|
|
490
490
|
* ```
|
|
491
491
|
* This is often used together with {@link ref}, in order to use properties other than `.value`.
|
|
492
492
|
*/
|
|
493
|
-
export declare function
|
|
493
|
+
export declare function A(...args: any[]): undefined | Element;
|
|
494
494
|
/**
|
|
495
495
|
* Inserts CSS rules into the document, scoping them with a unique class name.
|
|
496
496
|
*
|
|
@@ -502,7 +502,7 @@ export declare function $(...args: any[]): undefined | Element;
|
|
|
502
502
|
*
|
|
503
503
|
* ### Concise Style Strings
|
|
504
504
|
*
|
|
505
|
-
* Concise style strings use two syntaxes (same as inline CSS in {@link
|
|
505
|
+
* Concise style strings use two syntaxes (same as inline CSS in {@link A | A}):
|
|
506
506
|
* - **Short form** `key:value` (no space after colon): The value ends at the next whitespace.
|
|
507
507
|
* Example: `'m:$3 bg:red r:8px'`
|
|
508
508
|
* - **Long form** `key: value;` (space after colon): The value continues until a semicolon.
|
|
@@ -510,11 +510,11 @@ export declare function $(...args: any[]): undefined | Element;
|
|
|
510
510
|
*
|
|
511
511
|
* Both forms can be mixed: `'m:$3 box-shadow: 0 2px 4px rgba(0,0,0,0.2); bg:$cardBg'`
|
|
512
512
|
*
|
|
513
|
-
* Supports the same CSS shortcuts as {@link
|
|
513
|
+
* Supports the same CSS shortcuts as {@link A | A} and CSS variable references with `$` (e.g., `$primary`, `$3`).
|
|
514
514
|
*
|
|
515
515
|
* @param style - A concise style string or a style object.
|
|
516
516
|
* @returns The unique class name prefix used for scoping (e.g., `.AbdStl1`).
|
|
517
|
-
* Use this prefix with {@link
|
|
517
|
+
* Use this prefix with {@link A | A} to apply the styles.
|
|
518
518
|
*
|
|
519
519
|
* @example Basic Usage with Shortcuts and CSS Variables
|
|
520
520
|
* ```typescript
|
|
@@ -608,7 +608,7 @@ export declare function insertGlobalCss(style: object): void;
|
|
|
608
608
|
/**
|
|
609
609
|
* Sets a custom error handler function for errors that occur asynchronously
|
|
610
610
|
* within reactive scopes (e.g., during updates triggered by proxy changes in
|
|
611
|
-
* {@link derive} or {@link
|
|
611
|
+
* {@link derive} or {@link A | A} render functions).
|
|
612
612
|
*
|
|
613
613
|
* The default handler logs the error to `console.error` and adds a simple
|
|
614
614
|
* 'Error' message div to the DOM at the location where the error occurred (if possible).
|
|
@@ -655,7 +655,7 @@ export declare function setErrorHandler(handler?: (error: Error) => boolean | un
|
|
|
655
655
|
* This is useful for releasing resources, removing manual event listeners, or cleaning up
|
|
656
656
|
* side effects associated with the scope. Cleaners are run in reverse order of registration.
|
|
657
657
|
*
|
|
658
|
-
* Scopes are created by functions like {@link derive}, {@link mount}, {@link
|
|
658
|
+
* Scopes are created by functions like {@link derive}, {@link mount}, {@link A | A} (when given a render function),
|
|
659
659
|
* and internally by constructs like {@link onEach}.
|
|
660
660
|
*
|
|
661
661
|
* @param cleaner - The function to execute during cleanup.
|
|
@@ -696,7 +696,7 @@ export declare function clean(cleaner: () => void): void;
|
|
|
696
696
|
* Use {@link peek} or {@link unproxy} within the function to read proxied data without subscribing to it.
|
|
697
697
|
*
|
|
698
698
|
* @param func - The function to execute reactively. Any DOM manipulations should typically
|
|
699
|
-
* be done using {@link
|
|
699
|
+
* be done using {@link A | A} within this function. Its return value will be made available as an
|
|
700
700
|
* observable returned by the `derive()` function.
|
|
701
701
|
* @returns An observable object, with its `value` property containing whatever the last run of `func` returned.
|
|
702
702
|
*
|
|
@@ -737,21 +737,21 @@ export declare function clean(cleaner: () => void): void;
|
|
|
737
737
|
export declare function derive<T>(func: () => T): ValueRef<T>;
|
|
738
738
|
/**
|
|
739
739
|
* Attaches a reactive Aberdeen UI fragment to an existing DOM element. Without the use of
|
|
740
|
-
* this function, {@link
|
|
740
|
+
* this function, {@link A | A} will assume `document.body` as its root.
|
|
741
741
|
*
|
|
742
742
|
* It creates a top-level reactive scope associated with the `parentElement`. The provided
|
|
743
743
|
* function `func` is executed immediately within this scope. Any proxied data read by `func`
|
|
744
744
|
* will cause it to re-execute when the data changes, updating the DOM elements created within it.
|
|
745
745
|
*
|
|
746
|
-
* Calls to {@link
|
|
747
|
-
* You can nest {@link derive} or other {@link
|
|
746
|
+
* Calls to {@link A | A} inside `func` will append nodes to `parentElement`.
|
|
747
|
+
* You can nest {@link derive} or other {@link A | A} scopes within `func`.
|
|
748
748
|
* Use {@link unmountAll} to clean up all mounted scopes and their DOM nodes.
|
|
749
749
|
*
|
|
750
750
|
* Mounting scopes happens reactively, meaning that if this function is called from within another
|
|
751
|
-
* ({@link derive} or {@link
|
|
751
|
+
* ({@link derive} or {@link A | A} or {@link mount}) scope that gets cleaned up, so will the mount.
|
|
752
752
|
*
|
|
753
753
|
* @param parentElement - The native DOM `Element` to which the UI fragment will be appended.
|
|
754
|
-
* @param func - The function that defines the UI fragment, typically containing calls to {@link
|
|
754
|
+
* @param func - The function that defines the UI fragment, typically containing calls to {@link A | A}.
|
|
755
755
|
*
|
|
756
756
|
* @example Basic Mount
|
|
757
757
|
* ```javascript
|
|
@@ -780,7 +780,7 @@ export declare function derive<T>(func: () => T): ValueRef<T>;
|
|
|
780
780
|
export declare function mount(parentElement: Element, func: () => void): void;
|
|
781
781
|
/**
|
|
782
782
|
* Removes all Aberdeen-managed DOM nodes and stops all active reactive scopes
|
|
783
|
-
* (created by {@link mount}, {@link derive}, {@link
|
|
783
|
+
* (created by {@link mount}, {@link derive}, {@link A | A} with functions, etc.).
|
|
784
784
|
*
|
|
785
785
|
* This effectively cleans up the entire Aberdeen application state. Aside from in
|
|
786
786
|
* automated tests, there should probably be little reason to call this function.
|
|
@@ -789,7 +789,7 @@ export declare function unmountAll(): void;
|
|
|
789
789
|
/**
|
|
790
790
|
* Executes a function or retrieves a value *without* creating subscriptions in the current reactive scope, and returns its result.
|
|
791
791
|
*
|
|
792
|
-
* This is useful when you need to access reactive data inside a reactive scope (like {@link
|
|
792
|
+
* This is useful when you need to access reactive data inside a reactive scope (like {@link A | A})
|
|
793
793
|
* but do not want changes to that specific data to trigger a re-execute of the scope.
|
|
794
794
|
*
|
|
795
795
|
* Note: You may also use {@link unproxy} to get to the raw underlying data structure, which can be used to similar effect.
|
|
@@ -841,7 +841,7 @@ export declare function partition<IN_K extends string | number | symbol, OUT_K e
|
|
|
841
841
|
export declare function partition<IN_K extends string | number | symbol, OUT_K extends string | number | symbol, IN_V>(source: Map<IN_K, IN_V>, func: (value: IN_V, key: IN_K) => undefined | OUT_K | OUT_K[]): Record<OUT_K, Record<IN_K, IN_V>>;
|
|
842
842
|
/**
|
|
843
843
|
* Renders a live, recursive dump of a proxied data structure (or any value)
|
|
844
|
-
* into the DOM at the current {@link
|
|
844
|
+
* into the DOM at the current {@link A | A} insertion point.
|
|
845
845
|
*
|
|
846
846
|
* Uses `<ul>` and `<li>` elements to display object properties and array items.
|
|
847
847
|
* Updates reactively if the dumped data changes. Primarily intended for debugging purposes.
|
|
@@ -883,7 +883,7 @@ export declare function dump<T>(data: T): T;
|
|
|
883
883
|
* });
|
|
884
884
|
* ```
|
|
885
885
|
*/
|
|
886
|
-
declare const
|
|
886
|
+
declare const _default: typeof A & {
|
|
887
887
|
/** {@inheritDoc clean} */ clean: typeof clean;
|
|
888
888
|
/** {@inheritDoc clone} */ clone: typeof clone;
|
|
889
889
|
/** {@inheritDoc copy} */ copy: typeof copy;
|
|
@@ -913,4 +913,4 @@ declare const A: typeof $ & {
|
|
|
913
913
|
/** {@inheritDoc unmountAll} */ unmountAll: typeof unmountAll;
|
|
914
914
|
/** {@inheritDoc unproxy} */ unproxy: typeof unproxy;
|
|
915
915
|
};
|
|
916
|
-
export default
|
|
916
|
+
export default _default;
|
package/dist/src/aberdeen.js
CHANGED
|
@@ -1295,7 +1295,7 @@ var SPECIAL_PROPS = {
|
|
|
1295
1295
|
function disableCreateDestroy() {
|
|
1296
1296
|
SPECIAL_PROPS.create = SPECIAL_PROPS.destroy = () => {};
|
|
1297
1297
|
}
|
|
1298
|
-
function
|
|
1298
|
+
function A(...args) {
|
|
1299
1299
|
let el = currentScope.el;
|
|
1300
1300
|
let svg = currentScope.svg;
|
|
1301
1301
|
const argCount = args.length;
|
|
@@ -1651,21 +1651,21 @@ function partition(source, func) {
|
|
|
1651
1651
|
function dump(data) {
|
|
1652
1652
|
if (data && typeof data === "object") {
|
|
1653
1653
|
const name = data.constructor.name.toLowerCase() || "unknown object";
|
|
1654
|
-
|
|
1654
|
+
A(`#<${name}>`);
|
|
1655
1655
|
if (NO_COPY in data) {
|
|
1656
|
-
|
|
1656
|
+
A("# [NO_COPY]");
|
|
1657
1657
|
} else {
|
|
1658
|
-
|
|
1658
|
+
A("ul", () => {
|
|
1659
1659
|
onEach(data, (value, key) => {
|
|
1660
|
-
|
|
1661
|
-
|
|
1660
|
+
A("li", () => {
|
|
1661
|
+
A(`#${JSON.stringify(key)}: `);
|
|
1662
1662
|
dump(value);
|
|
1663
1663
|
});
|
|
1664
1664
|
});
|
|
1665
1665
|
});
|
|
1666
1666
|
}
|
|
1667
1667
|
} else if (data !== undefined) {
|
|
1668
|
-
|
|
1668
|
+
A("#" + JSON.stringify(data));
|
|
1669
1669
|
}
|
|
1670
1670
|
return data;
|
|
1671
1671
|
}
|
|
@@ -1681,7 +1681,7 @@ function handleError(e, showMessage) {
|
|
|
1681
1681
|
}
|
|
1682
1682
|
try {
|
|
1683
1683
|
if (showMessage)
|
|
1684
|
-
|
|
1684
|
+
A("div.aberdeen-error#Error");
|
|
1685
1685
|
} catch {}
|
|
1686
1686
|
}
|
|
1687
1687
|
function withEmitHandler(handler, func) {
|
|
@@ -1695,15 +1695,15 @@ function withEmitHandler(handler, func) {
|
|
|
1695
1695
|
}
|
|
1696
1696
|
if (typeof document !== "undefined") {
|
|
1697
1697
|
leakScope(() => {
|
|
1698
|
-
|
|
1698
|
+
A(() => {
|
|
1699
1699
|
if (isEmpty(cssSnippets) && isEmpty(cssVars))
|
|
1700
1700
|
return;
|
|
1701
1701
|
mount(document.head, () => {
|
|
1702
|
-
|
|
1702
|
+
A("style.abd", () => {
|
|
1703
1703
|
onEach(cssSnippets, (value) => {
|
|
1704
|
-
|
|
1704
|
+
A("#", value);
|
|
1705
1705
|
});
|
|
1706
|
-
|
|
1706
|
+
A(() => {
|
|
1707
1707
|
if (isEmpty(cssVars))
|
|
1708
1708
|
return;
|
|
1709
1709
|
let css = ":root{";
|
|
@@ -1713,14 +1713,14 @@ if (typeof document !== "undefined") {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
css += `}
|
|
1715
1715
|
`;
|
|
1716
|
-
|
|
1716
|
+
A("#", css);
|
|
1717
1717
|
});
|
|
1718
1718
|
});
|
|
1719
1719
|
});
|
|
1720
1720
|
});
|
|
1721
1721
|
});
|
|
1722
1722
|
}
|
|
1723
|
-
var
|
|
1723
|
+
var aberdeen_default = Object.assign(A, {
|
|
1724
1724
|
clean,
|
|
1725
1725
|
clone,
|
|
1726
1726
|
copy,
|
|
@@ -1750,7 +1750,6 @@ var A = Object.assign($, {
|
|
|
1750
1750
|
unmountAll,
|
|
1751
1751
|
unproxy
|
|
1752
1752
|
});
|
|
1753
|
-
var aberdeen_default = A;
|
|
1754
1753
|
export {
|
|
1755
1754
|
withEmitHandler,
|
|
1756
1755
|
unproxy,
|
|
@@ -1786,8 +1785,8 @@ export {
|
|
|
1786
1785
|
NO_COPY,
|
|
1787
1786
|
MAP_SIZE_SYMBOL,
|
|
1788
1787
|
EMPTY,
|
|
1789
|
-
|
|
1788
|
+
A
|
|
1790
1789
|
};
|
|
1791
1790
|
|
|
1792
|
-
//# debugId=
|
|
1791
|
+
//# debugId=3B0B71E6E017014564756E2164756E21
|
|
1793
1792
|
//# sourceMappingURL=aberdeen.js.map
|