@manyducks.co/dolla 2.0.0-alpha.51 → 2.0.0-alpha.53
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 +15 -11
- package/dist/core/context.d.ts +7 -3
- package/dist/core/env.d.ts +9 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/logger.d.ts +34 -0
- package/dist/core/markup.d.ts +6 -11
- package/dist/core/mount.d.ts +10 -0
- package/dist/core/nodes/dynamic.d.ts +1 -1
- package/dist/core/nodes/fragment.d.ts +1 -1
- package/dist/core/nodes/outlet.d.ts +1 -1
- package/dist/core/nodes/repeat.d.ts +1 -1
- package/dist/core/nodes/view.d.ts +11 -6
- package/dist/core/ref.d.ts +22 -0
- package/dist/core/signals.d.ts +43 -2
- package/dist/core/store.d.ts +10 -5
- package/dist/{fragment-Bvuvw3ue.js → fragment-DFnx8z2z.js} +2 -2
- package/dist/{fragment-Bvuvw3ue.js.map → fragment-DFnx8z2z.js.map} +1 -1
- package/dist/http.js +163 -0
- package/dist/http.js.map +1 -0
- package/dist/{translate → i18n}/index.d.ts +7 -6
- package/dist/i18n.js +318 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.js +74 -1187
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/logger-CByUPmlz.js +624 -0
- package/dist/logger-CByUPmlz.js.map +1 -0
- package/dist/router/index.d.ts +1 -144
- package/dist/router/router.d.ts +139 -0
- package/dist/router-W2HPWbeI.js +482 -0
- package/dist/router-W2HPWbeI.js.map +1 -0
- package/dist/router.js +8 -0
- package/dist/router.js.map +1 -0
- package/dist/typeChecking-EAVNeFyB.js +75 -0
- package/dist/typeChecking-EAVNeFyB.js.map +1 -0
- package/dist/types.d.ts +9 -1
- package/dist/view-CAEIbcZt.js +932 -0
- package/dist/view-CAEIbcZt.js.map +1 -0
- package/docs/i18n.md +17 -12
- package/docs/markup.md +16 -0
- package/notes/effection-idea.md +34 -0
- package/notes/stores.md +26 -0
- package/package.json +14 -2
- package/vite.config.js +4 -5
- package/dist/core/dolla.d.ts +0 -128
- package/dist/core/signals-api.d.ts +0 -42
- package/dist/index.d.ts +0 -26
- package/dist/markup-QqAGIoYP.js +0 -1501
- package/dist/markup-QqAGIoYP.js.map +0 -1
- /package/dist/core/{signals-api.test.d.ts → signals.test.d.ts} +0 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var Q = (i) => {
|
|
3
|
+
throw TypeError(i);
|
|
4
|
+
};
|
|
5
|
+
var Z = (i, t, e) => t in i ? Y(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
6
|
+
var S = (i, t, e) => Z(i, typeof t != "symbol" ? t + "" : t, e), N = (i, t, e) => t.has(i) || Q("Cannot " + e);
|
|
7
|
+
var l = (i, t, e) => (N(i, t, "read from private field"), e ? e.call(i) : t.get(i)), y = (i, t, e) => t.has(i) ? Q("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), k = (i, t, e, r) => (N(i, t, "write to private field"), r ? r.call(i, e) : t.set(i, e), e), m = (i, t, e) => (N(i, t, "access private method"), e);
|
|
8
|
+
var C = (i, t, e, r) => ({
|
|
9
|
+
set _(a) {
|
|
10
|
+
k(i, t, a, e);
|
|
11
|
+
},
|
|
12
|
+
get _() {
|
|
13
|
+
return l(i, t, r);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
import { $ as P, f as tt, p as F, s as I } from "./logger-CByUPmlz.js";
|
|
17
|
+
import { c as et } from "./view-CAEIbcZt.js";
|
|
18
|
+
import { d as rt, e as z, c as O, f as it, g as nt, b as st, i as j } from "./typeChecking-EAVNeFyB.js";
|
|
19
|
+
function V(i, t) {
|
|
20
|
+
return t.outlet();
|
|
21
|
+
}
|
|
22
|
+
function U(i) {
|
|
23
|
+
return z(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((t) => t.trim()).filter((t) => t !== "");
|
|
24
|
+
}
|
|
25
|
+
function M(i) {
|
|
26
|
+
var e;
|
|
27
|
+
rt(
|
|
28
|
+
(r) => O(r == null ? void 0 : r.toString),
|
|
29
|
+
i,
|
|
30
|
+
"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
|
|
31
|
+
), i = i.filter((r) => r).flatMap(String);
|
|
32
|
+
let t = (e = i.shift()) == null ? void 0 : e.toString();
|
|
33
|
+
if (t) {
|
|
34
|
+
for (const r of i.map((a) => a.toString()))
|
|
35
|
+
r.startsWith(".") ? t = W(t, r) : t[t.length - 1] !== "/" ? r[0] !== "/" ? t += "/" + r : t += r : r[0] === "/" ? t += r.slice(1) : t += r;
|
|
36
|
+
t && t !== "/" && t.endsWith("/") && (t = t.slice(0, t.length - 1));
|
|
37
|
+
}
|
|
38
|
+
return t ?? "";
|
|
39
|
+
}
|
|
40
|
+
function W(i, t) {
|
|
41
|
+
if (z(i, "Expected `base` to be a string. Got type: %t, value: %v"), t == null && (t = i, i = ""), t.startsWith("/"))
|
|
42
|
+
return t;
|
|
43
|
+
let e = i;
|
|
44
|
+
for (; ; )
|
|
45
|
+
if (t.startsWith("..")) {
|
|
46
|
+
for (let r = e.length; r > 0; --r)
|
|
47
|
+
if (e[r] === "/" || r === 0) {
|
|
48
|
+
e = e.slice(0, r), t = t.replace(/^\.\.\/?/, "");
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
} else if (t.startsWith("."))
|
|
52
|
+
t = t.replace(/^\.\/?/, "");
|
|
53
|
+
else
|
|
54
|
+
break;
|
|
55
|
+
return M([e, t]);
|
|
56
|
+
}
|
|
57
|
+
function at(i) {
|
|
58
|
+
if (!i) return {};
|
|
59
|
+
i.startsWith("?") && (i = i.slice(1));
|
|
60
|
+
const t = i.split("&").filter((e) => e.trim() !== "").map(
|
|
61
|
+
(e) => e.split("=").map((r) => r.trim()).slice(0, 2)
|
|
62
|
+
);
|
|
63
|
+
return Object.fromEntries(t);
|
|
64
|
+
}
|
|
65
|
+
function _(i, t, e = {}) {
|
|
66
|
+
var s;
|
|
67
|
+
const [r, a] = t.split("?"), n = U(r);
|
|
68
|
+
t: for (const h of i) {
|
|
69
|
+
const { fragments: o } = h;
|
|
70
|
+
if (!(((s = o[o.length - 1]) == null ? void 0 : s.type) === 3) && o.length !== n.length || e.willMatch && !e.willMatch(h))
|
|
71
|
+
continue t;
|
|
72
|
+
const p = [];
|
|
73
|
+
e: for (let c = 0; c < o.length; c++) {
|
|
74
|
+
const $ = n[c], d = o[c];
|
|
75
|
+
if ($ == null && d.type !== 3)
|
|
76
|
+
continue t;
|
|
77
|
+
switch (d.type) {
|
|
78
|
+
case 1:
|
|
79
|
+
if (d.name.toLowerCase() === $.toLowerCase()) {
|
|
80
|
+
p.push(d);
|
|
81
|
+
break;
|
|
82
|
+
} else
|
|
83
|
+
continue t;
|
|
84
|
+
case 2:
|
|
85
|
+
p.push({ ...d, value: $ });
|
|
86
|
+
break;
|
|
87
|
+
case 3:
|
|
88
|
+
p.push({ ...d, value: n.slice(c).join("/") });
|
|
89
|
+
break e;
|
|
90
|
+
case 4:
|
|
91
|
+
if (isNaN(Number($)))
|
|
92
|
+
continue t;
|
|
93
|
+
p.push({ ...d, value: $ });
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`Unknown fragment type: ${d.type}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const w = {};
|
|
100
|
+
for (const c of p)
|
|
101
|
+
c.type === 2 && (w[c.name] = decodeURIComponent(c.value)), c.type === 4 && (w[c.name] = String(c.value)), c.type === 3 && (w.wildcard = "/" + decodeURIComponent(c.value));
|
|
102
|
+
return {
|
|
103
|
+
path: "/" + p.map((c) => c.value).join("/"),
|
|
104
|
+
pattern: "/" + o.map((c) => c.type === 2 ? `{${c.name}}` : c.type === 4 ? `{#${c.name}}` : c.name).join("/"),
|
|
105
|
+
params: w,
|
|
106
|
+
query: at(a),
|
|
107
|
+
meta: h.meta
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function ot(i) {
|
|
112
|
+
const t = [], e = [], r = [], a = [];
|
|
113
|
+
for (const s of i) {
|
|
114
|
+
const { fragments: h } = s;
|
|
115
|
+
h.some(
|
|
116
|
+
(o) => o.type === 3
|
|
117
|
+
/* Wildcard */
|
|
118
|
+
) ? a.push(s) : h.some(
|
|
119
|
+
(o) => o.type === 4
|
|
120
|
+
/* NumericParam */
|
|
121
|
+
) ? e.push(s) : h.some(
|
|
122
|
+
(o) => o.type === 2
|
|
123
|
+
/* Param */
|
|
124
|
+
) ? r.push(s) : t.push(s);
|
|
125
|
+
}
|
|
126
|
+
const n = (s, h) => s.fragments.length > h.fragments.length ? -1 : 1;
|
|
127
|
+
return t.sort(n), e.sort(n), r.sort(n), a.sort(n), [...t, ...e, ...r, ...a];
|
|
128
|
+
}
|
|
129
|
+
function ct(i) {
|
|
130
|
+
const t = U(i), e = [];
|
|
131
|
+
for (let r = 0; r < t.length; r++) {
|
|
132
|
+
const a = t[r];
|
|
133
|
+
if (a === "*") {
|
|
134
|
+
if (r !== t.length - 1)
|
|
135
|
+
throw new Error(`Wildcard must be at the end of a pattern. Received: ${i}`);
|
|
136
|
+
e.push({
|
|
137
|
+
type: 3,
|
|
138
|
+
name: "*",
|
|
139
|
+
value: null
|
|
140
|
+
});
|
|
141
|
+
} else a.at(0) === "{" && a.at(-1) === "}" ? e.push({
|
|
142
|
+
type: a[1] === "#" ? 4 : 2,
|
|
143
|
+
name: a[1] === "#" ? a.slice(2, -1) : a.slice(1, -1),
|
|
144
|
+
value: null
|
|
145
|
+
}) : e.push({
|
|
146
|
+
type: 1,
|
|
147
|
+
name: a,
|
|
148
|
+
value: a
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return e;
|
|
152
|
+
}
|
|
153
|
+
const lt = /(noopener|noreferrer) (noopener|noreferrer)/, ht = /^[\w-_]+:/;
|
|
154
|
+
function ut(i, t, e = window) {
|
|
155
|
+
function r(n) {
|
|
156
|
+
return !n || n === i ? null : n.localName !== "a" || n.href === void 0 ? r(n.parentNode) : n;
|
|
157
|
+
}
|
|
158
|
+
function a(n) {
|
|
159
|
+
if (n.button && n.button !== 0 || n.ctrlKey || n.metaKey || n.altKey || n.shiftKey || n.defaultPrevented)
|
|
160
|
+
return;
|
|
161
|
+
const s = r(n.target);
|
|
162
|
+
s && (e.location.protocol !== s.protocol || e.location.hostname !== s.hostname || e.location.port !== s.port || s.hasAttribute("data-router-ignore") || s.hasAttribute("download") || s.getAttribute("target") === "_blank" && lt.test(s.getAttribute("rel")) || ht.test(s.getAttribute("href")) || (n.preventDefault(), t(s)));
|
|
163
|
+
}
|
|
164
|
+
return i.addEventListener("click", a), function() {
|
|
165
|
+
i.removeEventListener("click", a);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function ft(i, t) {
|
|
169
|
+
for (const e in t) {
|
|
170
|
+
const r = t[e].toString();
|
|
171
|
+
i = i.replace(`{${e}}`, r).replace(`{#${e}}`, r);
|
|
172
|
+
}
|
|
173
|
+
return i;
|
|
174
|
+
}
|
|
175
|
+
const pt = Symbol(), mt = Symbol(), K = Symbol();
|
|
176
|
+
var D, b, x, R, q, A, v, E, g, u, B, H, J, L, X, T, G;
|
|
177
|
+
class kt {
|
|
178
|
+
constructor(t) {
|
|
179
|
+
y(this, u);
|
|
180
|
+
y(this, b);
|
|
181
|
+
y(this, x, 0);
|
|
182
|
+
y(this, R, []);
|
|
183
|
+
y(this, q, []);
|
|
184
|
+
y(this, A, !1);
|
|
185
|
+
S(this, D, et(V));
|
|
186
|
+
/**
|
|
187
|
+
* Use hash routing when true. Configured in router options.
|
|
188
|
+
*/
|
|
189
|
+
y(this, v, !1);
|
|
190
|
+
// Callbacks that need to be called on unmount.
|
|
191
|
+
y(this, E, []);
|
|
192
|
+
/**
|
|
193
|
+
* The current match object.
|
|
194
|
+
*/
|
|
195
|
+
y(this, g, P());
|
|
196
|
+
/**
|
|
197
|
+
* The currently matched route pattern, if any.
|
|
198
|
+
*/
|
|
199
|
+
S(this, "$pattern", P(() => {
|
|
200
|
+
var t;
|
|
201
|
+
return (t = l(this, g).call(this)) == null ? void 0 : t.pattern;
|
|
202
|
+
}));
|
|
203
|
+
/**
|
|
204
|
+
* The current URL path.
|
|
205
|
+
*/
|
|
206
|
+
S(this, "$path", P(() => {
|
|
207
|
+
var t;
|
|
208
|
+
return ((t = l(this, g).call(this)) == null ? void 0 : t.path) ?? window.location.pathname;
|
|
209
|
+
}));
|
|
210
|
+
/**
|
|
211
|
+
* The current named path params.
|
|
212
|
+
*/
|
|
213
|
+
S(this, "$params", P(() => {
|
|
214
|
+
var t;
|
|
215
|
+
return ((t = l(this, g).call(this)) == null ? void 0 : t.params) ?? {};
|
|
216
|
+
}, { equals: I }));
|
|
217
|
+
/**
|
|
218
|
+
* The current query params. Changes to this object will be reflected in the URL.
|
|
219
|
+
*/
|
|
220
|
+
S(this, "$query", P(() => {
|
|
221
|
+
var t;
|
|
222
|
+
return ((t = l(this, g).call(this)) == null ? void 0 : t.query) ?? {};
|
|
223
|
+
}, { equals: I }));
|
|
224
|
+
it(t, "Options must be an object. Got: %t"), t.hash && k(this, v, !0), k(this, q, ot(
|
|
225
|
+
t.routes.flatMap((e) => m(this, u, G).call(this, e)).map((e) => ({
|
|
226
|
+
pattern: e.pattern,
|
|
227
|
+
meta: e.meta,
|
|
228
|
+
fragments: ct(e.pattern)
|
|
229
|
+
}))
|
|
230
|
+
)), dt(l(this, q));
|
|
231
|
+
}
|
|
232
|
+
async [(D = K, pt)](t) {
|
|
233
|
+
k(this, b, tt("Dolla.router"));
|
|
234
|
+
const e = () => {
|
|
235
|
+
m(this, u, L).call(this, void 0, {});
|
|
236
|
+
};
|
|
237
|
+
window.addEventListener("popstate", e), l(this, E).push(() => window.removeEventListener("popstate", e)), l(this, E).push(
|
|
238
|
+
ut(t, (r) => {
|
|
239
|
+
let a = r.getAttribute("href");
|
|
240
|
+
l(this, b).info("intercepted click on <a> tag", r);
|
|
241
|
+
const n = r.getAttribute("data-router-preserve-query");
|
|
242
|
+
this.go(a, {
|
|
243
|
+
preserveQuery: wt(n)
|
|
244
|
+
});
|
|
245
|
+
})
|
|
246
|
+
), l(this, b).info("will intercept clicks on <a> tags within root element", t), k(this, A, !0), await m(this, u, L).call(this, void 0, {});
|
|
247
|
+
}
|
|
248
|
+
async [mt]() {
|
|
249
|
+
for (const t of l(this, E))
|
|
250
|
+
t();
|
|
251
|
+
k(this, E, []);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
255
|
+
*/
|
|
256
|
+
back(t = 1) {
|
|
257
|
+
window.history.go(-t);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Navigate forward. Pass a number of steps to hit the forward button that many times.
|
|
261
|
+
*/
|
|
262
|
+
forward(t = 1) {
|
|
263
|
+
window.history.go(t);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Navigates to another route.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* router.go("/login"); // navigate to `/login`
|
|
270
|
+
* router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
271
|
+
*/
|
|
272
|
+
go(t, e = {}) {
|
|
273
|
+
let r;
|
|
274
|
+
Array.isArray(t) ? r = M(t) : r = t.toString(), r = W(window.location.pathname, r), e.replace ? m(this, u, H).call(this, r, e) : m(this, u, B).call(this, r, e);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Updates query params, keeping existing ones and applying new ones. Removes the query param if value is set to `null`.
|
|
278
|
+
*/
|
|
279
|
+
updateQuery(t) {
|
|
280
|
+
const e = F(l(this, g)), r = { ...this.$query() };
|
|
281
|
+
for (const s in t) {
|
|
282
|
+
const h = t[s];
|
|
283
|
+
h === null ? delete r[s] : r[s] = h.toString();
|
|
284
|
+
}
|
|
285
|
+
let a = [];
|
|
286
|
+
for (const s in r)
|
|
287
|
+
a.push(`${s}=${r[s]}`);
|
|
288
|
+
const n = a.length > 0 ? "?" + a.join("&") : "";
|
|
289
|
+
l(this, g).call(this, { ...e, query: r }), window.history.replaceState(null, "", l(this, v) ? "/#" + e.path + n : e.path + n);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
b = new WeakMap(), x = new WeakMap(), R = new WeakMap(), q = new WeakMap(), A = new WeakMap(), v = new WeakMap(), E = new WeakMap(), g = new WeakMap(), u = new WeakSet(), B = function(t, e) {
|
|
293
|
+
var r;
|
|
294
|
+
(r = l(this, b)) == null || r.info("(push)", t), window.history.pushState(null, "", l(this, v) ? "/#" + t : t), m(this, u, L).call(this, t, e);
|
|
295
|
+
}, H = function(t, e) {
|
|
296
|
+
var r;
|
|
297
|
+
(r = l(this, b)) == null || r.info("(replace)", t), window.history.replaceState(null, "", l(this, v) ? "/#" + t : t), m(this, u, L).call(this, t, e);
|
|
298
|
+
}, J = function() {
|
|
299
|
+
return l(this, v) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
|
|
300
|
+
}, L = async function(t, e) {
|
|
301
|
+
const r = l(this, b), a = this[K], n = t ? new URL(t, window.location.origin) : m(this, u, J).call(this), { match: s, journey: h } = await m(this, u, T).call(this, n);
|
|
302
|
+
for (const o of h)
|
|
303
|
+
switch (o.kind) {
|
|
304
|
+
case "match":
|
|
305
|
+
r == null || r.info(`📍 ${o.message}`);
|
|
306
|
+
break;
|
|
307
|
+
case "redirect":
|
|
308
|
+
r == null || r.info(`↩️ ${o.message}`);
|
|
309
|
+
break;
|
|
310
|
+
case "miss":
|
|
311
|
+
r == null || r.info(`💀 ${o.message}`);
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
if (s) {
|
|
315
|
+
const o = F(this.$pattern);
|
|
316
|
+
let f = s.query, p = [];
|
|
317
|
+
if (e.preserveQuery === !0)
|
|
318
|
+
f = Object.assign({}, this.$query(), s.query);
|
|
319
|
+
else if (nt(e.preserveQuery)) {
|
|
320
|
+
const c = {}, $ = this.$query();
|
|
321
|
+
for (const d in $)
|
|
322
|
+
e.preserveQuery.includes(d) && (c[d] = $[d]);
|
|
323
|
+
f = Object.assign({}, c, s.query);
|
|
324
|
+
}
|
|
325
|
+
for (const c in f)
|
|
326
|
+
p.push(`${c}=${f[c]}`);
|
|
327
|
+
const w = p.length > 0 ? "?" + p.join("&") : "";
|
|
328
|
+
l(this, g).call(this, { ...s, query: f }), a && (s.path !== location.pathname || location.search !== w) && window.history.replaceState(null, "", l(this, v) ? "/#" + s.path + w : s.path + w), a && s.pattern !== o && m(this, u, X).call(this, a, s);
|
|
329
|
+
} else
|
|
330
|
+
l(this, A) && r.crash(new yt(`Failed to match route '${n.pathname}'`));
|
|
331
|
+
return { match: s, journey: h };
|
|
332
|
+
}, /**
|
|
333
|
+
* Takes a matched route and mounts it.
|
|
334
|
+
*/
|
|
335
|
+
X = function(t, e) {
|
|
336
|
+
const r = e.meta.layers;
|
|
337
|
+
for (let a = 0; a < r.length; a++) {
|
|
338
|
+
const n = r[a], s = l(this, R)[a];
|
|
339
|
+
if ((s == null ? void 0 : s.id) !== n.id) {
|
|
340
|
+
k(this, R, l(this, R).slice(0, a)), s == null || s.view.unmount();
|
|
341
|
+
const h = l(this, R).at(-1), f = ((h == null ? void 0 : h.view) ?? t).setRouteView(n.view);
|
|
342
|
+
l(this, R).push({ id: n.id, view: f });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}, T = async function(t, e = []) {
|
|
346
|
+
return new Promise((r, a) => {
|
|
347
|
+
var o;
|
|
348
|
+
const n = _(l(this, q), t.pathname);
|
|
349
|
+
if (!n)
|
|
350
|
+
return r({
|
|
351
|
+
match: null,
|
|
352
|
+
journey: [...e, { kind: "miss", message: `no match for '${t.pathname}'` }]
|
|
353
|
+
});
|
|
354
|
+
let s = n.meta.redirect;
|
|
355
|
+
const h = async () => {
|
|
356
|
+
if (s != null) {
|
|
357
|
+
let f;
|
|
358
|
+
if (j(s))
|
|
359
|
+
f = ft(s, n.params);
|
|
360
|
+
else if (O(s)) {
|
|
361
|
+
const p = {
|
|
362
|
+
path: n.path,
|
|
363
|
+
pattern: n.pattern,
|
|
364
|
+
params: n.params,
|
|
365
|
+
query: n.query
|
|
366
|
+
};
|
|
367
|
+
if (f = await s(p), !j(f))
|
|
368
|
+
return a(new Error("Redirect function must return a path to redirect to."));
|
|
369
|
+
f.startsWith("/") || (f = W(n.path, f));
|
|
370
|
+
} else
|
|
371
|
+
return a(new TypeError("Redirect must either be a path string or a function."));
|
|
372
|
+
r(
|
|
373
|
+
m(this, u, T).call(this, new URL(f, window.location.origin), [
|
|
374
|
+
...e,
|
|
375
|
+
{ kind: "redirect", message: `redirecting '${n.path}' -> '${f}'` }
|
|
376
|
+
])
|
|
377
|
+
);
|
|
378
|
+
} else
|
|
379
|
+
r({ match: n, journey: [...e, { kind: "match", message: `matched route '${n.path}'` }] });
|
|
380
|
+
};
|
|
381
|
+
if ((o = n.meta.beforeMatch) != null && o.length) {
|
|
382
|
+
const f = n.meta.beforeMatch;
|
|
383
|
+
let p = -1;
|
|
384
|
+
const w = () => {
|
|
385
|
+
p++, p === f.length ? h() : f[p]({
|
|
386
|
+
path: n.path,
|
|
387
|
+
pattern: n.pattern,
|
|
388
|
+
params: n.params,
|
|
389
|
+
query: n.query,
|
|
390
|
+
// TODO: Allow setting context variables from here? Would apply to the context of the matched view.
|
|
391
|
+
redirect: (c) => {
|
|
392
|
+
s = c, h();
|
|
393
|
+
},
|
|
394
|
+
next: w
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
w();
|
|
398
|
+
} else
|
|
399
|
+
h();
|
|
400
|
+
});
|
|
401
|
+
}, /**
|
|
402
|
+
* Parses a route definition object into a set of matchable routes.
|
|
403
|
+
*
|
|
404
|
+
* @param route - Route config object.
|
|
405
|
+
* @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
|
|
406
|
+
*/
|
|
407
|
+
G = function(t, e = [], r = []) {
|
|
408
|
+
if (!st(t) || !j(t.path))
|
|
409
|
+
throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
|
|
410
|
+
if (t.redirect && t.routes)
|
|
411
|
+
throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
|
|
412
|
+
if (t.redirect && t.view)
|
|
413
|
+
throw new Error("Route cannot have both a 'redirect' and a 'view'.");
|
|
414
|
+
if (!t.view && !t.routes && !t.redirect)
|
|
415
|
+
throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
|
|
416
|
+
let a = [];
|
|
417
|
+
for (const o of e)
|
|
418
|
+
a.push(...U(o.path));
|
|
419
|
+
a.push(...U(t.path)), a[a.length - 1] === "*" && a.pop();
|
|
420
|
+
const n = [];
|
|
421
|
+
if (t.redirect) {
|
|
422
|
+
let o = t.redirect;
|
|
423
|
+
return j(o) && (o = W(M(a), o), o.startsWith("/") || (o = "/" + o)), n.push({
|
|
424
|
+
pattern: "/" + M([...a, ...U(t.path)]),
|
|
425
|
+
meta: {
|
|
426
|
+
redirect: o
|
|
427
|
+
}
|
|
428
|
+
}), n;
|
|
429
|
+
}
|
|
430
|
+
let s = V;
|
|
431
|
+
if (O(t.view))
|
|
432
|
+
s = t.view;
|
|
433
|
+
else if (t.view)
|
|
434
|
+
throw new TypeError(`Route '${t.path}' expected a view function or undefined. Got: ${t.view}`);
|
|
435
|
+
const h = { id: C(this, x)._++, view: s };
|
|
436
|
+
if (t.routes)
|
|
437
|
+
for (const o of t.routes)
|
|
438
|
+
n.push(...m(this, u, G).call(this, o, [...e, t], [...r, h]));
|
|
439
|
+
else
|
|
440
|
+
n.push({
|
|
441
|
+
pattern: parent ? M([...e.map((o) => o.path), t.path]) : t.path,
|
|
442
|
+
meta: {
|
|
443
|
+
pattern: t.path,
|
|
444
|
+
layers: [...r, h],
|
|
445
|
+
beforeMatch: e.flatMap((o) => o.beforeMatch).concat(t.beforeMatch).filter((o) => o != null)
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
return n;
|
|
449
|
+
};
|
|
450
|
+
function dt(i) {
|
|
451
|
+
for (const t of i)
|
|
452
|
+
if (t.meta.redirect) {
|
|
453
|
+
let e;
|
|
454
|
+
if (!O(t.meta.redirect)) if (j(t.meta.redirect)) {
|
|
455
|
+
if (e = t.meta.redirect, !_(i, e, {
|
|
456
|
+
willMatch(a) {
|
|
457
|
+
return a !== t;
|
|
458
|
+
}
|
|
459
|
+
}))
|
|
460
|
+
throw new Error(`Found a redirect to an undefined URL. From '${t.pattern}' to '${t.meta.redirect}'`);
|
|
461
|
+
} else
|
|
462
|
+
throw new TypeError(`Expected a string or redirect function. Got: ${t.meta.redirect}`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
function wt(i) {
|
|
466
|
+
if (i === null)
|
|
467
|
+
return !1;
|
|
468
|
+
if (i === !0 || i === !1)
|
|
469
|
+
return i;
|
|
470
|
+
if (typeof i == "string")
|
|
471
|
+
return i = i.trim(), i === "" || i === "true" ? !0 : i === "false" ? !1 : i.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
|
|
472
|
+
throw new Error(`Invalid type for data-router-preserve-query attribute: ${typeof i} (value: ${i})`);
|
|
473
|
+
}
|
|
474
|
+
class yt extends Error {
|
|
475
|
+
}
|
|
476
|
+
export {
|
|
477
|
+
pt as M,
|
|
478
|
+
kt as R,
|
|
479
|
+
mt as U,
|
|
480
|
+
K as a
|
|
481
|
+
};
|
|
482
|
+
//# sourceMappingURL=router-W2HPWbeI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-W2HPWbeI.js","sources":["../src/core/views/passthrough.ts","../src/router/router.utils.ts","../src/router/router.ts"],"sourcesContent":["import { type ViewContext } from \"../nodes/view.js\";\n\n/**\n * A utility view that simply displays a route.\n */\nexport function Passthrough(_: {}, ctx: ViewContext) {\n return ctx.outlet();\n}\n","import { assertString, assertArrayOf, isFunction } from \"../typeChecking.js\";\n\nexport type RouteMatch<T = Record<string, any>> = {\n /**\n * The path string that triggered this match.\n */\n path: string;\n\n /**\n * The pattern satisfied by `path`.\n */\n pattern: string;\n\n /**\n * Named params as parsed from `path`.\n */\n params: Record<string, string>;\n\n /**\n * Query params as parsed from `path`.\n */\n query: Record<string, string>;\n\n /**\n * Metadata registered to this route.\n */\n meta: T;\n};\n\nexport enum FragTypes {\n Literal = 1,\n Param = 2,\n Wildcard = 3,\n NumericParam = 4,\n}\n\nexport type RouteFragment = {\n name: string;\n type: FragTypes;\n value: string | number | null;\n};\n\nexport type ParsedRoute<T> = {\n pattern: string;\n fragments: RouteFragment[];\n meta: T;\n};\n\nexport type RouteMatchOptions<T> = {\n willMatch?: (route: ParsedRoute<T>) => boolean;\n};\n\n/**\n * Separates a URL path into multiple fragments.\n *\n * @param path - A path string (e.g. `\"/api/users/5\"`)\n * @returns an array of fragments (e.g. `[\"api\", \"users\", \"5\"]`)\n */\nexport function splitPath(path: string): string[] {\n assertString(path, \"Expected `path` to be a string. Got type: %t, value: %v\");\n\n return path\n .split(\"/\")\n .map((f) => f.trim())\n .filter((f) => f !== \"\");\n}\n\n/**\n * Joins multiple URL path fragments into a single string.\n *\n * @param parts - One or more URL fragments (e.g. `[\"api\", \"users\", 5]`)\n * @returns a joined path (e.g. `\"api/users/5\"`)\n */\nexport function joinPath(parts: { toString(): string }[]): string {\n assertArrayOf(\n (part) => isFunction(part?.toString),\n parts,\n \"Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v\",\n );\n\n parts = parts.filter((x) => x).flatMap(String);\n\n let joined = parts.shift()?.toString();\n\n if (joined) {\n for (const part of parts.map((p) => p.toString())) {\n if (part.startsWith(\".\")) {\n // Resolve relative path against joined\n joined = resolvePath(joined, part);\n } else if (joined[joined.length - 1] !== \"/\") {\n if (part[0] !== \"/\") {\n joined += \"/\" + part;\n } else {\n joined += part;\n }\n } else {\n if (part[0] === \"/\") {\n joined += part.slice(1);\n } else {\n joined += part;\n }\n }\n }\n\n // Remove trailing slash (unless path is just '/')\n if (joined && joined !== \"/\" && joined.endsWith(\"/\")) {\n joined = joined.slice(0, joined.length - 1);\n }\n }\n\n return joined ?? \"\";\n}\n\nexport function resolvePath(base: string, part: string | null) {\n assertString(base, \"Expected `base` to be a string. Got type: %t, value: %v\");\n\n if (part == null) {\n part = base;\n base = \"\";\n }\n\n if (part.startsWith(\"/\")) {\n return part;\n }\n\n let resolved = base;\n\n while (true) {\n if (part.startsWith(\"..\")) {\n for (let i = resolved.length; i > 0; --i) {\n if (resolved[i] === \"/\" || i === 0) {\n resolved = resolved.slice(0, i);\n part = part.replace(/^\\.\\.\\/?/, \"\");\n break;\n }\n }\n } else if (part.startsWith(\".\")) {\n part = part.replace(/^\\.\\/?/, \"\");\n } else {\n break;\n }\n }\n\n return joinPath([resolved, part]);\n}\n\nexport function parseQueryParams(query: string): Record<string, string> {\n if (!query) return {};\n\n if (query.startsWith(\"?\")) {\n query = query.slice(1);\n }\n\n const entries = query\n .split(\"&\")\n .filter((x) => x.trim() !== \"\")\n .map((entry) =>\n entry\n .split(\"=\")\n .map((x) => x.trim())\n .slice(0, 2),\n );\n\n return Object.fromEntries(entries);\n}\n\n/**\n * Returns the nearest match, or undefined if the path matches no route.\n *\n * @param url - Path to match against routes.\n * @param options - Options to customize how matching operates.\n */\nexport function matchRoutes<T>(\n routes: ParsedRoute<T>[],\n url: string,\n options: RouteMatchOptions<T> = {},\n): RouteMatch<T> | undefined {\n const [path, query] = url.split(\"?\");\n const parts = splitPath(path);\n\n routes: for (const route of routes) {\n const { fragments } = route;\n const hasWildcard = fragments[fragments.length - 1]?.type === FragTypes.Wildcard;\n\n if (!hasWildcard && fragments.length !== parts.length) {\n continue routes;\n }\n\n if (options.willMatch && !options.willMatch(route)) {\n continue routes;\n }\n\n const matched: RouteFragment[] = [];\n\n fragments: for (let i = 0; i < fragments.length; i++) {\n const part = parts[i];\n const frag = fragments[i];\n\n if (part == null && frag.type !== FragTypes.Wildcard) {\n continue routes;\n }\n\n switch (frag.type) {\n case FragTypes.Literal:\n if (frag.name.toLowerCase() === part.toLowerCase()) {\n matched.push(frag);\n break;\n } else {\n continue routes;\n }\n case FragTypes.Param:\n matched.push({ ...frag, value: part });\n break;\n case FragTypes.Wildcard:\n matched.push({ ...frag, value: parts.slice(i).join(\"/\") });\n break fragments;\n case FragTypes.NumericParam:\n if (!isNaN(Number(part))) {\n matched.push({ ...frag, value: part });\n break;\n } else {\n continue routes;\n }\n default:\n throw new Error(`Unknown fragment type: ${frag.type}`);\n }\n }\n\n const params: Record<string, string> = {};\n\n for (const frag of matched) {\n if (frag.type === FragTypes.Param) {\n params[frag.name] = decodeURIComponent(frag.value as string);\n }\n\n if (frag.type === FragTypes.NumericParam) {\n params[frag.name] = String(frag.value);\n }\n\n if (frag.type === FragTypes.Wildcard) {\n params.wildcard = \"/\" + decodeURIComponent(frag.value as string);\n }\n }\n\n return {\n path: \"/\" + matched.map((f) => f.value).join(\"/\"),\n pattern:\n \"/\" +\n fragments\n .map((f) => {\n if (f.type === FragTypes.Param) {\n return `{${f.name}}`;\n }\n\n if (f.type === FragTypes.NumericParam) {\n return `{#${f.name}}`;\n }\n\n return f.name;\n })\n .join(\"/\"),\n params,\n query: parseQueryParams(query),\n meta: route.meta,\n };\n }\n}\n\n/**\n * Sort routes descending by specificity. Guarantees that the most specific route matches first\n * no matter the order in which they were added.\n *\n * Routes without named params and routes with more fragments are weighted more heavily.\n */\nexport function sortRoutes<T>(routes: ParsedRoute<T>[]): ParsedRoute<T>[] {\n const withoutParams = [];\n const withNumericParams = [];\n const withParams = [];\n const wildcard = [];\n\n for (const route of routes) {\n const { fragments } = route;\n\n if (fragments.some((f) => f.type === FragTypes.Wildcard)) {\n wildcard.push(route);\n } else if (fragments.some((f) => f.type === FragTypes.NumericParam)) {\n withNumericParams.push(route);\n } else if (fragments.some((f) => f.type === FragTypes.Param)) {\n withParams.push(route);\n } else {\n withoutParams.push(route);\n }\n }\n\n const bySizeDesc = (a: ParsedRoute<T>, b: ParsedRoute<T>) => {\n if (a.fragments.length > b.fragments.length) {\n return -1;\n } else {\n return 1;\n }\n };\n\n withoutParams.sort(bySizeDesc);\n withNumericParams.sort(bySizeDesc);\n withParams.sort(bySizeDesc);\n wildcard.sort(bySizeDesc);\n\n return [...withoutParams, ...withNumericParams, ...withParams, ...wildcard];\n}\n\n/**\n * Converts a route pattern into a set of matchable fragments.\n *\n * @param route - A route string (e.g. \"/api/users/{id}\")\n */\nexport function patternToFragments(pattern: string): RouteFragment[] {\n const parts = splitPath(pattern);\n const fragments = [];\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n if (part === \"*\") {\n if (i !== parts.length - 1) {\n throw new Error(`Wildcard must be at the end of a pattern. Received: ${pattern}`);\n }\n fragments.push({\n type: FragTypes.Wildcard,\n name: \"*\",\n value: null,\n });\n } else if (part.at(0) === \"{\" && part.at(-1) === \"}\") {\n fragments.push({\n type: part[1] === \"#\" ? FragTypes.NumericParam : FragTypes.Param,\n name: part[1] === \"#\" ? part.slice(2, -1) : part.slice(1, -1),\n value: null,\n });\n } else {\n fragments.push({\n type: FragTypes.Literal,\n name: part,\n value: part,\n });\n }\n }\n\n return fragments;\n}\n\nconst safeExternalLink = /(noopener|noreferrer) (noopener|noreferrer)/;\nconst protocolLink = /^[\\w-_]+:/;\n\n/**\n * Intercepts links within the root node.\n *\n * This is adapted from https://github.com/choojs/nanohref/blob/master/index.js\n *\n * @param root - Element under which to intercept link clicks\n * @param callback - Function to call when a click event is intercepted\n * @param _window - (optional) Override for global window object\n */\nexport function catchLinks(root: Element, callback: (anchor: HTMLAnchorElement) => void, _window = window) {\n function traverse(node: HTMLElement | null): HTMLAnchorElement | null {\n if (!node || node === root) {\n return null;\n }\n\n if (node.localName !== \"a\" || (node as any).href === undefined) {\n return traverse(node.parentNode as HTMLElement | null);\n }\n\n return node as HTMLAnchorElement;\n }\n\n function handler(e: MouseEvent) {\n if ((e.button && e.button !== 0) || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey || e.defaultPrevented) {\n return;\n }\n\n const anchor = traverse(e.target as HTMLElement);\n\n if (!anchor) {\n return;\n }\n\n if (\n _window.location.protocol !== anchor.protocol ||\n _window.location.hostname !== anchor.hostname ||\n _window.location.port !== anchor.port ||\n anchor.hasAttribute(\"data-router-ignore\") ||\n anchor.hasAttribute(\"download\") ||\n (anchor.getAttribute(\"target\") === \"_blank\" && safeExternalLink.test(anchor.getAttribute(\"rel\")!)) ||\n protocolLink.test(anchor.getAttribute(\"href\")!)\n ) {\n return;\n }\n\n e.preventDefault();\n callback(anchor);\n }\n\n root.addEventListener(\"click\", handler as any);\n\n return function cancel() {\n root.removeEventListener(\"click\", handler as any);\n };\n}\n\n/**\n * Replace route pattern param placeholders with real matched values.\n */\nexport function replaceParams(path: string, params: Record<string, string | number>) {\n for (const key in params) {\n const value = params[key].toString();\n path = path.replace(`{${key}}`, value).replace(`{#${key}}`, value);\n }\n\n return path;\n}\n","import { createLogger, type Logger } from \"../core/logger.js\";\nimport { constructView, type ViewElement, type ViewFunction } from \"../core/nodes/view.js\";\nimport { $, peek, type UnsubscribeFn } from \"../core/signals.js\";\nimport { Passthrough } from \"../core/views/passthrough.js\";\nimport { assertObject, isArray, isFunction, isObject, isString } from \"../typeChecking.js\";\nimport type { Stringable } from \"../types.js\";\nimport { shallowEqual } from \"../utils.js\";\nimport {\n catchLinks,\n joinPath,\n matchRoutes,\n patternToFragments,\n replaceParams,\n resolvePath,\n sortRoutes,\n splitPath,\n type ParsedRoute,\n type RouteMatch,\n} from \"./router.utils.js\";\n\n// ----- Types ----- //\n\nexport interface RouteMatchContext {\n path: string;\n pattern: string;\n params: Record<string, string>;\n query: Record<string, string>;\n\n /**\n * Redirects the user to a different route instead of matching the current one.\n */\n redirect(path: string): void;\n\n /**\n * Triggers the next beforeMatch function, or mounts the route.\n */\n next(): void;\n}\n\nexport interface Route {\n /**\n * The path or path fragment to match.\n */\n path: string;\n\n /**\n * Path to redirect to when this route is matched, or a callback function that returns such path.\n */\n redirect?: string | ((ctx: RouteRedirectContext) => string) | ((ctx: RouteRedirectContext) => Promise<string>);\n\n /**\n * View to display when this route is matched.\n */\n view?: ViewFunction<any>;\n\n /**\n * Subroutes.\n */\n routes?: Route[];\n\n /**\n * Called after the match is identified but before it is acted on. Use this to set state, load data, etc.\n */\n beforeMatch?: (ctx: RouteMatchContext) => void | Promise<void>;\n}\n\nexport interface RouteMeta {\n redirect?: string | ((ctx: RouteRedirectContext) => string) | ((ctx: RouteRedirectContext) => Promise<string>);\n pattern?: string;\n layers?: RouteLayer[];\n beforeMatch?: ((ctx: RouteMatchContext) => void | Promise<void>)[];\n}\n\nexport interface RouteConfig {\n pattern: string;\n meta: RouteMeta;\n}\n\nexport interface RouteLayer {\n id: number;\n view: ViewFunction<{}>;\n}\n\n/**\n * An active route layer whose markup has been initialized into a view.\n */\ninterface ActiveLayer {\n id: number;\n view: ViewElement;\n}\n\n/**\n * Object passed to redirect callbacks. Contains information useful for determining how to redirect.\n */\nexport interface RouteRedirectContext {\n /**\n * The path as it appears in the URL bar.\n */\n path: string;\n\n /**\n * The pattern that this path was matched with.\n */\n pattern: string;\n\n /**\n * Named route params parsed from `path`.\n */\n params: Record<string, string>;\n\n /**\n * Query params parsed from `path`.\n */\n query: Record<string, string>;\n}\n\n/**\n * A log for a single step in the route resolution process.\n */\ninterface JourneyStep {\n kind: \"match\" | \"redirect\" | \"miss\";\n message: string;\n}\n\nexport interface NavigateOptions {\n /**\n * Replace the current item in the history stack instead of adding a new one.\n * The back button will send the user to the page they visited before this. Defaults to false.\n */\n replace?: boolean;\n\n /**\n * Preserve existing query params (if any) when navigating. Defaults to false.\n * If true, all existing query params are preserved and merged with new ones.\n * If an array of strings is passed only those keys will be preserved, then merged with any new ones.\n */\n preserveQuery?: boolean | string[];\n}\n\nexport interface RouterOptions {\n routes: Route[];\n\n /**\n * When true, the router will construct routes like \"https://www.example.com/#/sub/route\" which work without any backend intervention.\n */\n hash?: boolean;\n}\n\n// ----- Code ----- //\n\nexport const MOUNT = Symbol();\nexport const UNMOUNT = Symbol();\nexport const ROOT_VIEW = Symbol();\n\nexport class Router {\n #logger?: Logger;\n\n #layerId = 0;\n #activeLayers: ActiveLayer[] = [];\n #routes: ParsedRoute<RouteMeta>[] = [];\n\n #isMounted = false;\n\n [ROOT_VIEW] = constructView(Passthrough);\n\n /**\n * Use hash routing when true. Configured in router options.\n */\n #hash = false;\n\n // Callbacks that need to be called on unmount.\n #unsubscribers: UnsubscribeFn[] = [];\n\n /**\n * The current match object.\n */\n #match = $<RouteMatch>();\n\n /**\n * The currently matched route pattern, if any.\n */\n readonly $pattern = $(() => this.#match()?.pattern);\n\n /**\n * The current URL path.\n */\n readonly $path = $(() => this.#match()?.path ?? window.location.pathname);\n\n /**\n * The current named path params.\n */\n readonly $params = $(() => this.#match()?.params ?? {}, { equals: shallowEqual });\n\n /**\n * The current query params. Changes to this object will be reflected in the URL.\n */\n readonly $query = $(() => this.#match()?.query ?? {}, { equals: shallowEqual });\n\n constructor(options: RouterOptions) {\n assertObject(options, \"Options must be an object. Got: %t\");\n\n if (options.hash) {\n this.#hash = true;\n }\n\n // Add routes.\n this.#routes = sortRoutes(\n options.routes\n .flatMap((route) => this.#prepareRoute(route))\n .map((route) => ({\n pattern: route.pattern,\n meta: route.meta,\n fragments: patternToFragments(route.pattern),\n })),\n );\n\n assertValidRedirects(this.#routes);\n }\n\n async [MOUNT](parent: Element) {\n this.#logger = createLogger(\"Dolla.router\");\n\n // Listen for popstate events and update route accordingly.\n const onPopState = () => {\n this.#updateRoute(undefined, {});\n };\n window.addEventListener(\"popstate\", onPopState);\n this.#unsubscribers.push(() => window.removeEventListener(\"popstate\", onPopState));\n\n // Listen for clicks on <a> tags within the app.\n this.#unsubscribers.push(\n catchLinks(parent, (anchor) => {\n let href = anchor.getAttribute(\"href\")!;\n this.#logger!.info(\"intercepted click on <a> tag\", anchor);\n\n const preserve = anchor.getAttribute(\"data-router-preserve-query\");\n\n this.go(href, {\n preserveQuery: parsePreserveQueryAttribute(preserve),\n });\n }),\n );\n this.#logger.info(\"will intercept clicks on <a> tags within root element\", parent);\n\n this.#isMounted = true;\n\n // Setup initial route content.\n await this.#updateRoute(undefined, {});\n }\n\n async [UNMOUNT]() {\n for (const callback of this.#unsubscribers) {\n callback();\n }\n this.#unsubscribers = [];\n }\n\n /**\n * Navigate backward. Pass a number of steps to hit the back button that many times.\n */\n back(steps = 1) {\n window.history.go(-steps);\n }\n\n /**\n * Navigate forward. Pass a number of steps to hit the forward button that many times.\n */\n forward(steps = 1) {\n window.history.go(steps);\n }\n\n /**\n * Navigates to another route.\n *\n * @example\n * router.go(\"/login\"); // navigate to `/login`\n * router.go[\"/users\", 215], { replace: true }); // replace current history entry with `/users/215`\n */\n go(path: Stringable | Stringable[], options: NavigateOptions = {}) {\n let joined: string;\n\n if (Array.isArray(path)) {\n joined = joinPath(path);\n } else {\n joined = path.toString();\n }\n\n joined = resolvePath(window.location.pathname, joined);\n\n if (options.replace) {\n this.#replace(joined, options);\n } else {\n this.#push(joined, options);\n }\n }\n\n /**\n * Updates query params, keeping existing ones and applying new ones. Removes the query param if value is set to `null`.\n */\n updateQuery(values: Record<string, Stringable | null>) {\n const match = peek(this.#match)!;\n const query = { ...this.$query() };\n\n for (const key in values) {\n const value = values[key];\n if (value === null) {\n delete query[key];\n } else {\n query[key] = value.toString();\n }\n }\n\n let queryParts: string[] = [];\n\n for (const key in query) {\n queryParts.push(`${key}=${query[key]}`);\n }\n const queryString = queryParts.length > 0 ? \"?\" + queryParts.join(\"&\") : \"\";\n\n this.#match({ ...match, query });\n\n window.history.replaceState(null, \"\", this.#hash ? \"/#\" + match.path + queryString : match.path + queryString);\n }\n\n #push(href: string, options: NavigateOptions) {\n this.#logger?.info(\"(push)\", href);\n\n window.history.pushState(null, \"\", this.#hash ? \"/#\" + href : href);\n this.#updateRoute(href, options);\n }\n\n #replace(href: string, options: NavigateOptions) {\n this.#logger?.info(\"(replace)\", href);\n\n window.history.replaceState(null, \"\", this.#hash ? \"/#\" + href : href);\n this.#updateRoute(href, options);\n }\n\n #getCurrentURL(): URL {\n if (this.#hash) {\n return new URL(window.location.hash.slice(1), window.location.origin);\n } else {\n return new URL(window.location.pathname, window.location.origin);\n }\n }\n\n /**\n * Run when the location changes. Diffs and mounts new routes and updates\n * the $path, $route, $params and $query states accordingly.\n */\n async #updateRoute(href: string | undefined, options: NavigateOptions) {\n const logger = this.#logger;\n const rootView = this[ROOT_VIEW];\n const url = href ? new URL(href, window.location.origin) : this.#getCurrentURL();\n\n const { match, journey } = await this.#resolveRoute(url);\n\n for (const step of journey) {\n switch (step.kind) {\n case \"match\":\n logger?.info(`📍 ${step.message}`);\n break;\n case \"redirect\":\n logger?.info(`↩️ ${step.message}`);\n break;\n case \"miss\":\n logger?.info(`💀 ${step.message}`);\n break;\n default:\n break;\n }\n }\n\n if (match) {\n const oldPattern = peek(this.$pattern);\n\n // Merge query params.\n let query = match.query;\n let queryParts: string[] = [];\n\n if (options.preserveQuery === true) {\n query = Object.assign({}, this.$query(), match.query);\n } else if (isArray(options.preserveQuery)) {\n const preserved: Record<string, any> = {};\n const current = this.$query();\n for (const key in current) {\n if (options.preserveQuery.includes(key)) {\n preserved[key] = current[key];\n }\n }\n query = Object.assign({}, preserved, match.query);\n }\n\n for (const key in query) {\n queryParts.push(`${key}=${query[key]}`);\n }\n const queryString = queryParts.length > 0 ? \"?\" + queryParts.join(\"&\") : \"\";\n\n this.#match({ ...match, query });\n\n // Update the URL if matched path differs from navigator path.\n // This happens if route resolution involved redirects.\n if (rootView && (match.path !== location.pathname || location.search !== queryString)) {\n window.history.replaceState(null, \"\", this.#hash ? \"/#\" + match.path + queryString : match.path + queryString);\n }\n\n if (rootView && match.pattern !== oldPattern) {\n this.#mountRoute(rootView, match);\n }\n } else {\n // Only crash if routing has been configured.\n if (this.#isMounted) {\n logger!.crash(new NoRouteError(`Failed to match route '${url.pathname}'`));\n }\n }\n\n return { match, journey };\n }\n\n /**\n * Takes a matched route and mounts it.\n */\n #mountRoute(rootView: ViewElement, match: RouteMatch<RouteMeta>) {\n const layers = match.meta.layers!;\n\n // Diff and update route layers.\n for (let i = 0; i < layers.length; i++) {\n const matchedLayer = layers[i];\n const activeLayer = this.#activeLayers[i];\n\n if (activeLayer?.id !== matchedLayer.id) {\n // Discard all previously active layers starting at this depth.\n this.#activeLayers = this.#activeLayers.slice(0, i);\n activeLayer?.view.unmount();\n\n const parentLayer = this.#activeLayers.at(-1);\n const parent = parentLayer?.view ?? rootView;\n\n const view = parent.setRouteView(matchedLayer.view);\n this.#activeLayers.push({ id: matchedLayer.id, view });\n }\n }\n }\n\n /**\n * Takes a URL and finds a match, following redirects.\n */\n async #resolveRoute(\n url: URL,\n journey: JourneyStep[] = [],\n ): Promise<{\n match: RouteMatch<RouteMeta> | null;\n journey: JourneyStep[];\n }> {\n return new Promise((resolve, reject) => {\n const match = matchRoutes(this.#routes, url.pathname);\n\n if (!match) {\n return resolve({\n match: null,\n journey: [...journey, { kind: \"miss\", message: `no match for '${url.pathname}'` }],\n });\n }\n\n let redirect = match.meta.redirect;\n\n const finalize = async () => {\n if (redirect != null) {\n let path: string;\n\n if (isString(redirect)) {\n path = replaceParams(redirect, match.params);\n } else if (isFunction(redirect)) {\n const redirectContext: RouteRedirectContext = {\n path: match.path,\n pattern: match.pattern,\n params: match.params,\n query: match.query,\n };\n path = await redirect(redirectContext);\n if (!isString(path)) {\n return reject(new Error(`Redirect function must return a path to redirect to.`));\n }\n if (!path.startsWith(\"/\")) {\n // Not absolute. Resolve against matched path.\n path = resolvePath(match.path, path);\n }\n } else {\n return reject(new TypeError(`Redirect must either be a path string or a function.`));\n }\n\n resolve(\n this.#resolveRoute(new URL(path, window.location.origin), [\n ...journey,\n { kind: \"redirect\", message: `redirecting '${match.path}' -> '${path}'` },\n ]),\n );\n } else {\n resolve({ match, journey: [...journey, { kind: \"match\", message: `matched route '${match.path}'` }] });\n }\n };\n\n if (match.meta.beforeMatch?.length) {\n const callbacks = match.meta.beforeMatch;\n let i = -1;\n const next = () => {\n i++;\n if (i === callbacks.length) {\n // Mount route\n finalize();\n } else {\n // Next callback\n callbacks[i]({\n path: match.path,\n pattern: match.pattern,\n params: match.params,\n query: match.query,\n\n // TODO: Allow setting context variables from here? Would apply to the context of the matched view.\n redirect: (path) => {\n redirect = path;\n finalize();\n },\n\n next,\n });\n }\n };\n\n next();\n\n // TODO: Show warning after timeout if next hasn't been called?\n } else {\n finalize();\n }\n });\n }\n\n /**\n * Parses a route definition object into a set of matchable routes.\n *\n * @param route - Route config object.\n * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.\n */\n #prepareRoute(route: Route, parents: Route[] = [], layers: RouteLayer[] = []) {\n if (!isObject(route) || !isString(route.path)) {\n throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${route}`);\n }\n\n if (route.redirect && route.routes) {\n throw new Error(`Route cannot have both a 'redirect' and nested 'routes'.`);\n } else if (route.redirect && route.view) {\n throw new Error(`Route cannot have both a 'redirect' and a 'view'.`);\n } else if (!route.view && !route.routes && !route.redirect) {\n throw new Error(`Route must have a 'view', a 'redirect', or a set of nested 'routes'.`);\n }\n\n let parts: string[] = [];\n\n for (const parent of parents) {\n parts.push(...splitPath(parent.path));\n }\n\n parts.push(...splitPath(route.path));\n\n // Remove trailing wildcard for joining with nested routes.\n if (parts[parts.length - 1] === \"*\") {\n parts.pop();\n }\n\n const routes: RouteConfig[] = [];\n\n if (route.redirect) {\n let redirect = route.redirect;\n\n if (isString(redirect)) {\n redirect = resolvePath(joinPath(parts), redirect);\n\n if (!redirect.startsWith(\"/\")) {\n redirect = \"/\" + redirect;\n }\n }\n\n routes.push({\n pattern: \"/\" + joinPath([...parts, ...splitPath(route.path)]),\n meta: {\n redirect,\n },\n });\n\n return routes;\n }\n\n let view: ViewFunction<any> = Passthrough;\n\n if (isFunction(route.view)) {\n view = route.view;\n } else if (route.view) {\n throw new TypeError(`Route '${route.path}' expected a view function or undefined. Got: ${route.view}`);\n }\n\n const layer: RouteLayer = { id: this.#layerId++, view };\n\n // Parse nested routes if they exist.\n if (route.routes) {\n for (const subroute of route.routes) {\n routes.push(...this.#prepareRoute(subroute, [...parents, route], [...layers, layer]));\n }\n } else {\n routes.push({\n pattern: parent ? joinPath([...parents.map((p) => p.path), route.path]) : route.path,\n meta: {\n pattern: route.path,\n layers: [...layers, layer],\n beforeMatch: parents\n .flatMap((parent) => parent.beforeMatch)\n .concat(route.beforeMatch)\n .filter((x) => x != null),\n },\n });\n }\n\n return routes;\n }\n}\n\nfunction assertValidRedirects(routes: ParsedRoute<RouteMeta>[]) {\n // Test redirects to make sure all possible redirect targets actually exist.\n for (const route of routes) {\n if (route.meta.redirect) {\n let redirectPath: string;\n\n if (isFunction(route.meta.redirect)) {\n // throw new Error(`Redirect functions are not yet supported.`);\n // Just allow, though it could fail later. Best not to call the function and cause potential side effects.\n } else if (isString(route.meta.redirect)) {\n redirectPath = route.meta.redirect;\n\n const match = matchRoutes(routes, redirectPath, {\n willMatch(r) {\n return r !== route;\n },\n });\n\n if (!match) {\n throw new Error(`Found a redirect to an undefined URL. From '${route.pattern}' to '${route.meta.redirect}'`);\n }\n } else {\n throw new TypeError(`Expected a string or redirect function. Got: ${route.meta.redirect}`);\n }\n }\n }\n}\n\n/**\n * Parses the data-router-preserve-query attribute from a link.\n */\nfunction parsePreserveQueryAttribute(value: null | string | boolean): boolean | string[] {\n if (value === null) {\n return false;\n } else if (value === true || value === false) {\n return value;\n } else if (typeof value === \"string\") {\n value = value.trim();\n if (value === \"\" || value === \"true\") {\n return true;\n } else if (value === \"false\") {\n return false;\n }\n\n return value\n .split(\",\")\n .map((k) => k.trim())\n .filter((k) => k.length > 0);\n } else {\n throw new Error(`Invalid type for data-router-preserve-query attribute: ${typeof value} (value: ${value})`);\n }\n}\n\nclass NoRouteError extends Error {}\n"],"names":["Passthrough","_","ctx","splitPath","path","assertString","f","joinPath","parts","assertArrayOf","part","isFunction","x","joined","_a","p","resolvePath","base","resolved","i","parseQueryParams","query","entries","entry","matchRoutes","routes","url","options","route","fragments","matched","frag","params","sortRoutes","withoutParams","withNumericParams","withParams","wildcard","bySizeDesc","a","b","patternToFragments","pattern","safeExternalLink","protocolLink","catchLinks","root","callback","_window","traverse","node","handler","e","anchor","replaceParams","key","value","MOUNT","UNMOUNT","ROOT_VIEW","Router","__privateAdd","_Router_instances","_logger","_layerId","_activeLayers","_routes","_isMounted","__publicField","constructView","_hash","_unsubscribers","_match","$","__privateGet","shallowEqual","assertObject","__privateSet","__privateMethod","prepareRoute_fn","assertValidRedirects","parent","createLogger","onPopState","updateRoute_fn","href","preserve","parsePreserveQueryAttribute","steps","replace_fn","push_fn","values","match","peek","queryParts","queryString","getCurrentURL_fn","logger","rootView","journey","resolveRoute_fn","step","oldPattern","isArray","preserved","current","mountRoute_fn","NoRouteError","layers","matchedLayer","activeLayer","parentLayer","view","resolve","reject","redirect","finalize","isString","redirectContext","callbacks","next","parents","isObject","layer","__privateWrapper","subroute","redirectPath","r","k"],"mappings":";;;;;;;;;;;;;;;;;;AAKgB,SAAAA,EAAYC,GAAOC,GAAkB;AACnD,SAAOA,EAAI,OAAO;AACpB;ACmDO,SAASC,EAAUC,GAAwB;AAChD,SAAAC,EAAaD,GAAM,yDAAyD,GAErEA,EACJ,MAAM,GAAG,EACT,IAAI,CAACE,MAAMA,EAAE,KAAA,CAAM,EACnB,OAAO,CAACA,MAAMA,MAAM,EAAE;AAC3B;AAQO,SAASC,EAASC,GAAyC;;AAChE,EAAAC;AAAA,IACE,CAACC,MAASC,EAAWD,KAAA,gBAAAA,EAAM,QAAQ;AAAA,IACnCF;AAAA,IACA;AAAA,EACF,GAEAA,IAAQA,EAAM,OAAO,CAACI,MAAMA,CAAC,EAAE,QAAQ,MAAM;AAE7C,MAAIC,KAASC,IAAAN,EAAM,MAAM,MAAZ,gBAAAM,EAAe;AAE5B,MAAID,GAAQ;AACC,eAAAH,KAAQ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,CAACA,MAAMA,EAAE,SAAS,CAAC;AAE7B,QAAM,IAAI,MAAM,0DAA0D,OAAOxE,CAAK,YAAYA,CAAK,GAAG;AAE9G;AAEA,MAAMmD,WAAqB,MAAM;AAAC;"}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sources":["../src/router/index.ts"],"sourcesContent":["import { Router, RouterOptions } from \"./router.js\";\n\nexport function createRouter(options: RouterOptions): Router {\n return new Router(options);\n}\n"],"names":["createRouter","options","Router"],"mappings":";AAEO,SAASA,EAAaC,GAAgC;AACpD,SAAA,IAAIC,EAAOD,CAAO;AAC3B;"}
|