fumadocs-ui 14.6.0 → 14.6.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.
Files changed (55) hide show
  1. package/dist/components/dialog/search.d.ts +5 -2
  2. package/dist/components/dialog/search.d.ts.map +1 -1
  3. package/dist/components/dynamic-codeblock.d.ts.map +1 -1
  4. package/dist/components/dynamic-codeblock.js +2 -1
  5. package/dist/components/inline-toc.d.ts +4 -3
  6. package/dist/components/inline-toc.d.ts.map +1 -1
  7. package/dist/components/inline-toc.js +4 -3
  8. package/dist/components/layout/root-toggle.js +1 -1
  9. package/dist/components/layout/toc.d.ts.map +1 -1
  10. package/dist/components/layout/toc.js +4 -2
  11. package/dist/components/registry.d.ts.map +1 -1
  12. package/dist/components/registry.js +1 -0
  13. package/dist/contexts/layout.d.ts +12 -0
  14. package/dist/contexts/layout.d.ts.map +1 -0
  15. package/dist/contexts/layout.js +16 -0
  16. package/dist/contexts/sidebar.d.ts +2 -2
  17. package/dist/contexts/sidebar.d.ts.map +1 -1
  18. package/dist/contexts/tree.d.ts.map +1 -1
  19. package/dist/contexts/tree.js +2 -4
  20. package/dist/layouts/docs/shared.d.ts +3 -0
  21. package/dist/layouts/docs/shared.d.ts.map +1 -1
  22. package/dist/layouts/docs/shared.js +3 -0
  23. package/dist/layouts/docs/sidebar.d.ts.map +1 -1
  24. package/dist/layouts/docs/sidebar.js +9 -9
  25. package/dist/layouts/docs.client.d.ts +2 -5
  26. package/dist/layouts/docs.client.d.ts.map +1 -1
  27. package/dist/layouts/docs.client.js +16 -7
  28. package/dist/layouts/docs.d.ts.map +1 -1
  29. package/dist/layouts/docs.js +19 -9
  30. package/dist/layouts/home.d.ts +2 -2
  31. package/dist/layouts/home.d.ts.map +1 -1
  32. package/dist/layouts/home.js +25 -24
  33. package/dist/layouts/notebook.client.d.ts +1 -2
  34. package/dist/layouts/notebook.client.d.ts.map +1 -1
  35. package/dist/layouts/notebook.client.js +2 -10
  36. package/dist/layouts/notebook.d.ts.map +1 -1
  37. package/dist/layouts/notebook.js +14 -4
  38. package/dist/page.client.d.ts +3 -1
  39. package/dist/page.client.d.ts.map +1 -1
  40. package/dist/page.client.js +12 -2
  41. package/dist/page.d.ts.map +1 -1
  42. package/dist/page.js +21 -17
  43. package/dist/provider.d.ts +1 -0
  44. package/dist/provider.d.ts.map +1 -1
  45. package/dist/provider.js +1 -0
  46. package/dist/style.css +44 -104
  47. package/dist/tailwind-plugin.d.ts.map +1 -1
  48. package/dist/tailwind-plugin.js +1 -0
  49. package/dist/theme/colors.js +3 -3
  50. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -1
  51. package/dist/utils/get-sidebar-tabs.js +10 -1
  52. package/package.json +15 -15
  53. package/dist/layouts/docs/navbar.d.ts +0 -4
  54. package/dist/layouts/docs/navbar.d.ts.map +0 -1
  55. package/dist/layouts/docs/navbar.js +0 -20
@@ -1,6 +1,9 @@
1
- import type { SortedResult } from 'fumadocs-core/server';
2
1
  import { type ReactNode } from 'react';
2
+ import type { SortedResult } from 'fumadocs-core/server';
3
3
  export type SearchLink = [name: string, href: string];
