@windrun-huaiin/third-ui 20.1.0 → 22.0.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.
Files changed (123) hide show
  1. package/LICENSE +1 -1
  2. package/dist/ai/ai-markdown.js +1 -1
  3. package/dist/ai/ai-markdown.mjs +1 -1
  4. package/dist/clerk/clerk-page-context-generator.js +3 -2
  5. package/dist/clerk/clerk-page-context-generator.mjs +3 -2
  6. package/dist/clerk/clerk-page-generator.d.ts +0 -8
  7. package/dist/clerk/clerk-page-generator.js +4 -3
  8. package/dist/clerk/clerk-page-generator.mjs +4 -3
  9. package/dist/fuma/base/custom-header.d.ts +1 -1
  10. package/dist/fuma/base/custom-header.js +38 -36
  11. package/dist/fuma/base/custom-header.mjs +25 -23
  12. package/dist/fuma/base/custom-home-layout.d.ts +1 -1
  13. package/dist/fuma/base/custom-home-layout.js +1 -1
  14. package/dist/fuma/base/custom-home-layout.mjs +1 -1
  15. package/dist/fuma/base/header-theme-switch.d.ts +5 -0
  16. package/dist/fuma/base/header-theme-switch.js +42 -0
  17. package/dist/fuma/base/header-theme-switch.mjs +40 -0
  18. package/dist/fuma/base/index.d.ts +1 -0
  19. package/dist/fuma/base/index.js +7 -0
  20. package/dist/fuma/base/index.mjs +1 -0
  21. package/dist/fuma/base/site-layout.d.ts +116 -0
  22. package/dist/fuma/base/site-layout.js +72 -0
  23. package/dist/fuma/base/site-layout.mjs +65 -0
  24. package/dist/fuma/fuma-banner-suit.js +9 -6
  25. package/dist/fuma/fuma-banner-suit.mjs +10 -7
  26. package/dist/fuma/fuma-page-genarator.d.ts +2 -2
  27. package/dist/fuma/fuma-page-genarator.js +21 -8
  28. package/dist/fuma/fuma-page-genarator.mjs +21 -8
  29. package/dist/fuma/heavy/image-grid.d.ts +6 -0
  30. package/dist/fuma/heavy/image-grid.js +17 -0
  31. package/dist/fuma/heavy/image-grid.mjs +15 -0
  32. package/dist/fuma/heavy/image-zoom.d.ts +22 -0
  33. package/dist/fuma/heavy/image-zoom.js +39 -0
  34. package/dist/fuma/heavy/image-zoom.mjs +37 -0
  35. package/dist/fuma/heavy/index.d.ts +4 -0
  36. package/dist/fuma/heavy/index.js +15 -0
  37. package/dist/fuma/heavy/index.mjs +5 -0
  38. package/dist/fuma/heavy/math.d.ts +17 -0
  39. package/dist/fuma/heavy/math.js +60 -0
  40. package/dist/fuma/heavy/math.mjs +57 -0
  41. package/dist/fuma/heavy/mermaid.d.ts +13 -0
  42. package/dist/fuma/heavy/mermaid.js +360 -0
  43. package/dist/fuma/heavy/mermaid.mjs +358 -0
  44. package/dist/fuma/llm-copy-handler.js +3 -2
  45. package/dist/fuma/llm-copy-handler.mjs +3 -2
  46. package/dist/fuma/mdx/features.d.ts +8 -0
  47. package/dist/fuma/mdx/features.js +92 -0
  48. package/dist/fuma/mdx/features.mjs +85 -0
  49. package/dist/fuma/mdx/index.d.ts +0 -4
  50. package/dist/fuma/mdx/index.js +0 -8
  51. package/dist/fuma/mdx/index.mjs +0 -4
  52. package/dist/fuma/mdx/markdown-component-map.js +7 -1
  53. package/dist/fuma/mdx/markdown-component-map.mjs +7 -1
  54. package/dist/fuma/mdx/math.d.ts +17 -0
  55. package/dist/fuma/mdx/math.js +60 -0
  56. package/dist/fuma/mdx/math.mjs +57 -0
  57. package/dist/fuma/mdx/site-mdx-components.d.ts +13 -0
  58. package/dist/fuma/mdx/site-mdx-components.js +19 -0
  59. package/dist/fuma/mdx/site-mdx-components.mjs +17 -0
  60. package/dist/fuma/mdx/site-mdx-presets.d.ts +13 -0
  61. package/dist/fuma/mdx/site-mdx-presets.js +49 -0
  62. package/dist/fuma/mdx/site-mdx-presets.mjs +45 -0
  63. package/dist/fuma/mdx/toc-clerk-portable.js +9 -5
  64. package/dist/fuma/mdx/toc-clerk-portable.mjs +8 -4
  65. package/dist/fuma/mdx/zia-card.js +1 -1
  66. package/dist/fuma/mdx/zia-card.mjs +1 -1
  67. package/dist/fuma/mdx/zia-file.js +1 -0
  68. package/dist/fuma/mdx/zia-file.mjs +1 -0
  69. package/dist/fuma/server/optional-features.d.ts +8 -0
  70. package/dist/fuma/server/optional-features.js +111 -0
  71. package/dist/fuma/server/optional-features.mjs +104 -0
  72. package/dist/fuma/server/site-mdx-components.d.ts +13 -0
  73. package/dist/fuma/server/site-mdx-components.js +19 -0
  74. package/dist/fuma/server/site-mdx-components.mjs +17 -0
  75. package/dist/fuma/server/site-mdx-presets.d.ts +194 -0
  76. package/dist/fuma/server/site-mdx-presets.js +46 -0
  77. package/dist/fuma/server/site-mdx-presets.mjs +42 -0
  78. package/dist/fuma/share/index.d.ts +1 -0
  79. package/dist/fuma/share/index.js +7 -0
  80. package/dist/fuma/share/index.mjs +1 -0
  81. package/dist/fuma/share/markdown-component-map.d.ts +3 -0
  82. package/dist/fuma/share/markdown-component-map.js +79 -0
  83. package/dist/fuma/share/markdown-component-map.mjs +77 -0
  84. package/dist/lib/fuma-schema-check-util.js +19 -5
  85. package/dist/lib/fuma-schema-check-util.mjs +19 -5
  86. package/dist/lib/seo-metadata.d.ts +10 -0
  87. package/dist/main/x-button.js +2 -2
  88. package/dist/main/x-button.mjs +2 -2
  89. package/package.json +31 -8
  90. package/src/ai/ai-markdown.tsx +1 -1
  91. package/src/clerk/clerk-page-context-generator.tsx +6 -3
  92. package/src/clerk/clerk-page-generator.tsx +7 -13
  93. package/src/fuma/base/custom-header.tsx +32 -35
  94. package/src/fuma/base/custom-home-layout.tsx +2 -2
  95. package/src/fuma/base/header-theme-switch.tsx +88 -0
  96. package/src/fuma/base/index.ts +1 -0
  97. package/src/fuma/base/site-layout.tsx +289 -0
  98. package/src/fuma/fuma-banner-suit.tsx +30 -28
  99. package/src/fuma/fuma-page-genarator.tsx +27 -10
  100. package/src/fuma/{mdx → heavy}/image-grid.tsx +1 -1
  101. package/src/fuma/heavy/index.ts +7 -0
  102. package/src/fuma/heavy/math.tsx +130 -0
  103. package/src/fuma/llm-copy-handler.ts +3 -3
  104. package/src/fuma/mdx/index.ts +0 -4
  105. package/src/fuma/mdx/toc-clerk-portable.tsx +27 -24
  106. package/src/fuma/mdx/zia-card.tsx +1 -0
  107. package/src/fuma/mdx/zia-file.tsx +3 -1
  108. package/src/fuma/server/optional-features.tsx +168 -0
  109. package/src/fuma/server/site-mdx-components.tsx +48 -0
  110. package/src/fuma/server/site-mdx-presets.ts +80 -0
  111. package/src/fuma/share/index.ts +1 -0
  112. package/src/fuma/{mdx → share}/markdown-component-map.tsx +1 -1
  113. package/src/lib/fuma-schema-check-util.ts +22 -6
  114. package/src/lib/seo-metadata.ts +47 -0
  115. package/src/main/language-detector.tsx +0 -8
  116. package/src/main/x-button.tsx +2 -2
  117. package/src/styles/fuma.css +3 -7
  118. package/src/styles/third-ui.css +0 -4
  119. package/dist/main/ads-alert-dialog.d.ts +0 -15
  120. package/dist/main/ads-alert-dialog.js +0 -21
  121. package/dist/main/ads-alert-dialog.mjs +0 -19
  122. /package/src/fuma/{mdx → heavy}/image-zoom.tsx +0 -0
  123. /package/src/fuma/{mdx → heavy}/mermaid.tsx +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 D8ger
