@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.
- package/README.md +2 -3
- package/dist/components/auth/AuthHeader.js +1 -93
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +3 -286
- package/dist/components/auth/index.js +1 -9
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +1 -86
- package/dist/components/common/FeatureDisabled.js +1 -67
- package/dist/components/common/IconPlaceholder.d.ts +24 -0
- package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
- package/dist/components/common/IconPlaceholder.js +1 -0
- package/dist/components/common/LazyLucideIcon.d.ts +39 -0
- package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
- package/dist/components/common/LazyLucideIcon.js +1 -0
- package/dist/components/common/ProgressBar.js +1 -84
- package/dist/components/common/RedirectOverlay.js +1 -243
- package/dist/components/common/Skeleton.js +1 -144
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/TechBento.js +1 -53
- package/dist/components/common/icon.d.ts +1 -1
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +1 -84
- package/dist/components/common/iconByName.d.ts +33 -0
- package/dist/components/common/iconByName.d.ts.map +1 -0
- package/dist/components/common/iconByName.js +1 -0
- package/dist/components/common/index.js +1 -16
- package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
- package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
- package/dist/components/cookie-consent/ConsentBanner.js +1 -31
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -183
- package/dist/components/cookie-consent/index.js +1 -11
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
- package/dist/components/index.js +1 -13
- package/dist/components/layout/GameContainer.d.ts.map +1 -1
- package/dist/components/layout/GameContainer.js +1 -72
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/GameFlow.js +1 -93
- package/dist/components/layout/PageConfig.d.ts.map +1 -1
- package/dist/components/layout/PageConfig.js +1 -47
- package/dist/components/layout/PageContainer.d.ts.map +1 -1
- package/dist/components/layout/PageContainer.js +1 -38
- package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -89
- package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/DropdownNavigation.js +1 -30
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
- package/dist/components/layout/components/Notifications.js +1 -182
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.js +1 -54
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.js +1 -59
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.js +1 -40
- package/dist/components/layout/components/header/CacheSettings.js +1 -225
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/GameTitle.js +1 -66
- package/dist/components/layout/components/header/HeaderMenu.js +1 -75
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +1 -85
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +1 -93
- package/dist/components/layout/components/index.js +1 -25
- package/dist/components/layout/index.js +1 -14
- package/dist/crud/components/ChildRowsPicker.js +1 -68
- package/dist/crud/components/CrudCardLink.js +1 -14
- package/dist/crud/components/EntityCardList.d.ts +4 -1
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +1 -184
- package/dist/crud/components/EntityDisplayRenderer.js +1 -130
- package/dist/crud/components/EntityFormRenderer.js +1 -433
- package/dist/crud/components/EntityList.js +1 -521
- package/dist/crud/components/EntityRecommendations.js +1 -87
- package/dist/crud/components/EntityWorkflow.js +1 -55
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +1 -198
- package/dist/crud/components/cellEditFor.js +1 -74
- package/dist/crud/components/entityParent.js +1 -76
- package/dist/crud/components/index.js +1 -16
- package/dist/crud/components/useRecordBreadcrumb.d.ts +3 -1
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/crud/components/useRecordBreadcrumb.js +1 -43
- package/dist/crud/crudImports.js +1 -51
- package/dist/crud/index.js +1 -11
- package/dist/data/techLogos.js +1 -99
- package/dist/dndev-next.css +113 -41
- package/dist/dndev.css +113 -41
- package/dist/index.js +1 -5
- package/dist/internal/common/DnDevErrorBoundary.js +1 -55
- package/dist/internal/common/ErrorFallback.js +3 -214
- package/dist/internal/common/GlobalErrorFallback.js +1 -45
- package/dist/internal/common/RouteErrorFallback.js +3 -140
- package/dist/internal/devtools/DebugTools.js +1 -131
- package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
- package/dist/internal/devtools/components/ConfigTab.js +1 -61
- package/dist/internal/devtools/components/CookieTab.js +1 -156
- package/dist/internal/devtools/components/DebugDialog.js +1 -48
- package/dist/internal/devtools/components/DesignTab.js +1 -469
- package/dist/internal/devtools/components/LayoutReset.js +1 -214
- package/dist/internal/devtools/components/MaskedValue.js +1 -39
- package/dist/internal/devtools/components/StoresTab.js +1 -90
- package/dist/internal/devtools/components/index.js +1 -16
- package/dist/internal/devtools/index.js +1 -13
- package/dist/internal/devtools/types.js +0 -2
- package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
- package/dist/internal/devtools/utils/index.js +1 -12
- package/dist/internal/devtools/utils/maskSensitive.js +1 -59
- package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
- package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
- package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
- package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
- package/dist/internal/initializers/index.js +1 -11
- package/dist/internal/layout/DnDevLayout.js +1 -321
- package/dist/internal/layout/components/AutoMetaTags.d.ts +5 -0
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -338
- package/dist/internal/layout/components/FaviconHead.d.ts +18 -14
- package/dist/internal/layout/components/FaviconHead.d.ts.map +1 -1
- package/dist/internal/layout/components/FaviconHead.js +1 -60
- package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
- package/dist/internal/layout/components/HeadTags.js +1 -20
- package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
- package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
- package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
- package/dist/internal/layout/components/headTagElement.d.ts +16 -0
- package/dist/internal/layout/components/headTagElement.d.ts.map +1 -0
- package/dist/internal/layout/components/headTagElement.js +1 -0
- package/dist/internal/layout/components/index.js +1 -13
- package/dist/internal/layout/components/prerenderedHead.d.ts +15 -0
- package/dist/internal/layout/components/prerenderedHead.d.ts.map +1 -0
- package/dist/internal/layout/components/prerenderedHead.js +1 -0
- package/dist/internal/layout/components/trailingSlash.d.ts +13 -0
- package/dist/internal/layout/components/trailingSlash.d.ts.map +1 -0
- package/dist/internal/layout/components/trailingSlash.js +1 -0
- package/dist/internal/layout/config/defaults.js +1 -47
- package/dist/internal/layout/config/index.js +1 -11
- package/dist/internal/layout/config/presets/admin.js +1 -35
- package/dist/internal/layout/config/presets/blog.js +1 -31
- package/dist/internal/layout/config/presets/docs.js +1 -51
- package/dist/internal/layout/config/presets/game.js +1 -53
- package/dist/internal/layout/config/presets/index.js +1 -24
- package/dist/internal/layout/config/presets/landing.js +1 -42
- package/dist/internal/layout/config/presets/moolti.js +1 -52
- package/dist/internal/layout/config/presets/plain.js +1 -25
- package/dist/internal/layout/renderers/index.js +0 -10
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +1 -67
- package/dist/internal/layout/zones/DnDevHeader.js +1 -41
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
- package/dist/internal/layout/zones/index.js +1 -14
- package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/internal/providers/NavigationProvider.js +1 -71
- package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
- package/dist/internal/providers/SentryInitializer.js +1 -36
- package/dist/internal/providers/UIProviders.js +1 -79
- package/dist/internal/providers/index.js +1 -12
- package/dist/next.js +1 -11
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +1 -107
- package/dist/providers/ViteAppProviders.d.ts +11 -9
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +1 -117
- package/dist/providers/index.js +1 -11
- package/dist/routing/404.js +1 -108
- package/dist/routing/AuthGuard.js +1 -178
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -67
- package/dist/routing/AuthReturnTo.js +1 -68
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +1 -138
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +1 -38
- package/dist/routing/GoToDialog.d.ts.map +1 -1
- package/dist/routing/GoToDialog.js +1 -97
- package/dist/routing/GoToInput.d.ts.map +1 -1
- package/dist/routing/GoToInput.js +1 -49
- package/dist/routing/GoToWrapper.d.ts.map +1 -1
- package/dist/routing/GoToWrapper.js +1 -59
- package/dist/routing/Link.d.ts +10 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +1 -109
- package/dist/routing/NavigationItem.d.ts.map +1 -1
- package/dist/routing/NavigationItem.js +1 -44
- package/dist/routing/NotFoundDocument.d.ts +33 -0
- package/dist/routing/NotFoundDocument.d.ts.map +1 -0
- package/dist/routing/NotFoundDocument.js +1 -0
- package/dist/routing/SignedInRedirect.js +1 -47
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/index.js +1 -26
- package/dist/routing/hooks/types.js +0 -2
- package/dist/routing/hooks/useLocation.next.js +1 -35
- package/dist/routing/hooks/useLocation.vite.js +1 -13
- package/dist/routing/hooks/useMatch.next.js +1 -31
- package/dist/routing/hooks/useMatch.vite.js +1 -6
- package/dist/routing/hooks/useNavigate.next.js +1 -64
- package/dist/routing/hooks/useNavigate.vite.js +1 -61
- package/dist/routing/hooks/useParams.next.js +1 -9
- package/dist/routing/hooks/useParams.vite.js +1 -6
- package/dist/routing/hooks/useQueryParams.next.js +1 -66
- package/dist/routing/hooks/useQueryParams.vite.js +1 -66
- package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
- package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
- package/dist/routing/hooks/useRouteParam.next.js +1 -38
- package/dist/routing/hooks/useRouteParam.vite.js +1 -38
- package/dist/routing/hooks/useRoutePath.next.d.ts +5 -3
- package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -1
- package/dist/routing/hooks/useRoutePath.next.js +1 -36
- package/dist/routing/hooks/useRoutePath.vite.js +1 -25
- package/dist/routing/hooks/useSearchParams.next.js +1 -22
- package/dist/routing/hooks/useSearchParams.vite.js +1 -22
- package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
- package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -32
- package/dist/routing/link/InternalLink.next.d.ts +23 -0
- package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.next.js +1 -0
- package/dist/routing/link/InternalLink.vite.d.ts +22 -0
- package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.vite.js +1 -0
- package/dist/routing/link/absolutePath.d.ts +17 -0
- package/dist/routing/link/absolutePath.d.ts.map +1 -0
- package/dist/routing/link/absolutePath.js +1 -0
- package/dist/routing/link/link.next.d.ts +12 -0
- package/dist/routing/link/link.next.d.ts.map +1 -0
- package/dist/routing/link/link.next.js +1 -0
- package/dist/routing/link/link.vite.d.ts +12 -0
- package/dist/routing/link/link.vite.d.ts.map +1 -0
- package/dist/routing/link/link.vite.js +1 -0
- package/dist/routing/link/types.d.ts +30 -0
- package/dist/routing/link/types.d.ts.map +1 -0
- package/dist/routing/link/types.js +0 -0
- package/dist/routing/parentRoute.js +1 -43
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +1 -59
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +1 -114
- package/dist/routing/useRouteDiscovery.d.ts +4 -0
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +1 -313
- package/dist/rsc.d.ts +28 -0
- package/dist/rsc.d.ts.map +1 -0
- package/dist/rsc.js +1 -0
- package/dist/styles/index.css +113 -41
- package/dist/styles/index.js +1 -10
- package/dist/styles/layoutConstants.js +1 -134
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts +19 -19
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -297
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -23
- package/dist/utils/sanitizeSvg.js +1 -51
- package/dist/utils/tList.js +1 -42
- package/dist/utils/useAISafe.d.ts.map +1 -1
- package/dist/utils/useAISafe.js +1 -53
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +1 -78
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useAuthVisibility.js +1 -63
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.js +1 -57
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +1 -75
- package/dist/utils/useDeleteAccountSafe.js +1 -52
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -85
- package/dist/utils/useOAuthSafe.d.ts.map +1 -1
- package/dist/utils/useOAuthSafe.js +1 -38
- package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.js +1 -81
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +1 -235
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +1 -205
- package/dist/vite-routing/index.js +1 -11
- package/dist/vite.js +1 -10
- package/guidelines/COMPONENTS.md +3 -3
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +16 -0
- package/guidelines/SEO.md +160 -142
- package/package.json +18 -8
- package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
- package/dist/ChildRowsPicker-ISP365ON.js +0 -1
- package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
- package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
- package/dist/CookieConsent-QOUAY6B4.js +0 -1
- package/dist/GoToDialog-KSBGOIWO.js +0 -1
- package/dist/GoToDialog-XBK5EZF4.js +0 -1
- package/dist/chunk-3CIZFGST.js +0 -1
- package/dist/chunk-LHMKU342.js +0 -1
- package/dist/chunk-MS7ZIW5Z.js +0 -1
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-P2DHZWPY.js +0 -1
- package/dist/components/common/lucideIconByName.d.ts +0 -9
- package/dist/components/common/lucideIconByName.d.ts.map +0 -1
- package/dist/components/common/lucideIconByName.js +0 -32
- package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
- package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
- package/dist/internal/layout/components/PerformanceHints.js +0 -71
- package/dist/internal/layout/components/i18nSeoMeta.d.ts +0 -54
- package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +0 -1
- package/dist/internal/layout/components/i18nSeoMeta.js +0 -53
- package/dist/utils/useSeo.d.ts +0 -129
- package/dist/utils/useSeo.d.ts.map +0 -1
- package/dist/utils/useSeo.js +0 -151
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/internal/providers/UIProviders.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview UIProviders component
|
|
6
|
-
* @description Provides wrapper to basic UI components
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useEffect, useRef, useState } from 'react';
|
|
13
|
-
import { Dialog, LinkRendererProvider, Toaster, TooltipProvider, } from '@donotdev/components';
|
|
14
|
-
import { useOverlayStore } from '@donotdev/core';
|
|
15
|
-
// Platform-specific hooks via conditional exports
|
|
16
|
-
import { useNavigate, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
17
|
-
import { FormNavigationProvider, isCrudModuleAvailable } from '../../crud/crudImports';
|
|
18
|
-
import { Link } from '../../routing/Link';
|
|
19
|
-
import { getParentRoutePath } from '../../routing/parentRoute';
|
|
20
|
-
import { useAllRoutes } from '../../routing/useRouteDiscovery';
|
|
21
|
-
import DnDevErrorBoundary from '../common/DnDevErrorBoundary';
|
|
22
|
-
import GlobalErrorFallback from '../common/GlobalErrorFallback';
|
|
23
|
-
/** Router link for components' `href` props (Card): Next Link or react-router Link. */
|
|
24
|
-
function RouterLinkRenderer({ href, ...rest }) {
|
|
25
|
-
return _jsx(Link, { path: href, ...rest });
|
|
26
|
-
}
|
|
27
|
-
function UIGlobalErrorFallback(props) {
|
|
28
|
-
return _jsx(GlobalErrorFallback, { ...props });
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fills crud's form navigation placeholder with the app router, so
|
|
32
|
-
* `useEntityForm` can leave for the previous breadcrumb on save.
|
|
33
|
-
* Functions read the latest route at call time; the context value never
|
|
34
|
-
* changes, so forms do not re-render on navigation because of it.
|
|
35
|
-
*/
|
|
36
|
-
function FormNavigationBridge({ children }) {
|
|
37
|
-
const navigate = useNavigate();
|
|
38
|
-
const pathname = useRoutePath();
|
|
39
|
-
const routes = useAllRoutes();
|
|
40
|
-
const latest = useRef({ navigate, pathname, routes });
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
latest.current = { navigate, pathname, routes };
|
|
43
|
-
});
|
|
44
|
-
const [value] = useState(() => ({
|
|
45
|
-
navigate: (path) => {
|
|
46
|
-
void latest.current.navigate(path);
|
|
47
|
-
},
|
|
48
|
-
currentPath: () => latest.current.pathname,
|
|
49
|
-
parentPath: () => getParentRoutePath(latest.current.pathname, new Set(latest.current.routes.map((route) => route.path))),
|
|
50
|
-
}));
|
|
51
|
-
return _jsx(FormNavigationProvider, { value: value, children: children });
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Provides a wrapper to basic UI components
|
|
55
|
-
*
|
|
56
|
-
* @version 0.1.0
|
|
57
|
-
* @since 0.0.1
|
|
58
|
-
* @author AMBROISE PARK Consulting
|
|
59
|
-
*/
|
|
60
|
-
export function UIProviders({ children }) {
|
|
61
|
-
return (_jsx(DnDevErrorBoundary, { level: "app", fallback: UIGlobalErrorFallback, children: _jsx(LinkRendererProvider, { value: RouterLinkRenderer, children: _jsxs(TooltipProvider, { children: [isCrudModuleAvailable ? (_jsx(FormNavigationBridge, { children: children })) : (children), _jsx(Toaster, {}), _jsx(ModalDialog, {})] }) }) }));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* ModalDialog - Renders modal dialog using store directly
|
|
65
|
-
* Moved from ModalContext to avoid redundant context wrapper
|
|
66
|
-
*
|
|
67
|
-
* @version 0.1.0
|
|
68
|
-
* @since 0.0.1
|
|
69
|
-
* @author AMBROISE PARK Consulting
|
|
70
|
-
*/
|
|
71
|
-
function ModalDialog() {
|
|
72
|
-
const isOpen = useOverlayStore((state) => state.isOpen);
|
|
73
|
-
const content = useOverlayStore((state) => state.content);
|
|
74
|
-
const closeModal = useOverlayStore((state) => state.closeModal);
|
|
75
|
-
return (_jsx(Dialog, { open: isOpen, onOpenChange: (open) => {
|
|
76
|
-
if (!open)
|
|
77
|
-
closeModal();
|
|
78
|
-
}, children: content }));
|
|
79
|
-
}
|
|
1
|
+
"use client";import{useEffect as m,useRef as c,useState as u}from"react";import{Dialog as s,LinkRendererProvider as d,Toaster as v,TooltipProvider as f}from"@donotdev/components";import{useOverlayStore as p}from"@donotdev/core";import{useNavigate as P,useRoutePath as g}from"@donotdev/ui/routing/hooks";import{FormNavigationProvider as R,isCrudModuleAvailable as h}from"../../crud/crudImports.js";import{Link as k}from"../../routing/Link.js";import{getParentRoutePath as N}from"../../routing/parentRoute.js";import{useAllRoutes as F}from"../../routing/useRouteDiscovery.js";import b from"../common/DnDevErrorBoundary.js";import E from"../common/GlobalErrorFallback.js";import{jsx as e,jsxs as C}from"react/jsx-runtime";function y({href:r,...t}){return e(k,{path:r,...t})}function D(r){return e(E,{...r})}function L({children:r}){let t=P(),a=g(),o=F(),n=c({navigate:t,pathname:a,routes:o});m(()=>{n.current={navigate:t,pathname:a,routes:o}});let[l]=u(()=>({navigate:i=>{n.current.navigate(i)},currentPath:()=>n.current.pathname,parentPath:()=>N(n.current.pathname,new Set(n.current.routes.map(i=>i.path)))}));return e(R,{value:l,children:r})}function x({children:r}){return e(b,{level:"app",fallback:D,children:e(d,{value:y,children:C(f,{children:[h?e(L,{children:r}):r,e(v,{}),e(B,{})]})})})}function B(){let r=p(o=>o.isOpen),t=p(o=>o.content),a=p(o=>o.closeModal);return e(s,{open:r,onOpenChange:o=>{o||a()},children:t})}export{x as UIProviders};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview UI providers
|
|
4
|
-
* @description Provider components for DoNotDev framework
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
export { UIProviders } from './UIProviders';
|
|
11
|
-
export { NavigationProvider } from './NavigationProvider';
|
|
12
|
-
export { SentryInitializer } from './SentryInitializer';
|
|
1
|
+
import{UIProviders as e}from"./UIProviders.js";import{NavigationProvider as t}from"./NavigationProvider.js";import{SentryInitializer as f}from"./SentryInitializer.js";export{t as NavigationProvider,f as SentryInitializer,e as UIProviders};
|
package/dist/next.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Next.js App Providers
|
|
4
|
-
* @description Next.js-specific app providers export. Provides NextJsAppProviders component for Next.js applications.
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
export { NextJsAppProviders } from './providers/NextJsAppProviders';
|
|
11
|
-
export { FontPreloadLinks, default as FontPreloadLinksDefault, } from './internal/layout/components/FontPreloadLinks';
|
|
1
|
+
import{NextJsAppProviders as r}from"./providers/NextJsAppProviders.js";import{FontPreloadLinks as a,default as s}from"./internal/layout/components/FontPreloadLinks.js";export{a as FontPreloadLinks,s as FontPreloadLinksDefault,r as NextJsAppProviders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AA2F1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAQD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,+BA4FhE"}
|
|
@@ -1,107 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/providers/NextJsAppProviders.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview NextJsAppProviders component
|
|
6
|
-
* @description Next.js-specific app providers with SSR support
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useRouter } from 'next/navigation';
|
|
13
|
-
import { lazy, Suspense, useEffect, useMemo, useState } from 'react';
|
|
14
|
-
import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental';
|
|
15
|
-
import { AppConfigProvider, AuthSessionProvider, getI18nInstance, getLanguageRouting, getProvider, getRequestLanguage, hasProvider, isMultilingual, LanguageNavigationProvider, QueryProviders, RequestLanguageProvider, } from '@donotdev/core';
|
|
16
|
-
import { useConsent } from '@donotdev/core';
|
|
17
|
-
// Platform-specific hooks via conditional exports
|
|
18
|
-
import { useUrlLanguage } from '@donotdev/ui/routing/hooks';
|
|
19
|
-
import { NextJsStoresInitializer } from '../internal/initializers/NextJsStoresInitializer';
|
|
20
|
-
import { AutoMetaTags } from '../internal/layout/components/AutoMetaTags';
|
|
21
|
-
import FaviconHead from '../internal/layout/components/FaviconHead';
|
|
22
|
-
import { DnDevLayout } from '../internal/layout/DnDevLayout';
|
|
23
|
-
import { SentryInitializer } from '../internal/providers/SentryInitializer';
|
|
24
|
-
import { UIProviders } from '../internal/providers/UIProviders';
|
|
25
|
-
import { AuthReturnTo } from '../routing/AuthReturnTo';
|
|
26
|
-
import { PasswordResetCallback } from '../utils/useAuthSafe';
|
|
27
|
-
// Null fallback for lazy components that fail to load (e.g., optional auth dependency absent)
|
|
28
|
-
const NullFallback = () => null;
|
|
29
|
-
// Lazy load client-only components — each wrapped with catch to prevent hanging
|
|
30
|
-
// if an optional dependency (e.g., @donotdev/auth) is not installed.
|
|
31
|
-
const CookieConsent = lazy(() => import('../components/cookie-consent/CookieConsent').catch(() => ({ default: NullFallback })));
|
|
32
|
-
const PWAUpdateNotification = lazy(() => import('../internal/layout/components/PWAUpdateNotification')
|
|
33
|
-
.then((m) => ({ default: m.default }))
|
|
34
|
-
.catch(() => ({ default: NullFallback })));
|
|
35
|
-
const RedirectOverlay = lazy(() => import('../components/common/RedirectOverlay')
|
|
36
|
-
.then((m) => ({ default: m.RedirectOverlay }))
|
|
37
|
-
.catch(() => ({ default: NullFallback })));
|
|
38
|
-
/**
|
|
39
|
-
* ConsentBanner - Lazy loaded consent component
|
|
40
|
-
* Only shows if user hasn't consented yet
|
|
41
|
-
*
|
|
42
|
-
* @version 0.1.0
|
|
43
|
-
* @since 0.0.1
|
|
44
|
-
* @author AMBROISE PARK Consulting
|
|
45
|
-
*/
|
|
46
|
-
function ConsentBanner() {
|
|
47
|
-
const hasConsented = useConsent('hasConsented');
|
|
48
|
-
const showBanner = useConsent('showBanner');
|
|
49
|
-
if (hasConsented && !showBanner) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsent, {}) }));
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Language of the render. 2+ languages: the URL's (`/en/…`, the default language at
|
|
56
|
-
* the root; the generated proxy already moved a first visit to the visitor's
|
|
57
|
-
* language). One language: from the request headers (language cookie >
|
|
58
|
-
* Accept-Language > fallback). Same inputs on the server and in the hydration pass.
|
|
59
|
-
*/
|
|
60
|
-
function useRenderLanguage(serverCookies, acceptLanguage) {
|
|
61
|
-
const urlLanguage = useUrlLanguage();
|
|
62
|
-
const multilingual = isMultilingual(getLanguageRouting().languages);
|
|
63
|
-
const requestLanguage = useMemo(() => getRequestLanguage(serverCookies, acceptLanguage), [serverCookies, acceptLanguage]);
|
|
64
|
-
return multilingual ? urlLanguage : requestLanguage;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The live i18n instance follows the render language: a language switch navigates
|
|
68
|
-
* client-side to the other language's URL, and the page re-renders in it.
|
|
69
|
-
*/
|
|
70
|
-
function useFollowLanguage(language) {
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
const instance = getI18nInstance();
|
|
73
|
-
if (instance.language !== language)
|
|
74
|
-
void instance.changeLanguage(language);
|
|
75
|
-
}, [language]);
|
|
76
|
-
}
|
|
77
|
-
/** Auth session snapshot of the request, `null` when the auth provider cannot tell. */
|
|
78
|
-
function readAuthSnapshot(cookieHeader) {
|
|
79
|
-
if (cookieHeader === undefined || !hasProvider('auth'))
|
|
80
|
-
return null;
|
|
81
|
-
return getProvider('auth').readSessionSnapshot?.(cookieHeader) ?? null;
|
|
82
|
-
}
|
|
83
|
-
export function NextJsAppProviders(props) {
|
|
84
|
-
const { config = {}, layout, children, serverCookies, acceptLanguage, customStores, } = props;
|
|
85
|
-
// Same URL and header values on the server and in the hydration pass → same language
|
|
86
|
-
// and signed-in state on both, so the first paint is final (no keys, no auth swap).
|
|
87
|
-
const language = useRenderLanguage(serverCookies, acceptLanguage);
|
|
88
|
-
useFollowLanguage(language);
|
|
89
|
-
// Language switchers (core) open the other language's URL through the Next router
|
|
90
|
-
const router = useRouter();
|
|
91
|
-
const navigateToLanguage = (url) => router.push(url, { scroll: false });
|
|
92
|
-
const authSnapshot = useMemo(() => readAuthSnapshot(serverCookies), [serverCookies]);
|
|
93
|
-
// SSR is the default for Next apps: render the provider tree on the server so
|
|
94
|
-
// page content is present in the initial HTML (crawlable, real SSR). An app
|
|
95
|
-
// opts OUT with appConfig.ssr === false, restoring the legacy client-only
|
|
96
|
-
// render (the tree mounts after hydration). Hooks are still called
|
|
97
|
-
// unconditionally to keep render order stable.
|
|
98
|
-
const ssr = config.ssr !== false;
|
|
99
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
setIsMounted(true);
|
|
102
|
-
}, []);
|
|
103
|
-
if (!ssr && !isMounted) {
|
|
104
|
-
return _jsx(_Fragment, { children: children });
|
|
105
|
-
}
|
|
106
|
-
return (_jsx(RequestLanguageProvider, { language: language, children: _jsx(LanguageNavigationProvider, { navigate: navigateToLanguage, children: _jsx(AuthSessionProvider, { snapshot: authSnapshot, children: _jsxs(AppConfigProvider, { config: config, platform: "nextjs", children: [_jsx(SentryInitializer, {}), _jsxs(NextJsStoresInitializer, { serverCookies: serverCookies, customStores: customStores, children: [_jsx(FaviconHead, {}), _jsx(QueryProviders, { children: _jsx(ReactQueryStreamedHydration, { children: _jsxs(UIProviders, { children: [_jsx(AutoMetaTags, {}), _jsx(DnDevLayout, { layout: layout, children: children }), _jsx(ConsentBanner, {}), _jsx(AuthReturnTo, {}), _jsx(PasswordResetCallback, {}), _jsx(Suspense, { fallback: null, children: _jsx(PWAUpdateNotification, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(RedirectOverlay, {}) })] }) }) })] })] }) }) }) }));
|
|
107
|
-
}
|
|
1
|
+
"use client";import{useRouter as R}from"next/navigation";import{lazy as u,Suspense as i,useEffect as d,useMemo as p,useState as A}from"react";import{ReactQueryStreamedHydration as C}from"@tanstack/react-query-next-experimental";import{AppConfigProvider as k,AuthSessionProvider as b,getI18nInstance as x,getLanguageRouting as I,getProvider as q,getRequestLanguage as F,hasProvider as J,isMultilingual as M,LanguageNavigationProvider as w,QueryProviders as z,RequestLanguageProvider as D}from"@donotdev/core";import{useConsent as c}from"@donotdev/core";import{useUrlLanguage as Q}from"@donotdev/ui/routing/hooks";import{useCookieNoticeRequired as T}from"../components/cookie-consent/useCookieNoticeRequired.js";import{NextJsStoresInitializer as U}from"../internal/initializers/NextJsStoresInitializer.js";import{AutoMetaTags as B}from"../internal/layout/components/AutoMetaTags.js";import H from"../internal/layout/components/FaviconHead.js";import{DnDevLayout as O}from"../internal/layout/DnDevLayout.js";import{SentryInitializer as E}from"../internal/providers/SentryInitializer.js";import{UIProviders as W}from"../internal/providers/UIProviders.js";import{AuthReturnTo as j}from"../routing/AuthReturnTo.js";import{PasswordResetCallback as G}from"../utils/useAuthSafe.js";import{Fragment as ee,jsx as e,jsxs as s}from"react/jsx-runtime";var l=()=>null,K=u(()=>import("../components/cookie-consent/CookieConsent.js").catch(()=>({default:l}))),V=u(()=>import("../internal/layout/components/PWAUpdateNotification.js").then(t=>({default:t.default})).catch(()=>({default:l}))),X=u(()=>import("../components/common/RedirectOverlay.js").then(t=>({default:t.RedirectOverlay})).catch(()=>({default:l})));function Y(){let t=c("hasConsented"),o=c("showBanner");return!T()||t&&!o?null:e(i,{fallback:null,children:e(K,{})})}function Z(t,o){let n=Q(),a=M(I().languages),r=p(()=>F(t,o),[t,o]);return a?n:r}function _(t){d(()=>{let o=x();o.language!==t&&o.changeLanguage(t)},[t])}function $(t){return t===void 0||!J("auth")?null:q("auth").readSessionSnapshot?.(t)??null}function ve(t){let{config:o={},layout:n,children:a,serverCookies:r,acceptLanguage:f,customStores:m}=t,g=Z(r,f);_(g);let v=R(),P=N=>v.push(N,{scroll:!1}),h=p(()=>$(r),[r]),y=o.ssr!==!1,[L,S]=A(!1);return d(()=>{S(!0)},[]),!y&&!L?e(ee,{children:a}):e(D,{language:g,children:e(w,{navigate:P,children:e(b,{snapshot:h,children:s(k,{config:o,platform:"nextjs",children:[e(E,{}),s(U,{serverCookies:r,customStores:m,children:[e(H,{}),e(z,{children:e(C,{children:s(W,{children:[e(B,{}),e(O,{layout:n,children:a}),e(Y,{}),e(j,{}),e(G,{}),e(i,{fallback:null,children:e(V,{})}),e(i,{fallback:null,children:e(X,{})})]})})})]})]})})})})}export{ve as NextJsAppProviders};
|
|
@@ -15,17 +15,19 @@ import type { AppProvidersProps } from '@donotdev/core';
|
|
|
15
15
|
* 2. SentryInitializer (error monitoring)
|
|
16
16
|
* 3. ViteStoresInitializer (store setup)
|
|
17
17
|
* 4. HelmetProvider (head management)
|
|
18
|
-
* 5.
|
|
19
|
-
* 6. NavigationProvider (RouterProvider with auto-abort)
|
|
18
|
+
* 5. NavigationProvider (RouterProvider with auto-abort)
|
|
20
19
|
*
|
|
21
20
|
* Provider hierarchy (inside router via RootLayout):
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* 6. QueryProviders (React Query)
|
|
22
|
+
* 7. UIProviders (design system)
|
|
23
|
+
* 8. AutoMetaTags (SEO)
|
|
24
|
+
* 9. FrameworkReadySignal (framework initialization)
|
|
25
|
+
* 10. Layout (application layout)
|
|
26
|
+
* 11. ConsentBanner (cookie consent)
|
|
27
|
+
* 12. PWAUpdateNotification (PWA updates)
|
|
28
|
+
*
|
|
29
|
+
* No favicon component: the build writes the favicon tags into index.html and every
|
|
30
|
+
* prerendered page (`createViteFaviconPlugin`, `faviconHeadTags` of `@donotdev/core`).
|
|
29
31
|
*
|
|
30
32
|
* @version 0.1.0
|
|
31
33
|
* @since 0.0.1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViteAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/ViteAppProviders.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViteAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/ViteAppProviders.tsx"],"names":[],"mappings":"AAeA,OAAO,aAAa,CAAC;AACrB,OAAO,gBAAgB,CAAC;AACxB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AAUxB,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AA+B1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,+BAyDxD"}
|
|
@@ -1,117 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/ui/src/providers/ViteAppProviders.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview ViteAppProviders component
|
|
5
|
-
* @description Vite-specific app providers with lazy loading
|
|
6
|
-
*
|
|
7
|
-
* @version 0.1.0
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @author AMBROISE PARK Consulting
|
|
10
|
-
*/
|
|
11
|
-
import { lazy, Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
-
// Import virtual modules to populate globalThis._DNDEV_CONFIG_ before any components load
|
|
13
|
-
import 'virtual:env';
|
|
14
|
-
import 'virtual:themes';
|
|
15
|
-
import 'virtual:i18n-mapping';
|
|
16
|
-
import 'virtual:routes';
|
|
17
|
-
import 'virtual:assets';
|
|
18
|
-
import { AppConfigProvider, applyFirstVisitLanguage, getI18nInstance, getLanguageRouting, getUrlLanguage, LanguageNavigationProvider, } from '@donotdev/core';
|
|
19
|
-
import { ViteStoresInitializer } from '../internal/initializers/ViteStoresInitializer';
|
|
20
|
-
import { NavigationProvider } from '../internal/providers/NavigationProvider';
|
|
21
|
-
import { SentryInitializer } from '../internal/providers/SentryInitializer';
|
|
22
|
-
import { useRouteDiscovery } from '../routing/useRouteDiscovery';
|
|
23
|
-
import { createAppRouter } from '../vite-routing/AppRoutes';
|
|
24
|
-
// ✅ LAZY LOAD: Everything that imports Radix UI or react-router-dom
|
|
25
|
-
const HelmetProvider = lazy(() => import('react-helmet-async').then((m) => ({ default: m.HelmetProvider })));
|
|
26
|
-
// 🚨 CRITICAL: NavigationProvider must NOT be lazy loaded
|
|
27
|
-
// NavigationProvider uses React hooks (useEffect) and must load in the same chunk as React
|
|
28
|
-
// Lazy loading causes "Invalid hook call" errors because React's dispatcher is null when the chunk loads
|
|
29
|
-
// This has been tested - lazy loading NavigationProvider NEVER works, keep it eagerly imported
|
|
30
|
-
const FaviconHead = lazy(() => import('../internal/layout/components/FaviconHead').then((m) => ({
|
|
31
|
-
default: m.default,
|
|
32
|
-
})));
|
|
33
|
-
/** Language of the browser URL (prefix, else the default language). */
|
|
34
|
-
function currentUrlLanguage() {
|
|
35
|
-
return getUrlLanguage(window.location.pathname);
|
|
36
|
-
}
|
|
37
|
-
/** Stop the history listener of a router replaced by a language switch. */
|
|
38
|
-
function useDisposeReplacedRouter(router) {
|
|
39
|
-
const previous = useRef(router);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (previous.current !== router)
|
|
42
|
-
previous.current.dispose();
|
|
43
|
-
previous.current = router;
|
|
44
|
-
}, [router]);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* ViteAppProviders - Vite platform-specific app providers
|
|
48
|
-
*
|
|
49
|
-
* Clean provider hierarchy with configuration via context (no prop drilling).
|
|
50
|
-
* Uses React Router v7 data router pattern (RouterProvider + createBrowserRouter).
|
|
51
|
-
*
|
|
52
|
-
* Provider hierarchy (outside router):
|
|
53
|
-
* 1. AppConfigProvider (configuration context)
|
|
54
|
-
* 2. SentryInitializer (error monitoring)
|
|
55
|
-
* 3. ViteStoresInitializer (store setup)
|
|
56
|
-
* 4. HelmetProvider (head management)
|
|
57
|
-
* 5. FaviconHead (favicon configuration)
|
|
58
|
-
* 6. NavigationProvider (RouterProvider with auto-abort)
|
|
59
|
-
*
|
|
60
|
-
* Provider hierarchy (inside router via RootLayout):
|
|
61
|
-
* 7. QueryProviders (React Query)
|
|
62
|
-
* 8. UIProviders (design system)
|
|
63
|
-
* 9. AutoMetaTags (SEO)
|
|
64
|
-
* 10. FrameworkReadySignal (framework initialization)
|
|
65
|
-
* 11. Layout (application layout)
|
|
66
|
-
* 12. ConsentBanner (cookie consent)
|
|
67
|
-
* 13. PWAUpdateNotification (PWA updates)
|
|
68
|
-
*
|
|
69
|
-
* @version 0.1.0
|
|
70
|
-
* @since 0.0.1
|
|
71
|
-
* @author AMBROISE PARK Consulting
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```tsx
|
|
75
|
-
* <ViteAppProviders
|
|
76
|
-
* config={{ app: { name: 'My App' } }}
|
|
77
|
-
* />
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* Note: HomePage.tsx in src/pages/ is automatically used for the root route "/"
|
|
81
|
-
*/
|
|
82
|
-
export function ViteAppProviders(props) {
|
|
83
|
-
const { config = {}, layout, children, customStores } = props;
|
|
84
|
-
// Discover routes using the route discovery hook
|
|
85
|
-
const routeGroups = useRouteDiscovery();
|
|
86
|
-
// Create router instance using React Router v7 data router pattern
|
|
87
|
-
// Virtual modules are loaded at module level (lines 20-26), so routes are available
|
|
88
|
-
// HomePage.tsx is automatically assigned path "/" by RouteDiscovery convention
|
|
89
|
-
// Memoized so the router instance is stable across re-renders (Item 86)
|
|
90
|
-
// The router runs under the URL's language prefix (createAppRouter basename). A
|
|
91
|
-
// language switch moves the URL to the other language's prefix and recreates the
|
|
92
|
-
// router under it: client-side, no document reload.
|
|
93
|
-
const [urlLanguage, setUrlLanguage] = useState(currentUrlLanguage);
|
|
94
|
-
const router = useMemo(() => createAppRouter({ routeGroups, layout }),
|
|
95
|
-
// urlLanguage: a new router (new basename) per URL language
|
|
96
|
-
[routeGroups, layout, urlLanguage]);
|
|
97
|
-
useDisposeReplacedRouter(router);
|
|
98
|
-
// Back/forward across languages: the router of the other prefix takes over
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
const onPopState = () => {
|
|
101
|
-
// Same rule as a first visit (and as the Next proxy) for an unprefixed URL
|
|
102
|
-
const routing = getLanguageRouting();
|
|
103
|
-
applyFirstVisitLanguage(routing.languages, routing.defaultLanguage);
|
|
104
|
-
const language = currentUrlLanguage();
|
|
105
|
-
void getI18nInstance().changeLanguage(language);
|
|
106
|
-
setUrlLanguage(language);
|
|
107
|
-
};
|
|
108
|
-
window.addEventListener('popstate', onPopState);
|
|
109
|
-
return () => window.removeEventListener('popstate', onPopState);
|
|
110
|
-
}, []);
|
|
111
|
-
const navigateToLanguage = (url, language) => {
|
|
112
|
-
window.history.pushState(null, '', url);
|
|
113
|
-
void getI18nInstance().changeLanguage(language);
|
|
114
|
-
setUrlLanguage(language);
|
|
115
|
-
};
|
|
116
|
-
return (_jsxs(AppConfigProvider, { config: config, platform: "vite", children: [_jsx(SentryInitializer, {}), _jsx(ViteStoresInitializer, { customStores: customStores, children: _jsx(Suspense, { fallback: null, children: _jsxs(HelmetProvider, { children: [_jsx(FaviconHead, {}), _jsx(LanguageNavigationProvider, { navigate: navigateToLanguage, children: _jsx(NavigationProvider, { router: router }) })] }) }) })] }));
|
|
117
|
-
}
|
|
1
|
+
"use client";import{lazy as d,Suspense as f,useEffect as m,useMemo as L,useRef as P,useState as S}from"react";import"virtual:env";import"virtual:themes";import"virtual:i18n-mapping";import"virtual:routes";import"virtual:assets";import{AppConfigProvider as y,applyFirstVisitLanguage as w,getI18nInstance as s,getLanguageRouting as R,getUrlLanguage as h,LanguageNavigationProvider as A}from"@donotdev/core";import{ViteStoresInitializer as I}from"../internal/initializers/ViteStoresInitializer.js";import{NavigationProvider as N}from"../internal/providers/NavigationProvider.js";import{SentryInitializer as z}from"../internal/providers/SentryInitializer.js";import{useRouteDiscovery as V}from"../routing/useRouteDiscovery.js";import{createAppRouter as E}from"../vite-routing/AppRoutes.js";import{jsx as t,jsxs as U}from"react/jsx-runtime";var H=d(()=>import("react-helmet-async").then(e=>({default:e.HelmetProvider})));function c(){return h(window.location.pathname)}function T(e){let o=P(e);m(()=>{o.current!==e&&o.current.dispose(),o.current=e},[e])}function W(e){let{config:o={},layout:i,children:C,customStores:v}=e,a=V(),[l,g]=S(c),u=L(()=>E({routeGroups:a,layout:i}),[a,i,l]);return T(u),m(()=>{let n=()=>{let r=R();w(r.languages,r.defaultLanguage);let p=c();s().changeLanguage(p),g(p)};return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)},[]),U(y,{config:o,platform:"vite",children:[t(z,{}),t(I,{customStores:v,children:t(f,{fallback:null,children:t(H,{children:t(A,{navigate:(n,r)=>{window.history.pushState(null,"",n),s().changeLanguage(r),g(r)},children:t(N,{router:u})})})})})]})}export{W as ViteAppProviders};
|
package/dist/providers/index.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview UI providers
|
|
4
|
-
* @description Provider components for DoNotDev framework
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
export { ViteAppProviders } from './ViteAppProviders';
|
|
11
|
-
export { NextJsAppProviders } from './NextJsAppProviders';
|
|
1
|
+
import{ViteAppProviders as o}from"./ViteAppProviders.js";import{NextJsAppProviders as t}from"./NextJsAppProviders.js";export{t as NextJsAppProviders,o as ViteAppProviders};
|
package/dist/routing/404.js
CHANGED
|
@@ -1,108 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/routing/404.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview 404 Not Found page component
|
|
6
|
-
* @description Professional 404 page with full-viewport centered layout, i18n, and dynamic route suggestions
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { Home, ArrowLeft, Link as LinkIcon } from 'lucide-react';
|
|
13
|
-
import { useMemo } from 'react';
|
|
14
|
-
import { Button, BUTTON_VARIANT, Stack, Text } from '@donotdev/components';
|
|
15
|
-
import { useTranslation } from '@donotdev/core';
|
|
16
|
-
// Platform-specific hooks via conditional exports
|
|
17
|
-
import { useNavigate, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
18
|
-
import { Link } from './Link';
|
|
19
|
-
import { useNavigationItems } from './useNavigation';
|
|
20
|
-
import { Icon } from '../components/common/icon';
|
|
21
|
-
import { PageContainer } from '../components/layout/PageContainer';
|
|
22
|
-
/**
|
|
23
|
-
* 404 Not Found page metadata configuration
|
|
24
|
-
*
|
|
25
|
-
* @version 0.1.0
|
|
26
|
-
* @since 0.0.1
|
|
27
|
-
* @author AMBROISE PARK Consulting
|
|
28
|
-
*/
|
|
29
|
-
export const meta = {
|
|
30
|
-
hideFromMenu: true,
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Professional 404 Not Found page component
|
|
34
|
-
*
|
|
35
|
-
* Features:
|
|
36
|
-
* - Full-viewport centered design for professional appearance
|
|
37
|
-
* - Translation system integration (i18n)
|
|
38
|
-
* - Dynamic route suggestions from discovered routes
|
|
39
|
-
* - Optional requested-path badge (shown by default for existing consumers)
|
|
40
|
-
* - Accessible design with proper semantic HTML
|
|
41
|
-
* - Responsive across all viewports
|
|
42
|
-
*
|
|
43
|
-
* Legacy errors.notFound keys are compatibility references to the canonical
|
|
44
|
-
* messages.notFound resources. Keep lookups here so legacy app overrides win.
|
|
45
|
-
*
|
|
46
|
-
* @version 0.1.0
|
|
47
|
-
* @since 0.0.1
|
|
48
|
-
* @author AMBROISE PARK Consulting
|
|
49
|
-
*/
|
|
50
|
-
export default function NotFoundPage({ showRequestedPath = true, } = {}) {
|
|
51
|
-
const { t } = useTranslation('dndev');
|
|
52
|
-
const pathname = useRoutePath();
|
|
53
|
-
const navigate = useNavigate();
|
|
54
|
-
const navigationItems = useNavigationItems();
|
|
55
|
-
/**
|
|
56
|
-
* Get suggested routes for navigation
|
|
57
|
-
* Filters out dynamic routes, home, and limits to 4 suggestions
|
|
58
|
-
*/
|
|
59
|
-
const suggestedRoutes = useMemo(() => {
|
|
60
|
-
return navigationItems
|
|
61
|
-
.filter((route) => !route.path.includes(':') && route.path !== '/')
|
|
62
|
-
.slice(0, 4);
|
|
63
|
-
}, [navigationItems]);
|
|
64
|
-
/**
|
|
65
|
-
* Handle back button click
|
|
66
|
-
* Uses navigate('back') for platform-agnostic back navigation
|
|
67
|
-
*/
|
|
68
|
-
const handleBack = () => {
|
|
69
|
-
navigate('back');
|
|
70
|
-
};
|
|
71
|
-
return (_jsx(PageContainer, { variant: "docs", centered: true, children: _jsxs(Stack, { gap: "large", align: "center", justify: "center", children: [_jsxs(Stack, { align: "center", children: [_jsx(Text, { level: "h1", style: {
|
|
72
|
-
fontSize: 'clamp(4rem, 12vw, 8rem)',
|
|
73
|
-
fontWeight: 'var(--font-weight-bold)',
|
|
74
|
-
lineHeight: 1,
|
|
75
|
-
letterSpacing: '-0.02em',
|
|
76
|
-
background: 'linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%)',
|
|
77
|
-
WebkitBackgroundClip: 'text',
|
|
78
|
-
WebkitTextFillColor: 'transparent',
|
|
79
|
-
backgroundClip: 'text',
|
|
80
|
-
margin: 0,
|
|
81
|
-
}, children: "404" }), _jsx(Text, { level: "h2", style: {
|
|
82
|
-
fontSize: 'var(--font-size-2xl)',
|
|
83
|
-
fontWeight: 'var(--font-weight-semibold)',
|
|
84
|
-
margin: 0,
|
|
85
|
-
}, children: t('errors.notFound.title', 'Page Not Found') }), _jsx(Text, { style: {
|
|
86
|
-
fontSize: 'var(--font-size-lg)',
|
|
87
|
-
color: 'var(--muted-foreground)',
|
|
88
|
-
textAlign: 'center',
|
|
89
|
-
margin: 0,
|
|
90
|
-
}, children: t('errors.notFound.description', "The page you're looking for doesn't exist or has been moved.") }), showRequestedPath && pathname && (_jsx("code", { style: {
|
|
91
|
-
padding: 'var(--gap-sm) var(--gap-md)',
|
|
92
|
-
background: 'var(--muted)',
|
|
93
|
-
borderRadius: 'var(--radius-md)',
|
|
94
|
-
fontSize: 'var(--font-size-sm)',
|
|
95
|
-
fontFamily: 'var(--font-mono)',
|
|
96
|
-
color: 'var(--foreground)',
|
|
97
|
-
wordBreak: 'break-all',
|
|
98
|
-
maxWidth: '100%',
|
|
99
|
-
overflow: 'hidden',
|
|
100
|
-
textOverflow: 'ellipsis',
|
|
101
|
-
border: '1px solid var(--border-hairline)',
|
|
102
|
-
}, children: pathname }))] }), suggestedRoutes.length > 0 && (_jsxs(Stack, { align: "center", children: [_jsx("p", { className: "dndev-text-base", style: {
|
|
103
|
-
fontSize: 'var(--font-size-md)',
|
|
104
|
-
fontWeight: 'var(--font-weight-semibold)',
|
|
105
|
-
margin: 0,
|
|
106
|
-
color: 'var(--muted-foreground)',
|
|
107
|
-
}, children: t('errors.notFound.suggestions', 'You might be looking for:') }), _jsx(Stack, { direction: "row", wrap: "wrap", justify: "center", gap: "tight", children: suggestedRoutes.map((route) => (_jsx(Link, { path: route.path, replace: true, children: _jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, icon: _jsx(Icon, { icon: route.icon, fallback: LinkIcon }), "aria-label": t('errors.notFound.navigateTo', `Navigate to ${route.label}`, { label: route.label }), children: route.label }) }, route.path))) })] })), _jsxs(Stack, { direction: "row", wrap: "wrap", justify: "center", children: [_jsx(Link, { path: "/", replace: true, children: _jsx(Button, { variant: BUTTON_VARIANT.DEFAULT, icon: Home, "aria-label": t('errors.notFound.goHome', 'Go to home page'), children: t('errors.notFound.goHome', 'Go Home') }) }), _jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, icon: ArrowLeft, onClick: handleBack, "aria-label": t('errors.notFound.goBack', 'Go back to previous page'), children: t('errors.notFound.goBack', 'Go Back') })] })] }) }));
|
|
108
|
-
}
|
|
1
|
+
"use client";import{Home as f,ArrowLeft as v,Link as h}from"lucide-react";import{useMemo as k}from"react";import{Button as n,BUTTON_VARIANT as i,Stack as r,Text as l}from"@donotdev/components";import{useTranslation as b}from"@donotdev/core";import{useNavigate as w,useRoutePath as x}from"@donotdev/ui/routing/hooks";import{Link as g}from"./Link.js";import{useNavigationItems as F}from"./useNavigation.js";import{Icon as T}from"../components/common/icon.js";import{PageContainer as y}from"../components/layout/PageContainer.js";import{jsx as e,jsxs as a}from"react/jsx-runtime";var H={hideFromMenu:!0};function S({showRequestedPath:m=!0}={}){let{t}=b("dndev"),s=x(),p=w(),d=F(),c=k(()=>d.filter(o=>!o.path.includes(":")&&o.path!=="/").slice(0,4),[d]),u=()=>{p("back")};return e(y,{variant:"docs",centered:!0,children:a(r,{gap:"large",align:"center",justify:"center",children:[a(r,{align:"center",children:[e(l,{level:"h1",style:{fontSize:"clamp(4rem, 12vw, 8rem)",fontWeight:"var(--font-weight-bold)",lineHeight:1,letterSpacing:"-0.02em",background:"linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",margin:0},children:"404"}),e(l,{level:"h2",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-semibold)",margin:0},children:t("errors.notFound.title","Page Not Found")}),e(l,{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",textAlign:"center",margin:0},children:t("errors.notFound.description","The page you're looking for doesn't exist or has been moved.")}),m&&s&&e("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-md)",fontSize:"var(--font-size-sm)",fontFamily:"var(--font-mono)",color:"var(--foreground)",wordBreak:"break-all",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",border:"1px solid var(--border-hairline)"},children:s})]}),c.length>0&&a(r,{align:"center",children:[e("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-md)",fontWeight:"var(--font-weight-semibold)",margin:0,color:"var(--muted-foreground)"},children:t("errors.notFound.suggestions","You might be looking for:")}),e(r,{direction:"row",wrap:"wrap",justify:"center",gap:"tight",children:c.map(o=>e(g,{path:o.path,replace:!0,children:e(n,{variant:i.OUTLINE,icon:e(T,{icon:o.icon,fallback:h}),"aria-label":t("errors.notFound.navigateTo",`Navigate to ${o.label}`,{label:o.label}),children:o.label})},o.path))})]}),a(r,{direction:"row",wrap:"wrap",justify:"center",children:[e(g,{path:"/",replace:!0,children:e(n,{variant:i.DEFAULT,icon:f,"aria-label":t("errors.notFound.goHome","Go to home page"),children:t("errors.notFound.goHome","Go Home")})}),e(n,{variant:i.OUTLINE,icon:v,onClick:u,"aria-label":t("errors.notFound.goBack","Go back to previous page"),children:t("errors.notFound.goBack","Go Back")})]})]})})}export{S as default,H as meta};
|