fumadocs-ui 15.1.2 → 15.2.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/css/shiki.css +11 -11
- package/dist/components/card.js +1 -1
- package/dist/components/dialog/search.d.ts.map +1 -1
- package/dist/components/dialog/search.js +1 -1
- package/dist/components/dynamic-codeblock.d.ts +1 -1
- package/dist/components/dynamic-codeblock.d.ts.map +1 -1
- package/dist/components/image-zoom.d.ts +1 -1
- package/dist/components/image-zoom.d.ts.map +1 -1
- package/dist/components/image-zoom.js +8 -4
- package/dist/components/layout/root-toggle.js +4 -4
- package/dist/components/layout/sidebar.d.ts.map +1 -1
- package/dist/components/layout/sidebar.js +5 -5
- package/dist/components/registry.js +5 -5
- package/dist/components/type-table.js +1 -1
- package/dist/contexts/i18n.d.ts +7 -1
- package/dist/contexts/i18n.d.ts.map +1 -1
- package/dist/contexts/i18n.js +5 -6
- package/dist/contexts/layout.d.ts.map +1 -1
- package/dist/contexts/layout.js +6 -5
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +4 -3
- package/dist/contexts/sidebar.d.ts +7 -1
- package/dist/contexts/sidebar.d.ts.map +1 -1
- package/dist/contexts/sidebar.js +5 -7
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +6 -9
- package/dist/layouts/docs/shared.d.ts +0 -2
- package/dist/layouts/docs/shared.d.ts.map +1 -1
- package/dist/layouts/docs/shared.js +8 -10
- package/dist/layouts/{docs.client.d.ts → docs-client.d.ts} +1 -1
- package/dist/layouts/{docs.client.d.ts.map → docs-client.d.ts.map} +1 -1
- package/dist/layouts/docs.d.ts +17 -4
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +19 -19
- package/dist/layouts/links.js +1 -1
- package/dist/layouts/{notebook.client.d.ts → notebook-client.d.ts} +4 -2
- package/dist/layouts/notebook-client.d.ts.map +1 -0
- package/dist/layouts/{notebook.client.js → notebook-client.js} +5 -8
- package/dist/layouts/notebook.d.ts +1 -1
- package/dist/layouts/notebook.d.ts.map +1 -1
- package/dist/layouts/notebook.js +7 -11
- package/dist/layouts/shared.d.ts.map +1 -1
- package/dist/layouts/shared.js +1 -1
- package/dist/mdx.d.ts +3 -1
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +2 -2
- package/dist/{page.client.d.ts → page-client.d.ts} +1 -1
- package/dist/{page.client.d.ts.map → page-client.d.ts.map} +1 -1
- package/dist/{page.client.js → page-client.js} +3 -7
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/{provider.d.ts → provider/base.d.ts} +4 -8
- package/dist/provider/base.d.ts.map +1 -0
- package/dist/{provider.js → provider/base.js} +4 -9
- package/dist/provider/index.d.ts +9 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +12 -0
- package/dist/style.css +25 -21
- package/package.json +22 -14
- package/dist/layouts/notebook.client.d.ts.map +0 -1
- package/dist/provider.d.ts.map +0 -1
- /package/dist/layouts/{docs.client.js → docs-client.js} +0 -0
package/css/shiki.css
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
.
|
|
1
|
+
.fd-codeblock code span {
|
|
2
2
|
color: var(--shiki-light);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.dark .
|
|
5
|
+
.dark .fd-codeblock code span {
|
|
6
6
|
color: var(--shiki-dark);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.fd-codeblock
|
|
9
|
+
.fd-codeblock pre > * {
|
|
10
10
|
display: grid;
|
|
11
11
|
font-size: 13px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.
|
|
14
|
+
.fd-codeblock code .diff.remove {
|
|
15
15
|
background-color: var(--fd-diff-remove-color);
|
|
16
16
|
opacity: 0.7;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.
|
|
19
|
+
.fd-codeblock code .diff::before {
|
|
20
20
|
position: absolute;
|
|
21
21
|
left: 6px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.fd-codeblock code .diff.remove::before {
|
|
25
25
|
content: '-';
|
|
26
26
|
color: var(--fd-diff-remove-symbol-color);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.
|
|
29
|
+
.fd-codeblock code .diff.add {
|
|
30
30
|
background-color: var(--fd-diff-add-color);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
33
|
+
.fd-codeblock code .diff.add::before {
|
|
34
34
|
content: '+';
|
|
35
35
|
color: var(--fd-diff-add-symbol-color);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.fd-codeblock code .diff {
|
|
39
39
|
margin: 0 -16px;
|
|
40
40
|
padding: 0 16px;
|
|
41
41
|
position: relative;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
.fd-codeblock .highlighted {
|
|
45
45
|
margin: 0 -16px;
|
|
46
46
|
padding: 0 16px;
|
|
47
47
|
background-color: color-mix(
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.
|
|
54
|
+
.fd-codeblock .highlighted-word {
|
|
55
55
|
padding: 1px 2px;
|
|
56
56
|
margin: -1px -3px;
|
|
57
57
|
border: 1px solid
|
package/dist/components/card.js
CHANGED
|
@@ -6,5 +6,5 @@ export function Cards(props) {
|
|
|
6
6
|
}
|
|
7
7
|
export function Card({ icon, title, description, ...props }) {
|
|
8
8
|
const E = props.href ? Link : 'div';
|
|
9
|
-
return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "my-0 text-sm text-fd-muted-foreground", children: description })) : null, props.children ? (_jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children })) : null] }));
|
|
9
|
+
return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit rounded-md border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "!my-0 text-sm text-fd-muted-foreground", children: description })) : null, props.children ? (_jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children })) : null] }));
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EAKd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,MAAM,EACN,cAAc,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAyDnB;AA4JD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,KAAK,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAaD,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,aAAa,2CAkCf"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { FileText, Hash, Loader2, SearchIcon, Text } from 'lucide-react';
|
|
4
|
-
import { useRouter } from 'next/navigation';
|
|
5
4
|
import { useMemo, useEffect, useState, useCallback, } from 'react';
|
|
6
5
|
import { useI18n } from '../../contexts/i18n.js';
|
|
7
6
|
import { cn } from '../../utils/cn.js';
|
|
@@ -10,6 +9,7 @@ import { buttonVariants } from '../../components/ui/button.js';
|
|
|
10
9
|
import { Dialog, DialogContent, DialogOverlay, DialogTitle, } from '@radix-ui/react-dialog';
|
|
11
10
|
import { cva } from 'class-variance-authority';
|
|
12
11
|
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
12
|
+
import { useRouter } from 'fumadocs-core/framework';
|
|
13
13
|
export function SearchDialog({ open, onOpenChange, footer, links = [], search, onSearchChange, isLoading, ...props }) {
|
|
14
14
|
const { text } = useI18n();
|
|
15
15
|
const defaultItems = useMemo(() => links.map(([name, link]) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAchE,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;CAC1C,6BAUA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-zoom.d.ts","sourceRoot":"","sources":["../../src/components/image-zoom.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"image-zoom.d.ts","sourceRoot":"","sources":["../../src/components/image-zoom.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAC1B,OAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC;;OAEG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAeF,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,2CAoBhB"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import Image from '
|
|
3
|
+
import { Image } from 'fumadocs-core/framework';
|
|
4
4
|
import './image-zoom.css';
|
|
5
5
|
import Zoom from 'react-medium-image-zoom';
|
|
6
6
|
function getImageSrc(src) {
|
|
7
7
|
if (typeof src === 'string')
|
|
8
8
|
return src;
|
|
9
|
-
if ('
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (typeof src === 'object') {
|
|
10
|
+
// Next.js
|
|
11
|
+
if ('default' in src)
|
|
12
|
+
return src.default.src;
|
|
13
|
+
return src.src;
|
|
14
|
+
}
|
|
15
|
+
return '';
|
|
12
16
|
}
|
|
13
17
|
export function ImageZoom({ zoomInProps, children, rmiz, ...props }) {
|
|
14
18
|
return (_jsx(Zoom, { zoomMargin: 20, wrapElement: "span", ...rmiz, zoomImg: {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ChevronsUpDown } from 'lucide-react';
|
|
4
4
|
import { useMemo, useState } from 'react';
|
|
5
|
-
import Link from '
|
|
6
|
-
import { usePathname } from '
|
|
5
|
+
import Link from 'fumadocs-core/link';
|
|
6
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
7
7
|
import { cn } from '../../utils/cn.js';
|
|
8
8
|
import { isActive } from '../../utils/is-active.js';
|
|
9
9
|
import { useSidebar } from '../../contexts/sidebar.js';
|
|
@@ -22,10 +22,10 @@ export function RootToggle({ options, placeholder, ...props }) {
|
|
|
22
22
|
setOpen(false);
|
|
23
23
|
};
|
|
24
24
|
const item = selected ? _jsx(Item, { ...selected }) : placeholder;
|
|
25
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [item ? (_jsxs(PopoverTrigger, { ...props, className: cn('flex flex-row items-center gap-2.5 rounded-lg ps-2 pe-4 py-1.5 hover:
|
|
25
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [item ? (_jsxs(PopoverTrigger, { ...props, className: cn('flex flex-row items-center gap-2.5 rounded-lg ps-2 pe-4 py-1.5 hover:text-fd-accent-foreground', props.className), children: [item, _jsx(ChevronsUpDown, { className: "size-4 text-fd-muted-foreground" })] })) : null, _jsx(PopoverContent, { className: "w-(--radix-popover-trigger-width) overflow-hidden p-0", children: options.map((item) => (_jsx(Link, { href: item.url, onClick: onClick, ...item.props, className: cn('flex w-full flex-row items-center gap-2 px-2 py-1.5', selected === item
|
|
26
26
|
? 'bg-fd-accent text-fd-accent-foreground'
|
|
27
27
|
: 'hover:bg-fd-accent/50', item.props?.className), children: _jsx(Item, { ...item }) }, item.url))) })] }));
|
|
28
28
|
}
|
|
29
29
|
function Item(props) {
|
|
30
|
-
return (_jsxs(_Fragment, { children: [props.icon, _jsxs("div", { className: "flex-1 text-start", children: [_jsx("p", { className: "text-sm font-medium", children: props.title }), props.description ? (_jsx("p", { className: "text-xs text-fd-muted-foreground", children: props.description })) : null] })] }));
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(_Fragment, { children: props.icon }), _jsxs("div", { className: "flex-1 text-start", children: [_jsx("p", { className: "text-sm font-medium", children: props.title }), props.description ? (_jsx("p", { className: "text-xs text-fd-muted-foreground", children: props.description })) : null] })] }));
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAGzB,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC/D;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAGzB,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,YAA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,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,2CAwDA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ChevronDown, ExternalLink } from 'lucide-react';
|
|
4
4
|
import * as Base from 'fumadocs-core/sidebar';
|
|
5
|
-
import { usePathname } from '
|
|
5
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
6
6
|
import { createContext, Fragment, useContext, useMemo, useRef, useState, } from 'react';
|
|
7
7
|
import Link from 'fumadocs-core/link';
|
|
8
8
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
@@ -50,8 +50,9 @@ export function CollapsibleSidebar(props) {
|
|
|
50
50
|
? 0
|
|
51
51
|
: 500);
|
|
52
52
|
}, "data-collapsed": collapsed, className: cn('md:transition-all', collapsed &&
|
|
53
|
-
'md:-me-(--fd-sidebar-width) md
|
|
54
|
-
'--fd-sidebar-offset': 'calc(var(--fd-sidebar-width) -
|
|
53
|
+
'md:-me-(--fd-sidebar-width) md:-translate-x-(--fd-sidebar-offset) rtl:md:translate-x-(--fd-sidebar-offset)', collapsed && hover && 'z-50 md:translate-x-0', collapsed && !hover && 'md:opacity-0', props.className), style: {
|
|
54
|
+
'--fd-sidebar-offset': 'calc(var(--fd-sidebar-width) - 6px)',
|
|
55
|
+
...props.style,
|
|
55
56
|
} }));
|
|
56
57
|
}
|
|
57
58
|
export function Sidebar({ defaultOpenLevel = 0, prefetch = true, inner, ...props }) {
|
|
@@ -185,8 +186,7 @@ export function SidebarPageTree(props) {
|
|
|
185
186
|
function PageTreeFolder({ item, ...props }) {
|
|
186
187
|
const { defaultOpenLevel, level } = useInternalContext();
|
|
187
188
|
const path = useTreePath();
|
|
188
|
-
return (_jsxs(SidebarFolder, { defaultOpen: (item.defaultOpen ?? defaultOpenLevel >= level) ||
|
|
189
|
-
path.some((pathItem) => pathItem.$id === item.$id || pathItem === item), children: [item.index ? (_jsxs(SidebarFolderLink, { href: item.index.url, external: item.index.external, ...props, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { ...props, children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { children: props.children })] }));
|
|
189
|
+
return (_jsxs(SidebarFolder, { defaultOpen: (item.defaultOpen ?? defaultOpenLevel >= level) || path.includes(item), children: [item.index ? (_jsxs(SidebarFolderLink, { href: item.index.url, external: item.index.external, ...props, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { ...props, children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { children: props.children })] }));
|
|
190
190
|
}
|
|
191
191
|
function getOffset(level) {
|
|
192
192
|
return `calc(var(--spacing) * ${(level > 1 ? level : 0) * 2 + 2})`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
const contextsMap = {
|
|
3
|
-
'../contexts/sidebar.tsx': 'fumadocs-ui/
|
|
4
|
-
'../contexts/search.tsx': 'fumadocs-ui/
|
|
5
|
-
'../contexts/tree.tsx': 'fumadocs-ui/
|
|
6
|
-
'../contexts/i18n.tsx': 'fumadocs-ui/
|
|
7
|
-
'../contexts/layout.tsx': 'fumadocs-ui/
|
|
3
|
+
'../contexts/sidebar.tsx': 'fumadocs-ui/contexts/sidebar',
|
|
4
|
+
'../contexts/search.tsx': 'fumadocs-ui/contexts/search',
|
|
5
|
+
'../contexts/tree.tsx': 'fumadocs-ui/contexts/tree',
|
|
6
|
+
'../contexts/i18n.tsx': 'fumadocs-ui/contexts/i18n',
|
|
7
|
+
'../contexts/layout.tsx': 'fumadocs-ui/contexts/layout',
|
|
8
8
|
};
|
|
9
9
|
export const registry = {
|
|
10
10
|
path: fileURLToPath(import.meta.url),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { InfoIcon } from 'lucide-react';
|
|
4
|
-
import Link from '
|
|
4
|
+
import Link from 'fumadocs-core/link';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { cn } from '../utils/cn.js';
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover.js';
|
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -22,7 +22,13 @@ interface I18nContextType {
|
|
|
22
22
|
locales?: LocaleItem[];
|
|
23
23
|
}
|
|
24
24
|
export declare const defaultTranslations: Translations;
|
|
25
|
-
export declare const I18nContext:
|
|
25
|
+
export declare const I18nContext: {
|
|
26
|
+
Provider: (props: {
|
|
27
|
+
value: I18nContextType;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
use: (errorMessage?: string) => I18nContextType;
|
|
31
|
+
};
|
|
26
32
|
export declare function I18nLabel(props: {
|
|
27
33
|
label: keyof Translations;
|
|
28
34
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IAEvB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,YAWjC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;CAEtB,CAAC;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,YAAY,CAAA;CAAE,GAAG,MAAM,CAItE;AAED,wBAAgB,OAAO,IAAI,eAAe,CAEzC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IAEvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAY,EACZ,MAAM,EACN,QAAQ,EAAE,SAAS,EACnB,cAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAChD,2CAsCA"}
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext,
|
|
4
|
-
import { usePathname, useRouter } from 'next/navigation';
|
|
3
|
+
import { createContext, usePathname, useRouter } from 'fumadocs-core/framework';
|
|
5
4
|
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
6
5
|
import { useMemo } from 'react';
|
|
7
6
|
export const defaultTranslations = {
|
|
@@ -11,12 +10,12 @@ export const defaultTranslations = {
|
|
|
11
10
|
tocNoHeadings: 'No Headings',
|
|
12
11
|
lastUpdate: 'Last updated on',
|
|
13
12
|
chooseLanguage: 'Choose a language',
|
|
14
|
-
nextPage: 'Next',
|
|
15
|
-
previousPage: 'Previous',
|
|
13
|
+
nextPage: 'Next Page',
|
|
14
|
+
previousPage: 'Previous Page',
|
|
16
15
|
chooseTheme: 'Theme',
|
|
17
16
|
editOnGithub: 'Edit on GitHub',
|
|
18
17
|
};
|
|
19
|
-
export const I18nContext = createContext({
|
|
18
|
+
export const I18nContext = createContext('I18nContext', {
|
|
20
19
|
text: defaultTranslations,
|
|
21
20
|
});
|
|
22
21
|
export function I18nLabel(props) {
|
|
@@ -24,7 +23,7 @@ export function I18nLabel(props) {
|
|
|
24
23
|
return text[props.label];
|
|
25
24
|
}
|
|
26
25
|
export function useI18n() {
|
|
27
|
-
return
|
|
26
|
+
return I18nContext.use();
|
|
28
27
|
}
|
|
29
28
|
export function I18nProvider({ locales = [], locale, onChange: _onChange, onLocaleChange = _onChange, ...props }) {
|
|
30
29
|
const router = useRouter();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/contexts/layout.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/contexts/layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAGrE,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAgB,aAAa,eAE5B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAItC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC7C;AAED,UAAU,cAAc;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB;AAMD,wBAAgB,WAAW,CAAC,EAC1B,eAAwB,EACxB,QAAQ,GACT,EAAE,gBAAgB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAwB5C;AAED,wBAAgB,MAAM,IAAI,cAAc,CAEvC"}
|
package/dist/contexts/layout.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { createContext } from 'fumadocs-core/framework';
|
|
4
5
|
/**
|
|
5
6
|
* applied styles to different layout components in `Page` from layouts
|
|
6
7
|
*/
|
|
7
|
-
const StylesContext = createContext({
|
|
8
|
+
const StylesContext = createContext('StylesContext', {
|
|
8
9
|
tocNav: 'xl:hidden',
|
|
9
10
|
toc: 'max-xl:hidden',
|
|
10
11
|
});
|
|
11
12
|
export function usePageStyles() {
|
|
12
|
-
return
|
|
13
|
+
return StylesContext.use();
|
|
13
14
|
}
|
|
14
15
|
export function StylesProvider({ children, ...value }) {
|
|
15
16
|
return (_jsx(StylesContext.Provider, { value: value, children: children }));
|
|
16
17
|
}
|
|
17
|
-
const NavContext = createContext({
|
|
18
|
+
const NavContext = createContext('NavContext', {
|
|
18
19
|
isTransparent: false,
|
|
19
20
|
});
|
|
20
21
|
export function NavProvider({ transparentMode = 'none', children, }) {
|
|
@@ -34,5 +35,5 @@ export function NavProvider({ transparentMode = 'none', children, }) {
|
|
|
34
35
|
return (_jsx(NavContext.Provider, { value: useMemo(() => ({ isTransparent: transparent }), [transparent]), children: children }));
|
|
35
36
|
}
|
|
36
37
|
export function useNav() {
|
|
37
|
-
return
|
|
38
|
+
return NavContext.use();
|
|
38
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/contexts/search.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/contexts/search.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG1E,UAAU,MAAM;IACd,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IAErB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAQD,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAcD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,QAAQ,EACR,OAAc,EACd,OAAO,EACP,MASC,EACD,KAAK,GACN,EAAE,mBAAmB,2CAuCrB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,aAI/D"}
|
package/dist/contexts/search.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { useEffect, useMemo, useState, } from 'react';
|
|
4
|
+
import { createContext } from 'fumadocs-core/framework';
|
|
5
|
+
const SearchContext = createContext('SearchContext', {
|
|
5
6
|
enabled: false,
|
|
6
7
|
hotKey: [],
|
|
7
8
|
setOpenSearch: () => undefined,
|
|
8
9
|
});
|
|
9
10
|
export function useSearchContext() {
|
|
10
|
-
return
|
|
11
|
+
return SearchContext.use();
|
|
11
12
|
}
|
|
12
13
|
function MetaOrControl() {
|
|
13
14
|
const [key, setKey] = useState('⌘');
|
|
@@ -9,7 +9,13 @@ interface SidebarContext {
|
|
|
9
9
|
*/
|
|
10
10
|
closeOnRedirect: RefObject<boolean>;
|
|
11
11
|
}
|
|
12
|
-
declare const SidebarContext:
|
|
12
|
+
declare const SidebarContext: {
|
|
13
|
+
Provider: (props: {
|
|
14
|
+
value: SidebarContext;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
use: (errorMessage?: string) => SidebarContext;
|
|
18
|
+
};
|
|
13
19
|
export declare function useSidebar(): SidebarContext;
|
|
14
20
|
export declare function SidebarProvider({ children, }: {
|
|
15
21
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5D;;OAEG;IACH,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACrC;AAED,QAAA,MAAM,cAAc;;;;;;CAAkD,CAAC;AAEvE,wBAAgB,UAAU,IAAI,cAAc,CAE3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAgCZ"}
|
package/dist/contexts/sidebar.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { usePathname } from '
|
|
3
|
+
import { useState, useMemo, useRef, } from 'react';
|
|
4
|
+
import { createContext, usePathname } from 'fumadocs-core/framework';
|
|
4
5
|
import { SidebarProvider as BaseProvider } from 'fumadocs-core/sidebar';
|
|
5
6
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
-
const SidebarContext = createContext(
|
|
7
|
+
const SidebarContext = createContext('SidebarContext');
|
|
7
8
|
export function useSidebar() {
|
|
8
|
-
|
|
9
|
-
if (!ctx)
|
|
10
|
-
throw new Error('Missing root provider');
|
|
11
|
-
return ctx;
|
|
9
|
+
return SidebarContext.use();
|
|
12
10
|
}
|
|
13
11
|
export function SidebarProvider({ children, }) {
|
|
14
12
|
const closeOnRedirect = useRef(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAGxD,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E,UAAU,eAAe;IACvB,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC5D;AAKD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAmBA;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAEhD"}
|
package/dist/contexts/tree.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { usePathname } from '
|
|
4
|
-
import {
|
|
3
|
+
import { createContext, usePathname } from 'fumadocs-core/framework';
|
|
4
|
+
import { useMemo, useRef } from 'react';
|
|
5
5
|
import { searchPath } from 'fumadocs-core/breadcrumb';
|
|
6
|
-
const TreeContext = createContext(
|
|
7
|
-
const PathContext = createContext([]);
|
|
6
|
+
const TreeContext = createContext('TreeContext');
|
|
7
|
+
const PathContext = createContext('PathContext', []);
|
|
8
8
|
export function TreeContextProvider({ children, tree, }) {
|
|
9
9
|
const nextIdRef = useRef(0);
|
|
10
10
|
const pathname = usePathname();
|
|
@@ -14,11 +14,8 @@ export function TreeContextProvider({ children, tree, }) {
|
|
|
14
14
|
return (_jsx(TreeContext.Provider, { value: useMemo(() => ({ root: root }), [root]), children: _jsx(PathContext.Provider, { value: path, children: children }) }));
|
|
15
15
|
}
|
|
16
16
|
export function useTreePath() {
|
|
17
|
-
return
|
|
17
|
+
return PathContext.use();
|
|
18
18
|
}
|
|
19
19
|
export function useTreeContext() {
|
|
20
|
-
|
|
21
|
-
if (!ctx)
|
|
22
|
-
throw new Error('You must wrap this component under <DocsLayout />');
|
|
23
|
-
return ctx;
|
|
20
|
+
return TreeContext.use('You must wrap this component under <DocsLayout />');
|
|
24
21
|
}
|
|
@@ -10,8 +10,6 @@ export interface TabOptions {
|
|
|
10
10
|
transform?: (option: Option, node: PageTree.Folder) => Option | null;
|
|
11
11
|
}
|
|
12
12
|
export interface SidebarOptions extends SidebarProps {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
component: ReactNode;
|
|
15
13
|
collapsible?: boolean;
|
|
16
14
|
components?: Partial<SidebarComponents>;
|
|
17
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,E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EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAsDA;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,QAY5C;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
|
|
@@ -3,7 +3,6 @@ import { BaseLinkItem } from '../../layouts/links.js';
|
|
|
3
3
|
import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, } from '../../components/layout/sidebar.js';
|
|
4
4
|
import { cn } from '../../utils/cn.js';
|
|
5
5
|
import { buttonVariants } from '../../components/ui/button.js';
|
|
6
|
-
import { notFound } from 'next/navigation';
|
|
7
6
|
export const layoutVariables = {
|
|
8
7
|
'--fd-layout-offset': 'max(calc(50vw - var(--fd-layout-width) / 2), 0px)',
|
|
9
8
|
};
|
|
@@ -20,9 +19,8 @@ export function SidebarLinkItem({ item, ...props }) {
|
|
|
20
19
|
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, ...props, children: item.text }));
|
|
21
20
|
}
|
|
22
21
|
export function checkPageTree(passed) {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
if (typeof passed === 'object' &&
|
|
22
|
+
if (passed &&
|
|
23
|
+
typeof passed === 'object' &&
|
|
26
24
|
'children' in passed &&
|
|
27
25
|
Array.isArray(passed.children))
|
|
28
26
|
return;
|
|
@@ -51,14 +49,14 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
|
|
|
51
49
|
function findOptions(node) {
|
|
52
50
|
const results = [];
|
|
53
51
|
if (node.root) {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
52
|
+
const urls = getFolderUrls(node);
|
|
53
|
+
if (urls.size > 0) {
|
|
56
54
|
const option = {
|
|
57
|
-
url:
|
|
55
|
+
url: urls.values().next().value ?? '',
|
|
58
56
|
title: node.name,
|
|
59
57
|
icon: node.icon,
|
|
60
58
|
description: node.description,
|
|
61
|
-
urls
|
|
59
|
+
urls,
|
|
62
60
|
};
|
|
63
61
|
const mapped = transform ? transform(option, node) : option;
|
|
64
62
|
if (mapped)
|
|
@@ -73,11 +71,11 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
|
|
|
73
71
|
}
|
|
74
72
|
return findOptions(pageTree);
|
|
75
73
|
}
|
|
76
|
-
function getFolderUrls(folder, output) {
|
|
74
|
+
function getFolderUrls(folder, output = new Set()) {
|
|
77
75
|
if (folder.index)
|
|
78
76
|
output.add(folder.index.url);
|
|
79
77
|
for (const child of folder.children) {
|
|
80
|
-
if (child.type === 'page')
|
|
78
|
+
if (child.type === 'page' && !child.external)
|
|
81
79
|
output.add(child.url);
|
|
82
80
|
if (child.type === 'folder')
|
|
83
81
|
getFolderUrls(child, output);
|
|
@@ -2,4 +2,4 @@ import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
|
2
2
|
export declare function Navbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare function NavbarSidebarTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare function CollapsibleControl(): import("react/jsx-runtime").JSX.Element | undefined;
|
|
5
|
-
//# sourceMappingURL=docs
|
|
5
|
+
//# sourceMappingURL=docs-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs
|
|
1
|
+
{"version":3,"file":"docs-client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AASvE,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAiBxD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAkB/C;AAED,wBAAgB,kBAAkB,wDAoBjC"}
|
package/dist/layouts/docs.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import type { PageTree } from 'fumadocs-core/server';
|
|
2
2
|
import { type ReactNode, type HTMLAttributes } from 'react';
|
|
3
|
-
import { type LinkItemType } from '../layouts/links.js';
|
|
3
|
+
import { type LinkItemType, type IconItemType } from '../layouts/links.js';
|
|
4
4
|
import { type BaseLayoutProps } from './shared.js';
|
|
5
|
-
import { CollapsibleControl, Navbar, NavbarSidebarTrigger } from '../layouts/docs
|
|
5
|
+
import { CollapsibleControl, Navbar, NavbarSidebarTrigger } from '../layouts/docs-client.js';
|
|
6
6
|
import { type SidebarOptions } from '../layouts/docs/shared.js';
|
|
7
7
|
export interface DocsLayoutProps extends BaseLayoutProps {
|
|
8
8
|
tree: PageTree.Root;
|
|
9
|
-
sidebar?: Partial<SidebarOptions
|
|
9
|
+
sidebar?: Partial<SidebarOptions> & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
component?: ReactNode;
|
|
12
|
+
};
|
|
10
13
|
/**
|
|
11
14
|
* Props for the `div` container
|
|
12
15
|
*/
|
|
13
16
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
14
17
|
}
|
|
15
|
-
export declare function DocsLayout({ nav: { enabled: navEnabled, component: navReplace, transparentMode, ...nav }, themeSwitch, sidebar
|
|
18
|
+
export declare function DocsLayout({ nav: { enabled: navEnabled, component: navReplace, transparentMode, ...nav }, themeSwitch, sidebar, i18n, children, ...props }: DocsLayoutProps): ReactNode;
|
|
19
|
+
export declare function DocsLayoutSidebar({ collapsible, components, tabs: tabOptions, hideSearch, tree, nav, links, footer, banner, ...props }: Partial<SidebarOptions> & {
|
|
20
|
+
tree: PageTree.Root;
|
|
21
|
+
links?: LinkItemType[];
|
|
22
|
+
nav?: ReactNode;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function DocsLayoutSidebarFooter({ i18n, themeSwitch, links, }: {
|
|
25
|
+
i18n?: DocsLayoutProps['i18n'];
|
|
26
|
+
links?: IconItemType[];
|
|
27
|
+
themeSwitch?: DocsLayoutProps['themeSwitch'];
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
16
29
|
export { CollapsibleControl, Navbar, NavbarSidebarTrigger, type LinkItemType };
|
|
17
30
|
export { getSidebarTabsFromOptions, type TabOptions } from './docs/shared.js';
|
|
18
31
|
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAcrE,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAK1D,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAQ/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,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