@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,32 +0,0 @@
|
|
|
1
|
-
// packages/ui/src/components/common/lucideIconByName.ts
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Runtime Lucide icon lookup by export name
|
|
4
|
-
* @description Typed replacement for `(LucideIcons as any)[name]`. Internal to @donotdev/ui (not re-exported).
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.2.2
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
import * as LucideIcons from 'lucide-react';
|
|
11
|
-
/** The lucide-react namespace viewed as a name-indexed lookup table. */
|
|
12
|
-
const LUCIDE_EXPORTS = LucideIcons;
|
|
13
|
-
/**
|
|
14
|
-
* Narrows a lucide-react export to an icon component (function or forwardRef object).
|
|
15
|
-
*
|
|
16
|
-
* @param value - Any lucide-react export
|
|
17
|
-
* @returns True when the export is renderable as an icon component
|
|
18
|
-
*/
|
|
19
|
-
function isLucideIcon(value) {
|
|
20
|
-
return (typeof value === 'function' ||
|
|
21
|
-
(typeof value === 'object' && value !== null && 'render' in value));
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Finds a Lucide icon component by its export name (e.g. `"Rocket"`).
|
|
25
|
-
*
|
|
26
|
-
* @param name - Lucide export name
|
|
27
|
-
* @returns The icon component, or undefined when no icon export has that name
|
|
28
|
-
*/
|
|
29
|
-
export function findLucideIcon(name) {
|
|
30
|
-
const candidate = LUCIDE_EXPORTS[name];
|
|
31
|
-
return isLucideIcon(candidate) ? candidate : undefined;
|
|
32
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Performance hints for faster page loads
|
|
3
|
-
* @description Adds preconnect, dns-prefetch, and font preload hints
|
|
4
|
-
*
|
|
5
|
-
* - Preconnect establishes early connections (DNS + TCP + TLS) to origins
|
|
6
|
-
* the page will need, saving 100-300ms per origin on slow networks.
|
|
7
|
-
* - Font preload initiates font downloads early, reducing LCP by ~500-1000ms
|
|
8
|
-
*
|
|
9
|
-
* @version 0.1.0
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
* @author AMBROISE PARK Consulting
|
|
12
|
-
*/
|
|
13
|
-
import type { ComponentType } from 'react';
|
|
14
|
-
interface FontPreload {
|
|
15
|
-
/** Path to font file (e.g., '/fonts/Inter-latin.woff2') */
|
|
16
|
-
href: string;
|
|
17
|
-
/** Font MIME type @default 'font/woff2' */
|
|
18
|
-
type?: string;
|
|
19
|
-
/** Cross-origin setting @default 'anonymous' */
|
|
20
|
-
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
21
|
-
}
|
|
22
|
-
interface PerformanceHintsProps {
|
|
23
|
-
/**
|
|
24
|
-
* Additional origins to preconnect to
|
|
25
|
-
* These are merged with defaults
|
|
26
|
-
*/
|
|
27
|
-
preconnects?: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Additional origins to dns-prefetch
|
|
30
|
-
* These are merged with defaults
|
|
31
|
-
*/
|
|
32
|
-
dnsPrefetch?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* Additional fonts to preload (optional). Framework injects preloads at build time for Vite/Next;
|
|
35
|
-
* use this prop only for extra or custom font URLs.
|
|
36
|
-
* @default []
|
|
37
|
-
*/
|
|
38
|
-
fontPreloads?: (string | FontPreload)[];
|
|
39
|
-
/**
|
|
40
|
-
* Disable default preconnects (use only custom ones)
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
disableDefaults?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Disable default font preloads
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
disableFontPreloads?: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* PerformanceHints component
|
|
52
|
-
*
|
|
53
|
-
* Adds preconnect, dns-prefetch, and font preload hints to improve page load.
|
|
54
|
-
* Automatically includes common third-party origins and critical fonts.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* // Default: preconnect/dns-prefetch only; font preload handled by framework build (Vite/Next)
|
|
59
|
-
* <PerformanceHints />
|
|
60
|
-
*
|
|
61
|
-
* // Add custom font preload URLs
|
|
62
|
-
* <PerformanceHints fontPreloads={[customFontUrl]} />
|
|
63
|
-
*
|
|
64
|
-
* // Disable font preloads
|
|
65
|
-
* <PerformanceHints disableFontPreloads />
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
declare const PerformanceHints: ComponentType<PerformanceHintsProps>;
|
|
69
|
-
export default PerformanceHints;
|
|
70
|
-
export type { FontPreload, PerformanceHintsProps };
|
|
71
|
-
//# sourceMappingURL=PerformanceHints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceHints.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/PerformanceHints.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAsC3C,UAAU,WAAW;IACnB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;CAC/C;AAED,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC;IACxC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,gBAAgB,EAAE,aAAa,CAAC,qBAAqB,CA6D1D,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { HeadTags } from './HeadTags';
|
|
4
|
-
/**
|
|
5
|
-
* Common third-party origins that benefit from preconnect
|
|
6
|
-
* Only includes origins that are commonly used and safe to preconnect
|
|
7
|
-
*/
|
|
8
|
-
const DEFAULT_PRECONNECTS = [
|
|
9
|
-
// YouTube embeds - thumbnails and iframe
|
|
10
|
-
'https://img.youtube.com',
|
|
11
|
-
'https://www.youtube.com',
|
|
12
|
-
// Google Fonts (if used)
|
|
13
|
-
'https://fonts.googleapis.com',
|
|
14
|
-
'https://fonts.gstatic.com',
|
|
15
|
-
// Google APIs (Firebase, Analytics, etc.)
|
|
16
|
-
'https://www.googleapis.com',
|
|
17
|
-
// Stripe (if used)
|
|
18
|
-
'https://js.stripe.com',
|
|
19
|
-
];
|
|
20
|
-
/**
|
|
21
|
-
* Origins to dns-prefetch only (less aggressive than preconnect)
|
|
22
|
-
* Use for origins that might be needed but aren't certain
|
|
23
|
-
*/
|
|
24
|
-
const DEFAULT_DNS_PREFETCH = [
|
|
25
|
-
'https://www.google-analytics.com',
|
|
26
|
-
'https://www.googletagmanager.com',
|
|
27
|
-
];
|
|
28
|
-
/**
|
|
29
|
-
* Default critical fonts to preload.
|
|
30
|
-
* Empty: when using the framework's Vite or Next setup, font preload is handled by build-time
|
|
31
|
-
* injection (Vite: FontPreloadPlugin patches index.html; Next: FontPreloadLinks in root layout
|
|
32
|
-
* reads public/dndev-font-preloads.json). Pass fontPreloads only for extra/custom URLs.
|
|
33
|
-
*/
|
|
34
|
-
const DEFAULT_FONT_PRELOADS = [];
|
|
35
|
-
/**
|
|
36
|
-
* PerformanceHints component
|
|
37
|
-
*
|
|
38
|
-
* Adds preconnect, dns-prefetch, and font preload hints to improve page load.
|
|
39
|
-
* Automatically includes common third-party origins and critical fonts.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* // Default: preconnect/dns-prefetch only; font preload handled by framework build (Vite/Next)
|
|
44
|
-
* <PerformanceHints />
|
|
45
|
-
*
|
|
46
|
-
* // Add custom font preload URLs
|
|
47
|
-
* <PerformanceHints fontPreloads={[customFontUrl]} />
|
|
48
|
-
*
|
|
49
|
-
* // Disable font preloads
|
|
50
|
-
* <PerformanceHints disableFontPreloads />
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
const PerformanceHints = ({ preconnects = [], dnsPrefetch = [], fontPreloads = [], disableDefaults = false, disableFontPreloads = false, }) => {
|
|
54
|
-
// Merge defaults with custom origins
|
|
55
|
-
const allPreconnects = disableDefaults
|
|
56
|
-
? preconnects
|
|
57
|
-
: [...new Set([...DEFAULT_PRECONNECTS, ...preconnects])];
|
|
58
|
-
const allDnsPrefetch = disableDefaults
|
|
59
|
-
? dnsPrefetch
|
|
60
|
-
: [...new Set([...DEFAULT_DNS_PREFETCH, ...dnsPrefetch])];
|
|
61
|
-
// Normalize font preloads to FontPreload objects
|
|
62
|
-
const normalizeFontPreload = (font) => typeof font === 'string' ? { href: font } : font;
|
|
63
|
-
const customFontPaths = fontPreloads.map((f) => typeof f === 'string' ? f : f.href);
|
|
64
|
-
const allFontPreloads = disableFontPreloads
|
|
65
|
-
? []
|
|
66
|
-
: fontPreloads.length > 0
|
|
67
|
-
? fontPreloads.map(normalizeFontPreload)
|
|
68
|
-
: DEFAULT_FONT_PRELOADS.filter((f) => !customFontPaths.includes(f)).map(normalizeFontPreload);
|
|
69
|
-
return (_jsxs(HeadTags, { children: [allFontPreloads.map((font) => (_jsx("link", { rel: "preload", as: "font", href: font.href, type: font.type || 'font/woff2', crossOrigin: font.crossOrigin || 'anonymous' }, `font-${font.href}`))), allPreconnects.map((origin) => (_jsx("link", { rel: "preconnect", href: origin, crossOrigin: "anonymous" }, `preconnect-${origin}`))), allDnsPrefetch.map((origin) => (_jsx("link", { rel: "dns-prefetch", href: origin }, `dns-${origin}`)))] }));
|
|
70
|
-
};
|
|
71
|
-
export default PerformanceHints;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview SEO fields from a namespace's `meta` translations
|
|
3
|
-
* @description Reads `<ns>:meta.*` key by key, as the i18n convention requires:
|
|
4
|
-
* `useTranslation` returns strings only, never objects or arrays.
|
|
5
|
-
*
|
|
6
|
-
* @version 0.2.2
|
|
7
|
-
* @since 0.2.2
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
import type { TFunction } from 'i18next';
|
|
11
|
-
/**
|
|
12
|
-
* Resolves a title or description: explicit value, else its translation.
|
|
13
|
-
*
|
|
14
|
-
* @param seoValue - `null` omits the field, a string is used as is, `undefined` looks up the translation
|
|
15
|
-
* @param translationKey - Namespaced key, e.g. `home:description`
|
|
16
|
-
* @param t - Translation function loaded with the key's namespace
|
|
17
|
-
* @returns The resolved text, or undefined when omitted or not translated
|
|
18
|
-
*
|
|
19
|
-
* @version 0.2.2
|
|
20
|
-
* @since 0.2.2
|
|
21
|
-
* @author AMBROISE PARK Consulting
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveSeoField(seoValue: string | null | undefined, translationKey: string, t: TFunction): string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* SEO fields a namespace can define under `meta`.
|
|
26
|
-
*
|
|
27
|
-
* @version 0.2.2
|
|
28
|
-
* @since 0.2.2
|
|
29
|
-
* @author AMBROISE PARK Consulting
|
|
30
|
-
*/
|
|
31
|
-
export interface I18nSeoMeta {
|
|
32
|
-
fullTitle?: string;
|
|
33
|
-
image?: string;
|
|
34
|
-
type?: string;
|
|
35
|
-
keywords?: string[];
|
|
36
|
-
author?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Reads the SEO fields of a namespace from its translations.
|
|
40
|
-
*
|
|
41
|
-
* @param t - Translation function loaded with `ns`
|
|
42
|
-
* @param ns - Namespace holding the `meta` object
|
|
43
|
-
* @returns The defined fields; a missing or empty field is undefined
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* // JSON: { "meta": { "image": "/og.png", "keywords": ["a", "b"] } }
|
|
47
|
-
* readI18nSeoMeta(t, 'home'); // { image: '/og.png', keywords: ['a', 'b'] }
|
|
48
|
-
*
|
|
49
|
-
* @version 0.2.2
|
|
50
|
-
* @since 0.2.2
|
|
51
|
-
* @author AMBROISE PARK Consulting
|
|
52
|
-
*/
|
|
53
|
-
export declare function readI18nSeoMeta(t: TFunction, ns: string): I18nSeoMeta;
|
|
54
|
-
//# sourceMappingURL=i18nSeoMeta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18nSeoMeta.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/i18nSeoMeta.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAUzC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,EACtB,CAAC,EAAE,SAAS,GACX,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAmBrE"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// packages/ui/src/internal/layout/components/i18nSeoMeta.ts
|
|
2
|
-
import { translateArray } from '@donotdev/core';
|
|
3
|
-
/** Upper bound for translateArray: keywords past it are not emitted. */
|
|
4
|
-
const MAX_KEYWORDS = 20;
|
|
5
|
-
/** An empty default is how a missing key is detected: on a namespaced key, i18next returns the key without its namespace. */
|
|
6
|
-
const EMPTY_WHEN_MISSING = { defaultValue: '' };
|
|
7
|
-
/**
|
|
8
|
-
* Resolves a title or description: explicit value, else its translation.
|
|
9
|
-
*
|
|
10
|
-
* @param seoValue - `null` omits the field, a string is used as is, `undefined` looks up the translation
|
|
11
|
-
* @param translationKey - Namespaced key, e.g. `home:description`
|
|
12
|
-
* @param t - Translation function loaded with the key's namespace
|
|
13
|
-
* @returns The resolved text, or undefined when omitted or not translated
|
|
14
|
-
*
|
|
15
|
-
* @version 0.2.2
|
|
16
|
-
* @since 0.2.2
|
|
17
|
-
* @author AMBROISE PARK Consulting
|
|
18
|
-
*/
|
|
19
|
-
export function resolveSeoField(seoValue, translationKey, t) {
|
|
20
|
-
if (seoValue === null)
|
|
21
|
-
return undefined;
|
|
22
|
-
if (seoValue !== undefined)
|
|
23
|
-
return seoValue;
|
|
24
|
-
return t(translationKey, EMPTY_WHEN_MISSING) || undefined;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Reads the SEO fields of a namespace from its translations.
|
|
28
|
-
*
|
|
29
|
-
* @param t - Translation function loaded with `ns`
|
|
30
|
-
* @param ns - Namespace holding the `meta` object
|
|
31
|
-
* @returns The defined fields; a missing or empty field is undefined
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // JSON: { "meta": { "image": "/og.png", "keywords": ["a", "b"] } }
|
|
35
|
-
* readI18nSeoMeta(t, 'home'); // { image: '/og.png', keywords: ['a', 'b'] }
|
|
36
|
-
*
|
|
37
|
-
* @version 0.2.2
|
|
38
|
-
* @since 0.2.2
|
|
39
|
-
* @author AMBROISE PARK Consulting
|
|
40
|
-
*/
|
|
41
|
-
export function readI18nSeoMeta(t, ns) {
|
|
42
|
-
// why: TFunction is an i18next overload set; a single-signature wrapper cannot satisfy it structurally
|
|
43
|
-
const translateOrEmpty = ((key) => t(key, EMPTY_WHEN_MISSING));
|
|
44
|
-
const field = (name) => translateOrEmpty(`${ns}:meta.${name}`) || undefined;
|
|
45
|
-
const keywords = translateArray(translateOrEmpty, `${ns}:meta.keywords`, MAX_KEYWORDS);
|
|
46
|
-
return {
|
|
47
|
-
fullTitle: field('fullTitle'),
|
|
48
|
-
image: field('image'),
|
|
49
|
-
type: field('type'),
|
|
50
|
-
keywords: keywords.length > 0 ? keywords : undefined,
|
|
51
|
-
author: field('author'),
|
|
52
|
-
};
|
|
53
|
-
}
|
package/dist/utils/useSeo.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Dynamic SEO Component
|
|
3
|
-
* @description Isomorphic component for setting SEO metadata at runtime.
|
|
4
|
-
* Works with both static pages and dynamic data (after fetch).
|
|
5
|
-
* Uses react-helmet-async internally - works in SSR/prerender.
|
|
6
|
-
*
|
|
7
|
-
* Priority (highest to lowest):
|
|
8
|
-
* 1. <Seo /> component - runtime, always wins
|
|
9
|
-
* 2. i18n meta.fullTitle - translated
|
|
10
|
-
* 3. seo.fullTitle (PageMeta) - static fallback
|
|
11
|
-
* 4. seo.title / i18n title - "title | siteName"
|
|
12
|
-
* 5. siteName only
|
|
13
|
-
*
|
|
14
|
-
* @example Basic usage
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const { data: apartment } = useApartment(id);
|
|
17
|
-
*
|
|
18
|
-
* return (
|
|
19
|
-
* <>
|
|
20
|
-
* {apartment && (
|
|
21
|
-
* <Seo
|
|
22
|
-
* fullTitle={`${apartment.reference} - €${apartment.rent} | 아이수수`}
|
|
23
|
-
* description={apartment.description}
|
|
24
|
-
* image={apartment.photos[0]}
|
|
25
|
-
* />
|
|
26
|
-
* )}
|
|
27
|
-
* <ApartmentDetails data={apartment} />
|
|
28
|
-
* </>
|
|
29
|
-
* );
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @version 0.1.0
|
|
33
|
-
* @since 0.2.0
|
|
34
|
-
* @author AMBROISE PARK Consulting
|
|
35
|
-
*/
|
|
36
|
-
import type { ReactElement } from 'react';
|
|
37
|
-
import type { AnyEntity, EntitySeoRecord, SeoMeta } from '@donotdev/core';
|
|
38
|
-
/**
|
|
39
|
-
* Dynamic SEO props
|
|
40
|
-
* Extends SeoMeta with runtime-specific fields
|
|
41
|
-
*/
|
|
42
|
-
export interface SeoProps extends SeoMeta {
|
|
43
|
-
/**
|
|
44
|
-
* Canonical URL override
|
|
45
|
-
* @description If not set, uses current URL
|
|
46
|
-
*/
|
|
47
|
-
canonicalUrl?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Article publish date (ISO 8601)
|
|
50
|
-
* @description For article pages, sets article:published_time
|
|
51
|
-
*/
|
|
52
|
-
publishDate?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Article modified date (ISO 8601)
|
|
55
|
-
* @description For article pages, sets article:modified_time
|
|
56
|
-
*/
|
|
57
|
-
modifiedDate?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Entity of the record this page renders. With `data`, title, description, image
|
|
60
|
-
* and (for `type="product"`) Product JSON-LD are derived from the entity's fields
|
|
61
|
-
* (see deriveEntitySeo). Explicit props win over derived values.
|
|
62
|
-
*/
|
|
63
|
-
entity?: AnyEntity;
|
|
64
|
-
/** The record (e.g. from useCrudDoc). Ignored without `entity`; null renders site defaults. */
|
|
65
|
-
data?: EntitySeoRecord | null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Dynamic SEO component
|
|
69
|
-
*
|
|
70
|
-
* @description Sets SEO metadata at runtime. Render after data is loaded.
|
|
71
|
-
* Overrides any static PageMeta SEO settings.
|
|
72
|
-
* Works in SSR/prerender - meta tags will be in initial HTML.
|
|
73
|
-
*
|
|
74
|
-
* @example Static title override
|
|
75
|
-
* ```tsx
|
|
76
|
-
* <Seo fullTitle="About Us | MyApp" />
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @example Dynamic product page
|
|
80
|
-
* ```tsx
|
|
81
|
-
* const { data: product } = useProduct(id);
|
|
82
|
-
* if (!product) return <Loading />;
|
|
83
|
-
*
|
|
84
|
-
* return (
|
|
85
|
-
* <>
|
|
86
|
-
* <Seo
|
|
87
|
-
* title={product.name}
|
|
88
|
-
* description={product.description}
|
|
89
|
-
* image={product.image}
|
|
90
|
-
* type="product"
|
|
91
|
-
* />
|
|
92
|
-
* <ProductDetails product={product} />
|
|
93
|
-
* </>
|
|
94
|
-
* );
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* @example Article with dates
|
|
98
|
-
* ```tsx
|
|
99
|
-
* <Seo
|
|
100
|
-
* title={article.title}
|
|
101
|
-
* description={article.excerpt}
|
|
102
|
-
* type="article"
|
|
103
|
-
* publishDate={article.createdAt}
|
|
104
|
-
* modifiedDate={article.updatedAt}
|
|
105
|
-
* />
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
export declare function Seo({ title, fullTitle, description, image, type, keywords, noindex, canonicalUrl, publishDate, modifiedDate, entity, data, }: SeoProps): ReactElement | null;
|
|
109
|
-
/**
|
|
110
|
-
* Hook version for those who prefer hooks
|
|
111
|
-
* Returns the Seo component with props bound
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```tsx
|
|
115
|
-
* const SeoTags = useSeo({
|
|
116
|
-
* title: apartment.reference,
|
|
117
|
-
* description: apartment.description,
|
|
118
|
-
* });
|
|
119
|
-
*
|
|
120
|
-
* return (
|
|
121
|
-
* <>
|
|
122
|
-
* <SeoTags />
|
|
123
|
-
* <Content />
|
|
124
|
-
* </>
|
|
125
|
-
* );
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
export declare function useSeo(props: SeoProps | null): () => ReactElement | null;
|
|
129
|
-
//# sourceMappingURL=useSeo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSeo.d.ts","sourceRoot":"","sources":["../../src/utils/useSeo.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAS1C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM1E;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO;IACvC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,SAAS,EACT,WAAW,EACX,KAAK,EACL,IAAgB,EAChB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,IAAI,GACL,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,CA+IhC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,YAAY,GAAG,IAAI,CAKxE"}
|
package/dist/utils/useSeo.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { buildProductJsonLd, deriveEntitySeo, getPlatformEnvVar, useAppConfig, useTranslation, } from '@donotdev/core';
|
|
4
|
-
// Platform-specific hooks via conditional exports
|
|
5
|
-
import { useLocalizedPath, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
6
|
-
import { HeadTags } from '../internal/layout/components/HeadTags';
|
|
7
|
-
/** Root-relative URLs → absolute (link-preview crawlers and JSON-LD need absolute URLs). */
|
|
8
|
-
function absoluteUrl(url, baseUrl) {
|
|
9
|
-
return url.startsWith('/') && baseUrl ? `${baseUrl}${url}` : url;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Dynamic SEO component
|
|
13
|
-
*
|
|
14
|
-
* @description Sets SEO metadata at runtime. Render after data is loaded.
|
|
15
|
-
* Overrides any static PageMeta SEO settings.
|
|
16
|
-
* Works in SSR/prerender - meta tags will be in initial HTML.
|
|
17
|
-
*
|
|
18
|
-
* @example Static title override
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <Seo fullTitle="About Us | MyApp" />
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @example Dynamic product page
|
|
24
|
-
* ```tsx
|
|
25
|
-
* const { data: product } = useProduct(id);
|
|
26
|
-
* if (!product) return <Loading />;
|
|
27
|
-
*
|
|
28
|
-
* return (
|
|
29
|
-
* <>
|
|
30
|
-
* <Seo
|
|
31
|
-
* title={product.name}
|
|
32
|
-
* description={product.description}
|
|
33
|
-
* image={product.image}
|
|
34
|
-
* type="product"
|
|
35
|
-
* />
|
|
36
|
-
* <ProductDetails product={product} />
|
|
37
|
-
* </>
|
|
38
|
-
* );
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Article with dates
|
|
42
|
-
* ```tsx
|
|
43
|
-
* <Seo
|
|
44
|
-
* title={article.title}
|
|
45
|
-
* description={article.excerpt}
|
|
46
|
-
* type="article"
|
|
47
|
-
* publishDate={article.createdAt}
|
|
48
|
-
* modifiedDate={article.updatedAt}
|
|
49
|
-
* />
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export function Seo({ title, fullTitle, description, image, type = 'website', keywords, noindex, canonicalUrl, publishDate, modifiedDate, entity, data, }) {
|
|
53
|
-
const siteName = useAppConfig('name') || '';
|
|
54
|
-
const pathname = useRoutePath();
|
|
55
|
-
const localize = useLocalizedPath();
|
|
56
|
-
const baseUrl = getPlatformEnvVar('APP_URL') || '';
|
|
57
|
-
// Entity-derived identity (card text, entity namespace then crud); explicit props win
|
|
58
|
-
const { t, language } = useTranslation(entity ? [entity.namespace, 'crud'] : undefined);
|
|
59
|
-
const derived = entity && data ? deriveEntitySeo(entity, data, { t, locale: language }) : null;
|
|
60
|
-
const pageTitle = title ?? derived?.title;
|
|
61
|
-
const pageDescription = description ?? derived?.description;
|
|
62
|
-
const pageImage = image ?? derived?.image;
|
|
63
|
-
const absoluteImage = pageImage ? absoluteUrl(pageImage, baseUrl) : undefined;
|
|
64
|
-
// This page in this language (`/en/x`; `/x` for the default language)
|
|
65
|
-
const pageUrl = canonicalUrl ?? `${baseUrl}${localize(pathname)}`;
|
|
66
|
-
// Resolve final title
|
|
67
|
-
const resolvedTitle = fullTitle
|
|
68
|
-
? fullTitle
|
|
69
|
-
: pageTitle
|
|
70
|
-
? `${pageTitle} | ${siteName}`
|
|
71
|
-
: siteName;
|
|
72
|
-
const productJsonLd = type === 'product'
|
|
73
|
-
? buildProductJsonLd({
|
|
74
|
-
title: pageTitle ?? undefined,
|
|
75
|
-
description: pageDescription ?? undefined,
|
|
76
|
-
image: absoluteImage,
|
|
77
|
-
images: absoluteImage
|
|
78
|
-
? [
|
|
79
|
-
absoluteImage,
|
|
80
|
-
...(derived?.images ?? [])
|
|
81
|
-
.map((url) => absoluteUrl(url, baseUrl))
|
|
82
|
-
.filter((url) => url !== absoluteImage),
|
|
83
|
-
]
|
|
84
|
-
: [],
|
|
85
|
-
price: derived?.price,
|
|
86
|
-
availability: derived?.availability,
|
|
87
|
-
}, pageUrl)
|
|
88
|
-
: null;
|
|
89
|
-
// Build meta tags array for cleaner rendering
|
|
90
|
-
const metaTags = [];
|
|
91
|
-
// Description
|
|
92
|
-
if (pageDescription) {
|
|
93
|
-
metaTags.push(_jsx("meta", { name: "description", content: pageDescription }, "description"), _jsx("meta", { property: "og:description", content: pageDescription }, "og:description"), _jsx("meta", { name: "twitter:description", content: pageDescription }, "twitter:description"));
|
|
94
|
-
}
|
|
95
|
-
// Image
|
|
96
|
-
if (absoluteImage) {
|
|
97
|
-
metaTags.push(_jsx("meta", { property: "og:image", content: absoluteImage }, "og:image"), _jsx("meta", { name: "twitter:image", content: absoluteImage }, "twitter:image"), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }, "twitter:card"));
|
|
98
|
-
}
|
|
99
|
-
// Type
|
|
100
|
-
if (type) {
|
|
101
|
-
metaTags.push(_jsx("meta", { property: "og:type", content: type }, "og:type"));
|
|
102
|
-
}
|
|
103
|
-
// Keywords
|
|
104
|
-
if (keywords && keywords.length > 0) {
|
|
105
|
-
const keywordsStr = Array.isArray(keywords)
|
|
106
|
-
? keywords.join(', ')
|
|
107
|
-
: keywords;
|
|
108
|
-
metaTags.push(_jsx("meta", { name: "keywords", content: keywordsStr }, "keywords"));
|
|
109
|
-
}
|
|
110
|
-
// Robots
|
|
111
|
-
if (noindex) {
|
|
112
|
-
metaTags.push(_jsx("meta", { name: "robots", content: "noindex, nofollow" }, "robots"));
|
|
113
|
-
}
|
|
114
|
-
// Article-specific meta
|
|
115
|
-
if (type === 'article') {
|
|
116
|
-
if (publishDate) {
|
|
117
|
-
metaTags.push(_jsx("meta", { property: "article:published_time", content: publishDate }, "article:published_time"));
|
|
118
|
-
}
|
|
119
|
-
if (modifiedDate) {
|
|
120
|
-
metaTags.push(_jsx("meta", { property: "article:modified_time", content: modifiedDate }, "article:modified_time"));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// OG/Twitter title
|
|
124
|
-
metaTags.push(_jsx("meta", { property: "og:title", content: resolvedTitle }, "og:title"), _jsx("meta", { name: "twitter:title", content: resolvedTitle }, "twitter:title"));
|
|
125
|
-
return (_jsxs(HeadTags, { children: [_jsx("title", { children: resolvedTitle }), canonicalUrl && _jsx("link", { rel: "canonical", href: canonicalUrl }), metaTags, productJsonLd && (_jsx("script", { type: "application/ld+json", children: JSON.stringify(productJsonLd) }))] }));
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Hook version for those who prefer hooks
|
|
129
|
-
* Returns the Seo component with props bound
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```tsx
|
|
133
|
-
* const SeoTags = useSeo({
|
|
134
|
-
* title: apartment.reference,
|
|
135
|
-
* description: apartment.description,
|
|
136
|
-
* });
|
|
137
|
-
*
|
|
138
|
-
* return (
|
|
139
|
-
* <>
|
|
140
|
-
* <SeoTags />
|
|
141
|
-
* <Content />
|
|
142
|
-
* </>
|
|
143
|
-
* );
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
export function useSeo(props) {
|
|
147
|
-
if (props === null) {
|
|
148
|
-
return () => null;
|
|
149
|
-
}
|
|
150
|
-
return () => _jsx(Seo, { ...props });
|
|
151
|
-
}
|