@tanstack/react-router 0.0.1-alpha.4 → 0.0.1-alpha.5
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/build/cjs/router-core/build/esm/index.js +58 -44
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +58 -44
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +27 -27
- package/build/umd/index.development.js +58 -44
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
package/build/stats-html.html
CHANGED
|
@@ -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":"
|
|
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}};
|
|
4018
4018
|
|
|
4019
4019
|
const run = () => {
|
|
4020
4020
|
const width = window.innerWidth;
|
package/build/stats-react.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "138f-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": "
|
|
18
|
+
"uid": "138f-35"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "react-router/src/index.tsx",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "138f-37"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -29,90 +29,90 @@
|
|
|
29
29
|
"isRoot": true
|
|
30
30
|
},
|
|
31
31
|
"nodeParts": {
|
|
32
|
-
"
|
|
32
|
+
"138f-33": {
|
|
33
33
|
"renderedLength": 798,
|
|
34
34
|
"gzipLength": 366,
|
|
35
35
|
"brotliLength": 0,
|
|
36
|
-
"mainUid": "
|
|
36
|
+
"mainUid": "138f-32"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"renderedLength":
|
|
40
|
-
"gzipLength":
|
|
38
|
+
"138f-35": {
|
|
39
|
+
"renderedLength": 69909,
|
|
40
|
+
"gzipLength": 14557,
|
|
41
41
|
"brotliLength": 0,
|
|
42
|
-
"mainUid": "
|
|
42
|
+
"mainUid": "138f-34"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
44
|
+
"138f-37": {
|
|
45
45
|
"renderedLength": 11456,
|
|
46
46
|
"gzipLength": 2963,
|
|
47
47
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
48
|
+
"mainUid": "138f-36"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"nodeMetas": {
|
|
52
|
-
"
|
|
52
|
+
"138f-32": {
|
|
53
53
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
54
|
"moduleParts": {
|
|
55
|
-
"index.production.js": "
|
|
55
|
+
"index.production.js": "138f-33"
|
|
56
56
|
},
|
|
57
57
|
"imported": [],
|
|
58
58
|
"importedBy": [
|
|
59
59
|
{
|
|
60
|
-
"uid": "
|
|
60
|
+
"uid": "138f-36"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"138f-34": {
|
|
65
65
|
"id": "/packages/router-core/build/esm/index.js",
|
|
66
66
|
"moduleParts": {
|
|
67
|
-
"index.production.js": "
|
|
67
|
+
"index.production.js": "138f-35"
|
|
68
68
|
},
|
|
69
69
|
"imported": [],
|
|
70
70
|
"importedBy": [
|
|
71
71
|
{
|
|
72
|
-
"uid": "
|
|
72
|
+
"uid": "138f-36"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"
|
|
76
|
+
"138f-36": {
|
|
77
77
|
"id": "/packages/react-router/src/index.tsx",
|
|
78
78
|
"moduleParts": {
|
|
79
|
-
"index.production.js": "
|
|
79
|
+
"index.production.js": "138f-37"
|
|
80
80
|
},
|
|
81
81
|
"imported": [
|
|
82
82
|
{
|
|
83
|
-
"uid": "
|
|
83
|
+
"uid": "138f-32"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"uid": "
|
|
86
|
+
"uid": "138f-38"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
"uid": "
|
|
89
|
+
"uid": "138f-39"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"uid": "
|
|
92
|
+
"uid": "138f-34"
|
|
93
93
|
}
|
|
94
94
|
],
|
|
95
95
|
"importedBy": [],
|
|
96
96
|
"isEntry": true
|
|
97
97
|
},
|
|
98
|
-
"
|
|
98
|
+
"138f-38": {
|
|
99
99
|
"id": "react",
|
|
100
100
|
"moduleParts": {},
|
|
101
101
|
"imported": [],
|
|
102
102
|
"importedBy": [
|
|
103
103
|
{
|
|
104
|
-
"uid": "
|
|
104
|
+
"uid": "138f-36"
|
|
105
105
|
}
|
|
106
106
|
],
|
|
107
107
|
"isExternal": true
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"138f-39": {
|
|
110
110
|
"id": "use-sync-external-store/shim",
|
|
111
111
|
"moduleParts": {},
|
|
112
112
|
"imported": [],
|
|
113
113
|
"importedBy": [
|
|
114
114
|
{
|
|
115
|
-
"uid": "
|
|
115
|
+
"uid": "138f-36"
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
118
|
"isExternal": true
|
|
@@ -1029,6 +1029,7 @@
|
|
|
1029
1029
|
let router = {
|
|
1030
1030
|
options: originalOptions,
|
|
1031
1031
|
listeners: [],
|
|
1032
|
+
removeActionQueue: [],
|
|
1032
1033
|
// Resolved after construction
|
|
1033
1034
|
basepath: '',
|
|
1034
1035
|
routeTree: undefined,
|
|
@@ -1152,12 +1153,14 @@
|
|
|
1152
1153
|
strictParseParams: true
|
|
1153
1154
|
});
|
|
1154
1155
|
const toMatches = router.matchRoutes(pathname);
|
|
1155
|
-
|
|
1156
|
+
|
|
1157
|
+
const prevParams = _extends$1({}, (_last = last(fromMatches)) == null ? void 0 : _last.params);
|
|
1158
|
+
|
|
1156
1159
|
let nextParams = ((_dest$params = dest.params) != null ? _dest$params : true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
|
|
1157
1160
|
|
|
1158
1161
|
if (nextParams) {
|
|
1159
1162
|
toMatches.map(d => d.options.stringifyParams).filter(Boolean).forEach(fn => {
|
|
1160
|
-
Object.assign(nextParams, fn(nextParams));
|
|
1163
|
+
Object.assign({}, nextParams, fn(nextParams));
|
|
1161
1164
|
});
|
|
1162
1165
|
}
|
|
1163
1166
|
|
|
@@ -1260,22 +1263,33 @@
|
|
|
1260
1263
|
router.startedLoadingAt = id;
|
|
1261
1264
|
|
|
1262
1265
|
if (next) {
|
|
1266
|
+
// If the location.href has changed
|
|
1263
1267
|
// Ingest the new location
|
|
1264
1268
|
router.location = next;
|
|
1265
|
-
} //
|
|
1269
|
+
} // Clear out old actions
|
|
1266
1270
|
|
|
1267
1271
|
|
|
1272
|
+
router.removeActionQueue.forEach(_ref => {
|
|
1273
|
+
let {
|
|
1274
|
+
action,
|
|
1275
|
+
actionState
|
|
1276
|
+
} = _ref;
|
|
1277
|
+
|
|
1278
|
+
if (router.state.currentAction === actionState) {
|
|
1279
|
+
router.state.currentAction = undefined;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
if (action.current === actionState) {
|
|
1283
|
+
action.current = undefined;
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
router.removeActionQueue = []; // Cancel any pending matches
|
|
1287
|
+
|
|
1268
1288
|
router.cancelMatches(); // Match the routes
|
|
1269
1289
|
|
|
1270
1290
|
const unloadedMatches = router.matchRoutes(location.pathname, {
|
|
1271
1291
|
strictParseParams: true
|
|
1272
1292
|
});
|
|
1273
|
-
unloadedMatches.forEach((match, index) => {
|
|
1274
|
-
const parent = unloadedMatches[index - 1];
|
|
1275
|
-
const child = unloadedMatches[index + 1];
|
|
1276
|
-
if (parent) match.__.setParentMatch(parent);
|
|
1277
|
-
if (child) match.__.addChildMatch(child);
|
|
1278
|
-
});
|
|
1279
1293
|
router.state = _extends$1({}, router.state, {
|
|
1280
1294
|
pending: {
|
|
1281
1295
|
matches: unloadedMatches,
|
|
@@ -1456,6 +1470,7 @@
|
|
|
1456
1470
|
};
|
|
1457
1471
|
|
|
1458
1472
|
recurse([router.routeTree]);
|
|
1473
|
+
cascadeLoaderData(matches);
|
|
1459
1474
|
return matches;
|
|
1460
1475
|
},
|
|
1461
1476
|
loadMatches: async (resolvedMatches, loaderOpts) => {
|
|
@@ -1534,14 +1549,14 @@
|
|
|
1534
1549
|
const next = router.buildNext(location);
|
|
1535
1550
|
return router.commitLocation(next, location.replace);
|
|
1536
1551
|
},
|
|
1537
|
-
navigate: async
|
|
1552
|
+
navigate: async _ref2 => {
|
|
1538
1553
|
let {
|
|
1539
1554
|
from,
|
|
1540
1555
|
to = '.',
|
|
1541
1556
|
search,
|
|
1542
1557
|
hash,
|
|
1543
1558
|
replace
|
|
1544
|
-
} =
|
|
1559
|
+
} = _ref2;
|
|
1545
1560
|
// If this link simply reloads the current route,
|
|
1546
1561
|
// make sure it has a new key so it will trigger a data refresh
|
|
1547
1562
|
// If this `to` is a valid external URL, return
|
|
@@ -1563,8 +1578,8 @@
|
|
|
1563
1578
|
hash
|
|
1564
1579
|
});
|
|
1565
1580
|
},
|
|
1566
|
-
buildLink:
|
|
1567
|
-
var _preload,
|
|
1581
|
+
buildLink: _ref3 => {
|
|
1582
|
+
var _preload, _ref4, _ref5;
|
|
1568
1583
|
|
|
1569
1584
|
let {
|
|
1570
1585
|
from,
|
|
@@ -1579,7 +1594,7 @@
|
|
|
1579
1594
|
preloadMaxAge: userPreloadMaxAge,
|
|
1580
1595
|
preloadDelay: userPreloadDelay,
|
|
1581
1596
|
disabled
|
|
1582
|
-
} =
|
|
1597
|
+
} = _ref3;
|
|
1583
1598
|
|
|
1584
1599
|
// If this link simply reloads the current route,
|
|
1585
1600
|
// make sure it has a new key so it will trigger a data refresh
|
|
@@ -1603,8 +1618,8 @@
|
|
|
1603
1618
|
};
|
|
1604
1619
|
const next = router.buildNext(nextOpts);
|
|
1605
1620
|
preload = (_preload = preload) != null ? _preload : router.options.defaultLinkPreload;
|
|
1606
|
-
const preloadMaxAge = (
|
|
1607
|
-
const preloadDelay = (
|
|
1621
|
+
const preloadMaxAge = (_ref4 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref4 : 2000;
|
|
1622
|
+
const preloadDelay = (_ref5 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref5 : 50; // Compare path/hash for matches
|
|
1608
1623
|
|
|
1609
1624
|
const pathIsEqual = router.state.location.pathname === next.pathname;
|
|
1610
1625
|
const currentPathSplit = router.state.location.pathname.split('/');
|
|
@@ -1678,11 +1693,11 @@
|
|
|
1678
1693
|
},
|
|
1679
1694
|
__experimental__createSnapshot: () => {
|
|
1680
1695
|
return _extends$1({}, router.state, {
|
|
1681
|
-
matches: router.state.matches.map(
|
|
1696
|
+
matches: router.state.matches.map(_ref6 => {
|
|
1682
1697
|
let {
|
|
1683
1698
|
routeLoaderData: loaderData,
|
|
1684
1699
|
matchId
|
|
1685
|
-
} =
|
|
1700
|
+
} = _ref6;
|
|
1686
1701
|
return {
|
|
1687
1702
|
matchId,
|
|
1688
1703
|
loaderData
|
|
@@ -1732,10 +1747,12 @@
|
|
|
1732
1747
|
status: 'pending',
|
|
1733
1748
|
submission
|
|
1734
1749
|
};
|
|
1750
|
+
action.current = actionState;
|
|
1735
1751
|
action.latest = actionState;
|
|
1736
1752
|
action.pending.push(actionState);
|
|
1737
1753
|
router.state = _extends$1({}, router.state, {
|
|
1738
|
-
|
|
1754
|
+
currentAction: actionState,
|
|
1755
|
+
latestAction: actionState
|
|
1739
1756
|
});
|
|
1740
1757
|
router.notify();
|
|
1741
1758
|
|
|
@@ -1759,11 +1776,10 @@
|
|
|
1759
1776
|
actionState.status = 'error';
|
|
1760
1777
|
} finally {
|
|
1761
1778
|
action.pending = action.pending.filter(d => d !== actionState);
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1779
|
+
router.removeActionQueue.push({
|
|
1780
|
+
action,
|
|
1781
|
+
actionState
|
|
1782
|
+
});
|
|
1767
1783
|
router.notify();
|
|
1768
1784
|
}
|
|
1769
1785
|
}
|
|
@@ -1850,16 +1866,17 @@
|
|
|
1850
1866
|
clearTimeout(routeMatch.__.pendingMinTimeout);
|
|
1851
1867
|
delete routeMatch.__.pendingMinPromise;
|
|
1852
1868
|
},
|
|
1853
|
-
setParentMatch: parentMatch => {
|
|
1854
|
-
|
|
1855
|
-
},
|
|
1856
|
-
addChildMatch: childMatch => {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1869
|
+
// setParentMatch: (parentMatch?: RouteMatch) => {
|
|
1870
|
+
// routeMatch.parentMatch = parentMatch
|
|
1871
|
+
// },
|
|
1872
|
+
// addChildMatch: (childMatch: RouteMatch) => {
|
|
1873
|
+
// if (
|
|
1874
|
+
// routeMatch.childMatches.find((d) => d.matchId === childMatch.matchId)
|
|
1875
|
+
// ) {
|
|
1876
|
+
// return
|
|
1877
|
+
// }
|
|
1878
|
+
// routeMatch.childMatches.push(childMatch)
|
|
1879
|
+
// },
|
|
1863
1880
|
validate: () => {
|
|
1864
1881
|
var _routeMatch$parentMat, _routeMatch$parentMat2;
|
|
1865
1882
|
|
|
@@ -1963,7 +1980,6 @@
|
|
|
1963
1980
|
}
|
|
1964
1981
|
|
|
1965
1982
|
routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
|
|
1966
|
-
cascadeLoaderData(routeMatch);
|
|
1967
1983
|
routeMatch.error = undefined;
|
|
1968
1984
|
routeMatch.status = 'success';
|
|
1969
1985
|
routeMatch.updatedAt = Date.now();
|
|
@@ -2023,16 +2039,14 @@
|
|
|
2023
2039
|
return routeMatch;
|
|
2024
2040
|
}
|
|
2025
2041
|
|
|
2026
|
-
function cascadeLoaderData(
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
}
|
|
2042
|
+
function cascadeLoaderData(matches) {
|
|
2043
|
+
matches.forEach((match, index) => {
|
|
2044
|
+
const parent = matches[index - 1];
|
|
2030
2045
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
}
|
|
2046
|
+
if (parent) {
|
|
2047
|
+
match.loaderData = replaceEqualDeep(match.loaderData, _extends$1({}, parent.loaderData, match.routeLoaderData));
|
|
2048
|
+
}
|
|
2049
|
+
});
|
|
2036
2050
|
}
|
|
2037
2051
|
|
|
2038
2052
|
function matchPathname(currentPathname, matchLocation) {
|