@donotdev/ui 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/ChildRowsPicker-63M4EQUQ.js +1 -0
  2. package/dist/ChildRowsPicker-ISP365ON.js +1 -0
  3. package/dist/ChildRowsPicker-PQFE6NCR.js +1 -0
  4. package/dist/ChildRowsPicker-XXFFSMWY.js +1 -0
  5. package/dist/{GoToDialog-CICRYHHG.js → GoToDialog-KSBGOIWO.js} +1 -1
  6. package/dist/{GoToDialog-YGBON6FR.js → GoToDialog-XBK5EZF4.js} +1 -1
  7. package/dist/chunk-3CIZFGST.js +1 -0
  8. package/dist/chunk-LHMKU342.js +1 -0
  9. package/dist/chunk-MS7ZIW5Z.js +1 -0
  10. package/dist/chunk-P2DHZWPY.js +1 -0
  11. package/dist/components/auth/AuthHeader.d.ts.map +1 -1
  12. package/dist/components/auth/AuthHeader.js +0 -2
  13. package/dist/components/auth/AuthMenu.d.ts.map +1 -1
  14. package/dist/components/auth/AuthMenu.js +6 -40
  15. package/dist/components/common/icon.d.ts.map +1 -1
  16. package/dist/components/common/icon.js +2 -1
  17. package/dist/components/common/lucideIconByName.d.ts +9 -0
  18. package/dist/components/common/lucideIconByName.d.ts.map +1 -0
  19. package/dist/components/common/lucideIconByName.js +32 -0
  20. package/dist/components/layout/GameFlow.d.ts.map +1 -1
  21. package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
  22. package/dist/components/layout/components/Breadcrumbs.js +18 -12
  23. package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
  24. package/dist/components/layout/components/header/CacheSettings.js +6 -4
  25. package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
  26. package/dist/components/layout/components/header/SettingsMenu.js +4 -3
  27. package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
  28. package/dist/components/layout/components/header/ThemeToggle.js +2 -1
  29. package/dist/crud/components/ChildRowsPicker.d.ts +21 -0
  30. package/dist/crud/components/ChildRowsPicker.d.ts.map +1 -0
  31. package/dist/crud/components/ChildRowsPicker.js +68 -0
  32. package/dist/crud/components/CrudCardLink.d.ts +6 -6
  33. package/dist/crud/components/CrudCardLink.d.ts.map +1 -1
  34. package/dist/crud/components/CrudCardLink.js +3 -9
  35. package/dist/crud/components/EntityCardList.d.ts.map +1 -1
  36. package/dist/crud/components/EntityCardList.js +10 -26
  37. package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
  38. package/dist/crud/components/EntityDisplayRenderer.js +6 -3
  39. package/dist/crud/components/EntityFormRenderer.d.ts +4 -2
  40. package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
  41. package/dist/crud/components/EntityFormRenderer.js +160 -56
  42. package/dist/crud/components/EntityList.d.ts +6 -4
  43. package/dist/crud/components/EntityList.d.ts.map +1 -1
  44. package/dist/crud/components/EntityList.js +437 -92
  45. package/dist/crud/components/EntityRecommendations.js +1 -1
  46. package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
  47. package/dist/crud/components/EntityWorkflow.js +6 -4
  48. package/dist/crud/components/Form.d.ts +1 -1
  49. package/dist/crud/components/Form.d.ts.map +1 -1
  50. package/dist/crud/components/Form.js +2 -2
  51. package/dist/crud/components/cellEditFor.d.ts +43 -0
  52. package/dist/crud/components/cellEditFor.d.ts.map +1 -0
  53. package/dist/crud/components/cellEditFor.js +74 -0
  54. package/dist/crud/components/entityParent.d.ts +33 -0
  55. package/dist/crud/components/entityParent.d.ts.map +1 -0
  56. package/dist/crud/components/entityParent.js +76 -0
  57. package/dist/crud/components/useRecordBreadcrumb.d.ts +11 -0
  58. package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -0
  59. package/dist/crud/components/useRecordBreadcrumb.js +43 -0
  60. package/dist/crud/crudImports.d.ts +12 -1
  61. package/dist/crud/crudImports.d.ts.map +1 -1
  62. package/dist/crud/crudImports.js +11 -0
  63. package/dist/dndev-next.css +782 -193
  64. package/dist/dndev.css +784 -193
  65. package/dist/index.js +4 -4
  66. package/dist/internal/common/RouteErrorFallback.d.ts.map +1 -1
  67. package/dist/internal/common/RouteErrorFallback.js +2 -4
  68. package/dist/internal/devtools/components/ConfigTab.d.ts.map +1 -1
  69. package/dist/internal/devtools/components/ConfigTab.js +1 -1
  70. package/dist/internal/devtools/components/CookieTab.d.ts.map +1 -1
  71. package/dist/internal/devtools/components/CookieTab.js +1 -5
  72. package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
  73. package/dist/internal/devtools/components/DesignTab.js +18 -7
  74. package/dist/internal/devtools/components/StoresTab.d.ts.map +1 -1
  75. package/dist/internal/devtools/components/StoresTab.js +17 -3
  76. package/dist/internal/devtools/types.d.ts +3 -3
  77. package/dist/internal/devtools/types.d.ts.map +1 -1
  78. package/dist/internal/devtools/utils/maskSensitive.d.ts +1 -1
  79. package/dist/internal/devtools/utils/maskSensitive.d.ts.map +1 -1
  80. package/dist/internal/initializers/NextJsStoresInitializer.d.ts +3 -0
  81. package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
  82. package/dist/internal/initializers/NextJsStoresInitializer.js +8 -1
  83. package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
  84. package/dist/internal/layout/DnDevLayout.js +21 -21
  85. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  86. package/dist/internal/layout/components/AutoMetaTags.js +42 -38
  87. package/dist/internal/layout/components/FontPreloadLinks.d.ts +7 -4
  88. package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +1 -1
  89. package/dist/internal/layout/components/FontPreloadLinks.js +12 -25
  90. package/dist/internal/layout/components/footer/FooterCopyright.d.ts +2 -0
  91. package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
  92. package/dist/internal/layout/components/footer/FooterCopyright.js +4 -0
  93. package/dist/internal/layout/components/footer/useLegalLinks.d.ts +2 -1
  94. package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
  95. package/dist/internal/layout/components/footer/useLegalLinks.js +4 -3
  96. package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +1 -1
  97. package/dist/internal/layout/components/i18nSeoMeta.js +1 -0
  98. package/dist/internal/layout/zones/DnDevMergedBar.js +3 -3
  99. package/dist/internal/providers/UIProviders.d.ts +0 -8
  100. package/dist/internal/providers/UIProviders.d.ts.map +1 -1
  101. package/dist/internal/providers/UIProviders.js +45 -2
  102. package/dist/providers/NextJsAppProviders.d.ts +5 -1
  103. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  104. package/dist/providers/NextJsAppProviders.js +36 -6
  105. package/dist/providers/ViteAppProviders.d.ts.map +1 -1
  106. package/dist/providers/ViteAppProviders.js +42 -7
  107. package/dist/routing/404.d.ts +8 -1
  108. package/dist/routing/404.d.ts.map +1 -1
  109. package/dist/routing/404.js +9 -5
  110. package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
  111. package/dist/routing/AuthGuardFallback.js +1 -2
  112. package/dist/routing/AuthReturnTo.d.ts.map +1 -1
  113. package/dist/routing/AuthReturnTo.js +9 -2
  114. package/dist/routing/GoTo.d.ts +0 -6
  115. package/dist/routing/GoTo.d.ts.map +1 -1
  116. package/dist/routing/GoTo.js +5 -8
  117. package/dist/routing/Link.d.ts +4 -2
  118. package/dist/routing/Link.d.ts.map +1 -1
  119. package/dist/routing/Link.js +8 -5
  120. package/dist/routing/SignedInRedirect.d.ts +27 -0
  121. package/dist/routing/SignedInRedirect.d.ts.map +1 -0
  122. package/dist/routing/SignedInRedirect.js +47 -0
  123. package/dist/routing/hooks/hooks.next.d.ts +2 -0
  124. package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
  125. package/dist/routing/hooks/hooks.next.js +1 -1
  126. package/dist/routing/hooks/hooks.vite.d.ts +2 -0
  127. package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
  128. package/dist/routing/hooks/hooks.vite.js +1 -1
  129. package/dist/routing/hooks/useLocation.next.d.ts +12 -0
  130. package/dist/routing/hooks/useLocation.next.d.ts.map +1 -1
  131. package/dist/routing/hooks/useLocation.next.js +17 -4
  132. package/dist/routing/hooks/useMatch.next.d.ts +6 -0
  133. package/dist/routing/hooks/useMatch.next.d.ts.map +1 -1
  134. package/dist/routing/hooks/useMatch.next.js +8 -2
  135. package/dist/routing/hooks/useNavigate.next.d.ts +6 -1
  136. package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
  137. package/dist/routing/hooks/useNavigate.next.js +13 -4
  138. package/dist/routing/hooks/useNavigate.vite.d.ts +7 -1
  139. package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
  140. package/dist/routing/hooks/useNavigate.vite.js +20 -4
  141. package/dist/routing/hooks/useRedirectGuard.next.d.ts +3 -1
  142. package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
  143. package/dist/routing/hooks/useRedirectGuard.next.js +18 -10
  144. package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
  145. package/dist/routing/hooks/useRedirectGuard.vite.js +7 -1
  146. package/dist/routing/hooks/useRoutePath.next.d.ts +23 -0
  147. package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -0
  148. package/dist/routing/hooks/useRoutePath.next.js +36 -0
  149. package/dist/routing/hooks/useRoutePath.vite.d.ts +13 -0
  150. package/dist/routing/hooks/useRoutePath.vite.d.ts.map +1 -0
  151. package/dist/routing/hooks/useRoutePath.vite.js +25 -0
  152. package/dist/routing/hooks/useUrlLanguage.next.d.ts +28 -0
  153. package/dist/routing/hooks/useUrlLanguage.next.d.ts.map +1 -0
  154. package/dist/routing/hooks/useUrlLanguage.next.js +50 -0
  155. package/dist/routing/hooks/useUrlLanguage.vite.d.ts +22 -0
  156. package/dist/routing/hooks/useUrlLanguage.vite.d.ts.map +1 -0
  157. package/dist/routing/hooks/useUrlLanguage.vite.js +41 -0
  158. package/dist/routing/index.d.ts +3 -1
  159. package/dist/routing/index.d.ts.map +1 -1
  160. package/dist/routing/index.js +2 -1
  161. package/dist/routing/parentRoute.d.ts +27 -0
  162. package/dist/routing/parentRoute.d.ts.map +1 -0
  163. package/dist/routing/parentRoute.js +43 -0
  164. package/dist/routing/useNavigation.d.ts.map +1 -1
  165. package/dist/routing/useNavigation.js +8 -27
  166. package/dist/routing/useRouteDiscovery.d.ts +2 -2
  167. package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
  168. package/dist/routing/useRouteDiscovery.js +6 -5
  169. package/dist/styles/index.css +781 -192
  170. package/dist/symbol-index.json +1 -1
  171. package/dist/utils/assetResolver.d.ts.map +1 -1
  172. package/dist/utils/assetResolver.js +1 -0
  173. package/dist/utils/index.d.ts +2 -0
  174. package/dist/utils/index.d.ts.map +1 -1
  175. package/dist/utils/index.js +3 -0
  176. package/dist/utils/useDeleteAccountSafe.d.ts +17 -0
  177. package/dist/utils/useDeleteAccountSafe.d.ts.map +1 -0
  178. package/dist/utils/useDeleteAccountSafe.js +52 -0
  179. package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
  180. package/dist/utils/useFormStoreSafe.js +1 -0
  181. package/dist/utils/useSeo.d.ts +10 -2
  182. package/dist/utils/useSeo.d.ts.map +1 -1
  183. package/dist/utils/useSeo.js +44 -9
  184. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  185. package/dist/vite-routing/AppRoutes.js +37 -4
  186. package/guidelines/COMPONENTS.md +2 -1
  187. package/guidelines/GOTCHAS.md +2 -0
  188. package/guidelines/LAYOUTS.md +4 -0
  189. package/guidelines/PAGES.md +30 -3
  190. package/guidelines/ROUTING.md +29 -0
  191. package/guidelines/SEO.md +52 -0
  192. package/package.json +9 -9
  193. package/dist/CookieConsent-5NH5DNTP.js +0 -1
  194. package/dist/CookieConsent-W7UE647Y.js +0 -1
  195. package/dist/chunk-DRFM6WXH.js +0 -1
  196. package/dist/chunk-MIPTBUWY.js +0 -1
  197. package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +0 -57
  198. package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +0 -1
  199. package/dist/internal/layout/components/NextJsAutoMetaTags.js +0 -182
