fumadocs-core 12.5.1 → 12.5.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.
@@ -7,11 +7,14 @@ interface BreadcrumbItem {
7
7
  }
8
8
  interface BreadcrumbOptions extends SearchOptions {
9
9
  /**
10
- * Include the root itself in the breadcrumb items array
10
+ * Include the root itself in the breadcrumb items array.
11
+ * Specify the url by passing an object instead
11
12
  *
12
13
  * @defaultValue false
13
14
  */
14
- includeRoot?: boolean;
15
+ includeRoot?: boolean | {
16
+ url: string;
17
+ };
15
18
  }
16
19
  declare function useBreadcrumb(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
17
20
  declare function getBreadcrumbItems(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
@@ -11,13 +11,13 @@ function useBreadcrumb(url, tree, options) {
11
11
  );
12
12
  }
13
13
  function getBreadcrumbItems(url, tree, options = {}) {
14
- var _b, _c;
14
+ var _b;
15
15
  const _a = options, { includeRoot } = _a, rest = __objRest(_a, ["includeRoot"]);
16
16
  const path = (_b = searchPath(tree.children, url, rest)) != null ? _b : [];
17
17
  if (includeRoot) {
18
18
  path.unshift({
19
19
  name: tree.name,
20
- url: (_c = tree.children.find((p) => p.type === "page")) == null ? void 0 : _c.url
20
+ url: typeof includeRoot === "object" ? includeRoot.url : void 0
21
21
  });
22
22
  }
23
23
  return path;
@@ -12,10 +12,14 @@ var Link = forwardRef(
12
12
  (_a, ref) => {
13
13
  var _b = _a, {
14
14
  href = "#",
15
- external = !(href.startsWith("/") || href.startsWith("#") || href.startsWith("."))
15
+ external = !(href.startsWith("/") || href.startsWith("#") || href.startsWith(".")),
16
+ prefetch,
17
+ replace
16
18
  } = _b, props = __objRest(_b, [
17
19
  "href",
18
- "external"
20
+ "external",
21
+ "prefetch",
22
+ "replace"
19
23
  ]);
20
24
  if (external) {
21
25
  return /* @__PURE__ */ jsx(
@@ -30,7 +34,15 @@ var Link = forwardRef(
30
34
  })
31
35
  );
32
36
  }
33
- return /* @__PURE__ */ jsx(Original, __spreadValues({ ref, href }, props));
37
+ return /* @__PURE__ */ jsx(
38
+ Original,
39
+ __spreadValues({
40
+ ref,
41
+ href,
42
+ prefetch,
43
+ replace
44
+ }, props)
45
+ );
34
46
  }
35
47
  );
36
48
  Link.displayName = "Link";
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { LinkProps } from './link.js';
3
+ import 'next/link';
3
4
 
4
5
  type DynamicLinkProps = LinkProps;
5
6
  /**
@@ -7,8 +8,6 @@ type DynamicLinkProps = LinkProps;
7
8
  *
8
9
  * It supports dynamic hrefs, which means you can use `/[lang]/my-page` with `dynamicHrefs` enabled
9
10
  */
10
- declare const DynamicLink: react.ForwardRefExoticComponent<react.AnchorHTMLAttributes<HTMLAnchorElement> & {
11
- external?: boolean;
12
- } & react.RefAttributes<HTMLAnchorElement>>;
11
+ declare const DynamicLink: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
13
12
 
14
13
  export { DynamicLink, type DynamicLinkProps, DynamicLink as default };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Link
4
- } from "./chunk-XB7CNOKH.js";
4
+ } from "./chunk-UMTVJNLA.js";
5
5
  import {
6
6
  __objRest,
7
7
  __spreadValues
package/dist/link.d.ts CHANGED
@@ -1,24 +1,18 @@
1
1
  import * as react from 'react';
2
2
  import { AnchorHTMLAttributes } from 'react';
3
+ import { LinkProps as LinkProps$1 } from 'next/link';
3
4
 
4
- type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
5
+ interface LinkProps extends Pick<LinkProps$1, 'prefetch' | 'replace'>, AnchorHTMLAttributes<HTMLAnchorElement> {
5
6
  /**
6
7
  * If the href is an external URL
7
8
  *
8
9
  * automatically determined by default
9
10
  */
10
11
  external?: boolean;
11
- };
12
+ }
12
13
  /**
13
- * Wraps `next/link` and safe to use in mdx documents
14
+ * Wraps `next/link` and safe to use in MDX documents
14
15
  */
15
- declare const Link: react.ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & {
16
- /**
17
- * If the href is an external URL
18
- *
19
- * automatically determined by default
20
- */
21
- external?: boolean;
22
- } & react.RefAttributes<HTMLAnchorElement>>;
16
+ declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
23
17
 
24
18
  export { type LinkProps, Link as default };
package/dist/link.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Link
3
- } from "./chunk-XB7CNOKH.js";
3
+ } from "./chunk-UMTVJNLA.js";
4
4
  import "./chunk-CWMXXUWU.js";
5
5
  export {
6
6
  Link as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "12.5.1",
3
+ "version": "12.5.3",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",