fumadocs-ui 15.3.1 → 15.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/css/preset.css CHANGED
@@ -227,6 +227,22 @@
227
227
  }
228
228
  }
229
229
 
230
+ @utility fd-scroll-container {
231
+ &::-webkit-scrollbar {
232
+ width: 5px;
233
+ height: 5px;
234
+ }
235
+
236
+ &::-webkit-scrollbar-thumb {
237
+ border-radius: 5px;
238
+ background: var(--color-fd-border);
239
+ }
240
+
241
+ &::-webkit-scrollbar-track {
242
+ background: transparent;
243
+ }
244
+ }
245
+
230
246
  @utility fd-steps {
231
247
  counter-reset: step;
232
248
  position: relative;
package/css/shiki.css CHANGED
@@ -4,8 +4,18 @@
4
4
  }
5
5
 
6
6
  code .line {
7
- min-height: 1em;
8
- @apply relative inline-block w-full;
7
+ line-height: 1.45em;
8
+ min-height: 1.45em;
9
+ @apply relative;
10
+ }
11
+
12
+ &.has-focused code .line:not(.focused) {
13
+ filter: blur(2px);
14
+ transition: filter 200ms;
15
+ }
16
+
17
+ &.has-focused:hover code .line:not(.focused) {
18
+ filter: blur(0);
9
19
  }
10
20
 
11
21
  &[data-line-numbers] code .twoslash-meta-line {
@@ -48,25 +58,13 @@
48
58
  @apply text-fd-diff-add-symbol;
49
59
  }
50
60
 
51
- code .diff {
52
- @apply relative;
53
- }
54
-
55
61
  .highlighted {
56
62
  @apply bg-fd-primary/10;
57
63
  }
58
64
 
59
65
  .highlighted-word {
60
- padding: 1px 2px;
61
- margin: -1px -3px;
62
- border: 1px solid
63
- color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
64
- background-color: color-mix(
65
- in oklab,
66
- var(--color-fd-primary) 10%,
67
- transparent
68
- );
69
- border-radius: 2px;
66
+ padding: 1px;
67
+ @apply border -my-px border-fd-primary/30 bg-fd-primary/10 rounded-md font-medium;
70
68
  }
71
69
  }
72
70
 
@@ -4,7 +4,7 @@ export declare const Callout: import("react").ForwardRefExoticComponent<Omit<HTM
4
4
  /**
5
5
  * @defaultValue info
6
6
  */
7
- type?: "info" | "warn" | "error";
7
+ type?: "info" | "warn" | "error" | "success" | "warning";
8
8
  /**
9
9
  * Force an icon
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAiCxE,eAAO,MAAM,OAAO;YAzBV,SAAS;IACjB;;OAEG;WACI,MAAM,GAAG,MAAM,GAAG,OAAO;IAEhC;;OAEG;WACI,SAAS;kDA8CjB,CAAC"}
1
+ {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAkCxE,eAAO,MAAM,OAAO;YA1BV,SAAS;IACjB;;OAEG;WACI,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS;IAExD;;OAEG;WACI,SAAS;kDAoDjB,CAAC"}
@@ -1,18 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CircleX, Info, TriangleAlert } from '../icons.js';
2
+ import { CircleCheck, CircleX, Info, TriangleAlert } from '../icons.js';
3
3
  import { forwardRef } from 'react';
4
4
  import { cn } from '../utils/cn.js';
5
5
  import { cva } from 'class-variance-authority';
6
- const calloutVariants = cva('my-4 flex flex-row gap-2 rounded-lg border border-s-2 bg-fd-card p-3 text-sm text-fd-card-foreground shadow-md', {
6
+ const calloutVariants = cva('my-4 flex gap-2 rounded-lg border border-s-2 bg-fd-card p-3 text-sm text-fd-card-foreground shadow-md', {
7
7
  variants: {
8
8
  type: {
9
9
  info: 'border-s-blue-500/50',
10
10
  warn: 'border-s-orange-500/50',
11
11
  error: 'border-s-red-500/50',
12
+ success: 'border-s-green-500/50',
12
13
  },
13
14
  },
14
15
  });
15
16
  export const Callout = forwardRef(({ className, children, title, type = 'info', icon, ...props }, ref) => {
17
+ if (type === 'warning')
18
+ type = 'warn';
16
19
  return (_jsxs("div", { ref: ref, className: cn(calloutVariants({
17
20
  type: type,
18
21
  }), className), ...props, children: [icon ??
@@ -20,6 +23,7 @@ export const Callout = forwardRef(({ className, children, title, type = 'info',
20
23
  info: _jsx(Info, { className: "size-5 fill-blue-500 text-fd-card" }),
21
24
  warn: (_jsx(TriangleAlert, { className: "size-5 fill-orange-500 text-fd-card" })),
22
25
  error: _jsx(CircleX, { className: "size-5 fill-red-500 text-fd-card" }),
26
+ success: (_jsx(CircleCheck, { className: "size-5 fill-green-500 text-fd-card" })),
23
27
  }[type], _jsxs("div", { className: "min-w-0 flex flex-col gap-2 flex-1", children: [title ? _jsx("p", { className: "font-medium !my-0", children: title }) : null, _jsx("div", { className: "text-fd-muted-foreground prose-no-margin empty:hidden", children: children })] })] }));
24
28
  });
25
29
  Callout.displayName = 'Callout';
@@ -1,5 +1,4 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import type { ScrollAreaViewportProps } from '@radix-ui/react-scroll-area';
3
2
  export type CodeBlockProps = HTMLAttributes<HTMLElement> & {
4
3
  /**
5
4
  * Icon of code block
@@ -19,7 +18,7 @@ export type CodeBlockProps = HTMLAttributes<HTMLElement> & {
19
18
  * @defaultValue false
20
19
  */
21
20
  keepBackground?: boolean;
22
- viewportProps?: ScrollAreaViewportProps;
21
+ viewportProps?: HTMLAttributes<HTMLElement>;
23
22
  /**
24
23
  * show line numbers
25
24
  */
@@ -49,7 +48,7 @@ export declare const CodeBlock: import("react").ForwardRefExoticComponent<HTMLAt
49
48
  * @defaultValue false
50
49
  */
51
50
  keepBackground?: boolean;