@@ -1,15 +1,18 @@
1
1
  /**
2
2
  * @fileoverview FontPreloadLinks - Server-only component for Next.js
3
- * @description Reads public/dndev-font-preloads.json (written at build by FontPreloadWebpackPlugin) and renders preload link tags for Lighthouse-friendly LCP. Include in root layout so initial HTML contains the links.
3
+ * @description Links public/dndev-fonts.css, the @font-face rules of the framework
4
+ * fonts the app's theme uses (written at build by copyFontsToPublic). Renders nothing
5
+ * when the theme uses none (an app that packs its own fonts). Include in the root
6
+ * document's <head>.
4
7
  *
5
- * @version 0.1.0
8
+ * @version 0.2.0
6
9
  * @since 0.0.1
7
10
  * @author AMBROISE PARK Consulting
8
11
  */
9
12
  import type { ReactNode } from 'react';
10
13
  /**
11
- * Server component: renders preload links for fonts listed in public/dndev-font-preloads.json.
12
- * No-op if manifest is missing or empty. Use in root layout.tsx for SSR preload in initial HTML.
14
+ * Server component: `<link rel="stylesheet" href="/dndev-fonts.css">` when discovery
15
+ * generated that file (the theme renders text in a framework font), else null.
13
16
  */
14
17
  export declare function FontPreloadLinks(): Promise<ReactNode>;