3
+ Copyright (c) 2025 D8ger
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -4,7 +4,7 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var utils = require('@windrun-huaiin/lib/utils');
6
6
  var hastUtilToJsxRuntime = require('hast-util-to-jsx-runtime');
7
- var markdownComponentMap = require('../fuma/mdx/markdown-component-map.js');
7
+ var markdownComponentMap = require('../fuma/share/markdown-component-map.js');
8
8
  var React = require('react');
9
9
  var remarkGfm = require('remark-gfm');
10
10
  var remarkParse = require('remark-parse');
@@ -2,7 +2,7 @@
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { cn } from '@windrun-huaiin/lib/utils';
4
4
  import { toJsxRuntime } from 'hast-util-to-jsx-runtime';
5
- import { baseMarkdownComponents } from '../fuma/mdx/markdown-component-map.mjs';
5
+ import { baseMarkdownComponents } from '../fuma/share/markdown-component-map.mjs';
6
6
  import { useMemo } from 'react';
7
7
  import remarkGfm from 'remark-gfm';
8
8
  import remarkParse from 'remark-parse';
@@ -5,13 +5,14 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var signupWithFingerprintClient = require('./signup-with-fingerprint-client.js');
6
6
  var signinWithFingerprintClient = require('./signin-with-fingerprint-client.js');
7
7
 
8
+ const clerkPageContainerClassName = 'flex min-h-dvh w-full items-start justify-center px-6 pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1rem)] pb-6 md:px-8 md:pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1.5rem)] md:pb-8';
8
9
  /**
9
10
  * Create a SignUp page with fingerprint support
10
11
  * Note: This must be used within a FingerprintProvider
11
12
  */
12
13
  function createSignUpPageWithFingerprint() {
13
14
  return function SignUpPage() {
14
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center m-16", children: jsxRuntime.jsx(signupWithFingerprintClient.SignUpWithFingerprint, {}) }));
15
+ return (jsxRuntime.jsx("div", { className: clerkPageContainerClassName, children: jsxRuntime.jsx(signupWithFingerprintClient.SignUpWithFingerprint, {}) }));
15
16
  };
16
17
  }
17
18
  /**
@@ -20,7 +21,7 @@ function createSignUpPageWithFingerprint() {
20
21
  */
21
22
  function createSignInPageWithFingerprint() {
22
23
  return function SignInPage() {
23
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center m-16", children: jsxRuntime.jsx(signinWithFingerprintClient.SignInWithFingerprint, {}) }));
24
+ return (jsxRuntime.jsx("div", { className: clerkPageContainerClassName, children: jsxRuntime.jsx(signinWithFingerprintClient.SignInWithFingerprint, {}) }));
24
25
  };
25
26
  }
26
27
 
@@ -3,13 +3,14 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { SignUpWithFingerprint } from './signup-with-fingerprint-client.mjs';
4
4
  import { SignInWithFingerprint } from './signin-with-fingerprint-client.mjs';
5
5
 
6
+ const clerkPageContainerClassName = 'flex min-h-dvh w-full items-start justify-center px-6 pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1rem)] pb-6 md:px-8 md:pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1.5rem)] md:pb-8';
6
7
  /**
7
8
  * Create a SignUp page with fingerprint support
8
9
  * Note: This must be used within a FingerprintProvider
9
10
  */
10
11
  function createSignUpPageWithFingerprint() {
11
12
  return function SignUpPage() {
12
- return (jsx("div", { className: "flex-1 flex justify-center m-16", children: jsx(SignUpWithFingerprint, {}) }));
13
+ return (jsx("div", { className: clerkPageContainerClassName, children: jsx(SignUpWithFingerprint, {}) }));
13
14
  };
14
15
  }
15
16
  /**
@@ -18,7 +19,7 @@ function createSignUpPageWithFingerprint() {
18
19
  */
19
20
  function createSignInPageWithFingerprint() {
20
21
  return function SignInPage() {
21
- return (jsx("div", { className: "flex-1 flex justify-center m-16", children: jsx(SignInWithFingerprint, {}) }));
22
+ return (jsx("div", { className: clerkPageContainerClassName, children: jsx(SignInWithFingerprint, {}) }));
22
23
  };
23
24
  }
24
25
 
@@ -1,11 +1,3 @@
1
- /**
2
- * @license
3
- * MIT License
4
- * Copyright (c) 2026 D8ger
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */
9
1
  export declare function createSignInPage(): () => import("react/jsx-runtime").JSX.Element;
10
2
  export declare function createSignUpPage(): () => import("react/jsx-runtime").JSX.Element;
11
3
  export declare function createWaitlistPage(): () => import("react/jsx-runtime").JSX.Element;
@@ -3,20 +3,21 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var nextjs = require('@clerk/nextjs');
5
5
 
6
+ const clerkPageContainerClassName = 'flex min-h-dvh w-full items-start justify-center px-6 pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1rem)] pb-6 md:px-8 md:pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1.5rem)] md:pb-8';
6
7
  // Legacy page generators (for backward compatibility)
7
8
  function createSignInPage() {
8
9
  return function SignInPage() {
9
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center m-16", children: jsxRuntime.jsx(nextjs.SignIn, {}) }));
10
+ return (jsxRuntime.jsx("div", { className: clerkPageContainerClassName, children: jsxRuntime.jsx(nextjs.SignIn, {}) }));
10
11
  };
11
12
  }
12
13
  function createSignUpPage() {
13
14
  return function SignUpPage() {
14
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center m-16", children: jsxRuntime.jsx(nextjs.SignUp, {}) }));
15
+ return (jsxRuntime.jsx("div", { className: clerkPageContainerClassName, children: jsxRuntime.jsx(nextjs.SignUp, {}) }));
15
16
  };
16
17
  }
