@real-router/vue 0.15.0 → 0.15.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.
- package/dist/cjs/{createHttpStatusSink-XDu5aGhc.d.ts → createHttpStatusSink-BENH-5-J.d.ts} +1 -1
- package/dist/cjs/{createHttpStatusSink-XDu5aGhc.d.ts.map → createHttpStatusSink-BENH-5-J.d.ts.map} +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/ssr.d.ts +1 -1
- package/dist/cjs/ssr.d.ts.map +1 -1
- package/dist/cjs/ssr.js +1 -1
- package/dist/cjs/ssr.js.map +1 -1
- package/dist/cjs/useRoute-Dba_kop6.js +2 -0
- package/dist/cjs/{useRoute-BT3SkdOc.js.map → useRoute-Dba_kop6.js.map} +1 -1
- package/dist/esm/{createHttpStatusSink-DduXvbGr.d.mts → createHttpStatusSink-BENH-5-J.d.mts} +1 -1
- package/dist/esm/{createHttpStatusSink-DduXvbGr.d.mts.map → createHttpStatusSink-BENH-5-J.d.mts.map} +1 -1
- package/dist/esm/index.d.mts.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/ssr.d.mts +1 -1
- package/dist/esm/ssr.d.mts.map +1 -1
- package/dist/esm/ssr.mjs +1 -1
- package/dist/esm/{useRoute-2ocUdDHc.mjs → useRoute-BBfRYSpV.mjs} +1 -1
- package/dist/esm/{useRoute-2ocUdDHc.mjs.map → useRoute-BBfRYSpV.mjs.map} +1 -1
- package/package.json +7 -7
- package/src/components/RouteView/helpers.ts +9 -6
- package/dist/cjs/useRoute-BT3SkdOc.js +0 -2
package/dist/esm/ssr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createHttpStatusSink, t as HttpStatusSink } from "./createHttpStatusSink-
|
|
1
|
+
import { n as createHttpStatusSink, t as HttpStatusSink } from "./createHttpStatusSink-BENH-5-J.mjs";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ClientOnly.d.ts
|
package/dist/esm/ssr.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.d.mts","names":[],"sources":["../../src/components/ClientOnly.ts","../../src/components/ServerOnly.ts","../../src/components/Await.ts","../../src/components/Streamed.ts","../../src/components/HttpStatusCode.ts","../../src/components/HttpStatusProvider.ts","../../src/composables/useDeferred.ts"],"mappings":";;;;cAEa,UAAA,gBAAU,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;+IAWrB,QAAA,OAAA,QAAA;KAEU,eAAA,GAAkB,YAAY,QAAQ,UAAA;;;cCbrC,UAAA,gBAAU,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;+IAWrB,QAAA,OAAA,QAAA;KAEU,eAAA,GAAkB,YAAY,QAAQ,UAAA;;;;;;;ADblD;;;;;;;;;;;;;;;;;AAaA;;;;AAA4D;;;;cEkB/C,KAAA,gBAAK,eAAA,eAAA,gBAAA;EDpBhB;;;;;;;;;;;;KCiCU,UAAA,GAAa,YAAY,QAAQ,KAAA;;;;;;;AF5C7C;;;;;;;;;cGaa,QAAA,gBAAQ,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;iIAanB,QAAA,OAAA,QAAA;KAEU,aAAA,GAAgB,YAAY,QAAQ,QAAA;;;;;;;AH5BhD;;;;;;;;;;;;;;;;;AAaA;;;;AAA4D;;;;ACb5D;;;;;;;;;;;;;;;;;AAaA;cGyCa,cAAA,gBAAc,eAAA,eAAA,gBAAA;;;;;0CAjDA,qBAAA,gBAAA,qBAAA,4BAAA,WAAA,EAAA,QAAA,eAAA,gBAAA;EF0Bd;;;;;KEwCD,mBAAA,GAAsB,YAAY,QAAQ,cAAA;;;cClEzC,kBAAA,gBAAkB,eAAA,eAAA,gBAAA;;UAGH,QAAA,CAAS,cAAA;;;;;;;UAAT,QAAA,CAAS,cAAA;;;;KASzB,uBAAA,GAA0B,YAAY,QACzC,kBAAA;;;;;;;ALlBT;;;;;;;;;;;;;;;iBM4BgB,WAAA,
|
|
1
|
+
{"version":3,"file":"ssr.d.mts","names":[],"sources":["../../src/components/ClientOnly.ts","../../src/components/ServerOnly.ts","../../src/components/Await.ts","../../src/components/Streamed.ts","../../src/components/HttpStatusCode.ts","../../src/components/HttpStatusProvider.ts","../../src/composables/useDeferred.ts"],"mappings":";;;;cAEa,UAAA,gBAAU,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;+IAWrB,QAAA,OAAA,QAAA;KAEU,eAAA,GAAkB,YAAY,QAAQ,UAAA;;;cCbrC,UAAA,gBAAU,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;+IAWrB,QAAA,OAAA,QAAA;KAEU,eAAA,GAAkB,YAAY,QAAQ,UAAA;;;;;;;ADblD;;;;;;;;;;;;;;;;;AAaA;;;;AAA4D;;;;cEkB/C,KAAA,gBAAK,eAAA,eAAA,gBAAA;EDpBhB;;;;;;;;;;;;KCiCU,UAAA,GAAa,YAAY,QAAQ,KAAA;;;;;;;AF5C7C;;;;;;;;;cGaa,QAAA,gBAAQ,eAAA,yBAAA,KAAA,eAAA,YAAA,gBAAA,eAAA;EAAA;iIAanB,QAAA,OAAA,QAAA;KAEU,aAAA,GAAgB,YAAY,QAAQ,QAAA;;;;;;;AH5BhD;;;;;;;;;;;;;;;;;AAaA;;;;AAA4D;;;;ACb5D;;;;;;;;;;;;;;;;;AAaA;cGyCa,cAAA,gBAAc,eAAA,eAAA,gBAAA;;;;;0CAjDA,qBAAA,gBAAA,qBAAA,4BAAA,WAAA,EAAA,QAAA,eAAA,gBAAA;EF0Bd;;;;;KEwCD,mBAAA,GAAsB,YAAY,QAAQ,cAAA;;;cClEzC,kBAAA,gBAAkB,eAAA,eAAA,gBAAA;;UAGH,QAAA,CAAS,cAAA;;;;;;;UAAT,QAAA,CAAS,cAAA;;;;KASzB,uBAAA,GAA0B,YAAY,QACzC,kBAAA;;;;;;;ALlBT;;;;;;;;;;;;;;;iBM4BgB,WAAA,cAAyB,GAAA,WAAc,OAAO,CAAC,CAAA"}
|
package/dist/esm/ssr.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./useRoute-
|
|
1
|
+
import{n as e,t}from"./useRoute-BBfRYSpV.mjs";import{Suspense as n,defineComponent as r,h as i,inject as a,onMounted as o,provide as s,ref as c}from"vue";const l=r({name:`ClientOnly`,setup(e,{slots:t}){let n=c(!1);return o(()=>{n.value=!0}),()=>n.value?t.default?.():t.fallback?.()}}),u=r({name:`ServerOnly`,setup(e,{slots:t}){let n=c(!1);return o(()=>{n.value=!0}),()=>n.value?t.fallback?.():t.default?.()}}),d=new Promise(()=>{});function f(e){let{route:n}=t();return n.value.context.ssrDataDeferred?.[e]??d}const p=r({name:`Await`,props:{name:{type:String,required:!0}},async setup(e,{slots:t}){let n=await f(e.name);return()=>t.default?.({value:n})}}),m=r({name:`Streamed`,setup(e,{slots:t}){return()=>i(n,{},{default:()=>t.default?.(),fallback:()=>t.fallback?.()})}}),h=()=>null,g=r({name:`HttpStatusCode`,props:{code:{type:Number,required:!0}},setup(t){let n=a(e,null);return n&&(n.code=t.code),h}}),_=r({name:`HttpStatusProvider`,props:{sink:{type:Object,required:!0}},setup(t,{slots:n}){return s(e,t.sink),()=>n.default?.()}});function v(){return{code:void 0}}export{p as Await,l as ClientOnly,g as HttpStatusCode,_ as HttpStatusProvider,u as ServerOnly,m as Streamed,v as createHttpStatusSink,f as useDeferred};
|
|
2
2
|
//# sourceMappingURL=ssr.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{inject as e}from"vue";const t=Symbol(`RouterKey`),n=Symbol(`NavigatorKey`),r=Symbol(`RouteKey`),i=Symbol(`HttpStatusSink`),a=()=>{let t=e(r);if(!t)throw Error(`useRoute must be used within a RouterProvider`);if(!t.route.value)throw Error(`useRoute called with no active route. Did you forget to await router.start() before rendering, or is the router stopped/disposed?`);return t};export{t as a,r as i,i as n,n as r,a as t};
|
|
2
|
-
//# sourceMappingURL=useRoute-
|
|
2
|
+
//# sourceMappingURL=useRoute-BBfRYSpV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRoute-
|
|
1
|
+
{"version":3,"file":"useRoute-BBfRYSpV.mjs","names":[],"sources":["../../src/context.ts","../../src/composables/useRoute.ts"],"sourcesContent":["import type { RouteContext as RouteContextType } from \"./types\";\nimport type { HttpStatusSink } from \"./utils/createHttpStatusSink\";\nimport type { Router, Navigator } from \"@real-router/core\";\nimport type { InjectionKey } from \"vue\";\n\nexport const RouterKey: InjectionKey<Router> = Symbol(\"RouterKey\");\n\nexport const NavigatorKey: InjectionKey<Navigator> = Symbol(\"NavigatorKey\");\n\nexport const RouteKey: InjectionKey<RouteContextType> = Symbol(\"RouteKey\");\n\nexport const HTTP_STATUS_KEY: InjectionKey<HttpStatusSink> =\n Symbol(\"HttpStatusSink\");\n","import { inject } from \"vue\";\n\nimport { RouteKey } from \"../context\";\n\nimport type { RouteContext } from \"../types\";\nimport type { Params, State } from \"@real-router/core\";\nimport type { Ref } from \"vue\";\n\n/**\n * Return shape for `useRoute()` — `RouteContext<P>` with `route` narrowed\n * to the non-nullable variant. The composable throws when `route.value`\n * would be `undefined`, so consumers can read `.value.params.x` without a\n * nullable guard. Extracted from inline duplication at two call sites.\n */\nexport type UseRouteReturn<P extends Params = Params> = Omit<\n RouteContext<P>,\n \"route\"\n> & { route: Readonly<Ref<State<P>>> };\n\nexport const useRoute = <P extends Params = Params>(): UseRouteReturn<P> => {\n const routeContext = inject(RouteKey);\n\n if (!routeContext) {\n throw new Error(\"useRoute must be used within a RouterProvider\");\n }\n\n if (!routeContext.route.value) {\n throw new Error(\n \"useRoute called with no active route. Did you forget to await router.start() before rendering, or is the router stopped/disposed?\",\n );\n }\n\n return routeContext as UseRouteReturn<P>;\n};\n"],"mappings":"6BAKA,MAAa,EAAkC,OAAO,WAAW,EAEpD,EAAwC,OAAO,cAAc,EAE7D,EAA2C,OAAO,UAAU,EAE5D,EACX,OAAO,gBAAgB,ECOZ,MAA+D,CAC1E,IAAM,EAAe,EAAO,CAAQ,EAEpC,GAAI,CAAC,EACH,MAAU,MAAM,+CAA+C,EAGjE,GAAI,CAAC,EAAa,MAAM,MACtB,MAAU,MACR,mIACF,EAGF,OAAO,CACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/vue",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Vue 3 integration for Real-Router",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@real-router/core": "^0.
|
|
70
|
-
"@real-router/
|
|
71
|
-
"@real-router/
|
|
69
|
+
"@real-router/core": "^0.56.0",
|
|
70
|
+
"@real-router/sources": "^0.8.5",
|
|
71
|
+
"@real-router/route-utils": "^0.2.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@testing-library/jest-dom": "6.9.1",
|
|
75
|
-
"@vue/test-utils": "2.4.
|
|
76
|
-
"vue": "3.5.
|
|
77
|
-
"@real-router/browser-plugin": "^0.17.
|
|
75
|
+
"@vue/test-utils": "2.4.11",
|
|
76
|
+
"vue": "3.5.35",
|
|
77
|
+
"@real-router/browser-plugin": "^0.17.6"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"vue": ">=3.3.0"
|
|
@@ -6,6 +6,13 @@ import { Match, NotFound, Self } from "./components";
|
|
|
6
6
|
|
|
7
7
|
import type { VNode } from "vue";
|
|
8
8
|
|
|
9
|
+
const MARKER_TYPES: ReadonlySet<unknown> = new Set([Match, Self, NotFound]);
|
|
10
|
+
const KEEP_ALIVE_VALUES: ReadonlySet<unknown> = new Set([
|
|
11
|
+
true,
|
|
12
|
+
"",
|
|
13
|
+
"keep-alive",
|
|
14
|
+
]);
|
|
15
|
+
|
|
9
16
|
type FallbackType = VNode | (() => VNode) | undefined;
|
|
10
17
|
|
|
11
18
|
interface FallbackSlots {
|
|
@@ -34,7 +41,7 @@ export function isSegmentMatch(
|
|
|
34
41
|
// the hyphenated attribute name) reaches us here. Accept the same trio Vue's
|
|
35
42
|
// runtime does.
|
|
36
43
|
export function isKeepAliveEnabled(value: unknown): boolean {
|
|
37
|
-
return value
|
|
44
|
+
return KEEP_ALIVE_VALUES.has(value);
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
function normalizeChildren(children: unknown): VNode[] {
|
|
@@ -63,11 +70,7 @@ export function collectElements(children: unknown, result: VNode[]): void {
|
|
|
63
70
|
const vnodes = normalizeChildren(children);
|
|
64
71
|
|
|
65
72
|
for (const child of vnodes) {
|
|
66
|
-
if (
|
|
67
|
-
child.type === Match ||
|
|
68
|
-
child.type === Self ||
|
|
69
|
-
child.type === NotFound
|
|
70
|
-
) {
|
|
73
|
+
if (MARKER_TYPES.has(child.type)) {
|
|
71
74
|
result.push(child);
|
|
72
75
|
} else if (child.type === Fragment) {
|
|
73
76
|
collectElements(child.children, result);
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
let e=require(`vue`);const t=Symbol(`RouterKey`),n=Symbol(`NavigatorKey`),r=Symbol(`RouteKey`),i=Symbol(`HttpStatusSink`),a=()=>{let t=(0,e.inject)(r);if(!t)throw Error(`useRoute must be used within a RouterProvider`);if(!t.route.value)throw Error(`useRoute called with no active route. Did you forget to await router.start() before rendering, or is the router stopped/disposed?`);return t};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
2
|
-
//# sourceMappingURL=useRoute-BT3SkdOc.js.map
|