@donotdev/ui 0.2.2 → 0.3.0
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/dist/ChildRowsPicker-63M4EQUQ.js +1 -0
- package/dist/ChildRowsPicker-ISP365ON.js +1 -0
- package/dist/ChildRowsPicker-PQFE6NCR.js +1 -0
- package/dist/ChildRowsPicker-XXFFSMWY.js +1 -0
- package/dist/{GoToDialog-CICRYHHG.js → GoToDialog-KSBGOIWO.js} +1 -1
- package/dist/{GoToDialog-YGBON6FR.js → GoToDialog-XBK5EZF4.js} +1 -1
- package/dist/chunk-3CIZFGST.js +1 -0
- package/dist/chunk-LHMKU342.js +1 -0
- package/dist/chunk-MS7ZIW5Z.js +1 -0
- package/dist/chunk-P2DHZWPY.js +1 -0
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +0 -2
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +6 -40
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +2 -1
- package/dist/components/common/lucideIconByName.d.ts +9 -0
- package/dist/components/common/lucideIconByName.d.ts.map +1 -0
- package/dist/components/common/lucideIconByName.js +32 -0
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +18 -12
- package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
- package/dist/components/layout/components/header/CacheSettings.js +6 -4
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +4 -3
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +2 -1
- package/dist/crud/components/ChildRowsPicker.d.ts +21 -0
- package/dist/crud/components/ChildRowsPicker.d.ts.map +1 -0
- package/dist/crud/components/ChildRowsPicker.js +68 -0
- package/dist/crud/components/CrudCardLink.d.ts +6 -6
- package/dist/crud/components/CrudCardLink.d.ts.map +1 -1
- package/dist/crud/components/CrudCardLink.js +3 -9
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +10 -26
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +6 -3
- package/dist/crud/components/EntityFormRenderer.d.ts +4 -2
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +160 -56
- package/dist/crud/components/EntityList.d.ts +6 -4
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +437 -92
- package/dist/crud/components/EntityRecommendations.js +1 -1
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +6 -4
- package/dist/crud/components/Form.d.ts +1 -1
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +2 -2
- package/dist/crud/components/cellEditFor.d.ts +43 -0
- package/dist/crud/components/cellEditFor.d.ts.map +1 -0
- package/dist/crud/components/cellEditFor.js +74 -0
- package/dist/crud/components/entityParent.d.ts +33 -0
- package/dist/crud/components/entityParent.d.ts.map +1 -0
- package/dist/crud/components/entityParent.js +76 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts +11 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -0
- package/dist/crud/components/useRecordBreadcrumb.js +43 -0
- package/dist/crud/crudImports.d.ts +12 -1
- package/dist/crud/crudImports.d.ts.map +1 -1
- package/dist/crud/crudImports.js +11 -0
- package/dist/dndev-next.css +782 -193
- package/dist/dndev.css +784 -193
- package/dist/index.js +4 -4
- package/dist/internal/common/RouteErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/RouteErrorFallback.js +2 -4
- package/dist/internal/devtools/components/ConfigTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/ConfigTab.js +1 -1
- package/dist/internal/devtools/components/CookieTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/CookieTab.js +1 -5
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +18 -7
- package/dist/internal/devtools/components/StoresTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/StoresTab.js +17 -3
- package/dist/internal/devtools/types.d.ts +3 -3
- package/dist/internal/devtools/types.d.ts.map +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts +3 -0
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +8 -1
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +21 -21
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +42 -38
- package/dist/internal/layout/components/FontPreloadLinks.d.ts +7 -4
- package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/FontPreloadLinks.js +12 -25
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts +2 -0
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +4 -0
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +2 -1
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +4 -3
- package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +1 -1
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -0
- package/dist/internal/layout/zones/DnDevMergedBar.js +3 -3
- package/dist/internal/providers/UIProviders.d.ts +0 -8
- package/dist/internal/providers/UIProviders.d.ts.map +1 -1
- package/dist/internal/providers/UIProviders.js +45 -2
- package/dist/providers/NextJsAppProviders.d.ts +5 -1
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +36 -6
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +42 -7
- package/dist/routing/404.d.ts +8 -1
- package/dist/routing/404.d.ts.map +1 -1
- package/dist/routing/404.js +9 -5
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -2
- package/dist/routing/AuthReturnTo.d.ts.map +1 -1
- package/dist/routing/AuthReturnTo.js +9 -2
- package/dist/routing/GoTo.d.ts +0 -6
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +5 -8
- package/dist/routing/Link.d.ts +4 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +8 -5
- package/dist/routing/SignedInRedirect.d.ts +27 -0
- package/dist/routing/SignedInRedirect.d.ts.map +1 -0
- package/dist/routing/SignedInRedirect.js +47 -0
- package/dist/routing/hooks/hooks.next.d.ts +2 -0
- package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +2 -0
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useLocation.next.d.ts +12 -0
- package/dist/routing/hooks/useLocation.next.d.ts.map +1 -1
- package/dist/routing/hooks/useLocation.next.js +17 -4
- package/dist/routing/hooks/useMatch.next.d.ts +6 -0
- package/dist/routing/hooks/useMatch.next.d.ts.map +1 -1
- package/dist/routing/hooks/useMatch.next.js +8 -2
- package/dist/routing/hooks/useNavigate.next.d.ts +6 -1
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +13 -4
- package/dist/routing/hooks/useNavigate.vite.d.ts +7 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +20 -4
- package/dist/routing/hooks/useRedirectGuard.next.d.ts +3 -1
- package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.next.js +18 -10
- package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.vite.js +7 -1
- package/dist/routing/hooks/useRoutePath.next.d.ts +23 -0
- package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.next.js +36 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts +13 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.vite.js +25 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts +28 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.next.js +50 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts +22 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.vite.js +41 -0
- package/dist/routing/index.d.ts +3 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +2 -1
- package/dist/routing/parentRoute.d.ts +27 -0
- package/dist/routing/parentRoute.d.ts.map +1 -0
- package/dist/routing/parentRoute.js +43 -0
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +8 -27
- package/dist/routing/useRouteDiscovery.d.ts +2 -2
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +6 -5
- package/dist/styles/index.css +781 -192
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/useDeleteAccountSafe.d.ts +17 -0
- package/dist/utils/useDeleteAccountSafe.d.ts.map +1 -0
- package/dist/utils/useDeleteAccountSafe.js +52 -0
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -0
- package/dist/utils/useSeo.d.ts +10 -2
- package/dist/utils/useSeo.d.ts.map +1 -1
- package/dist/utils/useSeo.js +44 -9
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +37 -4
- package/guidelines/COMPONENTS.md +2 -1
- package/guidelines/GOTCHAS.md +2 -0
- package/guidelines/LAYOUTS.md +4 -0
- package/guidelines/PAGES.md +30 -3
- package/guidelines/ROUTING.md +29 -0
- package/guidelines/SEO.md +52 -0
- package/package.json +9 -9
- package/dist/CookieConsent-5NH5DNTP.js +0 -1
- package/dist/CookieConsent-W7UE647Y.js +0 -1
- package/dist/chunk-DRFM6WXH.js +0 -1
- package/dist/chunk-MIPTBUWY.js +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +0 -57
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.js +0 -182
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrorFallback.d.ts","sourceRoot":"","sources":["../../../src/internal/common/RouteErrorFallback.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAiB3C,UAAU,uBAAuB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"RouteErrorFallback.d.ts","sourceRoot":"","sources":["../../../src/internal/common/RouteErrorFallback.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAiB3C,UAAU,uBAAuB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CAiPrE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { AlertTriangle, Home, ArrowLeft, RotateCw, Copy, Check, } from 'lucide-r
|
|
|
13
13
|
import { useEffect, useState } from 'react';
|
|
14
14
|
import { Button, BUTTON_VARIANT, Card, CARD_VARIANT, Alert, ALERT_VARIANT, Stack, } from '@donotdev/components';
|
|
15
15
|
import { handleError, useTranslation } from '@donotdev/core';
|
|
16
|
-
import {
|
|
16
|
+
import { useBack, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
17
17
|
// Platform-specific hooks via conditional exports
|
|
18
18
|
import { Link } from '../../routing/Link';
|
|
19
19
|
/**
|
|
@@ -30,9 +30,7 @@ export const RouteErrorFallback = ({ error, resetError, componentStack, eventId,
|
|
|
30
30
|
const { t } = useTranslation('dndev');
|
|
31
31
|
const [copiedStack, setCopiedStack] = useState(false);
|
|
32
32
|
const back = useBack();
|
|
33
|
-
const
|
|
34
|
-
const pathname = location?.pathname ||
|
|
35
|
-
(typeof window !== 'undefined' ? window.location.pathname : '/');
|
|
33
|
+
const pathname = useRoutePath();
|
|
36
34
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
37
35
|
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
38
36
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/ConfigTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/ConfigTab.tsx"],"names":[],"mappings":"AAyBA,eAAO,MAAM,SAAS,mCAsGrB,CAAC"}
|
|
@@ -52,7 +52,7 @@ export const ConfigTab = () => {
|
|
|
52
52
|
label: 'Features',
|
|
53
53
|
value: (_jsx(Text, { className: "dndev-font-mono dndev-text-sm", children: config.features.available?.length || 0 })),
|
|
54
54
|
},
|
|
55
|
-
].filter(Boolean);
|
|
55
|
+
].filter((item) => Boolean(item));
|
|
56
56
|
const envItems = Object.entries(envVars).map(([key, value]) => ({
|
|
57
57
|
label: _jsx(Text, { className: "dndev-font-mono dndev-text-xs", children: key }),
|
|
58
58
|
value: _jsx(MaskedValue, { keyName: key, value: String(value) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/CookieTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CookieTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/CookieTab.tsx"],"names":[],"mappings":"AAkEA,eAAO,MAAM,SAAS,mCA8gBrB,CAAC"}
|
|
@@ -133,11 +133,7 @@ export const CookieTab = () => {
|
|
|
133
133
|
];
|
|
134
134
|
const categoryItems = Object.entries(CONSENT_CATEGORY).map(([key, value]) => ({
|
|
135
135
|
label: (_jsx(Text, { as: "span", className: "dndev-font-mono", children: key })),
|
|
136
|
-
value: (_jsx(Badge, { variant: categories[value]
|
|
137
|
-
? 'default'
|
|
138
|
-
: 'destructive', children: categories[value]
|
|
139
|
-
? '✅ Enabled'
|
|
140
|
-
: '❌ Disabled' })),
|
|
136
|
+
value: (_jsx(Badge, { variant: categories[value] ? 'default' : 'destructive', children: categories[value] ? '✅ Enabled' : '❌ Disabled' })),
|
|
141
137
|
}));
|
|
142
138
|
return (_jsx(Stack, { gap: "large", children: _jsx(Card, { title: "Cookie Consent Debug", footer: _jsxs(Stack, { direction: "row", gap: "tight", children: [_jsx(Button, { onClick: refreshData, icon: RefreshCw, variant: BUTTON_VARIANT.OUTLINE, title: "Refresh Data", children: "Refresh" }), _jsx(Button, { onClick: handleResetConsent, icon: Trash2, variant: BUTTON_VARIANT.OUTLINE, title: "Reset Consent & Reload", children: "Reset & Reload" })] }), children: _jsxs(Stack, { gap: "large", children: [_jsx(Card, { title: _jsxs(Stack, { direction: "row", align: "center", justify: "between", className: "dndev-w-full", children: [_jsx("span", { children: "Consent State" }), _jsx(CopyToClipboard, { text: formatJSON({
|
|
143
139
|
hasConsented,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/DesignTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DesignTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/DesignTab.tsx"],"names":[],"mappings":"AAoDA,eAAO,MAAM,SAAS,mCAozBrB,CAAC"}
|
|
@@ -13,6 +13,10 @@ import { Palette, Type } from 'lucide-react';
|
|
|
13
13
|
import { useState, useEffect } from 'react';
|
|
14
14
|
import { Card, Button, BUTTON_VARIANT, Stack, Label, Badge, BADGE_VARIANT, Alert, ALERT_VARIANT, DescriptionList, Text, ScrollArea, Accordion, CopyToClipboard, toast, } from '@donotdev/components';
|
|
15
15
|
import { useTheme, useThemeReady } from '@donotdev/core';
|
|
16
|
+
/** HTML, SVG and MathML elements all carry an inline `style`; narrows a generic Element to it. */
|
|
17
|
+
function hasInlineStyle(el) {
|
|
18
|
+
return 'style' in el;
|
|
19
|
+
}
|
|
16
20
|
export const DesignTab = () => {
|
|
17
21
|
const currentTheme = useTheme('currentTheme');
|
|
18
22
|
const availableThemes = useTheme('availableThemes');
|
|
@@ -68,7 +72,8 @@ export const DesignTab = () => {
|
|
|
68
72
|
const toggleHighlight = (size) => {
|
|
69
73
|
// Clear previous highlights
|
|
70
74
|
document.querySelectorAll('[data-dndev-highlight]').forEach((el) => {
|
|
71
|
-
el
|
|
75
|
+
if (hasInlineStyle(el))
|
|
76
|
+
el.style.outline = '';
|
|
72
77
|
el.removeAttribute('data-dndev-highlight');
|
|
73
78
|
});
|
|
74
79
|
if (highlightedSize === size) {
|
|
@@ -89,7 +94,8 @@ export const DesignTab = () => {
|
|
|
89
94
|
return;
|
|
90
95
|
const style = getComputedStyle(el);
|
|
91
96
|
if (normalizeFontSize(style.fontSize) === normalizedSize) {
|
|
92
|
-
|
|
97
|
+
if (hasInlineStyle(el))
|
|
98
|
+
el.style.outline = '2px solid var(--primary)';
|
|
93
99
|
el.setAttribute('data-dndev-highlight', 'true');
|
|
94
100
|
count++;
|
|
95
101
|
}
|
|
@@ -103,7 +109,8 @@ export const DesignTab = () => {
|
|
|
103
109
|
document
|
|
104
110
|
.querySelectorAll(`[data-dndev-font-size-color="${size}"]`)
|
|
105
111
|
.forEach((el) => {
|
|
106
|
-
el
|
|
112
|
+
if (hasInlineStyle(el))
|
|
113
|
+
el.style.color = '';
|
|
107
114
|
el.removeAttribute('data-dndev-font-size-color');
|
|
108
115
|
});
|
|
109
116
|
if (!color) {
|
|
@@ -128,7 +135,8 @@ export const DesignTab = () => {
|
|
|
128
135
|
return;
|
|
129
136
|
const style = getComputedStyle(el);
|
|
130
137
|
if (normalizeFontSize(style.fontSize) === normalizedSize) {
|
|
131
|
-
el
|
|
138
|
+
if (hasInlineStyle(el))
|
|
139
|
+
el.style.color = color;
|
|
132
140
|
el.setAttribute('data-dndev-font-size-color', size);
|
|
133
141
|
count++;
|
|
134
142
|
}
|
|
@@ -140,11 +148,13 @@ export const DesignTab = () => {
|
|
|
140
148
|
// Clear highlights on unmount or when dialog closes
|
|
141
149
|
const clearHighlights = () => {
|
|
142
150
|
document.querySelectorAll('[data-dndev-highlight]').forEach((el) => {
|
|
143
|
-
el
|
|
151
|
+
if (hasInlineStyle(el))
|
|
152
|
+
el.style.outline = '';
|
|
144
153
|
el.removeAttribute('data-dndev-highlight');
|
|
145
154
|
});
|
|
146
155
|
document.querySelectorAll('[data-dndev-font-size-color]').forEach((el) => {
|
|
147
|
-
el
|
|
156
|
+
if (hasInlineStyle(el))
|
|
157
|
+
el.style.color = '';
|
|
148
158
|
el.removeAttribute('data-dndev-font-size-color');
|
|
149
159
|
});
|
|
150
160
|
setHighlightedSize(null);
|
|
@@ -422,7 +432,8 @@ export const DesignTab = () => {
|
|
|
422
432
|
found.forEach((el) => {
|
|
423
433
|
// Log text content only (not the DOM node) to avoid memory leaks from retained element refs
|
|
424
434
|
console.log('[DesignTab]', el.textContent?.trim().substring(0, 50));
|
|
425
|
-
el
|
|
435
|
+
if (hasInlineStyle(el))
|
|
436
|
+
el.style.outline = '2px solid red';
|
|
426
437
|
});
|
|
427
438
|
console.log(`[DesignTab] Found ${found.length} elements with ${f.size}`);
|
|
428
439
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoresTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/StoresTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StoresTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/StoresTab.tsx"],"names":[],"mappings":"AA0DA,eAAO,MAAM,SAAS,mCAuHrB,CAAC"}
|
|
@@ -23,6 +23,20 @@ const STORE_NAMES = {
|
|
|
23
23
|
'i18n-store': 'i18n',
|
|
24
24
|
'error-store': 'Error',
|
|
25
25
|
};
|
|
26
|
+
/** Zustand bound stores expose `getState`; registry values are untyped (`Record<string, any>` in core globals). */
|
|
27
|
+
function hasGetState(store) {
|
|
28
|
+
return ((typeof store === 'function' || typeof store === 'object') &&
|
|
29
|
+
store !== null &&
|
|
30
|
+
'getState' in store &&
|
|
31
|
+
typeof store.getState === 'function');
|
|
32
|
+
}
|
|
33
|
+
/** Reads the `_error` marker that `refreshStores` writes for unreadable stores. */
|
|
34
|
+
function readStoreError(state) {
|
|
35
|
+
if (typeof state !== 'object' || state === null || !('_error' in state)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return typeof state._error === 'string' ? state._error : undefined;
|
|
39
|
+
}
|
|
26
40
|
export const StoresTab = () => {
|
|
27
41
|
const [storeStates, setStoreStates] = useState({});
|
|
28
42
|
const [storeNames, setStoreNames] = useState([]);
|
|
@@ -39,7 +53,7 @@ export const StoresTab = () => {
|
|
|
39
53
|
names.forEach((name) => {
|
|
40
54
|
try {
|
|
41
55
|
const store = registry[name];
|
|
42
|
-
if (store
|
|
56
|
+
if (hasGetState(store)) {
|
|
43
57
|
states[name] = store.getState();
|
|
44
58
|
}
|
|
45
59
|
else {
|
|
@@ -66,11 +80,11 @@ export const StoresTab = () => {
|
|
|
66
80
|
}
|
|
67
81
|
return (_jsx(Stack, { style: { padding: 'var(--gap-md)' }, children: _jsx(Card, { title: _jsxs(Stack, { direction: "row", align: "center", justify: "between", className: "dndev-w-full", children: [_jsx("span", { children: "Stores" }), _jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Badge, { variant: BADGE_VARIANT.SECONDARY, children: storeNames.length }), _jsx(Button, { variant: BUTTON_VARIANT.GHOST, icon: RefreshCw, onClick: refreshStores, title: "Refresh stores" })] })] }), children: _jsx(Accordion, { type: "single", collapsible: true, items: storeNames.map((name) => {
|
|
68
82
|
const state = storeStates[name];
|
|
69
|
-
const
|
|
83
|
+
const storeError = readStoreError(state);
|
|
70
84
|
return {
|
|
71
85
|
value: name,
|
|
72
86
|
trigger: (_jsxs(Stack, { direction: "row", align: "center", justify: "between", className: "dndev-w-full", children: [_jsx(Text, { className: "dndev-font-medium", children: getDisplayName(name) }), _jsx(Text, { className: "dndev-font-mono dndev-text-xs dndev-text-muted-foreground", children: name })] })),
|
|
73
|
-
content:
|
|
87
|
+
content: storeError ? (_jsx(Text, { className: "dndev-text-destructive dndev-text-sm", children: storeError })) : (_jsx(ScrollArea, { className: "dndev-max-h-64", children: _jsx(JsonViewer, { data: state, defaultDepth: 2, showCopyButton: true }) })),
|
|
74
88
|
};
|
|
75
89
|
}) }) }) }));
|
|
76
90
|
};
|
|
@@ -15,7 +15,7 @@ import type { BrowserInfo, FeatureSupport } from '@donotdev/core';
|
|
|
15
15
|
* @since 0.0.1
|
|
16
16
|
* @author AMBROISE PARK Consulting
|
|
17
17
|
*/
|
|
18
|
-
export interface VirtualModuleResult<T =
|
|
18
|
+
export interface VirtualModuleResult<T = unknown> {
|
|
19
19
|
success: boolean;
|
|
20
20
|
data: T | null;
|
|
21
21
|
error: string | null;
|
|
@@ -83,8 +83,8 @@ export interface GlobalData {
|
|
|
83
83
|
discoveredClasses: string[];
|
|
84
84
|
discoveredFrameworkVariables: string[];
|
|
85
85
|
discoveredConsumerVariables: string[];
|
|
86
|
-
discoveredUtilities: Record<string,
|
|
87
|
-
getAvailableThemes: (() =>
|
|
86
|
+
discoveredUtilities: Record<string, Record<string, string>>;
|
|
87
|
+
getAvailableThemes: (() => string[]) | null;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Health check result interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/types.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -6,7 +6,7 @@ export declare function maskSensitiveValue(value: string): string;
|
|
|
6
6
|
/**
|
|
7
7
|
* Mask sensitive values in an object based on key names
|
|
8
8
|
*/
|
|
9
|
-
export declare function maskSensitiveData<T extends Record<string,
|
|
9
|
+
export declare function maskSensitiveData<T extends Record<string, unknown>>(data: T): Record<string, string>;
|
|
10
10
|
/**
|
|
11
11
|
* Check if value should be masked (for display purposes)
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maskSensitive.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/maskSensitive.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"maskSensitive.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/maskSensitive.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,IAAI,EAAE,CAAC,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -11,6 +11,9 @@ interface NextJsStoresInitializerProps {
|
|
|
11
11
|
*
|
|
12
12
|
* Wraps BaseStoresInitializer with Next.js-specific handlers and SSR cookie hydration.
|
|
13
13
|
* Hydrates theme store from cookies before render to prevent FOUC (Flash of Unstyled Content).
|
|
14
|
+
* Refreshes the Next router when the signed-in identity changes (onQueryCacheIdentityChange):
|
|
15
|
+
* the client router cache holds payloads and proxy redirects of the previous session
|
|
16
|
+
* (e.g. `/` → signedInRedirect target), replayed on the next navigation otherwise.
|
|
14
17
|
* Automatically skips initialization in test environments.
|
|
15
18
|
*
|
|
16
19
|
* @version 0.1.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/NextJsStoresInitializer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NextJsStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/NextJsStoresInitializer.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,GACd,EAAE,4BAA4B,+BAyD9B"}
|
|
@@ -9,8 +9,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* @since 0.0.1
|
|
10
10
|
* @author AMBROISE PARK Consulting
|
|
11
11
|
*/
|
|
12
|
+
import { useRouter } from 'next/navigation';
|
|
12
13
|
import { useEffect } from 'react';
|
|
13
|
-
import { isTest, isClient, getDndevConfig } from '@donotdev/core';
|
|
14
|
+
import { isTest, isClient, getDndevConfig, onQueryCacheIdentityChange, } from '@donotdev/core';
|
|
14
15
|
import { useThemeStore } from '@donotdev/core';
|
|
15
16
|
import { BaseStoresInitializer, } from './BaseStoresInitializer';
|
|
16
17
|
function createNextJsHandlers() {
|
|
@@ -23,6 +24,9 @@ function createNextJsHandlers() {
|
|
|
23
24
|
*
|
|
24
25
|
* Wraps BaseStoresInitializer with Next.js-specific handlers and SSR cookie hydration.
|
|
25
26
|
* Hydrates theme store from cookies before render to prevent FOUC (Flash of Unstyled Content).
|
|
27
|
+
* Refreshes the Next router when the signed-in identity changes (onQueryCacheIdentityChange):
|
|
28
|
+
* the client router cache holds payloads and proxy redirects of the previous session
|
|
29
|
+
* (e.g. `/` → signedInRedirect target), replayed on the next navigation otherwise.
|
|
26
30
|
* Automatically skips initialization in test environments.
|
|
27
31
|
*
|
|
28
32
|
* @version 0.1.0
|
|
@@ -32,6 +36,9 @@ function createNextJsHandlers() {
|
|
|
32
36
|
export function NextJsStoresInitializer({ children, serverCookies, customStores, skipStoreInit, }) {
|
|
33
37
|
const skip = skipStoreInit ?? isTest();
|
|
34
38
|
const handlers = createNextJsHandlers();
|
|
39
|
+
const router = useRouter();
|
|
40
|
+
// Synchronous on the identity reset: refreshed before the caller's next navigation
|
|
41
|
+
useEffect(() => onQueryCacheIdentityChange(() => router.refresh()), [router]);
|
|
35
42
|
// Next.js SSR: Hydrate theme store from cookies before render
|
|
36
43
|
// Flow: 1) Next.js layout reads cookie and applies theme class (SSR)
|
|
37
44
|
// 2) This component hydrates Zustand store with theme from cookie (client-side only)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevLayout.d.ts","sourceRoot":"","sources":["../../../src/internal/layout/DnDevLayout.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,gBAAgB,CAAC;AA0CxB,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,kCAIzB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"DnDevLayout.d.ts","sourceRoot":"","sources":["../../../src/internal/layout/DnDevLayout.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,gBAAgB,CAAC;AA0CxB,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,kCAIzB,yBAAyB,gCAkZ3B,CAAC"}
|
|
@@ -17,7 +17,7 @@ import { useLayout } from '@donotdev/core';
|
|
|
17
17
|
import { useTranslation } from '@donotdev/core';
|
|
18
18
|
import { useAppConfig } from '@donotdev/core';
|
|
19
19
|
import { LAYOUT_PRESET, DENSITY } from '@donotdev/core';
|
|
20
|
-
import {
|
|
20
|
+
import { useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
21
21
|
import Breadcrumbs from '../../components/layout/components/Breadcrumbs';
|
|
22
22
|
import { GoToWrapper } from '../../routing';
|
|
23
23
|
import { DEFAULT_SLOTS } from './config/defaults';
|
|
@@ -72,8 +72,7 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
72
72
|
const breadcrumbs = layout?.breadcrumbs ?? 'smart';
|
|
73
73
|
const routeHideBreadcrumbs = useLayout('routeHideBreadcrumbs');
|
|
74
74
|
// Route detection for animations
|
|
75
|
-
const
|
|
76
|
-
const pathname = location.pathname;
|
|
75
|
+
const pathname = useRoutePath();
|
|
77
76
|
const mainRef = useRef(null);
|
|
78
77
|
// Platform content handling
|
|
79
78
|
const content = children;
|
|
@@ -96,6 +95,7 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
96
95
|
}, [routePresetOverride, preset, configPreset]);
|
|
97
96
|
// Get preset config (presets only override what's different, defaults fill the rest)
|
|
98
97
|
const config = useMemo(() => {
|
|
98
|
+
// why: presetRegistry is Record<string, PresetConfig>; `landing` always exists but index access yields `| undefined`
|
|
99
99
|
const presetConfig = (effectiveRegistry[effectivePreset] ??
|
|
100
100
|
presetRegistry.landing);
|
|
101
101
|
return {
|
|
@@ -117,7 +117,7 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
117
117
|
return (_jsx(DnDevHeader, { children: _jsx(layout.header, {}) }));
|
|
118
118
|
}
|
|
119
119
|
if (typeof config.header === 'function') {
|
|
120
|
-
return
|
|
120
|
+
return _jsx(DnDevHeader, { children: config.header() });
|
|
121
121
|
}
|
|
122
122
|
// Determine effective header config (mobile overrides desktop when on mobile)
|
|
123
123
|
const effectiveHeader = isMobile
|
|
@@ -182,7 +182,7 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
182
182
|
return (_jsx(DnDevSidebar, { children: _jsx(layout.sidebar, {}) }));
|
|
183
183
|
}
|
|
184
184
|
if (typeof config.sidebar === 'function') {
|
|
185
|
-
return
|
|
185
|
+
return _jsx(DnDevSidebar, { children: config.sidebar() });
|
|
186
186
|
}
|
|
187
187
|
if (layout?.sidebar && typeof layout.sidebar === 'object') {
|
|
188
188
|
// If consumer provides a function (including () => null), use it; otherwise fall back
|
|
@@ -213,7 +213,7 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
215
|
if (typeof config.footer === 'function') {
|
|
216
|
-
return
|
|
216
|
+
return _jsx(DnDevFooter, { children: config.footer() });
|
|
217
217
|
}
|
|
218
218
|
return _jsx(DnDevFooter, { app: app });
|
|
219
219
|
}, [layout?.footer, config.footer, app]);
|
|
@@ -295,27 +295,27 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
295
295
|
? LAYOUT_DENSITY_DEFAULTS[effectivePreset] || DENSITY.STANDARD
|
|
296
296
|
: undefined;
|
|
297
297
|
// Mirror the preset onto <html>. Client-only by nature (documentElement is not
|
|
298
|
-
// ours to render), so it lands after hydration — which is why the
|
|
299
|
-
//
|
|
300
|
-
// are scoped to :root[data-layout=...]
|
|
298
|
+
// ours to render), so it lands after hydration — which is why the attributes
|
|
299
|
+
// are rendered on the wrapper below. Kept because a few app or framework rules
|
|
300
|
+
// are scoped to :root[data-layout=...]. Density is not mirrored: the density
|
|
301
|
+
// tokens are declared on <html> from the wrapper's attribute (variables.css),
|
|
302
|
+
// and a [data-density] on <html> would match the nested-density rules there.
|
|
301
303
|
useLayoutEffect(() => {
|
|
302
304
|
if (!isClient() || !effectivePreset)
|
|
303
305
|
return;
|
|
304
306
|
const updateDOM = () => {
|
|
305
|
-
|
|
306
|
-
root.setAttribute('data-layout', effectivePreset);
|
|
307
|
-
if (effectiveDensity)
|
|
308
|
-
root.setAttribute('data-density', effectiveDensity);
|
|
307
|
+
document.documentElement.setAttribute('data-layout', effectivePreset);
|
|
309
308
|
};
|
|
310
309
|
startTransition(updateDOM);
|
|
311
|
-
}, [effectivePreset
|
|
310
|
+
}, [effectivePreset]);
|
|
312
311
|
return (
|
|
313
|
-
// data-layout / data-density are rendered here,
|
|
314
|
-
// by the effect above
|
|
315
|
-
//
|
|
316
|
-
// header
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
312
|
+
// data-layout / data-density are rendered here, in the server HTML, not only
|
|
313
|
+
// pushed onto <html> by the effect above (client-only, after hydration):
|
|
314
|
+
// - a preset hides its chrome through CSS scoped to the wrapper
|
|
315
|
+
// (`[data-layout='plain'] header[role='banner'] { display: none }`);
|
|
316
|
+
// - the layout and density tokens are declared on <html> from these
|
|
317
|
+
// attributes (`:root:has(.dndev-layout[data-density='standard'])`), never
|
|
318
|
+
// on the wrapper itself, so the app's :root overrides in themes.css still
|
|
319
|
+
// win. Both resolve on the first paint, with or without JavaScript.
|
|
320
320
|
_jsxs("div", { className: cn('dndev-layout', className), "data-layout": effectivePreset || undefined, "data-density": effectiveDensity, "data-footer-inline": footerInline || undefined, "data-has-mergedbar": resolvedMergedBar ? '' : undefined, children: [resolvedHeader, resolvedSidebar, _jsxs("main", { ref: mainRef, role: "main", className: "main", children: [breadcrumbs !== 'never' && !routeHideBreadcrumbs && (_jsx("div", { className: "breadcrumbs-container", children: _jsx(Breadcrumbs, { variant: breadcrumbs === 'always' ? 'default' : 'smart' }) })), debugEnabled && (_jsx(Suspense, { fallback: null, children: _jsx(DebugTools, {}) })), layout?.wrapper ? layout.wrapper({ children: content }) : content, footerInline && resolvedFooter] }), !footerInline && resolvedFooter, resolvedMergedBar, _jsx(GoToWrapper, {})] }));
|
|
321
321
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AA0N3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,aAmU1B,CAAC;AAEF;;;GAGG;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -15,17 +15,17 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
15
15
|
* - Internationalization integration
|
|
16
16
|
* - Canonical URL management
|
|
17
17
|
*
|
|
18
|
-
* @version 0.
|
|
18
|
+
* @version 0.3.0
|
|
19
19
|
* @since 0.0.1
|
|
20
20
|
* @author AMBROISE PARK Consulting
|
|
21
21
|
*/
|
|
22
22
|
import { useMemo } from 'react';
|
|
23
|
-
import { useTranslation,
|
|
23
|
+
import { getLanguageRouting, isMultilingual, isNextJs, languageUrls, localizePath, useTranslation, } from '@donotdev/core';
|
|
24
24
|
import { getDndevConfig } from '@donotdev/core';
|
|
25
25
|
import { useSeoConfig, useAppConfig, getPlatformEnvVar } from '@donotdev/core';
|
|
26
26
|
import { AssetResolver } from '@donotdev/ui';
|
|
27
27
|
// Platform-specific hooks via conditional exports
|
|
28
|
-
import {
|
|
28
|
+
import { useRoutePath, useUrlLanguage } from '@donotdev/ui/routing/hooks';
|
|
29
29
|
import { HeadTags } from './HeadTags';
|
|
30
30
|
import { readI18nSeoMeta, resolveSeoField } from './i18nSeoMeta';
|
|
31
31
|
/**
|
|
@@ -50,47 +50,46 @@ function matchRoutePath(pattern, pathname) {
|
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Get route metadata from
|
|
53
|
+
* Get route metadata from the build-time config (`globalThis._DNDEV_CONFIG_`).
|
|
54
54
|
* Resolves dynamic routes by pattern (e.g. /cars/:id) so PageMeta (including namespace) is used for SEO.
|
|
55
|
+
* The config is set at module load on the server (Next SSR) and in the browser, so the
|
|
56
|
+
* server render and the hydration pass resolve the same metadata.
|
|
55
57
|
*/
|
|
56
|
-
function getRouteMetadata(pathname
|
|
57
|
-
if (!isClient)
|
|
58
|
-
return {};
|
|
59
|
-
// Try to get route metadata from build-time injection
|
|
58
|
+
function getRouteMetadata(pathname) {
|
|
60
59
|
const config = getDndevConfig();
|
|
61
60
|
const routeData = config?.routes?.mapping;
|
|
62
61
|
if (routeData && Array.isArray(routeData)) {
|
|
63
62
|
// 1. Exact match (static routes)
|
|
64
63
|
let route = routeData.find((r) => r.path === pathname);
|
|
65
64
|
if (route)
|
|
66
|
-
return route.meta;
|
|
65
|
+
return { meta: route.meta, dynamic: false };
|
|
67
66
|
// 2. Pattern match (dynamic routes: /cars/:id, /blog/:slug/comments/:id, etc.)
|
|
68
67
|
const dynamicRoutes = routeData.filter((r) => typeof r.path === 'string' && r.path.includes(':'));
|
|
69
68
|
const matches = dynamicRoutes.filter((r) => matchRoutePath(r.path, pathname));
|
|
70
69
|
// Prefer most specific (longest path) so /blog/:slug/comments wins over /blog/:slug for /blog/a/comments
|
|
71
70
|
if (matches.length > 0) {
|
|
72
71
|
route = matches.reduce((best, r) => r.path.length > best.path.length ? r : best);
|
|
73
|
-
return route.meta;
|
|
72
|
+
return { meta: route.meta, dynamic: true };
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
// Fallback: first path segment as namespace (e.g. /cars/abc123 → ns: cars)
|
|
77
76
|
const segments = pathname.split('/').filter(Boolean);
|
|
78
77
|
if (segments.length > 0) {
|
|
79
|
-
return { namespace: segments[0] };
|
|
78
|
+
return { meta: { namespace: segments[0] }, dynamic: false };
|
|
80
79
|
}
|
|
81
|
-
return {};
|
|
80
|
+
return { meta: {}, dynamic: false };
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Build BreadcrumbList JSON-LD from URL path segments
|
|
85
84
|
*/
|
|
86
|
-
function buildBreadcrumbSchema(pathname, baseUrl, siteName) {
|
|
85
|
+
function buildBreadcrumbSchema(pathname, baseUrl, siteName, localize) {
|
|
87
86
|
const segments = pathname.split('/').filter(Boolean);
|
|
88
87
|
const items = [
|
|
89
88
|
{
|
|
90
89
|
'@type': 'ListItem',
|
|
91
90
|
position: 1,
|
|
92
91
|
name: siteName,
|
|
93
|
-
item: baseUrl
|
|
92
|
+
item: `${baseUrl}${localize('/')}`,
|
|
94
93
|
},
|
|
95
94
|
];
|
|
96
95
|
let currentPath = '';
|
|
@@ -102,7 +101,7 @@ function buildBreadcrumbSchema(pathname, baseUrl, siteName) {
|
|
|
102
101
|
name: segments[i].split('-')
|
|
103
102
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
104
103
|
.join(' '),
|
|
105
|
-
item: `${baseUrl}${currentPath}`,
|
|
104
|
+
item: `${baseUrl}${localize(currentPath)}`,
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
107
|
return {
|
|
@@ -199,26 +198,29 @@ function buildSpeculationRules() {
|
|
|
199
198
|
*/
|
|
200
199
|
export const AutoMetaTags = () => {
|
|
201
200
|
const { t } = useTranslation();
|
|
202
|
-
const
|
|
201
|
+
const pathname = useRoutePath();
|
|
203
202
|
const seoConfig = useSeoConfig();
|
|
204
|
-
const isClient = useIsClient();
|
|
205
203
|
const appMeta = useAppConfig('app');
|
|
206
204
|
const siteName = (seoConfig && seoConfig.siteName) || appMeta?.name || '';
|
|
207
205
|
const baseUrl = getPlatformEnvVar('APP_URL') || '';
|
|
208
|
-
// Get route metadata — computed from current pathname
|
|
209
|
-
const routeMeta = getRouteMetadata(
|
|
210
|
-
//
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
// Get route metadata — computed from current pathname
|
|
207
|
+
const { meta: routeMeta, dynamic: isDynamicRoute } = getRouteMetadata(pathname);
|
|
208
|
+
// On Next, a dynamic route's page renders the record's <Seo> (title, description,
|
|
209
|
+
// image). React 19 hoists every <title>/<meta> without deduping (unlike Helmet on
|
|
210
|
+
// Vite), so the page owns those tags there and this component emits site-level tags only.
|
|
211
|
+
const pageOwnsIdentity = isDynamicRoute && isNextJs();
|
|
212
|
+
// One URL per language (default language at the root): canonical, og:url, JSON-LD
|
|
213
|
+
// and hreflang use the page's URL in each language.
|
|
214
|
+
const routing = getLanguageRouting();
|
|
215
|
+
const language = useUrlLanguage();
|
|
216
|
+
const localize = (path) => localizePath(path, language, routing);
|
|
215
217
|
// Memoize computed values for performance — must be called before any early return
|
|
216
218
|
const metaData = useMemo(() => {
|
|
217
219
|
if (!seoConfig)
|
|
218
220
|
return null;
|
|
219
221
|
const { defaultNamespace = 'home', defaultImage = '/og-image.png' } = seoConfig;
|
|
220
|
-
//
|
|
221
|
-
const currentUrl = `${baseUrl}${
|
|
222
|
+
// Canonical: this page in this language (`/en/x`; `/x` for the default language)
|
|
223
|
+
const currentUrl = `${baseUrl}${localizePath(pathname, language, routing)}`;
|
|
222
224
|
const ns = routeMeta.namespace || defaultNamespace;
|
|
223
225
|
const seo = routeMeta.seo;
|
|
224
226
|
// Get the meta fields from i18n (image, type, keywords, author, fullTitle)
|
|
@@ -268,7 +270,7 @@ export const AutoMetaTags = () => {
|
|
|
268
270
|
publishDate: routeMeta.publishDate,
|
|
269
271
|
modifiedDate: routeMeta.modifiedDate,
|
|
270
272
|
};
|
|
271
|
-
}, [
|
|
273
|
+
}, [pathname, language, routeMeta, siteName, baseUrl, seoConfig, t]);
|
|
272
274
|
// Return null if SEO is disabled — after all hooks have been called
|
|
273
275
|
if (!seoConfig || !metaData)
|
|
274
276
|
return null;
|
|
@@ -282,13 +284,14 @@ export const AutoMetaTags = () => {
|
|
|
282
284
|
const websiteSchemaEnabled = seoConfig.websiteSchema !== false;
|
|
283
285
|
const organizationSchemaEnabled = seoConfig.organizationSchema !== false;
|
|
284
286
|
// hreflang: only emit when 2+ languages configured
|
|
285
|
-
const
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
287
|
+
const shouldEmitHreflang = hreflangEnabled && isMultilingual(routing.languages);
|
|
288
|
+
const alternates = languageUrls(pathname, baseUrl, routing);
|
|
289
|
+
return (_jsxs(HeadTags, { children: [baseUrl && _jsx("link", { rel: "canonical", href: metaData.url }), baseUrl && _jsx("meta", { property: "og:url", content: metaData.url }), _jsx("meta", { property: "og:site_name", content: siteName }), !pageOwnsIdentity && (_jsxs(_Fragment, { children: [_jsx("title", { children: metaData.title }), metaData.description && (_jsx("meta", { name: "description", content: metaData.description })), metaData.keywords && (_jsx("meta", { name: "keywords", content: Array.isArray(metaData.keywords)
|
|
290
|
+
? metaData.keywords.join(', ')
|
|
291
|
+
: metaData.keywords })), metaData.author && _jsx("meta", { name: "author", content: metaData.author }), metaData.noindex && (_jsx("meta", { name: "robots", content: "noindex, nofollow" })), _jsx("meta", { property: "og:title", content: metaData.title }), metaData.description && (_jsx("meta", { property: "og:description", content: metaData.description })), _jsx("meta", { property: "og:type", content: metaData.type }), metaData.image && (_jsx("meta", { property: "og:image", content: metaData.image })), metaData.image && _jsx("meta", { property: "og:image:width", content: "1200" }), metaData.image && _jsx("meta", { property: "og:image:height", content: "630" }), metaData.type === 'article' && (_jsxs(_Fragment, { children: [metaData.author && (_jsx("meta", { property: "article:author", content: metaData.author })), metaData.publishDate && (_jsx("meta", { property: "article:published_time", content: metaData.publishDate })), metaData.modifiedDate && (_jsx("meta", { property: "article:modified_time", content: metaData.modifiedDate }))] })), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }), _jsx("meta", { name: "twitter:title", content: metaData.title }), metaData.description && (_jsx("meta", { name: "twitter:description", content: metaData.description })), metaData.image && (_jsx("meta", { name: "twitter:image", content: metaData.image })), metaData.author && (_jsx("meta", { name: "twitter:creator", content: metaData.author }))] })), twitterHandle && (_jsx("meta", { name: "twitter:site", content: `@${twitterHandle}` })), _jsx("meta", { name: "format-detection", content: "telephone=no" }), _jsx("meta", { name: "mobile-web-app-capable", content: "yes" }), _jsx("meta", { name: "apple-mobile-web-app-status-bar-style", content: "default" }), Object.entries(staticTags).map(([name, content]) => (_jsx("meta", { name: name, content: content }, name))), shouldEmitHreflang &&
|
|
292
|
+
routing.languages.map((lang) => (_jsx("link", { rel: "alternate", hrefLang: lang, href: alternates[lang] }, `hreflang-${lang}`))), shouldEmitHreflang && (_jsx("link", { rel: "alternate", hrefLang: "x-default", href: alternates[routing.defaultLanguage] })), baseUrl && (_jsx("link", { rel: "alternate", type: "application/rss+xml", title: `${siteName} Blog`, href: `${baseUrl}/rss.xml` })), !pageOwnsIdentity &&
|
|
293
|
+
metaData.image &&
|
|
294
|
+
metaData.image.startsWith('http') && (_jsx("link", { rel: "dns-prefetch", href: new URL(metaData.image).origin })), !pageOwnsIdentity && (_jsx("script", { type: "application/ld+json", children: JSON.stringify({
|
|
292
295
|
'@context': 'https://schema.org',
|
|
293
296
|
'@type': metaData.type === 'article' ? 'Article' : 'WebPage',
|
|
294
297
|
name: metaData.title,
|
|
@@ -314,16 +317,17 @@ export const AutoMetaTags = () => {
|
|
|
314
317
|
name: siteName,
|
|
315
318
|
logo: {
|
|
316
319
|
'@type': 'ImageObject',
|
|
317
|
-
|
|
320
|
+
// Absolute: schema.org consumers (Google) ignore a relative logo URL
|
|
321
|
+
url: `${baseUrl}${AssetResolver.assetExists('/icon-512x512.png')
|
|
318
322
|
? '/icon-512x512.png'
|
|
319
323
|
: AssetResolver.assetExists('/icon-192x192.png')
|
|
320
324
|
? '/icon-192x192.png'
|
|
321
|
-
: '/logo.svg'
|
|
325
|
+
: '/logo.svg'}`,
|
|
322
326
|
},
|
|
323
327
|
},
|
|
324
|
-
}) }), breadcrumbSchemaEnabled &&
|
|
328
|
+
}) })), breadcrumbSchemaEnabled && pathname !== '/' && (_jsx("script", { type: "application/ld+json", children: JSON.stringify(buildBreadcrumbSchema(pathname, baseUrl, siteName, localize)) })), websiteSchemaEnabled && baseUrl && (_jsx("script", { type: "application/ld+json", children: JSON.stringify(buildWebSiteSchema(baseUrl, siteName)) })), organizationSchemaEnabled &&
|
|
325
329
|
baseUrl &&
|
|
326
|
-
|
|
330
|
+
pathname === '/' &&
|
|
327
331
|
appMeta?.links &&
|
|
328
332
|
Object.values(appMeta.links).some(Boolean) && (_jsx("script", { type: "application/ld+json", children: JSON.stringify(buildOrganizationSchema(baseUrl, siteName, appMeta.description, appMeta.links)) })), speculationRulesEnabled && (_jsx("script", { type: "speculationrules", children: JSON.stringify(buildSpeculationRules()) }))] }));
|
|
329
333
|
};
|