@donotdev/ui 0.3.1 → 0.3.2

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 (299) hide show
  1. package/dist/components/auth/AuthHeader.js +1 -93
  2. package/dist/components/auth/AuthMenu.d.ts.map +1 -1
  3. package/dist/components/auth/AuthMenu.js +3 -286
  4. package/dist/components/auth/index.js +1 -9
  5. package/dist/components/common/FeatureCard.d.ts.map +1 -1
  6. package/dist/components/common/FeatureCard.js +1 -86
  7. package/dist/components/common/FeatureDisabled.js +1 -67
  8. package/dist/components/common/IconPlaceholder.d.ts +24 -0
  9. package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
  10. package/dist/components/common/IconPlaceholder.js +1 -0
  11. package/dist/components/common/LazyLucideIcon.d.ts +39 -0
  12. package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
  13. package/dist/components/common/LazyLucideIcon.js +1 -0
  14. package/dist/components/common/ProgressBar.js +1 -84
  15. package/dist/components/common/RedirectOverlay.js +1 -243
  16. package/dist/components/common/Skeleton.js +1 -144
  17. package/dist/components/common/TechBento.d.ts.map +1 -1
  18. package/dist/components/common/TechBento.js +1 -53
  19. package/dist/components/common/icon.d.ts +1 -1
  20. package/dist/components/common/icon.d.ts.map +1 -1
  21. package/dist/components/common/icon.js +1 -84
  22. package/dist/components/common/iconByName.d.ts +33 -0
  23. package/dist/components/common/iconByName.d.ts.map +1 -0
  24. package/dist/components/common/iconByName.js +1 -0
  25. package/dist/components/common/index.js +1 -16
  26. package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
  27. package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
  28. package/dist/components/cookie-consent/ConsentBanner.js +1 -31
  29. package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
  30. package/dist/components/cookie-consent/CookieConsent.js +1 -183
  31. package/dist/components/cookie-consent/index.js +1 -11
  32. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
  33. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
  34. package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
  35. package/dist/components/index.js +1 -13
  36. package/dist/components/layout/GameContainer.d.ts.map +1 -1
  37. package/dist/components/layout/GameContainer.js +1 -72
  38. package/dist/components/layout/GameFlow.d.ts.map +1 -1
  39. package/dist/components/layout/GameFlow.js +1 -93
  40. package/dist/components/layout/PageConfig.d.ts.map +1 -1
  41. package/dist/components/layout/PageConfig.js +1 -47
  42. package/dist/components/layout/PageContainer.d.ts.map +1 -1
  43. package/dist/components/layout/PageContainer.js +1 -38
  44. package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
  45. package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
  46. package/dist/components/layout/components/Breadcrumbs.js +1 -89
  47. package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
  48. package/dist/components/layout/components/DropdownNavigation.js +1 -30
  49. package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
  50. package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
  51. package/dist/components/layout/components/Notifications.js +1 -182
  52. package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
  53. package/dist/components/layout/components/header/AppBranding.js +1 -54
  54. package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
  55. package/dist/components/layout/components/header/AppIcon.js +1 -59
  56. package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
  57. package/dist/components/layout/components/header/AppTitle.js +1 -40
  58. package/dist/components/layout/components/header/CacheSettings.js +1 -225
  59. package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
  60. package/dist/components/layout/components/header/GameTitle.js +1 -66
  61. package/dist/components/layout/components/header/HeaderMenu.js +1 -75
  62. package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
  63. package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
  64. package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
  65. package/dist/components/layout/components/header/SettingsMenu.js +1 -85
  66. package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
  67. package/dist/components/layout/components/header/ThemeToggle.js +1 -93
  68. package/dist/components/layout/components/index.js +1 -25
  69. package/dist/components/layout/index.js +1 -14
  70. package/dist/crud/components/ChildRowsPicker.js +1 -68
  71. package/dist/crud/components/CrudCardLink.js +1 -14
  72. package/dist/crud/components/EntityCardList.js +1 -184
  73. package/dist/crud/components/EntityDisplayRenderer.js +1 -130
  74. package/dist/crud/components/EntityFormRenderer.js +1 -433
  75. package/dist/crud/components/EntityList.js +1 -521
  76. package/dist/crud/components/EntityRecommendations.js +1 -87
  77. package/dist/crud/components/EntityWorkflow.js +1 -55
  78. package/dist/crud/components/Form.d.ts.map +1 -1
  79. package/dist/crud/components/Form.js +1 -198
  80. package/dist/crud/components/cellEditFor.js +1 -74
  81. package/dist/crud/components/entityParent.js +1 -76
  82. package/dist/crud/components/index.js +1 -16
  83. package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
  84. package/dist/crud/components/useRecordBreadcrumb.js +1 -43
  85. package/dist/crud/crudImports.js +1 -51
  86. package/dist/crud/index.js +1 -11
  87. package/dist/data/techLogos.js +1 -99
  88. package/dist/dndev-next.css +25 -4
  89. package/dist/dndev.css +25 -4
  90. package/dist/index.js +1 -5
  91. package/dist/internal/common/DnDevErrorBoundary.js +1 -55
  92. package/dist/internal/common/ErrorFallback.js +3 -214
  93. package/dist/internal/common/GlobalErrorFallback.js +1 -45
  94. package/dist/internal/common/RouteErrorFallback.js +3 -140
  95. package/dist/internal/devtools/DebugTools.js +1 -131
  96. package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
  97. package/dist/internal/devtools/components/ConfigTab.js +1 -61
  98. package/dist/internal/devtools/components/CookieTab.js +1 -156
  99. package/dist/internal/devtools/components/DebugDialog.js +1 -48
  100. package/dist/internal/devtools/components/DesignTab.js +1 -469
  101. package/dist/internal/devtools/components/LayoutReset.js +1 -214
  102. package/dist/internal/devtools/components/MaskedValue.js +1 -39
  103. package/dist/internal/devtools/components/StoresTab.js +1 -90
  104. package/dist/internal/devtools/components/index.js +1 -16
  105. package/dist/internal/devtools/index.js +1 -13
  106. package/dist/internal/devtools/types.js +0 -2
  107. package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
  108. package/dist/internal/devtools/utils/index.js +1 -12
  109. package/dist/internal/devtools/utils/maskSensitive.js +1 -59
  110. package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
  111. package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
  112. package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
  113. package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
  114. package/dist/internal/initializers/index.js +1 -11
  115. package/dist/internal/layout/DnDevLayout.js +1 -321
  116. package/dist/internal/layout/components/AutoMetaTags.d.ts +2 -0
  117. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  118. package/dist/internal/layout/components/AutoMetaTags.js +1 -338
  119. package/dist/internal/layout/components/FaviconHead.js +1 -60
  120. package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
  121. package/dist/internal/layout/components/HeadTags.js +1 -20
  122. package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
  123. package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
  124. package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
  125. package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
  126. package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
  127. package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
  128. package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
  129. package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
  130. package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
  131. package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
  132. package/dist/internal/layout/components/i18nSeoMeta.js +1 -53
  133. package/dist/internal/layout/components/index.js +1 -13
  134. package/dist/internal/layout/config/defaults.js +1 -47
  135. package/dist/internal/layout/config/index.js +1 -11
  136. package/dist/internal/layout/config/presets/admin.js +1 -35
  137. package/dist/internal/layout/config/presets/blog.js +1 -31
  138. package/dist/internal/layout/config/presets/docs.js +1 -51
  139. package/dist/internal/layout/config/presets/game.js +1 -53
  140. package/dist/internal/layout/config/presets/index.js +1 -24
  141. package/dist/internal/layout/config/presets/landing.js +1 -42
  142. package/dist/internal/layout/config/presets/moolti.js +1 -52
  143. package/dist/internal/layout/config/presets/plain.js +1 -25
  144. package/dist/internal/layout/renderers/index.js +0 -10
  145. package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
  146. package/dist/internal/layout/zones/DnDevFooter.js +1 -67
  147. package/dist/internal/layout/zones/DnDevHeader.js +1 -41
  148. package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
  149. package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
  150. package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
  151. package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
  152. package/dist/internal/layout/zones/index.js +1 -14
  153. package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
  154. package/dist/internal/providers/NavigationProvider.js +1 -71
  155. package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
  156. package/dist/internal/providers/SentryInitializer.js +1 -36
  157. package/dist/internal/providers/UIProviders.js +1 -79
  158. package/dist/internal/providers/index.js +1 -12
  159. package/dist/next.js +1 -11
  160. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  161. package/dist/providers/NextJsAppProviders.js +1 -107
  162. package/dist/providers/ViteAppProviders.d.ts.map +1 -1
  163. package/dist/providers/ViteAppProviders.js +1 -117
  164. package/dist/providers/index.js +1 -11
  165. package/dist/routing/404.js +1 -108
  166. package/dist/routing/AuthGuard.js +1 -178
  167. package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
  168. package/dist/routing/AuthGuardFallback.js +1 -67
  169. package/dist/routing/AuthReturnTo.js +1 -68
  170. package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
  171. package/dist/routing/DnDevNavigationMenu.js +1 -138
  172. package/dist/routing/GoTo.d.ts.map +1 -1
  173. package/dist/routing/GoTo.js +1 -38
  174. package/dist/routing/GoToDialog.d.ts.map +1 -1
  175. package/dist/routing/GoToDialog.js +1 -97
  176. package/dist/routing/GoToInput.d.ts.map +1 -1
  177. package/dist/routing/GoToInput.js +1 -49
  178. package/dist/routing/GoToWrapper.d.ts.map +1 -1
  179. package/dist/routing/GoToWrapper.js +1 -59
  180. package/dist/routing/Link.d.ts +10 -2
  181. package/dist/routing/Link.d.ts.map +1 -1
  182. package/dist/routing/Link.js +1 -109
  183. package/dist/routing/NavigationItem.d.ts.map +1 -1
  184. package/dist/routing/NavigationItem.js +1 -44
  185. package/dist/routing/NotFoundDocument.d.ts +33 -0
  186. package/dist/routing/NotFoundDocument.d.ts.map +1 -0
  187. package/dist/routing/NotFoundDocument.js +1 -0
  188. package/dist/routing/SignedInRedirect.js +1 -47
  189. package/dist/routing/hooks/hooks.vite.js +1 -1
  190. package/dist/routing/hooks/index.js +1 -26
  191. package/dist/routing/hooks/types.js +0 -2
  192. package/dist/routing/hooks/useLocation.next.js +1 -35
  193. package/dist/routing/hooks/useLocation.vite.js +1 -13
  194. package/dist/routing/hooks/useMatch.next.js +1 -31
  195. package/dist/routing/hooks/useMatch.vite.js +1 -6
  196. package/dist/routing/hooks/useNavigate.next.js +1 -64
  197. package/dist/routing/hooks/useNavigate.vite.js +1 -61
  198. package/dist/routing/hooks/useParams.next.js +1 -9
  199. package/dist/routing/hooks/useParams.vite.js +1 -6
  200. package/dist/routing/hooks/useQueryParams.next.js +1 -66
  201. package/dist/routing/hooks/useQueryParams.vite.js +1 -66
  202. package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
  203. package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
  204. package/dist/routing/hooks/useRouteParam.next.js +1 -38
  205. package/dist/routing/hooks/useRouteParam.vite.js +1 -38
  206. package/dist/routing/hooks/useRoutePath.next.js +1 -36
  207. package/dist/routing/hooks/useRoutePath.vite.js +1 -25
  208. package/dist/routing/hooks/useSearchParams.next.js +1 -22
  209. package/dist/routing/hooks/useSearchParams.vite.js +1 -22
  210. package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
  211. package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
  212. package/dist/routing/index.d.ts +1 -0
  213. package/dist/routing/index.d.ts.map +1 -1
  214. package/dist/routing/index.js +1 -32
  215. package/dist/routing/link/InternalLink.next.d.ts +23 -0
  216. package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
  217. package/dist/routing/link/InternalLink.next.js +1 -0
  218. package/dist/routing/link/InternalLink.vite.d.ts +22 -0
  219. package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
  220. package/dist/routing/link/InternalLink.vite.js +1 -0
  221. package/dist/routing/link/absolutePath.d.ts +17 -0
  222. package/dist/routing/link/absolutePath.d.ts.map +1 -0
  223. package/dist/routing/link/absolutePath.js +1 -0
  224. package/dist/routing/link/link.next.d.ts +12 -0
  225. package/dist/routing/link/link.next.d.ts.map +1 -0
  226. package/dist/routing/link/link.next.js +1 -0
  227. package/dist/routing/link/link.vite.d.ts +12 -0
  228. package/dist/routing/link/link.vite.d.ts.map +1 -0
  229. package/dist/routing/link/link.vite.js +1 -0
  230. package/dist/routing/link/types.d.ts +30 -0
  231. package/dist/routing/link/types.d.ts.map +1 -0
  232. package/dist/routing/link/types.js +0 -0
  233. package/dist/routing/parentRoute.js +1 -43
  234. package/dist/routing/useGoTo.d.ts.map +1 -1
  235. package/dist/routing/useGoTo.js +1 -59
  236. package/dist/routing/useNavigation.d.ts.map +1 -1
  237. package/dist/routing/useNavigation.js +1 -114
  238. package/dist/routing/useRouteDiscovery.d.ts +1 -0
  239. package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
  240. package/dist/routing/useRouteDiscovery.js +1 -313
  241. package/dist/rsc.d.ts +28 -0
  242. package/dist/rsc.d.ts.map +1 -0
  243. package/dist/rsc.js +1 -0
  244. package/dist/styles/index.css +25 -4
  245. package/dist/styles/index.js +1 -10
  246. package/dist/styles/layoutConstants.js +1 -134
  247. package/dist/symbol-index.json +1 -1
  248. package/dist/utils/assetResolver.d.ts.map +1 -1
  249. package/dist/utils/assetResolver.js +1 -297
  250. package/dist/utils/index.js +1 -23
  251. package/dist/utils/sanitizeSvg.js +1 -51
  252. package/dist/utils/tList.js +1 -42
  253. package/dist/utils/useAISafe.d.ts.map +1 -1
  254. package/dist/utils/useAISafe.js +1 -53
  255. package/dist/utils/useAuthSafe.d.ts.map +1 -1
  256. package/dist/utils/useAuthSafe.js +1 -78
  257. package/dist/utils/useAuthVisibility.d.ts.map +1 -1
  258. package/dist/utils/useAuthVisibility.js +1 -63
  259. package/dist/utils/useBillingVisibility.d.ts.map +1 -1
  260. package/dist/utils/useBillingVisibility.js +1 -57
  261. package/dist/utils/useCrudSafe.d.ts.map +1 -1
  262. package/dist/utils/useCrudSafe.js +1 -75
  263. package/dist/utils/useDeleteAccountSafe.js +1 -52
  264. package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
  265. package/dist/utils/useFormStoreSafe.js +1 -85
  266. package/dist/utils/useOAuthSafe.d.ts.map +1 -1
  267. package/dist/utils/useOAuthSafe.js +1 -38
  268. package/dist/utils/useSeo.js +1 -151
  269. package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
  270. package/dist/utils/useStripeBillingSafe.js +1 -81
  271. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  272. package/dist/vite-routing/AppRoutes.js +1 -235
  273. package/dist/vite-routing/RootLayout.d.ts.map +1 -1
  274. package/dist/vite-routing/RootLayout.js +1 -205
  275. package/dist/vite-routing/index.js +1 -11
  276. package/dist/vite.js +1 -10
  277. package/guidelines/COMPONENTS.md +3 -3
  278. package/guidelines/PAGES.md +3 -0
  279. package/guidelines/ROUTING.md +15 -0
  280. package/guidelines/SEO.md +4 -1
  281. package/package.json +18 -8
  282. package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
  283. package/dist/ChildRowsPicker-ISP365ON.js +0 -1
  284. package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
  285. package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
  286. package/dist/CookieConsent-QOUAY6B4.js +0 -1
  287. package/dist/GoToDialog-KSBGOIWO.js +0 -1
  288. package/dist/GoToDialog-XBK5EZF4.js +0 -1
  289. package/dist/chunk-3CIZFGST.js +0 -1
  290. package/dist/chunk-LHMKU342.js +0 -1
  291. package/dist/chunk-MS7ZIW5Z.js +0 -1
  292. package/dist/chunk-O2XFH626.js +0 -1
  293. package/dist/chunk-P2DHZWPY.js +0 -1
  294. package/dist/components/common/lucideIconByName.d.ts +0 -9
  295. package/dist/components/common/lucideIconByName.d.ts.map +0 -1
  296. package/dist/components/common/lucideIconByName.js +0 -32
  297. package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
  298. package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
  299. package/dist/internal/layout/components/PerformanceHints.js +0 -71
