fumadocs-ui 12.4.2 → 12.5.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 (44) hide show
  1. package/dist/{chunk-NZA3MCPM.js → chunk-AAS47F5B.js} +65 -145
  2. package/dist/{docs.client.js → chunk-CIVJB4ZT.js} +20 -179
  3. package/dist/chunk-FMI5QZTV.js +21 -0
  4. package/dist/{chunk-BZ53GHJX.js → chunk-INUQLSIT.js} +66 -18
  5. package/dist/{chunk-KH555T4I.js → chunk-QQAMPLSA.js} +1 -1
  6. package/dist/{chunk-NUPTR2L5.js → chunk-QZBW7643.js} +6 -10
  7. package/dist/chunk-V7IGWU5C.js +13 -0
  8. package/dist/{chunk-6JD7NGHG.js → chunk-YKLVLKDA.js} +4 -6
  9. package/dist/{chunk-VUIQ7ZYI.js → chunk-YSCK5YFO.js} +1 -0
  10. package/dist/{chunk-3F57TIUQ.js → chunk-YXSAWF3G.js} +9 -6
  11. package/dist/chunk-ZMEQF77D.js +89 -0
  12. package/dist/components/accordion.js +2 -2
  13. package/dist/components/api.d.ts +16 -2
  14. package/dist/components/api.js +19 -6
  15. package/dist/components/banner.js +1 -1
  16. package/dist/components/codeblock.js +2 -2
  17. package/dist/components/dialog/search-algolia.d.ts +10 -2
  18. package/dist/components/dialog/search-algolia.js +41 -7
  19. package/dist/components/dialog/search-default.d.ts +6 -2
  20. package/dist/components/dialog/search-default.js +21 -7
  21. package/dist/components/dialog/search.d.ts +16 -5
  22. package/dist/components/dialog/search.js +8 -5
  23. package/dist/components/files.d.ts +1 -0
  24. package/dist/components/layout/language-toggle.js +1 -1
  25. package/dist/components/layout/root-toggle.js +11 -4
  26. package/dist/components/roll-button.js +1 -1
  27. package/dist/components/tabs.d.ts +3 -5
  28. package/dist/components/tabs.js +1 -1
  29. package/dist/{docs.client.d.ts → docs-layout.client.d.ts} +4 -5
  30. package/dist/docs-layout.client.js +83 -0
  31. package/dist/dynamic-sidebar-DCHFPBYF.js +123 -0
  32. package/dist/{layout.client.d.ts → home-layout.client.d.ts} +1 -2
  33. package/dist/{layout.client.js → home-layout.client.js} +10 -7
  34. package/dist/home-layout.d.ts +7 -0
  35. package/dist/home-layout.js +29 -0
  36. package/dist/layout.d.ts +29 -3
  37. package/dist/layout.js +17 -22
  38. package/dist/{layout-ZAteQVYk.d.ts → layout.shared-GQuo9xqE.d.ts} +12 -65
  39. package/dist/mdx.client.js +2 -2
  40. package/dist/provider.d.ts +1 -1
  41. package/dist/provider.js +5 -4
  42. package/dist/sidebar-C7MbvaPk.d.ts +39 -0
  43. package/dist/style.css +1 -1
  44. package/package.json +15 -7
