@rspress/core 1.0.0-beta.1 → 1.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "@mdx-js/react": "2.2.1",
43
43
  "@modern-js/builder": "2.35.1",
44
44
  "@modern-js/builder-rspack-provider": "2.35.1",
45
- "@rspress/mdx-rs": "0.3.2",
45
+ "@rspress/mdx-rs": "0.3.3",
46
46
  "@modern-js/utils": "2.35.1",
47
47
  "@types/compression": "^1.7.2",
48
48
  "@types/polka": "^0.5.4",
@@ -89,14 +89,11 @@
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.0.0-beta.1",
93
- "@rspress/plugin-medium-zoom": "1.0.0-beta.1",
94
- "@rspress/plugin-last-updated": "1.0.0-beta.1",
95
- "@rspress/plugin-auto-nav-sidebar": "1.0.0-beta.1",
96
- "@rspress/plugin-container-syntax": "1.0.0-beta.1"
97
- },
98
- "peerDependencies": {
99
- "react": ">=17"
92
+ "@rspress/shared": "1.0.0-beta.3",
93
+ "@rspress/plugin-medium-zoom": "1.0.0-beta.3",
94
+ "@rspress/plugin-last-updated": "1.0.0-beta.3",
95
+ "@rspress/plugin-auto-nav-sidebar": "1.0.0-beta.3",
96
+ "@rspress/plugin-container-syntax": "1.0.0-beta.3"
100
97
  },
101
98
  "devDependencies": {
102
99
  "@modern-js/plugin-tailwindcss": "2.35.1",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-lines */
1
2
  import { createPortal } from 'react-dom';
2
3
  import { useEffect, useRef, useState } from 'react';
3
4
  import { groupBy, debounce } from 'lodash-es';
@@ -21,6 +21,7 @@ interface TabsProps {
21
21
  children: ReactNode;
22
22
  groupId?: string;
23
23
  tabContainerClassName?: string;
24
+ tabPosition?: 'left' | 'center';
24
25
  }
25
26
 
26
27
  function isTabItem(item: unknown): item is TabItem {
@@ -44,6 +45,7 @@ export function Tabs(props: TabsProps): ReactElement {
44
45
  onChange,
45
46
  children,
46
47
  groupId,
48
+ tabPosition = 'left',
47
49
  tabContainerClassName,
48
50
  } = props;
49
51
  let tabValues = values || [];
@@ -74,7 +76,13 @@ export function Tabs(props: TabsProps): ReactElement {
74
76
  <div className={styles.container}>
75
77
  <div className={tabContainerClassName}>
76
78
  {tabValues.length ? (
77
- <div className={styles.tabList}>
79
+ <div
80
+ className={styles.tabList}
81
+ style={{
82
+ justifyContent:
83
+ tabPosition === 'center' ? 'center' : 'flex-start',
84
+ }}
85
+ >
78
86
  {tabValues.map((item, index) => {
79
87
  return (
80
88
  <div
@@ -6,8 +6,9 @@ import { Link } from '@/theme-default/components/Link';
6
6
  export const A = (props: ComponentProps<'a'>) => {
7
7
  const { href = '', className = '' } = props;
8
8
  const { normalizeLinkHref } = usePathUtils();
9
+ const hasHeaderAnchor = className.includes('header-anchor');
9
10
 
10
- if (className.includes('header-anchor')) {
11
+ if (hasHeaderAnchor || href.startsWith('#')) {
11
12
  return <a {...props} className={`${styles.link} ${className}`} />;
12
13
  } else {
13
14
  return (
@@ -29,6 +29,10 @@ export const Layout: React.FC<LayoutProps> = props => {
29
29
  beforeNavTitle,
30
30
  afterNavTitle,
31
31
  beforeNav,
32
+ beforeHero,
33
+ afterHero,
34
+ beforeFeatures,
35
+ afterFeatures,
32
36
  } = props;
33
37
  const docProps: DocLayoutProps = {
34
38
  beforeDocFooter,
@@ -37,6 +41,12 @@ export const Layout: React.FC<LayoutProps> = props => {
37
41
  beforeOutline,
38
42
  afterOutline,
39
43
  };
44
+ const homeProps: HomeLayoutProps = {
45
+ beforeHero,
46
+ afterHero,
47
+ beforeFeatures,
48
+ afterFeatures,
49
+ };
40
50
  const { siteData, page } = usePageData();
41
51
  const { themeConfig } = siteData;
42
52
  const {
@@ -72,7 +82,7 @@ export const Layout: React.FC<LayoutProps> = props => {
72
82
  const getContentLayout = () => {
73
83
  switch (pageType) {
74
84
  case 'home':
75
- return <Theme.HomeLayout />;
85
+ return <Theme.HomeLayout {...homeProps} />;
76
86
  case 'doc':
77
87
  return <DocLayout {...docProps} />;
78
88
  case '404':