tanexpo 0.2.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.
Files changed (81) hide show
  1. package/dist/components/Link.d.mts +7 -0
  2. package/dist/components/Link.d.ts +7 -0
  3. package/dist/components/Link.js +81 -0
  4. package/dist/components/Link.js.map +1 -0
  5. package/dist/components/Link.mjs +56 -0
  6. package/dist/components/Link.mjs.map +1 -0
  7. package/dist/components/Link.native.d.mts +7 -0
  8. package/dist/components/Link.native.d.ts +7 -0
  9. package/dist/components/Link.native.js +35 -0
  10. package/dist/components/Link.native.js.map +1 -0
  11. package/dist/components/Link.native.mjs +10 -0
  12. package/dist/components/Link.native.mjs.map +1 -0
  13. package/dist/components/Redirect.d.mts +16 -0
  14. package/dist/components/Redirect.d.ts +16 -0
  15. package/dist/components/Redirect.js +69 -0
  16. package/dist/components/Redirect.js.map +1 -0
  17. package/dist/components/Redirect.mjs +44 -0
  18. package/dist/components/Redirect.mjs.map +1 -0
  19. package/dist/components/Redirect.native.d.mts +1 -0
  20. package/dist/components/Redirect.native.d.ts +1 -0
  21. package/dist/components/Redirect.native.js +31 -0
  22. package/dist/components/Redirect.native.js.map +1 -0
  23. package/dist/components/Redirect.native.mjs +6 -0
  24. package/dist/components/Redirect.native.mjs.map +1 -0
  25. package/dist/components/index.d.mts +5 -0
  26. package/dist/components/index.d.ts +5 -0
  27. package/dist/components/index.js +106 -0
  28. package/dist/components/index.js.map +1 -0
  29. package/dist/components/index.mjs +78 -0
  30. package/dist/components/index.mjs.map +1 -0
  31. package/dist/hooks/index.d.mts +5 -0
  32. package/dist/hooks/index.d.ts +5 -0
  33. package/dist/hooks/index.js +91 -0
  34. package/dist/hooks/index.js.map +1 -0
  35. package/dist/hooks/index.mjs +63 -0
  36. package/dist/hooks/index.mjs.map +1 -0
  37. package/dist/hooks/useLocalSearchParams.d.mts +13 -0
  38. package/dist/hooks/useLocalSearchParams.d.ts +13 -0
  39. package/dist/hooks/useLocalSearchParams.js +39 -0
  40. package/dist/hooks/useLocalSearchParams.js.map +1 -0
  41. package/dist/hooks/useLocalSearchParams.mjs +14 -0
  42. package/dist/hooks/useLocalSearchParams.mjs.map +1 -0
  43. package/dist/hooks/useLocalSearchParams.native.d.mts +1 -0
  44. package/dist/hooks/useLocalSearchParams.native.d.ts +1 -0
  45. package/dist/hooks/useLocalSearchParams.native.js +31 -0
  46. package/dist/hooks/useLocalSearchParams.native.js.map +1 -0
  47. package/dist/hooks/useLocalSearchParams.native.mjs +6 -0
  48. package/dist/hooks/useLocalSearchParams.native.mjs.map +1 -0
  49. package/dist/hooks/useRouter.d.mts +13 -0
  50. package/dist/hooks/useRouter.d.ts +13 -0
  51. package/dist/hooks/useRouter.js +76 -0
  52. package/dist/hooks/useRouter.js.map +1 -0
  53. package/dist/hooks/useRouter.mjs +51 -0
  54. package/dist/hooks/useRouter.mjs.map +1 -0
  55. package/dist/hooks/useRouter.native.d.mts +12 -0
  56. package/dist/hooks/useRouter.native.d.ts +12 -0
  57. package/dist/hooks/useRouter.native.js +41 -0
  58. package/dist/hooks/useRouter.native.js.map +1 -0
  59. package/dist/hooks/useRouter.native.mjs +16 -0
  60. package/dist/hooks/useRouter.native.mjs.map +1 -0
  61. package/dist/index.d.mts +8 -0
  62. package/dist/index.d.ts +8 -0
  63. package/dist/index.js +149 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/index.mjs +119 -0
  66. package/dist/index.mjs.map +1 -0
  67. package/dist/index.native.d.mts +7 -0
  68. package/dist/index.native.d.ts +7 -0
  69. package/dist/index.native.js +62 -0
  70. package/dist/index.native.js.map +1 -0
  71. package/dist/index.native.mjs +32 -0
  72. package/dist/index.native.mjs.map +1 -0
  73. package/dist/types-BrqVaE2O.d.mts +21 -0
  74. package/dist/types-BrqVaE2O.d.ts +21 -0
  75. package/dist/utils/route-utils.d.mts +19 -0
  76. package/dist/utils/route-utils.d.ts +19 -0
  77. package/dist/utils/route-utils.js +48 -0
  78. package/dist/utils/route-utils.js.map +1 -0
  79. package/dist/utils/route-utils.mjs +22 -0
  80. package/dist/utils/route-utils.mjs.map +1 -0
  81. package/package.json +64 -0
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LinkProps } from '../types-BrqVaE2O.mjs';
3
+ import 'react';
4
+
5
+ declare function Link({ href, replace, prefetch, children }: LinkProps): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Link };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LinkProps } from '../types-BrqVaE2O.js';
3
+ import 'react';
4
+
5
+ declare function Link({ href, replace, prefetch, children }: LinkProps): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Link };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Link.tsx
21
+ var Link_exports = {};
22
+ __export(Link_exports, {
23
+ Link: () => Link
24
+ });
25
+ module.exports = __toCommonJS(Link_exports);
26
+ var import_react_router = require("@tanstack/react-router");
27
+
28
+ // src/utils/route-utils.ts
29
+ function expoPathToTanStack(pathname) {
30
+ return pathname.replace(/\[([^\]]+)\]/g, (_, key) => `$${key}`);
31
+ }
32
+ function splitParams(pathname, params = {}) {
33
+ const dynamicKeys = Array.from(pathname.matchAll(/\[([^\]]+)\]/g), (m) => m[1]);
34
+ const pathParams = {};
35
+ const searchParams = {};
36
+ for (const [key, value] of Object.entries(params)) {
37
+ if (dynamicKeys.includes(key)) {
38
+ pathParams[key] = value;
39
+ } else {
40
+ searchParams[key] = value;
41
+ }
42
+ }
43
+ return { pathParams, searchParams };
44
+ }
45
+
46
+ // src/components/Link.tsx
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ function mapPrefetchToPreload(prefetch) {
49
+ if (prefetch === void 0 || prefetch === false) {
50
+ return false;
51
+ }
52
+ if (prefetch === true) {
53
+ return "intent";
54
+ }
55
+ return prefetch;
56
+ }
57
+ function Link({ href, replace, prefetch, children }) {
58
+ const preload = mapPrefetchToPreload(prefetch);
59
+ if (typeof href === "string") {
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router.Link, { to: href, replace, preload, children });
61
+ }
62
+ const { pathname, params } = href;
63
+ const to = expoPathToTanStack(pathname);
64
+ const { pathParams, searchParams } = splitParams(pathname, params);
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
+ import_react_router.Link,
67
+ {
68
+ to,
69
+ params: pathParams,
70
+ search: Object.keys(searchParams).length ? searchParams : void 0,
71
+ replace,
72
+ preload,
73
+ children
74
+ }
75
+ );
76
+ }
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ Link
80
+ });
81
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Link.tsx","../../src/utils/route-utils.ts"],"sourcesContent":["import { Link as TanStackLink } from \"@tanstack/react-router\";\nimport type { HrefObject, LinkProps, Prefetch } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\nfunction mapPrefetchToPreload(prefetch: Prefetch | undefined) {\n if (prefetch === undefined || prefetch === false) {\n return false;\n }\n\n if (prefetch === true) {\n return \"intent\";\n }\n\n return prefetch;\n}\n\nexport function Link({ href, replace, prefetch, children }: LinkProps) {\n const preload = mapPrefetchToPreload(prefetch);\n\n // String href\n if (typeof href === \"string\") {\n return (\n <TanStackLink to={href} replace={replace} preload={preload}>\n {children}\n </TanStackLink>\n );\n }\n\n // Object-based Expo href\n const { pathname, params } = href as HrefObject;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <TanStackLink\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n preload={preload}\n >\n {children}\n </TanStackLink>\n );\n}\n","import type { HrefObject } from \"../types\";\n\n/**\n * Converts:\n * /user/[id]/post/[slug] → /user/$id/post/$slug\n */\nexport function expoPathToTanStack(pathname: string) {\n return pathname.replace(/\\[([^\\]]+)\\]/g, (_, key) => `$${key}`);\n}\n\n/**\n * Splits params into:\n * - path params (used by dynamic segments)\n * - search params (query string)\n */\nexport function splitParams(pathname: string, params: HrefObject[\"params\"] = {}) {\n const dynamicKeys = Array.from(pathname.matchAll(/\\[([^\\]]+)\\]/g), (m) => m[1]);\n\n const pathParams: Record<string, unknown> = {};\n const searchParams: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (dynamicKeys.includes(key)) {\n pathParams[key] = value;\n } else {\n searchParams[key] = value;\n }\n }\n\n return { pathParams, searchParams };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAqC;;;ACM9B,SAAS,mBAAmB,UAAkB;AACnD,SAAO,SAAS,QAAQ,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE;AAChE;AAOO,SAAS,YAAY,UAAkB,SAA+B,CAAC,GAAG;AAC/E,QAAM,cAAc,MAAM,KAAK,SAAS,SAAS,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAE9E,QAAM,aAAsC,CAAC;AAC7C,QAAM,eAAwC,CAAC;AAE/C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,YAAY,SAAS,GAAG,GAAG;AAC7B,iBAAW,GAAG,IAAI;AAAA,IACpB,OAAO;AACL,mBAAa,GAAG,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,aAAa;AACpC;;;ADRM;AAlBN,SAAS,qBAAqB,UAAgC;AAC5D,MAAI,aAAa,UAAa,aAAa,OAAO;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,MAAM;AACrB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,KAAK,EAAE,MAAM,SAAS,UAAU,SAAS,GAAc;AACrE,QAAM,UAAU,qBAAqB,QAAQ;AAG7C,MAAI,OAAO,SAAS,UAAU;AAC5B,WACE,4CAAC,oBAAAA,MAAA,EAAa,IAAI,MAAM,SAAkB,SACvC,UACH;AAAA,EAEJ;AAGA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC,oBAAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":["TanStackLink"]}
@@ -0,0 +1,56 @@
1
+ // src/components/Link.tsx
2
+ import { Link as TanStackLink } from "@tanstack/react-router";
3
+
4
+ // src/utils/route-utils.ts
5
+ function expoPathToTanStack(pathname) {
6
+ return pathname.replace(/\[([^\]]+)\]/g, (_, key) => `$${key}`);
7
+ }
8
+ function splitParams(pathname, params = {}) {
9
+ const dynamicKeys = Array.from(pathname.matchAll(/\[([^\]]+)\]/g), (m) => m[1]);
10
+ const pathParams = {};
11
+ const searchParams = {};
12
+ for (const [key, value] of Object.entries(params)) {
13
+ if (dynamicKeys.includes(key)) {
14
+ pathParams[key] = value;
15
+ } else {
16
+ searchParams[key] = value;
17
+ }
18
+ }
19
+ return { pathParams, searchParams };
20
+ }
21
+
22
+ // src/components/Link.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ function mapPrefetchToPreload(prefetch) {
25
+ if (prefetch === void 0 || prefetch === false) {
26
+ return false;
27
+ }
28
+ if (prefetch === true) {
29
+ return "intent";
30
+ }
31
+ return prefetch;
32
+ }
33
+ function Link({ href, replace, prefetch, children }) {
34
+ const preload = mapPrefetchToPreload(prefetch);
35
+ if (typeof href === "string") {
36
+ return /* @__PURE__ */ jsx(TanStackLink, { to: href, replace, preload, children });
37
+ }
38
+ const { pathname, params } = href;
39
+ const to = expoPathToTanStack(pathname);
40
+ const { pathParams, searchParams } = splitParams(pathname, params);
41
+ return /* @__PURE__ */ jsx(
42
+ TanStackLink,
43
+ {
44
+ to,
45
+ params: pathParams,
46
+ search: Object.keys(searchParams).length ? searchParams : void 0,
47
+ replace,
48
+ preload,
49
+ children
50
+ }
51
+ );
52
+ }
53
+ export {
54
+ Link
55
+ };
56
+ //# sourceMappingURL=Link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Link.tsx","../../src/utils/route-utils.ts"],"sourcesContent":["import { Link as TanStackLink } from \"@tanstack/react-router\";\nimport type { HrefObject, LinkProps, Prefetch } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\nfunction mapPrefetchToPreload(prefetch: Prefetch | undefined) {\n if (prefetch === undefined || prefetch === false) {\n return false;\n }\n\n if (prefetch === true) {\n return \"intent\";\n }\n\n return prefetch;\n}\n\nexport function Link({ href, replace, prefetch, children }: LinkProps) {\n const preload = mapPrefetchToPreload(prefetch);\n\n // String href\n if (typeof href === \"string\") {\n return (\n <TanStackLink to={href} replace={replace} preload={preload}>\n {children}\n </TanStackLink>\n );\n }\n\n // Object-based Expo href\n const { pathname, params } = href as HrefObject;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <TanStackLink\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n preload={preload}\n >\n {children}\n </TanStackLink>\n );\n}\n","import type { HrefObject } from \"../types\";\n\n/**\n * Converts:\n * /user/[id]/post/[slug] → /user/$id/post/$slug\n */\nexport function expoPathToTanStack(pathname: string) {\n return pathname.replace(/\\[([^\\]]+)\\]/g, (_, key) => `$${key}`);\n}\n\n/**\n * Splits params into:\n * - path params (used by dynamic segments)\n * - search params (query string)\n */\nexport function splitParams(pathname: string, params: HrefObject[\"params\"] = {}) {\n const dynamicKeys = Array.from(pathname.matchAll(/\\[([^\\]]+)\\]/g), (m) => m[1]);\n\n const pathParams: Record<string, unknown> = {};\n const searchParams: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (dynamicKeys.includes(key)) {\n pathParams[key] = value;\n } else {\n searchParams[key] = value;\n }\n }\n\n return { pathParams, searchParams };\n}\n"],"mappings":";AAAA,SAAS,QAAQ,oBAAoB;;;ACM9B,SAAS,mBAAmB,UAAkB;AACnD,SAAO,SAAS,QAAQ,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE;AAChE;AAOO,SAAS,YAAY,UAAkB,SAA+B,CAAC,GAAG;AAC/E,QAAM,cAAc,MAAM,KAAK,SAAS,SAAS,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAE9E,QAAM,aAAsC,CAAC;AAC7C,QAAM,eAAwC,CAAC;AAE/C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,YAAY,SAAS,GAAG,GAAG;AAC7B,iBAAW,GAAG,IAAI;AAAA,IACpB,OAAO;AACL,mBAAa,GAAG,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,aAAa;AACpC;;;ADRM;AAlBN,SAAS,qBAAqB,UAAgC;AAC5D,MAAI,aAAa,UAAa,aAAa,OAAO;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,MAAM;AACrB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,KAAK,EAAE,MAAM,SAAS,UAAU,SAAS,GAAc;AACrE,QAAM,UAAU,qBAAqB,QAAQ;AAG7C,MAAI,OAAO,SAAS,UAAU;AAC5B,WACE,oBAAC,gBAAa,IAAI,MAAM,SAAkB,SACvC,UACH;AAAA,EAEJ;AAGA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LinkProps } from '../types-BrqVaE2O.mjs';
3
+ import 'react';
4
+
5
+ declare function Link({ href, replace, prefetch, push, children }: LinkProps): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Link };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { L as LinkProps } from '../types-BrqVaE2O.js';
3
+ import 'react';
4
+
5
+ declare function Link({ href, replace, prefetch, push, children }: LinkProps): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Link };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Link.native.tsx
21
+ var Link_native_exports = {};
22
+ __export(Link_native_exports, {
23
+ Link: () => Link
24
+ });
25
+ module.exports = __toCommonJS(Link_native_exports);
26
+ var import_expo_router = require("expo-router");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ function Link({ href, replace, prefetch, push, children }) {
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_expo_router.Link, { href, replace, prefetch: Boolean(prefetch), push, children });
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ Link
34
+ });
35
+ //# sourceMappingURL=Link.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Link.native.tsx"],"sourcesContent":["import { Link as ExpoLink } from \"expo-router\";\nimport type { LinkProps } from \"../types\";\nimport type { Href } from \"../types.native\";\n\nexport function Link({ href, replace, prefetch, push, children }: LinkProps) {\n return (\n <ExpoLink href={href as Href} replace={replace} prefetch={Boolean(prefetch)} push={push}>\n {children}\n </ExpoLink>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAiC;AAM7B;AAFG,SAAS,KAAK,EAAE,MAAM,SAAS,UAAU,MAAM,SAAS,GAAc;AAC3E,SACE,4CAAC,mBAAAA,MAAA,EAAS,MAAoB,SAAkB,UAAU,QAAQ,QAAQ,GAAG,MAC1E,UACH;AAEJ;","names":["ExpoLink"]}
@@ -0,0 +1,10 @@
1
+ // src/components/Link.native.tsx
2
+ import { Link as ExpoLink } from "expo-router";
3
+ import { jsx } from "react/jsx-runtime";
4
+ function Link({ href, replace, prefetch, push, children }) {
5
+ return /* @__PURE__ */ jsx(ExpoLink, { href, replace, prefetch: Boolean(prefetch), push, children });
6
+ }
7
+ export {
8
+ Link
9
+ };
10
+ //# sourceMappingURL=Link.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Link.native.tsx"],"sourcesContent":["import { Link as ExpoLink } from \"expo-router\";\nimport type { LinkProps } from \"../types\";\nimport type { Href } from \"../types.native\";\n\nexport function Link({ href, replace, prefetch, push, children }: LinkProps) {\n return (\n <ExpoLink href={href as Href} replace={replace} prefetch={Boolean(prefetch)} push={push}>\n {children}\n </ExpoLink>\n );\n}\n"],"mappings":";AAAA,SAAS,QAAQ,gBAAgB;AAM7B;AAFG,SAAS,KAAK,EAAE,MAAM,SAAS,UAAU,MAAM,SAAS,GAAc;AAC3E,SACE,oBAAC,YAAS,MAAoB,SAAkB,UAAU,QAAQ,QAAQ,GAAG,MAC1E,UACH;AAEJ;","names":[]}
@@ -0,0 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { H as Href } from '../types-BrqVaE2O.mjs';
3
+ import 'react';
4
+
5
+ type RedirectProps = {
6
+ href: Href;
7
+ replace?: boolean;
8
+ };
9
+ /**
10
+ * Expo-compatible Redirect for web.
11
+ *
12
+ * Maps Expo Router <Redirect /> → TanStack Router <Navigate />
13
+ */
14
+ declare function Redirect({ href, replace }: RedirectProps): react_jsx_runtime.JSX.Element;
15
+
16
+ export { Redirect };
@@ -0,0 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { H as Href } from '../types-BrqVaE2O.js';
3
+ import 'react';
4
+
5
+ type RedirectProps = {
6
+ href: Href;
7
+ replace?: boolean;
8
+ };
9
+ /**
10
+ * Expo-compatible Redirect for web.
11
+ *
12
+ * Maps Expo Router <Redirect /> → TanStack Router <Navigate />
13
+ */
14
+ declare function Redirect({ href, replace }: RedirectProps): react_jsx_runtime.JSX.Element;
15
+
16
+ export { Redirect };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Redirect.tsx
21
+ var Redirect_exports = {};
22
+ __export(Redirect_exports, {
23
+ Redirect: () => Redirect
24
+ });
25
+ module.exports = __toCommonJS(Redirect_exports);
26
+ var import_react_router = require("@tanstack/react-router");
27
+
28
+ // src/utils/route-utils.ts
29
+ function expoPathToTanStack(pathname) {
30
+ return pathname.replace(/\[([^\]]+)\]/g, (_, key) => `$${key}`);
31
+ }
32
+ function splitParams(pathname, params = {}) {
33
+ const dynamicKeys = Array.from(pathname.matchAll(/\[([^\]]+)\]/g), (m) => m[1]);
34
+ const pathParams = {};
35
+ const searchParams = {};
36
+ for (const [key, value] of Object.entries(params)) {
37
+ if (dynamicKeys.includes(key)) {
38
+ pathParams[key] = value;
39
+ } else {
40
+ searchParams[key] = value;
41
+ }
42
+ }
43
+ return { pathParams, searchParams };
44
+ }
45
+
46
+ // src/components/Redirect.tsx
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ function Redirect({ href, replace }) {
49
+ if (typeof href === "string") {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router.Navigate, { to: href, replace });
51
+ }
52
+ const { pathname, params } = href;
53
+ const to = expoPathToTanStack(pathname);
54
+ const { pathParams, searchParams } = splitParams(pathname, params);
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
+ import_react_router.Navigate,
57
+ {
58
+ to,
59
+ params: pathParams,
60
+ search: Object.keys(searchParams).length ? searchParams : void 0,
61
+ replace
62
+ }
63
+ );
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ Redirect
68
+ });
69
+ //# sourceMappingURL=Redirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Redirect.tsx","../../src/utils/route-utils.ts"],"sourcesContent":["import { Navigate } from \"@tanstack/react-router\";\nimport type { Href } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\ntype RedirectProps = {\n href: Href;\n replace?: boolean;\n};\n\n/**\n * Expo-compatible Redirect for web.\n *\n * Maps Expo Router <Redirect /> → TanStack Router <Navigate />\n */\nexport function Redirect({ href, replace }: RedirectProps) {\n // String path\n if (typeof href === \"string\") {\n return <Navigate to={href} replace={replace} />;\n }\n\n const { pathname, params } = href;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <Navigate\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n />\n );\n}\n","import type { HrefObject } from \"../types\";\n\n/**\n * Converts:\n * /user/[id]/post/[slug] → /user/$id/post/$slug\n */\nexport function expoPathToTanStack(pathname: string) {\n return pathname.replace(/\\[([^\\]]+)\\]/g, (_, key) => `$${key}`);\n}\n\n/**\n * Splits params into:\n * - path params (used by dynamic segments)\n * - search params (query string)\n */\nexport function splitParams(pathname: string, params: HrefObject[\"params\"] = {}) {\n const dynamicKeys = Array.from(pathname.matchAll(/\\[([^\\]]+)\\]/g), (m) => m[1]);\n\n const pathParams: Record<string, unknown> = {};\n const searchParams: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (dynamicKeys.includes(key)) {\n pathParams[key] = value;\n } else {\n searchParams[key] = value;\n }\n }\n\n return { pathParams, searchParams };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAyB;;;ACMlB,SAAS,mBAAmB,UAAkB;AACnD,SAAO,SAAS,QAAQ,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE;AAChE;AAOO,SAAS,YAAY,UAAkB,SAA+B,CAAC,GAAG;AAC/E,QAAM,cAAc,MAAM,KAAK,SAAS,SAAS,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAE9E,QAAM,aAAsC,CAAC;AAC7C,QAAM,eAAwC,CAAC;AAE/C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,YAAY,SAAS,GAAG,GAAG;AAC7B,iBAAW,GAAG,IAAI;AAAA,IACpB,OAAO;AACL,mBAAa,GAAG,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,aAAa;AACpC;;;ADbW;AAHJ,SAAS,SAAS,EAAE,MAAM,QAAQ,GAAkB;AAEzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,4CAAC,gCAAS,IAAI,MAAM,SAAkB;AAAA,EAC/C;AAEA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,44 @@
1
+ // src/components/Redirect.tsx
2
+ import { Navigate } from "@tanstack/react-router";
3
+
4
+ // src/utils/route-utils.ts
5
+ function expoPathToTanStack(pathname) {
6
+ return pathname.replace(/\[([^\]]+)\]/g, (_, key) => `$${key}`);
7
+ }
8
+ function splitParams(pathname, params = {}) {
9
+ const dynamicKeys = Array.from(pathname.matchAll(/\[([^\]]+)\]/g), (m) => m[1]);
10
+ const pathParams = {};
11
+ const searchParams = {};
12
+ for (const [key, value] of Object.entries(params)) {
13
+ if (dynamicKeys.includes(key)) {
14
+ pathParams[key] = value;
15
+ } else {
16
+ searchParams[key] = value;
17
+ }
18
+ }
19
+ return { pathParams, searchParams };
20
+ }
21
+
22
+ // src/components/Redirect.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ function Redirect({ href, replace }) {
25
+ if (typeof href === "string") {
26
+ return /* @__PURE__ */ jsx(Navigate, { to: href, replace });
27
+ }
28
+ const { pathname, params } = href;
29
+ const to = expoPathToTanStack(pathname);
30
+ const { pathParams, searchParams } = splitParams(pathname, params);
31
+ return /* @__PURE__ */ jsx(
32
+ Navigate,
33
+ {
34
+ to,
35
+ params: pathParams,
36
+ search: Object.keys(searchParams).length ? searchParams : void 0,
37
+ replace
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ Redirect
43
+ };
44
+ //# sourceMappingURL=Redirect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Redirect.tsx","../../src/utils/route-utils.ts"],"sourcesContent":["import { Navigate } from \"@tanstack/react-router\";\nimport type { Href } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\ntype RedirectProps = {\n href: Href;\n replace?: boolean;\n};\n\n/**\n * Expo-compatible Redirect for web.\n *\n * Maps Expo Router <Redirect /> → TanStack Router <Navigate />\n */\nexport function Redirect({ href, replace }: RedirectProps) {\n // String path\n if (typeof href === \"string\") {\n return <Navigate to={href} replace={replace} />;\n }\n\n const { pathname, params } = href;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <Navigate\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n />\n );\n}\n","import type { HrefObject } from \"../types\";\n\n/**\n * Converts:\n * /user/[id]/post/[slug] → /user/$id/post/$slug\n */\nexport function expoPathToTanStack(pathname: string) {\n return pathname.replace(/\\[([^\\]]+)\\]/g, (_, key) => `$${key}`);\n}\n\n/**\n * Splits params into:\n * - path params (used by dynamic segments)\n * - search params (query string)\n */\nexport function splitParams(pathname: string, params: HrefObject[\"params\"] = {}) {\n const dynamicKeys = Array.from(pathname.matchAll(/\\[([^\\]]+)\\]/g), (m) => m[1]);\n\n const pathParams: Record<string, unknown> = {};\n const searchParams: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (dynamicKeys.includes(key)) {\n pathParams[key] = value;\n } else {\n searchParams[key] = value;\n }\n }\n\n return { pathParams, searchParams };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;;;ACMlB,SAAS,mBAAmB,UAAkB;AACnD,SAAO,SAAS,QAAQ,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE;AAChE;AAOO,SAAS,YAAY,UAAkB,SAA+B,CAAC,GAAG;AAC/E,QAAM,cAAc,MAAM,KAAK,SAAS,SAAS,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAE9E,QAAM,aAAsC,CAAC;AAC7C,QAAM,eAAwC,CAAC;AAE/C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,YAAY,SAAS,GAAG,GAAG;AAC7B,iBAAW,GAAG,IAAI;AAAA,IACpB,OAAO;AACL,mBAAa,GAAG,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,aAAa;AACpC;;;ADbW;AAHJ,SAAS,SAAS,EAAE,MAAM,QAAQ,GAAkB;AAEzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,oBAAC,YAAS,IAAI,MAAM,SAAkB;AAAA,EAC/C;AAEA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1 @@
1
+ export { Redirect } from 'expo-router';
@@ -0,0 +1 @@
1
+ export { Redirect } from 'expo-router';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Redirect.native.tsx
21
+ var Redirect_native_exports = {};
22
+ __export(Redirect_native_exports, {
23
+ Redirect: () => import_expo_router.Redirect
24
+ });
25
+ module.exports = __toCommonJS(Redirect_native_exports);
26
+ var import_expo_router = require("expo-router");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ Redirect
30
+ });
31
+ //# sourceMappingURL=Redirect.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Redirect.native.tsx"],"sourcesContent":["export { Redirect } from \"expo-router\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAyB;","names":[]}
@@ -0,0 +1,6 @@
1
+ // src/components/Redirect.native.tsx
2
+ import { Redirect } from "expo-router";
3
+ export {
4
+ Redirect
5
+ };
6
+ //# sourceMappingURL=Redirect.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Redirect.native.tsx"],"sourcesContent":["export { Redirect } from \"expo-router\";\n"],"mappings":";AAAA,SAAS,gBAAgB;","names":[]}
@@ -0,0 +1,5 @@
1
+ export { Link } from './Link.mjs';
2
+ export { Redirect } from './Redirect.mjs';
3
+ import 'react/jsx-runtime';
4
+ import '../types-BrqVaE2O.mjs';
5
+ import 'react';
@@ -0,0 +1,5 @@
1
+ export { Link } from './Link.js';
2
+ export { Redirect } from './Redirect.js';
3
+ import 'react/jsx-runtime';
4
+ import '../types-BrqVaE2O.js';
5
+ import 'react';
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/index.ts
21
+ var components_exports = {};
22
+ __export(components_exports, {
23
+ Link: () => Link,
24
+ Redirect: () => Redirect
25
+ });
26
+ module.exports = __toCommonJS(components_exports);
27
+
28
+ // src/components/Link.tsx
29
+ var import_react_router = require("@tanstack/react-router");
30
+
31
+ // src/utils/route-utils.ts
32
+ function expoPathToTanStack(pathname) {
33
+ return pathname.replace(/\[([^\]]+)\]/g, (_, key) => `$${key}`);
34
+ }
35
+ function splitParams(pathname, params = {}) {
36
+ const dynamicKeys = Array.from(pathname.matchAll(/\[([^\]]+)\]/g), (m) => m[1]);
37
+ const pathParams = {};
38
+ const searchParams = {};
39
+ for (const [key, value] of Object.entries(params)) {
40
+ if (dynamicKeys.includes(key)) {
41
+ pathParams[key] = value;
42
+ } else {
43
+ searchParams[key] = value;
44
+ }
45
+ }
46
+ return { pathParams, searchParams };
47
+ }
48
+
49
+ // src/components/Link.tsx
50
+ var import_jsx_runtime = require("react/jsx-runtime");
51
+ function mapPrefetchToPreload(prefetch) {
52
+ if (prefetch === void 0 || prefetch === false) {
53
+ return false;
54
+ }
55
+ if (prefetch === true) {
56
+ return "intent";
57
+ }
58
+ return prefetch;
59
+ }
60
+ function Link({ href, replace, prefetch, children }) {
61
+ const preload = mapPrefetchToPreload(prefetch);
62
+ if (typeof href === "string") {
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router.Link, { to: href, replace, preload, children });
64
+ }
65
+ const { pathname, params } = href;
66
+ const to = expoPathToTanStack(pathname);
67
+ const { pathParams, searchParams } = splitParams(pathname, params);
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ import_react_router.Link,
70
+ {
71
+ to,
72
+ params: pathParams,
73
+ search: Object.keys(searchParams).length ? searchParams : void 0,
74
+ replace,
75
+ preload,
76
+ children
77
+ }
78
+ );
79
+ }
80
+
81
+ // src/components/Redirect.tsx
82
+ var import_react_router2 = require("@tanstack/react-router");
83
+ var import_jsx_runtime2 = require("react/jsx-runtime");
84
+ function Redirect({ href, replace }) {
85
+ if (typeof href === "string") {
86
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_router2.Navigate, { to: href, replace });
87
+ }
88
+ const { pathname, params } = href;
89
+ const to = expoPathToTanStack(pathname);
90
+ const { pathParams, searchParams } = splitParams(pathname, params);
91
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
92
+ import_react_router2.Navigate,
93
+ {
94
+ to,
95
+ params: pathParams,
96
+ search: Object.keys(searchParams).length ? searchParams : void 0,
97
+ replace
98
+ }
99
+ );
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ Link,
104
+ Redirect
105
+ });
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/index.ts","../../src/components/Link.tsx","../../src/utils/route-utils.ts","../../src/components/Redirect.tsx"],"sourcesContent":["export { Link } from \"./Link\";\nexport { Redirect } from \"./Redirect\";\n","import { Link as TanStackLink } from \"@tanstack/react-router\";\nimport type { HrefObject, LinkProps, Prefetch } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\nfunction mapPrefetchToPreload(prefetch: Prefetch | undefined) {\n if (prefetch === undefined || prefetch === false) {\n return false;\n }\n\n if (prefetch === true) {\n return \"intent\";\n }\n\n return prefetch;\n}\n\nexport function Link({ href, replace, prefetch, children }: LinkProps) {\n const preload = mapPrefetchToPreload(prefetch);\n\n // String href\n if (typeof href === \"string\") {\n return (\n <TanStackLink to={href} replace={replace} preload={preload}>\n {children}\n </TanStackLink>\n );\n }\n\n // Object-based Expo href\n const { pathname, params } = href as HrefObject;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <TanStackLink\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n preload={preload}\n >\n {children}\n </TanStackLink>\n );\n}\n","import type { HrefObject } from \"../types\";\n\n/**\n * Converts:\n * /user/[id]/post/[slug] → /user/$id/post/$slug\n */\nexport function expoPathToTanStack(pathname: string) {\n return pathname.replace(/\\[([^\\]]+)\\]/g, (_, key) => `$${key}`);\n}\n\n/**\n * Splits params into:\n * - path params (used by dynamic segments)\n * - search params (query string)\n */\nexport function splitParams(pathname: string, params: HrefObject[\"params\"] = {}) {\n const dynamicKeys = Array.from(pathname.matchAll(/\\[([^\\]]+)\\]/g), (m) => m[1]);\n\n const pathParams: Record<string, unknown> = {};\n const searchParams: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(params)) {\n if (dynamicKeys.includes(key)) {\n pathParams[key] = value;\n } else {\n searchParams[key] = value;\n }\n }\n\n return { pathParams, searchParams };\n}\n","import { Navigate } from \"@tanstack/react-router\";\nimport type { Href } from \"../types\";\nimport { expoPathToTanStack, splitParams } from \"../utils/route-utils\";\n\ntype RedirectProps = {\n href: Href;\n replace?: boolean;\n};\n\n/**\n * Expo-compatible Redirect for web.\n *\n * Maps Expo Router <Redirect /> → TanStack Router <Navigate />\n */\nexport function Redirect({ href, replace }: RedirectProps) {\n // String path\n if (typeof href === \"string\") {\n return <Navigate to={href} replace={replace} />;\n }\n\n const { pathname, params } = href;\n\n const to = expoPathToTanStack(pathname);\n const { pathParams, searchParams } = splitParams(pathname, params);\n\n return (\n <Navigate\n to={to}\n params={pathParams}\n search={Object.keys(searchParams).length ? searchParams : undefined}\n replace={replace}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAqC;;;ACM9B,SAAS,mBAAmB,UAAkB;AACnD,SAAO,SAAS,QAAQ,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE;AAChE;AAOO,SAAS,YAAY,UAAkB,SAA+B,CAAC,GAAG;AAC/E,QAAM,cAAc,MAAM,KAAK,SAAS,SAAS,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAE9E,QAAM,aAAsC,CAAC;AAC7C,QAAM,eAAwC,CAAC;AAE/C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,YAAY,SAAS,GAAG,GAAG;AAC7B,iBAAW,GAAG,IAAI;AAAA,IACpB,OAAO;AACL,mBAAa,GAAG,IAAI;AAAA,IACtB;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,aAAa;AACpC;;;ADRM;AAlBN,SAAS,qBAAqB,UAAgC;AAC5D,MAAI,aAAa,UAAa,aAAa,OAAO;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,MAAM;AACrB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,KAAK,EAAE,MAAM,SAAS,UAAU,SAAS,GAAc;AACrE,QAAM,UAAU,qBAAqB,QAAQ;AAG7C,MAAI,OAAO,SAAS,UAAU;AAC5B,WACE,4CAAC,oBAAAA,MAAA,EAAa,IAAI,MAAM,SAAkB,SACvC,UACH;AAAA,EAEJ;AAGA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC,oBAAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;AE7CA,IAAAC,uBAAyB;AAiBd,IAAAC,sBAAA;AAHJ,SAAS,SAAS,EAAE,MAAM,QAAQ,GAAkB;AAEzD,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,6CAAC,iCAAS,IAAI,MAAM,SAAkB;AAAA,EAC/C;AAEA,QAAM,EAAE,UAAU,OAAO,IAAI;AAE7B,QAAM,KAAK,mBAAmB,QAAQ;AACtC,QAAM,EAAE,YAAY,aAAa,IAAI,YAAY,UAAU,MAAM;AAEjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ,OAAO,KAAK,YAAY,EAAE,SAAS,eAAe;AAAA,MAC1D;AAAA;AAAA,EACF;AAEJ;","names":["TanStackLink","import_react_router","import_jsx_runtime"]}