fumadocs-ui 15.0.17 → 15.0.18

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,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- export declare const Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
2
+ export declare const Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
3
3
  title?: ReactNode;
4
4
  /**
5
5
  * @defaultValue info
@@ -1,5 +1,5 @@
1
1
  export declare const buttonVariants: (props?: ({
2
2
  color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
3
- size?: "sm" | "icon" | "icon-sm" | null | undefined;
3
+ size?: "icon" | "sm" | "icon-sm" | null | undefined;
4
4
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
5
  //# sourceMappingURL=button.d.ts.map
@@ -9,7 +9,7 @@ export declare function NavbarMenuContent(props: NavigationMenuContentProps): im
9
9
  export declare function NavbarMenuTrigger(props: NavigationMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
10
10
  export declare function NavbarMenuLink(props: LinkProps): import("react/jsx-runtime").JSX.Element;
11
11
  declare const linkVariants: (props?: ({
12
- variant?: "button" | "main" | "icon" | null | undefined;
12
+ variant?: "icon" | "button" | "main" | null | undefined;
13
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
14
  export declare function NavbarLink({ item, variant, ...props }: ComponentProps<typeof BaseLinkItem> & VariantProps<typeof linkVariants>): import("react/jsx-runtime").JSX.Element;
15
15
  export {};
package/dist/mdx.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Card, Cards } from './components/card.js';
3
3
  declare function Image(props: ImgHTMLAttributes<HTMLImageElement>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function Table(props: TableHTMLAttributes<HTMLTableElement>): import("react/jsx-runtime").JSX.Element;
5
5
  declare const defaultMdxComponents: {
6
- pre: FC<HTMLAttributes<HTMLPreElement>>;
6
+ pre: (props: HTMLAttributes<HTMLPreElement>) => import("react/jsx-runtime").JSX.Element;
7
7
  Card: typeof Card;
8
8
  Cards: typeof Cards;
9
9
  a: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
@@ -15,11 +15,12 @@ declare const defaultMdxComponents: {
15
15
  h5: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
16
16
  h6: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
17
17
  table: typeof Table;
18
- Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
18
+ Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
19
19
  title?: import("react").ReactNode;
20
20
  type?: "info" | "warn" | "error";
21
21
  icon?: import("react").ReactNode;
22
22
  } & import("react").RefAttributes<HTMLDivElement>>;
23
23
  };
24
+ export declare const createRelativeLink: typeof import('./mdx.server.js').createRelativeLink;
24
25
  export { defaultMdxComponents as default };
25
26
  //# 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,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,2CAQxD;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;SACZ,EAAE,CAAC,cAAc,C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@@ -5,7 +5,7 @@ import { Card, Cards } from './components/card.js';
5
5
  import { Callout } from './components/callout.js';
6
6
  import { Heading } from './components/heading.js';
7
7
  import { cn } from './utils/cn.js';
8
- import { Pre } from './mdx.client.js';
8
+ import { CodeBlock, Pre } from './components/codeblock.js';
9
9
  function Image(props) {
10
10
  return (_jsx(NextImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn('rounded-lg', props.className) }));
11
11
  }
@@ -13,7 +13,7 @@ function Table(props) {
13
13
  return (_jsx("div", { className: "relative overflow-auto", children: _jsx("table", { ...props }) }));
14
14
  }
15
15
  const defaultMdxComponents = {
16
- pre: Pre,
16
+ pre: (props) => (_jsx(CodeBlock, { ...props, children: _jsx(Pre, { children: props.children }) })),
17
17
  Card,
18
18
  Cards,
19
19
  a: Link,
@@ -27,4 +27,7 @@ const defaultMdxComponents = {
27
27
  table: Table,
28
28
  Callout,
29
29
  };
30
+ export const createRelativeLink = () => {
31
+ throw new Error('`createRelativeLink` is only supported in Node.js environment');
32
+ };
30
33
  export { defaultMdxComponents as default };
@@ -0,0 +1,13 @@
1
+ import type { LoaderConfig, LoaderOutput, Page } from 'fumadocs-core/source';
2
+ import type { ComponentProps, FC } from 'react';
3
+ import defaultMdxComponents from './mdx.js';
4
+ /**
5
+ * Extend the default Link component to resolve relative file paths in `href`.
6
+ *
7
+ * @param page the current page
8
+ * @param source the source object
9
+ * @param OverrideLink The component to override from
10
+ */
11
+ export declare function createRelativeLink(source: LoaderOutput<LoaderConfig>, page: Page, OverrideLink?: FC<ComponentProps<'a'>>): FC<ComponentProps<'a'>>;
12
+ export { defaultMdxComponents as default };
13
+ //# sourceMappingURL=mdx.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;AAGzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,EAClC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAA0B,GAC7D,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAgBzB;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import defaultMdxComponents from './mdx.js';
3
+ import * as path from 'node:path';
4
+ /**
5
+ * Extend the default Link component to resolve relative file paths in `href`.
6
+ *
7
+ * @param page the current page
8
+ * @param source the source object
9
+ * @param OverrideLink The component to override from
10
+ */
11
+ export function createRelativeLink(source, page, OverrideLink = defaultMdxComponents.a) {
12
+ return async function RelativeLink({ href, ...props }) {
13
+ if (href &&
14
+ href.startsWith('.') &&
15
+ (href.endsWith('.md') || href.endsWith('.mdx'))) {
16
+ const pages = source.getPages();
17
+ const hrefPath = path.join(page.file.dirname, href);
18
+ const targetPage = pages.find((item) => item.file.path === hrefPath);
19
+ if (targetPage)
20
+ href = targetPage.url;
21
+ }
22
+ return _jsx(OverrideLink, { href: href, ...props });
23
+ };
24
+ }
25
+ export { defaultMdxComponents as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.0.17",
3
+ "version": "15.0.18",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -37,6 +37,7 @@
37
37
  "types": "./dist/provider.d.ts"
38
38
  },