52
- viewportProps?: ScrollAreaViewportProps;
51
+ viewportProps?: HTMLAttributes<HTMLElement>;
53
52
  /**
54
53
  * show line numbers
55
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/components/codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACzD;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,aAAa,CAAC,EAAE,uBAAuB,CAAC;IAExC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,GAAG,2HAYf,CAAC;AAIF,eAAO,MAAM,SAAS;IAlDpB;;;;OAIG;WACI,SAAS;IAEhB;;;;OAIG;gBACS,OAAO;IAEnB;;;;OAIG;qBACc,OAAO;oBAER,uBAAuB;IAEvC;;OAEG;0BACmB,OAAO;IAE7B;;OAEG;gCACyB,MAAM;+CA4GnC,CAAC"}
1
+ {"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/components/codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACzD;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,aAAa,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAE5C;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,GAAG,2HAYf,CAAC;AAIF,eAAO,MAAM,SAAS;IAlDpB;;;;OAIG;WACI,SAAS;IAEhB;;;;OAIG;gBACS,OAAO;IAEnB;;;;OAIG;qBACc,OAAO;oBAER,cAAc,CAAC,WAAW,CAAC;IAE3C;;OAEG;0BACmB,OAAO;IAE7B;;OAEG;gCACyB,MAAM;+CA2GnC,CAAC"}
@@ -3,11 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Check, Copy } from '../icons.js';
4
4
  import { forwardRef, useRef, } from 'react';
5
5
  import { cn } from '../utils/cn.js';
6
- import { ScrollArea, ScrollBar, ScrollViewport, } from '../components/ui/scroll-area.js';
7
6
  import { useCopyButton } from '../utils/use-copy-button.js';
8
7
  import { buttonVariants } from '../components/ui/button.js';
9
8
  export const Pre = forwardRef(({ className, ...props }, ref) => {
10
- return (_jsx("pre", { ref: ref, className: cn('size-full *:block *:w-full', className), ...props, children: props.children }));
9
+ return (_jsx("pre", { ref: ref, className: cn('min-w-full w-max *:flex *:flex-col', className), ...props, children: props.children }));
11
10
  });
12
11
  Pre.displayName = 'Pre';
13
12
  export const CodeBlock = forwardRef(({ title, allowCopy = true, keepBackground = false, icon, viewportProps, children, ...props }, ref) => {
@@ -22,16 +21,16 @@ export const CodeBlock = forwardRef(({ title, allowCopy = true, keepBackground =
22
21
  });
23
22
  void navigator.clipboard.writeText(clone.textContent ?? '');
24
23
  };
25
- return (_jsxs("figure", { ref: ref, ...props, className: cn('not-prose group relative my-4 overflow-hidden rounded-lg border bg-fd-card text-sm outline-none', keepBackground && 'bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)', props.className), children: [title ? (_jsxs("div", { className: "flex items-center gap-2 bg-fd-secondary px-4 py-1.5", children: [icon ? (_jsx("div", { className: "text-fd-muted-foreground [&_svg]:size-3.5", dangerouslySetInnerHTML: typeof icon === 'string'
24
+ return (_jsxs("figure", { ref: ref, dir: "ltr", ...props, className: cn('not-prose group relative my-4 overflow-hidden rounded-lg border bg-fd-card text-sm outline-none', keepBackground && 'bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)', props.className), children: [title ? (_jsxs("div", { className: "flex items-center gap-2 bg-fd-secondary px-4 py-1.5", children: [icon ? (_jsx("div", { className: "text-fd-muted-foreground [&_svg]:size-3.5", dangerouslySetInnerHTML: typeof icon === 'string'
26
25
  ? {
27
26
  __html: icon,
28
27
  }
29
- : undefined, children: typeof icon !== 'string' ? icon : null })) : null, _jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }), allowCopy ? (_jsx(CopyButton, { className: "-me-2", onCopy: onCopy })) : null] })) : (allowCopy && (_jsx(CopyButton, { className: "absolute right-2 top-2 z-[2] backdrop-blur-md", onCopy: onCopy }))), _jsxs(ScrollArea, { ref: areaRef, dir: "ltr", children: [_jsx(ScrollViewport, { ...viewportProps, className: cn('text-[13px] py-3.5 [&_.line]:px-4 max-h-[600px]', props['data-line-numbers'] && '[&_.line]:pl-3', viewportProps?.className), style: {
30
- counterSet: props['data-line-numbers']
31
- ? `line ${Number(props['data-line-numbers-start'] ?? 1) - 1}`
32
- : undefined,
33
- ...viewportProps?.style,
34
- }, children: children }), _jsx(ScrollBar, { orientation: "horizontal" })] })] }));
28
+ : undefined, children: typeof icon !== 'string' ? icon : null })) : null, _jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }), allowCopy ? (_jsx(CopyButton, { className: "-me-2", onCopy: onCopy })) : null] })) : (allowCopy && (_jsx(CopyButton, { className: "absolute right-2 top-2 z-[2] backdrop-blur-md", onCopy: onCopy }))), _jsx("div", { ref: areaRef, ...viewportProps, className: cn('text-[13px] py-3.5 overflow-auto [&_.line]:px-4 max-h-[600px] fd-scroll-container', props['data-line-numbers'] && '[&_.line]:pl-3', viewportProps?.className), style: {
29
+ counterSet: props['data-line-numbers']
30
+ ? `line ${Number(props['data-line-numbers-start'] ?? 1) - 1}`
31
+ : undefined,
32
+ ...viewportProps?.style,
33
+ }, children: children })] }));
35
34
  });
36
35
  CodeBlock.displayName = 'CodeBlock';
37
36
  function CopyButton({ className, onCopy, ...props }) {
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout/sidebar.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,EAAE,EAGP,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;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMrD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC3D;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA2BD,wBAAgB,OAAO,CAAC,EACtB,gBAAoB,EACpB,QAAe,EACf,WAAkB,EAClB,GAAG,KAAK,EACT,EAAE,YAAY,2CAkHd;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAYzD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAYzD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,2CAarD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2C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,uBAAuB,2CAqBlE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrE;AAgBD,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,CAAC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC1E,SAAS,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzC,2CAuDA"}
@@ -45,7 +45,7 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
45
45
  });
46
46
  if (isMobile) {
47
47
  const state = open ? 'open' : 'closed';
48
- return (_jsxs(_Fragment, { children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 bg-black/30 backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsx(RemoveScroll, { as: "aside", enabled: present, id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] flex flex-col rounded-e-xl border-e start-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-enterFromLeft data-[state=closed]:animate-fd-exitToLeft', !present && 'invisible', props.className), children: _jsx(Context.Provider, { value: context, children: props.children }) })) })] }));
48
+ return (_jsxs(_Fragment, { children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 bg-black/30 backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsx(RemoveScroll, { as: "aside", enabled: present, id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] flex flex-col py-3 rounded-e-xl border-e start-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-enterFromLeft data-[state=closed]:animate-fd-exitToLeft', !present && 'invisible', props.className), children: _jsx(Context.Provider, { value: context, children: props.children }) })) })] }));
49
49
  }
50
50
  return (_jsx("aside", { id: "nd-sidebar", ...props, "data-collapsed": collapsed, className: cn('sticky top-(--fd-sidebar-top) z-20 bg-fd-card text-sm h-(--fd-sidebar-height) max-md:hidden', collapsible && [
51
51
  'transition-all',
@@ -76,13 +76,13 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
76
76
  }, Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100
77
77
  ? 0
78
78
  : 500);
79
- }, children: _jsx("div", { className: "flex w-(--fd-sidebar-width) h-full max-w-full flex-col ms-auto border-e", children: _jsx(Context.Provider, { value: context, children: props.children }) }) }));
79
+ }, children: _jsx("div", { className: "flex w-(--fd-sidebar-width) h-full max-w-full flex-col pt-1.5 ms-auto border-e", children: _jsx(Context.Provider, { value: context, children: props.children }) }) }));
80
80
  }
81
81
  export function SidebarHeader(props) {
82
- return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 px-4 pt-4 max-md:pt-6 empty:hidden', props.className), children: props.children }));
82
+ return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 px-4 py-2', props.className), children: props.children }));
83
83
  }
84
84
  export function SidebarFooter(props) {
85
- return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3 empty:hidden max-md:pb-6', props.className), children: props.children }));
85
+ return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3', props.className), children: props.children }));
86
86
  }
87
87
  export function SidebarViewport(props) {
88
88
  return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { className: "p-4", style: {
@@ -1,6 +1,5 @@
1
1
  import type { TOCItemType } from 'fumadocs-core/server';
2
2
  import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
3
- import { ScrollArea } from '../ui/scroll-area.js';
4
3
  export interface TOCProps {
5
4
  /**
6
5
  * Custom content in TOC container, before the main TOC
@@ -14,9 +13,7 @@ export interface TOCProps {
14
13
  }
15
14
  export declare function Toc(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
16
15
  export declare function TocItemsEmpty(): import("react/jsx-runtime").JSX.Element;
17
- export declare function TOCScrollArea({ isMenu, ...props }: ComponentProps<typeof ScrollArea> & {
18
- isMenu?: boolean;
19
- }): import("react/jsx-runtime").JSX.Element;
16
+ export declare function TOCScrollArea(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
20
17
  export declare function TOCItems({ items }: {
21
18
  items: TOCItemType[];
22
19
  }): import("react/jsx-runtime").JSX.Element;
@@ -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,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAG/D,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,aAAa,CAAC,EAC5B,MAAM,EACN,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,UAAU,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,2CAsB1D;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAqB3D"}
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,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAMf,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,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAiBzD;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,2CAqB3D"}
@@ -5,23 +5,21 @@ import { useRef, } from 'react';
5
5
  import { cn } from '../../utils/cn.js';
6
6
  import { useI18n } from '../../contexts/i18n.js';
7
7
  import { TocThumb } from '../../components/layout/toc-thumb.js';
8
- import { ScrollArea, ScrollViewport } from '../ui/scroll-area.js';
9
8
  import { usePageStyles } from '../../contexts/layout.js';
10
9
  export function Toc(props) {
11
10
  const { toc } = usePageStyles();
12
11
  return (_jsx("div", { id: "nd-toc", ...props, className: cn('sticky top-[calc(var(--fd-banner-height)+var(--fd-nav-height))] h-(--fd-toc-height) pb-2 pt-12', toc, props.className), style: {
13
12
  ...props.style,
14
13
  '--fd-toc-height': 'calc(100dvh - var(--fd-banner-height) - var(--fd-nav-height))',
15
- }, children: _jsx("div", { className: "flex h-full w-(--fd-toc-width) max-w-full flex-col gap-3 pe-4", children: props.children }) }));
14
+ }, children: _jsx("div", { className: "flex h-full w-(--fd-toc-width) max-w-full flex-col pe-4", children: props.children }) }));
16
15
  }
17
16
  export function TocItemsEmpty() {
18
17
  const { text } = useI18n();
19
18
  return (_jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings }));
20
19
  }
21
- export function TOCScrollArea({ isMenu, ...props }) {
20
+ export function TOCScrollArea(props) {
22
21
  const viewRef = useRef(null);
23
- return (_jsx(ScrollArea, { ...props, className: cn('flex flex-col ps-px', props.className), children: _jsx(ScrollViewport, { ref: viewRef, className: cn('relative min-h-0 text-sm', isMenu &&
24
- '[mask-image:linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] px-4 md:px-6 py-2'), children: _jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: props.children }) }) }));
22
+ return (_jsx("div", { ...props, ref: viewRef, className: cn('relative min-h-0 text-sm ms-px overflow-auto [scrollbar-width:none] [mask-image:linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] py-3', props.className), children: _jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: props.children }) }));
25
23
  }
26
24
  export function TOCItems({ items }) {
27
25
  const containerRef = useRef(null);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The built-in CSS `:empty` selector cannot detect if the children is hidden, classes such as `md:hidden` causes it to fail.
3
+ * This component is an enhancement to `empty:hidden` to fix the issue described above.
4
+ *
5
+ * This can be expensive, please avoid this whenever possible.
6
+ */
7
+ export declare function HideIfEmpty({ children }: {
8
+ children: React.ReactNode;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=hide-if-empty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hide-if-empty.d.ts","sourceRoot":"","sources":["../../../src/components/ui/hide-if-empty.tsx"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAyCtE"}
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Slot } from '@radix-ui/react-slot';
4
+ import { useEffect, useId, useRef, useState } from 'react';
5
+ const init = `function isEmpty(node) {
6
+ for (let i = 0; i < node.childNodes.length; i++) {
7
+ const child = node.childNodes.item(i);
8
+ if (child.nodeType === Node.TEXT_NODE) {
9
+ return false
10
+ } else if (
11
+ child.nodeType === Node.ELEMENT_NODE &&
12
+ window.getComputedStyle(child).display !== 'none'
13
+ ) {
14
+ return false
15
+ }
16
+ }
17
+
18
+ return true;
19
+ }`;
20
+ const isEmpty = eval(`${init}; isEmpty`);
21
+ /**
22
+ * The built-in CSS `:empty` selector cannot detect if the children is hidden, classes such as `md:hidden` causes it to fail.
23
+ * This component is an enhancement to `empty:hidden` to fix the issue described above.
24
+ *
25
+ * This can be expensive, please avoid this whenever possible.
26
+ */
27
+ export function HideIfEmpty({ children }) {
28
+ const id = useId();
29
+ const ref = useRef(null);
30
+ const [empty, setEmpty] = useState();
31
+ useEffect(() => {
32
+ const element = ref.current;
33
+ if (!element)
34
+ return;
35
+ const onUpdate = () => {
36
+ setEmpty(isEmpty(element));
37
+ };
38
+ const observer = new ResizeObserver(onUpdate);
39
+ observer.observe(element);
40
+ onUpdate();
41
+ return () => {
42
+ observer.disconnect();
43
+ };
44
+ }, []);
45
+ const inject = `
46
+ ${init}
47
+ const element = document.querySelector('[data-hide-if-empty="${id}"]')
48
+ if (element) {
49
+ element.setAttribute('data-empty', String(isEmpty(element)))
50
+ }`;
51
+ return (_jsxs(_Fragment, { children: [empty === undefined && _jsx("script", { children: `{ ${inject} }` }), _jsx(Slot, { ref: ref, "data-hide-if-empty": id, "data-empty": empty, className: "data-[empty=true]:hidden", children: children })] }));
52
+ }
@@ -12,6 +12,6 @@ NavigationMenuTrigger.displayName = Primitive.Trigger.displayName;
12
12
  const NavigationMenuContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(Primitive.Content, { ref: ref, className: cn('absolute inset-x-0 top-0 data-[motion=from-end]:animate-fd-enterFromRight data-[motion=from-start]:animate-fd-enterFromLeft data-[motion=to-end]:animate-fd-exitToRight data-[motion=to-start]:animate-fd-exitToLeft', className), ...props })));
