fumadocs-ui 14.2.1 → 14.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/components/accordion.d.ts +4 -7
  2. package/dist/components/accordion.d.ts.map +1 -0
  3. package/dist/components/accordion.js +32 -104
  4. package/dist/components/api.d.ts +4 -13
  5. package/dist/components/api.d.ts.map +1 -0
  6. package/dist/components/api.js +3 -16
  7. package/dist/components/banner.d.ts +3 -5
  8. package/dist/components/banner.d.ts.map +1 -0
  9. package/dist/components/banner.js +53 -120
  10. package/dist/components/callout.d.ts +4 -7
  11. package/dist/components/callout.d.ts.map +1 -0
  12. package/dist/components/callout.js +13 -9
  13. package/dist/components/card.d.ts +5 -7
  14. package/dist/components/card.d.ts.map +1 -0
  15. package/dist/components/card.js +10 -10
  16. package/dist/components/codeblock.d.ts +6 -9
  17. package/dist/components/codeblock.d.ts.map +1 -0
  18. package/dist/components/codeblock.js +41 -15
  19. package/dist/components/dialog/search-algolia.d.ts +7 -11
  20. package/dist/components/dialog/search-algolia.d.ts.map +1 -0
  21. package/dist/components/dialog/search-algolia.js +19 -79
  22. package/dist/components/dialog/search-default.d.ts +6 -10
  23. package/dist/components/dialog/search-default.d.ts.map +1 -0
  24. package/dist/components/dialog/search-default.js +24 -73
  25. package/dist/components/dialog/search-orama.d.ts +7 -11
  26. package/dist/components/dialog/search-orama.d.ts.map +1 -0
  27. package/dist/components/dialog/search-orama.js +22 -79
  28. package/dist/components/dialog/search.d.ts +7 -9
  29. package/dist/components/dialog/search.d.ts.map +1 -0
  30. package/dist/components/dialog/search.js +98 -13
  31. package/dist/components/dialog/tag-list.d.ts +13 -0
  32. package/dist/components/dialog/tag-list.d.ts.map +1 -0
  33. package/dist/components/dialog/tag-list.js +20 -0
  34. package/dist/components/files.d.ts +7 -9
  35. package/dist/components/files.d.ts.map +1 -0
  36. package/dist/components/files.js +15 -63
  37. package/dist/components/heading.d.ts +4 -5
  38. package/dist/components/heading.d.ts.map +1 -0
  39. package/dist/components/heading.js +9 -9
  40. package/dist/components/image-zoom.d.ts +7 -8
  41. package/dist/components/image-zoom.d.ts.map +1 -0
  42. package/dist/components/image-zoom.js +16 -40
  43. package/dist/components/inline-toc.d.ts +4 -6
  44. package/dist/components/inline-toc.d.ts.map +1 -0
  45. package/dist/components/inline-toc.js +8 -46
  46. package/dist/components/layout/breadcrumb.d.ts +11 -0
  47. package/dist/components/layout/breadcrumb.d.ts.map +1 -0
  48. package/dist/components/layout/breadcrumb.js +20 -0
  49. package/dist/components/layout/language-toggle.d.ts +5 -7
  50. package/dist/components/layout/language-toggle.d.ts.map +1 -0
  51. package/dist/components/layout/language-toggle.js +24 -14
  52. package/dist/components/layout/nav.d.ts +28 -0
  53. package/dist/components/layout/nav.d.ts.map +1 -0
  54. package/dist/components/layout/nav.js +29 -0
  55. package/dist/components/layout/root-toggle.d.ts +5 -7
  56. package/dist/components/layout/root-toggle.d.ts.map +1 -0
  57. package/dist/components/layout/root-toggle.js +28 -13
  58. package/dist/components/layout/search-toggle.d.ts +4 -0
  59. package/dist/components/layout/search-toggle.d.ts.map +1 -0
  60. package/dist/components/layout/search-toggle.js +24 -0
  61. package/dist/components/layout/theme-toggle.d.ts +3 -0
  62. package/dist/components/layout/theme-toggle.d.ts.map +1 -0
  63. package/dist/components/layout/theme-toggle.js +21 -0
  64. package/dist/components/layout/toc-clerk.d.ts +6 -0
  65. package/dist/components/layout/toc-clerk.d.ts.map +1 -0
  66. package/dist/components/layout/toc-clerk.js +76 -0
  67. package/dist/components/layout/toc-popover.d.ts +8 -0
  68. package/dist/components/layout/toc-popover.d.ts.map +1 -0
  69. package/dist/components/layout/toc-popover.js +20 -0
  70. package/dist/components/layout/toc-thumb.d.ts +6 -0
  71. package/dist/components/layout/toc-thumb.d.ts.map +1 -0
  72. package/dist/components/layout/toc-thumb.js +53 -0
  73. package/dist/components/layout/toc.d.ts +19 -0
  74. package/dist/components/layout/toc.d.ts.map +1 -0
  75. package/dist/components/layout/toc.js +25 -0
  76. package/dist/components/registry.d.ts +3 -0
  77. package/dist/components/registry.d.ts.map +1 -0
  78. package/dist/components/registry.js +70 -0
  79. package/dist/components/steps.d.ts +4 -6
  80. package/dist/components/steps.d.ts.map +1 -0
  81. package/dist/components/steps.js +5 -16
  82. package/dist/components/tabs.d.ts +7 -21
  83. package/dist/components/tabs.d.ts.map +1 -0
  84. package/dist/components/tabs.js +61 -171
  85. package/dist/components/type-table.d.ts +5 -6
  86. package/dist/components/type-table.d.ts.map +1 -0
  87. package/dist/components/type-table.js +18 -59
  88. package/dist/components/ui/button.d.ts +5 -0
  89. package/dist/components/ui/button.d.ts.map +1 -0
  90. package/dist/components/ui/button.js +14 -0
  91. package/dist/components/ui/collapsible.d.ts +6 -0
  92. package/dist/components/ui/collapsible.d.ts.map +1 -0
  93. package/dist/components/ui/collapsible.js +12 -0
  94. package/dist/components/ui/navigation-menu.d.ts +11 -0
  95. package/dist/components/ui/navigation-menu.d.ts.map +1 -0
  96. package/dist/components/ui/navigation-menu.js +15 -0
  97. package/dist/components/ui/popover.d.ts +8 -0
  98. package/dist/components/ui/popover.d.ts.map +1 -0
  99. package/dist/components/ui/popover.js +11 -0
  100. package/dist/components/ui/scroll-area.d.ts +7 -0
  101. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  102. package/dist/components/ui/scroll-area.js +11 -0
  103. package/dist/components/ui/tabs.d.ts +8 -0
  104. package/dist/components/ui/tabs.d.ts.map +1 -0
  105. package/dist/components/ui/tabs.js +16 -0
  106. package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
  107. package/dist/contexts/i18n.d.ts.map +1 -0
  108. package/dist/contexts/i18n.js +23 -0
  109. package/dist/contexts/search.d.ts +50 -0
  110. package/dist/contexts/search.d.ts.map +1 -0
  111. package/dist/contexts/search.js +50 -0
  112. package/dist/contexts/sidebar.d.ts +18 -0
  113. package/dist/contexts/sidebar.d.ts.map +1 -0
  114. package/dist/contexts/sidebar.js +31 -0
  115. package/dist/contexts/tree.d.ts +13 -0
  116. package/dist/contexts/tree.d.ts.map +1 -0
  117. package/dist/contexts/tree.js +25 -0
  118. package/dist/i18n.d.ts +5 -6
  119. package/dist/i18n.d.ts.map +1 -0
  120. package/dist/i18n.js +31 -49
  121. package/dist/layouts/docs/navbar.d.ts +4 -0
  122. package/dist/layouts/docs/navbar.d.ts.map +1 -0
  123. package/dist/layouts/docs/navbar.js +22 -0
  124. package/dist/layouts/docs/sidebar.d.ts +40 -0
  125. package/dist/layouts/docs/sidebar.d.ts.map +1 -0
  126. package/dist/layouts/docs/sidebar.js +146 -0
  127. package/dist/layouts/docs.client.d.ts +14 -25
  128. package/dist/layouts/docs.client.d.ts.map +1 -0
  129. package/dist/layouts/docs.client.js +53 -195
  130. package/dist/layouts/docs.d.ts +34 -19
  131. package/dist/layouts/docs.d.ts.map +1 -0
  132. package/dist/layouts/docs.js +67 -202
  133. package/dist/layouts/home/menu.d.ts +6 -0
  134. package/dist/layouts/home/menu.d.ts.map +1 -0
  135. package/dist/layouts/home/menu.js +33 -0
  136. package/dist/layouts/home/navbar.d.ts +16 -0
  137. package/dist/layouts/home/navbar.d.ts.map +1 -0
  138. package/dist/layouts/home/navbar.js +48 -0
  139. package/dist/layouts/home.d.ts +5 -7
  140. package/dist/layouts/home.d.ts.map +1 -0
  141. package/dist/layouts/home.js +51 -59
  142. package/dist/layouts/links.d.ts +80 -0
  143. package/dist/layouts/links.d.ts.map +1 -0
  144. package/dist/layouts/links.js +14 -0
  145. package/dist/layouts/shared.d.ts +48 -2
  146. package/dist/layouts/shared.d.ts.map +1 -0
  147. package/dist/layouts/shared.js +27 -9
  148. package/dist/mdx.client.d.ts +3 -6
  149. package/dist/mdx.client.d.ts.map +1 -0
  150. package/dist/mdx.client.js +12 -19
  151. package/dist/mdx.d.ts +18 -20
  152. package/dist/mdx.d.ts.map +1 -0
  153. package/dist/mdx.js +47 -56
  154. package/dist/og.d.ts +6 -7
  155. package/dist/og.d.ts.map +1 -0
  156. package/dist/og.js +43 -102
  157. package/dist/page.client.d.ts +8 -41
  158. package/dist/page.client.d.ts.map +1 -0
  159. package/dist/page.client.js +71 -261
  160. package/dist/page.d.ts +28 -30
  161. package/dist/page.d.ts.map +1 -0
  162. package/dist/page.js +80 -168
  163. package/dist/provider.d.ts +12 -72
  164. package/dist/provider.d.ts.map +1 -0
  165. package/dist/provider.js +19 -55
  166. package/dist/style.css +1 -1
  167. package/dist/tailwind-plugin.d.ts +9 -20
  168. package/dist/tailwind-plugin.d.ts.map +1 -0
  169. package/dist/tailwind-plugin.js +191 -699
  170. package/dist/theme/animations.d.ts +170 -0
  171. package/dist/theme/animations.d.ts.map +1 -0
  172. package/dist/theme/animations.js +95 -0
  173. package/dist/theme/colors.d.ts +11 -0
  174. package/dist/theme/colors.d.ts.map +1 -0
  175. package/dist/theme/colors.js +327 -0
  176. package/dist/theme/typography.d.ts +70 -0
  177. package/dist/theme/typography.d.ts.map +1 -0
  178. package/dist/theme/typography.js +71 -0
  179. package/dist/utils/cn.d.ts +2 -0
  180. package/dist/utils/cn.d.ts.map +1 -0
  181. package/dist/utils/cn.js +1 -0
  182. package/dist/utils/get-sidebar-tabs.d.ts +7 -0
  183. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
  184. package/dist/utils/get-sidebar-tabs.js +20 -0
  185. package/dist/utils/is-active.d.ts +2 -0
  186. package/dist/utils/is-active.d.ts.map +1 -0
  187. package/dist/utils/is-active.js +3 -0
  188. package/dist/utils/use-copy-button.d.ts +3 -0
  189. package/dist/utils/use-copy-button.d.ts.map +1 -0
  190. package/dist/utils/use-copy-button.js +25 -0
  191. package/package.json +9 -9
  192. package/dist/chunk-27HFSL7N.js +0 -53
  193. package/dist/chunk-2FLZOPQN.js +0 -54
  194. package/dist/chunk-2KMKNVSN.js +0 -29
  195. package/dist/chunk-AFMXKA2S.js +0 -125
  196. package/dist/chunk-CDPVENXR.js +0 -8
  197. package/dist/chunk-CLF6ZVYS.js +0 -259
  198. package/dist/chunk-DGKCMOIC.js +0 -56
  199. package/dist/chunk-DN6Z5VW6.js +0 -61
  200. package/dist/chunk-E3VO2QQT.js +0 -29
  201. package/dist/chunk-EFMHXXHW.js +0 -24
  202. package/dist/chunk-F534DZID.js +0 -43
  203. package/dist/chunk-GHOAONNQ.js +0 -48
  204. package/dist/chunk-IL64LMKR.js +0 -82
  205. package/dist/chunk-ILBYBJ5C.js +0 -38
  206. package/dist/chunk-IVBHRX3O.js +0 -31
  207. package/dist/chunk-J6XGK6ZG.js +0 -212
  208. package/dist/chunk-KZTWSBYY.js +0 -68
  209. package/dist/chunk-MCX7E6ZW.js +0 -57
  210. package/dist/chunk-MLKGABMK.js +0 -9
  211. package/dist/chunk-QKOA6KEZ.js +0 -22
  212. package/dist/chunk-TK3TM3MR.js +0 -6
  213. package/dist/chunk-TQJ6YPJ3.js +0 -31
  214. package/dist/chunk-UUGCW3UP.js +0 -84
  215. package/dist/chunk-VPJMNIJX.js +0 -542
  216. package/dist/chunk-W36BQGMB.js +0 -69
  217. package/dist/chunk-YL3MZH7N.js +0 -66
  218. package/dist/chunk-ZBOI25UW.js +0 -139
  219. package/dist/components/api.client.d.ts +0 -5
  220. package/dist/components/api.client.js +0 -8
  221. package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
  222. package/dist/edit-on-github-FIYOWWPQ.js +0 -49
  223. package/dist/layouts/home.client.d.ts +0 -11
  224. package/dist/layouts/home.client.js +0 -274
  225. package/dist/shared-SScCiV7b.d.ts +0 -152
  226. package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
  227. package/dist/tag-list-BsEgfE3x.d.ts +0 -6
  228. package/dist/toc-clerk-SKE4LBT7.js +0 -158
  229. package/dist/tree-06ley65N.d.ts +0 -21
