@rspress/core 1.1.3 → 1.2.1
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/index.js +3754 -87
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -0
- package/dist/loader.js +46 -19
- package/dist/loader.js.map +1 -1
- package/dist/runtime/clientEntry.js +3 -1
- package/dist/theme/bundle.css +9 -0
- package/dist/theme/bundle.js +13 -10
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +14 -14
- package/src/runtime/clientEntry.tsx +4 -1
- package/src/theme-default/components/Overview/index.tsx +6 -4
- package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +2 -1
- package/src/theme-default/components/SocialLinks/LinkContent.tsx +2 -2
- package/src/theme-default/layout/DocLayout/index.tsx +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@mdx-js/loader": "2.2.1",
|
|
41
41
|
"@mdx-js/mdx": "2.2.1",
|
|
42
42
|
"@mdx-js/react": "2.2.1",
|
|
43
|
-
"@modern-js/builder": "2.
|
|
44
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
45
|
-
"@rspress/mdx-rs": "0.4.
|
|
46
|
-
"@modern-js/utils": "2.
|
|
43
|
+
"@modern-js/builder": "2.38.0",
|
|
44
|
+
"@modern-js/builder-rspack-provider": "2.38.0",
|
|
45
|
+
"@rspress/mdx-rs": "0.4.1",
|
|
46
|
+
"@modern-js/utils": "2.38.0",
|
|
47
47
|
"@types/compression": "^1.7.2",
|
|
48
48
|
"@types/polka": "^0.5.4",
|
|
49
49
|
"autoprefixer": "10.4.13",
|
|
@@ -89,17 +89,17 @@
|
|
|
89
89
|
"unist-util-visit-children": "^2.0.1",
|
|
90
90
|
"yaml-front-matter": "^4.1.1",
|
|
91
91
|
"rspack-plugin-virtual-module": "0.1.12",
|
|
92
|
-
"@rspress/shared": "1.1
|
|
93
|
-
"@rspress/plugin-medium-zoom": "1.1
|
|
94
|
-
"@rspress/plugin-last-updated": "1.1
|
|
95
|
-
"@rspress/plugin-auto-nav-sidebar": "1.1
|
|
96
|
-
"@rspress/plugin-container-syntax": "1.1
|
|
92
|
+
"@rspress/shared": "1.2.1",
|
|
93
|
+
"@rspress/plugin-medium-zoom": "1.2.1",
|
|
94
|
+
"@rspress/plugin-last-updated": "1.2.1",
|
|
95
|
+
"@rspress/plugin-auto-nav-sidebar": "1.2.1",
|
|
96
|
+
"@rspress/plugin-container-syntax": "1.2.1"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@modern-js/plugin-tailwindcss": "2.
|
|
100
|
-
"@modern-js/plugin-testing": "2.
|
|
101
|
-
"@modern-js/tsconfig": "2.
|
|
102
|
-
"@modern-js/types": "2.
|
|
99
|
+
"@modern-js/plugin-tailwindcss": "2.38.0",
|
|
100
|
+
"@modern-js/plugin-testing": "2.38.0",
|
|
101
|
+
"@modern-js/tsconfig": "2.38.0",
|
|
102
|
+
"@modern-js/types": "2.38.0",
|
|
103
103
|
"@types/body-scroll-lock": "^3.1.0",
|
|
104
104
|
"@types/fs-extra": "^9.0.13",
|
|
105
105
|
"@types/hast": "^2.3.4",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { BrowserRouter } from 'react-router-dom';
|
|
3
3
|
import { isProduction } from '@rspress/shared';
|
|
4
|
+
import siteData from 'virtual-site-data';
|
|
4
5
|
import { App, initPageData } from './App';
|
|
5
6
|
import { DataContext, ThemeContext } from './hooks';
|
|
6
7
|
import { normalizeRoutePath } from './utils';
|
|
7
8
|
|
|
9
|
+
const enableSSG = siteData.ssg;
|
|
10
|
+
|
|
8
11
|
// eslint-disable-next-line import/no-commonjs
|
|
9
12
|
const { default: Theme } = require('@theme');
|
|
10
13
|
|
|
@@ -31,7 +34,7 @@ export async function renderInBrowser() {
|
|
|
31
34
|
const RootApp = await enhancedApp();
|
|
32
35
|
if (process.env.__IS_REACT_18__) {
|
|
33
36
|
const { createRoot, hydrateRoot } = require('react-dom/client');
|
|
34
|
-
if (isProduction()) {
|
|
37
|
+
if (isProduction() && enableSSG) {
|
|
35
38
|
hydrateRoot(container, <RootApp />);
|
|
36
39
|
} else {
|
|
37
40
|
createRoot(container).render(<RootApp />);
|
|
@@ -26,10 +26,10 @@ interface Group {
|
|
|
26
26
|
// In the meantime, some sidebar items also should be shown in the page, we collect them in the group named 'Others' and show them in the page.
|
|
27
27
|
const DEFAULT_GROUP = 'Others';
|
|
28
28
|
|
|
29
|
-
export function Overview() {
|
|
29
|
+
export function Overview(props: { content: React.ReactNode }) {
|
|
30
30
|
const {
|
|
31
31
|
siteData,
|
|
32
|
-
page: { routePath },
|
|
32
|
+
page: { routePath, title },
|
|
33
33
|
} = usePageData();
|
|
34
34
|
const { pages } = siteData;
|
|
35
35
|
const overviewModules = pages.filter(
|
|
@@ -90,9 +90,11 @@ export function Overview() {
|
|
|
90
90
|
return (
|
|
91
91
|
<div className="overview-index mx-auto px-8">
|
|
92
92
|
<div className="flex items-center justify-between">
|
|
93
|
-
|
|
93
|
+
{!title && (
|
|
94
|
+
<h1 className="text-3xl leading-10 tracking-tight">Overview</h1>
|
|
95
|
+
)}
|
|
94
96
|
</div>
|
|
95
|
-
|
|
97
|
+
{props.content}
|
|
96
98
|
{groups.map(group => (
|
|
97
99
|
<div className="mb-16" key={group.name}>
|
|
98
100
|
{/* If there is no sidebar group, we show the sidebar items directly and hide the group name */}
|
|
@@ -14,8 +14,9 @@ export const HiddenLinks = (props: IHiddenLinksProps) => {
|
|
|
14
14
|
boxShadow: 'var(--rp-shadow-3)',
|
|
15
15
|
marginRight: '-2px',
|
|
16
16
|
border: '1px solid var(--rp-c-divider-light)',
|
|
17
|
+
background: 'var(--rp-c-bg)',
|
|
17
18
|
}}
|
|
18
|
-
className="absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl
|
|
19
|
+
className="absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4"
|
|
19
20
|
>
|
|
20
21
|
{links.map(item => (
|
|
21
22
|
<LinkContent
|
|
@@ -55,7 +55,7 @@ export const LinkContent = (props: ILinkContentComp) => {
|
|
|
55
55
|
border: '1px solid var(--rp-c-divider-light)',
|
|
56
56
|
...popperStyle,
|
|
57
57
|
}}
|
|
58
|
-
className="z-1 p-3 w-50 absolute right-0 bg-white dark:bg-dark"
|
|
58
|
+
className="z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark"
|
|
59
59
|
>
|
|
60
60
|
<div className="text-md">{content}</div>
|
|
61
61
|
</div>
|
|
@@ -73,7 +73,7 @@ export const LinkContent = (props: ILinkContentComp) => {
|
|
|
73
73
|
{IconComp}
|
|
74
74
|
{contentVisible ? (
|
|
75
75
|
<div
|
|
76
|
-
className="break-all z-1 p-3 w-
|
|
76
|
+
className="break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl"
|
|
77
77
|
style={{
|
|
78
78
|
boxShadow: 'var(--rp-shadow-3)',
|
|
79
79
|
...popperStyle,
|
|
@@ -63,6 +63,14 @@ export function DocLayout(props: DocLayoutProps) {
|
|
|
63
63
|
}
|
|
64
64
|
}, []);
|
|
65
65
|
|
|
66
|
+
const docContent = (
|
|
67
|
+
<TabDataContext.Provider value={{ tabData, setTabData }}>
|
|
68
|
+
<MDXProvider components={getCustomMDXComponent()}>
|
|
69
|
+
<Content />
|
|
70
|
+
</MDXProvider>
|
|
71
|
+
</TabDataContext.Provider>
|
|
72
|
+
);
|
|
73
|
+
|
|
66
74
|
return (
|
|
67
75
|
<div
|
|
68
76
|
className={`${styles.docLayout} pt-0`}
|
|
@@ -73,20 +81,16 @@ export function DocLayout(props: DocLayoutProps) {
|
|
|
73
81
|
{beforeDoc}
|
|
74
82
|
{hasSidebar ? <SideMenu /> : null}
|
|
75
83
|
<div
|
|
76
|
-
className={`${styles.content} rspress-doc-container flex flex-shrink-0
|
|
84
|
+
className={`${styles.content} rspress-doc-container flex flex-shrink-0 mx-auto`}
|
|
77
85
|
>
|
|
78
86
|
<div className="w-full">
|
|
79
87
|
{isOverviewPage ? (
|
|
80
|
-
<
|
|
88
|
+
<div className="rspress-doc">
|
|
89
|
+
<Overview content={docContent} />
|
|
90
|
+
</div>
|
|
81
91
|
) : (
|
|
82
92
|
<div>
|
|
83
|
-
<div className="rspress-doc">
|
|
84
|
-
<TabDataContext.Provider value={{ tabData, setTabData }}>
|
|
85
|
-
<MDXProvider components={getCustomMDXComponent()}>
|
|
86
|
-
<Content />
|
|
87
|
-
</MDXProvider>
|
|
88
|
-
</TabDataContext.Provider>
|
|
89
|
-
</div>
|
|
93
|
+
<div className="rspress-doc">{docContent}</div>
|
|
90
94
|
<div className="rspress-doc-footer">
|
|
91
95
|
{beforeDocFooter}
|
|
92
96
|
{hasFooter && <DocFooter />}
|