@sveltejs/kit 1.0.0-next.290 → 1.0.0-next.291
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/assets/app/navigation.js +11 -66
- package/assets/client/singletons.js +5 -13
- package/assets/client/start.js +765 -827
- package/dist/cli.js +2 -2
- package/package.json +1 -1
- package/assets/chunks/utils.js +0 -13
package/assets/app/navigation.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as get_base_uri } from '../chunks/utils.js';
|
|
1
|
+
import { client } from '../client/singletons.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* @param {string} name
|
|
@@ -10,70 +9,16 @@ function guard(name) {
|
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
? guard('disableScrollHandling')
|
|
15
|
-
: disableScrollHandling_;
|
|
16
|
-
const goto = import.meta.env.SSR ? guard('goto') : goto_;
|
|
17
|
-
const invalidate = import.meta.env.SSR ? guard('invalidate') : invalidate_;
|
|
18
|
-
const prefetch = import.meta.env.SSR ? guard('prefetch') : prefetch_;
|
|
19
|
-
const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : prefetchRoutes_;
|
|
20
|
-
const beforeNavigate = import.meta.env.SSR ? () => {} : beforeNavigate_;
|
|
21
|
-
const afterNavigate = import.meta.env.SSR ? () => {} : afterNavigate_;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @type {import('$app/navigation').goto}
|
|
25
|
-
*/
|
|
26
|
-
async function disableScrollHandling_() {
|
|
27
|
-
renderer.disable_scroll_handling();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @type {import('$app/navigation').goto}
|
|
32
|
-
*/
|
|
33
|
-
async function goto_(href, opts) {
|
|
34
|
-
return router.goto(href, opts, []);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @type {import('$app/navigation').invalidate}
|
|
39
|
-
*/
|
|
40
|
-
async function invalidate_(resource) {
|
|
41
|
-
const { href } = new URL(resource, location.href);
|
|
42
|
-
return router.renderer.invalidate(href);
|
|
43
|
-
}
|
|
12
|
+
const ssr = import.meta.env.SSR;
|
|
44
13
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
async function prefetchRoutes_(pathnames) {
|
|
56
|
-
const matching = pathnames
|
|
57
|
-
? router.routes.filter((route) => pathnames.some((pathname) => route[0].test(pathname)))
|
|
58
|
-
: router.routes;
|
|
59
|
-
|
|
60
|
-
const promises = matching.map((r) => Promise.all(r[1].map((load) => load())));
|
|
61
|
-
|
|
62
|
-
await Promise.all(promises);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @type {import('$app/navigation').beforeNavigate}
|
|
67
|
-
*/
|
|
68
|
-
function beforeNavigate_(fn) {
|
|
69
|
-
if (router) router.before_navigate(fn);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @type {import('$app/navigation').afterNavigate}
|
|
74
|
-
*/
|
|
75
|
-
function afterNavigate_(fn) {
|
|
76
|
-
if (router) router.after_navigate(fn);
|
|
77
|
-
}
|
|
14
|
+
const disableScrollHandling = ssr
|
|
15
|
+
? guard('disableScrollHandling')
|
|
16
|
+
: client.disable_scroll_handling;
|
|
17
|
+
const goto = ssr ? guard('goto') : client.goto;
|
|
18
|
+
const invalidate = ssr ? guard('invalidate') : client.invalidate;
|
|
19
|
+
const prefetch = ssr ? guard('prefetch') : client.prefetch;
|
|
20
|
+
const prefetchRoutes = ssr ? guard('prefetchRoutes') : client.prefetch_routes;
|
|
21
|
+
const beforeNavigate = ssr ? () => {} : client.before_navigate;
|
|
22
|
+
const afterNavigate = ssr ? () => {} : client.after_navigate;
|
|
78
23
|
|
|
79
24
|
export { afterNavigate, beforeNavigate, disableScrollHandling, goto, invalidate, prefetch, prefetchRoutes };
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* @type {import('./router').Router}
|
|
4
|
-
*/
|
|
5
|
-
let router;
|
|
6
|
-
|
|
7
|
-
/** @type {import('./renderer').Renderer} */
|
|
8
|
-
let renderer;
|
|
1
|
+
/** @type {import('./types').Client} */
|
|
2
|
+
let client;
|
|
9
3
|
|
|
10
4
|
/**
|
|
11
5
|
* @param {{
|
|
12
|
-
*
|
|
13
|
-
* renderer: import('./renderer').Renderer;
|
|
6
|
+
* client: import('./types').Client;
|
|
14
7
|
* }} opts
|
|
15
8
|
*/
|
|
16
9
|
function init(opts) {
|
|
17
|
-
|
|
18
|
-
renderer = opts.renderer;
|
|
10
|
+
client = opts.client;
|
|
19
11
|
}
|
|
20
12
|
|
|
21
|
-
export {
|
|
13
|
+
export { client, init };
|