fumadocs-ui 15.7.5 → 15.7.7

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.
@@ -1,17 +1,6 @@
1
1
  import { type ComponentProps, type ReactNode } from 'react';
2
- export interface Option {
3
- /**
4
- * Redirect URL of the folder, usually the index page
5
- */
6
- url: string;
7
- icon?: ReactNode;
8
- title: ReactNode;
9
- description?: ReactNode;
10
- unlisted?: boolean;
11
- /**
12
- * Detect from a list of urls
13
- */
14
- urls?: Set<string>;
2
+ import type { SidebarTab } from '../../utils/get-sidebar-tabs.js';
3
+ export interface Option extends SidebarTab {
15
4
  props?: ComponentProps<'a'>;
16
5
  }
17
6
  export declare function RootToggle({ options, placeholder, ...props }: {
@@ -1 +1 @@
1
- {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ/E,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEnB,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,QAAQ,CAAC,2CAsF3B"}
1
+ {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAO/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,MAAO,SAAQ,UAAU;IACxC,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,QAAQ,CAAC,2CAgF3B"}
@@ -5,7 +5,7 @@ import { useMemo, useState } from 'react';
5
5
  import Link from 'fumadocs-core/link';
6
6
  import { usePathname } from 'fumadocs-core/framework';
7
7
  import { cn } from '../../utils/cn.js';
8
- import { isActive } from '../../utils/is-active.js';
8
+ import { isTabActive } from '../../utils/is-active.js';
9
9
  import { useSidebar } from '../../contexts/sidebar.js';
10
10
  import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';
11
11
  export function RootToggle({ options, placeholder, ...props }) {
@@ -13,12 +13,7 @@ export function RootToggle({ options, placeholder, ...props }) {
13
13
  const { closeOnRedirect } = useSidebar();
14
14
  const pathname = usePathname();
15
15
  const selected = useMemo(() => {
16
- const lookup = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
17
- return options.findLast((item) => {
18
- if (item.urls)
19
- return item.urls.has(lookup);
20
- return isActive(item.url, pathname, true);
21
- });
16
+ return options.findLast((item) => isTabActive(item, pathname));
22
17
  }, [options, pathname]);
23
18
  const onClick = () => {
24
19
  closeOnRedirect.current = false;
@@ -88,7 +88,7 @@ export function SidebarHeader(props) {
88
88
  return (_jsx("div", { ...props, className: cn('flex flex-col gap-3 p-4 pb-2', props.className), children: props.children }));
89
89
  }
90
90
  export function SidebarFooter(props) {
91
- return (_jsx("div", { ...props, className: cn('flex flex-col border-t px-4 py-3', props.className), children: props.children }));
91
+ return (_jsx("div", { ...props, className: cn('flex flex-col border-t p-4 pt-2', props.className), children: props.children }));
92
92
  }
93
93
  export function SidebarViewport(props) {
94
94
  return (_jsx(ScrollArea, { ...props, className: cn('h-full', props.className), children: _jsx(ScrollViewport, { className: "p-4 overscroll-contain", style: {
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAsBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAkB1B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,2CA+BA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/notebook/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,2CAoBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAsBvD;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAkB1B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,2CAuBA"}
@@ -8,7 +8,7 @@ import { buttonVariants } from '../../components/ui/button.js';
8
8
  import { Sidebar as SidebarIcon } from '../../icons.js';
9
9
  import Link from 'fumadocs-core/link';
10
10
  import { usePathname } from 'fumadocs-core/framework';
11
- import { isActive } from '../../utils/is-active.js';
11
+ import { isTabActive } from '../../utils/is-active.js';
12
12
  export function Navbar({ mode, ...props }) {
13
13
  const { open, collapsed } = useSidebar();
14
14
  const { isTransparent } = useNav();
@@ -36,16 +36,10 @@ export function NavbarSidebarTrigger({ className, ...props }) {
36
36
  export function LayoutTabs({ options, ...props }) {
37
37
  const pathname = usePathname();
38
38
  const selected = useMemo(() => {
39
- const url = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
40
- return options.findLast((option) => {
41
- if (option.urls) {
42
- return option.urls.has(url);
43
- }
44
- return isActive(option.url, pathname, true);
45
- });
39
+ return options.findLast((option) => isTabActive(option, pathname));
46
40
  }, [options, pathname]);
47
41
  return (_jsx("div", { ...props, className: cn('flex flex-row items-end gap-6 overflow-auto', props.className), children: options.map((option) => (_jsx(LayoutTab, { selected: selected === option, option: option }, option.url))) }));
48
42
  }
49
- function LayoutTab({ option, selected = false, }) {
50
- return (_jsx(Link, { className: cn('inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground', option.unlisted && !selected && 'hidden', selected && 'border-fd-primary text-fd-primary'), href: option.url, children: option.title }));
43
+ function LayoutTab({ option: { title, url, unlisted, props }, selected = false, }) {
44
+ return (_jsx(Link, { href: url, ...props, className: cn('inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground', unlisted && !selected && 'hidden', selected && 'border-fd-primary text-fd-primary', props?.className), children: title }));
51
45
  }
package/dist/page.js CHANGED
@@ -45,7 +45,7 @@ export const DocsDescription = forwardRef((props, ref) => {
45
45
  });
46
46
  DocsDescription.displayName = 'DocsDescription';
47
47
  export const DocsTitle = forwardRef((props, ref) => {
48
- return (_jsx("h1", { ref: ref, ...props, className: cn('text-3xl font-semibold', props.className), children: props.children }));
48
+ return (_jsx("h1", { ref: ref, ...props, className: cn('text-[1.75em] font-semibold', props.className), children: props.children }));
49
49
  });
50
50
  DocsTitle.displayName = 'DocsTitle';
51
51
  /**
package/dist/style.css CHANGED
@@ -1518,6 +1518,9 @@
1518
1518
  .pt-0 {
1519
1519
  padding-top: calc(var(--spacing) * 0);
1520
1520
  }
1521
+ .pt-2 {
1522
+ padding-top: calc(var(--spacing) * 2);
1523
+ }
1521
1524
  .pt-8 {
1522
1525
  padding-top: calc(var(--spacing) * 8);
1523
1526
  }
@@ -1567,6 +1570,9 @@
1567
1570
  font-size: var(--text-xs);
1568
1571
  line-height: var(--tw-leading, var(--text-xs--line-height));
1569
1572
  }
1573
+ .text-\[1\.75em\] {
1574
+ font-size: 1.75em;
1575
+ }
1570
1576
  .text-\[13px\] {
1571
1577
  font-size: 13px;
1572
1578
  }
@@ -1,7 +1,21 @@
1
1
  import type { PageTree } from 'fumadocs-core/server';
2
- import type { Option } from '../components/layout/root-toggle.js';
2
+ import type { ReactNode } from 'react';
3
+ export interface SidebarTab {
4
+ /**
5
+ * Redirect URL of the folder, usually the index page
6
+ */
7
+ url: string;
8
+ icon?: ReactNode;
9
+ title: ReactNode;
10
+ description?: ReactNode;
11
+ /**
12
+ * Detect from a list of urls
13
+ */
14
+ urls?: Set<string>;
15
+ unlisted?: boolean;
16
+ }
3
17
  export interface GetSidebarTabsOptions {
4
- transform?: (option: Option, node: PageTree.Folder) => Option | null;
18
+ transform?: (option: SidebarTab, node: PageTree.Folder) => SidebarTab | null;
5
19
  }
6
- export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions): Option[];
20
+ export declare function getSidebarTabs(tree: PageTree.Root, { transform }?: GetSidebarTabsOptions): SidebarTab[];
7
21
  //# sourceMappingURL=get-sidebar-tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAeD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,EAAE,SAA4B,EAAE,GAAE,qBAA0B,GAC3D,MAAM,EAAE,CAuCV"}
1
+ {"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;CAC9E;AAeD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,EAAE,SAA4B,EAAE,GAAE,qBAA0B,GAC3D,UAAU,EAAE,CAkCd"}
@@ -8,8 +8,8 @@ const defaultTransform = (option, node) => {
8
8
  };
9
9
  };
10
10
  export function getSidebarTabs(tree, { transform = defaultTransform } = {}) {
11
- function findOptions(node, unlisted) {
12
- const results = [];
11
+ const results = [];
12
+ function scanOptions(node, unlisted) {
13
13
  if ('root' in node && node.root) {
14
14
  const urls = getFolderUrls(node);
15
15
  if (urls.size > 0) {
@@ -28,15 +28,13 @@ export function getSidebarTabs(tree, { transform = defaultTransform } = {}) {
28
28
  }
29
29
  for (const child of node.children) {
30
30
  if (child.type === 'folder')
31
- results.push(...findOptions(child, unlisted));
31
+ scanOptions(child, unlisted);
32
32
  }
33
- return results;
34
33
  }
35
- const options = findOptions(tree);
36
- if (tree.fallback) {
37
- options.push(...findOptions(tree.fallback, true));
38
- }
39
- return options;
34
+ scanOptions(tree);
35
+ if (tree.fallback)
36
+ scanOptions(tree.fallback, true);
37
+ return results;
40
38
  }
41
39
  function getFolderUrls(folder, output = new Set()) {
42
40
  if (folder.index)
@@ -1,2 +1,4 @@
1
+ import type { SidebarTab } from '../utils/get-sidebar-tabs.js';
1
2
  export declare function isActive(url: string, pathname: string, nested?: boolean): boolean;
3
+ export declare function isTabActive(tab: SidebarTab, pathname: string): boolean;
2
4
  //# sourceMappingURL=is-active.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT"}
1
+ {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAO3D,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAI5D"}
@@ -8,3 +8,8 @@ export function isActive(url, pathname, nested = true) {
8
8
  pathname = normalize(pathname);
9
9
  return url === pathname || (nested && pathname.startsWith(`${url}/`));
10
10
  }
11
+ export function isTabActive(tab, pathname) {
12
+ if (tab.urls)
13
+ return tab.urls.has(normalize(pathname));
14
+ return isActive(tab.url, pathname, true);
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.7.5",
3
+ "version": "15.7.7",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -121,20 +121,20 @@
121
121
  "react-medium-image-zoom": "^5.3.0",
122
122
  "scroll-into-view-if-needed": "^3.1.0",
123
123
  "tailwind-merge": "^3.3.1",
124
- "fumadocs-core": "15.7.5"
124
+ "fumadocs-core": "15.7.7"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@next/eslint-plugin-next": "^15.5.2",
128
128
  "@tailwindcss/cli": "^4.1.12",
129
129
  "@types/lodash.merge": "^4.6.9",
130
130
  "@types/react": "^19.1.12",
131
- "@types/react-dom": "^19.1.8",
131
+ "@types/react-dom": "^19.1.9",
132
132
  "next": "15.5.2",
133
133
  "tailwindcss": "^4.1.12",
134
134
  "tsc-alias": "^1.8.16",
135
- "@fumadocs/cli": "1.0.1",
136
135
  "eslint-config-custom": "0.0.0",
137
- "fumadocs-core": "15.7.5",
136
+ "fumadocs-core": "15.7.7",
137
+ "@fumadocs/cli": "1.0.1",
138
138
  "tsconfig": "0.0.0"
139
139
  },
140
140
  "peerDependencies": {