4
+ type ReactSortedResult = SortedResult & {
5
+ content: ReactNode;
6
+ };
4
7
  export interface SharedProps {
5
8
  open: boolean;
6
9
  onOpenChange: (open: boolean) => void;
@@ -10,7 +13,7 @@ export interface SharedProps {
10
13
  links?: SearchLink[];
11
14
  }
12
15
  type SearchDialogProps = SharedProps & SearchValueProps & Omit<SearchResultProps, 'items'> & {
13
- results: SortedResult[] | 'empty';
16
+ results: ReactSortedResult[] | 'empty';
14
17
  footer?: ReactNode;
15
18
  };
16
19
  interface SearchValueProps {
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAaf,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,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,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAElC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,YAAY,GAAG;IACtC,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,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
@@ -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,sBAAsB,CAAC;AAc7D,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,2CAuBA"}
1
+ {"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAe7D,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,2CAuBA"}
@@ -3,9 +3,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  import { CodeBlock, Pre } from '../components/codeblock';
4
4
  import { PrerenderScript, useShiki } from 'fumadocs-core/utils/use-shiki';
5
5
  import { useId } from 'react';
6
+ import { cn } from '../utils/cn';
6
7
  const components = {
7
8
  pre(props) {
8
- return (_jsx(CodeBlock, { ...props, children: _jsx(Pre, { children: props.children }) }));
9
+ return (_jsx(CodeBlock, { ...props, className: cn('my-0', props.className), children: _jsx(Pre, { children: props.children }) }));
9
10
  },
10
11
  };
11
12
  export function DynamicCodeBlock({ lang, code, options, }) {
@@ -1,7 +1,8 @@
1
1
  import type { TOCItemType } from 'fumadocs-core/server';
2
- export interface InlineTocProps {
2
+ import { Collapsible } from './ui/collapsible';
3
+ import { ComponentProps } from 'react';
4
+ export interface InlineTocProps extends ComponentProps<typeof Collapsible> {
3
5
  items: TOCItemType[];
4
- defaultOpen?: boolean;
5
6
  }
6
- export declare function InlineTOC({ items, defaultOpen, }: InlineTocProps): React.ReactElement;
7
+ export declare function InlineTOC({ items, ...props }: InlineTocProps): import("react/jsx-runtime").JSX.Element;
7
8
  //# sourceMappingURL=inline-toc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inline-toc.d.ts","sourceRoot":"","sources":["../../src/components/inline-toc.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,GACZ,EAAE,cAAc,GAAG,KAAK,CAAC,YAAY,CA4BrC"}
1
+ {"version":3,"file":"inline-toc.d.ts","sourceRoot":"","sources":["../../src/components/inline-toc.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,WAAW,EAGZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,OAAO,WAAW,CAAC;IACxE,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CA+B5D"}
@@ -2,8 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ChevronDown } from 'lucide-react';
4
4
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from './ui/collapsible';
5
- export function InlineTOC({ items, defaultOpen, }) {
6
- return (_jsxs(Collapsible, { defaultOpen: defaultOpen, className: "not-prose rounded-lg border bg-fd-card text-fd-card-foreground", children: [_jsxs(CollapsibleTrigger, { className: "inline-flex w-full items-center justify-between p-4 font-medium [&[data-state=open]>svg]:rotate-180", children: ["Table of Contents", _jsx(ChevronDown, { className: "size-4 transition-transform duration-200" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col p-4 pt-0 text-sm text-fd-muted-foreground", children: items.map((item) => (_jsx("a", { href: item.url, className: "border-l py-1.5 hover:text-fd-accent-foreground", style: {
7
- paddingLeft: 12 * Math.max(item.depth - 1, 0),
5
+ import { cn } from '../utils/cn';
6
+ export function InlineTOC({ items, ...props }) {
7
+ return (_jsxs(Collapsible, { ...props, className: cn('not-prose rounded-lg border bg-fd-card text-fd-card-foreground', props.className), children: [_jsxs(CollapsibleTrigger, { className: "group inline-flex w-full items-center justify-between px-4 py-2.5 font-medium", children: [props.children ?? 'Table of Contents', _jsx(ChevronDown, { className: "size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col p-4 pt-0 text-sm text-fd-muted-foreground", children: items.map((item) => (_jsx("a", { href: item.url, className: "border-s py-1.5 hover:text-fd-accent-foreground", style: {
8
+ paddingInlineStart: 12 * Math.max(item.depth - 1, 0),
8
9
  }, children: item.title }, item.url))) }) })] }));
9
10
  }
@@ -22,7 +22,7 @@ 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 rounded-lg px-2 py-1.5 hover:bg-fd-accent/50 hover:text-fd-accent-foreground', props.className), children: [item, _jsx(ChevronDown, { className: "me-1.5 size-4 text-fd-muted-foreground" })] })) : null, _jsx(PopoverContent, { className: "w-[var(--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
25
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [item ? (_jsxs(PopoverTrigger, { ...props, className: cn('flex flex-row items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-fd-accent/50 hover:text-fd-accent-foreground', props.className), children: [item, _jsx(ChevronDown, { className: "me-2 size-4 text-fd-muted-foreground" })] })) : null, _jsx(PopoverContent, { className: "w-[var(--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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAU7E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAoBxD;AAED,wBAAgB,aAAa,4CAQ5B;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,MAAc,GACf,EAAE;IACD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,2CA6BA;AAkBD,eAAO,MAAM,UAAU,oEAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAyBhD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,2CAiB3D"}
1
+ {"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAU7E,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAyBxD;AAED,wBAAgB,aAAa,4CAQ5B;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,MAAc,GACf,EAAE;IACD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,2CA6BA;AAkBD,eAAO,MAAM,UAAU,oEAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAyBhD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,2CAiB3D"}
@@ -8,11 +8,13 @@ import { TocThumb } from '../../components/layout/toc-thumb';
8
8
  import { ScrollArea, ScrollViewport } from '../ui/scroll-area';
9
9
  import { Popover, PopoverContent, PopoverTrigger, } from '../../components/ui/popover';
10
10
  import { ChevronRight, Text } from 'lucide-react';
11
+ import { usePageStyles } from '../../contexts/layout';
11
12
  export function Toc(props) {
12
- return (_jsx("div", { ...props, "data-toc": "", className: cn('sticky top-fd-layout-top h-[var(--fd-toc-height)] flex-1 pb-2 pt-12', props.className), style: {
13
+ const { toc } = usePageStyles();
14
+ return (_jsx("div", { id: "nd-toc", ...props, className: cn('sticky top-fd-layout-top h-[var(--fd-toc-height)] pb-2 pt-12', toc, props.className), style: {
13
15
  ...props.style,
14
16
  '--fd-toc-height': 'calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))',
15
- }, children: props.children }));
17
+ }, children: _jsx("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: props.children }) }));
16
18
  }
17
19
  export function TocItemsEmpty() {
18
20
  const { text } = useI18n();
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/components/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AASpD,eAAO,MAAM,QAAQ,EAAE,QAmEtB,CAAC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/components/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAUpD,eAAO,MAAM,QAAQ,EAAE,QAmEtB,CAAC"}
@@ -4,6 +4,7 @@ const contextsMap = {
4
4
  '../contexts/search.tsx': 'fumadocs-ui/provider',
5
5
  '../contexts/tree.tsx': 'fumadocs-ui/provider',
6
6
  '../contexts/i18n.tsx': 'fumadocs-ui/provider',
7
+ '../contexts/layout.tsx': 'fumadocs-ui/provider',
7
8
  };
8
9
  export const registry = {
9
10
  path: fileURLToPath(import.meta.url),
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface PageStyles {
3
+ tocNav?: string;
4
+ toc?: string;
5
+ page?: string;
6
+ article?: string;
7
+ }
8
+ export declare function usePageStyles(): PageStyles;
9
+ export declare function StylesProvider({ children, ...value }: PageStyles & {
10
+ children: ReactNode;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/contexts/layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAElE,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"}
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from 'react';
4
+ /**
5
+ * applied styles to different layout components in `Page` from layouts
6
+ */
7
+ const StylesContext = createContext({
8
+ tocNav: 'xl:hidden',
9
+ toc: 'max-xl:hidden',
10
+ });
11
+ export function usePageStyles() {
12
+ return useContext(StylesContext);
13
+ }
14
+ export function StylesProvider({ children, ...value }) {
15
+ return (_jsx(StylesContext.Provider, { value: value, children: children }));
16
+ }
@@ -1,4 +1,4 @@
1
- import { type MutableRefObject, type ReactNode } from 'react';
1
+ import { type ReactNode, type RefObject } from 'react';
2
2
  interface SidebarContext {
3
3
  open: boolean;
4
4
  setOpen: React.Dispatch<React.SetStateAction<boolean>>;
@@ -7,7 +7,7 @@ interface SidebarContext {
7
7
  /**
8
8
  * When set to false, don't close the sidebar when navigate to another page
9
9
  */
10
- closeOnRedirect: MutableRefObject<boolean>;
10
+ closeOnRedirect: RefObject<boolean>;
11
11
  }
12
12
  declare const SidebarContext: import("react").Context<SidebarContext | undefined>;
13
13
  export declare function useSidebar(): SidebarContext;
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,gBAAgB,EACrB,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,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED,QAAA,MAAM,cAAc,qDAAuD,CAAC;AAE5E,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAgCZ"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,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,qDAAuD,CAAC;AAE5E,wBAAgB,UAAU,IAAI,cAAc,CAI3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAgCZ"}
@@ -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,EAGL,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,UAAU,eAAe;IACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;CACvC;AAKD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAiBZ;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAMhD"}
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,EAA6B,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAG3E,UAAU,eAAe;IACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;CACvC;AAKD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAeZ;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAMhD"}
@@ -1,17 +1,15 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { usePathname } from 'next/navigation';
4
- import { createContext, useContext, useMemo, useRef, } from 'react';
4
+ import { createContext, useContext, useMemo } from 'react';
5
5
  import { searchPath } from 'fumadocs-core/breadcrumb';
6
- const TreeContext = createContext(undefined);
6
+ const TreeContext = createContext(null);
7
7
  const PathContext = createContext([]);
8
8
  export function TreeContextProvider({ children, tree, }) {
9
9
  const pathname = usePathname();
10
10
  const path = useMemo(() => searchPath(tree.children, pathname) ?? [], [pathname, tree]);
11
11
  const root = (path.findLast((item) => item.type === 'folder' && item.root) ??
12
12
  tree);
13
- const pathnameRef = useRef(pathname);
14
- pathnameRef.current = pathname;
15
13
  return (_jsx(TreeContext.Provider, { value: useMemo(() => ({ root }), [root]), children: _jsx(PathContext.Provider, { value: path, children: children }) }));
16
14
  }
17
15
  export function useTreePath() {
@@ -4,6 +4,9 @@ import type { PageTree } from 'fumadocs-core/server';
4
4
  import { type TabOptions } from '../../utils/get-sidebar-tabs';
5
5
  import type { FC, ReactNode } from 'react';
6
6
  import type { Option } from '../../components/layout/root-toggle';
7
+ export declare const layoutVariables: {
8
+ '--fd-layout-offset': string;
9
+ };
7
10
  export interface SidebarOptions extends SidebarProps {
8
11
  enabled: boolean;
9
12
  component: ReactNode;
@@ -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,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,KAAK,CAAC;IAErC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,CAAC,CAAC;IAClC,MAAM,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,SAAS,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2UA+C/D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
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,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,eAAO,MAAM,eAAe;;CAE3B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,KAAK,CAAC;IAErC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,CAAC,CAAC;IAClC,MAAM,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,SAAS,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2UA+C/D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
@@ -4,6 +4,9 @@ import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTr
4
4
  import { cn } from '../../utils/cn';
5
5
  import { buttonVariants } from '../../components/ui/button';
6
6
  import { getSidebarTabs } from '../../utils/get-sidebar-tabs';
7
+ export const layoutVariables = {
8
+ '--fd-layout-offset': 'max(calc(50vw - var(--fd-layout-width) / 2), 0px)',
9
+ };
7
10
  export function SidebarLinkItem({ item }) {
8
11
  if (item.type === 'menu')
9
12
  return (_jsxs(SidebarFolder, { children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(SidebarLinkItem, { item: child }, i))) })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAInE,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;AA6BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,2CAqDrD;AAED,wBAAgB,OAAO,CAAC,EACtB,gBAAoB,EACpB,QAAe,EACf,KAAK,EACL,GAAG,KAAK,EACT,EAAE,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAAE,2CAuC3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAYlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAYlE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAYrD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,2CAY3E;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,GAAG;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,2CAiBA;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CAgBA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAelE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,2CAkCjD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAQlE;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAwB/C;AAgBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,eA0CA"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAU1D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAInE,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;AA6BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,2CAqDrD;AAED,wBAAgB,OAAO,CAAC,EACtB,gBAAoB,EACpB,QAAe,EACf,KAAK,EACL,GAAG,KAAK,EACT,EAAE,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAAE,2CAuC3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CASlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAYlE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAarD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,oBAAoB,CAAC,2CAY3E;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,GAAG;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,2CAiBA;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CAgBA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAelE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,2CA8BjD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,2CAQlE;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAyB/C;AAgBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,eA0CA"}
@@ -14,11 +14,11 @@ import { useSidebar } from '../../contexts/sidebar';
14
14
  import { buttonVariants } from '../../components/ui/button';
15
15
  import { cva } from 'class-variance-authority';
16
16
  import { useTreeContext, useTreePath } from '../../contexts/tree';
17
- const itemVariants = cva('flex flex-row items-center gap-2 rounded-md px-3 py-2 text-fd-muted-foreground transition-colors duration-100 [overflow-wrap:anywhere] md:px-2 md:py-1.5 [&_svg]:size-4', {
17
+ const itemVariants = cva('flex flex-row items-center gap-2 rounded-md p-2 text-fd-muted-foreground [overflow-wrap:anywhere] md:py-1.5 [&_svg]:size-4', {
18
18
  variants: {
19
19
  active: {
20
20
  true: 'bg-fd-primary/10 font-medium text-fd-primary',
21
- false: 'hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none',
21
+ false: 'transition-colors duration-100 hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none',
22
22
  },
23
23
  },
24
24
  });
@@ -68,18 +68,18 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, inner, ...props
68
68
  }, children: _jsx("div", { ...inner, className: cn('flex size-full max-w-full flex-col pt-2 md:ms-auto md:w-[var(--fd-sidebar-width)] md:border-e md:pt-4', inner?.className), children: props.children }) }) }));
69
69
  }
70
70
  export function SidebarHeader(props) {
71
- return (_jsx("div", { ...props, className: cn('flex flex-col gap-2 px-4 empty:hidden md:px-3', props.className), children: props.children }));
71
+ return (_jsx("div", { ...props, className: cn('flex flex-col gap-2 px-4 empty:hidden', props.className), children: props.children }));
72
72
  }
73
73
  export function SidebarFooter(props) {
74
74
  return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3 empty:hidden', props.className), children: props.children }));
75
75
  }
76
76
  export function SidebarViewport(props) {
77
- return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { style: {
77
+ return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { className: "px-4", style: {
78
78
  maskImage: 'linear-gradient(to bottom, transparent 2px, white 16px)',
79
79
  }, children: props.children }) }));
80
80
  }
81
81
  export function SidebarSeparator(props) {
82
- return (_jsx("p", { ...props, className: cn('mb-2 mt-8 px-3 text-sm font-medium first:mt-0 md:px-2', props.className), children: props.children }));
82
+ return (_jsx("p", { ...props, className: cn('mb-2 mt-8 px-2 text-sm font-medium first:mt-0', props.className), children: props.children }));
83
83
  }
84
84
  export function SidebarItem({ icon, ...props }) {
85
85
  const pathname = usePathname();
@@ -97,14 +97,14 @@ export function SidebarFolder({ defaultOpen = false, ...props }) {
97
97
  }
98
98
  export function SidebarFolderTrigger(props) {
99
99
  const { open } = useFolderContext();
100
- return (_jsxs(CollapsibleTrigger, { ...props, className: cn(itemVariants({ active: false }), 'w-full pe-3.5 md:pe-1.5'), children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
100
+ return (_jsxs(CollapsibleTrigger, { ...props, className: cn(itemVariants({ active: false }), 'w-full'), children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
101
101
  }
102
102
  export function SidebarFolderLink(props) {
103
103
  const { open, setOpen } = useFolderContext();
104
104
  const { prefetch } = useInternalContext();
105
105
  const pathname = usePathname();
106
106
  const active = props.href !== undefined && isActive(props.href, pathname, false);
107
- return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), 'w-full pe-3.5 md:pe-1.5', props.className), onClick: (e) => {
107
+ return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), 'w-full', props.className), onClick: (e) => {
108
108
  if (e.target.hasAttribute('data-icon')) {
109
109
  setOpen((prev) => !prev);
110
110
  e.preventDefault();
@@ -115,14 +115,14 @@ export function SidebarFolderLink(props) {
115
115
  }, prefetch: prefetch, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
116
116
  }
117
117
  export function SidebarFolderContent(props) {
118
- return (_jsx(CollapsibleContent, { ...props, children: _jsx("div", { className: "ms-3 border-s py-1.5 ps-1.5 md:ms-2 md:ps-2", children: props.children }) }));
118
+ return (_jsx(CollapsibleContent, { ...props, children: _jsx("div", { className: "ms-3 border-s py-1.5 ps-1.5 md:ms-2", children: props.children }) }));
119
119
  }
120
120
  export function SidebarCollapseTrigger(props) {
121
121
  const { collapsed, setCollapsed } = useSidebar();
122
122
  return (_jsx("button", { type: "button", "aria-label": "Collapse Sidebar", "data-collapsed": collapsed, ...props, className: cn(buttonVariants({
123
123
  color: 'ghost',
124
124
  size: 'icon',
125
- }), props.className), onClick: () => {
125
+ }), 'backdrop-blur-lg', props.className), onClick: () => {
126
126
  setCollapsed((prev) => !prev);
127
127
  }, children: props.children ?? _jsx(SidebarIcon, {}) }));
128
128
  }
@@ -1,13 +1,10 @@
1
1
  import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
2
2
  import { type LinkItemType } from '../layouts/links';
3
- export declare function LayoutBody(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
4
3
  interface LinksMenuProps extends ButtonHTMLAttributes<HTMLButtonElement> {
5
4
  items: LinkItemType[];
6
5
  }
7
6
  export declare function LinksMenu({ items, ...props }: LinksMenuProps): import("react/jsx-runtime").JSX.Element;
8
- interface MenuItemProps extends HTMLAttributes<HTMLElement> {
9
- item: LinkItemType;
10
- }
11
- export declare function MenuItem({ item, ...props }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Navbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function NavbarSidebarTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
12
9
  export {};
13
10
  //# sourceMappingURL=docs.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs.client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.client.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AASf,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAUlE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe5D;AAMD,UAAU,cAAe,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACtE,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAkB5D;AAED,UAAU,aAAc,SAAQ,cAAc,CAAC,WAAW,CAAC;IACzD,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAgDzD"}
1
+ {"version":3,"file":"docs.client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs.client.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AASf,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAgBlE,UAAU,cAAe,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACtE,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAkB5D;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAiBxD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAkB/C"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ChevronDown } from 'lucide-react';
3
+ import { ChevronDown, Menu, X } from 'lucide-react';
4
4
  import { useState, } from 'react';
5
5
  import { usePathname } from 'next/navigation';
6
6
  import { useOnChange } from 'fumadocs-core/utils/use-on-change';
@@ -11,11 +11,8 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../compone
11
11
  import { cva } from 'class-variance-authority';
12
12
  import { buttonVariants } from '../components/ui/button';
13
13
  import { useSidebar } from '../contexts/sidebar';
14
- export function LayoutBody(props) {
15
- const { collapsed } = useSidebar();
16
- return (_jsx("main", { ...props, className: cn(!collapsed &&
17
- '[&_#nd-page]:max-w-[calc(min(100vw,var(--fd-layout-width))-var(--fd-sidebar-width)-var(--fd-toc-width))]', props.className), children: props.children }));
18
- }
14
+ import { useNav } from '../components/layout/nav';
15
+ import { SidebarTrigger } from 'fumadocs-core/sidebar';
19
16
  const itemVariants = cva('flex flex-row items-center gap-2 rounded-md px-3 py-2.5 text-fd-muted-foreground transition-colors duration-100 [overflow-wrap:anywhere] hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none md:px-2 md:py-1.5 [&_svg]:size-4');
20
17
  export function LinksMenu({ items, ...props }) {
21
18
  const [open, setOpen] = useState(false);
@@ -25,7 +22,19 @@ export function LinksMenu({ items, ...props }) {
25
22
  });
26
23
  return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { ...props }), _jsx(PopoverContent, { className: "flex flex-col p-1", children: items.map((item, i) => (_jsx(MenuItem, { item: item }, i))) })] }));
27
24
  }
28
- export function MenuItem({ item, ...props }) {
25
+ export function Navbar(props) {
26
+ const { open } = useSidebar();
27
+ const { isTransparent } = useNav();
28
+ return (_jsx("header", { id: "nd-subnav", ...props, className: cn('sticky top-[var(--fd-banner-height)] z-30 flex h-14 flex-row items-center border-b border-fd-foreground/10 px-4 backdrop-blur-lg transition-colors', (!isTransparent || open) && 'bg-fd-background/80', props.className), children: props.children }));
29
+ }
30
+ export function NavbarSidebarTrigger(props) {
31
+ const { open } = useSidebar();
32
+ return (_jsx(SidebarTrigger, { ...props, className: cn(buttonVariants({
33
+ color: 'ghost',
34
+ size: 'icon',
35
+ }), props.className), children: open ? _jsx(X, {}) : _jsx(Menu, {}) }));
36
+ }
37
+ function MenuItem({ item, ...props }) {
29
38
  if (item.type === 'custom')
30
39
  return (_jsx("div", { ...props, className: cn('grid', props.className), children: item.children }));
31
40
  if (item.type === 'menu') {
@@ -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,EAAE,MAAM,OAAO,CAAC;AAgB5D,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAe1D,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAElC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EACH,OAAO,EAAE,UAAiB,EAC1B,SAAS,EAAE,UAAU,EACrB,eAAe,EACf,GAAG,GAAG,EACF,EACN,OAAO,EAAE,EACP,OAAO,EAAE,cAAqB,EAC9B,WAAkB,EAClB,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CAsF7B;AA0FD,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,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,EAAE,MAAM,OAAO,CAAC;AAe5D,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AAc1D,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAElC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EACH,OAAO,EAAE,UAAiB,EAC1B,SAAS,EAAE,UAAU,EACrB,eAAe,EACf,GAAG,GAAG,EACF,EACN,OAAO,EAAE,EACP,OAAO,EAAE,cAAqB,EAC9B,WAAkB,EAClB,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CA2G7B;AA0FD,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Link from 'next/link';
3
3
  import { Languages, MoreHorizontal } from 'lucide-react';
4
- import { notFound } from 'next/navigation';
5
4
  import { cn } from '../utils/cn';
6
5
  import { buttonVariants } from '../components/ui/button';
7
6
  import { CollapsibleSidebar, Sidebar, SidebarFooter, SidebarHeader, SidebarCollapseTrigger, SidebarViewport, SidebarPageTree, } from '../layouts/docs/sidebar';
@@ -11,28 +10,39 @@ import { getSidebarTabs } from '../utils/get-sidebar-tabs';
11
10
  import { RootToggle } from '../components/layout/root-toggle';
12
11
  import { getLinks } from './shared';
13
12
  import { LanguageToggle, LanguageToggleText, } from '../components/layout/language-toggle';
14
- import { LayoutBody, LinksMenu } from '../layouts/docs.client';
13
+ import { LinksMenu, Navbar, NavbarSidebarTrigger } from '../layouts/docs.client';
15
14
  import { TreeContextProvider } from '../contexts/tree';
16
15
  import { NavProvider, Title } from '../components/layout/nav';
17
16
  import { ThemeToggle } from '../components/layout/theme-toggle';
18
- import { Navbar, NavbarSidebarTrigger } from '../layouts/docs/navbar';
19
17
  import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
20
18
  import { SearchOnly } from '../contexts/search';
21
- import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../layouts/docs/shared';
19
+ import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared';
20
+ import { StylesProvider } from '../contexts/layout';
21
+ import { notFound } from 'next/navigation';
22
22
  export function DocsLayout({ nav: { enabled: navEnabled = true, component: navReplace, transparentMode, ...nav } = {}, sidebar: { enabled: sidebarEnabled = true, collapsible = true, component: sidebarReplace, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
23
23
  const links = getLinks(props.links ?? [], props.githubUrl);
24
24
  const Aside = collapsible ? CollapsibleSidebar : Sidebar;
25
25
  if (props.tree === undefined)
26
26
  notFound();
27
27
  const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
28
- return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { id: "nd-subnav", className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs(LayoutBody, { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px] [&_#nd-toc]:max-xl:hidden [&_#nd-tocnav]:xl:hidden max-xl:[&_article]:mx-0', !navReplace && navEnabled
29
- ? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
30
- : null, props.containerProps?.className), children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 start-2 z-40 transition-opacity data-[collapsed=false]:pointer-events-none data-[collapsed=false]:opacity-0 max-md:hidden" })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, className: "md:flex-1 md:data-[collapsed=true]:flex-initial", children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
28
+ const variables = cn('[--fd-tocnav-height:36px] md:[--fd-sidebar-width:268px] xl:[--fd-toc-width:268px] xl:[--fd-tocnav-height:0px]', !navReplace && navEnabled
29
+ ? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
30
+ : undefined);
31
+ const pageStyles = {
32
+ tocNav: cn('xl:hidden'),
33
+ toc: cn('max-xl:hidden'),
34
+ };
35
+ return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { className: "md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs("main", { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row pe-[var(--fd-layout-offset)]', variables, props.containerProps?.className), style: {
36
+ ...layoutVariables,
37
+ ...props.containerProps?.style,
38
+ }, children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 z-30 data-[collapsed=false]:invisible max-md:hidden", style: {
39
+ insetInlineStart: 'calc(var(--fd-layout-offset) + 0.5rem)',
40
+ } })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, className: cn('md:ps-[var(--fd-layout-offset)]', sidebar.className), children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "pt-4 empty:hidden md:hidden", children: links
31
41
  .filter((v) => v.type !== 'icon')
32
- .map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "px-2 py-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsxs(SidebarFooter, { children: [_jsx(SidebarFooterItems, { sidebarCollapsible: collapsible, i18n: i18n, disableThemeSwitch: props.disableThemeSwitch ?? false, iconItems: links.filter((v) => v.type === 'icon') }), sidebarFooter] })] }), {
42
+ .map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "py-4", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsxs(SidebarFooter, { children: [_jsx(SidebarFooterItems, { sidebarCollapsible: collapsible, i18n: i18n, disableThemeSwitch: props.disableThemeSwitch ?? false, iconItems: links.filter((v) => v.type === 'icon') }), sidebarFooter] })] }), {
33
43
  ...sidebar,
34
44
  tabs,
35
- }), props.children] })] }) }));
45
+ }), _jsx(StylesProvider, { ...pageStyles, children: props.children })] })] }) }));
36
46
  }
