fumadocs-core 15.0.6 → 15.0.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,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { R as Root, N as Node } from './page-tree-r8qjoUla.js';
2
+ import { R as Root, N as Node } from './page-tree-B1oLifVu.js';
3
3
 
4
4
  interface BreadcrumbItem {
5
5
  name: ReactNode;
@@ -18,6 +18,7 @@ interface Item {
18
18
  interface Separator {
19
19
  type: 'separator';
20
20
  name: ReactNode;
21
+ icon?: ReactElement;
21
22
  }
22
23
  interface Folder {
23
24
  $ref?: {
@@ -8,7 +8,7 @@ import 'mdast';
8
8
  import 'unified';
9
9
  import 'unist-util-visit';
10
10
  import 'react';
11
- import '../page-tree-r8qjoUla.js';
11
+ import '../page-tree-B1oLifVu.js';
12
12
 
13
13
  type AdvancedDocument = TypedDocument<Orama<typeof advancedSchema>>;
14
14
  declare const advancedSchema: {
@@ -1,6 +1,6 @@
1
1
  export { a as TOCItemType, T as TableOfContents, g as getTableOfContents } from '../get-toc-Cr2URuiP.js';
2
- import { N as Node, I as Item, R as Root } from '../page-tree-r8qjoUla.js';
3
- export { p as PageTree } from '../page-tree-r8qjoUla.js';
2
+ import { N as Node, I as Item, R as Root } from '../page-tree-B1oLifVu.js';
3
+ export { p as PageTree } from '../page-tree-B1oLifVu.js';
4
4
  export { S as SortedResult } from '../types-Ch8gnVgO.js';
5
5
  import { Metadata } from 'next';
6
6
  import { NextRequest } from 'next/server';
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { I as I18nConfig } from '../config-inq6kP6y.js';
3
- import { R as Root, I as Item, F as Folder$1, S as Separator } from '../page-tree-r8qjoUla.js';
3
+ import { R as Root, I as Item, F as Folder$1, S as Separator } from '../page-tree-B1oLifVu.js';
4
4
 
5
5
  interface FileInfo {
6
6
  /**
@@ -13,7 +13,7 @@ import {
13
13
  // src/source/page-tree-builder.ts
14
14
  var group = /^\((?<name>.+)\)$/;
15
15
  var link = /^(?:\[(?<icon>[^\]]+)])?\[(?<name>[^\]]+)]\((?<url>[^)]+)\)$/;
16
- var separator = /^---(?<name>.*?)---$/;
16
+ var separator = /^---(?:\[(?<icon>[^\]]+)])?(?<name>.+)---$/;
17
17
  var rest = "...";
18
18
  var restReversed = "z...a";
19
19
  var extractPrefix = "...";
@@ -52,9 +52,10 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
52
52
  if (match?.groups) {
53
53
  const node = {
54
54
  type: "separator",
55
+ icon: ctx.options.resolveIcon?.(match.groups.icon),
55
56
  name: match.groups.name
56
57
  };
57
- return [ctx.options.attachSeparator?.(node) ?? node];
58
+ return [removeUndefined(ctx.options.attachSeparator?.(node) ?? node)];
58
59
  }
59
60
  match = link.exec(item);
60
61
  if (match?.groups) {
@@ -89,8 +90,7 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
89
90
  }
90
91
  function buildFolderNode(folder, isGlobalRoot, ctx) {
91
92
  const metaPath = resolvePath(folder.file.path, "meta");
92
- let meta = ctx.storage.read(metaPath, "meta");
93
- meta = findLocalizedFile(metaPath, "meta", ctx) ?? meta;
93
+ const meta = findLocalizedFile(metaPath, "meta", ctx) ?? ctx.storage.read(metaPath, "meta");
94
94
  const indexFile = ctx.storage.read(
95
95
  resolvePath(folder.file.flattenedPath, "index"),
96
96
  "page"
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Don't use this, could be deleted anytime.
3
+ *
4
+ * @internal
5
+ */
6
+ declare function useEffectEvent<F extends (...params: never[]) => unknown>(callback: F): F;
7
+
8
+ export { useEffectEvent };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import "../chunk-MLKGABMK.js";
3
+
4
+ // src/utils/use-effect-event.ts
5
+ import { useCallback, useRef } from "react";
6
+ function useEffectEvent(callback) {
7
+ const ref = useRef(callback);
8
+ ref.current = callback;
9
+ return useCallback((...params) => ref.current(...params), []);
10
+ }
11
+ export {
12
+ useEffectEvent
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.0.6",
3
+ "version": "15.0.7",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -56,6 +56,10 @@
56
56
  "import": "./dist/utils/use-shiki.js",
57
57
  "types": "./dist/utils/use-shiki.d.ts"
58
58
  },
59
+ "./utils/use-effect-event": {
60
+ "import": "./dist/utils/use-effect-event.js",
61
+ "types": "./dist/utils/use-effect-event.d.ts"
62
+ },
59
63
  "./link": {
60
64
  "import": "./dist/link.js",
61
65
  "types": "./dist/link.d.ts"