fumadocs-core 15.2.3 → 15.2.5
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/dist/highlight/index.d.ts +5 -3
- package/dist/server/index.d.ts +5 -1
- package/dist/server/index.js +23 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +2 -2
- package/package.json +3 -3
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { CodeToHastOptionsCommon, BundledLanguage,
|
|
1
|
+
import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, RegexEngine, CodeOptionsThemes, ShikiTransformer } from 'shiki';
|
|
2
2
|
import { BundledTheme } from 'shiki/themes';
|
|
3
3
|
import { Components } from 'hast-util-to-jsx-runtime';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
declare function createStyleTransformer(): ShikiTransformer;
|
|
7
|
-
type
|
|
7
|
+
type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
|
|
8
8
|
engine?: Awaitable<RegexEngine>;
|
|
9
9
|
components?: Partial<Components>;
|
|
10
10
|
};
|
|
11
|
+
type HighlightOptionsThemes = CodeOptionsThemes<BundledTheme>;
|
|
12
|
+
type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Record<never, never>);
|
|
11
13
|
declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
|
|
12
14
|
|
|
13
|
-
export { type HighlightOptions, createStyleTransformer, highlight };
|
|
15
|
+
export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, createStyleTransformer, highlight };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
|
|
|
28
28
|
* Separate the folder nodes of a root into multiple roots
|
|
29
29
|
*/
|
|
30
30
|
declare function separatePageTree(pageTree: Root): Root[];
|
|
31
|
+
/**
|
|
32
|
+
* Get other page tree nodes that lives under the same parent
|
|
33
|
+
*/
|
|
34
|
+
declare function getPageTreePeers(tree: Root, url: string): Item[];
|
|
31
35
|
|
|
32
36
|
interface GetGithubLastCommitOptions {
|
|
33
37
|
/**
|
|
@@ -110,4 +114,4 @@ declare function createMetadataImage<S extends LoaderOutput<LoaderConfig>>(optio
|
|
|
110
114
|
}) => Response | Promise<Response>) => (request: NextRequest, options: any) => Response | Promise<Response>;
|
|
111
115
|
};
|
|
112
116
|
|
|
113
|
-
export { type GetGithubLastCommitOptions, createMetadataImage, findNeighbour, flattenTree, getGithubLastEdit, getPageTreeRoots, separatePageTree };
|
|
117
|
+
export { type GetGithubLastCommitOptions, createMetadataImage, findNeighbour, flattenTree, getGithubLastEdit, getPageTreePeers, getPageTreeRoots, separatePageTree };
|
package/dist/server/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function getTableOfContents(content, remarkPlugins) {
|
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
// src/
|
|
20
|
+
// src/utils/page-tree.tsx
|
|
21
21
|
function flattenTree(tree) {
|
|
22
22
|
return tree.flatMap((node) => {
|
|
23
23
|
if (node.type === "separator") return [];
|
|
@@ -67,6 +67,27 @@ function separatePageTree(pageTree) {
|
|
|
67
67
|
};
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
function getPageTreePeers(tree, url) {
|
|
71
|
+
const parent = findParentFromTree(tree, url);
|
|
72
|
+
if (!parent) return [];
|
|
73
|
+
return parent.children.filter(
|
|
74
|
+
(item) => item.type === "page" && item.url !== url
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function findParentFromTree(node, url) {
|
|
78
|
+
if ("index" in node && node.index?.url === url) {
|
|
79
|
+
return node;
|
|
80
|
+
}
|
|
81
|
+
for (const child of node.children) {
|
|
82
|
+
if (child.type === "folder") {
|
|
83
|
+
const parent = findParentFromTree(child, url);
|
|
84
|
+
if (parent) return parent;
|
|
85
|
+
}
|
|
86
|
+
if (child.type === "page" && child.url === url) {
|
|
87
|
+
return node;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
70
91
|
|
|
71
92
|
// src/server/page-tree.ts
|
|
72
93
|
var page_tree_exports = {};
|
|
@@ -174,6 +195,7 @@ export {
|
|
|
174
195
|
findNeighbour,
|
|
175
196
|
flattenTree,
|
|
176
197
|
getGithubLastEdit,
|
|
198
|
+
getPageTreePeers,
|
|
177
199
|
getPageTreeRoots,
|
|
178
200
|
getTableOfContents,
|
|
179
201
|
separatePageTree
|
package/dist/sidebar.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type SidebarContentProps<T extends ElementType> = AsProps<T> & {
|
|
|
24
24
|
*
|
|
25
25
|
* When the sidebar is opening and media query is matched, scrolling outside the sidebar will be blocked.
|
|
26
26
|
*
|
|
27
|
-
* @example (
|
|
27
|
+
* @example (max-width: 1000px)
|
|
28
28
|
*/
|
|
29
29
|
removeScrollOn?: string;
|
|
30
30
|
};
|
package/dist/sidebar.js
CHANGED
|
@@ -54,7 +54,7 @@ function SidebarTrigger({
|
|
|
54
54
|
function SidebarList({
|
|
55
55
|
as,
|
|
56
56
|
blockScrollingWidth,
|
|
57
|
-
removeScrollOn = blockScrollingWidth ? `(
|
|
57
|
+
removeScrollOn = blockScrollingWidth ? `(width < ${blockScrollingWidth}px)` : void 0,
|
|
58
58
|
...props
|
|
59
59
|
}) {
|
|
60
60
|
const { open } = useSidebarContext();
|
|
@@ -63,7 +63,7 @@ function SidebarList({
|
|
|
63
63
|
if (!removeScrollOn) return;
|
|
64
64
|
const mediaQueryList = window.matchMedia(removeScrollOn);
|
|
65
65
|
const handleChange = () => {
|
|
66
|
-
setIsBlocking(
|
|
66
|
+
setIsBlocking(mediaQueryList.matches);
|
|
67
67
|
};
|
|
68
68
|
handleChange();
|
|
69
69
|
mediaQueryList.addEventListener("change", handleChange);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.5",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
110
110
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
111
111
|
"next": "^15.2.4",
|
|
112
|
-
"react-router": "^7.
|
|
112
|
+
"react-router": "^7.5.0",
|
|
113
113
|
"remark-mdx": "^3.1.0",
|
|
114
114
|
"remark-rehype": "^11.1.2",
|
|
115
|
-
"typescript": "^5.8.
|
|
115
|
+
"typescript": "^5.8.3",
|
|
116
116
|
"unified": "^11.0.5",
|
|
117
117
|
"vfile": "^6.0.3",
|
|
118
118
|
"eslint-config-custom": "0.0.0",
|