@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,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};