17
18
  function createWaitlistPage() {
18
19
  return function WaitlistPage() {
19
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center m-16", children: jsxRuntime.jsx(nextjs.Waitlist, {}) }));
20
+ return (jsxRuntime.jsx("div", { className: clerkPageContainerClassName, children: jsxRuntime.jsx(nextjs.Waitlist, {}) }));
20
21
  };
21
22
  }
22
23
 
@@ -1,20 +1,21 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { SignIn, SignUp, Waitlist } from '@clerk/nextjs';
3
3
 
4
+ const clerkPageContainerClassName = 'flex min-h-dvh w-full items-start justify-center px-6 pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1rem)] pb-6 md:px-8 md:pt-[calc(var(--fd-banner-height,0px)+var(--fd-header-height,3.5rem)+1.5rem)] md:pb-8';
4
5
  // Legacy page generators (for backward compatibility)
5
6
  function createSignInPage() {
6
7
  return function SignInPage() {
7
- return (jsx("div", { className: "flex-1 flex justify-center m-16", children: jsx(SignIn, {}) }));
8
+ return (jsx("div", { className: clerkPageContainerClassName, children: jsx(SignIn, {}) }));
8
9
  };
9
10
  }
10
11
  function createSignUpPage() {
11
12
  return function SignUpPage() {
12
- return (jsx("div", { className: "flex-1 flex justify-center m-16", children: jsx(SignUp, {}) }));
13
+ return (jsx("div", { className: clerkPageContainerClassName, children: jsx(SignUp, {}) }));
13
14
  };
14
15
  }
15
16
  function createWaitlistPage() {
16
17
  return function WaitlistPage() {
17
- return (jsx("div", { className: "flex-1 flex justify-center m-16", children: jsx(Waitlist, {}) }));
18
+ return (jsx("div", { className: clerkPageContainerClassName, children: jsx(Waitlist, {}) }));
18
19
  };
19
20
  }
20
21
 
@@ -2,7 +2,7 @@ import { type CSSProperties } from 'react';
2
2
  import { HomeLayoutProps } from 'fumadocs-ui/layouts/home';
3
3
  export type NavbarCSSVars = CSSProperties & {
4
4
  '--fd-banner-height'?: string;
5
- '--fd-nav-height'?: string;
5
+ '--fd-header-height'?: string;
6
6
  '--fd-nav-max-width'?: string;
7
7
  };
