@tanstack/react-router 0.0.1-beta.30 → 0.0.1-beta.31

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.
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "bc11-73",
10
+ "uid": "6b80-73",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,15 +15,15 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js",
18
- "uid": "bc11-75"
18
+ "uid": "6b80-75"
19
19
  },
20
20
  {
21
21
  "name": "history@5.3.0/node_modules/history/index.js",
22
- "uid": "bc11-77"
22
+ "uid": "6b80-77"
23
23
  },
24
24
  {
25
25
  "name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
26
- "uid": "bc11-79"
26
+ "uid": "6b80-79"
27
27
  }
28
28
  ]
29
29
  },
@@ -32,11 +32,11 @@
32
32
  "children": [
33
33
  {
34
34
  "name": "router-core/build/esm/index.js",
35
- "uid": "bc11-81"
35
+ "uid": "6b80-81"
36
36
  },
37
37
  {
38
38
  "name": "react-router/src/index.tsx",
39
- "uid": "bc11-83"
39
+ "uid": "6b80-83"
40
40
  }
41
41
  ]
42
42
  }
@@ -46,155 +46,155 @@
46
46
  "isRoot": true
47
47
  },
48
48
  "nodeParts": {
49
- "bc11-73": {
49
+ "6b80-73": {
50
50
  "renderedLength": 793,
51
51
  "gzipLength": 363,
52
52
  "brotliLength": 0,
53
- "mainUid": "bc11-72"
53
+ "mainUid": "6b80-72"
54
54
  },
55
- "bc11-75": {
55
+ "6b80-75": {
56
56
  "renderedLength": 435,
57
57
  "gzipLength": 241,
58
58
  "brotliLength": 0,
59
- "mainUid": "bc11-74"
59
+ "mainUid": "6b80-74"
60
60
  },
61
- "bc11-77": {
61
+ "6b80-77": {
62
62
  "renderedLength": 20630,
63
63
  "gzipLength": 3800,
64
64
  "brotliLength": 0,
65
- "mainUid": "bc11-76"
65
+ "mainUid": "6b80-76"
66
66
  },
67
- "bc11-79": {
67
+ "6b80-79": {
68
68
  "renderedLength": 181,
69
69
  "gzipLength": 129,
70
70
  "brotliLength": 0,
71
- "mainUid": "bc11-78"
71
+ "mainUid": "6b80-78"
72
72
  },
73
- "bc11-81": {
74
- "renderedLength": 54734,
75
- "gzipLength": 12313,
73
+ "6b80-81": {
74
+ "renderedLength": 54705,
75
+ "gzipLength": 12303,
76
76
  "brotliLength": 0,
77
- "mainUid": "bc11-80"
77
+ "mainUid": "6b80-80"
78
78
  },
79
- "bc11-83": {
80
- "renderedLength": 14099,
81
- "gzipLength": 3516,
79
+ "6b80-83": {
80
+ "renderedLength": 14166,
81
+ "gzipLength": 3535,
82
82
  "brotliLength": 0,
83
- "mainUid": "bc11-82"
83
+ "mainUid": "6b80-82"
84
84
  }
85
85
  },
86
86
  "nodeMetas": {
87
- "bc11-72": {
87
+ "6b80-72": {
88
88
  "id": "\u0000rollupPluginBabelHelpers.js",
89
89
  "moduleParts": {
90
- "index.production.js": "bc11-73"
90
+ "index.production.js": "6b80-73"
91
91
  },
92
92
  "imported": [],
93
93
  "importedBy": [
94
94
  {
95
- "uid": "bc11-82"
95
+ "uid": "6b80-82"
96
96
  }
97
97
  ]
98
98
  },
99
- "bc11-74": {
99
+ "6b80-74": {
100
100
  "id": "/node_modules/.pnpm/@babel+runtime@7.20.6/node_modules/@babel/runtime/helpers/esm/extends.js",
101
101
  "moduleParts": {
102
- "index.production.js": "bc11-75"
102
+ "index.production.js": "6b80-75"
103
103
  },
104
104
  "imported": [],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "bc11-76"
107
+ "uid": "6b80-76"
108
108
  }
109
109
  ]
110
110
  },
111
- "bc11-76": {
111
+ "6b80-76": {
112
112
  "id": "/node_modules/.pnpm/history@5.3.0/node_modules/history/index.js",
113
113
  "moduleParts": {
114
- "index.production.js": "bc11-77"
114
+ "index.production.js": "6b80-77"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "bc11-74"
118
+ "uid": "6b80-74"
119
119
  }
120
120
  ],
121
121
  "importedBy": [
122
122
  {
123
- "uid": "bc11-80"
123
+ "uid": "6b80-80"
124
124
  }
125
125
  ]
126
126
  },
127
- "bc11-78": {
127
+ "6b80-78": {
128
128
  "id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
129
129
  "moduleParts": {
130
- "index.production.js": "bc11-79"
130
+ "index.production.js": "6b80-79"
131
131
  },
132
132
  "imported": [],
133
133
  "importedBy": [
134
134
  {
135
- "uid": "bc11-80"
135
+ "uid": "6b80-80"
136
136
  }
137
137
  ]
138
138
  },
139
- "bc11-80": {
139
+ "6b80-80": {
140
140
  "id": "/packages/router-core/build/esm/index.js",
141
141
  "moduleParts": {
142
- "index.production.js": "bc11-81"
142
+ "index.production.js": "6b80-81"
143
143
  },
144
144
  "imported": [
145
145
  {
146
- "uid": "bc11-76"
146
+ "uid": "6b80-76"
147
147
  },
148
148
  {
149
- "uid": "bc11-78"
149
+ "uid": "6b80-78"
150
150
  }
151
151
  ],
152
152
  "importedBy": [
153
153
  {
154
- "uid": "bc11-82"
154
+ "uid": "6b80-82"
155
155
  }
156
156
  ]
157
157
  },
158
- "bc11-82": {
158
+ "6b80-82": {
159
159
  "id": "/packages/react-router/src/index.tsx",
160
160
  "moduleParts": {
161
- "index.production.js": "bc11-83"
161
+ "index.production.js": "6b80-83"
162
162
  },
163
163
  "imported": [
164
164
  {
165
- "uid": "bc11-72"
165
+ "uid": "6b80-72"
166
166
  },
167
167
  {
168
- "uid": "bc11-84"
168
+ "uid": "6b80-84"
169
169
  },
170
170
  {
171
- "uid": "bc11-85"
171
+ "uid": "6b80-85"
172
172
  },
173
173
  {
174
- "uid": "bc11-80"
174
+ "uid": "6b80-80"
175
175
  }
176
176
  ],
177
177
  "importedBy": [],
178
178
  "isEntry": true
179
179
  },
180
- "bc11-84": {
180
+ "6b80-84": {
181
181
  "id": "react",
182
182
  "moduleParts": {},
183
183
  "imported": [],
184
184
  "importedBy": [
185
185
  {
186
- "uid": "bc11-82"
186
+ "uid": "6b80-82"
187
187
  }
188
188
  ],
189
189
  "isExternal": true
190
190
  },
191
- "bc11-85": {
191
+ "6b80-85": {
192
192
  "id": "use-sync-external-store/shim",
193
193
  "moduleParts": {},
194
194
  "imported": [],
195
195
  "importedBy": [
196
196
  {
197
- "uid": "bc11-82"
197
+ "uid": "6b80-82"
198
198
  }
199
199
  ],
200
200
  "isExternal": true
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import * as React from 'react';
12
- import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RouterState, RouteMatch, RouteInfo, DefaultAllRouteInfo, AnyRouteInfo, ResolveRelativePath, NoInfer, CheckId, ToIdOption, ValidFromPath, ToOptions, MatchRouteOptions, RouteInfoByPath, RegisteredAllRouteInfo, RegisteredRouter, RouterOptions, Router, Route, LinkOptions } from '@tanstack/router-core';
12
+ import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RouterState, RouteMatch, DefaultAllRouteInfo, AnyRouteInfo, RouteInfo, ResolveRelativePath, NoInfer, CheckId, ToIdOption, ValidFromPath, ToOptions, MatchRouteOptions, RouteInfoByPath, RegisteredAllRouteInfo, RegisteredRouter, RouterOptions, Router, Route, LinkOptions } from '@tanstack/router-core';
13
13
  export * from '@tanstack/router-core';
14
14
 
15
15
  type SyncRouteComponent<TProps = {}> = (props: TProps) => JSX.Element | React.ReactNode;
@@ -47,7 +47,6 @@ declare module '@tanstack/router-core' {
47
47
  interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
48
48
  useState: () => RouterState;
49
49
  useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(routeId: TId) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
50
- useNearestMatch: () => RouteMatch<TAllRouteInfo, RouteInfo>;
51
50
  useMatch: <TId extends keyof TAllRouteInfo['routeInfoById'], TStrict extends boolean = true>(routeId: TId, opts?: {
52
51
  strict?: TStrict;
53
52
  }) => TStrict extends true ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]> : RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]> | undefined;
@@ -1401,7 +1401,7 @@
1401
1401
  validate: () => {
1402
1402
  var _routeMatch$parentMat, _routeMatch$parentMat2;
1403
1403
  // Validate the search params and stabilize them
1404
- const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.location.search;
1404
+ const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.__location.search;
1405
1405
  try {
1406
1406
  var _validator;
1407
1407
  const prevSearch = routeMatch.routeSearch;
@@ -1639,7 +1639,7 @@
1639
1639
  basepath: '',
1640
1640
  routeTree: undefined,
1641
1641
  routesById: {},
1642
- location: undefined,
1642
+ __location: undefined,
1643
1643
  //
1644
1644
  resolveNavigation: () => {},
1645
1645
  matchCache: {},
@@ -1672,7 +1672,7 @@
1672
1672
  },
1673
1673
  dehydrate: () => {
1674
1674
  return {
1675
- location: router.location,
1675
+ location: router.__location,
1676
1676
  state: _extends({}, pick(router.state, ['status', 'location', 'lastUpdated', 'location']), {
1677
1677
  matches: router.state.matches.map(match => pick(match, ['matchId', 'status', 'routeLoaderData', 'loaderData', 'isInvalid', 'invalidAt']))
1678
1678
  }),
@@ -1681,13 +1681,13 @@
1681
1681
  },
1682
1682
  hydrate: dehydratedState => {
1683
1683
  // Update the location
1684
- router.location = dehydratedState.location;
1684
+ router.__location = dehydratedState.location;
1685
1685
 
1686
1686
  // Update the context
1687
1687
  router.options.context = dehydratedState.context;
1688
1688
 
1689
1689
  // Match the routes
1690
- const matches = router.matchRoutes(router.location.pathname, {
1690
+ const matches = router.matchRoutes(router.__location.pathname, {
1691
1691
  strictParseParams: true
1692
1692
  });
1693
1693
  matches.forEach((match, index) => {
@@ -1709,14 +1709,14 @@
1709
1709
 
1710
1710
  // If the current location isn't updated, trigger a navigation
1711
1711
  // to the current location. Otherwise, load the current location.
1712
- if (next.href !== router.location.href) {
1712
+ if (next.href !== router.__location.href) {
1713
1713
  router.__.commitLocation(next, true);
1714
1714
  }
1715
1715
  if (!router.state.matches.length) {
1716
1716
  router.load();
1717
1717
  }
1718
1718
  const unsub = router.history.listen(event => {
1719
- router.load(router.__.parseLocation(event.location, router.location));
1719
+ router.load(router.__.parseLocation(event.location, router.__location));
1720
1720
  });
1721
1721
 
1722
1722
  // addEventListener does not exist in React Native, but window does
@@ -1740,12 +1740,12 @@
1740
1740
  },
1741
1741
  update: opts => {
1742
1742
  const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
1743
- if (!router.location || newHistory) {
1743
+ if (!router.__location || newHistory) {
1744
1744
  if (opts != null && opts.history) {
1745
1745
  router.history = opts.history;
1746
1746
  }
1747
- router.location = router.__.parseLocation(router.history.location);
1748
- router.state.location = router.location;
1747
+ router.__location = router.__.parseLocation(router.history.location);
1748
+ router.state.location = router.__location;
1749
1749
  }
1750
1750
  Object.assign(router.options, opts);
1751
1751
  const {
@@ -1770,28 +1770,28 @@
1770
1770
  router.startedLoadingAt = id;
1771
1771
  if (next) {
1772
1772
  // Ingest the new location
1773
- router.location = next;
1773
+ router.__location = next;
1774
1774
  }
1775
1775
 
1776
1776
  // Cancel any pending matches
1777
1777
  router.cancelMatches();
1778
1778
 
1779
1779
  // Match the routes
1780
- const matches = router.matchRoutes(router.location.pathname, {
1780
+ const matches = router.matchRoutes(router.__location.pathname, {
1781
1781
  strictParseParams: true
1782
1782
  });
1783
1783
  if (typeof document !== 'undefined') {
1784
1784
  router.state = _extends({}, router.state, {
1785
1785
  pending: {
1786
1786
  matches: matches,
1787
- location: router.location
1787
+ location: router.__location
1788
1788
  },
1789
1789
  status: 'loading'
1790
1790
  });
1791
1791
  } else {
1792
1792
  router.state = _extends({}, router.state, {
1793
1793
  matches: matches,
1794
- location: router.location,
1794
+ location: router.__location,
1795
1795
  status: 'loading'
1796
1796
  });
1797
1797
  }
@@ -1875,7 +1875,7 @@
1875
1875
  }
1876
1876
  });
1877
1877
  router.state = _extends({}, router.state, {
1878
- location: router.location,
1878
+ location: router.__location,
1879
1879
  matches,
1880
1880
  pending: undefined,
1881
1881
  status: 'idle'
@@ -1904,7 +1904,7 @@
1904
1904
  },
1905
1905
  loadRoute: async function loadRoute(navigateOpts) {
1906
1906
  if (navigateOpts === void 0) {
1907
- navigateOpts = router.location;
1907
+ navigateOpts = router.__location;
1908
1908
  }
1909
1909
  const next = router.buildNext(navigateOpts);
1910
1910
  const matches = router.matchRoutes(next.pathname, {
@@ -1916,7 +1916,7 @@
1916
1916
  preloadRoute: async function preloadRoute(navigateOpts, loaderOpts) {
1917
1917
  var _ref3, _ref4, _loaderOpts$maxAge, _ref5, _ref6, _loaderOpts$gcMaxAge;
1918
1918
  if (navigateOpts === void 0) {
1919
- navigateOpts = router.location;
1919
+ navigateOpts = router.__location;
1920
1920
  }
1921
1921
  const next = router.buildNext(navigateOpts);
1922
1922
  const matches = router.matchRoutes(next.pathname, {
@@ -2296,11 +2296,9 @@
2296
2296
  if (dest === void 0) {
2297
2297
  dest = {};
2298
2298
  }
2299
- // const resolvedFrom: Location = {
2300
- // ...router.location,
2301
- const fromPathname = dest.fromCurrent ? router.location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.location.pathname;
2299
+ const fromPathname = dest.fromCurrent ? router.__location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.__location.pathname;
2302
2300
  let pathname = resolvePath((_router$basepath = router.basepath) != null ? _router$basepath : '/', fromPathname, "" + ((_dest$to = dest.to) != null ? _dest$to : '.'));
2303
- const fromMatches = router.matchRoutes(router.location.pathname, {
2301
+ const fromMatches = router.matchRoutes(router.__location.pathname, {
2304
2302
  strictParseParams: true
2305
2303
  });
2306
2304
  const toMatches = router.matchRoutes(pathname);
@@ -2314,7 +2312,7 @@
2314
2312
  pathname = interpolatePath(pathname, nextParams != null ? nextParams : {});
2315
2313
 
2316
2314
  // Pre filters first
2317
- const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.location.search) : router.location.search;
2315
+ const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.__location.search) : router.__location.search;
2318
2316
 
2319
2317
  // Then the link/navigate function
2320
2318
  const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
@@ -2324,15 +2322,15 @@
2324
2322
 
2325
2323
  // Then post filters
2326
2324
  const postFilteredSearch = (_dest$__postSearchFil = dest.__postSearchFilters) != null && _dest$__postSearchFil.length ? dest.__postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
2327
- const search = replaceEqualDeep(router.location.search, postFilteredSearch);
2325
+ const search = replaceEqualDeep(router.__location.search, postFilteredSearch);
2328
2326
  const searchStr = router.options.stringifySearch(search);
2329
- let hash = dest.hash === true ? router.location.hash : functionalUpdate(dest.hash, router.location.hash);
2327
+ let hash = dest.hash === true ? router.__location.hash : functionalUpdate(dest.hash, router.__location.hash);
2330
2328
  hash = hash ? "#" + hash : '';
2331
2329
  return {
2332
2330
  pathname,
2333
2331
  search,
2334
2332
  searchStr,
2335
- state: router.location.state,
2333
+ state: router.__location.state,
2336
2334
  hash,
2337
2335
  href: "" + pathname + searchStr + hash,
2338
2336
  key: dest.key
@@ -2493,8 +2491,9 @@
2493
2491
  });else handleClick(e);
2494
2492
  };
2495
2493
  const composeHandlers = handlers => e => {
2496
- e.persist();
2494
+ if (e.persist) e.persist();
2497
2495
  handlers.forEach(handler => {
2496
+ if (e.defaultPrevented) return;
2498
2497
  if (handler) handler(e);
2499
2498
  });
2500
2499
  };
@@ -2762,7 +2761,7 @@
2762
2761
  unblock();
2763
2762
  transition.retry();
2764
2763
  } else {
2765
- router.location.pathname = window.location.pathname;
2764
+ router.state.location.pathname = window.location.pathname;
2766
2765
  }
2767
2766
  });
2768
2767
  return unblock;