37
47
  function SidebarHeaderItems({ links, ...props }) {
38
48
  const isEmpty = !props.title && !props.children && links.length === 0;
@@ -1,5 +1,5 @@
1
- import type { HTMLAttributes, ReactNode } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
2
  import { type BaseLayoutProps } from './shared';
3
3
  export type HomeLayoutProps = BaseLayoutProps & HTMLAttributes<HTMLElement>;
4
- export declare function HomeLayout({ nav: { transparentMode, enableSearch, ...nav }, links, githubUrl, i18n, disableThemeSwitch, ...props }: HomeLayoutProps): ReactNode;
4
+ export declare function HomeLayout(props: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
5
5
  //# sourceMappingURL=home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAgC1D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE5E,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,YAAmB,EAAE,GAAG,GAAG,EAAO,EAC1D,KAAU,EACV,SAAS,EACT,IAAY,EACZ,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CAkH7B"}
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAgC1D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0ChD"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { replaceOrDefault } from '../layouts/shared';
3
3
  import { cn } from '../utils/cn';
4
4
  import { getLinks } from './shared';
@@ -13,38 +13,39 @@ import { buttonVariants } from '../components/ui/button';
13
13
  import { SearchOnly } from '../contexts/search';
14
14
  import Link from 'fumadocs-core/link';
15
15
  import { MenuLinkItem } from '../layouts/home/menu';
16
- export function HomeLayout({ nav: { transparentMode, enableSearch = true, ...nav } = {}, links = [], githubUrl, i18n = false, disableThemeSwitch, ...props }) {
16
+ export function HomeLayout(props) {
17
+ const { nav, links, githubUrl, i18n: _i18n, disableThemeSwitch: _disableThemeSwitch, ...rest } = props;
17
18
  const finalLinks = getLinks(links, githubUrl);
18
- const navItems = finalLinks.filter((item) => ['nav', 'all'].includes(item.on ?? 'all'));
19
- const menuItems = finalLinks.filter((item) => ['menu', 'all'].includes(item.on ?? 'all'));
20
- return (_jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...props, className: cn('flex flex-1 flex-col pt-[var(--fd-nav-height)] [--fd-nav-height:56px]', props.className), children: [replaceOrDefault(nav, _jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", className: "fixed inset-x-0 top-[var(--fd-banner-height)] z-40 h-6 bg-fd-background", style: {
19
+ return (_jsx(NavProvider, { transparentMode: nav?.transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...rest, className: cn('flex flex-1 flex-col pt-[var(--fd-nav-height)] [--fd-nav-height:56px]', rest.className), children: [replaceOrDefault(nav, _jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", className: "fixed inset-x-0 top-[var(--fd-banner-height)] z-40 h-6 bg-fd-background", style: {
21
20
  maskImage: 'linear-gradient(to bottom,white,transparent)',
22
- } }), _jsxs(Navbar, { children: [_jsx(Title, { title: nav.title, url: nav.url }), nav.children, _jsx(NavigationMenuList, { className: "flex flex-row items-center gap-2 max-sm:hidden", children: navItems
23
- .filter((item) => !isSecondary(item))
24
- .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), _jsxs("div", { className: "flex flex-1 flex-row items-center justify-end lg:gap-1.5", children: [enableSearch ? (_jsxs(SearchOnly, { children: [_jsx(SearchToggle, { className: "lg:hidden" }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden" })] })) : null, !disableThemeSwitch ? (_jsx(ThemeToggle, { className: "max-lg:hidden" })) : null, i18n ? (_jsx(LanguageToggle, { className: "-me-1.5 max-lg:hidden", children: _jsx(Languages, { className: "size-5" }) })) : null, navItems.filter(isSecondary).map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "-me-1.5 list-none max-lg:hidden" }, i))), _jsxs(NavigationMenuItem, { className: "list-none lg:hidden", children: [_jsx(NavigationMenuTrigger, { className: cn(buttonVariants({
25
- size: 'icon',
26
- color: 'ghost',
27
- }), 'group -me-2'), children: _jsx(ChevronDown, { className: "size-3 transition-transform duration-300 group-data-[state=open]:rotate-180" }) }), _jsxs(NavigationMenuContent, { className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end", children: [menuItems
28
- .filter((item) => !isSecondary(item))
29
- .map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "sm:hidden" }, i))), _jsxs("div", { className: "-ms-1.5 flex flex-row items-center gap-1.5 max-sm:mt-2", children: [menuItems.filter(isSecondary).map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "-me-1.5" }, i))), _jsx("div", { role: "separator", className: "flex-1" }), i18n ? (_jsxs(LanguageToggle, { children: [_jsx(Languages, { className: "size-5" }), _jsx(LanguageToggleText, {}), _jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, {}) : null] })] })] })] })] })] }), {
21
+ } }), _jsx(Header, { finalLinks: finalLinks, ...props })] }), {
30
22
  items: finalLinks,
31
- i18n,
32
- enableSearch,
33
- disableThemeSwitch,
34
- ...nav,
35
23
  }), props.children] }) }));