13
13
  NavigationMenuContent.displayName = Primitive.Content.displayName;
14
14
  const NavigationMenuLink = Primitive.Link;
15
- const NavigationMenuViewport = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: "flex w-full justify-center", children: _jsx(Primitive.Viewport, { ...props, className: cn('relative h-(--radix-navigation-menu-viewport-height) w-full origin-[top_center] overflow-hidden text-fd-popover-foreground transition-[width,height] duration-300 data-[state=closed]:animate-fd-nav-menu-out data-[state=open]:animate-fd-nav-menu-in', className) }) })));
15
+ const NavigationMenuViewport = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: "flex w-full justify-center", children: _jsx(Primitive.Viewport, { ...props, className: cn('relative h-(--radix-navigation-menu-viewport-height) max-h-[80svh] w-full origin-[top_center] overflow-auto [scrollbar-width:none] text-fd-popover-foreground transition-[width,height] duration-300 data-[state=closed]:animate-fd-nav-menu-out data-[state=open]:animate-fd-nav-menu-in', className) }) })));
16
16
  NavigationMenuViewport.displayName = Primitive.Viewport.displayName;
17
17
  export { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuContent, NavigationMenuTrigger, NavigationMenuLink, NavigationMenuViewport, };
@@ -24,7 +24,7 @@ export declare function DocsLayoutSidebarFooter({ i18n, themeSwitch, links, }: {
24
24
  i18n?: DocsLayoutProps['i18n'];
25
25
  links?: IconItemType[];
26
26
  themeSwitch?: DocsLayoutProps['themeSwitch'];
27
- }): import("react/jsx-runtime").JSX.Element | null;
27
+ }): import("react/jsx-runtime").JSX.Element;
28
28
  export { CollapsibleControl, Navbar, NavbarSidebarTrigger, type LinkItemType };
29
29
  export { getSidebarTabsFromOptions } from './docs/shared.js';
