@tanstack/solid-router-devtools 1.20.3-alpha.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 +5 -0
- package/dist/cjs/TanStackRouterDevtools.cjs +53 -0
- package/dist/cjs/TanStackRouterDevtools.cjs.map +1 -0
- package/dist/cjs/TanStackRouterDevtools.d.cts +41 -0
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs +49 -0
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs.map +1 -0
- package/dist/cjs/TanStackRouterDevtoolsPanel.d.cts +33 -0
- package/dist/cjs/index.cjs +17 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +6 -0
- package/dist/esm/TanStackRouterDevtools.d.ts +41 -0
- package/dist/esm/TanStackRouterDevtools.js +53 -0
- package/dist/esm/TanStackRouterDevtools.js.map +1 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.d.ts +33 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js +49 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/source/TanStackRouterDevtools.d.ts +41 -0
- package/dist/source/TanStackRouterDevtools.jsx +44 -0
- package/dist/source/TanStackRouterDevtools.jsx.map +1 -0
- package/dist/source/TanStackRouterDevtoolsPanel.d.ts +33 -0
- package/dist/source/TanStackRouterDevtoolsPanel.jsx +40 -0
- package/dist/source/TanStackRouterDevtoolsPanel.jsx.map +1 -0
- package/dist/source/index.d.ts +6 -0
- package/dist/source/index.jsx +15 -0
- package/dist/source/index.jsx.map +1 -0
- package/package.json +67 -0
- package/src/TanStackRouterDevtools.tsx +96 -0
- package/src/TanStackRouterDevtoolsPanel.tsx +87 -0
- package/src/index.tsx +22 -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
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const web = require("solid-js/web");
|
|
4
|
+
const solidRouter = require("@tanstack/solid-router");
|
|
5
|
+
const routerDevtoolsCore = require("@tanstack/router-devtools-core");
|
|
6
|
+
const solidJs = require("solid-js");
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ web.template(`<div>`);
|
|
8
|
+
const TanStackRouterDevtools = (props) => {
|
|
9
|
+
const activeRouter = props.router ?? solidRouter.useRouter();
|
|
10
|
+
const activeRouterState = solidRouter.useRouterState({
|
|
11
|
+
router: activeRouter
|
|
12
|
+
});
|
|
13
|
+
const usedProps = {
|
|
14
|
+
...props,
|
|
15
|
+
router: activeRouter,
|
|
16
|
+
routerState: activeRouterState
|
|
17
|
+
};
|
|
18
|
+
let devToolRef;
|
|
19
|
+
const [devtools] = solidJs.createSignal(new routerDevtoolsCore.TanStackRouterDevtoolsCore(usedProps));
|
|
20
|
+
solidJs.createEffect(() => {
|
|
21
|
+
devtools().setRouter(usedProps.router);
|
|
22
|
+
});
|
|
23
|
+
solidJs.createEffect(() => {
|
|
24
|
+
devtools().setRouterState(usedProps.routerState);
|
|
25
|
+
});
|
|
26
|
+
solidJs.createEffect(() => {
|
|
27
|
+
devtools().setOptions({
|
|
28
|
+
initialIsOpen: usedProps.initialIsOpen,
|
|
29
|
+
panelProps: usedProps.panelProps,
|
|
30
|
+
closeButtonProps: usedProps.closeButtonProps,
|
|
31
|
+
toggleButtonProps: usedProps.toggleButtonProps,
|
|
32
|
+
position: usedProps.position,
|
|
33
|
+
containerElement: usedProps.containerElement,
|
|
34
|
+
shadowDOMTarget: usedProps.shadowDOMTarget
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
solidJs.onMount(() => {
|
|
38
|
+
if (devToolRef) {
|
|
39
|
+
devtools().mount(devToolRef);
|
|
40
|
+
solidJs.onCleanup(() => {
|
|
41
|
+
devtools().unmount();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return (() => {
|
|
46
|
+
var _el$ = _tmpl$();
|
|
47
|
+
var _ref$ = devToolRef;
|
|
48
|
+
typeof _ref$ === "function" ? web.use(_ref$, _el$) : devToolRef = _el$;
|
|
49
|
+
return _el$;
|
|
50
|
+
})();
|
|
51
|
+
};
|
|
52
|
+
exports.TanStackRouterDevtools = TanStackRouterDevtools;
|
|
53
|
+
//# sourceMappingURL=TanStackRouterDevtools.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtools.cjs","sources":["../../src/TanStackRouterDevtools.tsx"],"sourcesContent":["import { useRouter, useRouterState } from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'\nimport { createEffect, createSignal, onCleanup, onMount } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { Component, JSX } from 'solid-js'\n\ninterface DevtoolsOptions {\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?: JSX.HTMLAttributes<HTMLDivElement>\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?: JSX.ButtonHTMLAttributes<HTMLButtonElement>\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?: JSX.ButtonHTMLAttributes<HTMLButtonElement>\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: Component<DevtoolsOptions> = (\n props,\n): JSX.Element | null => {\n const activeRouter = props.router ?? useRouter()\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const usedProps = {\n ...props,\n router: activeRouter,\n routerState: activeRouterState,\n }\n\n let devToolRef: HTMLDivElement | undefined\n const [devtools] = createSignal(new TanStackRouterDevtoolsCore(usedProps))\n\n // Update devtools when props change\n createEffect(() => {\n devtools().setRouter(usedProps.router)\n })\n\n createEffect(() => {\n devtools().setRouterState(usedProps.routerState)\n })\n\n createEffect(() => {\n devtools().setOptions({\n initialIsOpen: usedProps.initialIsOpen,\n panelProps: usedProps.panelProps,\n closeButtonProps: usedProps.closeButtonProps,\n toggleButtonProps: usedProps.toggleButtonProps,\n position: usedProps.position,\n containerElement: usedProps.containerElement,\n shadowDOMTarget: usedProps.shadowDOMTarget,\n })\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n\n return (\n <>\n <div ref={devToolRef} />\n </>\n )\n}\n"],"names":["TanStackRouterDevtools","props","activeRouter","router","useRouter","activeRouterState","useRouterState","usedProps","routerState","devToolRef","devtools","createSignal","TanStackRouterDevtoolsCore","createEffect","setRouter","setRouterState","setOptions","initialIsOpen","panelProps","closeButtonProps","toggleButtonProps","position","containerElement","shadowDOMTarget","onMount","mount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use"],"mappings":";;;;;;;AA4CaA,MAAAA,yBAAqDA,CAChEC,UACuB;AACjBC,QAAAA,eAAeD,MAAME,UAAUC,sBAAU;AAC/C,QAAMC,oBAAoBC,YAAAA,eAAe;AAAA,IAAEH,QAAQD;AAAAA,EAAAA,CAAc;AAEjE,QAAMK,YAAY;AAAA,IAChB,GAAGN;AAAAA,IACHE,QAAQD;AAAAA,IACRM,aAAaH;AAAAA,EACf;AAEII,MAAAA;AACJ,QAAM,CAACC,QAAQ,IAAIC,QAAAA,aAAa,IAAIC,mBAAAA,2BAA2BL,SAAS,CAAC;AAGzEM,UAAAA,aAAa,MAAM;AACR,eAAEC,UAAUP,UAAUJ,MAAM;AAAA,EAAA,CACtC;AAEDU,UAAAA,aAAa,MAAM;AACR,eAAEE,eAAeR,UAAUC,WAAW;AAAA,EAAA,CAChD;AAEDK,UAAAA,aAAa,MAAM;AACjBH,aAAAA,EAAWM,WAAW;AAAA,MACpBC,eAAeV,UAAUU;AAAAA,MACzBC,YAAYX,UAAUW;AAAAA,MACtBC,kBAAkBZ,UAAUY;AAAAA,MAC5BC,mBAAmBb,UAAUa;AAAAA,MAC7BC,UAAUd,UAAUc;AAAAA,MACpBC,kBAAkBf,UAAUe;AAAAA,MAC5BC,iBAAiBhB,UAAUgB;AAAAA,IAAAA,CAC5B;AAAA,EAAA,CACF;AAEDC,UAAAA,QAAQ,MAAM;AACZ,QAAIf,YAAY;AACL,eAAA,EAAEgB,MAAMhB,UAAU;AAE3BiB,cAAAA,UAAU,MAAM;AACdhB,iBAAAA,EAAWiB,QAAQ;AAAA,MAAA,CACpB;AAAA,IAAA;AAAA,EACH,CACD;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAA;AAAA,QAAAC,QAEcrB;AAAU,WAAAqB,UAAAC,aAAAA,IAAAA,IAAAD,OAAAF,IAAA,IAAVnB,aAAUmB;AAAAA,WAAAA;AAAAA,EAAAA,GAAA;AAG1B;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import { Component, JSX } from 'solid-js';
|
|
3
|
+
interface DevtoolsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Set this true if you want the dev tools to default to being open
|
|
6
|
+
*/
|
|
7
|
+
initialIsOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
10
|
+
*/
|
|
11
|
+
panelProps?: JSX.HTMLAttributes<HTMLDivElement>;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*/
|
|
15
|
+
closeButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*/
|
|
19
|
+
toggleButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
22
|
+
* Defaults to 'bottom-left'.
|
|
23
|
+
*/
|
|
24
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
25
|
+
/**
|
|
26
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
27
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
28
|
+
* Defaults to 'footer'.
|
|
29
|
+
*/
|
|
30
|
+
containerElement?: string | any;
|
|
31
|
+
/**
|
|
32
|
+
* The router instance to use for the devtools.
|
|
33
|
+
*/
|
|
34
|
+
router?: AnyRouter;
|
|
35
|
+
/**
|
|
36
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
37
|
+
*/
|
|
38
|
+
shadowDOMTarget?: ShadowRoot;
|
|
39
|
+
}
|
|
40
|
+
export declare const TanStackRouterDevtools: Component<DevtoolsOptions>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const web = require("solid-js/web");
|
|
4
|
+
const solidRouter = require("@tanstack/solid-router");
|
|
5
|
+
const routerDevtoolsCore = require("@tanstack/router-devtools-core");
|
|
6
|
+
const solidJs = require("solid-js");
|
|
7
|
+
var _tmpl$ = /* @__PURE__ */ web.template(`<div>`);
|
|
8
|
+
const TanStackRouterDevtoolsPanel = (props) => {
|
|
9
|
+
const activeRouter = props.router ?? solidRouter.useRouter();
|
|
10
|
+
const activeRouterState = solidRouter.useRouterState({
|
|
11
|
+
router: activeRouter
|
|
12
|
+
});
|
|
13
|
+
const usedProps = {
|
|
14
|
+
...props,
|
|
15
|
+
router: activeRouter,
|
|
16
|
+
routerState: activeRouterState
|
|
17
|
+
};
|
|
18
|
+
let devToolRef;
|
|
19
|
+
const [devtools] = solidJs.createSignal(new routerDevtoolsCore.TanStackRouterDevtoolsPanelCore(usedProps));
|
|
20
|
+
solidJs.createEffect(() => {
|
|
21
|
+
devtools().setRouter(usedProps.router);
|
|
22
|
+
});
|
|
23
|
+
solidJs.createEffect(() => {
|
|
24
|
+
devtools().setRouterState(usedProps.routerState);
|
|
25
|
+
});
|
|
26
|
+
solidJs.createEffect(() => {
|
|
27
|
+
devtools().setOptions({
|
|
28
|
+
className: usedProps.className,
|
|
29
|
+
style: usedProps.style,
|
|
30
|
+
shadowDOMTarget: usedProps.shadowDOMTarget
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
solidJs.onMount(() => {
|
|
34
|
+
if (devToolRef) {
|
|
35
|
+
devtools().mount(devToolRef);
|
|
36
|
+
solidJs.onCleanup(() => {
|
|
37
|
+
devtools().unmount();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return (() => {
|
|
42
|
+
var _el$ = _tmpl$();
|
|
43
|
+
var _ref$ = devToolRef;
|
|
44
|
+
typeof _ref$ === "function" ? web.use(_ref$, _el$) : devToolRef = _el$;
|
|
45
|
+
return _el$;
|
|
46
|
+
})();
|
|
47
|
+
};
|
|
48
|
+
exports.TanStackRouterDevtoolsPanel = TanStackRouterDevtoolsPanel;
|
|
49
|
+
//# sourceMappingURL=TanStackRouterDevtoolsPanel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtoolsPanel.cjs","sources":["../../src/TanStackRouterDevtoolsPanel.tsx"],"sourcesContent":["import { useRouter, useRouterState } from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'\nimport { createEffect, createSignal, onCleanup, onMount } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { Component, JSX } from 'solid-js'\n\nexport interface DevtoolsPanelOptions {\n /**\n * The standard React style object used to style a component with inline styles\n */\n style?: JSX.CSSProperties\n /**\n * The standard React 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 * A boolean variable indicating if the \"lite\" version of the library is being used\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: Component<DevtoolsPanelOptions> = (\n props,\n): JSX.Element | null => {\n const activeRouter = props.router ?? useRouter()\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const usedProps = {\n ...props,\n router: activeRouter,\n routerState: activeRouterState,\n }\n\n let devToolRef: HTMLDivElement | undefined\n const [devtools] = createSignal(\n new TanStackRouterDevtoolsPanelCore(usedProps),\n )\n\n // Update devtools when props change\n createEffect(() => {\n devtools().setRouter(usedProps.router)\n })\n\n createEffect(() => {\n devtools().setRouterState(usedProps.routerState)\n })\n\n createEffect(() => {\n devtools().setOptions({\n className: usedProps.className,\n style: usedProps.style,\n shadowDOMTarget: usedProps.shadowDOMTarget,\n })\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n\n return (\n <>\n <div ref={devToolRef} />\n </>\n )\n}\n"],"names":["TanStackRouterDevtoolsPanel","props","activeRouter","router","useRouter","activeRouterState","useRouterState","usedProps","routerState","devToolRef","devtools","createSignal","TanStackRouterDevtoolsPanelCore","createEffect","setRouter","setRouterState","setOptions","className","style","shadowDOMTarget","onMount","mount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use"],"mappings":";;;;;;;AAqCaA,MAAAA,8BAA+DA,CAC1EC,UACuB;AACjBC,QAAAA,eAAeD,MAAME,UAAUC,sBAAU;AAC/C,QAAMC,oBAAoBC,YAAAA,eAAe;AAAA,IAAEH,QAAQD;AAAAA,EAAAA,CAAc;AAEjE,QAAMK,YAAY;AAAA,IAChB,GAAGN;AAAAA,IACHE,QAAQD;AAAAA,IACRM,aAAaH;AAAAA,EACf;AAEII,MAAAA;AACJ,QAAM,CAACC,QAAQ,IAAIC,QAAAA,aACjB,IAAIC,mBAAAA,gCAAgCL,SAAS,CAC/C;AAGAM,UAAAA,aAAa,MAAM;AACR,eAAEC,UAAUP,UAAUJ,MAAM;AAAA,EAAA,CACtC;AAEDU,UAAAA,aAAa,MAAM;AACR,eAAEE,eAAeR,UAAUC,WAAW;AAAA,EAAA,CAChD;AAEDK,UAAAA,aAAa,MAAM;AACjBH,aAAAA,EAAWM,WAAW;AAAA,MACpBC,WAAWV,UAAUU;AAAAA,MACrBC,OAAOX,UAAUW;AAAAA,MACjBC,iBAAiBZ,UAAUY;AAAAA,IAAAA,CAC5B;AAAA,EAAA,CACF;AAEDC,UAAAA,QAAQ,MAAM;AACZ,QAAIX,YAAY;AACL,eAAA,EAAEY,MAAMZ,UAAU;AAE3Ba,cAAAA,UAAU,MAAM;AACdZ,iBAAAA,EAAWa,QAAQ;AAAA,MAAA,CACpB;AAAA,IAAA;AAAA,EACH,CACD;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAA;AAAA,QAAAC,QAEcjB;AAAU,WAAAiB,UAAAC,aAAAA,IAAAA,IAAAD,OAAAF,IAAA,IAAVf,aAAUe;AAAAA,WAAAA;AAAAA,EAAAA,GAAA;AAG1B;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import { Component, JSX } from 'solid-js';
|
|
3
|
+
export interface DevtoolsPanelOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The standard React style object used to style a component with inline styles
|
|
6
|
+
*/
|
|
7
|
+
style?: JSX.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* The standard React class property used to style a component with classes
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
14
|
+
*/
|
|
15
|
+
isOpen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A function that toggles the open and close state of the panel
|
|
18
|
+
*/
|
|
19
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Handles the opening and closing the devtools panel
|
|
22
|
+
*/
|
|
23
|
+
handleDragStart?: (e: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* A boolean variable indicating if the "lite" version of the library is being used
|
|
26
|
+
*/
|
|
27
|
+
router?: AnyRouter;
|
|
28
|
+
/**
|
|
29
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
30
|
+
*/
|
|
31
|
+
shadowDOMTarget?: ShadowRoot;
|
|
32
|
+
}
|
|
33
|
+
export declare const TanStackRouterDevtoolsPanel: Component<DevtoolsPanelOptions>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TanStackRouterDevtools$1 = require("./TanStackRouterDevtools.cjs");
|
|
4
|
+
const TanStackRouterDevtoolsPanel$1 = require("./TanStackRouterDevtoolsPanel.cjs");
|
|
5
|
+
const TanStackRouterDevtools = process.env.NODE_ENV !== "development" ? function() {
|
|
6
|
+
return null;
|
|
7
|
+
} : TanStackRouterDevtools$1.TanStackRouterDevtools;
|
|
8
|
+
const TanStackRouterDevtoolsInProd = TanStackRouterDevtools$1.TanStackRouterDevtools;
|
|
9
|
+
const TanStackRouterDevtoolsPanel = process.env.NODE_ENV !== "development" ? function() {
|
|
10
|
+
return null;
|
|
11
|
+
} : TanStackRouterDevtoolsPanel$1.TanStackRouterDevtoolsPanel;
|
|
12
|
+
const TanStackRouterDevtoolsPanelInProd = TanStackRouterDevtoolsPanel$1.TanStackRouterDevtoolsPanel;
|
|
13
|
+
exports.TanStackRouterDevtools = TanStackRouterDevtools;
|
|
14
|
+
exports.TanStackRouterDevtoolsInProd = TanStackRouterDevtoolsInProd;
|
|
15
|
+
exports.TanStackRouterDevtoolsPanel = TanStackRouterDevtoolsPanel;
|
|
16
|
+
exports.TanStackRouterDevtoolsPanelInProd = TanStackRouterDevtoolsPanelInProd;
|
|
17
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.tsx"],"sourcesContent":["import * as Devtools from './TanStackRouterDevtools'\nimport * as DevtoolsPanel from './TanStackRouterDevtoolsPanel'\n\nexport const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'] =\n Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.TanStackRouterDevtoolsPanel\n\nexport const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n DevtoolsPanel.TanStackRouterDevtoolsPanel\n"],"names":["TanStackRouterDevtools","process","env","NODE_ENV","Devtools","TanStackRouterDevtoolsInProd","TanStackRouterDevtoolsPanel","DevtoolsPanel","TanStackRouterDevtoolsPanelInProd"],"mappings":";;;;AAGO,MAAMA,yBACXC,QAAQC,IAAIC,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAC,yBAAAA;AAEC,MAAMC,+BACXD,yBAAAA;AAEK,MAAME,8BACXL,QAAQC,IAAIC,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAI,8BAAAA;AAEC,MAAMC,oCACXD,8BAAAA;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Devtools from './TanStackRouterDevtools.cjs';
|
|
2
|
+
import * as DevtoolsPanel from './TanStackRouterDevtoolsPanel.cjs';
|
|
3
|
+
export declare const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'];
|
|
4
|
+
export declare const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'];
|
|
5
|
+
export declare const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
6
|
+
export declare const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import { Component, JSX } from 'solid-js';
|
|
3
|
+
interface DevtoolsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Set this true if you want the dev tools to default to being open
|
|
6
|
+
*/
|
|
7
|
+
initialIsOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
10
|
+
*/
|
|
11
|
+
panelProps?: JSX.HTMLAttributes<HTMLDivElement>;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*/
|
|
15
|
+
closeButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*/
|
|
19
|
+
toggleButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
22
|
+
* Defaults to 'bottom-left'.
|
|
23
|
+
*/
|
|
24
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
25
|
+
/**
|
|
26
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
27
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
28
|
+
* Defaults to 'footer'.
|
|
29
|
+
*/
|
|
30
|
+
containerElement?: string | any;
|
|
31
|
+
/**
|
|
32
|
+
* The router instance to use for the devtools.
|
|
33
|
+
*/
|
|
34
|
+
router?: AnyRouter;
|
|
35
|
+
/**
|
|
36
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
37
|
+
*/
|
|
38
|
+
shadowDOMTarget?: ShadowRoot;
|
|
39
|
+
}
|
|
40
|
+
export declare const TanStackRouterDevtools: Component<DevtoolsOptions>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { template, use } from "solid-js/web";
|
|
2
|
+
import { useRouter, useRouterState } from "@tanstack/solid-router";
|
|
3
|
+
import { TanStackRouterDevtoolsCore } from "@tanstack/router-devtools-core";
|
|
4
|
+
import { createSignal, createEffect, onMount, onCleanup } from "solid-js";
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
6
|
+
const TanStackRouterDevtools = (props) => {
|
|
7
|
+
const activeRouter = props.router ?? useRouter();
|
|
8
|
+
const activeRouterState = useRouterState({
|
|
9
|
+
router: activeRouter
|
|
10
|
+
});
|
|
11
|
+
const usedProps = {
|
|
12
|
+
...props,
|
|
13
|
+
router: activeRouter,
|
|
14
|
+
routerState: activeRouterState
|
|
15
|
+
};
|
|
16
|
+
let devToolRef;
|
|
17
|
+
const [devtools] = createSignal(new TanStackRouterDevtoolsCore(usedProps));
|
|
18
|
+
createEffect(() => {
|
|
19
|
+
devtools().setRouter(usedProps.router);
|
|
20
|
+
});
|
|
21
|
+
createEffect(() => {
|
|
22
|
+
devtools().setRouterState(usedProps.routerState);
|
|
23
|
+
});
|
|
24
|
+
createEffect(() => {
|
|
25
|
+
devtools().setOptions({
|
|
26
|
+
initialIsOpen: usedProps.initialIsOpen,
|
|
27
|
+
panelProps: usedProps.panelProps,
|
|
28
|
+
closeButtonProps: usedProps.closeButtonProps,
|
|
29
|
+
toggleButtonProps: usedProps.toggleButtonProps,
|
|
30
|
+
position: usedProps.position,
|
|
31
|
+
containerElement: usedProps.containerElement,
|
|
32
|
+
shadowDOMTarget: usedProps.shadowDOMTarget
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
onMount(() => {
|
|
36
|
+
if (devToolRef) {
|
|
37
|
+
devtools().mount(devToolRef);
|
|
38
|
+
onCleanup(() => {
|
|
39
|
+
devtools().unmount();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return (() => {
|
|
44
|
+
var _el$ = _tmpl$();
|
|
45
|
+
var _ref$ = devToolRef;
|
|
46
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : devToolRef = _el$;
|
|
47
|
+
return _el$;
|
|
48
|
+
})();
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
TanStackRouterDevtools
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=TanStackRouterDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtools.js","sources":["../../src/TanStackRouterDevtools.tsx"],"sourcesContent":["import { useRouter, useRouterState } from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'\nimport { createEffect, createSignal, onCleanup, onMount } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { Component, JSX } from 'solid-js'\n\ninterface DevtoolsOptions {\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?: JSX.HTMLAttributes<HTMLDivElement>\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?: JSX.ButtonHTMLAttributes<HTMLButtonElement>\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?: JSX.ButtonHTMLAttributes<HTMLButtonElement>\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: Component<DevtoolsOptions> = (\n props,\n): JSX.Element | null => {\n const activeRouter = props.router ?? useRouter()\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const usedProps = {\n ...props,\n router: activeRouter,\n routerState: activeRouterState,\n }\n\n let devToolRef: HTMLDivElement | undefined\n const [devtools] = createSignal(new TanStackRouterDevtoolsCore(usedProps))\n\n // Update devtools when props change\n createEffect(() => {\n devtools().setRouter(usedProps.router)\n })\n\n createEffect(() => {\n devtools().setRouterState(usedProps.routerState)\n })\n\n createEffect(() => {\n devtools().setOptions({\n initialIsOpen: usedProps.initialIsOpen,\n panelProps: usedProps.panelProps,\n closeButtonProps: usedProps.closeButtonProps,\n toggleButtonProps: usedProps.toggleButtonProps,\n position: usedProps.position,\n containerElement: usedProps.containerElement,\n shadowDOMTarget: usedProps.shadowDOMTarget,\n })\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n\n return (\n <>\n <div ref={devToolRef} />\n </>\n )\n}\n"],"names":["TanStackRouterDevtools","props","activeRouter","router","useRouter","activeRouterState","useRouterState","usedProps","routerState","devToolRef","devtools","createSignal","TanStackRouterDevtoolsCore","createEffect","setRouter","setRouterState","setOptions","initialIsOpen","panelProps","closeButtonProps","toggleButtonProps","position","containerElement","shadowDOMTarget","onMount","mount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use"],"mappings":";;;;;AA4CaA,MAAAA,yBAAqDA,CAChEC,UACuB;AACjBC,QAAAA,eAAeD,MAAME,UAAUC,UAAU;AAC/C,QAAMC,oBAAoBC,eAAe;AAAA,IAAEH,QAAQD;AAAAA,EAAAA,CAAc;AAEjE,QAAMK,YAAY;AAAA,IAChB,GAAGN;AAAAA,IACHE,QAAQD;AAAAA,IACRM,aAAaH;AAAAA,EACf;AAEII,MAAAA;AACJ,QAAM,CAACC,QAAQ,IAAIC,aAAa,IAAIC,2BAA2BL,SAAS,CAAC;AAGzEM,eAAa,MAAM;AACR,eAAEC,UAAUP,UAAUJ,MAAM;AAAA,EAAA,CACtC;AAEDU,eAAa,MAAM;AACR,eAAEE,eAAeR,UAAUC,WAAW;AAAA,EAAA,CAChD;AAEDK,eAAa,MAAM;AACjBH,aAAAA,EAAWM,WAAW;AAAA,MACpBC,eAAeV,UAAUU;AAAAA,MACzBC,YAAYX,UAAUW;AAAAA,MACtBC,kBAAkBZ,UAAUY;AAAAA,MAC5BC,mBAAmBb,UAAUa;AAAAA,MAC7BC,UAAUd,UAAUc;AAAAA,MACpBC,kBAAkBf,UAAUe;AAAAA,MAC5BC,iBAAiBhB,UAAUgB;AAAAA,IAAAA,CAC5B;AAAA,EAAA,CACF;AAEDC,UAAQ,MAAM;AACZ,QAAIf,YAAY;AACL,eAAA,EAAEgB,MAAMhB,UAAU;AAE3BiB,gBAAU,MAAM;AACdhB,iBAAAA,EAAWiB,QAAQ;AAAA,MAAA,CACpB;AAAA,IAAA;AAAA,EACH,CACD;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAA;AAAA,QAAAC,QAEcrB;AAAU,WAAAqB,UAAAC,aAAAA,IAAAD,OAAAF,IAAA,IAAVnB,aAAUmB;AAAAA,WAAAA;AAAAA,EAAAA,GAAA;AAG1B;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import { Component, JSX } from 'solid-js';
|
|
3
|
+
export interface DevtoolsPanelOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The standard React style object used to style a component with inline styles
|
|
6
|
+
*/
|
|
7
|
+
style?: JSX.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* The standard React class property used to style a component with classes
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
14
|
+
*/
|
|
15
|
+
isOpen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A function that toggles the open and close state of the panel
|
|
18
|
+
*/
|
|
19
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Handles the opening and closing the devtools panel
|
|
22
|
+
*/
|
|
23
|
+
handleDragStart?: (e: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* A boolean variable indicating if the "lite" version of the library is being used
|
|
26
|
+
*/
|
|
27
|
+
router?: AnyRouter;
|
|
28
|
+
/**
|
|
29
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
30
|
+
*/
|
|
31
|
+
shadowDOMTarget?: ShadowRoot;
|
|
32
|
+
}
|
|
33
|
+
export declare const TanStackRouterDevtoolsPanel: Component<DevtoolsPanelOptions>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { template, use } from "solid-js/web";
|
|
2
|
+
import { useRouter, useRouterState } from "@tanstack/solid-router";
|
|
3
|
+
import { TanStackRouterDevtoolsPanelCore } from "@tanstack/router-devtools-core";
|
|
4
|
+
import { createSignal, createEffect, onMount, onCleanup } from "solid-js";
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
6
|
+
const TanStackRouterDevtoolsPanel = (props) => {
|
|
7
|
+
const activeRouter = props.router ?? useRouter();
|
|
8
|
+
const activeRouterState = useRouterState({
|
|
9
|
+
router: activeRouter
|
|
10
|
+
});
|
|
11
|
+
const usedProps = {
|
|
12
|
+
...props,
|
|
13
|
+
router: activeRouter,
|
|
14
|
+
routerState: activeRouterState
|
|
15
|
+
};
|
|
16
|
+
let devToolRef;
|
|
17
|
+
const [devtools] = createSignal(new TanStackRouterDevtoolsPanelCore(usedProps));
|
|
18
|
+
createEffect(() => {
|
|
19
|
+
devtools().setRouter(usedProps.router);
|
|
20
|
+
});
|
|
21
|
+
createEffect(() => {
|
|
22
|
+
devtools().setRouterState(usedProps.routerState);
|
|
23
|
+
});
|
|
24
|
+
createEffect(() => {
|
|
25
|
+
devtools().setOptions({
|
|
26
|
+
className: usedProps.className,
|
|
27
|
+
style: usedProps.style,
|
|
28
|
+
shadowDOMTarget: usedProps.shadowDOMTarget
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
onMount(() => {
|
|
32
|
+
if (devToolRef) {
|
|
33
|
+
devtools().mount(devToolRef);
|
|
34
|
+
onCleanup(() => {
|
|
35
|
+
devtools().unmount();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return (() => {
|
|
40
|
+
var _el$ = _tmpl$();
|
|
41
|
+
var _ref$ = devToolRef;
|
|
42
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : devToolRef = _el$;
|
|
43
|
+
return _el$;
|
|
44
|
+
})();
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
TanStackRouterDevtoolsPanel
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=TanStackRouterDevtoolsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtoolsPanel.js","sources":["../../src/TanStackRouterDevtoolsPanel.tsx"],"sourcesContent":["import { useRouter, useRouterState } from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'\nimport { createEffect, createSignal, onCleanup, onMount } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { Component, JSX } from 'solid-js'\n\nexport interface DevtoolsPanelOptions {\n /**\n * The standard React style object used to style a component with inline styles\n */\n style?: JSX.CSSProperties\n /**\n * The standard React 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 * A boolean variable indicating if the \"lite\" version of the library is being used\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: Component<DevtoolsPanelOptions> = (\n props,\n): JSX.Element | null => {\n const activeRouter = props.router ?? useRouter()\n const activeRouterState = useRouterState({ router: activeRouter })\n\n const usedProps = {\n ...props,\n router: activeRouter,\n routerState: activeRouterState,\n }\n\n let devToolRef: HTMLDivElement | undefined\n const [devtools] = createSignal(\n new TanStackRouterDevtoolsPanelCore(usedProps),\n )\n\n // Update devtools when props change\n createEffect(() => {\n devtools().setRouter(usedProps.router)\n })\n\n createEffect(() => {\n devtools().setRouterState(usedProps.routerState)\n })\n\n createEffect(() => {\n devtools().setOptions({\n className: usedProps.className,\n style: usedProps.style,\n shadowDOMTarget: usedProps.shadowDOMTarget,\n })\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n\n return (\n <>\n <div ref={devToolRef} />\n </>\n )\n}\n"],"names":["TanStackRouterDevtoolsPanel","props","activeRouter","router","useRouter","activeRouterState","useRouterState","usedProps","routerState","devToolRef","devtools","createSignal","TanStackRouterDevtoolsPanelCore","createEffect","setRouter","setRouterState","setOptions","className","style","shadowDOMTarget","onMount","mount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use"],"mappings":";;;;;AAqCaA,MAAAA,8BAA+DA,CAC1EC,UACuB;AACjBC,QAAAA,eAAeD,MAAME,UAAUC,UAAU;AAC/C,QAAMC,oBAAoBC,eAAe;AAAA,IAAEH,QAAQD;AAAAA,EAAAA,CAAc;AAEjE,QAAMK,YAAY;AAAA,IAChB,GAAGN;AAAAA,IACHE,QAAQD;AAAAA,IACRM,aAAaH;AAAAA,EACf;AAEII,MAAAA;AACJ,QAAM,CAACC,QAAQ,IAAIC,aACjB,IAAIC,gCAAgCL,SAAS,CAC/C;AAGAM,eAAa,MAAM;AACR,eAAEC,UAAUP,UAAUJ,MAAM;AAAA,EAAA,CACtC;AAEDU,eAAa,MAAM;AACR,eAAEE,eAAeR,UAAUC,WAAW;AAAA,EAAA,CAChD;AAEDK,eAAa,MAAM;AACjBH,aAAAA,EAAWM,WAAW;AAAA,MACpBC,WAAWV,UAAUU;AAAAA,MACrBC,OAAOX,UAAUW;AAAAA,MACjBC,iBAAiBZ,UAAUY;AAAAA,IAAAA,CAC5B;AAAA,EAAA,CACF;AAEDC,UAAQ,MAAM;AACZ,QAAIX,YAAY;AACL,eAAA,EAAEY,MAAMZ,UAAU;AAE3Ba,gBAAU,MAAM;AACdZ,iBAAAA,EAAWa,QAAQ;AAAA,MAAA,CACpB;AAAA,IAAA;AAAA,EACH,CACD;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAA;AAAA,QAAAC,QAEcjB;AAAU,WAAAiB,UAAAC,aAAAA,IAAAD,OAAAF,IAAA,IAAVf,aAAUe;AAAAA,WAAAA;AAAAA,EAAAA,GAAA;AAG1B;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Devtools from './TanStackRouterDevtools.js';
|
|
2
|
+
import * as DevtoolsPanel from './TanStackRouterDevtoolsPanel.js';
|
|
3
|
+
export declare const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'];
|
|
4
|
+
export declare const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'];
|
|
5
|
+
export declare const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
6
|
+
export declare const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TanStackRouterDevtools as TanStackRouterDevtools$1 } from "./TanStackRouterDevtools.js";
|
|
2
|
+
import { TanStackRouterDevtoolsPanel as TanStackRouterDevtoolsPanel$1 } from "./TanStackRouterDevtoolsPanel.js";
|
|
3
|
+
const TanStackRouterDevtools = process.env.NODE_ENV !== "development" ? function() {
|
|
4
|
+
return null;
|
|
5
|
+
} : TanStackRouterDevtools$1;
|
|
6
|
+
const TanStackRouterDevtoolsInProd = TanStackRouterDevtools$1;
|
|
7
|
+
const TanStackRouterDevtoolsPanel = process.env.NODE_ENV !== "development" ? function() {
|
|
8
|
+
return null;
|
|
9
|
+
} : TanStackRouterDevtoolsPanel$1;
|
|
10
|
+
const TanStackRouterDevtoolsPanelInProd = TanStackRouterDevtoolsPanel$1;
|
|
11
|
+
export {
|
|
12
|
+
TanStackRouterDevtools,
|
|
13
|
+
TanStackRouterDevtoolsInProd,
|
|
14
|
+
TanStackRouterDevtoolsPanel,
|
|
15
|
+
TanStackRouterDevtoolsPanelInProd
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as Devtools from './TanStackRouterDevtools'\nimport * as DevtoolsPanel from './TanStackRouterDevtoolsPanel'\n\nexport const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'] =\n Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.TanStackRouterDevtoolsPanel\n\nexport const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n DevtoolsPanel.TanStackRouterDevtoolsPanel\n"],"names":["TanStackRouterDevtools","process","env","NODE_ENV","Devtools","TanStackRouterDevtoolsInProd","TanStackRouterDevtoolsPanel","DevtoolsPanel","TanStackRouterDevtoolsPanelInProd"],"mappings":";;AAGO,MAAMA,yBACXC,QAAQC,IAAIC,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAC;AAEC,MAAMC,+BACXD;AAEK,MAAME,8BACXL,QAAQC,IAAIC,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAI;AAEC,MAAMC,oCACXD;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import type { Component, JSX } from 'solid-js';
|
|
3
|
+
interface DevtoolsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Set this true if you want the dev tools to default to being open
|
|
6
|
+
*/
|
|
7
|
+
initialIsOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
10
|
+
*/
|
|
11
|
+
panelProps?: JSX.HTMLAttributes<HTMLDivElement>;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*/
|
|
15
|
+
closeButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*/
|
|
19
|
+
toggleButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
22
|
+
* Defaults to 'bottom-left'.
|
|
23
|
+
*/
|
|
24
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
25
|
+
/**
|
|
26
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
27
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
28
|
+
* Defaults to 'footer'.
|
|
29
|
+
*/
|
|
30
|
+
containerElement?: string | any;
|
|
31
|
+
/**
|
|
32
|
+
* The router instance to use for the devtools.
|
|
33
|
+
*/
|
|
34
|
+
router?: AnyRouter;
|
|
35
|
+
/**
|
|
36
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
37
|
+
*/
|
|
38
|
+
shadowDOMTarget?: ShadowRoot;
|
|
39
|
+
}
|
|
40
|
+
export declare const TanStackRouterDevtools: Component<DevtoolsOptions>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useRouter, useRouterState } from '@tanstack/solid-router';
|
|
2
|
+
import { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core';
|
|
3
|
+
import { createEffect, createSignal, onCleanup, onMount } from 'solid-js';
|
|
4
|
+
export const TanStackRouterDevtools = (props) => {
|
|
5
|
+
const activeRouter = props.router ?? useRouter();
|
|
6
|
+
const activeRouterState = useRouterState({ router: activeRouter });
|
|
7
|
+
const usedProps = {
|
|
8
|
+
...props,
|
|
9
|
+
router: activeRouter,
|
|
10
|
+
routerState: activeRouterState,
|
|
11
|
+
};
|
|
12
|
+
let devToolRef;
|
|
13
|
+
const [devtools] = createSignal(new TanStackRouterDevtoolsCore(usedProps));
|
|
14
|
+
// Update devtools when props change
|
|
15
|
+
createEffect(() => {
|
|
16
|
+
devtools().setRouter(usedProps.router);
|
|
17
|
+
});
|
|
18
|
+
createEffect(() => {
|
|
19
|
+
devtools().setRouterState(usedProps.routerState);
|
|
20
|
+
});
|
|
21
|
+
createEffect(() => {
|
|
22
|
+
devtools().setOptions({
|
|
23
|
+
initialIsOpen: usedProps.initialIsOpen,
|
|
24
|
+
panelProps: usedProps.panelProps,
|
|
25
|
+
closeButtonProps: usedProps.closeButtonProps,
|
|
26
|
+
toggleButtonProps: usedProps.toggleButtonProps,
|
|
27
|
+
position: usedProps.position,
|
|
28
|
+
containerElement: usedProps.containerElement,
|
|
29
|
+
shadowDOMTarget: usedProps.shadowDOMTarget,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
onMount(() => {
|
|
33
|
+
if (devToolRef) {
|
|
34
|
+
devtools().mount(devToolRef);
|
|
35
|
+
onCleanup(() => {
|
|
36
|
+
devtools().unmount();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return (<>
|
|
41
|
+
<div ref={devToolRef}/>
|
|
42
|
+
</>);
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=TanStackRouterDevtools.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtools.jsx","sourceRoot":"","sources":["../../src/TanStackRouterDevtools.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AA0CzE,MAAM,CAAC,MAAM,sBAAsB,GAA+B,CAChE,KAAK,EACe,EAAE;IACtB,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,CAAA;IAChD,MAAM,iBAAiB,GAAG,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAA;IAElE,MAAM,SAAS,GAAG;QAChB,GAAG,KAAK;QACR,MAAM,EAAE,YAAY;QACpB,WAAW,EAAE,iBAAiB;KAC/B,CAAA;IAED,IAAI,UAAsC,CAAA;IAC1C,MAAM,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAA;IAE1E,oCAAoC;IACpC,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,UAAU,CAAC;YACpB,aAAa,EAAE,SAAS,CAAC,aAAa;YACtC,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,iBAAiB,EAAE,SAAS,CAAC,iBAAiB;YAC9C,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,eAAe,EAAE,SAAS,CAAC,eAAe;SAC3C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,EAAE,CAAC;YACf,QAAQ,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YAE5B,SAAS,CAAC,GAAG,EAAE;gBACb,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAA;YACtB,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CACL,EACE;MAAA,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,EACvB;IAAA,GAAG,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AnyRouter } from '@tanstack/solid-router';
|
|
2
|
+
import type { Component, JSX } from 'solid-js';
|
|
3
|
+
export interface DevtoolsPanelOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The standard React style object used to style a component with inline styles
|
|
6
|
+
*/
|
|
7
|
+
style?: JSX.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* The standard React class property used to style a component with classes
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
14
|
+
*/
|
|
15
|
+
isOpen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A function that toggles the open and close state of the panel
|
|
18
|
+
*/
|
|
19
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Handles the opening and closing the devtools panel
|
|
22
|
+
*/
|
|
23
|
+
handleDragStart?: (e: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* A boolean variable indicating if the "lite" version of the library is being used
|
|
26
|
+
*/
|
|
27
|
+
router?: AnyRouter;
|
|
28
|
+
/**
|
|
29
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
30
|
+
*/
|
|
31
|
+
shadowDOMTarget?: ShadowRoot;
|
|
32
|
+
}
|
|
33
|
+
export declare const TanStackRouterDevtoolsPanel: Component<DevtoolsPanelOptions>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRouter, useRouterState } from '@tanstack/solid-router';
|
|
2
|
+
import { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core';
|
|
3
|
+
import { createEffect, createSignal, onCleanup, onMount } from 'solid-js';
|
|
4
|
+
export const TanStackRouterDevtoolsPanel = (props) => {
|
|
5
|
+
const activeRouter = props.router ?? useRouter();
|
|
6
|
+
const activeRouterState = useRouterState({ router: activeRouter });
|
|
7
|
+
const usedProps = {
|
|
8
|
+
...props,
|
|
9
|
+
router: activeRouter,
|
|
10
|
+
routerState: activeRouterState,
|
|
11
|
+
};
|
|
12
|
+
let devToolRef;
|
|
13
|
+
const [devtools] = createSignal(new TanStackRouterDevtoolsPanelCore(usedProps));
|
|
14
|
+
// Update devtools when props change
|
|
15
|
+
createEffect(() => {
|
|
16
|
+
devtools().setRouter(usedProps.router);
|
|
17
|
+
});
|
|
18
|
+
createEffect(() => {
|
|
19
|
+
devtools().setRouterState(usedProps.routerState);
|
|
20
|
+
});
|
|
21
|
+
createEffect(() => {
|
|
22
|
+
devtools().setOptions({
|
|
23
|
+
className: usedProps.className,
|
|
24
|
+
style: usedProps.style,
|
|
25
|
+
shadowDOMTarget: usedProps.shadowDOMTarget,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
onMount(() => {
|
|
29
|
+
if (devToolRef) {
|
|
30
|
+
devtools().mount(devToolRef);
|
|
31
|
+
onCleanup(() => {
|
|
32
|
+
devtools().unmount();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return (<>
|
|
37
|
+
<div ref={devToolRef}/>
|
|
38
|
+
</>);
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=TanStackRouterDevtoolsPanel.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtoolsPanel.jsx","sourceRoot":"","sources":["../../src/TanStackRouterDevtoolsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAmCzE,MAAM,CAAC,MAAM,2BAA2B,GAAoC,CAC1E,KAAK,EACe,EAAE;IACtB,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,CAAA;IAChD,MAAM,iBAAiB,GAAG,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAA;IAElE,MAAM,SAAS,GAAG;QAChB,GAAG,KAAK;QACR,MAAM,EAAE,YAAY;QACpB,WAAW,EAAE,iBAAiB;KAC/B,CAAA;IAED,IAAI,UAAsC,CAAA;IAC1C,MAAM,CAAC,QAAQ,CAAC,GAAG,YAAY,CAC7B,IAAI,+BAA+B,CAAC,SAAS,CAAC,CAC/C,CAAA;IAED,oCAAoC;IACpC,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,YAAY,CAAC,GAAG,EAAE;QAChB,QAAQ,EAAE,CAAC,UAAU,CAAC;YACpB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,eAAe,EAAE,SAAS,CAAC,eAAe;SAC3C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,EAAE,CAAC;YACf,QAAQ,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YAE5B,SAAS,CAAC,GAAG,EAAE;gBACb,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAA;YACtB,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CACL,EACE;MAAA,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,EACvB;IAAA,GAAG,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Devtools from './TanStackRouterDevtools';
|
|
2
|
+
import * as DevtoolsPanel from './TanStackRouterDevtoolsPanel';
|
|
3
|
+
export declare const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'];
|
|
4
|
+
export declare const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'];
|
|
5
|
+
export declare const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
6
|
+
export declare const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Devtools from './TanStackRouterDevtools';
|
|
2
|
+
import * as DevtoolsPanel from './TanStackRouterDevtoolsPanel';
|
|
3
|
+
export const TanStackRouterDevtools = process.env.NODE_ENV !== 'development'
|
|
4
|
+
? function () {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
: Devtools.TanStackRouterDevtools;
|
|
8
|
+
export const TanStackRouterDevtoolsInProd = Devtools.TanStackRouterDevtools;
|
|
9
|
+
export const TanStackRouterDevtoolsPanel = process.env.NODE_ENV !== 'development'
|
|
10
|
+
? function () {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
: DevtoolsPanel.TanStackRouterDevtoolsPanel;
|
|
14
|
+
export const TanStackRouterDevtoolsPanelInProd = DevtoolsPanel.TanStackRouterDevtoolsPanel;
|
|
15
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAA;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GACjC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACpC,CAAC,CAAC;QACE,OAAO,IAAI,CAAA;IACb,CAAC;IACH,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAA;AAErC,MAAM,CAAC,MAAM,4BAA4B,GACvC,QAAQ,CAAC,sBAAsB,CAAA;AAEjC,MAAM,CAAC,MAAM,2BAA2B,GACtC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACpC,CAAC,CAAC;QACE,OAAO,IAAI,CAAA;IACb,CAAC;IACH,CAAC,CAAC,aAAa,CAAC,2BAA2B,CAAA;AAE/C,MAAM,CAAC,MAAM,iCAAiC,GAC5C,aAAa,CAAC,2BAA2B,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tanstack/solid-router-devtools",
|
|
3
|
+
"version": "1.20.3-alpha.1",
|
|
4
|
+
"description": "Modern and scalable routing for Solid applications",
|
|
5
|
+
"author": "Tanner Linsley",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/TanStack/router.git",
|
|
10
|
+
"directory": "packages/solid-router-devtools"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://tanstack.com/router",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
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
|
+
"main": "./dist/cjs/index.cjs",
|
|
29
|
+
"module": "./dist/esm/index.js",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"solid": {
|
|
33
|
+
"types": "./dist/source/index.d.ts",
|
|
34
|
+
"default": "./dist/source/index.jsx"
|
|
35
|
+
},
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/esm/index.d.ts",
|
|
38
|
+
"default": "./dist/esm/index.js"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/cjs/index.d.cts",
|
|
42
|
+
"default": "./dist/cjs/index.cjs"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"sideEffects": false,
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"src"
|
|
51
|
+
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=12"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"solid-js": "^1.9.5",
|
|
57
|
+
"@tanstack/router-devtools-core": "^1.20.3-alpha.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"vite-plugin-solid": "^2.11.6"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"solid-js": "^1.9.5",
|
|
64
|
+
"@tanstack/solid-router": "^1.20.3-alpha.1"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {}
|
|
67
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { useRouter, useRouterState } from '@tanstack/solid-router'
|
|
2
|
+
import { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'
|
|
3
|
+
import { createEffect, createSignal, onCleanup, onMount } from 'solid-js'
|
|
4
|
+
import type { AnyRouter } from '@tanstack/solid-router'
|
|
5
|
+
import type { Component, JSX } from 'solid-js'
|
|
6
|
+
|
|
7
|
+
interface DevtoolsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Set this true if you want the dev tools to default to being open
|
|
10
|
+
*/
|
|
11
|
+
initialIsOpen?: boolean
|
|
12
|
+
/**
|
|
13
|
+
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
14
|
+
*/
|
|
15
|
+
panelProps?: JSX.HTMLAttributes<HTMLDivElement>
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*/
|
|
19
|
+
closeButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>
|
|
20
|
+
/**
|
|
21
|
+
* 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.
|
|
22
|
+
*/
|
|
23
|
+
toggleButtonProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement>
|
|
24
|
+
/**
|
|
25
|
+
* The position of the TanStack Router logo to open and close the devtools panel.
|
|
26
|
+
* Defaults to 'bottom-left'.
|
|
27
|
+
*/
|
|
28
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
29
|
+
/**
|
|
30
|
+
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
31
|
+
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
32
|
+
* Defaults to 'footer'.
|
|
33
|
+
*/
|
|
34
|
+
containerElement?: string | any
|
|
35
|
+
/**
|
|
36
|
+
* The router instance to use for the devtools.
|
|
37
|
+
*/
|
|
38
|
+
router?: AnyRouter
|
|
39
|
+
/**
|
|
40
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
41
|
+
*/
|
|
42
|
+
shadowDOMTarget?: ShadowRoot
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const TanStackRouterDevtools: Component<DevtoolsOptions> = (
|
|
46
|
+
props,
|
|
47
|
+
): JSX.Element | null => {
|
|
48
|
+
const activeRouter = props.router ?? useRouter()
|
|
49
|
+
const activeRouterState = useRouterState({ router: activeRouter })
|
|
50
|
+
|
|
51
|
+
const usedProps = {
|
|
52
|
+
...props,
|
|
53
|
+
router: activeRouter,
|
|
54
|
+
routerState: activeRouterState,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let devToolRef: HTMLDivElement | undefined
|
|
58
|
+
const [devtools] = createSignal(new TanStackRouterDevtoolsCore(usedProps))
|
|
59
|
+
|
|
60
|
+
// Update devtools when props change
|
|
61
|
+
createEffect(() => {
|
|
62
|
+
devtools().setRouter(usedProps.router)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
createEffect(() => {
|
|
66
|
+
devtools().setRouterState(usedProps.routerState)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
createEffect(() => {
|
|
70
|
+
devtools().setOptions({
|
|
71
|
+
initialIsOpen: usedProps.initialIsOpen,
|
|
72
|
+
panelProps: usedProps.panelProps,
|
|
73
|
+
closeButtonProps: usedProps.closeButtonProps,
|
|
74
|
+
toggleButtonProps: usedProps.toggleButtonProps,
|
|
75
|
+
position: usedProps.position,
|
|
76
|
+
containerElement: usedProps.containerElement,
|
|
77
|
+
shadowDOMTarget: usedProps.shadowDOMTarget,
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
onMount(() => {
|
|
82
|
+
if (devToolRef) {
|
|
83
|
+
devtools().mount(devToolRef)
|
|
84
|
+
|
|
85
|
+
onCleanup(() => {
|
|
86
|
+
devtools().unmount()
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<div ref={devToolRef} />
|
|
94
|
+
</>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useRouter, useRouterState } from '@tanstack/solid-router'
|
|
2
|
+
import { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'
|
|
3
|
+
import { createEffect, createSignal, onCleanup, onMount } from 'solid-js'
|
|
4
|
+
import type { AnyRouter } from '@tanstack/solid-router'
|
|
5
|
+
import type { Component, JSX } from 'solid-js'
|
|
6
|
+
|
|
7
|
+
export interface DevtoolsPanelOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The standard React style object used to style a component with inline styles
|
|
10
|
+
*/
|
|
11
|
+
style?: JSX.CSSProperties
|
|
12
|
+
/**
|
|
13
|
+
* The standard React class property used to style a component with classes
|
|
14
|
+
*/
|
|
15
|
+
className?: string
|
|
16
|
+
/**
|
|
17
|
+
* A boolean variable indicating whether the panel is open or closed
|
|
18
|
+
*/
|
|
19
|
+
isOpen?: boolean
|
|
20
|
+
/**
|
|
21
|
+
* A function that toggles the open and close state of the panel
|
|
22
|
+
*/
|
|
23
|
+
setIsOpen?: (isOpen: boolean) => void
|
|
24
|
+
/**
|
|
25
|
+
* Handles the opening and closing the devtools panel
|
|
26
|
+
*/
|
|
27
|
+
handleDragStart?: (e: any) => void
|
|
28
|
+
/**
|
|
29
|
+
* A boolean variable indicating if the "lite" version of the library is being used
|
|
30
|
+
*/
|
|
31
|
+
router?: AnyRouter
|
|
32
|
+
/**
|
|
33
|
+
* Use this to attach the devtool's styles to specific element in the DOM.
|
|
34
|
+
*/
|
|
35
|
+
shadowDOMTarget?: ShadowRoot
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const TanStackRouterDevtoolsPanel: Component<DevtoolsPanelOptions> = (
|
|
39
|
+
props,
|
|
40
|
+
): JSX.Element | null => {
|
|
41
|
+
const activeRouter = props.router ?? useRouter()
|
|
42
|
+
const activeRouterState = useRouterState({ router: activeRouter })
|
|
43
|
+
|
|
44
|
+
const usedProps = {
|
|
45
|
+
...props,
|
|
46
|
+
router: activeRouter,
|
|
47
|
+
routerState: activeRouterState,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let devToolRef: HTMLDivElement | undefined
|
|
51
|
+
const [devtools] = createSignal(
|
|
52
|
+
new TanStackRouterDevtoolsPanelCore(usedProps),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
// Update devtools when props change
|
|
56
|
+
createEffect(() => {
|
|
57
|
+
devtools().setRouter(usedProps.router)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
createEffect(() => {
|
|
61
|
+
devtools().setRouterState(usedProps.routerState)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
createEffect(() => {
|
|
65
|
+
devtools().setOptions({
|
|
66
|
+
className: usedProps.className,
|
|
67
|
+
style: usedProps.style,
|
|
68
|
+
shadowDOMTarget: usedProps.shadowDOMTarget,
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
onMount(() => {
|
|
73
|
+
if (devToolRef) {
|
|
74
|
+
devtools().mount(devToolRef)
|
|
75
|
+
|
|
76
|
+
onCleanup(() => {
|
|
77
|
+
devtools().unmount()
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<div ref={devToolRef} />
|
|
85
|
+
</>
|
|
86
|
+
)
|
|
87
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Devtools from './TanStackRouterDevtools'
|
|
2
|
+
import * as DevtoolsPanel from './TanStackRouterDevtoolsPanel'
|
|
3
|
+
|
|
4
|
+
export const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'] =
|
|
5
|
+
process.env.NODE_ENV !== 'development'
|
|
6
|
+
? function () {
|
|
7
|
+
return null
|
|
8
|
+
}
|
|
9
|
+
: Devtools.TanStackRouterDevtools
|
|
10
|
+
|
|
11
|
+
export const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'] =
|
|
12
|
+
Devtools.TanStackRouterDevtools
|
|
13
|
+
|
|
14
|
+
export const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =
|
|
15
|
+
process.env.NODE_ENV !== 'development'
|
|
16
|
+
? function () {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
: DevtoolsPanel.TanStackRouterDevtoolsPanel
|
|
20
|
+
|
|
21
|
+
export const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =
|
|
22
|
+
DevtoolsPanel.TanStackRouterDevtoolsPanel
|