36
24
  }
25
+ function Header({ nav: { enableSearch = true, ...nav } = {}, i18n = false, finalLinks, disableThemeSwitch, }) {
26
+ const navItems = finalLinks.filter((item) => ['nav', 'all'].includes(item.on ?? 'all'));
27
+ const menuItems = finalLinks.filter((item) => ['menu', 'all'].includes(item.on ?? 'all'));
28
+ return (_jsxs(Navbar, { children: [_jsx(Title, { title: nav.title, url: nav.url }), nav.children, _jsx(NavigationMenuList, { className: "flex flex-row items-center gap-2 max-sm:hidden", children: navItems
29
+ .filter((item) => !isSecondary(item))
30
+ .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), _jsxs("div", { className: "flex flex-1 flex-row items-center justify-end lg:gap-1.5", children: [enableSearch ? (_jsxs(SearchOnly, { children: [_jsx(SearchToggle, { className: "lg:hidden" }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, { className: "max-lg:hidden" }) : null, i18n ? (_jsx(LanguageToggle, { className: "-me-1.5 max-lg:hidden", children: _jsx(Languages, { className: "size-5" }) })) : null, navItems.filter(isSecondary).map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "-me-1.5 list-none max-lg:hidden" }, i))), _jsxs(NavigationMenuItem, { className: "list-none lg:hidden", children: [_jsx(NavigationMenuTrigger, { className: cn(buttonVariants({
31
+ size: 'icon',
32
+ color: 'ghost',
33
+ }), 'group -me-2'), children: _jsx(ChevronDown, { className: "size-3 transition-transform duration-300 group-data-[state=open]:rotate-180" }) }), _jsxs(NavigationMenuContent, { className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end", children: [menuItems
34
+ .filter((item) => !isSecondary(item))
35
+ .map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "sm:hidden" }, i))), _jsxs("div", { className: "-ms-1.5 flex flex-row items-center gap-1.5 max-sm:mt-2", children: [menuItems.filter(isSecondary).map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "-me-1.5" }, i))), _jsx("div", { role: "separator", className: "flex-1" }), i18n ? (_jsxs(LanguageToggle, { children: [_jsx(Languages, { className: "size-5" }), _jsx(LanguageToggleText, {}), _jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, {}) : null] })] })] })] })] }));
36
+ }
37
37
  function NavbarLinkItem({ item, ...props }) {
38
38
  if (item.type === 'custom')
39
39
  return _jsx("div", { ...props, children: item.children });
40
40
  if (item.type === 'menu') {
41
- return (_jsxs(NavbarMenu, { children: [_jsx(NavbarMenuTrigger, { ...props, children: item.url ? _jsx(Link, { href: item.url, children: item.text }) : item.text }), _jsx(NavbarMenuContent, { children: item.items.map((child, j) => {
42
- if (child.type === 'custom')
43
- return _jsx("div", { children: child.children }, j);
44
- const { banner, footer, ...rest } = child.menu ?? {};
45
- return (_jsxs(NavbarMenuItem, { href: child.url, ...rest, children: [banner ??
46
- (child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null), _jsx("p", { className: "-mb-1 text-sm font-medium", children: child.text }), child.description ? (_jsx("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description })) : null, footer] }, j));
47
- }) })] }));
41
+ const children = item.items.map((child, j) => {
42
+ if (child.type === 'custom')
43
+ return _jsx("div", { children: child.children }, j);
44
+ const { banner, footer, ...rest } = child.menu ?? {};
45
+ return (_jsxs(NavbarMenuItem, { href: child.url, ...rest, children: [banner ??
46
+ (child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null), _jsx("p", { className: "-mb-1 text-sm font-medium", children: child.text }), child.description ? (_jsx("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description })) : null, footer] }, j));
47
+ });
48
+ return (_jsxs(NavbarMenu, { children: [_jsx(NavbarMenuTrigger, { ...props, children: item.url ? _jsx(Link, { href: item.url, children: item.text }) : item.text }), _jsx(NavbarMenuContent, { children: children })] }));
48
49
  }
49
50
  return (_jsx(NavbarLink, { ...props, item: item, variant: item.type, "aria-label": item.type === 'icon' ? item.label : undefined, children: item.type === 'icon' ? item.icon : item.text }));
50
51
  }
@@ -1,5 +1,4 @@
1
1
  import type { ButtonHTMLAttributes, HTMLAttributes } from 'react';
2
- export declare function LayoutBody(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
3
- export declare function SubNavbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Navbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
4
3
  export declare function NavbarSidebarTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
5
4
  //# sourceMappingURL=notebook.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notebook.client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAOlE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAkB5D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CA2B3D;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAkB/C"}
1
+ {"version":3,"file":"notebook.client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAOlE,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CA0BxD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAkB/C"}