@@ -1,139 +0,0 @@
1
- import {
2
- useCopyButton
3
- } from "./chunk-2KMKNVSN.js";
4
- import {
5
- buttonVariants
6
- } from "./chunk-QKOA6KEZ.js";
7
- import {
8
- ScrollArea,
9
- ScrollBar,
10
- ScrollViewport
11
- } from "./chunk-2FLZOPQN.js";
12
- import {
13
- Check,
14
- Copy
15
- } from "./chunk-VPJMNIJX.js";
16
- import {
17
- twMerge
18
- } from "./chunk-TK3TM3MR.js";
19
-
20
- // src/components/codeblock.tsx
21
- import {
22
- forwardRef,
23
- useCallback,
24
- useRef
25
- } from "react";
26
- import { jsx, jsxs } from "react/jsx-runtime";
27
- var Pre = forwardRef(
28
- ({ className, ...props }, ref) => {
29
- return /* @__PURE__ */ jsx("pre", { ref, className: twMerge("max-h-[400px] p-4", className), ...props, children: props.children });
30
- }
31
- );
32
- Pre.displayName = "Pre";
33
- var CodeBlock = forwardRef(
34
- ({
35
- title,
36
- allowCopy = true,
37
- keepBackground = false,
38
- icon,
39
- className,
40
- ...props
41
- }, ref) => {
42
- const areaRef = useRef(null);
43
- const onCopy = useCallback(() => {
44
- const pre = areaRef.current?.getElementsByTagName("pre").item(0);
45
- if (!pre) return;
46
- const clone = pre.cloneNode(true);
47
- clone.querySelectorAll(".nd-copy-ignore").forEach((node) => {
48
- node.remove();
49
- });
50
- void navigator.clipboard.writeText(clone.textContent ?? "");
51
- }, []);
52
- return /* @__PURE__ */ jsxs(
53
- "figure",
54
- {
55
- ref,
56
- className: twMerge(
57
- "not-prose group fd-codeblock relative my-6 overflow-hidden rounded-lg border bg-fd-secondary/50 text-sm",
58
- keepBackground && "bg-[var(--shiki-light-bg)] dark:bg-[var(--shiki-dark-bg)]",
59
- className
60
- ),
61
- ...props,
62
- children: [
63
- title ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 border-b bg-fd-muted px-4 py-1.5", children: [
64
- icon ? /* @__PURE__ */ jsx(
65
- "div",
66
- {
67
- className: "text-fd-muted-foreground [&_svg]:size-3.5",
68
- ...typeof icon === "string" ? {
69
- dangerouslySetInnerHTML: { __html: icon }
70
- } : {
71
- children: icon
72
- }
73
- }
74
- ) : null,
75
- /* @__PURE__ */ jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }),
76
- allowCopy ? /* @__PURE__ */ jsx(CopyButton, { className: "-me-2", onCopy }) : null
77
- ] }) : allowCopy && /* @__PURE__ */ jsx(
78
- CopyButton,
79
- {
80
- className: "absolute right-2 top-2 z-[2] backdrop-blur-md",
81
- onCopy
82
- }
83
- ),
84
- /* @__PURE__ */ jsxs(ScrollArea, { ref: areaRef, dir: "ltr", children: [
85
- /* @__PURE__ */ jsx(ScrollViewport, { children: props.children }),
86
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
87
- ] })
88
- ]
89
- }
90
- );
91
- }
92
- );
93
- CodeBlock.displayName = "CodeBlock";
94
- function CopyButton({
95
- className,
96
- onCopy,
97
- ...props
98
- }) {
99
- const [checked, onClick] = useCopyButton(onCopy);
100
- return /* @__PURE__ */ jsxs(
101
- "button",
102
- {
103
- type: "button",
104
- className: twMerge(
105
- buttonVariants({
106
- color: "ghost",
107
- className: "transition-all group-hover:opacity-100"
108
- }),
109
- !checked && "opacity-0",
110
- className
111
- ),
112
- "aria-label": "Copy Text",
113
- onClick,
114
- ...props,
115
- children: [
116
- /* @__PURE__ */ jsx(
117
- Check,
118
- {
119
- className: twMerge("size-3.5 transition-transform", !checked && "scale-0")
120
- }
121
- ),
122
- /* @__PURE__ */ jsx(
123
- Copy,
124
- {
125
- className: twMerge(
126
- "absolute size-3.5 transition-transform",
127
- checked && "scale-0"
128
- )
129
- }
130
- )
131
- ]
132
- }
133
- );
134
- }
135
-
136
- export {
137
- Pre,
138
- CodeBlock
139
- };
@@ -1,5 +0,0 @@
1
- import { MouseEventHandler } from 'react';
2
-
3
- declare function useCopyButton(onCopy: () => void): [checked: boolean, onClick: MouseEventHandler];
4
-
5
- export { useCopyButton as _useCopyButton };
@@ -1,8 +0,0 @@
1
- "use client";
2
- import {
3
- useCopyButton
4
- } from "../chunk-2KMKNVSN.js";
5
- import "../chunk-MLKGABMK.js";
6
- export {
7
- useCopyButton as _useCopyButton
8
- };
@@ -1,129 +0,0 @@
1
- "use client";
2
- import {
3
- Sidebar
4
- } from "./chunk-J6XGK6ZG.js";
5
- import "./chunk-W36BQGMB.js";
6
- import "./chunk-CDPVENXR.js";
7
- import "./chunk-TQJ6YPJ3.js";
8
- import {
9
- buttonVariants
10
- } from "./chunk-QKOA6KEZ.js";
11
- import "./chunk-2FLZOPQN.js";
12
- import {
13
- PanelLeft
14
- } from "./chunk-VPJMNIJX.js";
15
- import {
16
- twMerge
17
- } from "./chunk-TK3TM3MR.js";
18
- import "./chunk-UUGCW3UP.js";
19
- import "./chunk-YL3MZH7N.js";
20
- import {
21
- useSidebar
22
- } from "./chunk-27HFSL7N.js";
23
- import "./chunk-EFMHXXHW.js";
24
- import "./chunk-MLKGABMK.js";
25
-
26
- // src/components/layout/dynamic-sidebar.tsx
27
- import {
28
- useCallback,
29
- useMemo,
30
- useRef,
31
- useState
32
- } from "react";
33
- import { useOnChange } from "fumadocs-core/utils/use-on-change";
34
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
35
- function DynamicSidebar(props) {
36
- const { collapsed, setCollapsed } = useSidebar();
37
- const [hover, setHover] = useState(false);
38
- const timerRef = useRef(0);
39
- const closeTimeRef = useRef(0);
40
- useOnChange(collapsed, () => {
41
- setHover(false);
42
- closeTimeRef.current = Date.now() + 150;
43
- });
44
- const onEnter = useCallback((e) => {
45
- if (e.pointerType === "touch" || closeTimeRef.current > Date.now()) return;
46
- window.clearTimeout(timerRef.current);
47
- setHover(true);
48
- }, []);
49
- const onLeave = useCallback((e) => {
50
- if (e.pointerType === "touch") return;
51
- window.clearTimeout(timerRef.current);
52
- timerRef.current = window.setTimeout(
53
- () => {
54
- setHover(false);
55
- closeTimeRef.current = Date.now() + 150;
56
- },
57
- Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500
58
- );
59
- }, []);
60
- return /* @__PURE__ */ jsxs(Fragment, { children: [
61
- collapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
62
- /* @__PURE__ */ jsx(
63
- "div",
64
- {
65
- className: "fixed inset-y-0 start-0 w-6 max-md:hidden",
66
- onPointerEnter: onEnter,
67
- onPointerLeave: onLeave
68
- }
69
- ),
70
- /* @__PURE__ */ jsx(
71
- "button",
72
- {
73
- type: "button",
74
- "aria-label": "Collapse Sidebar",
75
- className: twMerge(
76
- buttonVariants({
77
- color: "secondary",
78
- size: "icon",
79
- className: "fixed start-4 bottom-2 z-10 max-md:hidden"
80
- })
81
- ),
82
- onClick: () => {
83
- setCollapsed((v) => !v);
84
- },
85
- children: /* @__PURE__ */ jsx(PanelLeft, {})
86
- }
87
- ),
88
- /* @__PURE__ */ jsx("style", { children: `#nd-page { --fd-sidebar-width: 0px; }` })
89
- ] }) : null,
90
- /* @__PURE__ */ jsx(
91
- Sidebar,
92
- {
93
- ...props,
94
- aside: useMemo(
95
- () => ({
96
- "data-collapse": collapsed,
97
- "data-hover": hover,
98
- onPointerEnter: collapsed ? onEnter : void 0,
99
- onPointerLeave: collapsed ? onLeave : void 0,
100
- "aria-hidden": Boolean(collapsed && !hover),
101
- style: {
102
- // the offset given to docs content when the sidebar is collapsed
103
- "--fd-content-offset": "calc(var(--fd-sidebar-width) * -1)"
104
- },
105
- className: twMerge(
106
- "md:transition-[transform,margin,flex]",
107
- collapsed && [
108
- "md:me-[var(--fd-content-offset)] md:grow-0 md:shadow-md",
109
- hover ? "md:translate-x-0" : "md:translate-x-[calc(var(--fd-sidebar-width)*-1)] rtl:md:translate-x-[var(--fd-sidebar-width)]"
110
- ],
111
- ``
112
- )
113
- }),
114
- [collapsed, hover, onEnter, onLeave]
115
- )
116
- }
117
- ),
118
- /* @__PURE__ */ jsx(
119
- "div",
120
- {
121
- role: "none",
122
- className: twMerge("transition-all max-md:hidden", collapsed && "flex-1")
123
- }
124
- )
125
- ] });
126
- }
127
- export {
128
- DynamicSidebar as default
129
- };
@@ -1,49 +0,0 @@
1
- "use client";
2
- import {
3
- buttonVariants
4
- } from "./chunk-QKOA6KEZ.js";
5
- import {
6
- SquarePen
7
- } from "./chunk-VPJMNIJX.js";
8
- import {
9
- twMerge
10
- } from "./chunk-TK3TM3MR.js";
11
- import {
12
- useI18n
13
- } from "./chunk-EFMHXXHW.js";
14
- import "./chunk-MLKGABMK.js";
15
-
16
- // src/components/layout/edit-on-github.tsx
17
- import { forwardRef } from "react";
18
- import { jsx, jsxs } from "react/jsx-runtime";
19
- var EditOnGitHub = forwardRef(
20
- ({ owner, repo, sha = "main", path, ...props }, ref) => {
21
- const { text } = useI18n();
22
- return /* @__PURE__ */ jsxs(
23
- "a",
24
- {
25
- ref,
26
- href: `https://github.com/${owner}/${repo}/blob/${sha}/${path.startsWith("/") ? path.slice(1) : path}`,
27
- target: "_blank",
28
- rel: "noreferrer noopener",
29
- ...props,
30
- className: twMerge(
31
- buttonVariants({
32
- color: "secondary",
33
- className: "gap-1.5 py-1 text-fd-muted-foreground"
34
- }),
35
- props.className
36
- ),
37
- children: [
38
- /* @__PURE__ */ jsx(SquarePen, { className: "size-3.5" }),
39
- text.editOnGithub
40
- ]
41
- }
42
- );
43
- }
44
- );
45
- EditOnGitHub.displayName = "EditOnGitHub";
46
- var edit_on_github_default = EditOnGitHub;
47
- export {
48
- edit_on_github_default as default
49
- };
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { S as SharedNavProps, L as LinkItemType } from '../shared-SScCiV7b.js';
3
- export { N as NavProvider } from '../shared-SScCiV7b.js';
4
-
5
- declare function Nav({ items, enableSearch, ...props }: Omit<SharedNavProps, 'transparentMode'> & {
6
- disableThemeSwitch?: boolean;
7
- i18n?: boolean;
8
- items: LinkItemType[];
9
- }): ReactNode;
10
-
11
- export { Nav };
@@ -1,274 +0,0 @@
1
- "use client";
2
- import {
3
- BaseLinkItem,
4
- ButtonItem,
5
- IconItem,
6
- ThemeToggle
7
- } from "../chunk-AFMXKA2S.js";
8
- import {
9
- LargeSearchToggle,
10
- SearchToggle
11
- } from "../chunk-W36BQGMB.js";
12
- import "../chunk-CDPVENXR.js";
13
- import {
14
- LanguageToggle,
15
- LanguageToggleText
16
- } from "../chunk-KZTWSBYY.js";
17
- import {
18
- buttonVariants
19
- } from "../chunk-QKOA6KEZ.js";
20
- import {
21
- NavContext,
22
- NavProvider,
23
- Title
24
- } from "../chunk-MCX7E6ZW.js";
25
- import "../chunk-IVBHRX3O.js";
26
- import {
27
- ChevronDown,
28
- Languages
29
- } from "../chunk-VPJMNIJX.js";
30
- import {
31
- twMerge
32
- } from "../chunk-TK3TM3MR.js";
33
- import {
34
- useSearchContext
35
- } from "../chunk-UUGCW3UP.js";
36
- import "../chunk-EFMHXXHW.js";
37
- import "../chunk-MLKGABMK.js";
38
-
39
- // src/layouts/home.client.tsx
40
- import { useContext, useMemo, useState } from "react";
41
-
42
- // src/layouts/nav-item.tsx
43
- import { Fragment } from "react";
44
- import { cva } from "class-variance-authority";
45
- import Link2 from "fumadocs-core/link";
46
-
47
- // src/components/ui/navigation-menu.tsx
48
- import * as React from "react";
49
- import * as Primitive from "@radix-ui/react-navigation-menu";
50
- import { jsx } from "react/jsx-runtime";
51
- var NavigationMenu = Primitive.Root;
52
- var NavigationMenuList = Primitive.List;
53
- var NavigationMenuItem = Primitive.Item;
54
- var NavigationMenuTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
55
- Primitive.Trigger,
56
- {
57
- ref,
58
- className: twMerge("data-[state=open]:bg-fd-accent/50", className),
59
- ...props,
60
- children
61
- }
62
- ));
63
- NavigationMenuTrigger.displayName = Primitive.Trigger.displayName;
64
- var NavigationMenuContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
65
- Primitive.Content,
66
- {
67
- ref,
68
- className: twMerge(
69
- "absolute inset-x-0 top-0 data-[motion=from-end]:animate-fd-enterFromRight data-[motion=from-start]:animate-fd-enterFromLeft data-[motion=to-end]:animate-fd-exitToRight data-[motion=to-start]:animate-fd-exitToLeft",
70
- className
71
- ),
72
- ...props
73
- }
74
- ));
75
- NavigationMenuContent.displayName = Primitive.Content.displayName;
76
- var NavigationMenuLink = Primitive.Link;
77
- var NavigationMenuViewport = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: "flex w-full justify-center", children: /* @__PURE__ */ jsx(
78
- Primitive.Viewport,
79
- {
80
- ...props,
81
- className: twMerge(
82
- "relative h-[var(--radix-navigation-menu-viewport-height)] w-full origin-[top_center] overflow-hidden text-fd-popover-foreground transition-[width,height] duration-300 data-[state=closed]:animate-fd-nav-menu-out data-[state=open]:animate-fd-nav-menu-in",
83
- className
84
- )
85
- }
86
- ) }));
87
- NavigationMenuViewport.displayName = Primitive.Viewport.displayName;
88
-
89
- // src/layouts/nav-item.tsx
90
- import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
91
- var navItemVariants = cva(
92
- "inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4"
93
- );
94
- function NavItem({ item, ...props }) {
95
- if (item.type === "custom") return /* @__PURE__ */ jsx2("div", { ...props, children: item.children });
96
- if (item.type === "menu") {
97
- return /* @__PURE__ */ jsxs(NavigationMenuItem, { ...props, children: [
98
- /* @__PURE__ */ jsx2(NavigationMenuTrigger, { className: twMerge(navItemVariants(), "rounded-md"), children: item.url ? /* @__PURE__ */ jsx2(Link2, { href: item.url, children: item.text }) : item.text }),
99
- /* @__PURE__ */ jsx2(NavigationMenuContent, { className: "grid grid-cols-1 gap-3 px-4 pb-4 md:grid-cols-2 lg:grid-cols-3", children: /* @__PURE__ */ jsx2(MenuItemContent, { item }) })
100
- ] });
101
- }
102
- if (item.type === "button") {
103
- return /* @__PURE__ */ jsx2(NavigationMenuItem, { ...props, children: /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsx2(ButtonItem, { item }) }) });
104
- }
105
- if (item.type === "icon") {
106
- return /* @__PURE__ */ jsx2(NavigationMenuItem, { ...props, children: /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsx2(IconItem, { item }) }) });
107
- }
108
- return /* @__PURE__ */ jsx2(NavigationMenuItem, { ...props, children: /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsx2(BaseLinkItem, { item, className: twMerge(navItemVariants()), children: item.text }) }) });
109
- }
110
- function MenuItemContent({ item }) {
111
- return /* @__PURE__ */ jsx2(Fragment2, { children: item.items.map((child, i) => {
112
- if (child.type === "custom")
113
- return /* @__PURE__ */ jsx2(Fragment, { children: child.children }, i);
114
- const { banner, footer, ...menuProps } = child.menu ?? {};
115
- return /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsxs(
116
- Link2,
117
- {
118
- external: child.external,
119
- href: child.url,
120
- ...menuProps,
121
- className: twMerge(
122
- "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",
123
- menuProps.className
124
- ),
125
- children: [
126
- banner ?? (child.icon ? /* @__PURE__ */ jsx2("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon }) : null),
127
- /* @__PURE__ */ jsx2("p", { className: "-mb-1 text-sm font-medium", children: child.text }),
128
- child.description ? /* @__PURE__ */ jsx2("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description }) : null,
129
- footer
130
- ]
131
- }
132
- ) }, i);
133
- }) });
134
- }
135
- function MenuItem({ item, ...rest }) {
136
- if (item.type === "button") {
137
- return /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsx2(ButtonItem, { item, ...rest }) });
138
- }
139
- if (item.type === "custom")
140
- return /* @__PURE__ */ jsx2("div", { ...rest, className: twMerge("grid", rest.className), children: item.children });
141
- if (item.type === "menu") {
142
- return /* @__PURE__ */ jsxs("div", { ...rest, className: twMerge("mb-4 flex flex-col", rest.className), children: [
143
- /* @__PURE__ */ jsx2("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsxs(Link2, { href: item.url, children: [
144
- item.icon,
145
- item.text
146
- ] }) }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
147
- item.icon,
148
- item.text
149
- ] }) }),
150
- item.items.map((child, i) => /* @__PURE__ */ jsx2(MenuItem, { item: child }, i))
151
- ] });
152
- }
153
- if (item.type === "icon") {
154
- return /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsx2(IconItem, { item }) });
155
- }
156
- return /* @__PURE__ */ jsx2(NavigationMenuLink, { asChild: true, children: /* @__PURE__ */ jsxs(
157
- BaseLinkItem,
158
- {
159
- item,
160
- ...rest,
161
- className: twMerge(
162
- "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",
163
- rest.className
164
- ),
165
- children: [
166
- item.icon,
167
- item.text
168
- ]
169
- }
170
- ) });
171
- }
172
-
173
- // src/layouts/home.client.tsx
174
- import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
175
- function Nav({
176
- items,
177
- enableSearch = true,
178
- ...props
179
- }) {
180
- const search = useSearchContext();
181
- const [navItems, menuItems] = useMemo(
182
- () => [
183
- items.filter((item) => ["nav", "all"].includes(item.on ?? "all")),
184
- items.filter((item) => ["menu", "all"].includes(item.on ?? "all"))
185
- ],
186
- [items]
187
- );
188
- return /* @__PURE__ */ jsxs2(Fragment3, { children: [
189
- /* @__PURE__ */ jsx3(
190
- "div",
191
- {
192
- "aria-hidden": "true",
193
- className: "fixed inset-x-0 top-[var(--fd-banner-height)] z-40 h-6 bg-fd-background",
194
- style: {
195
- maskImage: "linear-gradient(to bottom,white,transparent)"
196
- }
197
- }
198
- ),
199
- /* @__PURE__ */ jsxs2(Header, { children: [
200
- /* @__PURE__ */ jsx3(Title, { title: props.title, url: props.url }),
201
- props.children,
202
- /* @__PURE__ */ jsx3(NavigationMenuList, { className: "flex flex-row items-center gap-2 max-sm:hidden", children: navItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx3(NavItem, { item, className: "text-sm" }, i)) }),
203
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-row items-center justify-end lg:gap-1.5", children: [
204
- enableSearch && search.enabled ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
205
- /* @__PURE__ */ jsx3(SearchToggle, { className: "lg:hidden" }),
206
- /* @__PURE__ */ jsx3(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden" })
207
- ] }) : null,
208
- !props.disableThemeSwitch ? /* @__PURE__ */ jsx3(ThemeToggle, { className: "max-lg:hidden" }) : null,
209
- props.i18n ? /* @__PURE__ */ jsx3(LanguageToggle, { className: "-me-1.5 max-lg:hidden", children: /* @__PURE__ */ jsx3(Languages, { className: "size-5" }) }) : null,
210
- navItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx3(
211
- NavItem,
212
- {
213
- item,
214
- className: "-me-1.5 list-none max-lg:hidden"
215
- },
216
- i
217
- )),
218
- /* @__PURE__ */ jsxs2(NavigationMenuItem, { className: "list-none lg:hidden", children: [
219
- /* @__PURE__ */ jsx3(
220
- NavigationMenuTrigger,
221
- {
222
- className: twMerge(
223
- buttonVariants({
224
- size: "icon",
225
- color: "ghost"
226
- }),
227
- "group -me-2"
228
- ),
229
- children: /* @__PURE__ */ jsx3(ChevronDown, { className: "size-3 transition-transform duration-300 group-data-[state=open]:rotate-180" })
230
- }
231
- ),
232
- /* @__PURE__ */ jsxs2(NavigationMenuContent, { className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end", children: [
233
- menuItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx3(MenuItem, { item, className: "sm:hidden" }, i)),
234
- /* @__PURE__ */ jsxs2("div", { className: "-ms-1.5 flex flex-row items-center gap-1.5 max-sm:mt-2", children: [
235
- props.i18n ? /* @__PURE__ */ jsxs2(LanguageToggle, { className: "me-auto", children: [
236
- /* @__PURE__ */ jsx3(Languages, { className: "size-5" }),
237
- /* @__PURE__ */ jsx3(LanguageToggleText, {}),
238
- /* @__PURE__ */ jsx3(ChevronDown, { className: "size-3 text-fd-muted-foreground" })
239
- ] }) : null,
240
- /* @__PURE__ */ jsx3("div", { className: "flex flex-row items-center empty:hidden", children: menuItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx3(MenuItem, { item }, i)) }),
241
- !props.disableThemeSwitch ? /* @__PURE__ */ jsx3(ThemeToggle, { className: twMerge(!props.i18n && "ms-auto") }) : null
242
- ] })
243
- ] })
244
- ] })
245
- ] })
246
- ] })
247
- ] });
248
- }
249
- function Header({ children }) {
250
- const [value, setValue] = useState("");
251
- const { isTransparent } = useContext(NavContext);
252
- return /* @__PURE__ */ jsx3(NavigationMenu, { value, onValueChange: setValue, asChild: true, children: /* @__PURE__ */ jsxs2(
253
- "header",
254
- {
255
- id: "nd-nav",
256
- className: twMerge(
257
- "fixed left-1/2 top-[var(--fd-banner-height)] z-40 mt-1 w-[calc(100%-1rem)] max-w-fd-container -translate-x-1/2 rounded-2xl border border-fd-foreground/10 transition-colors",
258
- value.length > 0 ? "shadow-lg" : "shadow-sm",
259
- (!isTransparent || value.length > 0) && "bg-fd-background/80 backdrop-blur-lg"
260
- ),
261
- children: [
262
- /* @__PURE__ */ jsx3("nav", { className: "flex h-12 w-full flex-row items-center gap-6 px-4", children }),
263
- /* @__PURE__ */ jsx3(NavigationMenuViewport, {})
264
- ]
265
- }
266
- ) });
267
- }
268
- function isSecondary(item) {
269
- return "secondary" in item && item.secondary === true || item.type === "icon";
270
- }
271
- export {
272
- Nav,
273
- NavProvider
274
- };