30
30
  //# 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,cAAc,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAarE,OAAO,EAEL,KAAK,YAAY,EACjB,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;AAG/B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAY/B,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;QAClC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IAEF;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,GAAG,GAAG,EAAO,EACrC,OAAY,EACZ,YAAY,EACZ,kBAA0B,EAC1B,WAA8C,EAC9C,IAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eA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AAE,OAAO,CAAC,cAAc,CAAC,GAAG;QAClC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,CAAC;IAEF;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,GAAG,GAAG,EAAO,EACrC,OAAY,EACZ,YAAY,EACZ,kBAA0B,EAC1B,WAA8C,EAC9C,IAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CAkG7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,WAAkB,EAClB,UAAU,EACV,GAAG,EACH,KAAU,EACV,MAAM,EACN,MAAM,EACN,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG;IAChC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,2CAgDA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,WAAW,EACX,KAAU,GACX,EAAE;IACD,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;CAC9C,2CAgCA;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC"}
@@ -16,6 +16,7 @@ import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '..
16
16
  import { NavProvider, StylesProvider, } from '../contexts/layout.js';
17
17
  import Link from 'fumadocs-core/link';
18
18
  import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
19
+ import { HideIfEmpty } from '../components/ui/hide-if-empty.js';
19
20
  export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar = {}, searchToggle, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, i18n = false, children, ...props }) {
20
21
  const tabs = useMemo(() => getSidebarTabsFromOptions(sidebar.tabs, props.tree) ?? [], [sidebar.tabs, props.tree]);
21
22
  const links = getLinks(props.links ?? [], props.githubUrl);
@@ -32,18 +33,15 @@ export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar = {}
32
33
  }, children: [slot(sidebar, _jsx(DocsLayoutSidebar, { ...omit(sidebar, 'enabled', 'component', 'tabs'), links: links, nav: _jsxs(_Fragment, { children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[15px] items-center gap-2.5 font-medium", children: nav.title }), nav.children] }), banner: _jsxs(_Fragment, { children: [tabs.length > 0 ? _jsx(RootToggle, { options: tabs }) : null, slots('lg', searchToggle, _jsx(LargeSearchToggle, { hideIfDisabled: true, className: "rounded-lg max-md:hidden" })), sidebar.banner] }), footer: _jsxs(_Fragment, { children: [_jsx(DocsLayoutSidebarFooter, { links: links.filter((item) => item.type === 'icon'), i18n: i18n, themeSwitch: themeSwitch }), sidebar.footer] }) })), _jsx(StylesProvider, { ...pageStyles, children: children })] })] }) }));
33
34
  }
34
35
  export function DocsLayoutSidebar({ collapsible = true, components, nav, links = [], footer, banner, ...props }) {
35
- return (_jsxs(_Fragment, { children: [collapsible ? _jsx(CollapsibleControl, {}) : null, _jsxs(Sidebar, { ...props, collapsible: collapsible, className: cn('md:ps-(--fd-layout-offset)', props.className), children: [_jsxs(SidebarHeader, { children: [_jsxs("div", { className: "flex flex-row py-1.5 max-md:hidden", children: [nav, collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
36
- color: 'ghost',
37
- size: 'icon-sm',
38
- }), 'ms-auto mb-auto -my-1.5 text-fd-muted-foreground max-md:hidden'), children: _jsx(SidebarIcon, {}) }))] }), banner] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "mb-4 empty:hidden", children: links
39
- .filter((v) => v.type !== 'icon')
40
- .map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx(SidebarPageTree, { components: components })] }), _jsx(SidebarFooter, { children: footer })] })] }));
36
+ return (_jsxs(_Fragment, { children: [collapsible ? _jsx(CollapsibleControl, {}) : null, _jsxs(Sidebar, { ...props, collapsible: collapsible, className: cn('md:ps-(--fd-layout-offset)', props.className), children: [_jsx(HideIfEmpty, { children: _jsxs(SidebarHeader, { children: [_jsxs("div", { className: "flex py-1.5 max-md:hidden", children: [nav, collapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
37
+ color: 'ghost',
38
+ size: 'icon-sm',
39
+ }), 'ms-auto mb-auto -my-1.5 text-fd-muted-foreground max-md:hidden'), children: _jsx(SidebarIcon, {}) }))] }), banner] }) }), _jsxs(SidebarViewport, { children: [links
40
+ .filter((v) => v.type !== 'icon')
41
+ .map((item, i, list) => (_jsx(SidebarLinkItem, { item: item, className: cn(i === list.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: components })] }), _jsx(HideIfEmpty, { children: _jsx(SidebarFooter, { children: footer }) })] })] }));
41
42
  }
42
43
  export function DocsLayoutSidebarFooter({ i18n, themeSwitch, links = [], }) {
43
- // empty footer items
44
- if (links.length === 0 && !i18n && themeSwitch?.enabled === false)
45
- return null;
46
- return (_jsxs("div", { className: "flex flex-row items-center", children: [links.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon', color: 'ghost' }), 'text-fd-muted-foreground md:[&_svg]:size-4.5'), "aria-label": item.label, children: item.icon }, i))), _jsx("div", { role: "separator", className: "flex-1" }), i18n ? (_jsxs(LanguageToggle, { className: "me-1.5", children: [_jsx(Languages, { className: "size-4.5" }), _jsx(LanguageToggleText, { className: "md:hidden" })] })) : null, slot(themeSwitch, _jsx(ThemeToggle, { className: "p-0", mode: themeSwitch?.mode }))] }));
44
+ return (_jsx(HideIfEmpty, { children: _jsxs("div", { className: "flex items-center justify-end", children: [_jsx("div", { className: "flex items-center flex-1 empty:hidden", children: links.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon', color: 'ghost' }), 'text-fd-muted-foreground md:[&_svg]:size-4.5'), "aria-label": item.label, children: item.icon }, i))) }), i18n ? (_jsxs(LanguageToggle, { className: "me-1.5", children: [_jsx(Languages, { className: "size-4.5" }), _jsx(LanguageToggleText, { className: "md:hidden" })] })) : null, slot(themeSwitch, _jsx(ThemeToggle, { className: "p-0", mode: themeSwitch?.mode }))] }) }));
47
45
  }
48
46
  export { CollapsibleControl, Navbar, NavbarSidebarTrigger };
49
47
  export { getSidebarTabsFromOptions } from './docs/shared.js';
@@ -12,11 +12,11 @@ const navItemVariants = cva('inline-flex items-center gap-1 p-2 text-fd-muted-fo
12
12
  export function Navbar(props) {
13
13
  const [value, setValue] = useState('');
14
14
  const { isTransparent } = useNav();
15
- return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed left-(--fd-nav-left) top-(--fd-banner-height) z-40 box-content w-full max-w-fd-container -translate-x-1/2 border-b transition-colors lg:mt-2 lg:w-[calc(100%-1rem)] lg:rounded-2xl lg:border', value.length > 0 ? 'shadow-lg' : 'shadow-sm', (!isTransparent || value.length > 0) &&
16
- 'bg-fd-background/80 backdrop-blur-lg', props.className), style: {
17
- '--fd-nav-left': 'calc(50% - var(--removed-body-scroll-bar-size,0px) / 2)',
15
+ return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed top-(--fd-banner-height) z-40 box-content backdrop-blur-lg max-w-fd-container -translate-x-1/2 border-b transition-colors lg:mt-2 lg:[--fd-padding:1rem] lg:rounded-2xl lg:border', value.length > 0 ? 'shadow-lg' : 'shadow-sm', (!isTransparent || value.length > 0) && 'bg-fd-background/80', props.className), style: {
16
+ width: 'calc(100% - var(--fd-padding,0px) - var(--removed-body-scroll-bar-size,0px))',
17
+ left: 'calc(50% - var(--removed-body-scroll-bar-size,0px) / 2)',
18
18
  ...props.style,
19
- }, children: [_jsx(NavigationMenuList, { className: "flex h-14 w-full flex-row items-center px-4 lg:h-12", asChild: true, children: _jsx("nav", { children: props.children }) }), _jsx(NavigationMenuViewport, {})] }) }));
19
+ }, children: [_jsx(NavigationMenuList, { className: "flex h-14 w-full items-center px-4 lg:h-12", asChild: true, children: _jsx("nav", { children: props.children }) }), _jsx(NavigationMenuViewport, {})] }) }));
20
20
  }
21
21
  export const NavbarMenu = NavigationMenuItem;
22
22
  export function NavbarMenuContent(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AA6B1D,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,GAAG,CAAC,EAAE,OAAO,CACX,UAAU,GAAG;QACX;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CACF,CAAC;CACH;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,2CAmCrD;AAED,wBAAgB,MAAM,CAAC,EACrB,GAAQ,EACR,IAAY,EACZ,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,eAAe,2CA8FjB"}
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,UAAU,CAAC;AA6B1D,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,GAAG,CAAC,EAAE,OAAO,CACX,UAAU,GAAG;QACX;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CACF,CAAC;CACH;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,2CAmCrD;AAED,wBAAgB,MAAM,CAAC,EACrB,GAAQ,EACR,IAAY,EACZ,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,eAAe,2CA8FjB"}
@@ -33,7 +33,7 @@ function NavbarLinkItem({ item, ...props }) {
33
33
  if (child.type === 'custom')
34
34
  return _jsx(Fragment, { children: child.children }, j);
35
35
  const { banner = child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null, ...rest } = child.menu ?? {};
36
- return (_jsx(NavbarMenuLink, { href: child.url, ...rest, children: rest.children ?? (_jsxs(_Fragment, { children: [banner, _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] })) }, j));
36
+ return (_jsx(NavbarMenuLink, { href: child.url, external: child.external, ...rest, children: rest.children ?? (_jsxs(_Fragment, { children: [banner, _jsx("p", { className: "text-[15px] font-medium", children: child.text }), _jsx("p", { className: "text-sm text-fd-muted-foreground empty:hidden", children: child.description })] })) }, j));
37
37
  });
38
38
  return (_jsxs(NavbarMenu, { children: [_jsx(NavbarMenuTrigger, { ...props, children: item.url ? _jsx(Link, { href: item.url, children: item.text }) : item.text }), _jsx(NavbarMenuContent, { children: children })] }));
39
39
  }
