@rspress/core 2.0.21 → 2.0.22
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/cli/index.js +12 -13
- package/dist/config/loadConfigFile.d.ts +3 -4
- package/dist/config/loadConfigFile.js +13 -17
- package/dist/{7748~0.js → d~0.js} +0 -2
- package/dist/eject-theme/components/Llms/LlmsHint.test.tsx +8 -0
- package/dist/eject-theme/components/Llms/LlmsHint.tsx +11 -3
- package/dist/eject-theme/components/Nav/NavMenu.scss +4 -0
- package/dist/eject-theme/components/Nav/NavMenu.tsx +20 -13
- package/dist/eject-theme/components/Nav/index.tsx +30 -4
- package/dist/eject-theme/components/NavHamburger/index.tsx +11 -3
- package/dist/eject-theme/components/NavList/context.ts +3 -0
- package/dist/eject-theme/components/NavList/index.tsx +24 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenu.test.tsx +59 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenu.tsx +43 -2
- package/dist/eject-theme/components/NavScreen/index.scss +0 -6
- package/dist/eject-theme/components/NavScreen/index.tsx +20 -3
- package/dist/eject-theme/components/ReadPercent/useReadPercent.ts +1 -1
- package/dist/eject-theme/components/Search/SearchButton.scss +1 -0
- package/dist/eject-theme/components/Search/SearchPanel.scss +51 -12
- package/dist/eject-theme/components/Search/SearchPanel.tsx +54 -212
- package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +38 -16
- package/dist/eject-theme/components/Search/useSearchPanel.ts +216 -0
- package/dist/eject-theme/components/Steps/index.scss +1 -1
- package/dist/eject-theme/components/SwitchAppearance/getClipPath.test.ts +15 -0
- package/dist/eject-theme/components/SwitchAppearance/getClipPath.ts +26 -0
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +22 -26
- package/dist/eject-theme/components/Tabs/index.tsx +14 -14
- package/dist/index.js +1 -1
- package/dist/node/PluginDriver.d.ts +1 -1
- package/dist/node/PluginDriver.js +5 -9
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +6 -6
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/build.d.ts +3 -2
- package/dist/node/build.js +9 -3
- package/dist/node/constants.js +1 -1
- package/dist/node/dev.d.ts +4 -4
- package/dist/node/dev.js +8 -6
- package/dist/node/eject.js +5 -5
- package/dist/node/initRsbuild.d.ts +2 -3
- package/dist/node/initRsbuild.js +9 -7
- package/dist/node/last-updated/index.js +2 -2
- package/dist/node/logger/hint.js +4 -4
- package/dist/node/mdx/options.js +1 -1
- package/dist/node/mdx/processor.js +3 -3
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +6 -5
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +5 -5
- package/dist/node/mdx/remarkPlugins/image.js +5 -5
- package/dist/node/mdx/remarkPlugins/link.js +5 -5
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +6 -4
- package/dist/node/route/RouteService.js +3 -3
- package/dist/node/route/extractPageData.js +20 -7
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +5 -5
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.d.ts +3 -3
- package/dist/node/serve.js +10 -4
- package/dist/node/ssg/alternateLinks.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.js +1 -1
- package/dist/node/ssg/renderPage.js +5 -5
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +6 -6
- package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
- package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
- package/dist/node/ssg-md/renderPage.js +5 -5
- package/dist/node/ssg-md/renderPages.js +6 -6
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +5 -7
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +4 -4
- package/dist/node/utils/flattenMdxContent.js +2 -2
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/index.d.ts +1 -1
- package/dist/node/utils/reactAlias.js +5 -5
- package/dist/node/utils/slash.d.ts +1 -0
- package/dist/node/utils/slash.js +4 -0
- package/dist/{864~0.js → n~0.js} +41 -41
- package/dist/{2711~0.js → o~0.js} +90 -56
- package/dist/rslib-runtime~0.js +27 -35
- package/dist/theme/components/Link/useLinkNavigate.js +1 -1
- package/dist/theme/components/Llms/LlmsHint.js +23 -6
- package/dist/theme/components/Nav/NavMenu.css +4 -0
- package/dist/theme/components/Nav/NavMenu.d.ts +4 -2
- package/dist/theme/components/Nav/NavMenu.js +17 -9
- package/dist/theme/components/Nav/index.d.ts +7 -1
- package/dist/theme/components/Nav/index.js +13 -4
- package/dist/theme/components/NavHamburger/index.d.ts +2 -1
- package/dist/theme/components/NavHamburger/index.js +8 -2
- package/dist/theme/components/NavList/context.d.ts +1 -0
- package/dist/theme/components/NavList/context.js +3 -0
- package/dist/theme/components/NavList/index.d.ts +6 -0
- package/dist/theme/components/NavList/index.js +17 -0
- package/dist/theme/components/NavScreen/NavScreenMenu.d.ts +3 -2
- package/dist/theme/components/NavScreen/NavScreenMenu.js +42 -6
- package/dist/theme/components/NavScreen/index.css +0 -10
- package/dist/theme/components/NavScreen/index.d.ts +2 -1
- package/dist/theme/components/NavScreen/index.js +11 -3
- package/dist/theme/components/PackageManagerTabs/index.js +2 -2
- package/dist/theme/components/ReadPercent/useReadPercent.js +1 -0
- package/dist/theme/components/Search/SearchButton.css +1 -0
- package/dist/theme/components/Search/SearchPanel.css +47 -9
- package/dist/theme/components/Search/SearchPanel.js +97 -205
- package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +1 -0
- package/dist/theme/components/Search/logic/providers/LocalProvider.js +23 -13
- package/dist/theme/components/Search/logic/search.js +1 -1
- package/dist/theme/components/Search/useSearchPanel.d.ts +23 -0
- package/dist/theme/components/Search/useSearchPanel.js +155 -0
- package/dist/theme/components/Steps/index.css +3 -3
- package/dist/theme/components/SwitchAppearance/getClipPath.d.ts +8 -0
- package/dist/theme/components/SwitchAppearance/getClipPath.js +13 -0
- package/dist/theme/components/SwitchAppearance/index.js +9 -7
- package/dist/theme/components/Tabs/index.js +4 -4
- package/dist/theme/components/Tag/index.js +2 -2
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/layout/DocLayout/index.js +2 -2
- package/dist/theme/layout/Layout/index.js +12 -4
- package/dist/theme/logic/useFullTextSearch.js +6 -1
- package/dist/theme/styles/vars/shiki-vars.css +1 -1
- package/dist/tinypool~0.js +5 -3
- package/dist/{4538~0.js → t~0.js} +2 -2
- package/dist/{8472~0.js → v~0.js} +1 -1
- package/package.json +11 -12
- package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +0 -29
- package/dist/node/utils/normalizePath.d.ts +0 -3
- package/dist/node/utils/normalizePath.js +0 -10
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.d.ts +0 -2
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +0 -30
- package/dist/theme/logic/useHandler.d.ts +0 -6
- package/dist/theme/logic/useHandler.js +0 -7
- /package/dist/{9857~0.js → 4~0.js} +0 -0
- /package/dist/{8016~0.js → i~0.js} +0 -0
- /package/dist/{5357~0.js → r~0.js} +0 -0
- /package/dist/{102~0.js → t2~0.js} +0 -0
- /package/dist/{9940~0.js → tx~0.js} +0 -0
|
@@ -3,6 +3,14 @@ import { Document } from "flexsearch";
|
|
|
3
3
|
import { searchIndexHash } from "virtual-page-data";
|
|
4
4
|
import { LOCAL_INDEX } from "../Provider.js";
|
|
5
5
|
import { normalizeTextCase } from "../util.js";
|
|
6
|
+
function getSearchIndexURL(lang, version) {
|
|
7
|
+
const searchIndexGroupID = `${version ?? ''}###${lang ?? ''}`;
|
|
8
|
+
const searchIndexHashValue = searchIndexHash[searchIndexGroupID];
|
|
9
|
+
if (!searchIndexHashValue) return;
|
|
10
|
+
const searchIndexVersion = version ? `.${version.replace('.', '_')}` : '';
|
|
11
|
+
const searchIndexLang = lang ? `.${lang}` : '';
|
|
12
|
+
return `${removeTrailingSlash(__webpack_public_path__)}/static/${SEARCH_INDEX_NAME}${searchIndexVersion}${searchIndexLang}.${searchIndexHashValue}.json`;
|
|
13
|
+
}
|
|
6
14
|
const cjkRegex = /[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]|[\u4E00-\u9FCC\u3400-\u4DB5\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\ud840-\ud868][\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|[\ud86a-\ud86c][\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d]|[\u3041-\u3096]|[\u30A1-\u30FA]/giu;
|
|
7
15
|
const cyrillicRegex = /[\u0400-\u04FF]/g;
|
|
8
16
|
function tokenize(str, regex) {
|
|
@@ -20,23 +28,20 @@ class LocalProvider {
|
|
|
20
28
|
#cyrillicIndex;
|
|
21
29
|
#fetchPromise;
|
|
22
30
|
async #getPages(lang, version) {
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
const searchIndexVersion = version ? `.${version.replace('.', '_')}` : '';
|
|
26
|
-
const searchIndexLang = lang ? `.${lang}` : '';
|
|
27
|
-
const searchIndexURL = `${removeTrailingSlash(__webpack_public_path__)}/static/${SEARCH_INDEX_NAME}${searchIndexVersion}${searchIndexLang}.${searchIndexHash[searchIndexGroupID]}.json`;
|
|
31
|
+
const searchIndexURL = getSearchIndexURL(lang, version);
|
|
32
|
+
if (!searchIndexURL) return [];
|
|
28
33
|
const handleError = (result)=>{
|
|
29
34
|
console.error('Failed to fetch search index, please reload the page and try again.');
|
|
30
35
|
console.error(result);
|
|
36
|
+
throw result instanceof Error ? result : new Error('Failed to fetch search index');
|
|
31
37
|
};
|
|
32
38
|
try {
|
|
33
39
|
const result = await fetch(searchIndexURL);
|
|
34
40
|
if (result.ok) return result.json();
|
|
35
|
-
|
|
41
|
+
throw result;
|
|
36
42
|
} catch (error) {
|
|
37
|
-
handleError(error);
|
|
43
|
+
return handleError(error);
|
|
38
44
|
}
|
|
39
|
-
return [];
|
|
40
45
|
}
|
|
41
46
|
async fetchSearchIndex(options) {
|
|
42
47
|
if (this.#fetchPromise) return this.#fetchPromise;
|
|
@@ -65,7 +70,12 @@ class LocalProvider {
|
|
|
65
70
|
},
|
|
66
71
|
cache: 100
|
|
67
72
|
};
|
|
68
|
-
this.#index = new Document(
|
|
73
|
+
this.#index = new Document({
|
|
74
|
+
...createOptions,
|
|
75
|
+
encoder: {
|
|
76
|
+
maxlength: 64
|
|
77
|
+
}
|
|
78
|
+
});
|
|
69
79
|
this.#cjkIndex = new Document({
|
|
70
80
|
...createOptions,
|
|
71
81
|
encoder: {
|
|
@@ -78,12 +88,12 @@ class LocalProvider {
|
|
|
78
88
|
finalize: (str)=>str.flatMap((s)=>tokenize(s, cyrillicRegex))
|
|
79
89
|
}
|
|
80
90
|
});
|
|
91
|
+
const pending = [];
|
|
81
92
|
for (const item of pagesForSearch){
|
|
82
93
|
const flexSearchItem = item;
|
|
83
|
-
this.#index.addAsync(item.routePath, flexSearchItem);
|
|
84
|
-
this.#cjkIndex.addAsync(item.routePath, flexSearchItem);
|
|
85
|
-
this.#cyrillicIndex.addAsync(item.routePath, flexSearchItem);
|
|
94
|
+
pending.push(this.#index.addAsync(item.routePath, flexSearchItem), this.#cjkIndex.addAsync(item.routePath, flexSearchItem), this.#cyrillicIndex.addAsync(item.routePath, flexSearchItem));
|
|
86
95
|
}
|
|
96
|
+
await Promise.all(pending);
|
|
87
97
|
}
|
|
88
98
|
async search(query) {
|
|
89
99
|
const { keyword, limit } = query;
|
|
@@ -122,4 +132,4 @@ class LocalProvider {
|
|
|
122
132
|
];
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
|
-
export { LocalProvider };
|
|
135
|
+
export { LocalProvider, getSearchIndexURL };
|
|
@@ -110,7 +110,7 @@ class PageSearcher {
|
|
|
110
110
|
const getCurrentHeader = (currentIndex)=>{
|
|
111
111
|
const currentHeaderIndex = headersIndex.findIndex((hIndex, position)=>{
|
|
112
112
|
if (!(position < toc.length - 1)) return hIndex < currentIndex;
|
|
113
|
-
{
|
|
113
|
+
else {
|
|
114
114
|
const next = headersIndex[position + 1];
|
|
115
115
|
if (hIndex <= currentIndex && next >= currentIndex) return true;
|
|
116
116
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { MatchResult } from './logic/types.js';
|
|
3
|
+
import { RenderType } from './logic/types.js';
|
|
4
|
+
export declare function useSearchPanel({ focused, searchInputRef, }: {
|
|
5
|
+
focused: boolean;
|
|
6
|
+
searchInputRef: RefObject<HTMLInputElement | null>;
|
|
7
|
+
}): {
|
|
8
|
+
searchEnabled: boolean;
|
|
9
|
+
clearQuery: () => void;
|
|
10
|
+
currentRenderType: RenderType;
|
|
11
|
+
currentSuggestions: import("./logic/types.js").DefaultMatchResultItem[];
|
|
12
|
+
handleQueryInput: (value: string) => void;
|
|
13
|
+
initStatus: "error" | "inited" | "initial" | "initing";
|
|
14
|
+
isSearching: boolean;
|
|
15
|
+
resultTabIndex: number;
|
|
16
|
+
searchError: string | undefined;
|
|
17
|
+
searchIndexURL: string | undefined;
|
|
18
|
+
searchResult: MatchResult;
|
|
19
|
+
query: string;
|
|
20
|
+
currentSuggestionIndex: number;
|
|
21
|
+
setCurrentSuggestionIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
22
|
+
setResultTabIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { usePageData } from "@rspress/core/runtime";
|
|
2
|
+
import { debounce } from "@rspress/shared/lodash-es";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { getSearchIndexURL } from "./logic/providers/LocalProvider.js";
|
|
5
|
+
import { PageSearcher } from "./logic/search.js";
|
|
6
|
+
import { RenderType } from "./logic/types.js";
|
|
7
|
+
import * as __rspack_external_virtual_search_hooks_705b6e40 from "virtual-search-hooks";
|
|
8
|
+
const useDebounce = (cb)=>{
|
|
9
|
+
const cbRef = useRef(cb);
|
|
10
|
+
cbRef.current = cb;
|
|
11
|
+
return useCallback(debounce((...args)=>cbRef.current(...args), 150), []);
|
|
12
|
+
};
|
|
13
|
+
function useSearchPanel({ focused, searchInputRef }) {
|
|
14
|
+
const { siteData, page: { lang, version } } = usePageData();
|
|
15
|
+
const { search, title: siteTitle } = siteData;
|
|
16
|
+
const [query, setQuery] = useState('');
|
|
17
|
+
const [searchResult, setSearchResult] = useState([]);
|
|
18
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
19
|
+
const [resultTabIndex, setResultTabIndex] = useState(0);
|
|
20
|
+
const [currentSuggestionIndex, setCurrentSuggestionIndex] = useState(0);
|
|
21
|
+
const [initStatus, setInitStatus] = useState('initial');
|
|
22
|
+
const [searchError, setSearchError] = useState();
|
|
23
|
+
const pageSearcherRef = useRef(null);
|
|
24
|
+
const pageSearcherConfigRef = useRef(null);
|
|
25
|
+
const searchEnabled = false !== search;
|
|
26
|
+
const searchOptions = false === search ? {} : search;
|
|
27
|
+
const versionedSearch = searchEnabled && (search?.versioned ?? true);
|
|
28
|
+
const searchIndexURL = searchEnabled ? getSearchIndexURL(lang, versionedSearch ? version : '') : void 0;
|
|
29
|
+
const DEFAULT_RESULT = [
|
|
30
|
+
{
|
|
31
|
+
group: siteTitle,
|
|
32
|
+
result: [],
|
|
33
|
+
renderType: RenderType.Default
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const createSearcher = ()=>{
|
|
37
|
+
if (pageSearcherRef.current) return pageSearcherRef.current;
|
|
38
|
+
const pageSearcherConfig = {
|
|
39
|
+
currentLang: lang,
|
|
40
|
+
currentVersion: version
|
|
41
|
+
};
|
|
42
|
+
const pageSearcher = new PageSearcher({
|
|
43
|
+
indexName: siteTitle,
|
|
44
|
+
...searchOptions,
|
|
45
|
+
...pageSearcherConfig
|
|
46
|
+
});
|
|
47
|
+
pageSearcherRef.current = pageSearcher;
|
|
48
|
+
pageSearcherConfigRef.current = pageSearcherConfig;
|
|
49
|
+
return pageSearcher;
|
|
50
|
+
};
|
|
51
|
+
const initSearch = async ()=>{
|
|
52
|
+
if ('initial' !== initStatus) return;
|
|
53
|
+
const searcher = createSearcher();
|
|
54
|
+
setSearchError(void 0);
|
|
55
|
+
setInitStatus('initing');
|
|
56
|
+
try {
|
|
57
|
+
await searcher.init();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (pageSearcherRef.current !== searcher) return;
|
|
60
|
+
setSearchError(error instanceof Error ? error.message : String(error));
|
|
61
|
+
setInitStatus('error');
|
|
62
|
+
setIsSearching(false);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (pageSearcherRef.current !== searcher) return;
|
|
66
|
+
setInitStatus('inited');
|
|
67
|
+
const currentQuery = searchInputRef.current?.value;
|
|
68
|
+
if (currentQuery) {
|
|
69
|
+
const matched = await searcher.match(currentQuery);
|
|
70
|
+
if (pageSearcherRef.current !== searcher || searchInputRef.current?.value !== currentQuery) return;
|
|
71
|
+
setSearchResult(matched || DEFAULT_RESULT);
|
|
72
|
+
setIsSearching(false);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
useEffect(()=>{
|
|
76
|
+
if (!searchEnabled) return;
|
|
77
|
+
if (focused) {
|
|
78
|
+
setSearchResult(DEFAULT_RESULT);
|
|
79
|
+
initSearch();
|
|
80
|
+
} else setQuery('');
|
|
81
|
+
}, [
|
|
82
|
+
focused,
|
|
83
|
+
searchEnabled
|
|
84
|
+
]);
|
|
85
|
+
useEffect(()=>{
|
|
86
|
+
if (!searchEnabled) return;
|
|
87
|
+
const { currentLang, currentVersion } = pageSearcherConfigRef.current ?? {};
|
|
88
|
+
const isLangChanged = lang !== currentLang;
|
|
89
|
+
const isVersionChanged = versionedSearch && version !== currentVersion;
|
|
90
|
+
if (isLangChanged || isVersionChanged) {
|
|
91
|
+
setInitStatus('initial');
|
|
92
|
+
setSearchError(void 0);
|
|
93
|
+
setIsSearching(false);
|
|
94
|
+
pageSearcherRef.current = null;
|
|
95
|
+
createSearcher().fetchSearchIndex().catch(()=>{});
|
|
96
|
+
}
|
|
97
|
+
}, [
|
|
98
|
+
lang,
|
|
99
|
+
version,
|
|
100
|
+
versionedSearch,
|
|
101
|
+
searchEnabled
|
|
102
|
+
]);
|
|
103
|
+
const handleQueryChangedImpl = async (value)=>{
|
|
104
|
+
let newQuery = value;
|
|
105
|
+
setQuery(newQuery);
|
|
106
|
+
if (!newQuery) return void setIsSearching(false);
|
|
107
|
+
const result = [];
|
|
108
|
+
if ("beforeSearch" in __rspack_external_virtual_search_hooks_705b6e40) {
|
|
109
|
+
const transformedQuery = await __rspack_external_virtual_search_hooks_705b6e40.beforeSearch(newQuery);
|
|
110
|
+
if (transformedQuery) newQuery = transformedQuery;
|
|
111
|
+
}
|
|
112
|
+
const defaultSearchResult = await pageSearcherRef.current?.match(newQuery);
|
|
113
|
+
if (defaultSearchResult) result.push(...defaultSearchResult);
|
|
114
|
+
if ("onSearch" in __rspack_external_virtual_search_hooks_705b6e40) {
|
|
115
|
+
const customSearchResult = await __rspack_external_virtual_search_hooks_705b6e40.onSearch(newQuery, result);
|
|
116
|
+
if (customSearchResult) result.push(...customSearchResult.map((item)=>({
|
|
117
|
+
renderType: RenderType.Custom,
|
|
118
|
+
...item
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
121
|
+
if ("afterSearch" in __rspack_external_virtual_search_hooks_705b6e40) await __rspack_external_virtual_search_hooks_705b6e40.afterSearch(newQuery, result);
|
|
122
|
+
if (searchInputRef.current?.value === newQuery) {
|
|
123
|
+
setCurrentSuggestionIndex(0);
|
|
124
|
+
setSearchResult(result || DEFAULT_RESULT);
|
|
125
|
+
setIsSearching(false);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const handleQueryChange = useDebounce(handleQueryChangedImpl);
|
|
129
|
+
const handleQueryInput = (value)=>{
|
|
130
|
+
setIsSearching(Boolean(value));
|
|
131
|
+
handleQueryChange(value);
|
|
132
|
+
};
|
|
133
|
+
const clearQuery = ()=>{
|
|
134
|
+
setQuery('');
|
|
135
|
+
setIsSearching(false);
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
searchEnabled,
|
|
139
|
+
clearQuery,
|
|
140
|
+
currentRenderType: searchResult[resultTabIndex]?.renderType ?? RenderType.Default,
|
|
141
|
+
currentSuggestions: searchResult[resultTabIndex]?.result ?? [],
|
|
142
|
+
handleQueryInput,
|
|
143
|
+
initStatus,
|
|
144
|
+
isSearching,
|
|
145
|
+
resultTabIndex,
|
|
146
|
+
searchError,
|
|
147
|
+
searchIndexURL,
|
|
148
|
+
searchResult,
|
|
149
|
+
query,
|
|
150
|
+
currentSuggestionIndex,
|
|
151
|
+
setCurrentSuggestionIndex,
|
|
152
|
+
setResultTabIndex
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export { useSearchPanel };
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
margin-left: 1rem;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.rp-steps h3 {
|
|
15
|
+
.rp-steps > :is(h2, h3, h4, h5, h6) {
|
|
16
16
|
counter-increment: step;
|
|
17
17
|
min-height: var(--rp-steps-size);
|
|
18
18
|
margin-top: 0;
|
|
19
19
|
position: relative;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.rp-steps h3:before {
|
|
22
|
+
.rp-steps > :is(h2, h3, h4, h5, h6):before {
|
|
23
23
|
content: counter(step);
|
|
24
24
|
top: calc(var(--rp-steps-size)/2 + var(--rp-steps-offset-y));
|
|
25
25
|
left: calc(-1*var(--rp-steps-gap));
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
transform: translate(-50%, -50%);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.rp-steps h3 .rp-header-anchor {
|
|
43
|
+
.rp-steps > :is(h2, h3, h4, h5, h6) .rp-header-anchor {
|
|
44
44
|
top: calc(var(--rp-steps-size)/2 + var(--rp-steps-offset-y));
|
|
45
45
|
left: calc(-1*var(--rp-steps-gap) - var(--rp-steps-size)/2);
|
|
46
46
|
position: absolute;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const roundPercentage = (value)=>Math.round(1e6 * value) / 1e6;
|
|
2
|
+
const getClipPath = ({ height, width, x, y })=>{
|
|
3
|
+
const endRadius = Math.hypot(Math.max(x, width - x + 200), Math.max(y, height - y + 200));
|
|
4
|
+
const normalizedDiagonal = Math.hypot(width, height) / Math.SQRT2;
|
|
5
|
+
const xPercentage = roundPercentage(x / width * 100);
|
|
6
|
+
const yPercentage = roundPercentage(y / height * 100);
|
|
7
|
+
const endRadiusPercentage = roundPercentage(endRadius / normalizedDiagonal * 100);
|
|
8
|
+
return [
|
|
9
|
+
`circle(0% at ${xPercentage}% ${yPercentage}%)`,
|
|
10
|
+
`circle(${endRadiusPercentage}% at ${xPercentage}% ${yPercentage}%)`
|
|
11
|
+
];
|
|
12
|
+
};
|
|
13
|
+
export { getClipPath };
|
|
@@ -5,6 +5,7 @@ import { useContext } from "react";
|
|
|
5
5
|
import "./global.css";
|
|
6
6
|
import "./index.css";
|
|
7
7
|
import { flushSync } from "react-dom";
|
|
8
|
+
import { getClipPath } from "./getClipPath.js";
|
|
8
9
|
const supportAppearanceTransition = ()=>'function' == typeof document?.startViewTransition && !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
9
10
|
const removeClipViewTransition = ()=>{
|
|
10
11
|
document.documentElement.classList.add('rp-appearance-transition');
|
|
@@ -23,7 +24,6 @@ function SwitchAppearance({ onClick }) {
|
|
|
23
24
|
if (supported && enabled) {
|
|
24
25
|
const x = event.clientX;
|
|
25
26
|
const y = event.clientY;
|
|
26
|
-
const endRadius = Math.hypot(Math.max(x, innerWidth - x + 200), Math.max(y, innerHeight - y + 200));
|
|
27
27
|
const dispose = removeClipViewTransition();
|
|
28
28
|
const transition = document.startViewTransition(async ()=>{
|
|
29
29
|
flushSync(()=>{
|
|
@@ -31,10 +31,12 @@ function SwitchAppearance({ onClick }) {
|
|
|
31
31
|
onClick?.();
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
const clipPath =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const clipPath = getClipPath({
|
|
35
|
+
height: innerHeight,
|
|
36
|
+
width: innerWidth,
|
|
37
|
+
x,
|
|
38
|
+
y
|
|
39
|
+
});
|
|
38
40
|
transition.ready.then(()=>{
|
|
39
41
|
document.documentElement.animate({
|
|
40
42
|
clipPath: isDark ? [
|
|
@@ -43,12 +45,12 @@ function SwitchAppearance({ onClick }) {
|
|
|
43
45
|
}, {
|
|
44
46
|
duration: 400,
|
|
45
47
|
easing: 'ease-in',
|
|
48
|
+
fill: 'both',
|
|
46
49
|
pseudoElement: isDark ? '::view-transition-old(root)' : '::view-transition-new(root)',
|
|
47
50
|
id: ''
|
|
48
|
-
}).finished.then(()=>{
|
|
49
|
-
dispose();
|
|
50
51
|
});
|
|
51
52
|
});
|
|
53
|
+
transition.finished.then(dispose, dispose);
|
|
52
54
|
} else {
|
|
53
55
|
setTheme(nextTheme);
|
|
54
56
|
onClick?.();
|
|
@@ -32,6 +32,10 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
32
32
|
children,
|
|
33
33
|
values
|
|
34
34
|
]);
|
|
35
|
+
const defaultValueIndex = void 0 !== defaultValue ? tabValues.findIndex((item)=>item.value === defaultValue) : -1;
|
|
36
|
+
const initialActiveIndex = -1 === defaultValueIndex ? defaultIndex ?? 0 : defaultValueIndex;
|
|
37
|
+
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
38
|
+
const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, initialActiveIndex.toString());
|
|
35
39
|
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
|
|
36
40
|
children: tabValues.map(({ label, content })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
37
41
|
children: [
|
|
@@ -41,10 +45,6 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
41
45
|
]
|
|
42
46
|
}))
|
|
43
47
|
});
|
|
44
|
-
const defaultValueIndex = void 0 !== defaultValue ? tabValues.findIndex((item)=>item.value === defaultValue) : -1;
|
|
45
|
-
const initialActiveIndex = -1 === defaultValueIndex ? defaultIndex ?? 0 : defaultValueIndex;
|
|
46
|
-
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
47
|
-
const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, initialActiveIndex.toString());
|
|
48
48
|
const currentIndex = groupId ? Number(storageIndex) : activeIndex;
|
|
49
49
|
return /*#__PURE__*/ jsxs("div", {
|
|
50
50
|
className: clsx('rp-tabs', className),
|
|
@@ -62,7 +62,7 @@ const Tag_Tag = ({ tag })=>{
|
|
|
62
62
|
})
|
|
63
63
|
]
|
|
64
64
|
});
|
|
65
|
-
if ('deprecated' === normalizedTag) return /*#__PURE__*/ jsxs(Badge, {
|
|
65
|
+
else if ('deprecated' === normalizedTag) return /*#__PURE__*/ jsxs(Badge, {
|
|
66
66
|
type: "danger",
|
|
67
67
|
children: [
|
|
68
68
|
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
@@ -73,7 +73,7 @@ const Tag_Tag = ({ tag })=>{
|
|
|
73
73
|
})
|
|
74
74
|
]
|
|
75
75
|
});
|
|
76
|
-
if ('new' === normalizedTag) return /*#__PURE__*/ jsx(Badge, {
|
|
76
|
+
else if ('new' === normalizedTag) return /*#__PURE__*/ jsx(Badge, {
|
|
77
77
|
text: "new",
|
|
78
78
|
type: "tip"
|
|
79
79
|
});
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { LlmsContainer, type LlmsContainerProps, LlmsCopyButton, type LlmsCopyBu
|
|
|
25
25
|
export { LlmsCopyRow } from './components/Llms/LlmsCopyRow.js';
|
|
26
26
|
export { LlmsOpenRow } from './components/Llms/LlmsOpenRow.js';
|
|
27
27
|
export { Nav, type NavProps } from './components/Nav/index.js';
|
|
28
|
+
export { NavList, type NavListProps } from './components/NavList/index.js';
|
|
28
29
|
export { NavHamburger } from './components/NavHamburger/index.js';
|
|
29
30
|
export { NavTitle } from './components/NavTitle/index.js';
|
|
30
31
|
export { Outline } from './components/Outline/index.js';
|
package/dist/theme/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { LlmsContainer, LlmsCopyButton, LlmsHint, LlmsViewOptions, useMdUrl } fr
|
|
|
25
25
|
export { LlmsCopyRow } from "./components/Llms/LlmsCopyRow.js";
|
|
26
26
|
export { LlmsOpenRow } from "./components/Llms/LlmsOpenRow.js";
|
|
27
27
|
export { Nav } from "./components/Nav/index.js";
|
|
28
|
+
export { NavList } from "./components/NavList/index.js";
|
|
28
29
|
export { NavHamburger } from "./components/NavHamburger/index.js";
|
|
29
30
|
export { NavTitle } from "./components/NavTitle/index.js";
|
|
30
31
|
export { Outline } from "./components/Outline/index.js";
|
|
@@ -7,6 +7,8 @@ import "./index.css";
|
|
|
7
7
|
function DocLayout(props) {
|
|
8
8
|
const { beforeDocFooter, afterDocFooter, beforeDoc, afterDoc, beforeDocContent, afterDocContent, beforeOutline, afterOutline, beforeSidebar, afterSidebar, components } = props;
|
|
9
9
|
const { frontmatter } = useFrontmatter();
|
|
10
|
+
const { isOutlineOpen, isSidebarOpen, sidebarMenu, asideLayoutRef, sidebarLayoutRef } = useSidebarMenu(beforeOutline, afterOutline);
|
|
11
|
+
const { rspressDocRef } = useWatchToc();
|
|
10
12
|
const isOverviewPage = frontmatter?.overview ?? false;
|
|
11
13
|
const sidebar = frontmatter?.sidebar ?? true;
|
|
12
14
|
const showSidebar = true === sidebar;
|
|
@@ -25,8 +27,6 @@ function DocLayout(props) {
|
|
|
25
27
|
})
|
|
26
28
|
});
|
|
27
29
|
const isDocWide = 'doc-wide' === pageType;
|
|
28
|
-
const { isOutlineOpen, isSidebarOpen, sidebarMenu, asideLayoutRef, sidebarLayoutRef } = useSidebarMenu(beforeOutline, afterOutline);
|
|
29
|
-
const { rspressDocRef } = useWatchToc();
|
|
30
30
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
31
31
|
children: [
|
|
32
32
|
showSidebarMenu && /*#__PURE__*/ jsx("div", {
|
|
@@ -58,8 +58,13 @@ const HeadTags = /*#__PURE__*/ memo((props)=>{
|
|
|
58
58
|
children: frontmatterTags ?? null
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
const ClientEffects = ()=>{
|
|
62
|
+
useSetup();
|
|
63
|
+
useScrollReset();
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
61
66
|
function Layout(props) {
|
|
62
|
-
const { top, bottom, beforeDocFooter, afterDocFooter, beforeDoc, afterDoc, beforeDocContent, afterDocContent, beforeSidebar, afterSidebar, beforeOutline, afterOutline, beforeNavTitle, afterNavTitle, navTitle, beforeNav, afterNav, beforeHero, afterHero, beforeFeatures, afterFeatures, beforeNavMenu, afterNavMenu, components, HomeLayout = theme_HomeLayout, NotFoundLayout = theme_NotFoundLayout } = props;
|
|
67
|
+
const { top, bottom, beforeDocFooter, afterDocFooter, beforeDoc, afterDoc, beforeDocContent, afterDocContent, beforeSidebar, afterSidebar, beforeOutline, afterOutline, beforeNavTitle, afterNavTitle, navTitle, beforeNav, afterNav, beforeHero, afterHero, beforeFeatures, afterFeatures, beforeLeftNavItems, afterLeftNavItems, beforeRightNavItems, afterRightNavItems, beforeNavMenu, afterNavMenu, components, HomeLayout = theme_HomeLayout, NotFoundLayout = theme_NotFoundLayout } = props;
|
|
63
68
|
const docProps = {
|
|
64
69
|
beforeDocFooter,
|
|
65
70
|
afterDocFooter,
|
|
@@ -84,6 +89,7 @@ function Layout(props) {
|
|
|
84
89
|
const { frontmatter } = useFrontmatter();
|
|
85
90
|
const { pageType, lang: currentLang, title: articleTitle } = page;
|
|
86
91
|
const localesData = useLocaleSiteData();
|
|
92
|
+
const { navbar: showNavbar = true } = frontmatter;
|
|
87
93
|
let title = frontmatter.title ?? articleTitle;
|
|
88
94
|
const mainTitle = site.title || localesData.title || '';
|
|
89
95
|
title = title && ('doc' === pageType || 'doc-wide' === pageType) ? concatTitle(title, frontmatter.titleSuffix || mainTitle) : 'home' === pageType ? concatTitle(mainTitle, frontmatter.titleSuffix) : '404' === pageType ? concatTitle('404', mainTitle) : mainTitle;
|
|
@@ -114,11 +120,9 @@ function Layout(props) {
|
|
|
114
120
|
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
|
|
115
121
|
children: getContentLayout()
|
|
116
122
|
});
|
|
117
|
-
useSetup();
|
|
118
|
-
useScrollReset();
|
|
119
|
-
const { frontmatter: { navbar: showNavbar = true } } = useFrontmatter();
|
|
120
123
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
121
124
|
children: [
|
|
125
|
+
/*#__PURE__*/ jsx(ClientEffects, {}),
|
|
122
126
|
/*#__PURE__*/ jsx(HeadTags, {
|
|
123
127
|
lang: currentLang,
|
|
124
128
|
title: title,
|
|
@@ -133,6 +137,10 @@ function Layout(props) {
|
|
|
133
137
|
beforeNavTitle: beforeNavTitle,
|
|
134
138
|
afterNavTitle: afterNavTitle,
|
|
135
139
|
navTitle: navTitle,
|
|
140
|
+
beforeLeftNavItems: beforeLeftNavItems,
|
|
141
|
+
afterLeftNavItems: afterLeftNavItems,
|
|
142
|
+
beforeRightNavItems: beforeRightNavItems,
|
|
143
|
+
afterRightNavItems: afterRightNavItems,
|
|
136
144
|
beforeNavMenu: beforeNavMenu,
|
|
137
145
|
afterNavMenu: afterNavMenu
|
|
138
146
|
}),
|
|
@@ -15,7 +15,12 @@ function useFullTextSearch() {
|
|
|
15
15
|
currentVersion: page.version
|
|
16
16
|
});
|
|
17
17
|
searchRef.current = searcher;
|
|
18
|
-
|
|
18
|
+
try {
|
|
19
|
+
await searcher.init();
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error('[Rspress] Failed to initialize full-text search:', error);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
19
24
|
setInitialized(true);
|
|
20
25
|
}
|
|
21
26
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--shiki-foreground: inherit;
|
|
3
3
|
--shiki-background: transparent;
|
|
4
4
|
--shiki-token-constant: #1976d2;
|
|
5
|
-
--shiki-token-string: #
|
|
5
|
+
--shiki-token-string: #032f62;
|
|
6
6
|
--shiki-token-comment: #b6b4b4;
|
|
7
7
|
--shiki-token-keyword: #cf2727;
|
|
8
8
|
--shiki-token-parameter: #f59403;
|
package/dist/tinypool~0.js
CHANGED
|
@@ -678,8 +678,10 @@ var ThreadPool = class {
|
|
|
678
678
|
const totalCapacity = this.options.maxQueue + this.pendingCapacity();
|
|
679
679
|
if (this.taskQueue.size >= totalCapacity) if (0 === this.options.maxQueue) return Promise.reject(Errors.NoTaskQueueAvailable());
|
|
680
680
|
else return Promise.reject(Errors.TaskQueueAtLimit());
|
|
681
|
-
|
|
682
|
-
|
|
681
|
+
else {
|
|
682
|
+
if (this.workers.size < this.options.maxThreads) this._addNewWorker();
|
|
683
|
+
this.taskQueue.push(taskInfo);
|
|
684
|
+
}
|
|
683
685
|
return ret;
|
|
684
686
|
}
|
|
685
687
|
let workerInfo = this.workers.findAvailable();
|
|
@@ -691,7 +693,7 @@ var ThreadPool = class {
|
|
|
691
693
|
}
|
|
692
694
|
if (null === workerInfo) {
|
|
693
695
|
if (this.options.maxQueue <= 0 && !waitingForNewWorker) return Promise.reject(Errors.NoTaskQueueAvailable());
|
|
694
|
-
this.taskQueue.push(taskInfo);
|
|
696
|
+
else this.taskQueue.push(taskInfo);
|
|
695
697
|
return ret;
|
|
696
698
|
}
|
|
697
699
|
const now = performance.now();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { moduleFactories } from "./rslib-runtime~0.js";
|
|
2
|
+
moduleFactories.add({
|
|
3
3
|
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
4
4
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
5
5
|
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@mdx-js/mdx": "^3.1.1",
|
|
62
62
|
"@mdx-js/react": "^3.1.1",
|
|
63
|
-
"@rsbuild/core": "^2.
|
|
63
|
+
"@rsbuild/core": "^2.2.5",
|
|
64
64
|
"@rsbuild/plugin-react": "~2.1.0",
|
|
65
65
|
"@shikijs/rehype": "^4.2.0",
|
|
66
66
|
"@types/mdast": "^4.0.4",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"react-dom": "^19.2.8",
|
|
81
81
|
"react-lazy-with-preload": "^2.2.1",
|
|
82
82
|
"react-render-to-markdown": "19.1.0",
|
|
83
|
-
"react-router-dom": "^7.18.
|
|
83
|
+
"react-router-dom": "^7.18.3",
|
|
84
84
|
"rehype-external-links": "^3.0.0",
|
|
85
85
|
"rehype-raw": "^7.0.0",
|
|
86
86
|
"remark-cjk-friendly": "^2.3.1",
|
|
@@ -95,27 +95,26 @@
|
|
|
95
95
|
"unist-util-visit": "^5.1.0",
|
|
96
96
|
"unist-util-visit-children": "^3.0.0",
|
|
97
97
|
"vfile": "^6.0.3",
|
|
98
|
-
"@rspress/shared": "2.0.
|
|
98
|
+
"@rspress/shared": "2.0.22"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@microsoft/api-extractor": "^7.59.0",
|
|
102
102
|
"@rsbuild/plugin-sass": "~2.0.1",
|
|
103
103
|
"@rsbuild/plugin-svgr": "^2.0.5",
|
|
104
|
-
"@rslib/core": "1.0.0-rc.0",
|
|
105
104
|
"@types/body-scroll-lock": "^3.1.2",
|
|
106
105
|
"@types/hast": "^3.0.5",
|
|
107
106
|
"@types/node": "^22.8.1",
|
|
108
107
|
"@types/nprogress": "^0.2.3",
|
|
109
|
-
"@types/react-dom": "^19.2.
|
|
110
|
-
"@types/web": "^0.0.
|
|
108
|
+
"@types/react-dom": "^19.2.7",
|
|
109
|
+
"@types/web": "^0.0.355",
|
|
111
110
|
"cac": "^7.0.0",
|
|
112
111
|
"execa": "8.0.1",
|
|
113
112
|
"mdast-util-directive": "^3.1.0",
|
|
114
113
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
115
|
-
"memfs": "^4.
|
|
116
|
-
"p-map": "^7.0.
|
|
114
|
+
"memfs": "^4.78.0",
|
|
115
|
+
"p-map": "^7.0.7",
|
|
117
116
|
"picocolors": "^1.1.1",
|
|
118
|
-
"postcss": "8.5.
|
|
117
|
+
"postcss": "8.5.28",
|
|
119
118
|
"remark-directive": "^4.0.0",
|
|
120
119
|
"rsbuild-plugin-publint": "^1.0.0",
|
|
121
120
|
"rsbuild-plugin-virtual-module": "0.4.5",
|
|
@@ -133,8 +132,8 @@
|
|
|
133
132
|
"registry": "https://registry.npmjs.org/"
|
|
134
133
|
},
|
|
135
134
|
"scripts": {
|
|
136
|
-
"build": "node ./scripts/generateJsonSchema.mjs &&
|
|
137
|
-
"dev": "
|
|
135
|
+
"build": "node ./scripts/generateJsonSchema.mjs && rs lib",
|
|
136
|
+
"dev": "rs lib -w",
|
|
138
137
|
"reset": "rimraf ./**/node_modules"
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { NoSSR, useSite } from '@rspress/core/runtime';
|
|
2
|
-
import { SocialLinks, SwitchAppearance } from '@rspress/core/theme';
|
|
3
|
-
import { isDarkModeSwitchEnabled } from '@rspress/shared';
|
|
4
|
-
import './index.scss';
|
|
5
|
-
import { NavScreenLangs } from './NavScreenLangs';
|
|
6
|
-
import { NavScreenVersions } from './NavScreenVersions';
|
|
7
|
-
|
|
8
|
-
export function NavScreenMenuOthers() {
|
|
9
|
-
const { site } = useSite();
|
|
10
|
-
const hasAppearanceSwitch = isDarkModeSwitchEnabled(
|
|
11
|
-
site.themeConfig.darkMode,
|
|
12
|
-
);
|
|
13
|
-
const socialLinks = site?.themeConfig?.socialLinks || [];
|
|
14
|
-
const hasSocialLinks = socialLinks.length > 0;
|
|
15
|
-
return (
|
|
16
|
-
<div className="rp-nav-screen__others">
|
|
17
|
-
{hasAppearanceSwitch && (
|
|
18
|
-
<div className="rp-nav-screen__appearance">
|
|
19
|
-
<NoSSR>
|
|
20
|
-
<SwitchAppearance />
|
|
21
|
-
</NoSSR>
|
|
22
|
-
</div>
|
|
23
|
-
)}
|
|
24
|
-
<NavScreenLangs />
|
|
25
|
-
<NavScreenVersions />
|
|
26
|
-
{hasSocialLinks && <SocialLinks socialLinks={socialLinks} />}
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
}
|