fumadocs-ui 12.0.0 → 12.0.2
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-7EMVRXMS.js → chunk-45374JLF.js} +1 -1
- package/dist/{chunk-IOHAG6BY.js → chunk-5CZEA2KX.js} +1 -1
- package/dist/{chunk-XXVXIK4M.js → chunk-E5OQ6FBQ.js} +1 -1
- package/dist/{chunk-CRYPD6UZ.js → chunk-HLGNIWUN.js} +1 -0
- package/dist/{chunk-JQW5DMD2.js → chunk-KOSWCGKQ.js} +96 -61
- package/dist/components/accordion.js +2 -2
- package/dist/components/api.js +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/codeblock.js +1 -1
- package/dist/components/dialog/search-algolia.js +2 -2
- package/dist/components/dialog/search-default.js +2 -2
- package/dist/components/dialog/search.js +2 -2
- package/dist/components/files.js +1 -1
- package/dist/components/heading.js +1 -1
- package/dist/components/layout/language-toggle.js +1 -1
- package/dist/components/layout/root-toggle.js +2 -2
- package/dist/components/roll-button.d.ts +1 -1
- package/dist/components/roll-button.js +22 -9
- package/dist/docs.client.d.ts +8 -2
- package/dist/docs.client.js +26 -16
- package/dist/{i18n-CE8z-AAs.d.ts → i18n-DSnJuWoW.d.ts} +1 -0
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.js +1 -1
- package/dist/layout.client.js +20 -45
- package/dist/layout.js +13 -8
- package/dist/mdx.client.js +1 -1
- package/dist/mdx.js +1 -1
- package/dist/page.client.d.ts +16 -3
- package/dist/page.client.js +87 -34
- package/dist/page.d.ts +5 -14
- package/dist/page.js +21 -13
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.cjs +4 -0
- package/dist/tailwind-plugin.js +4 -0
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ function Heading({
|
|
|
17
17
|
LinkIcon,
|
|
18
18
|
{
|
|
19
19
|
"aria-label": "Link to section",
|
|
20
|
-
className: "
|
|
20
|
+
className: "ms-2 inline size-4 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"
|
|
21
21
|
}
|
|
22
22
|
)
|
|
23
23
|
] }) : props.children });
|
|
@@ -48,7 +48,7 @@ var CodeBlock = forwardRef(
|
|
|
48
48
|
title ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 border-b bg-muted px-4 py-1.5", children: [
|
|
49
49
|
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground [&_svg]:size-3.5", children: icon }),
|
|
50
50
|
/* @__PURE__ */ jsx("figcaption", { className: "flex-1 truncate text-muted-foreground", children: title }),
|
|
51
|
-
allowCopy ? /* @__PURE__ */ jsx(CopyButton, { className: "-
|
|
51
|
+
allowCopy ? /* @__PURE__ */ jsx(CopyButton, { className: "-me-2", onCopy }) : null
|
|
52
52
|
] }) : allowCopy && /* @__PURE__ */ jsx(
|
|
53
53
|
CopyButton,
|
|
54
54
|
{
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-FSPYEOFC.js";
|
|
12
12
|
import {
|
|
13
13
|
useI18n
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HLGNIWUN.js";
|
|
15
15
|
import {
|
|
16
16
|
Collapsible,
|
|
17
17
|
CollapsibleContent,
|
|
@@ -73,60 +73,23 @@ function LargeSearchToggle(props) {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// src/components/layout/
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import { useTheme } from "next-themes";
|
|
80
|
-
import { useCallback as useCallback2 } from "react";
|
|
81
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
82
|
-
var buttonVariants2 = cva("size-7 rounded-full p-1.5 text-muted-foreground", {
|
|
83
|
-
variants: {
|
|
84
|
-
dark: {
|
|
85
|
-
true: "dark:bg-accent dark:text-accent-foreground",
|
|
86
|
-
false: "bg-accent text-accent-foreground dark:bg-transparent dark:text-muted-foreground"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
function ThemeToggle({
|
|
91
|
-
className,
|
|
92
|
-
...props
|
|
93
|
-
}) {
|
|
94
|
-
const { setTheme, resolvedTheme } = useTheme();
|
|
95
|
-
const onToggle = useCallback2(() => {
|
|
96
|
-
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
97
|
-
}, [setTheme, resolvedTheme]);
|
|
98
|
-
return /* @__PURE__ */ jsxs2(
|
|
99
|
-
"button",
|
|
100
|
-
{
|
|
101
|
-
type: "button",
|
|
102
|
-
className: twMerge(
|
|
103
|
-
"inline-flex items-center rounded-full border p-0.5",
|
|
104
|
-
className
|
|
105
|
-
),
|
|
106
|
-
"aria-label": "Toggle Theme",
|
|
107
|
-
onClick: onToggle,
|
|
108
|
-
...props,
|
|
109
|
-
children: [
|
|
110
|
-
/* @__PURE__ */ jsx2(Sun, { className: twMerge(buttonVariants2({ dark: false })) }),
|
|
111
|
-
/* @__PURE__ */ jsx2(Moon, { className: twMerge(buttonVariants2({ dark: true })) })
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
}
|
|
76
|
+
// src/components/layout/links-menu.tsx
|
|
77
|
+
import { useEffect, useState } from "react";
|
|
78
|
+
import { usePathname as usePathname2 } from "next/navigation";
|
|
116
79
|
|
|
117
|
-
// src/components/link-item.tsx
|
|
80
|
+
// src/components/layout/link-item.tsx
|
|
118
81
|
import Link from "fumadocs-core/link";
|
|
119
82
|
import { ChevronDown } from "lucide-react";
|
|
120
83
|
import { usePathname } from "next/navigation";
|
|
121
|
-
import { cva
|
|
122
|
-
import { jsx as
|
|
123
|
-
var linkItemVariants =
|
|
124
|
-
"inline-flex items-center gap-1.5 rounded-lg p-2 text-muted-foreground transition-colors [&_svg]:size-4",
|
|
84
|
+
import { cva } from "class-variance-authority";
|
|
85
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
86
|
+
var linkItemVariants = cva(
|
|
87
|
+
"inline-flex items-center gap-1.5 rounded-lg p-2 text-muted-foreground transition-colors data-[state=open]:bg-accent [&_svg]:size-4",
|
|
125
88
|
{
|
|
126
89
|
variants: {
|
|
127
90
|
active: {
|
|
128
91
|
true: "bg-accent text-accent-foreground",
|
|
129
|
-
false: "hover:bg-accent"
|
|
92
|
+
false: "hover:bg-accent hover:transition-none"
|
|
130
93
|
}
|
|
131
94
|
},
|
|
132
95
|
defaultVariants: {
|
|
@@ -142,27 +105,24 @@ function LinkItem({
|
|
|
142
105
|
}) {
|
|
143
106
|
const pathname = usePathname();
|
|
144
107
|
if (item.type === "menu" && on === "nav") {
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ jsxs2(Popover, { children: [
|
|
109
|
+
/* @__PURE__ */ jsxs2(
|
|
147
110
|
PopoverTrigger,
|
|
148
111
|
{
|
|
149
|
-
className: twMerge(
|
|
150
|
-
linkItemVariants({ className }),
|
|
151
|
-
"data-[state=open]:bg-accent"
|
|
152
|
-
),
|
|
112
|
+
className: twMerge(linkItemVariants({ className })),
|
|
153
113
|
...props,
|
|
154
114
|
children: [
|
|
155
115
|
item.text,
|
|
156
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ jsx2(ChevronDown, { className: "ms-auto size-4" })
|
|
157
117
|
]
|
|
158
118
|
}
|
|
159
119
|
),
|
|
160
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ jsx2(PopoverContent, { className: "flex flex-col", children: item.items.map((child, i) => /* @__PURE__ */ jsx2(LinkItem, { item: child, on: "menu" }, i)) })
|
|
161
121
|
] });
|
|
162
122
|
}
|
|
163
123
|
if (item.type === "menu") {
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ jsxs2(Collapsible, { className: "flex flex-col", children: [
|
|
125
|
+
/* @__PURE__ */ jsxs2(
|
|
166
126
|
CollapsibleTrigger,
|
|
167
127
|
{
|
|
168
128
|
className: twMerge(linkItemVariants({ className }), "group/link"),
|
|
@@ -170,17 +130,17 @@ function LinkItem({
|
|
|
170
130
|
children: [
|
|
171
131
|
item.icon,
|
|
172
132
|
item.text,
|
|
173
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ jsx2(ChevronDown, { className: "ms-auto size-4 group-data-[state=closed]/link:-rotate-90" })
|
|
174
134
|
]
|
|
175
135
|
}
|
|
176
136
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ jsx2(CollapsibleContent, { children: /* @__PURE__ */ jsx2("div", { className: "flex flex-col py-1 ps-4", children: item.items.map((child, i) => /* @__PURE__ */ jsx2(LinkItem, { item: child, on: "menu" }, i)) }) })
|
|
178
138
|
] });
|
|
179
139
|
}
|
|
180
140
|
const activeType = item.active ?? "url";
|
|
181
141
|
const active = activeType !== "none" ? isActive(item.url, pathname, activeType === "nested-url") : false;
|
|
182
142
|
if (item.type === "secondary" && on === "nav") {
|
|
183
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsx2(
|
|
184
144
|
Link,
|
|
185
145
|
{
|
|
186
146
|
"aria-label": item.text,
|
|
@@ -198,7 +158,7 @@ function LinkItem({
|
|
|
198
158
|
}
|
|
199
159
|
);
|
|
200
160
|
}
|
|
201
|
-
return /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ jsxs2(
|
|
202
162
|
Link,
|
|
203
163
|
{
|
|
204
164
|
href: item.url,
|
|
@@ -218,9 +178,84 @@ function LinkItem({
|
|
|
218
178
|
);
|
|
219
179
|
}
|
|
220
180
|
|
|
181
|
+
// src/components/layout/links-menu.tsx
|
|
182
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
183
|
+
function LinksMenu({
|
|
184
|
+
items,
|
|
185
|
+
footer,
|
|
186
|
+
...props
|
|
187
|
+
}) {
|
|
188
|
+
const [open, setOpen] = useState(false);
|
|
189
|
+
const pathname = usePathname2();
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
setOpen(false);
|
|
192
|
+
}, [pathname]);
|
|
193
|
+
return /* @__PURE__ */ jsxs3(Popover, { open, onOpenChange: setOpen, children: [
|
|
194
|
+
/* @__PURE__ */ jsx3(
|
|
195
|
+
PopoverTrigger,
|
|
196
|
+
{
|
|
197
|
+
...props,
|
|
198
|
+
className: twMerge(
|
|
199
|
+
buttonVariants({
|
|
200
|
+
size: "icon",
|
|
201
|
+
color: "ghost",
|
|
202
|
+
className: props.className
|
|
203
|
+
})
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsxs3(PopoverContent, { className: "flex flex-col", children: [
|
|
208
|
+
items.map((item, i) => /* @__PURE__ */ jsx3(LinkItem, { item, on: "menu" }, i)),
|
|
209
|
+
footer
|
|
210
|
+
] })
|
|
211
|
+
] });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/components/layout/theme-toggle.tsx
|
|
215
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
216
|
+
import { Moon, Sun } from "lucide-react";
|
|
217
|
+
import { useTheme } from "next-themes";
|
|
218
|
+
import { useCallback as useCallback2 } from "react";
|
|
219
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
220
|
+
var buttonVariants2 = cva2("size-7 rounded-full p-1.5 text-muted-foreground", {
|
|
221
|
+
variants: {
|
|
222
|
+
dark: {
|
|
223
|
+
true: "dark:bg-accent dark:text-accent-foreground",
|
|
224
|
+
false: "bg-accent text-accent-foreground dark:bg-transparent dark:text-muted-foreground"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
function ThemeToggle({
|
|
229
|
+
className,
|
|
230
|
+
...props
|
|
231
|
+
}) {
|
|
232
|
+
const { setTheme, resolvedTheme } = useTheme();
|
|
233
|
+
const onToggle = useCallback2(() => {
|
|
234
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
235
|
+
}, [setTheme, resolvedTheme]);
|
|
236
|
+
return /* @__PURE__ */ jsxs4(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
className: twMerge(
|
|
241
|
+
"inline-flex items-center rounded-full border p-0.5",
|
|
242
|
+
className
|
|
243
|
+
),
|
|
244
|
+
"aria-label": "Toggle Theme",
|
|
245
|
+
onClick: onToggle,
|
|
246
|
+
...props,
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsx4(Sun, { className: twMerge(buttonVariants2({ dark: false })) }),
|
|
249
|
+
/* @__PURE__ */ jsx4(Moon, { className: twMerge(buttonVariants2({ dark: true })) })
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
221
255
|
export {
|
|
222
256
|
SearchToggle,
|
|
223
257
|
LargeSearchToggle,
|
|
224
258
|
LinkItem,
|
|
259
|
+
LinksMenu,
|
|
225
260
|
ThemeToggle
|
|
226
261
|
};
|
|
@@ -73,7 +73,7 @@ var Accordion = forwardRef(({ title, className, id, children, ...props }, ref) =
|
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
/* @__PURE__ */ jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", children: /* @__PURE__ */ jsx("div", { className: "
|
|
76
|
+
/* @__PURE__ */ jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", children: /* @__PURE__ */ jsx("div", { className: "ms-2 p-4 pt-0 prose-no-margin", children }) })
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
);
|
|
@@ -92,7 +92,7 @@ function CopyButton({ id }) {
|
|
|
92
92
|
className: twMerge(
|
|
93
93
|
buttonVariants({
|
|
94
94
|
color: "ghost",
|
|
95
|
-
className: "text-muted-foreground
|
|
95
|
+
className: "text-muted-foreground me-2"
|
|
96
96
|
})
|
|
97
97
|
),
|
|
98
98
|
onClick,
|
package/dist/components/api.js
CHANGED
|
@@ -79,7 +79,7 @@ function Property({
|
|
|
79
79
|
/* @__PURE__ */ jsx("code", { children: name }),
|
|
80
80
|
required ? /* @__PURE__ */ jsx("div", { className: twMerge(badgeVariants({ color: "red" })), children: "Required" }) : null,
|
|
81
81
|
deprecated ? /* @__PURE__ */ jsx("div", { className: twMerge(badgeVariants({ color: "yellow" })), children: "Deprecated" }) : null,
|
|
82
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "ms-auto font-mono text-[13px] text-muted-foreground", children: type })
|
|
83
83
|
] }),
|
|
84
84
|
children
|
|
85
85
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "
|
|
4
|
+
declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
|
|
5
5
|
title?: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* @defaultValue info
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SearchDialog
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-45374JLF.js";
|
|
5
5
|
import "../../chunk-3F57TIUQ.js";
|
|
6
6
|
import "../../chunk-FSPYEOFC.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-HLGNIWUN.js";
|
|
8
8
|
import "../../chunk-7GZKFBAP.js";
|
|
9
9
|
import "../../chunk-TK3TM3MR.js";
|
|
10
10
|
import "../../chunk-MLKGABMK.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SearchDialog
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-45374JLF.js";
|
|
5
5
|
import "../../chunk-3F57TIUQ.js";
|
|
6
6
|
import "../../chunk-FSPYEOFC.js";
|
|
7
7
|
import {
|
|
8
8
|
useI18n
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-HLGNIWUN.js";
|
|
10
10
|
import "../../chunk-7GZKFBAP.js";
|
|
11
11
|
import "../../chunk-TK3TM3MR.js";
|
|
12
12
|
import "../../chunk-MLKGABMK.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SearchDialog
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-45374JLF.js";
|
|
4
4
|
import "../../chunk-3F57TIUQ.js";
|
|
5
5
|
import "../../chunk-FSPYEOFC.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-HLGNIWUN.js";
|
|
7
7
|
import "../../chunk-7GZKFBAP.js";
|
|
8
8
|
import "../../chunk-TK3TM3MR.js";
|
|
9
9
|
import "../../chunk-MLKGABMK.js";
|
package/dist/components/files.js
CHANGED
|
@@ -52,7 +52,7 @@ function Folder({
|
|
|
52
52
|
open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(FolderIcon, {}),
|
|
53
53
|
name
|
|
54
54
|
] }),
|
|
55
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "
|
|
55
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ms-2 flex flex-col border-l pl-2", children: props.children }) })
|
|
56
56
|
] });
|
|
57
57
|
}
|
|
58
58
|
export {
|
|
@@ -25,9 +25,9 @@ function RootToggle({
|
|
|
25
25
|
const pathname = usePathname();
|
|
26
26
|
const selected = options.find((item) => isActive(item.url, pathname, true)) ?? options[0];
|
|
27
27
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
28
|
-
/* @__PURE__ */ jsxs(PopoverTrigger, { className: "-mx-2 flex flex-row items-center gap-2 rounded-lg p-2 hover:bg-muted", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(PopoverTrigger, { className: "-mx-2 flex flex-row items-center gap-2.5 rounded-lg p-2 hover:bg-muted", children: [
|
|
29
29
|
/* @__PURE__ */ jsx(Item, { ...selected }),
|
|
30
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-muted-foreground" })
|
|
30
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "me-1.5 size-4 text-muted-foreground" })
|
|
31
31
|
] }),
|
|
32
32
|
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] overflow-hidden p-0", children: options.map((item) => /* @__PURE__ */ jsx(
|
|
33
33
|
Link,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useTreeContext
|
|
4
|
+
} from "../chunk-34Z7WODD.js";
|
|
5
|
+
import "../chunk-AN2Y6MA2.js";
|
|
2
6
|
import {
|
|
3
7
|
buttonVariants
|
|
4
8
|
} from "../chunk-7GZKFBAP.js";
|
|
@@ -9,12 +13,19 @@ import "../chunk-MLKGABMK.js";
|
|
|
9
13
|
|
|
10
14
|
// src/components/roll-button.tsx
|
|
11
15
|
import { ChevronUp } from "lucide-react";
|
|
12
|
-
import { useEffect, useState } from "react";
|
|
13
|
-
import {
|
|
16
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
17
|
+
import { usePathname } from "next/navigation";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
19
|
function RollButton({
|
|
15
|
-
percentage = 0.
|
|
20
|
+
percentage = 0.1
|
|
16
21
|
}) {
|
|
17
22
|
const [show, setShow] = useState(false);
|
|
23
|
+
const { navigation } = useTreeContext();
|
|
24
|
+
const pathname = usePathname();
|
|
25
|
+
const current = useMemo(
|
|
26
|
+
() => navigation.find((item) => item.url === pathname),
|
|
27
|
+
[pathname, navigation]
|
|
28
|
+
);
|
|
18
29
|
useEffect(() => {
|
|
19
30
|
const listener = () => {
|
|
20
31
|
const element = document.scrollingElement;
|
|
@@ -27,7 +38,7 @@ function RollButton({
|
|
|
27
38
|
window.removeEventListener("scroll", listener);
|
|
28
39
|
};
|
|
29
40
|
}, [percentage]);
|
|
30
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
31
42
|
"button",
|
|
32
43
|
{
|
|
33
44
|
type: "button",
|
|
@@ -35,18 +46,20 @@ function RollButton({
|
|
|
35
46
|
className: twMerge(
|
|
36
47
|
buttonVariants({
|
|
37
48
|
color: "secondary",
|
|
38
|
-
|
|
39
|
-
className: "fixed bottom-8 p-3 right-8 z-50 shadow-md rounded-full transition-all"
|
|
49
|
+
className: "fixed top-16 [&_svg]:size-4 gap-1 left-1/2 translate-x-[-50%] z-10 shadow-md rounded-full transition-all md:top-4"
|
|
40
50
|
}),
|
|
41
51
|
!show && "translate-y-20 opacity-0"
|
|
42
52
|
),
|
|
43
|
-
onClick: () => {
|
|
53
|
+
onClick: useCallback(() => {
|
|
44
54
|
document.scrollingElement?.scrollTo({
|
|
45
55
|
top: 0,
|
|
46
56
|
behavior: "smooth"
|
|
47
57
|
});
|
|
48
|
-
},
|
|
49
|
-
children:
|
|
58
|
+
}, []),
|
|
59
|
+
children: [
|
|
60
|
+
current?.icon ?? /* @__PURE__ */ jsx(ChevronUp, {}),
|
|
61
|
+
current?.name
|
|
62
|
+
]
|
|
50
63
|
}
|
|
51
64
|
);
|
|
52
65
|
}
|
package/dist/docs.client.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { S as SidebarProps, N as NavProps } from './layout.client-Duq0TTke.js';
|
|
1
|
+
import { L as LinkItemType, S as SidebarProps, N as NavProps } from './layout.client-Duq0TTke.js';
|
|
2
2
|
export { a as Sidebar } from './layout.client-Duq0TTke.js';
|
|
3
3
|
export { T as TreeContextProvider } from './tree-CrKzI9Nz.js';
|
|
4
4
|
import { ButtonHTMLAttributes } from 'react';
|
|
5
5
|
import 'fumadocs-core/server';
|
|
6
6
|
|
|
7
|
+
interface LinksMenuProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
items: LinkItemType[];
|
|
9
|
+
footer?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function LinksMenu({ items, footer, ...props }: LinksMenuProps): React.ReactElement;
|
|
12
|
+
|
|
7
13
|
declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
|
|
8
14
|
|
|
9
15
|
declare function ThemeToggle({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): React.ReactElement;
|
|
10
16
|
|
|
11
17
|
declare function SubNav({ title, url, children, enableSearch, }: NavProps): React.ReactElement;
|
|
12
18
|
|
|
13
|
-
export { DynamicSidebar, SubNav, ThemeToggle };
|
|
19
|
+
export { DynamicSidebar, LinksMenu, SubNav, ThemeToggle };
|
package/dist/docs.client.js
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
LargeSearchToggle,
|
|
4
4
|
LinkItem,
|
|
5
|
+
LinksMenu,
|
|
5
6
|
SearchToggle,
|
|
6
7
|
ThemeToggle
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
TreeContextProvider,
|
|
10
|
-
useTreeContext
|
|
11
|
-
} from "./chunk-34Z7WODD.js";
|
|
8
|
+
} from "./chunk-KOSWCGKQ.js";
|
|
12
9
|
import {
|
|
13
10
|
ScrollArea,
|
|
14
11
|
ScrollViewport
|
|
15
12
|
} from "./chunk-VYTHQTZE.js";
|
|
16
13
|
import "./chunk-UBVEKNRF.js";
|
|
14
|
+
import {
|
|
15
|
+
TreeContextProvider,
|
|
16
|
+
useTreeContext
|
|
17
|
+
} from "./chunk-34Z7WODD.js";
|
|
17
18
|
import {
|
|
18
19
|
hasActive,
|
|
19
20
|
isActive
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
import {
|
|
25
26
|
useSearchContext
|
|
26
27
|
} from "./chunk-FSPYEOFC.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-HLGNIWUN.js";
|
|
28
29
|
import {
|
|
29
30
|
Collapsible,
|
|
30
31
|
CollapsibleContent,
|
|
@@ -112,7 +113,7 @@ function Sidebar({
|
|
|
112
113
|
{
|
|
113
114
|
...bannerProps,
|
|
114
115
|
className: twMerge(
|
|
115
|
-
"flex flex-col gap-2
|
|
116
|
+
"flex flex-col gap-2 px-4 pt-2 md:px-3 md:pt-6",
|
|
116
117
|
bannerProps?.className
|
|
117
118
|
),
|
|
118
119
|
children: [
|
|
@@ -121,13 +122,13 @@ function Sidebar({
|
|
|
121
122
|
]
|
|
122
123
|
}
|
|
123
124
|
),
|
|
124
|
-
/* @__PURE__ */ jsx(ViewportContent, { children: items.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)) }) }),
|
|
125
|
+
/* @__PURE__ */ jsx(ViewportContent, { children: items.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col md:hidden", children: items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)) }) }),
|
|
125
126
|
/* @__PURE__ */ jsx(
|
|
126
127
|
"div",
|
|
127
128
|
{
|
|
128
129
|
...footerProps,
|
|
129
130
|
className: twMerge(
|
|
130
|
-
"flex flex-row items-center border-t px-4 py-
|
|
131
|
+
"flex flex-row items-center border-t px-4 py-1 md:px-3",
|
|
131
132
|
footerProps?.className
|
|
132
133
|
),
|
|
133
134
|
children: footer
|
|
@@ -141,10 +142,18 @@ function ViewportContent({
|
|
|
141
142
|
children
|
|
142
143
|
}) {
|
|
143
144
|
const { root } = useTreeContext();
|
|
144
|
-
return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
146
|
+
ScrollViewport,
|
|
147
|
+
{
|
|
148
|
+
style: {
|
|
149
|
+
maskImage: "linear-gradient(to bottom, transparent 2px, white 24px, white calc(100% - 24px), transparent calc(100% - 2px))"
|
|
150
|
+
},
|
|
151
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8 px-4 py-6 md:px-3", children: [
|
|
152
|
+
children,
|
|
153
|
+
/* @__PURE__ */ jsx(NodeList, { items: root.children })
|
|
154
|
+
] })
|
|
155
|
+
}
|
|
156
|
+
) });
|
|
148
157
|
}
|
|
149
158
|
function NodeList({
|
|
150
159
|
items,
|
|
@@ -365,11 +374,11 @@ function SubNav({
|
|
|
365
374
|
"nav",
|
|
366
375
|
{
|
|
367
376
|
id: "nd-subnav",
|
|
368
|
-
className: "sticky top-0 z-40 flex h-16 w-full flex-row items-center border-b bg-background/
|
|
377
|
+
className: "sticky top-0 z-40 flex h-16 w-full flex-row items-center border-b bg-background/80 px-4 backdrop-blur-md md:hidden [&_svg]:size-5",
|
|
369
378
|
children: [
|
|
370
379
|
/* @__PURE__ */ jsx3(Link2, { href: url, className: "inline-flex items-center gap-3 font-semibold", children: title }),
|
|
371
380
|
children,
|
|
372
|
-
enabled && enableSearch ? /* @__PURE__ */ jsx3(SearchToggle, { className: "
|
|
381
|
+
enabled && enableSearch ? /* @__PURE__ */ jsx3(SearchToggle, { className: "ms-auto" }) : null,
|
|
373
382
|
/* @__PURE__ */ jsx3(
|
|
374
383
|
SidebarTrigger,
|
|
375
384
|
{
|
|
@@ -377,7 +386,7 @@ function SubNav({
|
|
|
377
386
|
buttonVariants({
|
|
378
387
|
color: "ghost",
|
|
379
388
|
size: "icon",
|
|
380
|
-
className: (!enabled || !enableSearch) && "
|
|
389
|
+
className: (!enabled || !enableSearch) && "ms-auto"
|
|
381
390
|
})
|
|
382
391
|
),
|
|
383
392
|
children: open ? /* @__PURE__ */ jsx3(X, {}) : /* @__PURE__ */ jsx3(Menu, {})
|
|
@@ -389,6 +398,7 @@ function SubNav({
|
|
|
389
398
|
}
|
|
390
399
|
export {
|
|
391
400
|
DynamicSidebar,
|
|
401
|
+
LinksMenu,
|
|
392
402
|
Sidebar,
|
|
393
403
|
SubNav,
|
|
394
404
|
ThemeToggle,
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { N as NamedTranslation } from './i18n-
|
|
3
|
-
export { T as Translations } from './i18n-
|
|
2
|
+
import { N as NamedTranslation } from './i18n-DSnJuWoW.js';
|
|
3
|
+
export { T as Translations } from './i18n-DSnJuWoW.js';
|
|
4
4
|
|
|
5
5
|
interface I18nProviderProps {
|
|
6
6
|
/**
|