@@ -6,7 +6,4 @@ export declare function Navbar({ mode, ...props }: HTMLAttributes<HTMLElement> &
6
6
  export declare function NavbarSidebarTrigger(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
7
7
  export declare function LayoutTabs(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
8
8
  export declare function LayoutTab(item: Option): import("react/jsx-runtime").JSX.Element;
9
- export declare function SidebarLayoutTab({ item, ...props }: {
10
- item: Option;
11
- } & HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
12
9
  //# 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,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBxD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAmB/C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAY5D;AAUD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,2CAkBrC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAAC,WAAW,CAAC,2CAoBhD"}
1
+ {"version":3,"file":"notebook-client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBxD;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,2CAmB/C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAY5D;AAUD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,2CAkBrC"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cn } from '../utils/cn.js';
4
4
  import { useSidebar } from '../contexts/sidebar.js';
5
5
  import { useNav } from '../contexts/layout.js';
@@ -38,9 +38,3 @@ export function LayoutTab(item) {
38
38
  closeOnRedirect.current = false;
39
39
  }, children: item.title }));
40
40
  }
41
- export function SidebarLayoutTab({ item, ...props }) {
42
- const selected = useIsSelected(item);
43
- return (_jsxs(Link, { ...props, className: cn('flex flex-row items-center px-2 -mx-2 py-1.5 gap-2.5 text-fd-muted-foreground [&_svg]:!size-4.5', selected
44
- ? 'text-fd-primary font-medium'
45
- : 'hover:text-fd-accent-foreground', props.className), "data-active": selected, href: item.url, children: [item.icon, item.title] }));
46
- }
@@ -1 +1 @@
1
- {"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAqB/E,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;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,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAmKhD;AAoLD,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC"}
@@ -11,11 +11,12 @@ import { LanguageToggle } from '../components/layout/language-toggle.js';
11
11
  import { ThemeToggle } from '../components/layout/theme-toggle.js';
12
12
  import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover.js';
13
13
  import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared.js';
14
- import { LayoutTab, LayoutTabs, Navbar, NavbarSidebarTrigger, SidebarLayoutTab, } from './notebook-client.js';
14
+ import { LayoutTab, LayoutTabs, Navbar, NavbarSidebarTrigger, } from './notebook-client.js';
15
15
  import { NavProvider, StylesProvider, } from '../contexts/layout.js';
16
16
  import { RootToggle } from '../components/layout/root-toggle.js';
17
17
  import Link from 'fumadocs-core/link';
18
18
  import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
19
+ import { HideIfEmpty } from '../components/ui/hide-if-empty.js';
19
20
  export function DocsLayout(props) {
20
21
  const { tabMode = 'sidebar', nav: { transparentMode, ...nav } = {}, sidebar: { tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, disableThemeSwitch = false, themeSwitch = { enabled: !disableThemeSwitch }, } = props;
21
22
  const navMode = nav.mode ?? 'auto';
@@ -29,17 +30,25 @@ export function DocsLayout(props) {
29
30
  toc: cn('max-xl:hidden'),
30
31
  page: cn('mt-(--fd-nav-height)'),
31
32
  };
33
+ const sidebarHeader = navMode === 'auto' && (_jsxs("div", { className: "flex justify-between max-md:hidden", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-medium", children: nav.title }), (sidebar.collapsible ?? true) && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
34
+ color: 'ghost',
35
+ size: 'icon-sm',
36
+ className: 'mb-auto text-fd-muted-foreground',
37
+ })), children: _jsx(SidebarIcon, {}) }))] }));
32
38
  return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs("main", { id: "nd-docs-layout", ...props.containerProps, className: cn('flex w-full flex-1 flex-row pe-(--fd-layout-offset)', variables, props.containerProps?.className), style: {
33
39
  ...layoutVariables,
34
40
  ...props.containerProps?.style,
35
41
  }, children: [_jsxs(Sidebar, { ...sidebar, className: cn('md:ps-(--fd-layout-offset)', navMode === 'top'
36
42
  ? 'md:bg-transparent'
37
- : 'md:[--fd-nav-height:0px]', sidebar.className), children: [_jsxs(SidebarHeader, { children: [navMode === 'auto' && (_jsxs("div", { className: "flex flex-row justify-between max-md:hidden", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 font-medium", children: nav.title }), (sidebar.collapsible ?? true) && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
38
- color: 'ghost',
43
+ : 'md:[--fd-nav-height:0px]', sidebar.className), children: [_jsx(HideIfEmpty, { children: _jsxs(SidebarHeader, { children: [sidebarHeader, nav.children, sidebarBanner, tabMode === 'sidebar' && tabs.length > 0 ? (_jsx(RootToggle, { className: "mb-2", options: tabs })) : null, tabMode === 'navbar' && tabs.length > 0 && (_jsx(RootToggle, { options: tabs, className: "lg:hidden" }))] }) }), _jsxs(SidebarViewport, { children: [links
44
+ .filter((item) => item.type !== 'icon')
45
+ .map((item, i) => (_jsx(SidebarLinkItem, { item: item, className: cn('lg:hidden', i === links.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: sidebarComponents })] }), _jsx(HideIfEmpty, { children: _jsxs(SidebarFooter, { className: "flex flex-row items-center justify-end", children: [_jsx("div", { className: "flex items-center flex-1 empty:hidden lg:hidden", children: links
46
+ .filter((item) => item.type === 'icon')
47
+ .map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({
39
48
  size: 'icon-sm',
40
- className: 'text-fd-muted-foreground mb-auto',
41
- })), children: _jsx(SidebarIcon, {}) }))] })), nav.children, sidebarBanner, tabMode === 'sidebar' && tabs.length > 0 ? (_jsx(RootToggle, { className: "mb-2", options: tabs })) : null] }), _jsxs(SidebarViewport, { children: [tabMode === 'navbar' &&
42
- tabs.map((tab, i) => (_jsx(SidebarLayoutTab, { item: tab, className: cn('lg:hidden', i === tabs.length - 1 && 'mb-4') }, tab.url))), links.map((item, i) => (_jsx(SidebarLinkItem, { item: item, className: cn('lg:hidden', i === links.length - 1 && 'mb-4') }, i))), _jsx(SidebarPageTree, { components: sidebarComponents })] }), _jsxs(SidebarFooter, { className: cn('flex flex-row items-center', !sidebarFooter && 'md:hidden'), children: [i18n ? (_jsx(LanguageToggle, { className: "me-auto md:hidden", children: _jsx(Languages, { className: "size-5 text-fd-muted-foreground" }) })) : null, slot(themeSwitch, _jsx(ThemeToggle, { className: "md:hidden", mode: themeSwitch?.mode ?? 'light-dark-system' })), sidebarFooter] })] }), _jsx(DocsNavbar, { ...props, links: links, tabs: tabMode == 'navbar' ? tabs : [] }), _jsx(StylesProvider, { ...pageStyles, children: props.children })] }) }) }));
49
+ color: 'ghost',
50
+ className: 'text-fd-muted-foreground',
51
+ })), "aria-label": item.label, children: item.icon }, i))) }), i18n ? (_jsx(LanguageToggle, { className: "me-auto md:hidden", children: _jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) })) : null, slot(themeSwitch, _jsx(ThemeToggle, { className: "md:hidden", mode: themeSwitch?.mode ?? 'light-dark-system' })), sidebarFooter] }) })] }), _jsx(DocsNavbar, { ...props, links: links, tabs: tabMode == 'navbar' ? tabs : [] }), _jsx(StylesProvider, { ...pageStyles, children: props.children })] }) }) }));
43
52
  }
