@rspress/core 2.0.13 → 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/0~rslib-runtime.js +9 -5
- package/dist/3358.js +1 -1
- package/dist/5580.js +2 -2
- package/dist/{2633.js → 6010.js} +12 -9
- package/dist/6646.js +3 -0
- package/dist/8005.js +1 -1
- package/dist/{7275.js → 9958.js} +3 -2
- package/dist/cli/index.js +1 -1
- package/dist/eject-theme/components/Banner/index.scss +11 -0
- package/dist/eject-theme/components/Banner/index.tsx +5 -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/Link/index.tsx +6 -0
- 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/Outline/index.tsx +0 -6
- package/dist/eject-theme/components/Search/SearchPanel.tsx +24 -17
- package/dist/eject-theme/components/Search/logic/search.ts +15 -16
- package/dist/eject-theme/components/SidebarMenu/index.tsx +10 -3
- package/dist/eject-theme/components/SidebarMenu/useSidebarMenu.tsx +12 -3
- package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +120 -0
- package/dist/eject-theme/components/SocialLinks/SocialLink.tsx +5 -0
- package/dist/eject-theme/components/SocialLinks/index.scss +17 -0
- package/dist/eject-theme/components/Tag/index.test.tsx +55 -0
- package/dist/eject-theme/components/Tag/index.tsx +19 -5
- 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 +21 -19
- 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 +33 -9
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/htmlFile.d.ts +2 -0
- package/dist/node/ssg/htmlFile.js +14 -0
- package/dist/node/ssg/renderPage.js +1 -1
- package/dist/node/ssg/renderPageWorker.d.ts +3 -6
- package/dist/node/ssg/renderPageWorker.js +24 -4
- package/dist/node/ssg/renderPages.d.ts +1 -1
- package/dist/node/ssg/renderPages.js +18 -17
- package/dist/node/ssg/rsbuildPluginCSR.js +2 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +6 -4
- 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/Banner/index.css +11 -0
- package/dist/theme/components/Banner/index.js +1 -0
- 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/Link/index.js +6 -0
- 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/Outline/index.js +1 -3
- 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 +12 -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/Search/logic/search.js +12 -7
- 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/index.d.ts +3 -0
- package/dist/theme/components/SidebarMenu/index.js +4 -3
- package/dist/theme/components/SidebarMenu/useSidebarMenu.d.ts +3 -2
- package/dist/theme/components/SidebarMenu/useSidebarMenu.js +7 -3
- package/dist/theme/components/SocialLinks/GithubStars.d.ts +7 -0
- package/dist/theme/components/SocialLinks/GithubStars.js +85 -0
- package/dist/theme/components/SocialLinks/SocialLink.d.ts +1 -1
- package/dist/theme/components/SocialLinks/SocialLink.js +5 -0
- package/dist/theme/components/SocialLinks/index.css +19 -0
- 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/Tag/index.js +9 -5
- 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/DocLayout/index.js +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 +20 -21
- package/dist/559.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function LastUpdated(): import("react
|
|
2
|
+
export declare function LastUpdated(): import("react").JSX.Element | null;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n, usePage, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
function LastUpdated() {
|
|
5
|
-
const { page: { lastUpdatedTime } } = usePage();
|
|
5
|
+
const { page: { lastUpdatedTime, lastUpdatedAuthor } } = usePage();
|
|
6
6
|
const { site } = useSite();
|
|
7
7
|
const { themeConfig } = site;
|
|
8
8
|
const showLastUpdated = themeConfig.lastUpdated;
|
|
9
9
|
const t = useI18n();
|
|
10
|
-
if (!showLastUpdated) return null;
|
|
10
|
+
if (!showLastUpdated || !lastUpdatedTime) return null;
|
|
11
11
|
return /*#__PURE__*/ jsx("div", {
|
|
12
12
|
className: "rp-last-updated",
|
|
13
13
|
children: /*#__PURE__*/ jsxs("p", {
|
|
@@ -16,6 +16,16 @@ function LastUpdated() {
|
|
|
16
16
|
": ",
|
|
17
17
|
/*#__PURE__*/ jsx("span", {
|
|
18
18
|
children: lastUpdatedTime
|
|
19
|
+
}),
|
|
20
|
+
lastUpdatedAuthor && /*#__PURE__*/ jsxs(Fragment, {
|
|
21
|
+
children: [
|
|
22
|
+
' ',
|
|
23
|
+
t('lastUpdatedAuthorText'),
|
|
24
|
+
" ",
|
|
25
|
+
/*#__PURE__*/ jsx("span", {
|
|
26
|
+
children: lastUpdatedAuthor
|
|
27
|
+
})
|
|
28
|
+
]
|
|
19
29
|
})
|
|
20
30
|
]
|
|
21
31
|
})
|
|
@@ -42,6 +42,9 @@ const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
42
42
|
onMouseEnter?.(event);
|
|
43
43
|
preloadLink(removeBaseHref);
|
|
44
44
|
},
|
|
45
|
+
onTouchStart: ()=>{
|
|
46
|
+
preloadLink(removeBaseHref);
|
|
47
|
+
},
|
|
45
48
|
onClick: (e)=>{
|
|
46
49
|
onClick?.(e);
|
|
47
50
|
if (0 !== e.button || e.currentTarget.target && '_self' !== e.currentTarget.target || e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) return;
|
|
@@ -59,6 +62,9 @@ const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
59
62
|
onMouseEnter?.(event);
|
|
60
63
|
preloadLink(removeBaseHref);
|
|
61
64
|
},
|
|
65
|
+
onTouchStart: ()=>{
|
|
66
|
+
preloadLink(removeBaseHref);
|
|
67
|
+
},
|
|
62
68
|
onClick: (e)=>{
|
|
63
69
|
onClick?.(e);
|
|
64
70
|
if (0 !== e.button || e.currentTarget.target && '_self' !== e.currentTarget.target || e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) return;
|
|
@@ -2,4 +2,4 @@ import type React from 'react';
|
|
|
2
2
|
import './LlmsContainer.scss';
|
|
3
3
|
export interface LlmsContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
}
|
|
5
|
-
export declare function LlmsContainer(props: LlmsContainerProps):
|
|
5
|
+
export declare function LlmsContainer(props: LlmsContainerProps): React.JSX.Element;
|
|
@@ -17,4 +17,4 @@ export interface LlmsCopyButtonProps extends React.ButtonHTMLAttributes<HTMLButt
|
|
|
17
17
|
*/
|
|
18
18
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
19
19
|
}
|
|
20
|
-
export declare function LlmsCopyButton(props: LlmsCopyButtonProps): import("react
|
|
20
|
+
export declare function LlmsCopyButton(props: LlmsCopyButtonProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function LlmsCopyRow(): import("react
|
|
1
|
+
export declare function LlmsCopyRow(): import("react").JSX.Element | null;
|
|
@@ -30,5 +30,5 @@ export interface LlmsViewOptionsProps extends React.ButtonHTMLAttributes<HTMLBut
|
|
|
30
30
|
*/
|
|
31
31
|
text?: string;
|
|
32
32
|
}
|
|
33
|
-
export declare function LlmsViewOptions({ options: propsOptions, }: LlmsViewOptionsProps):
|
|
33
|
+
export declare function LlmsViewOptions({ options: propsOptions, }: LlmsViewOptionsProps): React.JSX.Element;
|
|
34
34
|
export {};
|
|
@@ -2,25 +2,25 @@ import type { NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndC
|
|
|
2
2
|
import type { HoverGroupProps } from '@rspress/core/theme';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
4
|
import './NavMenu.scss';
|
|
5
|
-
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => import("react
|
|
5
|
+
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
6
6
|
export declare function NavMenuItemInner({ menuItem, children, }: {
|
|
7
7
|
menuItem: Partial<NavItemWithLink>;
|
|
8
8
|
children?: ReactNode;
|
|
9
|
-
}): import("react
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
10
|
export declare function NavMenuItemWithChildren({ menuItem, activeMatcher, }: {
|
|
11
11
|
menuItem: NavItemWithChildren | NavItemWithLinkAndChildren;
|
|
12
12
|
activeMatcher?: HoverGroupProps['activeMatcher'];
|
|
13
|
-
}): import("react
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
14
|
export declare function NavMenuItemWithLink({ menuItem, }: {
|
|
15
15
|
menuItem: NavItemWithLink;
|
|
16
|
-
}): import("react
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
17
|
export declare function NavMenuItem({ menuItem }: {
|
|
18
18
|
menuItem: NavItem;
|
|
19
|
-
}): import("react
|
|
20
|
-
export declare function NavMenuDivider(): import("react
|
|
21
|
-
export declare function NavLangs(): import("react
|
|
22
|
-
export declare function NavVersions(): import("react
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
export declare function NavMenuDivider(): import("react").JSX.Element;
|
|
21
|
+
export declare function NavLangs(): import("react").JSX.Element | null;
|
|
22
|
+
export declare function NavVersions(): import("react").JSX.Element | null;
|
|
23
23
|
export declare function NavMenu({ menuItems, position, }: {
|
|
24
24
|
menuItems: NavItem[];
|
|
25
25
|
position: 'left' | 'right';
|
|
26
|
-
}): import("react
|
|
26
|
+
}): import("react").JSX.Element | null;
|
|
@@ -32,9 +32,11 @@ function useLangsMenu() {
|
|
|
32
32
|
const hasMultiLanguage = localeLanguages.length > 1;
|
|
33
33
|
const { lang: currentLang, pageType } = page;
|
|
34
34
|
const translationMenuData = hasMultiLanguage ? {
|
|
35
|
-
items: localeLanguages.map((item)=>
|
|
35
|
+
items: localeLanguages.map((item)=>{
|
|
36
|
+
const isCurrentLang = item.lang === currentLang;
|
|
37
|
+
return {
|
|
36
38
|
text: item?.label,
|
|
37
|
-
link: replaceLang(pathname + search, {
|
|
39
|
+
link: isCurrentLang ? '' : replaceLang(pathname + search, {
|
|
38
40
|
current: currentLang,
|
|
39
41
|
target: item.lang,
|
|
40
42
|
default: defaultLang
|
|
@@ -44,7 +46,8 @@ function useLangsMenu() {
|
|
|
44
46
|
}, cleanUrls, '404' === pageType),
|
|
45
47
|
lang: item.lang,
|
|
46
48
|
rel: 'alternate'
|
|
47
|
-
}
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
48
51
|
activeValue: localeLanguages.find((item)=>currentLang === item.lang)?.label
|
|
49
52
|
} : {
|
|
50
53
|
items: []
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useNav, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import { NavHamburger, NavTitle, Search, SocialLinks, SwitchAppearance } from "@rspress/core/theme";
|
|
4
|
+
import { isDarkModeSwitchEnabled } from "@rspress/shared";
|
|
4
5
|
import "./index.css";
|
|
5
6
|
import { NavLangs, NavMenu, NavMenuDivider, NavVersions } from "./NavMenu.js";
|
|
6
7
|
function Nav(props) {
|
|
7
8
|
const { beforeNavTitle, afterNavTitle, beforeNavMenu, afterNavMenu, navTitle } = props;
|
|
8
9
|
const navList = useNav();
|
|
9
10
|
const { site } = useSite();
|
|
10
|
-
const hasAppearanceSwitch =
|
|
11
|
+
const hasAppearanceSwitch = isDarkModeSwitchEnabled(site.themeConfig.darkMode);
|
|
11
12
|
return /*#__PURE__*/ jsxs("header", {
|
|
12
13
|
className: "rp-nav",
|
|
13
14
|
children: [
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function NavHamburger(): import("react
|
|
2
|
+
export declare function NavHamburger(): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './NavScreenAppearance.scss';
|
|
2
|
-
export declare function NavScreenAppearance(): import("react
|
|
2
|
+
export declare function NavScreenAppearance(): import("react").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NoSSR, useI18n, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import { SwitchAppearance } from "@rspress/core/theme";
|
|
4
|
+
import { isDarkModeSwitchEnabled } from "@rspress/shared";
|
|
4
5
|
import "./NavScreenAppearance.css";
|
|
5
6
|
function NavScreenAppearance() {
|
|
6
7
|
const { site } = useSite();
|
|
7
|
-
const hasAppearanceSwitch =
|
|
8
|
+
const hasAppearanceSwitch = isDarkModeSwitchEnabled(site.themeConfig.darkMode);
|
|
8
9
|
const t = useI18n();
|
|
9
10
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
10
11
|
children: hasAppearanceSwitch && /*#__PURE__*/ jsxs("div", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './NavScreenLangs.scss';
|
|
2
|
-
export declare function NavScreenLangs(): import("react
|
|
2
|
+
export declare function NavScreenLangs(): import("react").JSX.Element | null;
|
|
@@ -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,13 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { EditLink, LlmsCopyRow, LlmsOpenRow, ReadPercent, Toc
|
|
3
|
+
import { EditLink, LlmsCopyRow, LlmsOpenRow, ReadPercent, Toc } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { ScrollToTop } from "./ScrollToTop.js";
|
|
6
6
|
function Outline() {
|
|
7
7
|
const t = useI18n();
|
|
8
|
-
const headers = useDynamicToc();
|
|
9
8
|
const { site: { themeConfig: { enableScrollToTop = true, llmsUI } } } = useSite();
|
|
10
|
-
if (0 === headers.length) return /*#__PURE__*/ jsx(Fragment, {});
|
|
11
9
|
const placement = 'object' == typeof llmsUI ? llmsUI?.placement ?? 'title' : 'title';
|
|
12
10
|
return /*#__PURE__*/ jsxs("div", {
|
|
13
11
|
className: "rp-outline",
|
|
@@ -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;
|
|
@@ -335,6 +339,7 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
335
339
|
"aria-label": "SearchPanelInput",
|
|
336
340
|
autoComplete: "off",
|
|
337
341
|
autoFocus: true,
|
|
342
|
+
inputMode: "search",
|
|
338
343
|
onChange: (e)=>handleQueryChange(e.target.value)
|
|
339
344
|
}),
|
|
340
345
|
/*#__PURE__*/ jsx("label", {
|
|
@@ -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;
|
|
@@ -128,13 +128,18 @@ class PageSearcher {
|
|
|
128
128
|
const statementStartIndex = byteToCharIndex(content, highlightStartIndex);
|
|
129
129
|
const statementEndIndex = byteToCharIndex(content, highlightStartIndex + THRESHOLD_CONTENT_LENGTH);
|
|
130
130
|
const statement = content.slice(statementStartIndex, statementEndIndex);
|
|
131
|
-
const highlightInfoList =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
const highlightInfoList = [];
|
|
132
|
+
const limitIndex = highlightStartIndex + THRESHOLD_CONTENT_LENGTH;
|
|
133
|
+
for (const match of item._matchesPosition?.content || []){
|
|
134
|
+
const { start, length } = match;
|
|
135
|
+
if (start >= highlightStartIndex && start + length <= limitIndex) {
|
|
136
|
+
const startCharIndex = byteToCharIndex(content, start) - statementStartIndex + 3;
|
|
137
|
+
highlightInfoList.push({
|
|
138
|
+
start: startCharIndex,
|
|
139
|
+
length
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
138
143
|
matchedResult.push({
|
|
139
144
|
type: 'content',
|
|
140
145
|
title: item.title,
|
|
@@ -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,7 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import './index.scss';
|
|
2
3
|
export declare const SidebarMenu: import("react").ForwardRefExoticComponent<{
|
|
3
4
|
isSidebarOpen: boolean;
|
|
4
5
|
onIsSidebarOpenChange: (isOpen: boolean) => void;
|
|
5
6
|
isOutlineOpen: boolean;
|
|
6
7
|
onIsOutlineOpenChange: (isOpen: boolean) => void;
|
|
8
|
+
beforeOutline?: ReactNode;
|
|
9
|
+
afterOutline?: ReactNode;
|
|
7
10
|
} & import("react").RefAttributes<unknown>>;
|