@donotdev/ui 0.3.1 → 0.3.3

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 (325) hide show
  1. package/README.md +2 -3
  2. package/dist/components/auth/AuthHeader.js +1 -93
  3. package/dist/components/auth/AuthMenu.d.ts.map +1 -1
  4. package/dist/components/auth/AuthMenu.js +3 -286
  5. package/dist/components/auth/index.js +1 -9
  6. package/dist/components/common/FeatureCard.d.ts.map +1 -1
  7. package/dist/components/common/FeatureCard.js +1 -86
  8. package/dist/components/common/FeatureDisabled.js +1 -67
  9. package/dist/components/common/IconPlaceholder.d.ts +24 -0
  10. package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
  11. package/dist/components/common/IconPlaceholder.js +1 -0
  12. package/dist/components/common/LazyLucideIcon.d.ts +39 -0
  13. package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
  14. package/dist/components/common/LazyLucideIcon.js +1 -0
  15. package/dist/components/common/ProgressBar.js +1 -84
  16. package/dist/components/common/RedirectOverlay.js +1 -243
  17. package/dist/components/common/Skeleton.js +1 -144
  18. package/dist/components/common/TechBento.d.ts.map +1 -1
  19. package/dist/components/common/TechBento.js +1 -53
  20. package/dist/components/common/icon.d.ts +1 -1
  21. package/dist/components/common/icon.d.ts.map +1 -1
  22. package/dist/components/common/icon.js +1 -84
  23. package/dist/components/common/iconByName.d.ts +33 -0
  24. package/dist/components/common/iconByName.d.ts.map +1 -0
  25. package/dist/components/common/iconByName.js +1 -0
  26. package/dist/components/common/index.js +1 -16
  27. package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
  28. package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
  29. package/dist/components/cookie-consent/ConsentBanner.js +1 -31
  30. package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
  31. package/dist/components/cookie-consent/CookieConsent.js +1 -183
  32. package/dist/components/cookie-consent/index.js +1 -11
  33. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
  34. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
  35. package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
  36. package/dist/components/index.js +1 -13
  37. package/dist/components/layout/GameContainer.d.ts.map +1 -1
  38. package/dist/components/layout/GameContainer.js +1 -72
  39. package/dist/components/layout/GameFlow.d.ts.map +1 -1
  40. package/dist/components/layout/GameFlow.js +1 -93
  41. package/dist/components/layout/PageConfig.d.ts.map +1 -1
  42. package/dist/components/layout/PageConfig.js +1 -47
  43. package/dist/components/layout/PageContainer.d.ts.map +1 -1
  44. package/dist/components/layout/PageContainer.js +1 -38
  45. package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
  46. package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
  47. package/dist/components/layout/components/Breadcrumbs.js +1 -89
  48. package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
  49. package/dist/components/layout/components/DropdownNavigation.js +1 -30
  50. package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
  51. package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
  52. package/dist/components/layout/components/Notifications.js +1 -182
  53. package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
  54. package/dist/components/layout/components/header/AppBranding.js +1 -54
  55. package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
  56. package/dist/components/layout/components/header/AppIcon.js +1 -59
  57. package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
  58. package/dist/components/layout/components/header/AppTitle.js +1 -40
  59. package/dist/components/layout/components/header/CacheSettings.js +1 -225
  60. package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
  61. package/dist/components/layout/components/header/GameTitle.js +1 -66
  62. package/dist/components/layout/components/header/HeaderMenu.js +1 -75
  63. package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
  64. package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
  65. package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
  66. package/dist/components/layout/components/header/SettingsMenu.js +1 -85
  67. package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
  68. package/dist/components/layout/components/header/ThemeToggle.js +1 -93
  69. package/dist/components/layout/components/index.js +1 -25
  70. package/dist/components/layout/index.js +1 -14
  71. package/dist/crud/components/ChildRowsPicker.js +1 -68
  72. package/dist/crud/components/CrudCardLink.js +1 -14
  73. package/dist/crud/components/EntityCardList.d.ts +4 -1
  74. package/dist/crud/components/EntityCardList.d.ts.map +1 -1
  75. package/dist/crud/components/EntityCardList.js +1 -184
  76. package/dist/crud/components/EntityDisplayRenderer.js +1 -130
  77. package/dist/crud/components/EntityFormRenderer.js +1 -433
  78. package/dist/crud/components/EntityList.js +1 -521
  79. package/dist/crud/components/EntityRecommendations.js +1 -87
  80. package/dist/crud/components/EntityWorkflow.js +1 -55
  81. package/dist/crud/components/Form.d.ts.map +1 -1
  82. package/dist/crud/components/Form.js +1 -198
  83. package/dist/crud/components/cellEditFor.js +1 -74
  84. package/dist/crud/components/entityParent.js +1 -76
  85. package/dist/crud/components/index.js +1 -16
  86. package/dist/crud/components/useRecordBreadcrumb.d.ts +3 -1
  87. package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
  88. package/dist/crud/components/useRecordBreadcrumb.js +1 -43
  89. package/dist/crud/crudImports.js +1 -51
  90. package/dist/crud/index.js +1 -11
  91. package/dist/data/techLogos.js +1 -99
  92. package/dist/dndev-next.css +113 -41
  93. package/dist/dndev.css +113 -41
  94. package/dist/index.js +1 -5
  95. package/dist/internal/common/DnDevErrorBoundary.js +1 -55
  96. package/dist/internal/common/ErrorFallback.js +3 -214
  97. package/dist/internal/common/GlobalErrorFallback.js +1 -45
  98. package/dist/internal/common/RouteErrorFallback.js +3 -140
  99. package/dist/internal/devtools/DebugTools.js +1 -131
  100. package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
  101. package/dist/internal/devtools/components/ConfigTab.js +1 -61
  102. package/dist/internal/devtools/components/CookieTab.js +1 -156
  103. package/dist/internal/devtools/components/DebugDialog.js +1 -48
  104. package/dist/internal/devtools/components/DesignTab.js +1 -469
  105. package/dist/internal/devtools/components/LayoutReset.js +1 -214
  106. package/dist/internal/devtools/components/MaskedValue.js +1 -39
  107. package/dist/internal/devtools/components/StoresTab.js +1 -90
  108. package/dist/internal/devtools/components/index.js +1 -16
  109. package/dist/internal/devtools/index.js +1 -13
  110. package/dist/internal/devtools/types.js +0 -2
  111. package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
  112. package/dist/internal/devtools/utils/index.js +1 -12
  113. package/dist/internal/devtools/utils/maskSensitive.js +1 -59
  114. package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
  115. package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
  116. package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
  117. package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
  118. package/dist/internal/initializers/index.js +1 -11
  119. package/dist/internal/layout/DnDevLayout.js +1 -321
  120. package/dist/internal/layout/components/AutoMetaTags.d.ts +5 -0
  121. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  122. package/dist/internal/layout/components/AutoMetaTags.js +1 -338
  123. package/dist/internal/layout/components/FaviconHead.d.ts +18 -14
  124. package/dist/internal/layout/components/FaviconHead.d.ts.map +1 -1
  125. package/dist/internal/layout/components/FaviconHead.js +1 -60
  126. package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
  127. package/dist/internal/layout/components/HeadTags.js +1 -20
  128. package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
  129. package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
  130. package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
  131. package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
  132. package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
  133. package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
  134. package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
  135. package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
  136. package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
  137. package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
  138. package/dist/internal/layout/components/headTagElement.d.ts +16 -0
  139. package/dist/internal/layout/components/headTagElement.d.ts.map +1 -0
  140. package/dist/internal/layout/components/headTagElement.js +1 -0
  141. package/dist/internal/layout/components/index.js +1 -13
  142. package/dist/internal/layout/components/prerenderedHead.d.ts +15 -0
  143. package/dist/internal/layout/components/prerenderedHead.d.ts.map +1 -0
  144. package/dist/internal/layout/components/prerenderedHead.js +1 -0
  145. package/dist/internal/layout/components/trailingSlash.d.ts +13 -0
  146. package/dist/internal/layout/components/trailingSlash.d.ts.map +1 -0
  147. package/dist/internal/layout/components/trailingSlash.js +1 -0
  148. package/dist/internal/layout/config/defaults.js +1 -47
  149. package/dist/internal/layout/config/index.js +1 -11
  150. package/dist/internal/layout/config/presets/admin.js +1 -35
  151. package/dist/internal/layout/config/presets/blog.js +1 -31
  152. package/dist/internal/layout/config/presets/docs.js +1 -51
  153. package/dist/internal/layout/config/presets/game.js +1 -53
  154. package/dist/internal/layout/config/presets/index.js +1 -24
  155. package/dist/internal/layout/config/presets/landing.js +1 -42
  156. package/dist/internal/layout/config/presets/moolti.js +1 -52
  157. package/dist/internal/layout/config/presets/plain.js +1 -25
  158. package/dist/internal/layout/renderers/index.js +0 -10
  159. package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
  160. package/dist/internal/layout/zones/DnDevFooter.js +1 -67
  161. package/dist/internal/layout/zones/DnDevHeader.js +1 -41
  162. package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
  163. package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
  164. package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
  165. package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
  166. package/dist/internal/layout/zones/index.js +1 -14
  167. package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
  168. package/dist/internal/providers/NavigationProvider.js +1 -71
  169. package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
  170. package/dist/internal/providers/SentryInitializer.js +1 -36
  171. package/dist/internal/providers/UIProviders.js +1 -79
  172. package/dist/internal/providers/index.js +1 -12
  173. package/dist/next.js +1 -11
  174. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  175. package/dist/providers/NextJsAppProviders.js +1 -107
  176. package/dist/providers/ViteAppProviders.d.ts +11 -9
  177. package/dist/providers/ViteAppProviders.d.ts.map +1 -1
  178. package/dist/providers/ViteAppProviders.js +1 -117
  179. package/dist/providers/index.js +1 -11
  180. package/dist/routing/404.js +1 -108
  181. package/dist/routing/AuthGuard.js +1 -178
  182. package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
  183. package/dist/routing/AuthGuardFallback.js +1 -67
  184. package/dist/routing/AuthReturnTo.js +1 -68
  185. package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
  186. package/dist/routing/DnDevNavigationMenu.js +1 -138
  187. package/dist/routing/GoTo.d.ts.map +1 -1
  188. package/dist/routing/GoTo.js +1 -38
  189. package/dist/routing/GoToDialog.d.ts.map +1 -1
  190. package/dist/routing/GoToDialog.js +1 -97
  191. package/dist/routing/GoToInput.d.ts.map +1 -1
  192. package/dist/routing/GoToInput.js +1 -49
  193. package/dist/routing/GoToWrapper.d.ts.map +1 -1
  194. package/dist/routing/GoToWrapper.js +1 -59
  195. package/dist/routing/Link.d.ts +10 -2
  196. package/dist/routing/Link.d.ts.map +1 -1
  197. package/dist/routing/Link.js +1 -109
  198. package/dist/routing/NavigationItem.d.ts.map +1 -1
  199. package/dist/routing/NavigationItem.js +1 -44
  200. package/dist/routing/NotFoundDocument.d.ts +33 -0
  201. package/dist/routing/NotFoundDocument.d.ts.map +1 -0
  202. package/dist/routing/NotFoundDocument.js +1 -0
  203. package/dist/routing/SignedInRedirect.js +1 -47
  204. package/dist/routing/hooks/hooks.next.js +1 -1
  205. package/dist/routing/hooks/hooks.vite.js +1 -1
  206. package/dist/routing/hooks/index.js +1 -26
  207. package/dist/routing/hooks/types.js +0 -2
  208. package/dist/routing/hooks/useLocation.next.js +1 -35
  209. package/dist/routing/hooks/useLocation.vite.js +1 -13
  210. package/dist/routing/hooks/useMatch.next.js +1 -31
  211. package/dist/routing/hooks/useMatch.vite.js +1 -6
  212. package/dist/routing/hooks/useNavigate.next.js +1 -64
  213. package/dist/routing/hooks/useNavigate.vite.js +1 -61
  214. package/dist/routing/hooks/useParams.next.js +1 -9
  215. package/dist/routing/hooks/useParams.vite.js +1 -6
  216. package/dist/routing/hooks/useQueryParams.next.js +1 -66
  217. package/dist/routing/hooks/useQueryParams.vite.js +1 -66
  218. package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
  219. package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
  220. package/dist/routing/hooks/useRouteParam.next.js +1 -38
  221. package/dist/routing/hooks/useRouteParam.vite.js +1 -38
  222. package/dist/routing/hooks/useRoutePath.next.d.ts +5 -3
  223. package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -1
  224. package/dist/routing/hooks/useRoutePath.next.js +1 -36
  225. package/dist/routing/hooks/useRoutePath.vite.js +1 -25
  226. package/dist/routing/hooks/useSearchParams.next.js +1 -22
  227. package/dist/routing/hooks/useSearchParams.vite.js +1 -22
  228. package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
  229. package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
  230. package/dist/routing/index.d.ts +1 -0
  231. package/dist/routing/index.d.ts.map +1 -1
  232. package/dist/routing/index.js +1 -32
  233. package/dist/routing/link/InternalLink.next.d.ts +23 -0
  234. package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
  235. package/dist/routing/link/InternalLink.next.js +1 -0
  236. package/dist/routing/link/InternalLink.vite.d.ts +22 -0
  237. package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
  238. package/dist/routing/link/InternalLink.vite.js +1 -0
  239. package/dist/routing/link/absolutePath.d.ts +17 -0
  240. package/dist/routing/link/absolutePath.d.ts.map +1 -0
  241. package/dist/routing/link/absolutePath.js +1 -0
  242. package/dist/routing/link/link.next.d.ts +12 -0
  243. package/dist/routing/link/link.next.d.ts.map +1 -0
  244. package/dist/routing/link/link.next.js +1 -0
  245. package/dist/routing/link/link.vite.d.ts +12 -0
  246. package/dist/routing/link/link.vite.d.ts.map +1 -0
  247. package/dist/routing/link/link.vite.js +1 -0
  248. package/dist/routing/link/types.d.ts +30 -0
  249. package/dist/routing/link/types.d.ts.map +1 -0
  250. package/dist/routing/link/types.js +0 -0
  251. package/dist/routing/parentRoute.js +1 -43
  252. package/dist/routing/useGoTo.d.ts.map +1 -1
  253. package/dist/routing/useGoTo.js +1 -59
  254. package/dist/routing/useNavigation.d.ts.map +1 -1
  255. package/dist/routing/useNavigation.js +1 -114
  256. package/dist/routing/useRouteDiscovery.d.ts +4 -0
  257. package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
  258. package/dist/routing/useRouteDiscovery.js +1 -313
  259. package/dist/rsc.d.ts +28 -0
  260. package/dist/rsc.d.ts.map +1 -0
  261. package/dist/rsc.js +1 -0
  262. package/dist/styles/index.css +113 -41
  263. package/dist/styles/index.js +1 -10
  264. package/dist/styles/layoutConstants.js +1 -134
  265. package/dist/symbol-index.json +1 -1
  266. package/dist/utils/assetResolver.d.ts +19 -19
  267. package/dist/utils/assetResolver.d.ts.map +1 -1
  268. package/dist/utils/assetResolver.js +1 -297
  269. package/dist/utils/index.d.ts +0 -1
  270. package/dist/utils/index.d.ts.map +1 -1
  271. package/dist/utils/index.js +1 -23
  272. package/dist/utils/sanitizeSvg.js +1 -51
  273. package/dist/utils/tList.js +1 -42
  274. package/dist/utils/useAISafe.d.ts.map +1 -1
  275. package/dist/utils/useAISafe.js +1 -53
  276. package/dist/utils/useAuthSafe.d.ts.map +1 -1
  277. package/dist/utils/useAuthSafe.js +1 -78
  278. package/dist/utils/useAuthVisibility.d.ts.map +1 -1
  279. package/dist/utils/useAuthVisibility.js +1 -63
  280. package/dist/utils/useBillingVisibility.d.ts.map +1 -1
  281. package/dist/utils/useBillingVisibility.js +1 -57
  282. package/dist/utils/useCrudSafe.d.ts.map +1 -1
  283. package/dist/utils/useCrudSafe.js +1 -75
  284. package/dist/utils/useDeleteAccountSafe.js +1 -52
  285. package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
  286. package/dist/utils/useFormStoreSafe.js +1 -85
  287. package/dist/utils/useOAuthSafe.d.ts.map +1 -1
  288. package/dist/utils/useOAuthSafe.js +1 -38
  289. package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
  290. package/dist/utils/useStripeBillingSafe.js +1 -81
  291. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  292. package/dist/vite-routing/AppRoutes.js +1 -235
  293. package/dist/vite-routing/RootLayout.d.ts.map +1 -1
  294. package/dist/vite-routing/RootLayout.js +1 -205
  295. package/dist/vite-routing/index.js +1 -11
  296. package/dist/vite.js +1 -10
  297. package/guidelines/COMPONENTS.md +3 -3
  298. package/guidelines/PAGES.md +3 -0
  299. package/guidelines/ROUTING.md +16 -0
  300. package/guidelines/SEO.md +160 -142
  301. package/package.json +18 -8
  302. package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
  303. package/dist/ChildRowsPicker-ISP365ON.js +0 -1
  304. package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
  305. package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
  306. package/dist/CookieConsent-QOUAY6B4.js +0 -1
  307. package/dist/GoToDialog-KSBGOIWO.js +0 -1
  308. package/dist/GoToDialog-XBK5EZF4.js +0 -1
  309. package/dist/chunk-3CIZFGST.js +0 -1
  310. package/dist/chunk-LHMKU342.js +0 -1
  311. package/dist/chunk-MS7ZIW5Z.js +0 -1
  312. package/dist/chunk-O2XFH626.js +0 -1
  313. package/dist/chunk-P2DHZWPY.js +0 -1
  314. package/dist/components/common/lucideIconByName.d.ts +0 -9
  315. package/dist/components/common/lucideIconByName.d.ts.map +0 -1
  316. package/dist/components/common/lucideIconByName.js +0 -32
  317. package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
  318. package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
  319. package/dist/internal/layout/components/PerformanceHints.js +0 -71
  320. package/dist/internal/layout/components/i18nSeoMeta.d.ts +0 -54
  321. package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +0 -1
  322. package/dist/internal/layout/components/i18nSeoMeta.js +0 -53
  323. package/dist/utils/useSeo.d.ts +0 -129
  324. package/dist/utils/useSeo.d.ts.map +0 -1
  325. package/dist/utils/useSeo.js +0 -151
