@rspress/core 2.0.0-rc.2 → 2.0.0-rc.3
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~7675.989ee664.js → 0~7675.723d12b2.js} +17 -14
- package/dist/{5313.6594aba0.js → 3521.56e42d70.js} +0 -7
- package/dist/{5485.2a0273cf.js → 5485.077f14ff.js} +1 -1
- package/dist/{7805.cadab34e.js → 9643.f109822d.js} +2 -1
- package/dist/_private/react/render.js +17 -4
- package/dist/cli/config/loadConfigFile.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/eject-theme/components/Badge/index.scss +1 -0
- package/dist/eject-theme/components/Banner/index.tsx +3 -1
- package/dist/eject-theme/components/Callout/index.tsx +8 -2
- package/dist/eject-theme/components/CodeBlock/index.scss +8 -6
- package/dist/eject-theme/components/CodeBlock/index.tsx +4 -0
- package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +50 -11
- package/dist/eject-theme/components/DocContent/doc.scss +1 -1
- package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +2 -1
- package/dist/eject-theme/components/DocContent/index.tsx +21 -4
- package/dist/eject-theme/components/DocFooter/index.tsx +1 -6
- package/dist/eject-theme/components/HoverGroup/index.scss +1 -1
- package/dist/eject-theme/components/LastUpdated/index.tsx +8 -1
- package/dist/eject-theme/components/Link/index.tsx +9 -2
- package/dist/eject-theme/components/NavScreen/NavScreenLangs.scss +6 -0
- package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +23 -9
- package/dist/eject-theme/components/NavScreen/NavScreenVersions.scss +6 -0
- package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +22 -9
- package/dist/eject-theme/components/Overview/index.tsx +1 -6
- package/dist/eject-theme/components/{Overview/OverviewGroup.scss → OverviewGroup/index.scss} +66 -12
- package/dist/eject-theme/components/{Overview/OverviewGroup.tsx → OverviewGroup/index.tsx} +50 -3
- package/dist/eject-theme/components/Search/logic/util.test.ts +1 -1
- package/dist/eject-theme/components/Tabs/index.scss +12 -4
- package/dist/eject-theme/components/Tabs/index.tsx +16 -0
- package/dist/eject-theme/components/Tag/index.tsx +84 -5
- package/dist/index.js +2 -2
- package/dist/node/PluginDriver.js +3 -4
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +11 -9
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/constants.d.ts +1 -0
- package/dist/node/constants.js +3 -2
- package/dist/node/eject.js +5 -5
- package/dist/node/initRsbuild.js +14 -6
- package/dist/node/last-updated/index.js +1 -1
- package/dist/node/mdx/loader.js +2 -1
- package/dist/node/mdx/options.js +7 -4
- package/dist/node/mdx/processor.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +1 -1
- package/dist/node/mdx/remarkPlugins/image.js +1 -1
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +2 -2
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- package/dist/node/serve.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/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +6 -2
- package/dist/node/ssg-md/remarkSplitMdx.js +140 -98
- package/dist/node/ssg-md/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +2 -1
- package/dist/node/utils/flattenMdxContent.js +2 -2
- package/dist/node/utils/normalizePath.js +1 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/runtime/initPageData.js +1 -1
- package/dist/theme/assets/deprecated.js +18 -0
- package/dist/theme/assets/experimental.js +21 -0
- package/dist/theme/components/Badge/index.css +1 -0
- package/dist/theme/components/Banner/index.js +2 -2
- package/dist/theme/components/Callout/index.js +5 -2
- package/dist/theme/components/CodeBlock/index.css +7 -6
- package/dist/theme/components/CodeBlock/index.js +4 -1
- package/dist/theme/components/CodeBlockRuntime/index.d.ts +1 -1
- package/dist/theme/components/CodeBlockRuntime/index.js +38 -8
- package/dist/theme/components/DocContent/doc.css +1 -1
- package/dist/theme/components/DocContent/docComponents/pre.js +3 -1
- package/dist/theme/components/DocContent/index.d.ts +11 -2
- package/dist/theme/components/DocContent/index.js +6 -5
- package/dist/theme/components/DocFooter/index.js +1 -5
- package/dist/theme/components/HoverGroup/index.css +3 -3
- package/dist/theme/components/LastUpdated/index.d.ts +1 -1
- package/dist/theme/components/LastUpdated/index.js +5 -1
- package/dist/theme/components/Link/index.d.ts +1 -1
- package/dist/theme/components/Link/index.js +8 -2
- package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
- package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
- package/dist/theme/components/NavScreen/NavScreenVersions.css +6 -0
- package/dist/theme/components/NavScreen/NavScreenVersions.js +12 -3
- package/dist/theme/components/Overview/index.d.ts +0 -1
- package/dist/theme/components/Overview/index.js +1 -1
- package/dist/theme/components/{Overview/OverviewGroup.css → OverviewGroup/index.css} +60 -8
- package/dist/theme/components/{Overview/OverviewGroup.d.ts → OverviewGroup/index.d.ts} +1 -1
- package/dist/theme/components/OverviewGroup/index.js +88 -0
- package/dist/theme/components/Search/logic/util.test.js +1 -1
- package/dist/theme/components/Tabs/index.css +6 -5
- package/dist/theme/components/Tabs/index.js +9 -0
- package/dist/theme/components/Tag/index.d.ts +3 -0
- package/dist/theme/components/Tag/index.js +63 -8
- package/dist/theme/hooks/useActiveAnchor.js +1 -1
- package/dist/theme/icons.d.ts +26 -24
- package/dist/theme/icons.js +5 -1
- package/dist/theme/index.d.ts +3 -1
- package/dist/theme/index.js +4 -2
- package/dist/theme/layout/DocLayout/index.css +0 -2
- package/dist/theme/layout/Layout/index.js +1 -2
- package/dist/theme/layout/NotFountLayout/index.js +1 -1
- package/dist/theme/logic/useAppearance.js +1 -1
- package/dist/theme/logic/useMediaQuery.js +1 -1
- package/dist/theme/styles/base.css +1 -0
- package/dist/theme/styles/shiki.css +9 -3
- package/dist/theme/styles/vars/base-vars.css +2 -2
- package/dist/theme/styles/vars/code-vars.css +2 -0
- package/package.json +14 -14
- package/dist/1218.3869bad6.js +0 -2
- package/dist/theme/components/Overview/OverviewGroup.js +0 -57
- /package/dist/eject-theme/components/{Overview → OverviewGroup}/icons/plugin.svg +0 -0
- /package/dist/theme/components/{Overview → OverviewGroup}/icons/plugin.js +0 -0
|
@@ -24,7 +24,7 @@ async function initPageData(routePath) {
|
|
|
24
24
|
}
|
|
25
25
|
let lang = virtual_site_data.lang || '';
|
|
26
26
|
let version = virtual_site_data.multiVersion?.default || '';
|
|
27
|
-
if (virtual_site_data.lang &&
|
|
27
|
+
if (virtual_site_data.lang && "u" > typeof window) {
|
|
28
28
|
const path = window.location.pathname.replace(virtual_site_data.base, '').split('/').slice(0, 2);
|
|
29
29
|
if (virtual_site_data.locales.length) {
|
|
30
30
|
const result = virtual_site_data.locales.find(({ lang })=>path.includes(lang));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgDeprecated = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
width: "1em",
|
|
5
|
+
height: "1em",
|
|
6
|
+
strokeLinejoin: "round",
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
viewBox: "0 0 16 16",
|
|
9
|
+
...props,
|
|
10
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
fillRule: "evenodd",
|
|
13
|
+
d: "M6.75 2.75a1.25 1.25 0 1 1 2.5 0V3h-2.5zM5.25 3v-.25a2.75 2.75 0 0 1 5.5 0V3H15v1.5h-1.115l-.707 9.192A2.5 2.5 0 0 1 10.685 16h-5.37a2.5 2.5 0 0 1-2.493-2.308L2.115 4.5H1V3h4.25m-.932 10.577L3.62 4.5h8.76l-.698 9.077a1 1 0 0 1-.997.923h-5.37a1 1 0 0 1-.997-.923",
|
|
14
|
+
clipRule: "evenodd"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
var deprecated = SvgDeprecated;
|
|
18
|
+
export { deprecated as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgExperimental = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
width: "1em",
|
|
5
|
+
height: "1em",
|
|
6
|
+
strokeLinejoin: "round",
|
|
7
|
+
"data-testid": "geist-icon",
|
|
8
|
+
style: {
|
|
9
|
+
color: "currentcolor"
|
|
10
|
+
},
|
|
11
|
+
viewBox: "0 0 16 16",
|
|
12
|
+
...props,
|
|
13
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
fillRule: "evenodd",
|
|
16
|
+
d: "M9 7.674V2.5H7v5.174l-.503.447L4.383 10h7.234L9.503 8.121zM5.5 2.5H4V1h8v1.5h-1.5V7l3.573 3.177A2.76 2.76 0 0 1 12.24 15H3.76a2.76 2.76 0 0 1-1.834-4.823L5.5 7zm-3 9.74c0-.268.085-.527.24-.74h10.52a1.26 1.26 0 0 1-1.02 2H3.76a1.26 1.26 0 0 1-1.26-1.26",
|
|
17
|
+
clipRule: "evenodd"
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
var experimental = SvgExperimental;
|
|
21
|
+
export { experimental as default };
|
|
@@ -7,11 +7,11 @@ const Banner = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
|
7
7
|
const { href, message, display = true, className, storageKey = 'rp-banner-closed', storage = 'localStorage', customChildren } = props;
|
|
8
8
|
const [height, setHeight] = useState(36);
|
|
9
9
|
const ref = mergeRefs(forwardedRef, (element)=>{
|
|
10
|
-
element?.offsetHeight
|
|
10
|
+
if (element?.offsetHeight) setHeight(element?.offsetHeight);
|
|
11
11
|
});
|
|
12
12
|
const [disable, setDisable] = useState(false);
|
|
13
13
|
useEffect(()=>{
|
|
14
|
-
if (
|
|
14
|
+
if ("u" < typeof window || !storage || !storageKey) return;
|
|
15
15
|
setDisable(Boolean(window[storage].getItem(storageKey)));
|
|
16
16
|
}, []);
|
|
17
17
|
if (!display || disable) return null;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./index.css";
|
|
3
|
+
function capitalize(type) {
|
|
4
|
+
return type.charAt(0).toUpperCase() + type.slice(1);
|
|
5
|
+
}
|
|
3
6
|
function Callout({ type, title, children }) {
|
|
4
7
|
const isDetails = 'details' === type;
|
|
5
8
|
if (isDetails) return /*#__PURE__*/ jsxs("details", {
|
|
@@ -7,7 +10,7 @@ function Callout({ type, title, children }) {
|
|
|
7
10
|
children: [
|
|
8
11
|
/*#__PURE__*/ jsx("summary", {
|
|
9
12
|
className: "rp-callout__title",
|
|
10
|
-
children: title
|
|
13
|
+
children: title ?? capitalize(type)
|
|
11
14
|
}),
|
|
12
15
|
/*#__PURE__*/ jsx("div", {
|
|
13
16
|
className: "rp-callout__content",
|
|
@@ -20,7 +23,7 @@ function Callout({ type, title, children }) {
|
|
|
20
23
|
children: [
|
|
21
24
|
/*#__PURE__*/ jsx("div", {
|
|
22
25
|
className: "rp-callout__title",
|
|
23
|
-
children: title
|
|
26
|
+
children: title ?? capitalize(type)
|
|
24
27
|
}),
|
|
25
28
|
/*#__PURE__*/ jsx("div", {
|
|
26
29
|
className: "rp-callout__content",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
.rp-codeblock {
|
|
2
2
|
border: var(--rp-code-block-border);
|
|
3
|
+
box-shadow: var(--rp-code-block-shadow);
|
|
3
4
|
border-radius: var(--rp-radius);
|
|
4
|
-
margin:
|
|
5
|
+
margin: 1rem 0;
|
|
5
6
|
transition: none;
|
|
6
7
|
position: relative;
|
|
7
8
|
overflow-x: auto;
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
@media (width <= 640px) {
|
|
11
12
|
.rp-codeblock {
|
|
12
13
|
contain: content;
|
|
13
|
-
margin:
|
|
14
|
+
margin: 1.5rem 0;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
font-size: var(--rp-code-font-size);
|
|
20
21
|
background-color: var(--rp-code-title-bg);
|
|
21
22
|
border-bottom: var(--rp-code-block-border);
|
|
22
|
-
padding:
|
|
23
|
+
padding: .75rem 1rem;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.rp-codeblock__content {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
font-family: var(--rp-font-family-mono);
|
|
53
54
|
width: fit-content;
|
|
54
55
|
min-width: 100%;
|
|
55
|
-
padding:
|
|
56
|
+
padding: 1rem 0;
|
|
56
57
|
line-height: 1.7;
|
|
57
58
|
display: inline-block;
|
|
58
59
|
}
|
|
@@ -72,8 +73,8 @@
|
|
|
72
73
|
counter-increment: step;
|
|
73
74
|
text-align: right;
|
|
74
75
|
color: #738a9466;
|
|
75
|
-
width:
|
|
76
|
-
margin-right:
|
|
76
|
+
width: 1rem;
|
|
77
|
+
margin-right: 1rem;
|
|
77
78
|
display: inline-block;
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CodeButtonGroup, useCodeButtonGroup } from "@theme";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, codeButtonGroupProps, children }) {
|
|
6
|
+
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
|
|
7
|
+
children: children
|
|
8
|
+
});
|
|
6
9
|
const { codeWrap, toggleCodeWrap, copyElementRef } = useCodeButtonGroup(wrapCodeProp);
|
|
7
10
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
11
|
className: clsx('rp-codeblock', `language-${lang}`, containerElementClassName),
|
|
@@ -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,
|
|
14
|
+
export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, }: CodeBlockRuntimeProps): ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent } from "@theme";
|
|
3
3
|
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
4
|
-
import { Fragment, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { codeToHast, createCssVariablesTheme } from "shiki";
|
|
6
6
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
7
7
|
name: 'css-variables',
|
|
@@ -14,8 +14,33 @@ 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,
|
|
18
|
-
const
|
|
17
|
+
function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers }) {
|
|
18
|
+
const mdxComponents = useMemo(()=>getCustomMDXComponent(), []);
|
|
19
|
+
const { pre: ShikiPre, code: Code, ...otherMdxComponents } = mdxComponents;
|
|
20
|
+
const fallback = useMemo(()=>/*#__PURE__*/ jsx(ShikiPre, {
|
|
21
|
+
title: title,
|
|
22
|
+
lang: lang,
|
|
23
|
+
wrapCode: wrapCode,
|
|
24
|
+
lineNumbers: lineNumbers,
|
|
25
|
+
containerElementClassName: containerElementClassName,
|
|
26
|
+
codeButtonGroupProps: codeButtonGroupProps,
|
|
27
|
+
className: "shiki css-variables",
|
|
28
|
+
children: /*#__PURE__*/ jsx(Code, {
|
|
29
|
+
style: {
|
|
30
|
+
padding: '1rem 1.25rem'
|
|
31
|
+
},
|
|
32
|
+
children: code
|
|
33
|
+
})
|
|
34
|
+
}), [
|
|
35
|
+
title,
|
|
36
|
+
lang,
|
|
37
|
+
wrapCode,
|
|
38
|
+
lineNumbers,
|
|
39
|
+
containerElementClassName,
|
|
40
|
+
codeButtonGroupProps,
|
|
41
|
+
code
|
|
42
|
+
]);
|
|
43
|
+
const [child, setChild] = useState(fallback);
|
|
19
44
|
const codeRef = useLatest(code);
|
|
20
45
|
useEffect(()=>{
|
|
21
46
|
const highlightCode = async ()=>{
|
|
@@ -25,7 +50,6 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
25
50
|
...shikiOptions
|
|
26
51
|
});
|
|
27
52
|
if (codeRef.current.length !== code.length) return;
|
|
28
|
-
const { pre: ShikiPre, code: Code, ...otherMdxComponents } = getCustomMDXComponent();
|
|
29
53
|
const reactNode = toJsxRuntime(hast, {
|
|
30
54
|
jsx: jsx,
|
|
31
55
|
jsxs: jsxs,
|
|
@@ -37,8 +61,9 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
37
61
|
lang: lang,
|
|
38
62
|
containerElementClassName: containerElementClassName,
|
|
39
63
|
codeButtonGroupProps: codeButtonGroupProps,
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
wrapCode: wrapCode,
|
|
65
|
+
lineNumbers: lineNumbers,
|
|
66
|
+
...props
|
|
42
67
|
}),
|
|
43
68
|
code: (props)=>/*#__PURE__*/ jsx(Code, {
|
|
44
69
|
...props
|
|
@@ -50,9 +75,14 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
|
|
|
50
75
|
};
|
|
51
76
|
highlightCode();
|
|
52
77
|
}, [
|
|
53
|
-
lang,
|
|
54
78
|
code,
|
|
55
|
-
|
|
79
|
+
codeButtonGroupProps,
|
|
80
|
+
containerElementClassName,
|
|
81
|
+
lang,
|
|
82
|
+
lineNumbers,
|
|
83
|
+
shikiOptions,
|
|
84
|
+
title,
|
|
85
|
+
wrapCode
|
|
56
86
|
]);
|
|
57
87
|
useEffect(()=>{
|
|
58
88
|
if (child) onRendered?.();
|
|
@@ -9,7 +9,9 @@ function ShikiPre({ title, lang, wrapCode, lineNumbers, containerElementClassNam
|
|
|
9
9
|
containerElementClassName: containerElementClassName,
|
|
10
10
|
codeButtonGroupProps: codeButtonGroupProps,
|
|
11
11
|
children: /*#__PURE__*/ jsx("pre", {
|
|
12
|
-
...otherProps
|
|
12
|
+
...otherProps,
|
|
13
|
+
"data-lang": lang,
|
|
14
|
+
"data-title": title
|
|
13
15
|
})
|
|
14
16
|
});
|
|
15
17
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import './doc.scss';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function DocContent({ components, isOverviewPage, }: {
|
|
2
|
+
export declare function DocContent({ components, isOverviewPage, afterDocContent, beforeDocContent, }: {
|
|
4
3
|
components: Record<string, React.FC<any>> | undefined;
|
|
5
4
|
isOverviewPage?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Optional React node rendered before the main document content.
|
|
7
|
+
* Can be used for banners, notices, or custom elements at the top of the page.
|
|
8
|
+
*/
|
|
9
|
+
beforeDocContent?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Optional React node rendered after the main document content.
|
|
12
|
+
* Can be used for footers, navigation, or other content at the bottom of the page.
|
|
13
|
+
*/
|
|
14
|
+
afterDocContent?: React.ReactNode;
|
|
6
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +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 } from "@theme";
|
|
5
|
-
import { useScrollAfterNav } from "../../logic/useScrollAfterNav.js";
|
|
4
|
+
import { Callout, FallbackHeading, getCustomMDXComponent, useScrollAfterNav } from "@theme";
|
|
6
5
|
import "./doc.css";
|
|
7
6
|
function FallbackTitle() {
|
|
8
7
|
const { site } = useSite();
|
|
@@ -13,7 +12,7 @@ function FallbackTitle() {
|
|
|
13
12
|
title: title
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
|
-
function DocContent({ components, isOverviewPage = false }) {
|
|
15
|
+
function DocContent({ components, isOverviewPage = false, afterDocContent, beforeDocContent }) {
|
|
17
16
|
useScrollAfterNav();
|
|
18
17
|
const mdxComponents = {
|
|
19
18
|
...getCustomMDXComponent(),
|
|
@@ -23,9 +22,11 @@ function DocContent({ components, isOverviewPage = false }) {
|
|
|
23
22
|
return /*#__PURE__*/ jsxs(MDXProvider, {
|
|
24
23
|
components: mdxComponents,
|
|
25
24
|
children: [
|
|
25
|
+
beforeDocContent,
|
|
26
26
|
!isOverviewPage && /*#__PURE__*/ jsx(FallbackTitle, {}),
|
|
27
|
-
/*#__PURE__*/ jsx(Content, {})
|
|
27
|
+
/*#__PURE__*/ jsx(Content, {}),
|
|
28
|
+
afterDocContent
|
|
28
29
|
]
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
export { DocContent
|
|
32
|
+
export { DocContent };
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useSite } from "@rspress/core/runtime";
|
|
3
2
|
import { EditLink, LastUpdated, PrevNextPage } from "@theme";
|
|
4
3
|
import "./index.css";
|
|
5
4
|
function DocFooter() {
|
|
6
|
-
const { site } = useSite();
|
|
7
|
-
const { themeConfig } = site;
|
|
8
|
-
const showLastUpdated = themeConfig.lastUpdated;
|
|
9
5
|
return /*#__PURE__*/ jsxs("footer", {
|
|
10
6
|
className: "rp-doc-footer",
|
|
11
7
|
children: [
|
|
@@ -13,7 +9,7 @@ function DocFooter() {
|
|
|
13
9
|
className: "rp-doc-footer__edit",
|
|
14
10
|
children: [
|
|
15
11
|
/*#__PURE__*/ jsx(EditLink, {}),
|
|
16
|
-
|
|
12
|
+
/*#__PURE__*/ jsx(LastUpdated, {})
|
|
17
13
|
]
|
|
18
14
|
}),
|
|
19
15
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
.rp-hover-group {
|
|
2
2
|
border: var(--rp-code-block-border);
|
|
3
3
|
background: var(--rp-c-bg);
|
|
4
|
+
width: auto;
|
|
5
|
+
min-width: 80px;
|
|
6
|
+
box-shadow: var(--rp-shadow-2);
|
|
4
7
|
z-index: 999;
|
|
5
8
|
border-radius: 8px;
|
|
6
9
|
flex-direction: column;
|
|
7
10
|
align-items: flex-start;
|
|
8
|
-
width: auto;
|
|
9
|
-
min-width: 80px;
|
|
10
11
|
padding: 8px;
|
|
11
12
|
list-style: none;
|
|
12
13
|
transition: opacity .3s ease-in-out;
|
|
13
14
|
display: flex;
|
|
14
15
|
position: absolute;
|
|
15
16
|
top: 80%;
|
|
16
|
-
box-shadow: 0 4px 16px #0000000a;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.rp-hover-group--center {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './index.scss';
|
|
2
|
-
export declare function LastUpdated(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function LastUpdated(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useI18n, usePage } from "@rspress/core/runtime";
|
|
2
|
+
import { useI18n, usePage, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import "./index.css";
|
|
4
4
|
function LastUpdated() {
|
|
5
5
|
const { page: { lastUpdatedTime } } = usePage();
|
|
6
|
+
const { site } = useSite();
|
|
7
|
+
const { themeConfig } = site;
|
|
8
|
+
const showLastUpdated = themeConfig.lastUpdated;
|
|
6
9
|
const t = useI18n();
|
|
10
|
+
if (!showLastUpdated) return null;
|
|
7
11
|
return /*#__PURE__*/ jsx("div", {
|
|
8
12
|
className: "rp-last-updated",
|
|
9
13
|
children: /*#__PURE__*/ jsxs("p", {
|
|
@@ -32,4 +32,4 @@ export interface LinkProps extends ComponentProps<'a'> {
|
|
|
32
32
|
* 3. If inCurrentSite, it will navigate and scroll to anchor, preload the asyncChunk onHover the link
|
|
33
33
|
* 4. Link is styled.
|
|
34
34
|
*/
|
|
35
|
-
export declare
|
|
35
|
+
export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -2,18 +2,20 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { preloadLink } from "@rspress/core/runtime";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import nprogress from "nprogress";
|
|
5
|
+
import { forwardRef } from "react";
|
|
5
6
|
import "./index.css";
|
|
6
7
|
import { getHref, useLinkNavigate } from "./useLinkNavigate.js";
|
|
7
8
|
nprogress.configure({
|
|
8
9
|
showSpinner: false
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
+
const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
11
12
|
const { href = '/', children, className = '', onClick, onMouseEnter, startTransition, ...otherProps } = props;
|
|
12
13
|
const { linkType, removeBaseHref, withBaseHref } = getHref(href);
|
|
13
14
|
const navigate = useLinkNavigate({
|
|
14
15
|
startTransition
|
|
15
16
|
});
|
|
16
17
|
if ('external' === linkType) return /*#__PURE__*/ jsx("a", {
|
|
18
|
+
ref: ref,
|
|
17
19
|
href: href,
|
|
18
20
|
target: "_blank",
|
|
19
21
|
rel: "noopener noreferrer",
|
|
@@ -24,6 +26,7 @@ function Link(props) {
|
|
|
24
26
|
children: children
|
|
25
27
|
});
|
|
26
28
|
if ('hashOnly' === linkType) return /*#__PURE__*/ jsx("a", {
|
|
29
|
+
ref: ref,
|
|
27
30
|
href: href,
|
|
28
31
|
className: clsx(className, 'rp-link'),
|
|
29
32
|
onClick: onClick,
|
|
@@ -32,6 +35,7 @@ function Link(props) {
|
|
|
32
35
|
children: children
|
|
33
36
|
});
|
|
34
37
|
if ('relative' === linkType) return /*#__PURE__*/ jsx("a", {
|
|
38
|
+
ref: ref,
|
|
35
39
|
href: href,
|
|
36
40
|
className: clsx(className, 'rp-link'),
|
|
37
41
|
onMouseEnter: (event)=>{
|
|
@@ -48,6 +52,7 @@ function Link(props) {
|
|
|
48
52
|
children: children
|
|
49
53
|
});
|
|
50
54
|
return /*#__PURE__*/ jsx("a", {
|
|
55
|
+
ref: ref,
|
|
51
56
|
href: withBaseHref,
|
|
52
57
|
className: clsx(className, 'rp-link'),
|
|
53
58
|
onMouseEnter: (event)=>{
|
|
@@ -63,5 +68,6 @@ function Link(props) {
|
|
|
63
68
|
...otherProps,
|
|
64
69
|
children: children
|
|
65
70
|
});
|
|
66
|
-
}
|
|
71
|
+
});
|
|
72
|
+
Link.displayName = 'Link';
|
|
67
73
|
export { Link };
|
|
@@ -4,6 +4,7 @@ import { useLangsMenu } from "../Nav/hooks.js";
|
|
|
4
4
|
import "./NavScreenLangs.css";
|
|
5
5
|
import { useI18n } from "@rspress/core/runtime";
|
|
6
6
|
import { Link } from "@theme";
|
|
7
|
+
import clsx from "clsx";
|
|
7
8
|
import { SvgDown } from "./NavScreenMenuItem.js";
|
|
8
9
|
function NavScreenLangs() {
|
|
9
10
|
const { items, activeValue } = useLangsMenu();
|
|
@@ -39,11 +40,20 @@ function NavScreenLangs() {
|
|
|
39
40
|
},
|
|
40
41
|
children: /*#__PURE__*/ jsx("div", {
|
|
41
42
|
className: "rp-nav-screen-langs-group__inner",
|
|
42
|
-
children: items.map((item)
|
|
43
|
+
children: items.map((item)=>{
|
|
44
|
+
const isActive = item.text === activeValue;
|
|
45
|
+
const className = clsx('rp-nav-screen-langs-group__item', isActive && 'rp-nav-screen-langs-group__item--active');
|
|
46
|
+
return isActive ? /*#__PURE__*/ jsx("span", {
|
|
47
|
+
className: className,
|
|
48
|
+
"aria-current": "page",
|
|
49
|
+
"aria-disabled": true,
|
|
50
|
+
children: item.text
|
|
51
|
+
}, item.text) : /*#__PURE__*/ jsx(Link, {
|
|
43
52
|
href: item.link,
|
|
44
|
-
className:
|
|
53
|
+
className: className,
|
|
45
54
|
children: item.text
|
|
46
|
-
}, item.text)
|
|
55
|
+
}, item.text);
|
|
56
|
+
})
|
|
47
57
|
})
|
|
48
58
|
})
|
|
49
59
|
]
|
|
@@ -35,11 +35,20 @@ function NavScreenVersions() {
|
|
|
35
35
|
}),
|
|
36
36
|
/*#__PURE__*/ jsx("div", {
|
|
37
37
|
className: clsx('rp-nav-screen-versions-group', isOpen && 'rp-nav-screen-versions-group--open'),
|
|
38
|
-
children: items.map((item)
|
|
38
|
+
children: items.map((item)=>{
|
|
39
|
+
const isActive = item.text === activeValue;
|
|
40
|
+
const className = clsx('rp-nav-screen-versions-group__item', isActive && 'rp-nav-screen-versions-group__item--active');
|
|
41
|
+
return isActive ? /*#__PURE__*/ jsx("span", {
|
|
42
|
+
className: className,
|
|
43
|
+
"aria-current": "page",
|
|
44
|
+
"aria-disabled": true,
|
|
45
|
+
children: item.text
|
|
46
|
+
}, item.text) : /*#__PURE__*/ jsx(Link, {
|
|
39
47
|
href: item.link,
|
|
40
|
-
className:
|
|
48
|
+
className: className,
|
|
41
49
|
children: item.text
|
|
42
|
-
}, item.text)
|
|
50
|
+
}, item.text);
|
|
51
|
+
})
|
|
43
52
|
})
|
|
44
53
|
]
|
|
45
54
|
}) : null;
|
|
@@ -31,7 +31,7 @@ const OverviewSearchInput = ({ query, setQuery, searchRef })=>{
|
|
|
31
31
|
};
|
|
32
32
|
function Overview(props) {
|
|
33
33
|
const { siteData, page: { routePath, title, frontmatter } } = usePageData();
|
|
34
|
-
const { content, groups: customGroups
|
|
34
|
+
const { content, groups: customGroups } = props;
|
|
35
35
|
const t = useI18n();
|
|
36
36
|
const [query, setQuery] = useState('');
|
|
37
37
|
const searchRef = useRef(null);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--rp-c-overview-group-bg: var(--rp-c-bg-soft);
|
|
3
|
+
--rp-c-overview-group-bg-hover: color-mix(in srgb, var(--rp-c-brand-lighter) 30%, transparent);
|
|
4
|
+
--rp-c-overview-group-border: 1px solid var(--rp-c-divider-light);
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
.rp-overview-group {
|
|
2
8
|
flex-direction: column;
|
|
3
9
|
gap: 20px;
|
|
@@ -6,7 +12,7 @@
|
|
|
6
12
|
}
|
|
7
13
|
|
|
8
14
|
.rp-overview-group__item {
|
|
9
|
-
border:
|
|
15
|
+
border: var(--rp-c-overview-group-border);
|
|
10
16
|
border-radius: var(--rp-radius);
|
|
11
17
|
flex-direction: row;
|
|
12
18
|
width: 100%;
|
|
@@ -21,7 +27,7 @@
|
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
.rp-overview-group__item:hover .rp-overview-group__item__title {
|
|
24
|
-
background-color:
|
|
30
|
+
background-color: var(--rp-c-overview-group-bg-hover);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
.rp-overview-group__item:hover .rp-overview-group__item__title .rp-overview-group__item__title__icon {
|
|
@@ -41,10 +47,10 @@
|
|
|
41
47
|
|
|
42
48
|
.rp-overview-group__item__title {
|
|
43
49
|
word-break: break-all;
|
|
44
|
-
|
|
45
|
-
width: 20%;
|
|
50
|
+
width: 25%;
|
|
46
51
|
color: var(--rp-c-text-1);
|
|
47
|
-
|
|
52
|
+
background-color: var(--rp-c-overview-group-bg);
|
|
53
|
+
flex: 0 0 25%;
|
|
48
54
|
padding: 16px 20px;
|
|
49
55
|
font-size: 18px;
|
|
50
56
|
font-weight: 600;
|
|
@@ -53,12 +59,12 @@
|
|
|
53
59
|
overflow: hidden;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
.rp-overview-
|
|
62
|
+
.rp-overview-group__item__title__link, .rp-overview-group__item__title__text {
|
|
57
63
|
color: inherit;
|
|
58
64
|
text-decoration: none;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
.rp-overview-
|
|
67
|
+
.rp-overview-group__item__title__link:hover, .rp-overview-group__item__title__text:hover {
|
|
62
68
|
color: var(--rp-c-brand);
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -118,7 +124,53 @@
|
|
|
118
124
|
background-color: var(--rp-c-bg);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
.rp-overview-group__grid {
|
|
128
|
+
grid-template-columns: repeat(4, 1fr);
|
|
129
|
+
gap: 20px;
|
|
130
|
+
width: 100%;
|
|
131
|
+
display: grid;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@media (width <= 1280px) {
|
|
135
|
+
.rp-overview-group__grid {
|
|
136
|
+
grid-template-columns: repeat(3, 1fr);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (width <= 768px) {
|
|
141
|
+
.rp-overview-group__grid {
|
|
142
|
+
grid-template-columns: repeat(2, 1fr);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (width <= 480px) {
|
|
147
|
+
.rp-overview-group__grid {
|
|
148
|
+
grid-template-columns: 1fr;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rp-overview-group__grid-item {
|
|
153
|
+
border: 1px solid var(--rp-c-divider-light);
|
|
154
|
+
border-radius: var(--rp-radius);
|
|
155
|
+
transition: border-color .2s, box-shadow .2s, background-color .2s;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.rp-overview-group__grid-item.rp-overview-group__item__title {
|
|
159
|
+
flex: none;
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.rp-overview-group__grid-item:hover {
|
|
164
|
+
border-color: var(--rp-c-brand-light);
|
|
165
|
+
background-color: var(--rp-c-overview-group-bg-hover);
|
|
166
|
+
box-shadow: 0 4px 6px #0000000a;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.rp-overview-group__grid-item:hover .rp-overview-group__item__title__icon {
|
|
170
|
+
color: var(--rp-c-brand-dark);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
html.rp-dark .rp-overview-group__item:hover .rp-overview-group__item__title__icon, html.rp-dark .rp-overview-group__grid-item:hover .rp-overview-group__item__title__icon {
|
|
122
174
|
color: #fff;
|
|
123
175
|
}
|
|
124
176
|
|