@tanstack/vue-router 1.167.1 → 1.167.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/esm/Asset.js +107 -151
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/Body.js +15 -24
- package/dist/esm/Body.js.map +1 -1
- package/dist/esm/CatchBoundary.js +112 -130
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/ClientOnly.js +59 -29
- package/dist/esm/ClientOnly.js.map +1 -1
- package/dist/esm/HeadContent.dev.js +29 -23
- package/dist/esm/HeadContent.dev.js.map +1 -1
- package/dist/esm/HeadContent.js +21 -16
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Html.js +42 -61
- package/dist/esm/Html.js.map +1 -1
- package/dist/esm/Match.js +238 -319
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.js +127 -170
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +50 -65
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/ScriptOnce.js +31 -36
- package/dist/esm/ScriptOnce.js.map +1 -1
- package/dist/esm/Scripts.js +79 -101
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/ScrollRestoration.js +25 -29
- package/dist/esm/ScrollRestoration.js.map +1 -1
- package/dist/esm/Transitioner.js +146 -164
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/esm/awaited.js +27 -34
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/fileRoute.js +90 -92
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/headContentUtils.js +92 -123
- package/dist/esm/headContentUtils.js.map +1 -1
- package/dist/esm/index.dev.js +16 -118
- package/dist/esm/index.js +18 -119
- package/dist/esm/lazyRouteComponent.js +69 -82
- package/dist/esm/lazyRouteComponent.js.map +1 -1
- package/dist/esm/link.js +364 -385
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/matchContext.js +16 -11
- package/dist/esm/matchContext.js.map +1 -1
- package/dist/esm/not-found.js +30 -40
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/renderRouteNotFound.js +20 -15
- package/dist/esm/renderRouteNotFound.js.map +1 -1
- package/dist/esm/route.js +196 -174
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +11 -11
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/routerContext.js +10 -7
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/scroll-restoration.js +39 -50
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/ssr/RouterClient.js +29 -43
- package/dist/esm/ssr/RouterClient.js.map +1 -1
- package/dist/esm/ssr/RouterServer.js +29 -32
- package/dist/esm/ssr/RouterServer.js.map +1 -1
- package/dist/esm/ssr/client.js +1 -4
- package/dist/esm/ssr/defaultRenderHandler.js +11 -13
- package/dist/esm/ssr/defaultRenderHandler.js.map +1 -1
- package/dist/esm/ssr/defaultStreamHandler.js +12 -15
- package/dist/esm/ssr/defaultStreamHandler.js.map +1 -1
- package/dist/esm/ssr/renderRouterToStream.js +47 -65
- package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
- package/dist/esm/ssr/renderRouterToString.js +24 -32
- package/dist/esm/ssr/renderRouterToString.js.map +1 -1
- package/dist/esm/ssr/server.js +3 -10
- package/dist/esm/useBlocker.js +243 -287
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useCanGoBack.js +6 -5
- package/dist/esm/useCanGoBack.js.map +1 -1
- package/dist/esm/useLoaderData.js +12 -11
- package/dist/esm/useLoaderData.js.map +1 -1
- package/dist/esm/useLoaderDeps.js +12 -14
- package/dist/esm/useLoaderDeps.js.map +1 -1
- package/dist/esm/useLocation.js +6 -7
- package/dist/esm/useLocation.js.map +1 -1
- package/dist/esm/useMatch.js +27 -35
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useNavigate.js +18 -24
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.js +13 -12
- package/dist/esm/useParams.js.map +1 -1
- package/dist/esm/useRouteContext.js +9 -8
- package/dist/esm/useRouteContext.js.map +1 -1
- package/dist/esm/useRouter.js +9 -8
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/useRouterState.js +18 -22
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/esm/useSearch.js +13 -12
- package/dist/esm/useSearch.js.map +1 -1
- package/dist/esm/utils.js +59 -38
- package/dist/esm/utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/esm/index.dev.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ssr/client.js.map +0 -1
- package/dist/esm/ssr/server.js.map +0 -1
|
@@ -1,68 +1,53 @@
|
|
|
1
|
-
import * as Vue from "vue";
|
|
2
|
-
import { Matches } from "./Matches.js";
|
|
3
1
|
import { provideRouter } from "./routerContext.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return childContent[0];
|
|
36
|
-
}
|
|
37
|
-
return childContent;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
2
|
+
import { Matches } from "./Matches.js";
|
|
3
|
+
import * as Vue from "vue";
|
|
4
|
+
//#region src/RouterProvider.tsx
|
|
5
|
+
var RouterContextProvider = Vue.defineComponent({
|
|
6
|
+
name: "RouterContextProvider",
|
|
7
|
+
props: { router: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: true
|
|
10
|
+
} },
|
|
11
|
+
setup(props, { attrs, slots }) {
|
|
12
|
+
const router = props.router;
|
|
13
|
+
const restAttrs = attrs;
|
|
14
|
+
router.update({
|
|
15
|
+
...router.options,
|
|
16
|
+
...restAttrs,
|
|
17
|
+
context: {
|
|
18
|
+
...router.options.context,
|
|
19
|
+
...restAttrs.context || {}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
provideRouter(router);
|
|
23
|
+
return () => {
|
|
24
|
+
const childContent = slots.default?.();
|
|
25
|
+
if (router.options.Wrap) {
|
|
26
|
+
const WrapComponent = router.options.Wrap;
|
|
27
|
+
return Vue.h(WrapComponent, null, () => childContent);
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(childContent) && childContent.length === 1) return childContent[0];
|
|
30
|
+
return childContent;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
40
33
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
router: props.router,
|
|
57
|
-
...restAttrs
|
|
58
|
-
}, {
|
|
59
|
-
default: () => Vue.h(Matches)
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
34
|
+
var RouterProvider = Vue.defineComponent({
|
|
35
|
+
name: "RouterProvider",
|
|
36
|
+
props: { router: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: true
|
|
39
|
+
} },
|
|
40
|
+
setup(props, { attrs }) {
|
|
41
|
+
const restAttrs = attrs;
|
|
42
|
+
return () => {
|
|
43
|
+
return Vue.h(RouterContextProvider, {
|
|
44
|
+
router: props.router,
|
|
45
|
+
...restAttrs
|
|
46
|
+
}, { default: () => Vue.h(Matches) });
|
|
47
|
+
};
|
|
48
|
+
}
|
|
63
49
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//# sourceMappingURL=RouterProvider.js.map
|
|
50
|
+
//#endregion
|
|
51
|
+
export { RouterContextProvider, RouterProvider };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=RouterProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { Matches } from './Matches'\nimport { provideRouter } from './routerContext'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\n// Component that provides router context and renders children\nexport const RouterContextProvider = Vue.defineComponent({\n name: 'RouterContextProvider',\n props: {\n router: {\n type: Object,\n required: true,\n },\n // Rest of router options will be passed as attrs\n },\n setup(props, { attrs, slots }) {\n const router = props.router as AnyRouter\n const restAttrs = attrs\n\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...restAttrs,\n context: {\n ...router.options.context,\n ...((restAttrs.context as Record<string, any>) || {}),\n },\n } as any)\n\n // Provide router to all child components\n provideRouter(router)\n\n return () => {\n // Get child content\n const childContent = slots.default?.()\n\n // If a Wrap component is specified in router options, use it\n if (router.options.Wrap) {\n const WrapComponent = router.options.Wrap\n return Vue.h(WrapComponent, null, () => childContent)\n }\n\n // Unwrap single-element arrays to avoid implicit Fragment\n // that would cause hydration mismatch\n if (Array.isArray(childContent) && childContent.length === 1) {\n return childContent[0]\n }\n\n // Otherwise just return the child content\n return childContent\n }\n },\n})\n\n// The main router provider component that includes matches\nexport const RouterProvider = Vue.defineComponent({\n name: 'RouterProvider',\n props: {\n router: {\n type: Object,\n required: true,\n },\n // Rest of router options will be passed as attrs\n },\n setup(props, { attrs }) {\n const restAttrs = attrs\n\n return () => {\n return Vue.h(\n RouterContextProvider,\n {\n router: props.router,\n ...restAttrs,\n },\n {\n default: () => Vue.h(Matches),\n },\n )\n }\n },\n}) as unknown as {\n <TRouter extends AnyRouter = RegisteredRouter>(\n props: {\n router: TRouter\n routeTree?: TRouter['routeTree']\n } & Record<string, any>,\n ): Vue.VNode\n new (): {\n $props: {\n router: AnyRouter\n routeTree?: AnyRouter['routeTree']\n }\n }\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"
|
|
1
|
+
{"version":3,"file":"RouterProvider.js","names":["Vue","Matches","provideRouter","RouterContextProvider","defineComponent","name","props","router","type","Object","required","setup","attrs","slots","restAttrs","update","options","context","childContent","default","Wrap","WrapComponent","h","Array","isArray","length","RouterProvider"],"sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { Matches } from './Matches'\nimport { provideRouter } from './routerContext'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\n// Component that provides router context and renders children\nexport const RouterContextProvider = Vue.defineComponent({\n name: 'RouterContextProvider',\n props: {\n router: {\n type: Object,\n required: true,\n },\n // Rest of router options will be passed as attrs\n },\n setup(props, { attrs, slots }) {\n const router = props.router as AnyRouter\n const restAttrs = attrs\n\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...restAttrs,\n context: {\n ...router.options.context,\n ...((restAttrs.context as Record<string, any>) || {}),\n },\n } as any)\n\n // Provide router to all child components\n provideRouter(router)\n\n return () => {\n // Get child content\n const childContent = slots.default?.()\n\n // If a Wrap component is specified in router options, use it\n if (router.options.Wrap) {\n const WrapComponent = router.options.Wrap\n return Vue.h(WrapComponent, null, () => childContent)\n }\n\n // Unwrap single-element arrays to avoid implicit Fragment\n // that would cause hydration mismatch\n if (Array.isArray(childContent) && childContent.length === 1) {\n return childContent[0]\n }\n\n // Otherwise just return the child content\n return childContent\n }\n },\n})\n\n// The main router provider component that includes matches\nexport const RouterProvider = Vue.defineComponent({\n name: 'RouterProvider',\n props: {\n router: {\n type: Object,\n required: true,\n },\n // Rest of router options will be passed as attrs\n },\n setup(props, { attrs }) {\n const restAttrs = attrs\n\n return () => {\n return Vue.h(\n RouterContextProvider,\n {\n router: props.router,\n ...restAttrs,\n },\n {\n default: () => Vue.h(Matches),\n },\n )\n }\n },\n}) as unknown as {\n <TRouter extends AnyRouter = RegisteredRouter>(\n props: {\n router: TRouter\n routeTree?: TRouter['routeTree']\n } & Record<string, any>,\n ): Vue.VNode\n new (): {\n $props: {\n router: AnyRouter\n routeTree?: AnyRouter['routeTree']\n }\n }\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"mappings":";;;;AAUA,IAAaG,wBAAwBH,IAAII,gBAAgB;CACvDC,MAAM;CACNC,OAAO,EACLC,QAAQ;EACNC,MAAMC;EACNC,UAAU;EACZ,EAED;CACDC,MAAML,OAAO,EAAEM,OAAOC,SAAS;EAC7B,MAAMN,SAASD,MAAMC;EACrB,MAAMO,YAAYF;AAGlBL,SAAOQ,OAAO;GACZ,GAAGR,OAAOS;GACV,GAAGF;GACHG,SAAS;IACP,GAAGV,OAAOS,QAAQC;IAClB,GAAKH,UAAUG,WAAmC,EAAE;IACtD;GACM,CAAC;AAGTf,gBAAcK,OAAO;AAErB,eAAa;GAEX,MAAMW,eAAeL,MAAMM,WAAW;AAGtC,OAAIZ,OAAOS,QAAQI,MAAM;IACvB,MAAMC,gBAAgBd,OAAOS,QAAQI;AACrC,WAAOpB,IAAIsB,EAAED,eAAe,YAAYH,aAAa;;AAKvD,OAAIK,MAAMC,QAAQN,aAAa,IAAIA,aAAaO,WAAW,EACzD,QAAOP,aAAa;AAItB,UAAOA;;;CAGZ,CAAC;AAGF,IAAaQ,iBAAiB1B,IAAII,gBAAgB;CAChDC,MAAM;CACNC,OAAO,EACLC,QAAQ;EACNC,MAAMC;EACNC,UAAU;EACZ,EAED;CACDC,MAAML,OAAO,EAAEM,SAAS;EACtB,MAAME,YAAYF;AAElB,eAAa;AACX,UAAOZ,IAAIsB,EACTnB,uBACA;IACEI,QAAQD,MAAMC;IACd,GAAGO;IACJ,EACD,EACEK,eAAenB,IAAIsB,EAAErB,QAAO,EAEhC,CAAC;;;CAGN,CAaA"}
|
package/dist/esm/ScriptOnce.js
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
|
+
import { useRouter } from "./useRouter.js";
|
|
1
2
|
import * as Vue from "vue";
|
|
2
3
|
import { createVNode } from "vue";
|
|
3
4
|
import { isServer } from "@tanstack/router-core/isServer";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"nonce": router.options.ssr?.nonce,
|
|
31
|
-
"data-allow-mismatch": true,
|
|
32
|
-
"innerHTML": ""
|
|
33
|
-
}, null);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
5
|
+
//#region src/ScriptOnce.tsx
|
|
6
|
+
var ScriptOnce = Vue.defineComponent({
|
|
7
|
+
name: "ScriptOnce",
|
|
8
|
+
props: { children: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true
|
|
11
|
+
} },
|
|
12
|
+
setup(props) {
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
if (isServer ?? router.isServer) return () => createVNode("script", {
|
|
15
|
+
"nonce": router.options.ssr?.nonce,
|
|
16
|
+
"innerHTML": props.children + ";document.currentScript.remove()"
|
|
17
|
+
}, null);
|
|
18
|
+
const mounted = Vue.ref(false);
|
|
19
|
+
Vue.onMounted(() => {
|
|
20
|
+
mounted.value = true;
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
if (mounted.value) return null;
|
|
24
|
+
return createVNode("script", {
|
|
25
|
+
"nonce": router.options.ssr?.nonce,
|
|
26
|
+
"data-allow-mismatch": true,
|
|
27
|
+
"innerHTML": ""
|
|
28
|
+
}, null);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
36
31
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=ScriptOnce.js.map
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ScriptOnce };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=ScriptOnce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptOnce.js","sources":["../../src/ScriptOnce.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport const ScriptOnce = Vue.defineComponent({\n name: 'ScriptOnce',\n props: {\n children: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n return () => (\n <script\n nonce={router.options.ssr?.nonce}\n innerHTML={props.children + ';document.currentScript.remove()'}\n />\n )\n }\n\n const mounted = Vue.ref(false)\n Vue.onMounted(() => {\n mounted.value = true\n })\n\n return () => {\n if (mounted.value) {\n return null\n }\n\n return (\n <script\n nonce={router.options.ssr?.nonce}\n data-allow-mismatch\n innerHTML=\"\"\n />\n )\n }\n },\n})\n"],"
|
|
1
|
+
{"version":3,"file":"ScriptOnce.js","names":["Vue","isServer","useRouter","ScriptOnce","defineComponent","name","props","children","type","String","required","setup","router","_createVNode","options","ssr","nonce","mounted","ref","onMounted","value"],"sources":["../../src/ScriptOnce.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport const ScriptOnce = Vue.defineComponent({\n name: 'ScriptOnce',\n props: {\n children: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n return () => (\n <script\n nonce={router.options.ssr?.nonce}\n innerHTML={props.children + ';document.currentScript.remove()'}\n />\n )\n }\n\n const mounted = Vue.ref(false)\n Vue.onMounted(() => {\n mounted.value = true\n })\n\n return () => {\n if (mounted.value) {\n return null\n }\n\n return (\n <script\n nonce={router.options.ssr?.nonce}\n data-allow-mismatch\n innerHTML=\"\"\n />\n )\n }\n },\n})\n"],"mappings":";;;;;AAIA,IAAaG,aAAaH,IAAII,gBAAgB;CAC5CC,MAAM;CACNC,OAAO,EACLC,UAAU;EACRC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,SAASV,WAAW;AAE1B,MAAID,YAAYW,OAAOX,SACrB,cAAOY,YAAA,UAAA;GAAA,SAEID,OAAOE,QAAQC,KAAKC;GAAK,aACrBV,MAAMC,WAAW;GAAkC,EAAA,KAEjE;EAGH,MAAMU,UAAUjB,IAAIkB,IAAI,MAAM;AAC9BlB,MAAImB,gBAAgB;AAClBF,WAAQG,QAAQ;IAChB;AAEF,eAAa;AACX,OAAIH,QAAQG,MACV,QAAO;AAGT,UAAAP,YAAA,UAAA;IAAA,SAEWD,OAAOE,QAAQC,KAAKC;IAAK,uBAAA;IAAA,aAAA;IAAA,EAAA,KAAA;;;CAOzC,CAAC"}
|
package/dist/esm/Scripts.js
CHANGED
|
@@ -1,103 +1,81 @@
|
|
|
1
|
-
import * as Vue from "vue";
|
|
2
|
-
import { createVNode, Fragment, mergeProps } from "vue";
|
|
3
|
-
import { Asset } from "./Asset.js";
|
|
4
|
-
import { useRouterState } from "./useRouterState.js";
|
|
5
1
|
import { useRouter } from "./useRouter.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
children: ""
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (const script of scripts.value.scripts) {
|
|
87
|
-
allScripts.push(script);
|
|
88
|
-
}
|
|
89
|
-
if (mounted.value || router.serverSsr) {
|
|
90
|
-
for (const asset of assetScripts.value) {
|
|
91
|
-
allScripts.push(asset);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return createVNode(Fragment, null, [allScripts.map((asset, i) => createVNode(Asset, mergeProps(asset, {
|
|
95
|
-
"key": `tsr-scripts-${asset.tag}-${i}`
|
|
96
|
-
}), null))]);
|
|
97
|
-
};
|
|
98
|
-
}
|
|
2
|
+
import { useRouterState } from "./useRouterState.js";
|
|
3
|
+
import { Asset } from "./Asset.js";
|
|
4
|
+
import * as Vue from "vue";
|
|
5
|
+
import { Fragment, createVNode, mergeProps } from "vue";
|
|
6
|
+
//#region src/Scripts.tsx
|
|
7
|
+
var Scripts = Vue.defineComponent({
|
|
8
|
+
name: "Scripts",
|
|
9
|
+
setup() {
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
const nonce = router.options.ssr?.nonce;
|
|
12
|
+
const assetScripts = useRouterState({ select: (state) => {
|
|
13
|
+
const assetScripts = [];
|
|
14
|
+
const manifest = router.ssr?.manifest;
|
|
15
|
+
if (!manifest) return [];
|
|
16
|
+
state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach((route) => manifest.routes[route.id]?.assets?.filter((d) => d.tag === "script").forEach((asset) => {
|
|
17
|
+
assetScripts.push({
|
|
18
|
+
tag: "script",
|
|
19
|
+
attrs: {
|
|
20
|
+
...asset.attrs,
|
|
21
|
+
nonce
|
|
22
|
+
},
|
|
23
|
+
children: asset.children
|
|
24
|
+
});
|
|
25
|
+
}));
|
|
26
|
+
return assetScripts;
|
|
27
|
+
} });
|
|
28
|
+
const scripts = useRouterState({ select: (state) => ({ scripts: state.matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
|
|
29
|
+
tag: "script",
|
|
30
|
+
attrs: {
|
|
31
|
+
...script,
|
|
32
|
+
nonce
|
|
33
|
+
},
|
|
34
|
+
children
|
|
35
|
+
})) }) });
|
|
36
|
+
const mounted = Vue.ref(false);
|
|
37
|
+
Vue.onMounted(() => {
|
|
38
|
+
mounted.value = true;
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
const allScripts = [];
|
|
42
|
+
if (router.serverSsr) {
|
|
43
|
+
const serverBufferedScript = router.serverSsr.takeBufferedScripts();
|
|
44
|
+
if (serverBufferedScript) allScripts.push(serverBufferedScript);
|
|
45
|
+
} else if (router.ssr && !mounted.value) {
|
|
46
|
+
allScripts.push({
|
|
47
|
+
tag: "script",
|
|
48
|
+
attrs: {
|
|
49
|
+
nonce,
|
|
50
|
+
"data-allow-mismatch": true
|
|
51
|
+
},
|
|
52
|
+
children: ""
|
|
53
|
+
});
|
|
54
|
+
allScripts.push({
|
|
55
|
+
tag: "script",
|
|
56
|
+
attrs: {
|
|
57
|
+
nonce,
|
|
58
|
+
id: "$tsr-stream-barrier",
|
|
59
|
+
"data-allow-mismatch": true
|
|
60
|
+
},
|
|
61
|
+
children: ""
|
|
62
|
+
});
|
|
63
|
+
for (const asset of assetScripts.value) allScripts.push({
|
|
64
|
+
tag: "script",
|
|
65
|
+
attrs: {
|
|
66
|
+
...asset.attrs,
|
|
67
|
+
"data-allow-mismatch": true
|
|
68
|
+
},
|
|
69
|
+
children: ""
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
for (const script of scripts.value.scripts) allScripts.push(script);
|
|
73
|
+
if (mounted.value || router.serverSsr) for (const asset of assetScripts.value) allScripts.push(asset);
|
|
74
|
+
return createVNode(Fragment, null, [allScripts.map((asset, i) => createVNode(Asset, mergeProps(asset, { "key": `tsr-scripts-${asset.tag}-${i}` }), null))]);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
99
77
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
//# sourceMappingURL=Scripts.js.map
|
|
78
|
+
//#endregion
|
|
79
|
+
export { Scripts };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=Scripts.js.map
|
package/dist/esm/Scripts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scripts.js","sources":["../../src/Scripts.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { Asset } from './Asset'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const Scripts = Vue.defineComponent({\n name: 'Scripts',\n setup() {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n\n const assetScripts = useRouterState({\n select: (state) => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as RouterManagedTag)\n }),\n )\n\n return assetScripts\n },\n })\n\n const scripts = useRouterState({\n select: (state) => ({\n scripts: (\n state.matches\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script' as const,\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n }),\n })\n\n const mounted = Vue.ref(false)\n Vue.onMounted(() => {\n mounted.value = true\n })\n\n return () => {\n const allScripts: Array<RouterManagedTag> = []\n\n if (router.serverSsr) {\n const serverBufferedScript = router.serverSsr.takeBufferedScripts()\n if (serverBufferedScript) {\n allScripts.push(serverBufferedScript)\n }\n } else if (router.ssr && !mounted.value) {\n allScripts.push({\n tag: 'script',\n attrs: { nonce, 'data-allow-mismatch': true },\n children: '',\n } as RouterManagedTag)\n\n allScripts.push({\n tag: 'script',\n attrs: {\n nonce,\n id: '$tsr-stream-barrier',\n 'data-allow-mismatch': true,\n },\n children: '',\n } as RouterManagedTag)\n\n for (const asset of assetScripts.value) {\n allScripts.push({\n tag: 'script',\n attrs: {\n ...asset.attrs,\n 'data-allow-mismatch': true,\n },\n children: '',\n } as RouterManagedTag)\n }\n }\n\n for (const script of scripts.value.scripts) {\n allScripts.push(script as RouterManagedTag)\n }\n\n if (mounted.value || router.serverSsr) {\n for (const asset of assetScripts.value) {\n allScripts.push(asset)\n }\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n ))}\n </>\n )\n }\n },\n})\n"],"
|
|
1
|
+
{"version":3,"file":"Scripts.js","names":["Vue","Asset","useRouterState","useRouter","Scripts","defineComponent","name","setup","router","nonce","options","ssr","assetScripts","select","state","manifest","matches","map","match","looseRoutesById","routeId","forEach","route","routes","id","assets","filter","d","tag","asset","push","attrs","children","scripts","flat","Boolean","script","mounted","ref","onMounted","value","allScripts","serverSsr","serverBufferedScript","takeBufferedScripts","_createVNode","_Fragment","i","_mergeProps"],"sources":["../../src/Scripts.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { Asset } from './Asset'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const Scripts = Vue.defineComponent({\n name: 'Scripts',\n setup() {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n\n const assetScripts = useRouterState({\n select: (state) => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as RouterManagedTag)\n }),\n )\n\n return assetScripts\n },\n })\n\n const scripts = useRouterState({\n select: (state) => ({\n scripts: (\n state.matches\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script' as const,\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n }),\n })\n\n const mounted = Vue.ref(false)\n Vue.onMounted(() => {\n mounted.value = true\n })\n\n return () => {\n const allScripts: Array<RouterManagedTag> = []\n\n if (router.serverSsr) {\n const serverBufferedScript = router.serverSsr.takeBufferedScripts()\n if (serverBufferedScript) {\n allScripts.push(serverBufferedScript)\n }\n } else if (router.ssr && !mounted.value) {\n allScripts.push({\n tag: 'script',\n attrs: { nonce, 'data-allow-mismatch': true },\n children: '',\n } as RouterManagedTag)\n\n allScripts.push({\n tag: 'script',\n attrs: {\n nonce,\n id: '$tsr-stream-barrier',\n 'data-allow-mismatch': true,\n },\n children: '',\n } as RouterManagedTag)\n\n for (const asset of assetScripts.value) {\n allScripts.push({\n tag: 'script',\n attrs: {\n ...asset.attrs,\n 'data-allow-mismatch': true,\n },\n children: '',\n } as RouterManagedTag)\n }\n }\n\n for (const script of scripts.value.scripts) {\n allScripts.push(script as RouterManagedTag)\n }\n\n if (mounted.value || router.serverSsr) {\n for (const asset of assetScripts.value) {\n allScripts.push(asset)\n }\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n ))}\n </>\n )\n }\n },\n})\n"],"mappings":";;;;;;AAMA,IAAaI,UAAUJ,IAAIK,gBAAgB;CACzCC,MAAM;CACNC,QAAQ;EACN,MAAMC,SAASL,WAAW;EAC1B,MAAMM,QAAQD,OAAOE,QAAQC,KAAKF;EAElC,MAAMG,eAAeV,eAAe,EAClCW,SAASC,UAAU;GACjB,MAAMF,eAAwC,EAAE;GAChD,MAAMG,WAAWP,OAAOG,KAAKI;AAE7B,OAAI,CAACA,SACH,QAAO,EAAE;AAGXD,SAAME,QACHC,KAAKC,UAAUV,OAAOW,gBAAgBD,MAAME,SAAU,CACtDC,SAASC,UACRP,SAASQ,OAAOD,MAAME,KAAKC,QACvBC,QAAQC,MAAMA,EAAEC,QAAQ,SAAS,CAClCP,SAASQ,UAAU;AAClBjB,iBAAakB,KAAK;KAChBF,KAAK;KACLG,OAAO;MAAE,GAAGF,MAAME;MAAOtB;MAAO;KAChCuB,UAAUH,MAAMG;KACG,CAAC;KAE5B,CAAC;AAEH,UAAOpB;KAEV,CAAC;EAEF,MAAMqB,UAAU/B,eAAe,EAC7BW,SAASC,WAAW,EAClBmB,SACEnB,MAAME,QACHC,KAAKC,UAAUA,MAAMe,QAAS,CAC9BC,KAAK,EAAE,CACPR,OAAOS,QAAQ,CAClBlB,KAAK,EAAEe,UAAU,GAAGI,cAAc;GAClCR,KAAK;GACLG,OAAO;IACL,GAAGK;IACH3B;IACD;GACDuB;GACD,EAAC,EACH,GACF,CAAC;EAEF,MAAMK,UAAUrC,IAAIsC,IAAI,MAAM;AAC9BtC,MAAIuC,gBAAgB;AAClBF,WAAQG,QAAQ;IAChB;AAEF,eAAa;GACX,MAAMC,aAAsC,EAAE;AAE9C,OAAIjC,OAAOkC,WAAW;IACpB,MAAMC,uBAAuBnC,OAAOkC,UAAUE,qBAAqB;AACnE,QAAID,qBACFF,YAAWX,KAAKa,qBAAqB;cAE9BnC,OAAOG,OAAO,CAAC0B,QAAQG,OAAO;AACvCC,eAAWX,KAAK;KACdF,KAAK;KACLG,OAAO;MAAEtB;MAAO,uBAAuB;MAAM;KAC7CuB,UAAU;KACS,CAAC;AAEtBS,eAAWX,KAAK;KACdF,KAAK;KACLG,OAAO;MACLtB;MACAe,IAAI;MACJ,uBAAuB;MACxB;KACDQ,UAAU;KACS,CAAC;AAEtB,SAAK,MAAMH,SAASjB,aAAa4B,MAC/BC,YAAWX,KAAK;KACdF,KAAK;KACLG,OAAO;MACL,GAAGF,MAAME;MACT,uBAAuB;MACxB;KACDC,UAAU;KACS,CAAC;;AAI1B,QAAK,MAAMI,UAAUH,QAAQO,MAAMP,QACjCQ,YAAWX,KAAKM,OAA2B;AAG7C,OAAIC,QAAQG,SAAShC,OAAOkC,UAC1B,MAAK,MAAMb,SAASjB,aAAa4B,MAC/BC,YAAWX,KAAKD,MAAM;AAI1B,UAAAgB,YAAAC,UAAA,MAAA,CAEKL,WAAWxB,KAAKY,OAAOkB,MAACF,YAAA5C,OAAA+C,WACZnB,OAAK,EAAA,OAAO,eAAeA,MAAMD,IAAG,GAAImB,KAAG,CAAA,EAAA,KACvD,CAAC,CAAA,CAAA;;;CAKX,CAAC"}
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import { defaultGetScrollRestorationKey, getCssSelector, scrollRestorationCache, setupScrollRestoration } from "@tanstack/router-core";
|
|
2
1
|
import { useRouter } from "./useRouter.js";
|
|
2
|
+
import { defaultGetScrollRestorationKey, getCssSelector, scrollRestorationCache, setupScrollRestoration } from "@tanstack/router-core";
|
|
3
|
+
//#region src/ScrollRestoration.tsx
|
|
3
4
|
function useScrollRestoration() {
|
|
4
|
-
|
|
5
|
-
setupScrollRestoration(router, true);
|
|
5
|
+
setupScrollRestoration(useRouter(), true);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated use createRouter's `scrollRestoration` option instead
|
|
9
|
+
*/
|
|
7
10
|
function ScrollRestoration(_props) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
11
|
+
useScrollRestoration();
|
|
12
|
+
if (process.env.NODE_ENV === "development") console.warn("The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.");
|
|
13
|
+
return null;
|
|
13
14
|
}
|
|
14
15
|
function useElementScrollRestoration(options) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
const restoreKey = getKey(router.latestLocation);
|
|
29
|
-
const byKey = scrollRestorationCache?.state[restoreKey];
|
|
30
|
-
return byKey?.[elementSelector];
|
|
16
|
+
useScrollRestoration();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const getKey = options.getKey || defaultGetScrollRestorationKey;
|
|
19
|
+
let elementSelector = "";
|
|
20
|
+
if (options.id) elementSelector = `[data-scroll-restoration-id="${options.id}"]`;
|
|
21
|
+
else {
|
|
22
|
+
const element = options.getElement?.();
|
|
23
|
+
if (!element) return;
|
|
24
|
+
elementSelector = element instanceof Window ? "window" : getCssSelector(element);
|
|
25
|
+
}
|
|
26
|
+
const restoreKey = getKey(router.latestLocation);
|
|
27
|
+
return (scrollRestorationCache?.state[restoreKey])?.[elementSelector];
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=ScrollRestoration.js.map
|
|
29
|
+
//#endregion
|
|
30
|
+
export { ScrollRestoration, useElementScrollRestoration };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=ScrollRestoration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollRestoration.js","sources":["../../src/ScrollRestoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n getCssSelector,\n scrollRestorationCache,\n setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n ParsedLocation,\n ScrollRestorationEntry,\n ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n const router = useRouter()\n setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated use createRouter's `scrollRestoration` option instead\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n useScrollRestoration()\n\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n )\n }\n\n return null\n}\n\nexport function useElementScrollRestoration(\n options: (\n | {\n id: string\n getElement?: () => Window | Element | undefined | null\n }\n | {\n id?: string\n getElement: () => Window | Element | undefined | null\n }\n ) & {\n getKey?: (location: ParsedLocation) => string\n },\n): ScrollRestorationEntry | undefined {\n useScrollRestoration()\n\n const router = useRouter()\n const getKey = options.getKey || defaultGetScrollRestorationKey\n\n let elementSelector = ''\n\n if (options.id) {\n elementSelector = `[data-scroll-restoration-id=\"${options.id}\"]`\n } else {\n const element = options.getElement?.()\n if (!element) {\n return\n }\n elementSelector =\n element instanceof Window ? 'window' : getCssSelector(element)\n }\n\n const restoreKey = getKey(router.latestLocation)\n const byKey = scrollRestorationCache?.state[restoreKey]\n return byKey?.[elementSelector]\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ScrollRestoration.js","names":["defaultGetScrollRestorationKey","getCssSelector","scrollRestorationCache","setupScrollRestoration","useRouter","useScrollRestoration","router","ScrollRestoration","_props","process","env","NODE_ENV","console","warn","useElementScrollRestoration","options","getKey","elementSelector","id","element","getElement","Window","restoreKey","latestLocation","byKey","state"],"sources":["../../src/ScrollRestoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n getCssSelector,\n scrollRestorationCache,\n setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n ParsedLocation,\n ScrollRestorationEntry,\n ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n const router = useRouter()\n setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated use createRouter's `scrollRestoration` option instead\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n useScrollRestoration()\n\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n )\n }\n\n return null\n}\n\nexport function useElementScrollRestoration(\n options: (\n | {\n id: string\n getElement?: () => Window | Element | undefined | null\n }\n | {\n id?: string\n getElement: () => Window | Element | undefined | null\n }\n ) & {\n getKey?: (location: ParsedLocation) => string\n },\n): ScrollRestorationEntry | undefined {\n useScrollRestoration()\n\n const router = useRouter()\n const getKey = options.getKey || defaultGetScrollRestorationKey\n\n let elementSelector = ''\n\n if (options.id) {\n elementSelector = `[data-scroll-restoration-id=\"${options.id}\"]`\n } else {\n const element = options.getElement?.()\n if (!element) {\n return\n }\n elementSelector =\n element instanceof Window ? 'window' : getCssSelector(element)\n }\n\n const restoreKey = getKey(router.latestLocation)\n const byKey = scrollRestorationCache?.state[restoreKey]\n return byKey?.[elementSelector]\n}\n"],"mappings":";;;AAaA,SAASK,uBAAuB;AAE9BF,wBADeC,WAAW,EACK,KAAK;;;;;AAMtC,SAAgBG,kBAAkBC,QAAkC;AAClEH,uBAAsB;AAEtB,KAAA,QAAA,IAAA,aAA6B,cAC3BO,SAAQC,KACN,wGACD;AAGH,QAAO;;AAGT,SAAgBC,4BACdC,SAYoC;AACpCV,uBAAsB;CAEtB,MAAMC,SAASF,WAAW;CAC1B,MAAMY,SAASD,QAAQC,UAAUhB;CAEjC,IAAIiB,kBAAkB;AAEtB,KAAIF,QAAQG,GACVD,mBAAkB,gCAAgCF,QAAQG,GAAE;MACvD;EACL,MAAMC,UAAUJ,QAAQK,cAAc;AACtC,MAAI,CAACD,QACH;AAEFF,oBACEE,mBAAmBE,SAAS,WAAWpB,eAAekB,QAAQ;;CAGlE,MAAMG,aAAaN,OAAOV,OAAOiB,eAAe;AAEhD,SADcrB,wBAAwBuB,MAAMH,eAC7BL"}
|