fumadocs-ui 15.2.12 → 15.2.14

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/shiki.css CHANGED
@@ -1,65 +1,69 @@
1
- .shiki code span {
2
- color: var(--shiki-light);
3
- }
4
-
5
- .dark .shiki code span {
6
- color: var(--shiki-dark);
7
- }
8
-
9
1
  .fd-codeblock pre > * {
10
2
  display: grid;
11
3
  font-size: 13px;
12
4
  }
13
5
 
14
- .shiki code .diff.remove {
15
- background-color: var(--fd-diff-remove-color);
16
- opacity: 0.7;
17
- }
6
+ .shiki:not(.not-fumadocs-codeblock *) {
7
+ code span {
8
+ color: var(--shiki-light);
9
+ }
18
10
 
19
- .shiki code .diff::before {
20
- position: absolute;
21
- left: 6px;
22
- }
11
+ code .diff.remove {
12
+ background-color: var(--fd-diff-remove-color);
13
+ opacity: 0.7;
14
+ }
23
15
 
24
- .shiki code .diff.remove::before {
25
- content: '-';
26
- color: var(--fd-diff-remove-symbol-color);
27
- }
16
+ code .diff::before {
17
+ position: absolute;
18
+ left: 6px;
19
+ }
28
20
 
29
- .shiki code .diff.add {
30
- background-color: var(--fd-diff-add-color);
31
- }
21
+ code .diff.remove::before {
22
+ content: '-';
23
+ color: var(--fd-diff-remove-symbol-color);
24
+ }
32
25
 
33
- .shiki code .diff.add::before {
34
- content: '+';
35
- color: var(--fd-diff-add-symbol-color);
36
- }
26
+ code .diff.add {
27
+ background-color: var(--fd-diff-add-color);
28
+ }
37
29
 
38
- .shiki code .diff {
39
- margin: 0 -16px;
40
- padding: 0 16px;
41
- position: relative;
42
- }
30
+ code .diff.add::before {
31
+ content: '+';
32
+ color: var(--fd-diff-add-symbol-color);
33
+ }
34
+
35
+ code .diff {
36
+ margin: 0 -16px;
37
+ padding: 0 16px;
38
+ position: relative;
39
+ }
40
+
41
+ .highlighted {
42
+ margin: 0 -16px;
43
+ padding: 0 16px;
44
+ background-color: color-mix(
45
+ in oklab,
46
+ var(--color-fd-primary) 10%,
47
+ transparent
48
+ );
49
+ }
43
50
 
44
- .shiki .highlighted {
45
- margin: 0 -16px;
46
- padding: 0 16px;
47
- background-color: color-mix(
48
- in oklab,
49
- var(--color-fd-primary) 10%,
50
- transparent
51
- );
51
+ .highlighted-word {
52
+ padding: 1px 2px;
53
+ margin: -1px -3px;
54
+ border: 1px solid
55
+ color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
56
+ background-color: color-mix(
57
+ in oklab,
58
+ var(--color-fd-primary) 10%,
59
+ transparent
60
+ );
61
+ border-radius: 2px;
62
+ }
52
63
  }
53
64
 
54
- .shiki .highlighted-word {
55
- padding: 1px 2px;
56
- margin: -1px -3px;
57
- border: 1px solid
58
- color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
59
- background-color: color-mix(
60
- in oklab,
61
- var(--color-fd-primary) 10%,
62
- transparent
63
- );
64
- border-radius: 2px;
65
+ .dark .shiki:not(.not-fumadocs-codeblock *) {
66
+ code span {
67
+ color: var(--shiki-dark);
68
+ }
65
69
  }
@@ -8,7 +8,7 @@ export const buttonVariants = cva('inline-flex items-center justify-center round
8
8
  secondary: 'border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent hover:text-fd-accent-foreground',
9
9
  },
10
10
  size: {
11
- sm: 'gap-1 p-1 text-xs',
11
+ sm: 'gap-1 px-2 py-1.5 text-xs',
12
12
  icon: 'p-1.5 [&_svg]:size-5',
13
13
  'icon-sm': 'p-1.5 [&_svg]:size-4.5',
14
14
  },
package/dist/page.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { TableOfContents } from 'fumadocs-core/server';
2
- import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { type AnchorHTMLAttributes, type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
3
3
  import { type AnchorProviderProps } from 'fumadocs-core/toc';
4
- import { type FooterProps, type BreadcrumbProps } from './page-client.js';
4
+ import { type BreadcrumbProps, type FooterProps } from './page-client.js';
5
5
  import { type TOCProps } from './components/layout/toc.js';
6
6
  type TableOfContentOptions = Omit<TOCProps, 'items' | 'children'> & Pick<AnchorProviderProps, 'single'> & {
7
7
  enabled: boolean;
@@ -65,7 +65,8 @@ export interface DocsPageProps {
65
65
  article?: HTMLAttributes<HTMLElement>;
66
66
  children: ReactNode;
67
67
  }
68
- export declare function DocsPage({ toc, full, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions }, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions }, ...props }: DocsPageProps): import("react/jsx-runtime").JSX.Element;
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;
69
+ export declare function EditOnGitHub(props: ComponentProps<'a'>): import("react/jsx-runtime").JSX.Element;
69
70
  /**
70
71
  * Add typography styles
71
72
  */
@@ -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,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAEL,KAAK,WAAW,EAIhB,KAAK,eAAe,EAKrB,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,CA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AAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,EACvB,GAAQ,EACR,IAAY,EACZ,YAAY,EACZ,qBAAqB,EAAE,EACrB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,iBAAiB,EAC5B,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAG,KAAK,EACT,EAAE,aAAa,2CA8Ff;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,2CAuBtD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,2HAOnB,CAAC;AAIH,eAAO,MAAM,eAAe,uIAgB1B,CAAC;AAIH,eAAO,MAAM,SAAS,mIAapB,CAAC;AAIH;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAM5E"}
package/dist/page.js CHANGED
@@ -1,15 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, } 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';
6
- import { Footer, LastUpdate, TocPopover, Breadcrumb, PageBody, PageArticle, TocPopoverTrigger, TocPopoverContent, } from './page-client.js';
6
+ import { Breadcrumb, Footer, LastUpdate, PageArticle, PageBody, TocPopover, TocPopoverContent, TocPopoverTrigger, } from './page-client.js';
7
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
11
  import ClerkTOCItems from './components/layout/toc-clerk.js';
12
- export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
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 ||
15
15
  tocOptions.header !== undefined;
@@ -24,17 +24,17 @@ export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enab
24
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] })] }), {
25
25
  items: toc,
26
26
  ...tocPopoverOptions,
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: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), 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] }), {
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] }), {
28
28
  items: toc,
29
29
  ...tocOptions,
30
30
  })] }));
