@tanstack/react-router 0.0.1-beta.83 → 1.0.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 (225) hide show
  1. package/LICENSE +1 -1
  2. package/build/cjs/CatchBoundary.js +128 -0
  3. package/build/cjs/CatchBoundary.js.map +1 -0
  4. package/build/cjs/Matches.js +233 -0
  5. package/build/cjs/Matches.js.map +1 -0
  6. package/build/cjs/RouterProvider.js +170 -0
  7. package/build/cjs/RouterProvider.js.map +1 -0
  8. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -4
  9. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  10. package/build/cjs/_virtual/with-selector.development.js +16 -0
  11. package/build/cjs/_virtual/with-selector.development.js.map +1 -0
  12. package/build/cjs/_virtual/with-selector.js +16 -0
  13. package/build/cjs/_virtual/with-selector.js.map +1 -0
  14. package/build/cjs/_virtual/with-selector.production.min.js +16 -0
  15. package/build/cjs/_virtual/with-selector.production.min.js.map +1 -0
  16. package/build/cjs/awaited.js +43 -0
  17. package/build/cjs/awaited.js.map +1 -0
  18. package/build/cjs/build/esm/index.js +79 -0
  19. package/build/cjs/build/esm/index.js.map +1 -0
  20. package/build/cjs/defer.js +37 -0
  21. package/build/cjs/defer.js.map +1 -0
  22. package/build/cjs/fileRoute.js +27 -0
  23. package/build/cjs/fileRoute.js.map +1 -0
  24. package/build/cjs/index.js +113 -451
  25. package/build/cjs/index.js.map +1 -1
  26. package/build/cjs/lazyRouteComponent.js +54 -0
  27. package/build/cjs/lazyRouteComponent.js.map +1 -0
  28. package/build/cjs/link.js +223 -0
  29. package/build/cjs/link.js.map +1 -0
  30. package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js +47 -0
  31. package/build/cjs/node_modules/.pnpm/@tanstack_react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js.map +1 -0
  32. package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js +70 -0
  33. package/build/cjs/node_modules/.pnpm/@tanstack_store@0.1.3/node_modules/@tanstack/store/build/modern/index.js.map +1 -0
  34. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +188 -0
  35. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
  36. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +39 -0
  37. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -0
  38. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js +26 -0
  39. package/build/cjs/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
  40. package/build/cjs/packages/react-router/src/CatchBoundary.js +123 -0
  41. package/build/cjs/packages/react-router/src/CatchBoundary.js.map +1 -0
  42. package/build/cjs/packages/react-router/src/Matches.js +235 -0
  43. package/build/cjs/packages/react-router/src/Matches.js.map +1 -0
  44. package/build/cjs/packages/react-router/src/RouterProvider.js +144 -0
  45. package/build/cjs/packages/react-router/src/RouterProvider.js.map +1 -0
  46. package/build/cjs/packages/react-router/src/awaited.js +43 -0
  47. package/build/cjs/packages/react-router/src/awaited.js.map +1 -0
  48. package/build/cjs/packages/react-router/src/defer.js +37 -0
  49. package/build/cjs/packages/react-router/src/defer.js.map +1 -0
  50. package/build/cjs/packages/react-router/src/fileRoute.js +27 -0
  51. package/build/cjs/packages/react-router/src/fileRoute.js.map +1 -0
  52. package/build/cjs/packages/react-router/src/index.js +61 -0
  53. package/build/cjs/packages/react-router/src/index.js.map +1 -0
  54. package/build/cjs/packages/react-router/src/lazyRouteComponent.js +54 -0
  55. package/build/cjs/packages/react-router/src/lazyRouteComponent.js.map +1 -0
  56. package/build/cjs/packages/react-router/src/link.js +148 -0
  57. package/build/cjs/packages/react-router/src/link.js.map +1 -0
  58. package/build/cjs/packages/react-router/src/path.js +209 -0
  59. package/build/cjs/packages/react-router/src/path.js.map +1 -0
  60. package/build/cjs/packages/react-router/src/qss.js +63 -0
  61. package/build/cjs/packages/react-router/src/qss.js.map +1 -0
  62. package/build/cjs/packages/react-router/src/react.js +634 -0
  63. package/build/cjs/packages/react-router/src/react.js.map +1 -0
  64. package/build/cjs/packages/react-router/src/redirects.js +25 -0
  65. package/build/cjs/packages/react-router/src/redirects.js.map +1 -0
  66. package/build/cjs/packages/react-router/src/route.js +134 -0
  67. package/build/cjs/packages/react-router/src/route.js.map +1 -0
  68. package/build/cjs/packages/react-router/src/router.js +1111 -0
  69. package/build/cjs/packages/react-router/src/router.js.map +1 -0
  70. package/build/cjs/packages/react-router/src/scroll-restoration.js +53 -0
  71. package/build/cjs/packages/react-router/src/scroll-restoration.js.map +1 -0
  72. package/build/cjs/packages/react-router/src/searchParams.js +81 -0
  73. package/build/cjs/packages/react-router/src/searchParams.js.map +1 -0
  74. package/build/cjs/packages/react-router/src/useBlocker.js +61 -0
  75. package/build/cjs/packages/react-router/src/useBlocker.js.map +1 -0
  76. package/build/cjs/packages/react-router/src/useNavigate.js +75 -0
  77. package/build/cjs/packages/react-router/src/useNavigate.js.map +1 -0
  78. package/build/cjs/packages/react-router/src/useParams.js +26 -0
  79. package/build/cjs/packages/react-router/src/useParams.js.map +1 -0
  80. package/build/cjs/packages/react-router/src/useSearch.js +25 -0
  81. package/build/cjs/packages/react-router/src/useSearch.js.map +1 -0
  82. package/build/cjs/packages/react-router/src/utils.js +239 -0
  83. package/build/cjs/packages/react-router/src/utils.js.map +1 -0
  84. package/build/cjs/path.js +214 -0
  85. package/build/cjs/path.js.map +1 -0
  86. package/build/cjs/qss.js +63 -0
  87. package/build/cjs/qss.js.map +1 -0
  88. package/build/cjs/react/CatchBoundary.js +123 -0
  89. package/build/cjs/react/CatchBoundary.js.map +1 -0
  90. package/build/cjs/react/awaited.js +43 -0
  91. package/build/cjs/react/awaited.js.map +1 -0
  92. package/build/cjs/react/defer.js +37 -0
  93. package/build/cjs/react/defer.js.map +1 -0
  94. package/build/cjs/react.js +650 -0
  95. package/build/cjs/react.js.map +1 -0
  96. package/build/cjs/redirects.js +28 -0
  97. package/build/cjs/redirects.js.map +1 -0
  98. package/build/cjs/route.js +191 -0
  99. package/build/cjs/route.js.map +1 -0
  100. package/build/cjs/router.js +1085 -0
  101. package/build/cjs/router.js.map +1 -0
  102. package/build/cjs/routerConfig.js +209 -0
  103. package/build/cjs/routerConfig.js.map +1 -0
  104. package/build/cjs/scroll-restoration.js +202 -0
  105. package/build/cjs/scroll-restoration.js.map +1 -0
  106. package/build/cjs/searchParams.js +81 -0
  107. package/build/cjs/searchParams.js.map +1 -0
  108. package/build/cjs/src/CatchBoundary.js +126 -0
  109. package/build/cjs/src/CatchBoundary.js.map +1 -0
  110. package/build/cjs/src/Matches.js +235 -0
  111. package/build/cjs/src/Matches.js.map +1 -0
  112. package/build/cjs/src/RouterProvider.js +1051 -0
  113. package/build/cjs/src/RouterProvider.js.map +1 -0
  114. package/build/cjs/src/awaited.js +45 -0
  115. package/build/cjs/src/awaited.js.map +1 -0
  116. package/build/cjs/src/defer.js +39 -0
  117. package/build/cjs/src/defer.js.map +1 -0
  118. package/build/cjs/src/fileRoute.js +29 -0
  119. package/build/cjs/src/fileRoute.js.map +1 -0
  120. package/build/cjs/src/index.js +134 -0
  121. package/build/cjs/src/index.js.map +1 -0
  122. package/build/cjs/src/lazyRouteComponent.js +57 -0
  123. package/build/cjs/src/lazyRouteComponent.js.map +1 -0
  124. package/build/cjs/src/link.js +151 -0
  125. package/build/cjs/src/link.js.map +1 -0
  126. package/build/cjs/src/path.js +211 -0
  127. package/build/cjs/src/path.js.map +1 -0
  128. package/build/cjs/src/qss.js +65 -0
  129. package/build/cjs/src/qss.js.map +1 -0
  130. package/build/cjs/src/redirects.js +27 -0
  131. package/build/cjs/src/redirects.js.map +1 -0
  132. package/build/cjs/src/route.js +139 -0
  133. package/build/cjs/src/route.js.map +1 -0
  134. package/build/cjs/src/router.js +203 -0
  135. package/build/cjs/src/router.js.map +1 -0
  136. package/build/cjs/src/scroll-restoration.js +186 -0
  137. package/build/cjs/src/scroll-restoration.js.map +1 -0
  138. package/build/cjs/src/searchParams.js +83 -0
  139. package/build/cjs/src/searchParams.js.map +1 -0
  140. package/build/cjs/src/useBlocker.js +64 -0
  141. package/build/cjs/src/useBlocker.js.map +1 -0
  142. package/build/cjs/src/useNavigate.js +78 -0
  143. package/build/cjs/src/useNavigate.js.map +1 -0
  144. package/build/cjs/src/useParams.js +28 -0
  145. package/build/cjs/src/useParams.js.map +1 -0
  146. package/build/cjs/src/useSearch.js +27 -0
  147. package/build/cjs/src/useSearch.js.map +1 -0
  148. package/build/cjs/src/utils.js +230 -0
  149. package/build/cjs/src/utils.js.map +1 -0
  150. package/build/cjs/useBlocker.js +55 -0
  151. package/build/cjs/useBlocker.js.map +1 -0
  152. package/build/cjs/useNavigate.js +86 -0
  153. package/build/cjs/useNavigate.js.map +1 -0
  154. package/build/cjs/useParams.js +26 -0
  155. package/build/cjs/useParams.js.map +1 -0
  156. package/build/cjs/useSearch.js +25 -0
  157. package/build/cjs/useSearch.js.map +1 -0
  158. package/build/cjs/useStore.js +99 -0
  159. package/build/cjs/useStore.js.map +1 -0
  160. package/build/cjs/utils.js +241 -0
  161. package/build/cjs/utils.js.map +1 -0
  162. package/build/esm/index.js +2581 -337
  163. package/build/esm/index.js.map +1 -1
  164. package/build/stats-html.html +3494 -2700
  165. package/build/stats-react.json +1134 -87
  166. package/build/types/CatchBoundary.d.ts +36 -0
  167. package/build/types/Matches.d.ts +64 -0
  168. package/build/types/RouteMatch.d.ts +23 -0
  169. package/build/types/RouterProvider.d.ts +35 -0
  170. package/build/types/awaited.d.ts +9 -0
  171. package/build/types/defer.d.ts +19 -0
  172. package/build/types/fileRoute.d.ts +38 -0
  173. package/build/types/history.d.ts +7 -0
  174. package/build/types/index.d.ts +911 -88
  175. package/build/types/injectHtml.d.ts +0 -0
  176. package/build/types/lazyRouteComponent.d.ts +2 -0
  177. package/build/types/link.d.ts +93 -0
  178. package/build/types/location.d.ts +12 -0
  179. package/build/types/path.d.ts +17 -0
  180. package/build/types/qss.d.ts +2 -0
  181. package/build/types/react/CatchBoundary.d.ts +33 -0
  182. package/build/types/react/awaited.d.ts +9 -0
  183. package/build/types/react/defer.d.ts +19 -0
  184. package/build/types/react.d.ts +141 -0
  185. package/build/types/redirects.d.ts +11 -0
  186. package/build/types/route.d.ts +283 -0
  187. package/build/types/routeInfo.d.ts +31 -0
  188. package/build/types/router.d.ts +186 -0
  189. package/build/types/scroll-restoration.d.ts +18 -0
  190. package/build/types/searchParams.d.ts +7 -0
  191. package/build/types/useBlocker.d.ts +9 -0
  192. package/build/types/useNavigate.d.ts +19 -0
  193. package/build/types/useParams.d.ts +7 -0
  194. package/build/types/useSearch.d.ts +7 -0
  195. package/build/types/useStore.d.ts +12 -0
  196. package/build/types/utils.d.ts +69 -0
  197. package/build/umd/index.development.js +2829 -1796
  198. package/build/umd/index.development.js.map +1 -1
  199. package/build/umd/index.production.js +4 -24
  200. package/build/umd/index.production.js.map +1 -1
  201. package/package.json +9 -7
  202. package/src/CatchBoundary.tsx +101 -0
  203. package/src/Matches.tsx +423 -0
  204. package/src/RouterProvider.tsx +252 -0
  205. package/src/awaited.tsx +40 -0
  206. package/src/defer.ts +55 -0
  207. package/src/fileRoute.ts +152 -0
  208. package/src/history.ts +8 -0
  209. package/src/index.tsx +28 -747
  210. package/src/lazyRouteComponent.tsx +33 -0
  211. package/src/link.tsx +603 -0
  212. package/src/location.ts +13 -0
  213. package/src/path.ts +261 -0
  214. package/src/qss.ts +53 -0
  215. package/src/redirects.ts +39 -0
  216. package/src/route.ts +882 -0
  217. package/src/routeInfo.ts +84 -0
  218. package/src/router.ts +1671 -0
  219. package/src/scroll-restoration.tsx +230 -0
  220. package/src/searchParams.ts +79 -0
  221. package/src/useBlocker.tsx +27 -0
  222. package/src/useNavigate.tsx +111 -0
  223. package/src/useParams.tsx +25 -0
  224. package/src/useSearch.tsx +25 -0
  225. package/src/utils.ts +360 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ var React = require('react');
