@tanstack/react-router 1.39.8 → 1.40.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/dist/cjs/Matches.cjs +4 -8
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/RouterProvider.d.cts +1 -0
- package/dist/cjs/link.cjs +7 -9
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +1 -0
- package/dist/cjs/not-found.cjs +1 -2
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/path.cjs +3 -6
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/qss.cjs +3 -6
- package/dist/cjs/qss.cjs.map +1 -1
- package/dist/cjs/root.cjs.map +1 -1
- package/dist/cjs/root.d.cts +1 -1
- package/dist/cjs/router.cjs +7 -4
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +2 -2
- package/dist/cjs/scroll-restoration.cjs +1 -2
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/esm/Matches.js +4 -8
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.d.ts +1 -0
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/link.d.ts +1 -0
- package/dist/esm/link.js +7 -9
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/not-found.js +1 -2
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/path.js +3 -6
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/qss.js +3 -6
- package/dist/esm/qss.js.map +1 -1
- package/dist/esm/root.d.ts +1 -1
- package/dist/esm/root.js.map +1 -1
- package/dist/esm/router.d.ts +2 -2
- package/dist/esm/router.js +7 -4
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/scroll-restoration.js +1 -2
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/package.json +4 -3
- package/src/RouterProvider.tsx +1 -0
- package/src/link.tsx +3 -0
- package/src/root.ts +1 -1
- package/src/router.ts +4 -0
package/dist/cjs/qss.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qss.cjs","sources":["../../src/qss.ts"],"sourcesContent":["// @ts-nocheck\n\n// qss has been slightly modified and inlined here for our use cases (and compression's sake). We've included it as a hard dependency for MIT license attribution.\n\n/**\n * Encodes an object into a query string.\n * @param obj - The object to encode into a query string.\n * @param [pfx] - An optional prefix to add before the query string.\n * @returns The encoded query string.\n * @example\n * ```\n * // Example input: encode({ token: 'foo', key: 'value' })\n * // Expected output: \"token=foo&key=value\"\n * ```\n */\nexport function encode(obj, pfx?: string) {\n let k,\n i,\n tmp,\n str = ''\n\n for (k in obj) {\n if ((tmp = obj[k]) !== void 0) {\n if (Array.isArray(tmp)) {\n for (i = 0; i < tmp.length; i++) {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i])\n }\n } else {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp)\n }\n }\n }\n\n return (pfx || '') + str\n}\n\n/**\n * Converts a string value to its appropriate type (string, number, boolean).\n * @param mix - The string value to convert.\n * @returns The converted value.\n * @example\n * // Example input: toValue(\"123\")\n * // Expected output: 123\n */\nfunction toValue(mix) {\n if (!mix) return ''\n const str = decodeURIComponent(mix)\n if (str === 'false') return false\n if (str === 'true') return true\n return +str * 0 === 0 && +str + '' === str ? +str : str\n}\n\n/**\n * Decodes a query string into an object.\n * @param str - The query string to decode.\n * @param [pfx] - An optional prefix to filter out from the query string.\n * @returns The decoded key-value pairs in an object format.\n * @example\n * // Example input: decode(\"token=foo&key=value\")\n * // Expected output: { \"token\": \"foo\", \"key\": \"value\" }\n */\nexport function decode(str, pfx?: string) {\n let tmp, k\n const out = {},\n arr = (pfx ? str.substr(pfx.length) : str).split('&')\n\n while ((tmp = arr.shift())) {\n const equalIndex = tmp.indexOf('=')\n if (equalIndex !== -1) {\n k = tmp.slice(0, equalIndex)\n const value = tmp.slice(equalIndex + 1)\n if (out[k] !== void 0) {\n out[k] = [].concat(out[k], toValue(value))\n } else {\n out[k] = toValue(value)\n }\n } else {\n k = tmp\n out[k] = ''\n }\n }\n\n return out\n}\n"],"names":[],"mappings":";;AAegB,SAAA,OAAO,KAAK,KAAc;AACpC,MAAA,GACF,GACA,KACA,MAAM;AAER,OAAK,KAAK,KAAK;AACb,SAAK,MAAM,IAAI,CAAC,OAAO,QAAQ;AACzB,UAAA,MAAM,QAAQ,GAAG,GAAG;AACtB,aAAK,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAC/B,kBAAQ,OAAO;AACf,iBAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,IAAI,CAAC,CAAC;AAAA,QAChE;AAAA,MAAA,OACK;AACL,gBAAQ,OAAO;AACf,eAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,GAAG;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAEA,UAAQ,OAAO,MAAM;AACvB;AAUA,SAAS,QAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"qss.cjs","sources":["../../src/qss.ts"],"sourcesContent":["// @ts-nocheck\n\n// qss has been slightly modified and inlined here for our use cases (and compression's sake). We've included it as a hard dependency for MIT license attribution.\n\n/**\n * Encodes an object into a query string.\n * @param obj - The object to encode into a query string.\n * @param [pfx] - An optional prefix to add before the query string.\n * @returns The encoded query string.\n * @example\n * ```\n * // Example input: encode({ token: 'foo', key: 'value' })\n * // Expected output: \"token=foo&key=value\"\n * ```\n */\nexport function encode(obj, pfx?: string) {\n let k,\n i,\n tmp,\n str = ''\n\n for (k in obj) {\n if ((tmp = obj[k]) !== void 0) {\n if (Array.isArray(tmp)) {\n for (i = 0; i < tmp.length; i++) {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i])\n }\n } else {\n str && (str += '&')\n str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp)\n }\n }\n }\n\n return (pfx || '') + str\n}\n\n/**\n * Converts a string value to its appropriate type (string, number, boolean).\n * @param mix - The string value to convert.\n * @returns The converted value.\n * @example\n * // Example input: toValue(\"123\")\n * // Expected output: 123\n */\nfunction toValue(mix) {\n if (!mix) return ''\n const str = decodeURIComponent(mix)\n if (str === 'false') return false\n if (str === 'true') return true\n return +str * 0 === 0 && +str + '' === str ? +str : str\n}\n\n/**\n * Decodes a query string into an object.\n * @param str - The query string to decode.\n * @param [pfx] - An optional prefix to filter out from the query string.\n * @returns The decoded key-value pairs in an object format.\n * @example\n * // Example input: decode(\"token=foo&key=value\")\n * // Expected output: { \"token\": \"foo\", \"key\": \"value\" }\n */\nexport function decode(str, pfx?: string) {\n let tmp, k\n const out = {},\n arr = (pfx ? str.substr(pfx.length) : str).split('&')\n\n while ((tmp = arr.shift())) {\n const equalIndex = tmp.indexOf('=')\n if (equalIndex !== -1) {\n k = tmp.slice(0, equalIndex)\n const value = tmp.slice(equalIndex + 1)\n if (out[k] !== void 0) {\n out[k] = [].concat(out[k], toValue(value))\n } else {\n out[k] = toValue(value)\n }\n } else {\n k = tmp\n out[k] = ''\n }\n }\n\n return out\n}\n"],"names":[],"mappings":";;AAegB,SAAA,OAAO,KAAK,KAAc;AACpC,MAAA,GACF,GACA,KACA,MAAM;AAER,OAAK,KAAK,KAAK;AACb,SAAK,MAAM,IAAI,CAAC,OAAO,QAAQ;AACzB,UAAA,MAAM,QAAQ,GAAG,GAAG;AACtB,aAAK,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAC/B,kBAAQ,OAAO;AACf,iBAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,IAAI,CAAC,CAAC;AAAA,QAChE;AAAA,MAAA,OACK;AACL,gBAAQ,OAAO;AACf,eAAO,mBAAmB,CAAC,IAAI,MAAM,mBAAmB,GAAG;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAEA,UAAQ,OAAO,MAAM;AACvB;AAUA,SAAS,QAAQ,KAAK;AAChB,MAAA,CAAC,IAAY,QAAA;AACX,QAAA,MAAM,mBAAmB,GAAG;AAC9B,MAAA,QAAQ,QAAgB,QAAA;AACxB,MAAA,QAAQ,OAAe,QAAA;AACpB,SAAA,CAAC,MAAM,MAAM,KAAK,CAAC,MAAM,OAAO,MAAM,CAAC,MAAM;AACtD;AAWgB,SAAA,OAAO,KAAK,KAAc;AACxC,MAAI,KAAK;AACT,QAAM,MAAM,CACV,GAAA,OAAO,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,KAAK,MAAM,GAAG;AAE9C,SAAA,MAAM,IAAI,SAAU;AACpB,UAAA,aAAa,IAAI,QAAQ,GAAG;AAClC,QAAI,eAAe,IAAI;AACjB,UAAA,IAAI,MAAM,GAAG,UAAU;AAC3B,YAAM,QAAQ,IAAI,MAAM,aAAa,CAAC;AAClC,UAAA,IAAI,CAAC,MAAM,QAAQ;AACjB,YAAA,CAAC,IAAI,CAAA,EAAG,OAAO,IAAI,CAAC,GAAG,QAAQ,KAAK,CAAC;AAAA,MAAA,OACpC;AACD,YAAA,CAAC,IAAI,QAAQ,KAAK;AAAA,MACxB;AAAA,IAAA,OACK;AACD,UAAA;AACJ,UAAI,CAAC,IAAI;AAAA,IACX;AAAA,EACF;AAEO,SAAA;AACT;;;"}
|
package/dist/cjs/root.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.cjs","sources":["../../src/root.ts"],"sourcesContent":["export const rootRouteId = '__root__'
|
|
1
|
+
{"version":3,"file":"root.cjs","sources":["../../src/root.ts"],"sourcesContent":["export const rootRouteId = '__root__'\nexport type RootRouteId = typeof rootRouteId\n"],"names":[],"mappings":";;AAAO,MAAM,cAAc;;"}
|
package/dist/cjs/root.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rootRouteId
|
|
1
|
+
export declare const rootRouteId = "__root__";
|
|
2
2
|
export type RootRouteId = typeof rootRouteId;
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -511,6 +511,7 @@ class Router {
|
|
|
511
511
|
this.commitLocation = async ({
|
|
512
512
|
startTransition,
|
|
513
513
|
viewTransition,
|
|
514
|
+
ignoreBlocker,
|
|
514
515
|
...next
|
|
515
516
|
}) => {
|
|
516
517
|
const isSameState = () => {
|
|
@@ -549,7 +550,8 @@ class Router {
|
|
|
549
550
|
this.shouldViewTransition = viewTransition;
|
|
550
551
|
this.history[next.replace ? "replace" : "push"](
|
|
551
552
|
nextHistory.href,
|
|
552
|
-
nextHistory.state
|
|
553
|
+
nextHistory.state,
|
|
554
|
+
{ ignoreBlocker }
|
|
553
555
|
);
|
|
554
556
|
}
|
|
555
557
|
this.resetNextScroll = next.resetScroll ?? true;
|
|
@@ -560,6 +562,7 @@ class Router {
|
|
|
560
562
|
resetScroll,
|
|
561
563
|
startTransition,
|
|
562
564
|
viewTransition,
|
|
565
|
+
ignoreBlocker,
|
|
563
566
|
...rest
|
|
564
567
|
} = {}) => {
|
|
565
568
|
const location = this.buildLocation(rest);
|
|
@@ -568,7 +571,8 @@ class Router {
|
|
|
568
571
|
startTransition,
|
|
569
572
|
viewTransition,
|
|
570
573
|
replace,
|
|
571
|
-
resetScroll
|
|
574
|
+
resetScroll,
|
|
575
|
+
ignoreBlocker
|
|
572
576
|
});
|
|
573
577
|
};
|
|
574
578
|
this.navigate = ({ from, to, __isRedirect, ...rest }) => {
|
|
@@ -743,8 +747,7 @@ class Router {
|
|
|
743
747
|
return updated;
|
|
744
748
|
};
|
|
745
749
|
const handleRedirectAndNotFound = (match, err) => {
|
|
746
|
-
if (redirects.isResolvedRedirect(err))
|
|
747
|
-
throw err;
|
|
750
|
+
if (redirects.isResolvedRedirect(err)) throw err;
|
|
748
751
|
if (redirects.isRedirect(err) || notFound.isNotFound(err)) {
|
|
749
752
|
updateMatch(match.id, (prev) => ({
|
|
750
753
|
...prev,
|