15
18
  export default FontPreloadLinks;
@@ -1 +1 @@
1
- {"version":3,"file":"FontPreloadLinks.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/FontPreloadLinks.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,CA0C3D;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"FontPreloadLinks.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/FontPreloadLinks.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,CAQ3D;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,44 +1,31 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // packages/ui/src/internal/layout/components/FontPreloadLinks.tsx
3
3
  /**
4
4
  * @fileoverview FontPreloadLinks - Server-only component for Next.js
5
- * @description Reads public/dndev-font-preloads.json (written at build by FontPreloadWebpackPlugin) and renders preload link tags for Lighthouse-friendly LCP. Include in root layout so initial HTML contains the links.
5
+ * @description Links public/dndev-fonts.css, the @font-face rules of the framework
6
+ * fonts the app's theme uses (written at build by copyFontsToPublic). Renders nothing
7
+ * when the theme uses none (an app that packs its own fonts). Include in the root
8
+ * document's <head>.
6
9
  *
7
- * @version 0.1.0
10
+ * @version 0.2.0
8
11
  * @since 0.0.1
9
12
  * @author AMBROISE PARK Consulting
10
13
  */
11
14
  import fs from 'node:fs/promises';
12
15
  import path from 'node:path';
13
- const MANIFEST_FILENAME = 'dndev-font-preloads.json';
14
16
  const FONTS_CSS_FILENAME = 'dndev-fonts.css';
15
17
  /**
16
- * Server component: renders preload links for fonts listed in public/dndev-font-preloads.json.
17
- * No-op if manifest is missing or empty. Use in root layout.tsx for SSR preload in initial HTML.
18
+ * Server component: `<link rel="stylesheet" href="/dndev-fonts.css">` when discovery
19
+ * generated that file (the theme renders text in a framework font), else null.
18
20
  */
19
21
  export async function FontPreloadLinks() {
20
- const publicDir = path.join(process.cwd(), 'public');
21
- // Load preload manifest (optional — may not exist on first build or static export)
22
- let entries = [];
23
22
  try {
24
- const content = await fs.readFile(path.join(publicDir, MANIFEST_FILENAME), 'utf8');
25
- const parsed = JSON.parse(content);
26
- entries = Array.isArray(parsed) ? parsed : [];
23
+ await fs.access(path.join(process.cwd(), 'public', FONTS_CSS_FILENAME));
27
24
  }
28
25
  catch {
29
- // No manifest — preload links won't render, but font stylesheet still can
30
- }
31
- // Check if public/dndev-fonts.css exists (generated by copyFontsToPublic for Next.js)
32
- let hasFontsCss = false;
33
- try {
34
- await fs.access(path.join(publicDir, FONTS_CSS_FILENAME));
35
- hasFontsCss = true;
36
- }
37
- catch {
38
- // No generated font CSS — fonts come from @fontsource CSS imports (Vite)
39
- }
40
- if (entries.length === 0 && !hasFontsCss)
26
+ // Not generated: the theme uses no framework font
41
27
  return null;
42
- return (_jsxs(_Fragment, { children: [hasFontsCss && _jsx("link", { rel: "stylesheet", href: `/${FONTS_CSS_FILENAME}` }), entries.map((e) => (_jsx("link", { rel: "preload", as: "font", href: e.href, type: e.type ?? 'font/woff2', crossOrigin: "anonymous" }, e.href)))] }));
28
+ }
29
+ return _jsx("link", { rel: "stylesheet", href: `/${FONTS_CSS_FILENAME}` });
43
30
  }
44
31
  export default FontPreloadLinks;
