@real-router/svelte 0.24.1 → 0.24.2
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.
|
@@ -174,6 +174,11 @@ export function anchorTargetsAnotherContext(element) {
|
|
|
174
174
|
function encodeFragmentInline(decoded) {
|
|
175
175
|
return encodeURI(decoded).replaceAll("#", "%23");
|
|
176
176
|
}
|
|
177
|
+
// A router path whose leading `/` is followed by `/` or `\` names a host, and
|
|
178
|
+
// `/.` keeps it a path on the page's origin. A copy of `HOST_PREFIX` in
|
|
179
|
+
// `shared/browser-env/url-utils.ts`: the dom-utils symlink graph does not reach
|
|
180
|
+
// browser-env.
|
|
181
|
+
const HOST_PREFIX = /^\/[\t\n\r]*[/\\]/;
|
|
177
182
|
/**
|
|
178
183
|
* Builds an href for a `<Link>` element.
|
|
179
184
|
*
|
|
@@ -286,7 +291,8 @@ export function buildHref(router, routeName, routeParams, routeSearch, hash) {
|
|
|
286
291
|
console.error(`[real-router] Route "${routeName}" yielded an empty path. The element will render without an href attribute.`);
|
|
287
292
|
return undefined;
|
|
288
293
|
}
|
|
289
|
-
|
|
294
|
+
const href = HOST_PREFIX.test(path) ? `/.${path}` : path;
|
|
295
|
+
return normHash ? `${href}#${encodeFragmentInline(normHash)}` : href;
|
|
290
296
|
}
|
|
291
297
|
catch {
|
|
292
298
|
console.error(`[real-router] Route "${routeName}" is not defined. The element will render without an href attribute.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/svelte",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Svelte 5 integration for Real-Router",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@real-router/sources": "^0.15.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@real-router/browser-plugin": "^0.26.
|
|
58
|
-
"@real-router/core": "^0.148.
|
|
57
|
+
"@real-router/browser-plugin": "^0.26.2",
|
|
58
|
+
"@real-router/core": "^0.148.1",
|
|
59
59
|
"@sveltejs/package": "2.5.8",
|
|
60
60
|
"@sveltejs/vite-plugin-svelte": "7.3.1",
|
|
61
61
|
"@testing-library/jest-dom": "~7.0.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"svelte-check": "4.7.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@real-router/core": ">=0.148.
|
|
69
|
+
"@real-router/core": ">=0.148.1",
|
|
70
70
|
"svelte": ">=5.7.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|