@tanstack/router-devtools 1.111.11 → 1.112.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AgeTicker.cjs +58 -0
- package/dist/cjs/AgeTicker.cjs.map +1 -0
- package/dist/cjs/AgeTicker.d.cts +5 -0
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs +421 -0
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs.map +1 -0
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.d.cts +3 -0
- package/dist/cjs/TanStackRouterDevtools.cjs +177 -0
- package/dist/cjs/TanStackRouterDevtools.cjs.map +1 -0
- package/dist/cjs/{devtools.d.cts → TanStackRouterDevtools.d.cts} +0 -31
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs +21 -0
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs.map +1 -0
- package/dist/cjs/TanStackRouterDevtoolsPanel.d.cts +33 -0
- package/dist/cjs/index.cjs +4 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/useStyles.cjs +570 -0
- package/dist/cjs/useStyles.cjs.map +1 -0
- package/dist/cjs/useStyles.d.cts +52 -0
- package/dist/esm/AgeTicker.d.ts +5 -0
- package/dist/esm/AgeTicker.js +58 -0
- package/dist/esm/AgeTicker.js.map +1 -0
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.d.ts +3 -0
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.js +421 -0
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.js.map +1 -0
- package/dist/esm/{devtools.d.ts → TanStackRouterDevtools.d.ts} +0 -31
- package/dist/esm/TanStackRouterDevtools.js +177 -0
- package/dist/esm/TanStackRouterDevtools.js.map +1 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.d.ts +33 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js +21 -0
- package/dist/esm/TanStackRouterDevtoolsPanel.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useStyles.d.ts +52 -0
- package/dist/esm/useStyles.js +553 -0
- package/dist/esm/useStyles.js.map +1 -0
- package/package.json +2 -2
- package/src/AgeTicker.tsx +73 -0
- package/src/BaseTanStackRouterDevtoolsPanel.tsx +488 -0
- package/src/TanStackRouterDevtools.tsx +250 -0
- package/src/TanStackRouterDevtoolsPanel.tsx +54 -0
- package/src/index.tsx +2 -1
- package/src/useStyles.tsx +589 -0
- package/dist/cjs/devtools.cjs +0 -1212
- package/dist/cjs/devtools.cjs.map +0 -1
- package/dist/esm/devtools.js +0 -1195
- package/dist/esm/devtools.js.map +0 -1
- package/src/devtools.tsx +0 -1443
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import React__default from "react";
|
|
4
|
+
import { ShadowDomTargetContext, DevtoolsOnCloseContext } from "./context.js";
|
|
5
|
+
import { useSafeState, useIsMounted } from "./utils.js";
|
|
6
|
+
import { BaseTanStackRouterDevtoolsPanel } from "./BaseTanStackRouterDevtoolsPanel.js";
|
|
7
|
+
import useLocalStorage from "./useLocalStorage.js";
|
|
8
|
+
import { TanStackLogo } from "./logo.js";
|
|
9
|
+
import { useStyles } from "./useStyles.js";
|
|
10
|
+
function TanStackRouterDevtools(props) {
|
|
11
|
+
const { shadowDOMTarget } = props;
|
|
12
|
+
return /* @__PURE__ */ jsx(ShadowDomTargetContext.Provider, { value: shadowDOMTarget, children: /* @__PURE__ */ jsx(FloatingTanStackRouterDevtools, { ...props }) });
|
|
13
|
+
}
|
|
14
|
+
function FloatingTanStackRouterDevtools({
|
|
15
|
+
initialIsOpen,
|
|
16
|
+
panelProps = {},
|
|
17
|
+
closeButtonProps = {},
|
|
18
|
+
toggleButtonProps = {},
|
|
19
|
+
position = "bottom-left",
|
|
20
|
+
containerElement: Container = "footer",
|
|
21
|
+
router,
|
|
22
|
+
shadowDOMTarget
|
|
23
|
+
}) {
|
|
24
|
+
const [rootEl, setRootEl] = React__default.useState();
|
|
25
|
+
const panelRef = React__default.useRef(null);
|
|
26
|
+
const [isOpen, setIsOpen] = useLocalStorage(
|
|
27
|
+
"tanstackRouterDevtoolsOpen",
|
|
28
|
+
initialIsOpen
|
|
29
|
+
);
|
|
30
|
+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage(
|
|
31
|
+
"tanstackRouterDevtoolsHeight",
|
|
32
|
+
null
|
|
33
|
+
);
|
|
34
|
+
const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false);
|
|
35
|
+
const [isResizing, setIsResizing] = useSafeState(false);
|
|
36
|
+
const isMounted = useIsMounted();
|
|
37
|
+
const styles = useStyles();
|
|
38
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
39
|
+
if (startEvent.button !== 0) return;
|
|
40
|
+
setIsResizing(true);
|
|
41
|
+
const dragInfo = {
|
|
42
|
+
originalHeight: (panelElement == null ? void 0 : panelElement.getBoundingClientRect().height) ?? 0,
|
|
43
|
+
pageY: startEvent.pageY
|
|
44
|
+
};
|
|
45
|
+
const run = (moveEvent) => {
|
|
46
|
+
const delta = dragInfo.pageY - moveEvent.pageY;
|
|
47
|
+
const newHeight = dragInfo.originalHeight + delta;
|
|
48
|
+
setDevtoolsHeight(newHeight);
|
|
49
|
+
if (newHeight < 70) {
|
|
50
|
+
setIsOpen(false);
|
|
51
|
+
} else {
|
|
52
|
+
setIsOpen(true);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const unsub = () => {
|
|
56
|
+
setIsResizing(false);
|
|
57
|
+
document.removeEventListener("mousemove", run);
|
|
58
|
+
document.removeEventListener("mouseUp", unsub);
|
|
59
|
+
};
|
|
60
|
+
document.addEventListener("mousemove", run);
|
|
61
|
+
document.addEventListener("mouseup", unsub);
|
|
62
|
+
};
|
|
63
|
+
const isButtonClosed = isOpen ?? false;
|
|
64
|
+
React__default.useEffect(() => {
|
|
65
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
66
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
67
|
+
React__default.useEffect(() => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (isResolvedOpen) {
|
|
70
|
+
const previousValue = (_a = rootEl == null ? void 0 : rootEl.parentElement) == null ? void 0 : _a.style.paddingBottom;
|
|
71
|
+
const run = () => {
|
|
72
|
+
var _a2;
|
|
73
|
+
const containerHeight = (_a2 = panelRef.current) == null ? void 0 : _a2.getBoundingClientRect().height;
|
|
74
|
+
if (rootEl == null ? void 0 : rootEl.parentElement) {
|
|
75
|
+
rootEl.parentElement.style.paddingBottom = `${containerHeight}px`;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
run();
|
|
79
|
+
if (typeof window !== "undefined") {
|
|
80
|
+
window.addEventListener("resize", run);
|
|
81
|
+
return () => {
|
|
82
|
+
window.removeEventListener("resize", run);
|
|
83
|
+
if ((rootEl == null ? void 0 : rootEl.parentElement) && typeof previousValue === "string") {
|
|
84
|
+
rootEl.parentElement.style.paddingBottom = previousValue;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}, [isResolvedOpen, rootEl == null ? void 0 : rootEl.parentElement]);
|
|
91
|
+
React__default.useEffect(() => {
|
|
92
|
+
if (rootEl) {
|
|
93
|
+
const el = rootEl;
|
|
94
|
+
const fontSize = getComputedStyle(el).fontSize;
|
|
95
|
+
el.style.setProperty("--tsrd-font-size", fontSize);
|
|
96
|
+
}
|
|
97
|
+
}, [rootEl]);
|
|
98
|
+
const { style: panelStyle = {}, ...otherPanelProps } = panelProps;
|
|
99
|
+
const {
|
|
100
|
+
style: closeButtonStyle = {},
|
|
101
|
+
onClick: onCloseClick,
|
|
102
|
+
...otherCloseButtonProps
|
|
103
|
+
} = closeButtonProps;
|
|
104
|
+
const {
|
|
105
|
+
onClick: onToggleClick,
|
|
106
|
+
className: toggleButtonClassName,
|
|
107
|
+
...otherToggleButtonProps
|
|
108
|
+
} = toggleButtonProps;
|
|
109
|
+
if (!isMounted) return null;
|
|
110
|
+
const resolvedHeight = devtoolsHeight ?? 500;
|
|
111
|
+
return /* @__PURE__ */ jsxs(Container, { ref: setRootEl, className: "TanStackRouterDevtools", children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
DevtoolsOnCloseContext.Provider,
|
|
114
|
+
{
|
|
115
|
+
value: {
|
|
116
|
+
onCloseClick: onCloseClick ?? (() => {
|
|
117
|
+
})
|
|
118
|
+
},
|
|
119
|
+
children: /* @__PURE__ */ jsx(
|
|
120
|
+
BaseTanStackRouterDevtoolsPanel,
|
|
121
|
+
{
|
|
122
|
+
ref: panelRef,
|
|
123
|
+
...otherPanelProps,
|
|
124
|
+
router,
|
|
125
|
+
className: clsx(
|
|
126
|
+
styles.devtoolsPanelContainer,
|
|
127
|
+
styles.devtoolsPanelContainerVisibility(!!isOpen),
|
|
128
|
+
styles.devtoolsPanelContainerResizing(isResizing),
|
|
129
|
+
styles.devtoolsPanelContainerAnimation(
|
|
130
|
+
isResolvedOpen,
|
|
131
|
+
resolvedHeight + 16
|
|
132
|
+
)
|
|
133
|
+
),
|
|
134
|
+
style: {
|
|
135
|
+
height: resolvedHeight,
|
|
136
|
+
...panelStyle
|
|
137
|
+
},
|
|
138
|
+
isOpen: isResolvedOpen,
|
|
139
|
+
setIsOpen,
|
|
140
|
+
handleDragStart: (e) => handleDragStart(panelRef.current, e),
|
|
141
|
+
shadowDOMTarget
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ jsxs(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
type: "button",
|
|
150
|
+
...otherToggleButtonProps,
|
|
151
|
+
"aria-label": "Open TanStack Router Devtools",
|
|
152
|
+
onClick: (e) => {
|
|
153
|
+
setIsOpen(true);
|
|
154
|
+
onToggleClick && onToggleClick(e);
|
|
155
|
+
},
|
|
156
|
+
className: clsx(
|
|
157
|
+
styles.mainCloseBtn,
|
|
158
|
+
styles.mainCloseBtnPosition(position),
|
|
159
|
+
styles.mainCloseBtnAnimation(!isButtonClosed),
|
|
160
|
+
toggleButtonClassName
|
|
161
|
+
),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsxs("div", { className: styles.mainCloseBtnIconContainer, children: [
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnIconOuter, children: /* @__PURE__ */ jsx(TanStackLogo, {}) }),
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnIconInner, children: /* @__PURE__ */ jsx(TanStackLogo, {}) })
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnDivider, children: "-" }),
|
|
168
|
+
/* @__PURE__ */ jsx("div", { className: styles.routerLogoCloseButton, children: "TanStack Router" })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
TanStackRouterDevtools
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=TanStackRouterDevtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtools.js","sources":["../../src/TanStackRouterDevtools.tsx"],"sourcesContent":["import { clsx as cx } from 'clsx'\nimport React from 'react'\nimport { DevtoolsOnCloseContext, ShadowDomTargetContext } from './context'\nimport { useIsMounted, useSafeState } from './utils'\nimport { BaseTanStackRouterDevtoolsPanel } from './BaseTanStackRouterDevtoolsPanel'\nimport useLocalStorage from './useLocalStorage'\nimport { TanStackLogo } from './logo'\nimport { useStyles } from './useStyles'\nimport type { AnyRouter } from '@tanstack/react-router'\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?: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >\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?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\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?: React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\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 * 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 function TanStackRouterDevtools(\n props: DevtoolsOptions,\n): React.ReactElement | null {\n const { shadowDOMTarget } = props\n\n return (\n <ShadowDomTargetContext.Provider value={shadowDOMTarget}>\n <FloatingTanStackRouterDevtools {...props} />\n </ShadowDomTargetContext.Provider>\n )\n}\n\nfunction FloatingTanStackRouterDevtools({\n initialIsOpen,\n panelProps = {},\n closeButtonProps = {},\n toggleButtonProps = {},\n position = 'bottom-left',\n containerElement: Container = 'footer',\n router,\n shadowDOMTarget,\n}: DevtoolsOptions): React.ReactElement | null {\n const [rootEl, setRootEl] = React.useState<HTMLDivElement>()\n const panelRef = React.useRef<HTMLDivElement>(null)\n const [isOpen, setIsOpen] = useLocalStorage(\n 'tanstackRouterDevtoolsOpen',\n initialIsOpen,\n )\n const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage<number | null>(\n 'tanstackRouterDevtoolsHeight',\n null,\n )\n const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false)\n const [isResizing, setIsResizing] = useSafeState(false)\n const isMounted = useIsMounted()\n const styles = useStyles()\n\n const handleDragStart = (\n panelElement: HTMLDivElement | null,\n startEvent: React.MouseEvent<HTMLDivElement, MouseEvent>,\n ) => {\n if (startEvent.button !== 0) return // Only allow left click for drag\n\n setIsResizing(true)\n\n const dragInfo = {\n originalHeight: panelElement?.getBoundingClientRect().height ?? 0,\n pageY: startEvent.pageY,\n }\n\n const run = (moveEvent: MouseEvent) => {\n const delta = dragInfo.pageY - moveEvent.pageY\n const newHeight = dragInfo.originalHeight + delta\n\n setDevtoolsHeight(newHeight)\n\n if (newHeight < 70) {\n setIsOpen(false)\n } else {\n setIsOpen(true)\n }\n }\n\n const unsub = () => {\n setIsResizing(false)\n document.removeEventListener('mousemove', run)\n document.removeEventListener('mouseUp', unsub)\n }\n\n document.addEventListener('mousemove', run)\n document.addEventListener('mouseup', unsub)\n }\n\n const isButtonClosed = isOpen ?? false\n\n React.useEffect(() => {\n setIsResolvedOpen(isOpen ?? false)\n }, [isOpen, isResolvedOpen, setIsResolvedOpen])\n\n React.useEffect(() => {\n if (isResolvedOpen) {\n const previousValue = rootEl?.parentElement?.style.paddingBottom\n\n const run = () => {\n const containerHeight = panelRef.current?.getBoundingClientRect().height\n if (rootEl?.parentElement) {\n rootEl.parentElement.style.paddingBottom = `${containerHeight}px`\n }\n }\n\n run()\n\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', run)\n\n return () => {\n window.removeEventListener('resize', run)\n if (rootEl?.parentElement && typeof previousValue === 'string') {\n rootEl.parentElement.style.paddingBottom = previousValue\n }\n }\n }\n }\n return\n }, [isResolvedOpen, rootEl?.parentElement])\n\n React.useEffect(() => {\n if (rootEl) {\n const el = rootEl\n const fontSize = getComputedStyle(el).fontSize\n el.style.setProperty('--tsrd-font-size', fontSize)\n }\n }, [rootEl])\n\n const { style: panelStyle = {}, ...otherPanelProps } = panelProps\n\n const {\n style: closeButtonStyle = {},\n onClick: onCloseClick,\n ...otherCloseButtonProps\n } = closeButtonProps\n\n const {\n onClick: onToggleClick,\n className: toggleButtonClassName,\n ...otherToggleButtonProps\n } = toggleButtonProps\n\n // Do not render on the server\n if (!isMounted) return null\n\n const resolvedHeight = devtoolsHeight ?? 500\n\n return (\n <Container ref={setRootEl} className=\"TanStackRouterDevtools\">\n <DevtoolsOnCloseContext.Provider\n value={{\n onCloseClick: onCloseClick ?? (() => {}),\n }}\n >\n <BaseTanStackRouterDevtoolsPanel\n ref={panelRef as any}\n {...otherPanelProps}\n router={router}\n className={cx(\n styles.devtoolsPanelContainer,\n styles.devtoolsPanelContainerVisibility(!!isOpen),\n styles.devtoolsPanelContainerResizing(isResizing),\n styles.devtoolsPanelContainerAnimation(\n isResolvedOpen,\n resolvedHeight + 16,\n ),\n )}\n style={{\n height: resolvedHeight,\n ...panelStyle,\n }}\n isOpen={isResolvedOpen}\n setIsOpen={setIsOpen}\n handleDragStart={(e) => handleDragStart(panelRef.current, e)}\n shadowDOMTarget={shadowDOMTarget}\n />\n </DevtoolsOnCloseContext.Provider>\n\n <button\n type=\"button\"\n {...otherToggleButtonProps}\n aria-label=\"Open TanStack Router Devtools\"\n onClick={(e) => {\n setIsOpen(true)\n onToggleClick && onToggleClick(e)\n }}\n className={cx(\n styles.mainCloseBtn,\n styles.mainCloseBtnPosition(position),\n styles.mainCloseBtnAnimation(!isButtonClosed),\n toggleButtonClassName,\n )}\n >\n <div className={styles.mainCloseBtnIconContainer}>\n <div className={styles.mainCloseBtnIconOuter}>\n <TanStackLogo />\n </div>\n <div className={styles.mainCloseBtnIconInner}>\n <TanStackLogo />\n </div>\n </div>\n <div className={styles.mainCloseBtnDivider}>-</div>\n <div className={styles.routerLogoCloseButton}>TanStack Router</div>\n </button>\n </Container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C,SAAI,WAAW,OAAO,uBACrB,UAAA,oBAAC,eAAa,CAAA,GAChB;AAAA,gCACC,OAAI,EAAA,WAAW,OAAO,uBACrB,UAAA,oBAAC,gBAAa,EAChB,CAAA;AAAA,UAAA,GACF;AAAA,UACC,oBAAA,OAAA,EAAI,WAAW,OAAO,qBAAqB,UAAC,KAAA;AAAA,UAC5C,oBAAA,OAAA,EAAI,WAAW,OAAO,uBAAuB,UAAe,kBAAA,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC/D,GACF;AAEJ;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AnyRouter } from '@tanstack/react-router';
|
|
3
|
+
export interface DevtoolsPanelOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The standard React style object used to style a component with inline styles
|
|
6
|
+
*/
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* The standard React className 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: React.MouseEvent<HTMLDivElement, MouseEvent>) => 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: React.ForwardRefExoticComponent<DevtoolsPanelOptions & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import { ShadowDomTargetContext, DevtoolsOnCloseContext } from "./context.js";
|
|
4
|
+
import { BaseTanStackRouterDevtoolsPanel } from "./BaseTanStackRouterDevtoolsPanel.js";
|
|
5
|
+
const TanStackRouterDevtoolsPanel = React__default.forwardRef(function TanStackRouterDevtoolsPanel2(props, ref) {
|
|
6
|
+
const { shadowDOMTarget } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(ShadowDomTargetContext.Provider, { value: shadowDOMTarget, children: /* @__PURE__ */ jsx(
|
|
8
|
+
DevtoolsOnCloseContext.Provider,
|
|
9
|
+
{
|
|
10
|
+
value: {
|
|
11
|
+
onCloseClick: () => {
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
children: /* @__PURE__ */ jsx(BaseTanStackRouterDevtoolsPanel, { ref, ...props })
|
|
15
|
+
}
|
|
16
|
+
) });
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
TanStackRouterDevtoolsPanel
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=TanStackRouterDevtoolsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TanStackRouterDevtoolsPanel.js","sources":["../../src/TanStackRouterDevtoolsPanel.tsx"],"sourcesContent":["import React from 'react'\nimport { DevtoolsOnCloseContext, ShadowDomTargetContext } from './context'\nimport { BaseTanStackRouterDevtoolsPanel } from './BaseTanStackRouterDevtoolsPanel'\nimport type { AnyRouter } from '@tanstack/react-router'\n\nexport interface DevtoolsPanelOptions {\n /**\n * The standard React style object used to style a component with inline styles\n */\n style?: React.CSSProperties\n /**\n * The standard React className 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: React.MouseEvent<HTMLDivElement, MouseEvent>) => 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 = React.forwardRef<\n HTMLDivElement,\n DevtoolsPanelOptions\n>(function TanStackRouterDevtoolsPanel(props, ref) {\n const { shadowDOMTarget } = props\n\n return (\n <ShadowDomTargetContext.Provider value={shadowDOMTarget}>\n <DevtoolsOnCloseContext.Provider\n value={{\n onCloseClick: () => {},\n }}\n >\n <BaseTanStackRouterDevtoolsPanel ref={ref} {...props} />\n </DevtoolsOnCloseContext.Provider>\n </ShadowDomTargetContext.Provider>\n )\n})\n"],"names":["React","TanStackRouterDevtoolsPanel"],"mappings":";;;;AAoCO,MAAM,8BAA8BA,eAAM,WAG/C,SAASC,6BAA4B,OAAO,KAAK;AAC3C,QAAA,EAAE,oBAAoB;AAE5B,SACG,oBAAA,uBAAuB,UAAvB,EAAgC,OAAO,iBACtC,UAAA;AAAA,IAAC,uBAAuB;AAAA,IAAvB;AAAA,MACC,OAAO;AAAA,QACL,cAAc,MAAM;AAAA,QAAA;AAAA,MACtB;AAAA,MAEA,UAAC,oBAAA,iCAAA,EAAgC,KAAW,GAAG,MAAO,CAAA;AAAA,IAAA;AAAA,EAAA,GAE1D;AAEJ,CAAC;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { TanStackRouterDevtools
|
|
1
|
+
export { TanStackRouterDevtools } from './TanStackRouterDevtools.js';
|
|
2
|
+
export { TanStackRouterDevtoolsPanel } from './TanStackRouterDevtoolsPanel.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TanStackRouterDevtools
|
|
1
|
+
import { TanStackRouterDevtools } from "./TanStackRouterDevtools.js";
|
|
2
|
+
import { TanStackRouterDevtoolsPanel } from "./TanStackRouterDevtoolsPanel.js";
|
|
2
3
|
export {
|
|
3
4
|
TanStackRouterDevtools,
|
|
4
5
|
TanStackRouterDevtoolsPanel
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare function useStyles(): {
|
|
2
|
+
devtoolsPanelContainer: string;
|
|
3
|
+
devtoolsPanelContainerVisibility: (isOpen: boolean) => string;
|
|
4
|
+
devtoolsPanelContainerResizing: (isResizing: boolean) => string;
|
|
5
|
+
devtoolsPanelContainerAnimation: (isOpen: boolean, height: number) => string;
|
|
6
|
+
logo: string;
|
|
7
|
+
tanstackLogo: string;
|
|
8
|
+
routerLogo: string;
|
|
9
|
+
devtoolsPanel: string;
|
|
10
|
+
dragHandle: string;
|
|
11
|
+
firstContainer: string;
|
|
12
|
+
routerExplorerContainer: string;
|
|
13
|
+
routerExplorer: string;
|
|
14
|
+
row: string;
|
|
15
|
+
detailsHeader: string;
|
|
16
|
+
maskedBadge: string;
|
|
17
|
+
maskedLocation: string;
|
|
18
|
+
detailsContent: string;
|
|
19
|
+
routeMatchesToggle: string;
|
|
20
|
+
routeMatchesToggleBtn: (active: boolean, showBorder: boolean) => string[];
|
|
21
|
+
detailsHeaderInfo: string;
|
|
22
|
+
matchRow: (active: boolean) => string[];
|
|
23
|
+
matchIndicator: (color: "green" | "red" | "yellow" | "gray" | "blue" | "purple") => string[];
|
|
24
|
+
matchID: string;
|
|
25
|
+
ageTicker: (showWarning: boolean) => string[];
|
|
26
|
+
secondContainer: string;
|
|
27
|
+
thirdContainer: string;
|
|
28
|
+
fourthContainer: string;
|
|
29
|
+
routesContainer: string;
|
|
30
|
+
routesRowContainer: (active: boolean, isMatch: boolean) => string[];
|
|
31
|
+
routesRow: (isMatch: boolean) => string[];
|
|
32
|
+
routeParamInfo: string;
|
|
33
|
+
nestedRouteRow: (isRoot: boolean) => string;
|
|
34
|
+
code: string;
|
|
35
|
+
matchesContainer: string;
|
|
36
|
+
cachedMatchesContainer: string;
|
|
37
|
+
maskedBadgeContainer: string;
|
|
38
|
+
matchDetails: string;
|
|
39
|
+
matchStatus: (status: "pending" | "success" | "error" | "notFound" | "redirected", isFetching: false | "beforeLoad" | "loader") => string;
|
|
40
|
+
matchDetailsInfo: string;
|
|
41
|
+
matchDetailsInfoLabel: string;
|
|
42
|
+
mainCloseBtn: string;
|
|
43
|
+
mainCloseBtnPosition: (position: "top-left" | "top-right" | "bottom-left" | "bottom-right") => string;
|
|
44
|
+
mainCloseBtnAnimation: (isOpen: boolean) => string;
|
|
45
|
+
routerLogoCloseButton: string;
|
|
46
|
+
mainCloseBtnDivider: string;
|
|
47
|
+
mainCloseBtnIconContainer: string;
|
|
48
|
+
mainCloseBtnIconOuter: string;
|
|
49
|
+
mainCloseBtnIconInner: string;
|
|
50
|
+
panelCloseBtn: string;
|
|
51
|
+
panelCloseBtnIcon: string;
|
|
52
|
+
};
|