@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,5 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- // packages/ui/src/vite-routing/AppRoutes.tsx
1
+ "use client";import{lazy as l,Suspense as y,useLayoutEffect as L}from"react";import{createBrowserRouter as C}from"react-router-dom";import{Spinner as h}from"@donotdev/components";import{applyFirstVisitLanguage as w,getLanguageRouting as A,splitLanguagePath as B,useLayout as m}from"@donotdev/core";import{RootLayout as x}from"./RootLayout.js";import{AuthGuard as G}from"../routing/AuthGuard.js";import{SignedInRedirect as k}from"../routing/SignedInRedirect.js";import{Fragment as R,jsx as o,jsxs as z}from"react/jsx-runtime";var i=new Map;function E(){i.has("404")||i.set("404",l(()=>import("../routing/404.js")));let t=i.get("404");return z(R,{children:[o("meta",{name:"robots",content:"noindex"}),o(y,{fallback:o(h,{overlay:!0}),children:o(t,{})})]})}var N=({component:e,path:t})=>{i.has(t)||i.set(t,l(e));let r=i.get(t);return o(y,{fallback:o(h,{overlay:!0}),children:o(r,{})})};function p(e){if(e&&typeof e=="object"&&"preset"in e){let t=e.preset;return typeof t=="string"?t:void 0}}function c(e){if(e&&typeof e=="object"&&"hideBreadcrumbs"in e){let t=e.hideBreadcrumbs;return typeof t=="boolean"?t:void 0}}function v(e){if(e&&typeof e=="object"&&"signedInRedirect"in e){let t=e.signedInRedirect;return typeof t=="string"?t:void 0}}function d(e){let t=o(N,{component:e.component,path:e.path}),r=v(e.meta);return r?o(k,{to:r,children:t}):t}var f=({preset:e,hideBreadcrumbs:t,children:r})=>{let a=m("setRoutePresetOverride"),u=m("setRouteHideBreadcrumbs");return L(()=>{a(e??null),u(t??!1)},[e,t,a,u]),o(R,{children:r})};function H(e){return typeof e=="boolean"?e?{required:!0}:!1:typeof e=="object"&&e!==null?e:!1}function M(e){let{routeGroups:t,basename:r,layout:a}=e,u=S(r),g=t.flatMap(n=>n.routes),s=g.find(n=>n.path==="/");if(!s)throw new Error("No HomePage.tsx found. Create src/pages/HomePage.tsx to define the root route.");let b=g.map(n=>({...n,parsedAuth:H(n.auth)})),P=[{path:"/",element:o(x,{layout:a}),children:[{index:!0,element:(s.auth&&typeof window<"u"&&import.meta.env.DEV,o(f,{preset:p(s.meta),hideBreadcrumbs:c(s.meta),children:d(s)}))},...b.filter(n=>n.path!=="/").map(n=>({path:n.path.startsWith("/")?n.path.slice(1):n.path,element:n.parsedAuth===!1?o(f,{preset:p(n.meta),hideBreadcrumbs:c(n.meta),children:d(n)}):o(f,{preset:p(n.meta),hideBreadcrumbs:c(n.meta),children:o(G,{auth:n.parsedAuth,children:d(n)})})})),{path:"*",element:o(E,{})}]}];return C(P,{basename:u})}function S(e){let t=A();w(t.languages,t.defaultLanguage);let r=e??"",{language:a,prefixed:u}=B(window.location.pathname.slice(r.length)||"/",t);return u?`${r}/${a}`:e}export{M as createAppRouter};
3
2
  /**
4
3
  * @fileoverview AppRoutes - Professional Route Configuration System
5
4
  * @description Enterprise-grade routing with automatic discovery, authentication, and lazy loading
@@ -46,236 +45,3 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
46
45
  * <RouterProvider router={router} />
47
46
  * ```
48
47
  */
