@tanstack/router-devtools 1.112.5 → 1.112.7
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/BaseTanStackRouterDevtoolsPanel.cjs +12 -29
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs.map +1 -1
- package/dist/cjs/BaseTanStackRouterDevtoolsPanel.d.cts +1 -3
- package/dist/cjs/Explorer.cjs +1 -1
- package/dist/cjs/Explorer.cjs.map +1 -1
- package/dist/cjs/TanStackRouterDevtools.cjs +2 -2
- package/dist/cjs/TanStackRouterDevtools.cjs.map +1 -1
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs +5 -7
- package/dist/cjs/TanStackRouterDevtoolsPanel.cjs.map +1 -1
- package/dist/cjs/TanStackRouterDevtoolsPanel.d.cts +1 -3
- package/dist/cjs/context.cjs +1 -1
- package/dist/cjs/context.cjs.map +1 -1
- package/dist/cjs/useStyles.cjs +1 -1
- package/dist/cjs/useStyles.cjs.map +1 -1
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +1 -3
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.d.ts +1 -3
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.js +12 -29
- package/dist/esm/BaseTanStackRouterDevtoolsPanel.js.map +1 -1
- package/dist/esm/Explorer.js +1 -1
- package/dist/esm/Explorer.js.map +1 -1
- package/dist/esm/TanStackRouterDevtools.js +2 -2
- package/dist/esm/TanStackRouterDevtools.js.map +1 -1
- package/dist/esm/TanStackRouterDevtoolsPanel.d.ts +1 -3
- package/dist/esm/TanStackRouterDevtoolsPanel.js +5 -7
- package/dist/esm/TanStackRouterDevtoolsPanel.js.map +1 -1
- package/dist/esm/context.js +1 -1
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/useStyles.js +1 -1
- package/dist/esm/useStyles.js.map +1 -1
- package/dist/esm/utils.d.ts +1 -3
- package/dist/esm/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/BaseTanStackRouterDevtoolsPanel.tsx +311 -322
- package/src/Explorer.tsx +1 -1
- package/src/TanStackRouterDevtools.tsx +4 -4
- package/src/TanStackRouterDevtoolsPanel.tsx +17 -18
- package/src/context.ts +1 -1
- package/src/theme.tsx +2 -2
- package/src/useStyles.tsx +1 -1
- package/src/utils.ts +31 -38
package/src/Explorer.tsx
CHANGED
|
@@ -356,7 +356,7 @@ const stylesFactory = (shadowDOMTarget?: ShadowRoot) => {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
function useStyles() {
|
|
359
|
-
const shadowDomTarget = React.
|
|
359
|
+
const shadowDomTarget = React.useContext(ShadowDomTargetContext)
|
|
360
360
|
const [_styles] = React.useState(() => stylesFactory(shadowDomTarget))
|
|
361
361
|
return _styles
|
|
362
362
|
}
|
|
@@ -61,9 +61,9 @@ export function TanStackRouterDevtools(
|
|
|
61
61
|
const { shadowDOMTarget } = props
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<ShadowDomTargetContext value={shadowDOMTarget}>
|
|
64
|
+
<ShadowDomTargetContext.Provider value={shadowDOMTarget}>
|
|
65
65
|
<FloatingTanStackRouterDevtools {...props} />
|
|
66
|
-
</ShadowDomTargetContext>
|
|
66
|
+
</ShadowDomTargetContext.Provider>
|
|
67
67
|
)
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -190,7 +190,7 @@ function FloatingTanStackRouterDevtools({
|
|
|
190
190
|
|
|
191
191
|
return (
|
|
192
192
|
<Container ref={setRootEl} className="TanStackRouterDevtools">
|
|
193
|
-
<DevtoolsOnCloseContext
|
|
193
|
+
<DevtoolsOnCloseContext.Provider
|
|
194
194
|
value={{
|
|
195
195
|
onCloseClick: onCloseClick ?? (() => {}),
|
|
196
196
|
}}
|
|
@@ -217,7 +217,7 @@ function FloatingTanStackRouterDevtools({
|
|
|
217
217
|
handleDragStart={(e) => handleDragStart(panelRef.current, e)}
|
|
218
218
|
shadowDOMTarget={shadowDOMTarget}
|
|
219
219
|
/>
|
|
220
|
-
</DevtoolsOnCloseContext>
|
|
220
|
+
</DevtoolsOnCloseContext.Provider>
|
|
221
221
|
|
|
222
222
|
<button
|
|
223
223
|
type="button"
|
|
@@ -34,22 +34,21 @@ export interface DevtoolsPanelOptions {
|
|
|
34
34
|
shadowDOMTarget?: ShadowRoot
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export const TanStackRouterDevtoolsPanel =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const { shadowDOMTarget } = props
|
|
37
|
+
export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
38
|
+
HTMLDivElement,
|
|
39
|
+
DevtoolsPanelOptions
|
|
40
|
+
>(function TanStackRouterDevtoolsPanel(props, ref) {
|
|
41
|
+
const { shadowDOMTarget } = props
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
return (
|
|
44
|
+
<ShadowDomTargetContext.Provider value={shadowDOMTarget}>
|
|
45
|
+
<DevtoolsOnCloseContext.Provider
|
|
46
|
+
value={{
|
|
47
|
+
onCloseClick: () => {},
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<BaseTanStackRouterDevtoolsPanel ref={ref} {...props} />
|
|
51
|
+
</DevtoolsOnCloseContext.Provider>
|
|
52
|
+
</ShadowDomTargetContext.Provider>
|
|
53
|
+
)
|
|
54
|
+
})
|
package/src/context.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const DevtoolsOnCloseContext = React.createContext<
|
|
|
12
12
|
>(undefined)
|
|
13
13
|
|
|
14
14
|
export const useDevtoolsOnClose = () => {
|
|
15
|
-
const context = React.
|
|
15
|
+
const context = React.useContext(DevtoolsOnCloseContext)
|
|
16
16
|
if (!context) {
|
|
17
17
|
throw new Error(
|
|
18
18
|
'useDevtoolsOnClose must be used within a TanStackRouterDevtools component',
|
package/src/theme.tsx
CHANGED
|
@@ -23,9 +23,9 @@ interface ProviderProps {
|
|
|
23
23
|
const ThemeContext = React.createContext(defaultTheme)
|
|
24
24
|
|
|
25
25
|
export function ThemeProvider({ theme, ...rest }: ProviderProps) {
|
|
26
|
-
return <ThemeContext value={theme} {...rest} />
|
|
26
|
+
return <ThemeContext.Provider value={theme} {...rest} />
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export function useTheme() {
|
|
30
|
-
return React.
|
|
30
|
+
return React.useContext(ThemeContext)
|
|
31
31
|
}
|
package/src/useStyles.tsx
CHANGED
|
@@ -583,7 +583,7 @@ const stylesFactory = (shadowDOMTarget?: ShadowRoot) => {
|
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
export function useStyles() {
|
|
586
|
-
const shadowDomTarget = React.
|
|
586
|
+
const shadowDomTarget = React.useContext(ShadowDomTargetContext)
|
|
587
587
|
const [_styles] = React.useState(() => stylesFactory(shadowDomTarget))
|
|
588
588
|
return _styles
|
|
589
589
|
}
|
package/src/utils.ts
CHANGED
|
@@ -63,44 +63,37 @@ export function styled<T extends keyof HTMLElementTagNameMap>(
|
|
|
63
63
|
type: T,
|
|
64
64
|
newStyles: Styles,
|
|
65
65
|
queries: Record<string, Styles> = {},
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
ref
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
: newStyles),
|
|
98
|
-
...style,
|
|
99
|
-
...mediaStyles,
|
|
100
|
-
},
|
|
101
|
-
ref,
|
|
102
|
-
})
|
|
103
|
-
}
|
|
66
|
+
) {
|
|
67
|
+
return React.forwardRef<HTMLElementTagNameMap[T], StyledComponent<T>>(
|
|
68
|
+
({ style, ...rest }, ref) => {
|
|
69
|
+
const theme = useTheme()
|
|
70
|
+
|
|
71
|
+
const mediaStyles = Object.entries(queries).reduce(
|
|
72
|
+
(current, [key, value]) => {
|
|
73
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
74
|
+
return useMediaQuery(key)
|
|
75
|
+
? {
|
|
76
|
+
...current,
|
|
77
|
+
...(typeof value === 'function' ? value(rest, theme) : value),
|
|
78
|
+
}
|
|
79
|
+
: current
|
|
80
|
+
},
|
|
81
|
+
{},
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return React.createElement(type, {
|
|
85
|
+
...rest,
|
|
86
|
+
style: {
|
|
87
|
+
...(typeof newStyles === 'function'
|
|
88
|
+
? newStyles(rest, theme)
|
|
89
|
+
: newStyles),
|
|
90
|
+
...style,
|
|
91
|
+
...mediaStyles,
|
|
92
|
+
},
|
|
93
|
+
ref,
|
|
94
|
+
})
|
|
95
|
+
},
|
|
96
|
+
)
|
|
104
97
|
}
|
|
105
98
|
|
|
106
99
|
export function useIsMounted() {
|