fumadocs-ui 14.7.1 → 14.7.3

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,5 +1,9 @@
1
1
  import { type HTMLAttributes } from 'react';
2
- export declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttributes<HTMLDivElement> & {
2
+ export declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
3
+ /**
4
+ * @defaultValue 3rem
5
+ */
6
+ height?: string;
3
7
  /**
4
8
  * @defaultValue 'normal'
5
9
  */
@@ -10,5 +14,5 @@ export declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttr
10
14
  * @defaultValue true
11
15
  */
12
16
  changeLayout?: boolean;
13
- }): React.ReactElement;
17
+ }): import("react/jsx-runtime").JSX.Element | null;
14
18
  //# sourceMappingURL=banner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/components/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAoC,MAAM,OAAO,CAAC;AAK9E,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,KAAK,CAAC,YAAY,CA6DrB"}
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/components/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAoC,MAAM,OAAO,CAAC;AAK9E,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,MAAe,EACf,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,kDAiEA"}
@@ -4,9 +4,9 @@ import { useCallback, useEffect, useState } from 'react';
4
4
  import { X } from 'lucide-react';
5
5
  import { cn } from '../utils/cn';
6
6
  import { buttonVariants } from '../components/ui/button';
7
- export function Banner({ id, variant = 'normal', changeLayout = true, ...props }) {
7
+ export function Banner({ id, variant = 'normal', changeLayout = true, height = '3rem', ...props }) {
8
8
  const [open, setOpen] = useState(true);
9
- const globalKey = id ? `nd-banner-${id}` : undefined;
9
+ const globalKey = id ? `nd-banner-${id}` : null;
10
10
  useEffect(() => {
11
11
  if (globalKey)
12
12
  setOpen(localStorage.getItem(globalKey) !== 'true');
@@ -16,9 +16,11 @@ export function Banner({ id, variant = 'normal', changeLayout = true, ...props }
16
16
  if (globalKey)
17
17
  localStorage.setItem(globalKey, 'true');
18
18
  }, [globalKey]);
19
- return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex h-12 flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), children: [changeLayout && open ? (_jsx("style", { children: `
20
- :root:not(.${globalKey ?? 'nd-banner-never'}) { --fd-banner-height: 3rem; }
21
- ` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, id ? (_jsx("script", { dangerouslySetInnerHTML: {
19
+ if (!open)
20
+ return null;
21
+ return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex h-[var(--fd-banner-height)] flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), children: [changeLayout && open ? (_jsx("style", { children: globalKey
22
+ ? `:root:not(.${globalKey}) { --fd-banner-height: ${height}; }`
23
+ : `:root { --fd-banner-height: ${height}; }` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, globalKey ? (_jsx("script", { dangerouslySetInnerHTML: {
22
24
  __html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`,
23
25
  } })) : null, variant === 'rainbow' ? rainbowLayer : null, props.children, id ? (_jsx("button", { type: "button", "aria-label": "Close Banner", onClick: onClick, className: cn(buttonVariants({
24
26
  color: 'ghost',
@@ -10,7 +10,7 @@ export interface Option {
10
10
  /**
11
11
  * Detect from a list of urls
12
12
  */
13
- urls?: string[];
13
+ urls?: Set<string>;
14
14
  props?: HTMLAttributes<HTMLElement>;
15
15
  }
16
16
  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;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;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,iBAAiB,CAAC,2CAuDpC"}
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;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEnB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;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,iBAAiB,CAAC,2CAyDpC"}
@@ -14,7 +14,7 @@ export function RootToggle({ options, placeholder, ...props }) {
14
14
  const pathname = usePathname();
15
15
  const selected = useMemo(() => {
16
16
  return options.findLast((item) => item.urls
17
- ? item.urls.includes(pathname)
17
+ ? item.urls.has(pathname.endsWith('/') ? pathname.slice(0, -1) : pathname)
18
18
  : isActive(item.url, pathname, true));
19
19
  }, [options, pathname]);
20
20
  const onClick = () => {
@@ -59,7 +59,7 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
59
59
  title: node.name,
60
60
  icon: node.icon,
61
61
  description: node.description,
62
- urls: getFolderUrls(node),
62
+ urls: getFolderUrls(node, new Set()),
63
63
  };
64
64
  const mapped = transform ? transform(option, node) : option;
65
65
  if (mapped)
@@ -74,15 +74,14 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
74
74
  }
75
75
  return findOptions(pageTree);
76
76
  }
77
- function getFolderUrls(folder) {
78
- const results = [];
77
+ function getFolderUrls(folder, output) {
79
78
  if (folder.index)
80
- results.push(folder.index.url);
79
+ output.add(folder.index.url);
81
80
  for (const child of folder.children) {
82
81
  if (child.type === 'page')
83
- results.push(child.url);
82
+ output.add(child.url);
84
83
  if (child.type === 'folder')
85
- results.push(...getFolderUrls(child));
84
+ getFolderUrls(child, output);
86
85
  }
87
- return results;
86
+ return output;
88
87
  }
@@ -12,7 +12,7 @@ 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-1/2 top-[var(--fd-banner-height)] z-40 w-full max-w-fd-container -translate-x-1/2 border-b border-fd-foreground/10 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) &&
15
+ return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed left-1/2 top-[var(--fd-banner-height)] z-40 box-content w-full max-w-fd-container -translate-x-1/2 border-b border-fd-foreground/10 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
16
  'bg-fd-background/80 backdrop-blur-lg', props.className), children: [_jsx("nav", { className: "flex h-14 w-full flex-row items-center gap-6 px-4 lg:h-12", children: props.children }), _jsx(NavigationMenuViewport, {})] }) }));
17
17
  }
18
18
  export const NavbarMenu = NavigationMenuItem;
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAgC1D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0ChD"}
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAgC1D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0BhD"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { replaceOrDefault } from '../layouts/shared';
3
3
  import { cn } from '../utils/cn';
4
4
  import { getLinks } from './shared';
@@ -16,9 +16,7 @@ import { MenuLinkItem } from '../layouts/home/menu';
16
16
  export function HomeLayout(props) {
17
17
  const { nav, links, githubUrl, i18n: _i18n, disableThemeSwitch: _disableThemeSwitch, ...rest } = props;
18
18
  const finalLinks = getLinks(links, githubUrl);
19
- return (_jsx(NavProvider, { transparentMode: nav?.transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...rest, className: cn('flex flex-1 flex-col pt-[var(--fd-nav-height)] [--fd-nav-height:56px]', rest.className), children: [replaceOrDefault(nav, _jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", className: "fixed inset-x-0 top-[var(--fd-banner-height)] z-40 h-6 bg-fd-background", style: {
20
- maskImage: 'linear-gradient(to bottom,white,transparent)',
21
- } }), _jsx(Header, { finalLinks: finalLinks, ...props })] }), {
19
+ return (_jsx(NavProvider, { transparentMode: nav?.transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...rest, className: cn('flex flex-1 flex-col pt-14', rest.className), children: [replaceOrDefault(nav, _jsx(Header, { finalLinks: finalLinks, ...props }), {
22
20
  items: finalLinks,
23
21
  }), props.children] }) }));
24
22
  }
@@ -57,5 +57,5 @@ function SidebarHeaderItems({ links, nav = {}, children, }) {
57
57
  const isEmpty = !nav.title && !nav.children && links.length === 0;
58
58
  if (isEmpty)
59
59
  return null;
60
- return (_jsxs("div", { className: "flex flex-row items-center max-md:hidden", children: [nav.title ? (_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 py-1 font-medium", children: nav.title })) : null, children] }));
60
+ return (_jsxs("div", { className: "flex flex-row items-center max-md:hidden", children: [nav.title ? (_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 py-1 font-medium md:px-2", children: nav.title })) : null, children] }));
61
61
  }
package/dist/mdx.d.ts CHANGED
@@ -21,19 +21,5 @@ declare const defaultMdxComponents: {
21
21
  icon?: import("react").ReactNode;
22
22
  } & import("react").RefAttributes<HTMLDivElement>>;
23
23
  };
24
- /**
25
- * **Server Component Only**
26
- *
27
- * Sometimes, if you directly pass a client component to MDX Components, it will throw an error
28
- *
29
- * To solve this, you can re-create the component in a server component like: `(props) => <Component {...props} />`
30
- *
31
- * This function does that for you
32
- *
33
- * @param c - MDX Components
34
- * @returns MDX Components with re-created client components
35
- * @deprecated no longer used
36
- */
37
- export declare function createComponents<Components extends Record<string, FC<unknown>>>(c: Components): Components;
38
24
  export { defaultMdxComponents as default };
39
25
  //# sourceMappingURL=mdx.d.ts.map
package/dist/mdx.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMhD,iBAAS,KAAK,CAAC,KAA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AC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
package/dist/mdx.js CHANGED
@@ -27,27 +27,4 @@ const defaultMdxComponents = {
27
27
  table: Table,
28
28
  Callout,
29
29
  };
30
- /**
31
- * **Server Component Only**
32
- *
33
- * Sometimes, if you directly pass a client component to MDX Components, it will throw an error
34
- *
35
- * To solve this, you can re-create the component in a server component like: `(props) => <Component {...props} />`
36
- *
37
- * This function does that for you
38
- *
39
- * @param c - MDX Components
40
- * @returns MDX Components with re-created client components
41
- * @deprecated no longer used
42
- */
43
- export function createComponents(c) {
44
- const mapped = Object.entries(c).map(([k, V]) => {
45
- // Client components are empty objects
46
- return [
47
- k,
48
- Object.keys(V).length === 0 ? (props) => _jsx(V, { ...props }) : V,
49
- ];
50
- });
51
- return Object.fromEntries(mapped);
52
- }
53
30
  export { defaultMdxComponents as default };
@@ -1 +1 @@
1
- {"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAGlC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CA2B3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;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AE,KAAK,EAAE,EAAE,WAAW,2CA8C5C;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAiClD"}
@@ -12,6 +12,7 @@ import { usePathname } from 'next/navigation';
12
12
  import { useNav } from './components/layout/nav';
13
13
  import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
14
14
  import { usePageStyles } from './contexts/layout';
15
+ import { isActive } from './utils/is-active';
15
16
  export function TocNav(props) {
16
17
  const { open } = useSidebar();
17
18
  const { tocNav } = usePageStyles();
@@ -67,7 +68,7 @@ export function Footer({ items }) {
67
68
  const cached = listCache.get(root);
68
69
  const list = cached ?? scanNavigationList(root.children);
69
70
  listCache.set(root, list);
70
- const idx = list.findIndex((item) => item.url === pathname);
71
+ const idx = list.findIndex((item) => isActive(item.url, pathname, false));
71
72
  if (idx === -1)
72
73
  return {};
73
74
  return {
package/dist/style.css CHANGED
@@ -1181,6 +1181,9 @@ body {
1181
1181
  .mt-auto {
1182
1182
  margin-top: auto;
1183
1183
  }
1184
+ .box-content {
1185
+ box-sizing: content-box;
1186
+ }
1184
1187
  .block {
1185
1188
  display: block;
1186
1189
  }
@@ -1226,14 +1229,11 @@ body {
1226
1229
  .h-1\.5 {
1227
1230
  height: 0.375rem;
1228
1231
  }
1229
- .h-12 {
1230
- height: 3rem;
1231
- }
1232
1232
  .h-14 {
1233
1233
  height: 3.5rem;
1234
1234
  }
1235
- .h-6 {
1236
- height: 1.5rem;
1235
+ .h-\[var\(--fd-banner-height\)\] {
1236
+ height: var(--fd-banner-height);
1237
1237
  }
1238
1238
  .h-\[var\(--fd-height\)\] {
1239
1239
  height: var(--fd-height);
@@ -1691,6 +1691,9 @@ body {
1691
1691
  .pt-12 {
1692
1692
  padding-top: 3rem;
1693
1693
  }
1694
+ .pt-14 {
1695
+ padding-top: 3.5rem;
1696
+ }
1694
1697
  .pt-2 {
1695
1698
  padding-top: 0.5rem;
1696
1699
  }
@@ -1700,9 +1703,6 @@ body {
1700
1703
  .pt-8 {
1701
1704
  padding-top: 2rem;
1702
1705
  }
1703
- .pt-\[var\(--fd-nav-height\)\] {
1704
- padding-top: var(--fd-nav-height);
1705
- }
1706
1706
  .text-center {
1707
1707
  text-align: center;
1708
1708
  }
@@ -1902,9 +1902,6 @@ body {
1902
1902
  .\[--fd-nav-height\:3\.5rem\] {
1903
1903
  --fd-nav-height: 3.5rem;
1904
1904
  }
1905
- .\[--fd-nav-height\:56px\] {
1906
- --fd-nav-height: 56px;
1907
- }
1908
1905
  .\[--fd-tocnav-height\:36px\] {
1909
1906
  --fd-tocnav-height: 36px;
1910
1907
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAET"}
1
+ {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT"}
@@ -1,3 +1,7 @@
1
1
  export function isActive(url, pathname, nested = true) {
2
+ if (url.endsWith('/'))
3
+ url = url.slice(0, -1);
4
+ if (pathname.endsWith('/'))
5
+ pathname = pathname.slice(0, -1);
2
6
  return url === pathname || (nested && pathname.startsWith(`${url}/`));
3
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "14.7.1",
3
+ "version": "14.7.3",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -70,19 +70,19 @@
70
70
  "tailwind-merge": "^2.6.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@next/eslint-plugin-next": "^15.1.3",
73
+ "@next/eslint-plugin-next": "^15.1.4",
74
74
  "@types/lodash.merge": "^4.6.9",
75
- "@types/react": "^19.0.2",
75
+ "@types/react": "^19.0.4",
76
76
  "@types/react-dom": "^19.0.2",
77
77
  "autoprefixer": "^10.4.20",
78
- "next": "15.1.3",
78
+ "next": "15.1.4",
79
79
  "postcss": "^8.4.49",
80
80
  "postcss-cli": "^11.0.0",
81
81
  "tailwindcss": "^3.4.17",
82
82
  "tsc-alias": "^1.8.10",
83
- "fumadocs-core": "14.7.1",
84
83
  "@fumadocs/cli": "0.0.6",
85
84
  "eslint-config-custom": "0.0.0",
85
+ "fumadocs-core": "14.7.3",
86
86
  "tsconfig": "0.0.0"
87
87
  },
88
88
  "peerDependencies": {
@@ -90,7 +90,7 @@
90
90
  "react": "18.x.x || 19.x.x",
91
91
  "react-dom": "18.x.x || 19.x.x",
92
92
  "tailwindcss": "^3.4.14",
93
- "fumadocs-core": "14.7.1"
93
+ "fumadocs-core": "14.7.3"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "tailwindcss": {