fumadocs-ui 14.2.0 → 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-45REPLUI.js +0 -259
  196. package/dist/chunk-5KVEK5A7.js +0 -139
  197. package/dist/chunk-5QPVK7QM.js +0 -542
  198. package/dist/chunk-CDPVENXR.js +0 -8
  199. package/dist/chunk-CPGKWLLV.js +0 -43
  200. package/dist/chunk-DGKCMOIC.js +0 -56
  201. package/dist/chunk-DN6Z5VW6.js +0 -61
  202. package/dist/chunk-E3VO2QQT.js +0 -29
  203. package/dist/chunk-EFMHXXHW.js +0 -24
  204. package/dist/chunk-ET4TW6M5.js +0 -70
  205. package/dist/chunk-GHOAONNQ.js +0 -48
  206. package/dist/chunk-IHIFNFRB.js +0 -38
  207. package/dist/chunk-IVBHRX3O.js +0 -31
  208. package/dist/chunk-JUOW3DZK.js +0 -212
  209. package/dist/chunk-KZTWSBYY.js +0 -68
  210. package/dist/chunk-MCX7E6ZW.js +0 -57
  211. package/dist/chunk-MLKGABMK.js +0 -9
  212. package/dist/chunk-PZTQPB4U.js +0 -125
  213. package/dist/chunk-QKOA6KEZ.js +0 -22
  214. package/dist/chunk-TK3TM3MR.js +0 -6
  215. package/dist/chunk-TQJ6YPJ3.js +0 -31
  216. package/dist/chunk-V6RONFCQ.js +0 -69
  217. package/dist/chunk-WRBUXI2A.js +0 -82
  218. package/dist/chunk-YL3MZH7N.js +0 -66
  219. package/dist/components/api.client.d.ts +0 -5
  220. package/dist/components/api.client.js +0 -8
  221. package/dist/dynamic-sidebar-MEINO4E2.js +0 -129
  222. package/dist/edit-on-github-PCTRDRD6.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,274 +0,0 @@
