@donotdev/ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/{GoToDialog-CR4VOVXT.js → GoToDialog-RU5RP7S2.js} +1 -1
  2. package/dist/chunk-ETE4RC7M.js +1 -0
  3. package/dist/components/auth/AuthHeader.d.ts +6 -1
  4. package/dist/components/auth/AuthHeader.d.ts.map +1 -1
  5. package/dist/components/auth/AuthHeader.js +4 -4
  6. package/dist/components/common/FeatureCard.d.ts +2 -0
  7. package/dist/components/common/FeatureCard.d.ts.map +1 -1
  8. package/dist/components/common/FeatureDisabled.d.ts +1 -0
  9. package/dist/components/common/FeatureDisabled.d.ts.map +1 -1
  10. package/dist/components/common/TechBento.d.ts +1 -0
  11. package/dist/components/common/TechBento.d.ts.map +1 -1
  12. package/dist/components/common/icon.d.ts +1 -0
  13. package/dist/components/common/icon.d.ts.map +1 -1
  14. package/dist/components/cookie-consent/CookieConsent.d.ts +1 -0
  15. package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
  16. package/dist/components/layout/PageConfig.d.ts +25 -0
  17. package/dist/components/layout/PageConfig.d.ts.map +1 -0
  18. package/dist/components/layout/PageConfig.js +47 -0
  19. package/dist/components/layout/components/Breadcrumbs.d.ts +2 -0
  20. package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
  21. package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts +1 -0
  22. package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
  23. package/dist/components/layout/components/header/AppBranding.d.ts +1 -0
  24. package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
  25. package/dist/components/layout/components/header/AppIcon.d.ts +1 -0
  26. package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
  27. package/dist/components/layout/components/header/AppTitle.d.ts +1 -0
  28. package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
  29. package/dist/components/layout/components/header/CacheSettings.js +2 -2
  30. package/dist/components/layout/components/header/GameTitle.d.ts +1 -0
  31. package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
  32. package/dist/components/layout/components/header/HeaderMenu.d.ts +1 -0
  33. package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
  34. package/dist/components/layout/components/header/HeaderNavigation.d.ts +1 -0
  35. package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
  36. package/dist/components/layout/components/header/SettingsMenu.d.ts +1 -0
  37. package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
  38. package/dist/components/layout/index.d.ts +1 -0
  39. package/dist/components/layout/index.d.ts.map +1 -1
  40. package/dist/components/layout/index.js +1 -0
  41. package/dist/crud/components/EntityCardList.d.ts +1 -1
  42. package/dist/crud/components/EntityCardList.d.ts.map +1 -1
  43. package/dist/crud/components/EntityCardList.js +32 -21
  44. package/dist/crud/components/EntityDisplayRenderer.d.ts +1 -1
  45. package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
  46. package/dist/crud/components/EntityDisplayRenderer.js +13 -12
  47. package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
  48. package/dist/crud/components/EntityFormRenderer.js +16 -18
  49. package/dist/crud/components/EntityList.d.ts +1 -1
  50. package/dist/crud/components/EntityList.d.ts.map +1 -1
  51. package/dist/crud/components/EntityList.js +40 -24
  52. package/dist/crud/components/EntityRecommendations.d.ts +1 -1
  53. package/dist/crud/components/EntityRecommendations.d.ts.map +1 -1
  54. package/dist/crud/components/EntityRecommendations.js +4 -4
  55. package/dist/crud/crudImports.d.ts +1 -0
  56. package/dist/crud/crudImports.d.ts.map +1 -1
  57. package/dist/crud/crudImports.js +1 -0
  58. package/dist/dndev-next.css +198 -75
  59. package/dist/dndev.css +228 -74
  60. package/dist/index.js +4 -4
  61. package/dist/internal/common/ErrorFallback.js +1 -1
  62. package/dist/internal/devtools/DebugTools.js +1 -1
  63. package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
  64. package/dist/internal/devtools/components/DesignTab.js +6 -2
  65. package/dist/internal/devtools/utils/envVarDiscovery.d.ts.map +1 -1
  66. package/dist/internal/devtools/utils/envVarDiscovery.js +4 -5
  67. package/dist/internal/devtools/utils/virtualModuleInspector.d.ts.map +1 -1
  68. package/dist/internal/devtools/utils/virtualModuleInspector.js +2 -0
  69. package/dist/internal/initializers/BaseStoresInitializer.d.ts.map +1 -1
  70. package/dist/internal/initializers/BaseStoresInitializer.js +11 -2
  71. package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
  72. package/dist/internal/layout/DnDevLayout.js +39 -16
  73. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  74. package/dist/internal/layout/components/AutoMetaTags.js +55 -23
  75. package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +2 -0
  76. package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +1 -1
  77. package/dist/internal/layout/components/NextJsAutoMetaTags.js +45 -15
  78. package/dist/internal/layout/components/PWAUpdateNotification.d.ts.map +1 -1
  79. package/dist/internal/layout/components/PWAUpdateNotification.js +15 -2
  80. package/dist/internal/layout/zones/DnDevFooter.d.ts +3 -1
  81. package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
  82. package/dist/internal/layout/zones/DnDevFooter.js +5 -1
  83. package/dist/internal/layout/zones/DnDevHeader.d.ts +3 -1
  84. package/dist/internal/layout/zones/DnDevHeader.d.ts.map +1 -1
  85. package/dist/internal/layout/zones/DnDevHeader.js +7 -2
  86. package/dist/internal/layout/zones/DnDevSidebar.d.ts +3 -1
  87. package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
  88. package/dist/internal/layout/zones/DnDevSidebar.js +9 -3
  89. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  90. package/dist/providers/NextJsAppProviders.js +3 -1
  91. package/dist/routing/AuthGuard.d.ts +7 -22
  92. package/dist/routing/AuthGuard.d.ts.map +1 -1
  93. package/dist/routing/AuthGuard.js +19 -64
  94. package/dist/routing/AuthReturnTo.d.ts +13 -0
  95. package/dist/routing/AuthReturnTo.d.ts.map +1 -0
  96. package/dist/routing/AuthReturnTo.js +61 -0
  97. package/dist/routing/DnDevNavigationMenu.d.ts +1 -0
  98. package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
  99. package/dist/routing/GoTo.d.ts +1 -0
  100. package/dist/routing/GoTo.d.ts.map +1 -1
  101. package/dist/routing/hooks/hooks.next.js +1 -1
  102. package/dist/routing/hooks/hooks.vite.js +1 -1
  103. package/dist/routing/hooks/useNavigate.next.d.ts +8 -0
  104. package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
  105. package/dist/routing/hooks/useNavigate.next.js +58 -8
  106. package/dist/routing/hooks/useNavigate.vite.d.ts +8 -0
  107. package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
  108. package/dist/routing/hooks/useNavigate.vite.js +64 -14
  109. package/dist/routing/hooks/useRedirectGuard.next.d.ts +2 -0
  110. package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
  111. package/dist/routing/hooks/useRedirectGuard.next.js +11 -27
  112. package/dist/routing/hooks/useRedirectGuard.vite.d.ts +2 -0
  113. package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
  114. package/dist/routing/hooks/useRedirectGuard.vite.js +11 -27
  115. package/dist/routing/index.d.ts +1 -0
  116. package/dist/routing/index.d.ts.map +1 -1
  117. package/dist/routing/index.js +1 -0
  118. package/dist/styles/index.css +228 -74
  119. package/dist/symbol-index.json +1 -0
  120. package/dist/utils/index.d.ts +1 -0
  121. package/dist/utils/index.d.ts.map +1 -1
  122. package/dist/utils/index.js +1 -0
  123. package/dist/utils/sanitizeSvg.d.ts +4 -0
  124. package/dist/utils/sanitizeSvg.d.ts.map +1 -1
  125. package/dist/utils/sanitizeSvg.js +4 -0
  126. package/dist/utils/useAISafe.d.ts +28 -0
  127. package/dist/utils/useAISafe.d.ts.map +1 -0
  128. package/dist/utils/useAISafe.js +53 -0
  129. package/dist/utils/useAuthSafe.d.ts +39 -0
  130. package/dist/utils/useAuthSafe.d.ts.map +1 -1
  131. package/dist/utils/useAuthSafe.js +5 -0
  132. package/dist/utils/useAuthVisibility.d.ts +1 -0
  133. package/dist/utils/useAuthVisibility.d.ts.map +1 -1
  134. package/dist/utils/useBillingVisibility.d.ts +1 -0
  135. package/dist/utils/useBillingVisibility.d.ts.map +1 -1
  136. package/dist/utils/useSeo.d.ts +121 -0
  137. package/dist/utils/useSeo.d.ts.map +1 -0
  138. package/dist/utils/useSeo.js +114 -0
  139. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  140. package/dist/vite-routing/AppRoutes.js +14 -4
  141. package/dist/vite-routing/RootLayout.d.ts.map +1 -1
  142. package/dist/vite-routing/RootLayout.js +6 -4
  143. package/guidelines/COMPONENTS.md +136 -0
  144. package/guidelines/GOTCHAS.md +66 -0
  145. package/guidelines/LAYOUTS.md +310 -0
  146. package/guidelines/PAGES.md +205 -0
  147. package/guidelines/ROUTING.md +499 -0
  148. package/guidelines/SEO.md +275 -0
  149. package/package.json +12 -7
  150. package/dist/chunk-XHGRMKOY.js +0 -1
