fumadocs-ui 13.4.4 → 13.4.6
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.
- package/dist/{chunk-N47AX4K6.js → chunk-KCZRDPB4.js} +145 -61
- package/dist/chunk-NSEJBI4V.js +56 -0
- package/dist/{chunk-YIMLV5JM.js → chunk-YIOV4KEY.js} +27 -7
- package/dist/components/banner.d.ts +8 -1
- package/dist/components/banner.js +16 -10
- package/dist/components/dialog/search-algolia.js +2 -1
- package/dist/components/dialog/search-default.js +2 -1
- package/dist/components/dialog/search.d.ts +3 -1
- package/dist/components/dialog/search.js +1 -1
- package/dist/components/layout/language-toggle.js +6 -51
- package/dist/docs-layout.client.d.ts +9 -4
- package/dist/docs-layout.client.js +325 -24
- package/dist/{edit-on-github-FSFN5H36.js → edit-on-github-YFVYCMB7.js} +2 -1
- package/dist/home-layout.client.d.ts +3 -2
- package/dist/home-layout.client.js +17 -9
- package/dist/home-layout.d.ts +2 -2
- package/dist/home-layout.js +2 -1
- package/dist/layout.d.ts +3 -9
- package/dist/layout.js +2 -11
- package/dist/{layout.shared-C5L62VPM.d.ts → layout.shared-DEQFTB9M.d.ts} +6 -0
- package/dist/page.js +2 -1
- package/dist/{sidebar-BguPKq_K.d.ts → sidebar-DwBSl7jC.d.ts} +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.js +0 -1
- package/package.json +6 -6
- package/dist/chunk-J5B4GINE.js +0 -90
- package/dist/chunk-VTGJREY6.js +0 -237
- package/dist/dynamic-sidebar-JFB3Z7SK.js +0 -106
|
@@ -25,14 +25,104 @@ import {
|
|
|
25
25
|
twMerge
|
|
26
26
|
} from "./chunk-TK3TM3MR.js";
|
|
27
27
|
|
|
28
|
-
// src/components/layout/
|
|
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
|
+
"data-search": "",
|
|
46
|
+
"aria-label": "Open Search",
|
|
47
|
+
onClick: useCallback(() => {
|
|
48
|
+
setOpenSearch(true);
|
|
49
|
+
}, [setOpenSearch]),
|
|
50
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function LargeSearchToggle(props) {
|
|
55
|
+
const { hotKey, setOpenSearch } = useSearchContext();
|
|
56
|
+
const { text } = useI18n();
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
"data-search-full": "",
|
|
62
|
+
...props,
|
|
63
|
+
className: twMerge(
|
|
64
|
+
"inline-flex items-center gap-2 rounded-full border bg-fd-secondary/50 p-1.5 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground",
|
|
65
|
+
props.className
|
|
66
|
+
),
|
|
67
|
+
onClick: useCallback(() => {
|
|
68
|
+
setOpenSearch(true);
|
|
69
|
+
}, [setOpenSearch]),
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(SearchIcon, { className: "ms-1 size-4" }),
|
|
72
|
+
text.search,
|
|
73
|
+
/* @__PURE__ */ jsx("div", { className: "ms-auto inline-flex gap-0.5", children: hotKey.map((k, i) => /* @__PURE__ */ jsx("kbd", { className: "rounded-md border bg-fd-background px-1.5", children: k.display }, i)) })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/components/layout/nav.tsx
|
|
29
80
|
import Link from "fumadocs-core/link";
|
|
81
|
+
import {
|
|
82
|
+
useEffect,
|
|
83
|
+
useState
|
|
84
|
+
} from "react";
|
|
85
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
86
|
+
function NavBox({
|
|
87
|
+
transparentMode = "none",
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
const [transparent, setTransparent] = useState(transparentMode !== "none");
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (transparentMode !== "top") return;
|
|
93
|
+
const listener = () => {
|
|
94
|
+
setTransparent(window.scrollY < 10);
|
|
95
|
+
};
|
|
96
|
+
listener();
|
|
97
|
+
window.addEventListener("scroll", listener);
|
|
98
|
+
return () => {
|
|
99
|
+
window.removeEventListener("scroll", listener);
|
|
100
|
+
};
|
|
101
|
+
}, [transparentMode]);
|
|
102
|
+
return /* @__PURE__ */ jsx2(
|
|
103
|
+
"header",
|
|
104
|
+
{
|
|
105
|
+
...props,
|
|
106
|
+
className: twMerge(
|
|
107
|
+
"sticky top-0 z-40 border-b transition-colors",
|
|
108
|
+
transparent ? "border-transparent" : "border-fd-foreground/10 bg-fd-background/60 backdrop-blur-md",
|
|
109
|
+
props.className
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function Title({ title, url = "/" }) {
|
|
115
|
+
return /* @__PURE__ */ jsx2(Link, { href: url, className: "inline-flex items-center gap-2 font-semibold", children: title });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/components/layout/link-item.tsx
|
|
119
|
+
import Link2 from "fumadocs-core/link";
|
|
30
120
|
import { ChevronDown } from "lucide-react";
|
|
31
121
|
import { usePathname } from "next/navigation";
|
|
32
122
|
import { cva } from "class-variance-authority";
|
|
33
|
-
import { useState } from "react";
|
|
123
|
+
import { useState as useState2 } from "react";
|
|
34
124
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
35
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
125
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
36
126
|
var linkItemVariants = cva(
|
|
37
127
|
"-m-2 inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors [&_svg]:size-4",
|
|
38
128
|
{
|
|
@@ -57,7 +147,7 @@ function LinkItem({
|
|
|
57
147
|
if (item.on && item.on !== "all" && item.on !== on) return null;
|
|
58
148
|
if (item.type === "custom") return item.children;
|
|
59
149
|
if (item.type === "menu" && on === "nav") {
|
|
60
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ jsxs2(
|
|
61
151
|
LinksMenu,
|
|
62
152
|
{
|
|
63
153
|
items: item.items,
|
|
@@ -66,14 +156,14 @@ function LinkItem({
|
|
|
66
156
|
children: [
|
|
67
157
|
item.icon,
|
|
68
158
|
item.text,
|
|
69
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto !size-3.5" })
|
|
70
160
|
]
|
|
71
161
|
}
|
|
72
162
|
);
|
|
73
163
|
}
|
|
74
164
|
if (item.type === "menu") {
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ jsxs2(Collapsible, { className: "flex flex-col", children: [
|
|
166
|
+
/* @__PURE__ */ jsxs2(
|
|
77
167
|
CollapsibleTrigger,
|
|
78
168
|
{
|
|
79
169
|
className: twMerge(itemVariants({ className }), "group/link"),
|
|
@@ -81,16 +171,16 @@ function LinkItem({
|
|
|
81
171
|
children: [
|
|
82
172
|
item.icon,
|
|
83
173
|
item.text,
|
|
84
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto transition-transform group-data-[state=closed]/link:-rotate-90" })
|
|
85
175
|
]
|
|
86
176
|
}
|
|
87
177
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__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)) }) })
|
|
89
179
|
] });
|
|
90
180
|
}
|
|
91
181
|
if (item.type === "button") {
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
|
|
182
|
+
return /* @__PURE__ */ jsxs2(
|
|
183
|
+
Link2,
|
|
94
184
|
{
|
|
95
185
|
href: item.url,
|
|
96
186
|
external: item.external,
|
|
@@ -109,8 +199,8 @@ function LinkItem({
|
|
|
109
199
|
const activeType = item.active ?? "url";
|
|
110
200
|
const active = activeType !== "none" && isActive(item.url, pathname, activeType === "nested-url");
|
|
111
201
|
if (item.type === "icon" && on === "nav") {
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
|
|
202
|
+
return /* @__PURE__ */ jsx3(
|
|
203
|
+
Link2,
|
|
114
204
|
{
|
|
115
205
|
"aria-label": item.label,
|
|
116
206
|
href: item.url,
|
|
@@ -127,8 +217,8 @@ function LinkItem({
|
|
|
127
217
|
}
|
|
128
218
|
);
|
|
129
219
|
}
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
-
|
|
220
|
+
return /* @__PURE__ */ jsxs2(
|
|
221
|
+
Link2,
|
|
132
222
|
{
|
|
133
223
|
href: item.url,
|
|
134
224
|
external: item.external,
|
|
@@ -151,74 +241,68 @@ function LinksMenu({
|
|
|
151
241
|
footer,
|
|
152
242
|
...props
|
|
153
243
|
}) {
|
|
154
|
-
const [open, setOpen] =
|
|
244
|
+
const [open, setOpen] = useState2(false);
|
|
155
245
|
const pathname = usePathname();
|
|
156
246
|
useOnChange(pathname, () => {
|
|
157
247
|
setOpen(false);
|
|
158
248
|
});
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
items.map((item, i) => /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ jsxs2(Popover, { open, onOpenChange: setOpen, children: [
|
|
250
|
+
/* @__PURE__ */ jsx3(PopoverTrigger, { ...props }),
|
|
251
|
+
/* @__PURE__ */ jsxs2(PopoverContent, { className: "flex flex-col", children: [
|
|
252
|
+
items.map((item, i) => /* @__PURE__ */ jsx3(LinkItem, { item, on: "menu" }, i)),
|
|
163
253
|
footer
|
|
164
254
|
] })
|
|
165
255
|
] });
|
|
166
256
|
}
|
|
167
257
|
|
|
168
|
-
// src/components/layout/
|
|
169
|
-
import {
|
|
170
|
-
import {
|
|
171
|
-
import {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
buttonVariants({
|
|
180
|
-
size: "icon",
|
|
181
|
-
color: "ghost",
|
|
182
|
-
className: props.className
|
|
183
|
-
})
|
|
184
|
-
),
|
|
185
|
-
"data-search": "",
|
|
186
|
-
"aria-label": "Open Search",
|
|
187
|
-
onClick: useCallback(() => {
|
|
188
|
-
setOpenSearch(true);
|
|
189
|
-
}, [setOpenSearch]),
|
|
190
|
-
children: /* @__PURE__ */ jsx2(SearchIcon, {})
|
|
258
|
+
// src/components/layout/theme-toggle.tsx
|
|
259
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
260
|
+
import { Moon, Sun } from "lucide-react";
|
|
261
|
+
import { useTheme } from "next-themes";
|
|
262
|
+
import { useCallback as useCallback2 } from "react";
|
|
263
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
|
+
var buttonVariants2 = cva2("size-6 rounded-full p-1 text-fd-muted-foreground", {
|
|
265
|
+
variants: {
|
|
266
|
+
dark: {
|
|
267
|
+
true: "dark:bg-fd-accent dark:text-fd-accent-foreground",
|
|
268
|
+
false: "bg-fd-accent text-fd-accent-foreground dark:bg-transparent dark:text-fd-muted-foreground"
|
|
191
269
|
}
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
function ThemeToggle({
|
|
273
|
+
className,
|
|
274
|
+
...props
|
|
275
|
+
}) {
|
|
276
|
+
const { setTheme, resolvedTheme } = useTheme();
|
|
277
|
+
const onToggle = useCallback2(() => {
|
|
278
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
279
|
+
}, [setTheme, resolvedTheme]);
|
|
280
|
+
return /* @__PURE__ */ jsxs3(
|
|
198
281
|
"button",
|
|
199
282
|
{
|
|
200
283
|
type: "button",
|
|
201
|
-
"data-search-full": "",
|
|
202
|
-
...props,
|
|
203
284
|
className: twMerge(
|
|
204
|
-
"inline-flex items-center
|
|
205
|
-
|
|
285
|
+
"inline-flex items-center rounded-full border p-0.5",
|
|
286
|
+
className
|
|
206
287
|
),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
288
|
+
"data-theme-toggle": "",
|
|
289
|
+
"aria-label": "Toggle Theme",
|
|
290
|
+
onClick: onToggle,
|
|
291
|
+
...props,
|
|
210
292
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
|
|
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-fd-background px-1.5", children: k.display }, i)) })
|
|
293
|
+
/* @__PURE__ */ jsx4(Sun, { className: twMerge(buttonVariants2({ dark: false })) }),
|
|
294
|
+
/* @__PURE__ */ jsx4(Moon, { className: twMerge(buttonVariants2({ dark: true })) })
|
|
214
295
|
]
|
|
215
296
|
}
|
|
216
297
|
);
|
|
217
298
|
}
|
|
218
299
|
|
|
219
300
|
export {
|
|
301
|
+
SearchToggle,
|
|
302
|
+
LargeSearchToggle,
|
|
303
|
+
NavBox,
|
|
304
|
+
Title,
|
|
220
305
|
LinkItem,
|
|
221
306
|
LinksMenu,
|
|
222
|
-
|
|
223
|
-
LargeSearchToggle
|
|
307
|
+
ThemeToggle
|
|
224
308
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover,
|
|
3
|
+
PopoverContent,
|
|
4
|
+
PopoverTrigger
|
|
5
|
+
} from "./chunk-CP67AHDD.js";
|
|
6
|
+
import {
|
|
7
|
+
useI18n
|
|
8
|
+
} from "./chunk-EFMHXXHW.js";
|
|
9
|
+
import {
|
|
10
|
+
buttonVariants
|
|
11
|
+
} from "./chunk-EDNTYBXS.js";
|
|
12
|
+
import {
|
|
13
|
+
twMerge
|
|
14
|
+
} from "./chunk-TK3TM3MR.js";
|
|
15
|
+
|
|
16
|
+
// src/components/layout/language-toggle.tsx
|
|
17
|
+
import { useState } from "react";
|
|
18
|
+
import { LanguagesIcon } from "lucide-react";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
function LanguageToggle(props) {
|
|
21
|
+
const context = useI18n();
|
|
22
|
+
const [open, setOpen] = useState(false);
|
|
23
|
+
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
24
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, ...props, children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
PopoverTrigger,
|
|
27
|
+
{
|
|
28
|
+
"aria-label": context.text.chooseLanguage,
|
|
29
|
+
className: twMerge(buttonVariants({ size: "icon", color: "ghost" })),
|
|
30
|
+
children: /* @__PURE__ */ jsx(LanguagesIcon, {})
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex flex-col p-1", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1 p-2 text-xs font-medium text-fd-muted-foreground", children: context.text.chooseLanguage }),
|
|
35
|
+
context.locales.map((item) => /* @__PURE__ */ jsx(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
className: twMerge(
|
|
40
|
+
"rounded-md p-2 text-left text-sm transition-colors duration-100",
|
|
41
|
+
item.locale === context.locale ? "bg-fd-primary/10 font-medium text-fd-primary" : "hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
42
|
+
),
|
|
43
|
+
onClick: () => {
|
|
44
|
+
context.onChange?.(item.locale);
|
|
45
|
+
},
|
|
46
|
+
children: item.name
|
|
47
|
+
},
|
|
48
|
+
item.locale
|
|
49
|
+
))
|
|
50
|
+
] })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
LanguageToggle
|
|
56
|
+
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-TK3TM3MR.js";
|
|
16
16
|
|
|
17
17
|
// src/components/dialog/search.tsx
|
|
18
|
-
import { FileText, Hash, Text } from "lucide-react";
|
|
18
|
+
import { FileText, Hash, Loader2, SearchIcon, Text } from "lucide-react";
|
|
19
19
|
import { useRouter } from "next/navigation";
|
|
20
20
|
import {
|
|
21
21
|
useMemo,
|
|
@@ -25,11 +25,10 @@ import { cva } from "class-variance-authority";
|
|
|
25
25
|
|
|
26
26
|
// src/components/ui/command.tsx
|
|
27
27
|
import { Command as CommandPrimitive } from "cmdk";
|
|
28
|
-
import { Search } from "lucide-react";
|
|
29
28
|
import * as React from "react";
|
|
30
29
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
-
var CommandInput = React.forwardRef(({ className, onClose, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 px-3", children: [
|
|
32
|
-
|
|
30
|
+
var CommandInput = React.forwardRef(({ className, onClose, children, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 px-3", children: [
|
|
31
|
+
children,
|
|
33
32
|
/* @__PURE__ */ jsx(
|
|
34
33
|
CommandPrimitive.Input,
|
|
35
34
|
{
|
|
@@ -156,7 +155,7 @@ function SearchDialog({
|
|
|
156
155
|
);
|
|
157
156
|
return /* @__PURE__ */ jsxs2(CommandDialog, { open, onOpenChange, children: [
|
|
158
157
|
/* @__PURE__ */ jsx2(
|
|
159
|
-
|
|
158
|
+
Search,
|
|
160
159
|
{
|
|
161
160
|
...props,
|
|
162
161
|
items: props.results === "empty" ? defaultItems : props.results,
|
|
@@ -171,10 +170,11 @@ var icons = {
|
|
|
171
170
|
heading: /* @__PURE__ */ jsx2(Hash, {}),
|
|
172
171
|
page: /* @__PURE__ */ jsx2(FileText, {})
|
|
173
172
|
};
|
|
174
|
-
function
|
|
173
|
+
function Search({
|
|
175
174
|
search,
|
|
176
175
|
onSearchChange,
|
|
177
176
|
items,
|
|
177
|
+
isLoading,
|
|
178
178
|
hideResults = false
|
|
179
179
|
}) {
|
|
180
180
|
const { text } = useI18n();
|
|
@@ -197,7 +197,27 @@ function Search2({
|
|
|
197
197
|
onClose: useCallback(() => {
|
|
198
198
|
setOpenSearch(false);
|
|
199
199
|
}, [setOpenSearch]),
|
|
200
|
-
placeholder: text.search
|
|
200
|
+
placeholder: text.search,
|
|
201
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "relative size-4", children: [
|
|
202
|
+
/* @__PURE__ */ jsx2(
|
|
203
|
+
Loader2,
|
|
204
|
+
{
|
|
205
|
+
className: twMerge(
|
|
206
|
+
"absolute size-full animate-spin text-fd-primary transition-opacity",
|
|
207
|
+
!isLoading && "opacity-0"
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ jsx2(
|
|
212
|
+
SearchIcon,
|
|
213
|
+
{
|
|
214
|
+
className: twMerge(
|
|
215
|
+
"absolute size-full text-fd-muted-foreground transition-opacity",
|
|
216
|
+
isLoading && "opacity-0"
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] })
|
|
201
221
|
}
|
|
202
222
|
),
|
|
203
223
|
/* @__PURE__ */ jsxs2(CommandList, { className: twMerge(hideResults && "hidden"), children: [
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
declare function Banner({ id, ...props }: HTMLAttributes<HTMLDivElement>
|
|
3
|
+
declare function Banner({ id, changeLayout, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* Change Fumadocs layout styles
|
|
6
|
+
*
|
|
7
|
+
* @defaultValue true
|
|
8
|
+
*/
|
|
9
|
+
changeLayout?: boolean;
|
|
10
|
+
}): React.ReactElement;
|
|
4
11
|
|
|
5
12
|
export { Banner };
|
|
@@ -13,36 +13,42 @@ import { X } from "lucide-react";
|
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
function Banner({
|
|
15
15
|
id,
|
|
16
|
+
changeLayout = true,
|
|
16
17
|
...props
|
|
17
18
|
}) {
|
|
18
19
|
const [open, setOpen] = useState(true);
|
|
20
|
+
const globalKey = id ? `nd-banner-${id}` : void 0;
|
|
19
21
|
useEffect(() => {
|
|
20
|
-
if (
|
|
21
|
-
}, [
|
|
22
|
+
if (globalKey) setOpen(localStorage.getItem(globalKey) !== "true");
|
|
23
|
+
}, [globalKey]);
|
|
22
24
|
const onClick = useCallback(() => {
|
|
23
25
|
setOpen(false);
|
|
24
|
-
if (
|
|
25
|
-
}, [
|
|
26
|
+
if (globalKey) localStorage.setItem(globalKey, "true");
|
|
27
|
+
}, [globalKey]);
|
|
26
28
|
return /* @__PURE__ */ jsxs(
|
|
27
29
|
"div",
|
|
28
30
|
{
|
|
29
31
|
id,
|
|
30
32
|
...props,
|
|
31
33
|
className: twMerge(
|
|
32
|
-
"
|
|
33
|
-
!open && "hidden",
|
|
34
|
+
"sticky top-0 z-40 flex h-12 flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium",
|
|
34
35
|
props.className
|
|
35
36
|
),
|
|
36
37
|
suppressHydrationWarning: true,
|
|
37
38
|
children: [
|
|
39
|
+
changeLayout && open ? /* @__PURE__ */ jsx("style", { children: `
|
|
40
|
+
.not_${globalKey} #nd-sidebar, .not_${globalKey} #nd-nav, .not_${globalKey} #nd-subnav, .not_${globalKey} [data-toc] { top: 3rem; }
|
|
41
|
+
.not_${globalKey} #nd-tocnav { top: 6.5rem; }
|
|
42
|
+
.not_${globalKey} #nd-sidebar, .not_${globalKey} [data-toc] { height: calc(100dvh - 3rem); }
|
|
43
|
+
` }) : null,
|
|
44
|
+
/* @__PURE__ */ jsx("style", { children: `.${globalKey} #${id} { display: none; }` }),
|
|
38
45
|
id ? /* @__PURE__ */ jsx(
|
|
39
46
|
"script",
|
|
40
47
|
{
|
|
41
48
|
dangerouslySetInnerHTML: {
|
|
42
|
-
__html: `
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}`
|
|
49
|
+
__html: `document.documentElement.classList.add(
|
|
50
|
+
localStorage.getItem('${globalKey}') === 'true'? '${globalKey}' : 'not_${globalKey}'
|
|
51
|
+
)`
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
) : null,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SearchDialog,
|
|
4
4
|
TagsList
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-YIOV4KEY.js";
|
|
6
6
|
import "../../chunk-ET4TW6M5.js";
|
|
7
7
|
import "../../chunk-27HFSL7N.js";
|
|
8
8
|
import "../../chunk-EFMHXXHW.js";
|
|
@@ -43,6 +43,7 @@ function AlgoliaSearchDialog({
|
|
|
43
43
|
search,
|
|
44
44
|
onSearchChange: setSearch,
|
|
45
45
|
results: query.data ?? [],
|
|
46
|
+
isLoading: query.isLoading,
|
|
46
47
|
...props,
|
|
47
48
|
footer: tags ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
49
|
/* @__PURE__ */ jsx(TagsList, { tag, onTagChange: setTag, items: tags, children: showAlgolia ? /* @__PURE__ */ jsx(AlgoliaTitle, {}) : null }),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SearchDialog,
|
|
4
4
|
TagsList
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-YIOV4KEY.js";
|
|
6
6
|
import "../../chunk-ET4TW6M5.js";
|
|
7
7
|
import "../../chunk-27HFSL7N.js";
|
|
8
8
|
import {
|
|
@@ -35,6 +35,7 @@ function DefaultSearchDialog({
|
|
|
35
35
|
{
|
|
36
36
|
search,
|
|
37
37
|
onSearchChange: setSearch,
|
|
38
|
+
isLoading: query.isLoading,
|
|
38
39
|
results: query.data ?? [],
|
|
39
40
|
...props,
|
|
40
41
|
footer: tags ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SortedResult } from 'fumadocs-core/search/shared';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
type SearchLink = [name: string, href: string];
|
|
@@ -17,10 +18,11 @@ interface SearchDialogProps extends SharedProps, Omit<SearchContentProps, 'items
|
|
|
17
18
|
interface SearchContentProps {
|
|
18
19
|
search: string;
|
|
19
20
|
onSearchChange: (v: string) => void;
|
|
21
|
+
isLoading?: boolean;
|
|
20
22
|
items: SortedResult[];
|
|
21
23
|
hideResults?: boolean;
|
|
22
24
|
}
|
|
23
|
-
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps):
|
|
25
|
+
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps): react.ReactElement;
|
|
24
26
|
interface TagItem {
|
|
25
27
|
name: string;
|
|
26
28
|
value: string;
|
|
@@ -1,57 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
} from "../../chunk-EFMHXXHW.js";
|
|
10
|
-
import {
|
|
11
|
-
buttonVariants
|
|
12
|
-
} from "../../chunk-EDNTYBXS.js";
|
|
13
|
-
import {
|
|
14
|
-
twMerge
|
|
15
|
-
} from "../../chunk-TK3TM3MR.js";
|
|
3
|
+
LanguageToggle
|
|
4
|
+
} from "../../chunk-NSEJBI4V.js";
|
|
5
|
+
import "../../chunk-CP67AHDD.js";
|
|
6
|
+
import "../../chunk-EFMHXXHW.js";
|
|
7
|
+
import "../../chunk-EDNTYBXS.js";
|
|
8
|
+
import "../../chunk-TK3TM3MR.js";
|
|
16
9
|
import "../../chunk-MLKGABMK.js";
|
|
17
|
-
|
|
18
|
-
// src/components/layout/language-toggle.tsx
|
|
19
|
-
import { useState } from "react";
|
|
20
|
-
import { LanguagesIcon } from "lucide-react";
|
|
21
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
function LanguageToggle(props) {
|
|
23
|
-
const context = useI18n();
|
|
24
|
-
const [open, setOpen] = useState(false);
|
|
25
|
-
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
26
|
-
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, ...props, children: [
|
|
27
|
-
/* @__PURE__ */ jsx(
|
|
28
|
-
PopoverTrigger,
|
|
29
|
-
{
|
|
30
|
-
"aria-label": context.text.chooseLanguage,
|
|
31
|
-
className: twMerge(buttonVariants({ size: "icon", color: "ghost" })),
|
|
32
|
-
children: /* @__PURE__ */ jsx(LanguagesIcon, {})
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex flex-col p-1", children: [
|
|
36
|
-
/* @__PURE__ */ jsx("p", { className: "mb-1 p-2 text-xs font-medium text-fd-muted-foreground", children: context.text.chooseLanguage }),
|
|
37
|
-
context.locales.map((item) => /* @__PURE__ */ jsx(
|
|
38
|
-
"button",
|
|
39
|
-
{
|
|
40
|
-
type: "button",
|
|
41
|
-
className: twMerge(
|
|
42
|
-
"rounded-md p-2 text-left text-sm transition-colors duration-100",
|
|
43
|
-
item.locale === context.locale ? "bg-fd-primary/10 font-medium text-fd-primary" : "hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
44
|
-
),
|
|
45
|
-
onClick: () => {
|
|
46
|
-
context.onChange?.(item.locale);
|
|
47
|
-
},
|
|
48
|
-
children: item.name
|
|
49
|
-
},
|
|
50
|
-
item.locale
|
|
51
|
-
))
|
|
52
|
-
] })
|
|
53
|
-
] });
|
|
54
|
-
}
|
|
55
10
|
export {
|
|
56
11
|
LanguageToggle
|
|
57
12
|
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { S as SharedNavProps } from './layout.shared-
|
|
2
|
-
export { a as LinksMenu } from './layout.shared-
|
|
3
|
-
|
|
1
|
+
import { S as SharedNavProps } from './layout.shared-DEQFTB9M.js';
|
|
2
|
+
export { a as LinksMenu } from './layout.shared-DEQFTB9M.js';
|
|
3
|
+
import { S as SidebarProps } from './sidebar-DwBSl7jC.js';
|
|
4
|
+
export { a as Sidebar } from './sidebar-DwBSl7jC.js';
|
|
4
5
|
export { T as TreeContextProvider } from './tree-CrKzI9Nz.js';
|
|
5
6
|
import { ButtonHTMLAttributes } from 'react';
|
|
7
|
+
export { LanguageToggle } from './components/layout/language-toggle.js';
|
|
6
8
|
import 'fumadocs-core/server';
|
|
9
|
+
import '@radix-ui/react-popover';
|
|
7
10
|
|
|
8
11
|
declare function ThemeToggle({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): React.ReactElement;
|
|
9
12
|
|
|
13
|
+
declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
|
|
14
|
+
|
|
10
15
|
declare function SubNav({ title, url, transparentMode, children, enableSearch, }: SharedNavProps): React.ReactElement;
|
|
11
16
|
declare function SidebarCollapseTrigger(): React.ReactElement;
|
|
12
17
|
|
|
13
|
-
export { SidebarCollapseTrigger, SubNav, ThemeToggle };
|
|
18
|
+
export { DynamicSidebar, SidebarCollapseTrigger, SubNav, ThemeToggle };
|