14
+
15
+ function _interopNamespaceDefault(e) {
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
33
+
34
+ function lazyRouteComponent(importer, exportName) {
35
+ let loadPromise;
36
+ const load = () => {
37
+ if (!loadPromise) {
38
+ loadPromise = importer();
39
+ }
40
+ return loadPromise;
41
+ };
42
+ const lazyComp = /*#__PURE__*/React__namespace.lazy(async () => {
43
+ const moduleExports = await load();
44
+ const comp = moduleExports[exportName ?? 'default'];
45
+ return {
46
+ default: comp
47
+ };
48
+ });
49
+ lazyComp.preload = load;
50
+ return lazyComp;
51
+ }
52
+
53
+ exports.lazyRouteComponent = lazyRouteComponent;
54
+ //# sourceMappingURL=lazyRouteComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazyRouteComponent.js","sources":["../../src/lazyRouteComponent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { AsyncRouteComponent } from './route'\n\nexport function lazyRouteComponent<\n T extends Record<string, any>,\n TKey extends keyof T = 'default',\n>(\n importer: () => Promise<T>,\n exportName?: TKey,\n): T[TKey] extends (props: infer TProps) => any\n ? AsyncRouteComponent<TProps>\n : never {\n let loadPromise: Promise<any>\n\n const load = () => {\n if (!loadPromise) {\n loadPromise = importer()\n }\n\n return loadPromise\n }\n\n const lazyComp = React.lazy(async () => {\n const moduleExports = await load()\n const comp = moduleExports[exportName ?? 'default']\n return {\n default: comp,\n }\n })\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n"],"names":["lazyRouteComponent","importer","exportName","loadPromise","load","lazyComp","React","lazy","moduleExports","comp","default","preload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,kBAAkBA,CAIhCC,QAA0B,EAC1BC,UAAiB,EAGT;AACR,EAAA,IAAIC,WAAyB,CAAA;EAE7B,MAAMC,IAAI,GAAGA,MAAM;IACjB,IAAI,CAACD,WAAW,EAAE;MAChBA,WAAW,GAAGF,QAAQ,EAAE,CAAA;AAC1B,KAAA;AAEA,IAAA,OAAOE,WAAW,CAAA;GACnB,CAAA;AAED,EAAA,MAAME,QAAQ,gBAAGC,gBAAK,CAACC,IAAI,CAAC,YAAY;AACtC,IAAA,MAAMC,aAAa,GAAG,MAAMJ,IAAI,EAAE,CAAA;AAClC,IAAA,MAAMK,IAAI,GAAGD,aAAa,CAACN,UAAU,IAAI,SAAS,CAAC,CAAA;IACnD,OAAO;AACLQ,MAAAA,OAAO,EAAED,IAAAA;KACV,CAAA;AACH,GAAC,CAAC,CAAA;EACAJ,QAAQ,CAASM,OAAO,GAAGP,IAAI,CAAA;AAEjC,EAAA,OAAOC,QAAQ,CAAA;AACjB;;;;"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
14
+ var React = require('react');
15
+ var Matches = require('./Matches.js');
16
+ var RouterProvider = require('./RouterProvider.js');
17
+ var utils = require('./utils.js');
18
+
19
+ function _interopNamespaceDefault(e) {
20
+ var n = Object.create(null);
21
+ if (e) {
22
+ Object.keys(e).forEach(function (k) {
23
+ if (k !== 'default') {
24
+ var d = Object.getOwnPropertyDescriptor(e, k);
25
+ Object.defineProperty(n, k, d.get ? d : {
26
+ enumerable: true,
27
+ get: function () { return e[k]; }
28
+ });
29
+ }
30
+ });
31
+ }
32
+ n.default = e;
33
+ return Object.freeze(n);
34
+ }
35
+
36
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
37
+
38
+ const preloadWarning = 'Error preloading route! ☝️';
39
+ function useLinkProps(options) {
40
+ const router = RouterProvider.useRouter();
41
+ const matchPathname = Matches.useMatch({
42
+ strict: false,
43
+ select: s => s.pathname
44
+ });
45
+ const {
46
+ // custom props
47
+ children,
48
+ target,
49
+ activeProps = () => ({
50
+ className: 'active'
51
+ }),
52
+ inactiveProps = () => ({}),
53
+ activeOptions,
54
+ disabled,
55
+ hash,
56
+ search,
57
+ params,
58
+ to,
59
+ state,
60
+ mask,
61
+ preload: userPreload,
62
+ preloadDelay: userPreloadDelay,
63
+ replace,
64
+ startTransition,
65
+ resetScroll,
66
+ // element props
67
+ style,
68
+ className,
69
+ onClick,
70
+ onFocus,
71
+ onMouseEnter,
72
+ onMouseLeave,
73
+ onTouchStart,
74
+ ...rest
75
+ } = options;
76
+
77
+ // If this link simply reloads the current route,
78
+ // make sure it has a new key so it will trigger a data refresh
79
+
80
+ // If this `to` is a valid external URL, return
81
+ // null for LinkUtils
82
+
83
+ const dest = {
84
+ from: options.to ? matchPathname : undefined,
85
+ ...options
86
+ };
87
+ let type = 'internal';
88
+ try {
89
+ new URL(`${to}`);
90
+ type = 'external';
91
+ } catch {}
92
+ if (type === 'external') {
93
+ return {
94
+ href: to
95
+ };
96
+ }
97
+ const next = router.buildLocation(dest);
98
+ const preload = userPreload ?? router.options.defaultPreload;
99
+ const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
100
+ const isActive = RouterProvider.useRouterState({
101
+ select: s => {
102
+ // Compare path/hash for matches
103
+ const currentPathSplit = s.location.pathname.split('/');
104
+ const nextPathSplit = next.pathname.split('/');
105
+ const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
106
+ // Combine the matches based on user router.options
107
+ const pathTest = activeOptions?.exact ? s.location.pathname === next.pathname : pathIsFuzzyEqual;
108
+ const hashTest = activeOptions?.includeHash ? s.location.hash === next.hash : true;
109
+ const searchTest = activeOptions?.includeSearch ?? true ? utils.deepEqual(s.location.search, next.search, !activeOptions?.exact) : true;
110
+
111
+ // The final "active" test
112
+ return pathTest && hashTest && searchTest;
113
+ }
114
+ });
115
+
116
+ // The click handler
117
+ const handleClick = e => {
118
+ if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!target || target === '_self') && e.button === 0) {
119
+ e.preventDefault();
120
+
121
+ // All is well? Navigate!
122
+ router.commitLocation({
123
+ ...next,
124
+ replace,
125
+ resetScroll,
126
+ startTransition
127
+ });
128
+ }
129
+ };
130
+
131
+ // The click handler
132
+ const handleFocus = e => {
133
+ if (preload) {
134
+ router.preloadRoute(dest).catch(err => {
135
+ console.warn(err);
136
+ console.warn(preloadWarning);
137
+ });
138
+ }
139
+ };
140
+ const handleTouchStart = e => {
141
+ if (preload) {
142
+ router.preloadRoute(dest).catch(err => {
143
+ console.warn(err);
144
+ console.warn(preloadWarning);
145
+ });
146
+ }
147
+ };
148
+ const handleEnter = e => {
149
+ const target = e.target || {};
150
+ if (preload) {
151
+ if (target.preloadTimeout) {
152
+ return;
153
+ }
154
+ target.preloadTimeout = setTimeout(() => {
155
+ target.preloadTimeout = null;
156
+ router.preloadRoute(dest).catch(err => {
157
+ console.warn(err);
158
+ console.warn(preloadWarning);
159
+ });
160
+ }, preloadDelay);
161
+ }
162
+ };
163
+ const handleLeave = e => {
164
+ const target = e.target || {};
165
+ if (target.preloadTimeout) {
166
+ clearTimeout(target.preloadTimeout);
167
+ target.preloadTimeout = null;
168
+ }
169
+ };
170
+ const composeHandlers = handlers => e => {
171
+ if (e.persist) e.persist();
172
+ handlers.filter(Boolean).forEach(handler => {
173
+ if (e.defaultPrevented) return;
174
+ handler(e);
175
+ });
176
+ };
177
+
178
+ // Get the active props
179
+ const resolvedActiveProps = isActive ? utils.functionalUpdate(activeProps, {}) ?? {} : {};
180
+
181
+ // Get the inactive props
182
+ const resolvedInactiveProps = isActive ? {} : utils.functionalUpdate(inactiveProps, {}) ?? {};
183
+ return {
184
+ ...resolvedActiveProps,
185
+ ...resolvedInactiveProps,
186
+ ...rest,
187
+ href: disabled ? undefined : next.maskedLocation ? next.maskedLocation.href : next.href,
188
+ onClick: composeHandlers([onClick, handleClick]),
189
+ onFocus: composeHandlers([onFocus, handleFocus]),
190
+ onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),
191
+ onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
192
+ onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),
193
+ target,
194
+ style: {
195
+ ...style,
196
+ ...resolvedActiveProps.style,
197
+ ...resolvedInactiveProps.style
198
+ },
199
+ className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined,
200
+ ...(disabled ? {
201
+ role: 'link',
202
+ 'aria-disabled': true
203
+ } : undefined),
204
+ ['data-status']: isActive ? 'active' : undefined
205
+ };
206
+ }
207
+ const Link = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
208
+ const linkProps = useLinkProps(props);
209
+ return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers.extends({
210
+ ref: ref
211
+ }, linkProps, {
212
+ children: typeof props.children === 'function' ? props.children({
213
+ isActive: linkProps['data-status'] === 'active'
214
+ }) : props.children
215
+ }));
216
+ });
217
+ function isCtrlEvent(e) {
218
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
219
+ }
220
+
221
+ exports.Link = Link;
222
+ exports.useLinkProps = useLinkProps;
223
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sources":["../../src/link.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useMatch } from './Matches'\nimport { useRouter, useRouterState } from './RouterProvider'\nimport { Trim } from './fileRoute'\nimport { AnyRoute, ReactNode } from './route'\nimport {\n AllParams,\n FullSearchSchema,\n RouteByPath,\n RouteIds,\n RoutePaths,\n} from './routeInfo'\nimport { RegisteredRouter } from './router'\nimport { LinkProps, UseLinkPropsOptions } from './useNavigate'\nimport {\n Expand,\n NoInfer,\n NonNullableUpdater,\n PickRequired,\n UnionToIntersection,\n Updater,\n deepEqual,\n functionalUpdate,\n} from './utils'\nimport { HistoryState } from '@tanstack/history'\n\nexport type CleanPath<T extends string> = T extends `${infer L}//${infer R}`\n ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`>\n : T extends `${infer L}//`\n ? `${CleanPath<L>}/`\n : T extends `//${infer L}`\n ? `/${CleanPath<L>}`\n : T\n\nexport type Split<S, TIncludeTrailingSlash = true> = S extends unknown\n ? string extends S\n ? string[]\n : S extends string\n ? CleanPath<S> extends ''\n ? []\n : TIncludeTrailingSlash extends true\n ? CleanPath<S> extends `${infer T}/`\n ? [...Split<T>, '/']\n : CleanPath<S> extends `/${infer U}`\n ? Split<U>\n : CleanPath<S> extends `${infer T}/${infer U}`\n ? [...Split<T>, ...Split<U>]\n : [S]\n : CleanPath<S> extends `${infer T}/${infer U}`\n ? [...Split<T>, ...Split<U>]\n : S extends string\n ? [S]\n : never\n : never\n : never\n\nexport type ParsePathParams<T extends string> = keyof {\n [K in Trim<Split<T>[number], '_'> as K extends `$${infer L}` ? L : never]: K\n}\n\nexport type Join<T, Delimiter extends string = '/'> = T extends []\n ? ''\n : T extends [infer L extends string]\n ? L\n : T extends [infer L extends string, ...infer Tail extends [...string[]]]\n ? CleanPath<`${L}${Delimiter}${Join<Tail>}`>\n : never\n\nexport type Last<T extends any[]> = T extends [...infer _, infer L] ? L : never\n\nexport type RelativeToPathAutoComplete<\n AllPaths extends string,\n TFrom extends string,\n TTo extends string,\n SplitPaths extends string[] = Split<AllPaths, false>,\n> = TTo extends `..${infer _}`\n ? SplitPaths extends [\n ...Split<ResolveRelativePath<TFrom, TTo>, false>,\n ...infer TToRest,\n ]\n ? `${CleanPath<\n Join<\n [\n ...Split<TTo, false>,\n ...(\n | TToRest\n | (Split<\n ResolveRelativePath<TFrom, TTo>,\n false\n >['length'] extends 1\n ? never\n : ['../'])\n ),\n ]\n >\n >}`\n : never\n : TTo extends `./${infer RestTTo}`\n ? SplitPaths extends [\n ...Split<TFrom, false>,\n ...Split<RestTTo, false>,\n ...infer RestPath,\n ]\n ? `${TTo}${Join<RestPath>}`\n : never\n :\n | (TFrom extends `/`\n ? never\n : SplitPaths extends [...Split<TFrom, false>, ...infer RestPath]\n ? Join<RestPath> extends { length: 0 }\n ? never\n : './'\n : never)\n | (TFrom extends `/` ? never : '../')\n | AllPaths\n\nexport type NavigateOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.\n replace?: boolean\n resetScroll?: boolean\n // If set to `true`, the link's underlying navigate() call will be wrapped in a `React.startTransition` call. Defaults to `true`.\n startTransition?: boolean\n}\n\nexport type ToOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToSubOptions<TRouteTree, TFrom, TTo> & {\n mask?: ToMaskOptions<TRouteTree, TMaskFrom, TMaskTo>\n}\n\nexport type ToMaskOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToSubOptions<TRouteTree, TMaskFrom, TMaskTo> & {\n unmaskOnReload?: boolean\n}\n\nexport type ToSubOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n> = {\n to?: ToPathOption<TRouteTree, TFrom, TTo>\n // The new has string or a function to update it\n hash?: true | Updater<string>\n // State to pass to the history stack\n state?: true | NonNullableUpdater<HistoryState>\n // The source route path. This is automatically set when using route-level APIs, but for type-safe relative routing on the router itself, this is required\n from?: TFrom\n // // When using relative route paths, this option forces resolution from the current path, instead of the route API's path or `from` path\n} & CheckPath<TRouteTree, NoInfer<TResolved>, {}> &\n SearchParamOptions<TRouteTree, TFrom, TTo, TResolved> &\n PathParamOptions<TRouteTree, TFrom, TResolved>\n\nexport type SearchParamOptions<\n TRouteTree extends AnyRoute,\n TFrom,\n TTo,\n TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n TFromSearchEnsured = '/' extends TFrom\n ? FullSearchSchema<TRouteTree>\n : Expand<\n PickRequired<\n RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']\n >\n >,\n TFromSearchOptional = Omit<\n FullSearchSchema<TRouteTree>,\n keyof TFromSearchEnsured\n >,\n TFromSearch = Expand<TFromSearchEnsured & TFromSearchOptional>,\n TToSearch = '' extends TTo\n ? FullSearchSchema<TRouteTree>\n : Expand<RouteByPath<TRouteTree, TResolved>['types']['fullSearchSchema']>,\n> = keyof PickRequired<TToSearch> extends never\n ? {\n search?: true | SearchReducer<TFromSearch, TToSearch>\n }\n : {\n search: TFromSearchEnsured extends PickRequired<TToSearch>\n ? true | SearchReducer<TFromSearch, TToSearch>\n : SearchReducer<TFromSearch, TToSearch>\n }\n\ntype SearchReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)\n\nexport type PathParamOptions<\n TRouteTree extends AnyRoute,\n TFrom,\n TTo,\n TFromParamsEnsured = Expand<\n UnionToIntersection<\n PickRequired<RouteByPath<TRouteTree, TFrom>['types']['allParams']>\n >\n >,\n TFromParamsOptional = Omit<AllParams<TRouteTree>, keyof TFromParamsEnsured>,\n TFromParams = Expand<TFromParamsOptional & TFromParamsEnsured>,\n TToParams = Expand<RouteByPath<TRouteTree, TTo>['types']['allParams']>,\n> = never extends TToParams\n ? {\n params?: true | ParamsReducer<Partial<TFromParams>, Partial<TFromParams>>\n }\n : keyof PickRequired<TToParams> extends never\n ? {\n params?: true | ParamsReducer<TFromParams, TToParams>\n }\n : {\n params: TFromParamsEnsured extends PickRequired<TToParams>\n ? true | ParamsReducer<TFromParams, TToParams>\n : ParamsReducer<TFromParams, TToParams>\n }\n\ntype ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)\n\nexport type ToPathOption<\n TRouteTree extends AnyRoute = AnyRoute,\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n> =\n | TTo\n | RelativeToPathAutoComplete<\n RoutePaths<TRouteTree>,\n NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',\n NoInfer<TTo> & string\n >\n\nexport type ToIdOption<\n TRouteTree extends AnyRoute = AnyRoute,\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n> =\n | TTo\n | RelativeToPathAutoComplete<\n RouteIds<TRouteTree>,\n NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',\n NoInfer<TTo> & string\n >\n\nexport interface ActiveOptions {\n exact?: boolean\n includeHash?: boolean\n includeSearch?: boolean\n}\n\nexport type LinkOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = TFrom,\n TMaskTo extends string = '',\n> = NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // The standard anchor tag target attribute\n target?: HTMLAnchorElement['target']\n // Defaults to `{ exact: false, includeHash: false }`\n activeOptions?: ActiveOptions\n // If set, will preload the linked route on hover and cache it for this many milliseconds in hopes that the user will eventually navigate there.\n preload?: false | 'intent'\n // Delay intent preloading by this many milliseconds. If the intent exits before this delay, the preload will be cancelled.\n preloadDelay?: number\n // If true, will render the link without the href attribute\n disabled?: boolean\n}\n\nexport type CheckRelativePath<\n TRouteTree extends AnyRoute,\n TFrom,\n TTo,\n> = TTo extends string\n ? TFrom extends string\n ? ResolveRelativePath<TFrom, TTo> extends RoutePaths<TRouteTree>\n ? {}\n : {\n Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<\n TFrom,\n TTo\n >}, which is not a valid route path.`\n 'Valid Route Paths': RoutePaths<TRouteTree>\n }\n : {}\n : {}\n\nexport type CheckPath<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<\n TPath,\n RoutePaths<TRouteTree>\n> extends never\n ? TPass\n : CheckPathError<TRouteTree, Exclude<TPath, RoutePaths<TRouteTree>>>\n\nexport type CheckPathError<TRouteTree extends AnyRoute, TInvalids> = {\n to: RoutePaths<TRouteTree>\n}\n\nexport type CheckId<TRouteTree extends AnyRoute, TPath, TPass> = Exclude<\n TPath,\n RouteIds<TRouteTree>\n> extends never\n ? TPass\n : CheckIdError<TRouteTree, Exclude<TPath, RouteIds<TRouteTree>>>\n\nexport type CheckIdError<TRouteTree extends AnyRoute, TInvalids> = {\n Error: `${TInvalids extends string\n ? TInvalids\n : never} is not a valid route ID.`\n 'Valid Route IDs': RouteIds<TRouteTree>\n}\n\nexport type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string\n ? TTo extends string\n ? TTo extends '.'\n ? TFrom\n : TTo extends `./`\n ? Join<[TFrom, '/']>\n : TTo extends `./${infer TRest}`\n ? ResolveRelativePath<TFrom, TRest>\n : TTo extends `/${infer TRest}`\n ? TTo\n : Split<TTo> extends ['..', ...infer ToRest]\n ? Split<TFrom> extends [...infer FromRest, infer FromTail]\n ? ToRest extends ['/']\n ? Join<[...FromRest, '/']>\n : ResolveRelativePath<Join<FromRest>, Join<ToRest>>\n : never\n : Split<TTo> extends ['.', ...infer ToRest]\n ? ToRest extends ['/']\n ? Join<[TFrom, '/']>\n : ResolveRelativePath<TFrom, Join<ToRest>>\n : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>>\n : never\n : never\n\ntype LinkCurrentTargetElement = {\n preloadTimeout?: null | ReturnType<typeof setTimeout>\n}\n\nconst preloadWarning = 'Error preloading route! ☝️'\n\nexport function useLinkProps<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n const matchPathname = useMatch({\n strict: false,\n select: (s) => s.pathname,\n })\n\n const {\n // custom props\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n hash,\n search,\n params,\n to,\n state,\n mask,\n preload: userPreload,\n preloadDelay: userPreloadDelay,\n replace,\n startTransition,\n resetScroll,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ...rest\n } = options\n\n // If this link simply reloads the current route,\n // make sure it has a new key so it will trigger a data refresh\n\n // If this `to` is a valid external URL, return\n // null for LinkUtils\n\n const dest = {\n from: options.to ? matchPathname : undefined,\n ...options,\n }\n\n let type: 'internal' | 'external' = 'internal'\n\n try {\n new URL(`${to}`)\n type = 'external'\n } catch {}\n\n if (type === 'external') {\n return {\n href: to,\n }\n }\n\n const next = router.buildLocation(dest as any)\n\n const preload = userPreload ?? router.options.defaultPreload\n const preloadDelay =\n userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n const isActive = useRouterState({\n select: (s) => {\n // Compare path/hash for matches\n const currentPathSplit = s.location.pathname.split('/')\n const nextPathSplit = next.pathname.split('/')\n const pathIsFuzzyEqual = nextPathSplit.every(\n (d, i) => d === currentPathSplit[i],\n )\n // Combine the matches based on user router.options\n const pathTest = activeOptions?.exact\n ? s.location.pathname === next.pathname\n : pathIsFuzzyEqual\n const hashTest = activeOptions?.includeHash\n ? s.location.hash === next.hash\n : true\n const searchTest =\n activeOptions?.includeSearch ?? true\n ? deepEqual(s.location.search, next.search, !activeOptions?.exact)\n : true\n\n // The final \"active\" test\n return pathTest && hashTest && searchTest\n },\n })\n\n // The click handler\n const handleClick = (e: MouseEvent) => {\n if (\n !disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!target || target === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n // All is well? Navigate!\n router.commitLocation({ ...next, replace, resetScroll, startTransition })\n }\n }\n\n // The click handler\n const handleFocus = (e: MouseEvent) => {\n if (preload) {\n router.preloadRoute(dest as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }\n }\n\n const handleTouchStart = (e: TouchEvent) => {\n if (preload) {\n router.preloadRoute(dest as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }\n }\n\n const handleEnter = (e: MouseEvent) => {\n const target = (e.target || {}) as LinkCurrentTargetElement\n\n if (preload) {\n if (target.preloadTimeout) {\n return\n }\n\n target.preloadTimeout = setTimeout(() => {\n target.preloadTimeout = null\n router.preloadRoute(dest as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }, preloadDelay)\n }\n }\n\n const handleLeave = (e: MouseEvent) => {\n const target = (e.target || {}) as LinkCurrentTargetElement\n\n if (target.preloadTimeout) {\n clearTimeout(target.preloadTimeout)\n target.preloadTimeout = null\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps as any, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled\n ? undefined\n : next.maskedLocation\n ? next.maskedLocation.href\n : next.href,\n onClick: composeHandlers([onClick, handleClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkComponent<TProps extends Record<string, any> = {}> {\n <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n props: LinkProps<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n TProps &\n React.RefAttributes<HTMLAnchorElement>,\n ): ReactNode\n}\n\nexport const Link: LinkComponent = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n"],"names":["preloadWarning","useLinkProps","options","router","useRouter","matchPathname","useMatch","strict","select","s","pathname","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","state","mask","preload","userPreload","preloadDelay","userPreloadDelay","replace","startTransition","resetScroll","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","rest","dest","from","undefined","type","URL","href","next","buildLocation","defaultPreload","defaultPreloadDelay","isActive","useRouterState","currentPathSplit","location","split","nextPathSplit","pathIsFuzzyEqual","every","d","i","pathTest","exact","hashTest","includeHash","searchTest","includeSearch","deepEqual","handleClick","e","isCtrlEvent","defaultPrevented","button","preventDefault","commitLocation","handleFocus","preloadRoute","catch","err","console","warn","handleTouchStart","handleEnter","preloadTimeout","setTimeout","handleLeave","clearTimeout","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","maskedLocation","join","role","Link","React","forwardRef","props","ref","linkProps","createElement","_extends","metaKey","altKey","ctrlKey","shiftKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0VA,MAAMA,cAAc,GAAG,4BAA4B,CAAA;AAE5C,SAASC,YAAYA,CAO1BC,OAAwE,EACzB;AAC/C,EAAA,MAAMC,MAAM,GAAGC,wBAAS,EAAE,CAAA;E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AEC,GAAG,KAAK;AACvE,EAAA,MAAMC,SAAS,GAAGrG,YAAY,CAACmG,KAAK,CAAC,CAAA;AAErC,EAAA,oBACEF,gBAAA,CAAAK,aAAA,CAAA,GAAA,EAAAC,iCAAA,CAAA;AAEIH,IAAAA,GAAG,EAAEA,GAAAA;AAAU,GAAA,EACZC,SAAS,EAAA;IACZ3F,QAAQ,EACN,OAAOyF,KAAK,CAACzF,QAAQ,KAAK,UAAU,GAChCyF,KAAK,CAACzF,QAAQ,CAAC;AACbqC,MAAAA,QAAQ,EAAGsD,SAAS,CAAS,aAAa,CAAC,KAAK,QAAA;KACjD,CAAC,GACFF,KAAK,CAACzF,QAAAA;AAAQ,GAAA,CAEvB,CAAC,CAAA;AAEN,CAAC,EAAQ;AAET,SAASwD,WAAWA,CAACD,CAAa,EAAE;AAClC,EAAA,OAAO,CAAC,EAAEA,CAAC,CAACuC,OAAO,IAAIvC,CAAC,CAACwC,MAAM,IAAIxC,CAAC,CAACyC,OAAO,IAAIzC,CAAC,CAAC0C,QAAQ,CAAC,CAAA;AAC7D;;;;;"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ var withSelector = require('../../../../../../use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/with-selector.js');
14
+
15
+ // src/index.ts
16
+ function useStore(store, selector = (d) => d) {
17
+ const slice = withSelector.withSelectorExports.useSyncExternalStoreWithSelector(
18
+ store.subscribe,
19
+ () => store.state,
20
+ () => store.state,
21
+ selector,
22
+ shallow
23
+ );
24
+ return slice;
25
+ }
26
+ function shallow(objA, objB) {
27
+ if (Object.is(objA, objB)) {
28
+ return true;
29
+ }
30
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
31
+ return false;
32
+ }
33
+ const keysA = Object.keys(objA);
34
+ if (keysA.length !== Object.keys(objB).length) {
35
+ return false;
36
+ }
37
+ for (let i = 0; i < keysA.length; i++) {
38
+ if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
39
+ return false;
40
+ }
41
+ }
42
+ return true;
43
+ }
44
+
45
+ exports.shallow = shallow;
46
+ exports.useStore = useStore;
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@tanstack+react-store@0.2.1_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-store/build/modern/index.js"],"sourcesContent":["// src/index.ts\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector.js\";\nexport * from \"@tanstack/store\";\nfunction useStore(store, selector = (d) => d) {\n const slice = useSyncExternalStoreWithSelector(\n store.subscribe,\n () => store.state,\n () => store.state,\n selector,\n shallow\n );\n return slice;\n}\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (let i = 0; i < keysA.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n return true;\n}\nexport {\n shallow,\n useStore\n};\n//# sourceMappingURL=index.js.map"],"names":["useSyncExternalStoreWithSelector"],"mappings":";;;;;;;;;;;;;;AAAA;AAGA,SAAS,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;AAC9C,EAAE,MAAM,KAAK,GAAGA,iEAAgC;AAChD,IAAI,KAAK,CAAC,SAAS;AACnB,IAAI,MAAM,KAAK,CAAC,KAAK;AACrB,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source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ // src/index.ts
14
+ var Store = class {
15
+ constructor(initialState, options) {
16
+ this.listeners = /* @__PURE__ */ new Set();
17
+ this._batching = false;
18
+ this._flushing = 0;
19
+ this._nextPriority = null;
20
+ this.subscribe = (listener) => {
21
+ this.listeners.add(listener);
22
+ const unsub = this.options?.onSubscribe?.(listener, this);
23
+ return () => {
24
+ this.listeners.delete(listener);
25
+ unsub?.();
26
+ };
27
+ };
28
+ this.setState = (updater, opts) => {
29
+ const previous = this.state;
30
+ this.state = this.options?.updateFn ? this.options.updateFn(previous)(updater) : updater(previous);
31
+ const priority = opts?.priority ?? this.options?.defaultPriority ?? "high";
32
+ if (this._nextPriority === null) {
33
+ this._nextPriority = priority;
34
+ } else if (this._nextPriority === "high") {
35
+ this._nextPriority = priority;
36
+ } else {
37
+ this._nextPriority = this.options?.defaultPriority ?? "high";
38
+ }
39
+ this.options?.onUpdate?.({
40
+ priority: this._nextPriority
41
+ });
42
+ this._flush();
43
+ };
44
+ this._flush = () => {
45
+ if (this._batching)
46
+ return;
47
+ const flushId = ++this._flushing;
48
+ this.listeners.forEach((listener) => {
49
+ if (this._flushing !== flushId)
50
+ return;
51
+ listener({
52
+ priority: this._nextPriority ?? "high"
53
+ });
54
+ });
55
+ };
56
+ this.batch = (cb) => {
57
+ if (this._batching)
58
+ return cb();
59
+ this._batching = true;
60
+ cb();
61
+ this._batching = false;
62
+ this._flush();
63
+ };
64
+ this.state = initialState;
65
+ this.options = options;
66
+ }
67
+ };
68
+
69
+ exports.Store = Store;
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@tanstack+store@0.1.3/node_modules/@tanstack/store/build/modern/index.js"],"sourcesContent":["// src/index.ts\nvar Store = class {\n constructor(initialState, options) {\n this.listeners = /* @__PURE__ */ new Set();\n this._batching = false;\n this._flushing = 0;\n this._nextPriority = null;\n this.subscribe = (listener) => {\n this.listeners.add(listener);\n const unsub = this.options?.onSubscribe?.(listener, this);\n return () => {\n this.listeners.delete(listener);\n unsub?.();\n };\n };\n this.setState = (updater, opts) => {\n const previous = this.state;\n this.state = this.options?.updateFn ? this.options.updateFn(previous)(updater) : updater(previous);\n const priority = opts?.priority ?? this.options?.defaultPriority ?? \"high\";\n if (this._nextPriority === null) {\n this._nextPriority = priority;\n } else if (this._nextPriority === \"high\") {\n this._nextPriority = priority;\n } else {\n this._nextPriority = this.options?.defaultPriority ?? \"high\";\n }\n this.options?.onUpdate?.({\n priority: this._nextPriority\n });\n this._flush();\n };\n this._flush = () => {\n if (this._batching)\n return;\n const flushId = ++this._flushing;\n this.listeners.forEach((listener) => {\n if (this._flushing !== flushId)\n return;\n listener({\n priority: this._nextPriority ?? \"high\"\n });\n });\n };\n this.batch = (cb) => {\n if (this._batching)\n return cb();\n this._batching = true;\n cb();\n this._batching = false;\n this._flush();\n };\n this.state = initialState;\n this.options = options;\n }\n};\nexport {\n Store\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACG,IAAC,KAAK,GAAG,MAAM;AAClB,EAAE,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE;AACrC,IAAI,IAAI,CAAC,SAAS,mBAAmB,IAAI,GAAG,EAAE,CAAC;AAC/C,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AAC3B,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;AACvB,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;AAC9B,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,QAAQ,KAAK;AACnC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,QAAQ,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CAAC,SAAS,CAAC;AACvC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK;AAC3C,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO;AACtC,UAAU,OAAO;AACjB,QAAQ,QAAQ,CAAC;AACjB,UAAU,QAAQ,EAAE,IAAI,CAAC,aAAa,IAAI,MAAM;AAChD,SAAS,CAAC,CAAC;AACX,OAAO,CAAC,CAAC;AACT,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK;AACzB,MAAM,IAAI,IAAI,CAAC,SAAS;AACxB,QAAQ,OAAO,EAAE,EAAE,CAAC;AACpB,MAAM,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AAC5B,MAAM,EAAE,EAAE,CAAC;AACX,MAAM,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AAC7B,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;AAC9B,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,GAAG;AACH;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * @tanstack/react-router/src/index.tsx
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ var withSelector_development = require('../../../../../../../_virtual/with-selector.development.js');
14
+ var React = require('react');
15
+ var require$$1 = require('use-sync-external-store/shim');
16
+
17
+ /**
18
+ * @license React
19
+ * use-sync-external-store-shim/with-selector.development.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+
27
+ var hasRequiredWithSelector_development;
28
+
29
+ function requireWithSelector_development () {
30
+ if (hasRequiredWithSelector_development) return withSelector_development.__exports;
31
+ hasRequiredWithSelector_development = 1;
32
+
33
+ if (process.env.NODE_ENV !== "production") {
34
+ (function() {
35
+
36
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
37
+ if (
38
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
39
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
40
+ 'function'
41
+ ) {
42
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
43
+ }
44
+ var React$1 = React;
45
+ var shim = require$$1;
46
+
47
+ /**
48
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
49
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
50
+ */
51
+ function is(x, y) {
52
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
53
+ ;
54
+ }
55
+
56
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
57
+
58
+ var useSyncExternalStore = shim.useSyncExternalStore;
59
+
60
+ // for CommonJS interop.
61
+
62
+ var useRef = React$1.useRef,
63
+ useEffect = React$1.useEffect,
64
+ useMemo = React$1.useMemo,
65
+ useDebugValue = React$1.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
66
+
67
+ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
68
+ // Use this to track the rendered snapshot.
69
+ var instRef = useRef(null);
70
+ var inst;
71
+
72
+ if (instRef.current === null) {
73
+ inst = {
74
+ hasValue: false,
75
+ value: null
76
+ };
77
+ instRef.current = inst;
78
+ } else {
79
+ inst = instRef.current;
80
+ }
81
+
82
+ var _useMemo = useMemo(function () {
83
+ // Track the memoized state using closure variables that are local to this
84
+ // memoized instance of a getSnapshot function. Intentionally not using a
85
+ // useRef hook, because that state would be shared across all concurrent
86
+ // copies of the hook/component.
87
+ var hasMemo = false;
88
+ var memoizedSnapshot;
89
+ var memoizedSelection;
90
+
91
+ var memoizedSelector = function (nextSnapshot) {
92
+ if (!hasMemo) {
93
+ // The first time the hook is called, there is no memoized result.
94
+ hasMemo = true;
95
+ memoizedSnapshot = nextSnapshot;
96
+
97
+ var _nextSelection = selector(nextSnapshot);
98
+
99
+ if (isEqual !== undefined) {
100
+ // Even if the selector has changed, the currently rendered selection
101
+ // may be equal to the new selection. We should attempt to reuse the
102
+ // current value if possible, to preserve downstream memoizations.
103
+ if (inst.hasValue) {
104
+ var currentSelection = inst.value;
105
+
106
+ if (isEqual(currentSelection, _nextSelection)) {
107
+ memoizedSelection = currentSelection;
108
+ return currentSelection;
109
+ }
110
+ }
111
+ }
112
+
113
+ memoizedSelection = _nextSelection;
114
+ return _nextSelection;
115
+ } // We may be able to reuse the previous invocation's result.
116
+
117
+
118
+ // We may be able to reuse the previous invocation's result.
119
+ var prevSnapshot = memoizedSnapshot;
120
+ var prevSelection = memoizedSelection;
121
+
122
+ if (objectIs(prevSnapshot, nextSnapshot)) {
123
+ // The snapshot is the same as last time. Reuse the previous selection.
124
+ return prevSelection;
125
+ } // The snapshot has changed, so we need to compute a new selection.
126
+
127
+
128
+ // The snapshot has changed, so we need to compute a new selection.
129
+ var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
130
+ // has changed. If it hasn't, return the previous selection. That signals
131
+ // to React that the selections are conceptually equal, and we can bail
132
+ // out of rendering.
133
+
134
+ // If a custom isEqual function is provided, use that to check if the data
135
+ // has changed. If it hasn't, return the previous selection. That signals
136
+ // to React that the selections are conceptually equal, and we can bail
137
+ // out of rendering.
138
+ if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
139
+ return prevSelection;
140
+ }
141
+
142
+ memoizedSnapshot = nextSnapshot;
143
+ memoizedSelection = nextSelection;
144
+ return nextSelection;
145
+ }; // Assigning this to a constant so that Flow knows it can't change.
146
+
147
+
148
+ // Assigning this to a constant so that Flow knows it can't change.
149
+ var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
150
+
151
+ var getSnapshotWithSelector = function () {
152
+ return memoizedSelector(getSnapshot());
153
+ };
154
+
155
+ var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
156
+ return memoizedSelector(maybeGetServerSnapshot());
157
+ };
158
+ return [getSnapshotWithSelector, getServerSnapshotWithSelector];
159
+ }, [getSnapshot, getServerSnapshot, selector, isEqual]),
160
+ getSelection = _useMemo[0],
161
+ getServerSelection = _useMemo[1];
162
+
163
+ var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
164
+ useEffect(function () {
165
+ inst.hasValue = true;
166
+ inst.value = value;
167
+ }, [value]);
168
+ useDebugValue(value);
169
+ return value;
170
+ }
171
+
172
+ withSelector_development.__exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
173
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
174
+ if (
175
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
176
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
177
+ 'function'
178
+ ) {
179
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
180
+ }
181
+
182
+ })();
183
+ }
184
+ return withSelector_development.__exports;
185
+ }
186
+
187
+ exports.__require = requireWithSelector_development;
188
+ //# sourceMappingURL=with-selector.development.js.map