one 1.2.57 → 1.2.59

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 (612) hide show
  1. package/dist/cjs/cli/build.cjs +3 -1
  2. package/dist/cjs/cli/build.js +1 -1
  3. package/dist/cjs/cli/build.js.map +1 -1
  4. package/dist/cjs/cli/build.native.js +13 -12
  5. package/dist/cjs/cli/build.native.js.map +1 -1
  6. package/dist/cjs/cli/buildPage.cjs +1 -1
  7. package/dist/cjs/cli/buildPage.js +1 -1
  8. package/dist/cjs/cli/buildPage.native.js +2 -2
  9. package/dist/cjs/cli/buildPage.native.js.map +1 -1
  10. package/dist/cjs/cli/dev.cjs +4 -4
  11. package/dist/cjs/cli/dev.js +4 -4
  12. package/dist/cjs/cli/dev.js.map +1 -1
  13. package/dist/cjs/cli/dev.native.js +4 -4
  14. package/dist/cjs/cli/dev.native.js.map +1 -1
  15. package/dist/cjs/cli/generateRoutes.cjs +1 -1
  16. package/dist/cjs/cli/generateRoutes.js +1 -1
  17. package/dist/cjs/cli/generateRoutes.native.js +1 -1
  18. package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
  19. package/dist/cjs/cli/generateSitemap.native.js +7 -7
  20. package/dist/cjs/cli/generateSitemap.native.js.map +1 -1
  21. package/dist/cjs/config.native.js +2 -2
  22. package/dist/cjs/config.native.js.map +1 -1
  23. package/dist/cjs/constants.native.js +1 -1
  24. package/dist/cjs/constants.native.js.map +1 -1
  25. package/dist/cjs/createApp.cjs +2 -1
  26. package/dist/cjs/createApp.js +2 -2
  27. package/dist/cjs/createApp.js.map +1 -1
  28. package/dist/cjs/createHandleRequest.test.js +3 -1
  29. package/dist/cjs/createHandleRequest.test.js.map +1 -1
  30. package/dist/cjs/createHandleRequest.test.native.js.map +1 -1
  31. package/dist/cjs/devtools/registry.cjs +30 -0
  32. package/dist/cjs/devtools/registry.js +25 -0
  33. package/dist/cjs/devtools/registry.js.map +6 -0
  34. package/dist/cjs/devtools/registry.native.js +33 -0
  35. package/dist/cjs/devtools/registry.native.js.map +1 -0
  36. package/dist/cjs/fork/NavigationContainer.native.js +5 -5
  37. package/dist/cjs/fork/NavigationContainer.native.js.map +1 -1
  38. package/dist/cjs/fork/createMemoryHistory.cjs +20 -9
  39. package/dist/cjs/fork/createMemoryHistory.js +22 -4
  40. package/dist/cjs/fork/createMemoryHistory.js.map +1 -1
  41. package/dist/cjs/fork/createMemoryHistory.native.js +22 -11
  42. package/dist/cjs/fork/createMemoryHistory.native.js.map +1 -1
  43. package/dist/cjs/fork/extractPathFromURL.native.js +8 -8
  44. package/dist/cjs/fork/extractPathFromURL.native.js.map +1 -1
  45. package/dist/cjs/fork/findFocusedRoute.native.js +2 -3
  46. package/dist/cjs/fork/findFocusedRoute.native.js.map +1 -1
  47. package/dist/cjs/fork/getPathFromState-mods.native.js +2 -3
  48. package/dist/cjs/fork/getPathFromState-mods.native.js.map +1 -1
  49. package/dist/cjs/fork/getStateFromPath-mods.native.js +3 -3
  50. package/dist/cjs/fork/getStateFromPath-mods.native.js.map +1 -1
  51. package/dist/cjs/fork/useLinking.cjs +11 -5
  52. package/dist/cjs/fork/useLinking.js +6 -6
  53. package/dist/cjs/fork/useLinking.js.map +1 -1
  54. package/dist/cjs/fork/useLinking.native.js.map +1 -1
  55. package/dist/cjs/head/url.native.js +2 -3
  56. package/dist/cjs/head/url.native.js.map +1 -1
  57. package/dist/cjs/hooks.js.map +1 -1
  58. package/dist/cjs/hooks.native.js.map +1 -1
  59. package/dist/cjs/index.cjs +17 -1
  60. package/dist/cjs/index.js +12 -2
  61. package/dist/cjs/index.js.map +1 -1
  62. package/dist/cjs/index.native.js +17 -1
  63. package/dist/cjs/index.native.js.map +1 -1
  64. package/dist/cjs/layouts/withLayoutContext.cjs +34 -15
  65. package/dist/cjs/layouts/withLayoutContext.js +29 -13
  66. package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
  67. package/dist/cjs/layouts/withLayoutContext.native.js +42 -19
  68. package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -1
  69. package/dist/cjs/link/Link.cjs +5 -2
  70. package/dist/cjs/link/Link.js +3 -2
  71. package/dist/cjs/link/Link.js.map +1 -1
  72. package/dist/cjs/link/Link.native.js +6 -1
  73. package/dist/cjs/link/Link.native.js.map +1 -1
  74. package/dist/cjs/link/href.native.js +2 -2
  75. package/dist/cjs/link/href.native.js.map +1 -1
  76. package/dist/cjs/link/useLinkTo.cjs +11 -3
  77. package/dist/cjs/link/useLinkTo.js +6 -3
  78. package/dist/cjs/link/useLinkTo.js.map +1 -1
  79. package/dist/cjs/link/useLinkTo.native.js +11 -3
  80. package/dist/cjs/link/useLinkTo.native.js.map +1 -1
  81. package/dist/cjs/router/Route.js.map +1 -1
  82. package/dist/cjs/router/Route.native.js.map +1 -1
  83. package/dist/cjs/router/findRouteNode.cjs +70 -0
  84. package/dist/cjs/router/findRouteNode.js +72 -0
  85. package/dist/cjs/router/findRouteNode.js.map +6 -0
  86. package/dist/cjs/router/findRouteNode.native.js +104 -0
  87. package/dist/cjs/router/findRouteNode.native.js.map +1 -0
  88. package/dist/cjs/router/getRoutes.native.js +3 -3
  89. package/dist/cjs/router/getRoutes.native.js.map +1 -1
  90. package/dist/cjs/router/router.cjs +160 -11
  91. package/dist/cjs/router/router.js +142 -7
  92. package/dist/cjs/router/router.js.map +2 -2
  93. package/dist/cjs/router/router.native.js +247 -67
  94. package/dist/cjs/router/router.native.js.map +1 -1
  95. package/dist/cjs/router/useNavigation.js.map +1 -1
  96. package/dist/cjs/router/useNavigation.native.js.map +1 -1
  97. package/dist/cjs/router/useScreens.cjs +1 -1
  98. package/dist/cjs/router/useScreens.js +1 -1
  99. package/dist/cjs/router/useScreens.js.map +1 -1
  100. package/dist/cjs/router/useScreens.native.js +6 -3
  101. package/dist/cjs/router/useScreens.native.js.map +1 -1
  102. package/dist/cjs/router/utils/getNavigateAction.native.js +2 -4
  103. package/dist/cjs/router/utils/getNavigateAction.native.js.map +1 -1
  104. package/dist/cjs/server/oneServe.js.map +1 -1
  105. package/dist/cjs/server/oneServe.native.js +4 -4
  106. package/dist/cjs/server/oneServe.native.js.map +1 -1
  107. package/dist/cjs/server/setupBuildOptions.native.js +1 -1
  108. package/dist/cjs/server/setupBuildOptions.native.js.map +1 -1
  109. package/dist/cjs/ui/common.native.js +6 -5
  110. package/dist/cjs/ui/common.native.js.map +1 -1
  111. package/dist/cjs/useBlocker.cjs +158 -0
  112. package/dist/cjs/useBlocker.js +145 -0
  113. package/dist/cjs/useBlocker.js.map +6 -0
  114. package/dist/cjs/useBlocker.native.js +89 -0
  115. package/dist/cjs/useBlocker.native.js.map +1 -0
  116. package/dist/cjs/useFocusEffect.cjs +2 -2
  117. package/dist/cjs/useFocusEffect.js +2 -2
  118. package/dist/cjs/useFocusEffect.js.map +1 -1
  119. package/dist/cjs/useFocusEffect.native.js +2 -2
  120. package/dist/cjs/useFocusEffect.native.js.map +1 -1
  121. package/dist/cjs/useLoader.cjs +69 -3
  122. package/dist/cjs/useLoader.js +57 -4
  123. package/dist/cjs/useLoader.js.map +2 -2
  124. package/dist/cjs/useLoader.native.js +90 -6
  125. package/dist/cjs/useLoader.native.js.map +1 -1
  126. package/dist/cjs/useScrollGroup.cjs +37 -0
  127. package/dist/cjs/useScrollGroup.js +30 -0
  128. package/dist/cjs/useScrollGroup.js.map +6 -0
  129. package/dist/cjs/useScrollGroup.native.js +29 -0
  130. package/dist/cjs/useScrollGroup.native.js.map +1 -0
  131. package/dist/cjs/validateParams.cjs +80 -0
  132. package/dist/cjs/validateParams.js +84 -0
  133. package/dist/cjs/validateParams.js.map +6 -0
  134. package/dist/cjs/validateParams.native.js +180 -0
  135. package/dist/cjs/validateParams.native.js.map +1 -0
  136. package/dist/cjs/validateSearch.cjs +104 -0
  137. package/dist/cjs/validateSearch.js +99 -0
  138. package/dist/cjs/validateSearch.js.map +6 -0
  139. package/dist/cjs/validateSearch.native.js +202 -0
  140. package/dist/cjs/validateSearch.native.js.map +1 -0
  141. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js +2 -2
  142. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
  143. package/dist/cjs/views/ErrorBoundary.cjs +293 -10
  144. package/dist/cjs/views/ErrorBoundary.js +328 -8
  145. package/dist/cjs/views/ErrorBoundary.js.map +2 -2
  146. package/dist/cjs/views/ErrorBoundary.native.js +159 -4
  147. package/dist/cjs/views/ErrorBoundary.native.js.map +1 -1
  148. package/dist/cjs/views/Navigator.cjs +10 -3
  149. package/dist/cjs/views/Navigator.js +11 -3
  150. package/dist/cjs/views/Navigator.js.map +1 -1
  151. package/dist/cjs/views/Navigator.native.js +15 -6
  152. package/dist/cjs/views/Navigator.native.js.map +1 -1
  153. package/dist/cjs/views/Protected.cjs +36 -0
  154. package/dist/cjs/views/Protected.js +27 -0
  155. package/dist/cjs/views/Protected.js.map +6 -0
  156. package/dist/cjs/views/Protected.native.js +44 -0
  157. package/dist/cjs/views/Protected.native.js.map +1 -0
  158. package/dist/cjs/views/RootErrorBoundary.cjs +193 -8
  159. package/dist/cjs/views/RootErrorBoundary.js +213 -8
  160. package/dist/cjs/views/RootErrorBoundary.js.map +1 -1
  161. package/dist/cjs/views/RootErrorBoundary.native.js +192 -8
  162. package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
  163. package/dist/cjs/views/ScrollBehavior.cjs +49 -11
  164. package/dist/cjs/views/ScrollBehavior.js +47 -11
  165. package/dist/cjs/views/ScrollBehavior.js.map +1 -1
  166. package/dist/cjs/views/ScrollBehavior.native.js +68 -10
  167. package/dist/cjs/views/ScrollBehavior.native.js.map +1 -1
  168. package/dist/cjs/views/SourceInspector.cjs +28 -0
  169. package/dist/cjs/views/SourceInspector.js +23 -0
  170. package/dist/cjs/views/SourceInspector.js.map +6 -0
  171. package/dist/cjs/views/SourceInspector.native.js +32 -0
  172. package/dist/cjs/views/SourceInspector.native.js.map +1 -0
  173. package/dist/cjs/views/Try.cjs +40 -7
  174. package/dist/cjs/views/Try.js +38 -4
  175. package/dist/cjs/views/Try.js.map +1 -1
  176. package/dist/cjs/views/Try.native.js +42 -7
  177. package/dist/cjs/views/Try.native.js.map +1 -1
  178. package/dist/cjs/vite/DevHead.cjs +797 -43
  179. package/dist/cjs/vite/DevHead.js +802 -51
  180. package/dist/cjs/vite/DevHead.js.map +1 -1
  181. package/dist/cjs/vite/DevHead.native.js +783 -1
  182. package/dist/cjs/vite/DevHead.native.js.map +1 -1
  183. package/dist/cjs/vite/one.cjs +7 -1
  184. package/dist/cjs/vite/one.js +7 -2
  185. package/dist/cjs/vite/one.js.map +1 -1
  186. package/dist/cjs/vite/one.native.js +17 -7
  187. package/dist/cjs/vite/one.native.js.map +1 -1
  188. package/dist/cjs/vite/plugins/SSRCSSPlugin.cjs +44 -4
  189. package/dist/cjs/vite/plugins/SSRCSSPlugin.js +48 -4
  190. package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
  191. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js +62 -5
  192. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  193. package/dist/cjs/vite/plugins/clientTreeShakePlugin.cjs +34 -15
  194. package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +24 -3
  195. package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
  196. package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js +55 -19
  197. package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
  198. package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.cjs +129 -0
  199. package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.js +129 -0
  200. package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.js.map +6 -0
  201. package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.native.js +140 -0
  202. package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.native.js.map +1 -0
  203. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +6 -3
  204. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  205. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +3 -3
  206. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  207. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +5 -1
  208. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
  209. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  210. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
  211. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  212. package/dist/cjs/vite/plugins/sourceInspectorPlugin.cjs +155 -0
  213. package/dist/cjs/vite/plugins/sourceInspectorPlugin.js +148 -0
  214. package/dist/cjs/vite/plugins/sourceInspectorPlugin.js.map +6 -0
  215. package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js +231 -0
  216. package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
  217. package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +25 -6
  218. package/dist/cjs/vite/plugins/virtualEntryPlugin.js +16 -6
  219. package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
  220. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +26 -7
  221. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  222. package/dist/esm/cli/build.js +1 -1
  223. package/dist/esm/cli/build.js.map +1 -1
  224. package/dist/esm/cli/build.mjs +3 -1
  225. package/dist/esm/cli/build.mjs.map +1 -1
  226. package/dist/esm/cli/build.native.js +13 -12
  227. package/dist/esm/cli/build.native.js.map +1 -1
  228. package/dist/esm/cli/buildPage.js +1 -1
  229. package/dist/esm/cli/buildPage.mjs +1 -1
  230. package/dist/esm/cli/buildPage.mjs.map +1 -1
  231. package/dist/esm/cli/buildPage.native.js +2 -2
  232. package/dist/esm/cli/buildPage.native.js.map +1 -1
  233. package/dist/esm/cli/dev.js +4 -4
  234. package/dist/esm/cli/dev.js.map +1 -1
  235. package/dist/esm/cli/dev.mjs +4 -4
  236. package/dist/esm/cli/dev.mjs.map +1 -1
  237. package/dist/esm/cli/dev.native.js +4 -4
  238. package/dist/esm/cli/dev.native.js.map +1 -1
  239. package/dist/esm/cli/generateRoutes.js +1 -1
  240. package/dist/esm/cli/generateRoutes.mjs +1 -1
  241. package/dist/esm/cli/generateRoutes.mjs.map +1 -1
  242. package/dist/esm/cli/generateRoutes.native.js +1 -1
  243. package/dist/esm/cli/generateRoutes.native.js.map +1 -1
  244. package/dist/esm/cli/generateSitemap.native.js +7 -7
  245. package/dist/esm/cli/generateSitemap.native.js.map +1 -1
  246. package/dist/esm/config.native.js +2 -2
  247. package/dist/esm/config.native.js.map +1 -1
  248. package/dist/esm/constants.native.js +2 -2
  249. package/dist/esm/constants.native.js.map +1 -1
  250. package/dist/esm/createApp.js +2 -2
  251. package/dist/esm/createApp.js.map +1 -1
  252. package/dist/esm/createApp.mjs +2 -1
  253. package/dist/esm/createApp.mjs.map +1 -1
  254. package/dist/esm/createHandleRequest.test.js +3 -1
  255. package/dist/esm/createHandleRequest.test.js.map +1 -1
  256. package/dist/esm/createHandleRequest.test.mjs.map +1 -1
  257. package/dist/esm/createHandleRequest.test.native.js.map +1 -1
  258. package/dist/esm/devtools/registry.js +9 -0
  259. package/dist/esm/devtools/registry.js.map +6 -0
  260. package/dist/esm/devtools/registry.mjs +6 -0
  261. package/dist/esm/devtools/registry.mjs.map +1 -0
  262. package/dist/esm/devtools/registry.native.js +6 -0
  263. package/dist/esm/devtools/registry.native.js.map +1 -0
  264. package/dist/esm/fork/NavigationContainer.native.js +5 -5
  265. package/dist/esm/fork/NavigationContainer.native.js.map +1 -1
  266. package/dist/esm/fork/createMemoryHistory.js +22 -4
  267. package/dist/esm/fork/createMemoryHistory.js.map +1 -1
  268. package/dist/esm/fork/createMemoryHistory.mjs +20 -9
  269. package/dist/esm/fork/createMemoryHistory.mjs.map +1 -1
  270. package/dist/esm/fork/createMemoryHistory.native.js +22 -11
  271. package/dist/esm/fork/createMemoryHistory.native.js.map +1 -1
  272. package/dist/esm/fork/extractPathFromURL.native.js +8 -8
  273. package/dist/esm/fork/extractPathFromURL.native.js.map +1 -1
  274. package/dist/esm/fork/findFocusedRoute.native.js +2 -3
  275. package/dist/esm/fork/findFocusedRoute.native.js.map +1 -1
  276. package/dist/esm/fork/getPathFromState-mods.native.js +2 -3
  277. package/dist/esm/fork/getPathFromState-mods.native.js.map +1 -1
  278. package/dist/esm/fork/getStateFromPath-mods.native.js +3 -3
  279. package/dist/esm/fork/getStateFromPath-mods.native.js.map +1 -1
  280. package/dist/esm/fork/useLinking.js +6 -5
  281. package/dist/esm/fork/useLinking.js.map +1 -1
  282. package/dist/esm/fork/useLinking.mjs +11 -5
  283. package/dist/esm/fork/useLinking.mjs.map +1 -1
  284. package/dist/esm/fork/useLinking.native.js.map +1 -1
  285. package/dist/esm/head/url.native.js +2 -3
  286. package/dist/esm/head/url.native.js.map +1 -1
  287. package/dist/esm/hooks.js.map +1 -1
  288. package/dist/esm/hooks.mjs.map +1 -1
  289. package/dist/esm/hooks.native.js.map +1 -1
  290. package/dist/esm/index.js +30 -2
  291. package/dist/esm/index.js.map +1 -1
  292. package/dist/esm/index.mjs +8 -2
  293. package/dist/esm/index.mjs.map +1 -1
  294. package/dist/esm/index.native.js +8 -2
  295. package/dist/esm/index.native.js.map +1 -1
  296. package/dist/esm/layouts/withLayoutContext.js +30 -12
  297. package/dist/esm/layouts/withLayoutContext.js.map +1 -1
  298. package/dist/esm/layouts/withLayoutContext.mjs +34 -15
  299. package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
  300. package/dist/esm/layouts/withLayoutContext.native.js +42 -19
  301. package/dist/esm/layouts/withLayoutContext.native.js.map +1 -1
  302. package/dist/esm/link/Link.js +3 -2
  303. package/dist/esm/link/Link.js.map +1 -1
  304. package/dist/esm/link/Link.mjs +5 -2
  305. package/dist/esm/link/Link.mjs.map +1 -1
  306. package/dist/esm/link/Link.native.js +6 -1
  307. package/dist/esm/link/Link.native.js.map +1 -1
  308. package/dist/esm/link/href.native.js +2 -2
  309. package/dist/esm/link/href.native.js.map +1 -1
  310. package/dist/esm/link/useLinkTo.js +6 -3
  311. package/dist/esm/link/useLinkTo.js.map +1 -1
  312. package/dist/esm/link/useLinkTo.mjs +11 -3
  313. package/dist/esm/link/useLinkTo.mjs.map +1 -1
  314. package/dist/esm/link/useLinkTo.native.js +11 -3
  315. package/dist/esm/link/useLinkTo.native.js.map +1 -1
  316. package/dist/esm/router/Route.js.map +1 -1
  317. package/dist/esm/router/Route.mjs.map +1 -1
  318. package/dist/esm/router/Route.native.js.map +1 -1
  319. package/dist/esm/router/findRouteNode.js +56 -0
  320. package/dist/esm/router/findRouteNode.js.map +6 -0
  321. package/dist/esm/router/findRouteNode.mjs +44 -0
  322. package/dist/esm/router/findRouteNode.mjs.map +1 -0
  323. package/dist/esm/router/findRouteNode.native.js +75 -0
  324. package/dist/esm/router/findRouteNode.native.js.map +1 -0
  325. package/dist/esm/router/getRoutes.native.js +3 -3
  326. package/dist/esm/router/getRoutes.native.js.map +1 -1
  327. package/dist/esm/router/router.js +154 -6
  328. package/dist/esm/router/router.js.map +1 -1
  329. package/dist/esm/router/router.mjs +151 -10
  330. package/dist/esm/router/router.mjs.map +1 -1
  331. package/dist/esm/router/router.native.js +238 -66
  332. package/dist/esm/router/router.native.js.map +1 -1
  333. package/dist/esm/router/useNavigation.js.map +1 -1
  334. package/dist/esm/router/useNavigation.mjs.map +1 -1
  335. package/dist/esm/router/useNavigation.native.js.map +1 -1
  336. package/dist/esm/router/useScreens.js +1 -1
  337. package/dist/esm/router/useScreens.js.map +1 -1
  338. package/dist/esm/router/useScreens.mjs +1 -1
  339. package/dist/esm/router/useScreens.mjs.map +1 -1
  340. package/dist/esm/router/useScreens.native.js +6 -3
  341. package/dist/esm/router/useScreens.native.js.map +1 -1
  342. package/dist/esm/router/utils/getNavigateAction.native.js +2 -4
  343. package/dist/esm/router/utils/getNavigateAction.native.js.map +1 -1
  344. package/dist/esm/server/oneServe.js.map +1 -1
  345. package/dist/esm/server/oneServe.mjs.map +1 -1
  346. package/dist/esm/server/oneServe.native.js +4 -4
  347. package/dist/esm/server/oneServe.native.js.map +1 -1
  348. package/dist/esm/server/setupBuildOptions.native.js +1 -1
  349. package/dist/esm/server/setupBuildOptions.native.js.map +1 -1
  350. package/dist/esm/ui/common.native.js +6 -5
  351. package/dist/esm/ui/common.native.js.map +1 -1
  352. package/dist/esm/useBlocker.js +122 -0
  353. package/dist/esm/useBlocker.js.map +6 -0
  354. package/dist/esm/useBlocker.mjs +123 -0
  355. package/dist/esm/useBlocker.mjs.map +1 -0
  356. package/dist/esm/useBlocker.native.js +51 -0
  357. package/dist/esm/useBlocker.native.js.map +1 -0
  358. package/dist/esm/useFocusEffect.js +2 -2
  359. package/dist/esm/useFocusEffect.js.map +1 -1
  360. package/dist/esm/useFocusEffect.mjs +2 -2
  361. package/dist/esm/useFocusEffect.mjs.map +1 -1
  362. package/dist/esm/useFocusEffect.native.js +2 -2
  363. package/dist/esm/useFocusEffect.native.js.map +1 -1
  364. package/dist/esm/useLoader.js +57 -3
  365. package/dist/esm/useLoader.js.map +2 -2
  366. package/dist/esm/useLoader.mjs +69 -4
  367. package/dist/esm/useLoader.mjs.map +1 -1
  368. package/dist/esm/useLoader.native.js +90 -7
  369. package/dist/esm/useLoader.native.js.map +1 -1
  370. package/dist/esm/useScrollGroup.js +16 -0
  371. package/dist/esm/useScrollGroup.js.map +6 -0
  372. package/dist/esm/useScrollGroup.mjs +14 -0
  373. package/dist/esm/useScrollGroup.mjs.map +1 -0
  374. package/dist/esm/useScrollGroup.native.js +3 -0
  375. package/dist/esm/useScrollGroup.native.js.map +1 -0
  376. package/dist/esm/validateParams.js +68 -0
  377. package/dist/esm/validateParams.js.map +6 -0
  378. package/dist/esm/validateParams.mjs +54 -0
  379. package/dist/esm/validateParams.mjs.map +1 -0
  380. package/dist/esm/validateParams.native.js +151 -0
  381. package/dist/esm/validateParams.native.js.map +1 -0
  382. package/dist/esm/validateSearch.js +83 -0
  383. package/dist/esm/validateSearch.js.map +6 -0
  384. package/dist/esm/validateSearch.mjs +77 -0
  385. package/dist/esm/validateSearch.mjs.map +1 -0
  386. package/dist/esm/validateSearch.native.js +172 -0
  387. package/dist/esm/validateSearch.native.js.map +1 -0
  388. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js +2 -2
  389. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
  390. package/dist/esm/views/ErrorBoundary.js +325 -7
  391. package/dist/esm/views/ErrorBoundary.js.map +2 -2
  392. package/dist/esm/views/ErrorBoundary.mjs +289 -6
  393. package/dist/esm/views/ErrorBoundary.mjs.map +1 -1
  394. package/dist/esm/views/ErrorBoundary.native.js +159 -4
  395. package/dist/esm/views/ErrorBoundary.native.js.map +1 -1
  396. package/dist/esm/views/Navigator.js +11 -2
  397. package/dist/esm/views/Navigator.js.map +1 -1
  398. package/dist/esm/views/Navigator.mjs +10 -3
  399. package/dist/esm/views/Navigator.mjs.map +1 -1
  400. package/dist/esm/views/Navigator.native.js +15 -6
  401. package/dist/esm/views/Navigator.native.js.map +1 -1
  402. package/dist/esm/views/Protected.js +14 -0
  403. package/dist/esm/views/Protected.js.map +6 -0
  404. package/dist/esm/views/Protected.mjs +11 -0
  405. package/dist/esm/views/Protected.mjs.map +1 -0
  406. package/dist/esm/views/Protected.native.js +16 -0
  407. package/dist/esm/views/Protected.native.js.map +1 -0
  408. package/dist/esm/views/RootErrorBoundary.js +214 -7
  409. package/dist/esm/views/RootErrorBoundary.js.map +1 -1
  410. package/dist/esm/views/RootErrorBoundary.mjs +192 -7
  411. package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
  412. package/dist/esm/views/RootErrorBoundary.native.js +191 -7
  413. package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
  414. package/dist/esm/views/ScrollBehavior.js +47 -11
  415. package/dist/esm/views/ScrollBehavior.js.map +1 -1
  416. package/dist/esm/views/ScrollBehavior.mjs +48 -11
  417. package/dist/esm/views/ScrollBehavior.mjs.map +1 -1
  418. package/dist/esm/views/ScrollBehavior.native.js +67 -10
  419. package/dist/esm/views/ScrollBehavior.native.js.map +1 -1
  420. package/dist/esm/views/SourceInspector.js +7 -0
  421. package/dist/esm/views/SourceInspector.js.map +6 -0
  422. package/dist/esm/views/SourceInspector.mjs +5 -0
  423. package/dist/esm/views/SourceInspector.mjs.map +1 -0
  424. package/dist/esm/views/SourceInspector.native.js +6 -0
  425. package/dist/esm/views/SourceInspector.native.js.map +1 -0
  426. package/dist/esm/views/Try.js +38 -4
  427. package/dist/esm/views/Try.js.map +1 -1
  428. package/dist/esm/views/Try.mjs +40 -7
  429. package/dist/esm/views/Try.mjs.map +1 -1
  430. package/dist/esm/views/Try.native.js +42 -7
  431. package/dist/esm/views/Try.native.js.map +1 -1
  432. package/dist/esm/vite/DevHead.js +802 -51
  433. package/dist/esm/vite/DevHead.js.map +1 -1
  434. package/dist/esm/vite/DevHead.mjs +797 -43
  435. package/dist/esm/vite/DevHead.mjs.map +1 -1
  436. package/dist/esm/vite/DevHead.native.js +782 -0
  437. package/dist/esm/vite/DevHead.native.js.map +1 -1
  438. package/dist/esm/vite/one.js +7 -1
  439. package/dist/esm/vite/one.js.map +1 -1
  440. package/dist/esm/vite/one.mjs +7 -1
  441. package/dist/esm/vite/one.mjs.map +1 -1
  442. package/dist/esm/vite/one.native.js +17 -7
  443. package/dist/esm/vite/one.native.js.map +1 -1
  444. package/dist/esm/vite/plugins/SSRCSSPlugin.js +48 -4
  445. package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
  446. package/dist/esm/vite/plugins/SSRCSSPlugin.mjs +44 -4
  447. package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
  448. package/dist/esm/vite/plugins/SSRCSSPlugin.native.js +61 -4
  449. package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  450. package/dist/esm/vite/plugins/clientTreeShakePlugin.js +24 -3
  451. package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
  452. package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs +34 -15
  453. package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
  454. package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js +55 -19
  455. package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
  456. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.js +130 -0
  457. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.js.map +6 -0
  458. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.mjs +130 -0
  459. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.mjs.map +1 -0
  460. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.native.js +138 -0
  461. package/dist/esm/vite/plugins/clientTreeShakePlugin.test.native.js.map +1 -0
  462. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +6 -3
  463. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  464. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
  465. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +3 -3
  466. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  467. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
  468. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  469. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +5 -1
  470. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
  471. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
  472. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  473. package/dist/esm/vite/plugins/sourceInspectorPlugin.js +126 -0
  474. package/dist/esm/vite/plugins/sourceInspectorPlugin.js.map +6 -0
  475. package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs +121 -0
  476. package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs.map +1 -0
  477. package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js +194 -0
  478. package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
  479. package/dist/esm/vite/plugins/virtualEntryPlugin.js +16 -6
  480. package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
  481. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +25 -6
  482. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
  483. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +26 -7
  484. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  485. package/package.json +16 -14
  486. package/src/cli/build.ts +1 -1
  487. package/src/cli/buildPage.ts +1 -1
  488. package/src/cli/dev.ts +4 -4
  489. package/src/cli/generateRoutes.ts +1 -1
  490. package/src/createApp.tsx +11 -1
  491. package/src/createHandleRequest.test.ts +3 -1
  492. package/src/devtools/registry.ts +21 -0
  493. package/src/fork/createMemoryHistory.tsx +43 -11
  494. package/src/fork/useLinking.ts +14 -4
  495. package/src/hooks.tsx +71 -21
  496. package/src/index.ts +34 -1
  497. package/src/interfaces/router.ts +48 -0
  498. package/src/layouts/withLayoutContext.tsx +48 -8
  499. package/src/link/Link.tsx +7 -2
  500. package/src/link/useLinkTo.tsx +7 -3
  501. package/src/router/Route.tsx +32 -3
  502. package/src/router/findRouteNode.ts +127 -0
  503. package/src/router/router.ts +291 -2
  504. package/src/router/useNavigation.ts +12 -3
  505. package/src/router/useScreens.tsx +9 -3
  506. package/src/useBlocker.native.ts +153 -0
  507. package/src/useBlocker.ts +340 -0
  508. package/src/useFocusEffect.ts +18 -5
  509. package/src/useLoader.ts +193 -2
  510. package/src/useScrollGroup.native.ts +7 -0
  511. package/src/useScrollGroup.ts +35 -0
  512. package/src/validateParams.ts +196 -0
  513. package/src/validateSearch.ts +241 -0
  514. package/src/views/ErrorBoundary.tsx +154 -156
  515. package/src/views/ErrorBoundary.web.tsx +321 -0
  516. package/src/views/Navigator.tsx +18 -2
  517. package/src/views/Protected.tsx +62 -0
  518. package/src/views/RootErrorBoundary.tsx +214 -17
  519. package/src/views/ScrollBehavior.tsx +82 -3
  520. package/src/views/SourceInspector.tsx +39 -0
  521. package/src/views/Try.tsx +81 -12
  522. package/src/vite/DevHead.tsx +819 -54
  523. package/src/vite/one.ts +13 -0
  524. package/src/vite/plugins/SSRCSSPlugin.ts +104 -0
  525. package/src/vite/plugins/clientTreeShakePlugin.test.ts +174 -0
  526. package/src/vite/plugins/clientTreeShakePlugin.ts +50 -4
  527. package/src/vite/plugins/fileSystemRouterPlugin.tsx +11 -8
  528. package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +4 -0
  529. package/src/vite/plugins/sourceInspectorPlugin.ts +246 -0
  530. package/src/vite/plugins/virtualEntryPlugin.ts +36 -10
  531. package/src/vite/types.ts +28 -0
  532. package/types/createApp.d.ts +5 -0
  533. package/types/createApp.d.ts.map +1 -1
  534. package/types/devtools/registry.d.ts +15 -0
  535. package/types/devtools/registry.d.ts.map +1 -0
  536. package/types/fork/createMemoryHistory.d.ts +8 -3
  537. package/types/fork/createMemoryHistory.d.ts.map +1 -1
  538. package/types/fork/useLinking.d.ts.map +1 -1
  539. package/types/hooks.d.ts +71 -20
  540. package/types/hooks.d.ts.map +1 -1
  541. package/types/index.d.ts +8 -1
  542. package/types/index.d.ts.map +1 -1
  543. package/types/interfaces/router.d.ts +47 -0
  544. package/types/interfaces/router.d.ts.map +1 -1
  545. package/types/layouts/Drawer.d.ts +15 -11
  546. package/types/layouts/Drawer.d.ts.map +1 -1
  547. package/types/layouts/withLayoutContext.d.ts +2 -1
  548. package/types/layouts/withLayoutContext.d.ts.map +1 -1
  549. package/types/link/Link.d.ts.map +1 -1
  550. package/types/link/useLinkTo.d.ts +1 -0
  551. package/types/link/useLinkTo.d.ts.map +1 -1
  552. package/types/router/Route.d.ts +32 -3
  553. package/types/router/Route.d.ts.map +1 -1
  554. package/types/router/findRouteNode.d.ts +31 -0
  555. package/types/router/findRouteNode.d.ts.map +1 -0
  556. package/types/router/router.d.ts +35 -0
  557. package/types/router/router.d.ts.map +1 -1
  558. package/types/router/useNavigation.d.ts +12 -3
  559. package/types/router/useNavigation.d.ts.map +1 -1
  560. package/types/router/useScreens.d.ts +2 -0
  561. package/types/router/useScreens.d.ts.map +1 -1
  562. package/types/server/oneServe.d.ts.map +1 -1
  563. package/types/ui/TabContext.d.ts +1 -1
  564. package/types/ui/TabContext.d.ts.map +1 -1
  565. package/types/ui/Tabs.d.ts +2 -2
  566. package/types/ui/Tabs.d.ts.map +1 -1
  567. package/types/useBlocker.d.ts +72 -0
  568. package/types/useBlocker.d.ts.map +1 -0
  569. package/types/useBlocker.native.d.ts +60 -0
  570. package/types/useBlocker.native.d.ts.map +1 -0
  571. package/types/useFocusEffect.d.ts +17 -4
  572. package/types/useFocusEffect.d.ts.map +1 -1
  573. package/types/useLoader.d.ts +63 -0
  574. package/types/useLoader.d.ts.map +1 -1
  575. package/types/useScrollGroup.d.ts +18 -0
  576. package/types/useScrollGroup.d.ts.map +1 -0
  577. package/types/useScrollGroup.native.d.ts +6 -0
  578. package/types/useScrollGroup.native.d.ts.map +1 -0
  579. package/types/validateParams.d.ts +85 -0
  580. package/types/validateParams.d.ts.map +1 -0
  581. package/types/validateSearch.d.ts +107 -0
  582. package/types/validateSearch.d.ts.map +1 -0
  583. package/types/views/ErrorBoundary.d.ts +11 -1
  584. package/types/views/ErrorBoundary.d.ts.map +1 -1
  585. package/types/views/ErrorBoundary.web.d.ts +13 -0
  586. package/types/views/ErrorBoundary.web.d.ts.map +1 -0
  587. package/types/views/Navigator.d.ts.map +1 -1
  588. package/types/views/Protected.d.ts +39 -0
  589. package/types/views/Protected.d.ts.map +1 -0
  590. package/types/views/RootErrorBoundary.d.ts +14 -8
  591. package/types/views/RootErrorBoundary.d.ts.map +1 -1
  592. package/types/views/ScrollBehavior.d.ts +8 -0
  593. package/types/views/ScrollBehavior.d.ts.map +1 -1
  594. package/types/views/SourceInspector.d.ts +35 -0
  595. package/types/views/SourceInspector.d.ts.map +1 -0
  596. package/types/views/Try.d.ts +29 -6
  597. package/types/views/Try.d.ts.map +1 -1
  598. package/types/vite/DevHead.d.ts.map +1 -1
  599. package/types/vite/one.d.ts.map +1 -1
  600. package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
  601. package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
  602. package/types/vite/plugins/clientTreeShakePlugin.test.d.ts +2 -0
  603. package/types/vite/plugins/clientTreeShakePlugin.test.d.ts.map +1 -0
  604. package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
  605. package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
  606. package/types/vite/plugins/sourceInspectorPlugin.d.ts +3 -0
  607. package/types/vite/plugins/sourceInspectorPlugin.d.ts.map +1 -0
  608. package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
  609. package/types/vite/types.d.ts +24 -0
  610. package/types/vite/types.d.ts.map +1 -1
  611. package/types/env.d.ts +0 -66
  612. /package/types/vercel/build/generate/{createSSRServerlessFunction.d.ts → createSsrServerlessFunction.d.ts} +0 -0
