fumadocs-ui 15.7.4 → 15.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/codeblock.d.ts +1 -1
- package/dist/components/codeblock.d.ts.map +1 -1
- package/dist/components/codeblock.js +5 -3
- package/dist/components/layout/root-toggle.d.ts +2 -13
- package/dist/components/layout/root-toggle.d.ts.map +1 -1
- package/dist/components/layout/root-toggle.js +2 -7
- package/dist/components/layout/sidebar.js +1 -1
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +4 -10
- package/dist/mdx.d.ts +2 -2
- package/dist/mdx.d.ts.map +1 -1
- package/dist/page.js +1 -1
- package/dist/style.css +9 -3
- package/dist/utils/get-sidebar-tabs.d.ts +17 -3
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -1
- package/dist/utils/get-sidebar-tabs.js +7 -9
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -1
- package/dist/utils/is-active.js +12 -4
- package/package.json +8 -8
|
@@ -38,5 +38,5 @@ export declare function CodeBlock({ ref, title, allowCopy, keepBackground, icon,
|
|
|
38
38
|
export declare function CodeBlockTabs({ ref, ...props }: ComponentProps<typeof Tabs>): import("react/jsx-runtime").JSX.Element;
|
|
39
39
|
export declare function CodeBlockTabsList(props: ComponentProps<typeof TabsList>): import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export declare function CodeBlockTabsTrigger({ children, ...props }: ComponentProps<typeof TabsTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export declare
|
|
41
|
+
export declare function CodeBlockTab({ className, ...props }: ComponentProps<typeof TabsContent>): import("react/jsx-runtime").JSX.Element;
|
|
42
42
|
//# sourceMappingURL=codeblock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/components/codeblock.tsx"],"names":[],"mappings":"AAEA,O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AQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAapC;AAGD,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAEpC"}
|
|
@@ -15,7 +15,7 @@ export function CodeBlock({ ref, title, allowCopy, keepBackground = false, icon,
|
|
|
15
15
|
const inTab = useContext(TabsContext) !== null;
|
|
16
16
|
const areaRef = useRef(null);
|
|
17
17
|
allowCopy ?? (allowCopy = !inTab);
|
|
18
|
-
return (_jsxs("figure", { ref: ref, dir: "ltr", ...props, className: cn(inTab ? '
|
|
18
|
+
return (_jsxs("figure", { ref: ref, dir: "ltr", ...props, className: cn(inTab ? 'bg-fd-secondary' : 'my-4 bg-fd-card', keepBackground && 'bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)', 'shiki relative border shadow-md rounded-xl outline-none not-prose overflow-hidden text-sm', props.className), children: [title ? (_jsxs("div", { className: "flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4", children: [typeof icon === 'string' ? (_jsx("div", { className: "[&_svg]:size-3.5", dangerouslySetInnerHTML: {
|
|
19
19
|
__html: icon,
|
|
20
20
|
} })) : (icon), _jsx("figcaption", { className: "flex-1 truncate", children: title }), Actions({
|
|
21
21
|
className: '-me-2',
|
|
@@ -51,7 +51,7 @@ function CopyButton({ className, containerRef, ...props }) {
|
|
|
51
51
|
export function CodeBlockTabs({ ref, ...props }) {
|
|
52
52
|
const containerRef = useRef(null);
|
|
53
53
|
const nested = useContext(TabsContext) !== null;
|
|
54
|
-
return (_jsx(Tabs, { ref: mergeRefs(containerRef, ref), ...props, className: cn('bg-fd-card
|
|
54
|
+
return (_jsx(Tabs, { ref: mergeRefs(containerRef, ref), ...props, className: cn('bg-fd-card rounded-xl border', nested ? 'shadow-sm' : 'my-4', props.className), children: _jsx(TabsContext.Provider, { value: useMemo(() => ({
|
|
55
55
|
containerRef,
|
|
56
56
|
nested,
|
|
57
57
|
}), [nested]), children: props.children }) }));
|
|
@@ -64,4 +64,6 @@ export function CodeBlockTabsTrigger({ children, ...props }) {
|
|
|
64
64
|
return (_jsxs(TabsTrigger, { ...props, className: cn('relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 hover:text-fd-accent-foreground data-[state=active]:text-fd-primary [&_svg]:size-3.5', props.className), children: [_jsx("div", { className: "absolute inset-x-2 bottom-0 h-px group-data-[state=active]:bg-fd-primary" }), children] }));
|
|
65
65
|
}
|
|
66
66
|
// TODO: currently Vite RSC plugin has problem with adding `asChild` here, maybe revisit this in future
|
|
67
|
-
export
|
|
67
|
+
export function CodeBlockTab({ className, ...props }) {
|
|
68
|
+
return _jsx(TabsContent, { className: cn('-mx-px -mb-px', className), ...props });
|
|
69
|
+
}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Redirect URL of the folder, usually the index page
|
|
5
|
-
*/
|
|
6
|
-
url: string;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
title: ReactNode;
|
|
9
|
-
description?: ReactNode;
|
|
10
|
-
unlisted?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Detect from a list of urls
|
|
13
|
-
*/
|
|
14
|
-
urls?: Set<string>;
|
|
2
|
+
import type { SidebarTab } from '../../utils/get-sidebar-tabs.js';
|
|
3
|
+
export interface Option extends SidebarTab {
|
|
15
4
|
props?: ComponentProps<'a'>;
|
|
16
5
|
}
|
|
17
6
|
export declare function RootToggle({ options, placeholder, ...props }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAO/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,MAAO,SAAQ,UAAU;IACxC,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,QAAQ,CAAC,2CAgF3B"}
|
|
@@ -5,7 +5,7 @@ import { useMemo, useState } from 'react';
|
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { usePathname } from 'fumadocs-core/framework';
|
|
7
7
|
import { cn } from '../../utils/cn.js';
|
|
8
|
-
import {
|
|
8
|
+
import { isTabActive } from '../../utils/is-active.js';
|
|
9
9
|
import { useSidebar } from '../../contexts/sidebar.js';
|
|
10
10
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';
|
|
11
11
|
export function RootToggle({ options, placeholder, ...props }) {
|
|
@@ -13,12 +13,7 @@ export function RootToggle({ options, placeholder, ...props }) {
|
|
|
13
13
|
const { closeOnRedirect } = useSidebar();
|
|
14
14
|
const pathname = usePathname();
|
|
15
15
|
const selected = useMemo(() => {
|
|
16
|
-
|
|
17
|
-
return options.findLast((item) => {
|
|
18
|
-
if (item.urls)
|
|
19
|
-
return item.urls.has(lookup);
|
|
20
|
-
return isActive(item.url, pathname, true);
|
|
21
|
-
});
|
|
16
|
+
return options.findLast((item) => isTabActive(item, pathname));
|
|
22
17
|
}, [options, pathname]);
|
|
23
18
|
const onClick = () => {
|
|
24
19
|
closeOnRedirect.current = false;
|
|
@@ -88,7 +88,7 @@ export function SidebarHeader(props) {
|
|
|
88
88
|
return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 p-4 pb-2', props.className), children: props.children }));
|
|
89
89
|
}
|
|
90
90
|
export function SidebarFooter(props) {
|
|
91
|
-
return (_jsx("div", { ...props, className: cn('flex flex-col border-t
|
|
91
|
+
return (_jsx("div", { ...props, className: cn('flex flex-col border-t p-4 pt-2', props.className), children: props.children }));
|
|
92
92
|
}
|
|
93
93
|
export function SidebarViewport(props) {
|
|
94
94
|
return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { className: "p-4 overscroll-contain", style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAsBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAkB1B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAsBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAkB1B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,2CAuBA"}
|
|
@@ -8,7 +8,7 @@ import { buttonVariants } from '../../components/ui/button.js';
|
|
|
8
8
|
import { Sidebar as SidebarIcon } from '../../icons.js';
|
|
9
9
|
import Link from 'fumadocs-core/link';
|
|
10
10
|
import { usePathname } from 'fumadocs-core/framework';
|
|
11
|
-
import {
|
|
11
|
+
import { isTabActive } from '../../utils/is-active.js';
|
|
12
12
|
export function Navbar({ mode, ...props }) {
|
|
13
13
|
const { open, collapsed } = useSidebar();
|
|
14
14
|
const { isTransparent } = useNav();
|
|
@@ -36,16 +36,10 @@ export function NavbarSidebarTrigger({ className, ...props }) {
|
|
|
36
36
|
export function LayoutTabs({ options, ...props }) {
|
|
37
37
|
const pathname = usePathname();
|
|
38
38
|
const selected = useMemo(() => {
|
|
39
|
-
|
|
40
|
-
return options.findLast((option) => {
|
|
41
|
-
if (option.urls) {
|
|
42
|
-
return option.urls.has(url);
|
|
43
|
-
}
|
|
44
|
-
return isActive(option.url, pathname, true);
|
|
45
|
-
});
|
|
39
|
+
return options.findLast((option) => isTabActive(option, pathname));
|
|
46
40
|
}, [options, pathname]);
|
|
47
41
|
return (_jsx("div", { ...props, className: cn('flex flex-row items-end gap-6 overflow-auto', props.className), children: options.map((option) => (_jsx(LayoutTab, { selected: selected === option, option: option }, option.url))) }));
|
|
48
42
|
}
|
|
49
|
-
function LayoutTab({ option, selected = false, }) {
|
|
50
|
-
return (_jsx(Link, { className: cn('inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground',
|
|
43
|
+
function LayoutTab({ option: { title, url, unlisted, props }, selected = false, }) {
|
|
44
|
+
return (_jsx(Link, { href: url, ...props, className: cn('inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground', unlisted && !selected && 'hidden', selected && 'border-fd-primary text-fd-primary', props?.className), children: title }));
|
|
51
45
|
}
|
package/dist/mdx.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from 'react';
|
|
2
2
|
import { Card, Cards } from './components/card.js';
|
|
3
|
-
import { CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from './components/codeblock.js';
|
|
3
|
+
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from './components/codeblock.js';
|
|
4
4
|
declare function Image(props: ImgHTMLAttributes<HTMLImageElement> & {
|
|
5
5
|
sizes?: string;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare function Table(props: TableHTMLAttributes<HTMLTableElement>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare const defaultMdxComponents: {
|
|
9
|
-
CodeBlockTab: typeof
|
|
9
|
+
CodeBlockTab: typeof CodeBlockTab;
|
|
10
10
|
CodeBlockTabs: typeof CodeBlockTabs;
|
|
11
11
|
CodeBlockTabsList: typeof CodeBlockTabsList;
|
|
12
12
|
CodeBlockTabsTrigger: typeof CodeBlockTabsTrigger;
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAEL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,wBAAwB,CAAC;AAEhC,iBAAS,KAAK,CACZ,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAUF;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;;;;;iBAKX,cAAc,CAAC,cAAc,CAAC;;;OAOhC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,cAAc,EAAE,kBAK5D,CAAC;AAEJ,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/page.js
CHANGED
|
@@ -35,7 +35,7 @@ export function EditOnGitHub(props) {
|
|
|
35
35
|
/**
|
|
36
36
|
* Add typography styles
|
|
37
37
|
*/
|
|
38
|
-
export const DocsBody = forwardRef((props, ref) => (_jsx("div", { ref: ref, ...props, className: cn('prose', props.className), children: props.children })));
|
|
38
|
+
export const DocsBody = forwardRef((props, ref) => (_jsx("div", { ref: ref, ...props, className: cn('prose flex-1', props.className), children: props.children })));
|
|
39
39
|
DocsBody.displayName = 'DocsBody';
|
|
40
40
|
export const DocsDescription = forwardRef((props, ref) => {
|
|
41
41
|
// don't render if no description provided
|
package/dist/style.css
CHANGED
|
@@ -415,9 +415,6 @@
|
|
|
415
415
|
max-width: 96rem;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
.-m-1 {
|
|
419
|
-
margin: calc(var(--spacing) * -1);
|
|
420
|
-
}
|
|
421
418
|
.container {
|
|
422
419
|
margin-inline: auto;
|
|
423
420
|
padding-inline: 1rem;
|
|
@@ -428,6 +425,9 @@
|
|
|
428
425
|
.-mx-1 {
|
|
429
426
|
margin-inline: calc(var(--spacing) * -1);
|
|
430
427
|
}
|
|
428
|
+
.-mx-px {
|
|
429
|
+
margin-inline: -1px;
|
|
430
|
+
}
|
|
431
431
|
.mx-\(--fd-layout-offset\) {
|
|
432
432
|
margin-inline: var(--fd-layout-offset);
|
|
433
433
|
}
|
|
@@ -863,6 +863,9 @@
|
|
|
863
863
|
.mr-auto {
|
|
864
864
|
margin-right: auto;
|
|
865
865
|
}
|
|
866
|
+
.-mb-px {
|
|
867
|
+
margin-bottom: -1px;
|
|
868
|
+
}
|
|
866
869
|
.mb-1 {
|
|
867
870
|
margin-bottom: calc(var(--spacing) * 1);
|
|
868
871
|
}
|
|
@@ -1515,6 +1518,9 @@
|
|
|
1515
1518
|
.pt-0 {
|
|
1516
1519
|
padding-top: calc(var(--spacing) * 0);
|
|
1517
1520
|
}
|
|
1521
|
+
.pt-2 {
|
|
1522
|
+
padding-top: calc(var(--spacing) * 2);
|
|
1523
|
+
}
|
|
1518
1524
|
.pt-8 {
|
|
1519
1525
|
padding-top: calc(var(--spacing) * 8);
|
|
1520
1526
|
}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { PageTree } from 'fumadocs-core/server';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export interface SidebarTab {
|
|
4
|
+
/**
|
|
5
|
+
* Redirect URL of the folder, usually the index page
|
|
6
|
+
*/
|
|
7
|
+
url: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Detect from a list of urls
|
|
13
|
+
*/
|
|
14
|
+
urls?: Set<string>;
|
|
15
|
+
unlisted?: boolean;
|
|
16
|
+
}
|
|
3
17
|
export interface GetSidebarTabsOptions {
|
|
4
|
-
transform?: (option:
|
|
18
|
+
transform?: (option: SidebarTab, node: PageTree.Folder) => SidebarTab | null;
|
|
5
19
|
}
|
|
6
|
-
export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions):
|
|
20
|
+
export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions): SidebarTab[];
|
|
7
21
|
//# sourceMappingURL=get-sidebar-tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;CAC9E;AAeD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,EAAE,SAA4B,EAAE,GAAE,qBAA0B,GAC3D,UAAU,EAAE,CAkCd"}
|
|
@@ -8,8 +8,8 @@ const defaultTransform = (option, node) => {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
export function getSidebarTabs(tree, { transform = defaultTransform } = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const results = [];
|
|
12
|
+
function scanOptions(node, unlisted) {
|
|
13
13
|
if ('root' in node && node.root) {
|
|
14
14
|
const urls = getFolderUrls(node);
|
|
15
15
|
if (urls.size > 0) {
|
|
@@ -28,15 +28,13 @@ export function getSidebarTabs(tree, { transform = defaultTransform } = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
for (const child of node.children) {
|
|
30
30
|
if (child.type === 'folder')
|
|
31
|
-
|
|
31
|
+
scanOptions(child, unlisted);
|
|
32
32
|
}
|
|
33
|
-
return results;
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
if (tree.fallback)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return options;
|
|
34
|
+
scanOptions(tree);
|
|
35
|
+
if (tree.fallback)
|
|
36
|
+
scanOptions(tree.fallback, true);
|
|
37
|
+
return results;
|
|
40
38
|
}
|
|
41
39
|
function getFolderUrls(folder, output = new Set()) {
|
|
42
40
|
if (folder.index)
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { SidebarTab } from '../utils/get-sidebar-tabs.js';
|
|
1
2
|
export declare function isActive(url: string, pathname: string, nested?: boolean): boolean;
|
|
3
|
+
export declare function isTabActive(tab: SidebarTab, pathname: string): boolean;
|
|
2
4
|
//# sourceMappingURL=is-active.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT"}
|
|
1
|
+
{"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAO3D,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAI5D"}
|
package/dist/utils/is-active.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
function normalize(url) {
|
|
2
|
+
if (url.length > 1 && url.endsWith('/'))
|
|
3
|
+
return url.slice(0, -1);
|
|
4
|
+
return url;
|
|
5
|
+
}
|
|
1
6
|
export function isActive(url, pathname, nested = true) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (pathname.endsWith('/'))
|
|
5
|
-
pathname = pathname.slice(0, -1);
|
|
7
|
+
url = normalize(url);
|
|
8
|
+
pathname = normalize(pathname);
|
|
6
9
|
return url === pathname || (nested && pathname.startsWith(`${url}/`));
|
|
7
10
|
}
|
|
11
|
+
export function isTabActive(tab, pathname) {
|
|
12
|
+
if (tab.urls)
|
|
13
|
+
return tab.urls.has(normalize(pathname));
|
|
14
|
+
return isActive(tab.url, pathname, true);
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.7.
|
|
3
|
+
"version": "15.7.6",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -121,20 +121,20 @@
|
|
|
121
121
|
"react-medium-image-zoom": "^5.3.0",
|
|
122
122
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
123
123
|
"tailwind-merge": "^3.3.1",
|
|
124
|
-
"fumadocs-core": "15.7.
|
|
124
|
+
"fumadocs-core": "15.7.6"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
-
"@next/eslint-plugin-next": "^15.5.
|
|
127
|
+
"@next/eslint-plugin-next": "^15.5.2",
|
|
128
128
|
"@tailwindcss/cli": "^4.1.12",
|
|
129
129
|
"@types/lodash.merge": "^4.6.9",
|
|
130
|
-
"@types/react": "^19.1.
|
|
131
|
-
"@types/react-dom": "^19.1.
|
|
132
|
-
"next": "15.5.
|
|
130
|
+
"@types/react": "^19.1.12",
|
|
131
|
+
"@types/react-dom": "^19.1.8",
|
|
132
|
+
"next": "15.5.2",
|
|
133
133
|
"tailwindcss": "^4.1.12",
|
|
134
134
|
"tsc-alias": "^1.8.16",
|
|
135
|
-
"@fumadocs/cli": "1.0.
|
|
135
|
+
"@fumadocs/cli": "1.0.1",
|
|
136
136
|
"eslint-config-custom": "0.0.0",
|
|
137
|
-
"fumadocs-core": "15.7.
|
|
137
|
+
"fumadocs-core": "15.7.6",
|
|
138
138
|
"tsconfig": "0.0.0"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|