@@ -12,6 +12,9 @@ import {
12
12
  import {
13
13
  useI18n
14
14
  } from "./chunk-HLGNIWUN.js";
15
+ import {
16
+ useOnChange
17
+ } from "./chunk-V7IGWU5C.js";
15
18
  import {
16
19
  Collapsible,
17
20
  CollapsibleContent,
@@ -20,106 +23,18 @@ import {
20
23
  import {
21
24
  buttonVariants,
22
25
  itemVariants
23
- } from "./chunk-VUIQ7ZYI.js";
26
+ } from "./chunk-YSCK5YFO.js";
24
27
  import {
25
28
  twMerge
26
29
  } from "./chunk-TK3TM3MR.js";
27
30
 
28
- // src/components/layout/search-toggle.tsx
29
- import { useCallback } from "react";
30
- import { SearchIcon } from "lucide-react";
31
- import { jsx, jsxs } from "react/jsx-runtime";
32
- function SearchToggle(props) {
33
- const { setOpenSearch } = useSearchContext();
34
- return /* @__PURE__ */ jsx(
35
- "button",
36
- {
37
- type: "button",
38
- className: twMerge(
39
- buttonVariants({
40
- size: "icon",
41
- color: "ghost",
42
- className: props.className
43
- })
44
- ),
45
- "aria-label": "Open Search",
46
- onClick: useCallback(() => {
47
- setOpenSearch(true);
48
- }, [setOpenSearch]),
49
- children: /* @__PURE__ */ jsx(SearchIcon, {})
50
- }
51
- );
52
- }
53
- function LargeSearchToggle(props) {
54
- const { hotKey, setOpenSearch } = useSearchContext();
55
- const { text } = useI18n();
56
- return /* @__PURE__ */ jsxs(
57
- "button",
58
- {
59
- type: "button",
60
- ...props,
61
- className: twMerge(
62
- "inline-flex items-center gap-2 rounded-full border bg-secondary/50 p-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
63
- props.className
64
- ),
65
- onClick: useCallback(() => {
66
- setOpenSearch(true);
67
- }, [setOpenSearch]),
68
- children: [
69
- /* @__PURE__ */ jsx(SearchIcon, { className: "ms-1 size-4" }),
70
- text.search,
71
- /* @__PURE__ */ jsx("div", { className: "ms-auto inline-flex gap-0.5", children: hotKey.map((k, i) => /* @__PURE__ */ jsx("kbd", { className: "rounded-md border bg-background px-1.5", children: k.display }, i)) })
72
- ]
73
- }
74
- );
75
- }
76
-
77
- // src/components/layout/nav.tsx
78
- import Link from "fumadocs-core/link";
79
- import {
80
- useEffect,
81
- useState
82
- } from "react";
83
- import { jsx as jsx2 } from "react/jsx-runtime";
84
- function NavBox({
85
- transparentMode = "none",
86
- ...props
87
- }) {
88
- const [transparent, setTransparent] = useState(transparentMode !== "none");
89
- useEffect(() => {
90
- if (transparentMode !== "top") return;
91
- const listener = () => {
92
- setTransparent(window.scrollY < 10);
93
- };
94
- listener();
95
- window.addEventListener("scroll", listener);
96
- return () => {
97
- window.removeEventListener("scroll", listener);
98
- };
99
- }, [transparentMode]);
100
- return /* @__PURE__ */ jsx2(
101
- "header",
102
- {
103
- ...props,
104
- className: twMerge(
105
- "sticky top-0 z-50 border-b transition-colors",
106
- transparent ? "border-transparent" : "border-foreground/10 bg-background/60 backdrop-blur-md",
107
- props.className
108
- )
109
- }
110
- );
111
- }
112
- function Title({ title, url = "/" }) {
113
- return /* @__PURE__ */ jsx2(Link, { href: url, className: "inline-flex items-center gap-2.5 font-semibold", children: title });
114
- }
115
-
116
31
  // src/components/layout/link-item.tsx
117
- import Link2 from "fumadocs-core/link";
32
+ import Link from "fumadocs-core/link";
118
33
  import { ChevronDown } from "lucide-react";
119
34
  import { usePathname } from "next/navigation";
120
35
  import { cva } from "class-variance-authority";
121
- import { useEffect as useEffect2, useState as useState2 } from "react";
122
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
36
+ import { useState } from "react";
37
+ import { jsx, jsxs } from "react/jsx-runtime";
123
38
  var linkItemVariants = cva(
124
39
  "-m-2 inline-flex items-center gap-1 p-2 text-muted-foreground transition-colors [&_svg]:size-4",
125
40
  {
@@ -144,7 +59,7 @@ function LinkItem({
144
59
  if (item.on && item.on !== "all" && item.on !== on) return null;
145
60
  if (item.type === "custom") return item.children;
146
61
  if (item.type === "menu" && on === "nav") {
147
- return /* @__PURE__ */ jsxs2(
62
+ return /* @__PURE__ */ jsxs(
148
63
  LinksMenu,
149
64
  {
150
65
  items: item.items,
@@ -153,14 +68,14 @@ function LinkItem({
153
68
  children: [
154
69
  item.icon,
155
70
  item.text,
156
- /* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto !size-3.5" })
71
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto !size-3.5" })
157
72
  ]
158
73
  }
159
74
  );
160
75
  }
161
76
  if (item.type === "menu") {
162
- return /* @__PURE__ */ jsxs2(Collapsible, { className: "flex flex-col", children: [
163
- /* @__PURE__ */ jsxs2(
77
+ return /* @__PURE__ */ jsxs(Collapsible, { className: "flex flex-col", children: [
78
+ /* @__PURE__ */ jsxs(
164
79
  CollapsibleTrigger,
165
80
  {
166
81
  className: twMerge(itemVariants({ className }), "group/link"),
@@ -168,16 +83,16 @@ function LinkItem({
168
83
  children: [
169
84
  item.icon,
170
85
  item.text,
171
- /* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto transition-transform group-data-[state=closed]/link:-rotate-90" })
86
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto transition-transform group-data-[state=closed]/link:-rotate-90" })
172
87
  ]
173
88
  }
174
89
  ),
175
- /* @__PURE__ */ jsx3(CollapsibleContent, { children: /* @__PURE__ */ jsx3("div", { className: "ms-2 flex flex-col border-s py-2 ps-2", children: item.items.map((child, i) => /* @__PURE__ */ jsx3(LinkItem, { item: child, on: "menu" }, i)) }) })
90
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ms-2 flex flex-col border-s py-2 ps-2", children: item.items.map((child, i) => /* @__PURE__ */ jsx(LinkItem, { item: child, on: "menu" }, i)) }) })
176
91
  ] });
177
92
  }
178
93
  if (item.type === "button") {
179
- return /* @__PURE__ */ jsxs2(
180
- Link2,
94
+ return /* @__PURE__ */ jsxs(
95
+ Link,
181
96
  {
182
97
  href: item.url,
183
98
  external: item.external,
@@ -196,8 +111,8 @@ function LinkItem({
196
111
  const activeType = item.active ?? "url";
197
112
  const active = activeType !== "none" && isActive(item.url, pathname, activeType === "nested-url");
198
113
  if ((item.type === "secondary" || item.type === "icon") && on === "nav") {
199
- return /* @__PURE__ */ jsx3(
200
- Link2,
114
+ return /* @__PURE__ */ jsx(
115
+ Link,
201
116
  {
202
117
  "aria-label": item.label,
203
118
  href: item.url,
@@ -214,8 +129,8 @@ function LinkItem({
214
129
  }
215
130
  );
216
131
  }
217
- return /* @__PURE__ */ jsxs2(
218
- Link2,
132
+ return /* @__PURE__ */ jsxs(
133
+ Link,
219
134
  {
220
135
  href: item.url,
221
136
  external: item.external,
@@ -238,67 +153,72 @@ function LinksMenu({
238
153
  footer,
239
154
  ...props
240
155
  }) {
241
- const [open, setOpen] = useState2(false);
156
+ const [open, setOpen] = useState(false);
242
157
  const pathname = usePathname();
243
- useEffect2(() => {
158
+ useOnChange(pathname, () => {
244
159
  setOpen(false);
245
- }, [pathname]);
246
- return /* @__PURE__ */ jsxs2(Popover, { open, onOpenChange: setOpen, children: [
247
- /* @__PURE__ */ jsx3(PopoverTrigger, { ...props }),
248
- /* @__PURE__ */ jsxs2(PopoverContent, { className: "flex flex-col", children: [
249
- items.map((item, i) => /* @__PURE__ */ jsx3(LinkItem, { item, on: "menu" }, i)),
160
+ });
161
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
162
+ /* @__PURE__ */ jsx(PopoverTrigger, { ...props }),
163
+ /* @__PURE__ */ jsxs(PopoverContent, { className: "flex flex-col", children: [
164
+ items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)),
250
165
  footer
251
166
  ] })
252
167
  ] });
253
168
  }
254
169
 
255
- // src/components/layout/theme-toggle.tsx
256
- import { cva as cva2 } from "class-variance-authority";
257
- import { Moon, Sun } from "lucide-react";
258
- import { useTheme } from "next-themes";
259
- import { useCallback as useCallback2 } from "react";
260
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
261
- var buttonVariants2 = cva2("size-7 rounded-full p-1.5 text-muted-foreground", {
262
- variants: {
263
- dark: {
264
- true: "dark:bg-accent dark:text-accent-foreground",
265
- false: "bg-accent text-accent-foreground dark:bg-transparent dark:text-muted-foreground"
266
- }
267
- }
268
- });
269
- function ThemeToggle({
270
- className,
271
- ...props
272
- }) {
273
- const { setTheme, resolvedTheme } = useTheme();
274
- const onToggle = useCallback2(() => {
275
- setTheme(resolvedTheme === "dark" ? "light" : "dark");
276
- }, [setTheme, resolvedTheme]);
277
- return /* @__PURE__ */ jsxs3(
170
+ // src/components/layout/search-toggle.tsx
171
+ import { useCallback } from "react";
172
+ import { SearchIcon } from "lucide-react";
173
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
174
+ function SearchToggle(props) {
175
+ const { setOpenSearch } = useSearchContext();
176
+ return /* @__PURE__ */ jsx2(
278
177
  "button",
279
178
  {
280
179
  type: "button",
281
180
  className: twMerge(
282
- "inline-flex items-center rounded-full border p-0.5",
283
- className
181
+ buttonVariants({
182
+ size: "icon",
183
+ color: "ghost",
184
+ className: props.className
185
+ })
284
186
  ),
285
- "aria-label": "Toggle Theme",
286
- onClick: onToggle,
187
+ "aria-label": "Open Search",
188
+ onClick: useCallback(() => {
189
+ setOpenSearch(true);
190
+ }, [setOpenSearch]),
191
+ children: /* @__PURE__ */ jsx2(SearchIcon, {})
192
+ }
193
+ );
194
+ }
195
+ function LargeSearchToggle(props) {
196
+ const { hotKey, setOpenSearch } = useSearchContext();
197
+ const { text } = useI18n();
198
+ return /* @__PURE__ */ jsxs2(
199
+ "button",
200
+ {
201
+ type: "button",
287
202
  ...props,
203
+ className: twMerge(
204
+ "inline-flex items-center gap-2 rounded-full border bg-secondary/50 p-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
205
+ props.className
206
+ ),
207
+ onClick: useCallback(() => {
208
+ setOpenSearch(true);
209
+ }, [setOpenSearch]),
288
210
  children: [
289
- /* @__PURE__ */ jsx4(Sun, { className: twMerge(buttonVariants2({ dark: false })) }),
290
- /* @__PURE__ */ jsx4(Moon, { className: twMerge(buttonVariants2({ dark: true })) })
211
+ /* @__PURE__ */ jsx2(SearchIcon, { className: "ms-1 size-4" }),
212
+ text.search,
213
+ /* @__PURE__ */ jsx2("div", { className: "ms-auto inline-flex gap-0.5", children: hotKey.map((k, i) => /* @__PURE__ */ jsx2("kbd", { className: "rounded-md border bg-background px-1.5", children: k.display }, i)) })
291
214
  ]
292
215
  }
293
216
  );
294
217
  }
295
218
 
296
219
  export {
297
- SearchToggle,
298
- LargeSearchToggle,
299
- NavBox,
300
- Title,
301
220
  LinkItem,
302
221
  LinksMenu,
303
- ThemeToggle
222
+ SearchToggle,
223
+ LargeSearchToggle
304
224
  };
@@ -1,50 +1,35 @@
1
- "use client";
2
1
  import {
3
2
  LargeSearchToggle,
4
- LinkItem,
5
- LinksMenu,
6
- NavBox,
7
- SearchToggle,
8
- ThemeToggle,
9
- Title
10
- } from "./chunk-NZA3MCPM.js";
3
+ LinkItem
4
+ } from "./chunk-AAS47F5B.js";
11
5
  import {
12
6
  ScrollArea,
13
7
  ScrollViewport
14
8
  } from "./chunk-VYTHQTZE.js";
15
- import "./chunk-GHKJ6EFT.js";
16
9
  import {
17
- TreeContextProvider,
18
10
  useTreeContext
19
11
  } from "./chunk-R3M2OC5U.js";
20
12
  import {
21
13
  hasActive,
22
14
  isActive
23
15
  } from "./chunk-IIDV3RNQ.js";
24
- import {
25
- useSidebar
26
- } from "./chunk-3F57TIUQ.js";
27
16
  import {
28
17
  useSearchContext
29
18
  } from "./chunk-ET4TW6M5.js";
30
- import "./chunk-HLGNIWUN.js";
19
+ import {
20
+ useOnChange
21
+ } from "./chunk-V7IGWU5C.js";
31
22
  import {
32
23
  Collapsible,
33
24
  CollapsibleContent,
34
25
  CollapsibleTrigger
35
26
  } from "./chunk-7XPZOMJ2.js";
36
27
  import {
37
- buttonVariants,
38
28
  itemVariants
39
- } from "./chunk-VUIQ7ZYI.js";
29
+ } from "./chunk-YSCK5YFO.js";
40
30
  import {
41
31
  twMerge
42
32
  } from "./chunk-TK3TM3MR.js";
43
- import "./chunk-MLKGABMK.js";
44
-
45
- // src/docs.client.tsx
46
- import { SidebarTrigger } from "fumadocs-core/sidebar";
47
- import { Menu, X } from "lucide-react";
48
33
 
49
34
  // src/components/layout/sidebar.tsx
50
35
  import { ChevronDown, ExternalLinkIcon } from "lucide-react";
@@ -54,7 +39,6 @@ import {
54
39
  createContext,
55
40
  useCallback,
56
41
  useContext,
57
- useEffect,
58
42
  useMemo,
59
43
  useState
60
44
  } from "react";
@@ -168,7 +152,6 @@ function PageNode({
168
152
  item: { icon, external = false, url, name }
169
153
  }) {
170
154
  const pathname = usePathname();
171
- const { closeOnRedirect } = useSidebar();
172
155
  const active = isActive(url, pathname, false);
173
156
  return /* @__PURE__ */ jsxs(
174
157
  Link,
@@ -176,9 +159,6 @@ function PageNode({
176
159
  href: url,
177
160
  external,
178
161
  className: twMerge(itemVariants({ active })),
179
- onClick: useCallback(() => {
180
- closeOnRedirect.current = !active;
181
- }, [closeOnRedirect, active]),
182
162
  children: [
183
163
  icon ?? (external ? /* @__PURE__ */ jsx(ExternalLinkIcon, {}) : null),
184
164
  name
@@ -191,7 +171,6 @@ function FolderNode({
191
171
  level
192
172
  }) {
193
173
  const { defaultOpenLevel } = useContext(Context);
194
- const { closeOnRedirect } = useSidebar();
195
174
  const pathname = usePathname();
196
175
  const active = index !== void 0 && isActive(index.url, pathname, false);
197
176
  const childActive = useMemo(
@@ -199,20 +178,21 @@ function FolderNode({
199
178
  [children, pathname]
200
179
  );
201
180
  const shouldExtend = active || childActive || defaultOpenLevel >= level || defaultOpen;
202
- const [extend, setExtend] = useState(shouldExtend);
203
- useEffect(() => {
204
- if (shouldExtend) setExtend(true);
205
- }, [shouldExtend]);
181
+ const [open, setOpen] = useState(shouldExtend);
182
+ useOnChange(shouldExtend, (v) => {
183
+ if (v) setOpen(v);
184
+ });
206
185
  const onClick = useCallback(
207
186
  (e) => {
208
- if (e.target !== e.currentTarget || active) {
209
- setExtend((prev) => !prev);
187
+ if (
188
+ // clicking on icon
189
+ e.target.hasAttribute("data-icon") || active
190
+ ) {
191
+ setOpen((prev) => !prev);
210
192
  e.preventDefault();
211
- } else {
212
- closeOnRedirect.current = !active;
213
193
  }
214
194
  },
215
- [closeOnRedirect, active]
195
+ [active]
216
196
  );
217
197
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
218
198
  icon,
@@ -220,11 +200,12 @@ function FolderNode({
220
200
  /* @__PURE__ */ jsx(
221
201
  ChevronDown,
222
202
  {
223
- className: twMerge("ms-auto transition-transform", !extend && "-rotate-90")
203
+ "data-icon": true,
204
+ className: twMerge("ms-auto transition-transform", !open && "-rotate-90")
224
205
  }
225
206
  )
226
207
  ] });
227
- return /* @__PURE__ */ jsxs(Collapsible, { open: extend, onOpenChange: setExtend, children: [
208
+ return /* @__PURE__ */ jsxs(Collapsible, { open, onOpenChange: setOpen, children: [
228
209
  index ? /* @__PURE__ */ jsx(
229
210
  Link,
230
211
  {
@@ -250,146 +231,6 @@ function SeparatorNode({
250
231
  return /* @__PURE__ */ jsx("p", { className: "mb-2 mt-8 px-2 font-medium first:mt-0", children: item.name });
251
232
  }
252
233
 
253
- // src/components/layout/dynamic-sidebar.tsx
254
- import { useCallback as useCallback2, useRef, useState as useState2 } from "react";
255
- import { SidebarIcon } from "lucide-react";
256
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
257
- function DynamicSidebar(props) {
258
- const { collapsed, setCollapsed } = useSidebar();
259
- const [hover, setHover] = useState2(false);
260
- const timerRef = useRef(0);
261
- const closeTimeRef = useRef(0);
262
- const onCollapse = useCallback2(() => {
263
- setCollapsed((v) => !v);
264
- setHover(false);
265
- closeTimeRef.current = Date.now() + 150;
266
- }, [setCollapsed]);
267
- const onEnter = useCallback2((e) => {
268
- if (e.pointerType === "touch" || closeTimeRef.current > Date.now()) return;
269
- window.clearTimeout(timerRef.current);
270
- setHover(true);
271
- }, []);
272
- const onLeave = useCallback2((e) => {
273
- if (e.pointerType === "touch") return;
274
- window.clearTimeout(timerRef.current);
275
- timerRef.current = window.setTimeout(
276
- () => {
277
- setHover(false);
278
- closeTimeRef.current = Date.now() + 150;
279
- },
280
- Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500
281
- );
282
- }, []);
283
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
284
- collapsed ? /* @__PURE__ */ jsx2(
285
- "div",
286
- {
287
- className: "fixed inset-y-0 start-0 w-6 max-md:hidden xl:w-[50px]",
288
- onPointerEnter: onEnter,
289
- onPointerLeave: onLeave
290
- }
291
- ) : null,
292
- collapsed ? /* @__PURE__ */ jsx2(
293
- "button",
294
- {
295
- type: "button",
296
- "aria-label": "Collapse Sidebar",
297
- className: twMerge(
298
- buttonVariants({
299
- color: "secondary",
300
- size: "icon",
301
- className: "fixed start-4 bottom-2 z-10 max-md:hidden"
302
- })
303
- ),
304
- onClick: onCollapse,
305
- children: /* @__PURE__ */ jsx2(SidebarIcon, {})
306
- }
307
- ) : null,
308
- /* @__PURE__ */ jsx2(
309
- Sidebar,
310
- {
311
- ...props,
312
- aside: {
313
- "data-collapse": collapsed,
314
- "data-hover": hover,
315
- onPointerEnter: onEnter,
316
- onPointerLeave: onLeave,
317
- "aria-hidden": Boolean(collapsed && !hover),
318
- className: twMerge(
319
- "md:transition-[transform,margin]",
320
- collapsed && [
321
- "md:top-1 md:mr-[-240px] md:h-[calc(100dvh-4px)] md:animate-sidebar-collapse md:rounded-xl md:border md:shadow-md xl:mr-[-260px]",
322
- hover ? "md:translate-x-1 rtl:md:-translate-x-1" : "md:-translate-x-full rtl:md:translate-x-full"
323
- ]
324
- )
325
- },
326
- footer: /* @__PURE__ */ jsxs2(Fragment2, { children: [
327
- props.footer,
328
- /* @__PURE__ */ jsx2(
329
- "button",
330
- {
331
- type: "button",
332
- "aria-label": "Collapse Sidebar",
333
- className: twMerge(
334
- buttonVariants({
335
- color: "ghost",
336
- size: "icon",
337
- className: "max-md:hidden"
338
- })
339
- ),
340
- onClick: onCollapse,
341
- children: /* @__PURE__ */ jsx2(SidebarIcon, {})
342
- }
343
- )
344
- ] })
345
- }
346
- )
347
- ] });
348
- }
349
-
350
- // src/docs.client.tsx
351
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
352
- function SubNav({
353
- title,
354
- url,
355
- transparentMode,
356
- children,
357
- enableSearch = true
358
- }) {
359
- const { open } = useSidebar();
360
- const { enabled } = useSearchContext();
361
- return /* @__PURE__ */ jsxs3(
362
- NavBox,
363
- {
364
- id: "nd-subnav",
365
- className: "flex h-14 flex-row items-center px-4 md:hidden",
366
- transparentMode,
367
- children: [
368
- /* @__PURE__ */ jsx3(Title, { url, title }),
369
- /* @__PURE__ */ jsx3("div", { className: "flex flex-1 flex-row items-center", children }),
370
- enabled && enableSearch ? /* @__PURE__ */ jsx3(SearchToggle, {}) : null,
371
- /* @__PURE__ */ jsx3(
372
- SidebarTrigger,
373
- {
374
- className: twMerge(
375
- buttonVariants({
376
- color: "ghost",
377
- size: "icon",
378
- className: "-me-2"
379
- })
380
- ),
381
- children: open ? /* @__PURE__ */ jsx3(X, {}) : /* @__PURE__ */ jsx3(Menu, {})
382
- }
383
- )
384
- ]
385
- }
386
- );
387
- }
388
234
  export {
389
- DynamicSidebar,
390
- LinksMenu,
391
- Sidebar,
392
- SubNav,
393
- ThemeToggle,
394
- TreeContextProvider
235
+ Sidebar
395
236
  };
@@ -0,0 +1,21 @@
1
+ // src/layout.shared.tsx
2
+ import { jsx } from "react/jsx-runtime";
3
+ function getLinks(links, githubUrl) {
4
+ let result = links ?? [];
5
+ if (githubUrl)
6
+ result = [
7
+ ...result,
8
+ {
9
+ type: "secondary",
10
+ url: githubUrl,
11
+ text: "Github",
12
+ 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" }) }),
13
+ external: true
14
+ }
15
+ ];
16
+ return result;
17
+ }
18
+
19
+ export {
20
+ getLinks
21
+ };