@rspress/core 0.0.6 → 0.0.8
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 +17 -11
- package/dist/index.js.map +1 -1
- package/dist/loader.js +2 -2
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.js +89 -0
- package/dist/runtime/Content.js +20 -0
- package/dist/runtime/NoSSR.js +16 -0
- package/dist/runtime/clientEntry.js +52 -0
- package/dist/runtime/hooks.js +20 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/ssrEntry.js +30 -0
- package/dist/runtime/utils.js +15 -0
- package/dist/theme/bundle.css +44 -19
- package/dist/theme/bundle.js +41 -38
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +13 -13
- package/src/runtime/App.tsx +3 -1
- package/src/runtime/clientEntry.tsx +3 -1
- package/src/theme-default/components/HomeHero/index.tsx +2 -2
- package/src/theme-default/components/Sidebar/index.module.scss +6 -0
- package/src/theme-default/components/Tabs/index.module.scss +32 -6
- package/src/theme-default/components/Tabs/index.tsx +41 -39
- package/src/theme-default/styles/vars.css +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@mdx-js/loader": "2.2.1",
|
|
42
42
|
"@mdx-js/mdx": "2.2.1",
|
|
43
43
|
"@mdx-js/react": "2.2.1",
|
|
44
|
-
"@modern-js/builder": "2.
|
|
45
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
44
|
+
"@modern-js/builder": "2.33.0",
|
|
45
|
+
"@modern-js/builder-rspack-provider": "2.33.0",
|
|
46
46
|
"@modern-js/mdx-rs-binding": "0.2.5",
|
|
47
|
-
"@modern-js/utils": "2.
|
|
47
|
+
"@modern-js/utils": "2.33.0",
|
|
48
48
|
"@types/compression": "^1.7.2",
|
|
49
49
|
"@types/polka": "^0.5.4",
|
|
50
50
|
"acorn": "^8.8.1",
|
|
@@ -91,20 +91,20 @@
|
|
|
91
91
|
"unist-util-visit": "^4.1.1",
|
|
92
92
|
"unist-util-visit-children": "^2.0.1",
|
|
93
93
|
"yaml-front-matter": "^4.1.1",
|
|
94
|
-
"@rspress/shared": "0.0.
|
|
95
|
-
"@rspress/plugin-medium-zoom": "0.0.
|
|
96
|
-
"@rspress/plugin-last-updated": "0.0.
|
|
97
|
-
"@rspress/plugin-auto-nav-sidebar": "0.0.
|
|
98
|
-
"@rspress/remark-container": "0.0.
|
|
94
|
+
"@rspress/shared": "0.0.8",
|
|
95
|
+
"@rspress/plugin-medium-zoom": "0.0.8",
|
|
96
|
+
"@rspress/plugin-last-updated": "0.0.8",
|
|
97
|
+
"@rspress/plugin-auto-nav-sidebar": "0.0.8",
|
|
98
|
+
"@rspress/remark-container": "0.0.7"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
101
|
"react": ">=17"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@modern-js/plugin-tailwindcss": "2.
|
|
105
|
-
"@modern-js/plugin-testing": "2.
|
|
106
|
-
"@modern-js/tsconfig": "2.
|
|
107
|
-
"@modern-js/types": "2.
|
|
104
|
+
"@modern-js/plugin-tailwindcss": "2.33.0",
|
|
105
|
+
"@modern-js/plugin-testing": "2.33.0",
|
|
106
|
+
"@modern-js/tsconfig": "2.33.0",
|
|
107
|
+
"@modern-js/types": "2.33.0",
|
|
108
108
|
"@types/body-scroll-lock": "^3.1.0",
|
|
109
109
|
"@types/fs-extra": "^9.0.13",
|
|
110
110
|
"@types/hast": "^2.3.4",
|
package/src/runtime/App.tsx
CHANGED
|
@@ -2,12 +2,14 @@ import siteData from 'virtual-site-data';
|
|
|
2
2
|
import { matchRoutes, useLocation } from 'react-router-dom';
|
|
3
3
|
import { HelmetProvider } from 'react-helmet-async';
|
|
4
4
|
import { useContext, useLayoutEffect } from 'react';
|
|
5
|
-
import Theme from '@theme';
|
|
6
5
|
import { Header, PageData, cleanUrl, isProduction } from '@rspress/shared';
|
|
7
6
|
import { isEqualPath, normalizeRoutePath } from './utils';
|
|
8
7
|
import { DataContext } from './hooks';
|
|
9
8
|
import 'virtual-global-styles';
|
|
10
9
|
|
|
10
|
+
// eslint-disable-next-line import/no-commonjs
|
|
11
|
+
const { default: Theme } = require('@theme');
|
|
12
|
+
|
|
11
13
|
type RspressPageMeta = Record<
|
|
12
14
|
string,
|
|
13
15
|
{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Theme from '@theme';
|
|
2
1
|
import { useState } from 'react';
|
|
3
2
|
import { BrowserRouter } from 'react-router-dom';
|
|
4
3
|
import { isProduction } from '@rspress/shared';
|
|
@@ -6,6 +5,9 @@ import { App, initPageData } from './App';
|
|
|
6
5
|
import { DataContext, ThemeContext } from './hooks';
|
|
7
6
|
import { normalizeRoutePath } from './utils';
|
|
8
7
|
|
|
8
|
+
// eslint-disable-next-line import/no-commonjs
|
|
9
|
+
const { default: Theme } = require('@theme');
|
|
10
|
+
|
|
9
11
|
export async function renderInBrowser() {
|
|
10
12
|
const container = document.getElementById('root')!;
|
|
11
13
|
const enhancedApp = async () => {
|
|
@@ -15,14 +15,14 @@ export function HomeHero({ frontmatter }: { frontmatter: FrontMatterMeta }) {
|
|
|
15
15
|
const hero = frontmatter?.hero || DEFAULT_HERO;
|
|
16
16
|
const hasImage = hero.image !== undefined;
|
|
17
17
|
return (
|
|
18
|
-
<div className="m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-
|
|
18
|
+
<div className="m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16">
|
|
19
19
|
<div
|
|
20
20
|
className={styles.mask}
|
|
21
21
|
style={{
|
|
22
22
|
left: hasImage ? '75%' : '50%',
|
|
23
23
|
}}
|
|
24
24
|
></div>
|
|
25
|
-
<div className="m-auto flex flex-col md:flex-row max-w-6xl">
|
|
25
|
+
<div className="m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh]">
|
|
26
26
|
<div className="flex flex-col justify-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1">
|
|
27
27
|
<h1 className="font-bold text-3xl sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-5 leading-tight z-10">
|
|
28
28
|
<span className={styles.clip} style={{ lineHeight: '1.15' }}>
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
border: 1px solid var(--rp-c-gray-light-3);
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:global(.dark) .container {
|
|
7
|
+
border-color: var(--rp-c-dark-light-1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tab-list {
|
|
11
|
+
padding-left: 8px;
|
|
12
|
+
padding-top: 4px;
|
|
13
|
+
display: flex;
|
|
14
|
+
min-width: 100%;
|
|
15
|
+
border-bottom-width: 1px;
|
|
16
|
+
border-color: var(--rp-c-gray-light-3);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:global(.dark) .tab-list {
|
|
20
|
+
border-color: var(--rp-c-dark-light-1);
|
|
21
|
+
}
|
|
22
|
+
|
|
1
23
|
.tab {
|
|
2
24
|
color: var(--rp-c-text-2);
|
|
3
|
-
border-bottom:
|
|
25
|
+
border-bottom: 1px solid transparent;
|
|
4
26
|
box-sizing: border-box;
|
|
5
27
|
margin-right: 10px;
|
|
6
|
-
padding:
|
|
7
|
-
transition: colors 0.2s;
|
|
28
|
+
padding: 6px 8px;
|
|
8
29
|
margin-bottom: -1px;
|
|
9
30
|
user-select: none;
|
|
10
|
-
transition: all 0.
|
|
31
|
+
transition: all 0.2s ease-in-out;
|
|
11
32
|
}
|
|
12
33
|
|
|
13
34
|
.tab:last-child {
|
|
@@ -16,8 +37,13 @@
|
|
|
16
37
|
|
|
17
38
|
.not-selected:hover {
|
|
18
39
|
color: var(--rp-c-text-1);
|
|
19
|
-
border-color: var(--rp-c-gray
|
|
20
|
-
border-radius:
|
|
40
|
+
border-color: var(--rp-c-gray);
|
|
41
|
+
border-top-left-radius: 10px;
|
|
42
|
+
border-top-right-radius: 10px;
|
|
43
|
+
background-color: var(--rp-c-gray-light-5);
|
|
44
|
+
:global(.dark) & {
|
|
45
|
+
background-color: var(--rp-c-dark-light-3);
|
|
46
|
+
}
|
|
21
47
|
}
|
|
22
48
|
|
|
23
49
|
.selected {
|
|
@@ -70,45 +70,47 @@ export function Tabs(props: TabsProps): ReactElement {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
onChange
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
<div className={styles.container}>
|
|
74
|
+
<HeadlessTab.Group
|
|
75
|
+
onChange={index => {
|
|
76
|
+
onChange?.(index);
|
|
77
|
+
if (groupId) {
|
|
78
|
+
setTabData({ ...tabData, [groupId]: index });
|
|
79
|
+
}
|
|
80
|
+
}}
|
|
81
|
+
{...(needSync ? { selectedIndex: defaultIndex } : { defaultIndex })}
|
|
82
|
+
>
|
|
83
|
+
<div className={tabContainerClassName}>
|
|
84
|
+
{tabValues.length ? (
|
|
85
|
+
<HeadlessTab.List className={styles.tabList}>
|
|
86
|
+
{tabValues.map((item, index) => {
|
|
87
|
+
const disabled = Boolean(
|
|
88
|
+
item &&
|
|
89
|
+
typeof item === 'object' &&
|
|
90
|
+
'disabled' in item &&
|
|
91
|
+
item.disabled,
|
|
92
|
+
);
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
return (
|
|
95
|
+
<HeadlessTab
|
|
96
|
+
key={index}
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
className={({ selected }) =>
|
|
99
|
+
`${styles.tab} ${
|
|
100
|
+
selected ? styles.selected : styles.notSelected
|
|
101
|
+
}`
|
|
102
|
+
}
|
|
103
|
+
>
|
|
104
|
+
{renderTab(item)}
|
|
105
|
+
</HeadlessTab>
|
|
106
|
+
);
|
|
107
|
+
})}
|
|
108
|
+
</HeadlessTab.List>
|
|
109
|
+
) : null}
|
|
110
|
+
</div>
|
|
111
|
+
<HeadlessTab.Panels>{children}</HeadlessTab.Panels>
|
|
112
|
+
</HeadlessTab.Group>
|
|
113
|
+
</div>
|
|
112
114
|
);
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -117,7 +119,7 @@ export function Tab({
|
|
|
117
119
|
...props
|
|
118
120
|
}: ComponentPropsWithRef<'div'>): ReactElement {
|
|
119
121
|
return (
|
|
120
|
-
<HeadlessTab.Panel {...props} className="rounded
|
|
122
|
+
<HeadlessTab.Panel {...props} className="rounded px-2">
|
|
121
123
|
{children}
|
|
122
124
|
</HeadlessTab.Panel>
|
|
123
125
|
);
|
|
@@ -36,6 +36,13 @@
|
|
|
36
36
|
--rp-c-gray-light-3: #d1d1d1;
|
|
37
37
|
--rp-c-gray-light-4: #e5e5e5;
|
|
38
38
|
--rp-c-gray-light-5: #f2f2f2;
|
|
39
|
+
|
|
40
|
+
--rp-c-dark: #000000;
|
|
41
|
+
--rp-c-dark-light-1: #2f2f2f;
|
|
42
|
+
--rp-c-dark-light-2: #3a3a3a;
|
|
43
|
+
--rp-c-dark-light-3: #4a4a4a;
|
|
44
|
+
--rp-c-dark-light-4: #5c5c5c;
|
|
45
|
+
--rp-c-dark-light-5: #6b6b6b;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
.dark {
|