@tanstack/react-router-devtools 0.0.1-beta.8 → 0.0.1-beta.80
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/build/cjs/{packages/react-router-devtools/src/Explorer.js → Explorer.js} +44 -61
- package/build/cjs/Explorer.js.map +1 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -18
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/{packages/react-router-devtools/src/devtools.js → devtools.js} +176 -275
- package/build/cjs/devtools.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/index.js → index.js} +0 -0
- package/build/cjs/{packages/react-router-devtools/src/index.js.map → index.js.map} +0 -0
- package/build/cjs/{packages/react-router-devtools/src/styledComponents.js → styledComponents.js} +9 -37
- package/build/cjs/styledComponents.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/theme.js → theme.js} +5 -8
- package/build/cjs/theme.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useLocalStorage.js → useLocalStorage.js} +2 -9
- package/build/cjs/useLocalStorage.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useMediaQuery.js → useMediaQuery.js} +10 -13
- package/build/cjs/useMediaQuery.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/utils.js → utils.js} +24 -70
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +268 -1319
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +312 -9469
- package/build/types/index.d.ts +4 -4
- package/build/umd/index.development.js +335 -1292
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +32 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +6 -8
- package/src/devtools.tsx +86 -87
- package/src/utils.ts +5 -17
- package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js +0 -30
- package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js +0 -22
- package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js +0 -20
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -21
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -33
- package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -22
- package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js +0 -67
- package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js +0 -207
- package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js +0 -26
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js +0 -39
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js +0 -65
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js +0 -34
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js +0 -105
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js +0 -52
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js +0 -31
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js +0 -164
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js +0 -116
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js +0 -47
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/toDate/index.js +0 -70
- package/build/cjs/node_modules/date-fns/esm/toDate/index.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router-devtools",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.80",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router/",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
25
25
|
},
|
|
26
26
|
"module": "build/esm/index.js",
|
|
27
|
-
"main": "build/cjs/
|
|
27
|
+
"main": "build/cjs/index.js",
|
|
28
28
|
"browser": "build/umd/index.production.js",
|
|
29
29
|
"types": "build/types/index.d.ts",
|
|
30
30
|
"engines": {
|
|
@@ -34,16 +34,14 @@
|
|
|
34
34
|
"build/**",
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
|
+
"sideEffects": false,
|
|
37
38
|
"peerDependencies": {
|
|
38
|
-
"@tanstack/react-router": "0.0.1-beta.8",
|
|
39
39
|
"react": ">=16",
|
|
40
40
|
"react-dom": ">=16"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "^7.16.7",
|
|
44
|
-
"date-fns": "^2.29.1"
|
|
45
|
-
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"babel-plugin-transform-async-to-promises": "^0.8.18"
|
|
44
|
+
"date-fns": "^2.29.1",
|
|
45
|
+
"@tanstack/react-router": "0.0.1-beta.80"
|
|
48
46
|
}
|
|
49
|
-
}
|
|
47
|
+
}
|
package/src/devtools.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
last,
|
|
4
|
+
routerContext,
|
|
5
|
+
invariant,
|
|
6
|
+
useRouter,
|
|
7
|
+
AnyRouter,
|
|
8
|
+
useStore,
|
|
9
|
+
} from '@tanstack/react-router'
|
|
4
10
|
|
|
5
11
|
import useLocalStorage from './useLocalStorage'
|
|
6
12
|
import {
|
|
@@ -56,7 +62,7 @@ interface DevtoolsOptions {
|
|
|
56
62
|
/**
|
|
57
63
|
* A boolean variable indicating if the "lite" version of the library is being used
|
|
58
64
|
*/
|
|
59
|
-
router
|
|
65
|
+
router?: AnyRouter
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
interface DevtoolsPanelOptions {
|
|
@@ -83,7 +89,7 @@ interface DevtoolsPanelOptions {
|
|
|
83
89
|
/**
|
|
84
90
|
* A boolean variable indicating if the "lite" version of the library is being used
|
|
85
91
|
*/
|
|
86
|
-
router
|
|
92
|
+
router?: AnyRouter
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
const isServer = typeof window === 'undefined'
|
|
@@ -97,8 +103,8 @@ function Logo(props: React.HTMLProps<HTMLDivElement>) {
|
|
|
97
103
|
display: 'flex',
|
|
98
104
|
alignItems: 'center',
|
|
99
105
|
flexDirection: 'column',
|
|
100
|
-
fontSize: '0.
|
|
101
|
-
fontWeight: '
|
|
106
|
+
fontSize: '0.8rem',
|
|
107
|
+
fontWeight: 'bolder',
|
|
102
108
|
lineHeight: '1',
|
|
103
109
|
}}
|
|
104
110
|
>
|
|
@@ -110,8 +116,16 @@ function Logo(props: React.HTMLProps<HTMLDivElement>) {
|
|
|
110
116
|
TANSTACK
|
|
111
117
|
</div>
|
|
112
118
|
<div
|
|
113
|
-
className="text-transparent bg-clip-text bg-gradient-to-r from-lime-500 to-emerald-500"
|
|
114
119
|
style={{
|
|
120
|
+
backgroundImage:
|
|
121
|
+
'linear-gradient(to right, var(--tw-gradient-stops))',
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
'--tw-gradient-from': '#84cc16',
|
|
124
|
+
'--tw-gradient-stops':
|
|
125
|
+
'var(--tw-gradient-from), var(--tw-gradient-to)',
|
|
126
|
+
'--tw-gradient-to': '#10b981',
|
|
127
|
+
WebkitBackgroundClip: 'text',
|
|
128
|
+
color: 'transparent',
|
|
115
129
|
letterSpacing: '0.1rem',
|
|
116
130
|
marginRight: '-0.2rem',
|
|
117
131
|
}}
|
|
@@ -398,23 +412,19 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
398
412
|
isOpen = true,
|
|
399
413
|
setIsOpen,
|
|
400
414
|
handleDragStart,
|
|
401
|
-
router,
|
|
415
|
+
router: userRouter,
|
|
402
416
|
...panelProps
|
|
403
417
|
} = props
|
|
404
418
|
|
|
405
|
-
const
|
|
419
|
+
const routerContextValue = React.useContext(routerContext)
|
|
420
|
+
const router = userRouter ?? routerContextValue?.router
|
|
406
421
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
return () => {
|
|
415
|
-
clearInterval(interval)
|
|
416
|
-
}
|
|
417
|
-
}, [])
|
|
422
|
+
invariant(
|
|
423
|
+
router,
|
|
424
|
+
'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.',
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
useStore(router.__store)
|
|
418
428
|
|
|
419
429
|
const [activeRouteId, setActiveRouteId] = useLocalStorage(
|
|
420
430
|
'tanstackRouterDevtoolsActiveRouteId',
|
|
@@ -430,24 +440,20 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
430
440
|
setActiveMatchId('')
|
|
431
441
|
}, [activeRouteId])
|
|
432
442
|
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
Object.keys(router.matchCache)
|
|
440
|
-
.filter((key) => {
|
|
441
|
-
const cacheEntry = router.matchCache[key]!
|
|
442
|
-
return cacheEntry.gc > Date.now()
|
|
443
|
-
})
|
|
444
|
-
.map((key) => router.matchCache[key]!),
|
|
445
|
-
[(d) => (d.match.isFetching ? -1 : 1), (d) => -d.match.updatedAt!],
|
|
443
|
+
const allMatches = React.useMemo(
|
|
444
|
+
() => [
|
|
445
|
+
...Object.values(router.state.currentMatches),
|
|
446
|
+
...Object.values(router.state.pendingMatches ?? []),
|
|
447
|
+
],
|
|
448
|
+
[router.state.currentMatches, router.state.pendingMatches],
|
|
446
449
|
)
|
|
447
450
|
|
|
451
|
+
const activeMatch =
|
|
452
|
+
allMatches?.find((d) => d.id === activeMatchId) ||
|
|
453
|
+
allMatches?.find((d) => d.route.id === activeRouteId)
|
|
454
|
+
|
|
448
455
|
return (
|
|
449
456
|
<ThemeProvider theme={theme}>
|
|
450
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
|
451
457
|
<Panel ref={ref} className="TanStackRouterDevtoolsPanel" {...panelProps}>
|
|
452
458
|
<style
|
|
453
459
|
dangerouslySetInnerHTML={{
|
|
@@ -521,8 +527,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
521
527
|
}}
|
|
522
528
|
>
|
|
523
529
|
<div
|
|
524
|
-
className="flex justify-start gap-2 p-2 items-center"
|
|
525
530
|
style={{
|
|
531
|
+
display: 'flex',
|
|
532
|
+
justifyContent: 'start',
|
|
533
|
+
gap: '1rem',
|
|
534
|
+
padding: '1rem',
|
|
535
|
+
alignItems: 'center',
|
|
526
536
|
background: theme.backgroundAlt,
|
|
527
537
|
}}
|
|
528
538
|
>
|
|
@@ -579,15 +589,15 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
579
589
|
>
|
|
580
590
|
Active Matches
|
|
581
591
|
</div>
|
|
582
|
-
{router.state.
|
|
592
|
+
{router.state.currentMatches.map((match, i) => {
|
|
583
593
|
return (
|
|
584
594
|
<div
|
|
585
|
-
key={match.
|
|
595
|
+
key={match.route.id || i}
|
|
586
596
|
role="button"
|
|
587
|
-
aria-label={`Open match details for ${match.
|
|
597
|
+
aria-label={`Open match details for ${match.route.id}`}
|
|
588
598
|
onClick={() =>
|
|
589
599
|
setActiveRouteId(
|
|
590
|
-
activeRouteId === match.
|
|
600
|
+
activeRouteId === match.route.id ? '' : match.route.id,
|
|
591
601
|
)
|
|
592
602
|
}
|
|
593
603
|
style={{
|
|
@@ -619,12 +629,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
619
629
|
padding: '.5em',
|
|
620
630
|
}}
|
|
621
631
|
>
|
|
622
|
-
{`${match.
|
|
632
|
+
{`${match.id}`}
|
|
623
633
|
</Code>
|
|
624
634
|
</div>
|
|
625
635
|
)
|
|
626
636
|
})}
|
|
627
|
-
{router.state.
|
|
637
|
+
{router.state.pendingMatches?.length ? (
|
|
628
638
|
<>
|
|
629
639
|
<div
|
|
630
640
|
style={{
|
|
@@ -638,15 +648,15 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
638
648
|
>
|
|
639
649
|
Pending Matches
|
|
640
650
|
</div>
|
|
641
|
-
{router.state.
|
|
651
|
+
{router.state.pendingMatches?.map((match, i) => {
|
|
642
652
|
return (
|
|
643
653
|
<div
|
|
644
|
-
key={match.
|
|
654
|
+
key={match.route.id || i}
|
|
645
655
|
role="button"
|
|
646
|
-
aria-label={`Open match details for ${match.
|
|
656
|
+
aria-label={`Open match details for ${match.route.id}`}
|
|
647
657
|
onClick={() =>
|
|
648
658
|
setActiveRouteId(
|
|
649
|
-
activeRouteId === match.
|
|
659
|
+
activeRouteId === match.route.id ? '' : match.route.id,
|
|
650
660
|
)
|
|
651
661
|
}
|
|
652
662
|
style={{
|
|
@@ -679,14 +689,14 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
679
689
|
padding: '.5em',
|
|
680
690
|
}}
|
|
681
691
|
>
|
|
682
|
-
{`${match.
|
|
692
|
+
{`${match.id}`}
|
|
683
693
|
</Code>
|
|
684
694
|
</div>
|
|
685
695
|
)
|
|
686
696
|
})}
|
|
687
697
|
</>
|
|
688
698
|
) : null}
|
|
689
|
-
{matchCacheValues.length ? (
|
|
699
|
+
{/* {matchCacheValues.length ? (
|
|
690
700
|
<>
|
|
691
701
|
<div
|
|
692
702
|
style={{
|
|
@@ -705,8 +715,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
705
715
|
<div>Match Cache</div>
|
|
706
716
|
<Button
|
|
707
717
|
onClick={() => {
|
|
708
|
-
router.matchCache = {}
|
|
709
|
-
router.notify()
|
|
718
|
+
router.store.setState((s) => (s.matchCache = {}))
|
|
710
719
|
}}
|
|
711
720
|
>
|
|
712
721
|
Clear
|
|
@@ -717,12 +726,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
717
726
|
|
|
718
727
|
return (
|
|
719
728
|
<div
|
|
720
|
-
key={match.
|
|
729
|
+
key={match.id || i}
|
|
721
730
|
role="button"
|
|
722
|
-
aria-label={`Open match details for ${match.
|
|
731
|
+
aria-label={`Open match details for ${match.id}`}
|
|
723
732
|
onClick={() =>
|
|
724
733
|
setActiveMatchId(
|
|
725
|
-
activeMatchId === match.
|
|
734
|
+
activeMatchId === match.id ? '' : match.id,
|
|
726
735
|
)
|
|
727
736
|
}
|
|
728
737
|
style={{
|
|
@@ -763,7 +772,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
763
772
|
transition: 'all .2s ease-out',
|
|
764
773
|
}}
|
|
765
774
|
/>
|
|
766
|
-
<Code>{`${match.
|
|
775
|
+
<Code>{`${match.id}`}</Code>
|
|
767
776
|
</div>
|
|
768
777
|
<span
|
|
769
778
|
style={{
|
|
@@ -782,7 +791,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
782
791
|
)
|
|
783
792
|
})}
|
|
784
793
|
</>
|
|
785
|
-
) : null}
|
|
794
|
+
) : null} */}
|
|
786
795
|
</div>
|
|
787
796
|
|
|
788
797
|
{activeMatch ? (
|
|
@@ -810,28 +819,24 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
810
819
|
lineHeight: '1.8em',
|
|
811
820
|
}}
|
|
812
821
|
>
|
|
813
|
-
{JSON.stringify(activeMatch.
|
|
822
|
+
{JSON.stringify(activeMatch.id, null, 2)}
|
|
814
823
|
</Code>
|
|
815
824
|
</td>
|
|
816
825
|
</tr>
|
|
817
826
|
<tr>
|
|
818
827
|
<td style={{ opacity: '.5' }}>Status</td>
|
|
819
|
-
<td>{activeMatch.status}</td>
|
|
820
|
-
</tr>
|
|
821
|
-
<tr>
|
|
822
|
-
<td style={{ opacity: '.5' }}>Pending</td>
|
|
823
|
-
<td>{activeMatch.isPending.toString()}</td>
|
|
828
|
+
<td>{activeMatch.state.status}</td>
|
|
824
829
|
</tr>
|
|
825
|
-
<tr>
|
|
830
|
+
{/* <tr>
|
|
826
831
|
<td style={{ opacity: '.5' }}>Invalid</td>
|
|
827
|
-
<td>{activeMatch.
|
|
828
|
-
</tr>
|
|
832
|
+
<td>{activeMatch.getIsInvalid().toString()}</td>
|
|
833
|
+
</tr> */}
|
|
829
834
|
<tr>
|
|
830
835
|
<td style={{ opacity: '.5' }}>Last Updated</td>
|
|
831
836
|
<td>
|
|
832
|
-
{activeMatch.updatedAt
|
|
837
|
+
{activeMatch.state.updatedAt
|
|
833
838
|
? new Date(
|
|
834
|
-
activeMatch.updatedAt as number,
|
|
839
|
+
activeMatch.state.updatedAt as number,
|
|
835
840
|
).toLocaleTimeString()
|
|
836
841
|
: 'N/A'}
|
|
837
842
|
</td>
|
|
@@ -856,19 +861,6 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
856
861
|
padding: '0.5em',
|
|
857
862
|
}}
|
|
858
863
|
>
|
|
859
|
-
<Button
|
|
860
|
-
type="button"
|
|
861
|
-
onClick={() => {
|
|
862
|
-
activeMatch.invalidate()
|
|
863
|
-
router.notify()
|
|
864
|
-
}}
|
|
865
|
-
style={{
|
|
866
|
-
background: theme.warning,
|
|
867
|
-
color: theme.inputTextColor,
|
|
868
|
-
}}
|
|
869
|
-
>
|
|
870
|
-
Invalidate
|
|
871
|
-
</Button>{' '}
|
|
872
864
|
<Button
|
|
873
865
|
type="button"
|
|
874
866
|
onClick={() => activeMatch.load()}
|
|
@@ -915,7 +907,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
915
907
|
flexDirection: 'column',
|
|
916
908
|
}}
|
|
917
909
|
>
|
|
918
|
-
<div
|
|
910
|
+
{/* <div
|
|
919
911
|
style={{
|
|
920
912
|
padding: '.5em',
|
|
921
913
|
background: theme.backgroundAlt,
|
|
@@ -932,12 +924,18 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
932
924
|
padding: '.5em',
|
|
933
925
|
}}
|
|
934
926
|
>
|
|
935
|
-
{Object.keys(
|
|
936
|
-
.
|
|
927
|
+
{Object.keys(
|
|
928
|
+
last(router.state.currentMatches)?.state.loaderData ||
|
|
929
|
+
{},
|
|
930
|
+
).length ? (
|
|
937
931
|
<Explorer
|
|
938
|
-
value={
|
|
932
|
+
value={
|
|
933
|
+
last(router.state.currentMatches)?.state
|
|
934
|
+
.loaderData || {}
|
|
935
|
+
}
|
|
939
936
|
defaultExpanded={Object.keys(
|
|
940
|
-
(last(router.state.
|
|
937
|
+
(last(router.state.currentMatches)?.state
|
|
938
|
+
.loaderData as {}) || {},
|
|
941
939
|
).reduce((obj: any, next) => {
|
|
942
940
|
obj[next] = {}
|
|
943
941
|
return obj
|
|
@@ -946,7 +944,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
946
944
|
) : (
|
|
947
945
|
<em style={{ opacity: 0.5 }}>{'{ }'}</em>
|
|
948
946
|
)}
|
|
949
|
-
</div>
|
|
947
|
+
</div> */}
|
|
950
948
|
<div
|
|
951
949
|
style={{
|
|
952
950
|
padding: '.5em',
|
|
@@ -964,11 +962,12 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
964
962
|
padding: '.5em',
|
|
965
963
|
}}
|
|
966
964
|
>
|
|
967
|
-
{Object.keys(last(router.state.
|
|
965
|
+
{Object.keys(last(router.state.currentMatches)?.state.search || {})
|
|
966
|
+
.length ? (
|
|
968
967
|
<Explorer
|
|
969
|
-
value={last(router.state.
|
|
968
|
+
value={last(router.state.currentMatches)?.state.search || {}}
|
|
970
969
|
defaultExpanded={Object.keys(
|
|
971
|
-
(last(router.state.
|
|
970
|
+
(last(router.state.currentMatches)?.state.search as {}) || {},
|
|
972
971
|
).reduce((obj: any, next) => {
|
|
973
972
|
obj[next] = {}
|
|
974
973
|
return obj
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { RouteMatch } from '@tanstack/react-router'
|
|
2
|
+
import { AnyRouteMatch, RouteMatch } from '@tanstack/react-router'
|
|
3
3
|
|
|
4
4
|
import { Theme, useTheme } from './theme'
|
|
5
5
|
import useMediaQuery from './useMediaQuery'
|
|
@@ -25,28 +25,16 @@ type StyledComponent<T> = T extends 'button'
|
|
|
25
25
|
? React.HTMLAttributes<HTMLElementTagNameMap[T]>
|
|
26
26
|
: never
|
|
27
27
|
|
|
28
|
-
export function getStatusColor(match:
|
|
29
|
-
return match.
|
|
30
|
-
? theme.warning
|
|
31
|
-
: match.isFetching
|
|
28
|
+
export function getStatusColor(match: AnyRouteMatch, theme: Theme) {
|
|
29
|
+
return match.state.status === 'pending'
|
|
32
30
|
? theme.active
|
|
33
|
-
: match.status === 'error'
|
|
31
|
+
: match.state.status === 'error'
|
|
34
32
|
? theme.danger
|
|
35
|
-
: match.status === 'success'
|
|
33
|
+
: match.state.status === 'success'
|
|
36
34
|
? theme.success
|
|
37
35
|
: theme.gray
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
// export function getQueryStatusLabel(query: Query) {
|
|
41
|
-
// return query.state.isFetching
|
|
42
|
-
// ? 'fetching'
|
|
43
|
-
// : !query.getObserversCount()
|
|
44
|
-
// ? 'inactive'
|
|
45
|
-
// : query.isStale()
|
|
46
|
-
// ? 'stale'
|
|
47
|
-
// : 'fresh'
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
38
|
type Styles =
|
|
51
39
|
| React.CSSProperties
|
|
52
40
|
| ((props: Record<string, any>, theme: Theme) => React.CSSProperties)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
function assign(target, object) {
|
|
16
|
-
if (target == null) {
|
|
17
|
-
throw new TypeError('assign requires that input parameter not be null or undefined');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
for (var property in object) {
|
|
21
|
-
if (Object.prototype.hasOwnProperty.call(object, property)) {
|
|
22
|
-
target[property] = object[property];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return target;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
exports["default"] = assign;
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/date-fns/esm/_lib/assign/index.js"],"sourcesContent":["export default function assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n\n return target;\n}"],"names":[],"mappings":";;;;;;;;;;;;;;AAAe,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE;AAC/C,EAAE,IAAI,MAAM,IAAI,IAAI,EAAE;AACtB,IAAI,MAAM,IAAI,SAAS,CAAC,+DAA+D,CAAC,CAAC;AACzF,GAAG;AACH;AACA,EAAE,KAAK,IAAI,QAAQ,IAAI,MAAM,EAAE;AAC/B,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;AAEhE,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var index = require('../assign/index.js');
|
|
16
|
-
|
|
17
|
-
function cloneObject(object) {
|
|
18
|
-
return index["default"]({}, object);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports["default"] = cloneObject;
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/date-fns/esm/_lib/cloneObject/index.js"],"sourcesContent":["import assign from \"../assign/index.js\";\nexport default function cloneObject(object) {\n return assign({}, object);\n}"],"names":["assign"],"mappings":";;;;;;;;;;;;;;;;AACe,SAAS,WAAW,CAAC,MAAM,EAAE;AAC5C,EAAE,OAAOA,gBAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAC5B;;;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var index = require('../../locale/en-US/index.js');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
exports["default"] = index["default"];
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var defaultOptions = {};
|
|
16
|
-
function getDefaultOptions() {
|
|
17
|
-
return defaultOptions;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.getDefaultOptions = getDefaultOptions;
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/date-fns/esm/_lib/defaultOptions/index.js"],"sourcesContent":["var defaultOptions = {};\nexport function getDefaultOptions() {\n return defaultOptions;\n}\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,IAAI,cAAc,GAAG,EAAE,CAAC;AACjB,SAAS,iBAAiB,GAAG;AACpC,EAAE,OAAO,cAAc,CAAC;AACxB;;;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
17
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
18
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
19
|
-
* and GMT+01:00:00 after that date)
|
|
20
|
-
*
|
|
21
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
22
|
-
* which would lead to incorrect calculations.
|
|
23
|
-
*
|
|
24
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
25
|
-
*/
|
|
26
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
27
|
-
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
28
|
-
utcDate.setUTCFullYear(date.getFullYear());
|
|
29
|
-
return date.getTime() - utcDate.getTime();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports["default"] = getTimezoneOffsetInMilliseconds;
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"],"sourcesContent":["/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,+BAA+B,CAAC,IAAI,EAAE;AAC9D,EAAE,IAAI,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AACvK,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AAC5C;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-router-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
function requiredArgs(required, args) {
|
|
16
|
-
if (args.length < required) {
|
|
17
|
-
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports["default"] = requiredArgs;
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js"],"sourcesContent":["export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}"],"names":[],"mappings":";;;;;;;;;;;;;;AAAe,SAAS,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE;AACrD,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ,EAAE;AAC9B,IAAI,MAAM,IAAI,SAAS,CAAC,QAAQ,GAAG,WAAW,IAAI,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,sBAAsB,GAAG,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;AAChI,GAAG;AACH;;;;"}
|