fumadocs-core 15.4.1 → 15.4.2
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.
|
@@ -4,13 +4,6 @@ function isDifferent(a, b) {
|
|
|
4
4
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
5
5
|
return b.length !== a.length || a.some((v, i) => isDifferent(v, b[i]));
|
|
6
6
|
}
|
|
7
|
-
if (typeof a === "object" && a && typeof b === "object" && b) {
|
|
8
|
-
const aKeys = Object.keys(a);
|
|
9
|
-
const bKeys = Object.keys(b);
|
|
10
|
-
return aKeys.length !== bKeys.length || aKeys.some(
|
|
11
|
-
(key) => isDifferent(a[key], b[key])
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
7
|
return a !== b;
|
|
15
8
|
}
|
|
16
9
|
function useOnChange(value, onChange, isUpdated = isDifferent) {
|
package/dist/search/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useOnChange
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-EMWGTXSW.js";
|
|
4
4
|
import "../chunk-MLKGABMK.js";
|
|
5
5
|
|
|
6
6
|
// src/search/client.ts
|
|
@@ -24,6 +24,19 @@ function useDebounce(value, delayMs = 1e3) {
|
|
|
24
24
|
|
|
25
25
|
// src/search/client.ts
|
|
26
26
|
var staticClient;
|
|
27
|
+
function isDifferentDeep(a, b) {
|
|
28
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
29
|
+
return b.length !== a.length || a.some((v, i) => isDifferentDeep(v, b[i]));
|
|
30
|
+
}
|
|
31
|
+
if (typeof a === "object" && a && typeof b === "object" && b) {
|
|
32
|
+
const aKeys = Object.keys(a);
|
|
33
|
+
const bKeys = Object.keys(b);
|
|
34
|
+
return aKeys.length !== bKeys.length || aKeys.some(
|
|
35
|
+
(key) => isDifferentDeep(a[key], b[key])
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return a !== b;
|
|
39
|
+
}
|
|
27
40
|
function useDocsSearch(client, locale, tag, delayMs = 100, allowEmpty = false, key) {
|
|
28
41
|
const [search, setSearch] = useState2("");
|
|
29
42
|
const [results, setResults] = useState2("empty");
|
|
@@ -31,44 +44,48 @@ function useDocsSearch(client, locale, tag, delayMs = 100, allowEmpty = false, k
|
|
|
31
44
|
const [isLoading, setIsLoading] = useState2(false);
|
|
32
45
|
const debouncedValue = useDebounce(search, delayMs);
|
|
33
46
|
const onStart = useRef2(void 0);
|
|
34
|
-
useOnChange(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onStart.current
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let interrupt = false;
|
|
41
|
-
onStart.current = () => {
|
|
42
|
-
interrupt = true;
|
|
43
|
-
};
|
|
44
|
-
async function run() {
|
|
45
|
-
if (debouncedValue.length === 0 && !allowEmpty) return "empty";
|
|
46
|
-
if (client.type === "fetch") {
|
|
47
|
-
const { fetchDocs } = await import("../fetch-W5EHIBOE.js");
|
|
48
|
-
return fetchDocs(debouncedValue, locale, tag, client);
|
|
49
|
-
}
|
|
50
|
-
if (client.type === "algolia") {
|
|
51
|
-
const { searchDocs } = await import("../algolia-RQ5VQJAB.js");
|
|
52
|
-
return searchDocs(debouncedValue, tag, locale, client);
|
|
47
|
+
useOnChange(
|
|
48
|
+
key ?? [client, debouncedValue, locale, tag],
|
|
49
|
+
() => {
|
|
50
|
+
if (onStart.current) {
|
|
51
|
+
onStart.current();
|
|
52
|
+
onStart.current = void 0;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
setIsLoading(true);
|
|
55
|
+
let interrupt = false;
|
|
56
|
+
onStart.current = () => {
|
|
57
|
+
interrupt = true;
|
|
58
|
+
};
|
|
59
|
+
async function run() {
|
|
60
|
+
if (debouncedValue.length === 0 && !allowEmpty) return "empty";
|
|
61
|
+
if (client.type === "fetch") {
|
|
62
|
+
const { fetchDocs } = await import("../fetch-W5EHIBOE.js");
|
|
63
|
+
return fetchDocs(debouncedValue, locale, tag, client);
|
|
64
|
+
}
|
|
65
|
+
if (client.type === "algolia") {
|
|
66
|
+
const { searchDocs } = await import("../algolia-RQ5VQJAB.js");
|
|
67
|
+
return searchDocs(debouncedValue, tag, locale, client);
|
|
68
|
+
}
|
|
69
|
+
if (client.type === "orama-cloud") {
|
|
70
|
+
const { searchDocs } = await import("../orama-cloud-USLSOSXS.js");
|
|
71
|
+
return searchDocs(debouncedValue, tag, client);
|
|
72
|
+
}
|
|
73
|
+
const { createStaticClient } = await import("../static-VESU2S64.js");
|
|
74
|
+
if (!staticClient) staticClient = createStaticClient(client);
|
|
75
|
+
return staticClient.search(debouncedValue, locale, tag);
|
|
57
76
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
});
|
|
77
|
+
void run().then((res) => {
|
|
78
|
+
if (interrupt) return;
|
|
79
|
+
setError(void 0);
|
|
80
|
+
setResults(res);
|
|
81
|
+
}).catch((err) => {
|
|
82
|
+
setError(err);
|
|
83
|
+
}).finally(() => {
|
|
84
|
+
setIsLoading(false);
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
isDifferentDeep
|
|
88
|
+
);
|
|
72
89
|
return { search, setSearch, query: { isLoading, data: results, error } };
|
|
73
90
|
}
|
|
74
91
|
export {
|
package/dist/toc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.2",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@mdx-js/mdx": "^3.1.0",
|
|
103
103
|
"@oramacloud/client": "^2.1.4",
|
|
104
|
-
"@tanstack/react-router": "^1.120.
|
|
104
|
+
"@tanstack/react-router": "^1.120.11",
|
|
105
105
|
"@types/estree-jsx": "^1.0.5",
|
|
106
106
|
"@types/hast": "^3.0.4",
|
|
107
107
|
"@types/mdast": "^4.0.3",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
114
114
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
115
115
|
"next": "^15.3.2",
|
|
116
|
-
"react-router": "^7.6.
|
|
116
|
+
"react-router": "^7.6.1",
|
|
117
117
|
"remark-mdx": "^3.1.0",
|
|
118
118
|
"typescript": "^5.8.3",
|
|
119
119
|
"unified": "^11.0.5",
|