@rspress/core 2.0.0-rc.2 → 2.0.0-rc.4
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} +18 -15
- package/dist/{5313.6594aba0.js → 3521.9eb6b114.js} +12 -19
- package/dist/4669.69cb6b18.js +1 -0
- package/dist/{5485.2a0273cf.js → 5485.9fc7f63d.js} +5 -5
- package/dist/6289.29817fb4.js +4 -0
- package/dist/8813.4b28f4bb.js +1 -0
- package/dist/9643.2dff683e.js +4 -0
- package/dist/_private/react/render.js +17 -4
- package/dist/cli/config/loadConfigFile.js +2 -2
- package/dist/cli/index.44f3184c.js +2 -0
- package/dist/cli/index.js +3 -3
- 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 +4 -3
- package/dist/eject-theme/components/HoverGroup/index.tsx +104 -22
- 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/Nav/NavMenu.scss +1 -1
- package/dist/eject-theme/components/Nav/NavMenu.tsx +50 -28
- 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/NavScreenMenuItem.tsx +26 -11
- 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 +66 -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 +7 -11
- package/dist/node/PluginDriver.js +5 -6
- package/dist/node/auto-nav-sidebar/index.js +3 -3
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +12 -10
- package/dist/node/auto-nav-sidebar/utils.js +2 -2
- package/dist/node/auto-nav-sidebar/walk.js +13 -9
- package/dist/node/constants.d.ts +1 -0
- package/dist/node/constants.js +4 -3
- package/dist/node/eject.js +7 -10
- package/dist/node/initRsbuild.js +25 -11
- package/dist/node/last-updated/index.js +1 -1
- package/dist/node/logger/hint.js +1 -1
- package/dist/node/mdx/loader.7c249a26.js +12 -0
- package/dist/node/mdx/loader.js +2 -1
- package/dist/node/mdx/options.js +9 -6
- package/dist/node/mdx/processor.js +2 -2
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +4 -4
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -5
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +3 -3
- package/dist/node/mdx/remarkPlugins/image.js +3 -3
- package/dist/node/mdx/remarkPlugins/link.js +3 -3
- package/dist/node/mdx/remarkPlugins/toc.js +3 -3
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +3 -3
- package/dist/node/route/extractPageData.js +5 -5
- package/dist/node/route/normalizeRoutePath.js +2 -2
- package/dist/node/runtimeModule/i18n.js +2 -2
- package/dist/node/runtimeModule/pageData/createPageData.js +2 -2
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/renderPage.js +2 -2
- package/dist/node/ssg/renderPageWorker.165b5d46.js +1 -0
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +3 -3
- package/dist/node/ssg/rsbuildPluginSSG.js +2 -2
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +9 -3
- package/dist/node/ssg-md/llms/llmsTxt.js +2 -2
- package/dist/node/ssg-md/remarkSplitMdx.js +141 -99
- package/dist/node/ssg-md/renderPage.js +2 -2
- package/dist/node/ssg-md/renderPages.js +2 -2
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +2 -2
- package/dist/node/utils/checkLanguageParity.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 +5 -5
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +3 -3
- package/dist/node/utils/reactAlias.js +2 -2
- package/dist/runtime/App.js +4 -2
- package/dist/runtime/initPageData.js +1 -1
- package/dist/runtime.js +1 -2
- package/dist/shiki-transformers.js +2 -2
- 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 +6 -5
- package/dist/theme/components/HoverGroup/index.js +88 -17
- 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/Nav/NavMenu.css +1 -1
- package/dist/theme/components/Nav/NavMenu.d.ts +6 -1
- package/dist/theme/components/Nav/NavMenu.js +47 -45
- package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
- package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
- package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -11
- 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 +46 -3
- 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/DocLayout/index.js +10 -0
- package/dist/theme/layout/HomeLayout/index.js +40 -0
- package/dist/theme/layout/Layout/index.js +11 -8
- 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/logic/useStorageValue.js +6 -3
- package/dist/theme/styles/base.css +1 -0
- package/dist/theme/styles/shiki.css +9 -3
- package/dist/theme/styles/vars/base-vars.css +4 -4
- package/dist/theme/styles/vars/code-vars.css +2 -0
- package/nav-json-schema.json +2 -2
- package/package.json +15 -15
- package/dist/1218.3869bad6.js +0 -2
- package/dist/4669.12208c6a.js +0 -2
- package/dist/6289.c67fe0d5.js +0 -5
- package/dist/7805.cadab34e.js +0 -4
- package/dist/8813.9da1f210.js +0 -2
- package/dist/cli/index.cb89dbd1.js +0 -3
- package/dist/node/mdx/loader.e1578c62.js +0 -13
- package/dist/node/ssg/renderPageWorker.474f9f73.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
|
@@ -11,7 +11,7 @@ const SvgDown = (props)=>/*#__PURE__*/ jsx(SvgWrapper, {
|
|
|
11
11
|
function NavScreenMenuItemRaw({ left, right, isOpen, isActive, onClick, href }) {
|
|
12
12
|
if (href) return /*#__PURE__*/ jsxs(Link, {
|
|
13
13
|
href: href,
|
|
14
|
-
className: clsx('rp-nav-screen-menu-item', isActive && 'rp-nav-screen-menu-item--active'),
|
|
14
|
+
className: clsx('rp-nav-screen-menu-item', isOpen && 'rp-nav-screen-menu-item--open', isActive && 'rp-nav-screen-menu-item--active'),
|
|
15
15
|
onClick: onClick,
|
|
16
16
|
children: [
|
|
17
17
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -61,7 +61,7 @@ function NavScreenMenuItemWithLink({ menuItem }) {
|
|
|
61
61
|
}
|
|
62
62
|
function NavScreenMenuItemWithChildren({ menuItem }) {
|
|
63
63
|
const [isOpen, setIsOpen] = useState(false);
|
|
64
|
-
return
|
|
64
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
65
65
|
children: [
|
|
66
66
|
/*#__PURE__*/ jsx(NavScreenMenuItemRaw, {
|
|
67
67
|
left: /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -76,7 +76,8 @@ function NavScreenMenuItemWithChildren({ menuItem }) {
|
|
|
76
76
|
className: "rp-nav-screen-menu-item__icon"
|
|
77
77
|
}),
|
|
78
78
|
isOpen: isOpen,
|
|
79
|
-
onClick: ()=>setIsOpen(!isOpen)
|
|
79
|
+
onClick: ()=>setIsOpen(!isOpen),
|
|
80
|
+
href: 'link' in menuItem ? menuItem.link : void 0
|
|
80
81
|
}),
|
|
81
82
|
/*#__PURE__*/ jsx("div", {
|
|
82
83
|
className: "rp-nav-screen-menu-item__group",
|
|
@@ -88,22 +89,31 @@ function NavScreenMenuItemWithChildren({ menuItem }) {
|
|
|
88
89
|
},
|
|
89
90
|
children: /*#__PURE__*/ jsx("div", {
|
|
90
91
|
className: "rp-nav-screen-menu-item__group-inner",
|
|
91
|
-
children: menuItem.items.map((item)=>/*#__PURE__*/ jsx(
|
|
92
|
+
children: menuItem.items.map((item)=>/*#__PURE__*/ jsx(NavScreenMenuItem, {
|
|
92
93
|
menuItem: item
|
|
93
94
|
}, item.text))
|
|
94
95
|
})
|
|
95
96
|
})
|
|
96
97
|
]
|
|
97
|
-
}) : /*#__PURE__*/ jsx(NavScreenMenuItemWithLink, {
|
|
98
|
-
menuItem: menuItem
|
|
99
98
|
});
|
|
100
99
|
}
|
|
101
|
-
function NavScreenMenuItem({ menuItem
|
|
102
|
-
if ('items' in
|
|
103
|
-
menuItem:
|
|
100
|
+
function NavScreenMenuItem({ menuItem }) {
|
|
101
|
+
if ('items' in menuItem && Array.isArray(menuItem.items) && menuItem.items.length > 0) return /*#__PURE__*/ jsx(NavScreenMenuItemWithChildren, {
|
|
102
|
+
menuItem: menuItem
|
|
104
103
|
});
|
|
105
|
-
return /*#__PURE__*/ jsx(NavScreenMenuItemWithLink, {
|
|
106
|
-
menuItem:
|
|
104
|
+
if ('link' in menuItem && 'string' == typeof menuItem.link) return /*#__PURE__*/ jsx(NavScreenMenuItemWithLink, {
|
|
105
|
+
menuItem: menuItem
|
|
106
|
+
});
|
|
107
|
+
return /*#__PURE__*/ jsx(NavScreenMenuItemRaw, {
|
|
108
|
+
left: /*#__PURE__*/ jsxs(Fragment, {
|
|
109
|
+
children: [
|
|
110
|
+
menuItem.text,
|
|
111
|
+
menuItem.tag && /*#__PURE__*/ jsx(Tag, {
|
|
112
|
+
tag: menuItem.tag
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
right: null
|
|
107
117
|
});
|
|
108
118
|
}
|
|
109
119
|
export { NavScreenMenuItem, NavScreenMenuItemRaw, NavScreenMenuItemWithChildren, NavScreenMenuItemWithLink, SvgDown };
|
|
@@ -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;
|
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isEqualPath, useI18n, usePageData, useSidebar } from "@rspress/core/runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isEqualPath, normalizeHref, useI18n, usePageData, useSidebar, withBase } from "@rspress/core/runtime";
|
|
3
3
|
import { FallbackHeading, OverviewGroup } from "@theme";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { isSidebarDivider, isSidebarSectionHeader, isSidebarSingleFile } from "../Sidebar/utils.js";
|
|
6
6
|
import "./index.css";
|
|
7
7
|
import { findItemByRoutePath } from "./utils.js";
|
|
8
|
+
function routePathToMdPath(routePath) {
|
|
9
|
+
let url = routePath;
|
|
10
|
+
url = normalizeHref(url, false);
|
|
11
|
+
url = url.replace(/\.html$/, '.md');
|
|
12
|
+
return withBase(url);
|
|
13
|
+
}
|
|
14
|
+
function OverviewMarkdown({ title, groups }) {
|
|
15
|
+
const lines = [];
|
|
16
|
+
lines.push(`# ${title}`);
|
|
17
|
+
lines.push('');
|
|
18
|
+
for (const group of groups){
|
|
19
|
+
if (group.name) {
|
|
20
|
+
lines.push(`## ${group.name}`);
|
|
21
|
+
lines.push('');
|
|
22
|
+
}
|
|
23
|
+
for (const item of group.items){
|
|
24
|
+
const itemTitle = item.link ? `[${item.text}](${routePathToMdPath(item.link)})` : `**${item.text}**`;
|
|
25
|
+
lines.push(`### ${itemTitle}`);
|
|
26
|
+
lines.push('');
|
|
27
|
+
if (item.headers && item.headers.length > 0) {
|
|
28
|
+
for (const header of item.headers){
|
|
29
|
+
const headerLink = item.link ? `[${header.text}](${routePathToMdPath(item.link)}#${header.id})` : header.text;
|
|
30
|
+
lines.push(`- ${headerLink}`);
|
|
31
|
+
}
|
|
32
|
+
lines.push('');
|
|
33
|
+
}
|
|
34
|
+
if (item.items && item.items.length > 0) {
|
|
35
|
+
for (const subItem of item.items){
|
|
36
|
+
const subItemLink = subItem.link ? `[${subItem.text}](${routePathToMdPath(subItem.link)})` : subItem.text;
|
|
37
|
+
lines.push(`- ${subItemLink}`);
|
|
38
|
+
}
|
|
39
|
+
lines.push('');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
44
|
+
children: lines.join('\n')
|
|
45
|
+
});
|
|
46
|
+
}
|
|
8
47
|
const normalizeText = (s)=>s.toLowerCase().replace(/-/g, ' ');
|
|
9
48
|
const matchesQuery = (text, query)=>normalizeText(text).includes(normalizeText(query));
|
|
10
49
|
const OverviewSearchInput = ({ query, setQuery, searchRef })=>{
|
|
@@ -31,7 +70,7 @@ const OverviewSearchInput = ({ query, setQuery, searchRef })=>{
|
|
|
31
70
|
};
|
|
32
71
|
function Overview(props) {
|
|
33
72
|
const { siteData, page: { routePath, title, frontmatter } } = usePageData();
|
|
34
|
-
const { content, groups: customGroups
|
|
73
|
+
const { content, groups: customGroups } = props;
|
|
35
74
|
const t = useI18n();
|
|
36
75
|
const [query, setQuery] = useState('');
|
|
37
76
|
const searchRef = useRef(null);
|
|
@@ -115,6 +154,10 @@ function Overview(props) {
|
|
|
115
154
|
query
|
|
116
155
|
]);
|
|
117
156
|
const overviewTitle = title || 'Overview';
|
|
157
|
+
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(OverviewMarkdown, {
|
|
158
|
+
title: overviewTitle,
|
|
159
|
+
groups: groups
|
|
160
|
+
});
|
|
118
161
|
return /*#__PURE__*/ jsxs("div", {
|
|
119
162
|
className: "rspress-doc rp-doc rspress-overview rp-overview",
|
|
120
163
|
children: [
|
|
@@ -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
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FallbackHeading, Link, SvgWrapper, renderInlineMarkdown } from "@theme";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import icons_plugin from "./icons/plugin.js";
|
|
6
|
+
const OverviewGroup = ({ group })=>{
|
|
7
|
+
const { itemsWithContent, itemsWithoutContent } = useMemo(()=>{
|
|
8
|
+
const itemsWithContent = group.items.filter((item)=>item.headers && item.headers.length > 0 || item.items && item.items.length > 0);
|
|
9
|
+
const itemsWithoutContent = group.items.filter((item)=>!(item.headers && item.headers.length > 0) && !(item.items && item.items.length > 0));
|
|
10
|
+
return {
|
|
11
|
+
itemsWithContent,
|
|
12
|
+
itemsWithoutContent
|
|
13
|
+
};
|
|
14
|
+
}, [
|
|
15
|
+
group
|
|
16
|
+
]);
|
|
17
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ jsx(FallbackHeading, {
|
|
20
|
+
level: 2,
|
|
21
|
+
title: group.name
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsxs("div", {
|
|
24
|
+
className: "rp-overview-group rp-not-doc",
|
|
25
|
+
children: [
|
|
26
|
+
itemsWithContent.map((item)=>/*#__PURE__*/ jsxs("div", {
|
|
27
|
+
className: "rp-overview-group__item",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ jsxs("div", {
|
|
30
|
+
className: "rp-overview-group__item__title",
|
|
31
|
+
children: [
|
|
32
|
+
item.link ? /*#__PURE__*/ jsx(Link, {
|
|
33
|
+
href: item.link,
|
|
34
|
+
className: "rp-overview-group__item__title__link",
|
|
35
|
+
...renderInlineMarkdown(item.text)
|
|
36
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
37
|
+
className: "rp-overview-group__item__title__text",
|
|
38
|
+
...renderInlineMarkdown(item.text)
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
41
|
+
icon: icons_plugin,
|
|
42
|
+
className: "rp-overview-group__item__title__icon"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsxs("ul", {
|
|
47
|
+
className: "rp-overview-group__item__content",
|
|
48
|
+
children: [
|
|
49
|
+
item.headers?.map((header)=>/*#__PURE__*/ jsx("li", {
|
|
50
|
+
className: "rp-overview-group__item__content__item",
|
|
51
|
+
children: /*#__PURE__*/ jsx(Link, {
|
|
52
|
+
className: "rp-overview-group__item__content__item__link",
|
|
53
|
+
href: `${item.link}#${header.id}`,
|
|
54
|
+
...renderInlineMarkdown(header.text)
|
|
55
|
+
})
|
|
56
|
+
}, header.id)),
|
|
57
|
+
item.items?.map(({ link, text })=>/*#__PURE__*/ jsx("li", {
|
|
58
|
+
className: "rp-overview-group__item__content__item",
|
|
59
|
+
children: /*#__PURE__*/ jsx(Link, {
|
|
60
|
+
className: "rp-overview-group__item__content__item__link",
|
|
61
|
+
href: link,
|
|
62
|
+
...renderInlineMarkdown(text)
|
|
63
|
+
})
|
|
64
|
+
}, link))
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}, item.link)),
|
|
69
|
+
itemsWithoutContent.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
70
|
+
className: "rp-overview-group__grid",
|
|
71
|
+
children: itemsWithoutContent.map((item)=>/*#__PURE__*/ jsx("div", {
|
|
72
|
+
className: "rp-overview-group__grid-item rp-overview-group__item__title",
|
|
73
|
+
children: item.link ? /*#__PURE__*/ jsx(Link, {
|
|
74
|
+
href: item.link,
|
|
75
|
+
className: "rp-overview-group__item__title__link",
|
|
76
|
+
...renderInlineMarkdown(item.text)
|
|
77
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
78
|
+
className: "rp-overview-group__item__title__text",
|
|
79
|
+
...renderInlineMarkdown(item.text)
|
|
80
|
+
})
|
|
81
|
+
}, item.link))
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
export { OverviewGroup };
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
contain: content;
|
|
3
3
|
border-radius: var(--rp-radius);
|
|
4
4
|
border: var(--rp-code-block-border);
|
|
5
|
+
box-shadow: var(--rp-code-block-shadow);
|
|
5
6
|
margin: 1rem 0;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
.rp-tabs .rp-codeblock {
|
|
9
|
-
border: none
|
|
10
|
-
border-radius: 0
|
|
11
|
-
margin: 0
|
|
9
|
+
.rp-tabs .rp-tabs, .rp-tabs .rp-codeblock {
|
|
10
|
+
border: none;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
margin: 0;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
.rp-tabs .rp-codeblock .rp-codeblock__title {
|
|
15
|
-
padding: 8px
|
|
16
|
+
padding: 8px 12px;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
.rp-tabs__label {
|
|
@@ -35,6 +35,15 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
35
35
|
values,
|
|
36
36
|
children
|
|
37
37
|
]);
|
|
38
|
+
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
|
|
39
|
+
children: tabValues.map(({ label, content })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
40
|
+
children: [
|
|
41
|
+
`\n**${label}**\n\n`,
|
|
42
|
+
content,
|
|
43
|
+
`\n`
|
|
44
|
+
]
|
|
45
|
+
}))
|
|
46
|
+
});
|
|
38
47
|
const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0);
|
|
39
48
|
const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, activeIndex.toString());
|
|
40
49
|
const currentIndex = groupId ? Number(storageIndex) : activeIndex;
|
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { isDataUrl, isExternalUrl } from "@rspress/core/runtime";
|
|
3
|
-
import { Badge } from "
|
|
4
|
-
|
|
3
|
+
import { Badge, IconDeprecated, IconExperimental, SvgWrapper, Tag } from "@theme";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
const BADGE_TAGS = {
|
|
6
|
+
tip: 'tip',
|
|
7
|
+
info: 'info',
|
|
8
|
+
warning: 'warning',
|
|
9
|
+
danger: 'danger'
|
|
10
|
+
};
|
|
11
|
+
function parseCommonTagsArrayStr(tagStr) {
|
|
12
|
+
const tags = tagStr.split(',').map((tag)=>tag.trim()).filter((tag)=>tag.length > 0);
|
|
13
|
+
return tags;
|
|
14
|
+
}
|
|
15
|
+
const getTagType = (tag)=>{
|
|
16
|
+
const normalizedTag = tag.trim();
|
|
17
|
+
const isSvgTagString = normalizedTag.startsWith('<svg');
|
|
18
|
+
const isPic = isExternalUrl(normalizedTag) || isDataUrl(normalizedTag);
|
|
19
|
+
const tagsArray = parseCommonTagsArrayStr(normalizedTag);
|
|
20
|
+
return {
|
|
21
|
+
isSvgTagString,
|
|
22
|
+
isPic,
|
|
23
|
+
isTagsArray: tagsArray && tagsArray?.length > 1,
|
|
24
|
+
tagsArray,
|
|
25
|
+
normalizedTag
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const Tag_Tag = ({ tag })=>{
|
|
5
29
|
if (!tag) return null;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
30
|
+
const { isPic, isTagsArray, isSvgTagString, normalizedTag, tagsArray } = useMemo(()=>getTagType(tag), [
|
|
31
|
+
tag
|
|
32
|
+
]);
|
|
33
|
+
if (isTagsArray) return /*#__PURE__*/ jsx(Fragment, {
|
|
34
|
+
children: tagsArray?.map((tag, index)=>/*#__PURE__*/ jsx(Tag, {
|
|
35
|
+
tag: tag
|
|
36
|
+
}, `${tag}-${index}`))
|
|
37
|
+
});
|
|
9
38
|
if (isSvgTagString) return /*#__PURE__*/ jsx("div", {
|
|
10
39
|
dangerouslySetInnerHTML: {
|
|
11
40
|
__html: tag
|
|
@@ -18,9 +47,35 @@ const Tag = ({ tag })=>{
|
|
|
18
47
|
if (isPic) return /*#__PURE__*/ jsx("img", {
|
|
19
48
|
src: tag
|
|
20
49
|
});
|
|
50
|
+
if ('experimental' === normalizedTag) return /*#__PURE__*/ jsxs(Badge, {
|
|
51
|
+
type: "warning",
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
54
|
+
icon: IconExperimental
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ jsx("span", {
|
|
57
|
+
children: "experimental"
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
if ('deprecated' === normalizedTag) return /*#__PURE__*/ jsxs(Badge, {
|
|
62
|
+
type: "danger",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
65
|
+
icon: IconDeprecated
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ jsx("span", {
|
|
68
|
+
children: "deprecated"
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
if (BADGE_TAGS[normalizedTag]) return /*#__PURE__*/ jsx(Badge, {
|
|
73
|
+
text: normalizedTag,
|
|
74
|
+
type: BADGE_TAGS[normalizedTag]
|
|
75
|
+
});
|
|
21
76
|
return /*#__PURE__*/ jsx(Badge, {
|
|
22
|
-
text:
|
|
77
|
+
text: normalizedTag,
|
|
23
78
|
type: "info"
|
|
24
79
|
});
|
|
25
80
|
};
|
|
26
|
-
export { Tag };
|
|
81
|
+
export { Tag_Tag as Tag };
|
|
@@ -11,7 +11,7 @@ const useActiveAnchor = (headers)=>{
|
|
|
11
11
|
const [scrolledHeader, setScrolledHeader] = useState();
|
|
12
12
|
const { hash } = useLocation();
|
|
13
13
|
useEffect(()=>{
|
|
14
|
-
if (
|
|
14
|
+
if ("u" < typeof window) return;
|
|
15
15
|
const handleScroll = ()=>{
|
|
16
16
|
const scrollPaddingTop = parseCSSLength(window.getComputedStyle(document.documentElement).getPropertyValue('scroll-padding-top'));
|
|
17
17
|
const topOffset = scrollPaddingTop - 5;
|
package/dist/theme/icons.d.ts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
type Icon = React.FC<React.SVGProps<SVGSVGElement>> | string;
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
declare const
|
|
15
|
-
declare const
|
|
16
|
-
declare const
|
|
17
|
-
declare const
|
|
18
|
-
declare const
|
|
19
|
-
declare const
|
|
20
|
-
declare const
|
|
21
|
-
declare const
|
|
22
|
-
declare const
|
|
23
|
-
declare const
|
|
24
|
-
declare const
|
|
25
|
-
export
|
|
2
|
+
export declare const IconDeprecated: Icon;
|
|
3
|
+
export declare const IconExperimental: Icon;
|
|
4
|
+
export declare const IconArrowDown: Icon;
|
|
5
|
+
export declare const IconArrowRight: Icon;
|
|
6
|
+
export declare const IconClose: Icon;
|
|
7
|
+
export declare const IconCopy: Icon;
|
|
8
|
+
export declare const IconDown: Icon;
|
|
9
|
+
export declare const IconEmpty: Icon;
|
|
10
|
+
export declare const IconFile: Icon;
|
|
11
|
+
export declare const IconGithub: Icon;
|
|
12
|
+
export declare const IconGitlab: Icon;
|
|
13
|
+
export declare const IconHeader: Icon;
|
|
14
|
+
export declare const IconJump: Icon;
|
|
15
|
+
export declare const IconLoading: Icon;
|
|
16
|
+
export declare const IconMenu: Icon;
|
|
17
|
+
export declare const IconMoon: Icon;
|
|
18
|
+
export declare const IconRight: Icon;
|
|
19
|
+
export declare const IconSearch: Icon;
|
|
20
|
+
export declare const IconSmallMenu: Icon;
|
|
21
|
+
export declare const IconSuccess: Icon;
|
|
22
|
+
export declare const IconSun: Icon;
|
|
23
|
+
export declare const IconTitle: Icon;
|
|
24
|
+
export declare const IconTranslator: Icon;
|
|
25
|
+
export declare const IconWrap: Icon;
|
|
26
|
+
export declare const IconWrapped: Icon;
|
|
27
|
+
export {};
|
package/dist/theme/icons.js
CHANGED
|
@@ -2,8 +2,10 @@ import arrow_down from "./assets/arrow-down.js";
|
|
|
2
2
|
import arrow_right from "./assets/arrow-right.js";
|
|
3
3
|
import assets_close from "./assets/close.js";
|
|
4
4
|
import copy from "./assets/copy.js";
|
|
5
|
+
import deprecated from "./assets/deprecated.js";
|
|
5
6
|
import down from "./assets/down.js";
|
|
6
7
|
import empty from "./assets/empty.js";
|
|
8
|
+
import experimental from "./assets/experimental.js";
|
|
7
9
|
import file from "./assets/file.js";
|
|
8
10
|
import github from "./assets/github.js";
|
|
9
11
|
import gitlab from "./assets/gitlab.js";
|
|
@@ -21,6 +23,8 @@ import title from "./assets/title.js";
|
|
|
21
23
|
import translator from "./assets/translator.js";
|
|
22
24
|
import wrap from "./assets/wrap.js";
|
|
23
25
|
import wrapped from "./assets/wrapped.js";
|
|
26
|
+
const IconDeprecated = deprecated;
|
|
27
|
+
const IconExperimental = experimental;
|
|
24
28
|
const IconArrowDown = arrow_down;
|
|
25
29
|
const IconArrowRight = arrow_right;
|
|
26
30
|
const IconClose = assets_close;
|
|
@@ -44,4 +48,4 @@ const IconTitle = title;
|
|
|
44
48
|
const IconTranslator = translator;
|
|
45
49
|
const IconWrap = wrap;
|
|
46
50
|
const IconWrapped = wrapped;
|
|
47
|
-
export { IconArrowDown, IconArrowRight, IconClose, IconCopy, IconDown, IconEmpty, IconFile, IconGithub, IconGitlab, IconHeader, IconJump, IconLoading, IconMenu, IconMoon, IconRight, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconTranslator, IconWrap, IconWrapped };
|
|
51
|
+
export { IconArrowDown, IconArrowRight, IconClose, IconCopy, IconDeprecated, IconDown, IconEmpty, IconExperimental, IconFile, IconGithub, IconGitlab, IconHeader, IconJump, IconLoading, IconMenu, IconMoon, IconRight, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconTranslator, IconWrap, IconWrapped };
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { Nav, type NavProps } from './components/Nav/index.js';
|
|
|
25
25
|
export { NavHamburger } from './components/NavHamburger/index.js';
|
|
26
26
|
export { Outline } from './components/Outline/index.js';
|
|
27
27
|
export { Overview } from './components/Overview/index.js';
|
|
28
|
-
export { type Group, type GroupItem, OverviewGroup, } from './components/
|
|
28
|
+
export { type Group, type GroupItem, OverviewGroup, } from './components/OverviewGroup/index.js';
|
|
29
29
|
export { type PackageManagerTabProps, PackageManagerTabs, } from './components/PackageManagerTabs/index.js';
|
|
30
30
|
export { PageTab, type PageTabProps, PageTabs, type PageTabsProps, } from './components/PageTabs/index.js';
|
|
31
31
|
export { PrevNextPage } from './components/PrevNextPage/index.js';
|
|
@@ -57,6 +57,8 @@ export { useThemeState } from './logic/useAppearance.js';
|
|
|
57
57
|
export { useFullTextSearch } from './logic/useFullTextSearch.js';
|
|
58
58
|
export { usePrevNextPage } from './logic/usePrevNextPage.js';
|
|
59
59
|
export { useRedirect4FirstVisit } from './logic/useRedirect4FirstVisit.js';
|
|
60
|
+
export { useScrollAfterNav } from './logic/useScrollAfterNav.js';
|
|
61
|
+
export { useScrollReset } from './logic/useScrollReset.js';
|
|
60
62
|
export { useSetup } from './logic/useSetup.js';
|
|
61
63
|
export { useStorageValue } from './logic/useStorageValue.js';
|
|
62
64
|
export { parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, } from './logic/utils.js';
|