@@ -1,309 +1 @@
1
- // packages/ui/src/internal/devtools/utils/virtualModuleInspector.ts
2
- /**
3
- * @fileoverview Virtual Module Inspector Utility
4
- * @description Inspects and validates virtual modules including design tokens, i18n mappings, and performs health checks
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- import { PLATFORMS } from '@donotdev/core';
11
- import { detectPlatform, detectPlatformInfo, detectBrowser, detectFeatures, getDndevConfig, } from '@donotdev/core';
12
- export class VirtualModuleInspector {
13
- static async getDesignTokens() {
14
- try {
15
- const platform = detectPlatform();
16
- let designTokens = {};
17
- let source = '';
18
- // Use DRY utility for platform-aware config access
19
- const config = getDndevConfig();
20
- if (config?.themes?.variables) {
21
- designTokens = config.themes.variables;
22
- source = 'config.themes.variables';
23
- }
24
- // If not available, could fetch from API route
25
- if (Object.keys(designTokens).length === 0) {
26
- try {
27
- const response = await fetch('/api/dndev/themes');
28
- if (response.ok) {
29
- const data = await response.json();
30
- designTokens = data.variables || {};
31
- source = '/api/dndev/themes';
32
- }
33
- }
34
- catch (error) {
35
- console.warn('Failed to fetch themes from API route:', error);
36
- }
37
- }
38
- const tokenCount = Object.keys(designTokens).length;
39
- if (process.env.NODE_ENV === 'development') {
40
- console.log('[VirtualModuleInspector] Design Tokens:', {
41
- platform,
42
- tokenCount,
43
- sampleTokens: Object.keys(designTokens).slice(0, 5),
44
- source,
45
- });
46
- }
47
- return {
48
- success: true,
49
- data: {
50
- ...designTokens,
51
- _meta: {
52
- tokenCount,
53
- loadedAt: new Date().toISOString(),
54
- source,
55
- platform,
56
- },
57
- },
58
- error: null,
59
- };
60
- }
61
- catch (error) {
62
- const errorMessage = error instanceof Error ? error.message : String(error);
63
- if (process.env.NODE_ENV === 'development') {
64
- console.group('[VirtualModuleInspector] Design Tokens Failed');
65
- console.error('Error:', errorMessage);
66
- console.log('Platform:', detectPlatform());
67
- console.log('Environment:', {
68
- isClient: typeof window !== 'undefined',
69
- hasConfig: !!getDndevConfig(),
70
- hasThemes: !!getDndevConfig()?.themes,
71
- hasVariables: !!getDndevConfig()?.themes?.variables,
72
- });
73
- console.groupEnd();
74
- }
75
- return {
76
- success: false,
77
- data: null,
78
- error: `Design tokens not available: ${errorMessage}. Check if @donotdev/core discovery plugin is enabled.`,
79
- };
80
- }
81
- }
82
- static async getI18nMapping() {
83
- try {
84
- const platform = detectPlatform();
85
- let i18nMapping = {};
86
- let source = '';
87
- // Use DRY utility for platform-aware config access
88
- const config = getDndevConfig();
89
- if (config?.i18n?.mapping) {
90
- i18nMapping = config.i18n.mapping;
91
- source = 'config.i18n.mapping';
92
- }
93
- // If not available, could fetch from API route
94
- if (Object.keys(i18nMapping).length === 0) {
95
- try {
96
- const response = await fetch('/api/dndev/i18n');
97
- if (response.ok) {
98
- const data = await response.json();
99
- i18nMapping = data.mapping || {};
100
- source = '/api/dndev/i18n';
101
- }
102
- }
103
- catch (error) {
104
- console.warn('Failed to fetch i18n from API route:', error);
105
- }
106
- }
107
- if (process.env.NODE_ENV === 'development') {
108
- console.log('🌐 i18n Mapping:', {
109
- platform,
110
- namespaces: Object.keys(i18nMapping),
111
- source,
112
- });
113
- }
114
- return {
115
- success: true,
116
- data: {
117
- ...i18nMapping,
118
- _meta: {
119
- namespaces: Object.keys(i18nMapping),
120
- loadedAt: new Date().toISOString(),
121
- source,
122
- platform,
123
- },
124
- },
125
- error: null,
126
- };
127
- }
128
- catch (error) {
129
- const errorMessage = error instanceof Error ? error.message : String(error);
130
- return {
131
- success: false,
132
- data: null,
133
- error: `i18n mapping not available: ${errorMessage}`,
134
- };
135
- }
136
- }
137
- static getGlobalDiscoveryData() {
138
- return {
139
- // Unified config (main source of truth)
140
- dndevConfig: getDndevConfig(),
141
- // Discovery data
142
- discoveredThemes: getDndevConfig()?.themes?.discovered?.map((t) => t.name) || [],
143
- discoveredClasses: Object.keys(getDndevConfig()?.themes?.utilities || {}),
144
- discoveredFrameworkVariables: Object.keys(getDndevConfig()?.themes?.variables || {}),
145
- discoveredConsumerVariables: [], // Not available in unified config yet
146
- discoveredUtilities: getDndevConfig()?.themes?.utilities || {},
147
- // Helper functions
148
- getAvailableThemes: globalThis.getAvailableThemes || null,
149
- };
150
- }
151
- static getCSSVariableData() {
152
- if (typeof document === 'undefined')
153
- return {
154
- dndevVariables: {},
155
- allCSSPropsCount: 0,
156
- dndevVarsCount: 0,
157
- utilityTests: {},
158
- actualHeader: null,
159
- keyVariables: {
160
- headerHeight: 'not set',
161
- sidebarWidth: 'not set',
162
- debugEnabled: 'not set',
163
- },
164
- };
165
- const documentStyle = getComputedStyle(document.documentElement);
166
- // Get all CSS custom properties
167
- const allCSSProps = Array.from(document.documentElement.style);
168
- const dndevVars = allCSSProps
169
- .filter((prop) => prop && prop.startsWith('--'))
170
- .reduce((acc, prop) => {
171
- if (prop) {
172
- acc[prop] = documentStyle.getPropertyValue(prop);
173
- }
174
- return acc;
175
- }, {});
176
- // Test utility classes
177
- const testDiv = document.createElement('div');
178
- testDiv.style.position = 'absolute';
179
- testDiv.style.top = '-9999px';
180
- testDiv.style.left = '-9999px';
181
- document.body.appendChild(testDiv);
182
- const utilityTests = {
183
- 'h-header': {
184
- height: '0px',
185
- width: '0px',
186
- minHeight: 'auto',
187
- maxWidth: 'none',
188
- },
189
- 'h-header-icon': {
190
- height: '0px',
191
- width: '0px',
192
- minHeight: 'auto',
193
- maxWidth: 'none',
194
- },
195
- 'w-sidebar': {
196
- height: '0px',
197
- width: '0px',
198
- minHeight: 'auto',
199
- maxWidth: 'none',
200
- },
201
- 'size-icon': {
202
- height: '0px',
203
- width: '0px',
204
- minHeight: 'auto',
205
- maxWidth: 'none',
206
- },
207
- };
208
- Object.keys(utilityTests).forEach((utility) => {
209
- testDiv.className = utility;
210
- const computed = getComputedStyle(testDiv);
211
- utilityTests[utility] = {
212
- height: computed.height,
213
- width: computed.width,
214
- minHeight: computed.minHeight,
215
- maxWidth: computed.maxWidth,
216
- };
217
- });
218
- document.body.removeChild(testDiv);
219
- // Check actual header element
220
- const existingHeader = document.querySelector('header');
221
- let actualHeaderData = null;
222
- if (existingHeader) {
223
- const headerStyle = getComputedStyle(existingHeader);
224
- actualHeaderData = {
225
- height: headerStyle.height,
226
- minHeight: headerStyle.minHeight,
227
- padding: headerStyle.padding,
228
- margin: headerStyle.margin,
229
- };
230
- }
231
- return {
232
- dndevVariables: dndevVars,
233
- allCSSPropsCount: allCSSProps.length,
234
- dndevVarsCount: Object.keys(dndevVars).length,
235
- utilityTests,
236
- actualHeader: actualHeaderData,
237
- keyVariables: {
238
- headerHeight: documentStyle.getPropertyValue('--header-height') || 'not set',
239
- sidebarWidth: documentStyle.getPropertyValue('--sidebar-width') || 'not set',
240
- debugEnabled: documentStyle.getPropertyValue('--debug-enabled') || 'not set',
241
- },
242
- };
243
- }
244
- static async performHealthCheck() {
245
- const timestamp = new Date().toISOString();
246
- const platform = detectPlatformInfo();
247
- const browser = detectBrowser();
248
- const features = detectFeatures();
249
- const [designTokens, i18n] = await Promise.all([
250
- this.getDesignTokens(),
251
- this.getI18nMapping(),
252
- ]);
253
- const globalData = this.getGlobalDiscoveryData();
254
- const cssData = this.getCSSVariableData();
255
- const issues = [];
256
- const suggestions = [];
257
- // Platform-specific issues
258
- if (platform.platform === 'unknown') {
259
- issues.push('Platform not detected - config may not work correctly');
260
- }
261
- // Browser issues
262
- if (browser.type === 'ie') {
263
- issues.push('Internet Explorer is deprecated and not supported');
264
- }
265
- // Feature support issues
266
- if (!features.cssCustomProperties) {
267
- issues.push('CSS Custom Properties not supported - theming may not work');
268
- }
269
- if (!features.localStorage) {
270
- issues.push('LocalStorage not supported - data persistence limited');
271
- }
272
- // Config issues
273
- if (!globalData.dndevConfig) {
274
- issues.push('No DnDev config found - discovery plugins may not be working');
275
- }
276
- if (!designTokens.success) {
277
- issues.push('Design tokens not available');
278
- }
279
- if (!i18n.success) {
280
- issues.push('i18n mapping not available');
281
- }
282
- // Suggestions
283
- if (platform.platform === PLATFORMS.NEXTJS && !features.serviceWorkers) {
284
- suggestions.push('Consider enabling service workers for PWA features');
285
- }
286
- if (!features.secureContext) {
287
- suggestions.push('Use HTTPS for secure features and better performance');
288
- }
289
- return {
290
- timestamp,
291
- platform: {
292
- type: platform.platform,
293
- mode: platform.mode,
294
- context: platform.context,
295
- version: platform.version,
296
- },
297
- browser,
298
- features,
299
- virtualModules: {
300
- designTokens,
301
- i18n,
302
- },
303
- globalData,
304
- cssData,
305
- issues,
306
- suggestions,
307
- };
308
- }
309
- }
1
+ import{PLATFORMS as m}from"@donotdev/core";import{detectPlatform as g,detectPlatformInfo as h,detectBrowser as p,detectFeatures as f,getDndevConfig as l}from"@donotdev/core";var u=class{static async getDesignTokens(){try{let t=g(),e={},n="",s=l();if(s?.themes?.variables&&(e=s.themes.variables,n="config.themes.variables"),Object.keys(e).length===0)try{let i=await fetch("/api/dndev/themes");i.ok&&(e=(await i.json()).variables||{},n="/api/dndev/themes")}catch{}let r=Object.keys(e).length;return{success:!0,data:{...e,_meta:{tokenCount:r,loadedAt:new Date().toISOString(),source:n,platform:t}},error:null}}catch(t){return{success:!1,data:null,error:`Design tokens not available: ${t instanceof Error?t.message:String(t)}. Check if @donotdev/core discovery plugin is enabled.`}}}static async getI18nMapping(){try{let t=g(),e={},n="",s=l();if(s?.i18n?.mapping&&(e=s.i18n.mapping,n="config.i18n.mapping"),Object.keys(e).length===0)try{let r=await fetch("/api/dndev/i18n");r.ok&&(e=(await r.json()).mapping||{},n="/api/dndev/i18n")}catch{}return{success:!0,data:{...e,_meta:{namespaces:Object.keys(e),loadedAt:new Date().toISOString(),source:n,platform:t}},error:null}}catch(t){return{success:!1,data:null,error:`i18n mapping not available: ${t instanceof Error?t.message:String(t)}`}}}static getGlobalDiscoveryData(){return{dndevConfig:l(),discoveredThemes:l()?.themes?.discovered?.map(t=>t.name)||[],discoveredClasses:Object.keys(l()?.themes?.utilities||{}),discoveredFrameworkVariables:Object.keys(l()?.themes?.variables||{}),discoveredConsumerVariables:[],discoveredUtilities:l()?.themes?.utilities||{},getAvailableThemes:globalThis.getAvailableThemes||null}}static getCSSVariableData(){if(typeof document>"u")return{dndevVariables:{},allCSSPropsCount:0,dndevVarsCount:0,utilityTests:{},actualHeader:null,keyVariables:{headerHeight:"not set",sidebarWidth:"not set",debugEnabled:"not set"}};let t=getComputedStyle(document.documentElement),e=Array.from(document.documentElement.style),n=e.filter(a=>a&&a.startsWith("--")).reduce((a,o)=>(o&&(a[o]=t.getPropertyValue(o)),a),{}),s=document.createElement("div");s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",document.body.appendChild(s);let r={"h-header":{height:"0px",width:"0px",minHeight:"auto",maxWidth:"none"},"h-header-icon":{height:"0px",width:"0px",minHeight:"auto",maxWidth:"none"},"w-sidebar":{height:"0px",width:"0px",minHeight:"auto",maxWidth:"none"},"size-icon":{height:"0px",width:"0px",minHeight:"auto",maxWidth:"none"}};Object.keys(r).forEach(a=>{s.className=a;let o=getComputedStyle(s);r[a]={height:o.height,width:o.width,minHeight:o.minHeight,maxWidth:o.maxWidth}}),document.body.removeChild(s);let i=document.querySelector("header"),d=null;if(i){let a=getComputedStyle(i);d={height:a.height,minHeight:a.minHeight,padding:a.padding,margin:a.margin}}return{dndevVariables:n,allCSSPropsCount:e.length,dndevVarsCount:Object.keys(n).length,utilityTests:r,actualHeader:d,keyVariables:{headerHeight:t.getPropertyValue("--header-height")||"not set",sidebarWidth:t.getPropertyValue("--sidebar-width")||"not set",debugEnabled:t.getPropertyValue("--debug-enabled")||"not set"}}}static async performHealthCheck(){let t=new Date().toISOString(),e=h(),n=p(),s=f(),[r,i]=await Promise.all([this.getDesignTokens(),this.getI18nMapping()]),d=this.getGlobalDiscoveryData(),a=this.getCSSVariableData(),o=[],c=[];return e.platform==="unknown"&&o.push("Platform not detected - config may not work correctly"),n.type==="ie"&&o.push("Internet Explorer is deprecated and not supported"),s.cssCustomProperties||o.push("CSS Custom Properties not supported - theming may not work"),s.localStorage||o.push("LocalStorage not supported - data persistence limited"),d.dndevConfig||o.push("No DnDev config found - discovery plugins may not be working"),r.success||o.push("Design tokens not available"),i.success||o.push("i18n mapping not available"),e.platform===m.NEXTJS&&!s.serviceWorkers&&c.push("Consider enabling service workers for PWA features"),s.secureContext||c.push("Use HTTPS for secure features and better performance"),{timestamp:t,platform:{type:e.platform,mode:e.mode,context:e.context,version:e.version},browser:n,features:s,virtualModules:{designTokens:r,i18n:i},globalData:d,cssData:a,issues:o,suggestions:c}}};export{u as VirtualModuleInspector};