@@ -124,7 +124,7 @@ const ErrorFallback = ({ error, resetError, componentStack, eventId, onGoBack, o
124
124
  backgroundColor: '#ffffff',
125
125
  marginBottom: '2rem',
126
126
  padding: '1rem',
127
- textAlign: 'left',
127
+ textAlign: 'start',
128
128
  border: '1px solid #fecaca',
129
129
  borderRadius: '8px',
130
130
  }, children: [_jsxs("div", { style: {
@@ -74,7 +74,7 @@ const DebugTools = ({ className }) => {
74
74
  return (_jsx(PortalButton, { onClick: () => setIsVisible(true), className: "dndev-z-overlay", style: {
75
75
  position: 'fixed',
76
76
  top: 'calc(var(--gap-lg) + var(--header-height))',
77
- left: 'calc(var(--gap-sm) + var(--sidebar-width))',
77
+ insetInlineStart: 'calc(var(--gap-sm) + var(--sidebar-width))',
78
78
  }, icon: Bug, title: "Show Debug Tools" }));
79
79
  }
80
80
  return (_jsx(Portal, { children: _jsx("div", { className: cn('dndev-z-overlay drag-handle', className), style: {
@@ -1 +1 @@
1
- {"version":3,"file":"DesignTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/DesignTab.tsx"],"names":[],"mappings":"AA+CA,eAAO,MAAM,SAAS,+CAizBrB,CAAC"}
1
+ {"version":3,"file":"DesignTab.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/components/DesignTab.tsx"],"names":[],"mappings":"AA+CA,eAAO,MAAM,SAAS,+CAkzBrB,CAAC"}
@@ -33,7 +33,8 @@ export const DesignTab = () => {
33
33
  }
34
34
  }
35
35
  catch (e) {
36
- // Ignore cache errors
36
+ if (process.env.NODE_ENV === 'development')
37
+ console.warn('Cache operation failed:', e);
37
38
  }
38
39
  };
39
40
  // Save analysis to localStorage
@@ -47,7 +48,8 @@ export const DesignTab = () => {
47
48
  }));
48
49
  }
49
50
  catch (e) {
50
- // Ignore save errors
51
+ if (process.env.NODE_ENV === 'development')
52
+ console.warn('Cache operation failed:', e);
51
53
  }
52
54
  };
53
55
  useEffect(() => {
@@ -151,6 +153,8 @@ export const DesignTab = () => {
151
153
  };
152
154
  // Get CSS variables from :root
153
155
  const getCSSVariables = () => {
156
+ if (typeof document === 'undefined')
157
+ return {};
154
158
  const root = document.documentElement;
155
159
  const style = getComputedStyle(root);
156
160
  const vars = {};
@@ -1 +1 @@
1
- {"version":3,"file":"envVarDiscovery.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/envVarDiscovery.ts"],"names":[],"mappings":"AA8BA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CA+CA;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAOpB"}
1
+ {"version":3,"file":"envVarDiscovery.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/envVarDiscovery.ts"],"names":[],"mappings":"AA8BA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CA6CA;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAOpB"}
@@ -14,10 +14,10 @@
14
14
  function matchesPattern(key, pattern) {
15
15
  const normalizedKey = key.toUpperCase();
16
16
  const normalizedPattern = pattern.toUpperCase();
17
- if (normalizedPattern.includes('*')) {
18
- const regexPattern = normalizedPattern
19
- .replace(/\*/g, '.*')
20
- .replace(/\?/g, '.');
17
+ if (normalizedPattern.includes('*') || normalizedPattern.includes('?')) {
18
+ // Escape regex metacharacters before converting wildcards
19
+ const escaped = normalizedPattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
20
+ const regexPattern = escaped.replace(/\\\*/g, '.*').replace(/\\\?/g, '.');
21
21
  const regex = new RegExp(`^${regexPattern}$`);
22
22
  return regex.test(normalizedKey);
23
23
  }
@@ -49,7 +49,6 @@ export function discoverEnvVarsByPattern(env, patterns) {
49
49
  export function groupEnvVarsByCategory(env) {
50
50
  const result = {};
51
51
  Object.entries(env).forEach(([key, value]) => {
52
- const upperKey = key.toUpperCase();
53
52
  if (matchesPattern(key, '*STRIPE*') ||
54
53
  matchesPattern(key, '*PRICE*ID*') ||
55
54
  matchesPattern(key, '*PRICE_ID*')) {
@@ -1 +1 @@
1
- {"version":3,"file":"virtualModuleInspector.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/virtualModuleInspector.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,OAAO,EAER,MAAM,UAAU,CAAC;AAElB,qBAAa,sBAAsB;WACpB,eAAe,IAAI,OAAO,CAAC,mBAAmB,CAAC;WA4E/C,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IA2D3D,MAAM,CAAC,sBAAsB,IAAI,UAAU;IAoB3C,MAAM,CAAC,kBAAkB,IAAI,OAAO;WAgGvB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAgF9D"}
1
+ {"version":3,"file":"virtualModuleInspector.d.ts","sourceRoot":"","sources":["../../../../src/internal/devtools/utils/virtualModuleInspector.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,OAAO,EAER,MAAM,UAAU,CAAC;AAElB,qBAAa,sBAAsB;WACpB,eAAe,IAAI,OAAO,CAAC,mBAAmB,CAAC;WA4E/C,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IA2D3D,MAAM,CAAC,sBAAsB,IAAI,UAAU;IAoB3C,MAAM,CAAC,kBAAkB,IAAI,OAAO;WAiGvB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAgF9D"}
@@ -149,6 +149,8 @@ export class VirtualModuleInspector {
149
149
  };
150
150
  }
151
151
  static getCSSVariableData() {
152
+ if (typeof document === 'undefined')
153
+ return { dndevVariables: {}, allCSSPropsCount: 0, dndevVarsCount: 0, utilityTests: {}, actualHeader: null, keyVariables: { headerHeight: 'not set', sidebarWidth: 'not set', debugEnabled: 'not set' } };
152
154
  const documentStyle = getComputedStyle(document.documentElement);
153
155
  // Get all CSS custom properties
154
156
  const allCSSProps = Array.from(document.documentElement.style);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/BaseStoresInitializer.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA6DvC;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyHD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,YAAiB,EACjB,aAAqB,EACrB,aAAa,GACd,EAAE,0BAA0B,kDA8K5B"}
1
+ {"version":3,"file":"BaseStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/BaseStoresInitializer.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA6DvC;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyHD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,YAAiB,EACjB,aAAqB,EACrB,aAAa,GACd,EAAE,0BAA0B,kDAiL5B"}
@@ -11,6 +11,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
11
  */
12
12
  import { useEffect, useLayoutEffect, useRef, useState } from 'react';
13
13
  import { useThemeStore, useNavigationStore, useOverlayStore, useNetworkStore, useAbortControllerStore, useConsentStore, useLanguageStore, useConsentReady, useThemeReady, getPlatformEnvVar, } from '@donotdev/core';
14
+ import { initRipple } from '@donotdev/components';
14
15
  import { useI18nReady, getI18nInstance, getSupportedLanguages, } from '@donotdev/core';
15
16
  import { handleError, isClient, getDndevConfig, globalEmitter, } from '@donotdev/core';
16
17
  import { useAppConfig } from '@donotdev/core';
@@ -134,7 +135,10 @@ async function initializeStore(config, handlers, appConfig, serverCookies) {
134
135
  if (consentCookie) {
135
136
  const cookieParts = consentCookie.split('=');
136
137
  if (cookieParts.length > 1 && cookieParts[1]) {
137
- cookieValue = decodeURIComponent(cookieParts[1].trim());
138
+ try {
139
+ cookieValue = decodeURIComponent(cookieParts[1].trim());
140
+ }
141
+ catch { /* malformed cookie */ }
138
142
  }
139
143
  }
140
144
  }
@@ -145,7 +149,10 @@ async function initializeStore(config, handlers, appConfig, serverCookies) {
145
149
  if (consentCookie) {
146
150
  const cookieParts = consentCookie.split('=');
147
151
  if (cookieParts.length > 1 && cookieParts[1]) {
148
- cookieValue = decodeURIComponent(cookieParts[1].trim());
152
+ try {
153
+ cookieValue = decodeURIComponent(cookieParts[1].trim());
154
+ }
155
+ catch { /* malformed cookie */ }
149
156
  }
150
157
  }
151
158
  }
@@ -277,6 +284,8 @@ export function BaseStoresInitializer({ children, handlers, customStores = [], s
277
284
  useLayoutEffect(() => {
278
285
  if (!isClient() || !criticalReady)
279
286
  return;
287
+ // Initialize ripple effect for all .dndev-interactive elements
288
+ initRipple();
280
289
  let removed = false;
281
290
  let frameworkReady = false;
282
291
  let routeReady = false;
@@ -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,4CAgU3B,CAAC"}
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,4CAyV3B,CAAC"}
@@ -64,40 +64,53 @@ export const DnDevLayout = ({ children, layout, className, }) => {
64
64
  const preset = useLayout('layoutPreset');
65
65
  const routePresetOverride = useLayout('routePresetOverride');
66
66
  const isMobile = useBreakpoint('isMobileOrTablet');
67
- const { app, features } = useAppConfig();
67
+ const { app, features, customPresets } = useAppConfig();
68
68
  const debugEnabled = isDev() && features?.debug === true;
69
69
  // Subscribe to language changes for zone re-renders
70
70
  useTranslation('dndev');
71
71
  // Layout config props
72
72
  const breadcrumbs = layout?.breadcrumbs ?? 'smart';
73
- const footerMode = layout?.footerMode;
74
- const footerInline = footerMode === 'scroll' || isMobile;
73
+ const routeHideBreadcrumbs = useLayout('routeHideBreadcrumbs');
75
74
  // Route detection for animations
76
75
  const location = useLocation();
77
76
  const pathname = location.pathname;
78
77
  const mainRef = useRef(null);
79
78
  // Platform content handling
80
79
  const content = children;
80
+ // Merge custom presets with built-in registry
81
+ const effectiveRegistry = useMemo(() => {
82
+ if (!customPresets)
83
+ return presetRegistry;
84
+ return { ...presetRegistry, ...customPresets };
85
+ }, [customPresets]);
81
86
  // Effective preset: route override > app default > fallback
82
87
  const effectivePreset = useMemo(() => {
83
88
  return routePresetOverride || preset || 'landing';
84
89
  }, [routePresetOverride, preset]);
85
90
  // Get preset config (presets only override what's different, defaults fill the rest)
86
91
  const config = useMemo(() => {
87
- const presetConfig = (presetRegistry[effectivePreset] ??
92
+ const presetConfig = (effectiveRegistry[effectivePreset] ??
88
93
  presetRegistry.landing);
89
94
  return {
90
95
  name: presetConfig.name,
91
96
  header: presetConfig.header,
92
97
  sidebar: presetConfig.sidebar,
93
98
  footer: presetConfig.footer,
99
+ footerMode: presetConfig.footerMode,
94
100
  mobile: presetConfig.mobile,
95
101
  };
96
- }, [effectivePreset]);
102
+ }, [effectivePreset, effectiveRegistry]);
103
+ // Footer mode: consumer layout prop > preset config > default (mobile=scroll, desktop=fixed)
104
+ const footerMode = layout?.footerMode ?? config.footerMode;
105
+ const footerInline = footerMode === 'scroll' || (isMobile && footerMode !== 'fixed');
97
106
  // Resolve header with consumer overrides
98
107
  const resolvedHeader = useMemo(() => {
108
+ // Function = custom mode: consumer owns zone visuals, DnDevHeader wraps with structural behavior
99
109
  if (typeof layout?.header === 'function') {
100
- return _jsx(layout.header, {});
110
+ return _jsx(DnDevHeader, { children: _jsx(layout.header, {}) });
111
+ }
112
+ if (typeof config.header === 'function') {
113
+ return _jsx(DnDevHeader, { children: config.header() });
101
114
  }
102
115
  // Determine effective header config (mobile overrides desktop when on mobile)
103
116
  const effectiveHeader = isMobile
@@ -157,8 +170,12 @@ export const DnDevLayout = ({ children, layout, className, }) => {
157
170
  }, [layout?.header, layout?.mobile?.header, config, isMobile]);
158
171
  // Resolve sidebar with consumer overrides
159
172
  const resolvedSidebar = useMemo(() => {
173
+ // Function = custom mode: consumer owns zone visuals, DnDevSidebar wraps with resize behavior
160
174
  if (typeof layout?.sidebar === 'function') {
161
- return _jsx(layout.sidebar, {});
175
+ return _jsx(DnDevSidebar, { children: _jsx(layout.sidebar, {}) });
176
+ }
177
+ if (typeof config.sidebar === 'function') {
178
+ return _jsx(DnDevSidebar, { children: config.sidebar() });
162
179
  }
163
180
  if (layout?.sidebar && typeof layout.sidebar === 'object') {
164
181
  // If consumer provides a function (including () => null), use it; otherwise fall back
@@ -181,13 +198,16 @@ export const DnDevLayout = ({ children, layout, className, }) => {
181
198
  }, [layout?.sidebar, config.sidebar]);
182
199
  // Resolve footer with consumer overrides
183
200
  const resolvedFooter = useMemo(() => {
201
+ // Function = custom mode: consumer owns zone visuals, DnDevFooter wraps with structural behavior
184
202
  if (layout?.footer) {
185
- return _jsx(layout.footer, {});
203
+ return _jsx(DnDevFooter, { children: _jsx(layout.footer, {}) });
186
204
  }
187
- // Preset can hide footer with footer: null
188
205
  if (config.footer === null) {
189
206
  return null;
190
207
  }
208
+ if (typeof config.footer === 'function') {
209
+ return _jsx(DnDevFooter, { children: config.footer() });
210
+ }
191
211
  return _jsx(DnDevFooter, { app: app });
192
212
  }, [layout?.footer, config.footer, app]);
193
213
  // Resolve mergedbar with consumer overrides
@@ -198,12 +218,15 @@ export const DnDevLayout = ({ children, layout, className, }) => {
198
218
  return _jsx(layout.mergedbar, {});
199
219
  }
200
220
  const mergedBarConfig = config.mobile.mergedBar;
221
+ // Narrow zone configs: function zones don't provide slots for mergedBar fallback
222
+ const headerSlots = typeof config.header === 'object' ? config.header : undefined;
223
+ const sidebarSlots = typeof config.sidebar === 'object' ? config.sidebar : undefined;
201
224
  if (layout?.mergedbar && typeof layout.mergedbar === 'object') {
202
225
  // If consumer provides a function (including () => null), use it; otherwise fall back
203
226
  const triggerSlot = layout.mergedbar.trigger !== undefined
204
227
  ? layout.mergedbar.trigger
205
228
  : (mergedBarConfig.trigger ??
206
- config.header?.start ??
229
+ headerSlots?.start ??
207
230
  DEFAULT_SLOTS.header.start);
208
231
  const topSlot = layout.mergedbar.top !== undefined
209
232
  ? layout.mergedbar.top
@@ -211,25 +234,25 @@ export const DnDevLayout = ({ children, layout, className, }) => {
211
234
  const contentSlot = layout.mergedbar.content !== undefined
212
235
  ? layout.mergedbar.content
213
236
  : (mergedBarConfig.content ??
214
- config.sidebar?.content ??
237
+ sidebarSlots?.content ??
215
238
  DEFAULT_SLOTS.sidebar.content);
216
239
  const bottomSlot = layout.mergedbar.bottom !== undefined
217
240
  ? layout.mergedbar.bottom
218
241
  : (mergedBarConfig.bottom ??
219
- config.sidebar?.bottom ??
242
+ sidebarSlots?.bottom ??
220
243
  DEFAULT_SLOTS.sidebar.bottom);
221
244
  return (_jsx(DnDevMergedBar, { position: mergedBarConfig.position, height: mergedBarConfig.height, trigger: triggerSlot(), top: topSlot(), content: contentSlot(), bottom: bottomSlot() }));
222
245
  }
223
246
  // No consumer override - use preset or defaults
224
247
  const triggerSlot = mergedBarConfig.trigger ??
225
- config.header?.start ??
248
+ headerSlots?.start ??
226
249
  DEFAULT_SLOTS.header.start;
227
250
  const topSlot = mergedBarConfig.top ?? DEFAULT_SLOTS.mobile.mergedBar.top;
228
251
  const contentSlot = mergedBarConfig.content ??
229
- config.sidebar?.content ??
252
+ sidebarSlots?.content ??
230
253
  DEFAULT_SLOTS.sidebar.content;
231
254
  const bottomSlot = mergedBarConfig.bottom ??
232
- config.sidebar?.bottom ??
255
+ sidebarSlots?.bottom ??
233
256
  DEFAULT_SLOTS.sidebar.bottom;
234
257
  return (_jsx(DnDevMergedBar, { position: mergedBarConfig.position, height: mergedBarConfig.height, trigger: triggerSlot(), top: topSlot(), content: contentSlot(), bottom: bottomSlot() }));
235
258
  }, [layout?.mergedbar, config]);
@@ -254,5 +277,5 @@ export const DnDevLayout = ({ children, layout, className, }) => {
254
277
  };
255
278
  startTransition(updateDOM);
256
279
  }, [effectivePreset]);
257
- return (_jsxs("div", { className: cn('dndev-layout', className), "data-footer-inline": footerInline || undefined, children: [resolvedHeader, resolvedSidebar, _jsxs("main", { ref: mainRef, role: "main", className: "main", children: [breadcrumbs !== 'never' && (_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, {})] }));
280
+ return (_jsxs("div", { className: cn('dndev-layout', className), "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, {})] }));
258
281
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAoM3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,aAuS1B,CAAC;AAEF;;;GAGG;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"AutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/AutoMetaTags.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAyN3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,aAyT1B,CAAC;AAEF;;;GAGG;AAEH,eAAe,YAAY,CAAC"}
@@ -10,7 +10,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
10
10
  * - Zero-configuration SEO setup
11
11
  * - Open Graph and Twitter Card support with image dimensions
12
12
  * - hreflang alternate links (auto from i18n config)
13
- * - Speculation Rules API (prefetch/prerender for Chromium)
13
+ * - Speculation Rules API (prefetch/prerender for Chromium) - opt-in, requires CSP config
14
14
  * - BreadcrumbList + WebSite JSON-LD structured data
15
15
  * - Internationalization integration
16
16
  * - Canonical URL management
@@ -48,6 +48,22 @@ function matchRoutePath(pattern, pathname) {
48
48
  }
49
49
  return true;
50
50
  }
51
+ /**
52
+ * Resolve SEO field with i18n fallback
53
+ * @description
54
+ * - `undefined` → i18n lookup
55
+ * - `string` → use literal value
56
+ * - `null` → omit (return undefined)
57
+ */
58
+ function resolveSeoField(seoValue, translationKey, t) {
59
+ if (seoValue === null)
60
+ return undefined; // Explicit null = omit
61
+ if (seoValue !== undefined)
62
+ return seoValue; // Explicit string = use it
63
+ // undefined = i18n lookup
64
+ const translated = t(translationKey);
65
+ return translated !== translationKey ? translated : undefined;
66
+ }
51
67
  /**
52
68
  * Get route metadata from window object (injected by build system).
53
69
  * Resolves dynamic routes by pattern (e.g. /cars/:id) so PageMeta (including namespace) is used for SEO.
@@ -75,7 +91,7 @@ function getRouteMetadata(pathname, isClient) {
75
91
  // Fallback: first path segment as namespace (e.g. /cars/abc123 → ns: cars)
76
92
  const segments = pathname.split('/').filter(Boolean);
77
93
  if (segments.length > 0) {
78
- return { ns: segments[0] };
94
+ return { namespace: segments[0] };
79
95
  }
80
96
  return {};
81
97
  }
@@ -206,7 +222,7 @@ export const AutoMetaTags = () => {
206
222
  const seoConfig = useSeoConfig();
207
223
  const isClient = useIsClient();
208
224
  const appMeta = useAppConfig('app');
209
- const siteName = appMeta?.name || '';
225
+ const siteName = (seoConfig && seoConfig.siteName) || appMeta?.name || '';
210
226
  const baseUrl = getPlatformEnvVar('APP_URL') || '';
211
227
  // Get route metadata — computed from current pathname and client flag
212
228
  const routeMeta = getRouteMetadata(location.pathname, isClient);
@@ -222,27 +238,41 @@ export const AutoMetaTags = () => {
222
238
  const { defaultNamespace = 'home', defaultImage } = seoConfig;
223
239
  // Construct absolute URL for canonical link
224
240
  const currentUrl = `${baseUrl}${location.pathname}`;
225
- const ns = routeMeta.ns || defaultNamespace;
226
- // Get meta tags from translation files
227
- const pageTitle = routeMeta.title || t(`${ns}:title`);
228
- const pageDescription = routeMeta.description || t(`${ns}:description`);
229
- // Get the meta object and destructure it properly
241
+ const ns = routeMeta.namespace || defaultNamespace;
242
+ const seo = routeMeta.seo;
243
+ // Get the meta object from i18n (for image, type, keywords, author, fullTitle)
230
244
  const metaObject = t(`${ns}:meta`, { returnObjects: true });
231
- const pageImage = routeMeta.image || metaObject?.image || defaultImage;
232
- const pageType = routeMeta.type || metaObject?.type || 'website';
233
- const pageKeywords = routeMeta.keywords || metaObject?.keywords;
245
+ // Title resolution priority:
246
+ // 1. i18n meta.fullTitle → translated, language-aware (wins)
247
+ // 2. seo.fullTitle (static PageMeta) → fallback for non-i18n apps
248
+ // 3. seo.title (explicit) → "title | siteName"
249
+ // 4. i18n ns:title → "translated | siteName"
250
+ // 5. siteName only (when seo.title === null or no translation)
251
+ let fullTitle;
252
+ if (metaObject?.fullTitle) {
253
+ // i18n fullTitle (ns:meta.fullTitle) → translated, takes priority
254
+ fullTitle = metaObject.fullTitle;
255
+ }
256
+ else if (seo?.fullTitle) {
257
+ // Static fullTitle in PageMeta → fallback for non-i18n apps
258
+ fullTitle = seo.fullTitle;
259
+ }
260
+ else {
261
+ // Standard resolution: title | siteName
262
+ const pageTitle = resolveSeoField(seo?.title, `${ns}:title`, t);
263
+ fullTitle = pageTitle ? `${pageTitle} | ${siteName}` : siteName;
264
+ }
265
+ // Description resolution: seo.description > i18n
266
+ const description = resolveSeoField(seo?.description, `${ns}:description`, t);
267
+ // Other meta fields: seo > i18n meta object > defaults
268
+ const pageImage = seo?.image || metaObject?.image || defaultImage;
269
+ const pageType = seo?.type || metaObject?.type || 'website';
270
+ const pageKeywords = seo?.keywords || metaObject?.keywords;
234
271
  const pageAuthor = routeMeta.author || metaObject?.author;
235
- // Only use values that are actually defined (not empty strings or undefined)
236
- const title = pageTitle && pageTitle !== `${ns}:title` ? pageTitle : undefined;
237
- const description = pageDescription && pageDescription !== `${ns}:description`
238
- ? pageDescription
239
- : undefined;
240
272
  const image = pageImage || undefined;
241
273
  const type = pageType || 'website';
242
274
  const keywords = pageKeywords || undefined;
243
275
  const author = pageAuthor || undefined;
244
- // Build full title with site name if title exists, otherwise just use site name
245
- const fullTitle = title ? `${title} | ${siteName}` : siteName;
246
276
  // Use relative image path instead of constructing absolute URL
247
277
  // This prevents crashes from invalid baseUrl and works in all modes
248
278
  const imagePath = image && image.startsWith('http') ? image : image ? image : undefined;
@@ -252,7 +282,7 @@ export const AutoMetaTags = () => {
252
282
  image: imagePath,
253
283
  url: currentUrl,
254
284
  type,
255
- noindex: routeMeta.noindex || false,
285
+ noindex: seo?.noindex || routeMeta.noindex || false,
256
286
  keywords,
257
287
  author,
258
288
  publishDate: routeMeta.publishDate,
@@ -263,8 +293,10 @@ export const AutoMetaTags = () => {
263
293
  if (!seoConfig || !metaData)
264
294
  return null;
265
295
  const { twitterHandle, staticTags = {} } = seoConfig;
266
- // Feature flags — all default to true (ON by default)
267
- const speculationRulesEnabled = seoConfig.speculationRules !== false;
296
+ // Feature flags — all default to true (ON by default), except speculationRules (CSP conflict)
297
+ // Speculation rules require inline script which conflicts with strict CSP.
298
+ // Opt-in only: set seo.speculationRules: true and add CSP hash to your headers.
299
+ const speculationRulesEnabled = seoConfig.speculationRules === true;
268
300
  const hreflangEnabled = seoConfig.hreflang !== false;
269
301
  const breadcrumbSchemaEnabled = seoConfig.breadcrumbSchema !== false;
270
302
  const websiteSchemaEnabled = seoConfig.websiteSchema !== false;
@@ -273,9 +305,9 @@ export const AutoMetaTags = () => {
273
305
  const languages = i18nConfig?.languages || [];
274
306
  const defaultLanguage = i18nConfig?.defaultLanguage || 'en';
275
307
  const shouldEmitHreflang = hreflangEnabled && languages.length >= 2;
276
- return (_jsxs(Helmet, { children: [_jsx("title", { children: metaData.title }), metaData.description && (_jsx("meta", { name: "description", content: metaData.description })), _jsx("link", { rel: "canonical", href: metaData.url }), metaData.keywords && (_jsx("meta", { name: "keywords", content: Array.isArray(metaData.keywords)
308
+ return (_jsxs(Helmet, { children: [_jsx("title", { children: metaData.title }), metaData.description && (_jsx("meta", { name: "description", content: metaData.description })), baseUrl && _jsx("link", { rel: "canonical", href: metaData.url }), metaData.keywords && (_jsx("meta", { name: "keywords", content: Array.isArray(metaData.keywords)
277
309
  ? metaData.keywords.join(', ')
278
- : 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:url", content: metaData.url }), _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" })), _jsx("meta", { property: "og:site_name", content: siteName }), 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 }), twitterHandle && (_jsx("meta", { name: "twitter:site", content: `@${twitterHandle}` })), metaData.author && (_jsx("meta", { name: "twitter:creator", content: metaData.author })), _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 &&
310
+ : 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 })), baseUrl && _jsx("meta", { property: "og:url", content: metaData.url }), _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" })), _jsx("meta", { property: "og:site_name", content: siteName }), 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 }), twitterHandle && (_jsx("meta", { name: "twitter:site", content: `@${twitterHandle}` })), metaData.author && (_jsx("meta", { name: "twitter:creator", content: metaData.author })), _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 &&
279
311
  languages.map((lang) => (_jsx("link", { rel: "alternate", hrefLang: lang, href: `${baseUrl}${lang === defaultLanguage ? '' : `/${lang}`}${location.pathname}` }, `hreflang-${lang}`))), shouldEmitHreflang && (_jsx("link", { rel: "alternate", hrefLang: "x-default", href: `${baseUrl}${location.pathname}` })), baseUrl && (_jsx("link", { rel: "alternate", type: "application/rss+xml", title: `${siteName} Blog`, href: `${baseUrl}/rss.xml` })), metaData.image && metaData.image.startsWith('http') && (_jsx("link", { rel: "dns-prefetch", href: new URL(metaData.image).origin })), _jsx("script", { type: "application/ld+json", children: JSON.stringify({
280
312
  '@context': 'https://schema.org',
281
313
  '@type': metaData.type === 'article' ? 'Article' : 'WebPage',
@@ -1,4 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
+ import type { SeoMeta } from '@donotdev/core';
2
3
  interface MetaTagsConfig {
3
4
  /** Base URL for canonical links */
4
5
  baseUrl?: string;
@@ -26,6 +27,7 @@ interface RouteMetadata {
26
27
  author?: string;
27
28
  publishDate?: string;
28
29
  modifiedDate?: string;
30
+ seo?: SeoMeta;
29
31
  }
30
32
  interface NextJsAutoMetaTagsProps {
31
33
  /** Configuration for meta tags */
@@ -1 +1 @@
1
- {"version":3,"file":"NextJsAutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/NextJsAutoMetaTags.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,UAAU,cAAc;IACtB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,uBAAuB;IAC/B,kCAAkC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AA+DD;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CA8L9D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"NextJsAutoMetaTags.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/NextJsAutoMetaTags.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,UAAU,cAAc;IACtB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,UAAU,uBAAuB;IAC/B,kCAAkC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAkFD;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CA6M9D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -39,6 +39,22 @@ function matchRoutePath(pattern, pathname) {
39
39
  }
40
40
  return true;
41
41
  }
42
+ /**
43
+ * Resolve SEO field with i18n fallback
44
+ * @description
45
+ * - `undefined` → i18n lookup
46
+ * - `string` → use literal value
47
+ * - `null` → omit (return undefined)
48
+ */
49
+ function resolveSeoField(seoValue, translationKey, t) {
50
+ if (seoValue === null)
51
+ return undefined; // Explicit null = omit
52
+ if (seoValue !== undefined)
53
+ return seoValue; // Explicit string = use it
54
+ // undefined = i18n lookup
55
+ const translated = t(translationKey);
56
+ return translated !== translationKey ? translated : undefined;
57
+ }
42
58
  /**
43
59
  * Get route metadata from config (injected by build system).
44
60
  * Resolves dynamic routes by pattern so PageMeta (including namespace) is used for SEO.
@@ -101,26 +117,40 @@ const NextJsAutoMetaTags = ({ config = {}, routeMeta: routeMetaOverride, title:
101
117
  // Construct absolute URL for canonical link
102
118
  const currentUrl = `${baseUrl}${pathname || '/'}`;
103
119
  const ns = finalRouteMeta.ns || defaultNamespace;
104
- // Get meta tags from translation files
105
- const pageTitle = finalRouteMeta.title || t(`${ns}:title`);
106
- const pageDescription = finalRouteMeta.description || t(`${ns}:description`);
107
- // Get the meta object and destructure it properly
120
+ const seo = finalRouteMeta.seo;
121
+ // Get the meta object from i18n (for image, type, keywords, author, fullTitle)
108
122
  const metaObject = t(`${ns}:meta`, { returnObjects: true });
109
- const pageImage = finalRouteMeta.image || metaObject?.image || defaultImage;
110
- const pageType = finalRouteMeta.type || metaObject?.type || 'website';
111
- const pageKeywords = finalRouteMeta.keywords || metaObject?.keywords;
123
+ // Title resolution priority:
124
+ // 1. i18n meta.fullTitle → translated, language-aware (wins)
125
+ // 2. seo.fullTitle (static PageMeta) → fallback for non-i18n apps
126
+ // 3. seo.title (explicit) → "title | siteName"
127
+ // 4. i18n ns:title → "translated | siteName"
128
+ // 5. siteName only (when seo.title === null or no translation)
129
+ let fullTitle;
130
+ if (metaObject?.fullTitle) {
131
+ // i18n fullTitle (ns:meta.fullTitle) → translated, takes priority
132
+ fullTitle = metaObject.fullTitle;
133
+ }
134
+ else if (seo?.fullTitle) {
135
+ // Static fullTitle in PageMeta → fallback for non-i18n apps
136
+ fullTitle = seo.fullTitle;
137
+ }
138
+ else {
139
+ // Standard resolution: title | siteName
140
+ const pageTitle = resolveSeoField(seo?.title, `${ns}:title`, t);
141
+ fullTitle = pageTitle ? `${pageTitle} | ${siteName}` : siteName;
142
+ }
143
+ // Description resolution: seo.description > i18n
144
+ const description = resolveSeoField(seo?.description, `${ns}:description`, t);
145
+ // Other meta fields: seo > i18n meta object > defaults
146
+ const pageImage = seo?.image || metaObject?.image || defaultImage;
147
+ const pageType = seo?.type || metaObject?.type || 'website';
148
+ const pageKeywords = seo?.keywords || metaObject?.keywords;
112
149
  const pageAuthor = finalRouteMeta.author || metaObject?.author;
113
- // Only use values that are actually defined (not empty strings or undefined)
114
- const title = pageTitle && pageTitle !== `${ns}:title` ? pageTitle : undefined;
115
- const description = pageDescription && pageDescription !== `${ns}:description`
116
- ? pageDescription
117
- : undefined;
118
150
  const image = pageImage || undefined;
119
151
  const type = pageType || 'website';
120
152
  const keywords = pageKeywords || undefined;
121
153
  const author = pageAuthor || undefined;
122
- // Build full title with site name if title exists, otherwise just use site name
123
- const fullTitle = title ? `${title} | ${siteName}` : siteName;
124
154
  // Use relative image path instead of constructing absolute URL
125
155
  // This prevents crashes from invalid baseUrl and works in all modes
126
156
  const imagePath = image && image.startsWith('http') ? image : image ? image : undefined;
@@ -130,7 +160,7 @@ const NextJsAutoMetaTags = ({ config = {}, routeMeta: routeMetaOverride, title:
130
160
  image: imagePath,
131
161
  url: currentUrl,
132
162
  type,
133
- noindex: finalRouteMeta.noindex || false,
163
+ noindex: seo?.noindex || finalRouteMeta.noindex || false,
134
164
  keywords,
135
165
  author,
136
166
  publishDate: finalRouteMeta.publishDate,
@@ -1 +1 @@
1
- {"version":3,"file":"PWAUpdateNotification.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/PWAUpdateNotification.tsx"],"names":[],"mappings":"AAwBA,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,QAsHtE;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"PWAUpdateNotification.d.ts","sourceRoot":"","sources":["../../../../src/internal/layout/components/PWAUpdateNotification.tsx"],"names":[],"mappings":"AAwBA,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,QAoItE;AAED,eAAe,qBAAqB,CAAC"}
@@ -49,6 +49,11 @@ function PWAUpdateNotification({ onUpdate }) {
49
49
  window.location.reload();
50
50
  };
51
51
  navigator.serviceWorker.addEventListener('controllerchange', handleControllerChange);
52
+ // Track listeners for cleanup
53
+ let currentReg = null;
54
+ let handleUpdateFound = null;
55
+ let trackedWorker = null;
56
+ let handleStateChange = null;
52
57
  const checkForUpdates = async () => {
53
58
  // CSR guard: Check client again
54
59
  if (!isClient())
@@ -56,11 +61,13 @@ function PWAUpdateNotification({ onUpdate }) {
56
61
  try {
57
62
  const reg = await navigator.serviceWorker.ready;
58
63
  registrationRef.current = reg;
59
- const handleUpdateFound = () => {
64
+ currentReg = reg;
65
+ handleUpdateFound = () => {
60
66
  const newWorker = reg.installing;
61
67
  if (!newWorker)
62
68
  return;
63
- const handleStateChange = () => {
69
+ trackedWorker = newWorker;
70
+ handleStateChange = () => {
64
71
  if (newWorker.state === 'installed' &&
65
72
  navigator.serviceWorker.controller &&
66
73
  !toastIdRef.current) {
@@ -109,6 +116,12 @@ function PWAUpdateNotification({ onUpdate }) {
109
116
  if (isClient() && 'serviceWorker' in navigator) {
110
117
  navigator.serviceWorker.removeEventListener('controllerchange', handleControllerChange);
111
118
  }
119
+ if (currentReg && handleUpdateFound) {
120
+ currentReg.removeEventListener('updatefound', handleUpdateFound);
121
+ }
122
+ if (trackedWorker && handleStateChange) {
123
+ trackedWorker.removeEventListener('statechange', handleStateChange);
124
+ }
112
125
  clearInterval(interval);
113
126
  };
114
127
  }, [onUpdate]);