39
39
  "./mdx": {
40
+ "node": "./dist/mdx.server.js",
40
41
  "import": "./dist/mdx.js",
41
42
  "types": "./dist/mdx.d.ts"
42
43
  },
@@ -80,9 +81,9 @@
80
81
  "next": "15.2.2",
81
82
  "tailwindcss": "^4.0.14",
82
83
  "tsc-alias": "^1.8.11",
83
- "eslint-config-custom": "0.0.0",
84
- "fumadocs-core": "15.0.17",
85
84
  "@fumadocs/cli": "0.0.8",
85
+ "eslint-config-custom": "0.0.0",
86
+ "fumadocs-core": "15.0.18",
86
87
  "tsconfig": "0.0.0"
87
88
  },
88
89
  "peerDependencies": {
@@ -90,7 +91,7 @@
90
91
  "react": "18.x.x || 19.x.x",
91
92
  "react-dom": "18.x.x || 19.x.x",
92
93
  "tailwindcss": "^3.4.14 || ^4.0.0",
93
- "fumadocs-core": "15.0.17"
94
+ "fumadocs-core": "15.0.18"
94
95
  },
95
96
  "peerDependenciesMeta": {
96
97
  "tailwindcss": {
@@ -1,10 +0,0 @@
1
- import * as Base from './components/codeblock.js';
2
- /**
3
- * You are NOT supposed to use this component directly.
4
- *
5
- * This should be referenced in the output generated by the Rehype Code plugin.
6
- *
7
- * @internal
8
- */
9
- export declare function Pre(props: Base.CodeBlockProps): React.ReactElement;
10
- //# sourceMappingURL=mdx.client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mdx.client.d.ts","sourceRoot":"","sources":["../src/mdx.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,YAAY,CAMlE"}
@@ -1,13 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as Base from './components/codeblock.js';
4
- /**
5
- * You are NOT supposed to use this component directly.
6
- *
7
- * This should be referenced in the output generated by the Rehype Code plugin.
8
- *
9
- * @internal
10
- */
11
- export function Pre(props) {
12
- return (_jsx(Base.CodeBlock, { ...props, children: _jsx(Base.Pre, { children: props.children }) }));
13
- }