fumadocs-ui 14.2.1 → 14.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,259 +0,0 @@
1
- import {
2
- buttonVariants
3
- } from "./chunk-QKOA6KEZ.js";
4
- import {
5
- FileText,
6
- Hash,
7
- LoaderCircle,
8
- Search,
9
- Text
10
- } from "./chunk-VPJMNIJX.js";
11
- import {
12
- twMerge
13
- } from "./chunk-TK3TM3MR.js";
14
- import {
15
- useSearchContext
16
- } from "./chunk-UUGCW3UP.js";
17
- import {
18
- useSidebar
19
- } from "./chunk-27HFSL7N.js";
20
- import {
21
- useI18n
22
- } from "./chunk-EFMHXXHW.js";
23
-
24
- // src/components/dialog/search.tsx
25
- import { useRouter } from "next/navigation";
26
- import {
27
- useMemo,
28
- useEffect,
29
- useState,
30
- useRef
31
- } from "react";
32
- import {
33
- Dialog,
34
- DialogContent,
35
- DialogOverlay,
36
- DialogTitle
37
- } from "@radix-ui/react-dialog";
38
- import { jsx, jsxs } from "react/jsx-runtime";
39
- function SearchDialog({
40
- open,
41
- onOpenChange,
42
- footer,
43
- links = [],
44
- ...props
45
- }) {
46
- const { text } = useI18n();
47
- const defaultItems = useMemo(
48
- () => links.map(([name, link]) => ({
49
- type: "page",
50
- id: name,
51
- content: name,
52
- url: link
53
- })),
54
- [links]
55
- );
56
- return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange, children: [
57
- /* @__PURE__ */ jsx(DialogOverlay, { className: "fixed inset-0 z-50 bg-fd-background/50 backdrop-blur-sm data-[state=closed]:animate-fd-fade-out data-[state=open]:animate-fd-fade-in" }),
58
- /* @__PURE__ */ jsxs(
59
- DialogContent,
60
- {
61
- "aria-describedby": void 0,
62
- className: "fixed left-1/2 top-[10vh] z-50 w-[98vw] max-w-screen-sm origin-left -translate-x-1/2 rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-lg data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in",
63
- children: [
64
- /* @__PURE__ */ jsx(DialogTitle, { className: "hidden", children: text.search }),
65
- /* @__PURE__ */ jsx(
66
- SearchInput,
67
- {
68
- search: props.search,
69
- onSearchChange: props.onSearchChange,
70
- isLoading: props.isLoading
71
- }
72
- ),
73
- /* @__PURE__ */ jsx(
74
- SearchList,
75
- {
76
- items: props.results === "empty" ? defaultItems : props.results,
77
- hideResults: props.results === "empty" && defaultItems.length === 0
78
- }
79
- ),
80
- footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col border-t p-3", children: footer }) : null
81
- ]
82
- }
83
- )
84
- ] });
85
- }
86
- var icons = {
87
- text: /* @__PURE__ */ jsx(Text, { className: "size-4 text-fd-muted-foreground" }),
88
- heading: /* @__PURE__ */ jsx(Hash, { className: "size-4 text-fd-muted-foreground" }),
89
- page: /* @__PURE__ */ jsx(FileText, { className: "size-4 text-fd-muted-foreground" })
90
- };
91
- function SearchInput({ search, onSearchChange, isLoading }) {
92
- const { text } = useI18n();
93
- const { setOpenSearch } = useSearchContext();
94
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 px-3", children: [
95
- /* @__PURE__ */ jsx(LoadingIndicator, { isLoading: isLoading ?? false }),
96
- /* @__PURE__ */ jsx(
97
- "input",
98
- {
99
- value: search,
100
- onChange: (e) => {
101
- onSearchChange(e.target.value);
102
- },
103
- placeholder: text.search,
104
- className: "w-0 flex-1 bg-transparent py-3 text-base placeholder:text-fd-muted-foreground focus-visible:outline-none"
105
- }
106
- ),
107
- /* @__PURE__ */ jsx(
108
- "button",
109
- {
110
- type: "button",
111
- "aria-label": "Close Search",
112
- onClick: () => {
113
- setOpenSearch(false);
114
- },
115
- className: twMerge(
116
- buttonVariants({
117
- color: "outline",
118
- className: "text-xs p-1.5"
119
- })
120
- ),
121
- children: "Esc"
122
- }
123
- )
124
- ] });
125
- }
126
- function SearchList({ items, hideResults = false }) {
127
- const [active, setActive] = useState();
128
- const { text } = useI18n();
129
- const router = useRouter();
130
- const sidebar = useSidebar();
131
- const { setOpenSearch } = useSearchContext();
132
- if (items.length > 0 && (!active || items.every((item) => item.id !== active))) {
133
- setActive(items[0].id);
134
- }
135
- const listenerRef = useRef();
136
- listenerRef.current = (e) => {
137
- if (e.key === "ArrowDown" || e.key == "ArrowUp") {
138
- setActive((cur) => {
139
- const idx = items.findIndex((item) => item.id === cur);
140
- if (idx === -1) return items.at(0)?.id;
141
- return items.at(
142
- (e.key === "ArrowDown" ? idx + 1 : idx - 1) % items.length
143
- )?.id;
144
- });
145
- e.preventDefault();
146
- }
147
- if (e.key === "Enter") {
148
- const selected = items.find((item) => item.id === active);
149
- if (selected) onOpen(selected.url);
150
- e.preventDefault();
151
- }
152
- };
153
- useEffect(() => {
154
- const listener = (e) => {
155
- listenerRef.current?.(e);
156
- };
157
- window.addEventListener("keydown", listener);
158
- return () => {
159
- window.removeEventListener("keydown", listener);
160
- };
161
- }, []);
162
- const onOpen = (url) => {
163
- router.push(url);
164
- setOpenSearch(false);
165
- sidebar.setOpen(false);
166
- };
167
- return /* @__PURE__ */ jsxs(
168
- "div",
169
- {
170
- className: twMerge(
171
- "flex max-h-[460px] flex-col overflow-y-auto border-t p-2",
172
- hideResults && "hidden"
173
- ),
174
- children: [
175
- items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-12 text-center text-sm", children: text.searchNoResult }) : null,
176
- items.map((item) => /* @__PURE__ */ jsxs(
177
- CommandItem,
178
- {
179
- value: item.id,
180
- active,
181
- onActiveChange: setActive,
182
- onClick: () => {
183
- onOpen(item.url);
184
- },
185
- children: [
186
- item.type !== "page" ? /* @__PURE__ */ jsx(
187
- "div",
188
- {
189
- role: "none",
190
- className: "ms-2 h-full min-h-10 w-px bg-fd-border"
191
- }
192
- ) : null,
193
- icons[item.type],
194
- /* @__PURE__ */ jsx("p", { className: "w-0 flex-1 truncate", children: item.content })
195
- ]
196
- },
197
- item.id
198
- ))
199
- ]
200
- }
201
- );
202
- }
203
- function LoadingIndicator({ isLoading }) {
204
- return /* @__PURE__ */ jsxs("div", { className: "relative size-4", children: [
205
- /* @__PURE__ */ jsx(
206
- LoaderCircle,
207
- {
208
- className: twMerge(
209
- "absolute size-full animate-spin text-fd-primary transition-opacity",
210
- !isLoading && "opacity-0"
211
- )
212
- }
213
- ),
214
- /* @__PURE__ */ jsx(
215
- Search,
216
- {
217
- className: twMerge(
218
- "absolute size-full text-fd-muted-foreground transition-opacity",
219
- isLoading && "opacity-0"
220
- )
221
- }
222
- )
223
- ] });
224
- }
225
- function CommandItem({
226
- active,
227
- onActiveChange,
228
- value,
229
- ...props
230
- }) {
231
- const ref = useRef(null);
232
- useEffect(() => {
233
- const element = ref.current;
234
- if (active === value && element) {
235
- element.scrollIntoView({
236
- block: "nearest"
237
- });
238
- }
239
- }, [active, value]);
240
- return /* @__PURE__ */ jsx(
241
- "button",
242
- {
243
- ref,
244
- type: "button",
245
- "aria-selected": active === value,
246
- onPointerMove: () => onActiveChange(value),
247
- ...props,
248
- className: twMerge(
249
- "flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-fd-accent aria-selected:text-fd-accent-foreground",
250
- props.className
251
- ),
252
- children: props.children
253
- }
254
- );
255
- }
256
-
257
- export {
258
- SearchDialog
259
- };
@@ -1,56 +0,0 @@
1
- import {
2
- twMerge
3
- } from "./chunk-TK3TM3MR.js";
4
-
5
- // src/components/dialog/tag-list.tsx
6
- import { cva } from "class-variance-authority";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- var itemVariants = cva(
9
- "rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors",
10
- {
11
- variants: {
12
- active: {
13
- true: "bg-fd-accent text-fd-accent-foreground"
14
- }
15
- }
16
- }
17
- );
18
- function TagsList({
19
- tag,
20
- onTagChange,
21
- items,
22
- allowClear,
23
- ...props
24
- }) {
25
- return /* @__PURE__ */ jsxs(
26
- "div",
27
- {
28
- ...props,
29
- className: twMerge("flex flex-row items-center gap-1", props.className),
30
- children: [
31
- items.map((item) => /* @__PURE__ */ jsx(
32
- "button",
33
- {
34
- type: "button",
35
- className: twMerge(itemVariants({ active: tag === item.value })),
36
- onClick: () => {
37
- if (tag === item.value && allowClear) {
38
- onTagChange(void 0);
39
- } else {
40
- onTagChange(item.value);
41
- }
42
- },
43
- tabIndex: -1,
44
- children: item.name
45
- },
46
- item.value
47
- )),
48
- props.children
49
- ]
50
- }
51
- );
52
- }
53
-
54
- export {
55
- TagsList
56
- };
@@ -1,61 +0,0 @@
1
- // src/components/layout/toc-thumb.tsx
2
- import {
3
- useEffect,
4
- useRef
5
- } from "react";
6
- import * as Primitive from "fumadocs-core/toc";
7
- import { useOnChange } from "fumadocs-core/utils/use-on-change";
8
- import { jsx } from "react/jsx-runtime";
9
- function calc(container, active) {
10
- if (active.length === 0 || container.clientHeight === 0) {
11
- return [0, 0];
12
- }
13
- let upper = Number.MAX_VALUE, lower = 0;
14
- for (const item of active) {
15
- const element = container.querySelector(`a[href="#${item}"]`);
16
- if (!element) continue;
17
- const styles = getComputedStyle(element);
18
- upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
19
- lower = Math.max(
20
- lower,
21
- element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom)
22
- );
23
- }
24
- return [upper, lower - upper];
25
- }
26
- function update(element, info) {
27
- element.style.setProperty("--fd-top", `${info[0]}px`);
28
- element.style.setProperty("--fd-height", `${info[1]}px`);
29
- }
30
- function TocThumb({
31
- containerRef,
32
- ...props
33
- }) {
34
- const active = Primitive.useActiveAnchors();
35
- const thumbRef = useRef(null);
36
- const activeRef = useRef(active);
37
- activeRef.current = active;
38
- useEffect(() => {
39
- if (!containerRef.current) return;
40
- const container = containerRef.current;
41
- const onResize = () => {
42
- if (!thumbRef.current) return;
43
- update(thumbRef.current, calc(container, activeRef.current));
44
- };
45
- onResize();
46
- const observer = new ResizeObserver(onResize);
47
- observer.observe(container);
48
- return () => {
49
- observer.disconnect();
50
- };
51
- }, [containerRef]);
52
- useOnChange(active, () => {
53
- if (!containerRef.current || !thumbRef.current) return;
54
- update(thumbRef.current, calc(containerRef.current, active));
55
- });
56
- return /* @__PURE__ */ jsx("div", { ref: thumbRef, role: "none", ...props });
57
- }
58
-
59
- export {
60
- TocThumb
61
- };
@@ -1,29 +0,0 @@
1
- // src/layouts/shared.tsx
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { jsx } from "react/jsx-runtime";
4
- function getLinks(links, githubUrl) {
5
- let result = links ?? [];
6
- if (githubUrl)
7
- result = [
8
- ...result,
9
- {
10
- type: "icon",
11
- url: githubUrl,
12
- text: "Github",
13
- icon: /* @__PURE__ */ jsx("svg", { role: "img", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) }),
14
- external: true
15
- }
16
- ];
17
- return result;
18
- }
19
- function replaceOrDefault(obj, def, customComponentProps, disabled) {
20
- if (obj?.enabled === false) return disabled;
21
- if (obj?.component !== void 0)
22
- return /* @__PURE__ */ jsx(Slot, { ...customComponentProps, children: obj.component });
23
- return def;
24
- }
25
-
26
- export {
27
- getLinks,
28
- replaceOrDefault
29
- };
@@ -1,24 +0,0 @@
1
- // src/contexts/i18n.tsx
2
- import { createContext, useContext } from "react";
3
- var I18nContext = createContext({
4
- text: {
5
- search: "Search",
6
- searchNoResult: "No results found",
7
- toc: "On this page",
8
- tocNoHeadings: "No Headings",
9
- lastUpdate: "Last updated on",
10
- chooseLanguage: "Choose a language",
11
- nextPage: "Next",
12
- previousPage: "Previous",
13
- chooseTheme: "Theme",
14
- editOnGithub: "Edit on GitHub"
15
- }
16
- });
17
- function useI18n() {
18
- return useContext(I18nContext);
19
- }
20
-
21
- export {
22
- I18nContext,
23
- useI18n
24
- };
@@ -1,43 +0,0 @@
1
- import {
2
- CircleX,
3
- Info,
4
- TriangleAlert
5
- } from "./chunk-VPJMNIJX.js";
6
- import {
7
- twMerge
8
- } from "./chunk-TK3TM3MR.js";
9
-
10
- // src/components/callout.tsx
11
- import { forwardRef } from "react";
12
- import { jsx, jsxs } from "react/jsx-runtime";
13
- var Callout = forwardRef(
14
- ({ className, children, title, type = "info", icon, ...props }, ref) => {
15
- return /* @__PURE__ */ jsxs(
16
- "div",
17
- {
18
- ref,
19
- className: twMerge(
20
- "my-6 flex flex-row gap-2 rounded-lg border bg-fd-card p-3 text-sm text-fd-card-foreground shadow-md",
21
- className
22
- ),
23
- ...props,
24
- children: [
25
- icon ?? {
26
- info: /* @__PURE__ */ jsx(Info, { className: "size-5 fill-blue-500 text-fd-card" }),
27
- warn: /* @__PURE__ */ jsx(TriangleAlert, { className: "size-5 fill-orange-500 text-fd-card" }),
28
- error: /* @__PURE__ */ jsx(CircleX, { className: "size-5 fill-red-500 text-fd-card" })
29
- }[type],
30
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
31
- title ? /* @__PURE__ */ jsx("p", { className: "not-prose mb-2 font-medium", children: title }) : null,
32
- /* @__PURE__ */ jsx("div", { className: "text-fd-muted-foreground prose-no-margin", children })
33
- ] })
34
- ]
35
- }
36
- );
37
- }
38
- );
39
- Callout.displayName = "Callout";
40
-
41
- export {
42
- Callout
43
- };
@@ -1,48 +0,0 @@
1
- import {
2
- twMerge
3
- } from "./chunk-TK3TM3MR.js";
4
-
5
- // src/components/card.tsx
6
- import Link from "fumadocs-core/link";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- function Cards(props) {
9
- return /* @__PURE__ */ jsx(
10
- "div",
11
- {
12
- ...props,
13
- className: twMerge("grid grid-cols-1 gap-4 sm:grid-cols-2", props.className),
14
- children: props.children
15
- }
16
- );
17
- }
18
- function Card({
19
- icon,
20
- title,
21
- description,
22
- ...props
23
- }) {
24
- const E = props.href ? Link : "div";
25
- return /* @__PURE__ */ jsxs(
26
- E,
27
- {
28
- ...props,
29
- "data-card": true,
30
- className: twMerge(
31
- "block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors",
32
- props.href && "hover:bg-fd-accent/80",
33
- props.className
34
- ),
35
- children: [
36
- icon ? /* @__PURE__ */ jsx("div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon }) : null,
37
- /* @__PURE__ */ jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }),
38
- description ? /* @__PURE__ */ jsx("p", { className: "my-0 text-sm text-fd-muted-foreground", children: description }) : null,
39
- props.children ? /* @__PURE__ */ jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children }) : null
40
- ]
41
- }
42
- );
43
- }
44
-
45
- export {
46
- Cards,
47
- Card
48
- };
@@ -1,82 +0,0 @@
1
- import {
2
- isActive
3
- } from "./chunk-CDPVENXR.js";
4
- import {
5
- Popover,
6
- PopoverContent,
7
- PopoverTrigger
8
- } from "./chunk-IVBHRX3O.js";
9
- import {
10
- ChevronDown
11
- } from "./chunk-VPJMNIJX.js";
12
- import {
13
- twMerge
14
- } from "./chunk-TK3TM3MR.js";
15
- import {
16
- useSidebar
17
- } from "./chunk-27HFSL7N.js";
18
-
19
- // src/components/layout/root-toggle.tsx
20
- import { useMemo, useState } from "react";
21
- import Link from "next/link";
22
- import { usePathname } from "next/navigation";
23
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
- function RootToggle({
25
- options,
26
- ...props
27
- }) {
28
- const [open, setOpen] = useState(false);
29
- const { closeOnRedirect } = useSidebar();
30
- const pathname = usePathname();
31
- const selected = useMemo(() => {
32
- return options.find((item) => isActive(item.url, pathname, true));
33
- }, [options, pathname]);
34
- const onClick = () => {
35
- closeOnRedirect.current = false;
36
- setOpen(false);
37
- };
38
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
39
- /* @__PURE__ */ jsxs(
40
- PopoverTrigger,
41
- {
42
- ...props,
43
- className: twMerge(
44
- "flex flex-row items-center gap-2.5 rounded-lg p-1 hover:bg-fd-accent/50 hover:text-fd-accent-foreground",
45
- props.className
46
- ),
47
- children: [
48
- selected ? /* @__PURE__ */ jsx(Item, { ...selected }) : null,
49
- /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground md:me-1.5" })
50
- ]
51
- }
52
- ),
53
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] overflow-hidden p-0", children: options.map((item) => /* @__PURE__ */ jsx(
54
- Link,
55
- {
56
- href: item.url,
57
- onClick,
58
- ...item.props,
59
- className: twMerge(
60
- "flex w-full flex-row items-center gap-2.5 p-1.5",
61
- selected === item ? "bg-fd-accent text-fd-accent-foreground" : "hover:bg-fd-accent/50",
62
- item.props?.className
63
- ),
64
- children: /* @__PURE__ */ jsx(Item, { ...item })
65
- },
66
- item.url
67
- )) })
68
- ] });
69
- }
70
- function Item(props) {
71
- return /* @__PURE__ */ jsxs(Fragment, { children: [
72
- props.icon,
73
- /* @__PURE__ */ jsxs("div", { className: "flex-1 text-left", children: [
74
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: props.title }),
75
- props.description ? /* @__PURE__ */ jsx("p", { className: "text-xs text-fd-muted-foreground", children: props.description }) : null
76
- ] })
77
- ] });
78
- }
79
-
80
- export {
81
- RootToggle
82
- };
@@ -1,38 +0,0 @@
1
- import {
2
- Link
3
- } from "./chunk-VPJMNIJX.js";
4
- import {
5
- twMerge
6
- } from "./chunk-TK3TM3MR.js";
7
-
8
- // src/components/heading.tsx
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- function Heading({
11
- as,
12
- className,
13
- ...props
14
- }) {
15
- const As = as ?? "h1";
16
- if (!props.id) return /* @__PURE__ */ jsx(As, { className, ...props });
17
- return /* @__PURE__ */ jsxs(
18
- As,
19
- {
20
- className: twMerge("flex scroll-m-28 flex-row items-center gap-2", className),
21
- ...props,
22
- children: [
23
- /* @__PURE__ */ jsx("a", { "data-card": "", href: `#${props.id}`, className: "peer", children: props.children }),
24
- /* @__PURE__ */ jsx(
25
- Link,
26
- {
27
- "aria-label": "Link to section",
28
- className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
29
- }
30
- )
31
- ]
32
- }
33
- );
34
- }
35
-
36
- export {
37
- Heading
38
- };
@@ -1,31 +0,0 @@
1
- import {
2
- twMerge
3
- } from "./chunk-TK3TM3MR.js";
4
-
5
- // src/components/ui/popover.tsx
6
- import * as PopoverPrimitive from "@radix-ui/react-popover";
7
- import * as React from "react";
8
- import { jsx } from "react/jsx-runtime";
9
- var Popover = PopoverPrimitive.Root;
10
- var PopoverTrigger = PopoverPrimitive.Trigger;
11
- var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
12
- PopoverPrimitive.Content,
13
- {
14
- ref,
15
- align,
16
- sideOffset,
17
- side: "bottom",
18
- className: twMerge(
19
- "z-50 min-w-[220px] max-w-[98vw] rounded-lg border bg-fd-popover p-2 text-sm text-fd-popover-foreground shadow-md focus-visible:outline-none data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in",
20
- className
21
- ),
22
- ...props
23
- }
24
- ) }));
25
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
26
-
27
- export {
28
- Popover,
29
- PopoverTrigger,
30
- PopoverContent
31
- };