@rspress/core 2.0.0-rc.0 → 2.0.0-rc.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/{3~395.js → 3~128.js} +2 -2
- package/dist/{3~101.js → 3~517.js} +2 -2
- package/dist/{3~335.js → 3~894.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/eject-theme/components/Button/index.scss +1 -6
- package/dist/eject-theme/components/DocContent/doc.scss +3 -2
- package/dist/eject-theme/components/DocContent/index.tsx +3 -0
- package/dist/eject-theme/components/HoverGroup/index.scss +5 -1
- package/dist/eject-theme/components/HoverGroup/index.tsx +5 -1
- package/dist/eject-theme/components/Link/index.tsx +30 -5
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +32 -16
- package/dist/eject-theme/components/Nav/NavMenu.scss +1 -0
- package/dist/eject-theme/components/Nav/NavTitle.scss +11 -0
- package/dist/eject-theme/components/Nav/NavTitle.tsx +1 -0
- package/dist/eject-theme/components/Nav/index.scss +0 -8
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +14 -0
- package/dist/eject-theme/components/Outline/index.scss +0 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +2 -2
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +12 -8
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +5 -4
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +1 -1
- package/dist/eject-theme/components/SourceCode/index.scss +2 -1
- package/dist/eject-theme/components/Toc/TocItem.scss +7 -3
- package/dist/index.js +4 -4
- package/dist/renderPageWorker.js +1 -1
- package/dist/theme/assets/moon.js +9 -26
- package/dist/theme/components/Button/index.css +1 -1
- package/dist/theme/components/DocContent/doc.css +2 -1
- package/dist/theme/components/DocContent/index.js +2 -0
- package/dist/theme/components/HoverGroup/index.css +5 -1
- package/dist/theme/components/HoverGroup/index.js +1 -0
- package/dist/theme/components/Link/index.d.ts +18 -1
- package/dist/theme/components/Link/index.js +6 -4
- package/dist/theme/components/Link/useLinkNavigate.d.ts +4 -1
- package/dist/theme/components/Link/useLinkNavigate.js +23 -17
- package/dist/theme/components/Nav/NavMenu.css +1 -0
- package/dist/theme/components/Nav/NavTitle.css +12 -0
- package/dist/theme/components/Nav/NavTitle.d.ts +1 -0
- package/dist/theme/components/Nav/NavTitle.js +1 -0
- package/dist/theme/components/Nav/index.css +0 -8
- package/dist/theme/components/NavScreen/NavScreenMenuItem.css +9 -0
- package/dist/theme/components/Outline/index.css +0 -1
- package/dist/theme/components/Search/SearchPanel.js +1 -1
- package/dist/theme/components/Sidebar/SidebarItem.css +11 -3
- package/dist/theme/components/Sidebar/SidebarItem.js +5 -3
- package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -1
- package/dist/theme/components/SourceCode/index.css +5 -0
- package/dist/theme/components/Toc/TocItem.css +7 -3
- package/dist/theme/index.d.ts +3 -3
- package/dist/theme/index.js +1 -1
- package/dist/theme/layout/DocLayout/index.js +1 -4
- package/dist/theme/layout/Layout/index.d.ts +1 -1
- package/dist/theme/layout/Layout/index.js +3 -3
- package/dist/theme/logic/useScrollAfterNav.d.ts +5 -0
- package/dist/theme/logic/{sideEffects.js → useScrollAfterNav.js} +5 -6
- package/dist/theme/logic/useScrollReset.d.ts +5 -0
- package/dist/theme/logic/useScrollReset.js +12 -0
- package/dist/theme/logic/useSetup.js +2 -0
- package/dist/theme/styles/base.css +1 -10
- package/dist/theme/styles/index.d.ts +1 -1
- package/dist/theme/styles/index.js +1 -1
- package/dist/theme/styles/vars/home-vars.css +2 -1
- package/package.json +11 -11
- /package/dist/theme/logic/{sideEffects.d.ts → useSetup.d.ts} +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { preloadLink } from "@rspress/core/runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
3
4
|
import nprogress from "nprogress";
|
|
4
|
-
import { getHref, useLinkNavigate } from "./useLinkNavigate.js";
|
|
5
5
|
import "./index.css";
|
|
6
|
-
import
|
|
6
|
+
import { getHref, useLinkNavigate } from "./useLinkNavigate.js";
|
|
7
7
|
nprogress.configure({
|
|
8
8
|
showSpinner: false
|
|
9
9
|
});
|
|
10
10
|
function Link(props) {
|
|
11
|
-
const { href = '/', children, className = '', onClick, onMouseEnter } = props;
|
|
11
|
+
const { href = '/', children, className = '', onClick, onMouseEnter, startTransition } = props;
|
|
12
12
|
const { linkType, removeBaseHref, withBaseHref } = getHref(href);
|
|
13
|
-
const navigate = useLinkNavigate(
|
|
13
|
+
const navigate = useLinkNavigate({
|
|
14
|
+
startTransition
|
|
15
|
+
});
|
|
14
16
|
if ('external' === linkType) return /*#__PURE__*/ jsx("a", {
|
|
15
17
|
...props,
|
|
16
18
|
href: href,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TransitionStartFunction } from 'react';
|
|
1
2
|
type LinkType = 'external' | 'hashOnly' | 'relative' | 'internal';
|
|
2
3
|
export declare function getHref(href: string): {
|
|
3
4
|
withBaseHref: string;
|
|
@@ -8,5 +9,7 @@ export declare function getHref(href: string): {
|
|
|
8
9
|
* For import { Link } from '@theme';
|
|
9
10
|
* useNavigate with preload logic
|
|
10
11
|
*/
|
|
11
|
-
export declare function useLinkNavigate(
|
|
12
|
+
export declare function useLinkNavigate({ startTransition }?: {
|
|
13
|
+
startTransition?: TransitionStartFunction;
|
|
14
|
+
}): (href: string) => Promise<void>;
|
|
12
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cleanUrlByConfig, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, withBase } from "@rspress/core/runtime";
|
|
2
2
|
import nprogress from "nprogress";
|
|
3
|
-
import { useCallback } from "react";
|
|
3
|
+
import { startTransition as external_react_startTransition, useCallback } from "react";
|
|
4
4
|
nprogress.configure({
|
|
5
5
|
showSpinner: false
|
|
6
6
|
});
|
|
@@ -29,28 +29,34 @@ function getHref(href) {
|
|
|
29
29
|
linkType
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function useLinkNavigate(
|
|
32
|
+
function useLinkNavigate({ startTransition } = {
|
|
33
|
+
startTransition: external_react_startTransition
|
|
34
|
+
}) {
|
|
33
35
|
const { pathname: currPagePathname } = useLocation();
|
|
34
36
|
const navigate = useNavigate();
|
|
35
37
|
return useCallback(async (href)=>{
|
|
36
38
|
const { linkType, removeBaseHref, withBaseHref } = getHref(href);
|
|
37
39
|
if ('external' === linkType || 'hashOnly' === linkType) return void window.location.assign(href);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const preloadChunkThenNavigate = async ()=>{
|
|
41
|
+
const inCurrPage = isActive(removeBaseHref, currPagePathname);
|
|
42
|
+
if (!process.env.__SSR__ && !inCurrPage) {
|
|
43
|
+
const matchedRoute = pathnameToRouteService(removeBaseHref);
|
|
44
|
+
if (!matchedRoute) return void window.location.assign(withBaseHref);
|
|
45
|
+
{
|
|
46
|
+
const timer = setTimeout(()=>{
|
|
47
|
+
nprogress.start();
|
|
48
|
+
}, 200);
|
|
49
|
+
await matchedRoute.preload();
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
nprogress.done();
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
+
navigate(removeBaseHref, {
|
|
55
|
+
replace: false
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
if (startTransition) startTransition(preloadChunkThenNavigate);
|
|
59
|
+
else preloadChunkThenNavigate();
|
|
54
60
|
}, [
|
|
55
61
|
currPagePathname,
|
|
56
62
|
navigate
|
|
@@ -2,6 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { addLeadingSlash, normalizeImagePath, useLocaleSiteData, useSite } from "@rspress/core/runtime";
|
|
3
3
|
import { Link } from "@theme";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
+
import "./NavTitle.css";
|
|
5
6
|
const NavTitle = ()=>{
|
|
6
7
|
const { site } = useSite();
|
|
7
8
|
const localeData = useLocaleSiteData();
|
|
@@ -48,3 +48,12 @@
|
|
|
48
48
|
overflow: hidden;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
.rp-nav-screen-menu-item.rp-link[target="_blank"] .rp-nav-screen-menu-item__left:after {
|
|
52
|
+
content: "↗";
|
|
53
|
+
color: var(--rp-c-text-3);
|
|
54
|
+
margin-left: .2em;
|
|
55
|
+
margin-right: .1em;
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
transform: translate(0, -.2em);
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -138,7 +138,7 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
138
138
|
case KEY_CODE.ENTER:
|
|
139
139
|
if (e.isComposing) return;
|
|
140
140
|
if (currentSuggestionIndex >= 0 && currentRenderType === RenderType.Default) {
|
|
141
|
-
const flatSuggestions =
|
|
141
|
+
const flatSuggestions = Array.from(normalizeSuggestions(currentSuggestions).values()).flat();
|
|
142
142
|
const suggestion = flatSuggestions[currentSuggestionIndex];
|
|
143
143
|
navigate(suggestion.link);
|
|
144
144
|
clearSearchState();
|
|
@@ -5,20 +5,28 @@
|
|
|
5
5
|
justify-content: space-between;
|
|
6
6
|
align-items: center;
|
|
7
7
|
margin-top: 2px;
|
|
8
|
-
padding:
|
|
8
|
+
padding: 6px 12px;
|
|
9
9
|
font-size: 14px;
|
|
10
10
|
font-weight: 400;
|
|
11
|
-
line-height:
|
|
11
|
+
line-height: 24px;
|
|
12
12
|
transition: color .15s, background-color .15s;
|
|
13
13
|
display: flex;
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.rp-sidebar-item:
|
|
17
|
+
.rp-sidebar-item:first-child {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rp-sidebar-item:hover, .rp-sidebar-item--pending {
|
|
18
22
|
color: var(--rp-c-text-1);
|
|
19
23
|
background-color: var(--rp-c-bg-mute);
|
|
20
24
|
}
|
|
21
25
|
|
|
26
|
+
.rp-sidebar-item--pending {
|
|
27
|
+
opacity: .8;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
.rp-sidebar-item.rp-link[target="_blank"]:after {
|
|
23
31
|
content: "↗";
|
|
24
32
|
margin-left: .2em;
|
|
@@ -2,11 +2,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useActiveMatcher } from "@rspress/core/runtime";
|
|
3
3
|
import { Link, Tag, renderInlineMarkdown } from "@theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { useEffect, useRef } from "react";
|
|
5
|
+
import { useEffect, useRef, useTransition } from "react";
|
|
6
6
|
import "./SidebarItem.css";
|
|
7
7
|
import scroll_into_view_if_needed from "scroll-into-view-if-needed";
|
|
8
8
|
function SidebarItemRaw({ active, text, tag, link, context, className, left, right, onClick, depth }) {
|
|
9
9
|
const ref = useRef(null);
|
|
10
|
+
const [isPending, startTransition] = useTransition();
|
|
10
11
|
useEffect(()=>{
|
|
11
12
|
if (active && ref.current) scroll_into_view_if_needed(ref.current, {
|
|
12
13
|
scrollMode: 'if-needed'
|
|
@@ -39,9 +40,10 @@ function SidebarItemRaw({ active, text, tag, link, context, className, left, rig
|
|
|
39
40
|
});
|
|
40
41
|
if (link) return /*#__PURE__*/ jsx(Link, {
|
|
41
42
|
href: link,
|
|
42
|
-
|
|
43
|
+
startTransition: startTransition,
|
|
43
44
|
className: clsx('rp-sidebar-item', {
|
|
44
|
-
'rp-sidebar-item--active': active
|
|
45
|
+
'rp-sidebar-item--active': active,
|
|
46
|
+
'rp-sidebar-item--pending': isPending
|
|
45
47
|
}, className),
|
|
46
48
|
style: {
|
|
47
49
|
paddingLeft: 0 === depth ? '12px' : `calc(12px * ${depth} + 12px)`
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
.rp-toc-item {
|
|
2
|
-
border-radius: 6px;
|
|
3
2
|
justify-content: flex-start;
|
|
4
3
|
align-self: stretch;
|
|
5
4
|
align-items: flex-start;
|
|
6
5
|
gap: 10px;
|
|
6
|
+
margin-top: 6px;
|
|
7
7
|
display: block;
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
.rp-toc-item:first-child {
|
|
12
|
+
margin-top: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
.rp-toc-item__text {
|
|
12
16
|
color: var(--rp-c-text-2);
|
|
13
17
|
overflow-wrap: break-word;
|
|
14
18
|
font-size: 14px;
|
|
15
19
|
font-weight: 400;
|
|
16
|
-
line-height:
|
|
20
|
+
line-height: 1;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
.rp-toc-item--active .rp-toc-item__text, .rp-toc-item--active .rp-toc-item__text
|
|
23
|
+
.rp-toc-item--active .rp-toc-item__text, .rp-toc-item--active .rp-toc-item__text code {
|
|
20
24
|
color: var(--rp-c-link);
|
|
21
25
|
}
|
|
22
26
|
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -46,14 +46,14 @@ export { Toc } from './components/Toc';
|
|
|
46
46
|
export { useActiveAnchor } from './hooks/useActiveAnchor';
|
|
47
47
|
export { useDynamicToc, useWatchToc } from './hooks/useDynamicToc';
|
|
48
48
|
export { DocLayout, type DocLayoutProps } from './layout/DocLayout';
|
|
49
|
-
export { HomeLayout } from './layout/HomeLayout/index';
|
|
50
|
-
export { Layout } from './layout/Layout/index';
|
|
49
|
+
export { HomeLayout, type HomeLayoutProps } from './layout/HomeLayout/index';
|
|
50
|
+
export { Layout, type LayoutProps } from './layout/Layout/index';
|
|
51
51
|
export { NotFoundLayout } from './layout/NotFountLayout/index';
|
|
52
52
|
export { mergeRefs } from './logic/mergeRefs';
|
|
53
|
-
export { useSetup } from './logic/sideEffects';
|
|
54
53
|
export { useThemeState } from './logic/useAppearance';
|
|
55
54
|
export { useFullTextSearch } from './logic/useFullTextSearch';
|
|
56
55
|
export { usePrevNextPage } from './logic/usePrevNextPage';
|
|
57
56
|
export { useRedirect4FirstVisit } from './logic/useRedirect4FirstVisit';
|
|
57
|
+
export { useSetup } from './logic/useSetup';
|
|
58
58
|
export { useStorageValue } from './logic/useStorageValue';
|
|
59
59
|
export { parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, } from './logic/utils';
|
package/dist/theme/index.js
CHANGED
|
@@ -48,11 +48,11 @@ import { HomeLayout } from "./layout/HomeLayout/index.js";
|
|
|
48
48
|
import { Layout } from "./layout/Layout/index.js";
|
|
49
49
|
import { NotFoundLayout } from "./layout/NotFountLayout/index.js";
|
|
50
50
|
import { mergeRefs } from "./logic/mergeRefs.js";
|
|
51
|
-
import { useSetup } from "./logic/sideEffects.js";
|
|
52
51
|
import { useThemeState } from "./logic/useAppearance.js";
|
|
53
52
|
import { useFullTextSearch } from "./logic/useFullTextSearch.js";
|
|
54
53
|
import { usePrevNextPage } from "./logic/usePrevNextPage.js";
|
|
55
54
|
import { useRedirect4FirstVisit } from "./logic/useRedirect4FirstVisit.js";
|
|
55
|
+
import { useSetup } from "./logic/useSetup.js";
|
|
56
56
|
import { useStorageValue } from "./logic/useStorageValue.js";
|
|
57
57
|
import { parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown } from "./logic/utils.js";
|
|
58
58
|
export { Badge, Banner, Button, Callout, CodeBlock, CodeBlockRuntime, CodeButtonGroup, DocContent, DocFooter, DocLayout, EditLink, HomeBackground, HomeFeature, HomeFooter, HomeHero, HomeLayout, HoverGroup, LastUpdated, Layout, Link, Nav, NavHamburger, NotFoundLayout, Outline, Overview, OverviewGroup, PackageManagerTabs, PageTab, PageTabs, PrevNextPage, ReadPercent, RenderType, Search, SearchButton, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SvgWrapper, SwitchAppearance, Tab, Tabs, Tag, Toc, getCustomMDXComponent, mergeRefs, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, useActiveAnchor, useCodeButtonGroup, useDynamicToc, useEditLink, useFullTextSearch, useHoverGroup, useLinkNavigate, usePrevNextPage, useRedirect4FirstVisit, useSetup, useStorageValue, useThemeState, useWatchToc };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useFrontmatter } from "@rspress/core/runtime";
|
|
3
|
-
import { DocContent, Overview, useWatchToc } from "@theme";
|
|
3
|
+
import { DocContent, DocFooter, Outline, Overview, Sidebar, useWatchToc } from "@theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { DocFooter } from "../../components/DocFooter/index.js";
|
|
6
|
-
import { Outline } from "../../components/Outline/index.js";
|
|
7
|
-
import { Sidebar } from "../../components/Sidebar/index.js";
|
|
8
5
|
import { useSidebarMenu } from "../../components/SidebarMenu/useSidebarMenu.js";
|
|
9
6
|
import "./index.css";
|
|
10
7
|
function DocLayout(props) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HomeLayoutProps } from '@theme';
|
|
1
2
|
import { type DocLayoutProps, type NavProps } from '@theme';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import type { HomeLayoutProps } from '../HomeLayout';
|
|
4
4
|
export type LayoutProps = {
|
|
5
5
|
top?: React.ReactNode;
|
|
6
6
|
bottom?: React.ReactNode;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Content, useFrontmatter, useLocaleSiteData, usePageData, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { DocLayout, HomeLayout as external_theme_HomeLayout, Nav, NotFoundLayout as external_theme_NotFoundLayout } from "@theme";
|
|
3
|
+
import { DocLayout, HomeLayout as external_theme_HomeLayout, Nav, NotFoundLayout as external_theme_NotFoundLayout, useRedirect4FirstVisit, useSetup } from "@theme";
|
|
4
4
|
import { Head, useHead } from "@unhead/react";
|
|
5
5
|
import react, { memo, useMemo } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import { useRedirect4FirstVisit } from "../../logic/useRedirect4FirstVisit.js";
|
|
6
|
+
import { useScrollReset } from "../../logic/useScrollReset.js";
|
|
8
7
|
const concatTitle = (title, suffix)=>{
|
|
9
8
|
if (!suffix) return title;
|
|
10
9
|
title = title.trim();
|
|
@@ -71,6 +70,7 @@ function Layout(props) {
|
|
|
71
70
|
const { pageType, lang: currentLang, title: articleTitle } = page;
|
|
72
71
|
const localesData = useLocaleSiteData();
|
|
73
72
|
useSetup();
|
|
73
|
+
useScrollReset();
|
|
74
74
|
useRedirect4FirstVisit();
|
|
75
75
|
let title = frontmatter.title ?? articleTitle;
|
|
76
76
|
const mainTitle = site.title || localesData.title || '';
|
|
@@ -18,17 +18,16 @@ function scrollToTarget(target) {
|
|
|
18
18
|
top: offsetTop
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
21
|
+
function useScrollAfterNav() {
|
|
22
|
+
const location = useLocation();
|
|
23
23
|
useEffect(()=>{
|
|
24
24
|
const decodedHash = decodeURIComponent(window.location.hash);
|
|
25
|
-
if (
|
|
26
|
-
else {
|
|
25
|
+
if (decodedHash.length > 0) {
|
|
27
26
|
const target = document.getElementById(decodedHash.slice(1));
|
|
28
27
|
if (target) scrollToTarget(target);
|
|
29
28
|
}
|
|
30
29
|
}, [
|
|
31
|
-
|
|
30
|
+
location
|
|
32
31
|
]);
|
|
33
32
|
}
|
|
34
|
-
export {
|
|
33
|
+
export { useScrollAfterNav };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useLocation } from "react-router-dom";
|
|
3
|
+
function useScrollReset() {
|
|
4
|
+
const { pathname } = useLocation();
|
|
5
|
+
useEffect(()=>{
|
|
6
|
+
const decodedHash = decodeURIComponent(window.location.hash);
|
|
7
|
+
if (0 === decodedHash.length) window.scrollTo(0, 0);
|
|
8
|
+
}, [
|
|
9
|
+
pathname
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
export { useScrollReset };
|
|
@@ -42,16 +42,7 @@ body {
|
|
|
42
42
|
--rp-font-family-mono: Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.
|
|
46
|
-
height: 1.6rem;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#nprogress .bar {
|
|
45
|
+
:root #nprogress .bar {
|
|
50
46
|
background: var(--rp-c-brand);
|
|
51
|
-
width: 100%;
|
|
52
|
-
height: 2px;
|
|
53
|
-
position: fixed;
|
|
54
|
-
top: 0;
|
|
55
|
-
left: 0;
|
|
56
47
|
}
|
|
57
48
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The theme code will be bundled by Modern.js Module Tools, but it will ignore the `@import` in css file. So we need to import the css file in js/ts file to make sure the css file will be bundled.
|
|
3
3
|
*/
|
|
4
|
+
import 'nprogress/nprogress.css';
|
|
4
5
|
import './vars/brand-vars.css';
|
|
5
6
|
import './vars/shiki-vars.css';
|
|
6
7
|
import './vars/code-vars.css';
|
|
@@ -9,4 +10,3 @@ import './vars/base-vars.css';
|
|
|
9
10
|
import './base.css';
|
|
10
11
|
import './scrollbar.scss';
|
|
11
12
|
import './shiki.scss';
|
|
12
|
-
import 'nprogress/nprogress.css';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "nprogress/nprogress.css";
|
|
1
2
|
import "./vars/brand-vars.css";
|
|
2
3
|
import "./vars/shiki-vars.css";
|
|
3
4
|
import "./vars/code-vars.css";
|
|
@@ -6,4 +7,3 @@ import "./vars/base-vars.css";
|
|
|
6
7
|
import "./base.css";
|
|
7
8
|
import "./scrollbar.css";
|
|
8
9
|
import "./shiki.css";
|
|
9
|
-
import "nprogress/nprogress.css";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
:where(html:not(.rp-dark)) {
|
|
2
|
+
--rp-home-hero-secondary-color: #a673ff;
|
|
2
3
|
--rp-home-hero-title-color: transparent;
|
|
3
|
-
--rp-home-hero-title-bg: linear-gradient(90deg, var(--rp-c-brand-dark) 0%, var(--rp-c-brand-dark) 30%,
|
|
4
|
+
--rp-home-hero-title-bg: linear-gradient(90deg, var(--rp-c-brand-dark) 0%, var(--rp-c-brand-dark) 30%, var(--rp-home-hero-secondary-color) 100%);
|
|
4
5
|
--rp-home-background-bg: radial-gradient(42.12% 56.13% at 100% 0%, #537dff1a 0%, #fff0 100%), radial-gradient(42.01% 79.63% at 52.86% 0%, #537dff33 0%, #fff0 100%), radial-gradient(79.67% 58.09% at 0% 0%, #7e69ff33 0%, #fff0 100%), #fff;
|
|
5
6
|
--rp-home-feature-bg: linear-gradient(135deg, #fff, #f9f9f980);
|
|
6
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@mdx-js/mdx": "^3.1.1",
|
|
61
61
|
"@mdx-js/react": "^3.1.1",
|
|
62
|
-
"@rsbuild/core": "~1.6.
|
|
62
|
+
"@rsbuild/core": "~1.6.6",
|
|
63
63
|
"@rsbuild/plugin-react": "~1.4.2",
|
|
64
64
|
"@rspress/mdx-rs": "0.6.6",
|
|
65
65
|
"@shikijs/rehype": "^3.12.2",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-dom": "^19.2.0",
|
|
86
86
|
"react-lazy-with-preload": "^2.2.1",
|
|
87
87
|
"react-reconciler": "0.33.0",
|
|
88
|
-
"react-router-dom": "^6.30.
|
|
88
|
+
"react-router-dom": "^6.30.2",
|
|
89
89
|
"rehype-external-links": "^3.0.0",
|
|
90
90
|
"rehype-raw": "^7.0.0",
|
|
91
91
|
"remark-gfm": "^4.0.1",
|
|
@@ -97,14 +97,14 @@
|
|
|
97
97
|
"unified": "^11.0.5",
|
|
98
98
|
"unist-util-visit": "^5.0.0",
|
|
99
99
|
"unist-util-visit-children": "^3.0.0",
|
|
100
|
-
"@rspress/runtime": "2.0.0-rc.
|
|
101
|
-
"@rspress/shared": "2.0.0-rc.
|
|
100
|
+
"@rspress/runtime": "2.0.0-rc.1",
|
|
101
|
+
"@rspress/shared": "2.0.0-rc.1"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@microsoft/api-extractor": "^7.
|
|
104
|
+
"@microsoft/api-extractor": "^7.55.0",
|
|
105
105
|
"@rsbuild/plugin-sass": "~1.4.0",
|
|
106
106
|
"@rsbuild/plugin-svgr": "^1.2.2",
|
|
107
|
-
"@rslib/core": "0.
|
|
107
|
+
"@rslib/core": "0.17.2",
|
|
108
108
|
"@types/body-scroll-lock": "^3.1.2",
|
|
109
109
|
"@types/hast": "^3.0.4",
|
|
110
110
|
"@types/html-to-text": "^9.0.4",
|
|
@@ -112,15 +112,15 @@
|
|
|
112
112
|
"@types/mdast": "^4.0.4",
|
|
113
113
|
"@types/node": "^22.8.1",
|
|
114
114
|
"@types/nprogress": "^0.2.3",
|
|
115
|
-
"@types/react": "^19.2.
|
|
116
|
-
"@types/react-dom": "^19.2.
|
|
115
|
+
"@types/react": "^19.2.5",
|
|
116
|
+
"@types/react-dom": "^19.2.3",
|
|
117
117
|
"@types/react-reconciler": "^0.32.3",
|
|
118
118
|
"@types/web": "^0.0.294",
|
|
119
119
|
"execa": "8.0.1",
|
|
120
120
|
"mdast-util-directive": "^3.1.0",
|
|
121
121
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
122
|
-
"memfs": "^4.
|
|
123
|
-
"p-map": "^7.0.
|
|
122
|
+
"memfs": "^4.51.0",
|
|
123
|
+
"p-map": "^7.0.4",
|
|
124
124
|
"postcss": "8.5.6",
|
|
125
125
|
"rehype-stringify": "^10.0.1",
|
|
126
126
|
"remark-directive": "^4.0.0",
|
|
File without changes
|