@@ -1,36 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useRoutePath.next.ts
3
- /**
4
- * @fileoverview Next.js route path of the current URL
5
- * @description The pathname without its language prefix, read without the query string.
6
- *
7
- * @version 0.1.0
8
- * @since 0.2.3
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { usePathname } from 'next/navigation';
12
- import { getLanguageRouting, publicPathname, splitLanguagePath, } from '@donotdev/core';
13
- /**
14
- * Route path of the current URL: the pathname without its language prefix
15
- * (`/en/produits` → `/produits`). Reads the pathname only: safe in cached (static)
16
- * renders, where reading the query string (`useLocation().search`,
17
- * `useSearchParams`) moves the render to the browser up to the nearest Suspense
18
- * boundary. Use it whenever the query string is not needed. The server render of a
19
- * per-request page reads its internal pathname (`/<lang>/dndev-session/…`): dropped here, so
20
- * the server and the browser see the same path.
21
- *
22
- * @returns Route path, always starting with `/`
23
- *
24
- * @example
25
- * ```tsx
26
- * const path = useRoutePath();
27
- * const active = path === '/produits';
28
- * ```
29
- *
30
- * @version 0.1.0
31
- * @since 0.2.3
32
- * @author AMBROISE PARK Consulting
33
- */
34
- export function useRoutePath() {
35
- return splitLanguagePath(publicPathname(usePathname() ?? '/'), getLanguageRouting()).path;
36
- }
1
+ "use client";import{usePathname as t}from"next/navigation";import{getLanguageRouting as a,publicPathname as e,splitLanguagePath as i,stripTrailingSlash as n}from"@donotdev/core";function g(){return i(e(n(t()??"/")),a()).path}export{g as useRoutePath};
@@ -1,25 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useRoutePath.vite.ts
3
- /**
4
- * @fileoverview Vite route path of the current URL
5
- * @description The router pathname (React Router strips the language basename).
6
- *
7
- * @version 0.1.0
8
- * @since 0.2.3
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { useLocation as useRouterLocation } from 'react-router-dom';
12
- /**
13
- * Route path of the current URL: the pathname without its language prefix
14
- * (`/en/produits` → `/produits`). Same as `useLocation().pathname`; on Next it is the
15
- * one that stays safe in cached (static) renders.
16
- *
17
- * @returns Route path, always starting with `/`
18
- *
19
- * @version 0.1.0
20
- * @since 0.2.3
21
- * @author AMBROISE PARK Consulting
22
- */
23
- export function useRoutePath() {
24
- return useRouterLocation().pathname;
25
- }
1
+ "use client";import{useLocation as t}from"react-router-dom";function o(){return t().pathname}export{o as useRoutePath};
@@ -1,22 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useSearchParams.next.ts
3
- import { useSearchParams as useNextSearchParams } from 'next/navigation';
4
- /**
5
- * Get current URL search parameters (read-only).
6
- * Returns a ReadonlyURLSearchParams instance directly (NOT a tuple).
7
- *
8
- * To modify search params, use `useNavigate()` with a query string
9
- * or `useQueryParams()` for a key-value API with defaults.
10
- *
11
- * @returns ReadonlyURLSearchParams instance with `.get()`, `.has()`, `.getAll()`, etc.
12
- *
13
- * @example
14
- * ```tsx
15
- * const searchParams = useSearchParams();
16
- * const page = searchParams.get('page');
17
- * const sort = searchParams.get('sort');
18
- * ```
19
- */
20
- export function useSearchParams() {
21
- return useNextSearchParams();
22
- }
1
+ "use client";import{useSearchParams as e}from"next/navigation";function a(){return e()}export{a as useSearchParams};
@@ -1,22 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useSearchParams.vite.ts
3
- import { useSearchParams as useRouterSearchParams } from 'react-router-dom';
4
- /**
5
- * Get current URL search parameters (read-only).
6
- * Returns a URLSearchParams instance directly (NOT a tuple).
7
- *
8
- * To modify search params, use `useNavigate()` with a query string
9
- * or `useQueryParams()` for a key-value API with defaults.
10
- *
11
- * @returns URLSearchParams instance with `.get()`, `.has()`, `.getAll()`, etc.
12
- *
13
- * @example
14
- * ```tsx
15
- * const searchParams = useSearchParams();
16
- * const page = searchParams.get('page');
17
- * const sort = searchParams.get('sort');
18
- * ```
19
- */
20
- export function useSearchParams() {
21
- return useRouterSearchParams()[0];
22
- }
1
+ "use client";import{useSearchParams as r}from"react-router-dom";function e(){return r()[0]}export{e as useSearchParams};
@@ -1,50 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useUrlLanguage.next.ts
3
- /**
4
- * @fileoverview Next.js language of the URL
5
- * @description The language of the current URL and the localized form of app paths
6
- * (default language at the root, others under `/<lang>`; see languagePath in
7
- * @donotdev/core). On the server a rewritten default-language page reads
8
- * `/<default>/…` and the browser reads `/…` (a per-request page: `/<lang>/dndev-session/…`,
9
- * dropped by publicPathname): both give the same language and paths, so the server
10
- * HTML and the hydration pass agree.
11
- *
12
- * @version 0.1.0
13
- * @since 0.2.3
14
- * @author AMBROISE PARK Consulting
15
- */
16
- import { usePathname } from 'next/navigation';
17
- import { getLanguageRouting, localizePath, publicPathname, splitLanguagePath, } from '@donotdev/core';
18
- /**
19
- * Language of the current URL: its prefix, else the default language.
20
- *
21
- * @returns Language code (`/en/produits` → `en`)
22
- *
23
- * @version 0.1.0
24
- * @since 0.2.3
25
- * @author AMBROISE PARK Consulting
26
- */
27
- export function useUrlLanguage() {
28
- return splitLanguagePath(publicPathname(usePathname() ?? '/'), getLanguageRouting()).language;
29
- }
30
- /**
31
- * Localize app paths in the current URL's language, for `href`s built outside `<Link>`.
32
- * `<Link path>` and `navigate()` already do it.
33
- *
34
- * @returns `(path) => url`: `/produits` → `/en/produits` on an English page
35
- *
36
- * @example
37
- * ```tsx
38
- * const localize = useLocalizedPath();
39
- * <a href={localize('/produits')}>…</a>
40
- * ```
41
- *
42
- * @version 0.1.0
43
- * @since 0.2.3
44
- * @author AMBROISE PARK Consulting
45
- */
46
- export function useLocalizedPath() {
47
- const language = useUrlLanguage();
48
- const routing = getLanguageRouting();
49
- return (path) => localizePath(path, language, routing);
50
- }
1
+ "use client";import{usePathname as g}from"next/navigation";import{getLanguageRouting as t,localizePath as r,publicPathname as u,splitLanguagePath as i}from"@donotdev/core";function o(){return i(u(g()??"/"),t()).language}function c(){let n=o(),a=t();return e=>r(e,n,a)}export{c as useLocalizedPath,o as useUrlLanguage};
@@ -1,41 +1 @@
1
- 'use client';
2
- // packages/ui/src/routing/hooks/useUrlLanguage.vite.ts
3
- /**
4
- * @fileoverview Vite language of the URL
5
- * @description The router runs under the language prefix as its basename
6
- * (createAppRouter), so route paths never carry it. This reads the language from that
7
- * basename and localizes app paths for `href`s.
8
- *
9
- * @version 0.1.0
10
- * @since 0.2.3
11
- * @author AMBROISE PARK Consulting
12
- */
13
- import { useHref } from 'react-router-dom';
14
- import { getLanguageRouting, localizePath, splitLanguagePath, } from '@donotdev/core';
15
- /**
16
- * Language of the current URL: the router basename's language, else the default.
17
- *
18
- * @returns Language code
19
- *
20
- * @version 0.1.0
21
- * @since 0.2.3
22
- * @author AMBROISE PARK Consulting
23
- */
24
- export function useUrlLanguage() {
25
- return splitLanguagePath(useHref('/'), getLanguageRouting()).language;
26
- }
27
- /**
28
- * Localize app paths in the current URL's language, for `href`s built outside `<Link>`.
29
- * `<Link path>` and `navigate()` already do it.
30
- *
31
- * @returns `(path) => url`: `/produits` → `/en/produits` on an English page
32
- *
33
- * @version 0.1.0
34
- * @since 0.2.3
35
- * @author AMBROISE PARK Consulting
36
- */
37
- export function useLocalizedPath() {
38
- const language = useUrlLanguage();
39
- const routing = getLanguageRouting();
40
- return (path) => localizePath(path, language, routing);
41
- }
1
+ "use client";import{useHref as r}from"react-router-dom";import{getLanguageRouting as t,localizePath as a,splitLanguagePath as u}from"@donotdev/core";function i(){return u(r("/"),t()).language}function l(){let n=i(),e=t();return g=>a(g,n,e)}export{l as useLocalizedPath,i as useUrlLanguage};
@@ -18,6 +18,7 @@ export { default as GoToWrapper } from './GoToWrapper';
18
18
  export { default as GoToInput } from './GoToInput';
