aberdeen 1.5.0 → 1.7.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 +5 -11
- package/dist/aberdeen.d.ts +234 -128
- package/dist/aberdeen.js +212 -103
- package/dist/aberdeen.js.map +3 -3
- package/dist/dispatcher.d.ts +10 -7
- package/dist/dispatcher.js +11 -10
- package/dist/dispatcher.js.map +3 -3
- package/dist/route.d.ts +17 -0
- package/dist/route.js +65 -23
- package/dist/route.js.map +3 -3
- package/dist-min/aberdeen.js +9 -7
- package/dist-min/aberdeen.js.map +3 -3
- package/dist-min/dispatcher.js +2 -2
- package/dist-min/dispatcher.js.map +3 -3
- package/dist-min/route.js +2 -2
- package/dist-min/route.js.map +3 -3
- package/html-to-aberdeen +3 -6
- package/package.json +5 -2
- package/skill/SKILL.md +791 -206
- package/skill/aberdeen.md +2338 -0
- package/skill/dispatcher.md +129 -0
- package/skill/prediction.md +73 -0
- package/skill/route.md +277 -0
- package/skill/transitions.md +59 -0
- package/src/aberdeen.ts +490 -244
- package/src/dispatcher.ts +16 -13
- package/src/route.ts +93 -22
- package/skill/references/prediction.md +0 -45
- package/skill/references/routing.md +0 -81
- package/skill/references/transitions.md +0 -52
package/dist/dispatcher.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Symbol to return when a custom {@link Dispatcher.addRoute} matcher cannot match a segment.
|
|
3
3
|
*/
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const MATCH_FAILED: unique symbol;
|
|
5
5
|
/**
|
|
6
6
|
* Special {@link Dispatcher.addRoute} matcher that matches the rest of the segments as an array of strings.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
9
|
-
type Matcher = string | ((segment: string) => any) | typeof
|
|
10
|
-
type ExtractParamType<M> = M extends string ? never : (M extends ((segment: string) => infer R) ? Exclude<R, typeof
|
|
8
|
+
export declare const MATCH_REST: unique symbol;
|
|
9
|
+
type Matcher = string | ((segment: string) => any) | typeof MATCH_REST;
|
|
10
|
+
type ExtractParamType<M> = M extends string ? never : (M extends ((segment: string) => infer R) ? Exclude<R, typeof MATCH_FAILED> : (M extends typeof MATCH_REST ? string[] : never));
|
|
11
11
|
type ParamsFromMatchers<T extends Matcher[]> = T extends [infer M1, ...infer Rest] ? (M1 extends Matcher ? (ExtractParamType<M1> extends never ? ParamsFromMatchers<Rest extends Matcher[] ? Rest : []> : [ExtractParamType<M1>, ...ParamsFromMatchers<Rest extends Matcher[] ? Rest : []>]) : never) : [];
|
|
12
12
|
/**
|
|
13
13
|
* Simple route matcher and dispatcher.
|
|
@@ -15,6 +15,9 @@ type ParamsFromMatchers<T extends Matcher[]> = T extends [infer M1, ...infer Res
|
|
|
15
15
|
* Example usage:
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
|
+
* import * as route from 'aberdeen/route';
|
|
19
|
+
* import { Dispatcher, MATCH_REST } from 'aberdeen/dispatcher';
|
|
20
|
+
*
|
|
18
21
|
* const dispatcher = new Dispatcher();
|
|
19
22
|
*
|
|
20
23
|
* dispatcher.addRoute("user", Number, "stream", String, (id, stream) => {
|
|
@@ -24,7 +27,7 @@ type ParamsFromMatchers<T extends Matcher[]> = T extends [infer M1, ...infer Res
|
|
|
24
27
|
* dispatcher.dispatch(["user", "42", "stream", "music"]);
|
|
25
28
|
* // Logs: User 42, stream music
|
|
26
29
|
*
|
|
27
|
-
* dispatcher.addRoute("search",
|
|
30
|
+
* dispatcher.addRoute("search", MATCH_REST, (terms: string[]) => {
|
|
28
31
|
* console.log("Search terms:", terms);
|
|
29
32
|
* });
|
|
30
33
|
*
|
|
@@ -38,8 +41,8 @@ export declare class Dispatcher {
|
|
|
38
41
|
* Add a route with matchers and a handler function.
|
|
39
42
|
* @param args An array of matchers followed by a handler function. Each matcher can be:
|
|
40
43
|
* - A string: matches exactly that string.
|
|
41
|
-
* - A function: takes a string segment and returns a value (of any type) if it matches, or {@link
|
|
42
|
-
* - The special {@link
|
|
44
|
+
* - A function: takes a string segment and returns a value (of any type) if it matches, or {@link MATCH_FAILED} if it doesn't match. The return value (if not `MATCH_FAILED` and not `NaN`) is passed as a parameter to the handler function. The standard JavaScript functions `Number` and `String` can be used to match numeric and string segments respectively.
|
|
45
|
+
* - The special {@link MATCH_REST} symbol: matches the rest of the segments as an array of strings. Only one `MATCH_REST` is allowed.
|
|
43
46
|
* @template T - Array of matcher types.
|
|
44
47
|
* @template H - Handler function type, inferred from the matchers.
|
|
45
48
|
*/
|
package/dist/dispatcher.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/dispatcher.ts
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var MATCH_FAILED = Symbol("MATCH_FAILED");
|
|
3
|
+
var MATCH_REST = Symbol("MATCH_REST");
|
|
4
4
|
|
|
5
5
|
class Dispatcher {
|
|
6
6
|
routes = [];
|
|
@@ -10,9 +10,9 @@ class Dispatcher {
|
|
|
10
10
|
if (typeof handler !== "function") {
|
|
11
11
|
throw new Error("Last argument should be a handler function");
|
|
12
12
|
}
|
|
13
|
-
const restCount = matchers.filter((m) => m ===
|
|
13
|
+
const restCount = matchers.filter((m) => m === MATCH_REST).length;
|
|
14
14
|
if (restCount > 1) {
|
|
15
|
-
throw new Error("Only one
|
|
15
|
+
throw new Error("Only one MATCH_REST is allowed");
|
|
16
16
|
}
|
|
17
17
|
this.routes.push({ matchers, handler });
|
|
18
18
|
}
|
|
@@ -31,7 +31,7 @@ function matchRoute(route, segments) {
|
|
|
31
31
|
const args = [];
|
|
32
32
|
let segmentIndex = 0;
|
|
33
33
|
for (const matcher of route.matchers) {
|
|
34
|
-
if (matcher ===
|
|
34
|
+
if (matcher === MATCH_REST) {
|
|
35
35
|
const len = segments.length - (route.matchers.length - 1);
|
|
36
36
|
if (len < 0)
|
|
37
37
|
return;
|
|
@@ -47,19 +47,20 @@ function matchRoute(route, segments) {
|
|
|
47
47
|
return;
|
|
48
48
|
} else if (typeof matcher === "function") {
|
|
49
49
|
const result = matcher(segment);
|
|
50
|
-
if (result ===
|
|
50
|
+
if (result === MATCH_FAILED || typeof result === "number" && isNaN(result))
|
|
51
51
|
return;
|
|
52
52
|
args.push(result);
|
|
53
53
|
}
|
|
54
54
|
segmentIndex++;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
if (segmentIndex === segments.length)
|
|
57
|
+
return args;
|
|
57
58
|
}
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
MATCH_REST,
|
|
61
|
+
MATCH_FAILED,
|
|
61
62
|
Dispatcher
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
//# debugId=
|
|
65
|
+
//# debugId=EB41818E6FB7C09864756E2164756E21
|
|
65
66
|
//# sourceMappingURL=dispatcher.js.map
|
package/dist/dispatcher.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/dispatcher.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Symbol to return when a custom {@link Dispatcher.addRoute} matcher cannot match a segment.\n */\nexport const
|
|
5
|
+
"/**\n * Symbol to return when a custom {@link Dispatcher.addRoute} matcher cannot match a segment.\n */\nexport const MATCH_FAILED: unique symbol = Symbol(\"MATCH_FAILED\");\n\n/**\n * Special {@link Dispatcher.addRoute} matcher that matches the rest of the segments as an array of strings.\n */\nexport const MATCH_REST: unique symbol = Symbol(\"MATCH_REST\");\n\ntype Matcher = string | ((segment: string) => any) | typeof MATCH_REST;\n\ntype ExtractParamType<M> = M extends string\n? never : (\n M extends ((segment: string) => infer R)\n ? Exclude<R, typeof MATCH_FAILED>\n : (M extends typeof MATCH_REST ? string[] : never)\n);\n\ntype ParamsFromMatchers<T extends Matcher[]> = T extends [infer M1, ...infer Rest]\n? (\n M1 extends Matcher\n ? (\n ExtractParamType<M1> extends never\n ? ParamsFromMatchers<Rest extends Matcher[] ? Rest : []>\n : [ExtractParamType<M1>, ...ParamsFromMatchers<Rest extends Matcher[] ? Rest : []>]\n ) : never\n) : [];\n\ninterface DispatcherRoute {\n matchers: Matcher[];\n handler: (...params: any[]) => void;\n}\n\n/**\n * Simple route matcher and dispatcher.\n * \n * Example usage:\n * \n * ```ts\n * import * as route from 'aberdeen/route';\n * import { Dispatcher, MATCH_REST } from 'aberdeen/dispatcher';\n * \n * const dispatcher = new Dispatcher();\n * \n * dispatcher.addRoute(\"user\", Number, \"stream\", String, (id, stream) => {\n * console.log(`User ${id}, stream ${stream}`);\n * });\n *\n * dispatcher.dispatch([\"user\", \"42\", \"stream\", \"music\"]);\n * // Logs: User 42, stream music\n * \n * dispatcher.addRoute(\"search\", MATCH_REST, (terms: string[]) => {\n * console.log(\"Search terms:\", terms);\n * });\n * \n * dispatcher.dispatch([\"search\", \"classical\", \"piano\"]);\n * // Logs: Search terms: [ 'classical', 'piano' ]\n * ```\n */\nexport class Dispatcher {\n private routes: Array<DispatcherRoute> = [];\n \n /**\n * Add a route with matchers and a handler function.\n * @param args An array of matchers followed by a handler function. Each matcher can be:\n * - A string: matches exactly that string.\n * - A function: takes a string segment and returns a value (of any type) if it matches, or {@link MATCH_FAILED} if it doesn't match. The return value (if not `MATCH_FAILED` and not `NaN`) is passed as a parameter to the handler function. The standard JavaScript functions `Number` and `String` can be used to match numeric and string segments respectively.\n * - The special {@link MATCH_REST} symbol: matches the rest of the segments as an array of strings. Only one `MATCH_REST` is allowed.\n * @template T - Array of matcher types.\n * @template H - Handler function type, inferred from the matchers.\n */\n addRoute<T extends Matcher[], H extends (...args: ParamsFromMatchers<T>) => void>(...args: [...T, H]): void {\n const matchers = args.slice(0, -1) as Matcher[];\n const handler = args[args.length - 1] as (...args: any) => any;\n\n if (typeof handler !== \"function\") {\n throw new Error(\"Last argument should be a handler function\");\n }\n \n const restCount = matchers.filter(m => m === MATCH_REST).length;\n if (restCount > 1) {\n throw new Error(\"Only one MATCH_REST is allowed\");\n }\n\n this.routes.push({ matchers, handler });\n }\n \n /**\n * Dispatches the given segments to the first route handler that matches.\n * @param segments Array of string segments to match against the added routes. When using this class with the Aberdeen `route` module, one would typically pass `route.current.p`.\n * @returns True if a matching route was found and handled, false otherwise.\n */\n dispatch(segments: string[]): boolean {\n for (const route of this.routes) {\n const args = matchRoute(route, segments);\n if (args) {\n route.handler(...args);\n return true;\n }\n }\n return false;\n }\n}\n\nfunction matchRoute(route: DispatcherRoute, segments: string[]): any[] | undefined {\n const args: any[] = [];\n let segmentIndex = 0;\n\n for (const matcher of route.matchers) {\n if (matcher === MATCH_REST) {\n const len = segments.length - (route.matchers.length - 1);\n if (len < 0) return;\n args.push(segments.slice(segmentIndex, segmentIndex + len));\n segmentIndex += len;\n continue;\n }\n\n if (segmentIndex >= segments.length) return;\n const segment = segments[segmentIndex];\n \n if (typeof matcher === \"string\") {\n if (segment !== matcher) return;\n } else if (typeof matcher === \"function\") {\n const result = matcher(segment);\n if (result === MATCH_FAILED || (typeof result === 'number' && isNaN(result))) return;\n args.push(result);\n }\n \n segmentIndex++;\n }\n if (segmentIndex === segments.length) return args; // success!\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAGO,IAAM,
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAGO,IAAM,eAA8B,OAAO,cAAc;AAKzD,IAAM,aAA4B,OAAO,YAAY;AAAA;AAoDrD,MAAM,WAAW;AAAA,EACZ,SAAiC,CAAC;AAAA,EAW1C,QAAiF,IAAI,MAAuB;AAAA,IACxG,MAAM,WAAW,KAAK,MAAM,GAAG,EAAE;AAAA,IACjC,MAAM,UAAU,KAAK,KAAK,SAAS;AAAA,IAEnC,IAAI,OAAO,YAAY,YAAY;AAAA,MAC/B,MAAM,IAAI,MAAM,4CAA4C;AAAA,IAChE;AAAA,IAEA,MAAM,YAAY,SAAS,OAAO,OAAK,MAAM,UAAU,EAAE;AAAA,IACzD,IAAI,YAAY,GAAG;AAAA,MACf,MAAM,IAAI,MAAM,gCAAg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@ export declare function up(stripCount?: number): void;
|
|
|
90
90
|
* The scroll position will be persisted in `route.aux.scroll.<name>`.
|
|
91
91
|
*/
|
|
92
92
|
export declare function persistScroll(name?: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Intercept clicks and Enter key presses on links (`<a>` tags) and use Aberdeen routing
|
|
95
|
+
* instead of browser navigation for local paths (paths without a protocol or host).
|
|
96
|
+
*
|
|
97
|
+
* This allows you to use regular HTML anchor tags for navigation without needing to
|
|
98
|
+
* manually attach click handlers to each link.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```js
|
|
102
|
+
* // In your root component:
|
|
103
|
+
* route.interceptLinks();
|
|
104
|
+
*
|
|
105
|
+
* // Now you can use regular anchor tags:
|
|
106
|
+
* $('a text=About href=/corporate/about');
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function interceptLinks(): void;
|
|
93
110
|
/**
|
|
94
111
|
* The global {@link Route} object reflecting the current URL and browser history state. Changes you make to this affect the current browser history item (modifying the URL if needed).
|
|
95
112
|
*/
|
package/dist/route.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/route.ts
|
|
2
|
-
import { clean,
|
|
2
|
+
import { clean, $, proxy, runQueue, unproxy, copy, merge, clone, leakScope } from "./aberdeen.js";
|
|
3
3
|
var log = () => {};
|
|
4
4
|
function setLog(value) {
|
|
5
5
|
if (value === true) {
|
|
@@ -10,13 +10,16 @@ function setLog(value) {
|
|
|
10
10
|
log = value;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
var windowE = typeof ABERDEEN_FAKE_WINDOW !== "undefined" ? ABERDEEN_FAKE_WINDOW : window;
|
|
14
|
+
var locationE = windowE.location;
|
|
15
|
+
var historyE = windowE.history;
|
|
13
16
|
function getRouteFromBrowser() {
|
|
14
17
|
return toCanonRoute({
|
|
15
|
-
path:
|
|
16
|
-
hash:
|
|
17
|
-
search: Object.fromEntries(new URLSearchParams(
|
|
18
|
-
state:
|
|
19
|
-
}, "load", (
|
|
18
|
+
path: locationE.pathname,
|
|
19
|
+
hash: locationE.hash,
|
|
20
|
+
search: Object.fromEntries(new URLSearchParams(locationE.search)),
|
|
21
|
+
state: historyE.state?.state || {}
|
|
22
|
+
}, "load", (historyE.state?.stack?.length || 0) + 1);
|
|
20
23
|
}
|
|
21
24
|
function equal(a, b, partial) {
|
|
22
25
|
if (a === b)
|
|
@@ -82,28 +85,28 @@ function targetToPartial(target) {
|
|
|
82
85
|
return target;
|
|
83
86
|
}
|
|
84
87
|
function go(target, nav = "go") {
|
|
85
|
-
const stack =
|
|
88
|
+
const stack = historyE.state?.stack || [];
|
|
86
89
|
prevStack = stack.concat(JSON.stringify(unproxy(current)));
|
|
87
90
|
const newRoute = toCanonRoute(targetToPartial(target), nav, prevStack.length + 1);
|
|
88
91
|
copy(current, newRoute);
|
|
89
92
|
log(nav, newRoute);
|
|
90
|
-
|
|
93
|
+
historyE.pushState({ state: newRoute.state, stack: prevStack }, "", getUrl(newRoute));
|
|
91
94
|
runQueue();
|
|
92
95
|
}
|
|
93
96
|
function push(target) {
|
|
94
|
-
|
|
95
|
-
merge(
|
|
96
|
-
go(
|
|
97
|
+
const c = clone(unproxy(current));
|
|
98
|
+
merge(c, targetToPartial(target));
|
|
99
|
+
go(c);
|
|
97
100
|
}
|
|
98
101
|
function back(target = {}) {
|
|
99
102
|
const partial = targetToPartial(target);
|
|
100
|
-
const stack =
|
|
103
|
+
const stack = historyE.state?.stack || [];
|
|
101
104
|
for (let i = stack.length - 1;i >= 0; i--) {
|
|
102
105
|
const histRoute = JSON.parse(stack[i]);
|
|
103
106
|
if (equal(histRoute, partial, true)) {
|
|
104
107
|
const pages = i - stack.length;
|
|
105
108
|
log(`back`, pages, histRoute);
|
|
106
|
-
|
|
109
|
+
historyE.go(pages);
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
@@ -113,12 +116,12 @@ function back(target = {}) {
|
|
|
113
116
|
}
|
|
114
117
|
function up(stripCount = 1) {
|
|
115
118
|
const currentP = unproxy(current).p;
|
|
116
|
-
const stack =
|
|
119
|
+
const stack = historyE.state?.stack || [];
|
|
117
120
|
for (let i = stack.length - 1;i >= 0; i--) {
|
|
118
121
|
const histRoute = JSON.parse(stack[i]);
|
|
119
122
|
if (histRoute.p.length < currentP.length && equal(histRoute.p, currentP.slice(0, histRoute.p.length), false)) {
|
|
120
123
|
log(`up to ${i + 1} / ${stack.length}`, histRoute);
|
|
121
|
-
|
|
124
|
+
historyE.go(i - stack.length);
|
|
122
125
|
return;
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -127,7 +130,7 @@ function up(stripCount = 1) {
|
|
|
127
130
|
copy(current, newRoute);
|
|
128
131
|
}
|
|
129
132
|
function persistScroll(name = "main") {
|
|
130
|
-
const el =
|
|
133
|
+
const el = $();
|
|
131
134
|
el.addEventListener("scroll", onScroll);
|
|
132
135
|
clean(() => el.removeEventListener("scroll", onScroll));
|
|
133
136
|
const restore = unproxy(current).state.scroll?.[name];
|
|
@@ -142,18 +145,56 @@ function persistScroll(name = "main") {
|
|
|
142
145
|
};
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
function interceptLinks() {
|
|
149
|
+
$({
|
|
150
|
+
click: handleEvent,
|
|
151
|
+
keydown: handleKeyEvent
|
|
152
|
+
});
|
|
153
|
+
function handleKeyEvent(e) {
|
|
154
|
+
if (e.key === "Enter") {
|
|
155
|
+
handleEvent(e);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function handleEvent(e) {
|
|
159
|
+
let target = e.target;
|
|
160
|
+
while (target && target.tagName?.toUpperCase() !== "A") {
|
|
161
|
+
target = target.parentElement;
|
|
162
|
+
}
|
|
163
|
+
if (!target)
|
|
164
|
+
return;
|
|
165
|
+
const anchor = target;
|
|
166
|
+
const href = anchor.getAttribute("href");
|
|
167
|
+
if (!href)
|
|
168
|
+
return;
|
|
169
|
+
if (href.startsWith("#"))
|
|
170
|
+
return;
|
|
171
|
+
if (href.startsWith("//") || /^[^/?#]+:/.test(href))
|
|
172
|
+
return;
|
|
173
|
+
if (anchor.getAttribute("target") || anchor.getAttribute("download"))
|
|
174
|
+
return;
|
|
175
|
+
if (typeof MouseEvent !== "undefined" && e instanceof MouseEvent && (e.ctrlKey || e.metaKey || e.shiftKey))
|
|
176
|
+
return;
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
const url = new URL(href, locationE.href);
|
|
179
|
+
go({
|
|
180
|
+
path: url.pathname,
|
|
181
|
+
search: Object.fromEntries(url.searchParams),
|
|
182
|
+
hash: url.hash
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
145
186
|
var prevStack;
|
|
146
187
|
var current = proxy({});
|
|
147
188
|
function reset() {
|
|
148
|
-
prevStack =
|
|
189
|
+
prevStack = historyE.state?.stack || [];
|
|
149
190
|
const initRoute = getRouteFromBrowser();
|
|
150
191
|
log("initial", initRoute);
|
|
151
192
|
copy(unproxy(current), initRoute);
|
|
152
193
|
}
|
|
153
194
|
reset();
|
|
154
|
-
|
|
195
|
+
windowE.addEventListener("popstate", function(event) {
|
|
155
196
|
const newRoute = getRouteFromBrowser();
|
|
156
|
-
const stack =
|
|
197
|
+
const stack = historyE.state?.stack || [];
|
|
157
198
|
if (stack.length !== prevStack.length) {
|
|
158
199
|
const maxIndex = Math.min(prevStack.length, stack.length) - 1;
|
|
159
200
|
if (maxIndex < 0 || stack[maxIndex] === prevStack[maxIndex]) {
|
|
@@ -170,14 +211,14 @@ leakScope(() => {
|
|
|
170
211
|
current.path = "/" + Array.from(current.p).join("/");
|
|
171
212
|
});
|
|
172
213
|
$(() => {
|
|
173
|
-
const stack =
|
|
214
|
+
const stack = historyE.state?.stack || [];
|
|
174
215
|
const newRoute = toCanonRoute(current, unproxy(current).nav, stack.length + 1);
|
|
175
216
|
copy(current, newRoute);
|
|
176
217
|
const state = { state: newRoute.state, stack };
|
|
177
218
|
const url = getUrl(newRoute);
|
|
178
|
-
if (url !==
|
|
219
|
+
if (url !== locationE.pathname + locationE.search + locationE.hash || !equal(historyE.state, state, false)) {
|
|
179
220
|
log("replaceState", newRoute, state, url);
|
|
180
|
-
|
|
221
|
+
historyE.replaceState(state, "", url);
|
|
181
222
|
}
|
|
182
223
|
});
|
|
183
224
|
});
|
|
@@ -187,10 +228,11 @@ export {
|
|
|
187
228
|
reset,
|
|
188
229
|
push,
|
|
189
230
|
persistScroll,
|
|
231
|
+
interceptLinks,
|
|
190
232
|
go,
|
|
191
233
|
current,
|
|
192
234
|
back
|
|
193
235
|
};
|
|
194
236
|
|
|
195
|
-
//# debugId=
|
|
237
|
+
//# debugId=E68290553D18C42B64756E2164756E21
|
|
196
238
|
//# sourceMappingURL=route.js.map
|
package/dist/route.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/route.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import {clean, getParentElement, $, proxy, runQueue, unproxy, copy, merge, clone, leakScope} from \"./aberdeen.js\";\n\ntype NavType = \"load\" | \"back\" | \"forward\" | \"go\" | \"push\";\n\n/**\n* The class for the global `route` object.\n*/\nexport interface Route {\n\t/** The current path of the URL as a string. For instance `\"/\"` or `\"/users/123/feed\"`. Paths are normalized to always start with a `/` and never end with a `/` (unless it's the root path). */\n\tpath: string;\n\t/** An convenience array containing path segments, mapping to `path`. For instance `[]` (for `\"/\"`) or `['users', '123', 'feed']` (for `\"/users/123/feed\"`). */\n\tp: string[];\n\t/** The hash fragment including the leading `#`, or an empty string. For instance `\"#my_section\"` or `\"\"`. */\n\thash: string;\n\t/** The query string interpreted as search parameters. So `\"a=x&b=y\"` becomes `{a: \"x\", b: \"y\"}`. */\n\tsearch: Record<string, string>;\n\t/** An object to be used for any additional data you want to associate with the current page. Data should be JSON-compatible. */\n\tstate: Record<string, any>;\n\t/** The navigation depth of the current session. Starts at 1. Writing to this property has no effect. */\n\tdepth: number;\n\t/** The navigation action that got us to this page. Writing to this property has no effect.\n\t- `\"load\"`: An initial page load.\n\t- `\"back\"` or `\"forward\"`: When we navigated backwards or forwards in the stack.\n\t- `\"go\"`: When we added a new page on top of the stack.\n\t- `\"push\"`: When we added a new page on top of the stack, merging with the current page.\n\tMostly useful for page transition animations. Writing to this property has no effect.\n\t*/\n\tnav: NavType;\n}\n\nlet log: (...args: any) => void = () => {};\n\n/**\n * Configure logging on route changes.\n * @param value `true` to enable logging to console, `false` to disable logging, or a custom logging function. Defaults to `false`.\n */\nexport function setLog(value: boolean | ((...args: any[]) => void)) {\n\tif (value === true) {\n\t\tlog = console.log.bind(console, 'aberdeen router');\n\t} else if (value === false) {\n\t\tlog = () => {};\n\t} else {\n\t\tlog = value;\n\t}\n}\n\nfunction getRouteFromBrowser(): Route {\n\treturn toCanonRoute({\n\t\tpath: location.pathname,\n\t\thash: location.hash,\n\t\tsearch: Object.fromEntries(new URLSearchParams(location.search)),\n\t\tstate: history.state?.state || {},\n\t}, \"load\", (history.state?.stack?.length || 0) + 1);\n}\n\n/**\n* Deep compare `a` and `b`. If `partial` is true, objects contained in `b` may be a subset\n* of their counterparts in `a` and still be considered equal.\n*/\nfunction equal(a: any, b: any, partial: boolean): boolean {\n\tif (a===b) return true;\n\tif (typeof a !== \"object\" || !a || typeof b !== \"object\" || !b) return false; // otherwise they would have been equal\n\tif (a.constructor !== b.constructor) return false;\n\tif (b instanceof Array) {\n\t\tif (a.length !== b.length) return false;\n\t\tfor(let i = 0; i < b.length; i++) {\n\t\t\tif (!equal(a[i], b[i], partial)) return false;\n\t\t}\n\t} else {\n\t\tfor(const k of Object.keys(b)) {\n\t\t\tif (!equal(a[k], b[k], partial)) return false;\n\t\t}\n\t\tif (!partial) {\n\t\t\tfor(const k of Object.keys(a)) {\n\t\t\t\tif (!b.hasOwnProperty(k)) return false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction getUrl(target: Route) {\n\tconst search = new URLSearchParams(target.search).toString();\n\treturn (search ? `${target.path}?${search}` : target.path) + target.hash;\n}\n\nfunction toCanonRoute(target: Partial<Route>, nav: NavType, depth: number): Route {\n\tlet path = target.path || (target.p || []).join(\"/\") || \"/\";\n\tpath = (\"\"+path).replace(/\\/+$/, \"\");\n\tif (!path.startsWith(\"/\")) path = `/${path}`;\n\t\n\treturn {\n\t\tpath,\n\t\thash: target.hash && target.hash !==\"#\" ? (target.hash.startsWith(\"#\") ? target.hash : \"#\" + target.hash) : \"\",\n\t\tp: path.length > 1 ? path.slice(1).replace(/\\/+$/, \"\").split(\"/\") : [],\n\t\tnav,\n\t\tsearch: typeof target.search === 'object' && target.search ? clone(target.search) : {},\n\t\tstate: typeof target.state === 'object' && target.state ? clone(target.state) : {},\n\t\tdepth,\n\t};\n}\n\n\ntype RouteTarget = string | (string|number)[] | Partial<Omit<Omit<Route,\"p\">,\"search\"> & {\n\t/** An convenience array containing path segments, mapping to `path`. For instance `[]` (for `\"/\"`) or `['users', 123, 'feed']` (for `\"/users/123/feed\"`). Values may be integers but will be converted to strings.*/\n\tp: (string|number)[],\n\t/** The query string interpreted as search parameters. So `\"a=x&b=y\"` becomes `{a: \"x\", b: \"y\", c: 42}`. Values may be integers but will be converted to strings. */\n\tsearch: Record<string,string|number>,\n}>;\n\nfunction targetToPartial(target: RouteTarget) {\n\t// Convert shortcut values to objects\n\tif (typeof target === 'string') {\n\t\ttarget = {path: target};\n\t} else if (target instanceof Array) {\n\t\ttarget = {p: target};\n\t}\n\t// Convert numbers in p and search to strings\n\tif (target.p) {\n\t\ttarget.p = target.p.map(String);\n\t}\n\tif (target.search) {\n\t\tfor(const key of Object.keys(target.search)) {\n\t\t\ttarget.search[key] = String(target.search[key]);\n\t\t}\n\t}\n\treturn target as Partial<Route>;\n}\n\n\n/**\n* Navigate to a new URL by pushing a new history entry.\n* \n* Note that this happens synchronously, immediately updating `route` and processing any reactive updates based on that.\n* \n* @param target A subset of the {@link Route} properties to navigate to. If neither `p` nor `path` is given, the current path is used. For other properties, an empty/default value is assumed if not given. For convenience:\n* - You may pass a string instead of an object, which is interpreted as the `path`.\n* - You may pass an array instead of an object, which is interpreted as the `p` array.\n* - If you pass `p`, it may contain numbers, which will be converted to strings.\n* - If you pass `search`, its values may be numbers, which will be converted to strings.\n* \n* Examples:\n* ```js\n* // Navigate to /users/123\n* route.go(\"/users/123\");\n* \n* // Navigate to /users/123?tab=feed#top\n* route.go({p: [\"users\", 123], search: {tab: \"feed\"}, hash: \"top\"});\n* ```\n*/\nexport function go(target: RouteTarget, nav: NavType = \"go\"): void {\n\tconst stack: string[] = history.state?.stack || [];\n\n\tprevStack = stack.concat(JSON.stringify(unproxy(current)));\n\t\n\tconst newRoute: Route = toCanonRoute(targetToPartial(target), nav, prevStack.length + 1);\n\tcopy(current, newRoute);\n\t\n\tlog(nav, newRoute);\n\thistory.pushState({state: newRoute.state, stack: prevStack}, \"\", getUrl(newRoute));\n\t\n\trunQueue();\n}\n\n/**\n * Modify the current route by merging `target` into it (using {@link merge}), pushing a new history entry.\n * \n * This is useful for things like opening modals or side panels, where you want a browser back action to return to the previous state.\n * \n * @param target Same as for {@link go}, but merged into the current route instead deleting all state.\n */\nexport function push(target: RouteTarget): void {\n\tlet copy = clone(unproxy(current));\n\tmerge(copy, targetToPartial(target));\n\tgo(copy);\n}\n\n/**\n * Try to go back in history to the first entry that matches the given target. If none is found, the given state will replace the current page. This is useful for \"cancel\" or \"close\" actions that should return to the previous page if possible, but create a new page if not (for instance when arriving at the current page through a direct link).\n * \n * Consider using {@link up} to go up in the path hierarchy.\n * \n * @param target The target route to go back to. May be a subset of {@link Route}, or a string (for `path`), or an array of strings (for `p`).\n */\nexport function back(target: RouteTarget = {}): void {\n\tconst partial = targetToPartial(target);\n\tconst stack: string[] = history.state?.stack || [];\n\tfor(let i = stack.length - 1; i >= 0; i--) {\n\t\tconst histRoute: Route = JSON.parse(stack[i]);\n\t\tif (equal(histRoute, partial, true)) {\n\t\t\tconst pages = i - stack.length;\n\t\t\tlog(`back`, pages, histRoute);\n\t\t\thistory.go(pages);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst newRoute = toCanonRoute(partial, \"back\", stack.length + 1);\n\tlog(`back not found, replacing`, partial);\n\tcopy(current, newRoute);\n}\n\n/**\n* Navigate up in the path hierarchy, by going back to the first history entry\n* that has a shorter path than the current one. If there's none, we just shorten\n* the current path.\n* \n* Note that going back in browser history happens asynchronously, so `route` will not be updated immediately.\n*/\nexport function up(stripCount: number = 1): void {\n\tconst currentP = unproxy(current).p;\n\tconst stack: string[] = history.state?.stack || [];\n\tfor(let i = stack.length - 1; i >= 0; i--) {\n\t\tconst histRoute: Route = JSON.parse(stack[i]);\n\t\tif (histRoute.p.length < currentP.length && equal(histRoute.p, currentP.slice(0, histRoute.p.length), false)) {\n\t\t\t// This route is shorter and matches the start of the current path\n\t\t\tlog(`up to ${i+1} / ${stack.length}`, histRoute);\n\t\t\thistory.go(i - stack.length);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Replace current route with /\n\tconst newRoute = toCanonRoute({p: currentP.slice(0, currentP.length - stripCount)}, \"back\", stack.length + 1);\n\tlog(`up not found, replacing`, newRoute);\n\tcopy(current, newRoute);\n}\n\n/**\n* Restore and store the vertical and horizontal scroll position for\n* the parent element to the page state.\n*\n* @param {string} name - A unique (within this page) name for this\n* scrollable element. Defaults to 'main'.\n*\n* The scroll position will be persisted in `route.aux.scroll.<name>`.\n*/\nexport function persistScroll(name = \"main\") {\n\tconst el = getParentElement();\n\tel.addEventListener(\"scroll\", onScroll);\n\tclean(() => el.removeEventListener(\"scroll\", onScroll));\n\t\n\tconst restore = unproxy(current).state.scroll?.[name];\n\tif (restore) {\n\t\tlog(\"restoring scroll\", name, restore);\n\t\tObject.assign(el, restore);\n\t}\n\t\n\tfunction onScroll() {\n\t\t(current.state.scroll ||= {})[name] = {\n\t\t\tscrollTop: el.scrollTop,\n\t\t\tscrollLeft: el.scrollLeft,\n\t\t};\n\t}\n}\n\nlet prevStack: string[];\n\n/**\n* The global {@link Route} object reflecting the current URL and browser history state. Changes you make to this affect the current browser history item (modifying the URL if needed).\n*/\nexport const current: Route = proxy({}) as Route;\n\n/**\n * Reset the router to its initial state, based on the current browser state. Intended for testing purposes only.\n * @internal\n * */\nexport function reset() {\n\tprevStack = history.state?.stack || [];\n\tconst initRoute = getRouteFromBrowser();\n\tlog('initial', initRoute);\n\tcopy(unproxy(current), initRoute);\n}\nreset();\n\n// Handle browser history back and forward\nwindow.addEventListener(\"popstate\", function(event: PopStateEvent) {\n\tconst newRoute = getRouteFromBrowser();\n\t\n\t// If the stack length changes, and at least the top-most shared entry is the same,\n\t// we'll interpret this as a \"back\" or \"forward\" navigation.\n\tconst stack: string[] = history.state?.stack || [];\n\tif (stack.length !== prevStack.length) {\n\t\tconst maxIndex = Math.min(prevStack.length, stack.length) - 1;\n\t\tif (maxIndex < 0 || stack[maxIndex] === prevStack[maxIndex]) {\n\t\t\tnewRoute.nav = stack.length < prevStack.length ? \"back\" : \"forward\";\n\t\t}\n\t}\n\t// else nav will be \"load\"\n\t\n\tprevStack = stack;\n\tlog('popstate', newRoute);\n\tcopy(current, newRoute);\n\t\n\trunQueue();\n});\n\n// Make sure these observers are never cleaned up, not even by `unmountAll`.\nleakScope(() => {\n\t// Sync `p` to `path`. We need to do this in a separate, higher-priority observer,\n\t// so that setting `route.p` will not be immediately overruled by the pre-existing `route.path`.\n\t$(() => {\n\t\tcurrent.path = \"/\" + Array.from(current.p).join(\"/\");\n\t});\n\n\t// Do a replaceState based on changes to proxy\n\t$(() => {\n\n\t\t// First normalize `route`\n\t\tconst stack = history.state?.stack || [];\n\t\tconst newRoute = toCanonRoute(current, unproxy(current).nav, stack.length + 1);\n\t\tcopy(current, newRoute);\n\t\t\n\t\t// Then replace the current browser state if something actually changed\n\t\tconst state = {state: newRoute.state, stack};\n\t\tconst url = getUrl(newRoute);\n\t\tif (url !== location.pathname + location.search + location.hash || !equal(history.state, state, false)) {\n\t\t\tlog('replaceState', newRoute, state, url);\n\t\t\thistory.replaceState(state, \"\", url);\n\t\t}\n\t});\n});\n"
|
|
5
|
+
"import {clean, $, proxy, runQueue, unproxy, copy, merge, clone, leakScope} from \"./aberdeen.js\";\n\ntype NavType = \"load\" | \"back\" | \"forward\" | \"go\" | \"push\";\n\n/**\n* The class for the global `route` object.\n*/\nexport interface Route {\n\t/** The current path of the URL as a string. For instance `\"/\"` or `\"/users/123/feed\"`. Paths are normalized to always start with a `/` and never end with a `/` (unless it's the root path). */\n\tpath: string;\n\t/** An convenience array containing path segments, mapping to `path`. For instance `[]` (for `\"/\"`) or `['users', '123', 'feed']` (for `\"/users/123/feed\"`). */\n\tp: string[];\n\t/** The hash fragment including the leading `#`, or an empty string. For instance `\"#my_section\"` or `\"\"`. */\n\thash: string;\n\t/** The query string interpreted as search parameters. So `\"a=x&b=y\"` becomes `{a: \"x\", b: \"y\"}`. */\n\tsearch: Record<string, string>;\n\t/** An object to be used for any additional data you want to associate with the current page. Data should be JSON-compatible. */\n\tstate: Record<string, any>;\n\t/** The navigation depth of the current session. Starts at 1. Writing to this property has no effect. */\n\tdepth: number;\n\t/** The navigation action that got us to this page. Writing to this property has no effect.\n\t- `\"load\"`: An initial page load.\n\t- `\"back\"` or `\"forward\"`: When we navigated backwards or forwards in the stack.\n\t- `\"go\"`: When we added a new page on top of the stack.\n\t- `\"push\"`: When we added a new page on top of the stack, merging with the current page.\n\tMostly useful for page transition animations. Writing to this property has no effect.\n\t*/\n\tnav: NavType;\n}\n\nlet log: (...args: any) => void = () => {};\n\n/**\n * Configure logging on route changes.\n * @param value `true` to enable logging to console, `false` to disable logging, or a custom logging function. Defaults to `false`.\n */\nexport function setLog(value: boolean | ((...args: any[]) => void)) {\n\tif (value === true) {\n\t\tlog = console.log.bind(console, 'aberdeen router');\n\t} else if (value === false) {\n\t\tlog = () => {};\n\t} else {\n\t\tlog = value;\n\t}\n}\n\ndeclare const ABERDEEN_FAKE_WINDOW: Window | undefined;\nconst windowE = typeof ABERDEEN_FAKE_WINDOW !== 'undefined'? ABERDEEN_FAKE_WINDOW : window;\nconst locationE = windowE.location;\nconst historyE = windowE.history;\n\nfunction getRouteFromBrowser(): Route {\n\treturn toCanonRoute({\n\t\tpath: locationE.pathname,\n\t\thash: locationE.hash,\n\t\tsearch: Object.fromEntries(new URLSearchParams(locationE.search)),\n\t\tstate: \thistoryE.state?.state || {},\n\t}, \"load\", (historyE.state?.stack?.length || 0) + 1);\n}\n\n/**\n* Deep compare `a` and `b`. If `partial` is true, objects contained in `b` may be a subset\n* of their counterparts in `a` and still be considered equal.\n*/\nfunction equal(a: any, b: any, partial: boolean): boolean {\n\tif (a===b) return true;\n\tif (typeof a !== \"object\" || !a || typeof b !== \"object\" || !b) return false; // otherwise they would have been equal\n\tif (a.constructor !== b.constructor) return false;\n\tif (b instanceof Array) {\n\t\tif (a.length !== b.length) return false;\n\t\tfor(let i = 0; i < b.length; i++) {\n\t\t\tif (!equal(a[i], b[i], partial)) return false;\n\t\t}\n\t} else {\n\t\tfor(const k of Object.keys(b)) {\n\t\t\tif (!equal(a[k], b[k], partial)) return false;\n\t\t}\n\t\tif (!partial) {\n\t\t\tfor(const k of Object.keys(a)) {\n\t\t\t\tif (!b.hasOwnProperty(k)) return false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction getUrl(target: Route) {\n\tconst search = new URLSearchParams(target.search).toString();\n\treturn (search ? `${target.path}?${search}` : target.path) + target.hash;\n}\n\nfunction toCanonRoute(target: Partial<Route>, nav: NavType, depth: number): Route {\n\tlet path = target.path || (target.p || []).join(\"/\") || \"/\";\n\tpath = (\"\"+path).replace(/\\/+$/, \"\");\n\tif (!path.startsWith(\"/\")) path = `/${path}`;\n\t\n\treturn {\n\t\tpath,\n\t\thash: target.hash && target.hash !==\"#\" ? (target.hash.startsWith(\"#\") ? target.hash : \"#\" + target.hash) : \"\",\n\t\tp: path.length > 1 ? path.slice(1).replace(/\\/+$/, \"\").split(\"/\") : [],\n\t\tnav,\n\t\tsearch: typeof target.search === 'object' && target.search ? clone(target.search) : {},\n\t\tstate: typeof target.state === 'object' && target.state ? clone(target.state) : {},\n\t\tdepth,\n\t};\n}\n\n\ntype RouteTarget = string | (string|number)[] | Partial<Omit<Omit<Route,\"p\">,\"search\"> & {\n\t/** An convenience array containing path segments, mapping to `path`. For instance `[]` (for `\"/\"`) or `['users', 123, 'feed']` (for `\"/users/123/feed\"`). Values may be integers but will be converted to strings.*/\n\tp: (string|number)[],\n\t/** The query string interpreted as search parameters. So `\"a=x&b=y\"` becomes `{a: \"x\", b: \"y\", c: 42}`. Values may be integers but will be converted to strings. */\n\tsearch: Record<string,string|number>,\n}>;\n\nfunction targetToPartial(target: RouteTarget) {\n\t// Convert shortcut values to objects\n\tif (typeof target === 'string') {\n\t\ttarget = {path: target};\n\t} else if (target instanceof Array) {\n\t\ttarget = {p: target};\n\t}\n\t// Convert numbers in p and search to strings\n\tif (target.p) {\n\t\ttarget.p = target.p.map(String);\n\t}\n\tif (target.search) {\n\t\tfor(const key of Object.keys(target.search)) {\n\t\t\ttarget.search[key] = String(target.search[key]);\n\t\t}\n\t}\n\treturn target as Partial<Route>;\n}\n\n\n/**\n* Navigate to a new URL by pushing a new history entry.\n* \n* Note that this happens synchronously, immediately updating `route` and processing any reactive updates based on that.\n* \n* @param target A subset of the {@link Route} properties to navigate to. If neither `p` nor `path` is given, the current path is used. For other properties, an empty/default value is assumed if not given. For convenience:\n* - You may pass a string instead of an object, which is interpreted as the `path`.\n* - You may pass an array instead of an object, which is interpreted as the `p` array.\n* - If you pass `p`, it may contain numbers, which will be converted to strings.\n* - If you pass `search`, its values may be numbers, which will be converted to strings.\n* \n* Examples:\n* ```js\n* // Navigate to /users/123\n* route.go(\"/users/123\");\n* \n* // Navigate to /users/123?tab=feed#top\n* route.go({p: [\"users\", 123], search: {tab: \"feed\"}, hash: \"top\"});\n* ```\n*/\nexport function go(target: RouteTarget, nav: NavType = \"go\"): void {\n\tconst stack: string[] = historyE.state?.stack || [];\n\n\tprevStack = stack.concat(JSON.stringify(unproxy(current)));\n\t\n\tconst newRoute: Route = toCanonRoute(targetToPartial(target), nav, prevStack.length + 1);\n\tcopy(current, newRoute);\n\t\n\tlog(nav, newRoute);\n\thistoryE.pushState({state: newRoute.state, stack: prevStack}, \"\", getUrl(newRoute));\n\t\n\trunQueue();\n}\n\n/**\n * Modify the current route by merging `target` into it (using {@link merge}), pushing a new history entry.\n * \n * This is useful for things like opening modals or side panels, where you want a browser back action to return to the previous state.\n * \n * @param target Same as for {@link go}, but merged into the current route instead deleting all state.\n */\nexport function push(target: RouteTarget): void {\n\tconst c = clone(unproxy(current));\n\tmerge(c, targetToPartial(target));\n\tgo(c);\n}\n\n/**\n * Try to go back in history to the first entry that matches the given target. If none is found, the given state will replace the current page. This is useful for \"cancel\" or \"close\" actions that should return to the previous page if possible, but create a new page if not (for instance when arriving at the current page through a direct link).\n * \n * Consider using {@link up} to go up in the path hierarchy.\n * \n * @param target The target route to go back to. May be a subset of {@link Route}, or a string (for `path`), or an array of strings (for `p`).\n */\nexport function back(target: RouteTarget = {}): void {\n\tconst partial = targetToPartial(target);\n\tconst stack: string[] = historyE.state?.stack || [];\n\tfor(let i = stack.length - 1; i >= 0; i--) {\n\t\tconst histRoute: Route = JSON.parse(stack[i]);\n\t\tif (equal(histRoute, partial, true)) {\n\t\t\tconst pages = i - stack.length;\n\t\t\tlog(`back`, pages, histRoute);\n\t\t\thistoryE.go(pages);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst newRoute = toCanonRoute(partial, \"back\", stack.length + 1);\n\tlog(`back not found, replacing`, partial);\n\tcopy(current, newRoute);\n}\n\n/**\n* Navigate up in the path hierarchy, by going back to the first history entry\n* that has a shorter path than the current one. If there's none, we just shorten\n* the current path.\n* \n* Note that going back in browser history happens asynchronously, so `route` will not be updated immediately.\n*/\nexport function up(stripCount: number = 1): void {\n\tconst currentP = unproxy(current).p;\n\tconst stack: string[] = historyE.state?.stack || [];\n\tfor(let i = stack.length - 1; i >= 0; i--) {\n\t\tconst histRoute: Route = JSON.parse(stack[i]);\n\t\tif (histRoute.p.length < currentP.length && equal(histRoute.p, currentP.slice(0, histRoute.p.length), false)) {\n\t\t\t// This route is shorter and matches the start of the current path\n\t\t\tlog(`up to ${i+1} / ${stack.length}`, histRoute);\n\t\t\thistoryE.go(i - stack.length);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Replace current route with /\n\tconst newRoute = toCanonRoute({p: currentP.slice(0, currentP.length - stripCount)}, \"back\", stack.length + 1);\n\tlog(`up not found, replacing`, newRoute);\n\tcopy(current, newRoute);\n}\n\n/**\n* Restore and store the vertical and horizontal scroll position for\n* the parent element to the page state.\n*\n* @param {string} name - A unique (within this page) name for this\n* scrollable element. Defaults to 'main'.\n*\n* The scroll position will be persisted in `route.aux.scroll.<name>`.\n*/\nexport function persistScroll(name = \"main\") {\n\tconst el = $()!;\n\tel.addEventListener(\"scroll\", onScroll);\n\tclean(() => el.removeEventListener(\"scroll\", onScroll));\n\t\n\tconst restore = unproxy(current).state.scroll?.[name];\n\tif (restore) {\n\t\tlog(\"restoring scroll\", name, restore);\n\t\tObject.assign(el, restore);\n\t}\n\t\n\tfunction onScroll() {\n\t\t(current.state.scroll ||= {})[name] = {\n\t\t\tscrollTop: el.scrollTop,\n\t\t\tscrollLeft: el.scrollLeft,\n\t\t};\n\t}\n}\n\n/**\n * Intercept clicks and Enter key presses on links (`<a>` tags) and use Aberdeen routing\n * instead of browser navigation for local paths (paths without a protocol or host).\n * \n * This allows you to use regular HTML anchor tags for navigation without needing to\n * manually attach click handlers to each link.\n * \n * @example\n * ```js\n * // In your root component:\n * route.interceptLinks();\n * \n * // Now you can use regular anchor tags:\n * $('a text=About href=/corporate/about');\n * ```\n */\nexport function interceptLinks() {\n\t$({\n\t\tclick: handleEvent,\n\t\tkeydown: handleKeyEvent,\n\t});\n\t\n\tfunction handleKeyEvent(e: KeyboardEvent) {\n\t\tif (e.key === \"Enter\") {\n\t\t\thandleEvent(e);\n\t\t}\n\t}\n\t\n\tfunction handleEvent(e: Event) {\n\t\t// Find the closest <a> tag\n\t\tlet target = e.target as HTMLElement | null;\n\t\twhile (target && target.tagName?.toUpperCase() !== \"A\") {\n\t\t\ttarget = target.parentElement;\n\t\t}\n\t\t\n\t\tif (!target) return;\n\t\t\n\t\tconst anchor = target as HTMLAnchorElement;\n\t\tconst href = anchor.getAttribute(\"href\");\n\t\t\n\t\tif (!href) return;\n\t\t\n\t\t// Skip hash-only links\n\t\tif (href.startsWith(\"#\")) return;\n\t\t\n\t\t// Skip if it has a protocol or is protocol-relative (// or contains : before any / ? #)\n\t\tif (href.startsWith(\"//\") || /^[^/?#]+:/.test(href)) return;\n\t\t\n\t\t// Skip if the link has target or download attribute\n\t\tif (anchor.getAttribute(\"target\") || anchor.getAttribute(\"download\")) return;\n\t\t\n\t\t// Skip if modifier keys are pressed (Ctrl/Cmd click to open in new tab)\n\t\tif (typeof MouseEvent !== 'undefined' && e instanceof MouseEvent && (e.ctrlKey || e.metaKey || e.shiftKey)) return;\n\t\t\n\t\te.preventDefault();\n\t\t\n\t\t// Parse using URL to handle both absolute and relative paths correctly\n\t\tconst url = new URL(href, locationE.href);\n\t\tgo({\n\t\t\tpath: url.pathname,\n\t\t\tsearch: Object.fromEntries(url.searchParams),\n\t\t\thash: url.hash,\n\t\t});\n\t}\n}\n\nlet prevStack: string[];\n\n/**\n* The global {@link Route} object reflecting the current URL and browser history state. Changes you make to this affect the current browser history item (modifying the URL if needed).\n*/\nexport const current: Route = proxy({}) as Route;\n\n/**\n * Reset the router to its initial state, based on the current browser state. Intended for testing purposes only.\n * @internal\n * */\nexport function reset() {\n\tprevStack = historyE.state?.stack || [];\n\tconst initRoute = getRouteFromBrowser();\n\tlog('initial', initRoute);\n\tcopy(unproxy(current), initRoute);\n}\nreset();\n\n// Handle browser history back and forward\nwindowE.addEventListener(\"popstate\", function(event: PopStateEvent) {\n\tconst newRoute = getRouteFromBrowser();\n\t\n\t// If the stack length changes, and at least the top-most shared entry is the same,\n\t// we'll interpret this as a \"back\" or \"forward\" navigation.\n\tconst stack: string[] = historyE.state?.stack || [];\n\tif (stack.length !== prevStack.length) {\n\t\tconst maxIndex = Math.min(prevStack.length, stack.length) - 1;\n\t\tif (maxIndex < 0 || stack[maxIndex] === prevStack[maxIndex]) {\n\t\t\tnewRoute.nav = stack.length < prevStack.length ? \"back\" : \"forward\";\n\t\t}\n\t}\n\t// else nav will be \"load\"\n\t\n\tprevStack = stack;\n\tlog('popstate', newRoute);\n\tcopy(current, newRoute);\n\t\n\trunQueue();\n});\n\n// Make sure these observers are never cleaned up, not even by `unmountAll`.\nleakScope(() => {\n\t// Sync `p` to `path`. We need to do this in a separate, higher-priority observer,\n\t// so that setting `route.p` will not be immediately overruled by the pre-existing `route.path`.\n\t$(() => {\n\t\tcurrent.path = \"/\" + Array.from(current.p).join(\"/\");\n\t});\n\n\t// Do a replaceState based on changes to proxy\n\t$(() => {\n\n\t\t// First normalize `route`\n\t\tconst stack = historyE.state?.stack || [];\n\t\tconst newRoute = toCanonRoute(current, unproxy(current).nav, stack.length + 1);\n\t\tcopy(current, newRoute);\n\t\t\n\t\t// Then replace the current browser state if something actually changed\n\t\tconst state = {state: newRoute.state, stack};\n\t\tconst url = getUrl(newRoute);\n\t\tif (url !== locationE.pathname + locationE.search + locationE.hash || !equal(historyE.state, state, false)) {\n\t\t\tlog('replaceState', newRoute, state, url);\n\t\t\thistoryE.replaceState(state, \"\", url);\n\t\t}\n\t});\n});\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAAA;AA8BA,IAAI,MAA8B,MAAM;AAMjC,SAAS,MAAM,CAAC,OAA6C;AAAA,EACnE,IAAI,UAAU,MAAM;AAAA,IACnB,MAAM,QAAQ,IAAI,KAAK,SAAS,iBAAiB;AAAA,EAClD,EAAO,SAAI,UAAU,OAAO;AAAA,IAC3B,MAAM,MAAM;AAAA,EACb,EAAO;AAAA,IACN,MAAM;AAAA;AAAA;
|
|
8
|
-
"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I,gBAAgB,UAAU,OAAO,GAAG;AAAA,MACxC,SAAS,aAAa,OAAO,IAAI,GAAG;AAAA,IACrC;AAAA,GACA;AAAA,CACD;",
|
|
8
|
+
"debugId": "E68290553D18C42B64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist-min/aberdeen.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
class m{keyProp;tail;symbols;constructor(J){this.keyProp=J;this.tail={},this.symbols=[Symbol(0)]}add(J){if(this.symbols[0]in J)return!1;let X=1+(Math.clz32(Math.random()*4294967295)>>2);for(let j=this.symbols.length;j<X;j++)this.symbols.push(Symbol(j));let W=this.keyProp,z=J[W],Z,U=this.tail;for(let j=this.symbols.length-1;j>=0;j--){let F=this.symbols[j];while((Z=U[F])&&Z[W]>z)U=Z;if(j<X)J[F]=U[F],U[F]=J}return!0}has(J){return this.symbols[0]in J}fetchLast(){let J=this.tail[this.symbols[0]];if(J)return this.remove(J),J}isEmpty(){return this.tail[this.symbols[0]]===void 0}get(J){let X=this.keyProp,W,z=this.tail;for(let Z=this.symbols.length-1;Z>=0;Z--){let U=this.symbols[Z];while((W=z[U])&&W[X]>J)z=W}return z[this.symbols[0]]?.[X]===J?z[this.symbols[0]]:void 0}*[Symbol.iterator](){let J=this.symbols[0],X=this.tail[J];while(X)yield X,X=X[J]}prev(J){return J[this.symbols[0]]}remove(J){if(!(this.symbols[0]in J))return!1;let X=this.keyProp,W=J[X],z,Z=this.tail;for(let U=this.symbols.length-1;U>=0;U--){let j=this.symbols[U];while((z=Z[j])&&z[X]>=W&&z!==J)Z=z;if(z===J)Z[j]=z[j],delete z[j]}return z===J}clear(){let J=this.symbols[0],X=this.tail;while(X){let W=X[J];for(let z of this.symbols){if(!(z in X))break;delete X[z]}X=W}this.tail={}}}var I,Y=0,f;function h(J){if(!I)I=new m("prio"),setTimeout(fJ,0);else if(!(Y&1)){if(Y++,Y>98)throw Error("Too many recursive updates from observes")}I.add(J)}function fJ(){let J=Date.now();while(I){let X=I.fetchLast();if(!X)break;if(Y&1)Y++;X.queueRun()}if(I=void 0,Y=0,J=Date.now()-J,J>9)console.debug(`Aberdeen queue took ${J}ms`)}function e(J){if(typeof J==="string")return`${J}\x01`;let X="",W=Math.abs(Math.round(J)),z=J<0;while(W>0)X=String.fromCharCode(z?65534-W%65533:2+W%65533)+X,W=Math.floor(W/65533);return String.fromCharCode(128+(z?-X.length:X.length))+X}function gJ(J){let X="";for(let W=0;W<J.length;W++)X+=String.fromCodePoint(65535-J.charCodeAt(W));return X}var jJ=0;class s{prio=--jJ;onChange(J){h(this)}remove(){let J=this.getLastNode();if(J)S(J,this.getPrecedingNode());this.delete()}}class FJ{queueRun;prio=--jJ;constructor(J){this.queueRun=J;h(this)}}class P extends s{cleaners;constructor(J=[]){super();this.cleaners=J}lastChild;redraw(){}getLastNode(){return D(this.lastChild)}delete(){for(let J of this.cleaners)if(typeof J==="function")J();else J.delete(this);this.cleaners.length=0,I?.remove(this),this.lastChild=void 0}queueRun(){this.remove(),f=this,this.redraw(),f=void 0}getInsertAfterNode(){return this.getLastNode()||this.getPrecedingNode()}onChange(){h(this)}getChildPrevSibling(){return this.lastChild}}class g extends P{el;svg;prevSibling;constructor(J,X,W=!1){super(W?q.cleaners:[]);this.el=J;this.svg=X;if(J===q.el)this.prevSibling=q.getChildPrevSibling(),q.lastChild=this;else this.prevSibling=J.lastChild||void 0;if(!W)q.cleaners.push(this)}getPrecedingNode(){return D(this.prevSibling)}getChildPrevSibling(){return this.lastChild||this.prevSibling}}class a extends g{renderer;constructor(J,X,W){super(J,X);this.renderer=W;this.redraw()}redraw(){let J=q;q=this;try{this.renderer()}catch(X){t(X,!0)}q=J}}class r extends P{el=document.body;svg=!1;getPrecedingNode(){return}}class qJ extends P{el;renderer;svg;constructor(J,X){super();this.el=J;this.renderer=X;this.svg=J.namespaceURI==="http://www.w3.org/2000/svg",this.redraw(),q.cleaners.push(this)}redraw(){a.prototype.redraw.call(this)}getPrecedingNode(){return}delete(){S(this.getLastNode(),this.getPrecedingNode()),super.delete()}remove(){this.delete()}}function S(J,X){while(J&&J!==X){let W=J.previousSibling,z=l.get(J);if(z&&J instanceof Element){if(z!==!0){if(typeof z==="function")z(J);else EJ(J,z);l.set(J,!0)}}else J.remove();J=W}}function D(J){if(!J||J instanceof Node)return J;return J.getLastNode()||J.getPrecedingNode()}class HJ extends g{renderer;result=N({value:void 0});constructor(J){super(q.el,q.svg);this.renderer=J;this.redraw()}redraw(){let J=q;q=this;try{this.result.value=this.renderer()}catch(X){t(X,!0)}q=J}}class $J extends g{key;target;svg=!1;constructor(J,X,W){super(J,J.namespaceURI==="http://www.w3.org/2000/svg");this.key=X;this.target=W;this.redraw()}redraw(){let J=q;q=this,_(this.el,this.key,this.target.value),q=J}}class QJ extends s{renderer;makeSortKey;parentElement=q.el;prevSibling;target;byIndex=new Map;sortedSet=new m("sortKey");changedIndexes=new Set;constructor(J,X,W){super();this.renderer=X;this.makeSortKey=W;let z=this.target=J[$]||J;if(B(z,A,this),this.prevSibling=q.getChildPrevSibling(),q.lastChild=this,q.cleaners.push(this),z instanceof Array)for(let Z=0;Z<z.length;Z++)new v(this,Z,!1);else for(let Z of z instanceof Map?z.keys():Object.keys(z))new v(this,Z,!1)}getPrecedingNode(){return D(this.prevSibling)}onChange(J){if(!(this.target instanceof Array)||typeof J==="number")this.changedIndexes.add(J);h(this)}queueRun(){let J=this.changedIndexes;this.changedIndexes=new Set;for(let X of J){let W=this.byIndex.get(X);if(W)W.remove();if(this.target instanceof Map?this.target.has(X):(X in this.target))new v(this,X,!0);else this.byIndex.delete(X)}f=void 0}delete(){for(let J of this.byIndex.values())J.delete();I?.remove(this),this.byIndex.clear(),setTimeout(()=>{this.sortedSet.clear()},1)}getLastNode(){for(let J of this.sortedSet){let X=J.getActualLastNode();if(X)return X}}}class v extends P{parent;itemIndex;sortKey;el;svg;constructor(J,X,W){super();this.parent=J;this.itemIndex=X;if(this.el=J.parentElement,this.svg=q.svg,this.parent.byIndex.set(this.itemIndex,this),this.lastChild=this,W)f=this;this.redraw()}getPrecedingNode(){this.parent.sortedSet.add(this);let J=this.parent.sortedSet.prev(this);if(J)return D(J.lastChild);return this.parent.getPrecedingNode()}getLastNode(){return this.getPrecedingNode()}getActualLastNode(){let J=this.lastChild;while(J&&J!==this){if(J instanceof Node)return J;let X=J.getLastNode();if(X)return X;J=J.getPrecedingNode()}}queueRun(){if(q!==b)ZJ(4);if(this.sortKey!==void 0){let J=this.getActualLastNode();if(J)S(J,this.getPrecedingNode())}this.delete(),this.lastChild=this,f=this,this.redraw(),f=void 0}redraw(){let J,X=this.parent.target,W=this.itemIndex;if(X instanceof Map)J=N(X.get(W)),W=N(W);else J=N(X[W]);let z=q;q=this;let Z;try{if(this.parent.makeSortKey){let U=this.parent.makeSortKey(J,W);if(U!=null)Z=U instanceof Array?U.map(e).join(""):U}else Z=W;if(typeof Z==="number")Z=e(Z);if(this.sortKey!==Z)this.parent.sortedSet.remove(this),this.sortKey=Z;if(Z!=null)this.parent.renderer(J,W)}catch(U){t(U,Z!=null)}q=z}getInsertAfterNode(){if(this.sortKey==null)ZJ(1);return D(this.lastChild)}remove(){if(this.sortKey!==void 0){let J=this.getActualLastNode();if(J)S(J,this.getPrecedingNode());this.parent.sortedSet.remove(this),this.sortKey=void 0}this.delete()}}function y(J,X){if(J!==q.el){J.appendChild(X);return}let W=q.el,z=q.getInsertAfterNode();W.insertBefore(X,z?z.nextSibling:W.firstChild),q.lastChild=X}var b=new r,q=b;function hJ(J){let X=q;q=new r;try{return J()}finally{q=X}}var A=Symbol("any"),$=Symbol("target"),O=Symbol("mapSize"),p=new WeakMap,i=0;function B(J,X,W=q){if(W===b||i)return;let z=p.get(J);if(!z)p.set(J,z=new Map);if(X!==A&&z.get(A)?.has(W))return;let Z=z.get(X);if(!Z)z.set(X,Z=new Set);if(Z.has(W))return;if(Z.add(W),W===q)q.cleaners.push(Z);else q.cleaners.push(()=>{Z.delete(W)})}function u(J,X,W){if(!J||typeof J!=="object")throw Error("onEach requires an object");J=J[$]||J,new QJ(J,X,W)}function KJ(J){for(let X of Object.keys(J))return!1;return!0}var G=Symbol("empty");function uJ(J){let X=J[$]||J,W=q;if(X instanceof Array)return B(X,"length",(Z,U,j)=>{if(!U!==!j)h(W)}),!X.length;if(X instanceof Map)return B(X,O,(Z,U,j)=>{if(!U!==!j)h(W)}),!X.size;let z=KJ(X);return B(X,A,(Z,U,j)=>{if(z?j===G:U===G)h(W)}),z}function cJ(J){if(J instanceof Array)return n(J,"length");if(J instanceof Map)return n(J,"size");let X=J[$]||J,W=0;for(let Z of Object.keys(X))if(X[Z]!==void 0)W++;let z=DJ(W);return B(X,A,(Z,U,j)=>{if(j===U);else if(j===G)z.value=++W;else if(U===G)z.value=--W}),z}function wJ(J,X,W,z){if(W===z&&W!==void 0)return;let Z=p.get(J);if(Z===void 0)return;for(let U of[X,A]){let j=Z.get(U);if(j)for(let F of j)if(typeof F==="function")F(X,W,z);else F.onChange(X)}}var Q=wJ,YJ={get(J,X){if(X===$)return J;return B(J,X),N(J[X])},set(J,X,W){if(typeof W==="object"&&W)W=W[$]||W;let z=J.hasOwnProperty(X)?J[X]:G;if(W!==z)J[X]=W,Q(J,X,W,z);return!0},deleteProperty(J,X){let W=J.hasOwnProperty(X)?J[X]:G;return delete J[X],Q(J,X,G,W),!0},has(J,X){return B(J,X),J.hasOwnProperty(X)},ownKeys(J){return B(J,A),Reflect.ownKeys(J)}};function MJ(J,X,W){if(typeof W==="object"&&W)W=W[$]||W;let z=J[X];if(z===void 0&&!J.hasOwnProperty(X))z=G;if(W!==z){let Z=J.length;if(X==="length"){J.length=W;for(let U=W;U<Z;U++)Q(J,U,G,J[U])}else{if(typeof X==="string"){let U=0|X;if(String(U)===X&&U>=0)X=U}J[X]=W,Q(J,X,W,z)}if(J.length!==Z)Q(J,"length",J.length,Z)}return!0}var OJ={get(J,X){if(X===$)return J;if(typeof X==="string"){let W=0|X;if(String(W)===X&&W>=0)X=W}return B(J,X),N(J[X])},set:MJ,deleteProperty(J,X){if(typeof X==="string"){let z=0|X;if(String(z)===X&&z>=0)X=z}let W=J[X];if(W===void 0&&!J.hasOwnProperty(X))W=G;return delete J[X],Q(J,X,G,W),!0}};function JJ(J){return{[Symbol.iterator](){return this},next(){let X=J.next();if(X.done)return X;return{done:!1,value:N(X.value)}}}}function XJ(J){return{[Symbol.iterator](){return this},next(){let X=J.next();if(X.done)return X;return{done:!1,value:[N(X.value[0]),N(X.value[1])]}}}}var WJ={get(J){let X=this[$];if(typeof J==="object"&&J)J=J[$]||J;return B(X,J),N(X.get(J))},set(J,X){let W=this[$];if(typeof J==="object"&&J)J=J[$]||J;if(typeof X==="object"&&X)X=X[$]||X;let z=W.get(J);if(z===void 0&&!W.has(J))z=G;if(X!==z){let Z=W.size;W.set(J,X),Q(W,J,X,z),Q(W,O,W.size,Z)}return this},delete(J){let X=this[$];if(typeof J==="object"&&J)J=J[$]||J;let W=X.get(J);if(W===void 0&&!X.has(J))W=G;let z=X.delete(J);if(z)Q(X,J,G,W),Q(X,O,X.size,X.size+1);return z},clear(){let J=this[$],X=J.size;for(let W of J.keys())Q(J,W,void 0,J.get(W));J.clear(),Q(J,O,0,X)},has(J){let X=this[$];if(typeof J==="object"&&J)J=J[$]||J;return B(X,J),X.has(J)},keys(){let J=this[$];return B(J,A),JJ(J.keys())},values(){let J=this[$];return B(J,A),JJ(J.values())},entries(){let J=this[$];return B(J,A),XJ(J.entries())},[Symbol.iterator](){let J=this[$];return B(J,A),XJ(J[Symbol.iterator]())}},TJ={get(J,X){if(X===$)return J;if(WJ.hasOwnProperty(X))return WJ[X];if(X==="size")return B(J,O),J.size;return J[X]}},zJ=new WeakMap;function N(J){if(typeof J!=="object"||!J||J[$]!==void 0||w in J)return J;let X=zJ.get(J);if(X)return X;let W;if(J instanceof Array)W=OJ;else if(J instanceof Map)W=TJ;else W=YJ;return X=new Proxy(J,W),zJ.set(J,X),X}function DJ(J){if(J instanceof Promise){let X=N({busy:!0});return J.then((W)=>{X.value=W,X.busy=!1}).catch((W)=>{X.error=W,X.busy=!1}),X}return N(typeof J==="object"&&J!==null?J:{value:J})}function GJ(J){return J?J[$]||J:J}var l=new WeakMap;function EJ(J,X){let W=X.split(".").filter((z)=>z);J.classList.add(...W),setTimeout(()=>J.remove(),2000)}function dJ(J,X,W){if(arguments.length>2)return NJ(J,X,W,0);return c(J,X,0)}function NJ(J,X,W,z){let Z=kJ(J,X);if(W===Z)return!1;if(typeof Z==="object"&&Z&&typeof W==="object"&&W&&Z.constructor===W.constructor)return c(Z,W,z);if(W=T(W),J instanceof Map)J.set(X,W);else J[X]=T(W);return!0}function pJ(J,X,W){if(arguments.length>2)return NJ(J,X,W,E);return c(J,X,E)}function c(J,X,W){let z=J[$];if(z)J=z,W|=L;if(z=X[$],z){if(X=z,q!==b&&!i)W|=BJ}return k(J,X,W)}function k(J,X,W){if(W&BJ)B(X,A);let z=!1;if(X instanceof Array&&J instanceof Array){let Z=J.length,U=X.length;for(let j=0;j<U;j++){let F=J[j];if(F===void 0&&!J.hasOwnProperty(j))F=G;let H=X[j];if(H===void 0&&!X.hasOwnProperty(j)){if(delete J[j],W&L)Q(J,j,G,F);z=!0}else if(F!==H){if(H&&typeof H==="object"){if(typeof F==="object"&&F&&H.constructor===F.constructor&&!(w in H)){z=k(F,H,W)||z;continue}H=T(H)}if(J[j]=H,W&L)Q(J,j,H,F);z=!0}}if(U!==Z){if(W&L){for(let j=U;j<Z;j++){let F=J[j];delete J[j],Q(J,j,G,F)}J.length=U,Q(J,"length",U,Z)}else J.length=U;z=!0}}else if(X instanceof Map&&J instanceof Map){for(let Z of X.keys()){let U=X.get(Z),j=J.get(Z);if(j===void 0&&!J.has(Z))j=G;if(j!==U){if(U&&typeof U==="object"){if(typeof j==="object"&&j&&U.constructor===j.constructor&&!(w in U)){z=k(j,U,W)||z;continue}U=T(U)}if(J.set(Z,U),W&L)Q(J,Z,U,j);z=!0}}if(!(W&E)){for(let Z of J.keys())if(!X.has(Z)){let U=J.get(Z);if(J.delete(Z),W&L)Q(J,Z,void 0,U);z=!0}}}else if(X.constructor===J.constructor){for(let Z of Object.keys(X)){let U=X[Z],j=J.hasOwnProperty(Z)?J[Z]:G;if(j!==U){if(U&&typeof U==="object"){if(typeof j==="object"&&j&&U.constructor===j.constructor&&!(w in U)){z=k(j,U,W)||z;continue}U=T(U)}if(J[Z]=U,W&L)Q(J,Z,U,j);z=!0}}if(!(W&E)){for(let Z of Object.keys(J))if(!X.hasOwnProperty(Z)){let U=J[Z];if(delete J[Z],W&L&&U!==void 0)Q(J,Z,void 0,U);z=!0}}}else throw Error(`Incompatible or non-object types: ${X?.constructor?.name||typeof X} vs ${J?.constructor?.name||typeof J}`);return z}var E=1,BJ=32,L=64,w=Symbol("NO_COPY");Promise.prototype[w]=!0;var AJ=N({});for(let J=1;J<=12;J++)AJ[J]=2**(J-3)+"rem";var CJ=/^\d/;function VJ(J){return`var(--${CJ.test(J)?`m${J}`:J})`}function T(J){if(w in J)return J;let X=Array.isArray(J)?[]:J instanceof Map?new Map:Object.create(Object.getPrototypeOf(J));return c(X,J,E),X}var PJ={get(J,X){if(X===$)return n(GJ(J.proxy),J.index);if(X==="value")return J.proxy[J.index]},set(J,X,W){if(X==="value")return J.proxy[J.index]=W,!0;return!1}};function n(J,X){return new Proxy({proxy:J,index:X},PJ)}function bJ(J,X){let W,z,Z=J.getAttribute("type"),U=GJ(X).value;if(Z==="checkbox"){if(U===void 0)X.value=J.checked;W=()=>{J.checked=X.value},z=()=>{X.value=J.checked}}else if(Z==="radio"){if(U===void 0&&J.checked)X.value=J.value;W=()=>{J.checked=X.value===J.value},z=()=>{if(J.checked)X.value=J.value}}else{if(z=()=>{X.value=Z==="number"||Z==="range"?J.value===""?null:+J.value:J.value},U===void 0)z();W=()=>{if(J.value=X.value,J.tagName==="SELECT"&&J.value!=X.value)new FJ(()=>J.value=X.value)}}xJ(W),J.addEventListener("input",z),M(()=>{J.removeEventListener("input",z)})}var UJ={create:(J,X)=>{if(q!==f)return;if(typeof X==="function")X(J);else{let W=X.split(".").filter((z)=>z);J.classList.add(...W),(async()=>{J.offsetHeight,J.classList.remove(...W)})()}},destroy:(J,X)=>{l.set(J,X)},html:(J,X)=>{let W=document.createElement(q.el.tagName);W.innerHTML=`${X}`;while(W.firstChild)y(J,W.firstChild)},text:(J,X)=>{y(J,document.createTextNode(X))}};function V(...J){let{el:X,svg:W}=q,z=J.length;for(let Z=0;Z<z;Z++){let U=J[Z];if(U==null||U===!1);else if(typeof U==="string"){let j=U.length,F=0;for(let H=0;H<j;H=F+1){F=x(U," .=:#",H);let R=U[F];if(R===":"||R==="="){let K=U.substring(H,F);if(R===":")K="$"+K;if(F+1>=j){_(X,K,J[++Z]);break}if(U[F+1]==='"'){let C=x(U,'"',F+2),d=U.substring(F+2,C);_(X,K,d),F=C}else{let C=x(U," ",F+1),d=U.substring(F+1,C);_(X,K,d),F=C}}else{if(F>H){let K=U.substring(H,F);W||=K==="svg";let C=W?document.createElementNS("http://www.w3.org/2000/svg",K):document.createElement(K);y(X,C),X=C}if(R==="#"){let K=F+1<j?U.substring(F+1):J[++Z];_(X,"text",K);break}if(R==="."){let K=x(U," #=.",F+1);if(U[K]==="="&&K+1>=j)_(X,U.substring(F,K),J[++Z]),F=K;else{let C=U.substring(F+1,K);X.classList.add(C||J[++Z]),F=K-1}}}}}else if(typeof U==="object")if(U.constructor!==Object)if(U instanceof Node){if(y(X,U),U instanceof Element)X=U,W=U.namespaceURI==="http://www.w3.org/2000/svg"}else throw Error(`Unexpected argument: ${U}`);else for(let j of Object.keys(U))_(X,j,U[j]);else if(typeof U==="function")new a(X,W,U);else throw Error(`Unexpected argument: ${U}`)}return X}function x(J,X,W){if(X.length===1){let Z=J.indexOf(X,W);return Z>=0?Z:J.length}let z=J.length;for(let Z=W;Z<z;Z++)if(X.indexOf(J[Z])>=0)return Z;return z}var LJ=0;function mJ(J,X=!1){let W=X?"":`.AbdStl${++LJ}`,z=o(J,W);if(z)V(`style#${z}`);return W}function lJ(J){return mJ(J,!0)}var IJ={m:"margin",mt:"marginTop",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",mh:["marginLeft","marginRight"],mv:["marginTop","marginBottom"],p:"padding",pt:"paddingTop",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight",ph:["paddingLeft","paddingRight"],pv:["paddingTop","paddingBottom"],w:"width",h:"height",bg:"background",fg:"color",r:"borderRadius"};function o(J,X){let W="",z="";for(let Z of Object.keys(J)){let U=J[Z];for(let j of Z.split(/, ?/g))if(U&&typeof U==="object")if(j.startsWith("@"))z+=`${j}{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
${
|
|
5
|
-
`;
|
|
6
|
-
|
|
1
|
+
class v{keyProp;tail;symbols;constructor(J){this.keyProp=J;this.tail={},this.symbols=[Symbol(0)]}add(J){if(this.symbols[0]in J)return!1;let X=1+(Math.clz32(Math.random()*4294967295)>>2);for(let F=this.symbols.length;F<X;F++)this.symbols.push(Symbol(F));let W=this.keyProp,z=J[W],U,Z=this.tail;for(let F=this.symbols.length-1;F>=0;F--){let q=this.symbols[F];while((U=Z[q])&&U[W]>z)Z=U;if(F<X)J[q]=Z[q],Z[q]=J}return!0}has(J){return this.symbols[0]in J}fetchLast(){let J=this.tail[this.symbols[0]];if(J)return this.remove(J),J}isEmpty(){return this.tail[this.symbols[0]]===void 0}get(J){let X=this.keyProp,W,z=this.tail;for(let U=this.symbols.length-1;U>=0;U--){let Z=this.symbols[U];while((W=z[Z])&&W[X]>J)z=W}return z[this.symbols[0]]?.[X]===J?z[this.symbols[0]]:void 0}*[Symbol.iterator](){let J=this.symbols[0],X=this.tail[J];while(X)yield X,X=X[J]}prev(J){return J[this.symbols[0]]}remove(J){if(!(this.symbols[0]in J))return!1;let X=this.keyProp,W=J[X],z,U=this.tail;for(let Z=this.symbols.length-1;Z>=0;Z--){let F=this.symbols[Z];while((z=U[F])&&z[X]>=W&&z!==J)U=z;if(z===J)U[F]=z[F],delete z[F]}return z===J}clear(){let J=this.symbols[0],X=this.tail;while(X){let W=X[J];for(let z of this.symbols){if(!(z in X))break;delete X[z]}X=W}this.tail={}}}var h,M=0,f;function e(J){if(!h)h=new v("prio"),setTimeout(OJ,0);else if(!(M&1)){if(M++,M>98)throw Error("Too many recursive updates from observes")}h.add(J)}function OJ(){let J=Date.now();while(h){let X=h.fetchLast();if(!X)break;if(M&1)M++;X.queueRun()}if(h=void 0,M=0,J=Date.now()-J,J>9)console.debug(`Aberdeen queue took ${J}ms`)}function UJ(J){if(typeof J==="string")return`${J}\x01`;let X="",W=Math.abs(Math.round(J)),z=J<0;while(W>0)X=String.fromCharCode(z?65534-W%65533:2+W%65533)+X,W=Math.floor(W/65533);return String.fromCharCode(128+(z?-X.length:X.length))+X}function nJ(J){let X="";for(let W=0;W<J.length;W++)X+=String.fromCodePoint(65535-J.charCodeAt(W));return X}var KJ=0;class JJ{prio=--KJ;remove(){let J=this.getLastNode();if(J)y(J,this.getPrecedingNode());this.delete()}}class GJ{queueRun;prio=--KJ;constructor(J){this.queueRun=J;e(this)}}class D extends JJ{cleaners;changes;constructor(J=[]){super();this.cleaners=J}lastChild;redraw(){}getLastNode(){return P(this.lastChild)}delete(){for(let J of this.cleaners)if(typeof J==="function")J();else J.delete(this);this.cleaners.length=0,h?.remove(this),this.lastChild=void 0}onChange(J,X,W,z){if(!this.changes)this.changes=new Map,e(this);let U=this.changes.get(J);if(!U)U=new Map,this.changes.set(J,U);if(U.has(X)){if(U.get(X)===W)U.delete(X)}else U.set(X,z)}fetchHasChanges(){if(!this.changes)return!1;for(let J of this.changes.values())if(J.size>0)return delete this.changes,!0;return delete this.changes,!1}queueRun(){if(!this.fetchHasChanges())return;this.remove(),f=this,this.redraw(),f=void 0}getInsertAfterNode(){return this.getLastNode()||this.getPrecedingNode()}getChildPrevSibling(){return this.lastChild}}class c extends D{el;svg;prevSibling;constructor(J,X,W=!1){super(W?H.cleaners:[]);this.el=J;this.svg=X;if(J===H.el)this.prevSibling=H.getChildPrevSibling(),H.lastChild=this;else this.prevSibling=J.lastChild||void 0;if(!W)H.cleaners.push(this)}getPrecedingNode(){return P(this.prevSibling)}getChildPrevSibling(){return this.lastChild||this.prevSibling}}class XJ extends c{renderer;constructor(J,X,W){super(J,X);this.renderer=W;this.redraw()}redraw(){let J=H;H=this;try{this.renderer()}catch(X){zJ(X,!0)}H=J}}class WJ extends D{el=document.body;svg=!1;getPrecedingNode(){return}}class NJ extends D{el;renderer;svg;constructor(J,X){super();this.el=J;this.renderer=X;this.svg=J.namespaceURI==="http://www.w3.org/2000/svg",this.redraw(),H.cleaners.push(this)}redraw(){XJ.prototype.redraw.call(this)}getPrecedingNode(){return}delete(){y(this.getLastNode(),this.getPrecedingNode()),super.delete()}remove(){this.delete()}}function y(J,X){while(J&&J!==X){let W=J.previousSibling,z=s.get(J);if(z&&J instanceof Element){if(z!==!0){if(typeof z==="function")z(J);else kJ(J,z);s.set(J,!0)}}else J.remove();J=W}}function P(J){if(!J||J instanceof Node)return J;return J.getLastNode()||J.getPrecedingNode()}class BJ extends c{renderer;result=N({value:void 0});constructor(J){super(H.el,H.svg);this.renderer=J;this.redraw()}redraw(){let J=H;H=this;try{this.result.value=this.renderer()}catch(X){zJ(X,!0)}H=J}}class AJ extends c{key;target;svg=!1;constructor(J,X,W){super(J,J.namespaceURI==="http://www.w3.org/2000/svg");this.key=X;this.target=W;this.redraw()}redraw(){let J=H;H=this,L(this.el,this.key,this.target.value),H=J}}class VJ extends JJ{renderer;makeSortKey;parentElement=H.el;prevSibling;target;byIndex=new Map;sortedSet=new v("sortKey");changedIndexes=new Map;constructor(J,X,W){super();this.renderer=X;this.makeSortKey=W;let z=this.target=J[Q]||J;if(B(z,C,this),this.prevSibling=H.getChildPrevSibling(),H.lastChild=this,H.cleaners.push(this),z instanceof Array)for(let U=0;U<z.length;U++)new x(this,U,!1);else for(let U of z instanceof Map?z.keys():Object.keys(z))new x(this,U,!1)}getPrecedingNode(){return P(this.prevSibling)}onChange(J,X,W,z){if(!(J instanceof Array)||typeof X==="number")if(this.changedIndexes.has(X)){if(this.changedIndexes.get(X)===W)this.changedIndexes.delete(X)}else this.changedIndexes.set(X,z),e(this)}queueRun(){let J=this.changedIndexes;this.changedIndexes=new Map;for(let X of J.keys()){let W=this.byIndex.get(X);if(W)W.remove();if(this.target instanceof Map?this.target.has(X):(X in this.target))new x(this,X,!0);else this.byIndex.delete(X)}f=void 0}delete(){for(let J of this.byIndex.values())J.delete();h?.remove(this),this.byIndex.clear(),setTimeout(()=>{this.sortedSet.clear()},1)}getLastNode(){for(let J of this.sortedSet){let X=J.getActualLastNode();if(X)return X}}}class x extends D{parent;itemIndex;sortKey;el;svg;constructor(J,X,W){super();this.parent=J;this.itemIndex=X;if(this.el=J.parentElement,this.svg=H.svg,this.parent.byIndex.set(this.itemIndex,this),this.lastChild=this,W)f=this;this.redraw()}getPrecedingNode(){this.parent.sortedSet.add(this);let J=this.parent.sortedSet.prev(this);if(J)return P(J.lastChild);return this.parent.getPrecedingNode()}getLastNode(){return this.getPrecedingNode()}getActualLastNode(){let J=this.lastChild;while(J&&J!==this){if(J instanceof Node)return J;let X=J.getLastNode();if(X)return X;J=J.getPrecedingNode()}}queueRun(){if(H!==m)QJ(4);if(!this.fetchHasChanges())return;if(this.sortKey!==void 0){let J=this.getActualLastNode();if(J)y(J,this.getPrecedingNode())}this.delete(),this.lastChild=this,f=this,this.redraw(),f=void 0}redraw(){let J,X=this.parent.target,W=this.itemIndex;if(X instanceof Map)J=N(X.get(W)),W=N(W);else J=N(X[W]);let z=H;H=this;let U;try{if(this.parent.makeSortKey){let Z=this.parent.makeSortKey(J,W);if(Z!=null)U=Z instanceof Array?Z.map(UJ).join(""):Z}else U=W;if(typeof U==="number")U=UJ(U);if(this.sortKey!==U)this.parent.sortedSet.remove(this),this.sortKey=U;if(U!=null)this.parent.renderer(J,W)}catch(Z){zJ(Z,U!=null)}H=z}getInsertAfterNode(){if(this.sortKey==null)QJ(1);return P(this.lastChild)}remove(){if(this.sortKey!==void 0){let J=this.getActualLastNode();if(J)y(J,this.getPrecedingNode());this.parent.sortedSet.remove(this),this.sortKey=void 0}this.delete()}}function i(J,X){if(J!==H.el){J.appendChild(X);return}let W=H.el,z=H.getInsertAfterNode();W.insertBefore(X,z?z.nextSibling:W.firstChild),H.lastChild=X}var m=new WJ,H=m;function TJ(J){let X=H;H=new WJ;try{return J()}finally{H=X}}var C=Symbol("any"),Q=Symbol("target"),T=Symbol("mapSize"),n=new WeakMap,g=0;function B(J,X,W=H){if(W===m||g)return;let z=n.get(J);if(!z)n.set(J,z=new Map);if(X!==C&&z.get(C)?.has(W))return;let U=z.get(X);if(!U)z.set(X,U=new Set);if(U.has(W))return;if(U.add(W),W===H)H.cleaners.push(U);else H.cleaners.push(()=>{U.delete(W)})}function d(J,X,W){if(!J||typeof J!=="object")throw Error("onEach requires an object");J=J[Q]||J,new VJ(J,X,W)}function o(J){for(let X of Object.keys(J))return!1;return!0}var K=Symbol("empty");function bJ(J){let X=J[Q]||J,W=H;if(X instanceof Array)return B(X,"length",(U,Z,F)=>{if(!Z!==!F)W.onChange(X,K,!Z,!F)}),!X.length;if(X instanceof Map)return B(X,T,(U,Z,F)=>{if(!Z!==!F)W.onChange(X,K,!Z,!F)}),!X.size;let z=o(X);return B(X,C,(U,Z,F)=>{if(Z===K!==(F===K)){let q=o(X);W.onChange(X,K,q,z),z=q}}),z}function oJ(J){if(J instanceof Array)return r(J,"length");if(J instanceof Map)return r(J,"size");let X=J[Q]||J,W=0;for(let U of Object.keys(X))if(X[U]!==void 0)W++;let z=CJ(W);return B(X,C,(U,Z,F)=>{if(F===Z);else if(F===K)z.value=++W;else if(Z===K)z.value=--W}),z}function PJ(J,X,W,z){if(W===z&&W!==void 0)return;let U=n.get(J);if(U===void 0)return;for(let Z of[X,C]){let F=U.get(Z);if(F)for(let q of F)if(typeof q==="function")q(X,W,z);else q.onChange(J,X,W,z)}}var G=PJ,EJ={get(J,X){if(X===Q)return J;return B(J,X),N(J[X])},set(J,X,W){if(typeof W==="object"&&W)W=W[Q]||W;let z=J.hasOwnProperty(X)?J[X]:K;if(W!==z)J[X]=W,G(J,X,W,z);return!0},deleteProperty(J,X){let W=J.hasOwnProperty(X)?J[X]:K;return delete J[X],G(J,X,K,W),!0},has(J,X){return B(J,X),J.hasOwnProperty(X)},ownKeys(J){return B(J,C),Reflect.ownKeys(J)}};function DJ(J,X,W){if(typeof W==="object"&&W)W=W[Q]||W;let z=J[X];if(z===void 0&&!J.hasOwnProperty(X))z=K;if(W!==z){let U=J.length;if(X==="length"){J.length=W;for(let Z=W;Z<U;Z++)G(J,Z,K,J[Z])}else{if(typeof X==="string"){let Z=0|X;if(String(Z)===X&&Z>=0)X=Z}J[X]=W,G(J,X,W,z)}if(J.length!==U)G(J,"length",J.length,U)}return!0}var mJ={get(J,X){if(X===Q)return J;if(typeof X==="string"){let W=0|X;if(String(W)===X&&W>=0)X=W}return B(J,X),N(J[X])},set:DJ,deleteProperty(J,X){if(typeof X==="string"){let z=0|X;if(String(z)===X&&z>=0)X=z}let W=J[X];if(W===void 0&&!J.hasOwnProperty(X))W=K;return delete J[X],G(J,X,K,W),!0}};function ZJ(J){return{[Symbol.iterator](){return this},next(){let X=J.next();if(X.done)return X;return{done:!1,value:N(X.value)}}}}function FJ(J){return{[Symbol.iterator](){return this},next(){let X=J.next();if(X.done)return X;return{done:!1,value:[N(X.value[0]),N(X.value[1])]}}}}var qJ={get(J){let X=this[Q];if(typeof J==="object"&&J)J=J[Q]||J;return B(X,J),N(X.get(J))},set(J,X){let W=this[Q];if(typeof J==="object"&&J)J=J[Q]||J;if(typeof X==="object"&&X)X=X[Q]||X;let z=W.get(J);if(z===void 0&&!W.has(J))z=K;if(X!==z){let U=W.size;W.set(J,X),G(W,J,X,z),G(W,T,W.size,U)}return this},delete(J){let X=this[Q];if(typeof J==="object"&&J)J=J[Q]||J;let W=X.get(J);if(W===void 0&&!X.has(J))W=K;let z=X.delete(J);if(z)G(X,J,K,W),G(X,T,X.size,X.size+1);return z},clear(){let J=this[Q],X=J.size;for(let W of J.keys())G(J,W,void 0,J.get(W));J.clear(),G(J,T,0,X)},has(J){let X=this[Q];if(typeof J==="object"&&J)J=J[Q]||J;return B(X,J),X.has(J)},keys(){let J=this[Q];return B(J,C),ZJ(J.keys())},values(){let J=this[Q];return B(J,C),ZJ(J.values())},entries(){let J=this[Q];return B(J,C),FJ(J.entries())},[Symbol.iterator](){let J=this[Q];return B(J,C),FJ(J[Symbol.iterator]())}},vJ={get(J,X){if(X===Q)return J;if(qJ.hasOwnProperty(X))return qJ[X];if(X==="size")return B(J,T),J.size;return J[X]}},HJ=new WeakMap;function N(J){if(typeof J!=="object"||!J||J[Q]!==void 0||Y in J)return J;let X=HJ.get(J);if(X)return X;let W;if(J instanceof Array)W=mJ;else if(J instanceof Map)W=vJ;else W=EJ;return X=new Proxy(J,W),HJ.set(J,X),X}function CJ(J){if(J instanceof Promise){let X=N({busy:!0});return J.then((W)=>{X.value=W,X.busy=!1}).catch((W)=>{X.error=W,X.busy=!1}),X}return N(typeof J==="object"&&J!==null?J:{value:J})}function LJ(J){return J?J[Q]||J:J}var s=new WeakMap;function kJ(J,X){let W=X.split(".").filter((z)=>z);J.classList.add(...W),setTimeout(()=>J.remove(),2000)}function sJ(J,X,W){if(arguments.length>2)return IJ(J,X,W,0);return p(J,X,0)}function IJ(J,X,W,z){let U=cJ(J,X);if(W===U)return!1;if(typeof U==="object"&&U&&typeof W==="object"&&W&&U.constructor===W.constructor)return p(U,W,z);if(W=b(W),J instanceof Map)J.set(X,W);else J[X]=b(W);return!0}function aJ(J,X,W){if(arguments.length>2)return IJ(J,X,W,E);return p(J,X,E)}function p(J,X,W){let z=J[Q];if(z)J=z,W|=_;if(z=X[Q],z){if(X=z,H!==m&&!g)W|=RJ}return S(J,X,W)}function S(J,X,W){if(W&RJ)B(X,C);let z=!1;if(X instanceof Array&&J instanceof Array){let U=J.length,Z=X.length;for(let F=0;F<Z;F++){let q=J[F];if(q===void 0&&!J.hasOwnProperty(F))q=K;let $=X[F];if($===void 0&&!X.hasOwnProperty(F)){if(delete J[F],W&_)G(J,F,K,q);z=!0}else if(q!==$){if($&&typeof $==="object"){if(typeof q==="object"&&q&&$.constructor===q.constructor&&!(Y in $)){z=S(q,$,W)||z;continue}$=b($)}if(J[F]=$,W&_)G(J,F,$,q);z=!0}}if(Z!==U){if(W&_){for(let F=Z;F<U;F++){let q=J[F];delete J[F],G(J,F,K,q)}J.length=Z,G(J,"length",Z,U)}else J.length=Z;z=!0}}else if(X instanceof Map&&J instanceof Map){for(let U of X.keys()){let Z=X.get(U),F=J.get(U);if(F===void 0&&!J.has(U))F=K;if(F!==Z){if(Z&&typeof Z==="object"){if(typeof F==="object"&&F&&Z.constructor===F.constructor&&!(Y in Z)){z=S(F,Z,W)||z;continue}Z=b(Z)}if(J.set(U,Z),W&_)G(J,U,Z,F);z=!0}}if(!(W&E)){for(let U of J.keys())if(!X.has(U)){let Z=J.get(U);if(J.delete(U),W&_)G(J,U,K,Z);z=!0}}}else if(X.constructor===J.constructor){for(let U of Object.keys(X)){let Z=X[U],F=J.hasOwnProperty(U)?J[U]:K;if(F!==Z){if(Z&&typeof Z==="object"){if(typeof F==="object"&&F&&Z.constructor===F.constructor&&!(Y in Z)){z=S(F,Z,W)||z;continue}Z=b(Z)}if(J[U]=Z,W&_)G(J,U,Z,F);z=!0}}if(!(W&E)){for(let U of Object.keys(J))if(!X.hasOwnProperty(U)){let Z=J[U];if(delete J[U],W&_&&Z!==void 0)G(J,U,K,Z);z=!0}}}else throw Error(`Incompatible or non-object types: ${X?.constructor?.name||typeof X} vs ${J?.constructor?.name||typeof J}`);return z}var E=1,RJ=32,_=64,Y=Symbol("NO_COPY");Promise.prototype[Y]=!0;var a=N({});function rJ(J=1,X="rem"){for(let W=0;W<=12;W++)a[W]=2**(W-3)*J+X}var xJ=/(\([^)]*\))|("[^"]*")|(^| )\$(\w+)/g,_J=/^\d/;function hJ(J){if(J.indexOf("$")<0)return J;return J.replace(xJ,(X,W,z,U,Z)=>{if(W||z)return X;let F=_J.test(Z)?`m${Z}`:Z;return`${U}var(--${F})`})}if(typeof document<"u")TJ(()=>{V(()=>{if(!bJ(a))uJ(document.head,()=>{V("style",()=>{let J=`:root {
|
|
2
|
+
`;for(let[X,W]of Object.entries(a)){let z=_J.test(String(X))?`m${X}`:X;J+=` --${z}: ${W};
|
|
3
|
+
`}J+="}",V(`#${J}`)})})})});var k;function tJ(){if(!k){if(typeof window>"u"||!window.matchMedia)return!1;let J=window.matchMedia("(prefers-color-scheme: dark)");k=CJ({value:J.matches}),J.addEventListener("change",()=>k.value=J.matches)}return k.value}function b(J){if(Y in J)return J;let X=Array.isArray(J)?[]:J instanceof Map?new Map:Object.create(Object.getPrototypeOf(J));return p(X,J,E),X}var SJ={get(J,X){if(X===Q)return r(LJ(J.proxy),J.index);if(X==="value")return J.proxy[J.index]},set(J,X,W){if(X==="value")return J.proxy[J.index]=W,!0;return!1}};function r(J,X){return new Proxy({proxy:J,index:X},SJ)}function yJ(J,X){let W,z,U=J.getAttribute("type"),Z=LJ(X).value;if(U==="checkbox"){if(Z===void 0)X.value=J.checked;W=()=>{J.checked=X.value},z=()=>{X.value=J.checked}}else if(U==="radio"){if(Z===void 0&&J.checked)X.value=J.value;W=()=>{J.checked=X.value===J.value},z=()=>{if(J.checked)X.value=J.value}}else{if(z=()=>{X.value=U==="number"||U==="range"?J.value===""?null:+J.value:J.value},Z===void 0)z();W=()=>{if(J.value=X.value,J.tagName==="SELECT"&&J.value!=X.value)new GJ(()=>J.value=X.value)}}gJ(W),J.addEventListener("input",z),O(()=>{J.removeEventListener("input",z)})}var jJ={create:(J,X)=>{if(H!==f)return;if(typeof X==="function")X(J);else{let W=X.split(".").filter((z)=>z);J.classList.add(...W),(async()=>{J.offsetHeight,J.classList.remove(...W)})()}},destroy:(J,X)=>{s.set(J,X)},html:(J,X)=>{let W=document.createElement(H.el.tagName);W.innerHTML=`${X}`;while(W.firstChild)i(J,W.firstChild)},text:(J,X)=>{i(J,document.createTextNode(X))}};function V(...J){let{el:X,svg:W}=H,z=J.length;for(let U=0;U<z;U++){let Z=J[U];if(Z==null||Z===!1);else if(typeof Z==="string"){let F=Z.length,q=0;for(let $=0;$<F;$=q+1){q=w(Z," .=:#",$);let R=Z[q];if(R===":"){let j="$"+Z.substring($,q);if(q+1>=F){L(X,j,J[++U]);break}if(Z[q+1]===" "){let A=w(Z,";",q+2),I=Z.substring(q+2,A).trim();L(X,j,I),q=A}else{let A=w(Z," ",q+1),I=Z.substring(q+1,A);L(X,j,I),q=A}}else if(R==="="){let j=Z.substring($,q);if(q+1>=F){L(X,j,J[++U]);break}let A=Z[q+1];if(A==='"'||A==="'"||A==="`"){let I=w(Z,A,q+2),l=Z.substring(q+2,I);L(X,j,l),q=I}else{let I=w(Z," ",q+1),l=Z.substring(q+1,I);L(X,j,l),q=I}}else{if(q>$){let j=Z.substring($,q);W||=j==="svg";let A=W?document.createElementNS("http://www.w3.org/2000/svg",j):document.createElement(j);i(X,A),X=A}if(R==="#"){let j=q+1<F?Z.substring(q+1):J[++U];L(X,"text",j);break}if(R==="."){let j=w(Z," #=.",q+1);if(Z[j]==="="&&j+1>=F)L(X,Z.substring(q,j),J[++U]),q=j;else{let A=Z.substring(q+1,j);X.classList.add(A||J[++U]),q=j-1}}}}}else if(typeof Z==="object")if(Z.constructor!==Object)if(Z instanceof Node){if(i(X,Z),Z instanceof Element)X=Z,W=Z.namespaceURI==="http://www.w3.org/2000/svg"}else throw Error(`Unexpected argument: ${Z}`);else for(let F of Object.keys(Z))L(X,F,Z[F]);else if(typeof Z==="function")new XJ(X,W,Z);else throw Error(`Unexpected argument: ${Z}`)}return X}function w(J,X,W){if(X.length===1){let U=J.indexOf(X,W);return U>=0?U:J.length}let z=J.length;for(let U=W;U<z;U++)if(X.indexOf(J[U])>=0)return U;return z}var fJ=0;function eJ(J){let X=`.AbdStl${++fJ}`,W=typeof J==="string"?t(J,X):u(J,X);if(W)V(`style#${W}`);return X}function u(J,X){let W="";for(let[z,U]of Object.entries(J))if(U&&typeof U==="object")if(z.startsWith("@"))W+=`${z}{
|
|
4
|
+
${u(U,X)}}
|
|
5
|
+
`;else{let Z=z==="&"?X:z.includes("&")?z.replace(/&/g,X):`${X} ${z}`.trim();W+=u(U,Z)}else if(typeof U==="string")if(z.startsWith("@"))W+=`${z}{
|
|
6
|
+
${t(U,X)}}
|
|
7
|
+
`;else{let Z=z.includes("&")?z.replace(/&/g,X):`${X} ${z}`.trim();W+=t(U,Z)}return W}var iJ=/-([a-z])/g;function $J(J){return J.replace(iJ,(X,W)=>W.toUpperCase())}function t(J,X){let W="";for(let z=0,U=J.length;z<U;){while(J[z]===" ")z++;if(z>=U)break;let Z=J.indexOf(":",z);if(Z===-1)break;let F=J.substring(z,Z);z=Z+1;let q;if(J[z]===" "){z++;let j=J.indexOf(";",z);q=J.substring(z,j===-1?U:j).trim(),z=j===-1?U:j+1}else{let j=J.indexOf(" ",z);q=J.substring(z,j===-1?U:j),z=j===-1?U:j}let $=hJ(q),R=YJ[F]||F;W+=typeof R==="string"?`${R}:${$};`:R.map((j)=>`${j}:${$};`).join("")}return W?`${X}{${W}}
|
|
8
|
+
`:""}function JX(J){let X=u(J,"");if(X)V(`style#${X}`)}var YJ={m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mh:["margin-left","margin-right"],mv:["margin-top","margin-bottom"],p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",ph:["padding-left","padding-right"],pv:["padding-top","padding-bottom"],w:"width",h:"height",bg:"background",fg:"color",r:"border-radius"};function L(J,X,W){if(typeof W==="object"&&W!==null&&W[Q])if(X==="bind")yJ(J,W);else new AJ(J,X,W);else if(X[0]==="."){let z=X.substring(1).split(".");if(W)J.classList.add(...z);else J.classList.remove(...z)}else if(X[0]==="$"){X=X.substring(1);let z=W==null||W===!1?"":typeof W==="string"?hJ(W):String(W),U=YJ[X]||X;if(typeof U==="string")J.style[$J(U)]=z;else for(let Z of U)J.style[$J(Z)]=z}else if(W==null);else if(X in jJ)jJ[X](J,W);else if(typeof W==="function"){if(J.addEventListener(X,W),J===H.el)O(()=>J.removeEventListener(X,W))}else if(W===!0||W===!1||X==="value"||X==="selectedIndex")J[X]=W;else J.setAttribute(X,W)}function wJ(J){return console.error("Error while in Aberdeen render:",J),!0}var MJ=wJ;function XX(J){MJ=J||wJ}function O(J){H.cleaners.push(J)}function gJ(J){return new BJ(J).result}function uJ(J,X){new NJ(J,X)}function WX(){m.remove(),fJ=0}function cJ(J,X){g++;try{if(arguments.length===1)return J();else return J instanceof Map?J.get(X):J[X]}finally{g--}}function zX(J,X){let W;if(J instanceof Array)W=N([]);else if(J instanceof Map)W=N(new Map);else W=N({});return d(J,(z,U)=>{let Z=X(z,U);if(Z!==void 0)if(W instanceof Map)W.set(U,Z),O(()=>{W.delete(U)});else W[U]=Z,O(()=>{delete W[U]})}),W}function UX(J,X){let W=N({});return d(J,(z,U)=>{let Z=X(z,U);if(Z){for(let F of Object.keys(Z))W[F]=Z[F];O(()=>{for(let F of Object.keys(Z))delete W[F]})}}),W}function ZX(J,X){let W={},z=N(W);return d(J,(U,Z)=>{let F=X(U,Z);if(F!=null){let q=F instanceof Array?F:[F];if(q.length){for(let $ of q)if(W[$])z[$][Z]=U;else z[$]={[Z]:U};O(()=>{for(let $ of q)if(delete z[$][Z],o(W[$]))delete z[$]})}}}),z}function dJ(J){if(J&&typeof J==="object"){let X=J.constructor.name.toLowerCase()||"unknown object";if(V(`#<${X}>`),Y in J)V("# [NO_COPY]");else V("ul",()=>{d(J,(W,z)=>{V("li",()=>{V(`#${JSON.stringify(z)}: `),dJ(W)})})})}else if(J!==void 0)V("#"+JSON.stringify(J));return J}function QJ(J){throw Error(`Aberdeen internal error ${J}`)}function zJ(J,X){try{if(MJ(J)===!1)X=!1}catch(W){console.error(W)}try{if(X)V("div.aberdeen-error#Error")}catch{}}function FX(J,X){let W=G;G=J;try{X()}finally{G=W}}export{FX as withEmitHandler,LJ as unproxy,WX as unmountAll,rJ as setSpacingCssVars,XX as setErrorHandler,OJ as runQueue,r as ref,CJ as proxy,cJ as peek,ZX as partition,d as onEach,UX as multiMap,uJ as mount,aJ as merge,zX as map,TJ as leakScope,bJ as isEmpty,nJ as invertString,JX as insertGlobalCss,eJ as insertCss,dJ as dump,gJ as derive,PJ as defaultEmitHandler,tJ as darkMode,a as cssVars,oJ as count,sJ as copy,b as clone,O as clean,Y as NO_COPY,V as $};
|
|
7
9
|
|
|
8
|
-
//# debugId=
|
|
10
|
+
//# debugId=4FF89A88B326BB3764756E2164756E21
|
|
9
11
|
//# sourceMappingURL=aberdeen.js.map
|