44
53
  function DocsNavbar({ links, tabs, ...props }) {
45
54
  const navMode = props.nav?.mode ?? 'auto';
@@ -55,7 +64,7 @@ function DocsNavbar({ links, tabs, ...props }) {
55
64
  .map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon-sm', color: 'ghost' }), 'text-fd-muted-foreground max-lg:hidden'), "aria-label": item.label, children: item.icon }, i))), props.i18n ? (_jsx(LanguageToggle, { className: "max-md:hidden", children: _jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) })) : null, slot(props.themeSwitch, _jsx(ThemeToggle, { className: "ms-2 max-md:hidden", mode: props.themeSwitch?.mode ?? 'light-dark-system' })), sidebarCollapsible && navMode === 'top' ? (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
56
65
  color: 'secondary',
57
66
  size: 'icon-sm',
58
- }), 'ms-2 text-fd-muted-foreground rounded-full max-md:hidden'), children: _jsx(SidebarIcon, {}) })) : null] })] }), tabs.length > 0 ? (_jsx(LayoutTabs, { className: "px-6 border-b border-fd-foreground/10 h-10 max-lg:hidden", children: tabs.map((tab) => (_jsx(LayoutTab, { ...tab }, tab.url))) })) : null] }));
67
+ }), 'ms-2 text-fd-muted-foreground rounded-full max-md:hidden'), children: _jsx(SidebarIcon, {}) })) : null] })] }), tabs.length > 0 ? (_jsx(LayoutTabs, { className: "px-6 border-b h-10 max-lg:hidden", children: tabs.map((tab) => (_jsx(LayoutTab, { ...tab }, tab.url))) })) : null] }));
59
68
  }
60
69
  function NavbarLinkItem({ item, ...props }) {
61
70
  if (item.type === 'menu') {
package/dist/mdx.d.ts CHANGED
@@ -19,7 +19,7 @@ declare const defaultMdxComponents: {
19
19
  table: typeof Table;
20
20
  Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
21
21
  title?: import("react").ReactNode;
22
- type?: "info" | "warn" | "error";
22
+ type?: "info" | "warn" | "error" | "success" | "warning";
23
23
  icon?: import("react").ReactNode;
24
24
  } & import("react").RefAttributes<HTMLDivElement>>;
25
25
  };
package/dist/page.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TableOfContents } from 'fumadocs-core/server';
2
- import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { type ComponentProps, type ReactNode } from 'react';
3
3
  import { type AnchorProviderProps } from 'fumadocs-core/toc';
4
4
  import { type BreadcrumbProps, type FooterProps } from './page-client.js';
5
5
  import { type TOCProps } from './components/layout/toc.js';
@@ -61,8 +61,8 @@ export interface DocsPageProps {
61
61
  footer?: Partial<FooterOptions>;
62
62
  editOnGithub?: EditOnGitHubOptions;
63
63
  lastUpdate?: Date | string | number;
64
- container?: HTMLAttributes<HTMLDivElement>;
65
- article?: HTMLAttributes<HTMLElement>;
64
+ container?: ComponentProps<'div'>;
65
+ article?: ComponentProps<'article'>;
66
66
  children: ReactNode;
67
67
  }