1
- "use client";
2
- import {
3
- BaseLinkItem,
4
- ButtonItem,
5
- IconItem,
6
- ThemeToggle
7
- } from "../chunk-PZTQPB4U.js";
8
- import {
9
- LargeSearchToggle,
10
- SearchToggle
11
- } from "../chunk-V6RONFCQ.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-5QPVK7QM.js";
30
- import {
31
- twMerge
32
- } from "../chunk-TK3TM3MR.js";
33
- import {
34
- useSearchContext
35
- } from "../chunk-ET4TW6M5.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
- };
@@ -1,152 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode, HTMLAttributes } from 'react';
3
-
4
- interface BaseItem {
5
- /**
6
- * Restrict where the item is displayed
7
- *
8
- * @defaultValue 'all'
9
- */
10
- on?: 'menu' | 'nav' | 'all';
11
- }
12
- interface MainItem extends BaseLinkItem {
13
- type?: 'main';
14
- icon?: ReactNode;
15
- text: ReactNode;
16
- description?: ReactNode;
17
- }
18
- interface MenuItem extends BaseItem {
19
- type: 'menu';
20
- icon?: ReactNode;
21
- text: ReactNode;
22
- url?: string;
23
- items: ((MainItem & {
24
- /**
25
- * Options when displayed on navigation menu
26
- */
27
- menu?: HTMLAttributes<HTMLElement> & {
28
- banner?: ReactNode;
29
- footer?: ReactNode;
30
- };
31
- }) | CustomItem)[];
32
- /**
33
- * @defaultValue false
34
- */
35
- secondary?: boolean;
36
- }
37
- interface CustomItem extends BaseItem {
38
- type: 'custom';
39
- /**
40
- * @defaultValue false
41
- */
42
- secondary?: boolean;
43
- children: ReactNode;
44
- }
45
- type LinkItemType = MainItem | IconItem | ButtonItem | MenuItem | CustomItem;
46
- interface BaseLinkItem extends BaseItem {
47
- url: string;
48
- /**
49
- * When the item is marked as active
50
- *
51
- * @defaultValue 'url'
52
- */
53
- active?: 'url' | 'nested-url' | 'none';
54
- external?: boolean;
55
- }
56
- declare const BaseLinkItem: react.ForwardRefExoticComponent<{
57
- item: BaseLinkItem;
58
- } & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
59
- interface ButtonItem extends BaseLinkItem {
60
- type: 'button';
61
- icon?: ReactNode;
62
- text: ReactNode;
63
- /**
64
- * @defaultValue false
65
- */
66
- secondary?: boolean;
67
- }
68
- declare const ButtonItem: react.ForwardRefExoticComponent<{
69
- item: ButtonItem;
70
- } & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
71
- interface IconItem extends BaseLinkItem {
72
- type: 'icon';
73
- /**
74
- * `aria-label` of icon button
75
- */
76
- label?: string;
77
- icon: ReactNode;
78
- text: ReactNode;
79
- /**
80
- * @defaultValue true
81
- */
82
- secondary?: boolean;
83
- }
84
- declare const IconItem: react.ForwardRefExoticComponent<{
85
- item: IconItem;
86
- } & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
87
-
88
- interface NavProviderProps {
89
- /**
90
- * Use transparent background
91
- *
92
- * @defaultValue none
93
- */
94
- transparentMode?: 'always' | 'top' | 'none';
95
- }
96
- interface TitleProps {
97
- title?: ReactNode;
98
- /**
99
- * Redirect url of title
100
- * @defaultValue '/'
101
- */
102
- url?: string;
103
- }
104
- declare function NavProvider({ transparentMode, children, }: NavProviderProps & {
105
- children: ReactNode;
106
- }): ReactNode;
107
-
108
- interface NavOptions extends SharedNavProps {
109
- enabled: boolean;
110
- component: ReactNode;
111
- }
112
- interface SharedNavProps extends TitleProps, NavProviderProps {
113
- /**
114
- * Show/hide search toggle
115
- *
116
- * Note: Enable/disable search from root provider instead
117
- */
118
- enableSearch?: boolean;
119
- children?: ReactNode;
120
- }
121
- interface BaseLayoutProps {
122
- /**
123
- * Remove theme switcher component
124
- */
125
- disableThemeSwitch?: boolean;
126
- /**
127
- * Enable Language Switch
128
- *
129
- * @defaultValue false
130
- */
131
- i18n?: boolean;
132
- /**
133
- * GitHub url
134
- */
135
- githubUrl?: string;
136
- links?: LinkItemType[];
137
- /**
138
- * Replace or disable navbar
139
- */
140
- nav?: Partial<NavOptions>;
141
- children?: ReactNode;
142
- }
143
- /**
144
- * Get Links Items with shortcuts
145
- */
146
- declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
147
- declare function replaceOrDefault(obj: {
148
- enabled?: boolean;
149
- component?: ReactNode;
150
- } | undefined, def: ReactNode, customComponentProps?: object, disabled?: ReactNode): ReactNode;
151
-
152
- export { type BaseLayoutProps as B, IconItem as I, type LinkItemType as L, NavProvider as N, type SharedNavProps as S, getLinks as g, replaceOrDefault as r };
@@ -1,50 +0,0 @@
1
- import * as react from 'react';
2
- import { HTMLAttributes, ReactNode } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { PageTree } from 'fumadocs-core/server';
5
-
6
- interface SidebarProps {
7
- /**
8
- * Open folders by default if their level is lower or equal to a specific level
9
- * (Starting from 1)
10
- *
11
- * @defaultValue 0
12
- */
13
- defaultOpenLevel?: number;
14
- /**
15
- * Prefetch links
16
- *
17
- * @defaultValue true
18
- */
19
- prefetch?: boolean;
20
- /**
21
- * Customise each of the component
22
- */
23
- components?: Partial<Components>;
24
- banner?: ReactNode;
25
- children?: ReactNode;
26
- footer?: ReactNode;
27
- /**
28
- * Hide search trigger
29
- *
30
- * @defaultValue false
31
- */
32
- hideSearch?: boolean;
33
- }
34
- interface Components {
35
- Item: React.FC<{
36
- item: PageTree.Item;
37
- }>;
38
- Folder: React.FC<{
39
- item: PageTree.Folder;
40
- level: number;
41
- }>;
42
- Separator: React.FC<{
43
- item: PageTree.Separator;
44
- }>;
45
- }
46
- declare const Sidebar: react.MemoExoticComponent<({ components, defaultOpenLevel, prefetch, ...props }: SidebarProps & {
47
- aside?: HTMLAttributes<HTMLElement> & Record<string, unknown>;
48
- }) => react_jsx_runtime.JSX.Element>;
49
-
50
- export { type SidebarProps as S, Sidebar as a };
@@ -1,6 +0,0 @@
1
- interface TagItem {
2
- name: string;
3
- value: string | undefined;
4
- }
5
-
6
- export type { TagItem as T };
@@ -1,158 +0,0 @@
1
- "use client";
2
- import {
3
- TocThumb
4
- } from "./chunk-DN6Z5VW6.js";
5
- import {
6
- ScrollArea,
7
- ScrollViewport
8
- } from "./chunk-2FLZOPQN.js";
9
- import {
10
- twMerge
11
- } from "./chunk-TK3TM3MR.js";
12
- import {
13
- useI18n
14
- } from "./chunk-EFMHXXHW.js";
15
- import "./chunk-MLKGABMK.js";
16
-
17
- // src/components/layout/toc-clerk.tsx
18
- import * as Primitive from "fumadocs-core/toc";
19
- import { useEffect, useRef, useState } from "react";
20
- import { jsx, jsxs } from "react/jsx-runtime";
21
- function ClerkTOCItems({
22
- items,
23
- isMenu = false
24
- }) {
25
- const { text } = useI18n();
26
- const viewRef = useRef(null);
27
- const containerRef = useRef(null);
28
- const [svg, setSvg] = useState();
29
- useEffect(() => {
30
- if (!containerRef.current) return;
31
- const container = containerRef.current;
32
- function onResize() {
33
- if (container.clientHeight === 0) return;
34
- let w = 0, h = 0;
35
- const d = [];
36
- for (let i = 0; i < items.length; i++) {
37
- const element = container.querySelector(
38
- `a[href="#${items[i].url.slice(1)}"]`
39
- );
40
- if (!element) continue;
41
- const styles = getComputedStyle(element);
42
- const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
43
- w = Math.max(offset, w);
44
- h = Math.max(h, bottom);
45
- d.push(`${i === 0 ? "M" : "L"}${offset} ${top}`);
46
- d.push(`L${offset} ${bottom}`);
47
- }
48
- setSvg({
49
- path: d.join(" "),
50
- width: w + 1,
51
- height: h
52
- });
53
- }
54
- const observer = new ResizeObserver(onResize);
55
- onResize();
56
- observer.observe(container);
57
- return () => {
58
- observer.disconnect();
59
- };
60
- }, [items]);
61
- if (items.length === 0)
62
- return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings });
63
- return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsxs(ScrollViewport, { className: "relative min-h-0", ref: viewRef, children: [
64
- svg ? /* @__PURE__ */ jsx(
65
- "div",
66
- {
67
- className: "absolute start-0 top-0 rtl:-scale-x-100",
68
- style: {
69
- width: svg.width,
70
- height: svg.height,
71
- maskImage: `url("data:image/svg+xml,${// Inline SVG
72
- encodeURIComponent(
73
- `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`
74
- )}")`
75
- },
76
- children: /* @__PURE__ */ jsx(
77
- TocThumb,
78
- {
79
- containerRef,
80
- className: "mt-[var(--fd-top)] h-[var(--fd-height)] bg-fd-primary transition-all"
81
- }
82
- )
83
- }
84
- ) : null,
85
- /* @__PURE__ */ jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", ref: containerRef, children: items.map((item, i) => /* @__PURE__ */ jsx(
86
- TOCItem2,
87
- {
88
- item,
89
- upper: items[i - 1]?.depth,
90
- lower: items[i + 1]?.depth
91
- },
92
- item.url
93
- )) }) })
94
- ] }) });
95
- }
96
- function getItemOffset(depth) {
97
- if (depth <= 2) return 16;
98
- if (depth === 3) return 32;
99
- return 48;
100
- }
101
- function getLineOffset(depth) {
102
- return depth >= 3 ? 12 : 0;
103
- }
104
- function TOCItem2({
105
- item,
106
- upper = item.depth,
107
- lower = item.depth
108
- }) {
109
- const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
110
- return /* @__PURE__ */ jsxs(
111
- Primitive.TOCItem,
112
- {
113
- href: item.url,
114
- style: {
115
- paddingInlineStart: getItemOffset(item.depth)
116
- },
117
- className: "prose relative py-2 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
118
- children: [
119
- offset !== upperOffset ? /* @__PURE__ */ jsx(
120
- "svg",
121
- {
122
- xmlns: "http://www.w3.org/2000/svg",
123
- viewBox: "0 0 16 16",
124
- className: "absolute -top-2 start-0 size-4 rtl:-scale-x-100",
125
- children: /* @__PURE__ */ jsx(
126
- "line",
127
- {
128
- x1: upperOffset,
129
- y1: "0",
130
- x2: offset,
131
- y2: "16",
132
- className: "stroke-fd-foreground/10",
133
- strokeWidth: "1"
134
- }
135
- )
136
- }
137
- ) : null,
138
- /* @__PURE__ */ jsx(
139
- "div",
140
- {
141
- className: twMerge(
142
- "absolute inset-y-0 w-px bg-fd-foreground/10",
143
- offset !== upperOffset && "top-2",
144
- offset !== lowerOffset && "bottom-2"
145
- ),
146
- style: {
147
- insetInlineStart: offset
148
- }
149
- }
150
- ),
151
- item.title
152
- ]
153
- }
154
- );
155
- }
156
- export {
157
- ClerkTOCItems as default
158
- };
@@ -1,21 +0,0 @@
1
- import { PageTree } from 'fumadocs-core/server';
2
- import { ReactNode } from 'react';
3
-
4
- interface TreeContextType {
5
- /**
6
- * The path to the current node
7
- */
8
- path: PageTree.Node[];
9
- /**
10
- * Get neighbours of current `pathname`
11
- */
12
- getNeighbours: () => [PageTree.Item | undefined, PageTree.Item | undefined];
13
- root: PageTree.Root | PageTree.Folder;
14
- }
15
- declare function TreeContextProvider({ children, tree, }: {
16
- tree: PageTree.Root;
17
- children: ReactNode;
18
- }): ReactNode;
19
- declare function useTreeContext(): TreeContextType;
20
-
21
- export { TreeContextProvider as T, useTreeContext as u };