31
31
  }
32
- function EditOnGitHub({ owner, repo, sha, path, ...props }) {
33
- const href = `https://github.com/${owner}/${repo}/blob/${sha}/${path.startsWith('/') ? path.slice(1) : path}`;
34
- return (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
32
+ export function EditOnGitHub(props) {
33
+ return (_jsx("a", { target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({
35
34
  color: 'secondary',
36
- className: 'gap-1.5 text-fd-muted-foreground',
37
- }), props.className), children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] }));
35
+ size: 'sm',
36
+ className: 'gap-1.5 not-prose',
37
+ }), props.className), children: props.children ?? (_jsxs(_Fragment, { children: [_jsx(Edit, { className: "size-3.5" }), _jsx(I18nLabel, { label: "editOnGithub" })] })) }));
38
38
  }
39
39
  /**
40
40
  * Add typography styles
package/dist/style.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -1585,7 +1585,7 @@
1585
1585
  backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
1586
1586
  }
1587
1587
  .transition {
1588
- transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;
1588
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
1589
1589
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
1590
1590
  transition-duration: var(--tw-duration, var(--default-transition-duration));
1591
1591
  }
@@ -2351,60 +2351,64 @@
2351
2351
  --color-fd-secondary: hsl(0, 0%, 18%);
2352
2352
  --color-fd-muted-foreground: hsl(0, 0%, 72%);
2353
2353
  }
2354
- .shiki code span {
2355
- color: var(--shiki-light);
2356
- }
2357
- .dark .shiki code span {
2358
- color: var(--shiki-dark);
2359
- }
2360
2354
  .fd-codeblock pre > * {
2361
2355
  display: grid;
2362
2356
  font-size: 13px;
2363
2357
  }
2364
- .shiki code .diff.remove {
2365
- background-color: var(--fd-diff-remove-color);
2366
- opacity: 0.7;
2367
- }
2368
- .shiki code .diff::before {
2369
- position: absolute;
2370
- left: 6px;
2371
- }
2372
- .shiki code .diff.remove::before {
2373
- content: '-';
2374
- color: var(--fd-diff-remove-symbol-color);
2375
- }
2376
- .shiki code .diff.add {
2377
- background-color: var(--fd-diff-add-color);
2378
- }
2379
- .shiki code .diff.add::before {
2380
- content: '+';
2381
- color: var(--fd-diff-add-symbol-color);
2382
- }
2383
- .shiki code .diff {
2384
- margin: 0 -16px;
2385
- padding: 0 16px;
2386
- position: relative;
2387
- }
2388
- .shiki .highlighted {
2389
- margin: 0 -16px;
2390
- padding: 0 16px;
2391
- background-color: color-mix( in oklab, hsl(0, 0%, 9%) 10%, transparent );
2392
- @supports (color: color-mix(in lab, red, red)) {
2393
- background-color: color-mix( in oklab, var(--color-fd-primary) 10%, transparent );
2358
+ .shiki:not(.not-fumadocs-codeblock *) {
2359
+ code span {
2360
+ color: var(--shiki-light);
2394
2361
  }
2395
- }
2396
- .shiki .highlighted-word {
2397
- padding: 1px 2px;
2398
- margin: -1px -3px;
2399
- border: 1px solid color-mix(in srgb, hsl(0, 0%, 9%) 50%, transparent);
2400
- @supports (color: color-mix(in lab, red, red)) {
2401
- border: 1px solid color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
2362
+ code .diff.remove {
2363
+ background-color: var(--fd-diff-remove-color);
2364
+ opacity: 0.7;
2365
+ }
2366
+ code .diff::before {
2367
+ position: absolute;
2368
+ left: 6px;
2369
+ }
2370
+ code .diff.remove::before {
2371
+ content: '-';
2372
+ color: var(--fd-diff-remove-symbol-color);
2373
+ }
2374
+ code .diff.add {
2375
+ background-color: var(--fd-diff-add-color);
2402
2376
  }
2403
- background-color: color-mix( in oklab, hsl(0, 0%, 9%) 10%, transparent );
2404
- @supports (color: color-mix(in lab, red, red)) {
2405
- background-color: color-mix( in oklab, var(--color-fd-primary) 10%, transparent );
2377
+ code .diff.add::before {
2378
+ content: '+';
2379
+ color: var(--fd-diff-add-symbol-color);
2380
+ }
2381
+ code .diff {
2382
+ margin: 0 -16px;
2383
+ padding: 0 16px;
2384
+ position: relative;
2385
+ }
2386
+ .highlighted {
2387
+ margin: 0 -16px;
2388
+ padding: 0 16px;
2389
+ background-color: color-mix( in oklab, hsl(0, 0%, 9%) 10%, transparent );
2390
+ @supports (color: color-mix(in lab, red, red)) {
2391
+ background-color: color-mix( in oklab, var(--color-fd-primary) 10%, transparent );
2392
+ }
2393
+ }
2394
+ .highlighted-word {
2395
+ padding: 1px 2px;
2396
+ margin: -1px -3px;
2397
+ border: 1px solid color-mix(in srgb, hsl(0, 0%, 9%) 50%, transparent);
2398
+ @supports (color: color-mix(in lab, red, red)) {
2399
+ border: 1px solid color-mix(in oklab, var(--color-fd-primary) 50%, transparent);
2400
+ }
2401
+ background-color: color-mix( in oklab, hsl(0, 0%, 9%) 10%, transparent );
2402
+ @supports (color: color-mix(in lab, red, red)) {
2403
+ background-color: color-mix( in oklab, var(--color-fd-primary) 10%, transparent );
2404
+ }
2405
+ border-radius: 2px;
2406
+ }
2407
+ }
2408
+ .dark .shiki:not(.not-fumadocs-codeblock *) {
2409
+ code span {
2410
+ color: var(--shiki-dark);
2406
2411
  }
2407
- border-radius: 2px;
2408
2412
  }
2409
2413
  @layer base {
2410
2414
  *, ::after, ::before, ::backdrop, ::file-selector-button {
@@ -1,3 +1,3 @@
1
1
  import { type MouseEventHandler } from 'react';
2
- export declare function useCopyButton(onCopy: () => void): [checked: boolean, onClick: MouseEventHandler];
2
+ export declare function useCopyButton(onCopy: () => void | Promise<void>): [checked: boolean, onClick: MouseEventHandler];
3
3
  //# sourceMappingURL=use-copy-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-copy-button.d.ts","sourceRoot":"","sources":["../../src/utils/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,IAAI,GACjB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAuBhD"}
1
+ {"version":3,"file":"use-copy-button.d.ts","sourceRoot":"","sources":["../../src/utils/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAG5E,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAwBhD"}
@@ -1,19 +1,20 @@
1
1
  'use client';
2
- import { useState, useRef, useEffect, useCallback, } from 'react';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
3
4
  export function useCopyButton(onCopy) {
4
5
  const [checked, setChecked] = useState(false);
5
6
  const timeoutRef = useRef(null);
6
- const callbackRef = useRef(onCopy);
7
- callbackRef.current = onCopy;
8
- const onClick = useCallback(() => {
7
+ const onClick = useEffectEvent(() => {
9
8
  if (timeoutRef.current)
10
9
  window.clearTimeout(timeoutRef.current);
11
- timeoutRef.current = window.setTimeout(() => {
12
- setChecked(false);
13
- }, 1500);
14
- callbackRef.current();
15
- setChecked(true);
16
- }, []);
10
+ const res = Promise.resolve(onCopy());
11
+ void res.then(() => {
12
+ setChecked(true);
13
+ timeoutRef.current = window.setTimeout(() => {
14
+ setChecked(false);
15
+ }, 1500);
16
+ });
17
+ });
17
18
  // Avoid updates after being unmounted
18
19
  useEffect(() => {
19
20
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.2.12",
3
+ "version": "15.2.14",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -87,20 +87,20 @@
87
87
  "postcss-selector-parser": "^7.1.0",
88
88
  "react-medium-image-zoom": "^5.2.14",
89
89
  "tailwind-merge": "^3.2.0",
90
- "fumadocs-core": "15.2.12"
90
+ "fumadocs-core": "15.2.14"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@next/eslint-plugin-next": "^15.3.1",
94
- "@tailwindcss/cli": "^4.1.4",
94
+ "@tailwindcss/cli": "^4.1.5",
95
95
  "@types/lodash.merge": "^4.6.9",
96
96
  "@types/react": "^19.1.2",
97
- "@types/react-dom": "^19.1.2",
97
+ "@types/react-dom": "^19.1.3",
98
98
  "next": "15.3.1",
99
- "tailwindcss": "^4.1.4",
99
+ "tailwindcss": "^4.1.5",
100
100
  "tsc-alias": "^1.8.15",
101
101
  "@fumadocs/cli": "0.1.1",
102
102
  "eslint-config-custom": "0.0.0",
103
- "fumadocs-core": "15.2.12",
103
+ "fumadocs-core": "15.2.14",
104
104
  "tsconfig": "0.0.0"
105
105
  },
106
106
  "peerDependencies": {