fumadocs-core 16.0.13 → 16.0.14
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.
|
@@ -2,7 +2,7 @@ import { R as Root, I as Item, F as Folder, S as Separator } from './definitions
|
|
|
2
2
|
import { I18nConfig } from './i18n/index.js';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
interface LoaderPlugin<
|
|
5
|
+
interface LoaderPlugin<Config extends SourceConfig = SourceConfig> {
|
|
6
6
|
name?: string;
|
|
7
7
|
/**
|
|
8
8
|
* Change the order of plugin:
|
|
@@ -18,12 +18,12 @@ interface LoaderPlugin<Page extends PageData = PageData, Meta extends MetaData =
|
|
|
18
18
|
* transform the storage after loading
|
|
19
19
|
*/
|
|
20
20
|
transformStorage?: (context: {
|
|
21
|
-
storage: ContentStorage<
|
|
21
|
+
storage: ContentStorage<Config['pageData'], Config['metaData']>;
|
|
22
22
|
}) => void;
|
|
23
23
|
/**
|
|
24
24
|
* transform the generated page tree
|
|
25
25
|
*/
|
|
26
|
-
transformPageTree?: PageTreeTransformer<
|
|
26
|
+
transformPageTree?: PageTreeTransformer<Config['pageData'], Config['metaData']>;
|
|
27
27
|
}
|
|
28
28
|
declare function buildPlugins(plugins: (LoaderPlugin | LoaderPlugin[] | undefined)[]): LoaderPlugin[];
|
|
29
29
|
|
|
@@ -44,8 +44,8 @@ interface LoaderOptions<S extends SourceConfig = SourceConfig, I18n extends I18n
|
|
|
44
44
|
/**
|
|
45
45
|
* Additional options for page tree builder
|
|
46
46
|
*/
|
|
47
|
-
pageTree?: PageTreeOptions<S
|
|
48
|
-
plugins?: (LoaderPlugin<S
|
|
47
|
+
pageTree?: PageTreeOptions<S>;
|
|
48
|
+
plugins?: (LoaderPlugin<S> | LoaderPlugin<S>[] | undefined)[];
|
|
49
49
|
icon?: IconResolver;
|
|
50
50
|
slugs?: (info: {
|
|
51
51
|
path: string;
|
|
@@ -265,7 +265,7 @@ interface PageTreeTransformer<Page extends PageData = PageData, Meta extends Met
|
|
|
265
265
|
separator?: (this: PageTreeBuilderContext<Page, Meta>, node: Separator) => Separator;
|
|
266
266
|
root?: (this: PageTreeBuilderContext<Page, Meta>, node: Root) => Root;
|
|
267
267
|
}
|
|
268
|
-
interface PageTreeOptions<
|
|
268
|
+
interface PageTreeOptions<Config extends SourceConfig = SourceConfig> {
|
|
269
269
|
id?: string;
|
|
270
270
|
/**
|
|
271
271
|
* Remove references to the file path of original nodes (`$ref`)
|
|
@@ -282,7 +282,7 @@ interface PageTreeOptions<Page extends PageData = PageData, Meta extends MetaDat
|
|
|
282
282
|
/**
|
|
283
283
|
* Additional page tree transformers to apply
|
|
284
284
|
*/
|
|
285
|
-
transformers?: PageTreeTransformer<
|
|
285
|
+
transformers?: PageTreeTransformer<Config['pageData'], Config['metaData']>[];
|
|
286
286
|
}
|
|
287
287
|
interface PageTreeBuilder {
|
|
288
288
|
build: (storage: ContentStorage, options?: PageTreeOptions) => Root;
|
|
@@ -4,15 +4,33 @@ import {
|
|
|
4
4
|
import "../chunk-U67V476Y.js";
|
|
5
5
|
|
|
6
6
|
// src/framework/tanstack.tsx
|
|
7
|
-
import { useMemo } from "react";
|
|
8
|
-
import {
|
|
7
|
+
import { useRef, useMemo } from "react";
|
|
8
|
+
import {
|
|
9
|
+
useParams,
|
|
10
|
+
Link,
|
|
11
|
+
useRouter,
|
|
12
|
+
useRouterState
|
|
13
|
+
} from "@tanstack/react-router";
|
|
9
14
|
import { jsx } from "react/jsx-runtime";
|
|
10
15
|
var framework = {
|
|
11
|
-
Link({ href, prefetch, ...props }) {
|
|
16
|
+
Link({ href, prefetch = true, ...props }) {
|
|
12
17
|
return /* @__PURE__ */ jsx(Link, { to: href, preload: prefetch ? "intent" : false, ...props, children: props.children });
|
|
13
18
|
},
|
|
14
19
|
usePathname() {
|
|
15
|
-
|
|
20
|
+
const { isLoading, pathname } = useRouterState({
|
|
21
|
+
select: (state) => ({
|
|
22
|
+
isLoading: state.isLoading,
|
|
23
|
+
pathname: state.location.pathname
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
const activePathname = useRef(pathname);
|
|
27
|
+
return useMemo(() => {
|
|
28
|
+
if (isLoading) {
|
|
29
|
+
return activePathname.current;
|
|
30
|
+
}
|
|
31
|
+
activePathname.current = pathname;
|
|
32
|
+
return pathname;
|
|
33
|
+
}, [isLoading, pathname]);
|
|
16
34
|
},
|
|
17
35
|
useRouter() {
|
|
18
36
|
const router = useRouter();
|
package/dist/search/server.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { StructuredData } from '../mdx-plugins/remark-structure.js';
|
|
|
3
3
|
import { SortedResult } from './index.js';
|
|
4
4
|
export { HighlightedText, ReactSortedResult, createContentHighlighter } from './index.js';
|
|
5
5
|
import { I18nConfig } from '../i18n/index.js';
|
|
6
|
-
import { k as LoaderOutput, f as LoaderConfig, I as InferPageType } from '../builder-
|
|
6
|
+
import { k as LoaderOutput, f as LoaderConfig, I as InferPageType } from '../builder-W853MYyx.js';
|
|
7
7
|
import 'mdast';
|
|
8
8
|
import 'unified';
|
|
9
9
|
import 'mdast-util-mdx-jsx';
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ContentStorage, F as FileSystem, t as InferMetaType, I as InferPageType, f as LoaderConfig, g as LoaderOptions, k as LoaderOutput, L as LoaderPlugin, j as Meta, p as MetaData, M as MetaFile, i as Page, q as PageData, e as PageFile, a as PageTreeBuilder, b as PageTreeBuilderContext, d as PageTreeOptions, P as PageTreeTransformer, R as ResolvedLoaderConfig, h as Source, S as SourceConfig, U as UrlFn, s as VirtualFile, r as VirtualMeta, V as VirtualPage, _ as _ConfigUnion_, u as buildPlugins, l as createGetUrl, c as createPageTreeBuilder, m as loader, o as map, n as multiple } from '../builder-
|
|
1
|
+
export { C as ContentStorage, F as FileSystem, t as InferMetaType, I as InferPageType, f as LoaderConfig, g as LoaderOptions, k as LoaderOutput, L as LoaderPlugin, j as Meta, p as MetaData, M as MetaFile, i as Page, q as PageData, e as PageFile, a as PageTreeBuilder, b as PageTreeBuilderContext, d as PageTreeOptions, P as PageTreeTransformer, R as ResolvedLoaderConfig, h as Source, S as SourceConfig, U as UrlFn, s as VirtualFile, r as VirtualMeta, V as VirtualPage, _ as _ConfigUnion_, u as buildPlugins, l as createGetUrl, c as createPageTreeBuilder, m as loader, o as map, n as multiple } from '../builder-W853MYyx.js';
|
|
2
2
|
import '../definitions-DbCug1P3.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../i18n/index.js';
|