@real-router/svelte 0.24.0 → 0.24.1
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 +1 -1
- package/dist/dom-utils/direction-tracker.js +24 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -317,7 +317,7 @@ Paired SSR-aware boundaries. `<ClientOnly>` renders the `fallback` snippet on th
|
|
|
317
317
|
|
|
318
318
|
```svelte
|
|
319
319
|
<script lang="ts">
|
|
320
|
-
import { ClientOnly, ServerOnly } from "@real-router/svelte";
|
|
320
|
+
import { ClientOnly, ServerOnly } from "@real-router/svelte/ssr";
|
|
321
321
|
</script>
|
|
322
322
|
|
|
323
323
|
<ClientOnly>
|
|
@@ -48,7 +48,31 @@ export function createDirectionTracker(router) {
|
|
|
48
48
|
// in-flight transition and replays it from that transition's `finally`. The
|
|
49
49
|
// gap has no upper bound. Measured on the obvious choice: a task-boundary
|
|
50
50
|
// expiry disarms a live navigation on ONE async `canDeactivate`.
|
|
51
|
+
// ⚑ A traversal onto the URL of the router's own state starts no
|
|
52
|
+
// transition: a URL plugin's return after a refused Back or Forward
|
|
53
|
+
// (#2740), or a Back onto an entry holding that state. The URL comes from
|
|
54
|
+
// the URL plugin's `buildUrl`; without one, every popstate arms the flag.
|
|
55
|
+
const landsOnRouterState = () => {
|
|
56
|
+
const state = router.getState();
|
|
57
|
+
const buildUrl = router.buildUrl;
|
|
58
|
+
if (state === undefined || buildUrl === undefined) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const hash = state.context
|
|
63
|
+
?.url?.hash;
|
|
64
|
+
const url = buildUrl(state.name, state.params, state.search, hash ? { hash } : undefined);
|
|
65
|
+
return (url !== undefined &&
|
|
66
|
+
new URL(url, globalThis.location.href).href === globalThis.location.href);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
51
72
|
const onPopstate = () => {
|
|
73
|
+
if (landsOnRouterState()) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
52
76
|
popstateFlag = true;
|
|
53
77
|
// A deferred event belongs to the replay, not to the transition running
|
|
54
78
|
// now, so that transition's terminal event must not spend it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/svelte",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Svelte 5 integration for Real-Router",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@real-router/sources": "^0.15.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@real-router/browser-plugin": "^0.
|
|
57
|
+
"@real-router/browser-plugin": "^0.26.0",
|
|
58
58
|
"@real-router/core": "^0.148.0",
|
|
59
59
|
"@sveltejs/package": "2.5.8",
|
|
60
|
-
"@sveltejs/vite-plugin-svelte": "7.3.
|
|
60
|
+
"@sveltejs/vite-plugin-svelte": "7.3.1",
|
|
61
61
|
"@testing-library/jest-dom": "~7.0.1",
|
|
62
62
|
"@testing-library/svelte": "~5.4.2",
|
|
63
63
|
"@testing-library/user-event": "~14.6.1",
|