@@ -1,171 +1,169 @@
1
- // import { LogContext } from '@expo/metro-runtime/build/error-overlay/Data/LogContext'
2
- // import { LogBoxInspectorStackFrames } from '@expo/metro-runtime/build/error-overlay/overlay/LogBoxInspectorStackFrames'
3
- // import { LogBoxLog, parseErrorStack } from '@expo/metro-runtime/symbolicate'
4
1
  import { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs'
5
2
  import React from 'react'
6
- import { View } from 'react-native'
3
+ import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'
7
4
  import { SafeAreaView } from 'react-native-safe-area-context'
8
5
 
9
6
  import type { ErrorBoundaryProps } from './Try'
10
7
 
11
- // function useMetroSymbolication(error: Error) {
12
- // const [logBoxLog, setLogBoxLog] = React.useState<LogBoxLog | null>(null)
13
-
14
- // React.useEffect(() => {
15
- // let isMounted = true
16
- // const stack = parseErrorStack(error.stack)
17
-
18
- // const log = new LogBoxLog({
19
- // level: 'error',
20
- // message: {
21
- // content: error.message,
22
- // substitutions: [],
23
- // },
24
- // isComponentError: false,
25
- // stack,
26
- // category: error.message,
27
- // componentStack: [],
28
- // })
29
-
30
- // log.symbolicate('stack', (symbolicatedLog) => {
31
- // if (isMounted) {
32
- // setLogBoxLog(log)
33
- // }
34
- // })
8
+ /**
9
+ * Default error boundary component for native platforms.
10
+ * Shows a user-friendly error message with retry capability.
11
+ *
12
+ * This component is used when:
13
+ * - A route doesn't export its own ErrorBoundary
14
+ * - An error occurs during rendering
15
+ *
16
+ * Users can override this by exporting their own ErrorBoundary from a route.
17
+ */
18
+ export function ErrorBoundary({ error, retry, route }: ErrorBoundaryProps) {
19
+ const inTabBar = React.useContext(BottomTabBarHeightContext)
20
+ const Wrapper = inTabBar ? View : SafeAreaView
21
+ const isDev = process.env.NODE_ENV === 'development'
35
22
 
36
- // return () => {
37
- // isMounted = false
38
- // }
39
- // }, [error])
23
+ console.error('[One] Error in route:', route?.routeName || 'unknown', error)
40
24
 
41
- // return logBoxLog
42
- // }
25
+ return (
26
+ <Wrapper style={styles.container}>
27
+ <View style={styles.content}>
28
+ {/* Error icon */}
29
+ <View style={styles.iconContainer}>
30
+ <Text style={styles.iconText}>!</Text>
31
+ </View>
43
32
 
44
- export function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {
45
- // const logBoxLog = useMetroSymbolication(error)
46
- const inTabBar = React.useContext(BottomTabBarHeightContext)
47
- const Wrapper = inTabBar ? View : SafeAreaView
33
+ {/* Title */}
34
+ <Text style={styles.title}>Something went wrong</Text>
48
35
 
49
- console.error('error', error)
36
+ {/* Route info */}
37
+ {route?.routeName && (
38
+ <Text style={styles.routeInfo}>on route: {route.routeName}</Text>
39
+ )}
50
40
 
51
- return null
41
+ {/* Error message */}
42
+ <View style={styles.errorBox}>
43
+ <Text style={styles.errorMessage}>
44
+ {error?.message || 'An unexpected error occurred'}
45
+ </Text>
46
+ </View>
52
47
 
53
- // return (
54
- // <View style={styles.container}>
55
- // <Wrapper style={{ flex: 1, gap: 8, maxWidth: 720, marginHorizontal: 'auto' }}>
56
- // <View
57
- // style={{
58
- // marginBottom: 12,
59
- // flexDirection: 'row',
60
- // flexWrap: 'wrap',
61
- // justifyContent: 'space-between',
62
- // alignItems: 'center',
63
- // }}
64
- // >
65
- // <Text role="heading" aria-level={1} style={styles.title}>
66
- // Something went wrong
67
- // </Text>
68
- // </View>
48
+ {/* Stack trace (dev only) */}
49
+ {isDev && error?.stack && (
50
+ <ScrollView style={styles.stackContainer}>
51
+ <Text style={styles.stackTitle}>Stack trace:</Text>
52
+ <Text style={styles.stackText}>{error.stack}</Text>
53
+ </ScrollView>
54
+ )}
69
55
 
70
- // <StackTrace logData={logBoxLog} />
71
- // {process.env.NODE_ENV === 'development' && (
72
- // <Link href="/_sitemap" style={styles.link}>
73
- // Sitemap
74
- // </Link>
75
- // )}
76
- // <Pressable onPress={retry}>
77
- // {({ hovered, pressed }) => (
78
- // <View
79
- // style={[
80
- // styles.buttonInner,
81
- // (hovered || pressed) && { backgroundColor: 'white' },
82
- // ]}
83
- // >
84
- // <Text
85
- // style={[
86
- // styles.buttonText,
87
- // {
88
- // transitionDuration: '100ms',
89
- // color: hovered || pressed ? 'black' : 'white',
90
- // },
91
- // ]}
92
- // >
93
- // Retry
94
- // </Text>
95
- // </View>
96
- // )}
97
- // </Pressable>
98
- // </Wrapper>
99
- // </View>
100
- // )
56
+ {/* Actions */}
57
+ <View style={styles.actions}>
58
+ <Pressable
59
+ onPress={() => retry()}
60
+ style={({ pressed }) => [
61
+ styles.button,
62
+ styles.primaryButton,
63
+ pressed && styles.buttonPressed,
64
+ ]}
65
+ >
66
+ <Text style={styles.primaryButtonText}>Try Again</Text>
67
+ </Pressable>
68
+ </View>
69
+ </View>
70
+ </Wrapper>
71
+ )
101
72
  }
102
73
 
103
- // function StackTrace({ logData }: { logData: LogBoxLog | null }) {
104
- // if (!logData?.symbolicated?.stack?.stack) {
105
- // return null
106
- // }
107
- // return (
108
- // <ScrollView style={{ flex: 1 }}>
109
- // <LogContext.Provider
110
- // value={{
111
- // isDisabled: false,
112
- // logs: [logData],
113
- // selectedLogIndex: 0,
114
- // }}
115
- // >
116
- // <LogBoxInspectorStackFrames onRetry={function () {}} type="stack" />
117
- // </LogContext.Provider>
118
- // </ScrollView>
119
- // )
120
- // }
121
-
122
- // const styles = StyleSheet.create({
123
- // container: {
124
- // flex: 1,
125
- // backgroundColor: 'black',
126
- // padding: 24,
127
- // alignItems: 'stretch',
128
- // justifyContent: 'center',
129
- // },
130
- // title: {
131
- // color: 'white',
132
- // fontSize: Platform.select({ web: 32, default: 24 }),
133
- // fontWeight: 'bold',
134
- // },
135
- // buttonText: {
136
- // fontSize: 18,
137
- // fontWeight: 'bold',
138
- // color: 'black',
139
- // },
140
- // buttonInner: {
141
- // transitionDuration: '100ms',
142
- // paddingVertical: 12,
143
- // paddingHorizontal: 24,
144
- // borderColor: 'white',
145
- // borderWidth: 2,
146
- // marginLeft: 8,
147
- // justifyContent: 'center',
148
- // alignItems: 'center',
149
- // },
150
- // code: {
151
- // fontFamily: Platform.select({
152
- // default: 'Courier',
153
- // ios: 'Courier New',
154
- // android: 'monospace',
155
- // }),
156
- // fontWeight: '500',
157
- // },
158
- // subtitle: {
159
- // color: 'white',
160
- // fontSize: 14,
161
- // marginBottom: 12,
162
- // // textAlign: "center",
163
- // },
164
- // link: {
165
- // color: 'rgba(255,255,255,0.4)',
166
- // textDecorationStyle: 'solid',
167
- // textDecorationLine: 'underline',
168
- // fontSize: 14,
169
- // textAlign: 'center',
170
- // },
171
- // })
74
+ const styles = StyleSheet.create({
75
+ container: {
76
+ flex: 1,
77
+ backgroundColor: '#0a0a0f',
78
+ },
79
+ content: {
80
+ flex: 1,
81
+ alignItems: 'center',
82
+ justifyContent: 'center',
83
+ padding: 24,
84
+ },
85
+ iconContainer: {
86
+ width: 64,
87
+ height: 64,
88
+ backgroundColor: '#ef4444',
89
+ borderRadius: 32,
90
+ alignItems: 'center',
91
+ justifyContent: 'center',
92
+ marginBottom: 24,
93
+ },
94
+ iconText: {
95
+ color: 'white',
96
+ fontSize: 32,
97
+ fontWeight: 'bold',
98
+ },
99
+ title: {
100
+ fontSize: 22,
101
+ fontWeight: '600',
102
+ color: '#e8e8e8',
103
+ marginBottom: 8,
104
+ textAlign: 'center',
105
+ },
106
+ routeInfo: {
107
+ fontSize: 13,
108
+ color: '#666',
109
+ marginBottom: 16,
110
+ },
111
+ errorBox: {
112
+ backgroundColor: '#1a1a2e',
113
+ borderRadius: 8,
114
+ padding: 16,
115
+ marginBottom: 16,
116
+ width: '100%',
117
+ maxWidth: 400,
118
+ },
119
+ errorMessage: {
120
+ fontFamily: 'monospace',
121
+ fontSize: 14,
122
+ lineHeight: 20,
123
+ color: '#f87171',
124
+ textAlign: 'center',
125
+ },
126
+ stackContainer: {
127
+ maxHeight: 150,
128
+ width: '100%',
129
+ maxWidth: 400,
130
+ backgroundColor: '#16162a',
131
+ borderRadius: 8,
132
+ padding: 12,
133
+ marginBottom: 16,
134
+ },
135
+ stackTitle: {
136
+ fontSize: 11,
137
+ color: '#666',
138
+ marginBottom: 8,
139
+ },
140
+ stackText: {
141
+ fontFamily: 'monospace',
142
+ fontSize: 10,
143
+ lineHeight: 16,
144
+ color: '#a0a0a0',
145
+ },
146
+ actions: {
147
+ flexDirection: 'row',
148
+ gap: 12,
149
+ marginTop: 8,
150
+ },
151
+ button: {
152
+ paddingVertical: 12,
153
+ paddingHorizontal: 24,
154
+ borderRadius: 8,
155
+ minWidth: 120,
156
+ alignItems: 'center',
157
+ },
158
+ primaryButton: {
159
+ backgroundColor: '#3b82f6',
160
+ },
161
+ buttonPressed: {
162
+ opacity: 0.8,
163
+ },
164
+ primaryButtonText: {
165
+ color: 'white',
166
+ fontSize: 14,
167
+ fontWeight: '500',
168
+ },
169
+ })
@@ -0,0 +1,321 @@
1
+ import React from 'react'
2
+ import type { ErrorBoundaryProps } from './Try'
3
+
4
+ /**
5
+ * Default error boundary component for web.
6
+ * Shows a user-friendly error message with retry capability.
7
+ *
8
+ * This component is used when:
9
+ * - A route doesn't export its own ErrorBoundary
10
+ * - An error occurs during rendering
11
+ *
12
+ * Users can override this by exporting their own ErrorBoundary from a route.
13
+ */
14
+ export function ErrorBoundary({ error, retry, route }: ErrorBoundaryProps) {
15
+ const isDev = process.env.NODE_ENV === 'development'
16
+
17
+ // Dispatch error event for devtools
18
+ React.useEffect(() => {
19
+ if (typeof window !== 'undefined') {
20
+ window.dispatchEvent(
21
+ new CustomEvent('one-error', {
22
+ detail: {
23
+ error: {
24
+ message: error.message,
25
+ stack: error.stack,
26
+ name: error.name,
27
+ },
28
+ route: route || {},
29
+ timestamp: Date.now(),
30
+ type: 'render',
31
+ },
32
+ })
33
+ )
34
+ }
35
+ }, [error, route])
36
+
37
+ return (
38
+ <div
39
+ style={{
40
+ minHeight: '100vh',
41
+ display: 'flex',
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ backgroundColor: '#0a0a0f',
45
+ fontFamily:
46
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
47
+ color: '#e8e8e8',
48
+ padding: '24px',
49
+ }}
50
+ >
51
+ <div
52
+ style={{
53
+ maxWidth: '600px',
54
+ width: '100%',
55
+ backgroundColor: '#1a1a2e',
56
+ borderRadius: '12px',
57
+ boxShadow: '0 8px 32px rgba(0, 0, 0, 0.4)',
58
+ overflow: 'hidden',
59
+ }}
60
+ >
61
+ {/* Header */}
62
+ <div
63
+ style={{
64
+ padding: '16px 20px',
65
+ backgroundColor: '#ef4444',
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ gap: '12px',
69
+ }}
70
+ >
71
+ <svg
72
+ width="24"
73
+ height="24"
74
+ viewBox="0 0 24 24"
75
+ fill="none"
76
+ stroke="white"
77
+ strokeWidth="2"
78
+ >
79
+ <circle cx="12" cy="12" r="10" />
80
+ <line x1="12" y1="8" x2="12" y2="12" />
81
+ <line x1="12" y1="16" x2="12.01" y2="16" />
82
+ </svg>
83
+ <div>
84
+ <div style={{ fontWeight: 600, fontSize: '16px', color: 'white' }}>
85
+ Something went wrong
86
+ </div>
87
+ {route?.pathname && (
88
+ <div
89
+ style={{
90
+ fontSize: '13px',
91
+ color: 'rgba(255,255,255,0.8)',
92
+ marginTop: '2px',
93
+ }}
94
+ >
95
+ on {route.pathname}
96
+ </div>
97
+ )}
98
+ </div>
99
+ </div>
100
+
101
+ {/* Content */}
102
+ <div style={{ padding: '20px' }}>
103
+ {/* Error message */}
104
+ <div
105
+ style={{
106
+ backgroundColor: '#2a2a4a',
107
+ borderRadius: '8px',
108
+ padding: '16px',
109
+ marginBottom: '16px',
110
+ }}
111
+ >
112
+ <div
113
+ style={{
114
+ fontFamily: 'monospace',
115
+ fontSize: '14px',
116
+ lineHeight: '1.5',
117
+ color: '#f87171',
118
+ wordBreak: 'break-word',
119
+ }}
120
+ >
121
+ {error.message || 'An unexpected error occurred'}
122
+ </div>
123
+ </div>
124
+
125
+ {/* Stack trace (dev only) */}
126
+ {isDev && error.stack && (
127
+ <details
128
+ style={{
129
+ marginBottom: '16px',
130
+ }}
131
+ >
132
+ <summary
133
+ style={{
134
+ cursor: 'pointer',
135
+ fontSize: '13px',
136
+ color: '#888',
137
+ marginBottom: '8px',
138
+ }}
139
+ >
140
+ Stack trace
141
+ </summary>
142
+ <div
143
+ style={{
144
+ backgroundColor: '#16162a',
145
+ borderRadius: '8px',
146
+ padding: '12px',
147
+ maxHeight: '200px',
148
+ overflow: 'auto',
149
+ }}
150
+ >
151
+ <pre
152
+ style={{
153
+ fontFamily: 'monospace',
154
+ fontSize: '11px',
155
+ lineHeight: '1.6',
156
+ color: '#a0a0a0',
157
+ margin: 0,
158
+ whiteSpace: 'pre-wrap',
159
+ wordBreak: 'break-word',
160
+ }}
161
+ >
162
+ {error.stack}
163
+ </pre>
164
+ </div>
165
+ </details>
166
+ )}
167
+
168
+ {/* Route info (dev only) */}
169
+ {isDev && route && (
170
+ <details
171
+ style={{
172
+ marginBottom: '16px',
173
+ }}
174
+ >
175
+ <summary
176
+ style={{
177
+ cursor: 'pointer',
178
+ fontSize: '13px',
179
+ color: '#888',
180
+ marginBottom: '8px',
181
+ }}
182
+ >
183
+ Route info
184
+ </summary>
185
+ <div
186
+ style={{
187
+ backgroundColor: '#16162a',
188
+ borderRadius: '8px',
189
+ padding: '12px',
190
+ display: 'grid',
191
+ gridTemplateColumns: 'auto 1fr',
192
+ gap: '8px',
193
+ fontFamily: 'monospace',
194
+ fontSize: '12px',
195
+ }}
196
+ >
197
+ {route.pathname && (
198
+ <>
199
+ <span style={{ color: '#888' }}>pathname</span>
200
+ <span style={{ color: '#e8e8e8' }}>{route.pathname}</span>
201
+ </>
202
+ )}
203
+ {route.routeName && (
204
+ <>
205
+ <span style={{ color: '#888' }}>route</span>
206
+ <span style={{ color: '#e8e8e8' }}>{route.routeName}</span>
207
+ </>
208
+ )}
209
+ {route.params && Object.keys(route.params).length > 0 && (
210
+ <>
211
+ <span style={{ color: '#888' }}>params</span>
212
+ <span style={{ color: '#e8e8e8' }}>
213
+ {JSON.stringify(route.params)}
214
+ </span>
215
+ </>
216
+ )}
217
+ </div>
218
+ </details>
219
+ )}
220
+
221
+ {/* Actions */}
222
+ <div style={{ display: 'flex', gap: '12px' }}>
223
+ <button
224
+ onClick={() => retry()}
225
+ style={{
226
+ flex: 1,
227
+ padding: '12px 20px',
228
+ backgroundColor: '#3b82f6',
229
+ color: 'white',
230
+ border: 'none',
231
+ borderRadius: '8px',
232
+ fontSize: '14px',
233
+ fontWeight: 500,
234
+ cursor: 'pointer',
235
+ transition: 'background-color 0.15s',
236
+ }}
237
+ onMouseOver={(e) => {
238
+ e.currentTarget.style.backgroundColor = '#2563eb'
239
+ }}
240
+ onMouseOut={(e) => {
241
+ e.currentTarget.style.backgroundColor = '#3b82f6'
242
+ }}
243
+ >
244
+ Try Again
245
+ </button>
246
+ <button
247
+ onClick={() => {
248
+ if (typeof window !== 'undefined') {
249
+ window.location.href = '/'
250
+ }
251
+ }}
252
+ style={{
253
+ padding: '12px 20px',
254
+ backgroundColor: 'transparent',
255
+ color: '#888',
256
+ border: '1px solid #3a3a5a',
257
+ borderRadius: '8px',
258
+ fontSize: '14px',
259
+ fontWeight: 500,
260
+ cursor: 'pointer',
261
+ transition: 'all 0.15s',
262
+ }}
263
+ onMouseOver={(e) => {
264
+ e.currentTarget.style.backgroundColor = '#2a2a4a'
265
+ e.currentTarget.style.color = '#e8e8e8'
266
+ }}
267
+ onMouseOut={(e) => {
268
+ e.currentTarget.style.backgroundColor = 'transparent'
269
+ e.currentTarget.style.color = '#888'
270
+ }}
271
+ >
272
+ Go Home
273
+ </button>
274
+ </div>
275
+ </div>
276
+
277
+ {/* Footer */}
278
+ {isDev && (
279
+ <div
280
+ style={{
281
+ padding: '12px 20px',
282
+ backgroundColor: '#16162a',
283
+ borderTop: '1px solid #2a2a4a',
284
+ fontSize: '11px',
285
+ color: '#666',
286
+ display: 'flex',
287
+ alignItems: 'center',
288
+ gap: '8px',
289
+ }}
290
+ >
291
+ <svg
292
+ width="12"
293
+ height="12"
294
+ viewBox="0 0 24 24"
295
+ fill="none"
296
+ stroke="#666"
297
+ strokeWidth="2"
298
+ >
299
+ <circle cx="12" cy="12" r="10" />
300
+ <path d="M12 16v-4" />
301
+ <path d="M12 8h.01" />
302
+ </svg>
303
+ <span>
304
+ Press{' '}
305
+ <kbd
306
+ style={{
307
+ padding: '2px 6px',
308
+ backgroundColor: '#2a2a4a',
309
+ borderRadius: '4px',
310
+ }}
311
+ >
312
+ Alt+E
313
+ </kbd>{' '}
314
+ to open Error Panel
315
+ </span>
316
+ </div>
317
+ )}
318
+ </div>
319
+ </div>
320
+ )
321
+ }
@@ -9,6 +9,7 @@ import { SafeAreaView } from 'react-native-safe-area-context'
9
9
  import { useFilterScreenChildren } from '../layouts/withLayoutContext'
10
10
  import { FlagsContext } from '../router/FlagsContext'
11
11
  import { useContextKey } from '../router/Route'
12
+ import { registerProtectedRoutes, unregisterProtectedRoutes } from '../router/router'
12
13
  import { useSortedScreens } from '../router/useScreens'
13
14
  import { Screen } from './Screen'
14
15
 
@@ -44,12 +45,27 @@ export function Navigator({
44
45
  const contextKey = useContextKey()
45
46
 
46
47
  // Allows adding Screen components as children to configure routes.
47
- const { screens, children: otherSlot } = useFilterScreenChildren(children, {
48
+ const {
49
+ screens,
50
+ children: otherSlot,
51
+ protectedScreens,
52
+ } = useFilterScreenChildren(children, {
48
53
  isCustomNavigator: true,
49
54
  contextKey,
50
55
  })
51
56
 
52
- const sorted = useSortedScreens(screens ?? [])
57
+ // Register protected routes globally so linkTo can block navigation to them
58
+ // Register immediately (not just in effect) to catch navigation attempts during first render
59
+ registerProtectedRoutes(contextKey, protectedScreens)
60
+
61
+ React.useEffect(() => {
62
+ registerProtectedRoutes(contextKey, protectedScreens)
63
+ return () => {
64
+ unregisterProtectedRoutes(contextKey)
65
+ }
66
+ }, [contextKey, protectedScreens])
67
+
68
+ const sorted = useSortedScreens(screens ?? [], { protectedScreens })
53
69
 
54
70
  if (!sorted.length) {
55
71
  console.warn(`Navigator at "${contextKey}" has no children.`)