49
- import { lazy, Suspense, useLayoutEffect } from 'react';
50
- import { createBrowserRouter } from 'react-router-dom';
51
- import { Spinner } from '@donotdev/components';
52
- import { applyFirstVisitLanguage, getLanguageRouting, splitLanguagePath, useLayout, } from '@donotdev/core';
53
- import { RootLayout } from './RootLayout';
54
- import { AuthGuard } from '../routing/AuthGuard';
55
- import { SignedInRedirect } from '../routing/SignedInRedirect';
56
- // Cache lazy components to prevent recreation and infinite loops
57
- const lazyComponentCache = new Map();
58
- /**
59
- * NotFoundPage component with lazy loading and caching
60
- * Only loads when actually needed (404 route)
61
- */
62
- function NotFoundPage() {
63
- const cacheKey = '404';
64
- // Use the same caching mechanism as dynamic routes
65
- if (!lazyComponentCache.has(cacheKey)) {
66
- lazyComponentCache.set(cacheKey, lazy(() => import('../routing/404')));
67
- }
68
- const LazyNotFoundPage = lazyComponentCache.get(cacheKey);
69
- return (_jsx(Suspense, { fallback: _jsx(Spinner, { overlay: true }), children: _jsx(LazyNotFoundPage, {}) }));
70
- }
71
- /**
72
- * LazyRoute - Optimized Component Loader
73
- *
74
- * Provides efficient lazy loading with caching to prevent component recreation
75
- * and infinite loops. Uses the component function directly from route discovery.
76
- *
77
- * @param component - Lazy component function from route discovery
78
- * @param path - Route path for caching
79
- * @returns Lazy-loaded React component
80
- *
81
- * @example
82
- * ```tsx
83
- * <LazyRoute component={route.component} path={route.path} />
84
- * ```
85
- */
86
- const LazyRoute = ({ component, path, }) => {
87
- if (!lazyComponentCache.has(path)) {
88
- lazyComponentCache.set(path, lazy(component));
89
- }
90
- const Component = lazyComponentCache.get(path);
91
- return (_jsx(Suspense, { fallback: _jsx(Spinner, { overlay: true }), children: _jsx(Component, {}) }));
92
- };
93
- /** Extract preset from route meta (meta is unknown at the interface level) */
94
- function getRoutePreset(meta) {
95
- if (meta && typeof meta === 'object' && 'preset' in meta) {
96
- const preset = meta.preset;
97
- return typeof preset === 'string' ? preset : undefined;
98
- }
99
- return undefined;
100
- }
101
- /** Extract hideBreadcrumbs from route meta */
102
- function getRouteHideBreadcrumbs(meta) {
103
- if (meta && typeof meta === 'object' && 'hideBreadcrumbs' in meta) {
104
- const hide = meta.hideBreadcrumbs;
105
- return typeof hide === 'boolean' ? hide : undefined;
106
- }
107
- return undefined;
108
- }
109
- /** Extract signedInRedirect (PageMeta) from route meta */
110
- function getRouteSignedInRedirect(meta) {
111
- if (meta && typeof meta === 'object' && 'signedInRedirect' in meta) {
112
- const to = meta.signedInRedirect;
113
- return typeof to === 'string' ? to : undefined;
114
- }
115
- return undefined;
116
- }
117
- /** Route page, inside SignedInRedirect when its PageMeta sets `signedInRedirect` */
118
- function routePage(route) {
119
- const page = _jsx(LazyRoute, { component: route.component, path: route.path });
120
- const to = getRouteSignedInRedirect(route.meta);
121
- return to ? _jsx(SignedInRedirect, { to: to, children: page }) : page;
122
- }
123
- /**
124
- * LayoutRoute - Per-route preset switcher
125
- *
126
- * Wraps route elements to apply the route's `meta.preset` override.
127
- * On mount, sets the route preset override in the theme store.
128
- * On unmount (navigation away), the next route's LayoutRoute sets its own value.
129
- * Routes without a preset pass null, falling back to the app's default.
130
- *
131
- * Uses useLayoutEffect to apply before paint, avoiding visual flash.
132
- */
133
- const LayoutRoute = ({ preset, hideBreadcrumbs, children, }) => {
134
- const setRoutePresetOverride = useLayout('setRoutePresetOverride');
135
- const setRouteHideBreadcrumbs = useLayout('setRouteHideBreadcrumbs');
136
- useLayoutEffect(() => {
137
- // Set route override (or null to clear and use app default)
138
- setRoutePresetOverride(preset ?? null);
139
- setRouteHideBreadcrumbs(hideBreadcrumbs ?? false);
140
- }, [
141
- preset,
142
- hideBreadcrumbs,
143
- setRoutePresetOverride,
144
- setRouteHideBreadcrumbs,
145
- ]);
146
- return _jsx(_Fragment, { children: children });
147
- };
148
- /**
149
- * Parse auth configuration to PageAuth | false for AuthGuard
150
- *
151
- * Handles various auth configurations from route discovery:
152
- * - boolean true: Convert to { required: true }
153
- * - boolean false: Return false (public)
154
- * - PageAuth object: Return as-is
155
- * - function: Invalid config, default to public
156
- * - undefined/null: Default to public
157
- *
158
- * @param auth - Auth configuration from route discovery
159
- * @returns Clean PageAuth or false for AuthGuard
160
- */
161
- function parseAuthConfig(auth) {
162
- if (typeof auth === 'boolean') {
163
- return auth ? { required: true } : false;
164
- }
165
- if (typeof auth === 'object' && auth !== null) {
166
- return auth; // Return PageAuth object as-is
167
- }
168
- return false; // Default to public
169
- }
170
- /**
171
- * createAppRouter - Router Factory Function
172
- *
173
- * Creates a configured React Router instance with automatic route discovery,
174
- * authentication, lazy loading, and error handling.
175
- *
176
- * This factory function replaces the component-based approach with React Router v7's
177
- * data router pattern (createBrowserRouter). It discovers routes at creation time
178
- * and returns a router instance ready for use with RouterProvider.
179
- *
180
- * Features:
181
- * - Automatic route discovery from filesystem
182
- * - Lazy loading with code splitting
183
- * - Authentication integration via AuthGuard
184
- * - SEO-friendly root route
185
- * - Native scroll restoration
186
- * - Optional layout wrapper integration
187
- *
188
- * @param options - Router configuration options
189
- * @returns Configured router instance for RouterProvider
190
- *
191
- * @example
192
- * ```tsx
193
- * const groups = useRouteDiscovery();
194
- * const router = createAppRouter({
195
- * routeGroups: groups
196
- * });
197
- * <RouterProvider router={router} />
198
- * ```
199
- *
200
- * @example
201
- * ```tsx
202
- * // With basename and layout config
203
- * const groups = useRouteDiscovery();
204
- * const router = createAppRouter({
205
- * routeGroups: groups,
206
- * basename: '/app',
207
- * layout: { header: () => <CustomHeader /> }
208
- * });
209
- * <RouterProvider router={router} />
210
- * ```
211
- */
212
- export function createAppRouter(options) {
213
- const { routeGroups, basename, layout } = options;
214
- const routerBasename = languageBasename(basename);
215
- // Find HomePage route (path "/")
216
- const allRoutes = routeGroups.flatMap((group) => group.routes);
217
- const homePageRoute = allRoutes.find((route) => route.path === '/');
218
- if (!homePageRoute) {
219
- throw new Error('No HomePage.tsx found. Create src/pages/HomePage.tsx to define the root route.');
220
- }
221
- // Pre-parse auth configs for all routes
222
- const routesWithParsedAuth = allRoutes.map((route) => ({
223
- ...route,
224
- parsedAuth: parseAuthConfig(route.auth),
225
- }));
226
- // Build route configuration
227
- const routeConfig = [
228
- {
229
- /** Root route - HomePage.tsx is automatically assigned path "/" by convention */
230
- path: '/',
231
- element: _jsx(RootLayout, { layout: layout }),
232
- children: [
233
- {
234
- /** HomePage route - lazy loaded, public (no AuthGuard).
235
- * Auth config on HomePage is intentionally ignored — use a different page as entry. */
236
- index: true,
237
- element: (() => {
238
- if (homePageRoute.auth &&
239
- typeof window !== 'undefined' &&
240
- import.meta.env.DEV) {
241
- console.warn('[DoNotDev] HomePage has auth config but the index route is always public. ' +
242
- 'Auth config on HomePage is ignored. Use a different page as your protected entry point.');
243
- }
244
- return (_jsx(LayoutRoute, { preset: getRoutePreset(homePageRoute.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(homePageRoute.meta), children: routePage(homePageRoute) }));
245
- })(),
246
- },
247
- /** All other routes are discovered and rendered here */
248
- ...routesWithParsedAuth
249
- .filter((route) => route.path !== '/')
250
- .map((route) => ({
251
- path: route.path.startsWith('/') ? route.path.slice(1) : route.path,
252
- element: route.parsedAuth === false ? (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(route.meta), children: routePage(route) })) : (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), hideBreadcrumbs: getRouteHideBreadcrumbs(route.meta), children: _jsx(AuthGuard, { auth: route.parsedAuth, children: routePage(route) }) })),
253
- })),
254
- // 404 catch-all route (must be last)
255
- {
256
- path: '*',
257
- element: _jsx(NotFoundPage, {}),
258
- },
259
- ],
260
- },
261
- ];
262
- // Create and return router instance
263
- return createBrowserRouter(routeConfig, { basename: routerBasename });
264
- }
265
- /**
266
- * Router basename for the URL's language: `/en` on `/en/…` (other languages live under
267
- * their prefix, the default language at the root), so routes, links and useLocation
268
- * work with app paths. A first visit to an unprefixed URL moves to the visitor's
269
- * language first (same rule as the Next proxy). One language: the basename unchanged.
270
- *
271
- * @param basename - App basename, if the app is not served at the domain root
272
- */
273
- function languageBasename(basename) {
274
- const routing = getLanguageRouting();
275
- applyFirstVisitLanguage(routing.languages, routing.defaultLanguage);
276
- const appBase = basename ?? '';
277
- const { language, prefixed } = splitLanguagePath(window.location.pathname.slice(appBase.length) || '/', routing);
278
- if (!prefixed)
279
- return basename;
280
- return `${appBase}/${language}`;
281
- }
@@ -1 +1 @@
1
- {"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/vite-routing/RootLayout.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAuLnD;;GAEG;AACH,UAAU,oBAAoB;IAC5B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,+BAiC1D"}
1
+ {"version":3,"file":"RootLayout.d.ts","sourceRoot":"","sources":["../../src/vite-routing/RootLayout.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAuLnD;;GAEG;AACH,UAAU,oBAAoB;IAC5B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,+BAiC1D"}
@@ -1,205 +1 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- // packages/ui/src/vite-routing/RootLayout.tsx
3
- /**
4
- * @fileoverview RootLayout - Root route layout component
5
- * @description Wraps all routes with QueryProviders, UIProviders, and Layout
6
- *
7
- * This component is rendered as the root route element in the React Router v7
8
- * data router configuration. It provides the core provider hierarchy for all
9
- * routes in the application.
10
- *
11
- * @version 0.1.0
12
- * @since 0.0.1
13
- * @author AMBROISE PARK Consulting
14
- */
15
- import { Suspense, lazy, useEffect, useLayoutEffect, useRef } from 'react';
16
- import { Outlet, useLocation } from 'react-router-dom';
17
- import { globalEmitter, isClient, QueryProviders } from '@donotdev/core';
18
- import { DnDevLayout } from '../internal/layout/DnDevLayout';
19
- import { UIProviders } from '../internal/providers/UIProviders';
20
- import { AuthReturnTo } from '../routing/AuthReturnTo';
21
- import { PasswordResetCallback } from '../utils/useAuthSafe';
22
- // Only lazy load non-critical components (not in render path)
23
- const AutoMetaTags = lazy(() => import('../internal/layout/components/AutoMetaTags').then((m) => ({
24
- default: m.default,
25
- })));
26
- const ConsentBanner = lazy(() => import('../components/cookie-consent/ConsentBanner').then((m) => ({
27
- default: m.default,
28
- })));
29
- const PWAUpdateNotification = lazy(() => import('../internal/layout/components/PWAUpdateNotification').then((m) => ({
30
- default: m.default,
31
- })));
32
- const RedirectOverlay = lazy(() => import('../components/common/RedirectOverlay').then((m) => ({
33
- default: m.RedirectOverlay,
34
- })));
35
- /**
36
- * CustomScrollRestoration - Scroll restoration for custom scroll containers
37
- *
38
- * React Router's <ScrollRestoration /> only works with window-level scrolling.
39
- * Our layout uses main[role='main'] as the scroll container (overflow-y: auto),
40
- * so we need custom scroll restoration logic.
41
- *
42
- * Behavior:
43
- * - New navigation (PUSH): Scroll main element to top
44
- * - Back/Forward (POP): Restore previous scroll position
45
- *
46
- * @version 0.1.0
47
- * @since 0.0.1
48
- * @author AMBROISE PARK Consulting
49
- */
50
- function CustomScrollRestoration() {
51
- const location = useLocation();
52
- const scrollPositions = useRef(new Map());
53
- const prevLocationKey = useRef(null);
54
- useEffect(() => {
55
- const mainElement = document.querySelector('main[role="main"]');
56
- if (!mainElement)
57
- return;
58
- // main is always the sole scroll container (overflow-y: auto)
59
- // Save scroll position of the page we're leaving
60
- if (prevLocationKey.current) {
61
- scrollPositions.current.set(prevLocationKey.current, mainElement.scrollTop);
62
- }
63
- // Check if this is a back/forward navigation (POP) by checking saved position
64
- const saved = scrollPositions.current.get(location.key);
65
- if (saved !== undefined) {
66
- // POP navigation - restore scroll position
67
- requestAnimationFrame(() => {
68
- mainElement.scrollTop = saved;
69
- });
70
- }
71
- else {
72
- // PUSH navigation - scroll to top
73
- mainElement.scrollTop = 0;
74
- }
75
- prevLocationKey.current = location.key;
76
- // Cleanup: Keep only last 20 positions to prevent memory leaks
77
- if (scrollPositions.current.size > 20) {
78
- for (const key of scrollPositions.current.keys()) {
79
- scrollPositions.current.delete(key);
80
- break;
81
- }
82
- }
83
- }, [location.pathname, location.key]);
84
- return null;
85
- }
86
- /**
87
- * FrameworkReadySignal - Signals when framework providers are painted
88
- *
89
- * Framework responsibility: Show shell loader while framework sets up (stores, providers).
90
- * Customer responsibility: Handle their own loading states via Suspense boundaries.
91
- *
92
- * This component signals when the FRAMEWORK is ready (providers painted),
93
- * NOT when customer content is ready. Customer's Suspense fallbacks handle that gap.
94
- *
95
- * Uses useLayoutEffect to detect when framework providers (UIProviders wrapper) are painted.
96
- * Dispatches 'DNDEV_FRAMEWORK_READY' event for shell loader removal coordination.
97
- *
98
- * @version 0.1.0
99
- * @since 0.0.1
100
- * @author AMBROISE PARK Consulting
101
- */
102
- function FrameworkReadySignal({ children }) {
103
- const hasSignaled = useRef(false);
104
- const frameworkRef = useRef(null);
105
- useLayoutEffect(() => {
106
- if (!isClient() || hasSignaled.current)
107
- return;
108
- const checkAndSignal = () => {
109
- if (hasSignaled.current)
110
- return;
111
- const element = frameworkRef.current;
112
- if (!element)
113
- return;
114
- requestAnimationFrame(() => {
115
- const rect = element.getBoundingClientRect();
116
- const hasVisibleFramework = rect.width > 0 && rect.height > 0;
117
- if (hasVisibleFramework) {
118
- hasSignaled.current = true;
119
- requestAnimationFrame(() => {
120
- requestAnimationFrame(() => {
121
- globalEmitter.emit('DNDEV_FRAMEWORK_READY');
122
- });
123
- });
124
- }
125
- });
126
- };
127
- checkAndSignal();
128
- const timeout = setTimeout(() => {
129
- if (!hasSignaled.current) {
130
- hasSignaled.current = true;
131
- globalEmitter.emit('DNDEV_FRAMEWORK_READY');
132
- }
133
- }, 500);
134
- return () => {
135
- clearTimeout(timeout);
136
- };
137
- }, []);
138
- return _jsx("div", { ref: frameworkRef, children: children });
139
- }
140
- /**
141
- * RouteReadySignal - Signals when route content is painted
142
- *
143
- * Emits 'DNDEV_ROUTE_READY' event when route content (inside Suspense) is painted.
144
- * Used in coordination with FrameworkReadySignal to time shell loader removal.
145
- *
146
- * Shell loader removed only when BOTH framework AND route are ready,
147
- * preventing "late arrival" of route content after Header/Footer paint.
148
- *
149
- * @version 0.1.0
150
- * @since 0.0.1
151
- * @author AMBROISE PARK Consulting
152
- */
153
- function RouteReadySignal({ children }) {
154
- const hasSignaled = useRef(false);
155
- useLayoutEffect(() => {
156
- if (!isClient() || hasSignaled.current)
157
- return;
158
- // Wait for two animation frames to ensure paint completion
159
- requestAnimationFrame(() => {
160
- requestAnimationFrame(() => {
161
- if (hasSignaled.current)
162
- return;
163
- hasSignaled.current = true;
164
- globalEmitter.emit('DNDEV_ROUTE_READY');
165
- });
166
- });
167
- }, []);
168
- return _jsx(_Fragment, { children: children });
169
- }
170
- /**
171
- * RootLayout - Root route layout component
172
- *
173
- * Provides the core provider hierarchy for all routes:
174
- * - QueryProviders (React Query)
175
- * - UIProviders (design system, error boundaries)
176
- * - AutoMetaTags (SEO)
177
- * - FrameworkReadySignal (framework initialization signal)
178
- * - Layout (application layout with slots)
179
- * - ConsentBanner (cookie consent)
180
- * - PWAUpdateNotification (PWA update notifications)
181
- *
182
- * Wraps <Outlet /> which renders child routes.
183
- *
184
- * @param props - RootLayout props
185
- * @returns Root layout with providers
186
- *
187
- * @example
188
- * ```tsx
189
- * // Used in route configuration
190
- * const routes = [
191
- * {
192
- * path: '/',
193
- * element: <RootLayout layout={layoutConfig} />,
194
- * children: [...]
195
- * }
196
- * ];
197
- * ```
198
- *
199
- * @version 0.1.0
200
- * @since 0.0.1
201
- * @author AMBROISE PARK Consulting
202
- */
203
- export function RootLayout({ layout }) {
204
- return (_jsx(QueryProviders, { children: _jsxs(UIProviders, { children: [_jsx(Suspense, { fallback: null, children: _jsx(AutoMetaTags, {}) }), _jsxs(FrameworkReadySignal, { children: [_jsx(DnDevLayout, { layout: layout, children: _jsx(RouteReadySignal, { children: _jsx(Outlet, {}) }) }), _jsx(CustomScrollRestoration, {}), _jsx(AuthReturnTo, {}), _jsxs(Suspense, { fallback: null, children: [_jsx(ConsentBanner, {}), _jsx(PasswordResetCallback, {}), _jsx(PWAUpdateNotification, {}), _jsx(RedirectOverlay, {})] })] })] }) }));
205
- }
1
+ "use client";import{Suspense as f,lazy as c,useEffect as p,useLayoutEffect as d,useRef as i}from"react";import{Outlet as y,useLocation as g}from"react-router-dom";import{globalEmitter as l,isClient as R,QueryProviders as D}from"@donotdev/core";import{DnDevLayout as h}from"../internal/layout/DnDevLayout.js";import{UIProviders as k}from"../internal/providers/UIProviders.js";import{AuthReturnTo as v}from"../routing/AuthReturnTo.js";import{PasswordResetCallback as A}from"../utils/useAuthSafe.js";import{Fragment as w,jsx as r,jsxs as s}from"react/jsx-runtime";var E=c(()=>import("../internal/layout/components/AutoMetaTags.js").then(e=>({default:e.default}))),S=c(()=>import("../components/cookie-consent/ConsentBanner.js").then(e=>({default:e.default}))),F=c(()=>import("../internal/layout/components/PWAUpdateNotification.js").then(e=>({default:e.default}))),L=c(()=>import("../components/common/RedirectOverlay.js").then(e=>({default:e.RedirectOverlay})));function P(){let e=g(),t=i(new Map),n=i(null);return p(()=>{let o=document.querySelector('main[role="main"]');if(!o)return;n.current&&t.current.set(n.current,o.scrollTop);let u=t.current.get(e.key);if(u!==void 0?requestAnimationFrame(()=>{o.scrollTop=u}):o.scrollTop=0,n.current=e.key,t.current.size>20)for(let a of t.current.keys()){t.current.delete(a);break}},[e.pathname,e.key]),null}function T({children:e}){let t=i(!1),n=i(null);return d(()=>{if(!R()||t.current)return;(()=>{if(t.current)return;let a=n.current;a&&requestAnimationFrame(()=>{let m=a.getBoundingClientRect();m.width>0&&m.height>0&&(t.current=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>{l.emit("DNDEV_FRAMEWORK_READY")})}))})})();let u=setTimeout(()=>{t.current||(t.current=!0,l.emit("DNDEV_FRAMEWORK_READY"))},500);return()=>{clearTimeout(u)}},[]),r("div",{ref:n,children:e})}function b({children:e}){let t=i(!1);return d(()=>{!R()||t.current||requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.current||(t.current=!0,l.emit("DNDEV_ROUTE_READY"))})})},[]),r(w,{children:e})}function K({layout:e}){return r(D,{children:s(k,{children:[r(f,{fallback:null,children:r(E,{})}),s(T,{children:[r(h,{layout:e,children:r(b,{children:r(y,{})})}),r(P,{}),r(v,{}),s(f,{fallback:null,children:[r(S,{}),r(A,{}),r(F,{}),r(L,{})]})]})]})})}export{K as RootLayout};
@@ -1,11 +1 @@
1
- // packages/ui/src/vite-routing/index.ts
2
- /**
3
- * @fileoverview Vite-specific routing exports
4
- * @description React Router based routing components for Vite applications only
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- export * from './AppRoutes';
11
- export * from './RootLayout';
1
+ export*from"./AppRoutes.js";export*from"./RootLayout.js";
package/dist/vite.js CHANGED
@@ -1,10 +1 @@
1
- // packages/ui/src/vite.ts
2
- /**
3
- * @fileoverview Vite App Providers
4
- * @description Vite-specific app providers and routing exports
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- export { ViteAppProviders } from './providers/ViteAppProviders';
1
+ import{ViteAppProviders as o}from"./providers/ViteAppProviders.js";export{o as ViteAppProviders};
@@ -48,7 +48,7 @@
48
48
  ## Common Components
49
49
 
50
50
  - **FeatureDisabled** - Component shown when features are disabled.
51
- - **Icon** - Icon component wrapper.
51
+ - **Icon** - Icon component wrapper. `icon`: Lucide component (`{Rocket}`, static), emoji, ReactNode, or Lucide name string (`"Rocket"`): theme icons (`--theme-icon`) render statically from the build-time registry, any other name loads as its own chunk (same-size placeholder meanwhile, none in server HTML; unknown names show `Palette`). Prefer components for server-rendered icons.
52
52
  - **ProgressBar** - Progress bar component.
53
53
  - **Skeleton** - Skeleton loading component (consumer use, not used internally).
54
54
  - **FeatureCard** - Feature showcase card component.
@@ -58,7 +58,7 @@
58
58
 
59
59
  ## Routing Components
60
60
 
61
- - **Link** - Platform-agnostic link component (works in Vite + Next.js).
61
+ - **Link** - Platform-agnostic link component (works in Vite + Next.js). Internal paths render `next/link` on Next.js (route prefetch by default, in full for signed-in visitors; `prefetch={false}` disables it) and a react-router `<a href>` on Vite. See ROUTING.md.
62
62
  - **AuthGuard** - Route guard component for protected routes.
63
63
  - **AuthGuardFallback** - Fallback component for auth-guarded routes.
64
64
  - **GoTo** - Programmatic navigation component.
@@ -92,7 +92,7 @@
92
92
  ## Cookie Consent
93
93
 
94
94
  - **CookieConsent** - Cookie consent management component.
95
- - **ConsentBanner** - Cookie consent banner component.
95
+ - **ConsentBanner** - Cookie consent banner component. Renders nothing when the app sets only strictly necessary cookies (`features.requiredCookies` has no `functional`/`analytics`/`marketing`); the `#cookie-settings` footer link is then hidden too.
96
96
 
97
97
  ---
98
98
 
@@ -180,7 +180,10 @@ import { useCrud } from '@donotdev/crud';
180
180
 
181
181
  **Sub-path exceptions** (server, config, and provider-specific):
182
182
  - **Server:** `@donotdev/core/server`, `@donotdev/firebase/server`, `@donotdev/security/server`
183
+ - **Server components (Next only):** `@donotdev/core/rsc` (`useTranslation`, `setRequestLanguage`; see core `I18N.md`), `@donotdev/components/rsc`, `@donotdev/ui/rsc`. They resolve only in React Server Components (`react-server` condition); importing them anywhere else fails the build.
183
184
  - **Config:** `@donotdev/core/vite`, `@donotdev/core/next`, `@donotdev/core/functions`
185
+
186
+ **`@donotdev/components/rsc` / `@donotdev/ui/rsc`** export the same names as the package root. Presentational components (Stack, Text, Grid, Button…) render on the server. Interactive ones (hooks, Radix, context, event handlers, browser APIs: Card, Dialog, PageContainer…) carry their own `'use client'` and render as client islands. Calling one of their hooks or helpers from a server component throws. The package roots (`@donotdev/components`, `@donotdev/ui`) are unchanged: client barrels everywhere, including server files. Nothing imports the `/rsc` entries yet, so apps render exactly as before until a later phase adopts them. Vite never uses them.
184
187
  - **Functions:** `@donotdev/functions/firebase`, `@donotdev/functions/vercel`, `@donotdev/functions/supabase`
185
188
 
186
189
  ---
@@ -39,11 +39,18 @@ import { Link, DnDevNavigationMenu } from '@donotdev/ui';
39
39
  <Link path="/users/:id" replace prefetch={false}>User Details</Link>
40
40
  ```
41
41
 
42
+ Internal paths render a real `<a href>` on both platforms (via `@donotdev/ui/routing/link`, resolved like `routing/hooks`):
43
+ - **Next.js:** `next/link`. `prefetch` (default `true`): guests get next/link's default prefetch (production only: static routes fully, dynamic routes up to the nearest `loading.js`); signed-in visitors (`useAuth('isAuthenticated')`, cookie snapshot until the provider is ready) get `prefetch={true}`, the full route of each visible link, because their pages render per request (session tree) and the default skips them. `prefetch={false}` disables it for everyone. An `onClick` calling `preventDefault()` cancels the navigation.
44
+ - **Vite:** `<a href>` navigated by react-router; `prefetch` has no effect.
45
+ - Modifier / middle clicks keep the browser default (new tab). External URLs (`http(s)`, `mailto:`, `tel:`) are plain `<a target="_blank">`. Cards (`href`) and Tables render links through `Link`, so they get the same behaviour.
46
+ - String `icon` names (`"Package"`) load per icon (own chunk); prefer an imported component (`icon={Package}`) for server-rendered icons.
47
+
42
48
  **DnDevNavigationMenu (Sidebar/Header):**
43
49
  ```tsx
44
50
  // Auto-fetches routes, handles auth filtering
45
51
  <DnDevNavigationMenu vertical display={DISPLAY.AUTO} />
46
52
  ```
53
+ The link of the current route gets `aria-current="page"` + `data-active="true"` (exact match, or the route is nested under the item's path; `/` matches exactly only). A parent item is active when one of its children is. Also applies to the header overflow ("More") dropdown.
47
54
 
48
55
  ### Hooks
49
56
 
@@ -72,6 +79,15 @@ not-found wrappers opt into this generic, badge-free content. This prop hides on
72
79
  the path badge; translated labels, route suggestions and Home/Back actions remain
73
80
  server-renderable. It does not disable SSR or defer navigation until mount.
74
81
 
82
+ The badge is not the only URL-derived output. The static Next 404 is built once (at
83
+ `/_not-found`) and served for every unknown URL, so anything computed from the
84
+ pathname differs between its HTML and the browser's render (React #418). The
85
+ generated not-found and global not-found pages wrap their tree in
86
+ `<NotFoundDocument>` (`@donotdev/ui`): inside it, `AutoMetaTags` emits no canonical
87
+ link and no URL-derived JSON-LD, and `Breadcrumbs` renders nothing. A hand-written
88
+ shared 404 must do the same. Apps that set `breadcrumbs: 'never'` in their layout
89
+ still need it for the head tags.
90
+
75
91
  The canonical translation text is `dndev:messages.notFound.*`. Framework eager
76
92
  locales expose `errors.notFound.{title,description,suggestions,navigateTo,goHome,goBack}`
77
93
  as explicit i18next `$t(messages.notFound.<key>)` compatibility references, not