@rspress/core 2.0.14 → 2.0.15
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/0~execa.js +1 -1
- package/dist/3358.js +1 -1
- package/dist/5580.js +1 -1
- package/dist/{4942.js → 6010.js} +1 -1
- package/dist/8005.js +1 -1
- package/dist/{7261.js → 9958.js} +2 -1
- package/dist/cli/index.js +1 -1
- package/dist/eject-theme/components/DocContent/doc.scss +2 -2
- package/dist/eject-theme/components/HomeBackground/useNavTransparent.tsx +2 -2
- package/dist/eject-theme/components/HoverGroup/index.scss +1 -1
- package/dist/eject-theme/components/LastUpdated/index.tsx +8 -2
- package/dist/eject-theme/components/Nav/NavMenu.scss +1 -1
- package/dist/eject-theme/components/Nav/hooks.tsx +18 -14
- package/dist/eject-theme/components/Nav/index.tsx +4 -1
- package/dist/eject-theme/components/NavScreen/NavScreenAppearance.tsx +4 -1
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +3 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +4 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +23 -17
- package/dist/index.d.ts +1 -1
- package/dist/node/PluginDriver.js +4 -4
- 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 +1 -1
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.d.ts +4 -2
- package/dist/node/auto-nav-sidebar/walk.js +3 -3
- package/dist/node/constants.d.ts +2 -1
- package/dist/node/constants.js +12 -6
- package/dist/node/initRsbuild.js +8 -15
- package/dist/node/last-updated/index.d.ts +3 -3
- package/dist/node/last-updated/index.js +24 -9
- package/dist/node/mdx/options.js +8 -1
- package/dist/node/mdx/processor.js +3 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.d.ts +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +10 -6
- package/dist/node/mdx/remarkPlugins/link.js +91 -16
- package/dist/node/mdx/remarkPlugins/toc.d.ts +8 -1
- package/dist/node/mdx/remarkPlugins/toc.js +44 -15
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.d.ts +6 -0
- package/dist/node/route/RouteService.js +41 -7
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +7 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +7 -0
- package/dist/node/runtimeModule/i18n.js +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +2 -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 +12 -2
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderPage.js +1 -1
- package/dist/node/ssg/renderPageWorker.js +1 -1
- package/dist/node/ssg/renderPages.js +2 -2
- package/dist/node/ssg/rsbuildPluginCSR.js +2 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +5 -3
- 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/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +2 -2
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +3 -2
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/runtime/App.d.ts +2 -1
- package/dist/runtime/ClientApp.d.ts +1 -1
- package/dist/runtime/Content.d.ts +1 -1
- package/dist/runtime/NoSSR.d.ts +1 -1
- package/dist/theme/components/Badge/index.d.ts +1 -1
- package/dist/theme/components/CodeBlock/index.d.ts +1 -1
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.d.ts +1 -1
- package/dist/theme/components/CodeButtonGroup/index.d.ts +1 -1
- package/dist/theme/components/DocContent/doc.css +2 -2
- package/dist/theme/components/DocContent/docComponents/a.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/code.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/hr.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/img.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/index.d.ts +18 -18
- package/dist/theme/components/DocContent/docComponents/list.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/paragraph.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/pre.d.ts +1 -1
- package/dist/theme/components/DocContent/docComponents/table.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/title.d.ts +6 -6
- package/dist/theme/components/DocContent/index.d.ts +1 -1
- package/dist/theme/components/DocFooter/index.d.ts +1 -1
- package/dist/theme/components/EditLink/index.d.ts +1 -1
- package/dist/theme/components/FallbackHeading/index.d.ts +1 -1
- package/dist/theme/components/HomeBackground/index.d.ts +1 -1
- package/dist/theme/components/HomeBackground/useNavTransparent.d.ts +1 -1
- package/dist/theme/components/HomeBackground/useNavTransparent.js +2 -2
- package/dist/theme/components/HomeFeature/useCardAnimation.d.ts +1 -1
- package/dist/theme/components/HomeFooter/index.d.ts +1 -1
- package/dist/theme/components/HomeHero/index.d.ts +1 -1
- package/dist/theme/components/HoverGroup/index.css +1 -1
- package/dist/theme/components/HoverGroup/index.d.ts +1 -1
- package/dist/theme/components/HoverGroup/useHoverGroup.d.ts +1 -1
- package/dist/theme/components/LastUpdated/index.d.ts +1 -1
- package/dist/theme/components/LastUpdated/index.js +13 -3
- package/dist/theme/components/Llms/LlmsContainer.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsCopyButton.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsCopyRow.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsOpenRow.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsViewOptions.d.ts +1 -1
- package/dist/theme/components/Nav/NavMenu.css +1 -1
- package/dist/theme/components/Nav/NavMenu.d.ts +9 -9
- package/dist/theme/components/Nav/hooks.js +6 -3
- package/dist/theme/components/Nav/index.d.ts +1 -1
- package/dist/theme/components/Nav/index.js +2 -1
- package/dist/theme/components/NavHamburger/index.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenAppearance.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenAppearance.js +2 -1
- package/dist/theme/components/NavScreen/NavScreenLangs.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenu.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.css +10 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +5 -5
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +2 -1
- package/dist/theme/components/NavScreen/NavScreenVersions.d.ts +1 -1
- package/dist/theme/components/NavScreen/index.d.ts +2 -2
- package/dist/theme/components/NavTitle/index.d.ts +1 -1
- package/dist/theme/components/Outline/ScrollToTop.d.ts +1 -1
- package/dist/theme/components/Outline/index.d.ts +1 -1
- package/dist/theme/components/Overview/index.d.ts +1 -1
- package/dist/theme/components/OverviewGroup/index.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/index.d.ts +1 -1
- package/dist/theme/components/PrevNextPage/index.d.ts +1 -1
- package/dist/theme/components/Prompt/index.d.ts +1 -1
- package/dist/theme/components/ReadPercent/index.d.ts +1 -1
- package/dist/theme/components/Root/index.d.ts +1 -1
- package/dist/theme/components/Search/NoSearchResult.d.ts +1 -1
- package/dist/theme/components/Search/SearchButton.d.ts +1 -1
- package/dist/theme/components/Search/SearchPanel.d.ts +1 -1
- package/dist/theme/components/Search/SearchPanel.js +11 -7
- package/dist/theme/components/Search/SuggestItem.d.ts +1 -1
- package/dist/theme/components/Search/index.d.ts +1 -1
- package/dist/theme/components/Sidebar/SidebarDivider.d.ts +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.d.ts +1 -1
- package/dist/theme/components/Sidebar/SidebarItem.d.ts +2 -2
- package/dist/theme/components/Sidebar/SidebarSectionHeader.d.ts +1 -1
- package/dist/theme/components/Sidebar/index.d.ts +2 -2
- package/dist/theme/components/SidebarMenu/useSidebarMenu.d.ts +1 -1
- package/dist/theme/components/SocialLinks/GithubStars.d.ts +1 -1
- package/dist/theme/components/SocialLinks/SocialLink.d.ts +1 -1
- package/dist/theme/components/SocialLinks/index.d.ts +1 -1
- package/dist/theme/components/SourceCode/index.d.ts +1 -1
- package/dist/theme/components/Steps/index.d.ts +1 -1
- package/dist/theme/components/SvgWrapper/index.d.ts +1 -1
- package/dist/theme/components/SwitchAppearance/index.d.ts +1 -1
- package/dist/theme/components/Tag/index.d.ts +1 -1
- package/dist/theme/components/Toc/TocItem.d.ts +1 -1
- package/dist/theme/components/Toc/index.d.ts +1 -1
- package/dist/theme/layout/DocLayout/index.d.ts +1 -1
- package/dist/theme/layout/HomeLayout/index.d.ts +1 -1
- package/dist/theme/layout/Layout/index.d.ts +1 -1
- package/dist/theme/layout/NotFountLayout/index.d.ts +1 -1
- package/dist/theme/logic/useThemeState.d.ts +6 -7
- package/dist/theme/logic/useThemeState.js +19 -15
- package/package.json +17 -17
|
@@ -20,7 +20,16 @@
|
|
|
20
20
|
font-weight: 600;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.rp-nav-screen-menu-item__left
|
|
23
|
+
.rp-nav-screen-menu-item__left {
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 4px;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
line-height: 22px;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rp-nav-screen-menu-item__right {
|
|
24
33
|
font-size: 14px;
|
|
25
34
|
font-weight: 500;
|
|
26
35
|
line-height: 22px;
|
|
@@ -4,7 +4,7 @@ import './NavScreenMenuItem.scss';
|
|
|
4
4
|
interface NavScreenMenuItemWithLinkProps {
|
|
5
5
|
menuItem: NavItemWithLink;
|
|
6
6
|
}
|
|
7
|
-
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) =>
|
|
7
|
+
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element;
|
|
8
8
|
export declare function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href, download, }: {
|
|
9
9
|
left: React.ReactNode;
|
|
10
10
|
right: React.ReactNode;
|
|
@@ -13,14 +13,14 @@ export declare function NavScreenMenuItemRaw({ left, right, isOpen, isActive, on
|
|
|
13
13
|
onClick?: () => void;
|
|
14
14
|
href?: string;
|
|
15
15
|
download?: boolean;
|
|
16
|
-
}):
|
|
17
|
-
export declare function NavScreenMenuItemWithLink({ menuItem, }: NavScreenMenuItemWithLinkProps):
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare function NavScreenMenuItemWithLink({ menuItem, }: NavScreenMenuItemWithLinkProps): React.JSX.Element;
|
|
18
18
|
interface NavScreenMenuItemWithChildrenProps {
|
|
19
19
|
menuItem: NavItemWithChildren | NavItemWithLinkAndChildren;
|
|
20
20
|
}
|
|
21
|
-
export declare function NavScreenMenuItemWithChildren({ menuItem, }: NavScreenMenuItemWithChildrenProps):
|
|
21
|
+
export declare function NavScreenMenuItemWithChildren({ menuItem, }: NavScreenMenuItemWithChildrenProps): React.JSX.Element;
|
|
22
22
|
interface NavScreenMenuItemProps {
|
|
23
23
|
menuItem: NavItem;
|
|
24
24
|
}
|
|
25
|
-
export declare function NavScreenMenuItem({ menuItem }: NavScreenMenuItemProps):
|
|
25
|
+
export declare function NavScreenMenuItem({ menuItem }: NavScreenMenuItemProps): React.JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function NavScreenMenuOthers(): import("react
|
|
2
|
+
export declare function NavScreenMenuOthers(): import("react").JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NoSSR, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import { SocialLinks, SwitchAppearance } from "@rspress/core/theme";
|
|
4
|
+
import { isDarkModeSwitchEnabled } from "@rspress/shared";
|
|
4
5
|
import "./index.css";
|
|
5
6
|
import { NavScreenLangs } from "./NavScreenLangs.js";
|
|
6
7
|
import { NavScreenVersions } from "./NavScreenVersions.js";
|
|
7
8
|
function NavScreenMenuOthers() {
|
|
8
9
|
const { site } = useSite();
|
|
9
|
-
const hasAppearanceSwitch =
|
|
10
|
+
const hasAppearanceSwitch = isDarkModeSwitchEnabled(site.themeConfig.darkMode);
|
|
10
11
|
const socialLinks = site?.themeConfig?.socialLinks || [];
|
|
11
12
|
const hasSocialLinks = socialLinks.length > 0;
|
|
12
13
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './NavScreenVersions.scss';
|
|
2
|
-
export declare function NavScreenVersions(): import("react
|
|
2
|
+
export declare function NavScreenVersions(): import("react").JSX.Element | null;
|
|
@@ -3,5 +3,5 @@ export interface NavScreenProps {
|
|
|
3
3
|
isScreenOpen: boolean;
|
|
4
4
|
toggleScreen: () => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function NavScreenDivider(): import("react
|
|
7
|
-
export declare function NavScreen(props: NavScreenProps): import("react
|
|
6
|
+
export declare function NavScreenDivider(): import("react").JSX.Element;
|
|
7
|
+
export declare function NavScreen(props: NavScreenProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare const NavTitle: () => import("react
|
|
2
|
+
export declare const NavTitle: () => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function ScrollToTop(): import("react
|
|
1
|
+
export declare function ScrollToTop(): import("react").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function Outline(): import("react
|
|
2
|
+
export declare function Outline(): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function Bun(props: ComponentProps<'svg'>): import("react
|
|
2
|
+
export declare function Bun(props: ComponentProps<'svg'>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function Deno(props: ComponentProps<'svg'>): import("react
|
|
2
|
+
export declare function Deno(props: ComponentProps<'svg'>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function Npm(props: ComponentProps<'svg'>): import("react
|
|
2
|
+
export declare function Npm(props: ComponentProps<'svg'>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function Pnpm(props: ComponentProps<'svg'>): import("react
|
|
2
|
+
export declare function Pnpm(props: ComponentProps<'svg'>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
export declare function Yarn(props: ComponentProps<'svg'>): import("react
|
|
2
|
+
export declare function Yarn(props: ComponentProps<'svg'>): import("react").JSX.Element;
|
|
@@ -28,4 +28,4 @@ export type PackageManagerTabProps = ({
|
|
|
28
28
|
icon?: ReactNode;
|
|
29
29
|
}[];
|
|
30
30
|
};
|
|
31
|
-
export declare function PackageManagerTabs({ command, exec, dlx, additionalTabs, }: PackageManagerTabProps): string | import("react
|
|
31
|
+
export declare function PackageManagerTabs({ command, exec, dlx, additionalTabs, }: PackageManagerTabProps): string | import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function PrevNextPage(): import("react
|
|
2
|
+
export declare function PrevNextPage(): import("react").JSX.Element;
|
|
@@ -29,5 +29,5 @@ export interface PromptProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
29
|
*/
|
|
30
30
|
prompt?: string;
|
|
31
31
|
}
|
|
32
|
-
export declare function Prompt({ custom, ...props }: PromptProps): import("react
|
|
32
|
+
export declare function Prompt({ custom, ...props }: PromptProps): import("react").JSX.Element;
|
|
33
33
|
export default Prompt;
|
|
@@ -2,4 +2,4 @@ import './SearchButton.scss';
|
|
|
2
2
|
export interface SearchButtonProps {
|
|
3
3
|
setFocused: (focused: boolean) => void;
|
|
4
4
|
}
|
|
5
|
-
export declare function SearchButton({ setFocused }: SearchButtonProps): import("react
|
|
5
|
+
export declare function SearchButton({ setFocused }: SearchButtonProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ export interface SearchPanelProps {
|
|
|
3
3
|
focused: boolean;
|
|
4
4
|
setFocused: (focused: boolean) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function SearchPanel({ focused, setFocused }: SearchPanelProps): import("react
|
|
6
|
+
export declare function SearchPanel({ focused, setFocused }: SearchPanelProps): import("react").JSX.Element | null;
|
|
@@ -23,6 +23,12 @@ const useDebounce = (cb)=>{
|
|
|
23
23
|
const debounced = useCallback(debounce((...args)=>cbRef.current(...args), 150), []);
|
|
24
24
|
return debounced;
|
|
25
25
|
};
|
|
26
|
+
const normalizeSuggestions = (suggestions)=>suggestions.reduce((groups, item)=>{
|
|
27
|
+
const group = item.title;
|
|
28
|
+
if (!groups.has(group)) groups.set(group, []);
|
|
29
|
+
groups.get(group).push(item);
|
|
30
|
+
return groups;
|
|
31
|
+
}, new Map());
|
|
26
32
|
function SearchPanel({ focused, setFocused }) {
|
|
27
33
|
const [query, setQuery] = useState('');
|
|
28
34
|
const [searchResult, setSearchResult] = useState([]);
|
|
@@ -169,10 +175,14 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
169
175
|
focused
|
|
170
176
|
]);
|
|
171
177
|
useEffect(()=>{
|
|
172
|
-
|
|
178
|
+
let idleCallbackID;
|
|
179
|
+
if ('requestIdleCallback' in window && !pageSearcherRef.current) idleCallbackID = window.requestIdleCallback(()=>{
|
|
173
180
|
const searcher = createSearcher();
|
|
174
181
|
searcher.fetchSearchIndex();
|
|
175
182
|
});
|
|
183
|
+
return ()=>{
|
|
184
|
+
if (void 0 !== idleCallbackID && 'cancelIdleCallback' in window) window.cancelIdleCallback(idleCallbackID);
|
|
185
|
+
};
|
|
176
186
|
}, []);
|
|
177
187
|
useEffect(()=>{
|
|
178
188
|
const { currentLang, currentVersion } = pageSearcherConfigRef.current ?? {};
|
|
@@ -222,12 +232,6 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
222
232
|
}
|
|
223
233
|
};
|
|
224
234
|
const handleQueryChange = useDebounce(handleQueryChangedImpl);
|
|
225
|
-
const normalizeSuggestions = (suggestions)=>suggestions.reduce((groups, item)=>{
|
|
226
|
-
const group = item.title;
|
|
227
|
-
if (!groups.has(group)) groups.set(group, []);
|
|
228
|
-
groups.get(group).push(item);
|
|
229
|
-
return groups;
|
|
230
|
-
}, new Map());
|
|
231
235
|
const renderSearchResult = (result, isSearching)=>{
|
|
232
236
|
if (1 === result.length) {
|
|
233
237
|
const currentSearchResult = result[0].result;
|
|
@@ -8,4 +8,4 @@ export declare function SuggestItem({ suggestion, closeSearch, isCurrent, setCur
|
|
|
8
8
|
onMouseMove: (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
|
|
9
9
|
inCurrentDocIndex: boolean;
|
|
10
10
|
scrollTo: (top: number, height: number) => void;
|
|
11
|
-
}): import("react
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Search(): import("react
|
|
1
|
+
export declare function Search(): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ export type SidebarDividerProps = {
|
|
|
3
3
|
depth: number;
|
|
4
4
|
dividerType: 'dashed' | 'solid';
|
|
5
5
|
};
|
|
6
|
-
export declare function SidebarDivider(props: SidebarDividerProps): import("react
|
|
6
|
+
export declare function SidebarDivider(props: SidebarDividerProps): import("react").JSX.Element;
|
|
@@ -8,4 +8,4 @@ export interface SidebarGroupProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
setSidebarData: React.Dispatch<React.SetStateAction<(NormalizedSidebarGroup | SidebarItemType | SidebarDividerType | SidebarSectionHeaderType)[]>>;
|
|
10
10
|
}
|
|
11
|
-
export declare function SidebarGroup(props: SidebarGroupProps):
|
|
11
|
+
export declare function SidebarGroup(props: SidebarGroupProps): React.JSX.Element;
|
|
@@ -12,10 +12,10 @@ export declare function SidebarItemRaw({ active, text, tag, link, context, class
|
|
|
12
12
|
left?: React.ReactNode;
|
|
13
13
|
right?: React.ReactNode;
|
|
14
14
|
onClick?: React.MouseEventHandler<HTMLDivElement | HTMLAnchorElement>;
|
|
15
|
-
}):
|
|
15
|
+
}): React.JSX.Element;
|
|
16
16
|
export interface SidebarItemProps {
|
|
17
17
|
item: SidebarItemType | NormalizedSidebarGroup;
|
|
18
18
|
depth: number;
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
|
21
|
-
export declare function SidebarItem(props: SidebarItemProps):
|
|
21
|
+
export declare function SidebarItem(props: SidebarItemProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SidebarData } from '@rspress/core';
|
|
2
|
-
export declare function Sidebar(): import("react
|
|
2
|
+
export declare function Sidebar(): import("react").JSX.Element;
|
|
3
3
|
export declare function SidebarList({ sidebarData, setSidebarData, }: {
|
|
4
4
|
sidebarData: SidebarData;
|
|
5
5
|
setSidebarData: React.Dispatch<React.SetStateAction<SidebarData>>;
|
|
6
|
-
}): import("react
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
declare function useSidebarMenu(beforeOutline?: ReactNode, afterOutline?: ReactNode): {
|
|
3
|
-
sidebarMenu: import("react
|
|
3
|
+
sidebarMenu: import("react").JSX.Element;
|
|
4
4
|
isOutlineOpen: boolean;
|
|
5
5
|
isSidebarOpen: boolean;
|
|
6
6
|
sidebarLayoutRef: import("react").RefObject<HTMLDivElement | null>;
|
|
@@ -3,5 +3,5 @@ interface GithubStarsProps {
|
|
|
3
3
|
content: string;
|
|
4
4
|
icon: ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare const GithubStars: (props: GithubStarsProps) => import("react
|
|
6
|
+
export declare const GithubStars: (props: GithubStarsProps) => import("react").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -7,5 +7,5 @@ interface SocialLinkProps {
|
|
|
7
7
|
*/
|
|
8
8
|
hoverGroupPosition?: 'center' | 'left' | 'right';
|
|
9
9
|
}
|
|
10
|
-
export declare const SocialLink: (props: SocialLinkProps) => import("react
|
|
10
|
+
export declare const SocialLink: (props: SocialLinkProps) => import("react").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -3,4 +3,4 @@ export interface SourceCodeProps {
|
|
|
3
3
|
href: string;
|
|
4
4
|
platform?: 'github' | 'gitlab';
|
|
5
5
|
}
|
|
6
|
-
export declare function SourceCode(props: SourceCodeProps): import("react
|
|
6
|
+
export declare function SourceCode(props: SourceCodeProps): import("react").JSX.Element;
|
|
@@ -10,4 +10,4 @@ export type SvgWrapperProps = {
|
|
|
10
10
|
* - Other strings (emoji/text/HTML): render with renderHtmlOrText
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
export declare function SvgWrapper({ icon: Icon, ...rest }: SvgWrapperProps): import("react
|
|
13
|
+
export declare function SvgWrapper({ icon: Icon, ...rest }: SvgWrapperProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Toc(): import("react
|
|
1
|
+
export declare function Toc(): import("react").JSX.Element;
|
|
@@ -13,4 +13,4 @@ export interface DocLayoutProps {
|
|
|
13
13
|
navTitle?: React.ReactNode;
|
|
14
14
|
components?: Record<string, React.FC>;
|
|
15
15
|
}
|
|
16
|
-
export declare function DocLayout(props: DocLayoutProps): import("react
|
|
16
|
+
export declare function DocLayout(props: DocLayoutProps): import("react").JSX.Element;
|
|
@@ -6,4 +6,4 @@ export interface HomeLayoutProps {
|
|
|
6
6
|
beforeFeatures?: React.ReactNode;
|
|
7
7
|
afterFeatures?: React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare function HomeLayout(props: HomeLayoutProps): import("react
|
|
9
|
+
export declare function HomeLayout(props: HomeLayoutProps): import("react").JSX.Element;
|
|
@@ -9,4 +9,4 @@ export type LayoutProps = {
|
|
|
9
9
|
beforeNav?: React.ReactNode;
|
|
10
10
|
afterNav?: React.ReactNode;
|
|
11
11
|
} & Omit<DocLayoutProps, 'uiSwitch'> & HomeLayoutProps & NavProps;
|
|
12
|
-
export declare function Layout(props: LayoutProps):
|
|
12
|
+
export declare function Layout(props: LayoutProps): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function NotFoundLayout(): import("react
|
|
2
|
+
export declare function NotFoundLayout(): import("react").JSX.Element | null;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export type ThemeValue = 'light' | 'dark';
|
|
3
|
-
/** Theme config value stored in localStorage */
|
|
4
|
-
export type ThemeConfigValue = ThemeValue | 'auto';
|
|
5
|
-
export declare const getStoredThemeConfig: (theme: ThemeValue, prefersDark: boolean) => ThemeConfigValue;
|
|
6
|
-
export declare const getResolvedTheme: (config: ThemeConfigValue, prefersDark: boolean) => ThemeValue;
|
|
1
|
+
type ThemeValue = 'dark' | 'light';
|
|
7
2
|
/**
|
|
8
3
|
* State provider for theme context.
|
|
9
4
|
* @internal
|
|
10
5
|
*/
|
|
11
|
-
export declare function useThemeState(): readonly [
|
|
6
|
+
export declare function useThemeState(): readonly [
|
|
7
|
+
ThemeValue,
|
|
8
|
+
(value: ThemeValue) => void
|
|
9
|
+
];
|
|
10
|
+
export {};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { useSite } from "@rspress/core/runtime";
|
|
2
|
+
import { getDefaultDarkModeValue, isDarkModeSwitchEnabled } from "@rspress/shared";
|
|
2
3
|
import { useCallback, useLayoutEffect } from "react";
|
|
3
4
|
import { useMediaQuery } from "./useMediaQuery.js";
|
|
4
5
|
import { useStorageValue } from "./useStorageValue.js";
|
|
5
6
|
const APPEARANCE_KEY = 'rspress-theme-appearance';
|
|
6
7
|
const MEDIA_QUERY = '(prefers-color-scheme: dark)';
|
|
7
|
-
const getSystemTheme = (prefersDark)=>prefersDark ? 'dark' : 'light';
|
|
8
|
-
const getStoredThemeConfig = (theme, prefersDark)=>{
|
|
9
|
-
const systemTheme = getSystemTheme(prefersDark);
|
|
10
|
-
return theme === systemTheme ? 'auto' : theme;
|
|
11
|
-
};
|
|
12
|
-
const getResolvedTheme = (config, prefersDark)=>'auto' === config ? getSystemTheme(prefersDark) : config;
|
|
13
8
|
const applyThemeToDOM = (theme)=>{
|
|
14
9
|
if (!document?.documentElement) return;
|
|
15
10
|
const root = document.documentElement;
|
|
@@ -17,19 +12,28 @@ const applyThemeToDOM = (theme)=>{
|
|
|
17
12
|
root.classList.toggle('rp-dark', 'dark' === theme);
|
|
18
13
|
root.style.colorScheme = theme;
|
|
19
14
|
};
|
|
15
|
+
function useSystemTheme() {
|
|
16
|
+
const prefersDark = useMediaQuery(MEDIA_QUERY);
|
|
17
|
+
const system = prefersDark ? 'dark' : 'light';
|
|
18
|
+
return system;
|
|
19
|
+
}
|
|
20
20
|
function useThemeState() {
|
|
21
21
|
const { site } = useSite();
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
22
|
+
const { darkMode } = site.themeConfig;
|
|
23
|
+
const canSwitchDarkMode = isDarkModeSwitchEnabled(darkMode);
|
|
24
|
+
const defaultThemeConfig = getDefaultDarkModeValue(darkMode);
|
|
25
|
+
const [storedConfig, setStoredConfig] = useStorageValue(APPEARANCE_KEY, defaultThemeConfig);
|
|
26
|
+
const validatedStoredConfig = 'light' === storedConfig || 'dark' === storedConfig || 'auto' === storedConfig ? storedConfig : null;
|
|
27
|
+
const system = useSystemTheme();
|
|
28
|
+
const themeConfigValue = canSwitchDarkMode ? validatedStoredConfig ?? defaultThemeConfig : defaultThemeConfig;
|
|
29
|
+
const theme = 'auto' === themeConfigValue ? system : themeConfigValue;
|
|
26
30
|
const setTheme = useCallback((value)=>{
|
|
27
|
-
if (
|
|
28
|
-
setStoredConfig(
|
|
31
|
+
if (!canSwitchDarkMode) return;
|
|
32
|
+
setStoredConfig(system === value ? 'auto' : value);
|
|
29
33
|
applyThemeToDOM(value);
|
|
30
34
|
}, [
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
canSwitchDarkMode,
|
|
36
|
+
system,
|
|
33
37
|
setStoredConfig
|
|
34
38
|
]);
|
|
35
39
|
useLayoutEffect(()=>{
|
|
@@ -42,4 +46,4 @@ function useThemeState() {
|
|
|
42
46
|
setTheme
|
|
43
47
|
];
|
|
44
48
|
}
|
|
45
|
-
export {
|
|
49
|
+
export { useThemeState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@mdx-js/mdx": "^3.1.1",
|
|
62
62
|
"@mdx-js/react": "^3.1.1",
|
|
63
|
-
"@rsbuild/core": "^2.0.
|
|
63
|
+
"@rsbuild/core": "^2.0.15",
|
|
64
64
|
"@rsbuild/plugin-react": "~2.0.1",
|
|
65
|
-
"@shikijs/rehype": "^4.0
|
|
65
|
+
"@shikijs/rehype": "^4.2.0",
|
|
66
66
|
"@types/unist": "^3.0.3",
|
|
67
67
|
"@unhead/react": "^2.1.15",
|
|
68
68
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
@@ -75,54 +75,54 @@
|
|
|
75
75
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
76
76
|
"medium-zoom": "1.1.0",
|
|
77
77
|
"nprogress": "^0.2.0",
|
|
78
|
-
"react": "^19.2.
|
|
79
|
-
"react-dom": "^19.2.
|
|
78
|
+
"react": "^19.2.7",
|
|
79
|
+
"react-dom": "^19.2.7",
|
|
80
80
|
"react-lazy-with-preload": "^2.2.1",
|
|
81
81
|
"react-reconciler": "0.33.0",
|
|
82
82
|
"react-render-to-markdown": "19.1.0",
|
|
83
83
|
"react-router-dom": "^7.15.1",
|
|
84
84
|
"rehype-external-links": "^3.0.0",
|
|
85
85
|
"rehype-raw": "^7.0.0",
|
|
86
|
-
"remark-cjk-friendly": "^2.
|
|
87
|
-
"remark-cjk-friendly-gfm-strikethrough": "^2.0
|
|
86
|
+
"remark-cjk-friendly": "^2.3.1",
|
|
87
|
+
"remark-cjk-friendly-gfm-strikethrough": "^2.1.0",
|
|
88
88
|
"remark-gfm": "^4.0.1",
|
|
89
89
|
"remark-mdx": "^3.1.1",
|
|
90
90
|
"remark-parse": "^11.0.0",
|
|
91
91
|
"remark-stringify": "^11.0.0",
|
|
92
92
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
93
|
-
"shiki": "^4.0
|
|
93
|
+
"shiki": "^4.2.0",
|
|
94
94
|
"unified": "^11.0.5",
|
|
95
95
|
"unist-util-remove": "^4.0.0",
|
|
96
96
|
"unist-util-visit": "^5.1.0",
|
|
97
97
|
"unist-util-visit-children": "^3.0.0",
|
|
98
|
-
"@rspress/shared": "2.0.
|
|
98
|
+
"@rspress/shared": "2.0.15"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@microsoft/api-extractor": "^7.
|
|
101
|
+
"@microsoft/api-extractor": "^7.58.9",
|
|
102
102
|
"@rsbuild/plugin-sass": "~1.5.3",
|
|
103
|
-
"@rsbuild/plugin-svgr": "^2.0.
|
|
104
|
-
"@rslib/core": "0.
|
|
103
|
+
"@rsbuild/plugin-svgr": "^2.0.4",
|
|
104
|
+
"@rslib/core": "0.23.0",
|
|
105
105
|
"@types/body-scroll-lock": "^3.1.2",
|
|
106
106
|
"@types/hast": "^3.0.4",
|
|
107
107
|
"@types/mdast": "^4.0.4",
|
|
108
108
|
"@types/node": "^22.8.1",
|
|
109
109
|
"@types/nprogress": "^0.2.3",
|
|
110
|
-
"@types/react": "^19.2.
|
|
110
|
+
"@types/react": "^19.2.17",
|
|
111
111
|
"@types/react-dom": "^19.2.3",
|
|
112
112
|
"@types/react-reconciler": "^0.33.0",
|
|
113
|
-
"@types/web": "^0.0.
|
|
113
|
+
"@types/web": "^0.0.350",
|
|
114
114
|
"cac": "^7.0.0",
|
|
115
115
|
"chokidar": "^3.6.0",
|
|
116
116
|
"execa": "8.0.1",
|
|
117
117
|
"mdast-util-directive": "^3.1.0",
|
|
118
118
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
119
|
-
"memfs": "^4.57.
|
|
119
|
+
"memfs": "^4.57.8",
|
|
120
120
|
"p-map": "^7.0.4",
|
|
121
121
|
"picocolors": "^1.1.1",
|
|
122
122
|
"postcss": "8.5.15",
|
|
123
123
|
"remark-directive": "^4.0.0",
|
|
124
|
-
"rsbuild-plugin-publint": "^0.
|
|
125
|
-
"rsbuild-plugin-virtual-module": "0.4.
|
|
124
|
+
"rsbuild-plugin-publint": "^1.0.0",
|
|
125
|
+
"rsbuild-plugin-virtual-module": "0.4.4",
|
|
126
126
|
"tinyglobby": "^0.2.17",
|
|
127
127
|
"tinypool": "^1.1.1",
|
|
128
128
|
"ts-json-schema-generator": "^2.9.0",
|