@sveltejs/kit 2.11.0 → 2.12.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/package.json +1 -1
- package/src/exports/public.d.ts +3 -3
- package/src/exports/vite/build/build_service_worker.js +2 -1
- package/src/exports/vite/index.js +7 -1
- package/src/runtime/app/forms.js +1 -1
- package/src/runtime/app/state/client.js +84 -0
- package/src/runtime/app/state/package.json +9 -0
- package/src/runtime/app/state/server.js +60 -0
- package/src/runtime/app/stores.js +7 -0
- package/src/runtime/client/client.js +40 -25
- package/src/runtime/client/state.svelte.js +57 -0
- package/src/runtime/client/utils.js +5 -0
- package/src/runtime/components/svelte-5/error.svelte +3 -3
- package/src/runtime/server/page/actions.js +4 -2
- package/src/runtime/server/page/index.js +1 -1
- package/src/runtime/server/page/render.js +13 -2
- package/src/types/ambient.d.ts +2 -2
- package/src/types/internal.d.ts +4 -1
- package/src/utils/url.js +1 -1
- package/src/version.js +1 -1
- package/types/index.d.ts +68 -10
- package/types/index.d.ts.map +5 -3
package/package.json
CHANGED
package/src/exports/public.d.ts
CHANGED
|
@@ -638,17 +638,17 @@ export interface KitConfig {
|
|
|
638
638
|
* /// file: +layout.svelte
|
|
639
639
|
* <script>
|
|
640
640
|
* import { beforeNavigate } from '$app/navigation';
|
|
641
|
-
* import { updated } from '$app/
|
|
641
|
+
* import { updated } from '$app/state';
|
|
642
642
|
*
|
|
643
643
|
* beforeNavigate(({ willUnload, to }) => {
|
|
644
|
-
* if (
|
|
644
|
+
* if (updated.current && !willUnload && to?.url) {
|
|
645
645
|
* location.href = to.url.href;
|
|
646
646
|
* }
|
|
647
647
|
* });
|
|
648
648
|
* </script>
|
|
649
649
|
* ```
|
|
650
650
|
*
|
|
651
|
-
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of
|
|
651
|
+
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of [`updated.current`](https://svelte.dev/docs/kit/$app-state#updated) `true` when it detects one.
|
|
652
652
|
*/
|
|
653
653
|
version?: {
|
|
654
654
|
/**
|
|
@@ -886,7 +886,13 @@ async function kit({ svelte_config }) {
|
|
|
886
886
|
await build_service_worker(
|
|
887
887
|
out,
|
|
888
888
|
kit,
|
|
889
|
-
|
|
889
|
+
{
|
|
890
|
+
...vite_config,
|
|
891
|
+
build: {
|
|
892
|
+
...vite_config.build,
|
|
893
|
+
minify: initial_config.build?.minify ?? 'esbuild'
|
|
894
|
+
}
|
|
895
|
+
},
|
|
890
896
|
manifest_data,
|
|
891
897
|
service_worker_entry_file,
|
|
892
898
|
prerendered,
|
package/src/runtime/app/forms.js
CHANGED
|
@@ -59,7 +59,7 @@ function clone(element) {
|
|
|
59
59
|
*
|
|
60
60
|
* If this function or its return value isn't set, it
|
|
61
61
|
* - falls back to updating the `form` prop with the returned data if the action is on the same page as the form
|
|
62
|
-
* - updates
|
|
62
|
+
* - updates `page.status`
|
|
63
63
|
* - resets the `<form>` element and invalidates all data in case of successful submission with no redirect response
|
|
64
64
|
* - redirects in case of a redirect response
|
|
65
65
|
* - redirects to the nearest error page in case of an unexpected error
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
page as _page,
|
|
3
|
+
navigating as _navigating,
|
|
4
|
+
updated as _updated
|
|
5
|
+
} from '../../client/state.svelte.js';
|
|
6
|
+
import { stores } from '../../client/client.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A reactive object with information about the current page, serving several use cases:
|
|
10
|
+
* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))
|
|
11
|
+
* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))
|
|
12
|
+
* - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))
|
|
13
|
+
* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error
|
|
14
|
+
*
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <!--- file: +layout.svelte --->
|
|
17
|
+
* <script>
|
|
18
|
+
* import { page } from '$app/state';
|
|
19
|
+
* </script>
|
|
20
|
+
*
|
|
21
|
+
* <p>Currently at {page.url.pathname}</p>
|
|
22
|
+
*
|
|
23
|
+
* {#if page.error}
|
|
24
|
+
* <span class="red">Problem detected</span>
|
|
25
|
+
* {:else}
|
|
26
|
+
* <span class="small">All systems operational</span>
|
|
27
|
+
* {/if}
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.
|
|
31
|
+
*
|
|
32
|
+
* @type {import('@sveltejs/kit').Page}
|
|
33
|
+
*/
|
|
34
|
+
export const page = {
|
|
35
|
+
get data() {
|
|
36
|
+
return _page.data;
|
|
37
|
+
},
|
|
38
|
+
get error() {
|
|
39
|
+
return _page.error;
|
|
40
|
+
},
|
|
41
|
+
get form() {
|
|
42
|
+
return _page.form;
|
|
43
|
+
},
|
|
44
|
+
get params() {
|
|
45
|
+
return _page.params;
|
|
46
|
+
},
|
|
47
|
+
get route() {
|
|
48
|
+
return _page.route;
|
|
49
|
+
},
|
|
50
|
+
get state() {
|
|
51
|
+
return _page.state;
|
|
52
|
+
},
|
|
53
|
+
get status() {
|
|
54
|
+
return _page.status;
|
|
55
|
+
},
|
|
56
|
+
get url() {
|
|
57
|
+
return _page.url;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An object with a reactive `current` property.
|
|
63
|
+
* When navigation starts, `current` is a `Navigation` object with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.
|
|
64
|
+
* When navigation finishes, `current` reverts to `null`.
|
|
65
|
+
*
|
|
66
|
+
* On the server, this value can only be read during rendering. In the browser, it can be read at any time.
|
|
67
|
+
* @type {{ get current(): import('@sveltejs/kit').Navigation | null; }}
|
|
68
|
+
*/
|
|
69
|
+
export const navigating = {
|
|
70
|
+
get current() {
|
|
71
|
+
return _navigating.current;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
|
|
77
|
+
* @type {{ get current(): boolean; check(): Promise<boolean>; }}
|
|
78
|
+
*/
|
|
79
|
+
export const updated = {
|
|
80
|
+
get current() {
|
|
81
|
+
return _updated.current;
|
|
82
|
+
},
|
|
83
|
+
check: stores.updated.check
|
|
84
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getContext } from 'svelte';
|
|
2
|
+
|
|
3
|
+
function context() {
|
|
4
|
+
return getContext('__request__');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** @param {string} name */
|
|
8
|
+
function context_dev(name) {
|
|
9
|
+
try {
|
|
10
|
+
return context();
|
|
11
|
+
} catch {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`Can only read '${name}' on the server during rendering (not in e.g. \`load\` functions), as it is bound to the current request via component context. This prevents state from leaking between users.` +
|
|
14
|
+
'For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server'
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// TODO we're using DEV in some places and __SVELTEKIT_DEV__ in others - why? Can we consolidate?
|
|
20
|
+
export const page = {
|
|
21
|
+
get data() {
|
|
22
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.data') : context()).page.data;
|
|
23
|
+
},
|
|
24
|
+
get error() {
|
|
25
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.error') : context()).page.error;
|
|
26
|
+
},
|
|
27
|
+
get form() {
|
|
28
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.form') : context()).page.form;
|
|
29
|
+
},
|
|
30
|
+
get params() {
|
|
31
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.params') : context()).page.params;
|
|
32
|
+
},
|
|
33
|
+
get route() {
|
|
34
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.route') : context()).page.route;
|
|
35
|
+
},
|
|
36
|
+
get state() {
|
|
37
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.state') : context()).page.state;
|
|
38
|
+
},
|
|
39
|
+
get status() {
|
|
40
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.status') : context()).page.status;
|
|
41
|
+
},
|
|
42
|
+
get url() {
|
|
43
|
+
return (__SVELTEKIT_DEV__ ? context_dev('page.url') : context()).page.url;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const navigating = {
|
|
48
|
+
get current() {
|
|
49
|
+
return (__SVELTEKIT_DEV__ ? context_dev('navigating.current') : context()).navigating;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const updated = {
|
|
54
|
+
get current() {
|
|
55
|
+
return false;
|
|
56
|
+
},
|
|
57
|
+
check: () => {
|
|
58
|
+
throw new Error('Can only call updated.check() in the browser');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -5,6 +5,8 @@ import { stores as browser_stores } from '../client/client.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* A function that returns all of the contextual stores. On the server, this must be called during component initialization.
|
|
7
7
|
* Only use this if you need to defer store subscription until after the component has mounted, for some reason.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
8
10
|
*/
|
|
9
11
|
export const getStores = () => {
|
|
10
12
|
const stores = BROWSER ? browser_stores : getContext('__svelte__');
|
|
@@ -28,6 +30,7 @@ export const getStores = () => {
|
|
|
28
30
|
*
|
|
29
31
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
30
32
|
*
|
|
33
|
+
* @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
31
34
|
* @type {import('svelte/store').Readable<import('@sveltejs/kit').Page>}
|
|
32
35
|
*/
|
|
33
36
|
export const page = {
|
|
@@ -43,6 +46,8 @@ export const page = {
|
|
|
43
46
|
* When navigating finishes, its value reverts to `null`.
|
|
44
47
|
*
|
|
45
48
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
49
|
+
*
|
|
50
|
+
* @deprecated Use `navigating` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
46
51
|
* @type {import('svelte/store').Readable<import('@sveltejs/kit').Navigation | null>}
|
|
47
52
|
*/
|
|
48
53
|
export const navigating = {
|
|
@@ -56,6 +61,8 @@ export const navigating = {
|
|
|
56
61
|
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
|
|
57
62
|
*
|
|
58
63
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated Use `updated` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
59
66
|
* @type {import('svelte/store').Readable<boolean> & { check(): Promise<boolean> }}
|
|
60
67
|
*/
|
|
61
68
|
export const updated = {
|
|
@@ -45,6 +45,7 @@ import { HttpError, Redirect, SvelteKitError } from '../control.js';
|
|
|
45
45
|
import { INVALIDATED_PARAM, TRAILING_SLASH_PARAM, validate_depends } from '../shared.js';
|
|
46
46
|
import { get_message, get_status } from '../../utils/error.js';
|
|
47
47
|
import { writable } from 'svelte/store';
|
|
48
|
+
import { page, update, navigating } from './state.svelte.js';
|
|
48
49
|
|
|
49
50
|
const ICON_REL_ATTRIBUTES = new Set(['icon', 'shortcut icon', 'apple-touch-icon']);
|
|
50
51
|
|
|
@@ -212,7 +213,7 @@ let hydrated = false;
|
|
|
212
213
|
let started = false;
|
|
213
214
|
let autoscroll = true;
|
|
214
215
|
let updating = false;
|
|
215
|
-
let
|
|
216
|
+
let is_navigating = false;
|
|
216
217
|
let hash_navigating = false;
|
|
217
218
|
/** True as soon as there happened one client-side navigation (excluding the SvelteKit-initialized initial one when in SPA mode) */
|
|
218
219
|
let has_navigated = false;
|
|
@@ -228,9 +229,6 @@ let current_history_index;
|
|
|
228
229
|
/** @type {number} */
|
|
229
230
|
let current_navigation_index;
|
|
230
231
|
|
|
231
|
-
/** @type {import('@sveltejs/kit').Page} */
|
|
232
|
-
let page;
|
|
233
|
-
|
|
234
232
|
/** @type {{}} */
|
|
235
233
|
let token;
|
|
236
234
|
|
|
@@ -341,11 +339,12 @@ async function _invalidate() {
|
|
|
341
339
|
}
|
|
342
340
|
|
|
343
341
|
if (navigation_result.props.page) {
|
|
344
|
-
page
|
|
342
|
+
Object.assign(page, navigation_result.props.page);
|
|
345
343
|
}
|
|
346
344
|
current = navigation_result.state;
|
|
347
345
|
reset_invalidation();
|
|
348
346
|
root.$set(navigation_result.props);
|
|
347
|
+
update(navigation_result.props.page);
|
|
349
348
|
}
|
|
350
349
|
|
|
351
350
|
function reset_invalidation() {
|
|
@@ -447,7 +446,7 @@ function initialize(result, target, hydrate) {
|
|
|
447
446
|
const style = document.querySelector('style[data-sveltekit]');
|
|
448
447
|
if (style) style.remove();
|
|
449
448
|
|
|
450
|
-
page
|
|
449
|
+
Object.assign(page, /** @type {import('@sveltejs/kit').Page} */ (result.props.page));
|
|
451
450
|
|
|
452
451
|
root = new app.root({
|
|
453
452
|
target,
|
|
@@ -1240,7 +1239,7 @@ function _before_navigate({ url, type, intent, delta }) {
|
|
|
1240
1239
|
}
|
|
1241
1240
|
};
|
|
1242
1241
|
|
|
1243
|
-
if (!
|
|
1242
|
+
if (!is_navigating) {
|
|
1244
1243
|
// Don't run the event during redirects
|
|
1245
1244
|
before_navigate_callbacks.forEach((fn) => fn(cancellable));
|
|
1246
1245
|
}
|
|
@@ -1294,10 +1293,10 @@ async function navigate({
|
|
|
1294
1293
|
|
|
1295
1294
|
accept();
|
|
1296
1295
|
|
|
1297
|
-
|
|
1296
|
+
is_navigating = true;
|
|
1298
1297
|
|
|
1299
1298
|
if (started) {
|
|
1300
|
-
stores.navigating.set(nav.navigation);
|
|
1299
|
+
stores.navigating.set((navigating.current = nav.navigation));
|
|
1301
1300
|
}
|
|
1302
1301
|
|
|
1303
1302
|
token = nav_token;
|
|
@@ -1423,6 +1422,7 @@ async function navigate({
|
|
|
1423
1422
|
}
|
|
1424
1423
|
|
|
1425
1424
|
root.$set(navigation_result.props);
|
|
1425
|
+
update(navigation_result.props.page);
|
|
1426
1426
|
has_navigated = true;
|
|
1427
1427
|
} else {
|
|
1428
1428
|
initialize(navigation_result, target, false);
|
|
@@ -1464,10 +1464,10 @@ async function navigate({
|
|
|
1464
1464
|
autoscroll = true;
|
|
1465
1465
|
|
|
1466
1466
|
if (navigation_result.props.page) {
|
|
1467
|
-
page
|
|
1467
|
+
Object.assign(page, navigation_result.props.page);
|
|
1468
1468
|
}
|
|
1469
1469
|
|
|
1470
|
-
|
|
1470
|
+
is_navigating = false;
|
|
1471
1471
|
|
|
1472
1472
|
if (type === 'popstate') {
|
|
1473
1473
|
restore_snapshot(current_navigation_index);
|
|
@@ -1479,7 +1479,7 @@ async function navigate({
|
|
|
1479
1479
|
fn(/** @type {import('@sveltejs/kit').AfterNavigate} */ (nav.navigation))
|
|
1480
1480
|
);
|
|
1481
1481
|
|
|
1482
|
-
stores.navigating.set(null);
|
|
1482
|
+
stores.navigating.set((navigating.current = null));
|
|
1483
1483
|
|
|
1484
1484
|
updating = false;
|
|
1485
1485
|
}
|
|
@@ -1722,7 +1722,9 @@ export function disableScrollHandling() {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
1724
|
/**
|
|
1725
|
+
* Allows you to navigate programmatically to a given route, with options such as keeping the current element focused.
|
|
1725
1726
|
* Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`.
|
|
1727
|
+
*
|
|
1726
1728
|
* For external URLs, use `window.location = url` instead of calling `goto(url)`.
|
|
1727
1729
|
*
|
|
1728
1730
|
* @param {string | URL} url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.
|
|
@@ -1731,7 +1733,7 @@ export function disableScrollHandling() {
|
|
|
1731
1733
|
* @param {boolean} [opts.noScroll] If `true`, the browser will maintain its scroll position rather than scrolling to the top of the page after navigation
|
|
1732
1734
|
* @param {boolean} [opts.keepFocus] If `true`, the currently focused element will retain focus after navigation. Otherwise, focus will be reset to the body
|
|
1733
1735
|
* @param {boolean} [opts.invalidateAll] If `true`, all `load` functions of the page will be rerun. See https://svelte.dev/docs/kit/load#rerunning-load-functions for more info on invalidation.
|
|
1734
|
-
* @param {App.PageState} [opts.state] An optional object that will be available
|
|
1736
|
+
* @param {App.PageState} [opts.state] An optional object that will be available as `page.state`
|
|
1735
1737
|
* @returns {Promise<void>}
|
|
1736
1738
|
*/
|
|
1737
1739
|
export function goto(url, opts = {}) {
|
|
@@ -1869,7 +1871,7 @@ export function preloadCode(pathname) {
|
|
|
1869
1871
|
}
|
|
1870
1872
|
|
|
1871
1873
|
/**
|
|
1872
|
-
* Programmatically create a new history entry with the given
|
|
1874
|
+
* Programmatically create a new history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
1873
1875
|
*
|
|
1874
1876
|
* @param {string | URL} url
|
|
1875
1877
|
* @param {App.PageState} state
|
|
@@ -1906,14 +1908,14 @@ export function pushState(url, state) {
|
|
|
1906
1908
|
history.pushState(opts, '', resolve_url(url));
|
|
1907
1909
|
has_navigated = true;
|
|
1908
1910
|
|
|
1909
|
-
page =
|
|
1911
|
+
page.state = state;
|
|
1910
1912
|
root.$set({ page });
|
|
1911
1913
|
|
|
1912
1914
|
clear_onward_history(current_history_index, current_navigation_index);
|
|
1913
1915
|
}
|
|
1914
1916
|
|
|
1915
1917
|
/**
|
|
1916
|
-
* Programmatically replace the current history entry with the given
|
|
1918
|
+
* Programmatically replace the current history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
1917
1919
|
*
|
|
1918
1920
|
* @param {string | URL} url
|
|
1919
1921
|
* @param {App.PageState} state
|
|
@@ -1947,12 +1949,12 @@ export function replaceState(url, state) {
|
|
|
1947
1949
|
|
|
1948
1950
|
history.replaceState(opts, '', resolve_url(url));
|
|
1949
1951
|
|
|
1950
|
-
page =
|
|
1952
|
+
page.state = state;
|
|
1951
1953
|
root.$set({ page });
|
|
1952
1954
|
}
|
|
1953
1955
|
|
|
1954
1956
|
/**
|
|
1955
|
-
* This action updates the `form` property of the current page with the given data and updates
|
|
1957
|
+
* This action updates the `form` property of the current page with the given data and updates `page.status`.
|
|
1956
1958
|
* In case of an error, it redirects to the nearest error page.
|
|
1957
1959
|
* @template {Record<string, unknown> | undefined} Success
|
|
1958
1960
|
* @template {Record<string, unknown> | undefined} Failure
|
|
@@ -1984,18 +1986,22 @@ export async function applyAction(result) {
|
|
|
1984
1986
|
current = navigation_result.state;
|
|
1985
1987
|
|
|
1986
1988
|
root.$set(navigation_result.props);
|
|
1989
|
+
update(navigation_result.props.page);
|
|
1987
1990
|
|
|
1988
1991
|
tick().then(reset_focus);
|
|
1989
1992
|
}
|
|
1990
1993
|
} else if (result.type === 'redirect') {
|
|
1991
1994
|
_goto(result.location, { invalidateAll: true }, 0);
|
|
1992
1995
|
} else {
|
|
1996
|
+
page.form = result.data;
|
|
1997
|
+
page.status = result.status;
|
|
1998
|
+
|
|
1993
1999
|
/** @type {Record<string, any>} */
|
|
1994
2000
|
root.$set({
|
|
1995
2001
|
// this brings Svelte's view of the world in line with SvelteKit's
|
|
1996
2002
|
// after use:enhance reset the form....
|
|
1997
2003
|
form: null,
|
|
1998
|
-
page
|
|
2004
|
+
page
|
|
1999
2005
|
});
|
|
2000
2006
|
|
|
2001
2007
|
// ...so that setting the `form` prop takes effect and isn't ignored
|
|
@@ -2020,7 +2026,7 @@ function _start_router() {
|
|
|
2020
2026
|
|
|
2021
2027
|
persist_state();
|
|
2022
2028
|
|
|
2023
|
-
if (!
|
|
2029
|
+
if (!is_navigating) {
|
|
2024
2030
|
const nav = create_navigation(current, undefined, null, 'leave');
|
|
2025
2031
|
|
|
2026
2032
|
// If we're navigating, beforeNavigate was already called. If we end up in here during navigation,
|
|
@@ -2105,7 +2111,7 @@ function _start_router() {
|
|
|
2105
2111
|
if (_before_navigate({ url, type: 'link' })) {
|
|
2106
2112
|
// set `navigating` to `true` to prevent `beforeNavigate` callbacks
|
|
2107
2113
|
// being called when the page unloads
|
|
2108
|
-
|
|
2114
|
+
is_navigating = true;
|
|
2109
2115
|
} else {
|
|
2110
2116
|
event.preventDefault();
|
|
2111
2117
|
}
|
|
@@ -2253,7 +2259,7 @@ function _start_router() {
|
|
|
2253
2259
|
if (scroll) scrollTo(scroll.x, scroll.y);
|
|
2254
2260
|
|
|
2255
2261
|
if (state !== page.state) {
|
|
2256
|
-
page =
|
|
2262
|
+
page.state = state;
|
|
2257
2263
|
root.$set({ page });
|
|
2258
2264
|
}
|
|
2259
2265
|
|
|
@@ -2323,7 +2329,7 @@ function _start_router() {
|
|
|
2323
2329
|
// the navigation away from it was successful.
|
|
2324
2330
|
// Info about bfcache here: https://web.dev/bfcache
|
|
2325
2331
|
if (event.persisted) {
|
|
2326
|
-
stores.navigating.set(null);
|
|
2332
|
+
stores.navigating.set((navigating.current = null));
|
|
2327
2333
|
}
|
|
2328
2334
|
});
|
|
2329
2335
|
|
|
@@ -2331,8 +2337,17 @@ function _start_router() {
|
|
|
2331
2337
|
* @param {URL} url
|
|
2332
2338
|
*/
|
|
2333
2339
|
function update_url(url) {
|
|
2334
|
-
current.url = url;
|
|
2335
|
-
stores.page.set({
|
|
2340
|
+
current.url = page.url = url;
|
|
2341
|
+
stores.page.set({
|
|
2342
|
+
data: page.data,
|
|
2343
|
+
error: page.error,
|
|
2344
|
+
form: page.form,
|
|
2345
|
+
params: page.params,
|
|
2346
|
+
route: page.route,
|
|
2347
|
+
state: page.state,
|
|
2348
|
+
status: page.status,
|
|
2349
|
+
url
|
|
2350
|
+
});
|
|
2336
2351
|
stores.page.notify();
|
|
2337
2352
|
}
|
|
2338
2353
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { onMount } from 'svelte';
|
|
2
|
+
import { updated_listener } from './utils.js';
|
|
3
|
+
|
|
4
|
+
/** @type {import('@sveltejs/kit').Page} */
|
|
5
|
+
export let page;
|
|
6
|
+
|
|
7
|
+
/** @type {{ current: import('@sveltejs/kit').Navigation | null }} */
|
|
8
|
+
export let navigating;
|
|
9
|
+
|
|
10
|
+
/** @type {{ current: boolean }} */
|
|
11
|
+
export let updated;
|
|
12
|
+
|
|
13
|
+
// this is a bootleg way to tell if we're in old svelte or new svelte
|
|
14
|
+
const is_legacy =
|
|
15
|
+
onMount.toString().includes('$$') || /function \w+\(\) \{\}/.test(onMount.toString());
|
|
16
|
+
|
|
17
|
+
if (is_legacy) {
|
|
18
|
+
page = {
|
|
19
|
+
data: {},
|
|
20
|
+
form: null,
|
|
21
|
+
error: null,
|
|
22
|
+
params: {},
|
|
23
|
+
route: { id: null },
|
|
24
|
+
state: {},
|
|
25
|
+
status: -1,
|
|
26
|
+
url: new URL('https://example.com')
|
|
27
|
+
};
|
|
28
|
+
navigating = { current: null };
|
|
29
|
+
updated = { current: false };
|
|
30
|
+
} else {
|
|
31
|
+
page = new (class Page {
|
|
32
|
+
data = $state.raw({});
|
|
33
|
+
form = $state.raw(null);
|
|
34
|
+
error = $state.raw(null);
|
|
35
|
+
params = $state.raw({});
|
|
36
|
+
route = $state.raw({ id: null });
|
|
37
|
+
state = $state.raw({});
|
|
38
|
+
status = $state.raw(-1);
|
|
39
|
+
url = $state.raw(new URL('https://example.com'));
|
|
40
|
+
})();
|
|
41
|
+
|
|
42
|
+
navigating = new (class Navigating {
|
|
43
|
+
current = $state.raw(null);
|
|
44
|
+
})();
|
|
45
|
+
|
|
46
|
+
updated = new (class Updated {
|
|
47
|
+
current = $state.raw(false);
|
|
48
|
+
})();
|
|
49
|
+
updated_listener.v = () => (updated.current = true);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {import('@sveltejs/kit').Page} new_page
|
|
54
|
+
*/
|
|
55
|
+
export function update(new_page) {
|
|
56
|
+
Object.assign(page, new_page);
|
|
57
|
+
}
|
|
@@ -234,6 +234,10 @@ export function notifiable_store(value) {
|
|
|
234
234
|
return { notify, set, subscribe };
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
export const updated_listener = {
|
|
238
|
+
v: () => {}
|
|
239
|
+
};
|
|
240
|
+
|
|
237
241
|
export function create_updated_store() {
|
|
238
242
|
const { set, subscribe } = writable(false);
|
|
239
243
|
|
|
@@ -273,6 +277,7 @@ export function create_updated_store() {
|
|
|
273
277
|
|
|
274
278
|
if (updated) {
|
|
275
279
|
set(true);
|
|
280
|
+
updated_listener.v();
|
|
276
281
|
clearTimeout(timeout);
|
|
277
282
|
}
|
|
278
283
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as devalue from 'devalue';
|
|
2
|
+
import { DEV } from 'esm-env';
|
|
2
3
|
import { json } from '../../../exports/index.js';
|
|
3
4
|
import { get_status, normalize_error } from '../../../utils/error.js';
|
|
4
5
|
import { is_form_content_type, negotiate } from '../../../utils/http.js';
|
|
@@ -27,8 +28,9 @@ export async function handle_action_json_request(event, options, server) {
|
|
|
27
28
|
const no_actions_error = new SvelteKitError(
|
|
28
29
|
405,
|
|
29
30
|
'Method Not Allowed',
|
|
30
|
-
|
|
31
|
+
`POST method not allowed. No form actions exist for ${DEV ? `the page at ${event.route.id}` : 'this page'}`
|
|
31
32
|
);
|
|
33
|
+
|
|
32
34
|
return action_json(
|
|
33
35
|
{
|
|
34
36
|
type: 'error',
|
|
@@ -153,7 +155,7 @@ export async function handle_action_request(event, server) {
|
|
|
153
155
|
error: new SvelteKitError(
|
|
154
156
|
405,
|
|
155
157
|
'Method Not Allowed',
|
|
156
|
-
|
|
158
|
+
`POST method not allowed. No form actions exist for ${DEV ? `the page at ${event.route.id}` : 'this page'}`
|
|
157
159
|
)
|
|
158
160
|
};
|
|
159
161
|
}
|
|
@@ -110,7 +110,7 @@ export async function render_page(event, page, options, manifest, state, resolve
|
|
|
110
110
|
} else if (action_result.data) {
|
|
111
111
|
/// case: lost data
|
|
112
112
|
console.warn(
|
|
113
|
-
"The form action returned a value, but it isn't available in
|
|
113
|
+
"The form action returned a value, but it isn't available in `page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance"
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -149,6 +149,17 @@ export async function render_response({
|
|
|
149
149
|
// portable as possible, but reset afterwards
|
|
150
150
|
if (paths.relative) paths.override({ base, assets });
|
|
151
151
|
|
|
152
|
+
const render_opts = {
|
|
153
|
+
context: new Map([
|
|
154
|
+
[
|
|
155
|
+
'__request__',
|
|
156
|
+
{
|
|
157
|
+
page: props.page
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
])
|
|
161
|
+
};
|
|
162
|
+
|
|
152
163
|
if (__SVELTEKIT_DEV__) {
|
|
153
164
|
const fetch = globalThis.fetch;
|
|
154
165
|
let warned = false;
|
|
@@ -168,14 +179,14 @@ export async function render_response({
|
|
|
168
179
|
};
|
|
169
180
|
|
|
170
181
|
try {
|
|
171
|
-
rendered = options.root.render(props);
|
|
182
|
+
rendered = options.root.render(props, render_opts);
|
|
172
183
|
} finally {
|
|
173
184
|
globalThis.fetch = fetch;
|
|
174
185
|
paths.reset();
|
|
175
186
|
}
|
|
176
187
|
} else {
|
|
177
188
|
try {
|
|
178
|
-
rendered = options.root.render(props);
|
|
189
|
+
rendered = options.root.render(props, render_opts);
|
|
179
190
|
} finally {
|
|
180
191
|
paths.reset();
|
|
181
192
|
}
|
package/src/types/ambient.d.ts
CHANGED
|
@@ -34,14 +34,14 @@ declare namespace App {
|
|
|
34
34
|
export interface Locals {}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Defines the common shape of the [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages.
|
|
37
|
+
* Defines the common shape of the [page.data state](https://svelte.dev/docs/kit/$app-state#page) and [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages.
|
|
38
38
|
* The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly.
|
|
39
39
|
* Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`).
|
|
40
40
|
*/
|
|
41
41
|
export interface PageData {}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* The shape of the
|
|
44
|
+
* The shape of the `page.state` object, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`.
|
|
45
45
|
*/
|
|
46
46
|
export interface PageState {}
|
|
47
47
|
|
package/src/types/internal.d.ts
CHANGED
|
@@ -306,7 +306,10 @@ export interface ServerMetadata {
|
|
|
306
306
|
|
|
307
307
|
export interface SSRComponent {
|
|
308
308
|
default: {
|
|
309
|
-
render(
|
|
309
|
+
render(
|
|
310
|
+
props: Record<string, any>,
|
|
311
|
+
opts: { context: Map<any, any> }
|
|
312
|
+
): {
|
|
310
313
|
html: string;
|
|
311
314
|
head: string;
|
|
312
315
|
css: {
|
package/src/utils/url.js
CHANGED
|
@@ -168,7 +168,7 @@ function disable_hash(url) {
|
|
|
168
168
|
Object.defineProperty(url, 'hash', {
|
|
169
169
|
get() {
|
|
170
170
|
throw new Error(
|
|
171
|
-
'Cannot access event.url.hash. Consider using
|
|
171
|
+
'Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead'
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
});
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -620,17 +620,17 @@ declare module '@sveltejs/kit' {
|
|
|
620
620
|
* /// file: +layout.svelte
|
|
621
621
|
* <script>
|
|
622
622
|
* import { beforeNavigate } from '$app/navigation';
|
|
623
|
-
* import { updated } from '$app/
|
|
623
|
+
* import { updated } from '$app/state';
|
|
624
624
|
*
|
|
625
625
|
* beforeNavigate(({ willUnload, to }) => {
|
|
626
|
-
* if (
|
|
626
|
+
* if (updated.current && !willUnload && to?.url) {
|
|
627
627
|
* location.href = to.url.href;
|
|
628
628
|
* }
|
|
629
629
|
* });
|
|
630
630
|
* </script>
|
|
631
631
|
* ```
|
|
632
632
|
*
|
|
633
|
-
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of
|
|
633
|
+
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of [`updated.current`](https://svelte.dev/docs/kit/$app-state#updated) `true` when it detects one.
|
|
634
634
|
*/
|
|
635
635
|
version?: {
|
|
636
636
|
/**
|
|
@@ -1722,7 +1722,10 @@ declare module '@sveltejs/kit' {
|
|
|
1722
1722
|
|
|
1723
1723
|
interface SSRComponent {
|
|
1724
1724
|
default: {
|
|
1725
|
-
render(
|
|
1725
|
+
render(
|
|
1726
|
+
props: Record<string, any>,
|
|
1727
|
+
opts: { context: Map<any, any> }
|
|
1728
|
+
): {
|
|
1726
1729
|
html: string;
|
|
1727
1730
|
head: string;
|
|
1728
1731
|
css: {
|
|
@@ -2071,7 +2074,7 @@ declare module '$app/forms' {
|
|
|
2071
2074
|
*
|
|
2072
2075
|
* If this function or its return value isn't set, it
|
|
2073
2076
|
* - falls back to updating the `form` prop with the returned data if the action is on the same page as the form
|
|
2074
|
-
* - updates
|
|
2077
|
+
* - updates `page.status`
|
|
2075
2078
|
* - resets the `<form>` element and invalidates all data in case of successful submission with no redirect response
|
|
2076
2079
|
* - redirects in case of a redirect response
|
|
2077
2080
|
* - redirects to the nearest error page in case of an unexpected error
|
|
@@ -2084,7 +2087,7 @@ declare module '$app/forms' {
|
|
|
2084
2087
|
destroy(): void;
|
|
2085
2088
|
};
|
|
2086
2089
|
/**
|
|
2087
|
-
* This action updates the `form` property of the current page with the given data and updates
|
|
2090
|
+
* This action updates the `form` property of the current page with the given data and updates `page.status`.
|
|
2088
2091
|
* In case of an error, it redirects to the nearest error page.
|
|
2089
2092
|
* */
|
|
2090
2093
|
export function applyAction<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: import("@sveltejs/kit").ActionResult<Success, Failure>): Promise<void>;
|
|
@@ -2127,7 +2130,9 @@ declare module '$app/navigation' {
|
|
|
2127
2130
|
* */
|
|
2128
2131
|
export function disableScrollHandling(): void;
|
|
2129
2132
|
/**
|
|
2133
|
+
* Allows you to navigate programmatically to a given route, with options such as keeping the current element focused.
|
|
2130
2134
|
* Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`.
|
|
2135
|
+
*
|
|
2131
2136
|
* For external URLs, use `window.location = url` instead of calling `goto(url)`.
|
|
2132
2137
|
*
|
|
2133
2138
|
* @param url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.
|
|
@@ -2193,12 +2198,12 @@ declare module '$app/navigation' {
|
|
|
2193
2198
|
* */
|
|
2194
2199
|
export function preloadCode(pathname: string): Promise<void>;
|
|
2195
2200
|
/**
|
|
2196
|
-
* Programmatically create a new history entry with the given
|
|
2201
|
+
* Programmatically create a new history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
2197
2202
|
*
|
|
2198
2203
|
* */
|
|
2199
2204
|
export function pushState(url: string | URL, state: App.PageState): void;
|
|
2200
2205
|
/**
|
|
2201
|
-
* Programmatically replace the current history entry with the given
|
|
2206
|
+
* Programmatically replace the current history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
2202
2207
|
*
|
|
2203
2208
|
* */
|
|
2204
2209
|
export function replaceState(url: string | URL, state: App.PageState): void;
|
|
@@ -2260,6 +2265,54 @@ declare module '$app/server' {
|
|
|
2260
2265
|
export {};
|
|
2261
2266
|
}
|
|
2262
2267
|
|
|
2268
|
+
declare module '$app/state' {
|
|
2269
|
+
/**
|
|
2270
|
+
* A reactive object with information about the current page, serving several use cases:
|
|
2271
|
+
* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))
|
|
2272
|
+
* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))
|
|
2273
|
+
* - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))
|
|
2274
|
+
* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error
|
|
2275
|
+
*
|
|
2276
|
+
* ```svelte
|
|
2277
|
+
* <!--- file: +layout.svelte --->
|
|
2278
|
+
* <script>
|
|
2279
|
+
* import { page } from '$app/state';
|
|
2280
|
+
* </script>
|
|
2281
|
+
*
|
|
2282
|
+
* <p>Currently at {page.url.pathname}</p>
|
|
2283
|
+
*
|
|
2284
|
+
* {#if page.error}
|
|
2285
|
+
* <span class="red">Problem detected</span>
|
|
2286
|
+
* {:else}
|
|
2287
|
+
* <span class="small">All systems operational</span>
|
|
2288
|
+
* {/if}
|
|
2289
|
+
* ```
|
|
2290
|
+
*
|
|
2291
|
+
* On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.
|
|
2292
|
+
*
|
|
2293
|
+
* */
|
|
2294
|
+
export const page: import("@sveltejs/kit").Page;
|
|
2295
|
+
/**
|
|
2296
|
+
* An object with a reactive `current` property.
|
|
2297
|
+
* When navigation starts, `current` is a `Navigation` object with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.
|
|
2298
|
+
* When navigation finishes, `current` reverts to `null`.
|
|
2299
|
+
*
|
|
2300
|
+
* On the server, this value can only be read during rendering. In the browser, it can be read at any time.
|
|
2301
|
+
* */
|
|
2302
|
+
export const navigating: {
|
|
2303
|
+
get current(): import("@sveltejs/kit").Navigation | null;
|
|
2304
|
+
};
|
|
2305
|
+
/**
|
|
2306
|
+
* A reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
|
|
2307
|
+
* */
|
|
2308
|
+
export const updated: {
|
|
2309
|
+
get current(): boolean;
|
|
2310
|
+
check(): Promise<boolean>;
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
export {};
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2263
2316
|
declare module '$app/stores' {
|
|
2264
2317
|
export function getStores(): {
|
|
2265
2318
|
|
|
@@ -2274,6 +2327,7 @@ declare module '$app/stores' {
|
|
|
2274
2327
|
*
|
|
2275
2328
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
2276
2329
|
*
|
|
2330
|
+
* @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
2277
2331
|
* */
|
|
2278
2332
|
export const page: import("svelte/store").Readable<import("@sveltejs/kit").Page>;
|
|
2279
2333
|
/**
|
|
@@ -2282,12 +2336,16 @@ declare module '$app/stores' {
|
|
|
2282
2336
|
* When navigating finishes, its value reverts to `null`.
|
|
2283
2337
|
*
|
|
2284
2338
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
2339
|
+
*
|
|
2340
|
+
* @deprecated Use `navigating` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
2285
2341
|
* */
|
|
2286
2342
|
export const navigating: import("svelte/store").Readable<import("@sveltejs/kit").Navigation | null>;
|
|
2287
2343
|
/**
|
|
2288
2344
|
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
|
|
2289
2345
|
*
|
|
2290
2346
|
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
2347
|
+
*
|
|
2348
|
+
* @deprecated Use `updated` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
2291
2349
|
* */
|
|
2292
2350
|
export const updated: import("svelte/store").Readable<boolean> & {
|
|
2293
2351
|
check(): Promise<boolean>;
|
|
@@ -2330,14 +2388,14 @@ declare namespace App {
|
|
|
2330
2388
|
export interface Locals {}
|
|
2331
2389
|
|
|
2332
2390
|
/**
|
|
2333
|
-
* Defines the common shape of the [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages.
|
|
2391
|
+
* Defines the common shape of the [page.data state](https://svelte.dev/docs/kit/$app-state#page) and [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages.
|
|
2334
2392
|
* The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly.
|
|
2335
2393
|
* Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`).
|
|
2336
2394
|
*/
|
|
2337
2395
|
export interface PageData {}
|
|
2338
2396
|
|
|
2339
2397
|
/**
|
|
2340
|
-
* The shape of the
|
|
2398
|
+
* The shape of the `page.state` object, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`.
|
|
2341
2399
|
*/
|
|
2342
2400
|
export interface PageState {}
|
|
2343
2401
|
|
package/types/index.d.ts.map
CHANGED
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
"assets",
|
|
117
117
|
"resolveRoute",
|
|
118
118
|
"read",
|
|
119
|
-
"getStores",
|
|
120
119
|
"page",
|
|
121
120
|
"navigating",
|
|
122
|
-
"updated"
|
|
121
|
+
"updated",
|
|
122
|
+
"getStores"
|
|
123
123
|
],
|
|
124
124
|
"sources": [
|
|
125
125
|
"../src/exports/public.d.ts",
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"../src/runtime/client/client.js",
|
|
138
138
|
"../src/runtime/app/paths/types.d.ts",
|
|
139
139
|
"../src/runtime/app/server/index.js",
|
|
140
|
+
"../src/runtime/app/state/client.js",
|
|
140
141
|
"../src/runtime/app/stores.js"
|
|
141
142
|
],
|
|
142
143
|
"sourcesContent": [
|
|
@@ -155,8 +156,9 @@
|
|
|
155
156
|
null,
|
|
156
157
|
null,
|
|
157
158
|
null,
|
|
159
|
+
null,
|
|
158
160
|
null
|
|
159
161
|
],
|
|
160
|
-
"mappings": ";;;;;;;;;kBA2BiBA,OAAOA;;;;;;;;;;;;;;;;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