8
8
  export interface CustomHomeHeaderProps extends HomeLayoutProps {
@@ -6,17 +6,15 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
7
  var classVarianceAuthority = require('class-variance-authority');
8
8
  var icons = require('@windrun-huaiin/base-ui/icons');
9
+ var utils = require('@windrun-huaiin/lib/utils');
9
10
  var Link = require('fumadocs-core/link');
10
11
  var shared = require('fumadocs-ui/layouts/shared');
11
- var cn = require('fumadocs-ui/utils/cn');
12
- var searchToggle = require('fumadocs-ui/components/layout/search-toggle');
13
- var themeToggle = require('fumadocs-ui/components/layout/theme-toggle');
14
- var languageToggle = require('fumadocs-ui/components/layout/language-toggle');
12
+ var languageSelect = require('fumadocs-ui/layouts/shared/slots/language-select');
15
13
  var navigationMenu = require('fumadocs-ui/components/ui/navigation-menu');
16
14
  var popover = require('fumadocs-ui/components/ui/popover');
17
15
  var button = require('fumadocs-ui/components/ui/button');
18
- var layout = require('fumadocs-ui/contexts/layout');
19
16
  var i18n = require('fumadocs-ui/contexts/i18n');
17
+ var headerThemeSwitch = require('./header-theme-switch.js');
20
18
 
21
19
  const DEFAULT_DESKTOP_ACTIONS = [
22
20
  'search',
@@ -35,9 +33,9 @@ const DEFAULT_MOBILE_MENU_ACTIONS = [
35
33
  'i18n',
36
34
  'theme',
37
35
  ];
38
- function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitch = {}, searchToggle: searchToggle$1 = {}, bannerHeight = 0, headerHeight = 2.5, maxContentWidth = 1400, navbarClassName, floating = false, desktopActionsOrder = DEFAULT_DESKTOP_ACTIONS, mobileBarActionsOrder = DEFAULT_MOBILE_BAR_ACTIONS, mobileMenuActionsOrder = DEFAULT_MOBILE_MENU_ACTIONS, }) {
36
+ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitch = {}, searchToggle = {}, bannerHeight = 0, headerHeight = 2.5, maxContentWidth = 1400, navbarClassName, floating = false, desktopActionsOrder = DEFAULT_DESKTOP_ACTIONS, mobileBarActionsOrder = DEFAULT_MOBILE_BAR_ACTIONS, mobileMenuActionsOrder = DEFAULT_MOBILE_MENU_ACTIONS, }) {
39
37
  var _a, _b, _c, _d, _e, _f, _g;
40
- const finalLinks = React.useMemo(() => shared.getLinks(links, githubUrl), [links, githubUrl]);
38
+ const finalLinks = React.useMemo(() => shared.resolveLinkItems({ links, githubUrl }), [links, githubUrl]);
41
39
  const navItems = finalLinks.filter((item) => { var _a; return ['nav', 'all'].includes((_a = item.on) !== null && _a !== void 0 ? _a : 'all'); });
42
40
  const menuItems = finalLinks.filter((item) => { var _a; return ['menu', 'all'].includes((_a = item.on) !== null && _a !== void 0 ? _a : 'all'); });
43
41
  const mobilePinnedItems = navItems.filter((item) => isSecondary(item) && isMobilePinned(item));
@@ -53,19 +51,19 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
53
51
  ? desktopSecondaryItems.filter((item) => !isGithubItem(item, githubUrl))
54
52
  : desktopSecondaryItems;
55
53
  const desktopActionNodes = {
56
- search: searchToggle$1.enabled !== false
57
- ? (_b = (_a = searchToggle$1.components) === null || _a === void 0 ? void 0 : _a.lg) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(searchToggle.LargeSearchToggle, { className: "w-full rounded-full ps-2.5 max-w-[240px]", hideIfDisabled: true }))
54
+ search: searchToggle.enabled !== false
55
+ ? (_b = (_a = searchToggle.components) === null || _a === void 0 ? void 0 : _a.lg) !== null && _b !== void 0 ? _b : null
58
56
  : null,
59
57
  theme: themeSwitch.enabled !== false
60
- ? (_c = themeSwitch.component) !== null && _c !== void 0 ? _c : jsxRuntime.jsx(themeToggle.ThemeToggle, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
58
+ ? (_c = themeSwitch.component) !== null && _c !== void 0 ? _c : jsxRuntime.jsx(headerThemeSwitch.HeaderThemeSwitch, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
61
59
  : null,
62
60
  i18n: i18n ? (jsxRuntime.jsx(CompactLanguageToggle, { children: jsxRuntime.jsx(icons.LanguagesIcon, { className: "size-5" }) })) : null,
63
- secondary: desktopSecondaryDisplayItems.length ? (jsxRuntime.jsx("ul", { className: "flex flex-row gap-2 items-center empty:hidden", children: desktopSecondaryDisplayItems.map((item, i) => (jsxRuntime.jsx(NavbarLinkItem, { item: item, className: cn.cn(item.type === 'icon' && [
61
+ secondary: desktopSecondaryDisplayItems.length ? (jsxRuntime.jsx("ul", { className: "flex flex-row gap-2 items-center empty:hidden", children: desktopSecondaryDisplayItems.map((item, i) => (jsxRuntime.jsx(NavbarLinkItem, { item: item, className: utils.cn(item.type === 'icon' && [
64
62
  '-mx-1',
65
63
  i === 0 && 'ms-0',
66
64
  i === desktopSecondaryDisplayItems.length - 1 && 'me-0',
67
65
  ]) }, i))) })) : null,
68
- github: githubDesktopItem ? (jsxRuntime.jsx(NavbarLinkItem, { item: githubDesktopItem, className: cn.cn(githubDesktopItem.type === 'icon' && '-mx-1') })) : null,
66
+ github: githubDesktopItem ? (jsxRuntime.jsx(NavbarLinkItem, { item: githubDesktopItem, className: utils.cn(githubDesktopItem.type === 'icon' && '-mx-1') })) : null,
69
67
  };
70
68
  const mobileMenuActionsIncludeGithub = mobileMenuActionsOrder.includes('github');
71
69
  const githubMobileMenuItem = mobileMenuActionsIncludeGithub
@@ -78,9 +76,9 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
78
76
  secondary: secondaryMenuDisplayItems.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: secondaryMenuDisplayItems.map((item, i) => (jsxRuntime.jsx(MenuLinkItem, { item: item, className: "-me-1.5" }, i))) })) : null,
79
77
  github: githubMobileMenuItem ? (jsxRuntime.jsx(MenuLinkItem, { item: githubMobileMenuItem, className: "-me-1.5" })) : null,
80
78
  separator: jsxRuntime.jsx("div", { role: "separator", className: "flex-1" }),
81
- i18n: i18n ? (jsxRuntime.jsxs(CompactLanguageToggle, { children: [jsxRuntime.jsx(icons.LanguagesIcon, { className: "size-5" }), jsxRuntime.jsx(languageToggle.LanguageToggleText, {}), jsxRuntime.jsx(icons.ChevronDownIcon, { className: "size-3 text-fd-muted-foreground" })] })) : null,
79
+ i18n: i18n ? (jsxRuntime.jsxs(CompactLanguageToggle, { children: [jsxRuntime.jsx(icons.LanguagesIcon, { className: "size-5" }), jsxRuntime.jsx(languageSelect.LanguageSelectText, {}), jsxRuntime.jsx(icons.ChevronDownIcon, { className: "size-3 text-fd-muted-foreground" })] })) : null,
82
80
  theme: themeSwitch.enabled !== false
83
- ? (_d = themeSwitch.component) !== null && _d !== void 0 ? _d : jsxRuntime.jsx(themeToggle.ThemeToggle, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
81
+ ? (_d = themeSwitch.component) !== null && _d !== void 0 ? _d : jsxRuntime.jsx(headerThemeSwitch.HeaderThemeSwitch, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
84
82
  : null,
85
83
  };
86
84
  const shouldRenderMobileUtilities = mobileMenuActionsOrder.some((action) => action !== 'separator' && Boolean(mobileMenuActionNodes[action]));
@@ -89,7 +87,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
89
87
  return null;
90
88
  return mobileMenuActionNodes[action];
91
89
  };
92
- const menuNode = (jsxRuntime.jsxs(Menu, { children: [jsxRuntime.jsx(MenuTrigger, { "aria-label": "Toggle Menu", className: cn.cn(button.buttonVariants({
90
+ const menuNode = (jsxRuntime.jsxs(Menu, { children: [jsxRuntime.jsx(MenuTrigger, { "aria-label": "Toggle Menu", className: utils.cn(button.buttonVariants({
93
91
  size: 'icon',
94
92
  color: 'ghost',
95
93
  className: 'group [&_svg]:size-5.5',
@@ -100,8 +98,8 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
100
98
  return (jsxRuntime.jsx(React.Fragment, { children: node }, `mobile-menu-${action}`));
101
99
  }) })) : null] })] }));
102
100
  const mobilePinnedNode = mobilePinnedItems.length > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: mobilePinnedItems.map((item, i) => (jsxRuntime.jsx(NavbarLinkItem, { item: item, className: "max-sm:-mr-1" }, `mobile-pinned-${i}`))) })) : null;
103
- const mobileSearchNode = searchToggle$1.enabled !== false
104
- ? (_f = (_e = searchToggle$1.components) === null || _e === void 0 ? void 0 : _e.sm) !== null && _f !== void 0 ? _f : (jsxRuntime.jsx(searchToggle.SearchToggle, { className: "p-2", hideIfDisabled: true }))
101
+ const mobileSearchNode = searchToggle.enabled !== false
102
+ ? (_f = (_e = searchToggle.components) === null || _e === void 0 ? void 0 : _e.sm) !== null && _f !== void 0 ? _f : null
105
103
  : null;
106
104
  const mobileBarNodes = {
107
105
  pinned: mobilePinnedNode,
@@ -109,7 +107,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
109
107
  menu: menuNode,
110
108
  };
111
109
  const getMobileBarNode = (action) => { var _a; return (_a = mobileBarNodes[action]) !== null && _a !== void 0 ? _a : null; };
112
- return (jsxRuntime.jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsxRuntime.jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: nav.title }), nav.children, jsxRuntime.jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
110
+ return (jsxRuntime.jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsxRuntime.jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsxRuntime.jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
113
111
  .filter((item) => !isSecondary(item))
114
112
  .map((item, i) => (jsxRuntime.jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), jsxRuntime.jsx("div", { className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden", children: desktopActionsOrder.map((action) => {
115
113
  const node = desktopActionNodes[action];
@@ -124,8 +122,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
124
122
  function CustomNavbar(_a) {
125
123
  var { bannerHeight = 0, headerHeight = 2.5, maxContentWidth = 1400, className, style, floating = false } = _a, props = tslib.__rest(_a, ["bannerHeight", "headerHeight", "maxContentWidth", "className", "style", "floating"]);
126
124
  const [value, setValue] = React.useState('');
127
- const { isTransparent } = layout.useNav();
128
- const cssVars = Object.assign({ '--fd-banner-height': `${bannerHeight}rem`, '--fd-nav-height': `${headerHeight}rem` }, (maxContentWidth
125
+ const cssVars = Object.assign({ '--fd-banner-height': `${bannerHeight}rem`, '--fd-header-height': `${headerHeight}rem` }, (maxContentWidth
129
126
  ? {
130
127
  '--fd-nav-max-width': typeof maxContentWidth === 'number'
131
128
  ? `${maxContentWidth}px`
@@ -138,17 +135,14 @@ function CustomNavbar(_a) {
138
135
  : maxContentWidth
139
136
  : '88rem';
140
137
  const minNavWidth = '15rem';
141
- const floatingWidth = `clamp(${minNavWidth}, 100vw, ${resolvedMaxWidth})`;
142
138
  const widthStyle = floating
143
- ? { width: floatingWidth }
139
+ ? { width: `clamp(${minNavWidth}, 100vw, ${resolvedMaxWidth})` }
144
140
  : { width: '100%', maxWidth: resolvedMaxWidth, minWidth: minNavWidth };
145
141
  const headerStyle = Object.assign(Object.assign(Object.assign({}, cssVars), widthStyle), style);
146
- return (jsxRuntime.jsx(navigationMenu.NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: jsxRuntime.jsxs("header", Object.assign({}, props, { style: headerStyle, className: cn.cn('rounded-2xl border px-4 py-1 transition-[background-color,box-shadow,transform] duration-300 backdrop-blur-xl shadow-lg shadow-black/5', floating
142
+ return (jsxRuntime.jsx(navigationMenu.NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: jsxRuntime.jsxs("header", Object.assign({}, props, { style: headerStyle, className: utils.cn('rounded-2xl border px-4 py-1 transition-[background-color,box-shadow,transform] duration-300 backdrop-blur-xl shadow-lg shadow-black/5', floating
147
143
  ? 'fixed left-1/2 top-[--fd-banner-height] z-1001 -translate-x-1/2'
148
- : 'relative mx-auto w-full', isTransparent
149
- ? 'border-transparent bg-transparent shadow-transparent'
150
- : 'border border-fd-border/60 bg-white/85 dark:border-white/20 dark:bg-neutral-900/75', value.length > 0 &&
151
- 'max-lg:rounded-b-3xl border-fd-border/60 bg-white dark:border-white/20 dark:bg-neutral-900', className), children: [jsxRuntime.jsx(navigationMenu.NavigationMenuList, { className: "flex w-full items-center gap-4 px-1", style: { height: 'var(--fd-nav-height)' }, asChild: true, children: jsxRuntime.jsx("nav", { children: props.children }) }), jsxRuntime.jsx(navigationMenu.NavigationMenuViewport, {})] })) }));
144
+ : 'relative mx-auto w-full', 'border border-fd-border/60 bg-white/85 dark:border-white/20 dark:bg-neutral-900/75', value.length > 0 &&
145
+ 'max-lg:rounded-b-3xl border-fd-border/60 bg-white dark:border-white/20 dark:bg-neutral-900', className), children: [jsxRuntime.jsx(navigationMenu.NavigationMenuList, { className: "flex w-full items-center gap-4 px-1", style: { height: 'var(--fd-header-height)' }, asChild: true, children: jsxRuntime.jsx("nav", { children: props.children }) }), jsxRuntime.jsx(navigationMenu.NavigationMenuViewport, {})] })) }));
152
146
  }
153
147
  const navItemVariants = classVarianceAuthority.cva('[&_svg]:size-4', {
154
148
  variants: {
@@ -179,23 +173,23 @@ function NavbarLinkItem(_a) {
179
173
  return jsxRuntime.jsx(React.Fragment, { children: child.children }, j);
180
174
  }
181
175
  const _c = (_a = child.menu) !== null && _a !== void 0 ? _a : {}, { banner = child.icon ? (jsxRuntime.jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null } = _c, rest = tslib.__rest(_c, ["banner"]);
182
- return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, Object.assign({ href: child.url, external: child.external }, rest, { className: cn.cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', rest.className), children: (_b = rest.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [banner, jsxRuntime.jsx("p", { className: "text-[15px] font-medium", children: child.text }), jsxRuntime.jsx("p", { className: "text-sm text-fd-muted-foreground empty:hidden", children: child.description })] })) })) }, `${j}-${child.url}`));
176
+ return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, Object.assign({ href: child.url, external: child.external }, rest, { className: utils.cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', rest.className), children: (_b = rest.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [banner, jsxRuntime.jsx("p", { className: "text-[15px] font-medium", children: child.text }), jsxRuntime.jsx("p", { className: "text-sm text-fd-muted-foreground empty:hidden", children: child.description })] })) })) }, `${j}-${child.url}`));
183
177
  });
184
- return (jsxRuntime.jsxs(navigationMenu.NavigationMenuItem, { children: [jsxRuntime.jsx(navigationMenu.NavigationMenuTrigger, Object.assign({}, props, { className: cn.cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: item.text })) : (item.text) })), jsxRuntime.jsx(navigationMenu.NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
178
+ return (jsxRuntime.jsxs(navigationMenu.NavigationMenuItem, { children: [jsxRuntime.jsx(navigationMenu.NavigationMenuTrigger, Object.assign({}, props, { className: utils.cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: item.text })) : (item.text) })), jsxRuntime.jsx(navigationMenu.NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
185
179
  }
186
- return (jsxRuntime.jsx(navigationMenu.NavigationMenuItem, { children: jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(shared.BaseLinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: cn.cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
180
+ return (jsxRuntime.jsx(navigationMenu.NavigationMenuItem, { children: jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(shared.LinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: utils.cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
187
181
  }
188
182
  const Menu = navigationMenu.NavigationMenuItem;
189
183
  function MenuLinkItem(_a) {
190
184
  var _b;
191
185
  var { item } = _a, props = tslib.__rest(_a, ["item"]);
192
186
  if (item.type === 'custom')
193
- return jsxRuntime.jsx("div", { className: cn.cn('grid', props.className), children: item.children });
187
+ return jsxRuntime.jsx("div", { className: utils.cn('grid', props.className), children: item.children });
194
188
  if (item.type === 'menu') {
195
189
  const header = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon, item.text] }));
196
- return (jsxRuntime.jsxs("div", { className: cn.cn('mb-4 flex flex-col', props.className), children: [jsxRuntime.jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsxRuntime.jsx(MenuLinkItem, { item: child }, i)))] }));
190
+ return (jsxRuntime.jsxs("div", { className: utils.cn('mb-4 flex flex-col', props.className), children: [jsxRuntime.jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsxRuntime.jsx(MenuLinkItem, { item: child }, i)))] }));
197
191
  }
198
- return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsxs(shared.BaseLinkItem, { item: item, className: cn.cn({
192
+ return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsxs(shared.LinkItem, { item: item, className: utils.cn({
199
193
  main: 'inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4',
200
194
  icon: button.buttonVariants({
201
195
  size: 'icon',
@@ -212,17 +206,17 @@ function MenuTrigger(_a) {
212
206
  return (jsxRuntime.jsx(navigationMenu.NavigationMenuTrigger, Object.assign({}, props, { onPointerMove: enableHover ? undefined : (e) => e.preventDefault(), children: props.children })));
213
207
  }
214
208
  function MenuContent(props) {
215
- return (jsxRuntime.jsx(navigationMenu.NavigationMenuContent, Object.assign({}, props, { className: cn.cn('flex flex-col p-4 w-full max-w-full min-w-0', props.className), style: Object.assign({ minWidth: 0, width: '100%', maxWidth: '100%' }, props.style), children: props.children })));
209
+ return (jsxRuntime.jsx(navigationMenu.NavigationMenuContent, Object.assign({}, props, { className: utils.cn('flex flex-col p-4 w-full max-w-full min-w-0', props.className), style: Object.assign({ minWidth: 0, width: '100%', maxWidth: '100%' }, props.style), children: props.children })));
216
210
  }
217
211
  function CompactLanguageToggle(_a) {
218
212
  var { contentClassName } = _a, props = tslib.__rest(_a, ["contentClassName"]);
219
213
  const context = i18n.useI18n();
220
214
  if (!context.locales)
221
215
  throw new Error('Missing `<I18nProvider />`');
222
- return (jsxRuntime.jsxs(popover.Popover, { children: [jsxRuntime.jsx(popover.PopoverTrigger, Object.assign({ "aria-label": context.text.chooseLanguage }, props, { className: cn.cn(button.buttonVariants({
216
+ return (jsxRuntime.jsxs(popover.Popover, { children: [jsxRuntime.jsx(popover.PopoverTrigger, Object.assign({ "aria-label": context.text.chooseLanguage }, props, { className: utils.cn(button.buttonVariants({
223
217
  color: 'ghost',
224
218
  className: 'gap-1.5 py-1.5 px-1',
225
- }), props.className), children: props.children })), jsxRuntime.jsxs(popover.PopoverContent, { className: cn.cn('flex min-w-[150px] z-1001 flex-col overflow-x-hidden rounded-xl border bg-fd-popover/60 p-0 text-fd-popover-foreground backdrop-blur-lg', contentClassName), children: [jsxRuntime.jsx("p", { className: "mb-1 p-2 text-xs font-medium text-fd-muted-foreground", children: context.text.chooseLanguage }), context.locales.map((item) => (jsxRuntime.jsx("button", { type: "button", className: cn.cn('p-2 text-start text-sm', item.locale === context.locale
219
+ }), props.className), children: props.children })), jsxRuntime.jsxs(popover.PopoverContent, { className: utils.cn('flex min-w-[150px] z-1001 flex-col overflow-x-hidden rounded-xl border bg-fd-popover/60 p-0 text-fd-popover-foreground backdrop-blur-lg', contentClassName), children: [jsxRuntime.jsx("p", { className: "mb-1 p-2 text-xs font-medium text-fd-muted-foreground", children: context.text.chooseLanguage }), context.locales.map((item) => (jsxRuntime.jsx("button", { type: "button", className: utils.cn('p-2 text-start text-sm', item.locale === context.locale
226
220
  ? 'bg-fd-primary/10 font-medium text-fd-primary'
227
221
  : 'hover:bg-fd-accent hover:text-fd-accent-foreground'), onClick: () => {
228
222
  var _a;
@@ -240,5 +234,13 @@ function isSecondary(item) {
240
234
  function isMobilePinned(item) {
241
235
  return Boolean(item.mobilePinned);
242
236
  }
237
+ function renderNavTitle(title) {
238
+ var _a;
239
+ if (typeof title === 'function') {
240
+ const TitleComponent = title;
241
+ return jsxRuntime.jsx(TitleComponent, {});
242
+ }
243
+ return (_a = title) !== null && _a !== void 0 ? _a : null;
244
+ }
243
245
 
244
246
  exports.CustomHomeHeader = CustomHomeHeader;
@@ -4,17 +4,15 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useMemo, Fragment as Fragment$1, useState } from 'react';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { LanguagesIcon, ChevronDownIcon } from '@windrun-huaiin/base-ui/icons';
7
+ import { cn } from '@windrun-huaiin/lib/utils';
7
8
  import Link from 'fumadocs-core/link';
8
- import { getLinks, BaseLinkItem } from 'fumadocs-ui/layouts/shared';
9
- import { cn } from 'fumadocs-ui/utils/cn';
10
- import { LargeSearchToggle, SearchToggle } from 'fumadocs-ui/components/layout/search-toggle';
11
- import { ThemeToggle } from 'fumadocs-ui/components/layout/theme-toggle';
12
- import { LanguageToggleText } from 'fumadocs-ui/components/layout/language-toggle';
9
+ import { resolveLinkItems, LinkItem } from 'fumadocs-ui/layouts/shared';
10
+ import { LanguageSelectText } from 'fumadocs-ui/layouts/shared/slots/language-select';
13
11
  import { NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, NavigationMenuContent, NavigationMenu, NavigationMenuList, NavigationMenuViewport } from 'fumadocs-ui/components/ui/navigation-menu';
14
12
  import { Popover, PopoverTrigger, PopoverContent } from 'fumadocs-ui/components/ui/popover';
15
13
  import { buttonVariants } from 'fumadocs-ui/components/ui/button';
16
- import { useNav } from 'fumadocs-ui/contexts/layout';
17
14
  import { useI18n } from 'fumadocs-ui/contexts/i18n';
15
+ import { HeaderThemeSwitch } from './header-theme-switch.mjs';
18
16
 
19
17
  const DEFAULT_DESKTOP_ACTIONS = [
20
18
  'search',
@@ -35,7 +33,7 @@ const DEFAULT_MOBILE_MENU_ACTIONS = [
35
33
  ];
36
34
  function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitch = {}, searchToggle = {}, bannerHeight = 0, headerHeight = 2.5, maxContentWidth = 1400, navbarClassName, floating = false, desktopActionsOrder = DEFAULT_DESKTOP_ACTIONS, mobileBarActionsOrder = DEFAULT_MOBILE_BAR_ACTIONS, mobileMenuActionsOrder = DEFAULT_MOBILE_MENU_ACTIONS, }) {
37
35
  var _a, _b, _c, _d, _e, _f, _g;
38
- const finalLinks = useMemo(() => getLinks(links, githubUrl), [links, githubUrl]);
36
+ const finalLinks = useMemo(() => resolveLinkItems({ links, githubUrl }), [links, githubUrl]);
39
37
  const navItems = finalLinks.filter((item) => { var _a; return ['nav', 'all'].includes((_a = item.on) !== null && _a !== void 0 ? _a : 'all'); });
40
38
  const menuItems = finalLinks.filter((item) => { var _a; return ['menu', 'all'].includes((_a = item.on) !== null && _a !== void 0 ? _a : 'all'); });
41
39
  const mobilePinnedItems = navItems.filter((item) => isSecondary(item) && isMobilePinned(item));
@@ -52,10 +50,10 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
52
50
  : desktopSecondaryItems;
53
51
  const desktopActionNodes = {
54
52
  search: searchToggle.enabled !== false
55
- ? (_b = (_a = searchToggle.components) === null || _a === void 0 ? void 0 : _a.lg) !== null && _b !== void 0 ? _b : (jsx(LargeSearchToggle, { className: "w-full rounded-full ps-2.5 max-w-[240px]", hideIfDisabled: true }))
53
+ ? (_b = (_a = searchToggle.components) === null || _a === void 0 ? void 0 : _a.lg) !== null && _b !== void 0 ? _b : null
56
54
  : null,
57
55
  theme: themeSwitch.enabled !== false
58
- ? (_c = themeSwitch.component) !== null && _c !== void 0 ? _c : jsx(ThemeToggle, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
56
+ ? (_c = themeSwitch.component) !== null && _c !== void 0 ? _c : jsx(HeaderThemeSwitch, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
59
57
  : null,
60
58
  i18n: i18n ? (jsx(CompactLanguageToggle, { children: jsx(LanguagesIcon, { className: "size-5" }) })) : null,
61
59
  secondary: desktopSecondaryDisplayItems.length ? (jsx("ul", { className: "flex flex-row gap-2 items-center empty:hidden", children: desktopSecondaryDisplayItems.map((item, i) => (jsx(NavbarLinkItem, { item: item, className: cn(item.type === 'icon' && [
@@ -76,9 +74,9 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
76
74
  secondary: secondaryMenuDisplayItems.length ? (jsx(Fragment, { children: secondaryMenuDisplayItems.map((item, i) => (jsx(MenuLinkItem, { item: item, className: "-me-1.5" }, i))) })) : null,
77
75
  github: githubMobileMenuItem ? (jsx(MenuLinkItem, { item: githubMobileMenuItem, className: "-me-1.5" })) : null,
78
76
  separator: jsx("div", { role: "separator", className: "flex-1" }),
79
- i18n: i18n ? (jsxs(CompactLanguageToggle, { children: [jsx(LanguagesIcon, { className: "size-5" }), jsx(LanguageToggleText, {}), jsx(ChevronDownIcon, { className: "size-3 text-fd-muted-foreground" })] })) : null,
77
+ i18n: i18n ? (jsxs(CompactLanguageToggle, { children: [jsx(LanguagesIcon, { className: "size-5" }), jsx(LanguageSelectText, {}), jsx(ChevronDownIcon, { className: "size-3 text-fd-muted-foreground" })] })) : null,
80
78
  theme: themeSwitch.enabled !== false
81
- ? (_d = themeSwitch.component) !== null && _d !== void 0 ? _d : jsx(ThemeToggle, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
79
+ ? (_d = themeSwitch.component) !== null && _d !== void 0 ? _d : jsx(HeaderThemeSwitch, { mode: themeSwitch === null || themeSwitch === void 0 ? void 0 : themeSwitch.mode })
82
80
  : null,
83
81
  };
84
82
  const shouldRenderMobileUtilities = mobileMenuActionsOrder.some((action) => action !== 'separator' && Boolean(mobileMenuActionNodes[action]));
@@ -99,7 +97,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
99
97
  }) })) : null] })] }));
100
98
  const mobilePinnedNode = mobilePinnedItems.length > 0 ? (jsx(Fragment, { children: mobilePinnedItems.map((item, i) => (jsx(NavbarLinkItem, { item: item, className: "max-sm:-mr-1" }, `mobile-pinned-${i}`))) })) : null;
101
99
  const mobileSearchNode = searchToggle.enabled !== false
102
- ? (_f = (_e = searchToggle.components) === null || _e === void 0 ? void 0 : _e.sm) !== null && _f !== void 0 ? _f : (jsx(SearchToggle, { className: "p-2", hideIfDisabled: true }))
100
+ ? (_f = (_e = searchToggle.components) === null || _e === void 0 ? void 0 : _e.sm) !== null && _f !== void 0 ? _f : null
103
101
  : null;
104
102
  const mobileBarNodes = {
105
103
  pinned: mobilePinnedNode,
@@ -107,7 +105,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
107
105
  menu: menuNode,
108
106
  };
109
107
  const getMobileBarNode = (action) => { var _a; return (_a = mobileBarNodes[action]) !== null && _a !== void 0 ? _a : null; };
110
- return (jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: nav.title }), nav.children, jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
108
+ return (jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
111
109
  .filter((item) => !isSecondary(item))
112
110
  .map((item, i) => (jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), jsx("div", { className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden", children: desktopActionsOrder.map((action) => {
113
111
  const node = desktopActionNodes[action];
@@ -122,8 +120,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
122
120
  function CustomNavbar(_a) {
123
121
  var { bannerHeight = 0, headerHeight = 2.5, maxContentWidth = 1400, className, style, floating = false } = _a, props = __rest(_a, ["bannerHeight", "headerHeight", "maxContentWidth", "className", "style", "floating"]);
124
122
  const [value, setValue] = useState('');
125
- const { isTransparent } = useNav();
126
- const cssVars = Object.assign({ '--fd-banner-height': `${bannerHeight}rem`, '--fd-nav-height': `${headerHeight}rem` }, (maxContentWidth
123
+ const cssVars = Object.assign({ '--fd-banner-height': `${bannerHeight}rem`, '--fd-header-height': `${headerHeight}rem` }, (maxContentWidth
127
124
  ? {
128
125
  '--fd-nav-max-width': typeof maxContentWidth === 'number'
129
126
  ? `${maxContentWidth}px`
@@ -136,17 +133,14 @@ function CustomNavbar(_a) {
136
133
  : maxContentWidth
137
134
  : '88rem';
138
135
  const minNavWidth = '15rem';
139
- const floatingWidth = `clamp(${minNavWidth}, 100vw, ${resolvedMaxWidth})`;
140
136
  const widthStyle = floating
141
- ? { width: floatingWidth }
137
+ ? { width: `clamp(${minNavWidth}, 100vw, ${resolvedMaxWidth})` }
142
138
  : { width: '100%', maxWidth: resolvedMaxWidth, minWidth: minNavWidth };
143
139
  const headerStyle = Object.assign(Object.assign(Object.assign({}, cssVars), widthStyle), style);
144
140
  return (jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: jsxs("header", Object.assign({}, props, { style: headerStyle, className: cn('rounded-2xl border px-4 py-1 transition-[background-color,box-shadow,transform] duration-300 backdrop-blur-xl shadow-lg shadow-black/5', floating
145
141
  ? 'fixed left-1/2 top-[--fd-banner-height] z-1001 -translate-x-1/2'
146
- : 'relative mx-auto w-full', isTransparent
147
- ? 'border-transparent bg-transparent shadow-transparent'
148
- : 'border border-fd-border/60 bg-white/85 dark:border-white/20 dark:bg-neutral-900/75', value.length > 0 &&
149
- 'max-lg:rounded-b-3xl border-fd-border/60 bg-white dark:border-white/20 dark:bg-neutral-900', className), children: [jsx(NavigationMenuList, { className: "flex w-full items-center gap-4 px-1", style: { height: 'var(--fd-nav-height)' }, asChild: true, children: jsx("nav", { children: props.children }) }), jsx(NavigationMenuViewport, {})] })) }));
142
+ : 'relative mx-auto w-full', 'border border-fd-border/60 bg-white/85 dark:border-white/20 dark:bg-neutral-900/75', value.length > 0 &&
143
+ 'max-lg:rounded-b-3xl border-fd-border/60 bg-white dark:border-white/20 dark:bg-neutral-900', className), children: [jsx(NavigationMenuList, { className: "flex w-full items-center gap-4 px-1", style: { height: 'var(--fd-header-height)' }, asChild: true, children: jsx("nav", { children: props.children }) }), jsx(NavigationMenuViewport, {})] })) }));
150
144
  }
151
145
  const navItemVariants = cva('[&_svg]:size-4', {
152
146
  variants: {
@@ -181,7 +175,7 @@ function NavbarLinkItem(_a) {
181
175
  });
182
176
  return (jsxs(NavigationMenuItem, { children: [jsx(NavigationMenuTrigger, Object.assign({}, props, { className: cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsx(Link, { href: item.url, external: item.external, children: item.text })) : (item.text) })), jsx(NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
183
177
  }
184
- return (jsx(NavigationMenuItem, { children: jsx(NavigationMenuLink, { asChild: true, children: jsx(BaseLinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
178
+ return (jsx(NavigationMenuItem, { children: jsx(NavigationMenuLink, { asChild: true, children: jsx(LinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
185
179
  }
186
180
  const Menu = NavigationMenuItem;
187
181
  function MenuLinkItem(_a) {
@@ -193,7 +187,7 @@ function MenuLinkItem(_a) {
193
187
  const header = (jsxs(Fragment, { children: [item.icon, item.text] }));
194
188
  return (jsxs("div", { className: cn('mb-4 flex flex-col', props.className), children: [jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsx(NavigationMenuLink, { asChild: true, children: jsx(Link, { href: item.url, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsx(MenuLinkItem, { item: child }, i)))] }));
195
189
  }
196
- return (jsx(NavigationMenuLink, { asChild: true, children: jsxs(BaseLinkItem, { item: item, className: cn({
190
+ return (jsx(NavigationMenuLink, { asChild: true, children: jsxs(LinkItem, { item: item, className: cn({
197
191
  main: 'inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4',
198
192
  icon: buttonVariants({
199
193
  size: 'icon',
@@ -238,5 +232,13 @@ function isSecondary(item) {
238
232
  function isMobilePinned(item) {
239
233
  return Boolean(item.mobilePinned);
240
234
  }
235
+ function renderNavTitle(title) {
236
+ var _a;
237
+ if (typeof title === 'function') {
238
+ const TitleComponent = title;
239
+ return jsx(TitleComponent, {});
240
+ }
241
+ return (_a = title) !== null && _a !== void 0 ? _a : null;
242
+ }
241
243
 
242
244
  export { CustomHomeHeader };
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
2
  import { type HomeLayoutProps } from 'fumadocs-ui/layouts/home';
3
- import { type LinkItemType } from 'fumadocs-ui/layouts/docs';
3
+ import { type LinkItemType } from 'fumadocs-ui/layouts/shared';
4
4
  import { type DesktopAction, type MobileBarAction, type MobileMenuAction } from './custom-header';
5
5
  export type ExtendedLinkItem = LinkItemType & {
6
6
  mobilePinned?: boolean;
@@ -11,7 +11,7 @@ var customHeader = require('./custom-header.js');
11
11
  function CustomHomeLayout({ locale, options, children, showBanner = false, bannerHeight, headerHeight = 2.5, headerPaddingTop, navbarClassName, banner, footer: footer$1, goToTop: goToTop$1, showFooter = true, showGoToTop = true, style, floatingNav = false, actionOrders, localePrefixAsNeeded = true, defaultLocale = 'en', }) {
12
12
  const resolvedBannerHeight = bannerHeight !== null && bannerHeight !== void 0 ? bannerHeight : (showBanner ? 3 : 0.5);
13
13
  const resolvedPaddingTop = headerPaddingTop !== null && headerPaddingTop !== void 0 ? headerPaddingTop : (showBanner ? 0 : 0.5);
14
- const layoutStyle = Object.assign({ '--fd-banner-height': `${resolvedBannerHeight}rem`, '--fd-nav-height': `${headerHeight}rem`, paddingTop: floatingNav
14
+ const layoutStyle = Object.assign({ '--fd-banner-height': `${resolvedBannerHeight}rem`, '--fd-header-height': `${headerHeight}rem`, paddingTop: floatingNav
15
15
  ? `calc(var(--fd-banner-height) + ${resolvedPaddingTop}rem)`
16
16
  : `${resolvedPaddingTop}rem` }, style);
17
17
  const { nav } = options, homeLayoutProps = tslib.__rest(options, ["nav"]);
@@ -9,7 +9,7 @@ import { CustomHomeHeader } from './custom-header.mjs';
9
9
  function CustomHomeLayout({ locale, options, children, showBanner = false, bannerHeight, headerHeight = 2.5, headerPaddingTop, navbarClassName, banner, footer, goToTop, showFooter = true, showGoToTop = true, style, floatingNav = false, actionOrders, localePrefixAsNeeded = true, defaultLocale = 'en', }) {
10
10
  const resolvedBannerHeight = bannerHeight !== null && bannerHeight !== void 0 ? bannerHeight : (showBanner ? 3 : 0.5);
11
11
  const resolvedPaddingTop = headerPaddingTop !== null && headerPaddingTop !== void 0 ? headerPaddingTop : (showBanner ? 0 : 0.5);
12
- const layoutStyle = Object.assign({ '--fd-banner-height': `${resolvedBannerHeight}rem`, '--fd-nav-height': `${headerHeight}rem`, paddingTop: floatingNav
12
+ const layoutStyle = Object.assign({ '--fd-banner-height': `${resolvedBannerHeight}rem`, '--fd-header-height': `${headerHeight}rem`, paddingTop: floatingNav
13
13
  ? `calc(var(--fd-banner-height) + ${resolvedPaddingTop}rem)`
14
14
  : `${resolvedPaddingTop}rem` }, style);
15
15
  const { nav } = options, homeLayoutProps = __rest(options, ["nav"]);
@@ -0,0 +1,5 @@
1
+ import { type ComponentProps } from 'react';
2
+ export interface HeaderThemeSwitchProps extends ComponentProps<'div'> {
3
+ mode?: 'light-dark' | 'light-dark-system';
4
+ }
5
+ export declare function HeaderThemeSwitch({ className, mode, ...props }: HeaderThemeSwitchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var tslib = require('tslib');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var icons = require('@windrun-huaiin/base-ui/icons');
8
+ var nextThemes = require('next-themes');
9
+ var React = require('react');
10
+ var utils = require('@windrun-huaiin/lib/utils');
11
+
12
+ const itemVariants = classVarianceAuthority.cva('inline-flex size-6.5 items-center justify-center rounded-full p-1.5', {
13
+ variants: {
14
+ active: {
15
+ true: 'bg-fd-accent',
16
+ false: '',
17
+ },
18
+ },
19
+ });
20
+ const full = [['light', icons.SunIcon], ['dark', icons.MoonIcon], ['system', icons.AirplayIcon]];
21
+ function HeaderThemeSwitch(_a) {
22
+ var { className, mode = 'light-dark' } = _a, props = tslib.__rest(_a, ["className", "mode"]);
23
+ const { setTheme, theme, resolvedTheme } = nextThemes.useTheme();
24
+ const [mounted, setMounted] = React.useState(false);
25
+ React.useEffect(() => {
26
+ setMounted(true);
27
+ }, []);
28
+ const container = utils.cn('inline-flex items-center rounded-full border p-1 overflow-hidden *:rounded-full', className);
29
+ const iconClassName = 'size-3.5 text-neutral-600 dark:text-neutral-300';
30
+ if (mode === 'light-dark') {
31
+ const value = mounted ? resolvedTheme : null;
32
+ return (jsxRuntime.jsx("button", { type: "button", className: container, "aria-label": "Toggle Theme", onClick: () => setTheme(value === 'light' ? 'dark' : 'light'), "data-theme-toggle": "", children: full.map(([key, Icon]) => {
33
+ if (key === 'system')
34
+ return null;
35
+ return (jsxRuntime.jsx(Icon, { fill: "currentColor", className: utils.cn(itemVariants({ active: value === key }), iconClassName) }, key));
36
+ }) }));
37
+ }
38
+ const value = mounted ? theme : null;
39
+ return (jsxRuntime.jsx("div", Object.assign({ className: container, "data-theme-toggle": "" }, props, { children: full.map(([key, Icon]) => (jsxRuntime.jsx("button", { type: "button", "aria-label": key, className: utils.cn(itemVariants({ active: value === key })), onClick: () => setTheme(key), children: jsxRuntime.jsx(Icon, { className: iconClassName, fill: "currentColor" }) }, key))) })));
40
+ }
41
+
42
+ exports.HeaderThemeSwitch = HeaderThemeSwitch;