fumadocs-ui 14.2.1 → 14.3.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.
- package/dist/components/accordion.d.ts +4 -7
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +32 -104
- package/dist/components/api.d.ts +4 -13
- package/dist/components/api.d.ts.map +1 -0
- package/dist/components/api.js +3 -16
- package/dist/components/banner.d.ts +3 -5
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +53 -120
- package/dist/components/callout.d.ts +4 -7
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +13 -9
- package/dist/components/card.d.ts +5 -7
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -10
- package/dist/components/codeblock.d.ts +6 -9
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +41 -15
- package/dist/components/dialog/search-algolia.d.ts +7 -11
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +19 -79
- package/dist/components/dialog/search-default.d.ts +6 -10
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +24 -73
- package/dist/components/dialog/search-orama.d.ts +7 -11
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +22 -79
- package/dist/components/dialog/search.d.ts +7 -9
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +98 -13
- package/dist/components/dialog/tag-list.d.ts +13 -0
- package/dist/components/dialog/tag-list.d.ts.map +1 -0
- package/dist/components/dialog/tag-list.js +20 -0
- package/dist/components/files.d.ts +7 -9
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +15 -63
- package/dist/components/heading.d.ts +4 -5
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -9
- package/dist/components/image-zoom.d.ts +7 -8
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +16 -40
- package/dist/components/inline-toc.d.ts +4 -6
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +8 -46
- package/dist/components/layout/breadcrumb.d.ts +11 -0
- package/dist/components/layout/breadcrumb.d.ts.map +1 -0
- package/dist/components/layout/breadcrumb.js +20 -0
- package/dist/components/layout/language-toggle.d.ts +5 -7
- package/dist/components/layout/language-toggle.d.ts.map +1 -0
- package/dist/components/layout/language-toggle.js +24 -14
- package/dist/components/layout/nav.d.ts +28 -0
- package/dist/components/layout/nav.d.ts.map +1 -0
- package/dist/components/layout/nav.js +29 -0
- package/dist/components/layout/root-toggle.d.ts +5 -7
- package/dist/components/layout/root-toggle.d.ts.map +1 -0
- package/dist/components/layout/root-toggle.js +28 -13
- package/dist/components/layout/search-toggle.d.ts +4 -0
- package/dist/components/layout/search-toggle.d.ts.map +1 -0
- package/dist/components/layout/search-toggle.js +24 -0
- package/dist/components/layout/theme-toggle.d.ts +3 -0
- package/dist/components/layout/theme-toggle.d.ts.map +1 -0
- package/dist/components/layout/theme-toggle.js +21 -0
- package/dist/components/layout/toc-clerk.d.ts +6 -0
- package/dist/components/layout/toc-clerk.d.ts.map +1 -0
- package/dist/components/layout/toc-clerk.js +76 -0
- package/dist/components/layout/toc-popover.d.ts +8 -0
- package/dist/components/layout/toc-popover.d.ts.map +1 -0
- package/dist/components/layout/toc-popover.js +20 -0
- package/dist/components/layout/toc-thumb.d.ts +6 -0
- package/dist/components/layout/toc-thumb.d.ts.map +1 -0
- package/dist/components/layout/toc-thumb.js +53 -0
- package/dist/components/layout/toc.d.ts +19 -0
- package/dist/components/layout/toc.d.ts.map +1 -0
- package/dist/components/layout/toc.js +25 -0
- package/dist/components/registry.d.ts +3 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +70 -0
- package/dist/components/steps.d.ts +4 -6
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +5 -16
- package/dist/components/tabs.d.ts +7 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +61 -171
- package/dist/components/type-table.d.ts +5 -6
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +18 -59
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +14 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +15 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +16 -0
- package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +23 -0
- package/dist/contexts/search.d.ts +50 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +50 -0
- package/dist/contexts/sidebar.d.ts +18 -0
- package/dist/contexts/sidebar.d.ts.map +1 -0
- package/dist/contexts/sidebar.js +31 -0
- package/dist/contexts/tree.d.ts +13 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +25 -0
- package/dist/i18n.d.ts +5 -6
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +31 -49
- package/dist/layouts/docs/navbar.d.ts +4 -0
- package/dist/layouts/docs/navbar.d.ts.map +1 -0
- package/dist/layouts/docs/navbar.js +22 -0
- package/dist/layouts/docs/sidebar.d.ts +40 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +146 -0
- package/dist/layouts/docs.client.d.ts +14 -25
- package/dist/layouts/docs.client.d.ts.map +1 -0
- package/dist/layouts/docs.client.js +53 -195
- package/dist/layouts/docs.d.ts +34 -19
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +67 -202
- package/dist/layouts/home/menu.d.ts +6 -0
- package/dist/layouts/home/menu.d.ts.map +1 -0
- package/dist/layouts/home/menu.js +33 -0
- package/dist/layouts/home/navbar.d.ts +16 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +48 -0
- package/dist/layouts/home.d.ts +5 -7
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +51 -59
- package/dist/layouts/links.d.ts +80 -0
- package/dist/layouts/links.d.ts.map +1 -0
- package/dist/layouts/links.js +14 -0
- package/dist/layouts/shared.d.ts +48 -2
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +27 -9
- package/dist/mdx.client.d.ts +3 -6
- package/dist/mdx.client.d.ts.map +1 -0
- package/dist/mdx.client.js +12 -19
- package/dist/mdx.d.ts +18 -20
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +47 -56
- package/dist/og.d.ts +6 -7
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +43 -102
- package/dist/page.client.d.ts +8 -41
- package/dist/page.client.d.ts.map +1 -0
- package/dist/page.client.js +71 -261
- package/dist/page.d.ts +28 -30
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +80 -168
- package/dist/provider.d.ts +12 -72
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +19 -55
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +9 -20
- package/dist/tailwind-plugin.d.ts.map +1 -0
- package/dist/tailwind-plugin.js +191 -699
- package/dist/theme/animations.d.ts +170 -0
- package/dist/theme/animations.d.ts.map +1 -0
- package/dist/theme/animations.js +95 -0
- package/dist/theme/colors.d.ts +11 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +327 -0
- package/dist/theme/typography.d.ts +70 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +71 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +1 -0
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +20 -0
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -0
- package/dist/utils/is-active.js +3 -0
- package/dist/utils/use-copy-button.d.ts +3 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +25 -0
- package/package.json +9 -9
- package/dist/chunk-27HFSL7N.js +0 -53
- package/dist/chunk-2FLZOPQN.js +0 -54
- package/dist/chunk-2KMKNVSN.js +0 -29
- package/dist/chunk-AFMXKA2S.js +0 -125
- package/dist/chunk-CDPVENXR.js +0 -8
- package/dist/chunk-CLF6ZVYS.js +0 -259
- package/dist/chunk-DGKCMOIC.js +0 -56
- package/dist/chunk-DN6Z5VW6.js +0 -61
- package/dist/chunk-E3VO2QQT.js +0 -29
- package/dist/chunk-EFMHXXHW.js +0 -24
- package/dist/chunk-F534DZID.js +0 -43
- package/dist/chunk-GHOAONNQ.js +0 -48
- package/dist/chunk-IL64LMKR.js +0 -82
- package/dist/chunk-ILBYBJ5C.js +0 -38
- package/dist/chunk-IVBHRX3O.js +0 -31
- package/dist/chunk-J6XGK6ZG.js +0 -212
- package/dist/chunk-KZTWSBYY.js +0 -68
- package/dist/chunk-MCX7E6ZW.js +0 -57
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-QKOA6KEZ.js +0 -22
- package/dist/chunk-TK3TM3MR.js +0 -6
- package/dist/chunk-TQJ6YPJ3.js +0 -31
- package/dist/chunk-UUGCW3UP.js +0 -84
- package/dist/chunk-VPJMNIJX.js +0 -542
- package/dist/chunk-W36BQGMB.js +0 -69
- package/dist/chunk-YL3MZH7N.js +0 -66
- package/dist/chunk-ZBOI25UW.js +0 -139
- package/dist/components/api.client.d.ts +0 -5
- package/dist/components/api.client.js +0 -8
- package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
- package/dist/edit-on-github-FIYOWWPQ.js +0 -49
- package/dist/layouts/home.client.d.ts +0 -11
- package/dist/layouts/home.client.js +0 -274
- package/dist/shared-SScCiV7b.d.ts +0 -152
- package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
- package/dist/tag-list-BsEgfE3x.d.ts +0 -6
- package/dist/toc-clerk-SKE4LBT7.js +0 -158
- package/dist/tree-06ley65N.d.ts +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAYf,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAuBlE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAyB/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAiCD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA8C5C"}
|
package/dist/page.client.js
CHANGED
|
@@ -1,267 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "./chunk-VPJMNIJX.js";
|
|
22
|
-
import {
|
|
23
|
-
twMerge
|
|
24
|
-
} from "./chunk-TK3TM3MR.js";
|
|
25
|
-
import {
|
|
26
|
-
useTreeContext
|
|
27
|
-
} from "./chunk-YL3MZH7N.js";
|
|
28
|
-
import {
|
|
29
|
-
useSidebar
|
|
30
|
-
} from "./chunk-27HFSL7N.js";
|
|
31
|
-
import {
|
|
32
|
-
useI18n
|
|
33
|
-
} from "./chunk-EFMHXXHW.js";
|
|
34
|
-
import "./chunk-MLKGABMK.js";
|
|
35
|
-
|
|
36
|
-
// src/page.client.tsx
|
|
37
|
-
import { useEffect, useMemo as useMemo3, useState } from "react";
|
|
38
|
-
import Link2 from "next/link";
|
|
39
|
-
import { cva } from "class-variance-authority";
|
|
40
|
-
|
|
41
|
-
// src/components/layout/toc.tsx
|
|
42
|
-
import * as Primitive from "fumadocs-core/toc";
|
|
43
|
-
import {
|
|
44
|
-
useContext,
|
|
45
|
-
useMemo,
|
|
46
|
-
useRef
|
|
47
|
-
} from "react";
|
|
48
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
49
|
-
function Toc({ header, footer, children }) {
|
|
50
|
-
const { text } = useI18n();
|
|
51
|
-
return /* @__PURE__ */ jsx(
|
|
52
|
-
"div",
|
|
53
|
-
{
|
|
54
|
-
"data-toc": "",
|
|
55
|
-
className: "sticky top-fd-layout-top h-[var(--fd-toc-height)] flex-1 pb-2 pt-12 max-lg:hidden",
|
|
56
|
-
style: {
|
|
57
|
-
"--fd-toc-height": "calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))"
|
|
58
|
-
},
|
|
59
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] flex-col gap-3 pe-2", children: [
|
|
60
|
-
header,
|
|
61
|
-
/* @__PURE__ */ jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [
|
|
62
|
-
/* @__PURE__ */ jsx(Text, { className: "size-4" }),
|
|
63
|
-
text.toc
|
|
64
|
-
] }),
|
|
65
|
-
children,
|
|
66
|
-
footer
|
|
67
|
-
] })
|
|
68
|
-
}
|
|
69
|
-
);
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useEffect, useMemo, useState, } from 'react';
|
|
4
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { cn } from './utils/cn';
|
|
8
|
+
import { useI18n } from './contexts/i18n';
|
|
9
|
+
import { useTreeContext } from './contexts/tree';
|
|
10
|
+
import { useSidebar } from './contexts/sidebar';
|
|
11
|
+
import { usePathname } from 'next/navigation';
|
|
12
|
+
import { NavContext } from './components/layout/nav';
|
|
13
|
+
export function PageContainer(props) {
|
|
14
|
+
const { collapsed } = useSidebar();
|
|
15
|
+
return (_jsx("div", { id: "nd-page", ...props, className: cn('flex w-full min-w-0 max-w-[var(--fd-page-width)] flex-col md:transition-[max-width]', props.className), style: {
|
|
16
|
+
...props.style,
|
|
17
|
+
'--fd-page-width': collapsed
|
|
18
|
+
? '100vw'
|
|
19
|
+
: 'calc(min(100vw, var(--fd-layout-width)) - var(--fd-sidebar-width) - var(--fd-toc-width))',
|
|
20
|
+
}, children: props.children }));
|
|
70
21
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
className: twMerge(
|
|
79
|
-
"sticky top-fd-layout-top z-10 border-b border-fd-foreground/10 text-sm transition-colors md:top-[var(--fd-toc-top-with-offset)] md:mx-3 md:rounded-full md:border",
|
|
80
|
-
!isTransparent && "bg-fd-background/80 backdrop-blur-md md:shadow-md",
|
|
81
|
-
open && "opacity-0",
|
|
82
|
-
props.className
|
|
83
|
-
),
|
|
84
|
-
style: {
|
|
85
|
-
"--fd-toc-top-with-offset": "calc(4px + var(--fd-banner-height) + var(--fd-nav-height))"
|
|
86
|
-
},
|
|
87
|
-
children: props.children
|
|
88
|
-
}
|
|
89
|
-
);
|
|
22
|
+
export function PageHeader(props) {
|
|
23
|
+
const { open } = useSidebar();
|
|
24
|
+
const { isTransparent } = useContext(NavContext);
|
|
25
|
+
return (_jsx("div", { id: "nd-tocnav", ...props, className: cn('sticky top-fd-layout-top z-10 flex flex-row items-center border-b border-fd-foreground/10 text-sm transition-colors', !isTransparent && 'bg-fd-background/80 backdrop-blur-md', open && 'opacity-0', props.className), style: {
|
|
26
|
+
...props.style,
|
|
27
|
+
'--fd-toc-top-with-offset': 'calc(4px + var(--fd-banner-height) + var(--fd-nav-height))',
|
|
28
|
+
}, children: props.children }));
|
|
90
29
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
}, [items, active]);
|
|
100
|
-
return /* @__PURE__ */ jsx(TocNav, { ...props, children: /* @__PURE__ */ jsxs(Popover, { children: [
|
|
101
|
-
/* @__PURE__ */ jsxs(PopoverTrigger, { className: "inline-flex size-full items-center gap-2 text-nowrap px-4 py-2 text-left md:px-3", children: [
|
|
102
|
-
/* @__PURE__ */ jsx(Text, { className: "size-4 shrink-0" }),
|
|
103
|
-
text.toc,
|
|
104
|
-
current ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: "-mx-1.5 size-4 shrink-0 text-fd-muted-foreground" }),
|
|
106
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-fd-muted-foreground", children: current })
|
|
107
|
-
] }) : null
|
|
108
|
-
] }),
|
|
109
|
-
/* @__PURE__ */ jsxs(
|
|
110
|
-
PopoverContent,
|
|
111
|
-
{
|
|
112
|
-
hideWhenDetached: true,
|
|
113
|
-
alignOffset: 16,
|
|
114
|
-
align: "start",
|
|
115
|
-
side: "bottom",
|
|
116
|
-
className: "flex max-h-[var(--radix-popover-content-available-height)] w-[260px] flex-col gap-4 p-3",
|
|
117
|
-
"data-toc-popover": "",
|
|
118
|
-
children: [
|
|
119
|
-
props.header,
|
|
120
|
-
props.children,
|
|
121
|
-
props.footer
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
] }) });
|
|
30
|
+
export function LastUpdate(props) {
|
|
31
|
+
const { text } = useI18n();
|
|
32
|
+
const [date, setDate] = useState('');
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
// to the timezone of client
|
|
35
|
+
setDate(props.date.toLocaleDateString());
|
|
36
|
+
}, [props.date]);
|
|
37
|
+
return (_jsxs("p", { className: "text-sm text-fd-muted-foreground", children: [text.lastUpdate, " ", date] }));
|
|
126
38
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
/* @__PURE__ */ jsx(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
147
|
-
ref: containerRef,
|
|
148
|
-
className: twMerge(
|
|
149
|
-
"flex flex-col",
|
|
150
|
-
!isMenu && "border-s border-fd-foreground/10"
|
|
151
|
-
),
|
|
152
|
-
children: items.map((item) => /* @__PURE__ */ jsx(TOCItem2, { item }, item.url))
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
] }) }) });
|
|
156
|
-
}
|
|
157
|
-
function TOCItem2({ item }) {
|
|
158
|
-
return /* @__PURE__ */ jsx(
|
|
159
|
-
Primitive.TOCItem,
|
|
160
|
-
{
|
|
161
|
-
href: item.url,
|
|
162
|
-
className: twMerge(
|
|
163
|
-
"prose py-1.5 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
164
|
-
item.depth <= 2 && "ps-3.5",
|
|
165
|
-
item.depth === 3 && "ps-6",
|
|
166
|
-
item.depth >= 4 && "ps-8"
|
|
167
|
-
),
|
|
168
|
-
children: item.title
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// src/components/layout/breadcrumb.tsx
|
|
174
|
-
import {
|
|
175
|
-
getBreadcrumbItemsFromPath
|
|
176
|
-
} from "fumadocs-core/breadcrumb";
|
|
177
|
-
import Link from "next/link";
|
|
178
|
-
import { Fragment as Fragment2, useMemo as useMemo2 } from "react";
|
|
179
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
180
|
-
function Breadcrumb({
|
|
181
|
-
full = false,
|
|
182
|
-
...options
|
|
183
|
-
}) {
|
|
184
|
-
const { path, root } = useTreeContext();
|
|
185
|
-
const items = useMemo2(() => {
|
|
186
|
-
return getBreadcrumbItemsFromPath(root, path, {
|
|
187
|
-
includePage: full,
|
|
188
|
-
...options
|
|
39
|
+
const itemVariants = cva('flex w-full flex-col gap-2 rounded-lg border bg-fd-card p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground');
|
|
40
|
+
const itemLabel = cva('inline-flex items-center gap-0.5 text-fd-muted-foreground');
|
|
41
|
+
function scanNavigationList(tree) {
|
|
42
|
+
const list = [];
|
|
43
|
+
tree.forEach((node) => {
|
|
44
|
+
if (node.type === 'folder') {
|
|
45
|
+
if (node.index) {
|
|
46
|
+
list.push(node.index);
|
|
47
|
+
}
|
|
48
|
+
list.push(...scanNavigationList(node.children));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (node.type === 'page' && !node.external) {
|
|
52
|
+
list.push(node);
|
|
53
|
+
}
|
|
189
54
|
});
|
|
190
|
-
|
|
191
|
-
if (items.length === 0) return null;
|
|
192
|
-
return /* @__PURE__ */ jsx2("div", { className: "-mb-3 flex flex-row items-center gap-1 text-sm font-medium text-fd-muted-foreground", children: items.map((item, i) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
193
|
-
i !== 0 && /* @__PURE__ */ jsx2(ChevronRight, { className: "size-4 shrink-0 rtl:rotate-180" }),
|
|
194
|
-
item.url ? /* @__PURE__ */ jsx2(
|
|
195
|
-
Link,
|
|
196
|
-
{
|
|
197
|
-
href: item.url,
|
|
198
|
-
className: "truncate hover:text-fd-accent-foreground",
|
|
199
|
-
children: item.name
|
|
200
|
-
}
|
|
201
|
-
) : /* @__PURE__ */ jsx2("span", { className: "truncate", children: item.name })
|
|
202
|
-
] }, i)) });
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// src/page.client.tsx
|
|
206
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
207
|
-
function LastUpdate(props) {
|
|
208
|
-
const { text } = useI18n();
|
|
209
|
-
const [date, setDate] = useState("");
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
setDate(props.date.toLocaleDateString());
|
|
212
|
-
}, [props.date]);
|
|
213
|
-
return /* @__PURE__ */ jsxs3("p", { className: "text-sm text-fd-muted-foreground", children: [
|
|
214
|
-
text.lastUpdate,
|
|
215
|
-
" ",
|
|
216
|
-
date
|
|
217
|
-
] });
|
|
55
|
+
return list;
|
|
218
56
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/* @__PURE__ */ jsx3(ChevronLeft, { className: "-ms-1 size-4 shrink-0 rtl:rotate-180" }),
|
|
240
|
-
/* @__PURE__ */ jsx3("p", { children: text.previousPage })
|
|
241
|
-
] }),
|
|
242
|
-
/* @__PURE__ */ jsx3("p", { className: "font-medium", children: previous.name })
|
|
243
|
-
] }) : null,
|
|
244
|
-
next ? /* @__PURE__ */ jsxs3(
|
|
245
|
-
Link2,
|
|
246
|
-
{
|
|
247
|
-
href: next.url,
|
|
248
|
-
className: twMerge(itemVariants({ className: "col-start-2 text-end" })),
|
|
249
|
-
children: [
|
|
250
|
-
/* @__PURE__ */ jsxs3("div", { className: twMerge(itemLabel({ className: "flex-row-reverse" })), children: [
|
|
251
|
-
/* @__PURE__ */ jsx3(ChevronRight, { className: "-me-1 size-4 shrink-0 rtl:rotate-180" }),
|
|
252
|
-
/* @__PURE__ */ jsx3("p", { children: text.nextPage })
|
|
253
|
-
] }),
|
|
254
|
-
/* @__PURE__ */ jsx3("p", { className: "font-medium", children: next.name })
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
) : null
|
|
258
|
-
] });
|
|
57
|
+
const listCache = new WeakMap();
|
|
58
|
+
export function Footer({ items }) {
|
|
59
|
+
const { root } = useTreeContext();
|
|
60
|
+
const { text } = useI18n();
|
|
61
|
+
const pathname = usePathname();
|
|
62
|
+
const { previous, next } = useMemo(() => {
|
|
63
|
+
if (items)
|
|
64
|
+
return items;
|
|
65
|
+
const cached = listCache.get(root);
|
|
66
|
+
const list = cached ?? scanNavigationList(root.children);
|
|
67
|
+
listCache.set(root, list);
|
|
68
|
+
const idx = list.findIndex((item) => item.url === pathname);
|
|
69
|
+
if (idx === -1)
|
|
70
|
+
return {};
|
|
71
|
+
return {
|
|
72
|
+
previous: list[idx - 1],
|
|
73
|
+
next: list[idx + 1],
|
|
74
|
+
};
|
|
75
|
+
}, [items, pathname, root]);
|
|
76
|
+
return (_jsxs("div", { className: "grid grid-cols-2 gap-4 pb-6", children: [previous ? (_jsxs(Link, { href: previous.url, className: cn(itemVariants()), children: [_jsxs("div", { className: cn(itemLabel()), children: [_jsx(ChevronLeft, { className: "-ms-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: text.previousPage })] }), _jsx("p", { className: "font-medium", children: previous.name })] })) : null, next ? (_jsxs(Link, { href: next.url, className: cn(itemVariants({ className: 'col-start-2 text-end' })), children: [_jsxs("div", { className: cn(itemLabel({ className: 'flex-row-reverse' })), children: [_jsx(ChevronRight, { className: "-me-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: text.nextPage })] }), _jsx("p", { className: "font-medium", children: next.name })] })) : null] }));
|
|
259
77
|
}
|
|
260
|
-
export {
|
|
261
|
-
Breadcrumb,
|
|
262
|
-
Footer,
|
|
263
|
-
LastUpdate,
|
|
264
|
-
TOCItems,
|
|
265
|
-
Toc,
|
|
266
|
-
TocPopover
|
|
267
|
-
};
|
package/dist/page.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AnchorHTMLAttributes,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import '
|
|
8
|
-
|
|
1
|
+
import { type PageTree, type TableOfContents } from 'fumadocs-core/server';
|
|
2
|
+
import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
3
|
+
import type { LoaderConfig, LoaderOutput, Page } from 'fumadocs-core/source';
|
|
4
|
+
import { type AnchorProviderProps } from 'fumadocs-core/toc';
|
|
5
|
+
import { type FooterProps } from './page.client';
|
|
6
|
+
import { type BreadcrumbProps } from './components/layout/breadcrumb';
|
|
7
|
+
import { type TOCProps } from './components/layout/toc';
|
|
8
|
+
type TableOfContentOptions = Omit<TOCProps, 'items' | 'children'> & Pick<AnchorProviderProps, 'single'> & {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
component: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* @defaultValue 'normal'
|
|
13
|
+
*/
|
|
14
|
+
style?: 'normal' | 'clerk';
|
|
15
|
+
};
|
|
16
|
+
type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
|
|
9
17
|
interface EditOnGitHubOptions extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'children'> {
|
|
10
18
|
owner: string;
|
|
11
19
|
repo: string;
|
|
@@ -20,16 +28,6 @@ interface EditOnGitHubOptions extends Omit<AnchorHTMLAttributes<HTMLAnchorElemen
|
|
|
20
28
|
*/
|
|
21
29
|
path: string;
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
type TableOfContentOptions = Omit<TOCProps, 'items' | 'children'> & Pick<AnchorProviderProps, 'single'> & {
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
component: ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* @defaultValue 'normal'
|
|
29
|
-
*/
|
|
30
|
-
style?: 'normal' | 'clerk';
|
|
31
|
-
};
|
|
32
|
-
type TableOfContentPopoverOptions = Omit<TableOfContentOptions, 'single'>;
|
|
33
31
|
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
34
32
|
enabled: boolean;
|
|
35
33
|
component: ReactNode;
|
|
@@ -38,7 +36,7 @@ interface FooterOptions extends FooterProps {
|
|
|
38
36
|
enabled: boolean;
|
|
39
37
|
component: ReactNode;
|
|
40
38
|
}
|
|
41
|
-
interface DocsPageProps {
|
|
39
|
+
export interface DocsPageProps {
|
|
42
40
|
toc?: TableOfContents;
|
|
43
41
|
/**
|
|
44
42
|
* Extend the page to fill all available space
|
|
@@ -60,23 +58,23 @@ interface DocsPageProps {
|
|
|
60
58
|
lastUpdate?: Date | string | number;
|
|
61
59
|
children: ReactNode;
|
|
62
60
|
}
|
|
63
|
-
declare function DocsPage({ toc, breadcrumb, full, footer, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps):
|
|
61
|
+
export declare function DocsPage({ toc, breadcrumb, full, footer, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): ReactNode;
|
|
64
62
|
/**
|
|
65
63
|
* Add typography styles
|
|
66
64
|
*/
|
|
67
|
-
declare const DocsBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
68
|
-
declare const DocsDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
|
|
69
|
-
declare const DocsTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & react.RefAttributes<HTMLHeadingElement>>;
|
|
70
|
-
declare function DocsCategory({ page, from, tree: forcedTree, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
65
|
+
export declare const DocsBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export declare const DocsDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
67
|
+
export declare const DocsTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
68
|
+
export declare function DocsCategory({ page, from, tree: forcedTree, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
71
69
|
page: Page;
|
|
72
70
|
from: LoaderOutput<LoaderConfig>;
|
|
73
71
|
tree?: PageTree.Root;
|
|
74
|
-
}):
|
|
72
|
+
}): ReactNode;
|
|
75
73
|
/**
|
|
76
74
|
* For separate MDX page
|
|
77
75
|
*/
|
|
78
|
-
declare function withArticle({ children
|
|
79
|
-
children:
|
|
80
|
-
}):
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
export declare function withArticle({ children }: {
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
}): ReactNode;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"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"}
|