@tanstack/react-router 0.0.1-alpha.5 → 0.0.1-alpha.6

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.
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
4014
4014
  </script>
4015
4015
  <script>
4016
4016
  /*<!--*/
4017
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"138f-25","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"138f-27"},{"name":"react-router/src/index.tsx","uid":"138f-29"}]}]}],"isRoot":true},"nodeParts":{"138f-25":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"138f-24"},"138f-27":{"renderedLength":69909,"gzipLength":14557,"brotliLength":0,"mainUid":"138f-26"},"138f-29":{"renderedLength":11456,"gzipLength":2963,"brotliLength":0,"mainUid":"138f-28"}},"nodeMetas":{"138f-24":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"138f-25"},"imported":[],"importedBy":[{"uid":"138f-28"}]},"138f-26":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"138f-27"},"imported":[],"importedBy":[{"uid":"138f-28"}]},"138f-28":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"138f-29"},"imported":[{"uid":"138f-24"},{"uid":"138f-30"},{"uid":"138f-31"},{"uid":"138f-26"}],"importedBy":[],"isEntry":true},"138f-30":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"138f-28"}],"isExternal":true},"138f-31":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"138f-28"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"19e6-25","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"19e6-27"},{"name":"react-router/src/index.tsx","uid":"19e6-29"}]}]}],"isRoot":true},"nodeParts":{"19e6-25":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"19e6-24"},"19e6-27":{"renderedLength":69986,"gzipLength":14566,"brotliLength":0,"mainUid":"19e6-26"},"19e6-29":{"renderedLength":11513,"gzipLength":2992,"brotliLength":0,"mainUid":"19e6-28"}},"nodeMetas":{"19e6-24":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"19e6-25"},"imported":[],"importedBy":[{"uid":"19e6-28"}]},"19e6-26":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"19e6-27"},"imported":[],"importedBy":[{"uid":"19e6-28"}]},"19e6-28":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"19e6-29"},"imported":[{"uid":"19e6-24"},{"uid":"19e6-30"},{"uid":"19e6-31"},{"uid":"19e6-26"}],"importedBy":[],"isEntry":true},"19e6-30":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"19e6-28"}],"isExternal":true},"19e6-31":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"19e6-28"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4018
4018
 
4019
4019
  const run = () => {
4020
4020
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "138f-33",
10
+ "uid": "19e6-33",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,11 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "router-core/build/esm/index.js",
18
- "uid": "138f-35"
18
+ "uid": "19e6-35"
19
19
  },
20
20
  {
21
21
  "name": "react-router/src/index.tsx",
22
- "uid": "138f-37"
22
+ "uid": "19e6-37"
23
23
  }
24
24
  ]
25
25
  }
@@ -29,90 +29,90 @@
29
29
  "isRoot": true
30
30
  },