@@ -11,6 +11,8 @@ export interface FooterCopyrightProps {
11
11
  *
12
12
  * Uses useTranslation internally, so it re-renders when language changes.
13
13
  * If appName not provided, reads from app config automatically.
14
+ * Renders nothing when the app has no footer (`app.footer: null`), as DnDevFooter,
15
+ * including in presets that show it in the sidebar.
14
16
  *
15
17
  * @version 0.1.0
16
18
  * @since 0.0.1
@@ -1 +1 @@
1
- {"version":3,"file":"FooterCopyright.d.ts","sourceRoot":"","sources":["../../../../../src/internal/layout/components/footer/FooterCopyright.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAqBrE,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"FooterCopyright.d.ts","sourceRoot":"","sources":["../../../../../src/internal/layout/components/footer/FooterCopyright.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAuBrE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -15,6 +15,8 @@ import { useTranslation, useAppConfig } from '@donotdev/core';
15
15
  *
16
16
  * Uses useTranslation internally, so it re-renders when language changes.
17
17
  * If appName not provided, reads from app config automatically.
18
+ * Renders nothing when the app has no footer (`app.footer: null`), as DnDevFooter,
19
+ * including in presets that show it in the sidebar.
18
20
  *
19
21
  * @version 0.1.0
20
22
  * @since 0.0.1
@@ -24,6 +26,8 @@ export const FooterCopyright = ({ appName, year = new Date().getFullYear(), clas
24
26
  const { t } = useTranslation('dndev');
25
27
  const app = useAppConfig('app');
26
28
  const resolvedAppName = appName || app?.name || 'App';
29
+ if (app?.footer === null)
30
+ return null;
27
31
  return (_jsxs("span", { className: cn(className), style: {
28
32
  flexShrink: 0,
29
33
  color: 'var(--muted-foreground)',
@@ -5,7 +5,8 @@ export interface FooterLegalLink {
5
5
  }
6
6
  /**
7
7
  * Returns the configured legal links for the footer.
8
- * Handles the logic: null = hide, undefined = defaults, array = custom
8
+ * Handles the logic: `footer: null` or `legalLinks: null` = hide, undefined = defaults,
9
+ * array = custom
9
10
  *
10
11
  * @remarks Not a hook — no React state or effects. Named with `get` prefix.
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useLegalLinks.d.ts","sourceRoot":"","sources":["../../../../../src/internal/layout/components/footer/useLegalLinks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAQD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,WAAW,CAAC,QAAQ,CAAC,KAClC,eAAe,EAQjB,CAAC"}
1
+ {"version":3,"file":"useLegalLinks.d.ts","sourceRoot":"","sources":["../../../../../src/internal/layout/components/footer/useLegalLinks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAQD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,WAAW,CAAC,QAAQ,CAAC,KAClC,eAAe,EAQjB,CAAC"}
@@ -6,13 +6,14 @@ const DEFAULT_LINKS = [
6
6
  ];
7
7
  /**
8
8
  * Returns the configured legal links for the footer.
9
- * Handles the logic: null = hide, undefined = defaults, array = custom
9
+ * Handles the logic: `footer: null` or `legalLinks: null` = hide, undefined = defaults,
10
+ * array = custom
10
11
  *
11
12
  * @remarks Not a hook — no React state or effects. Named with `get` prefix.
12
13
  */
13
14
  export const getLegalLinks = (footerConfig) => {
14
- // If explicitly null, return empty array (hidden)
15
- if (footerConfig?.legalLinks === null) {
15
+ // No footer at all, or links explicitly null: hidden (also in presets that show them in the sidebar)
16
+ if (footerConfig === null || footerConfig?.legalLinks === null) {
16
17
  return [];
17
18
  }
18
19
  // Use configured links or defaults
@@ -1 +1 @@
1
- {"version":3,"file":"i18nSeoMeta.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/i18nSeoMeta.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAUzC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,EACtB,CAAC,EAAE,SAAS,GACX,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAkBrE"}
1
+ {"version":3,"file":"i18nSeoMeta.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/i18nSeoMeta.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAUzC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,EACtB,CAAC,EAAE,SAAS,GACX,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAmBrE"}
@@ -39,6 +39,7 @@ export function resolveSeoField(seoValue, translationKey, t) {
39
39
  * @author AMBROISE PARK Consulting
40
40
  */
41
41
  export function readI18nSeoMeta(t, ns) {
42
+ // why: TFunction is an i18next overload set; a single-signature wrapper cannot satisfy it structurally
42
43
  const translateOrEmpty = ((key) => t(key, EMPTY_WHEN_MISSING));
43
44
  const field = (name) => translateOrEmpty(`${ns}:meta.${name}`) || undefined;
44
45
  const keywords = translateArray(translateOrEmpty, `${ns}:meta.keywords`, MAX_KEYWORDS);
@@ -16,7 +16,7 @@ import { ChevronUp, Menu } from 'lucide-react';
16
16
  import { memo, useState, useEffect } from 'react';
17
17
  import { Stack, Button, Sheet, BUTTON_VARIANT, Separator, SEPARATOR_VARIANT, } from '@donotdev/components';
18
18
  import { useTranslation } from '@donotdev/core';
19
- import { useLocation } from '@donotdev/ui/routing/hooks';
19
+ import { useRoutePath } from '@donotdev/ui/routing/hooks';
20
20
  /**
21
21
  * DnDevMergedBar - Mobile navigation zone
22
22
  *
@@ -39,11 +39,11 @@ function DnDevMergedBarComponent({ position, height, trigger, top, content, bott
39
39
  // For RTL apps, this would need Sheet to support 'start'/'end' sides — tracked separately.
40
40
  const sheetSide = position === 'top' ? 'left' : position;
41
41
  const [open, setOpen] = useState(false);
42
- const location = useLocation();
42
+ const pathname = useRoutePath();
43
43
  // Close sheet when route changes
44
44
  useEffect(() => {
45
45
  setOpen(false);
46
- }, [location.pathname]);
46
+ }, [pathname]);
47
47
  // Build sheet content
48
48
  const sheetNode = (_jsxs(Stack, { direction: "column", className: "merged-bar-sheet-content", children: [top && (_jsxs(_Fragment, { children: [top, _jsx(Separator, { variant: SEPARATOR_VARIANT.MUTED })] })), content && _jsx("div", { className: "merged-bar-sheet-scroll", children: content }), bottom && (_jsxs(_Fragment, { children: [_jsx(Separator, { variant: SEPARATOR_VARIANT.MUTED }), bottom] }))] }));
49
49
  const triggerButton = (_jsx(Button, { variant: BUTTON_VARIANT.GHOST, icon: Icon, "aria-label": "Open navigation" }));
@@ -1,11 +1,3 @@
1
- /**
2
- * @fileoverview UIProviders component
3
- * @description Provides wrapper to basic UI components
4
- *
5
- * @version 0.1.0
6
- * @since 0.0.1
7
- * @author AMBROISE PARK Consulting
8
- */
9
1
  import type { ReactNode, ReactElement } from 'react';
10
2
  interface UIProvidersProps {
11
3
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"UIProviders.d.ts","sourceRoot":"","sources":["../../../src/internal/providers/UIProviders.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,OAAO,CAAC;AAcrE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,YAAY,CAUxE"}
1
+ {"version":3,"file":"UIProviders.d.ts","sourceRoot":"","sources":["../../../src/internal/providers/UIProviders.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,OAAO,CAAC;AA6DrE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,YAAY,CAiBxE"}
@@ -1,12 +1,55 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { TooltipProvider, Toaster, Dialog } from '@donotdev/components';
3
+ // packages/ui/src/internal/providers/UIProviders.tsx
4
+ /**
5
+ * @fileoverview UIProviders component
6
+ * @description Provides wrapper to basic UI components
7
+ *
8
+ * @version 0.1.0
9
+ * @since 0.0.1
10
+ * @author AMBROISE PARK Consulting
11
+ */
12
+ import { useEffect, useRef, useState } from 'react';
13
+ import { Dialog, LinkRendererProvider, Toaster, TooltipProvider, } from '@donotdev/components';
4
14
  import { useOverlayStore } from '@donotdev/core';
15
+ // Platform-specific hooks via conditional exports
16
+ import { useNavigate, useRoutePath } from '@donotdev/ui/routing/hooks';
17
+ import { FormNavigationProvider, isCrudModuleAvailable } from '../../crud/crudImports';
18
+ import { Link } from '../../routing/Link';
19
+ import { getParentRoutePath } from '../../routing/parentRoute';
20
+ import { useAllRoutes } from '../../routing/useRouteDiscovery';
5
21
  import DnDevErrorBoundary from '../common/DnDevErrorBoundary';
6
22
  import GlobalErrorFallback from '../common/GlobalErrorFallback';
23
+ /** Router link for components' `href` props (Card): Next Link or react-router Link. */
24
+ function RouterLinkRenderer({ href, ...rest }) {
25
+ return _jsx(Link, { path: href, ...rest });
26
+ }
7
27
  function UIGlobalErrorFallback(props) {
8
28
  return _jsx(GlobalErrorFallback, { ...props });
9
29
  }
30
+ /**
31
+ * Fills crud's form navigation placeholder with the app router, so
32
+ * `useEntityForm` can leave for the previous breadcrumb on save.
33
+ * Functions read the latest route at call time; the context value never
34
+ * changes, so forms do not re-render on navigation because of it.
35
+ */
36
+ function FormNavigationBridge({ children }) {
37
+ const navigate = useNavigate();
38
+ const pathname = useRoutePath();
39
+ const routes = useAllRoutes();
40
+ const latest = useRef({ navigate, pathname, routes });
41
+ useEffect(() => {
42
+ latest.current = { navigate, pathname, routes };
43
+ });
44
+ const [value] = useState(() => ({
45
+ navigate: (path) => {
46
+ void latest.current.navigate(path);
47
+ },
48
+ currentPath: () => latest.current.pathname,
49
+ parentPath: () => getParentRoutePath(latest.current.pathname, new Set(latest.current.routes.map((route) => route.path))),
50
+ }));
51
+ return _jsx(FormNavigationProvider, { value: value, children: children });
52
+ }
10
53
  /**
11
54
  * Provides a wrapper to basic UI components
12
55
  *
@@ -15,7 +58,7 @@ function UIGlobalErrorFallback(props) {
15
58
  * @author AMBROISE PARK Consulting
16
59
  */
17
60
  export function UIProviders({ children }) {
18
- return (_jsx(DnDevErrorBoundary, { level: "app", fallback: UIGlobalErrorFallback, children: _jsxs(TooltipProvider, { children: [children, _jsx(Toaster, {}), _jsx(ModalDialog, {})] }) }));
61
+ return (_jsx(DnDevErrorBoundary, { level: "app", fallback: UIGlobalErrorFallback, children: _jsx(LinkRendererProvider, { value: RouterLinkRenderer, children: _jsxs(TooltipProvider, { children: [isCrudModuleAvailable ? (_jsx(FormNavigationBridge, { children: children })) : (children), _jsx(Toaster, {}), _jsx(ModalDialog, {})] }) }) }));
19
62
  }
20
63
  /**
21
64
  * ModalDialog - Renders modal dialog using store directly
@@ -4,9 +4,13 @@ import type { AppProvidersProps } from '@donotdev/core';
4
4
  *
5
5
  * Clean provider hierarchy with configuration via context (no prop drilling).
6
6
  *
7
+ * Language: the URL's with 2+ languages (one URL per language), else the request's
8
+ * (`serverCookies` / `acceptLanguage`). Language switchers navigate client-side to the
9
+ * other language's URL (LanguageNavigationProvider, Next router).
10
+ *
7
11
  * Provider hierarchy:
8
12
  * 1. AppConfigProvider (configuration context)
9
- * 2. HelmetProvider (head management)
13
+ * 2. AutoMetaTags (SEO head, server-rendered; no Helmet on Next)
10
14
  * 3. NextJsStoresInitializer (store setup, SSR-safe)
11
15
  * 4. QueryProviders (React Query)
12
16
  * 5. UIProviders (design system)
@@ -1 +1 @@
1
- {"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAuDxD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,+BAuFhE"}
1
+ {"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AAuF1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,+BA0FhE"}
@@ -9,13 +9,16 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
9
9
  * @since 0.0.1
10
10
  * @author AMBROISE PARK Consulting
11
11
  */
12
+ import { useRouter } from 'next/navigation';
12
13
  import { lazy, Suspense, useEffect, useMemo, useState } from 'react';
13
14
  import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental';
14
- import { AppConfigProvider, AuthSessionProvider, getProvider, getRequestLanguage, hasProvider, QueryProviders, RequestLanguageProvider, } from '@donotdev/core';
15
+ import { AppConfigProvider, AuthSessionProvider, getI18nInstance, getLanguageRouting, getProvider, getRequestLanguage, hasProvider, isMultilingual, LanguageNavigationProvider, QueryProviders, RequestLanguageProvider, } from '@donotdev/core';
15
16
  import { useConsent } from '@donotdev/core';
17
+ // Platform-specific hooks via conditional exports
18
+ import { useUrlLanguage } from '@donotdev/ui/routing/hooks';
16
19
  import { NextJsStoresInitializer } from '../internal/initializers/NextJsStoresInitializer';
20
+ import { AutoMetaTags } from '../internal/layout/components/AutoMetaTags';
17
21
  import FaviconHead from '../internal/layout/components/FaviconHead';
18
- import PerformanceHints from '../internal/layout/components/PerformanceHints';
19
22
  import { DnDevLayout } from '../internal/layout/DnDevLayout';
20
23
  import { SentryInitializer } from '../internal/providers/SentryInitializer';
21
24
  import { UIProviders } from '../internal/providers/UIProviders';
@@ -48,6 +51,29 @@ function ConsentBanner() {
48
51
  }
49
52
  return (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsent, {}) }));
50
53
  }
54
+ /**
55
+ * Language of the render. 2+ languages: the URL's (`/en/…`, the default language at
56
+ * the root; the generated proxy already moved a first visit to the visitor's
57
+ * language). One language: from the request headers (language cookie >
58
+ * Accept-Language > fallback). Same inputs on the server and in the hydration pass.
59
+ */
60
+ function useRenderLanguage(serverCookies, acceptLanguage) {
61
+ const urlLanguage = useUrlLanguage();
62
+ const multilingual = isMultilingual(getLanguageRouting().languages);
63
+ const requestLanguage = useMemo(() => getRequestLanguage(serverCookies, acceptLanguage), [serverCookies, acceptLanguage]);
64
+ return multilingual ? urlLanguage : requestLanguage;
65
+ }
66
+ /**
67
+ * The live i18n instance follows the render language: a language switch navigates
68
+ * client-side to the other language's URL, and the page re-renders in it.
69
+ */
70
+ function useFollowLanguage(language) {
71
+ useEffect(() => {
72
+ const instance = getI18nInstance();
73
+ if (instance.language !== language)
74
+ void instance.changeLanguage(language);
75
+ }, [language]);
76
+ }
51
77
  /** Auth session snapshot of the request, `null` when the auth provider cannot tell. */
52
78
  function readAuthSnapshot(cookieHeader) {
53
79
  if (cookieHeader === undefined || !hasProvider('auth'))
@@ -56,9 +82,13 @@ function readAuthSnapshot(cookieHeader) {
56
82
  }
57
83
  export function NextJsAppProviders(props) {
58
84
  const { config = {}, layout, children, serverCookies, acceptLanguage, customStores, } = props;
59
- // Same header values on the server and in the hydration pass → same language and
60
- // signed-in state on both, so the first paint is final (no keys, no auth swap).
61
- const requestLanguage = useMemo(() => getRequestLanguage(serverCookies, acceptLanguage), [serverCookies, acceptLanguage]);
85
+ // Same URL and header values on the server and in the hydration pass → same language
86
+ // and signed-in state on both, so the first paint is final (no keys, no auth swap).
87
+ const language = useRenderLanguage(serverCookies, acceptLanguage);
88
+ useFollowLanguage(language);
89
+ // Language switchers (core) open the other language's URL through the Next router
90
+ const router = useRouter();
91
+ const navigateToLanguage = (url) => router.push(url, { scroll: false });
62
92
  const authSnapshot = useMemo(() => readAuthSnapshot(serverCookies), [serverCookies]);
63
93
  // SSR is the default for Next apps: render the provider tree on the server so
64
94
  // page content is present in the initial HTML (crawlable, real SSR). An app
@@ -73,5 +103,5 @@ export function NextJsAppProviders(props) {
73
103
  if (!ssr && !isMounted) {
74
104
  return _jsx(_Fragment, { children: children });
75
105
  }
76
- return (_jsx(RequestLanguageProvider, { language: requestLanguage, children: _jsx(AuthSessionProvider, { snapshot: authSnapshot, children: _jsxs(AppConfigProvider, { config: config, platform: "nextjs", children: [_jsx(SentryInitializer, {}), _jsxs(NextJsStoresInitializer, { serverCookies: serverCookies, customStores: customStores, children: [_jsx(FaviconHead, {}), _jsx(PerformanceHints, {}), _jsx(QueryProviders, { children: _jsx(ReactQueryStreamedHydration, { children: _jsxs(UIProviders, { children: [_jsx(DnDevLayout, { layout: layout, children: children }), _jsx(ConsentBanner, {}), _jsx(AuthReturnTo, {}), _jsx(PasswordResetCallback, {}), _jsx(Suspense, { fallback: null, children: _jsx(PWAUpdateNotification, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(RedirectOverlay, {}) })] }) }) })] })] }) }) }));
106
+ return (_jsx(RequestLanguageProvider, { language: language, children: _jsx(LanguageNavigationProvider, { navigate: navigateToLanguage, children: _jsx(AuthSessionProvider, { snapshot: authSnapshot, children: _jsxs(AppConfigProvider, { config: config, platform: "nextjs", children: [_jsx(SentryInitializer, {}), _jsxs(NextJsStoresInitializer, { serverCookies: serverCookies, customStores: customStores, children: [_jsx(FaviconHead, {}), _jsx(QueryProviders, { children: _jsx(ReactQueryStreamedHydration, { children: _jsxs(UIProviders, { children: [_jsx(AutoMetaTags, {}), _jsx(DnDevLayout, { layout: layout, children: children }), _jsx(ConsentBanner, {}), _jsx(AuthReturnTo, {}), _jsx(PasswordResetCallback, {}), _jsx(Suspense, { fallback: null, children: _jsx(PWAUpdateNotification, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(RedirectOverlay, {}) })] }) }) })] })] }) }) }) }));
77
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ViteAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/ViteAppProviders.tsx"],"names":[],"mappings":"AAcA,OAAO,aAAa,CAAC;AACrB,OAAO,gBAAgB,CAAC;AACxB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA2BxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,+BAmCxD"}
1
+ {"version":3,"file":"ViteAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/ViteAppProviders.tsx"],"names":[],"mappings":"AAcA,OAAO,aAAa,CAAC;AACrB,OAAO,gBAAgB,CAAC;AACxB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AAUxB,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AAoC1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,+BA4DxD"}
@@ -8,14 +8,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
- import { lazy, Suspense, useMemo } from 'react';
11
+ import { lazy, Suspense, useEffect, useMemo, useRef, useState } from 'react';
12
12
  // Import virtual modules to populate globalThis._DNDEV_CONFIG_ before any components load
13
13
  import 'virtual:env';
14
14
  import 'virtual:themes';
15
15
  import 'virtual:i18n-mapping';
16
16
  import 'virtual:routes';
17
17
  import 'virtual:assets';
18
- import { AppConfigProvider } from '@donotdev/core';
18
+ import { AppConfigProvider, applyFirstVisitLanguage, getI18nInstance, getLanguageRouting, getUrlLanguage, LanguageNavigationProvider, } from '@donotdev/core';
19
19
  import { ViteStoresInitializer } from '../internal/initializers/ViteStoresInitializer';
20
20
  import { NavigationProvider } from '../internal/providers/NavigationProvider';
21
21
  import { SentryInitializer } from '../internal/providers/SentryInitializer';
@@ -30,9 +30,19 @@ const HelmetProvider = lazy(() => import('react-helmet-async').then((m) => ({ de
30
30
  const FaviconHead = lazy(() => import('../internal/layout/components/FaviconHead').then((m) => ({
31
31
  default: m.default,
32
32
  })));
33
- const PerformanceHints = lazy(() => import('../internal/layout/components/PerformanceHints').then((m) => ({
34
- default: m.default,
35
- })));
33
+ /** Language of the browser URL (prefix, else the default language). */
34
+ function currentUrlLanguage() {
35
+ return getUrlLanguage(window.location.pathname);
36
+ }
37
+ /** Stop the history listener of a router replaced by a language switch. */
38
+ function useDisposeReplacedRouter(router) {
39
+ const previous = useRef(router);
40
+ useEffect(() => {
41
+ if (previous.current !== router)
42
+ previous.current.dispose();
43
+ previous.current = router;
44
+ }, [router]);
45
+ }
36
46
  /**
37
47
  * ViteAppProviders - Vite platform-specific app providers
38
48
  *
@@ -77,6 +87,31 @@ export function ViteAppProviders(props) {
77
87
  // Virtual modules are loaded at module level (lines 20-26), so routes are available
78
88
  // HomePage.tsx is automatically assigned path "/" by RouteDiscovery convention
79
89
  // Memoized so the router instance is stable across re-renders (Item 86)
80
- const router = useMemo(() => createAppRouter({ routeGroups, layout }), [routeGroups, layout]);
81
- return (_jsxs(AppConfigProvider, { config: config, platform: "vite", children: [_jsx(SentryInitializer, {}), _jsx(ViteStoresInitializer, { customStores: customStores, children: _jsx(Suspense, { fallback: null, children: _jsxs(HelmetProvider, { children: [_jsx(FaviconHead, {}), _jsx(PerformanceHints, {}), _jsx(NavigationProvider, { router: router })] }) }) })] }));
90
+ // The router runs under the URL's language prefix (createAppRouter basename). A
91
+ // language switch moves the URL to the other language's prefix and recreates the
92
+ // router under it: client-side, no document reload.
93
+ const [urlLanguage, setUrlLanguage] = useState(currentUrlLanguage);
94
+ const router = useMemo(() => createAppRouter({ routeGroups, layout }),
95
+ // urlLanguage: a new router (new basename) per URL language
96
+ [routeGroups, layout, urlLanguage]);
97
+ useDisposeReplacedRouter(router);
98
+ // Back/forward across languages: the router of the other prefix takes over
99
+ useEffect(() => {
100
+ const onPopState = () => {
101
+ // Same rule as a first visit (and as the Next proxy) for an unprefixed URL
102
+ const routing = getLanguageRouting();
103
+ applyFirstVisitLanguage(routing.languages, routing.defaultLanguage);
104
+ const language = currentUrlLanguage();
105
+ void getI18nInstance().changeLanguage(language);
106
+ setUrlLanguage(language);
107
+ };
108
+ window.addEventListener('popstate', onPopState);
109
+ return () => window.removeEventListener('popstate', onPopState);
110
+ }, []);
111
+ const navigateToLanguage = (url, language) => {
112
+ window.history.pushState(null, '', url);
113
+ void getI18nInstance().changeLanguage(language);
114
+ setUrlLanguage(language);
115
+ };
116
+ return (_jsxs(AppConfigProvider, { config: config, platform: "vite", children: [_jsx(SentryInitializer, {}), _jsx(ViteStoresInitializer, { customStores: customStores, children: _jsx(Suspense, { fallback: null, children: _jsxs(HelmetProvider, { children: [_jsx(FaviconHead, {}), _jsx(LanguageNavigationProvider, { navigate: navigateToLanguage, children: _jsx(NavigationProvider, { router: router }) })] }) }) })] }));
82
117
  }
@@ -14,12 +14,19 @@ export declare const meta: PageMeta;
14
14
  * - Full-viewport centered design for professional appearance
15
15
  * - Translation system integration (i18n)
16
16
  * - Dynamic route suggestions from discovered routes
17
+ * - Optional requested-path badge (shown by default for existing consumers)
17
18
  * - Accessible design with proper semantic HTML
18
19
  * - Responsive across all viewports
19
20
  *
21
+ * Legacy errors.notFound keys are compatibility references to the canonical
22
+ * messages.notFound resources. Keep lookups here so legacy app overrides win.
23
+ *
20
24
  * @version 0.1.0
21
25
  * @since 0.0.1
22
26
  * @author AMBROISE PARK Consulting
23
27
  */
24
- export default function NotFoundPage(): import("react").JSX.Element;
28
+ export default function NotFoundPage({ showRequestedPath, }?: {
29
+ /** Display the current route path. Disable for shared, statically generated fallbacks. */
30
+ showRequestedPath?: boolean;
31
+ }): import("react").JSX.Element;
25
32
  //# sourceMappingURL=404.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"404.d.ts","sourceRoot":"","sources":["../../src/routing/404.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS/C;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,QAElB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,gCAyJnC"}
1
+ {"version":3,"file":"404.d.ts","sourceRoot":"","sources":["../../src/routing/404.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS/C;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,QAElB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,iBAAwB,GACzB,GAAE;IACD,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACxB,+BAyJL"}
@@ -14,7 +14,7 @@ import { useMemo } from 'react';
14
14
  import { Button, BUTTON_VARIANT, Stack, Text } from '@donotdev/components';
15
15
  import { useTranslation } from '@donotdev/core';
16
16
  // Platform-specific hooks via conditional exports
17
- import { useLocation, useNavigate } from '@donotdev/ui/routing/hooks';
17
+ import { useNavigate, useRoutePath } from '@donotdev/ui/routing/hooks';
18
18
  import { Link } from './Link';
19
19
  import { useNavigationItems } from './useNavigation';
20
20
  import { Icon } from '../components/common/icon';
@@ -36,16 +36,20 @@ export const meta = {
36
36
  * - Full-viewport centered design for professional appearance
37
37
  * - Translation system integration (i18n)
38
38
  * - Dynamic route suggestions from discovered routes
39
+ * - Optional requested-path badge (shown by default for existing consumers)
39
40
  * - Accessible design with proper semantic HTML
40
41
  * - Responsive across all viewports
41
42
  *
43
+ * Legacy errors.notFound keys are compatibility references to the canonical
44
+ * messages.notFound resources. Keep lookups here so legacy app overrides win.
45
+ *
42
46
  * @version 0.1.0
43
47
  * @since 0.0.1
44
48
  * @author AMBROISE PARK Consulting
45
49
  */
46
- export default function NotFoundPage() {
50
+ export default function NotFoundPage({ showRequestedPath = true, } = {}) {
47
51
  const { t } = useTranslation('dndev');
48
- const location = useLocation();
52
+ const pathname = useRoutePath();
49
53
  const navigate = useNavigate();
50
54
  const navigationItems = useNavigationItems();
51
55
  /**
@@ -83,7 +87,7 @@ export default function NotFoundPage() {
83
87
  color: 'var(--muted-foreground)',
84
88
  textAlign: 'center',
85
89
  margin: 0,
86
- }, children: t('errors.notFound.description', "The page you're looking for doesn't exist or has been moved.") }), location.pathname && (_jsx("code", { style: {
90
+ }, children: t('errors.notFound.description', "The page you're looking for doesn't exist or has been moved.") }), showRequestedPath && pathname && (_jsx("code", { style: {
87
91
  padding: 'var(--gap-sm) var(--gap-md)',
88
92
  background: 'var(--muted)',
89
93
  borderRadius: 'var(--radius-md)',
@@ -95,7 +99,7 @@ export default function NotFoundPage() {
95
99
  overflow: 'hidden',
96
100
  textOverflow: 'ellipsis',
97
101
  border: '1px solid var(--border-hairline)',
98
- }, children: location.pathname }))] }), suggestedRoutes.length > 0 && (_jsxs(Stack, { align: "center", children: [_jsx("p", { className: "dndev-text-base", style: {
102
+ }, children: pathname }))] }), suggestedRoutes.length > 0 && (_jsxs(Stack, { align: "center", children: [_jsx("p", { className: "dndev-text-base", style: {
99
103
  fontSize: 'var(--font-size-md)',
100
104
  fontWeight: 'var(--font-weight-semibold)',
101
105
  margin: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"AuthGuardFallback.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuardFallback.tsx"],"names":[],"mappings":"AA6BA,UAAU,sBAAsB;IAC9B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,cAAqB,EACrB,MAAM,EACN,SAAc,GACf,EAAE,sBAAsB,+BAsHxB;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"AuthGuardFallback.d.ts","sourceRoot":"","sources":["../../src/routing/AuthGuardFallback.tsx"],"names":[],"mappings":"AA6BA,UAAU,sBAAsB;IAC9B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,cAAqB,EACrB,MAAM,EACN,SAAc,GACf,EAAE,sBAAsB,+BAqHxB;AAED,eAAe,iBAAiB,CAAC"}
@@ -14,7 +14,7 @@ import { Card, Button, Separator, Stack, cn } from '@donotdev/components';
14
14
  import { useTranslation } from '@donotdev/core';
15
15
  import { useBreakpoint } from '@donotdev/core';
16
16
  // Platform-specific hooks via conditional exports
17
- import { useLocation, useBack } from '@donotdev/ui/routing/hooks';
17
+ import { useBack } from '@donotdev/ui/routing/hooks';
18
18
  import { PageContainer } from '../components/layout/PageContainer';
19
19
  // Lazy load MultipleAuthProviders to enable code splitting
20
20
  const MultipleAuthProviders = lazy(() => import('@donotdev/auth').then((module) => ({
@@ -33,7 +33,6 @@ const MultipleAuthProviders = lazy(() => import('@donotdev/auth').then((module)
33
33
  */
34
34
  export function AuthGuardFallback({ title, description, showBackButton = true, onBack, className = '', }) {
35
35
  const { t } = useTranslation(['auth', 'common']);
36
- const location = useLocation();
37
36
  const back = useBack();
38
37
  const handleBack = () => {
39
38
  if (onBack) {
@@ -1 +1 @@
1
- {"version":3,"file":"AuthReturnTo.d.ts","sourceRoot":"","sources":["../../src/routing/AuthReturnTo.tsx"],"names":[],"mappings":"AA0BA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,SA8B3B"}
1
+ {"version":3,"file":"AuthReturnTo.d.ts","sourceRoot":"","sources":["../../src/routing/AuthReturnTo.tsx"],"names":[],"mappings":"AA+BA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,SAoC3B"}
@@ -19,6 +19,10 @@ import { useToast } from '@donotdev/components';
19
19
  import { isClient, safeSessionStorage, useTranslation } from '@donotdev/core';
20
20
  import { useNavigate } from '@donotdev/ui/routing/hooks';
21
21
  import { useAuthSafe } from '../utils/useAuthSafe';
22
+ /** A path on this site (`/x`), never `//host` or `https://…` (no open redirect). */
23
+ function isSameOriginPath(value) {
24
+ return value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\');
25
+ }
22
26
  /**
23
27
  * AuthReturnTo - Restores navigation after OAuth redirect.
24
28
  *
@@ -45,11 +49,14 @@ export function AuthReturnTo() {
45
49
  safeSessionStorage.removeItem('dndev.auth.guardToast');
46
50
  toast('warning', t('guard.signInRequired', 'Please sign in to access this page'));
47
51
  }, []);
48
- // Return-to after sign-in
52
+ // Return-to after sign-in: saved by AuthGuard (sessionStorage) or passed as
53
+ // `?returnTo=` by the generated proxy's server redirect. Same-origin paths only.
49
54
  useEffect(() => {
50
55
  if (!user || !isClient())
51
56
  return;
52
- const returnTo = safeSessionStorage.getItem('dndev.auth.returnTo');
57
+ const fromQuery = new URLSearchParams(window.location.search).get('returnTo');
58
+ const returnTo = safeSessionStorage.getItem('dndev.auth.returnTo') ??
59
+ (fromQuery && isSameOriginPath(fromQuery) ? fromQuery : null);
53
60
  if (!returnTo)
54
61
  return;
55
62
  safeSessionStorage.removeItem('dndev.auth.returnTo');
@@ -11,12 +11,6 @@ export interface GoToProps {
11
11
  /** Optional callback called after opening command dialog (e.g., to close parent dropdown) */
12
12
  onOpen?: () => void;
13
13
  }
14
- /**
15
- * GoTo - Command palette trigger button
16
- *
17
- * Simple button: Search icon + "Go to" label + keyboard shortcut.
18
- * Opens command dialog on click.
19
- */
20
14
  export declare const GoTo: ({ display, className, onOpen, }: GoToProps) => import("react").JSX.Element;
21
15
  export default GoTo;
22
16
  //# sourceMappingURL=GoTo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GoTo.d.ts","sourceRoot":"","sources":["../../src/routing/GoTo.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGvE,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,iCAIlB,SAAS,gCA0CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"GoTo.d.ts","sourceRoot":"","sources":["../../src/routing/GoTo.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGvE,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAkBD,eAAO,MAAM,IAAI,GAAI,iCAIlB,SAAS,gCAyCX,CAAC;AAEF,eAAe,IAAI,CAAC"}