@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,40 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // packages/ui/src/components/layout/components/header/AppTitle.tsx
3
- /**
4
- * @fileoverview AppTitle component
5
- * @description Simple app title using text-base styling
6
- *
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { cn } from '@donotdev/components';
12
- import { useAppConfig, useBreakpoint } from '@donotdev/core';
13
- import { Link } from '../../../../routing/Link';
14
- /**
15
- * AppTitle - Simple app title using text-base xl
16
- * Automatically gets app name from AppConfig if title not provided
17
- *
18
- * @version 0.1.0
19
- * @since 0.0.1
20
- * @author AMBROISE PARK Consulting
21
- */
22
- export const AppTitle = ({ title, className, linkToHome = true, }) => {
23
- const isMobileOrTablet = useBreakpoint('isMobileOrTablet');
24
- const appName = useAppConfig('name');
25
- const appShortName = useAppConfig('shortName');
26
- const displayTitle = title || (isMobileOrTablet ? appShortName || appName : appName) || 'App';
27
- const content = (_jsx("div", { className: cn('dndev-text-base', className), style: {
28
- fontSize: 'var(--font-size-xl)',
29
- fontWeight: 700,
30
- overflow: 'hidden',
31
- textOverflow: 'ellipsis',
32
- whiteSpace: 'nowrap',
33
- maxWidth: '100%',
34
- }, children: displayTitle }));
35
- if (linkToHome) {
36
- return (_jsx(Link, { path: "/", className: cn('dndev-inline-block', className), children: content }));
37
- }
38
- return content;
39
- };
40
- export default AppTitle;
1
+ "use client";import{cn as i}from"@donotdev/components";import{useAppConfig as n,useBreakpoint as m}from"@donotdev/core";import{Link as f}from"../../../../routing/Link.js";import{jsx as p}from"react/jsx-runtime";var d=({title:r,className:e,linkToHome:s=!0})=>{let l=m("isMobileOrTablet"),t=n("name"),a=n("shortName"),c=r||l&&a||t||"App",o=p("div",{className:i("dndev-text-base",e),style:{fontSize:"var(--font-size-xl)",fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:c});return s?p(f,{path:"/",className:i("dndev-inline-block",e),children:o}):o},T=d;export{d as AppTitle,T as default};
@@ -1,225 +1 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // packages/ui/src/components/layout/components/header/CacheSettings.tsx
4
- /**
5
- * @fileoverview CacheSettings component
6
- * @description Cache settings component for clearing various caches
7
- *
8
- * @version 0.1.0
9
- * @since 0.0.1
10
- * @author AMBROISE PARK Consulting
11
- */
12
- import { Trash2 } from 'lucide-react';
13
- import { useState } from 'react';
14
- import { Button, BUTTON_VARIANT, Checkbox, Stack, useToast, } from '@donotdev/components';
15
- import { useTranslation } from '@donotdev/core';
16
- // Platform-specific hooks via conditional exports
17
- import { useRefresh } from '@donotdev/ui/routing/hooks';
18
- const legacyGlobals = globalThis;
19
- /**
20
- * CacheSettings - Cache settings component for clearing various caches
21
- *
22
- * Provides UI for clearing browser caches including localStorage, sessionStorage,
23
- * cookies, IndexedDB, and service worker caches.
24
- *
25
- * @version 0.1.0
26
- * @since 0.0.1
27
- * @author AMBROISE PARK Consulting
28
- */
29
- function CacheSettings() {
30
- const { t } = useTranslation('dndev');
31
- const { toast } = useToast();
32
- const [isClearing, setIsClearing] = useState(false);
33
- const refresh = useRefresh();
34
- // Simple local state - no need for global store
35
- const [cacheOptions, setCacheOptions] = useState({
36
- localStorage: true,
37
- sessionStorage: true,
38
- applicationCache: true,
39
- serviceWorker: true,
40
- cookies: true,
41
- indexedDB: true,
42
- webSQL: true,
43
- memoryCache: true,
44
- });
45
- const clearSelectedCache = async () => {
46
- try {
47
- setIsClearing(true);
48
- const clearedItems = [];
49
- // Clear localStorage
50
- if (cacheOptions.localStorage && typeof window !== 'undefined') {
51
- try {
52
- localStorage.clear();
53
- clearedItems.push('localStorage');
54
- }
55
- catch (err) {
56
- console.error('Failed to clear localStorage:', err);
57
- }
58
- }
59
- // Clear sessionStorage
60
- if (cacheOptions.sessionStorage && typeof window !== 'undefined') {
61
- try {
62
- sessionStorage.clear();
63
- clearedItems.push('sessionStorage');
64
- }
65
- catch (err) {
66
- console.error('Failed to clear sessionStorage:', err);
67
- }
68
- }
69
- // Clear IndexedDB
70
- if (cacheOptions.indexedDB &&
71
- typeof window !== 'undefined' &&
72
- 'indexedDB' in window) {
73
- try {
74
- // Get all databases and delete them
75
- if ('databases' in indexedDB) {
76
- const databases = await indexedDB.databases();
77
- await Promise.all(databases.map(async (db) => {
78
- if (db.name) {
79
- const deleteReq = indexedDB.deleteDatabase(db.name);
80
- await new Promise((resolve, reject) => {
81
- deleteReq.onsuccess = () => resolve(undefined);
82
- deleteReq.onerror = () => reject(deleteReq.error);
83
- });
84
- }
85
- }));
86
- }
87
- clearedItems.push('IndexedDB');
88
- }
89
- catch (err) {
90
- console.error('Failed to clear IndexedDB:', err);
91
- }
92
- }
93
- if (cacheOptions.webSQL &&
94
- typeof window !== 'undefined' &&
95
- 'openDatabase' in window &&
96
- typeof legacyGlobals.openDatabase === 'function') {
97
- try {
98
- const db = legacyGlobals.openDatabase('', '', '', '');
99
- if (db && db.transaction) {
100
- db.transaction((tx) => {
101
- tx.executeSql('SELECT name FROM sqlite_master WHERE type="table"', [], (tx, results) => {
102
- for (let i = 0; i < results.rows.length; i++) {
103
- const tableName = results.rows.item(i).name;
104
- if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(tableName)) {
105
- tx.executeSql(`DROP TABLE IF EXISTS ${tableName}`);
106
- }
107
- }
108
- });
109
- });
110
- }
111
- clearedItems.push('WebSQL');
112
- }
113
- catch (err) {
114
- console.error('Failed to clear WebSQL:', err);
115
- }
116
- }
117
- // Clear Application Cache API
118
- if (cacheOptions.applicationCache &&
119
- typeof window !== 'undefined' &&
120
- 'caches' in window) {
121
- try {
122
- const keys = await caches.keys();
123
- await Promise.all(keys.map(async (key) => {
124
- try {
125
- await caches.delete(key);
126
- }
127
- catch (err) {
128
- console.error(`Failed to delete cache ${key}:`, err);
129
- }
130
- }));
131
- clearedItems.push('Application Cache');
132
- }
133
- catch (err) {
134
- console.error('Failed to clear application cache:', err);
135
- }
136
- }
137
- // Clear Service Workers
138
- if (cacheOptions.serviceWorker && 'serviceWorker' in navigator) {
139
- try {
140
- const registrations = await navigator.serviceWorker.getRegistrations();
141
- await Promise.all(registrations.map(async (reg) => {
142
- try {
143
- await reg.unregister();
144
- }
145
- catch (err) {
146
- console.error('Failed to unregister service worker:', err);
147
- }
148
- }));
149
- clearedItems.push('Service Workers');
150
- }
151
- catch (err) {
152
- console.error('Failed to clear service workers:', err);
153
- }
154
- }
155
- // Clear cookies
156
- if (cacheOptions.cookies) {
157
- try {
158
- // Clear all cookies for current domain
159
- document.cookie.split(';').forEach((cookie) => {
160
- const eqPos = cookie.indexOf('=');
161
- const name = eqPos > -1 ? cookie.slice(0, eqPos) : cookie;
162
- document.cookie = `${name.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
163
- document.cookie = `${name.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`;
164
- document.cookie = `${name.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`;
165
- });
166
- clearedItems.push('Cookies');
167
- }
168
- catch (err) {
169
- console.error('Failed to clear cookies:', err);
170
- }
171
- }
172
- // Clear memory cache (force garbage collection if available)
173
- if (cacheOptions.memoryCache) {
174
- try {
175
- // Force garbage collection if available (Chrome DevTools)
176
- if ('gc' in window && typeof legacyGlobals.gc === 'function') {
177
- legacyGlobals.gc();
178
- }
179
- clearedItems.push('Memory Cache');
180
- }
181
- catch (err) {
182
- console.error('Failed to clear memory cache:', err);
183
- }
184
- }
185
- const successMessage = clearedItems.length > 0
186
- ? t('settings.clearCache.success', 'Cache cleared successfully: {{items}}', {
187
- items: clearedItems.join(', '),
188
- })
189
- : t('settings.clearCache.noItemsCleared', 'No cache items were cleared');
190
- toast('success', successMessage);
191
- // Reload if any significant caches were cleared
192
- if (clearedItems.length > 0) {
193
- setTimeout(() => {
194
- // Clear store registry (DEV mode: HMR preserves globalThis, prevents re-init)
195
- if (typeof globalThis !== 'undefined' && globalThis._DNDEV_STORES_) {
196
- globalThis._DNDEV_STORES_ = {};
197
- }
198
- // Force hard reload (bypasses HMR)
199
- if (typeof window !== 'undefined') {
200
- window.location.href = window.location.href;
201
- }
202
- else {
203
- refresh();
204
- }
205
- }, 1000);
206
- }
207
- }
208
- catch (error) {
209
- console.error('Error clearing cache:', error);
210
- toast('error', t('settings.clearCache.error', 'Error clearing cache'));
211
- }
212
- finally {
213
- setIsClearing(false);
214
- }
215
- };
216
- return (_jsxs(Stack, { children: [_jsx(Stack, { children: Object.entries(cacheOptions).map(([key, checked]) => (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Checkbox, { id: key, checked: checked, onCheckedChange: (checked) => setCacheOptions((prev) => ({ ...prev, [key]: !!checked })) }), _jsx("label", { htmlFor: key, style: {
217
- fontSize: 'var(--font-size-sm)',
218
- fontWeight: 500,
219
- lineHeight: 1,
220
- cursor: 'pointer',
221
- }, children: t(`settings.clearCache.${key}`, key.charAt(0).toUpperCase() + key.slice(1)) })] }, key))) }), _jsx(Button, { variant: BUTTON_VARIANT.DESTRUCTIVE, style: { margin: '0 auto' }, disabled: isClearing || !Object.values(cacheOptions).some(Boolean), onClick: clearSelectedCache, icon: Trash2, children: isClearing
222
- ? t('settings.clearCache.clearing', 'Clearing...')
223
- : t('settings.clearCache.button', 'Clear Cache') })] }));
224
- }
225
- export default CacheSettings;
1
+ "use client";import{Trash2 as C}from"lucide-react";import{useState as p}from"react";import{Button as T,BUTTON_VARIANT as k,Checkbox as D,Stack as h,useToast as v}from"@donotdev/components";import{useTranslation as x}from"@donotdev/core";import{useRefresh as W}from"@donotdev/ui/routing/hooks";import{jsx as l,jsxs as w}from"react/jsx-runtime";var c=globalThis;function B(){let{t:s}=x("dndev"),{toast:u}=v(),[g,m]=p(!1),S=W(),[o,b]=p({localStorage:!0,sessionStorage:!0,applicationCache:!0,serviceWorker:!0,cookies:!0,indexedDB:!0,webSQL:!0,memoryCache:!0}),y=async()=>{try{m(!0);let r=[];if(o.localStorage&&typeof window<"u")try{localStorage.clear(),r.push("localStorage")}catch{}if(o.sessionStorage&&typeof window<"u")try{sessionStorage.clear(),r.push("sessionStorage")}catch{}if(o.indexedDB&&typeof window<"u"&&"indexedDB"in window)try{if("databases"in indexedDB){let e=await indexedDB.databases();await Promise.all(e.map(async a=>{if(a.name){let t=indexedDB.deleteDatabase(a.name);await new Promise((n,i)=>{t.onsuccess=()=>n(void 0),t.onerror=()=>i(t.error)})}}))}r.push("IndexedDB")}catch{}if(o.webSQL&&typeof window<"u"&&"openDatabase"in window&&typeof c.openDatabase=="function")try{let e=c.openDatabase("","","","");e&&e.transaction&&e.transaction(a=>{a.executeSql('SELECT name FROM sqlite_master WHERE type="table"',[],(t,n)=>{for(let i=0;i<n.rows.length;i++){let f=n.rows.item(i).name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(f)&&t.executeSql(`DROP TABLE IF EXISTS ${f}`)}})}),r.push("WebSQL")}catch{}if(o.applicationCache&&typeof window<"u"&&"caches"in window)try{let e=await caches.keys();await Promise.all(e.map(async a=>{try{await caches.delete(a)}catch{}})),r.push("Application Cache")}catch{}if(o.serviceWorker&&"serviceWorker"in navigator)try{let e=await navigator.serviceWorker.getRegistrations();await Promise.all(e.map(async a=>{try{await a.unregister()}catch{}})),r.push("Service Workers")}catch{}if(o.cookies)try{document.cookie.split(";").forEach(e=>{let a=e.indexOf("="),t=a>-1?e.slice(0,a):e;document.cookie=`${t.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`,document.cookie=`${t.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`,document.cookie=`${t.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`}),r.push("Cookies")}catch{}if(o.memoryCache)try{"gc"in window&&typeof c.gc=="function"&&c.gc(),r.push("Memory Cache")}catch{}let d=r.length>0?s("settings.clearCache.success","Cache cleared successfully: {{items}}",{items:r.join(", ")}):s("settings.clearCache.noItemsCleared","No cache items were cleared");u("success",d),r.length>0&&setTimeout(()=>{typeof globalThis<"u"&&globalThis._DNDEV_STORES_&&(globalThis._DNDEV_STORES_={}),typeof window<"u"?window.location.href=window.location.href:S()},1e3)}catch{u("error",s("settings.clearCache.error","Error clearing cache"))}finally{m(!1)}};return w(h,{children:[l(h,{children:Object.entries(o).map(([r,d])=>w(h,{direction:"row",align:"center",gap:"tight",children:[l(D,{id:r,checked:d,onCheckedChange:e=>b(a=>({...a,[r]:!!e}))}),l("label",{htmlFor:r,style:{fontSize:"var(--font-size-sm)",fontWeight:500,lineHeight:1,cursor:"pointer"},children:s(`settings.clearCache.${r}`,r.charAt(0).toUpperCase()+r.slice(1))})]},r))}),l(T,{variant:k.DESTRUCTIVE,style:{margin:"0 auto"},disabled:g||!Object.values(o).some(Boolean),onClick:y,icon:C,children:g?s("settings.clearCache.clearing","Clearing..."):s("settings.clearCache.button","Clear Cache")})]})}var _=B;export{_ as default};
@@ -1 +1 @@
1
- {"version":3,"file":"GameTitle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/GameTitle.tsx"],"names":[],"mappings":"AAoBA,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,GAAI,uBAA+B,cAAc,gCA+EtE,CAAC"}
1
+ {"version":3,"file":"GameTitle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/GameTitle.tsx"],"names":[],"mappings":"AAqBA,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,GAAI,uBAA+B,cAAc,gCA+EtE,CAAC"}
@@ -1,66 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // packages/ui/src/components/layout/components/header/GameTitle.tsx
3
- /**
4
- * @fileoverview Game Title Component
5
- * @description Dynamic title for game preset header. Reads from layout store.
6
- *
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { useTranslation, maybeTranslate, useLayout, useAppConfig, } from '@donotdev/core';
12
- import { Link } from '../../../../routing';
13
- /**
14
- * GameTitle Component
15
- *
16
- * Renders title/subtitle when available (from themeStore), otherwise falls back to app name.
17
- * Used in game preset header center slot.
18
- *
19
- * Non-negotiable: This component is always rendered in the center of game header.
20
- *
21
- * @param props - GameTitle component props
22
- * @returns React component
23
- * @version 0.1.0
24
- * @since 0.0.1
25
- * @author AMBROISE PARK Consulting
26
- */
27
- export const GameTitle = ({ asLink = false, className }) => {
28
- const app = useAppConfig('app');
29
- const titleKey = useLayout('gameTitle');
30
- const subtitleKey = useLayout('gameSubtitle');
31
- const namespace = useLayout('gameNamespace');
32
- const { t } = useTranslation(namespace || 'dndev');
33
- const title = maybeTranslate(t, titleKey ?? undefined);
34
- const subtitle = maybeTranslate(t, subtitleKey ?? undefined);
35
- const appName = app?.name || 'Game';
36
- if (title) {
37
- return (_jsx("div", { className: className, children: _jsxs("div", { style: { textAlign: 'center' }, children: [_jsx("h2", { style: {
38
- fontSize: 'var(--font-size-lg)',
39
- fontWeight: 600,
40
- overflow: 'hidden',
41
- textOverflow: 'ellipsis',
42
- whiteSpace: 'nowrap',
43
- }, children: title }), subtitle && (_jsx("p", { style: {
44
- color: 'var(--muted-foreground)',
45
- fontSize: 'var(--font-size-sm)',
46
- overflow: 'hidden',
47
- textOverflow: 'ellipsis',
48
- whiteSpace: 'nowrap',
49
- }, children: subtitle }))] }) }));
50
- }
51
- const appNameElement = (_jsx("h2", { style: {
52
- fontSize: 'var(--font-size-lg)',
53
- fontWeight: 600,
54
- overflow: 'hidden',
55
- textOverflow: 'ellipsis',
56
- whiteSpace: 'nowrap',
57
- }, children: appName }));
58
- if (asLink) {
59
- return (_jsx(Link, { path: "/", className: className, style: {
60
- fontSize: 'var(--font-size-2xl)',
61
- fontWeight: 700,
62
- transition: 'color var(--dur-fast) ease-out',
63
- }, onMouseEnter: (e) => (e.currentTarget.style.color = 'var(--primary)'), onMouseLeave: (e) => (e.currentTarget.style.color = 'var(--foreground)'), children: appName }));
64
- }
65
- return _jsx("div", { className: className, children: appNameElement });
66
- };
1
+ "use client";import{useTranslation as u,maybeTranslate as l,useLayout as n,useAppConfig as g}from"@donotdev/core";import{Link as h}from"../../../../routing/index.js";import{jsx as e,jsxs as w}from"react/jsx-runtime";var S=({asLink:p=!1,className:t})=>{let f=g("app"),c=n("gameTitle"),d=n("gameSubtitle"),m=n("gameNamespace"),{t:i}=u(m||"dndev"),a=l(i,c??void 0),r=l(i,d??void 0),s=f?.name||"Game";if(a)return e("div",{className:t,children:w("div",{style:{textAlign:"center"},children:[e("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),r&&e("p",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r})]})});let v=e("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s});return p?e(h,{path:"/",className:t,style:{fontSize:"var(--font-size-2xl)",fontWeight:700,transition:"color var(--dur-fast) ease-out"},onMouseEnter:o=>o.currentTarget.style.color="var(--primary)",onMouseLeave:o=>o.currentTarget.style.color="var(--foreground)",children:s}):e("div",{className:t,children:v})};export{S as GameTitle};
@@ -1,75 +1 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- // packages/ui/src/components/layout/components/header/HeaderMenu.tsx
4
- /**
5
- * @fileoverview HeaderMenu component
6
- * @description Header controls inline on laptop and desktop, behind a hamburger below
7
- *
8
- * Features:
9
- * - Children inline from the laptop breakpoint up, in a burger panel below
10
- * - CSS-only switch (HeaderMenu.css): both are in the server HTML, no hydration swap
11
- * - Nested popups (DropdownMenu, Dialog…) open and work from inside the panel
12
- * - Reusable across all layout presets
13
- *
14
- * @version 0.2.0
15
- * @since 0.0.1
16
- * @author AMBROISE PARK Consulting
17
- */
18
- import { Menu } from 'lucide-react';
19
- import { useState } from 'react';
20
- import { Button, BUTTON_VARIANT, Popover, Stack } from '@donotdev/components';
21
- /**
22
- * Whether a click inside the burger panel ends the interaction.
23
- *
24
- * The panel renders its own copy of the children, so closing it unmounts any popup
25
- * they opened. It stays open for a popup trigger (`aria-expanded`: DropdownMenu,
26
- * Dialog, Popover, Select triggers) and for clicks inside a nested dialog, which is
27
- * portaled outside the panel. Any other click (a plain control, a nested menu choice)
28
- * closes it, as a menu item does.
29
- */
30
- function endsInteraction({ target, currentTarget, }) {
31
- if (!(target instanceof Element) || target.closest('[aria-expanded]')) {
32
- return false;
33
- }
34
- if (currentTarget.contains(target))
35
- return true;
36
- return !target.closest('[role="dialog"], [role="alertdialog"]');
37
- }
38
- /**
39
- * HeaderMenu - Header controls that collapse into a hamburger
40
- *
41
- * Renders `children` inline (`display: contents`, so they sit in the parent row with
42
- * its gap) and a hamburger whose panel renders the same children while open. Both are
43
- * in the server HTML; HeaderMenu.css shows the hamburger below the laptop breakpoint
44
- * (1024px, the split of `useBreakpoint('isMobileOrTablet')`) and the inline controls
45
- * from it up. No JS breakpoint, no hydration swap: usable at every width.
46
- *
47
- * The panel is a Popover, not a DropdownMenu: menu items swallow the clicks of the
48
- * controls inside them and keep keyboard focus on the item wrapper, which broke
49
- * nested popups (AuthHeader's provider menu or dialog, LanguageSelector, an account
50
- * DropdownMenu). Labels are forced visible in the panel (.dndev-menu-content).
51
- * The panel sits just above the header, so dialogs and menus opened from it show above it.
52
- *
53
- * @version 0.2.0
54
- * @since 0.0.1
55
- * @author AMBROISE PARK Consulting
56
- *
57
- * @example
58
- * ```tsx
59
- * // Inline on laptop and desktop, burger on mobile and tablet:
60
- * <HeaderMenu>
61
- * <AuthHeader />
62
- * <LanguageSelector />
63
- * <ThemeToggle />
64
- * </HeaderMenu>
65
- * ```
66
- */
67
- export const HeaderMenu = ({ children, className }) => {
68
- const [open, setOpen] = useState(false);
69
- const closeAfterAction = (event) => {
70
- if (endsInteraction(event))
71
- setOpen(false);
72
- };
73
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "dndev-header-menu-inline", children: children }), _jsx("div", { className: "dndev-header-menu-burger", children: _jsx(Popover, { open: open, onOpenChange: setOpen, align: "end", className: "dndev-menu-content dndev-header-menu-panel", trigger: _jsx(Button, { variant: BUTTON_VARIANT.GHOST, icon: Menu, "aria-label": "Menu", className: className }), children: _jsx(Stack, { gap: "none", onClick: closeAfterAction, children: children }) }) })] }));
74
- };
75
- export default HeaderMenu;
1
+ "use client";import{Menu as i}from"lucide-react";import{useState as l}from"react";import{Button as d,BUTTON_VARIANT as c,Popover as u,Stack as m}from"@donotdev/components";import{Fragment as v,jsx as n,jsxs as M}from"react/jsx-runtime";function p({target:e,currentTarget:o}){return!(e instanceof Element)||e.closest("[aria-expanded]")?!1:o.contains(e)?!0:!e.closest('[role="dialog"], [role="alertdialog"]')}var f=({children:e,className:o})=>{let[t,a]=l(!1),r=s=>{p(s)&&a(!1)};return M(v,{children:[n("div",{className:"dndev-header-menu-inline",children:e}),n("div",{className:"dndev-header-menu-burger",children:n(u,{open:t,onOpenChange:a,align:"end",className:"dndev-menu-content dndev-header-menu-panel",trigger:n(d,{variant:c.GHOST,icon:i,"aria-label":"Menu",className:o}),children:n(m,{gap:"none",onClick:r,children:e})})})]})},H=f;export{f as HeaderMenu,H as default};
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/HeaderNavigation.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EACL,OAAO,EAIR,MAAM,sBAAsB,CAAC;AAa9B,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,EAAE,aAAa,CAAC,qBAAqB,CA4E1D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"HeaderNavigation.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/HeaderNavigation.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EACL,OAAO,EAIR,MAAM,sBAAsB,CAAC;AAa9B,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,EAAE,aAAa,CAAC,qBAAqB,CA4E1D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,66 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // packages/ui/src/components/layout/components/header/HeaderNavigation.tsx
3
- /**
4
- * @fileoverview HeaderNavigation Component
5
- * @description Framework-compliant adaptive navigation with progressive disclosure
6
- *
7
- * Features:
8
- * - Uses framework NavigationMenu components
9
- * - Progressive disclosure: shows items inline, hides overflow in dropdown
10
- * - Uses IntersectionObserver to detect overflow
11
- * - "More" dropdown only shows when items overflow
12
- * - Theme-based styling only (no custom CSS)
13
- *
14
- * @version 0.1.0
15
- * @since 0.0.1
16
- * @author AMBROISE PARK Consulting
17
- */
18
- import { MoreHorizontal } from 'lucide-react';
19
- import { Link as LinkIcon } from 'lucide-react';
20
- import { DISPLAY, DropdownMenu, Button, } from '@donotdev/components';
21
- import { cn } from '@donotdev/components';
22
- import { useBreakpoint, useTranslation } from '@donotdev/core';
23
- import { DnDevNavigationMenu } from '../../../../routing/DnDevNavigationMenu';
24
- import { Link } from '../../../../routing/Link';
25
- import { NavigationItemComponent } from '../../../../routing/NavigationItem';
26
- import { useNavigationItems, useNavigationRoute, } from '../../../../routing/useNavigation';
27
- import { Icon } from '../../../common/icon';
28
- /**
29
- * HeaderNavigation - DISPLAY-aware adaptive navigation component
30
- *
31
- * Uses DISPLAY prop to choose navigation strategy:
32
- * - COMPACT: All items in dropdown menu (HeaderMenu pattern)
33
- * - FULL: Inline navigation with overflow detection (DnDevNavigationMenu with overflowDetection)
34
- * - AUTO: Responsive (dropdown on mobile/tablet, inline on desktop)
35
- *
36
- * @version 0.1.0
37
- * @since 0.0.1
38
- * @author AMBROISE PARK Consulting
39
- */
40
- const HeaderNavigation = ({ className = '', showIcons = true, display = DISPLAY.AUTO, path, }) => {
41
- const { t } = useTranslation('dndev');
42
- const isMobile = useBreakpoint('isMobile');
43
- const isTablet = useBreakpoint('isTablet');
44
- const navigationItems = useNavigationItems();
45
- const singleRoute = useNavigationRoute(path ?? '');
46
- // Single-item mode — render one route as a Button link.
47
- if (path) {
48
- if (!singleRoute)
49
- return null;
50
- return (_jsx(Button, { variant: "ghost", display: display, icon: showIcons ? (_jsx(Icon, { icon: singleRoute.icon, fallback: LinkIcon })) : undefined, className: className, render: ({ children, ...props }) => (_jsx(Link, { path: singleRoute.path, ...props, children: children })), children: singleRoute.label }));
51
- }
52
- const effectiveDisplay = display === DISPLAY.AUTO
53
- ? isMobile || isTablet
54
- ? DISPLAY.COMPACT
55
- : DISPLAY.FULL
56
- : display;
57
- if (effectiveDisplay === DISPLAY.COMPACT) {
58
- return (_jsx(DropdownMenu, { trigger: _jsx(Button, { variant: "ghost", icon: MoreHorizontal, "aria-label": t('navigation.menu', 'Navigation'), className: className }), contentAlign: "end", items: navigationItems.map((item) => ({
59
- label: item.label,
60
- children: (_jsx(NavigationItemComponent, { route: item, showIcons: showIcons })),
61
- asChild: true,
62
- })) }));
63
- }
64
- return (_jsx(DnDevNavigationMenu, { overflowDetection: true, showIcons: showIcons, className: cn(className), style: { flex: 1 } }));
65
- };
66
- export default HeaderNavigation;
1
+ "use client";import{MoreHorizontal as v}from"lucide-react";import{Link as d}from"lucide-react";import{DISPLAY as t,DropdownMenu as D,Button as m}from"@donotdev/components";import{cn as I}from"@donotdev/components";import{useBreakpoint as p,useTranslation as b}from"@donotdev/core";import{DnDevNavigationMenu as y}from"../../../../routing/DnDevNavigationMenu.js";import{Link as N}from"../../../../routing/Link.js";import{NavigationItemComponent as L}from"../../../../routing/NavigationItem.js";import{useNavigationItems as M,useNavigationRoute as T}from"../../../../routing/useNavigation.js";import{Icon as A}from"../../../common/icon.js";import{jsx as o}from"react/jsx-runtime";var C=({className:i="",showIcons:a=!0,display:r=t.AUTO,path:s})=>{let{t:l}=b("dndev"),f=p("isMobile"),c=p("isTablet"),u=M(),e=T(s??"");return s?e?o(m,{variant:"ghost",display:r,icon:a?o(A,{icon:e.icon,fallback:d}):void 0,className:i,render:({children:n,...g})=>o(N,{path:e.path,...g,children:n}),children:e.label}):null:(r===t.AUTO?f||c?t.COMPACT:t.FULL:r)===t.COMPACT?o(D,{trigger:o(m,{variant:"ghost",icon:v,"aria-label":l("navigation.menu","Navigation"),className:i}),contentAlign:"end",items:u.map(n=>({label:n.label,children:o(L,{route:n,showIcons:a}),asChild:!0}))}):o(y,{overflowDetection:!0,showIcons:a,className:I(i),style:{flex:1}})},R=C;export{R as default};
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/SettingsMenu.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAahF,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,EACpB,OAAgC,GACjC,GAAE,iBAAsB,+BA+FxB;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/SettingsMenu.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAahF,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,EACpB,OAAgC,GACjC,GAAE,iBAAsB,+BA8FxB;AAED,eAAe,YAAY,CAAC"}
@@ -1,85 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // packages/ui/src/components/layout/components/header/SettingsMenu.tsx
3
- /**
4
- * @fileoverview SettingsMenu component
5
- * @description Settings dropdown menu with theme, language, and cache settings
6
- *
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { Settings, Check } from 'lucide-react';
12
- import * as LucideIcons from 'lucide-react';
13
- import { Button, BUTTON_VARIANT, DropdownMenu, Stack, DISPLAY, } from '@donotdev/components';
14
- import { useTranslation } from '@donotdev/core';
15
- import { useLanguageSelector, useTheme, Flag, } from '@donotdev/core';
16
- import CacheSettings from './CacheSettings';
17
- import { findLucideIcon } from '../../../common/lucideIconByName';
18
- import { AuthHeader } from '../../../auth/AuthHeader';
19
- /**
20
- * SettingsMenu with fixed hooks order and error protection
21
- *
22
- * @version 0.1.0
23
- * @since 0.0.1
24
- * @author AMBROISE PARK Consulting
25
- */
26
- function SettingsMenu({ variant = BUTTON_VARIANT.OUTLINE, } = {}) {
27
- const { t } = useTranslation('dndev');
28
- const { languages, currentLanguage, changeLanguage, isLoading } = useLanguageSelector();
29
- const availableThemes = useTheme('availableThemes');
30
- const currentThemeName = useTheme('currentTheme');
31
- const setTheme = useTheme('setTheme');
32
- const getIcon = (iconName) => {
33
- if (!iconName)
34
- return LucideIcons.Palette;
35
- const cleanIconName = iconName.replace(/['"]/g, '');
36
- return findLucideIcon(cleanIconName) || LucideIcons.Palette;
37
- };
38
- const themeItems = availableThemes.map((themeInfo) => {
39
- const Icon = getIcon(themeInfo.meta?.icon);
40
- const isCurrent = themeInfo.name === currentThemeName;
41
- return {
42
- label: themeInfo.displayName || themeInfo.name,
43
- icon: Icon,
44
- onClick: () => setTheme(themeInfo.name),
45
- checked: isCurrent,
46
- };
47
- });
48
- const languageItems = languages.map((language) => {
49
- const isActive = language.id === currentLanguage;
50
- return {
51
- label: language.nativeName,
52
- onClick: () => changeLanguage(language.id),
53
- disabled: isLoading,
54
- checked: isActive,
55
- className: isActive ? 'bg-accent' : undefined,
56
- iconEnd: isActive && !isLoading ? Check : undefined,
57
- children: (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Flag, { code: language.flagCode || language.id, title: language.nativeName }), _jsx("span", { children: language.nativeName }), isLoading && isActive && (_jsx("div", { style: { marginInlineStart: 'auto' }, children: _jsx("div", { style: {
58
- width: '0.5rem',
59
- height: '0.5rem',
60
- borderRadius: '50%',
61
- backgroundColor: 'var(--primary)',
62
- } }) }))] })),
63
- };
64
- });
65
- const items = [
66
- {
67
- label: t('auth.title', 'Authentication'),
68
- subContent: _jsx(AuthHeader, { display: DISPLAY.COMPACT }),
69
- },
70
- {
71
- label: t('settings.theme', 'Theme'),
72
- subItems: themeItems,
73
- },
74
- {
75
- label: t('settings.language', 'Language'),
76
- subItems: languageItems,
77
- },
78
- {
79
- label: t('settings.clearCache.title', 'Clear Cache'),
80
- subContent: _jsx(CacheSettings, {}),
81
- },
82
- ];
83
- return (_jsx(DropdownMenu, { trigger: _jsx(Button, { variant: variant, "aria-label": t('settings.title', 'Settings'), icon: Settings }), items: items, contentWidth: "14rem", contentAlign: "end" }));
84
- }
85
- export default SettingsMenu;
1
+ "use client";import{Settings as f,Check as v,Palette as r}from"lucide-react";import{Button as I,BUTTON_VARIANT as y,DropdownMenu as S,Stack as D,DISPLAY as N}from"@donotdev/components";import{useTranslation as M}from"@donotdev/core";import{useLanguageSelector as k,useTheme as o,Flag as A}from"@donotdev/core";import w from"./CacheSettings.js";import{iconByName as L}from"../../../common/iconByName.js";import{AuthHeader as B}from"../../../auth/AuthHeader.js";import{jsx as t,jsxs as O}from"react/jsx-runtime";function P({variant:s=y.OUTLINE}={}){let{t:a}=M("dndev"),{languages:m,currentLanguage:c,changeLanguage:l,isLoading:i}=k(),d=o("availableThemes"),u=o("currentTheme"),p=o("setTheme"),g=e=>e?L(e,r):r,h=d.map(e=>{let n=g(e.meta?.icon),C=e.name===u;return{label:e.displayName||e.name,icon:n,onClick:()=>p(e.name),checked:C}}),T=m.map(e=>{let n=e.id===c;return{label:e.nativeName,onClick:()=>l(e.id),disabled:i,checked:n,className:n?"bg-accent":void 0,iconEnd:n&&!i?v:void 0,children:O(D,{direction:"row",align:"center",gap:"tight",children:[t(A,{code:e.flagCode||e.id,title:e.nativeName}),t("span",{children:e.nativeName}),i&&n&&t("div",{style:{marginInlineStart:"auto"},children:t("div",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",backgroundColor:"var(--primary)"}})})]})}}),b=[{label:a("auth.title","Authentication"),subContent:t(B,{display:N.COMPACT})},{label:a("settings.theme","Theme"),subItems:h},{label:a("settings.language","Language"),subItems:T},{label:a("settings.clearCache.title","Clear Cache"),subContent:t(w,{})}];return t(S,{trigger:t(I,{variant:s,"aria-label":a("settings.title","Settings"),icon:f}),items:b,contentWidth:"14rem",contentAlign:"end"})}var W=P;export{W as default};
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/ThemeToggle.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEtD,OAAO,EAIL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAQ9B,UAAU,gBAAgB;IACxB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAUD;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CA8FhD,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/ThemeToggle.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAIL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAQ9B,UAAU,gBAAgB;IACxB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AASD;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CA8FhD,CAAC;AAEF,eAAe,WAAW,CAAC"}