fumadocs-ui 15.6.4 → 15.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/css/preset.css CHANGED
@@ -10,7 +10,12 @@
10
10
  --color-fd-success: oklch(72.3% 0.219 149.579);
11
11
  }
12
12
 
13
+ [dir='rtl'] {
14
+ --fd-sidebar-mobile-offset: -100%;
15
+ }
16
+
13
17
  @theme {
18
+ --fd-sidebar-mobile-offset: 100%;
14
19
  --spacing-fd-container: 1400px;
15
20
  --fd-page-width: 1200px;
16
21
  --fd-sidebar-width: 0px;
@@ -54,6 +59,18 @@
54
59
  --animate-fd-exitToLeft: fd-exitToLeft 250ms ease;
55
60
  --animate-fd-exitToRight: fd-exitToRight 250ms ease;
56
61
 
62
+ @keyframes fd-sidebar-in {
63
+ from {
64
+ transform: translateX(var(--fd-sidebar-mobile-offset));
65
+ }
66
+ }
67
+
68
+ @keyframes fd-sidebar-out {
69
+ to {
70
+ transform: translateX(var(--fd-sidebar-mobile-offset));
71
+ }
72
+ }
73
+
57
74
  @keyframes fd-collapsible-down {
58
75
  from {
59
76
  height: 0;
@@ -190,18 +207,6 @@
190
207
  }
191
208
  }
192
209
 
193
- @keyframes fd-sidebar-in {
194
- from {
195
- transform: translateX(-100%);
196
- }
197
- }
198
-
199
- @keyframes fd-sidebar-out {
200
- to {
201
- transform: translateX(-100%);
202
- }
203
- }
204
-
205
210
  @keyframes fd-nav-menu-in {
206
211
  from {
207
212
  opacity: 0;
@@ -65,7 +65,7 @@ export function SearchDialogList({ items = null, Empty = () => (_jsx("div", { cl
65
65
  onOpenChange(false);
66
66
  };
67
67
  const onKey = useEffectEvent((e) => {
68
- if (!items)
68
+ if (!items || e.isComposing)
69
69
  return;
70
70
  if (e.key === 'ArrowDown' || e.key == 'ArrowUp') {
71
71
  let idx = items.findIndex((item) => item.id === active);
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layout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E,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"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ChevronDown, ExternalLink } from '../../icons.js';
3
+ import { ChevronDown, ExternalLink, X } from '../../icons.js';
4
4
  import { usePathname } from 'fumadocs-core/framework';
5
5
  import { createContext, Fragment, useContext, useMemo, useRef, useState, } from 'react';
6
6
  import Link from 'fumadocs-core/link';
@@ -14,7 +14,8 @@ import { cva } from 'class-variance-authority';
14
14
  import { useTreeContext, useTreePath } from '../../contexts/tree.js';
15
15
  import { useMediaQuery } from 'fumadocs-core/utils/use-media-query';
16
16
  import { Presence } from '@radix-ui/react-presence';
17
- const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-xl p-2 text-start text-fd-muted-foreground [overflow-wrap:anywhere] [&_svg]:size-4 [&_svg]:shrink-0', {
17
+ import { buttonVariants } from '../../components/ui/button.js';
18
+ const itemVariants = cva('relative flex flex-row items-center gap-2 rounded-xl p-2 ps-(--sidebar-item-offset) text-start text-fd-muted-foreground [overflow-wrap:anywhere] [&_svg]:size-4 [&_svg]:shrink-0', {
18
19
  variants: {
19
20
  active: {
20
21
  true: 'bg-fd-primary/10 text-fd-primary',
@@ -44,24 +45,28 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
44
45
  });
45
46
  if (isMobile) {
46
47
  const state = open ? 'open' : 'closed';
47
- return (_jsxs(Context.Provider, { value: context, children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsx("aside", { id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] flex flex-col shadow-lg rounded-2xl border start-2 inset-y-2 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out', !present && 'invisible', props.className), children: props.children })) })] }));
48
+ return (_jsxs(Context.Provider, { value: context, children: [_jsx(Presence, { present: open, children: _jsx("div", { "data-state": state, className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", onClick: () => setOpen(false) }) }), _jsx(Presence, { present: open, children: ({ present }) => (_jsxs("aside", { id: "nd-sidebar-mobile", ...props, "data-state": state, className: cn('fixed text-[15px] flex flex-col shadow-lg border-s end-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out', !present && 'invisible', props.className), children: [_jsx("button", { onClick: () => setOpen(false), className: cn(buttonVariants({
49
+ color: 'ghost',
50
+ size: 'icon-sm',
51
+ className: 'mt-3 mb-1 ms-auto me-4 text-fd-muted-foreground',
52
+ })), children: _jsx(X, {}) }), props.children] })) })] }));
48
53
  }
49
54
  return (_jsx("aside", { id: "nd-sidebar", ...props, "data-collapsed": collapsed, className: cn('fixed start-0 flex flex-col items-end top-(--fd-sidebar-top) bottom-(--fd-sidebar-margin) z-20 bg-fd-card text-sm border-e max-md:hidden *:w-(--fd-sidebar-width)', collapsed && [
50
- 'rounded-xl border',
51
- hover
52
- ? 'z-50 translate-x-2 shadow-lg'
53
- : 'opacity-0 -translate-x-(--fd-sidebar-offset) rtl:translate-x-(--fd-sidebar-offset)',
55
+ 'rounded-xl border translate-x-(--fd-sidebar-offset) rtl:-translate-x-(--fd-sidebar-offset)',
56
+ hover ? 'z-50 shadow-lg' : 'opacity-0 ',
54
57
  ], props.className), style: {
55
58
  transition: ['top', 'opacity', 'translate', 'width']
56
59
  .map((v) => `${v} ease 250ms`)
57
60
  .join(', '),
58
61
  ...props.style,
59
- '--fd-sidebar-offset': 'calc(100% - 16px)',
62
+ '--fd-sidebar-offset': hover
63
+ ? 'calc(var(--spacing) * 2)'
64
+ : 'calc(16px - 100%)',
60
65
  '--fd-sidebar-margin': collapsed ? '0.5rem' : '0px',
66
+ '--fd-sidebar-top': `calc(var(--fd-banner-height) + var(--fd-nav-height) + var(--fd-sidebar-margin))`,
61
67
  width: collapsed
62
68
  ? 'var(--fd-sidebar-width)'
63
69
  : 'calc(var(--fd-sidebar-width) + var(--fd-layout-offset))',
64
- '--fd-sidebar-top': `calc(var(--fd-banner-height) + var(--fd-nav-height) + var(--fd-sidebar-margin))`,
65
70
  }, onPointerEnter: (e) => {
66
71
  if (!collapsible ||
67
72
  !collapsed ||
@@ -83,31 +88,25 @@ export function Sidebar({ defaultOpenLevel = 0, prefetch = true, collapsible = t
83
88
  }, children: _jsx(Context.Provider, { value: context, children: props.children }) }));
84
89
  }
85
90
  export function SidebarHeader(props) {
86
- return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 p-4 pb-2', props.className), children: props.children }));
91
+ return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 px-4 pb-2 md:pt-4', props.className), children: props.children }));
87
92
  }
88
93
  export function SidebarFooter(props) {
89
94
  return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3', props.className), children: props.children }));
90
95
  }
91
96
  export function SidebarViewport(props) {
92
97
  return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { className: "p-4", style: {
98
+ '--sidebar-item-offset': 'calc(var(--spacing) * 2)',
93
99
  maskImage: 'linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)',
94
100
  }, children: props.children }) }));
95
101
  }
96
102
  export function SidebarSeparator(props) {
97
- const { level } = useInternalContext();
98
- return (_jsx("p", { ...props, className: cn('inline-flex items-center gap-2 mb-1.5 px-2 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0', props.className), style: {
99
- paddingInlineStart: getOffset(level),
100
- ...props.style,
101
- }, children: props.children }));
103
+ return (_jsx("p", { ...props, className: cn('inline-flex items-center gap-2 mb-1.5 px-2 ps-(--sidebar-item-offset) empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0', props.className), children: props.children }));
102
104
  }
103
105
  export function SidebarItem({ icon, ...props }) {
104
106
  const pathname = usePathname();
105
107
  const active = props.href !== undefined && isActive(props.href, pathname, false);
106
- const { prefetch, level } = useInternalContext();
107
- return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), props.className), prefetch: prefetch, style: {
108
- paddingInlineStart: getOffset(level),
109
- ...props.style,
110
- }, children: [_jsx(Border, { level: level, active: active }), icon ?? (props.external ? _jsx(ExternalLink, {}) : null), props.children] }));
108
+ const { prefetch } = useInternalContext();
109
+ return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), props.className), prefetch: prefetch, children: [icon ?? (props.external ? _jsx(ExternalLink, {}) : null), props.children] }));
111
110
  }