68
68
  export declare function DocsPage({ toc, full, editOnGithub, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): import("react/jsx-runtime").JSX.Element;
@@ -70,14 +70,12 @@ export declare function EditOnGitHub(props: ComponentProps<'a'>): import("react/
70
70
  /**
71
71
  * Add typography styles
72
72
  */
73
- export declare const DocsBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
74
- export declare const DocsDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
75
- export declare const DocsTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLHeadingElement>>;
73
+ export declare const DocsBody: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
74
+ export declare const DocsDescription: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
75
+ export declare const DocsTitle: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
76
76
  /**
77
77
  * For separate MDX page
78
78
  */
79
- export declare function withArticle({ children }: {
80
- children: ReactNode;
81
- }): ReactNode;
79
+ export declare function withArticle(props: ComponentProps<'main'>): ReactNode;
82
80
  export {};
83
81
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,WAAW,EAOjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,QAAQ,EAEd,MAAM,yBAAyB,CAAC;AAMjC,KAAK,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,GAC/D,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEJ,KAAK,4BAA4B,GAAG,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAE1E,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;I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B,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAuBtD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,2MAMpB,CAAC;AAIF,eAAO,MAAM,eAAe,6NAgB1B,CAAC;AAIH,eAAO,MAAM,SAAS,uNAYrB,CAAC;AAIF;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,CAMpE"}
package/dist/page.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, } from 'react';
2
+ import { forwardRef, lazy } from 'react';
3
3
  import { AnchorProvider } from 'fumadocs-core/toc';
4
4
  import { slot } from './layouts/shared.js';
5
5
  import { cn } from './utils/cn.js';
@@ -8,7 +8,7 @@ import { Toc, TOCItems, TOCScrollArea, } from './components/layout/toc.js';
8
8
  import { buttonVariants } from './components/ui/button.js';
9
9
  import { Edit, Text } from './icons.js';
10
10
  import { I18nLabel } from './contexts/i18n.js';
11
- import ClerkTOCItems from './components/layout/toc-clerk.js';
11
+ const ClerkTOCItems = lazy(() => import('./components/layout/toc-clerk.js'));
12
12
  export function DocsPage({ toc = [], full = false, editOnGithub, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
13
13
  const isTocRequired = toc.length > 0 ||
14
14
  tocOptions.footer !== undefined ||
@@ -21,7 +21,7 @@ export function DocsPage({ toc = [], full = false, editOnGithub, tableOfContentP
21
21
  return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(PageBody, { ...props.container, className: cn(props.container?.className), style: {
22
22
  '--fd-tocnav-height': !tocPopoverEnabled ? '0px' : undefined,
23
23
  ...props.container?.style,
24
- }, children: [slot({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsxs(TocPopover, { className: "h-10", children: [_jsx(TocPopoverTrigger, { className: "w-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, _jsx(TOCScrollArea, { isMenu: true, children: tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })) }), tocPopoverOptions.footer] })] }), {
24
+ }, children: [slot({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsxs(TocPopover, { className: "h-10", children: [_jsx(TocPopoverTrigger, { className: "w-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, _jsx(TOCScrollArea, { className: "px-4 md:px-6", children: tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })) }), tocPopoverOptions.footer] })] }), {
25
25
  items: toc,
26
26
  ...tocPopoverOptions,
27
27
  }), _jsxs(PageArticle, { ...props.article, className: cn(full || !tocEnabled ? 'max-w-[1120px]' : 'max-w-[860px]', props.article?.className), children: [slot(props.breadcrumb, _jsx(Breadcrumb, { ...props.breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [editOnGithub && (_jsx(EditOnGitHub, { href: `https://github.com/${editOnGithub.owner}/${editOnGithub.repo}/blob/${editOnGithub.sha}/${editOnGithub.path.startsWith('/') ? editOnGithub.path.slice(1) : editOnGithub.path}` })), props.lastUpdate && (_jsx(LastUpdate, { date: new Date(props.lastUpdate) }))] }), slot(props.footer, _jsx(Footer, { items: props.footer?.items }))] })] }), slot({ enabled: tocEnabled, component: tocReplace }, _jsxs(Toc, { children: [tocOptions.header, _jsxs("h3", { className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), _jsx(TOCScrollArea, { children: tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })) }), tocOptions.footer] }), {
@@ -55,6 +55,6 @@ DocsTitle.displayName = 'DocsTitle';
55
55
  /**
56
56
  * For separate MDX page
57
57
  */
58
- export function withArticle({ children }) {
59
- return (_jsx("main", { className: "container py-12", children: _jsx("article", { className: "prose", children: children }) }));
58
+ export function withArticle(props) {
59
+ return (_jsx("main", { ...props, className: cn('container py-12', props.className), children: _jsx("article", { className: "prose", children: props.children }) }));
60
60
  }
package/dist/style.css CHANGED
@@ -9,6 +9,7 @@
9
9
  "Courier New", monospace;
10
10
  --color-red-500: oklch(63.7% 0.237 25.331);
11
11
  --color-orange-500: oklch(70.5% 0.213 47.604);
12
+ --color-green-500: oklch(72.3% 0.219 149.579);
12
13
  --color-blue-500: oklch(62.3% 0.214 259.815);
13
14
  --color-black: #000;
14
15
  --spacing: 0.25rem;
@@ -354,9 +355,6 @@
354
355
  .bottom-1\.5 {
355
356
  bottom: calc(var(--spacing) * 1.5);
356
357
  }
357
- .left-\(--fd-nav-left\) {
358
- left: var(--fd-nav-left);
359
- }
360
358
  .left-1\/2 {
361
359
  left: calc(1/2 * 100%);
362
360
  }
@@ -409,9 +407,6 @@
409
407
  .-mx-1 {
410
408
  margin-inline: calc(var(--spacing) * -1);
411
409
  }
412
- .-mx-2 {
413
- margin-inline: calc(var(--spacing) * -2);
414
- }
415
410
  .\!my-0 {
416
411
  margin-block: calc(var(--spacing) * 0) !important;
417
412
  }
@@ -442,6 +437,9 @@
442
437
  .ms-auto {
443
438
  margin-inline-start: auto;
444
439
  }
440
+ .ms-px {
441
+ margin-inline-start: 1px;
442
+ }
445
443
  .-me-\(--fd-sidebar-width\) {
446
444
  margin-inline-end: calc(var(--fd-sidebar-width) * -1);
447
445
  }
@@ -847,9 +845,6 @@
847
845
  .mr-auto {
848
846
  margin-right: auto;
849
847
  }
850
- .-mb-1 {
851
- margin-bottom: calc(var(--spacing) * -1);
852
- }
853
848
  .mb-1 {
854
849
  margin-bottom: calc(var(--spacing) * 1);
855
850
  }
@@ -889,6 +884,19 @@
889
884
  .table {
890
885
  display: table;
891
886
  }
887
+ .fd-scroll-container {
888
+ &::-webkit-scrollbar {
889
+ width: 5px;
890
+ height: 5px;
891
+ }
892
+ &::-webkit-scrollbar-thumb {
893
+ border-radius: 5px;
894
+ background: var(--color-fd-border);
895
+ }
896
+ &::-webkit-scrollbar-track {
897
+ background: transparent;
898
+ }
899
+ }
892
900
  .size-3 {
893
901
  width: calc(var(--spacing) * 3);
894
902
  height: calc(var(--spacing) * 3);
@@ -947,6 +955,9 @@
947
955
  .max-h-\[50vh\] {
948
956
  max-height: 50vh;
949
957
  }
958
+ .max-h-\[80svh\] {
959
+ max-height: 80svh;
960
+ }
950
961
  .max-h-\[400px\] {
951
962
  max-height: 400px;
952
963
  }
@@ -1001,6 +1012,9 @@
1001
1012
  .w-full {
1002
1013
  width: 100%;
1003
1014
  }
1015
+ .w-max {
1016
+ width: max-content;
1017
+ }
1004
1018
  .w-px {
1005
1019
  width: 1px;
1006
1020
  }
@@ -1040,6 +1054,9 @@
1040
1054
  .min-w-\[220px\] {
1041
1055
  min-width: 220px;
1042
1056
  }
1057
+ .min-w-full {
1058
+ min-width: 100%;
1059
+ }
1043
1060
  .flex-1 {
1044
1061
  flex: 1;
1045
1062
  }
@@ -1265,6 +1282,12 @@
1265
1282
  border-inline-start-color: color-mix(in oklab, var(--color-blue-500) 50%, transparent);
1266
1283
  }
1267
1284
  }
1285
+ .border-s-green-500\/50 {
1286
+ border-inline-start-color: color-mix(in srgb, oklch(72.3% 0.219 149.579) 50%, transparent);
1287
+ @supports (color: color-mix(in lab, red, red)) {
1288
+ border-inline-start-color: color-mix(in oklab, var(--color-green-500) 50%, transparent);
1289
+ }
1290
+ }
1268
1291
  .border-s-orange-500\/50 {
1269
1292
  border-inline-start-color: color-mix(in srgb, oklch(70.5% 0.213 47.604) 50%, transparent);
1270
1293
  @supports (color: color-mix(in lab, red, red)) {
@@ -1343,6 +1366,9 @@
1343
1366
  .fill-blue-500 {
1344
1367
  fill: var(--color-blue-500);
1345
1368
  }
1369
+ .fill-green-500 {
1370
+ fill: var(--color-green-500);
1371
+ }
1346
1372
  .fill-orange-500 {
1347
1373
  fill: var(--color-orange-500);
1348
1374
  }
@@ -1445,9 +1471,6 @@
1445
1471
  .ps-\[calc\(var\(--fd-layout-offset\)\+var\(--fd-sidebar-width\)\)\] {
1446
1472
  padding-inline-start: calc(var(--fd-layout-offset) + var(--fd-sidebar-width));
1447
1473
  }
1448
- .ps-px {
1449
- padding-inline-start: 1px;
1450
- }
1451
1474
  .pe-\(--fd-layout-offset\) {
1452
1475
  padding-inline-end: var(--fd-layout-offset);
1453
1476
  }
@@ -1460,8 +1483,8 @@
1460
1483
  .pt-0 {
1461
1484
  padding-top: calc(var(--spacing) * 0);
1462
1485
  }
1463
- .pt-4 {
1464
- padding-top: calc(var(--spacing) * 4);
1486
+ .pt-1\.5 {
1487
+ padding-top: calc(var(--spacing) * 1.5);
1465
1488
  }
1466
1489
  .pt-8 {
1467
1490
  padding-top: calc(var(--spacing) * 8);
@@ -1686,6 +1709,9 @@
1686
1709
  .\[--fd-tocnav-height\:36px\] {
1687
1710
  --fd-tocnav-height: 36px;
1688
1711
  }
1712
+ .\[scrollbar-width\:none\] {
1713
+ scrollbar-width: none;
1714
+ }
1689
1715
  .\*\:col-start-1 {
1690
1716
  :is(& > *) {
1691
1717
  grid-column-start: 1;
@@ -1696,14 +1722,14 @@
1696
1722
  grid-row-start: 1;
1697
1723
  }
1698
1724
  }
1699
- .\*\:block {
1725
+ .\*\:flex {
1700
1726
  :is(& > *) {
1701
- display: block;
1727
+ display: flex;
1702
1728
  }
1703
1729
  }
1704
- .\*\:w-full {
1730
+ .\*\:flex-col {
1705
1731
  :is(& > *) {
1706
- width: 100%;
1732
+ flex-direction: column;
1707
1733
  }
1708
1734
  }
1709
1735
  .group-hover\:opacity-100 {
@@ -1875,6 +1901,11 @@
1875
1901
  display: none;
1876
1902
  }
1877
1903
  }
1904
+ .data-\[empty\=true\]\:hidden {
1905
+ &[data-empty="true"] {
1906
+ display: none;
1907
+ }
1908
+ }
1878
1909
  .data-\[motion\=from-end\]\:animate-fd-enterFromRight {
1879
1910
  &[data-motion="from-end"] {
1880
1911
  animation: var(--animate-fd-enterFromRight);
@@ -2028,16 +2059,6 @@
2028
2059
  background-color: var(--color-fd-background);
2029
2060
  }
2030
2061
  }
2031
- .max-md\:pt-6 {
2032
- @media (width < 48rem) {
2033
- padding-top: calc(var(--spacing) * 6);
2034
- }
2035
- }
2036
- .max-md\:pb-6 {
2037
- @media (width < 48rem) {
2038
- padding-bottom: calc(var(--spacing) * 6);
2039
- }
2040
- }
2041
2062
  .max-sm\:mt-2 {
2042
2063
  @media (width < 40rem) {
2043
2064
  margin-top: calc(var(--spacing) * 2);
@@ -2170,11 +2191,6 @@
2170
2191
  height: calc(var(--spacing) * 12);
2171
2192
  }
2172
2193
  }
2173
- .lg\:w-\[calc\(100\%-1rem\)\] {
2174
- @media (width >= 64rem) {
2175
- width: calc(100% - 1rem);
2176
- }
2177
- }
2178
2194
  .lg\:grid-cols-3 {
2179
2195
  @media (width >= 64rem) {
2180
2196
  grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -2206,6 +2222,11 @@
2206
2222
  --fd-nav-height: calc(var(--spacing) * 24);
2207
2223
  }
2208
2224
  }
2225
+ .lg\:\[--fd-padding\:1rem\] {
2226
+ @media (width >= 64rem) {
2227
+ --fd-padding: 1rem;
2228
+ }
2229
+ }
2209
2230
  .lg\:\[--fd-sidebar-width\:286px\] {
2210
2231
  @media (width >= 64rem) {
2211
2232
  --fd-sidebar-width: 286px;
@@ -2278,12 +2299,6 @@
2278
2299
  padding-left: calc(var(--spacing) * 3);
2279
2300
  }
2280
2301
  }
2281
- .\[\&_svg\]\:\!size-4\.5 {
2282
- & svg {
2283
- width: calc(var(--spacing) * 4.5) !important;
2284
- height: calc(var(--spacing) * 4.5) !important;
2285
- }
2286
- }
2287
2302
  .\[\&_svg\]\:size-3\.5 {
2288
2303
  & svg {
2289
2304
  width: calc(var(--spacing) * 3.5);
@@ -2366,10 +2381,16 @@
2366
2381
  color: var(--shiki-light);
2367
2382
  }
2368
2383
  code .line {
2369
- min-height: 1em;
2384
+ line-height: 1.45em;
2385
+ min-height: 1.45em;
2370
2386
  position: relative;
2371
- display: inline-block;
2372
- width: 100%;
2387
+ }
2388
+ &.has-focused code .line:not(.focused) {
2389
+ filter: blur(2px);
2390
+ transition: filter 200ms;
2391
+ }
2392
+ &.has-focused:hover code .line:not(.focused) {
2393
+ filter: blur(0);
2373
2394
  }
2374
2395
  &[data-line-numbers] code .twoslash-meta-line {
2375
2396
  margin-left: calc(var(--spacing) * 7);
@@ -2408,9 +2429,6 @@
2408
2429
  content: '+';
2409
2430
  color: var(--color-fd-diff-add-symbol);
2410
2431
  }
2411
- code .diff {
2412
- position: relative;
2413
- }
2414
2432
  .highlighted {
2415
2433
  background-color: color-mix(in srgb, hsl(0, 0%, 9%) 10%, transparent);
2416
2434
  @supports (color: color-mix(in lab, red, red)) {
@@ -2418,17 +2436,21 @@
2418
2436
  }
2419
2437
  }
2420
2438
  .highlighted-word {
2421
- padding: 1px 2px;
2422
- margin: -1px -3px;
2423
- border: 1px solid color-mix(in srgb, hsl(0, 0%, 9%) 50%, transparent);
2439
+ padding: 1px;
2440
+ margin-block: -1px;
2441
+ border-radius: var(--radius-md);
2442
+ border-style: var(--tw-border-style);
2443
+ border-width: 1px;
2444
+ border-color: color-mix(in srgb, hsl(0, 0%, 9%) 30%, transparent);
2424
2445
  @supports (color: color-mix(in lab, red, red)) {
2425
- border: 1px solid color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
2446
+ border-color: color-mix(in oklab, var(--color-fd-primary) 30%, transparent);
2426
2447
  }
2427
- background-color: color-mix( in oklab, hsl(0, 0%, 9%) 10%, transparent );
2448
+ background-color: color-mix(in srgb, hsl(0, 0%, 9%) 10%, transparent);
2428
2449
  @supports (color: color-mix(in lab, red, red)) {
2429
- background-color: color-mix( in oklab, var(--color-fd-primary) 10%, transparent );
2450
+ background-color: color-mix(in oklab, var(--color-fd-primary) 10%, transparent);
2430
2451
  }
2431
- border-radius: 2px;
2452
+ --tw-font-weight: var(--font-weight-medium);
2453
+ font-weight: var(--font-weight-medium);
2432
2454
  }
2433
2455
  }
2434
2456
  .dark .shiki:not(.not-fumadocs-codeblock *) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.3.1",
3
+ "version": "15.3.2",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -89,7 +89,7 @@
89
89
  "react-medium-image-zoom": "^5.2.14",
90
90
  "react-remove-scroll": "^2.6.3",
91
91
  "tailwind-merge": "^3.2.0",
92
- "fumadocs-core": "15.3.1"
92
+ "fumadocs-core": "15.3.2"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@next/eslint-plugin-next": "^15.3.1",
@@ -102,7 +102,7 @@
102
102
  "tsc-alias": "^1.8.16",
103
103
  "@fumadocs/cli": "0.1.1",
104
104
  "eslint-config-custom": "0.0.0",
105
- "fumadocs-core": "15.3.1",
105
+ "fumadocs-core": "15.3.2",
106
106
  "tsconfig": "0.0.0"
107
107
  },
108
108
  "peerDependencies": {