31
31
  "nodeParts": {
32
- "138f-33": {
32
+ "19e6-33": {
33
33
  "renderedLength": 798,
34
34
  "gzipLength": 366,
35
35
  "brotliLength": 0,
36
- "mainUid": "138f-32"
36
+ "mainUid": "19e6-32"
37
37
  },
38
- "138f-35": {
39
- "renderedLength": 69909,
40
- "gzipLength": 14557,
38
+ "19e6-35": {
39
+ "renderedLength": 69986,
40
+ "gzipLength": 14566,
41
41
  "brotliLength": 0,
42
- "mainUid": "138f-34"
42
+ "mainUid": "19e6-34"
43
43
  },
44
- "138f-37": {
45
- "renderedLength": 11456,
46
- "gzipLength": 2963,
44
+ "19e6-37": {
45
+ "renderedLength": 11513,
46
+ "gzipLength": 2992,
47
47
  "brotliLength": 0,
48
- "mainUid": "138f-36"
48
+ "mainUid": "19e6-36"
49
49
  }
50
50
  },
51
51
  "nodeMetas": {
52
- "138f-32": {
52
+ "19e6-32": {
53
53
  "id": "\u0000rollupPluginBabelHelpers.js",
54
54
  "moduleParts": {
55
- "index.production.js": "138f-33"
55
+ "index.production.js": "19e6-33"
56
56
  },
57
57
  "imported": [],
58
58
  "importedBy": [
59
59
  {
60
- "uid": "138f-36"
60
+ "uid": "19e6-36"
61
61
  }
62
62
  ]
63
63
  },
64
- "138f-34": {
64
+ "19e6-34": {
65
65
  "id": "/packages/router-core/build/esm/index.js",
66
66
  "moduleParts": {
67
- "index.production.js": "138f-35"
67
+ "index.production.js": "19e6-35"
68
68
  },
69
69
  "imported": [],
70
70
  "importedBy": [
71
71
  {
72
- "uid": "138f-36"
72
+ "uid": "19e6-36"
73
73
  }
74
74
  ]
75
75
  },
76
- "138f-36": {
76
+ "19e6-36": {
77
77
  "id": "/packages/react-router/src/index.tsx",
78
78
  "moduleParts": {
79
- "index.production.js": "138f-37"
79
+ "index.production.js": "19e6-37"
80
80
  },
81
81
  "imported": [
82
82
  {
83
- "uid": "138f-32"
83
+ "uid": "19e6-32"
84
84
  },
85
85
  {
86
- "uid": "138f-38"
86
+ "uid": "19e6-38"
87
87
  },
88
88
  {
89
- "uid": "138f-39"
89
+ "uid": "19e6-39"
90
90
  },
91
91
  {
92
- "uid": "138f-34"
92
+ "uid": "19e6-34"
93
93
  }
94
94
  ],
95
95
  "importedBy": [],
96
96
  "isEntry": true
97
97
  },
98
- "138f-38": {
98
+ "19e6-38": {
99
99
  "id": "react",
100
100
  "moduleParts": {},
101
101
  "imported": [],
102
102
  "importedBy": [
103
103
  {
104
- "uid": "138f-36"
104
+ "uid": "19e6-36"
105
105
  }
106
106
  ],
107
107
  "isExternal": true
108
108
  },
109
- "138f-39": {
109
+ "19e6-39": {
110
110
  "id": "use-sync-external-store/shim",
111
111
  "moduleParts": {},
112
112
  "imported": [],
113
113
  "importedBy": [
114
114
  {
115
- "uid": "138f-36"
115
+ "uid": "19e6-36"
116
116
  }
117
117
  ],
118
118
  "isExternal": true
@@ -65,13 +65,9 @@ declare type RouterProps<TRouteConfig extends AnyRouteConfig = RouteConfig, TAll
65
65
  children?: React.ReactNode;
66
66
  };
67
67
  declare function RouterProvider<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>): JSX.Element;
68
- declare function useRouter(): Router;
69
- declare function useMatches(): RouteMatch[];
70
- declare function useParentMatches(): RouteMatch[];
71
- declare function useMatch<T>(): RouteMatch;
72
68
  declare function Outlet(): JSX.Element | null;
73
69
  declare function DefaultCatchBoundary({ error }: {
74
70
  error: any;
75
71
  }): JSX.Element;
76
72
 
77
- export { DefaultCatchBoundary, MatchesProvider, MatchesProviderProps, Outlet, PromptProps, RouterProps, RouterProvider, createReactRouter, useMatch, useMatches, useParentMatches, useRouter };
73
+ export { DefaultCatchBoundary, MatchesProvider, MatchesProviderProps, Outlet, PromptProps, RouterProps, RouterProvider, createReactRouter };
@@ -1263,7 +1263,6 @@
1263
1263
  router.startedLoadingAt = id;
1264
1264
 
1265
1265
  if (next) {
1266
- // If the location.href has changed
1267
1266
  // Ingest the new location
1268
1267
  router.location = next;
1269
1268
  } // Clear out old actions
@@ -1508,7 +1507,7 @@
1508
1507
  const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
1509
1508
  [...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
1510
1509
  if (unloadedMatchIds.includes(match.matchId)) {
1511
- match.isInvalid = true;
1510
+ match.invalidate();
1512
1511
  }
1513
1512
  });
1514
1513
  },
@@ -1555,7 +1554,8 @@
1555
1554
  to = '.',
1556
1555
  search,
1557
1556
  hash,
1558
- replace
1557
+ replace,
1558
+ params
1559
1559
  } = _ref2;
1560
1560
  // If this link simply reloads the current route,
1561
1561
  // make sure it has a new key so it will trigger a data refresh
@@ -1575,7 +1575,9 @@
1575
1575
  from: fromString,
1576
1576
  to: toString,
1577
1577
  search,
1578
- hash
1578
+ hash,
1579
+ replace,
1580
+ params
1579
1581
  });
1580
1582
  },
1581
1583
  buildLink: _ref3 => {
@@ -1913,6 +1915,9 @@
1913
1915
 
1914
1916
  routeMatch.__.cancelPending();
1915
1917
  },
1918
+ invalidate: () => {
1919
+ routeMatch.isInvalid = true;
1920
+ },
1916
1921
  load: async () => {
1917
1922
  const id = '' + Date.now() + Math.random();
1918
1923
  routeMatch.__.latestId = id; // If the match was in an error state, set it
@@ -2578,29 +2583,33 @@
2578
2583
  value: router.state.matches
2579
2584
  }, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
2580
2585
  }
2586
+
2581
2587
  function useRouter() {
2582
2588
  const value = React__namespace.useContext(routerContext);
2583
2589
  warning(!value, 'useRouter must be used inside a <Router> component!');
2584
2590
  useRouterSubscription(value.router);
2585
2591
  return value.router;
2586
2592
  }
2593
+
2587
2594
  function useMatches() {
2588
2595
  return React__namespace.useContext(matchesContext);
2589
- }
2590
- function useParentMatches() {
2591
- const router = useRouter();
2592
-
2593
- const match = _useMatch();
2596
+ } // function useParentMatches(): RouteMatch[] {
2597
+ // const router = useRouter()
2598
+ // const match = useMatch()
2599
+ // const matches = router.state.matches
2600
+ // return matches.slice(
2601
+ // 0,
2602
+ // matches.findIndex((d) => d.matchId === match.matchId) - 1,
2603
+ // )
2604
+ // }
2594
2605
 
2595
- const matches = router.state.matches;
2596
- return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
2597
- }
2598
2606
 
2599
2607
  function _useMatch() {
2600
2608
  var _useMatches;
2601
2609
 
2602
2610
  return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
2603
2611
  }
2612
+
2604
2613
  function Outlet() {
2605
2614
  var _ref3, _childMatch$options$c;
2606
2615
 
@@ -2759,10 +2768,6 @@
2759
2768
  exports.resolvePath = _resolvePath;
2760
2769
  exports.rootRouteId = rootRouteId;
2761
2770
  exports.stringifySearchWith = stringifySearchWith;
2762
- exports.useMatch = _useMatch;
2763
- exports.useMatches = useMatches;
2764
- exports.useParentMatches = useParentMatches;
2765
- exports.useRouter = useRouter;
2766
2771
  exports.warning = warning;
2767
2772
 
2768
2773
  Object.defineProperty(exports, '__esModule', { value: true });