112
111
  export function SidebarFolder({ defaultOpen = false, ...props }) {
113
112
  const [open, setOpen] = useState(defaultOpen);
@@ -118,16 +117,12 @@ export function SidebarFolder({ defaultOpen = false, ...props }) {
118
117
  return (_jsx(Collapsible, { open: open, onOpenChange: setOpen, ...props, children: _jsx(FolderContext.Provider, { value: useMemo(() => ({ open, setOpen }), [open]), children: props.children }) }));
119
118
  }
120
119
  export function SidebarFolderTrigger({ className, ...props }) {
121
- const { level } = useInternalContext();
122
120
  const { open } = useFolderContext();
123
- return (_jsxs(CollapsibleTrigger, { className: cn(itemVariants({ active: false }), 'w-full', className), ...props, style: {
124
- paddingInlineStart: getOffset(level),
125
- ...props.style,
126
- }, children: [_jsx(Border, { level: level }), props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
121
+ return (_jsxs(CollapsibleTrigger, { className: cn(itemVariants({ active: false }), 'w-full', className), ...props, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
127
122
  }
128
123
  export function SidebarFolderLink(props) {
129
124
  const { open, setOpen } = useFolderContext();
130
- const { prefetch, level } = useInternalContext();
125
+ const { prefetch } = useInternalContext();
131
126
  const pathname = usePathname();
132
127
  const active = props.href !== undefined && isActive(props.href, pathname, false);
133
128
  return (_jsxs(Link, { ...props, "data-active": active, className: cn(itemVariants({ active }), 'w-full', props.className), onClick: (e) => {
@@ -139,17 +134,19 @@ export function SidebarFolderLink(props) {
139
134
  else {
140
135
  setOpen(active ? !open : true);
141
136
  }
142
- }, prefetch: prefetch, style: {
143
- paddingInlineStart: getOffset(level),
144
- ...props.style,
145
- }, children: [_jsx(Border, { level: level, active: active }), props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
137
+ }, prefetch: prefetch, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
146
138
  }
147
139
  export function SidebarFolderContent(props) {
148
140
  const ctx = useInternalContext();
149
- return (_jsx(CollapsibleContent, { ...props, className: cn('relative', props.className), children: _jsxs(Context.Provider, { value: useMemo(() => ({
150
- ...ctx,
151
- level: ctx.level + 1,
152
- }), [ctx]), children: [ctx.level === 1 && (_jsx("div", { className: "absolute w-px inset-y-1 bg-fd-border start-2.5" })), props.children] }) }));
141
+ const level = ctx.level + 1;
142
+ return (_jsxs(CollapsibleContent, { ...props, className: cn('relative', level === 2 &&
143
+ "**:data-[active=true]:before:content-[''] **:data-[active=true]:before:bg-fd-primary **:data-[active=true]:before:absolute **:data-[active=true]:before:w-px **:data-[active=true]:before:inset-y-2.5 **:data-[active=true]:before:start-2.5", props.className), style: {
144
+ '--sidebar-item-offset': `calc(var(--spacing) * ${level > 1 ? level * 3 : 2})`,
145
+ ...props.style,
146
+ }, children: [level === 2 && (_jsx("div", { className: "absolute w-px inset-y-1 bg-fd-border start-2.5" })), _jsx(Context.Provider, { value: useMemo(() => ({
147
+ ...ctx,
148
+ level,
149
+ }), [ctx, level]), children: props.children })] }));
153
150
  }
154
151
  export function SidebarCollapseTrigger(props) {
155
152
  const { collapsed, setCollapsed } = useSidebar();
@@ -202,11 +199,3 @@ function PageTreeFolder({ item, ...props }) {
202
199
  const path = useTreePath();
203
200
  return (_jsxs(SidebarFolder, { defaultOpen: (item.defaultOpen ?? defaultOpenLevel >= level) || path.includes(item), children: [item.index ? (_jsxs(SidebarFolderLink, { href: item.index.url, external: item.index.external, ...props, children: [item.icon, item.name] })) : (_jsxs(SidebarFolderTrigger, { ...props, children: [item.icon, item.name] })), _jsx(SidebarFolderContent, { children: props.children })] }));
204
201
  }
205
- function getOffset(level) {
206
- return `calc(var(--spacing) * ${level > 1 ? level * 3 : 2})`;
207
- }
208
- function Border({ level, active }) {
209
- if (level <= 1)
210
- return null;
211
- return (_jsx("div", { className: cn('absolute w-px inset-y-3 z-2 start-2.5 md:inset-y-2', active && 'bg-fd-primary') }));
212
- }
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Info as InfoIcon } from '../icons.js';
3
+ import { Info as InfoIcon, Link as LinkIcon } from '../icons.js';
4
4
  import Link from 'fumadocs-core/link';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { cn } from '../utils/cn.js';
@@ -20,5 +20,5 @@ const code = cva('rounded-md bg-fd-secondary p-1 text-fd-secondary-foreground',
20
20
  export function TypeTable({ type }) {
21
21
  return (_jsx("div", { className: "prose my-6 overflow-auto prose-no-margin", children: _jsxs("table", { className: "whitespace-nowrap text-sm text-fd-muted-foreground", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "w-[45%]", children: "Prop" }), _jsx("th", { className: "w-[30%]", children: "Type" }), _jsx("th", { className: "w-1/4", children: "Default" })] }) }), _jsx("tbody", { children: Object.entries(type).map(([key, value]) => (_jsxs("tr", { children: [_jsx("td", { children: _jsxs("div", { className: field(), children: [_jsxs("code", { className: cn(code({
22
22
  color: value.deprecated ? 'deprecated' : 'primary',
23
- })), children: [key, !value.required && '?'] }), value.description ? _jsx(Info, { children: value.description }) : null] }) }), _jsx("td", { children: _jsxs("div", { className: field(), children: [_jsx("code", { className: code(), children: value.type }), value.typeDescription ? (_jsx(Info, { children: value.typeDescription })) : null, value.typeDescriptionLink ? (_jsx(Link, { href: value.typeDescriptionLink, children: _jsx(InfoIcon, { className: "size-4" }) })) : null] }) }), _jsx("td", { children: value.default ? (_jsx("code", { className: code(), children: value.default })) : ('-') })] }, key))) })] }) }));
23
+ })), children: [key, !value.required && '?'] }), value.description ? _jsx(Info, { children: value.description }) : null] }) }), _jsx("td", { children: _jsxs("div", { className: field(), children: [_jsx("code", { className: code(), children: value.type }), value.typeDescription ? (_jsx(Info, { children: value.typeDescription })) : null, value.typeDescriptionLink ? (_jsx(Link, { href: value.typeDescriptionLink, children: _jsx(LinkIcon, { className: "size-4 text-fd-muted-foreground" }) })) : null] }) }), _jsx("td", { children: value.default ? (_jsx("code", { className: code(), children: value.default })) : ('-') })] }, key))) })] }) }));
24
24
  }
