@tanstack/react-router 0.0.1-beta.9 → 1.0.0
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/CatchBoundary.js +128 -0
- package/build/cjs/CatchBoundary.js.map +1 -0
- package/build/cjs/Matches.js +233 -0
- package/build/cjs/Matches.js.map +1 -0
- package/build/cjs/RouterProvider.js +170 -0
- package/build/cjs/RouterProvider.js.map +1 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -22
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/_virtual/with-selector.development.js +16 -0
- package/build/cjs/_virtual/with-selector.development.js.map +1 -0
- package/build/cjs/_virtual/with-selector.js +16 -0
- package/build/cjs/_virtual/with-selector.js.map +1 -0
- package/build/cjs/_virtual/with-selector.production.min.js +16 -0
- package/build/cjs/_virtual/with-selector.production.min.js.map +1 -0
- package/build/cjs/awaited.js +43 -0
- package/build/cjs/awaited.js.map +1 -0
- package/build/cjs/build/esm/index.js +79 -0
- package/build/cjs/build/esm/index.js.map +1 -0
- package/build/cjs/defer.js +37 -0
- package/build/cjs/defer.js.map +1 -0
- package/build/cjs/fileRoute.js +27 -0
- package/build/cjs/fileRoute.js.map +1 -0
- package/build/cjs/index.js +130 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/lazyRouteComponent.js +54 -0
- package/build/cjs/lazyRouteComponent.js.map +1 -0
- package/build/cjs/link.js +223 -0
- package/build/cjs/link.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js +47 -0
- package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js +70 -0
- package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +188 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +39 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js +26 -0
- package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/build/cjs/packages/react-router/src/CatchBoundary.js +123 -0
- package/build/cjs/packages/react-router/src/CatchBoundary.js.map +1 -0
- package/build/cjs/packages/react-router/src/Matches.js +235 -0
- package/build/cjs/packages/react-router/src/Matches.js.map +1 -0
- package/build/cjs/packages/react-router/src/RouterProvider.js +144 -0
- package/build/cjs/packages/react-router/src/RouterProvider.js.map +1 -0
- package/build/cjs/packages/react-router/src/awaited.js +43 -0
- package/build/cjs/packages/react-router/src/awaited.js.map +1 -0
- package/build/cjs/packages/react-router/src/defer.js +37 -0
- package/build/cjs/packages/react-router/src/defer.js.map +1 -0
- package/build/cjs/packages/react-router/src/fileRoute.js +27 -0
- package/build/cjs/packages/react-router/src/fileRoute.js.map +1 -0
- package/build/cjs/packages/react-router/src/index.js +61 -0
- package/build/cjs/packages/react-router/src/index.js.map +1 -0
- package/build/cjs/packages/react-router/src/lazyRouteComponent.js +54 -0
- package/build/cjs/packages/react-router/src/lazyRouteComponent.js.map +1 -0
- package/build/cjs/packages/react-router/src/link.js +148 -0
- package/build/cjs/packages/react-router/src/link.js.map +1 -0
- package/build/cjs/packages/react-router/src/path.js +209 -0
- package/build/cjs/packages/react-router/src/path.js.map +1 -0
- package/build/cjs/packages/react-router/src/qss.js +63 -0
- package/build/cjs/packages/react-router/src/qss.js.map +1 -0
- package/build/cjs/packages/react-router/src/react.js +634 -0
- package/build/cjs/packages/react-router/src/react.js.map +1 -0
- package/build/cjs/packages/react-router/src/redirects.js +25 -0
- package/build/cjs/packages/react-router/src/redirects.js.map +1 -0
- package/build/cjs/packages/react-router/src/route.js +134 -0
- package/build/cjs/packages/react-router/src/route.js.map +1 -0
- package/build/cjs/packages/react-router/src/router.js +1111 -0
- package/build/cjs/packages/react-router/src/router.js.map +1 -0
- package/build/cjs/packages/react-router/src/scroll-restoration.js +53 -0
- package/build/cjs/packages/react-router/src/scroll-restoration.js.map +1 -0
- package/build/cjs/packages/react-router/src/searchParams.js +81 -0
- package/build/cjs/packages/react-router/src/searchParams.js.map +1 -0
- package/build/cjs/packages/react-router/src/useBlocker.js +61 -0
- package/build/cjs/packages/react-router/src/useBlocker.js.map +1 -0
- package/build/cjs/packages/react-router/src/useNavigate.js +75 -0
- package/build/cjs/packages/react-router/src/useNavigate.js.map +1 -0
- package/build/cjs/packages/react-router/src/useParams.js +26 -0
- package/build/cjs/packages/react-router/src/useParams.js.map +1 -0
- package/build/cjs/packages/react-router/src/useSearch.js +25 -0
- package/build/cjs/packages/react-router/src/useSearch.js.map +1 -0
- package/build/cjs/packages/react-router/src/utils.js +239 -0
- package/build/cjs/packages/react-router/src/utils.js.map +1 -0
- package/build/cjs/path.js +214 -0
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/qss.js +63 -0
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/react/CatchBoundary.js +123 -0
- package/build/cjs/react/CatchBoundary.js.map +1 -0
- package/build/cjs/react/awaited.js +43 -0
- package/build/cjs/react/awaited.js.map +1 -0
- package/build/cjs/react/defer.js +37 -0
- package/build/cjs/react/defer.js.map +1 -0
- package/build/cjs/react.js +650 -0
- package/build/cjs/react.js.map +1 -0
- package/build/cjs/redirects.js +28 -0
- package/build/cjs/redirects.js.map +1 -0
- package/build/cjs/route.js +191 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/router.js +1085 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/routerConfig.js +209 -0
- package/build/cjs/routerConfig.js.map +1 -0
- package/build/cjs/scroll-restoration.js +202 -0
- package/build/cjs/scroll-restoration.js.map +1 -0
- package/build/cjs/searchParams.js +81 -0
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/src/CatchBoundary.js +126 -0
- package/build/cjs/src/CatchBoundary.js.map +1 -0
- package/build/cjs/src/Matches.js +235 -0
- package/build/cjs/src/Matches.js.map +1 -0
- package/build/cjs/src/RouterProvider.js +1051 -0
- package/build/cjs/src/RouterProvider.js.map +1 -0
- package/build/cjs/src/awaited.js +45 -0
- package/build/cjs/src/awaited.js.map +1 -0
- package/build/cjs/src/defer.js +39 -0
- package/build/cjs/src/defer.js.map +1 -0
- package/build/cjs/src/fileRoute.js +29 -0
- package/build/cjs/src/fileRoute.js.map +1 -0
- package/build/cjs/src/index.js +134 -0
- package/build/cjs/src/index.js.map +1 -0
- package/build/cjs/src/lazyRouteComponent.js +57 -0
- package/build/cjs/src/lazyRouteComponent.js.map +1 -0
- package/build/cjs/src/link.js +151 -0
- package/build/cjs/src/link.js.map +1 -0
- package/build/cjs/src/path.js +211 -0
- package/build/cjs/src/path.js.map +1 -0
- package/build/cjs/src/qss.js +65 -0
- package/build/cjs/src/qss.js.map +1 -0
- package/build/cjs/src/redirects.js +27 -0
- package/build/cjs/src/redirects.js.map +1 -0
- package/build/cjs/src/route.js +139 -0
- package/build/cjs/src/route.js.map +1 -0
- package/build/cjs/src/router.js +203 -0
- package/build/cjs/src/router.js.map +1 -0
- package/build/cjs/src/scroll-restoration.js +186 -0
- package/build/cjs/src/scroll-restoration.js.map +1 -0
- package/build/cjs/src/searchParams.js +83 -0
- package/build/cjs/src/searchParams.js.map +1 -0
- package/build/cjs/src/useBlocker.js +64 -0
- package/build/cjs/src/useBlocker.js.map +1 -0
- package/build/cjs/src/useNavigate.js +78 -0
- package/build/cjs/src/useNavigate.js.map +1 -0
- package/build/cjs/src/useParams.js +28 -0
- package/build/cjs/src/useParams.js.map +1 -0
- package/build/cjs/src/useSearch.js +27 -0
- package/build/cjs/src/useSearch.js.map +1 -0
- package/build/cjs/src/utils.js +230 -0
- package/build/cjs/src/utils.js.map +1 -0
- package/build/cjs/useBlocker.js +55 -0
- package/build/cjs/useBlocker.js.map +1 -0
- package/build/cjs/useNavigate.js +86 -0
- package/build/cjs/useNavigate.js.map +1 -0
- package/build/cjs/useParams.js +26 -0
- package/build/cjs/useParams.js.map +1 -0
- package/build/cjs/useSearch.js +25 -0
- package/build/cjs/useSearch.js.map +1 -0
- package/build/cjs/useStore.js +99 -0
- package/build/cjs/useStore.js.map +1 -0
- package/build/cjs/utils.js +241 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +2300 -2534
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +3498 -2694
- package/build/stats-react.json +1204 -44
- package/build/types/CatchBoundary.d.ts +36 -0
- package/build/types/Matches.d.ts +64 -0
- package/build/types/RouteMatch.d.ts +23 -0
- package/build/types/RouterProvider.d.ts +35 -0
- package/build/types/awaited.d.ts +9 -0
- package/build/types/defer.d.ts +19 -0
- package/build/types/fileRoute.d.ts +38 -0
- package/build/types/history.d.ts +7 -0
- package/build/types/index.d.ts +919 -58
- package/build/types/injectHtml.d.ts +0 -0
- package/build/types/lazyRouteComponent.d.ts +2 -0
- package/build/types/link.d.ts +93 -0
- package/build/types/location.d.ts +12 -0
- package/build/types/path.d.ts +17 -0
- package/build/types/qss.d.ts +2 -0
- package/build/types/react/CatchBoundary.d.ts +33 -0
- package/build/types/react/awaited.d.ts +9 -0
- package/build/types/react/defer.d.ts +19 -0
- package/build/types/react.d.ts +141 -0
- package/build/types/redirects.d.ts +11 -0
- package/build/types/route.d.ts +283 -0
- package/build/types/routeInfo.d.ts +31 -0
- package/build/types/router.d.ts +186 -0
- package/build/types/scroll-restoration.d.ts +18 -0
- package/build/types/searchParams.d.ts +7 -0
- package/build/types/useBlocker.d.ts +9 -0
- package/build/types/useNavigate.d.ts +19 -0
- package/build/types/useParams.d.ts +7 -0
- package/build/types/useSearch.d.ts +7 -0
- package/build/types/useStore.d.ts +12 -0
- package/build/types/utils.d.ts +69 -0
- package/build/umd/index.development.js +2897 -2493
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +4 -4
- package/build/umd/index.production.js.map +1 -1
- package/package.json +12 -10
- package/src/CatchBoundary.tsx +101 -0
- package/src/Matches.tsx +423 -0
- package/src/RouterProvider.tsx +252 -0
- package/src/awaited.tsx +40 -0
- package/src/defer.ts +55 -0
- package/src/fileRoute.ts +152 -0
- package/src/history.ts +8 -0
- package/src/index.tsx +28 -619
- package/src/lazyRouteComponent.tsx +33 -0
- package/src/link.tsx +603 -0
- package/src/location.ts +13 -0
- package/src/path.ts +261 -0
- package/src/qss.ts +53 -0
- package/src/redirects.ts +39 -0
- package/src/route.ts +882 -0
- package/src/routeInfo.ts +84 -0
- package/src/router.ts +1671 -0
- package/src/scroll-restoration.tsx +230 -0
- package/src/searchParams.ts +79 -0
- package/src/useBlocker.tsx +27 -0
- package/src/useNavigate.tsx +111 -0
- package/src/useParams.tsx +25 -0
- package/src/useSearch.tsx +25 -0
- package/src/utils.ts +360 -0
- package/build/cjs/react-router/src/index.js +0 -458
- package/build/cjs/react-router/src/index.js.map +0 -1
- package/build/cjs/router-core/build/esm/index.js +0 -2524
- package/build/cjs/router-core/build/esm/index.js.map +0 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
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
|
+
var withSelector_development = require('../../../../../../../_virtual/with-selector.development.js');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var require$$1 = require('use-sync-external-store/shim');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var hasRequiredWithSelector_development;
|
|
28
|
+
|
|
29
|
+
function requireWithSelector_development () {
|
|
30
|
+
if (hasRequiredWithSelector_development) return withSelector_development.__exports;
|
|
31
|
+
hasRequiredWithSelector_development = 1;
|
|
32
|
+
|
|
33
|
+
if (process.env.NODE_ENV !== "production") {
|
|
34
|
+
(function() {
|
|
35
|
+
|
|
36
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
37
|
+
if (
|
|
38
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
39
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
40
|
+
'function'
|
|
41
|
+
) {
|
|
42
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
43
|
+
}
|
|
44
|
+
var React$1 = React;
|
|
45
|
+
var shim = require$$1;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
49
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
50
|
+
*/
|
|
51
|
+
function is(x, y) {
|
|
52
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
53
|
+
;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
57
|
+
|
|
58
|
+
var useSyncExternalStore = shim.useSyncExternalStore;
|
|
59
|
+
|
|
60
|
+
// for CommonJS interop.
|
|
61
|
+
|
|
62
|
+
var useRef = React$1.useRef,
|
|
63
|
+
useEffect = React$1.useEffect,
|
|
64
|
+
useMemo = React$1.useMemo,
|
|
65
|
+
useDebugValue = React$1.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
|
|
66
|
+
|
|
67
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
68
|
+
// Use this to track the rendered snapshot.
|
|
69
|
+
var instRef = useRef(null);
|
|
70
|
+
var inst;
|
|
71
|
+
|
|
72
|
+
if (instRef.current === null) {
|
|
73
|
+
inst = {
|
|
74
|
+
hasValue: false,
|
|
75
|
+
value: null
|
|
76
|
+
};
|
|
77
|
+
instRef.current = inst;
|
|
78
|
+
} else {
|
|
79
|
+
inst = instRef.current;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var _useMemo = useMemo(function () {
|
|
83
|
+
// Track the memoized state using closure variables that are local to this
|
|
84
|
+
// memoized instance of a getSnapshot function. Intentionally not using a
|
|
85
|
+
// useRef hook, because that state would be shared across all concurrent
|
|
86
|
+
// copies of the hook/component.
|
|
87
|
+
var hasMemo = false;
|
|
88
|
+
var memoizedSnapshot;
|
|
89
|
+
var memoizedSelection;
|
|
90
|
+
|
|
91
|
+
var memoizedSelector = function (nextSnapshot) {
|
|
92
|
+
if (!hasMemo) {
|
|
93
|
+
// The first time the hook is called, there is no memoized result.
|
|
94
|
+
hasMemo = true;
|
|
95
|
+
memoizedSnapshot = nextSnapshot;
|
|
96
|
+
|
|
97
|
+
var _nextSelection = selector(nextSnapshot);
|
|
98
|
+
|
|
99
|
+
if (isEqual !== undefined) {
|
|
100
|
+
// Even if the selector has changed, the currently rendered selection
|
|
101
|
+
// may be equal to the new selection. We should attempt to reuse the
|
|
102
|
+
// current value if possible, to preserve downstream memoizations.
|
|
103
|
+
if (inst.hasValue) {
|
|
104
|
+
var currentSelection = inst.value;
|
|
105
|
+
|
|
106
|
+
if (isEqual(currentSelection, _nextSelection)) {
|
|
107
|
+
memoizedSelection = currentSelection;
|
|
108
|
+
return currentSelection;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
memoizedSelection = _nextSelection;
|
|
114
|
+
return _nextSelection;
|
|
115
|
+
} // We may be able to reuse the previous invocation's result.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// We may be able to reuse the previous invocation's result.
|
|
119
|
+
var prevSnapshot = memoizedSnapshot;
|
|
120
|
+
var prevSelection = memoizedSelection;
|
|
121
|
+
|
|
122
|
+
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
123
|
+
// The snapshot is the same as last time. Reuse the previous selection.
|
|
124
|
+
return prevSelection;
|
|
125
|
+
} // The snapshot has changed, so we need to compute a new selection.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
// The snapshot has changed, so we need to compute a new selection.
|
|
129
|
+
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
|
|
130
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
131
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
132
|
+
// out of rendering.
|
|
133
|
+
|
|
134
|
+
// If a custom isEqual function is provided, use that to check if the data
|
|
135
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
136
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
137
|
+
// out of rendering.
|
|
138
|
+
if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
|
|
139
|
+
return prevSelection;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
memoizedSnapshot = nextSnapshot;
|
|
143
|
+
memoizedSelection = nextSelection;
|
|
144
|
+
return nextSelection;
|
|
145
|
+
}; // Assigning this to a constant so that Flow knows it can't change.
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
// Assigning this to a constant so that Flow knows it can't change.
|
|
149
|
+
var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
|
|
150
|
+
|
|
151
|
+
var getSnapshotWithSelector = function () {
|
|
152
|
+
return memoizedSelector(getSnapshot());
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
|
|
156
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
157
|
+
};
|
|
158
|
+
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
159
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual]),
|
|
160
|
+
getSelection = _useMemo[0],
|
|
161
|
+
getServerSelection = _useMemo[1];
|
|
162
|
+
|
|
163
|
+
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
164
|
+
useEffect(function () {
|
|
165
|
+
inst.hasValue = true;
|
|
166
|
+
inst.value = value;
|
|
167
|
+
}, [value]);
|
|
168
|
+
useDebugValue(value);
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
withSelector_development.__exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
173
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
174
|
+
if (
|
|
175
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
176
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
177
|
+
'function'
|
|
178
|
+
) {
|
|
179
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
})();
|
|
183
|
+
}
|
|
184
|
+
return withSelector_development.__exports;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
exports.__require = requireWithSelector_development;
|
|
188
|
+
//# sourceMappingURL=with-selector.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.development.js","sources":["../../../../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["React","require$$0","withSelector_development"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;AACA,CAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AAC3C,GAAE,CAAC,WAAW;AAGd;AACA;AACA,CAAA;GACE,OAAO,8BAA8B,KAAK,WAAW;GACrD,OAAO,8BAA8B,CAAC,2BAA2B;AACnE,KAAI,UAAU;GACZ;GACA,8BAA8B,CAAC,2BAA2B,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;EACzE;AACD,WAAU,IAAIA,OAAK,GAAGC,KAAgB,CAAC;CACvC,IAAI,IAAI,GAAG,UAAuC,CAAC;AACn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+
*
|
|
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
|
+
var withSelector_production_min = require('../../../../../../../_virtual/with-selector.production.min.js');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var require$$1 = require('use-sync-external-store/shim');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var hasRequiredWithSelector_production_min;
|
|
28
|
+
|
|
29
|
+
function requireWithSelector_production_min () {
|
|
30
|
+
if (hasRequiredWithSelector_production_min) return withSelector_production_min.__exports;
|
|
31
|
+
hasRequiredWithSelector_production_min = 1;
|
|
32
|
+
var h=React,n=require$$1;function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
|
|
33
|
+
withSelector_production_min.__exports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f;}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return [function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
|
|
34
|
+
u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
|
|
35
|
+
return withSelector_production_min.__exports;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.__require = requireWithSelector_production_min;
|
|
39
|
+
//# sourceMappingURL=with-selector.production.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.production.min.js","sources":["../../../../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n"],"names":["require$$0","withSelector_production_min"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASa,IAAI,CAAC,CAACA,KAAgB,CAAC,CAAC,CAAC,UAAuC,CAAC,SAAS,CAAC,CAAC,CAAC,CA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvf,CAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
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
|
+
var withSelector = require('../../../../../../_virtual/with-selector.js');
|
|
14
|
+
var withSelector_development = require('../cjs/use-sync-external-store-shim/with-selector.development.js');
|
|
15
|
+
var withSelector_production_min = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');
|
|
16
|
+
|
|
17
|
+
if (process.env.NODE_ENV === 'production') {
|
|
18
|
+
withSelector.__module.exports = withSelector_production_min.__require();
|
|
19
|
+
} else {
|
|
20
|
+
withSelector.__module.exports = withSelector_development.__require();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var withSelectorExports = withSelector.__module.exports;
|
|
24
|
+
|
|
25
|
+
exports.withSelectorExports = withSelectorExports;
|
|
26
|
+
//# sourceMappingURL=with-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.js","sources":["../../../../../../../../../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["withSelectorModule","require$$1","require$$0"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AAC3C,EAAEA,qBAAA,CAAA,OAAc,GAAGC,qCAAA,EAA8E,CAAC;AAClG,CAAC,MAAM;AACP,EAAED,qBAAA,CAAA,OAAc,GAAGE,kCAAA,EAA2E,CAAC;AAC/F,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
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
|
+
var React = require('react');
|
|
14
|
+
|
|
15
|
+
function _interopNamespaceDefault(e) {
|
|
16
|
+
var n = Object.create(null);
|
|
17
|
+
if (e) {
|
|
18
|
+
Object.keys(e).forEach(function (k) {
|
|
19
|
+
if (k !== 'default') {
|
|
20
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return e[k]; }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
n.default = e;
|
|
29
|
+
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
|
+
|
|
34
|
+
function CatchBoundary(props) {
|
|
35
|
+
const errorComponent = props.errorComponent ?? ErrorComponent;
|
|
36
|
+
return /*#__PURE__*/React__namespace.createElement(CatchBoundaryImpl, {
|
|
37
|
+
resetKey: props.resetKey,
|
|
38
|
+
onCatch: props.onCatch,
|
|
39
|
+
children: ({
|
|
40
|
+
error
|
|
41
|
+
}) => {
|
|
42
|
+
if (error) {
|
|
43
|
+
return /*#__PURE__*/React__namespace.createElement(errorComponent, {
|
|
44
|
+
error
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return props.children;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
class CatchBoundaryImpl extends React__namespace.Component {
|
|
52
|
+
state = {
|
|
53
|
+
error: null
|
|
54
|
+
};
|
|
55
|
+
static getDerivedStateFromError(error) {
|
|
56
|
+
return {
|
|
57
|
+
error
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
componentDidUpdate(prevProps, prevState) {
|
|
61
|
+
if (prevState.error && prevProps.resetKey !== this.props.resetKey) {
|
|
62
|
+
this.setState({
|
|
63
|
+
error: null
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
componentDidCatch(error) {
|
|
68
|
+
console.error(error);
|
|
69
|
+
this.props.onCatch?.(error);
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return this.props.children(this.state);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function ErrorComponent({
|
|
76
|
+
error
|
|
77
|
+
}) {
|
|
78
|
+
const [show, setShow] = React__namespace.useState(process.env.NODE_ENV !== 'production');
|
|
79
|
+
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
80
|
+
style: {
|
|
81
|
+
padding: '.5rem',
|
|
82
|
+
maxWidth: '100%'
|
|
83
|
+
}
|
|
84
|
+
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
85
|
+
style: {
|
|
86
|
+
display: 'flex',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
gap: '.5rem'
|
|
89
|
+
}
|
|
90
|
+
}, /*#__PURE__*/React__namespace.createElement("strong", {
|
|
91
|
+
style: {
|
|
92
|
+
fontSize: '1rem'
|
|
93
|
+
}
|
|
94
|
+
}, "Something went wrong!"), /*#__PURE__*/React__namespace.createElement("button", {
|
|
95
|
+
style: {
|
|
96
|
+
appearance: 'none',
|
|
97
|
+
fontSize: '.6em',
|
|
98
|
+
border: '1px solid currentColor',
|
|
99
|
+
padding: '.1rem .2rem',
|
|
100
|
+
fontWeight: 'bold',
|
|
101
|
+
borderRadius: '.25rem'
|
|
102
|
+
},
|
|
103
|
+
onClick: () => setShow(d => !d)
|
|
104
|
+
}, show ? 'Hide Error' : 'Show Error')), /*#__PURE__*/React__namespace.createElement("div", {
|
|
105
|
+
style: {
|
|
106
|
+
height: '.25rem'
|
|
107
|
+
}
|
|
108
|
+
}), show ? /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("pre", {
|
|
109
|
+
style: {
|
|
110
|
+
fontSize: '.7em',
|
|
111
|
+
border: '1px solid red',
|
|
112
|
+
borderRadius: '.25rem',
|
|
113
|
+
padding: '.3rem',
|
|
114
|
+
color: 'red',
|
|
115
|
+
overflow: 'auto'
|
|
116
|
+
}
|
|
117
|
+
}, error.message ? /*#__PURE__*/React__namespace.createElement("code", null, error.message) : null)) : null);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
exports.CatchBoundary = CatchBoundary;
|
|
121
|
+
exports.CatchBoundaryImpl = CatchBoundaryImpl;
|
|
122
|
+
exports.ErrorComponent = ErrorComponent;
|
|
123
|
+
//# sourceMappingURL=CatchBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatchBoundary.js","sources":["../../../../../src/CatchBoundary.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport function CatchBoundary(props: {\n resetKey: string\n children: any\n errorComponent?: any\n onCatch: (error: any) => void\n}) {\n const errorComponent = props.errorComponent ?? ErrorComponent\n\n return (\n <CatchBoundaryImpl\n resetKey={props.resetKey}\n onCatch={props.onCatch}\n children={({ error }) => {\n if (error) {\n return React.createElement(errorComponent, {\n error,\n })\n }\n\n return props.children\n }}\n />\n )\n}\n\nexport class CatchBoundaryImpl extends React.Component<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: (error: any) => void\n}> {\n state = { error: null } as any\n static getDerivedStateFromError(error: any) {\n return { error }\n }\n componentDidUpdate(\n prevProps: Readonly<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: ((error: any, info: any) => void) | undefined\n }>,\n prevState: any,\n ): void {\n if (prevState.error && prevProps.resetKey !== this.props.resetKey) {\n this.setState({ error: null })\n }\n }\n componentDidCatch(error: any) {\n console.error(error)\n this.props.onCatch?.(error)\n }\n render() {\n return this.props.children(this.state)\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"names":["CatchBoundary","props","errorComponent","ErrorComponent","React","createElement","CatchBoundaryImpl","resetKey","onCatch","children","error","Component","state","getDerivedStateFromError","componentDidUpdate","prevProps","prevState","setState","componentDidCatch","console","render","show","setShow","useState","process","env","NODE_ENV","style","padding","maxWidth","display","alignItems","gap","fontSize","appearance","border","fontWeight","borderRadius","onClick","d","height","color","overflow","message"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAASA,aAAaA,CAACC,KAK7B,EAAE;AACD,EAAA,MAAMC,cAAc,GAAGD,KAAK,CAACC,cAAc,IAAIC,cAAc,CAAA;AAE7D,EAAA,oBACEC,gBAAA,CAAAC,aAAA,CAACC,iBAAiB,EAAA;IAChBC,QAAQ,EAAEN,KAAK,CAACM,QAAS;IACzBC,OAAO,EAAEP,KAAK,CAACO,OAAQ;AACvBC,IAAAA,QAAQ,EAAEA,CAAC;AAAEC,MAAAA,KAAAA;AAAM,KAAC,KAAK;AACvB,MAAA,IAAIA,KAAK,EAAE;AACT,QAAA,oBAAON,gBAAK,CAACC,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,MAAAA,OAAO,EAAE,OAAO;AAChBa,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,QAAQ,EAAE,MAAA;AACZ,KAAA;AAAE,GAAA,EAEDhC,KAAK,CAACiC,OAAO,gBAAGvC,gBAAA,CAAAC,aAAA,CAAOK,MAAAA,EAAAA,IAAAA,EAAAA,KAAK,CAACiC,OAAc,CAAC,GAAG,IAC7C,CACF,CAAC,GACJ,IACD,CAAC,CAAA;AAEV;;;;;;"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
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
|
+
var React = require('react');
|
|
14
|
+
var invariant = require('tiny-invariant');
|
|
15
|
+
var warning = require('tiny-warning');
|
|
16
|
+
var CatchBoundary = require('./CatchBoundary.js');
|
|
17
|
+
var RouterProvider = require('./RouterProvider.js');
|
|
18
|
+
var route = require('./route.js');
|
|
19
|
+
|
|
20
|
+
function _interopNamespaceDefault(e) {
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
n.default = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
38
|
+
|
|
39
|
+
function Matches() {
|
|
40
|
+
const {
|
|
41
|
+
routesById,
|
|
42
|
+
state
|
|
43
|
+
} = RouterProvider.useRouter();
|
|
44
|
+
const {
|
|
45
|
+
matches
|
|
46
|
+
} = state;
|
|
47
|
+
const locationKey = RouterProvider.useRouterState().location.state.key;
|
|
48
|
+
const route$1 = routesById[route.rootRouteId];
|
|
49
|
+
const errorComponent = React__namespace.useCallback(props => {
|
|
50
|
+
return /*#__PURE__*/React__namespace.createElement(CatchBoundary.ErrorComponent, {
|
|
51
|
+
...props,
|
|
52
|
+
useMatch: route$1.useMatch,
|
|
53
|
+
useRouteContext: route$1.useRouteContext,
|
|
54
|
+
useSearch: route$1.useSearch,
|
|
55
|
+
useParams: route$1.useParams
|
|
56
|
+
});
|
|
57
|
+
}, [route$1]);
|
|
58
|
+
return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
|
|
59
|
+
value: matches
|
|
60
|
+
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary.CatchBoundary, {
|
|
61
|
+
resetKey: locationKey,
|
|
62
|
+
errorComponent: errorComponent,
|
|
63
|
+
onCatch: () => {
|
|
64
|
+
warning(false, `Error in router! Consider setting an 'errorComponent' in your RootRoute! 👍`);
|
|
65
|
+
}
|
|
66
|
+
}, matches.length ? /*#__PURE__*/React__namespace.createElement(Match, {
|
|
67
|
+
matches: matches
|
|
68
|
+
}) : null));
|
|
69
|
+
}
|
|
70
|
+
function SafeFragment(props) {
|
|
71
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, props.children);
|
|
72
|
+
}
|
|
73
|
+
function Match({
|
|
74
|
+
matches
|
|
75
|
+
}) {
|
|
76
|
+
const {
|
|
77
|
+
options,
|
|
78
|
+
routesById
|
|
79
|
+
} = RouterProvider.useRouter();
|
|
80
|
+
const match = matches[0];
|
|
81
|
+
const routeId = match?.routeId;
|
|
82
|
+
const route = routesById[routeId];
|
|
83
|
+
const router = RouterProvider.useRouter();
|
|
84
|
+
const locationKey = router.latestLocation.state?.key;
|
|
85
|
+
// const locationKey = useRouterState().location.state?.key
|
|
86
|
+
|
|
87
|
+
const PendingComponent = route.options.pendingComponent ?? options.defaultPendingComponent;
|
|
88
|
+
const pendingElement = PendingComponent ? /*#__PURE__*/React__namespace.createElement(PendingComponent, {
|
|
89
|
+
useMatch: route.useMatch,
|
|
90
|
+
useRouteContext: route.useRouteContext,
|
|
91
|
+
useSearch: route.useSearch,
|
|
92
|
+
useParams: route.useParams
|
|
93
|
+
}) : undefined;
|
|
94
|
+
const routeErrorComponent = route.options.errorComponent ?? options.defaultErrorComponent ?? CatchBoundary.ErrorComponent;
|
|
95
|
+
const ResolvedSuspenseBoundary = route.options.wrapInSuspense ?? pendingElement ? React__namespace.Suspense : SafeFragment;
|
|
96
|
+
const errorComponent = routeErrorComponent ? React__namespace.useCallback(props => {
|
|
97
|
+
return /*#__PURE__*/React__namespace.createElement(routeErrorComponent, {
|
|
98
|
+
...props,
|
|
99
|
+
useMatch: route.useMatch,
|
|
100
|
+
useRouteContext: route.useRouteContext,
|
|
101
|
+
useSearch: route.useSearch,
|
|
102
|
+
useParams: route.useParams
|
|
103
|
+
});
|
|
104
|
+
}, [route]) : undefined;
|
|
105
|
+
const ResolvedCatchBoundary = errorComponent ? CatchBoundary.CatchBoundary : SafeFragment;
|
|
106
|
+
return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
|
|
107
|
+
value: matches
|
|
108
|
+
}, /*#__PURE__*/React__namespace.createElement(ResolvedSuspenseBoundary, {
|
|
109
|
+
fallback: pendingElement
|
|
110
|
+
}, /*#__PURE__*/React__namespace.createElement(ResolvedCatchBoundary, {
|
|
111
|
+
resetKey: locationKey,
|
|
112
|
+
errorComponent: errorComponent,
|
|
113
|
+
onCatch: () => {
|
|
114
|
+
warning(false, `Error in route match: ${match.id}`);
|
|
115
|
+
}
|
|
116
|
+
}, /*#__PURE__*/React__namespace.createElement(MatchInner, {
|
|
117
|
+
match: match,
|
|
118
|
+
pendingElement: pendingElement
|
|
119
|
+
}))));
|
|
120
|
+
}
|
|
121
|
+
function MatchInner({
|
|
122
|
+
match,
|
|
123
|
+
pendingElement
|
|
124
|
+
}) {
|
|
125
|
+
const {
|
|
126
|
+
options,
|
|
127
|
+
routesById
|
|
128
|
+
} = RouterProvider.useRouter();
|
|
129
|
+
const route = routesById[match.routeId];
|
|
130
|
+
if (match.status === 'error') {
|
|
131
|
+
throw match.error;
|
|
132
|
+
}
|
|
133
|
+
if (match.status === 'pending') {
|
|
134
|
+
if (match.showPending) {
|
|
135
|
+
return pendingElement || null;
|
|
136
|
+
}
|
|
137
|
+
throw match.loadPromise;
|
|
138
|
+
}
|
|
139
|
+
if (match.status === 'success') {
|
|
140
|
+
let comp = route.options.component ?? options.defaultComponent;
|
|
141
|
+
if (comp) {
|
|
142
|
+
return /*#__PURE__*/React__namespace.createElement(comp, {
|
|
143
|
+
useMatch: route.useMatch,
|
|
144
|
+
useRouteContext: route.useRouteContext,
|
|
145
|
+
useSearch: route.useSearch,
|
|
146
|
+
useParams: route.useParams,
|
|
147
|
+
useLoaderData: route.useLoaderData
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return /*#__PURE__*/React__namespace.createElement(Outlet, null);
|
|
151
|
+
}
|
|
152
|
+
invariant(false, 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!');
|
|
153
|
+
}
|
|
154
|
+
function Outlet() {
|
|
155
|
+
const matches = React__namespace.useContext(matchesContext).slice(1);
|
|
156
|
+
if (!matches[0]) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return /*#__PURE__*/React__namespace.createElement(Match, {
|
|
160
|
+
matches: matches
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function useMatchRoute() {
|
|
164
|
+
const {
|
|
165
|
+
matchRoute
|
|
166
|
+
} = RouterProvider.useRouter();
|
|
167
|
+
return React__namespace.useCallback(opts => {
|
|
168
|
+
const {
|
|
169
|
+
pending,
|
|
170
|
+
caseSensitive,
|
|
171
|
+
...rest
|
|
172
|
+
} = opts;
|
|
173
|
+
return matchRoute(rest, {
|
|
174
|
+
pending,
|
|
175
|
+
caseSensitive
|
|
176
|
+
});
|
|
177
|
+
}, []);
|
|
178
|
+
}
|
|
179
|
+
function MatchRoute(props) {
|
|
180
|
+
const matchRoute = useMatchRoute();
|
|
181
|
+
const params = matchRoute(props);
|
|
182
|
+
if (typeof props.children === 'function') {
|
|
183
|
+
return props.children(params);
|
|
184
|
+
}
|
|
185
|
+
return !!params ? props.children : null;
|
|
186
|
+
}
|
|
187
|
+
function useMatch(opts) {
|
|
188
|
+
const nearestMatch = React__namespace.useContext(matchesContext)[0];
|
|
189
|
+
const nearestMatchRouteId = nearestMatch?.routeId;
|
|
190
|
+
const matchRouteId = RouterProvider.useRouterState({
|
|
191
|
+
select: state => {
|
|
192
|
+
const match = opts?.from ? state.matches.find(d => d.routeId === opts?.from) : state.matches.find(d => d.id === nearestMatch.id);
|
|
193
|
+
return match.routeId;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
if (opts?.strict ?? true) {
|
|
197
|
+
invariant(nearestMatchRouteId == matchRouteId, `useMatch("${matchRouteId}") is being called in a component that is meant to render the '${nearestMatchRouteId}' route. Did you mean to 'useMatch("${matchRouteId}", { strict: false })' or 'useRoute("${matchRouteId}")' instead?`);
|
|
198
|
+
}
|
|
199
|
+
const matchSelection = RouterProvider.useRouterState({
|
|
200
|
+
select: state => {
|
|
201
|
+
const match = opts?.from ? state.matches.find(d => d.routeId === opts?.from) : state.matches.find(d => d.id === nearestMatch.id);
|
|
202
|
+
invariant(match, `Could not find ${opts?.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);
|
|
203
|
+
return opts?.select ? opts.select(match) : match;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return matchSelection;
|
|
207
|
+
}
|
|
208
|
+
const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
209
|
+
function useMatches(opts) {
|
|
210
|
+
const contextMatches = React__namespace.useContext(matchesContext);
|
|
211
|
+
return RouterProvider.useRouterState({
|
|
212
|
+
select: state => {
|
|
213
|
+
const matches = state.matches.slice(state.matches.findIndex(d => d.id === contextMatches[0]?.id));
|
|
214
|
+
return opts?.select ? opts.select(matches) : matches;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function useLoaderData(opts) {
|
|
219
|
+
const match = useMatch({
|
|
220
|
+
...opts,
|
|
221
|
+
select: undefined
|
|
222
|
+
});
|
|
223
|
+
return typeof opts.select === 'function' ? opts.select(match?.loaderData) : match?.loaderData;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
exports.Match = Match;
|
|
227
|
+
exports.MatchRoute = MatchRoute;
|
|
228
|
+
exports.Matches = Matches;
|
|
229
|
+
exports.Outlet = Outlet;
|
|
230
|
+
exports.matchesContext = matchesContext;
|
|
231
|
+
exports.useLoaderData = useLoaderData;
|
|
232
|
+
exports.useMatch = useMatch;
|
|
233
|
+
exports.useMatchRoute = useMatchRoute;
|
|
234
|
+
exports.useMatches = useMatches;
|
|
235
|
+
//# sourceMappingURL=Matches.js.map
|