fumadocs-ui 16.7.0 → 16.7.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/css/generated/docs.css +5 -4
- package/css/generated/flux.css +3 -4
- package/css/generated/home.css +2 -3
- package/css/generated/notebook.css +4 -4
- package/css/generated/shared.css +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/dialog/search.js +2 -2
- package/dist/components/files.js +3 -3
- package/dist/components/heading.js +2 -2
- package/dist/components/sidebar/tabs/dropdown.js +1 -1
- package/dist/components/toc/index.d.ts +3 -2
- package/dist/components/toc/index.js +12 -2
- package/dist/layouts/docs/client.d.ts +3 -3
- package/dist/layouts/docs/client.js +20 -23
- package/dist/layouts/docs/index.d.ts +1 -1
- package/dist/layouts/docs/page/index.d.ts +91 -3
- package/dist/layouts/docs/page/index.js +67 -7
- package/dist/layouts/docs/page/slots/breadcrumb.js +3 -1
- package/dist/layouts/docs/page/slots/container.js +2 -1
- package/dist/layouts/docs/page/slots/footer.js +1 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +29 -1
- package/dist/layouts/docs/page/slots/toc.js +137 -4
- package/dist/layouts/docs/slots/container.js +2 -1
- package/dist/layouts/docs/slots/header.js +1 -0
- package/dist/layouts/docs/slots/sidebar.js +6 -6
- package/dist/layouts/flux/index.d.ts +4 -4
- package/dist/layouts/flux/index.js +8 -11
- package/dist/layouts/flux/page/index.d.ts +79 -3
- package/dist/layouts/flux/page/index.js +61 -7
- package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
- package/dist/layouts/flux/page/slots/container.js +2 -1
- package/dist/layouts/flux/page/slots/footer.js +1 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
- package/dist/layouts/flux/page/slots/toc.js +3 -3
- package/dist/layouts/flux/slots/container.js +1 -0
- package/dist/layouts/home/index.d.ts +3 -3
- package/dist/layouts/home/index.js +6 -8
- package/dist/layouts/home/slots/container.js +1 -0
- package/dist/layouts/home/slots/header.js +5 -5
- package/dist/layouts/notebook/client.d.ts +3 -3
- package/dist/layouts/notebook/client.js +15 -18
- package/dist/layouts/notebook/index.d.ts +1 -1
- package/dist/layouts/notebook/page/index.d.ts +91 -3
- package/dist/layouts/notebook/page/index.js +67 -7
- package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
- package/dist/layouts/notebook/page/slots/container.js +2 -1
- package/dist/layouts/notebook/page/slots/footer.js +1 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +29 -1
- package/dist/layouts/notebook/page/slots/toc.js +136 -4
- package/dist/layouts/notebook/slots/container.js +1 -0
- package/dist/layouts/notebook/slots/sidebar.js +4 -4
- package/dist/layouts/shared/client.d.ts +8 -8
- package/dist/layouts/shared/client.js +4 -4
- package/dist/layouts/shared/index.d.ts +5 -5
- package/dist/layouts/shared/page-actions.d.ts +2 -2
- package/dist/layouts/shared/page-actions.js +3 -3
- package/dist/layouts/shared/slots/search-trigger.d.ts +3 -3
- package/dist/page.d.ts +1 -2
- package/dist/page.js +1 -2
- package/package.json +4 -6
- package/dist/layouts/docs/page/client.d.ts +0 -98
- package/dist/layouts/docs/page/client.js +0 -110
- package/dist/layouts/docs/page/slots/toc-popover.d.ts +0 -31
- package/dist/layouts/docs/page/slots/toc-popover.js +0 -141
- package/dist/layouts/flux/page/client.d.ts +0 -82
- package/dist/layouts/flux/page/client.js +0 -94
- package/dist/layouts/notebook/page/client.d.ts +0 -98
- package/dist/layouts/notebook/page/client.js +0 -110
- package/dist/layouts/notebook/page/slots/toc-popover.d.ts +0 -31
- package/dist/layouts/notebook/page/slots/toc-popover.js +0 -141
package/css/generated/docs.css
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
@source inline("border-t");
|
|
82
82
|
@source inline("border-transparent");
|
|
83
83
|
@source inline("breadcrumb");
|
|
84
|
+
@source inline("breadcrumbEnabled");
|
|
84
85
|
@source inline("button");
|
|
85
86
|
@source inline("buttonVariants");
|
|
86
87
|
@source inline("children");
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
@source inline("collapsible");
|
|
98
99
|
@source inline("collapsing");
|
|
99
100
|
@source inline("color");
|
|
101
|
+
@source inline("component");
|
|
100
102
|
@source inline("components");
|
|
101
103
|
@source inline("const");
|
|
102
104
|
@source inline("container");
|
|
@@ -165,6 +167,7 @@
|
|
|
165
167
|
@source inline("font-medium");
|
|
166
168
|
@source inline("font-semibold");
|
|
167
169
|
@source inline("footer");
|
|
170
|
+
@source inline("footerEnabled");
|
|
168
171
|
@source inline("footerList");
|
|
169
172
|
@source inline("for");
|
|
170
173
|
@source inline("from");
|
|
@@ -241,7 +244,6 @@
|
|
|
241
244
|
@source inline("layoutTabs");
|
|
242
245
|
@source inline("leading-none");
|
|
243
246
|
@source inline("length");
|
|
244
|
-
@source inline("let");
|
|
245
247
|
@source inline("link");
|
|
246
248
|
@source inline("linkItems");
|
|
247
249
|
@source inline("lucide-react");
|
|
@@ -328,6 +330,7 @@
|
|
|
328
330
|
@source inline("pe-4");
|
|
329
331
|
@source inline("placeholder");
|
|
330
332
|
@source inline("pointer-events-none");
|
|
333
|
+
@source inline("popover");
|
|
331
334
|
@source inline("prefetch");
|
|
332
335
|
@source inline("previous");
|
|
333
336
|
@source inline("previousPage");
|
|
@@ -373,6 +376,7 @@
|
|
|
373
376
|
@source inline("showItem");
|
|
374
377
|
@source inline("shrink-0");
|
|
375
378
|
@source inline("sidebar");
|
|
379
|
+
@source inline("sidebarEnabled");
|
|
376
380
|
@source inline("sidebarProps");
|
|
377
381
|
@source inline("single");
|
|
378
382
|
@source inline("size");
|
|
@@ -428,7 +432,6 @@
|
|
|
428
432
|
@source inline("tocPopoverEnabled");
|
|
429
433
|
@source inline("tocPopoverProps");
|
|
430
434
|
@source inline("tocProps");
|
|
431
|
-
@source inline("tocProvider");
|
|
432
435
|
@source inline("top");
|
|
433
436
|
@source inline("top-(--fd-docs-row-1)");
|
|
434
437
|
@source inline("top-(--fd-docs-row-2)");
|
|
@@ -455,7 +458,6 @@
|
|
|
455
458
|
@source inline("unlisted");
|
|
456
459
|
@source inline("url");
|
|
457
460
|
@source inline("use");
|
|
458
|
-
@source inline("useActiveAnchor");
|
|
459
461
|
@source inline("useDocsLayout");
|
|
460
462
|
@source inline("useDocsPage");
|
|
461
463
|
@source inline("useFooterItems");
|
|
@@ -467,7 +469,6 @@
|
|
|
467
469
|
@source inline("useRef");
|
|
468
470
|
@source inline("useSidebar");
|
|
469
471
|
@source inline("useState");
|
|
470
|
-
@source inline("useTOCItems");
|
|
471
472
|
@source inline("useTreeContext");
|
|
472
473
|
@source inline("useTreePath");
|
|
473
474
|
@source inline("value");
|
package/css/generated/flux.css
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@source inline("bottom-0");
|
|
54
54
|
@source inline("bottom-26");
|
|
55
55
|
@source inline("breadcrumb");
|
|
56
|
+
@source inline("breadcrumbEnabled");
|
|
56
57
|
@source inline("button");
|
|
57
58
|
@source inline("buttonVariants");
|
|
58
59
|
@source inline("children");
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
@source inline("collapsed");
|
|
69
70
|
@source inline("collapsible");
|
|
70
71
|
@source inline("color");
|
|
72
|
+
@source inline("component");
|
|
71
73
|
@source inline("components");
|
|
72
74
|
@source inline("const");
|
|
73
75
|
@source inline("container");
|
|
@@ -131,6 +133,7 @@
|
|
|
131
133
|
@source inline("font-medium");
|
|
132
134
|
@source inline("font-semibold");
|
|
133
135
|
@source inline("footer");
|
|
136
|
+
@source inline("footerEnabled");
|
|
134
137
|
@source inline("footerList");
|
|
135
138
|
@source inline("for");
|
|
136
139
|
@source inline("from");
|
|
@@ -201,7 +204,6 @@
|
|
|
201
204
|
@source inline("leading-none");
|
|
202
205
|
@source inline("left-1/2");
|
|
203
206
|
@source inline("length");
|
|
204
|
-
@source inline("let");
|
|
205
207
|
@source inline("lg:text-sm");
|
|
206
208
|
@source inline("link");
|
|
207
209
|
@source inline("linkItems");
|
|
@@ -384,7 +386,6 @@
|
|
|
384
386
|
@source inline("toc");
|
|
385
387
|
@source inline("tocEnabled");
|
|
386
388
|
@source inline("tocProps");
|
|
387
|
-
@source inline("tocProvider");
|
|
388
389
|
@source inline("tool");
|
|
389
390
|
@source inline("top-0");
|
|
390
391
|
@source inline("transform");
|
|
@@ -404,7 +405,6 @@
|
|
|
404
405
|
@source inline("under");
|
|
405
406
|
@source inline("url");
|
|
406
407
|
@source inline("use");
|
|
407
|
-
@source inline("useActiveAnchor");
|
|
408
408
|
@source inline("useDocsPage");
|
|
409
409
|
@source inline("useFluxLayout");
|
|
410
410
|
@source inline("useFooterItems");
|
|
@@ -416,7 +416,6 @@
|
|
|
416
416
|
@source inline("useSearchContext");
|
|
417
417
|
@source inline("useSidebar");
|
|
418
418
|
@source inline("useState");
|
|
419
|
-
@source inline("useTOCItems");
|
|
420
419
|
@source inline("useTreePath");
|
|
421
420
|
@source inline("value");
|
|
422
421
|
@source inline("variant");
|
package/css/generated/home.css
CHANGED
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
@source inline("component");
|
|
32
32
|
@source inline("const");
|
|
33
33
|
@source inline("container");
|
|
34
|
-
@source inline("content");
|
|
35
34
|
@source inline("context");
|
|
36
35
|
@source inline("createContext");
|
|
37
36
|
@source inline("custom");
|
|
@@ -101,9 +100,9 @@
|
|
|
101
100
|
@source inline("justify-end");
|
|
102
101
|
@source inline("key");
|
|
103
102
|
@source inline("label");
|
|
103
|
+
@source inline("languageSelect");
|
|
104
104
|
@source inline("last:me-0");
|
|
105
105
|
@source inline("length");
|
|
106
|
-
@source inline("let");
|
|
107
106
|
@source inline("lg:grid-cols-3");
|
|
108
107
|
@source inline("lg:hidden");
|
|
109
108
|
@source inline("linkItems");
|
|
@@ -160,11 +159,11 @@
|
|
|
160
159
|
@source inline("rest");
|
|
161
160
|
@source inline("return");
|
|
162
161
|
@source inline("role");
|
|
163
|
-
@source inline("root");
|
|
164
162
|
@source inline("rounded-full");
|
|
165
163
|
@source inline("rounded-lg");
|
|
166
164
|
@source inline("rounded-md");
|
|
167
165
|
@source inline("searchToggle");
|
|
166
|
+
@source inline("searchTrigger");
|
|
168
167
|
@source inline("secondary");
|
|
169
168
|
@source inline("separator");
|
|
170
169
|
@source inline("setValue");
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
@source inline("border-t");
|
|
84
84
|
@source inline("border-transparent");
|
|
85
85
|
@source inline("breadcrumb");
|
|
86
|
+
@source inline("breadcrumbEnabled");
|
|
86
87
|
@source inline("button");
|
|
87
88
|
@source inline("buttonVariants");
|
|
88
89
|
@source inline("children");
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
@source inline("collapsible");
|
|
101
102
|
@source inline("collapsing");
|
|
102
103
|
@source inline("color");
|
|
104
|
+
@source inline("component");
|
|
103
105
|
@source inline("components");
|
|
104
106
|
@source inline("const");
|
|
105
107
|
@source inline("container");
|
|
@@ -172,6 +174,7 @@
|
|
|
172
174
|
@source inline("font-medium");
|
|
173
175
|
@source inline("font-semibold");
|
|
174
176
|
@source inline("footer");
|
|
177
|
+
@source inline("footerEnabled");
|
|
175
178
|
@source inline("footerList");
|
|
176
179
|
@source inline("for");
|
|
177
180
|
@source inline("freezeUntil");
|
|
@@ -257,7 +260,6 @@
|
|
|
257
260
|
@source inline("layout:[--fd-header-height:--spacing(14)]");
|
|
258
261
|
@source inline("leading-none");
|
|
259
262
|
@source inline("length");
|
|
260
|
-
@source inline("let");
|
|
261
263
|
@source inline("lg:hidden");
|
|
262
264
|
@source inline("lg:layout:[--fd-header-height:--spacing(24)]");
|
|
263
265
|
@source inline("link");
|
|
@@ -357,6 +359,7 @@
|
|
|
357
359
|
@source inline("placeholder");
|
|
358
360
|
@source inline("pointer-events-none");
|
|
359
361
|
@source inline("pointerType");
|
|
362
|
+
@source inline("popover");
|
|
360
363
|
@source inline("prefetch");
|
|
361
364
|
@source inline("previous");
|
|
362
365
|
@source inline("previousPage");
|
|
@@ -462,7 +465,6 @@
|
|
|
462
465
|
@source inline("tocPopoverEnabled");
|
|
463
466
|
@source inline("tocPopoverProps");
|
|
464
467
|
@source inline("tocProps");
|
|
465
|
-
@source inline("tocProvider");
|
|
466
468
|
@source inline("top");
|
|
467
469
|
@source inline("top-(--fd-docs-row-1)");
|
|
468
470
|
@source inline("top-(--fd-docs-row-2)");
|
|
@@ -490,7 +492,6 @@
|
|
|
490
492
|
@source inline("unlisted");
|
|
491
493
|
@source inline("url");
|
|
492
494
|
@source inline("use");
|
|
493
|
-
@source inline("useActiveAnchor");
|
|
494
495
|
@source inline("useDocsPage");
|
|
495
496
|
@source inline("useFooterItems");
|
|
496
497
|
@source inline("useI18n");
|
|
@@ -501,7 +502,6 @@
|
|
|
501
502
|
@source inline("useProvider");
|
|
502
503
|
@source inline("useRef");
|
|
503
504
|
@source inline("useSidebar");
|
|
504
|
-
@source inline("useTOCItems");
|
|
505
505
|
@source inline("useTreePath");
|
|
506
506
|
@source inline("value");
|
|
507
507
|
@source inline("variant");
|
package/css/generated/shared.css
CHANGED
|
@@ -6,7 +6,7 @@ import { mergeRefs } from "../utils/merge-refs.js";
|
|
|
6
6
|
import { Accordion as Accordion$1, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger } from "./ui/accordion.js";
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { Check,
|
|
9
|
+
import { Check, LinkIcon } from "lucide-react";
|
|
10
10
|
//#region src/components/accordion.tsx
|
|
11
11
|
function Accordions({ type = "single", ref, className, defaultValue, ...props }) {
|
|
12
12
|
const rootRef = useRef(null);
|
|
@@ -59,7 +59,7 @@ function CopyButton({ id }) {
|
|
|
59
59
|
className: "text-fd-muted-foreground me-2"
|
|
60
60
|
})),
|
|
61
61
|
onClick,
|
|
62
|
-
children: checked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(
|
|
62
|
+
children: checked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(LinkIcon, { className: "size-3.5" })
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
@@ -5,7 +5,7 @@ import { buttonVariants } from "../ui/button.js";
|
|
|
5
5
|
import { Fragment, createContext, use, useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { useRouter } from "fumadocs-core/framework";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { ChevronRight, Hash,
|
|
8
|
+
import { ChevronRight, Hash, SearchIcon } from "lucide-react";
|
|
9
9
|
import { cva } from "class-variance-authority";
|
|
10
10
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
11
11
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
@@ -289,7 +289,7 @@ function SearchDialogListItem({ item, className, children, renderMarkdown = (s)
|
|
|
289
289
|
}
|
|
290
290
|
function SearchDialogIcon(props) {
|
|
291
291
|
const { isLoading } = useSearch();
|
|
292
|
-
return /* @__PURE__ */ jsx(
|
|
292
|
+
return /* @__PURE__ */ jsx(SearchIcon, {
|
|
293
293
|
...props,
|
|
294
294
|
className: cn("size-5 text-fd-muted-foreground", isLoading && "animate-pulse duration-400", props.className)
|
|
295
295
|
});
|
package/dist/components/files.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cn } from "../utils/cn.js";
|
|
|
3
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { FileIcon, FolderIcon, FolderOpen } from "lucide-react";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
8
|
//#region src/components/files.tsx
|
|
9
9
|
const itemVariants = cva("flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4");
|
|
@@ -14,7 +14,7 @@ function Files({ className, ...props }) {
|
|
|
14
14
|
children: props.children
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
function File({ name, icon = /* @__PURE__ */ jsx(
|
|
17
|
+
function File({ name, icon = /* @__PURE__ */ jsx(FileIcon, {}), className, ...rest }) {
|
|
18
18
|
return /* @__PURE__ */ jsxs("div", {
|
|
19
19
|
className: cn(itemVariants({ className })),
|
|
20
20
|
...rest,
|
|
@@ -29,7 +29,7 @@ function Folder({ name, defaultOpen = false, ...props }) {
|
|
|
29
29
|
...props,
|
|
30
30
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
31
31
|
className: cn(itemVariants({ className: "w-full" })),
|
|
32
|
-
children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(
|
|
32
|
+
children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(FolderIcon, {}), name]
|
|
33
33
|
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
|
|
34
34
|
className: "ms-2 flex flex-col border-l ps-2",
|
|
35
35
|
children: props.children
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../utils/cn.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { LinkIcon } from "lucide-react";
|
|
4
4
|
//#region src/components/heading.tsx
|
|
5
5
|
function Heading({ as, className, ...props }) {
|
|
6
6
|
const As = as ?? "h1";
|
|
@@ -16,7 +16,7 @@ function Heading({ as, className, ...props }) {
|
|
|
16
16
|
href: `#${props.id}`,
|
|
17
17
|
className: "peer",
|
|
18
18
|
children: props.children
|
|
19
|
-
}), /* @__PURE__ */ jsx(
|
|
19
|
+
}), /* @__PURE__ */ jsx(LinkIcon, {
|
|
20
20
|
"aria-hidden": true,
|
|
21
21
|
className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
|
|
22
22
|
})]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../../utils/cn.js";
|
|
3
|
-
import { useSidebar } from "../base.js";
|
|
4
3
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
5
4
|
import { isLayoutTabActive } from "../../../layouts/shared/index.js";
|
|
5
|
+
import { useSidebar } from "../base.js";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { usePathname } from "fumadocs-core/framework";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -4,7 +4,8 @@ import * as Primitive from "fumadocs-core/toc";
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/toc/index.d.ts
|
|
6
6
|
declare function useTOCItems(): Primitive.TOCItemType[];
|
|
7
|
-
type TOCProviderProps =
|
|
7
|
+
type TOCProviderProps = Primitive.AnchorProviderProps;
|
|
8
|
+
declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors;
|
|
8
9
|
declare function TOCProvider({
|
|
9
10
|
toc,
|
|
10
11
|
children,
|
|
@@ -23,4 +24,4 @@ declare function TocThumb({
|
|
|
23
24
|
...props
|
|
24
25
|
}: ComponentProps<'div'> & RefProps): react_jsx_runtime0.JSX.Element;
|
|
25
26
|
//#endregion
|
|
26
|
-
export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useTOCItems };
|
|
27
|
+
export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useTOCItems };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
3
|
import { cn } from "../../utils/cn.js";
|
|
3
4
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
4
5
|
import { createContext, use, useEffect, useEffectEvent, useRef } from "react";
|
|
@@ -6,10 +7,19 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
7
|
import * as Primitive from "fumadocs-core/toc";
|
|
7
8
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
8
9
|
//#region src/components/toc/index.tsx
|
|
10
|
+
var toc_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
TOCProvider: () => TOCProvider,
|
|
12
|
+
TOCScrollArea: () => TOCScrollArea,
|
|
13
|
+
TocThumb: () => TocThumb,
|
|
14
|
+
useActiveAnchor: () => useActiveAnchor,
|
|
15
|
+
useActiveAnchors: () => useActiveAnchors,
|
|
16
|
+
useTOCItems: () => useTOCItems
|
|
17
|
+
});
|
|
9
18
|
const TOCContext = createContext([]);
|
|
10
19
|
function useTOCItems() {
|
|
11
20
|
return use(TOCContext);
|
|
12
21
|
}
|
|
22
|
+
const { useActiveAnchor, useActiveAnchors } = Primitive;
|
|
13
23
|
function TOCProvider({ toc, children, ...props }) {
|
|
14
24
|
return /* @__PURE__ */ jsx(TOCContext, {
|
|
15
25
|
value: toc,
|
|
@@ -34,7 +44,7 @@ function TOCScrollArea({ ref, className, ...props }) {
|
|
|
34
44
|
}
|
|
35
45
|
function TocThumb({ containerRef, ...props }) {
|
|
36
46
|
const thumbRef = useRef(null);
|
|
37
|
-
const active =
|
|
47
|
+
const active = useActiveAnchors();
|
|
38
48
|
function update(info) {
|
|
39
49
|
const element = thumbRef.current;
|
|
40
50
|
if (!element) return;
|
|
@@ -75,4 +85,4 @@ function calc(container, active) {
|
|
|
75
85
|
return [upper, lower - upper];
|
|
76
86
|
}
|
|
77
87
|
//#endregion
|
|
78
|
-
export { TOCProvider, TOCScrollArea, TocThumb, useTOCItems };
|
|
88
|
+
export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useTOCItems };
|
|
@@ -5,8 +5,9 @@ import { DocsLayoutProps } from "./index.js";
|
|
|
5
5
|
import { ComponentProps, FC } from "react";
|
|
6
6
|
//#region src/layouts/docs/client.d.ts
|
|
7
7
|
interface DocsSlots extends BaseSlots {
|
|
8
|
-
container
|
|
9
|
-
|
|
8
|
+
container: FC<ComponentProps<'div'>>;
|
|
9
|
+
header: FC<ComponentProps<'header'>>;
|
|
10
|
+
sidebar: {
|
|
10
11
|
provider: FC<SidebarProviderProps>;
|
|
11
12
|
root: FC<SidebarProps>;
|
|
12
13
|
trigger: FC<ComponentProps<'button'>>;
|
|
@@ -16,7 +17,6 @@ interface DocsSlots extends BaseSlots {
|
|
|
16
17
|
setOpen: (v: boolean) => void;
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
|
-
header?: FC<ComponentProps<'header'>>;
|
|
20
20
|
}
|
|
21
21
|
interface SlotsProps extends BaseSlotsProps<DocsLayoutProps> {
|
|
22
22
|
tabs: LayoutTab[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
import { TreeContextProvider } from "../../contexts/tree.js";
|
|
4
|
-
import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
|
|
5
4
|
import { baseSlots } from "../shared/client.js";
|
|
6
5
|
import { isLayoutTabActive, useLinkItems } from "../shared/index.js";
|
|
6
|
+
import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
|
|
7
7
|
import { Sidebar, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
|
|
8
8
|
import { Header } from "./slots/header.js";
|
|
9
9
|
import { Container } from "./slots/container.js";
|
|
10
10
|
import { createContext, use, useMemo } from "react";
|
|
11
11
|
import { usePathname } from "fumadocs-core/framework";
|
|
12
|
-
import {
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import Link from "fumadocs-core/link";
|
|
14
14
|
//#region src/layouts/docs/client.tsx
|
|
15
15
|
const { useProvider } = baseSlots({ useProps() {
|
|
@@ -25,14 +25,14 @@ function useDocsLayout() {
|
|
|
25
25
|
return context;
|
|
26
26
|
}
|
|
27
27
|
function LayoutBody(props) {
|
|
28
|
-
const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
|
|
28
|
+
const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { enabled: sidebarEnabled = true, defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
|
|
29
29
|
const isTop = useIsScrollTop({ enabled: navTransparentMode === "top" }) ?? true;
|
|
30
30
|
const isNavTransparent = navTransparentMode === "top" ? isTop : navTransparentMode === "always";
|
|
31
31
|
const { baseSlots, baseProps } = useProvider(props);
|
|
32
32
|
const linkItems = useLinkItems(props);
|
|
33
33
|
const slots = {
|
|
34
34
|
...baseSlots,
|
|
35
|
-
header:
|
|
35
|
+
header: defaultSlots?.header ?? Header,
|
|
36
36
|
container: defaultSlots?.container ?? Container,
|
|
37
37
|
sidebar: defaultSlots?.sidebar ?? {
|
|
38
38
|
provider: SidebarProvider,
|
|
@@ -41,24 +41,6 @@ function LayoutBody(props) {
|
|
|
41
41
|
useSidebar
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
45
|
-
slots.header && /* @__PURE__ */ jsx(slots.header, {}),
|
|
46
|
-
slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
|
|
47
|
-
tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
|
|
48
|
-
tabs,
|
|
49
|
-
className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
|
|
50
|
-
}),
|
|
51
|
-
children
|
|
52
|
-
] });
|
|
53
|
-
if (slots.container) content = /* @__PURE__ */ jsx(slots.container, {
|
|
54
|
-
...containerProps,
|
|
55
|
-
children: content
|
|
56
|
-
});
|
|
57
|
-
if (slots.sidebar) content = /* @__PURE__ */ jsx(slots.sidebar.provider, {
|
|
58
|
-
defaultOpenLevel,
|
|
59
|
-
prefetch,
|
|
60
|
-
children: content
|
|
61
|
-
});
|
|
62
44
|
return /* @__PURE__ */ jsx(TreeContextProvider, {
|
|
63
45
|
tree,
|
|
64
46
|
children: /* @__PURE__ */ jsx(LayoutContext, {
|
|
@@ -72,7 +54,22 @@ function LayoutBody(props) {
|
|
|
72
54
|
slots,
|
|
73
55
|
...linkItems
|
|
74
56
|
},
|
|
75
|
-
children:
|
|
57
|
+
children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
|
|
58
|
+
defaultOpenLevel,
|
|
59
|
+
prefetch,
|
|
60
|
+
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
61
|
+
...containerProps,
|
|
62
|
+
children: [
|
|
63
|
+
navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
|
|
64
|
+
sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
|
|
65
|
+
tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
|
|
66
|
+
tabs,
|
|
67
|
+
className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
|
|
68
|
+
}),
|
|
69
|
+
children
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
})
|
|
76
73
|
})
|
|
77
74
|
});
|
|
78
75
|
}
|
|
@@ -12,7 +12,7 @@ interface DocsLayoutProps extends BaseLayoutProps {
|
|
|
12
12
|
tabMode?: 'top' | 'auto';
|
|
13
13
|
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
14
14
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
15
|
-
slots?: DocsSlots
|
|
15
|
+
slots?: Partial<DocsSlots>;
|
|
16
16
|
}
|
|
17
17
|
interface SidebarOptions extends SidebarProps, SidebarProviderProps {
|
|
18
18
|
enabled?: boolean;
|
|
@@ -1,11 +1,93 @@
|
|
|
1
|
+
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
1
2
|
import { Footer, FooterProps } from "./slots/footer.js";
|
|
2
3
|
import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
3
|
-
import { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage } from "./client.js";
|
|
4
4
|
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
5
|
-
import { ComponentProps } from "react";
|
|
5
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
import { TOCItemType } from "fumadocs-core/toc";
|
|
7
8
|
|
|
8
9
|
//#region src/layouts/docs/page/index.d.ts
|
|
10
|
+
interface DocsPageProps extends ComponentProps<'article'> {
|
|
11
|
+
toc?: TOCItemType[];
|
|
12
|
+
/**
|
|
13
|
+
* Extend the page to fill all available space
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
full?: boolean;
|
|
18
|
+
slots?: Partial<DocsPageSlots>;
|
|
19
|
+
footer?: FooterOptions;
|
|
20
|
+
breadcrumb?: BreadcrumbOptions;
|
|
21
|
+
tableOfContent?: TableOfContentOptions;
|
|
22
|
+
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
23
|
+
}
|
|
24
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated use `slots.breadcrumb` instead.
|
|
28
|
+
*/
|
|
29
|
+
component?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
interface FooterOptions extends FooterProps {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use `slots.footer` instead.
|
|
35
|
+
*/
|
|
36
|
+
component?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated use `slots.toc` instead.
|
|
42
|
+
*/
|
|
43
|
+
component?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
interface TableOfContentPopoverOptions extends TOCPopoverProps {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated use `slots.tocPopover` instead.
|
|
49
|
+
*/
|
|
50
|
+
component?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
interface DocsPageSlots {
|
|
53
|
+
toc: {
|
|
54
|
+
provider: FC<TOCProviderProps>;
|
|
55
|
+
main: FC<TOCProps>;
|
|
56
|
+
popover: FC<TOCPopoverProps>;
|
|
57
|
+
};
|
|
58
|
+
container: FC<ComponentProps<'article'>>;
|
|
59
|
+
footer: FC<FooterProps>;
|
|
60
|
+
breadcrumb: FC<BreadcrumbProps>;
|
|
61
|
+
}
|
|
62
|
+
type PageSlotsProps = Pick<DocsPageProps, 'full'>;
|
|
63
|
+
declare function useDocsPage(): {
|
|
64
|
+
props: PageSlotsProps;
|
|
65
|
+
slots: DocsPageSlots;
|
|
66
|
+
};
|
|
67
|
+
declare function DocsPage({
|
|
68
|
+
tableOfContent: {
|
|
69
|
+
enabled: tocEnabled,
|
|
70
|
+
single,
|
|
71
|
+
...tocProps
|
|
72
|
+
},
|
|
73
|
+
tableOfContentPopover: {
|
|
74
|
+
enabled: tocPopoverEnabled,
|
|
75
|
+
...tocPopoverProps
|
|
76
|
+
},
|
|
77
|
+
breadcrumb: {
|
|
78
|
+
enabled: breadcrumbEnabled,
|
|
79
|
+
...breadcrumb
|
|
80
|
+
},
|
|
81
|
+
footer: {
|
|
82
|
+
enabled: footerEnabled,
|
|
83
|
+
...footer
|
|
84
|
+
},
|
|
85
|
+
full,
|
|
86
|
+
toc,
|
|
87
|
+
slots: defaultSlots,
|
|
88
|
+
children,
|
|
89
|
+
...containerProps
|
|
90
|
+
}: DocsPageProps): react_jsx_runtime0.JSX.Element;
|
|
9
91
|
declare function EditOnGitHub(props: ComponentProps<'a'>): react_jsx_runtime0.JSX.Element;
|
|
10
92
|
/**
|
|
11
93
|
* Add typography styles
|
|
@@ -25,5 +107,11 @@ declare function DocsTitle({
|
|
|
25
107
|
className,
|
|
26
108
|
...props
|
|
27
109
|
}: ComponentProps<'h1'>): react_jsx_runtime0.JSX.Element;
|
|
110
|
+
declare function PageLastUpdate({
|
|
111
|
+
date: value,
|
|
112
|
+
...props
|
|
113
|
+
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
114
|
+
date: Date;
|
|
115
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
28
116
|
//#endregion
|
|
29
|
-
export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage,
|
|
117
|
+
export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
|