@@ -2,5 +2,5 @@ import { type ComponentProps } from 'react';
2
2
  export declare function Navbar(props: ComponentProps<'header'>): import("react/jsx-runtime").JSX.Element;
3
3
  export declare function LayoutBody(props: ComponentProps<'main'>): import("react/jsx-runtime").JSX.Element;
4
4
  export declare function NavbarSidebarTrigger({ className, ...props }: ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
5
- export declare function CollapsibleControl(): import("react/jsx-runtime").JSX.Element | undefined;
5
+ export declare function CollapsibleControl(): import("react/jsx-runtime").JSX.Element;
6
6
  //# 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,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAqBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAmB1B;AAED,wBAAgB,kBAAkB,wDAyBjC"}
1
+ {"version":3,"file":"docs-client.d.ts","sourceRoot":"","sources":["../../src/layouts/docs-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAqBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAmB1B;AAED,wBAAgB,kBAAkB,4CA2BjC"}
@@ -30,9 +30,7 @@ export function NavbarSidebarTrigger({ className, ...props }) {
30
30
  }
31
31
  export function CollapsibleControl() {
32
32
  const { collapsed } = useSidebar();
33
- if (!collapsed)
34
- return;
35
- return (_jsxs("div", { className: "fixed flex shadow-lg animate-fd-fade-in rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10 xl:start-4 max-xl:end-4", style: {
33
+ return (_jsxs("div", { className: cn('fixed flex shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10 max-md:hidden xl:start-4 max-xl:end-4', !collapsed && 'pointer-events-none opacity-0'), style: {
36
34
  top: 'calc(var(--fd-banner-height) + var(--fd-tocnav-height) + var(--spacing) * 4)',
37
35
  }, children: [_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
38
36
  color: 'ghost',
@@ -23,7 +23,7 @@ export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { t
23
23
  'md:[--fd-sidebar-width:268px] lg:[--fd-sidebar-width:286px]', 'xl:[--fd-toc-width:286px]', !nav.component && nav.enabled !== false
24
24
  ? '[--fd-nav-height:56px] md:[--fd-nav-height:0px]'
25
25
  : undefined);
26
- const sidebar = sidebarComponent ?? (_jsxs(_Fragment, { children: [sidebarCollapsible ? _jsx(CollapsibleControl, {}) : null, _jsxs(Sidebar, { ...sidebarProps, collapsible: sidebarCollapsible, children: [_jsx(HideIfEmpty, { children: _jsxs(SidebarHeader, { className: "data-[empty=true]:hidden", children: [_jsxs("div", { className: "flex max-md:hidden", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[15px] items-center gap-2.5 font-medium me-auto", children: nav.title }), nav.children, sidebarCollapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
26
+ const sidebar = sidebarComponent ?? (_jsxs(_Fragment, { children: [sidebarCollapsible && _jsx(CollapsibleControl, {}), _jsxs(Sidebar, { ...sidebarProps, collapsible: sidebarCollapsible, children: [_jsx(HideIfEmpty, { children: _jsxs(SidebarHeader, { className: "data-[empty=true]:hidden", children: [_jsxs("div", { className: "flex max-md:hidden", children: [_jsx(Link, { href: nav.url ?? '/', className: "inline-flex text-[15px] items-center gap-2.5 font-medium me-auto", children: nav.title }), nav.children, sidebarCollapsible && (_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
27
27
  color: 'ghost',
28
28
  size: 'icon-sm',
29
29
  className: 'mb-auto text-fd-muted-foreground max-md:hidden',
package/dist/style.css CHANGED
@@ -55,6 +55,7 @@
55
55
  --color-fd-warning: oklch(76.9% 0.188 70.08);
56
56
  --color-fd-error: oklch(63.7% 0.237 25.331);
57
57
  --color-fd-success: oklch(72.3% 0.219 149.579);
58
+ --fd-sidebar-mobile-offset: 100%;
58
59
  --spacing-fd-container: 1400px;
59
60
  --fd-page-width: 1200px;
60
61
  --fd-sidebar-width: 0px;
@@ -312,24 +313,18 @@
312
313
  .inset-y-1 {
313
314
  inset-block: calc(var(--spacing) * 1);
314
315
  }
315
- .inset-y-2 {
316
- inset-block: calc(var(--spacing) * 2);
317
- }
318
- .inset-y-3 {
319
- inset-block: calc(var(--spacing) * 3);
320
- }
321
316
  .start-0 {
322
317
  inset-inline-start: calc(var(--spacing) * 0);
323
318
  }
324
- .start-2 {
325
- inset-inline-start: calc(var(--spacing) * 2);
326
- }
327
319
  .start-2\.5 {
328
320
  inset-inline-start: calc(var(--spacing) * 2.5);
329
321
  }
330
322
  .start-4\.5 {
331
323
  inset-inline-start: calc(var(--spacing) * 4.5);
332
324
  }
325
+ .end-0 {
326
+ inset-inline-end: calc(var(--spacing) * 0);
327
+ }
333
328
  .end-2 {
334
329
  inset-inline-end: calc(var(--spacing) * 2);
335
330
  }
@@ -481,6 +476,9 @@
481
476
  .me-2 {
482
477
  margin-inline-end: calc(var(--spacing) * 2);
483
478
  }
479
+ .me-4 {
480
+ margin-inline-end: calc(var(--spacing) * 4);
481
+ }
484
482
  .me-auto {
485
483
  margin-inline-end: auto;
486
484
  }
@@ -859,6 +857,9 @@
859
857
  .mt-\(--fd-top\) {
860
858
  margin-top: var(--fd-top);
861
859
  }
860
+ .mt-3 {
861
+ margin-top: calc(var(--spacing) * 3);
862
+ }
862
863
  .mt-6 {
863
864
  margin-top: calc(var(--spacing) * 6);
864
865
  }
@@ -1116,16 +1117,12 @@
1116
1117
  .origin-\[top_center\] {
1117
1118
  transform-origin: top center;
1118
1119
  }
1119
- .-translate-x-\(--fd-sidebar-offset\) {
1120
- --tw-translate-x: calc(var(--fd-sidebar-offset) * -1);
1121
- translate: var(--tw-translate-x) var(--tw-translate-y);
1122
- }
1123
1120
  .-translate-x-1\/2 {
1124
1121
  --tw-translate-x: calc(calc(1/2 * 100%) * -1);
1125
1122
  translate: var(--tw-translate-x) var(--tw-translate-y);
1126
1123
  }
1127
- .translate-x-2 {
1128
- --tw-translate-x: calc(var(--spacing) * 2);
1124
+ .translate-x-\(--fd-sidebar-offset\) {
1125
+ --tw-translate-x: var(--fd-sidebar-offset);
1129
1126
  translate: var(--tw-translate-x) var(--tw-translate-y);
1130
1127
  }
1131
1128
  .-translate-y-1\/2 {
@@ -1149,9 +1146,6 @@
1149
1146
  .transform {
1150
1147
  transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
1151
1148
  }
1152
- .animate-fd-fade-in {
1153
- animation: var(--animate-fd-fade-in);
1154
- }
1155
1149
  .animate-pulse {
1156
1150
  animation: var(--animate-pulse);
1157
1151
  }
@@ -1466,6 +1460,9 @@
1466
1460
  .py-12 {
1467
1461
  padding-block: calc(var(--spacing) * 12);
1468
1462
  }
1463
+ .ps-\(--sidebar-item-offset\) {
1464
+ padding-inline-start: var(--sidebar-item-offset);
1465
+ }
1469
1466
  .ps-1 {
1470
1467
  padding-inline-start: calc(var(--spacing) * 1);
1471
1468
  }
@@ -1979,6 +1976,67 @@
1979
1976
  color: var(--color-fd-primary);
1980
1977
  }
1981
1978
  }
1979
+ .\*\*\:data-\[active\=true\]\:before\:absolute {
1980
+ :is(& *) {
1981
+ &[data-active="true"] {
1982
+ &::before {
1983
+ content: var(--tw-content);
1984
+ position: absolute;
1985
+ }
1986
+ }
1987
+ }
1988
+ }
1989
+ .\*\*\:data-\[active\=true\]\:before\:inset-y-2\.5 {
1990
+ :is(& *) {
1991
+ &[data-active="true"] {
1992
+ &::before {
1993
+ content: var(--tw-content);
1994
+ inset-block: calc(var(--spacing) * 2.5);
1995
+ }
1996
+ }
1997
+ }
1998
+ }
1999
+ .\*\*\:data-\[active\=true\]\:before\:start-2\.5 {
2000
+ :is(& *) {
2001
+ &[data-active="true"] {
2002
+ &::before {
2003
+ content: var(--tw-content);
2004
+ inset-inline-start: calc(var(--spacing) * 2.5);
2005
+ }
2006
+ }
2007
+ }
2008
+ }
2009
+ .\*\*\:data-\[active\=true\]\:before\:w-px {
2010
+ :is(& *) {
2011
+ &[data-active="true"] {
2012
+ &::before {
2013
+ content: var(--tw-content);
2014
+ width: 1px;
2015
+ }
2016
+ }
2017
+ }
2018
+ }
2019
+ .\*\*\:data-\[active\=true\]\:before\:bg-fd-primary {
2020
+ :is(& *) {
2021
+ &[data-active="true"] {
2022
+ &::before {
2023
+ content: var(--tw-content);
2024
+ background-color: var(--color-fd-primary);
2025
+ }
2026
+ }
2027
+ }
2028
+ }
2029
+ .\*\*\:data-\[active\=true\]\:before\:content-\[\'\'\] {
2030
+ :is(& *) {
2031
+ &[data-active="true"] {
2032
+ &::before {
2033
+ content: var(--tw-content);
2034
+ --tw-content: '';
2035
+ content: var(--tw-content);
2036
+ }
2037
+ }
2038
+ }
2039
+ }
1982
2040
  .data-\[collapsed\=false\]\:hidden {
1983
2041
  &[data-collapsed="false"] {
1984
2042
  display: none;
@@ -2240,11 +2298,6 @@
2240
2298
  position: sticky;
2241
2299
  }
2242
2300
  }
2243
- .md\:inset-y-2 {
2244
- @media (width >= 48rem) {
2245
- inset-block: calc(var(--spacing) * 2);
2246
- }
2247
- }
2248
2301
  .md\:top-\[calc\(50\%-250px\)\] {
2249
2302
  @media (width >= 48rem) {
2250
2303
  top: calc(50% - 250px);
@@ -2301,6 +2354,11 @@
2301
2354
  padding-inline: calc(var(--spacing) * 6);
2302
2355
  }
2303
2356
  }
2357
+ .md\:pt-4 {
2358
+ @media (width >= 48rem) {
2359
+ padding-top: calc(var(--spacing) * 4);
2360
+ }
2361
+ }
2304
2362
  .md\:\[--fd-nav-height\:0px\] {
2305
2363
  @media (width >= 48rem) {
2306
2364
  --fd-nav-height: 0px;
@@ -2381,9 +2439,9 @@
2381
2439
  grid-column: 1 / -1;
2382
2440
  }
2383
2441
  }
2384
- .rtl\:translate-x-\(--fd-sidebar-offset\) {
2442
+ .rtl\:-translate-x-\(--fd-sidebar-offset\) {
2385
2443
  &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
2386
- --tw-translate-x: var(--fd-sidebar-offset);
2444
+ --tw-translate-x: calc(var(--fd-sidebar-offset) * -1);
2387
2445
  translate: var(--tw-translate-x) var(--tw-translate-y);
2388
2446
  }
2389
2447
  }
@@ -2567,6 +2625,9 @@
2567
2625
  color: var(--shiki-dark);
2568
2626
  }
2569
2627
  }
2628
+ [dir='rtl'] {
2629
+ --fd-sidebar-mobile-offset: -100%;
2630
+ }
2570
2631
  @layer base {
2571
2632
  *, ::after, ::before, ::backdrop, ::file-selector-button {
2572
2633
  border-color: var(--color-fd-border, currentColor);
@@ -2811,6 +2872,11 @@
2811
2872
  syntax: "*";
2812
2873
  inherits: false;
2813
2874
  }
2875
+ @property --tw-content {
2876
+ syntax: "*";
2877
+ initial-value: "";
2878
+ inherits: false;
2879
+ }
2814
2880
  @property --tw-scale-x {
2815
2881
  syntax: "*";
2816
2882
  inherits: false;
@@ -2831,6 +2897,16 @@
2831
2897
  opacity: 0.5;
2832
2898
  }
2833
2899
  }
2900
+ @keyframes fd-sidebar-in {
2901
+ from {
2902
+ transform: translateX(var(--fd-sidebar-mobile-offset));
2903
+ }
2904
+ }
2905
+ @keyframes fd-sidebar-out {
2906
+ to {
2907
+ transform: translateX(var(--fd-sidebar-mobile-offset));
2908
+ }
2909
+ }
2834
2910
  @keyframes fd-collapsible-down {
2835
2911
  from {
2836
2912
  height: 0;
@@ -2953,16 +3029,6 @@
2953
3029
  transform: translateX(-200px);
2954
3030
  }
2955
3031
  }
2956
- @keyframes fd-sidebar-in {
2957
- from {
2958
- transform: translateX(-100%);
2959
- }
2960
- }
2961
- @keyframes fd-sidebar-out {
2962
- to {
2963
- transform: translateX(-100%);
2964
- }
2965
- }
2966
3032
  @keyframes fd-nav-menu-in {
2967
3033
  from {
2968
3034
  opacity: 0;
@@ -3035,6 +3101,7 @@
3035
3101
  --tw-backdrop-saturate: initial;
3036
3102
  --tw-backdrop-sepia: initial;
3037
3103
  --tw-duration: initial;
3104
+ --tw-content: "";
3038
3105
  --tw-scale-x: 1;
3039
3106
  --tw-scale-y: 1;
3040
3107
  --tw-scale-z: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.6.4",
3
+ "version": "15.6.6",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -86,23 +86,23 @@
86
86
  "lodash.merge": "^4.6.2",
87
87
  "next-themes": "^0.4.6",
88
88
  "postcss-selector-parser": "^7.1.0",
89
- "react-medium-image-zoom": "^5.2.14",
89
+ "react-medium-image-zoom": "^5.3.0",
90
90
  "scroll-into-view-if-needed": "^3.1.0",
91
91
  "tailwind-merge": "^3.3.1",
92
- "fumadocs-core": "15.6.4"
92
+ "fumadocs-core": "15.6.6"
93
93
  },
94
94
  "devDependencies": {
95
- "@next/eslint-plugin-next": "^15.4.1",
95
+ "@next/eslint-plugin-next": "^15.4.4",
96
96
  "@tailwindcss/cli": "^4.1.11",
97
97
  "@types/lodash.merge": "^4.6.9",
98
98
  "@types/react": "^19.1.8",
99
99
  "@types/react-dom": "^19.1.6",
100
- "next": "15.4.1",
100
+ "next": "15.4.4",
101
101
  "tailwindcss": "^4.1.11",
102
102
  "tsc-alias": "^1.8.16",
103
- "eslint-config-custom": "0.0.0",
104
103
  "@fumadocs/cli": "0.2.1",
105
- "fumadocs-core": "15.6.4",
104
+ "eslint-config-custom": "0.0.0",
105
+ "fumadocs-core": "15.6.6",
106
106
  "tsconfig": "0.0.0"
107
107
  },
108
108
  "peerDependencies": {