@tanstack/vue-router-devtools 0.0.1 → 1.140.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/LICENSE +21 -0
- package/README.md +3 -43
- package/dist/esm/TanStackRouterDevtools.d.ts +113 -0
- package/dist/esm/TanStackRouterDevtools.js +60 -0
- package/dist/esm/TanStackRouterDevtools.js.map +1 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.d.ts +74 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js +55 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js.map +1 -0
- package/dist/esm/index.d.ts +82 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +74 -7
- package/src/TanStackRouterDevtools.tsx +125 -0
- package/src/TanStackRouterDevtoolsPanel.tsx +104 -0
- package/src/index.tsx +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188" />
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# TanStack Vue Router Devtools
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@tanstack/vue-router-devtools`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|
|
5
|
+
See https://tanstack.com/router/latest/docs/framework/vue/devtools
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/vue-router';
|
|
2
|
+
export interface TanStackRouterDevtoolsOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Set this true if you want the dev tools to default to being open
|
|
5
|
+
*/
|
|
6
|
+
initialIsOpen?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
9
|
+
*/
|
|
10
|
+
panelProps?: Record<string, any>;
|
|
11
|
+
/**
|
|
12
|
+
* Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
13
|
+
*/
|
|
14
|
+
closeButtonProps?: Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
17
|
+
*/
|
|
18
|
+
toggleButtonProps?: Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
21
|
+
* Defaults to 'bottom-left'.
|
|
22
|
+
*/
|
|
23
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
24
|
+
/**
|
|
25
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
26
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
27
|
+
* Defaults to 'footer'.
|
|
28
|
+
*/
|
|
29
|
+
containerElement?: string | any;
|
|
30
|
+
/**
|
|
31
|
+
* The router instance to use for the devtools.
|
|
32
|
+
*/
|
|
33
|
+
router?: AnyRouter;
|
|
34
|
+
/**
|
|
35
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
36
|
+
*/
|
|
37
|
+
shadowDOMTarget?: ShadowRoot;
|
|
38
|
+
}
|
|
39
|
+
export declare const TanStackRouterDevtools: import('vue').DefineComponent<{
|
|
40
|
+
initialIsOpen?: boolean
|
|
41
|
+
/**
|
|
42
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
43
|
+
*/
|
|
44
|
+
| undefined;
|
|
45
|
+
panelProps?: Record<string, any>
|
|
46
|
+
/**
|
|
47
|
+
* Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
48
|
+
*/
|
|
49
|
+
| undefined;
|
|
50
|
+
closeButtonProps?: Record<string, any>
|
|
51
|
+
/**
|
|
52
|
+
* Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
53
|
+
*/
|
|
54
|
+
| undefined;
|
|
55
|
+
toggleButtonProps?: Record<string, any>
|
|
56
|
+
/**
|
|
57
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
58
|
+
* Defaults to 'bottom-left'.
|
|
59
|
+
*/
|
|
60
|
+
| undefined;
|
|
61
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
62
|
+
/**
|
|
63
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
64
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
65
|
+
* Defaults to 'footer'.
|
|
66
|
+
*/
|
|
67
|
+
| undefined;
|
|
68
|
+
containerElement?: string | any;
|
|
69
|
+
router?: AnyRouter
|
|
70
|
+
/**
|
|
71
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
72
|
+
*/
|
|
73
|
+
| undefined;
|
|
74
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
75
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
78
|
+
initialIsOpen?: boolean
|
|
79
|
+
/**
|
|
80
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
81
|
+
*/
|
|
82
|
+
| undefined;
|
|
83
|
+
panelProps?: Record<string, any>
|
|
84
|
+
/**
|
|
85
|
+
* Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
86
|
+
*/
|
|
87
|
+
| undefined;
|
|
88
|
+
closeButtonProps?: Record<string, any>
|
|
89
|
+
/**
|
|
90
|
+
* Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
91
|
+
*/
|
|
92
|
+
| undefined;
|
|
93
|
+
toggleButtonProps?: Record<string, any>
|
|
94
|
+
/**
|
|
95
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
96
|
+
* Defaults to 'bottom-left'.
|
|
97
|
+
*/
|
|
98
|
+
| undefined;
|
|
99
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
100
|
+
/**
|
|
101
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
102
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
103
|
+
* Defaults to 'footer'.
|
|
104
|
+
*/
|
|
105
|
+
| undefined;
|
|
106
|
+
containerElement?: string | any;
|
|
107
|
+
router?: AnyRouter
|
|
108
|
+
/**
|
|
109
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
110
|
+
*/
|
|
111
|
+
| undefined;
|
|
112
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
113
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TanStackRouterDevtoolsCore } from "@tanstack/router-devtools-core";
|
|
2
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, h } from "vue";
|
|
3
|
+
import { useRouter, useRouterState } from "@tanstack/vue-router";
|
|
4
|
+
const TanStackRouterDevtools = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "TanStackRouterDevtools",
|
|
6
|
+
props: ["initialIsOpen", "panelProps", "closeButtonProps", "toggleButtonProps", "position", "containerElement", "router", "shadowDOMTarget"],
|
|
7
|
+
setup(props) {
|
|
8
|
+
const devToolRef = ref(null);
|
|
9
|
+
const hookRouter = useRouter({
|
|
10
|
+
warn: false
|
|
11
|
+
});
|
|
12
|
+
const activeRouter = props.router ?? hookRouter;
|
|
13
|
+
const activeRouterState = useRouterState({
|
|
14
|
+
router: activeRouter
|
|
15
|
+
});
|
|
16
|
+
const devtools = new TanStackRouterDevtoolsCore({
|
|
17
|
+
initialIsOpen: props.initialIsOpen,
|
|
18
|
+
panelProps: props.panelProps,
|
|
19
|
+
closeButtonProps: props.closeButtonProps,
|
|
20
|
+
toggleButtonProps: props.toggleButtonProps,
|
|
21
|
+
position: props.position,
|
|
22
|
+
containerElement: props.containerElement,
|
|
23
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
24
|
+
router: activeRouter,
|
|
25
|
+
routerState: activeRouterState.value
|
|
26
|
+
});
|
|
27
|
+
watch(() => activeRouter, (router) => {
|
|
28
|
+
devtools.setRouter(router);
|
|
29
|
+
});
|
|
30
|
+
watch(activeRouterState, (routerState) => {
|
|
31
|
+
devtools.setRouterState(routerState);
|
|
32
|
+
});
|
|
33
|
+
watch(() => [props.initialIsOpen, props.panelProps, props.closeButtonProps, props.toggleButtonProps, props.position, props.containerElement, props.shadowDOMTarget], () => {
|
|
34
|
+
devtools.setOptions({
|
|
35
|
+
initialIsOpen: props.initialIsOpen,
|
|
36
|
+
panelProps: props.panelProps,
|
|
37
|
+
closeButtonProps: props.closeButtonProps,
|
|
38
|
+
toggleButtonProps: props.toggleButtonProps,
|
|
39
|
+
position: props.position,
|
|
40
|
+
containerElement: props.containerElement,
|
|
41
|
+
shadowDOMTarget: props.shadowDOMTarget
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
if (devToolRef.value) {
|
|
46
|
+
devtools.mount(devToolRef.value);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
onUnmounted(() => {
|
|
50
|
+
devtools.unmount();
|
|
51
|
+
});
|
|
52
|
+
return () => h("div", {
|
|
53
|
+
ref: devToolRef
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export {
|
|
58
|
+
TanStackRouterDevtools
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=TanStackRouterDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtools.js","sources":["../../src/TanStackRouterDevtools.tsx"],"sourcesContent":["import { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'\nimport { defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue'\nimport { useRouter, useRouterState } from '@tanstack/vue-router'\nimport type { AnyRouter } from '@tanstack/vue-router'\n\nexport interface TanStackRouterDevtoolsOptions {\n /**\n * Set this true if you want the dev tools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.\n */\n panelProps?: Record<string, any>\n /**\n * Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.\n */\n closeButtonProps?: Record<string, any>\n /**\n * Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.\n */\n toggleButtonProps?: Record<string, any>\n /**\n * The position of the TanStack Router logo to open and close the devtools panel.\n * Defaults to 'bottom-left'.\n */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n /**\n * Use this to render the devtools inside a different type of container element for a11y purposes.\n * Any string which corresponds to a valid intrinsic JSX element is allowed.\n * Defaults to 'footer'.\n */\n containerElement?: string | any\n /**\n * The router instance to use for the devtools.\n */\n router?: AnyRouter\n /**\n * Use this to attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n}\n\nexport const TanStackRouterDevtools = /* #__PURE__ */ defineComponent({\n name: 'TanStackRouterDevtools',\n props: [\n 'initialIsOpen',\n 'panelProps',\n 'closeButtonProps',\n 'toggleButtonProps',\n 'position',\n 'containerElement',\n 'router',\n 'shadowDOMTarget',\n ] as unknown as undefined,\n setup(props: TanStackRouterDevtoolsOptions) {\n const devToolRef = ref<HTMLDivElement | null>(null)\n\n const hookRouter = useRouter({ warn: false })\n const activeRouter = props.router ?? hookRouter\n\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const devtools = new TanStackRouterDevtoolsCore({\n initialIsOpen: props.initialIsOpen,\n panelProps: props.panelProps,\n closeButtonProps: props.closeButtonProps,\n toggleButtonProps: props.toggleButtonProps,\n position: props.position,\n containerElement: props.containerElement,\n shadowDOMTarget: props.shadowDOMTarget,\n router: activeRouter,\n routerState: activeRouterState.value,\n })\n\n // Update devtools when router changes\n watch(\n () => activeRouter,\n (router) => {\n devtools.setRouter(router)\n },\n )\n\n // Update devtools when router state changes\n watch(activeRouterState, (routerState) => {\n devtools.setRouterState(routerState)\n })\n\n // Update devtools when options change\n watch(\n () => [\n props.initialIsOpen,\n props.panelProps,\n props.closeButtonProps,\n props.toggleButtonProps,\n props.position,\n props.containerElement,\n props.shadowDOMTarget,\n ],\n () => {\n devtools.setOptions({\n initialIsOpen: props.initialIsOpen,\n panelProps: props.panelProps,\n closeButtonProps: props.closeButtonProps,\n toggleButtonProps: props.toggleButtonProps,\n position: props.position,\n containerElement: props.containerElement,\n shadowDOMTarget: props.shadowDOMTarget,\n })\n },\n )\n\n onMounted(() => {\n if (devToolRef.value) {\n devtools.mount(devToolRef.value)\n }\n })\n\n onUnmounted(() => {\n devtools.unmount()\n })\n\n return () => h('div', { ref: devToolRef })\n },\n})\n"],"names":["TanStackRouterDevtools","name","props","setup","devToolRef","ref","hookRouter","useRouter","warn","activeRouter","router","activeRouterState","useRouterState","devtools","TanStackRouterDevtoolsCore","initialIsOpen","panelProps","closeButtonProps","toggleButtonProps","position","containerElement","shadowDOMTarget","routerState","value","watch","setRouter","setRouterState","setOptions","onMounted","mount","onUnmounted","unmount","h"],"mappings":";;;AA2CO,MAAMA,yDAAyD;AAAA,EACpEC,MAAM;AAAA,EACNC,OAAO,CACL,iBACA,cACA,oBACA,qBACA,YACA,oBACA,UACA,iBAAiB;AAAA,EAEnBC,MAAMD,OAAsC;AAC1C,UAAME,aAAaC,IAA2B,IAAI;AAElD,UAAMC,aAAaC,UAAU;AAAA,MAAEC,MAAM;AAAA,IAAM,CAAC;AAC5C,UAAMC,eAAeP,MAAMQ,UAAUJ;AAErC,UAAMK,oBAAoBC,eAAe;AAAA,MAAEF,QAAQD;AAAAA,IAAa,CAAC;AAEjE,UAAMI,WAAW,IAAIC,2BAA2B;AAAA,MAC9CC,eAAeb,MAAMa;AAAAA,MACrBC,YAAYd,MAAMc;AAAAA,MAClBC,kBAAkBf,MAAMe;AAAAA,MACxBC,mBAAmBhB,MAAMgB;AAAAA,MACzBC,UAAUjB,MAAMiB;AAAAA,MAChBC,kBAAkBlB,MAAMkB;AAAAA,MACxBC,iBAAiBnB,MAAMmB;AAAAA,MACvBX,QAAQD;AAAAA,MACRa,aAAaX,kBAAkBY;AAAAA,IACjC,CAAC;AAGDC,UACE,MAAMf,cACLC,YAAW;AACVG,eAASY,UAAUf,MAAM;AAAA,IAC3B,CACF;AAGAc,UAAMb,mBAAoBW,iBAAgB;AACxCT,eAASa,eAAeJ,WAAW;AAAA,IACrC,CAAC;AAGDE,UACE,MAAM,CACJtB,MAAMa,eACNb,MAAMc,YACNd,MAAMe,kBACNf,MAAMgB,mBACNhB,MAAMiB,UACNjB,MAAMkB,kBACNlB,MAAMmB,eAAe,GAEvB,MAAM;AACJR,eAASc,WAAW;AAAA,QAClBZ,eAAeb,MAAMa;AAAAA,QACrBC,YAAYd,MAAMc;AAAAA,QAClBC,kBAAkBf,MAAMe;AAAAA,QACxBC,mBAAmBhB,MAAMgB;AAAAA,QACzBC,UAAUjB,MAAMiB;AAAAA,QAChBC,kBAAkBlB,MAAMkB;AAAAA,QACxBC,iBAAiBnB,MAAMmB;AAAAA,MACzB,CAAC;AAAA,IACH,CACF;AAEAO,cAAU,MAAM;AACd,UAAIxB,WAAWmB,OAAO;AACpBV,iBAASgB,MAAMzB,WAAWmB,KAAK;AAAA,MACjC;AAAA,IACF,CAAC;AAEDO,gBAAY,MAAM;AAChBjB,eAASkB,QAAO;AAAA,IAClB,CAAC;AAED,WAAO,MAAMC,EAAE,OAAO;AAAA,MAAE3B,KAAKD;AAAAA,IAAW,CAAC;AAAA,EAC3C;AACF,CAAC;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/vue-router';
|
|
2
|
+
export interface TanStackRouterDevtoolsPanelOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The standard style object used to style a component with inline styles
|
|
5
|
+
*/
|
|
6
|
+
style?: any;
|
|
7
|
+
/**
|
|
8
|
+
* The standard class property used to style a component with classes
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
13
|
+
*/
|
|
14
|
+
isOpen?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A function that toggles the open and close state of the panel
|
|
17
|
+
*/
|
|
18
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Handles the opening and closing the devtools panel
|
|
21
|
+
*/
|
|
22
|
+
handleDragStart?: (e: any) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The router instance to use for the devtools.
|
|
25
|
+
*/
|
|
26
|
+
router?: AnyRouter;
|
|
27
|
+
/**
|
|
28
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
29
|
+
*/
|
|
30
|
+
shadowDOMTarget?: ShadowRoot;
|
|
31
|
+
}
|
|
32
|
+
export declare const TanStackRouterDevtoolsPanel: import('vue').DefineComponent<{
|
|
33
|
+
style?: any;
|
|
34
|
+
className?: string
|
|
35
|
+
/**
|
|
36
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
37
|
+
*/
|
|
38
|
+
| undefined;
|
|
39
|
+
isOpen?: boolean
|
|
40
|
+
/**
|
|
41
|
+
* A function that toggles the open and close state of the panel
|
|
42
|
+
*/
|
|
43
|
+
| undefined;
|
|
44
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
45
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
46
|
+
router?: AnyRouter
|
|
47
|
+
/**
|
|
48
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
49
|
+
*/
|
|
50
|
+
| undefined;
|
|
51
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
52
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
55
|
+
style?: any;
|
|
56
|
+
className?: string
|
|
57
|
+
/**
|
|
58
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
59
|
+
*/
|
|
60
|
+
| undefined;
|
|
61
|
+
isOpen?: boolean
|
|
62
|
+
/**
|
|
63
|
+
* A function that toggles the open and close state of the panel
|
|
64
|
+
*/
|
|
65
|
+
| undefined;
|
|
66
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
67
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
68
|
+
router?: AnyRouter
|
|
69
|
+
/**
|
|
70
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
71
|
+
*/
|
|
72
|
+
| undefined;
|
|
73
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
74
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TanStackRouterDevtoolsPanelCore } from "@tanstack/router-devtools-core";
|
|
2
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, h } from "vue";
|
|
3
|
+
import { useRouter, useRouterState } from "@tanstack/vue-router";
|
|
4
|
+
const TanStackRouterDevtoolsPanel = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "TanStackRouterDevtoolsPanel",
|
|
6
|
+
props: ["style", "className", "isOpen", "setIsOpen", "handleDragStart", "router", "shadowDOMTarget"],
|
|
7
|
+
setup(props) {
|
|
8
|
+
const devToolRef = ref(null);
|
|
9
|
+
const hookRouter = useRouter({
|
|
10
|
+
warn: false
|
|
11
|
+
});
|
|
12
|
+
const activeRouter = props.router ?? hookRouter;
|
|
13
|
+
const activeRouterState = useRouterState({
|
|
14
|
+
router: activeRouter
|
|
15
|
+
});
|
|
16
|
+
const devtools = new TanStackRouterDevtoolsPanelCore({
|
|
17
|
+
style: props.style,
|
|
18
|
+
className: props.className,
|
|
19
|
+
isOpen: props.isOpen,
|
|
20
|
+
setIsOpen: props.setIsOpen,
|
|
21
|
+
handleDragStart: props.handleDragStart,
|
|
22
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
23
|
+
router: activeRouter,
|
|
24
|
+
routerState: activeRouterState.value
|
|
25
|
+
});
|
|
26
|
+
watch(() => activeRouter, (router) => {
|
|
27
|
+
devtools.setRouter(router);
|
|
28
|
+
});
|
|
29
|
+
watch(activeRouterState, (routerState) => {
|
|
30
|
+
devtools.setRouterState(routerState);
|
|
31
|
+
});
|
|
32
|
+
watch(() => [props.className, props.style, props.shadowDOMTarget], () => {
|
|
33
|
+
devtools.setOptions({
|
|
34
|
+
className: props.className,
|
|
35
|
+
style: props.style,
|
|
36
|
+
shadowDOMTarget: props.shadowDOMTarget
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
if (devToolRef.value) {
|
|
41
|
+
devtools.mount(devToolRef.value);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
onUnmounted(() => {
|
|
45
|
+
devtools.unmount();
|
|
46
|
+
});
|
|
47
|
+
return () => h("div", {
|
|
48
|
+
ref: devToolRef
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
TanStackRouterDevtoolsPanel
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=TanStackRouterDevtoolsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtoolsPanel.js","sources":["../../src/TanStackRouterDevtoolsPanel.tsx"],"sourcesContent":["import { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'\nimport { defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue'\nimport { useRouter, useRouterState } from '@tanstack/vue-router'\nimport type { AnyRouter } from '@tanstack/vue-router'\n\nexport interface TanStackRouterDevtoolsPanelOptions {\n /**\n * The standard style object used to style a component with inline styles\n */\n style?: any\n /**\n * The standard class property used to style a component with classes\n */\n className?: string\n /**\n * A boolean variable indicating whether the panel is open or closed\n */\n isOpen?: boolean\n /**\n * A function that toggles the open and close state of the panel\n */\n setIsOpen?: (isOpen: boolean) => void\n /**\n * Handles the opening and closing the devtools panel\n */\n handleDragStart?: (e: any) => void\n /**\n * The router instance to use for the devtools.\n */\n router?: AnyRouter\n /**\n * Use this to attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n}\n\nexport const TanStackRouterDevtoolsPanel = /* #__PURE__ */ defineComponent({\n name: 'TanStackRouterDevtoolsPanel',\n props: [\n 'style',\n 'className',\n 'isOpen',\n 'setIsOpen',\n 'handleDragStart',\n 'router',\n 'shadowDOMTarget',\n ] as unknown as undefined,\n setup(props: TanStackRouterDevtoolsPanelOptions) {\n const devToolRef = ref<HTMLDivElement | null>(null)\n\n const hookRouter = useRouter({ warn: false })\n const activeRouter = props.router ?? hookRouter\n\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const devtools = new TanStackRouterDevtoolsPanelCore({\n style: props.style,\n className: props.className,\n isOpen: props.isOpen,\n setIsOpen: props.setIsOpen,\n handleDragStart: props.handleDragStart,\n shadowDOMTarget: props.shadowDOMTarget,\n router: activeRouter,\n routerState: activeRouterState.value,\n })\n\n // Update devtools when router changes\n watch(\n () => activeRouter,\n (router) => {\n devtools.setRouter(router)\n },\n )\n\n // Update devtools when router state changes\n watch(activeRouterState, (routerState) => {\n devtools.setRouterState(routerState)\n })\n\n // Update devtools when options change\n watch(\n () => [props.className, props.style, props.shadowDOMTarget],\n () => {\n devtools.setOptions({\n className: props.className,\n style: props.style,\n shadowDOMTarget: props.shadowDOMTarget,\n })\n },\n )\n\n onMounted(() => {\n if (devToolRef.value) {\n devtools.mount(devToolRef.value)\n }\n })\n\n onUnmounted(() => {\n devtools.unmount()\n })\n\n return () => h('div', { ref: devToolRef })\n },\n})\n"],"names":["TanStackRouterDevtoolsPanel","name","props","setup","devToolRef","ref","hookRouter","useRouter","warn","activeRouter","router","activeRouterState","useRouterState","devtools","TanStackRouterDevtoolsPanelCore","style","className","isOpen","setIsOpen","handleDragStart","shadowDOMTarget","routerState","value","watch","setRouter","setRouterState","setOptions","onMounted","mount","onUnmounted","unmount","h"],"mappings":";;;AAoCO,MAAMA,8DAA8D;AAAA,EACzEC,MAAM;AAAA,EACNC,OAAO,CACL,SACA,aACA,UACA,aACA,mBACA,UACA,iBAAiB;AAAA,EAEnBC,MAAMD,OAA2C;AAC/C,UAAME,aAAaC,IAA2B,IAAI;AAElD,UAAMC,aAAaC,UAAU;AAAA,MAAEC,MAAM;AAAA,IAAM,CAAC;AAC5C,UAAMC,eAAeP,MAAMQ,UAAUJ;AAErC,UAAMK,oBAAoBC,eAAe;AAAA,MAAEF,QAAQD;AAAAA,IAAa,CAAC;AAEjE,UAAMI,WAAW,IAAIC,gCAAgC;AAAA,MACnDC,OAAOb,MAAMa;AAAAA,MACbC,WAAWd,MAAMc;AAAAA,MACjBC,QAAQf,MAAMe;AAAAA,MACdC,WAAWhB,MAAMgB;AAAAA,MACjBC,iBAAiBjB,MAAMiB;AAAAA,MACvBC,iBAAiBlB,MAAMkB;AAAAA,MACvBV,QAAQD;AAAAA,MACRY,aAAaV,kBAAkBW;AAAAA,IACjC,CAAC;AAGDC,UACE,MAAMd,cACLC,YAAW;AACVG,eAASW,UAAUd,MAAM;AAAA,IAC3B,CACF;AAGAa,UAAMZ,mBAAoBU,iBAAgB;AACxCR,eAASY,eAAeJ,WAAW;AAAA,IACrC,CAAC;AAGDE,UACE,MAAM,CAACrB,MAAMc,WAAWd,MAAMa,OAAOb,MAAMkB,eAAe,GAC1D,MAAM;AACJP,eAASa,WAAW;AAAA,QAClBV,WAAWd,MAAMc;AAAAA,QACjBD,OAAOb,MAAMa;AAAAA,QACbK,iBAAiBlB,MAAMkB;AAAAA,MACzB,CAAC;AAAA,IACH,CACF;AAEAO,cAAU,MAAM;AACd,UAAIvB,WAAWkB,OAAO;AACpBT,iBAASe,MAAMxB,WAAWkB,KAAK;AAAA,MACjC;AAAA,IACF,CAAC;AAEDO,gBAAY,MAAM;AAChBhB,eAASiB,QAAO;AAAA,IAClB,CAAC;AAED,WAAO,MAAMC,EAAE,OAAO;AAAA,MAAE1B,KAAKD;AAAAA,IAAW,CAAC;AAAA,EAC3C;AACF,CAAC;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type { TanStackRouterDevtoolsOptions } from './TanStackRouterDevtools.js';
|
|
2
|
+
export type { TanStackRouterDevtoolsPanelOptions } from './TanStackRouterDevtoolsPanel.js';
|
|
3
|
+
export declare const TanStackRouterDevtools: import('vue').DefineComponent<{
|
|
4
|
+
initialIsOpen?: boolean | undefined;
|
|
5
|
+
panelProps?: Record<string, any> | undefined;
|
|
6
|
+
closeButtonProps?: Record<string, any> | undefined;
|
|
7
|
+
toggleButtonProps?: Record<string, any> | undefined;
|
|
8
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
|
|
9
|
+
containerElement?: string | any;
|
|
10
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
11
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
12
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
15
|
+
initialIsOpen?: boolean | undefined;
|
|
16
|
+
panelProps?: Record<string, any> | undefined;
|
|
17
|
+
closeButtonProps?: Record<string, any> | undefined;
|
|
18
|
+
toggleButtonProps?: Record<string, any> | undefined;
|
|
19
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
|
|
20
|
+
containerElement?: string | any;
|
|
21
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
22
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
23
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any> | import('vue').DefineComponent<{}, () => null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
export declare const TanStackRouterDevtoolsInProd: import('vue').DefineComponent<{
|
|
25
|
+
initialIsOpen?: boolean | undefined;
|
|
26
|
+
panelProps?: Record<string, any> | undefined;
|
|
27
|
+
closeButtonProps?: Record<string, any> | undefined;
|
|
28
|
+
toggleButtonProps?: Record<string, any> | undefined;
|
|
29
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
|
|
30
|
+
containerElement?: string | any;
|
|
31
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
32
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
33
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
36
|
+
initialIsOpen?: boolean | undefined;
|
|
37
|
+
panelProps?: Record<string, any> | undefined;
|
|
38
|
+
closeButtonProps?: Record<string, any> | undefined;
|
|
39
|
+
toggleButtonProps?: Record<string, any> | undefined;
|
|
40
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
|
|
41
|
+
containerElement?: string | any;
|
|
42
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
43
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
44
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
45
|
+
export declare const TanStackRouterDevtoolsPanel: import('vue').DefineComponent<{
|
|
46
|
+
style?: any;
|
|
47
|
+
className?: string | undefined;
|
|
48
|
+
isOpen?: boolean | undefined;
|
|
49
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
50
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
51
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
52
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
53
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
56
|
+
style?: any;
|
|
57
|
+
className?: string | undefined;
|
|
58
|
+
isOpen?: boolean | undefined;
|
|
59
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
60
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
61
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
62
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
63
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any> | import('vue').DefineComponent<{}, () => null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
64
|
+
export declare const TanStackRouterDevtoolsPanelInProd: import('vue').DefineComponent<{
|
|
65
|
+
style?: any;
|
|
66
|
+
className?: string | undefined;
|
|
67
|
+
isOpen?: boolean | undefined;
|
|
68
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
69
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
70
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
71
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
72
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
75
|
+
style?: any;
|
|
76
|
+
className?: string | undefined;
|
|
77
|
+
isOpen?: boolean | undefined;
|
|
78
|
+
setIsOpen?: ((isOpen: boolean) => void) | undefined;
|
|
79
|
+
handleDragStart?: ((e: any) => void) | undefined;
|
|
80
|
+
router?: import('@tanstack/router-core').AnyRouter | undefined;
|
|
81
|
+
shadowDOMTarget?: ShadowRoot | undefined;
|
|
82
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
|
+
import { TanStackRouterDevtools as TanStackRouterDevtools$1 } from "./TanStackRouterDevtools.js";
|
|
3
|
+
import { TanStackRouterDevtoolsPanel as TanStackRouterDevtoolsPanel$1 } from "./TanStackRouterDevtoolsPanel.js";
|
|
4
|
+
const NullComponent = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "NullTanStackRouterDevtools",
|
|
6
|
+
setup() {
|
|
7
|
+
return () => null;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const TanStackRouterDevtools = process.env.NODE_ENV !== "development" ? NullComponent : TanStackRouterDevtools$1;
|
|
11
|
+
const TanStackRouterDevtoolsInProd = TanStackRouterDevtools$1;
|
|
12
|
+
const TanStackRouterDevtoolsPanel = process.env.NODE_ENV !== "development" ? NullComponent : TanStackRouterDevtoolsPanel$1;
|
|
13
|
+
const TanStackRouterDevtoolsPanelInProd = TanStackRouterDevtoolsPanel$1;
|
|
14
|
+
export {
|
|
15
|
+
TanStackRouterDevtools,
|
|
16
|
+
TanStackRouterDevtoolsInProd,
|
|
17
|
+
TanStackRouterDevtoolsPanel,
|
|
18
|
+
TanStackRouterDevtoolsPanelInProd
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import { defineComponent } from 'vue'\nimport { TanStackRouterDevtools as DevToolsComponent } from './TanStackRouterDevtools'\nimport { TanStackRouterDevtoolsPanel as DevToolsPanelComponent } from './TanStackRouterDevtoolsPanel'\n\n// Re-export types\nexport type { TanStackRouterDevtoolsOptions } from './TanStackRouterDevtools'\nexport type { TanStackRouterDevtoolsPanelOptions } from './TanStackRouterDevtoolsPanel'\n\n// Create a null component for production\nconst NullComponent = /* #__PURE__ */ defineComponent({\n name: 'NullTanStackRouterDevtools',\n setup() {\n return () => null\n },\n})\n\nexport const TanStackRouterDevtools =\n process.env.NODE_ENV !== 'development' ? NullComponent : DevToolsComponent\n\nexport const TanStackRouterDevtoolsInProd = DevToolsComponent\n\nexport const TanStackRouterDevtoolsPanel =\n process.env.NODE_ENV !== 'development'\n ? NullComponent\n : DevToolsPanelComponent\n\nexport const TanStackRouterDevtoolsPanelInProd = DevToolsPanelComponent\n"],"names":["NullComponent","defineComponent","name","setup","TanStackRouterDevtools","process","env","NODE_ENV","DevToolsComponent","TanStackRouterDevtoolsInProd","TanStackRouterDevtoolsPanel","DevToolsPanelComponent","TanStackRouterDevtoolsPanelInProd"],"mappings":";;;AASA,MAAMA,gBAAgCC,gCAAgB;AAAA,EACpDC,MAAM;AAAA,EACNC,QAAQ;AACN,WAAO,MAAM;AAAA,EACf;AACF,CAAC;AAEM,MAAMC,yBACXC,QAAQC,IAAIC,aAAa,gBAAgBP,gBAAgBQ;AAEpD,MAAMC,+BAA+BD;AAErC,MAAME,8BACXL,QAAQC,IAAIC,aAAa,gBACrBP,gBACAW;AAEC,MAAMC,oCAAoCD;"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-router-devtools",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.140.1",
|
|
4
|
+
"description": "Modern and scalable routing for Vue applications",
|
|
5
|
+
"author": "Tanner Linsley",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/TanStack/router.git",
|
|
10
|
+
"directory": "packages/vue-router-devtools"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://tanstack.com/router",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
|
+
},
|
|
5
17
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
"vue",
|
|
19
|
+
"location",
|
|
20
|
+
"router",
|
|
21
|
+
"routing",
|
|
22
|
+
"async",
|
|
23
|
+
"async router",
|
|
24
|
+
"typescript"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"types": "./dist/esm/index.d.ts",
|
|
28
|
+
"module": "./dist/esm/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/esm/index.d.ts",
|
|
33
|
+
"default": "./dist/esm/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"sideEffects": false,
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"src"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=12"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"vite": "^7.1.7",
|
|
48
|
+
"@tanstack/router-devtools-core": "1.140.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
|
52
|
+
"vue": "^3.5.13"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"vue": "^3.5.13",
|
|
56
|
+
"@tanstack/router-core": "^1.140.1",
|
|
57
|
+
"@tanstack/vue-router": "^1.140.1"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@tanstack/router-core": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
66
|
+
"test:eslint": "eslint ./src",
|
|
67
|
+
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
|
|
68
|
+
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
|
|
69
|
+
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
|
|
70
|
+
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
|
|
71
|
+
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
|
|
72
|
+
"test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
|
|
73
|
+
"test:types:ts59": "tsc",
|
|
74
|
+
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
|
|
75
|
+
"build": "vite build"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'
|
|
2
|
+
import { defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
|
+
import { useRouter, useRouterState } from '@tanstack/vue-router'
|
|
4
|
+
import type { AnyRouter } from '@tanstack/vue-router'
|
|
5
|
+
|
|
6
|
+
export interface TanStackRouterDevtoolsOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Set this true if you want the dev tools to default to being open
|
|
9
|
+
*/
|
|
10
|
+
initialIsOpen?: boolean
|
|
11
|
+
/**
|
|
12
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
13
|
+
*/
|
|
14
|
+
panelProps?: Record<string, any>
|
|
15
|
+
/**
|
|
16
|
+
* Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
17
|
+
*/
|
|
18
|
+
closeButtonProps?: Record<string, any>
|
|
19
|
+
/**
|
|
20
|
+
* Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
21
|
+
*/
|
|
22
|
+
toggleButtonProps?: Record<string, any>
|
|
23
|
+
/**
|
|
24
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
25
|
+
* Defaults to 'bottom-left'.
|
|
26
|
+
*/
|
|
27
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
28
|
+
/**
|
|
29
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
30
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
31
|
+
* Defaults to 'footer'.
|
|
32
|
+
*/
|
|
33
|
+
containerElement?: string | any
|
|
34
|
+
/**
|
|
35
|
+
* The router instance to use for the devtools.
|
|
36
|
+
*/
|
|
37
|
+
router?: AnyRouter
|
|
38
|
+
/**
|
|
39
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
40
|
+
*/
|
|
41
|
+
shadowDOMTarget?: ShadowRoot
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const TanStackRouterDevtools = /* #__PURE__ */ defineComponent({
|
|
45
|
+
name: 'TanStackRouterDevtools',
|
|
46
|
+
props: [
|
|
47
|
+
'initialIsOpen',
|
|
48
|
+
'panelProps',
|
|
49
|
+
'closeButtonProps',
|
|
50
|
+
'toggleButtonProps',
|
|
51
|
+
'position',
|
|
52
|
+
'containerElement',
|
|
53
|
+
'router',
|
|
54
|
+
'shadowDOMTarget',
|
|
55
|
+
] as unknown as undefined,
|
|
56
|
+
setup(props: TanStackRouterDevtoolsOptions) {
|
|
57
|
+
const devToolRef = ref<HTMLDivElement | null>(null)
|
|
58
|
+
|
|
59
|
+
const hookRouter = useRouter({ warn: false })
|
|
60
|
+
const activeRouter = props.router ?? hookRouter
|
|
61
|
+
|
|
62
|
+
const activeRouterState = useRouterState({ router: activeRouter })
|
|
63
|
+
|
|
64
|
+
const devtools = new TanStackRouterDevtoolsCore({
|
|
65
|
+
initialIsOpen: props.initialIsOpen,
|
|
66
|
+
panelProps: props.panelProps,
|
|
67
|
+
closeButtonProps: props.closeButtonProps,
|
|
68
|
+
toggleButtonProps: props.toggleButtonProps,
|
|
69
|
+
position: props.position,
|
|
70
|
+
containerElement: props.containerElement,
|
|
71
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
72
|
+
router: activeRouter,
|
|
73
|
+
routerState: activeRouterState.value,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// Update devtools when router changes
|
|
77
|
+
watch(
|
|
78
|
+
() => activeRouter,
|
|
79
|
+
(router) => {
|
|
80
|
+
devtools.setRouter(router)
|
|
81
|
+
},
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
// Update devtools when router state changes
|
|
85
|
+
watch(activeRouterState, (routerState) => {
|
|
86
|
+
devtools.setRouterState(routerState)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Update devtools when options change
|
|
90
|
+
watch(
|
|
91
|
+
() => [
|
|
92
|
+
props.initialIsOpen,
|
|
93
|
+
props.panelProps,
|
|
94
|
+
props.closeButtonProps,
|
|
95
|
+
props.toggleButtonProps,
|
|
96
|
+
props.position,
|
|
97
|
+
props.containerElement,
|
|
98
|
+
props.shadowDOMTarget,
|
|
99
|
+
],
|
|
100
|
+
() => {
|
|
101
|
+
devtools.setOptions({
|
|
102
|
+
initialIsOpen: props.initialIsOpen,
|
|
103
|
+
panelProps: props.panelProps,
|
|
104
|
+
closeButtonProps: props.closeButtonProps,
|
|
105
|
+
toggleButtonProps: props.toggleButtonProps,
|
|
106
|
+
position: props.position,
|
|
107
|
+
containerElement: props.containerElement,
|
|
108
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
onMounted(() => {
|
|
114
|
+
if (devToolRef.value) {
|
|
115
|
+
devtools.mount(devToolRef.value)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
onUnmounted(() => {
|
|
120
|
+
devtools.unmount()
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
return () => h('div', { ref: devToolRef })
|
|
124
|
+
},
|
|
125
|
+
})
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'
|
|
2
|
+
import { defineComponent, h, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
|
+
import { useRouter, useRouterState } from '@tanstack/vue-router'
|
|
4
|
+
import type { AnyRouter } from '@tanstack/vue-router'
|
|
5
|
+
|
|
6
|
+
export interface TanStackRouterDevtoolsPanelOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The standard style object used to style a component with inline styles
|
|
9
|
+
*/
|
|
10
|
+
style?: any
|
|
11
|
+
/**
|
|
12
|
+
* The standard class property used to style a component with classes
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
17
|
+
*/
|
|
18
|
+
isOpen?: boolean
|
|
19
|
+
/**
|
|
20
|
+
* A function that toggles the open and close state of the panel
|
|
21
|
+
*/
|
|
22
|
+
setIsOpen?: (isOpen: boolean) => void
|
|
23
|
+
/**
|
|
24
|
+
* Handles the opening and closing the devtools panel
|
|
25
|
+
*/
|
|
26
|
+
handleDragStart?: (e: any) => void
|
|
27
|
+
/**
|
|
28
|
+
* The router instance to use for the devtools.
|
|
29
|
+
*/
|
|
30
|
+
router?: AnyRouter
|
|
31
|
+
/**
|
|
32
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
33
|
+
*/
|
|
34
|
+
shadowDOMTarget?: ShadowRoot
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const TanStackRouterDevtoolsPanel = /* #__PURE__ */ defineComponent({
|
|
38
|
+
name: 'TanStackRouterDevtoolsPanel',
|
|
39
|
+
props: [
|
|
40
|
+
'style',
|
|
41
|
+
'className',
|
|
42
|
+
'isOpen',
|
|
43
|
+
'setIsOpen',
|
|
44
|
+
'handleDragStart',
|
|
45
|
+
'router',
|
|
46
|
+
'shadowDOMTarget',
|
|
47
|
+
] as unknown as undefined,
|
|
48
|
+
setup(props: TanStackRouterDevtoolsPanelOptions) {
|
|
49
|
+
const devToolRef = ref<HTMLDivElement | null>(null)
|
|
50
|
+
|
|
51
|
+
const hookRouter = useRouter({ warn: false })
|
|
52
|
+
const activeRouter = props.router ?? hookRouter
|
|
53
|
+
|
|
54
|
+
const activeRouterState = useRouterState({ router: activeRouter })
|
|
55
|
+
|
|
56
|
+
const devtools = new TanStackRouterDevtoolsPanelCore({
|
|
57
|
+
style: props.style,
|
|
58
|
+
className: props.className,
|
|
59
|
+
isOpen: props.isOpen,
|
|
60
|
+
setIsOpen: props.setIsOpen,
|
|
61
|
+
handleDragStart: props.handleDragStart,
|
|
62
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
63
|
+
router: activeRouter,
|
|
64
|
+
routerState: activeRouterState.value,
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Update devtools when router changes
|
|
68
|
+
watch(
|
|
69
|
+
() => activeRouter,
|
|
70
|
+
(router) => {
|
|
71
|
+
devtools.setRouter(router)
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
// Update devtools when router state changes
|
|
76
|
+
watch(activeRouterState, (routerState) => {
|
|
77
|
+
devtools.setRouterState(routerState)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// Update devtools when options change
|
|
81
|
+
watch(
|
|
82
|
+
() => [props.className, props.style, props.shadowDOMTarget],
|
|
83
|
+
() => {
|
|
84
|
+
devtools.setOptions({
|
|
85
|
+
className: props.className,
|
|
86
|
+
style: props.style,
|
|
87
|
+
shadowDOMTarget: props.shadowDOMTarget,
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
if (devToolRef.value) {
|
|
94
|
+
devtools.mount(devToolRef.value)
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
onUnmounted(() => {
|
|
99
|
+
devtools.unmount()
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
return () => h('div', { ref: devToolRef })
|
|
103
|
+
},
|
|
104
|
+
})
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineComponent } from 'vue'
|
|
2
|
+
import { TanStackRouterDevtools as DevToolsComponent } from './TanStackRouterDevtools'
|
|
3
|
+
import { TanStackRouterDevtoolsPanel as DevToolsPanelComponent } from './TanStackRouterDevtoolsPanel'
|
|
4
|
+
|
|
5
|
+
// Re-export types
|
|
6
|
+
export type { TanStackRouterDevtoolsOptions } from './TanStackRouterDevtools'
|
|
7
|
+
export type { TanStackRouterDevtoolsPanelOptions } from './TanStackRouterDevtoolsPanel'
|
|
8
|
+
|
|
9
|
+
// Create a null component for production
|
|
10
|
+
const NullComponent = /* #__PURE__ */ defineComponent({
|
|
11
|
+
name: 'NullTanStackRouterDevtools',
|
|
12
|
+
setup() {
|
|
13
|
+
return () => null
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const TanStackRouterDevtools =
|
|
18
|
+
process.env.NODE_ENV !== 'development' ? NullComponent : DevToolsComponent
|
|
19
|
+
|
|
20
|
+
export const TanStackRouterDevtoolsInProd = DevToolsComponent
|
|
21
|
+
|
|
22
|
+
export const TanStackRouterDevtoolsPanel =
|
|
23
|
+
process.env.NODE_ENV !== 'development'
|
|
24
|
+
? NullComponent
|
|
25
|
+
: DevToolsPanelComponent
|
|
26
|
+
|
|
27
|
+
export const TanStackRouterDevtoolsPanelInProd = DevToolsPanelComponent
|