19
19
  export * from './DnDevNavigationMenu';
20
20
  export { default as NotFoundPage } from './404';
21
+ export { NotFoundDocument, useIsNotFoundDocument } from './NotFoundDocument';
21
22
  export { useNavigate, useBack, useRefresh, usePrefetch, useLocation, useRoutePath, useParams, useRouteParam, useSearchParams, useMatch, useQueryParams, useRedirectGuard, useLocalizedPath, useUrlLanguage, } from '@donotdev/ui/routing/hooks';
22
23
  export type { NavigateOptions, RedirectGuardOptions, RedirectGuardResult, } from '@donotdev/ui/routing/hooks';
23
24
  export * from './useNavigation';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAOhD,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAGH,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAO7E,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,eAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
@@ -1,32 +1 @@
1
- // packages/ui/src/routing/index.ts
2
- /**
3
- * @fileoverview Routing package
4
- * @description Platform-agnostic routing components and hooks (work in both Vite + Next.js)
5
- * Vite-specific routing (AppRoutes, RootLayout) moved to ../vite-routing
6
- *
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- // Components - all platform-agnostic
12
- export * from './Link';
13
- // NavigationItemComponent intentionally NOT exported — internal building block.
14
- // Public API: HeaderNavigation (path prop for single item), DnDevNavigationMenu (full menu).
15
- export * from './AuthGuard';
16
- export * from './AuthGuardFallback';
17
- export { AuthReturnTo } from './AuthReturnTo';
18
- export { SignedInRedirect } from './SignedInRedirect';
19
- export * from './GoTo';
20
- export { default as GoToWrapper } from './GoToWrapper';
21
- export { default as GoToInput } from './GoToInput';
22
- // GoToDialog intentionally NOT exported - lazy loaded by GoToWrapper
23
- export * from './DnDevNavigationMenu';
24
- export { default as NotFoundPage } from './404';
25
- // Hooks - platform-specific via conditional exports
26
- // '@donotdev/ui/routing/hooks' resolves to:
27
- // - hooks.vite.ts when bundled with Vite (vite-app condition)
28
- // - hooks.next.ts when bundled with Next.js (default condition)
29
- // NOTE: Explicit named exports required - esbuild can't re-export with 'export *' from external
30
- export { useNavigate, useBack, useRefresh, usePrefetch, useLocation, useRoutePath, useParams, useRouteParam, useSearchParams, useMatch, useQueryParams, useRedirectGuard, useLocalizedPath, useUrlLanguage, } from '@donotdev/ui/routing/hooks';
31
- export * from './useNavigation';
32
- export * from './useGoTo';
1
+ export*from"./Link.js";export*from"./AuthGuard.js";export*from"./AuthGuardFallback.js";import{AuthReturnTo as a}from"./AuthReturnTo.js";import{SignedInRedirect as p}from"./SignedInRedirect.js";export*from"./GoTo.js";import{default as f}from"./GoToWrapper.js";import{default as i}from"./GoToInput.js";export*from"./DnDevNavigationMenu.js";import{default as R}from"./404.js";import{NotFoundDocument as P,useIsNotFoundDocument as h}from"./NotFoundDocument.js";import{useNavigate as G,useBack as I,useRefresh as N,usePrefetch as S,useLocation as v,useRoutePath as y,useParams as F,useRouteParam as L,useSearchParams as T,useMatch as k,useQueryParams as D,useRedirectGuard as O,useLocalizedPath as z,useUrlLanguage as A}from"@donotdev/ui/routing/hooks";export*from"./useNavigation.js";export*from"./useGoTo.js";export{a as AuthReturnTo,i as GoToInput,f as GoToWrapper,P as NotFoundDocument,R as NotFoundPage,p as SignedInRedirect,I as useBack,h as useIsNotFoundDocument,z as useLocalizedPath,v as useLocation,k as useMatch,G as useNavigate,F as useParams,S as usePrefetch,D as useQueryParams,O as useRedirectGuard,N as useRefresh,L as useRouteParam,y as useRoutePath,T as useSearchParams,A as useUrlLanguage};
@@ -0,0 +1,23 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { InternalLinkProps } from './types';
3
+ /**
4
+ * Internal link (Next.js): renders next/link (a real `<a href>`) in the current language.
5
+ * - `prefetch` true (default), guest: next/link's default (`auto`: static routes fully,
6
+ * dynamic routes up to the nearest `loading.js`; production only). Guests get the
7
+ * cached site tree, which `auto` prefetches in full.
8
+ * - `prefetch` true, signed in: `prefetch={true}`, the full route of each visible link.
9
+ * Signed-in visitors get the per-request session tree (`dndev-session`, dynamic), which
10
+ * `auto` skips. Signed-in state is `useAuth('isAuthenticated')`: the request's cookie
11
+ * snapshot on the server and in the hydration pass, the provider's once ready. The
12
+ * anchor HTML does not depend on it (prefetch runs after mount): no hydration mismatch.
13
+ * - `prefetch` false: no prefetch, signed in or not.
14
+ * - Plain left click: client-side navigation, open overlays closed (same as `navigate()`).
15
+ * Modifier / middle clicks keep the browser default (new tab). An `onClick` calling
16
+ * `preventDefault()` cancels the navigation.
17
+ *
18
+ * @version 0.2.0
19
+ * @since 0.3.2
20
+ * @author AMBROISE PARK Consulting
21
+ */
22
+ export declare function InternalLink({ path, replace, prefetch, children, ...anchorProps }: InternalLinkProps): ReactElement;
23
+ //# sourceMappingURL=InternalLink.next.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalLink.next.d.ts","sourceRoot":"","sources":["../../../src/routing/link/InternalLink.next.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQ1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,OAAO,EACP,QAAe,EACf,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,iBAAiB,GAAG,YAAY,CAgBlC"}
@@ -0,0 +1 @@
1
+ "use client";import p from"next/link";import{useOverlayStore as s}from"@donotdev/core";import{useLocalizedPath as c}from"@donotdev/ui/routing/hooks";import{useAuthSafe as f}from"../../utils/useAuthSafe.js";import{absolutePath as u}from"./absolutePath.js";import{jsx as h}from"react/jsx-runtime";function P({path:e,replace:t,prefetch:o=!0,children:r,...n}){let l=c(),i=s(m=>m.closeAll),a=f("isAuthenticated");return h(p,{href:l(u(e)),replace:t,prefetch:o?a?!0:null:!1,onNavigate:()=>i(),...n,children:r})}export{P as InternalLink};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview Vite internal link
3
+ * @description `<a href>` to an app path, navigated client-side by react-router (`useNavigate`).
4
+ * Resolved via the `vite-app` condition of `@donotdev/ui/routing/link`.
5
+ *
6
+ * @version 0.1.0
7
+ * @since 0.3.2
8
+ * @author AMBROISE PARK Consulting
9
+ */
10
+ import type { ReactElement } from 'react';
11
+ import type { InternalLinkProps } from './types';
12
+ /**
13
+ * Internal link (Vite): renders `<a href>` in the current language and navigates with the
14
+ * router on a plain left click. Modifier / non-left clicks keep the browser default (new tab).
15
+ * `prefetch` has no effect (react-router has no prefetch).
16
+ *
17
+ * @version 0.1.0
18
+ * @since 0.3.2
19
+ * @author AMBROISE PARK Consulting
20
+ */
21
+ export declare function InternalLink({ path, replace, prefetch: _prefetch, onClick, children, ...anchorProps }: InternalLinkProps): ReactElement;
22
+ //# sourceMappingURL=InternalLink.vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalLink.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/link/InternalLink.vite.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAMtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,OAAO,EACP,QAAQ,EAAE,SAAS,EACnB,OAAO,EACP,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,iBAAiB,GAAG,YAAY,CAwBlC"}
@@ -0,0 +1 @@
1
+ "use client";import{useLocalizedPath as c,useNavigate as p}from"@donotdev/ui/routing/hooks";import{absolutePath as s}from"./absolutePath.js";import{jsx as m}from"react/jsx-runtime";function v({path:n,replace:r,prefetch:u,onClick:e,children:o,...a}){let i=p(),l=c(),f=t=>{if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.button!==0){e&&e(t);return}t.preventDefault(),e&&e(t),i(s(n),{replace:r})};return m("a",{href:l(n),onClick:f,...a,children:o})}export{v as InternalLink};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @fileoverview Link target path
3
+ * @description Path an internal `Link` navigates to.
4
+ *
5
+ * @version 0.1.0
6
+ * @since 0.3.2
7
+ * @author AMBROISE PARK Consulting
8
+ */
9
+ /**
10
+ * Absolute app path (starts with `/`) so navigation never resolves relative to the current
11
+ * URL; intentional relative paths (`./x`, `../x`) are kept.
12
+ *
13
+ * @param path - `Link` path
14
+ * @returns `products` → `/products`; `/products`, `./x` unchanged
15
+ */
16
+ export declare function absolutePath(path: string): string;
17
+ //# sourceMappingURL=absolutePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absolutePath.d.ts","sourceRoot":"","sources":["../../../src/routing/link/absolutePath.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"}
@@ -0,0 +1 @@
1
+ function r(t){return t.startsWith("/")||t.startsWith(".")?t:`/${t}`}export{r as absolutePath};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Next.js platform link barrel
3
+ * @description Next.js implementation (next/link) of the internal link `Link` renders.
4
+ * Resolved via the default condition of `@donotdev/ui/routing/link`.
5
+ *
6
+ * @version 0.1.0
7
+ * @since 0.3.2
8
+ * @author AMBROISE PARK Consulting
9
+ */
10
+ export { InternalLink } from './InternalLink.next';
11
+ export type { InternalLinkProps } from './types';
12
+ //# sourceMappingURL=link.next.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.next.d.ts","sourceRoot":"","sources":["../../../src/routing/link/link.next.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ "use client";import h from"next/link";import{useOverlayStore as P}from"@donotdev/core";import{useLocalizedPath as I}from"@donotdev/ui/routing/hooks";import*as o from"@donotdev/auth";import{DEGRADED_AUTH_API as p}from"@donotdev/core";var e=o?.useAuth;function m(t){return p[t]}function r(t){return e?e(t):m(t)}var y=o?.PasswordResetCallback??(()=>null);function n(t){return t.startsWith("/")||t.startsWith(".")?t:`/${t}`}import{jsx as k}from"react/jsx-runtime";function d({path:t,replace:s,prefetch:u=!0,children:i,...l}){let a=I(),f=P(c=>c.closeAll),A=r("isAuthenticated");return k(h,{href:a(n(t)),replace:s,prefetch:u?A?!0:null:!1,onNavigate:()=>f(),...l,children:i})}export{d as InternalLink};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Vite platform link barrel
3
+ * @description Vite implementation of the internal link `Link` renders.
4
+ * Resolved via the `vite-app` condition of `@donotdev/ui/routing/link`.
5
+ *
6
+ * @version 0.1.0
7
+ * @since 0.3.2
8
+ * @author AMBROISE PARK Consulting
9
+ */
10
+ export { InternalLink } from './InternalLink.vite';
11
+ export type { InternalLinkProps } from './types';
12
+ //# sourceMappingURL=link.vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.vite.d.ts","sourceRoot":"","sources":["../../../src/routing/link/link.vite.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ "use client";import{useLocalizedPath as p,useNavigate as c}from"@donotdev/ui/routing/hooks";function n(e){return e.startsWith("/")||e.startsWith(".")?e:`/${e}`}import{jsx as m}from"react/jsx-runtime";function u({path:e,replace:o,prefetch:y,onClick:r,children:i,...a}){let s=c(),l=p(),f=t=>{if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.button!==0){r&&r(t);return}t.preventDefault(),r&&r(t),s(n(e),{replace:o})};return m("a",{href:l(e),onClick:f,...a,children:i})}export{u as InternalLink};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview Platform link types
3
+ * @description Props of the platform anchor `Link` renders for internal paths
4
+ * (`InternalLink`: next/link on Next.js, react-router navigation on Vite).
5
+ *
6
+ * @version 0.1.0
7
+ * @since 0.3.2
8
+ * @author AMBROISE PARK Consulting
9
+ */
10
+ import type { AnchorHTMLAttributes, ReactNode } from 'react';
11
+ /**
12
+ * Props of `InternalLink`: an anchor to an app path, rendered as a real `<a href>`.
13
+ *
14
+ * @version 0.1.0
15
+ * @since 0.3.2
16
+ * @author AMBROISE PARK Consulting
17
+ */
18
+ export interface InternalLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
19
+ /** App path (`/produits`): the link uses the current language's URL */
20
+ path: string;
21
+ /** Replace the current history entry instead of pushing one */
22
+ replace?: boolean;
23
+ /**
24
+ * Next.js: `true` (default) prefetches with next/link's default for guests and the full
25
+ * route for signed-in visitors; `false` disables prefetching. Vite: ignored
26
+ */
27
+ prefetch?: boolean;
28
+ children?: ReactNode;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/routing/link/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC7D,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
File without changes
@@ -1,43 +1 @@
1
- // packages/ui/src/routing/parentRoute.ts
2
- /**
3
- * @fileoverview Breadcrumb path rules
4
- * @description One rule for Breadcrumbs and form navigation: every cumulative
5
- * path prefix is a crumb, and a crumb links only when it is a known route.
6
- *
7
- * @version 0.1.0
8
- * @since 0.2.5
9
- * @author AMBROISE PARK Consulting
10
- */
11
- /**
12
- * Cumulative prefixes of a pathname: `/a/b/c` → `['/a', '/a/b', '/a/b/c']`.
13
- *
14
- * @param pathname - App path (no language prefix)
15
- * @returns One entry per segment, in order
16
- */
17
- export function getPathPrefixes(pathname) {
18
- const prefixes = [];
19
- let current = '';
20
- for (const segment of pathname.split('/').filter(Boolean)) {
21
- current += `/${segment}`;
22
- prefixes.push(current);
23
- }
24
- return prefixes;
25
- }
26
- /**
27
- * Previous breadcrumb: the nearest parent prefix that is a known route, else home.
28
- * `/routines/abc` → `/routines`; `/reglages` → `/`.
29
- *
30
- * @param pathname - App path (no language prefix)
31
- * @param routePaths - Known route paths (what Breadcrumbs links)
32
- * @param homePath - Path when no parent route exists
33
- * @returns The path the previous breadcrumb links to
34
- */
35
- export function getParentRoutePath(pathname, routePaths, homePath = '/') {
36
- const parents = getPathPrefixes(pathname).slice(0, -1);
37
- for (let index = parents.length - 1; index >= 0; index--) {
38
- const path = parents[index];
39
- if (path !== undefined && routePaths.has(path))
40
- return path;
41
- }
42
- return homePath;
43
- }
1
+ function o(r){let t=[],e="";for(let n of r.split("/").filter(Boolean))e+=`/${n}`,t.push(e);return t}function f(r,t,e="/"){let n=o(r).slice(0,-1);for(let s=n.length-1;s>=0;s--){let i=n[s];if(i!==void 0&&t.has(i))return i}return e}export{f as getParentRoutePath,o as getPathPrefixes};
@@ -1 +1 @@
1
- {"version":3,"file":"useGoTo.d.ts","sourceRoot":"","sources":["../../src/routing/useGoTo.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;2BAwBY,MAAM;uBAKV,MAAM;2BASvB,MAAM;CAehB,CAAC"}
1
+ {"version":3,"file":"useGoTo.d.ts","sourceRoot":"","sources":["../../src/routing/useGoTo.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;2BAwBY,MAAM;uBAKV,MAAM;2BASvB,MAAM;CAehB,CAAC"}
@@ -1,59 +1 @@
1
- // packages/ui/src/routing/useGoTo.ts
2
- /**
3
- * @fileoverview useGoTo Hook - Navigation search logic
4
- * @description Clean hook for Cmd+K navigation with favorites, recents, and filtering
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- import { useCallback } from 'react';
11
- import { useNavigationStore } from '@donotdev/core';
12
- // Platform-specific hooks via conditional exports
13
- import { useNavigate } from '@donotdev/ui/routing/hooks';
14
- import { useNavigationItems } from './useNavigation';
15
- /**
16
- * Hook for navigation with favorites and recents
17
- * Command component handles search/filtering
18
- */
19
- export const useGoTo = () => {
20
- const navigate = useNavigate();
21
- const navigationItems = useNavigationItems() ?? [];
22
- // Navigation store (favorites and recent persisted per computer)
23
- const favorites = useNavigationStore((state) => state.favorites);
24
- const recent = useNavigationStore((state) => state.recent);
25
- const toggleFavoriteStore = useNavigationStore((state) => state.toggleFavorite);
26
- const isFavoriteStore = useNavigationStore((state) => state.isFavorite);
27
- const addRecentStore = useNavigationStore((state) => state.addRecent);
28
- // Get favorite items
29
- const favoriteItems = navigationItems.length
30
- ? navigationItems.filter((item) => favorites.includes(item.path))
31
- : [];
32
- // Get recent items
33
- const recentItems = navigationItems.length
34
- ? navigationItems.filter((item) => recent.includes(item.path)).slice(0, 5)
35
- : [];
36
- // Toggle favorite (delegates to navigation store)
37
- const toggleFavorite = (path) => {
38
- toggleFavoriteStore(path);
39
- };
40
- // Check if item is favorite (delegates to navigation store)
41
- const isFavorite = (path) => isFavoriteStore(path);
42
- // Add to recent (delegates to navigation store)
43
- const addRecent = (path) => {
44
- addRecentStore(path);
45
- };
46
- // Navigate to item
47
- const navigateToItem = useCallback((path) => {
48
- addRecent(path);
49
- navigate(path);
50
- }, [navigate, addRecent]);
51
- return {
52
- navigationItems,
53
- favoriteItems,
54
- recentItems,
55
- toggleFavorite,
56
- isFavorite,
57
- navigateToItem,
58
- };
59
- };
1
+ "use client";import{useCallback as d}from"react";import{useNavigationStore as o}from"@donotdev/core";import{useNavigate as p}from"@donotdev/ui/routing/hooks";import{useNavigationItems as F}from"./useNavigation.js";var R=()=>{let n=p(),e=F()??[],i=o(t=>t.favorites),r=o(t=>t.recent),a=o(t=>t.toggleFavorite),c=o(t=>t.isFavorite),g=o(t=>t.addRecent),v=e.length?e.filter(t=>i.includes(t.path)):[],l=e.length?e.filter(t=>r.includes(t.path)).slice(0,5):[],m=t=>{a(t)},f=t=>c(t),s=t=>{g(t)},u=d(t=>{s(t),n(t)},[n,s]);return{navigationItems:e,favoriteItems:v,recentItems:l,toggleFavorite:m,isFavorite:f,navigateToItem:u}};export{R as useGoTo};
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../../src/routing/useNavigation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAYtD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAyBrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAG3E"}
1
+ {"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../../src/routing/useNavigation.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAYtD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAyBrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAG3E"}