@rspress/core 2.0.6 → 2.0.7
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/7397.js +1 -1
- package/dist/8311.js +1 -1
- package/dist/eject-theme/components/Banner/index.tsx +1 -1
- package/dist/eject-theme/components/Button/index.tsx +1 -1
- package/dist/eject-theme/components/CodeBlock/index.scss +54 -1
- package/dist/eject-theme/components/CodeBlock/index.tsx +77 -7
- package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +12 -2
- package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.tsx +15 -15
- package/dist/eject-theme/components/DocContent/docComponents/a.tsx +1 -1
- package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +5 -1
- package/dist/eject-theme/components/DocContent/docComponents/title.tsx +6 -1
- package/dist/eject-theme/components/DocContent/index.tsx +1 -1
- package/dist/eject-theme/components/DocFooter/index.tsx +1 -1
- package/dist/eject-theme/components/EditLink/index.tsx +1 -1
- package/dist/eject-theme/components/FallbackHeading/index.tsx +4 -1
- package/dist/eject-theme/components/HomeFeature/index.tsx +5 -1
- package/dist/eject-theme/components/HomeFooter/index.tsx +1 -1
- package/dist/eject-theme/components/HomeHero/index.tsx +1 -1
- package/dist/eject-theme/components/HoverGroup/index.tsx +4 -1
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +1 -1
- package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +1 -1
- package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +1 -1
- package/dist/eject-theme/components/Nav/NavMenu.tsx +9 -2
- package/dist/eject-theme/components/Nav/index.tsx +1 -1
- package/dist/eject-theme/components/NavHamburger/index.tsx +6 -1
- package/dist/eject-theme/components/NavScreen/NavScreenAppearance.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +5 -1
- package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +1 -1
- package/dist/eject-theme/components/NavScreen/index.tsx +1 -1
- package/dist/eject-theme/components/NavTitle/index.tsx +1 -1
- package/dist/eject-theme/components/Outline/ScrollToTop.tsx +5 -1
- package/dist/eject-theme/components/Outline/index.tsx +1 -1
- package/dist/eject-theme/components/Overview/index.tsx +1 -1
- package/dist/eject-theme/components/OverviewGroup/index.tsx +2 -2
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +1 -1
- package/dist/eject-theme/components/PrevNextPage/index.tsx +1 -1
- package/dist/eject-theme/components/Root/index.tsx +1 -1
- package/dist/eject-theme/components/Search/NoSearchResult.tsx +1 -1
- package/dist/eject-theme/components/Search/SearchButton.tsx +1 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -1
- package/dist/eject-theme/components/Search/SuggestItem.tsx +1 -1
- package/dist/eject-theme/components/Search/index.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +5 -1
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.tsx +1 -1
- package/dist/eject-theme/components/SidebarMenu/index.tsx +1 -1
- package/dist/eject-theme/components/SocialLinks/index.tsx +1 -1
- package/dist/eject-theme/components/SourceCode/index.tsx +1 -1
- package/dist/eject-theme/components/SvgWrapper/index.tsx +1 -1
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +1 -1
- package/dist/eject-theme/components/Tabs/index.tsx +1 -1
- package/dist/eject-theme/components/Tag/index.tsx +1 -1
- package/dist/eject-theme/components/Toc/TocItem.tsx +5 -1
- package/dist/eject-theme/components/Toc/index.tsx +1 -1
- package/dist/node/PluginDriver.js +1 -1
- 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.js +1 -1
- package/dist/node/initRsbuild.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +2 -1
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +6 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +38 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +1 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.js +1 -0
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +2 -2
- 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.js +1 -1
- package/dist/node/ssg/renderPages.js +1 -1
- 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/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- 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/shiki-transformers.js +1 -0
- package/dist/theme/components/Banner/index.js +1 -1
- package/dist/theme/components/Button/index.js +1 -1
- package/dist/theme/components/CodeBlock/index.css +49 -1
- package/dist/theme/components/CodeBlock/index.d.ts +11 -3
- package/dist/theme/components/CodeBlock/index.js +51 -6
- package/dist/theme/components/CodeBlockRuntime/index.d.ts +2 -2
- package/dist/theme/components/CodeBlockRuntime/index.js +10 -2
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +1 -1
- package/dist/theme/components/CodeButtonGroup/index.d.ts +6 -6
- package/dist/theme/components/CodeButtonGroup/index.js +10 -10
- package/dist/theme/components/DocContent/docComponents/a.js +1 -1
- package/dist/theme/components/DocContent/docComponents/pre.d.ts +2 -2
- package/dist/theme/components/DocContent/docComponents/pre.js +4 -2
- package/dist/theme/components/DocContent/docComponents/title.js +1 -1
- package/dist/theme/components/DocContent/index.js +1 -1
- package/dist/theme/components/DocFooter/index.js +1 -1
- package/dist/theme/components/EditLink/index.js +1 -1
- package/dist/theme/components/FallbackHeading/index.js +1 -1
- package/dist/theme/components/HomeFeature/index.js +1 -1
- package/dist/theme/components/HomeFooter/index.js +1 -1
- package/dist/theme/components/HomeHero/index.js +1 -1
- package/dist/theme/components/HoverGroup/index.js +4 -1
- package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
- package/dist/theme/components/Llms/LlmsCopyButton.js +1 -1
- package/dist/theme/components/Llms/LlmsCopyRow.js +1 -1
- package/dist/theme/components/Llms/LlmsOpenRow.js +1 -1
- package/dist/theme/components/Llms/LlmsViewOptions.js +1 -1
- package/dist/theme/components/Nav/NavMenu.d.ts +1 -1
- package/dist/theme/components/Nav/NavMenu.js +2 -1
- package/dist/theme/components/Nav/index.js +1 -1
- package/dist/theme/components/NavHamburger/index.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenAppearance.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenLangs.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +2 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +4 -2
- package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +1 -1
- package/dist/theme/components/NavScreen/NavScreenVersions.js +1 -1
- package/dist/theme/components/NavScreen/index.js +1 -1
- package/dist/theme/components/NavTitle/index.js +1 -1
- package/dist/theme/components/Outline/ScrollToTop.js +1 -1
- package/dist/theme/components/Outline/index.js +1 -1
- package/dist/theme/components/Overview/index.d.ts +1 -1
- package/dist/theme/components/Overview/index.js +1 -1
- package/dist/theme/components/OverviewGroup/index.js +1 -1
- package/dist/theme/components/PackageManagerTabs/index.js +1 -1
- package/dist/theme/components/PrevNextPage/index.js +1 -1
- package/dist/theme/components/Root/index.d.ts +1 -1
- package/dist/theme/components/Search/NoSearchResult.js +1 -1
- package/dist/theme/components/Search/SearchButton.js +1 -1
- package/dist/theme/components/Search/SearchPanel.js +1 -1
- package/dist/theme/components/Search/SuggestItem.js +1 -1
- package/dist/theme/components/Search/index.js +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +1 -1
- package/dist/theme/components/Sidebar/SidebarItem.js +1 -1
- package/dist/theme/components/Sidebar/SidebarSectionHeader.js +1 -1
- package/dist/theme/components/SidebarMenu/index.js +1 -1
- package/dist/theme/components/SocialLinks/index.js +1 -1
- package/dist/theme/components/SourceCode/index.js +1 -1
- package/dist/theme/components/SvgWrapper/index.js +1 -1
- package/dist/theme/components/SwitchAppearance/index.js +1 -1
- package/dist/theme/components/Tabs/index.js +1 -1
- package/dist/theme/components/Tag/index.js +1 -1
- package/dist/theme/components/Toc/TocItem.js +1 -1
- package/dist/theme/components/Toc/index.js +1 -1
- package/dist/theme/layout/DocLayout/index.js +1 -1
- package/dist/theme/layout/HomeLayout/index.js +1 -1
- package/dist/theme/layout/Layout/index.d.ts +2 -2
- package/dist/theme/layout/Layout/index.js +2 -2
- package/dist/theme/layout/NotFountLayout/index.js +1 -1
- package/dist/theme/styles/base.css +1 -1
- package/nav-json-schema.json +3 -0
- package/package.json +10 -10
- /package/dist/{675.js → 4524.js} +0 -0
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
display: inline-block;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.rp-codeblock__content--code
|
|
61
|
+
.rp-codeblock__content--wrap-code code {
|
|
62
62
|
white-space: pre-wrap !important;
|
|
63
63
|
word-break: break-all !important;
|
|
64
64
|
}
|
|
@@ -82,3 +82,51 @@
|
|
|
82
82
|
width: 3ch;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.rp-codeblock__content--fold {
|
|
86
|
+
position: relative;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rp-codeblock__content--fold:after {
|
|
91
|
+
content: "";
|
|
92
|
+
background: linear-gradient(to bottom, transparent, var(--rp-code-block-bg));
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
z-index: 2;
|
|
95
|
+
height: 48px;
|
|
96
|
+
position: absolute;
|
|
97
|
+
bottom: 0;
|
|
98
|
+
left: 0;
|
|
99
|
+
right: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.rp-codeblock__fold-btn {
|
|
103
|
+
background-color: var(--rp-code-block-bg);
|
|
104
|
+
width: 100%;
|
|
105
|
+
color: var(--rp-c-text-3);
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
-webkit-user-select: none;
|
|
108
|
+
user-select: none;
|
|
109
|
+
border-radius: 0 0 var(--rp-radius) var(--rp-radius);
|
|
110
|
+
border: none;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
113
|
+
padding: 4px 0;
|
|
114
|
+
transition: color .2s, background-color .2s;
|
|
115
|
+
display: flex;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rp-codeblock__fold-btn:hover {
|
|
119
|
+
color: var(--rp-c-text-1);
|
|
120
|
+
background-color: var(--rp-code-title-bg);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.rp-codeblock__fold-btn__icon {
|
|
124
|
+
width: 18px;
|
|
125
|
+
height: 18px;
|
|
126
|
+
transition: transform .3s;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.rp-codeblock__fold-btn--expanded .rp-codeblock__fold-btn__icon {
|
|
130
|
+
transform: rotate(180deg);
|
|
131
|
+
}
|
|
132
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CodeButtonGroupProps } from '@theme';
|
|
1
|
+
import { type CodeButtonGroupProps } from '@rspress/core/theme';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
export type CodeBlockProps = {
|
|
4
4
|
title?: string;
|
|
@@ -11,8 +11,16 @@ export type CodeBlockProps = {
|
|
|
11
11
|
* @default false
|
|
12
12
|
*/
|
|
13
13
|
lineNumbers?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
fold?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @default 300
|
|
20
|
+
*/
|
|
21
|
+
height?: number;
|
|
14
22
|
containerElementClassName?: string;
|
|
15
|
-
codeButtonGroupProps?: Omit<CodeButtonGroupProps, 'preElementRef' | '
|
|
23
|
+
codeButtonGroupProps?: Omit<CodeButtonGroupProps, 'preElementRef' | 'wrapCode' | 'toggleWrapCode'>;
|
|
16
24
|
children?: React.ReactNode;
|
|
17
25
|
};
|
|
18
26
|
/**
|
|
@@ -51,4 +59,4 @@ export type CodeBlockProps = {
|
|
|
51
59
|
*</div>
|
|
52
60
|
*```
|
|
53
61
|
*/
|
|
54
|
-
export declare function CodeBlock({ containerElementClassName, title, lang, wrapCode: wrapCodeProp, lineNumbers: lineNumbersProp, codeButtonGroupProps, children, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare function CodeBlock({ containerElementClassName, title, lang, wrapCode: wrapCodeProp, lineNumbers: lineNumbersProp, fold, height, codeButtonGroupProps, children, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CodeButtonGroup, useCodeButtonGroup } from "@theme";
|
|
2
|
+
import { CodeButtonGroup, IconArrowDown, SvgWrapper, useCodeButtonGroup } from "@rspress/core/theme";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
5
|
import "./index.css";
|
|
5
|
-
function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, codeButtonGroupProps, children }) {
|
|
6
|
+
function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, fold = false, height = 300, codeButtonGroupProps, children }) {
|
|
6
7
|
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
|
|
7
8
|
children: children
|
|
8
9
|
});
|
|
9
|
-
const {
|
|
10
|
+
const { wrapCode: wrapCodeState, toggleWrapCode, copyElementRef } = useCodeButtonGroup(wrapCodeProp);
|
|
11
|
+
const [expanded, setExpanded] = useState(false);
|
|
12
|
+
const [needFold, setNeedFold] = useState(false);
|
|
13
|
+
const codeBlockRef = useRef(null);
|
|
14
|
+
const contentRef = useRef(null);
|
|
15
|
+
useEffect(()=>{
|
|
16
|
+
if (!fold || !contentRef.current) return void setNeedFold(false);
|
|
17
|
+
const realHeight = contentRef.current.scrollHeight;
|
|
18
|
+
setNeedFold(realHeight > height);
|
|
19
|
+
}, [
|
|
20
|
+
fold,
|
|
21
|
+
height
|
|
22
|
+
]);
|
|
23
|
+
const handleFoldToggle = useCallback(()=>{
|
|
24
|
+
if (expanded) {
|
|
25
|
+
setExpanded(false);
|
|
26
|
+
requestAnimationFrame(()=>{
|
|
27
|
+
if (codeBlockRef.current) {
|
|
28
|
+
const rect = codeBlockRef.current.getBoundingClientRect();
|
|
29
|
+
if (rect.top < 0) window.scrollBy({
|
|
30
|
+
top: rect.top - 16,
|
|
31
|
+
behavior: 'smooth'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
} else setExpanded(true);
|
|
36
|
+
}, [
|
|
37
|
+
expanded
|
|
38
|
+
]);
|
|
10
39
|
return /*#__PURE__*/ jsxs("div", {
|
|
11
40
|
className: clsx('rp-codeblock', `language-${lang}`, containerElementClassName),
|
|
41
|
+
ref: codeBlockRef,
|
|
12
42
|
children: [
|
|
13
43
|
title && /*#__PURE__*/ jsx("div", {
|
|
14
44
|
className: "rp-codeblock__title",
|
|
15
45
|
children: title
|
|
16
46
|
}),
|
|
17
47
|
/*#__PURE__*/ jsxs("div", {
|
|
18
|
-
className: clsx('rp-codeblock__content',
|
|
48
|
+
className: clsx('rp-codeblock__content', wrapCodeState && 'rp-codeblock__content--wrap-code', lineNumbersProp && 'rp-codeblock__content--line-numbers', needFold && !expanded && 'rp-codeblock__content--fold'),
|
|
49
|
+
style: needFold && !expanded ? {
|
|
50
|
+
maxHeight: `${height}px`
|
|
51
|
+
} : void 0,
|
|
52
|
+
ref: contentRef,
|
|
19
53
|
children: [
|
|
20
54
|
/*#__PURE__*/ jsx("div", {
|
|
21
55
|
className: "rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always",
|
|
@@ -25,10 +59,21 @@ function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: w
|
|
|
25
59
|
/*#__PURE__*/ jsx(CodeButtonGroup, {
|
|
26
60
|
...codeButtonGroupProps,
|
|
27
61
|
copyElementRef: copyElementRef,
|
|
28
|
-
|
|
29
|
-
|
|
62
|
+
wrapCode: wrapCodeState,
|
|
63
|
+
toggleWrapCode: toggleWrapCode
|
|
30
64
|
})
|
|
31
65
|
]
|
|
66
|
+
}),
|
|
67
|
+
needFold && /*#__PURE__*/ jsx("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
className: clsx('rp-codeblock__fold-btn', expanded && 'rp-codeblock__fold-btn--expanded'),
|
|
70
|
+
onClick: handleFoldToggle,
|
|
71
|
+
"aria-label": expanded ? 'Collapse code' : 'Expand code',
|
|
72
|
+
"aria-expanded": expanded,
|
|
73
|
+
children: /*#__PURE__*/ jsx(SvgWrapper, {
|
|
74
|
+
icon: IconArrowDown,
|
|
75
|
+
className: "rp-codeblock__fold-btn__icon"
|
|
76
|
+
})
|
|
32
77
|
})
|
|
33
78
|
]
|
|
34
79
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CodeBlockProps } from '@theme';
|
|
1
|
+
import type { CodeBlockProps } from '@rspress/core/theme';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import { type BundledLanguage, type BundledTheme, type CodeToHastOptions } from 'shiki';
|
|
4
4
|
export interface CodeBlockRuntimeProps extends CodeBlockProps {
|
|
@@ -11,4 +11,4 @@ export interface CodeBlockRuntimeProps extends CodeBlockProps {
|
|
|
11
11
|
*/
|
|
12
12
|
onRendered?: () => void;
|
|
13
13
|
}
|
|
14
|
-
export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, }: CodeBlockRuntimeProps): ReactNode;
|
|
14
|
+
export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, fold, height, }: CodeBlockRuntimeProps): ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getCustomMDXComponent } from "@theme";
|
|
2
|
+
import { getCustomMDXComponent } from "@rspress/core/theme";
|
|
3
3
|
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
4
4
|
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { codeToHast, createCssVariablesTheme } from "shiki";
|
|
@@ -14,7 +14,7 @@ const useLatest = (value)=>{
|
|
|
14
14
|
ref.current = value;
|
|
15
15
|
return ref;
|
|
16
16
|
};
|
|
17
|
-
function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers }) {
|
|
17
|
+
function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, fold, height }) {
|
|
18
18
|
const mdxComponents = useMemo(()=>getCustomMDXComponent(), []);
|
|
19
19
|
const { pre: ShikiPre, code: Code, ...otherMdxComponents } = mdxComponents;
|
|
20
20
|
const fallback = useMemo(()=>/*#__PURE__*/ jsx(ShikiPre, {
|
|
@@ -22,6 +22,8 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
22
22
|
lang: lang,
|
|
23
23
|
wrapCode: wrapCode,
|
|
24
24
|
lineNumbers: lineNumbers,
|
|
25
|
+
fold: fold,
|
|
26
|
+
height: height,
|
|
25
27
|
containerElementClassName: containerElementClassName,
|
|
26
28
|
codeButtonGroupProps: codeButtonGroupProps,
|
|
27
29
|
className: "shiki css-variables",
|
|
@@ -36,6 +38,8 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
36
38
|
lang,
|
|
37
39
|
wrapCode,
|
|
38
40
|
lineNumbers,
|
|
41
|
+
fold,
|
|
42
|
+
height,
|
|
39
43
|
containerElementClassName,
|
|
40
44
|
codeButtonGroupProps,
|
|
41
45
|
code
|
|
@@ -63,6 +67,8 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
63
67
|
codeButtonGroupProps: codeButtonGroupProps,
|
|
64
68
|
wrapCode: wrapCode,
|
|
65
69
|
lineNumbers: lineNumbers,
|
|
70
|
+
fold: fold,
|
|
71
|
+
height: height,
|
|
66
72
|
...props
|
|
67
73
|
}),
|
|
68
74
|
code: (props)=>/*#__PURE__*/ jsx(Code, {
|
|
@@ -80,6 +86,8 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
80
86
|
containerElementClassName,
|
|
81
87
|
lang,
|
|
82
88
|
lineNumbers,
|
|
89
|
+
fold,
|
|
90
|
+
height,
|
|
83
91
|
shikiOptions,
|
|
84
92
|
title,
|
|
85
93
|
wrapCode
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IconCopy, IconSuccess, SvgWrapper } from "@theme";
|
|
2
|
+
import { IconCopy, IconSuccess, SvgWrapper } from "@rspress/core/theme";
|
|
3
3
|
import copy_to_clipboard from "copy-to-clipboard";
|
|
4
4
|
import { useRef } from "react";
|
|
5
5
|
import "./CopyCodeButton.css";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
2
|
export interface CodeButtonGroupProps {
|
|
3
3
|
copyElementRef: React.RefObject<HTMLDivElement | null>;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
wrapCode: boolean;
|
|
5
|
+
toggleWrapCode: () => void;
|
|
6
6
|
/**
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
showWrapCodeButton?: boolean;
|
|
10
10
|
/**
|
|
11
11
|
* @default true
|
|
12
12
|
*/
|
|
@@ -14,7 +14,7 @@ export interface CodeButtonGroupProps {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const useCodeButtonGroup: (initialWrapCode?: boolean) => {
|
|
16
16
|
copyElementRef: import("react").RefObject<HTMLDivElement | null>;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
wrapCode: boolean;
|
|
18
|
+
toggleWrapCode: () => void;
|
|
19
19
|
};
|
|
20
|
-
export declare function CodeButtonGroup({
|
|
20
|
+
export declare function CodeButtonGroup({ wrapCode, toggleWrapCode, copyElementRef, showWrapCodeButton, showCopyButton, }: CodeButtonGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { IconWrap, IconWrapped, SvgWrapper } from "@theme";
|
|
3
|
+
import { IconWrap, IconWrapped, SvgWrapper } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useRef, useState } from "react";
|
|
6
6
|
import "./index.css";
|
|
@@ -8,25 +8,25 @@ import { CopyCodeButton } from "./CopyCodeButton.js";
|
|
|
8
8
|
const useCodeButtonGroup = (initialWrapCode)=>{
|
|
9
9
|
const { site } = useSite();
|
|
10
10
|
const { defaultWrapCode } = site.markdown;
|
|
11
|
-
const [
|
|
11
|
+
const [wrapCode, setWrapCode] = useState(initialWrapCode ?? defaultWrapCode);
|
|
12
12
|
const copyElementRef = useRef(null);
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const toggleWrapCode = ()=>{
|
|
14
|
+
setWrapCode(!wrapCode);
|
|
15
15
|
};
|
|
16
16
|
return {
|
|
17
17
|
copyElementRef,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
wrapCode,
|
|
19
|
+
toggleWrapCode
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
function CodeButtonGroup({
|
|
22
|
+
function CodeButtonGroup({ wrapCode, toggleWrapCode, copyElementRef, showWrapCodeButton = true, showCopyButton = true }) {
|
|
23
23
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
24
24
|
children: /*#__PURE__*/ jsxs("div", {
|
|
25
25
|
className: "rp-code-button-group",
|
|
26
26
|
children: [
|
|
27
|
-
|
|
28
|
-
className: clsx('rp-code-button-group__button', 'rp-code-wrap-button',
|
|
29
|
-
onClick: ()=>
|
|
27
|
+
showWrapCodeButton && /*#__PURE__*/ jsxs("button", {
|
|
28
|
+
className: clsx('rp-code-button-group__button', 'rp-code-wrap-button', wrapCode && 'rp-code-wrap-button--wrapped'),
|
|
29
|
+
onClick: ()=>toggleWrapCode(),
|
|
30
30
|
title: "Toggle code wrap",
|
|
31
31
|
children: [
|
|
32
32
|
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type CodeBlockProps } from '@theme';
|
|
1
|
+
import { type CodeBlockProps } from '@rspress/core/theme';
|
|
2
2
|
export type ShikiPreProps = CodeBlockProps & React.HTMLAttributes<HTMLPreElement>;
|
|
3
|
-
export declare function ShikiPre({ title, lang, wrapCode, lineNumbers, containerElementClassName, codeButtonGroupProps, ...otherProps }: ShikiPreProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ShikiPre({ title, lang, wrapCode, lineNumbers, fold, height, containerElementClassName, codeButtonGroupProps, ...otherProps }: ShikiPreProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CodeBlock } from "@theme";
|
|
3
|
-
function ShikiPre({ title, lang, wrapCode, lineNumbers, containerElementClassName, codeButtonGroupProps, ...otherProps }) {
|
|
2
|
+
import { CodeBlock } from "@rspress/core/theme";
|
|
3
|
+
function ShikiPre({ title, lang, wrapCode, lineNumbers, fold, height, containerElementClassName, codeButtonGroupProps, ...otherProps }) {
|
|
4
4
|
return /*#__PURE__*/ jsx(CodeBlock, {
|
|
5
5
|
title: title,
|
|
6
6
|
lang: lang,
|
|
7
7
|
wrapCode: wrapCode,
|
|
8
8
|
lineNumbers: lineNumbers,
|
|
9
|
+
fold: fold,
|
|
10
|
+
height: height,
|
|
9
11
|
containerElementClassName: containerElementClassName,
|
|
10
12
|
codeButtonGroupProps: codeButtonGroupProps,
|
|
11
13
|
children: /*#__PURE__*/ jsx("pre", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useFrontmatter, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, Tag } from "@theme";
|
|
3
|
+
import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, Tag } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
const H1 = (props)=>{
|
|
6
6
|
const { className, children, ...rest } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MDXProvider } from "@mdx-js/react";
|
|
3
3
|
import { Content, usePage, useSite } from "@rspress/core/runtime";
|
|
4
|
-
import { Callout, FallbackHeading, getCustomMDXComponent, useScrollAfterNav } from "@theme";
|
|
4
|
+
import { Callout, FallbackHeading, getCustomMDXComponent, useScrollAfterNav } from "@rspress/core/theme";
|
|
5
5
|
import "./doc.css";
|
|
6
6
|
function FallbackTitle() {
|
|
7
7
|
const { site } = useSite();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { EditLink, LastUpdated, PrevNextPage } from "@theme";
|
|
2
|
+
import { EditLink, LastUpdated, PrevNextPage } from "@rspress/core/theme";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
function DocFooter() {
|
|
5
5
|
return /*#__PURE__*/ jsxs("footer", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IconEdit, Link, SvgWrapper } from "@theme";
|
|
2
|
+
import { IconEdit, Link, SvgWrapper } from "@rspress/core/theme";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
import { useEditLink } from "./useEditLink.js";
|
|
5
5
|
function EditLink({ isOutline }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getCustomMDXComponent, renderInlineMarkdown } from "@theme";
|
|
2
|
+
import { getCustomMDXComponent, renderInlineMarkdown } from "@rspress/core/theme";
|
|
3
3
|
import { slug } from "github-slugger";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
const getHeadingMap = ()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useFrontmatter } from "@rspress/core/runtime";
|
|
3
|
-
import { SvgWrapper, renderHtmlOrText, useLinkNavigate } from "@theme";
|
|
3
|
+
import { SvgWrapper, renderHtmlOrText, useLinkNavigate } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { useCardAnimation } from "./useCardAnimation.js";
|
|
6
6
|
const getGridClass = (feature)=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { renderHtmlOrText } from "@theme";
|
|
3
|
+
import { renderHtmlOrText } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
function HomeFooter() {
|
|
6
6
|
const { site } = useSite();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { normalizeImagePath, useFrontmatter } from "@rspress/core/runtime";
|
|
3
|
-
import { Button, Link, renderHtmlOrText } from "@theme";
|
|
3
|
+
import { Button, Link, renderHtmlOrText } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
const DEFAULT_HERO = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { matchNavbar, useLocation } from "@rspress/core/runtime";
|
|
3
|
-
import { Link, Tag } from "@theme";
|
|
3
|
+
import { Link, Tag } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import "./index.css";
|
|
6
6
|
function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
@@ -17,6 +17,7 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
17
17
|
"data-depth": depth,
|
|
18
18
|
children: /*#__PURE__*/ jsxs(Link, {
|
|
19
19
|
href: item.link,
|
|
20
|
+
download: 'download' in item ? item.download : void 0,
|
|
20
21
|
"aria-label": item.text,
|
|
21
22
|
className: "rp-hover-group__item__link",
|
|
22
23
|
lang: item.lang,
|
|
@@ -40,6 +41,7 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
40
41
|
}
|
|
41
42
|
if ('link' in item) {
|
|
42
43
|
const { text, link, lang, rel } = item;
|
|
44
|
+
const download = 'download' in item ? item.download : void 0;
|
|
43
45
|
const isActiveItem = activeMatcher ? activeMatcher(item) : matchNavbar(item, pathname);
|
|
44
46
|
return /*#__PURE__*/ jsx("li", {
|
|
45
47
|
className: clsx('rp-hover-group__item', {
|
|
@@ -51,6 +53,7 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
51
53
|
"data-depth": depth,
|
|
52
54
|
children: link ? /*#__PURE__*/ jsxs(Link, {
|
|
53
55
|
href: link,
|
|
56
|
+
download: download,
|
|
54
57
|
"aria-label": text,
|
|
55
58
|
className: "rp-hover-group__item__link",
|
|
56
59
|
lang: lang,
|
|
@@ -6,7 +6,7 @@ export declare function getHref(href: string): {
|
|
|
6
6
|
linkType: LinkType;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* For import { Link } from '@theme';
|
|
9
|
+
* For import { Link } from '@rspress/core/theme';
|
|
10
10
|
* useNavigate with preload logic
|
|
11
11
|
*/
|
|
12
12
|
export declare function useLinkNavigate({ startTransition }?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! LICENSE: LlmsCopyButton.js.LICENSE.txt */
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useI18n } from "@rspress/core/runtime";
|
|
4
|
-
import { IconCopy, IconSuccess } from "@theme";
|
|
4
|
+
import { IconCopy, IconSuccess } from "@rspress/core/theme";
|
|
5
5
|
import { useCallback, useRef, useState } from "react";
|
|
6
6
|
import { SvgWrapper } from "../SvgWrapper/index.js";
|
|
7
7
|
import "./index.css";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n } from "@rspress/core/runtime";
|
|
3
|
-
import { IconCopy, IconSuccess, SvgWrapper } from "@theme";
|
|
3
|
+
import { IconCopy, IconSuccess, SvgWrapper } from "@rspress/core/theme";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
5
5
|
import { copyToClipboard } from "./copy.js";
|
|
6
6
|
import { useMdUrl } from "./useMdUrl.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { IconExternalLink, SvgWrapper } from "@theme";
|
|
3
|
+
import { IconExternalLink, SvgWrapper } from "@rspress/core/theme";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import "./LlmsOpenRow.css";
|
|
6
6
|
import "./LlmsViewOptions.css";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! LICENSE: LlmsViewOptions.js.LICENSE.txt */
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useI18n, useSite } from "@rspress/core/runtime";
|
|
4
|
-
import { IconDown, IconExternalLink, IconLink } from "@theme";
|
|
4
|
+
import { IconDown, IconExternalLink, IconLink } from "@rspress/core/theme";
|
|
5
5
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { SvgWrapper } from "../SvgWrapper/index.js";
|
|
7
7
|
import "./index.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren } from '@rspress/core';
|
|
2
|
-
import type { HoverGroupProps } from '@theme';
|
|
2
|
+
import type { HoverGroupProps } from '@rspress/core/theme';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
4
|
import './NavMenu.scss';
|
|
5
5
|
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { matchNavbar, useLocation } from "@rspress/core/runtime";
|
|
3
|
-
import { IconArrowDown, Link, SvgWrapper, Tag, useHoverGroup } from "@theme";
|
|
3
|
+
import { IconArrowDown, Link, SvgWrapper, Tag, useHoverGroup } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useMemo } from "react";
|
|
6
6
|
import { useLangsMenu, useVersionsMenu } from "./hooks.js";
|
|
@@ -13,6 +13,7 @@ function NavMenuItemInner({ menuItem, children }) {
|
|
|
13
13
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
14
14
|
children: 'link' in menuItem && 'string' == typeof menuItem.link ? /*#__PURE__*/ jsxs(Link, {
|
|
15
15
|
href: menuItem.link,
|
|
16
|
+
download: menuItem.download,
|
|
16
17
|
className: "rp-nav-menu__item__container",
|
|
17
18
|
hrefLang: menuItem.lang,
|
|
18
19
|
lang: menuItem.lang,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useNav, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { NavHamburger, NavTitle, Search, SocialLinks, SwitchAppearance } from "@theme";
|
|
3
|
+
import { NavHamburger, NavTitle, Search, SocialLinks, SwitchAppearance } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { NavLangs, NavMenu, NavMenuDivider, NavVersions } from "./NavMenu.js";
|
|
6
6
|
function Nav(props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IconSmallMenu, SocialLinks, SvgWrapper, useHoverGroup } from "@theme";
|
|
2
|
+
import { IconSmallMenu, SocialLinks, SvgWrapper, useHoverGroup } from "@rspress/core/theme";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { NavVersions } from "../Nav/NavMenu.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NoSSR, useI18n, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { SwitchAppearance } from "@theme";
|
|
3
|
+
import { SwitchAppearance } from "@rspress/core/theme";
|
|
4
4
|
import "./NavScreenAppearance.css";
|
|
5
5
|
function NavScreenAppearance() {
|
|
6
6
|
const { site } = useSite();
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { useLangsMenu } from "../Nav/hooks.js";
|
|
4
4
|
import "./NavScreenLangs.css";
|
|
5
5
|
import { useI18n } from "@rspress/core/runtime";
|
|
6
|
-
import { Link } from "@theme";
|
|
6
|
+
import { Link } from "@rspress/core/theme";
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
import { SvgDown } from "./NavScreenMenuItem.js";
|
|
9
9
|
function NavScreenLangs() {
|
|
@@ -5,13 +5,14 @@ interface NavScreenMenuItemWithLinkProps {
|
|
|
5
5
|
menuItem: NavItemWithLink;
|
|
6
6
|
}
|
|
7
7
|
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href, }: {
|
|
8
|
+
export declare function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href, download, }: {
|
|
9
9
|
left: React.ReactNode;
|
|
10
10
|
right: React.ReactNode;
|
|
11
11
|
isOpen?: boolean;
|
|
12
12
|
isActive?: boolean;
|
|
13
13
|
onClick?: () => void;
|
|
14
14
|
href?: string;
|
|
15
|
+
download?: boolean;
|
|
15
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare function NavScreenMenuItemWithLink({ menuItem, }: NavScreenMenuItemWithLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
interface NavScreenMenuItemWithChildrenProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { matchNavbar, useLocation } from "@rspress/core/runtime";
|
|
3
|
-
import { IconArrowDown, Link, SvgWrapper, Tag } from "@theme";
|
|
3
|
+
import { IconArrowDown, Link, SvgWrapper, Tag } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import "./NavScreenMenuItem.css";
|
|
@@ -8,11 +8,12 @@ const SvgDown = (props)=>/*#__PURE__*/ jsx(SvgWrapper, {
|
|
|
8
8
|
icon: IconArrowDown,
|
|
9
9
|
...props
|
|
10
10
|
});
|
|
11
|
-
function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href }) {
|
|
11
|
+
function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href, download }) {
|
|
12
12
|
if (href) return /*#__PURE__*/ jsxs(Link, {
|
|
13
13
|
href: href,
|
|
14
14
|
className: clsx('rp-nav-screen-menu-item', isOpen && 'rp-nav-screen-menu-item--open', isActive && 'rp-nav-screen-menu-item--active'),
|
|
15
15
|
onClick: onClick,
|
|
16
|
+
download: download,
|
|
16
17
|
children: [
|
|
17
18
|
/*#__PURE__*/ jsx("div", {
|
|
18
19
|
className: "rp-nav-screen-menu-item__left",
|
|
@@ -56,6 +57,7 @@ function NavScreenMenuItemWithLink({ menuItem }) {
|
|
|
56
57
|
}),
|
|
57
58
|
right: null,
|
|
58
59
|
href: menuItem.link,
|
|
60
|
+
download: menuItem.download,
|
|
59
61
|
isActive: isActive
|
|
60
62
|
});
|
|
61
63
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NoSSR, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { SocialLinks, SwitchAppearance } from "@theme";
|
|
3
|
+
import { SocialLinks, SwitchAppearance } from "@rspress/core/theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { NavScreenLangs } from "./NavScreenLangs.js";
|
|
6
6
|
import { NavScreenVersions } from "./NavScreenVersions.js";
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { useVersionsMenu } from "../Nav/hooks.js";
|
|
4
4
|
import "./NavScreenVersions.css";
|
|
5
5
|
import { useI18n } from "@rspress/core/runtime";
|
|
6
|
-
import { Link } from "@theme";
|
|
6
|
+
import { Link } from "@rspress/core/theme";
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
import { SvgDown } from "./NavScreenMenuItem.js";
|
|
9
9
|
function NavScreenVersions() {
|