@rspress/core 2.0.0-rc.1 → 2.0.0-rc.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/bin/rspress.js +1 -1
- package/dist/0~7675.723d12b2.js +1794 -0
- package/dist/3521.56e42d70.js +56 -0
- package/dist/4669.12208c6a.js +2 -0
- package/dist/5485.077f14ff.js +98 -0
- package/dist/6289.c67fe0d5.js +5 -0
- package/dist/8813.9da1f210.js +2 -0
- package/dist/9643.f109822d.js +5 -0
- package/dist/_private/react/render.js +17 -4
- package/dist/cli/config/index.js +4 -0
- package/dist/cli/config/loadConfigFile.js +30 -0
- package/dist/cli/index.cb89dbd1.js +3 -0
- package/dist/cli/index.js +122 -0
- package/dist/eject-theme/components/Badge/index.scss +1 -0
- package/dist/eject-theme/components/Banner/index.tsx +6 -5
- package/dist/eject-theme/components/Callout/index.scss +0 -2
- package/dist/eject-theme/components/Callout/index.tsx +8 -2
- package/dist/eject-theme/components/CodeBlock/index.scss +12 -18
- package/dist/eject-theme/components/CodeBlock/index.tsx +10 -1
- package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +50 -11
- package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -3
- package/dist/eject-theme/components/CodeButtonGroup/index.scss +5 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.tsx +1 -3
- package/dist/eject-theme/components/DocContent/doc.scss +27 -7
- package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +2 -1
- package/dist/eject-theme/components/DocContent/docComponents/table.tsx +10 -4
- 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/{DocContent/FallbackHeading.tsx → FallbackHeading/index.tsx} +20 -11
- package/dist/eject-theme/components/HoverGroup/index.scss +1 -1
- package/dist/eject-theme/components/LastUpdated/index.tsx +8 -1
- package/dist/eject-theme/components/Link/index.tsx +22 -6
- package/dist/eject-theme/components/Nav/NavMenu.tsx +2 -3
- package/dist/eject-theme/components/NavHamburger/index.tsx +3 -4
- 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 +2 -3
- 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 +7 -8
- package/dist/eject-theme/components/{Overview/OverviewGroup.scss → OverviewGroup/index.scss} +66 -12
- package/dist/eject-theme/components/{Overview/OverviewGroup.tsx → OverviewGroup/index.tsx} +51 -5
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +12 -0
- package/dist/eject-theme/components/PrevNextPage/index.tsx +6 -3
- package/dist/eject-theme/components/Root/index.tsx +58 -0
- package/dist/eject-theme/components/Search/NoSearchResult.tsx +2 -3
- package/dist/eject-theme/components/Search/SearchButton.tsx +3 -4
- package/dist/eject-theme/components/Search/SearchPanel.tsx +12 -7
- package/dist/eject-theme/components/Search/SuggestItem.tsx +15 -12
- package/dist/eject-theme/components/Search/logic/util.test.ts +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +2 -3
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -0
- package/dist/eject-theme/components/SidebarMenu/index.tsx +4 -4
- package/dist/eject-theme/components/SocialLinks/index.tsx +2 -3
- package/dist/eject-theme/components/SourceCode/index.tsx +6 -4
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +3 -5
- package/dist/eject-theme/components/Tabs/index.scss +31 -26
- package/dist/eject-theme/components/Tabs/index.tsx +16 -0
- package/dist/eject-theme/components/Tag/index.tsx +84 -5
- package/dist/eject-theme/components/Toc/TocItem.scss +3 -3
- package/dist/eject-theme/components/Toc/TocItem.tsx +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -3134
- package/dist/node/PluginDriver.d.ts +1 -1
- package/dist/node/PluginDriver.js +142 -0
- package/dist/node/auto-nav-sidebar/index.js +44 -0
- package/dist/node/auto-nav-sidebar/locales.js +26 -0
- package/dist/node/auto-nav-sidebar/normalize.js +230 -0
- package/dist/node/auto-nav-sidebar/utils.js +68 -0
- package/dist/node/auto-nav-sidebar/walk.js +67 -0
- package/dist/node/build.js +31 -0
- package/dist/node/constants.d.ts +2 -0
- package/dist/node/constants.js +34 -0
- package/dist/node/dev.js +32 -0
- package/dist/node/eject.js +111 -0
- package/dist/node/index.d.ts +5 -5
- package/dist/node/initRsbuild.d.ts +2 -2
- package/dist/node/initRsbuild.js +346 -0
- package/dist/node/last-updated/index.js +28 -0
- package/dist/node/logger/hint.d.ts +1 -1
- package/dist/node/logger/hint.js +85 -0
- package/dist/node/mdx/loader.d.ts +1 -1
- package/dist/node/mdx/loader.e1578c62.js +13 -0
- package/dist/{loader.js → node/mdx/loader.js} +4 -3
- package/dist/node/mdx/options.d.ts +2 -2
- package/dist/node/mdx/options.js +103 -0
- package/dist/node/mdx/processor.d.ts +2 -2
- package/dist/node/mdx/processor.js +71 -0
- package/dist/node/mdx/rehypePlugins/codeMeta.js +10 -0
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +53 -0
- package/dist/node/mdx/rehypePlugins/shiki.js +34 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-lang.js +15 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-line-numbers.js +22 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-title.js +24 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-wrap-code.js +22 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +5 -5
- package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -0
- package/dist/node/mdx/rehypePlugins/transformers/meta-highlight.js +41 -0
- package/dist/node/mdx/remarkPlugins/builtin.js +11 -0
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +190 -0
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +66 -0
- package/dist/node/mdx/remarkPlugins/image.js +67 -0
- package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
- package/dist/node/mdx/remarkPlugins/link.js +99 -0
- package/dist/node/mdx/remarkPlugins/toc.js +50 -0
- package/dist/node/mdx/types.d.ts +3 -3
- package/dist/node/medium-zoom/index.d.ts +1 -1
- package/dist/node/medium-zoom/index.js +14 -0
- package/dist/node/route/RoutePage.d.ts +1 -1
- package/dist/node/route/RoutePage.js +61 -0
- package/dist/node/route/RouteService.d.ts +1 -1
- package/dist/node/route/RouteService.js +177 -0
- package/dist/node/route/extractPageData.d.ts +1 -1
- package/dist/node/route/extractPageData.js +112 -0
- package/dist/node/route/normalizeRoutePath.js +54 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +21 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +150 -0
- package/dist/node/runtimeModule/globalStyles.d.ts +1 -1
- package/dist/node/runtimeModule/globalStyles.js +12 -0
- package/dist/node/runtimeModule/globalUIComponents.d.ts +1 -1
- package/dist/node/runtimeModule/globalUIComponents.js +25 -0
- package/dist/node/runtimeModule/i18n.d.ts +2 -2
- package/dist/node/runtimeModule/i18n.js +83 -0
- package/dist/node/runtimeModule/pageData/createPageData.d.ts +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +64 -0
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +51 -0
- package/dist/node/runtimeModule/routeList.d.ts +1 -1
- package/dist/node/runtimeModule/routeList.js +7 -0
- package/dist/node/runtimeModule/searchHooks.d.ts +1 -1
- package/dist/node/runtimeModule/searchHooks.js +11 -0
- package/dist/node/runtimeModule/siteData/createSiteData.js +34 -0
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +94 -0
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.d.ts +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +24 -0
- package/dist/node/runtimeModule/socialLinks.d.ts +1 -1
- package/dist/node/runtimeModule/socialLinks.js +8 -0
- package/dist/node/runtimeModule/types.d.ts +2 -2
- package/dist/node/serve.js +23 -0
- package/dist/node/ssg/renderHtmlTemplate.js +33 -0
- package/dist/node/ssg/renderPage.js +34 -0
- package/dist/node/ssg/renderPageWorker.474f9f73.js +2 -0
- package/dist/node/ssg/renderPageWorker.js +15 -0
- package/dist/node/ssg/renderPages.d.ts +1 -1
- package/dist/node/ssg/renderPages.js +105 -0
- package/dist/node/ssg/renderPages.js.LICENSE.txt +4 -0
- package/dist/node/ssg/rsbuildPluginCSR.d.ts +1 -1
- package/dist/node/ssg/rsbuildPluginCSR.js +27 -0
- package/dist/node/ssg/rsbuildPluginSSG.d.ts +1 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +72 -0
- package/dist/node/ssg/ssgEnv.js +33 -0
- package/dist/node/ssg/ssgEnv.js.LICENSE.txt +5 -0
- package/dist/node/ssg-md/llms/emitLlmsTxt.d.ts +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +84 -0
- package/dist/node/ssg-md/llms/llmsTxt.d.ts +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +66 -0
- package/dist/node/ssg-md/react/index.d.ts +1 -1
- package/dist/node/ssg-md/remarkSplitMdx.js +244 -0
- package/dist/node/ssg-md/renderPage.js +31 -0
- package/dist/node/ssg-md/renderPages.d.ts +1 -1
- package/dist/node/ssg-md/renderPages.js +27 -0
- package/dist/node/ssg-md/rsbuildPluginSSGMD.d.ts +1 -1
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +47 -0
- package/dist/node/utils/applyReplaceRules.js +6 -0
- package/dist/node/utils/checkLanguageParity.js +77 -0
- package/dist/node/utils/createHash.js +5 -0
- package/dist/node/utils/error.d.ts +9 -0
- package/dist/node/utils/error.js +10 -0
- package/dist/node/utils/escapeHeadingIds.js +5 -0
- package/dist/node/utils/flattenMdxContent.js +74 -0
- package/dist/node/utils/fs.js +14 -0
- package/dist/node/utils/getImportAstNode.js +63 -0
- package/dist/node/utils/getPageKey.js +6 -0
- package/dist/node/utils/getSocialIcons.js +32 -0
- package/dist/node/utils/index.d.ts +10 -9
- package/dist/node/utils/normalizePath.js +10 -0
- package/dist/node/utils/reactAlias.d.ts +2 -0
- package/dist/node/utils/reactAlias.js +83 -0
- package/dist/rslib-runtime.99091bf6.js +18 -0
- package/dist/runtime/App.js +2 -2
- package/dist/runtime/ClientApp.d.ts +1 -1
- package/dist/runtime/ClientApp.js +0 -4
- package/dist/runtime/initPageData.js +1 -1
- package/dist/runtime/ssrMdServerEntry.js +1 -1
- package/dist/runtime/ssrServerEntry.js +2 -1
- package/dist/runtime.72d450ac.js +1 -0
- package/dist/runtime.js +3 -2
- package/dist/shiki-transformers.d.ts +1 -1
- package/dist/shiki-transformers.js +6 -120
- 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.d.ts +1 -1
- package/dist/theme/components/Banner/index.js +4 -5
- package/dist/theme/components/Callout/index.css +0 -2
- package/dist/theme/components/Callout/index.js +5 -2
- package/dist/theme/components/CodeBlock/index.css +11 -21
- package/dist/theme/components/CodeBlock/index.js +5 -1
- package/dist/theme/components/CodeBlockRuntime/index.d.ts +1 -1
- package/dist/theme/components/CodeBlockRuntime/index.js +38 -8
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +3 -5
- package/dist/theme/components/CodeButtonGroup/index.css +5 -1
- package/dist/theme/components/CodeButtonGroup/index.js +3 -5
- package/dist/theme/components/DocContent/doc.css +28 -7
- package/dist/theme/components/DocContent/docComponents/index.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/pre.js +3 -1
- package/dist/theme/components/DocContent/docComponents/table.d.ts +2 -2
- package/dist/theme/components/DocContent/docComponents/table.js +8 -3
- package/dist/theme/components/DocContent/index.d.ts +11 -2
- package/dist/theme/components/DocContent/index.js +6 -6
- package/dist/theme/components/DocFooter/index.js +1 -5
- package/dist/theme/components/{DocContent/FallbackHeading.js → FallbackHeading/index.js} +19 -11
- package/dist/theme/components/HoverGroup/index.css +3 -3
- package/dist/theme/components/HoverGroup/useHoverGroup.d.ts +1 -1
- 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 +17 -7
- package/dist/theme/components/Nav/NavMenu.js +2 -3
- package/dist/theme/components/NavHamburger/index.js +3 -4
- package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
- package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +2 -3
- 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 +2 -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/PackageManagerTabs/index.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/index.js +4 -0
- package/dist/theme/components/PrevNextPage/index.js +3 -4
- package/dist/theme/components/Root/index.d.ts +54 -0
- package/dist/theme/components/Root/index.js +7 -0
- package/dist/theme/components/Search/NoSearchResult.js +2 -3
- package/dist/theme/components/Search/SearchButton.js +3 -4
- package/dist/theme/components/Search/SearchPanel.js +12 -15
- package/dist/theme/components/Search/SuggestItem.d.ts +1 -1
- package/dist/theme/components/Search/SuggestItem.js +7 -11
- package/dist/theme/components/Search/logic/Provider.d.ts +1 -1
- package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +2 -2
- package/dist/theme/components/Search/logic/search.d.ts +1 -1
- package/dist/theme/components/Search/logic/util.test.js +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +2 -3
- package/dist/theme/components/Sidebar/SidebarItem.js +1 -0
- package/dist/theme/components/SidebarMenu/index.js +3 -5
- package/dist/theme/components/SocialLinks/index.js +2 -3
- package/dist/theme/components/SourceCode/index.js +2 -4
- package/dist/theme/components/SwitchAppearance/index.js +3 -5
- package/dist/theme/components/Tabs/index.css +19 -27
- 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/components/Toc/TocItem.css +2 -3
- package/dist/theme/components/Toc/TocItem.js +1 -0
- package/dist/theme/hooks/useActiveAnchor.js +1 -1
- package/dist/theme/icons.d.ts +27 -0
- package/dist/theme/icons.js +51 -0
- package/dist/theme/index.d.ts +64 -59
- package/dist/theme/index.js +7 -2
- package/dist/theme/layout/DocLayout/index.css +2 -4
- package/dist/theme/layout/Layout/index.js +1 -2
- package/dist/theme/layout/NotFountLayout/index.js +1 -1
- package/dist/theme/logic/useAppearance.js +1 -1
- package/dist/theme/logic/useFullTextSearch.d.ts +1 -1
- package/dist/theme/logic/useMediaQuery.js +1 -1
- package/dist/theme/styles/base.css +1 -0
- package/dist/theme/styles/scrollbar.css +1 -0
- package/dist/theme/styles/shiki.css +9 -3
- package/dist/theme/styles/vars/base-vars.css +7 -5
- package/dist/theme/styles/vars/code-vars.css +2 -0
- package/dist/theme/styles/vars/home-vars.css +2 -1
- package/package.json +22 -23
- package/dist/3~128.js +0 -74
- package/dist/3~517.js +0 -1786
- package/dist/3~894.js +0 -26
- package/dist/cli.js +0 -259
- package/dist/index.js.LICENSE.txt +0 -10
- package/dist/node/auto-nav-sidebar/fixtures/docs/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/fixtures/docs-locales/en/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/fixtures/docs-locales/zh/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/locales.test.d.ts +0 -1
- package/dist/node/auto-nav-sidebar/walk.test.d.ts +0 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/image.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/link.test.d.ts +0 -1
- package/dist/node/route/RouteService.test.d.ts +0 -1
- package/dist/node/route/extractPageData.test.d.ts +0 -1
- package/dist/node/route/fixtures/basic/guide/c.d.ts +0 -2
- package/dist/node/route/normalizeRoutePath.test.d.ts +0 -1
- package/dist/node/runtimeModule/i18n.test.d.ts +0 -1
- package/dist/node/ssg-md/remarkSplitMdx.test.d.ts +0 -4
- package/dist/node/utils/checkLanguageParity.test.d.ts +0 -1
- package/dist/node/utils/detectCustomIcon.d.ts +0 -1
- package/dist/node/utils/detectReactVersion.d.ts +0 -3
- package/dist/processor.js +0 -4539
- package/dist/renderPageWorker.js +0 -196
- package/dist/theme/components/Overview/OverviewGroup.js +0 -58
- package/dist/theme/components/Search/logic/util.test.d.ts +0 -1
- /package/dist/cli/{config.d.ts → config/index.d.ts} +0 -0
- /package/dist/eject-theme/components/{Overview → OverviewGroup}/icons/plugin.svg +0 -0
- /package/dist/{shiki-transformers.js.LICENSE.txt → node/mdx/rehypePlugins/transformers/meta-highlight.js.LICENSE.txt} +0 -0
- /package/dist/theme/components/{DocContent/FallbackHeading.d.ts → FallbackHeading/index.d.ts} +0 -0
- /package/dist/theme/components/{Overview → OverviewGroup}/icons/plugin.js +0 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--rp-code-button-group-z-index: 10;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.rp-codeblock__content:hover .rp-code-button-group__button {
|
|
2
6
|
opacity: 1;
|
|
3
7
|
}
|
|
@@ -6,7 +10,7 @@
|
|
|
6
10
|
position: absolute;
|
|
7
11
|
right: 20px;
|
|
8
12
|
top: 20px;
|
|
9
|
-
z-index:
|
|
13
|
+
z-index: var(--rp-code-button-group-z-index);
|
|
10
14
|
display: flex;
|
|
11
15
|
gap: 10px;
|
|
12
16
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useSite } from '@rspress/core/runtime';
|
|
2
|
-
import { SvgWrapper } from '@theme';
|
|
3
|
-
import IconWrap from '@theme-assets/wrap';
|
|
4
|
-
import IconWrapped from '@theme-assets/wrapped';
|
|
2
|
+
import { IconWrap, IconWrapped, SvgWrapper } from '@theme';
|
|
5
3
|
import clsx from 'clsx';
|
|
6
4
|
import { useRef, useState } from 'react';
|
|
7
5
|
import './index.scss';
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
overflow-wrap: break-word;
|
|
37
37
|
|
|
38
38
|
&:hover {
|
|
39
|
-
border-bottom: 1px solid
|
|
39
|
+
border-bottom: 1px solid currentColor;
|
|
40
40
|
opacity: 0.85;
|
|
41
41
|
}
|
|
42
42
|
&[target='_blank'] {
|
|
@@ -174,22 +174,41 @@
|
|
|
174
174
|
|
|
175
175
|
/* table */
|
|
176
176
|
/* #region */
|
|
177
|
+
&:where(.rp-table-scroll-container) {
|
|
178
|
+
overflow-x: auto;
|
|
179
|
+
}
|
|
177
180
|
&:where(table) {
|
|
178
181
|
width: 100%;
|
|
182
|
+
|
|
183
|
+
table-layout: auto;
|
|
184
|
+
border-collapse: separate;
|
|
185
|
+
border-spacing: 0;
|
|
186
|
+
|
|
187
|
+
border: var(--rp-code-block-border);
|
|
179
188
|
border-radius: var(--rp-radius);
|
|
180
189
|
overflow: hidden;
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
|
|
191
|
+
&::-webkit-scrollbar {
|
|
192
|
+
height: 5px;
|
|
193
|
+
width: 5px;
|
|
194
|
+
}
|
|
195
|
+
&::-webkit-scrollbar-corner {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
&::-webkit-scrollbar-thumb {
|
|
199
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
200
|
+
border-radius: 10px;
|
|
201
|
+
}
|
|
183
202
|
}
|
|
184
203
|
|
|
185
204
|
/* thead */
|
|
186
205
|
&:where(thead) {
|
|
187
206
|
color: var(--rp-c-text-0);
|
|
188
|
-
background: var(--rp-
|
|
207
|
+
background: var(--rp-code-title-bg);
|
|
189
208
|
}
|
|
190
209
|
|
|
191
210
|
&:where(th) {
|
|
192
|
-
padding:
|
|
211
|
+
padding: 0.75rem 1.25rem;
|
|
193
212
|
font-weight: 600;
|
|
194
213
|
font-size: 0.875rem;
|
|
195
214
|
text-align: left;
|
|
@@ -199,11 +218,11 @@
|
|
|
199
218
|
|
|
200
219
|
/* tbody */
|
|
201
220
|
&:where(tbody) {
|
|
202
|
-
background:
|
|
221
|
+
background: var(--rp-c-bg);
|
|
203
222
|
}
|
|
204
223
|
|
|
205
224
|
&:where(td) {
|
|
206
|
-
padding:
|
|
225
|
+
padding: 0.75rem 1.25rem;
|
|
207
226
|
border-bottom: 1px solid var(--rp-c-divider-light);
|
|
208
227
|
|
|
209
228
|
font-size: 0.875rem;
|
|
@@ -235,6 +254,7 @@
|
|
|
235
254
|
padding: 3px 6px;
|
|
236
255
|
border-radius: var(--rp-radius-small);
|
|
237
256
|
background-color: var(--rp-c-text-code-bg);
|
|
257
|
+
border: 1px solid var(--rp-c-text-code-border);
|
|
238
258
|
overflow-wrap: break-word;
|
|
239
259
|
}
|
|
240
260
|
&:where(:not(pre, a) > code) {
|
|
@@ -21,7 +21,8 @@ export function ShikiPre({
|
|
|
21
21
|
containerElementClassName={containerElementClassName}
|
|
22
22
|
codeButtonGroupProps={codeButtonGroupProps}
|
|
23
23
|
>
|
|
24
|
-
|
|
24
|
+
{/* data-lang is a meta for SSG-MD */}
|
|
25
|
+
<pre {...otherProps} data-lang={lang} data-title={title} />
|
|
25
26
|
</CodeBlock>
|
|
26
27
|
);
|
|
27
28
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentProps, forwardRef } from 'react';
|
|
2
2
|
|
|
3
|
-
export const Table =
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export const Table = forwardRef<HTMLTableElement, ComponentProps<'table'>>(
|
|
4
|
+
(props, ref) => {
|
|
5
|
+
return (
|
|
6
|
+
<div className="rp-table-scroll-container rp-scrollbar">
|
|
7
|
+
<table ref={ref} {...props} />
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
},
|
|
11
|
+
);
|
|
6
12
|
|
|
7
13
|
export const Tr = (props: ComponentProps<'tr'>) => {
|
|
8
14
|
return <tr {...props} />;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { MDXProvider } from '@mdx-js/react';
|
|
2
2
|
import { Content, usePage, useSite } from '@rspress/core/runtime';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Callout,
|
|
5
|
+
FallbackHeading,
|
|
6
|
+
getCustomMDXComponent,
|
|
7
|
+
useScrollAfterNav,
|
|
8
|
+
} from '@theme';
|
|
4
9
|
import './doc.scss';
|
|
5
|
-
import { useScrollAfterNav } from '../../logic/useScrollAfterNav';
|
|
6
|
-
import { FallbackHeading } from './FallbackHeading';
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
function FallbackTitle() {
|
|
9
12
|
const { site } = useSite();
|
|
10
13
|
const { page } = usePage();
|
|
11
14
|
const { headingTitle, title } = page;
|
|
@@ -19,9 +22,21 @@ export function FallbackTitle() {
|
|
|
19
22
|
export function DocContent({
|
|
20
23
|
components,
|
|
21
24
|
isOverviewPage = false,
|
|
25
|
+
afterDocContent,
|
|
26
|
+
beforeDocContent,
|
|
22
27
|
}: {
|
|
23
28
|
components: Record<string, React.FC<any>> | undefined;
|
|
24
29
|
isOverviewPage?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional React node rendered before the main document content.
|
|
32
|
+
* Can be used for banners, notices, or custom elements at the top of the page.
|
|
33
|
+
*/
|
|
34
|
+
beforeDocContent?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Optional React node rendered after the main document content.
|
|
37
|
+
* Can be used for footers, navigation, or other content at the bottom of the page.
|
|
38
|
+
*/
|
|
39
|
+
afterDocContent?: React.ReactNode;
|
|
25
40
|
}) {
|
|
26
41
|
useScrollAfterNav();
|
|
27
42
|
|
|
@@ -35,8 +50,10 @@ export function DocContent({
|
|
|
35
50
|
|
|
36
51
|
return (
|
|
37
52
|
<MDXProvider components={mdxComponents}>
|
|
53
|
+
{beforeDocContent}
|
|
38
54
|
{!isOverviewPage && <FallbackTitle />}
|
|
39
55
|
<Content />
|
|
56
|
+
{afterDocContent}
|
|
40
57
|
</MDXProvider>
|
|
41
58
|
);
|
|
42
59
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { useSite } from '@rspress/core/runtime';
|
|
2
1
|
import { EditLink, LastUpdated, PrevNextPage } from '@theme';
|
|
3
2
|
import './index.scss';
|
|
4
3
|
|
|
5
4
|
export function DocFooter() {
|
|
6
|
-
const { site } = useSite();
|
|
7
|
-
const { themeConfig } = site;
|
|
8
|
-
const showLastUpdated = themeConfig.lastUpdated;
|
|
9
|
-
|
|
10
5
|
return (
|
|
11
6
|
<footer className="rp-doc-footer">
|
|
12
7
|
<div className="rp-doc-footer__edit">
|
|
13
8
|
<EditLink />
|
|
14
|
-
|
|
9
|
+
<LastUpdated />
|
|
15
10
|
</div>
|
|
16
11
|
<div className="rp-doc-footer__divider" />
|
|
17
12
|
<PrevNextPage />
|
package/dist/eject-theme/components/{DocContent/FallbackHeading.tsx → FallbackHeading/index.tsx}
RENAMED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { renderInlineMarkdown } from '@theme';
|
|
1
|
+
import { getCustomMDXComponent, renderInlineMarkdown } from '@theme';
|
|
2
2
|
import { slug } from 'github-slugger';
|
|
3
|
-
import {
|
|
4
|
-
import { H1, H2, H3, H4, H5, H6 } from './docComponents/title';
|
|
3
|
+
import { useMemo } from 'react';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const getHeadingMap = () => {
|
|
6
|
+
const { h1, h2, h3, h4, h5, h6 } = getCustomMDXComponent();
|
|
7
|
+
return {
|
|
8
|
+
1: h1,
|
|
9
|
+
2: h2,
|
|
10
|
+
3: h3,
|
|
11
|
+
4: h4,
|
|
12
|
+
5: h5,
|
|
13
|
+
6: h6,
|
|
14
|
+
};
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -28,7 +30,14 @@ export function FallbackHeading({
|
|
|
28
30
|
}) {
|
|
29
31
|
const titleSlug = title && slug(title.trim());
|
|
30
32
|
|
|
31
|
-
const Element =
|
|
33
|
+
const Element = useMemo(() => {
|
|
34
|
+
const headingMap = getHeadingMap();
|
|
35
|
+
return headingMap[level] || headingMap[1];
|
|
36
|
+
}, [level]);
|
|
37
|
+
|
|
38
|
+
const A = useMemo(() => {
|
|
39
|
+
return getCustomMDXComponent().a;
|
|
40
|
+
}, []);
|
|
32
41
|
|
|
33
42
|
return (
|
|
34
43
|
titleSlug && (
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { useI18n, usePage } from '@rspress/core/runtime';
|
|
1
|
+
import { useI18n, usePage, useSite } from '@rspress/core/runtime';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
|
|
4
4
|
export function LastUpdated() {
|
|
5
5
|
const {
|
|
6
6
|
page: { lastUpdatedTime },
|
|
7
7
|
} = usePage();
|
|
8
|
+
const { site } = useSite();
|
|
9
|
+
const { themeConfig } = site;
|
|
10
|
+
const showLastUpdated = themeConfig.lastUpdated;
|
|
8
11
|
|
|
9
12
|
const t = useI18n();
|
|
10
13
|
|
|
14
|
+
if (!showLastUpdated) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
return (
|
|
12
19
|
<div className="rp-last-updated">
|
|
13
20
|
<p>
|
|
@@ -3,6 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import nprogress from 'nprogress';
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
import type { ComponentProps, TransitionStartFunction } from 'react';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
6
7
|
import './index.scss';
|
|
7
8
|
import { getHref, useLinkNavigate } from './useLinkNavigate';
|
|
8
9
|
|
|
@@ -43,7 +44,7 @@ nprogress.configure({ showSpinner: false });
|
|
|
43
44
|
* 3. If inCurrentSite, it will navigate and scroll to anchor, preload the asyncChunk onHover the link
|
|
44
45
|
* 4. Link is styled.
|
|
45
46
|
*/
|
|
46
|
-
export
|
|
47
|
+
export const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
|
|
47
48
|
const {
|
|
48
49
|
href = '/',
|
|
49
50
|
children,
|
|
@@ -51,6 +52,7 @@ export function Link(props: LinkProps) {
|
|
|
51
52
|
onClick,
|
|
52
53
|
onMouseEnter,
|
|
53
54
|
startTransition,
|
|
55
|
+
...otherProps
|
|
54
56
|
} = props;
|
|
55
57
|
|
|
56
58
|
const { linkType, removeBaseHref, withBaseHref } = getHref(href);
|
|
@@ -59,11 +61,14 @@ export function Link(props: LinkProps) {
|
|
|
59
61
|
if (linkType === 'external') {
|
|
60
62
|
return (
|
|
61
63
|
<a
|
|
62
|
-
{
|
|
64
|
+
ref={ref}
|
|
63
65
|
href={href}
|
|
64
66
|
target="_blank"
|
|
65
67
|
rel="noopener noreferrer"
|
|
66
68
|
className={clsx(className, 'rp-link')}
|
|
69
|
+
onClick={onClick}
|
|
70
|
+
onMouseEnter={onMouseEnter}
|
|
71
|
+
{...otherProps}
|
|
67
72
|
>
|
|
68
73
|
{children}
|
|
69
74
|
</a>
|
|
@@ -72,7 +77,14 @@ export function Link(props: LinkProps) {
|
|
|
72
77
|
|
|
73
78
|
if (linkType === 'hashOnly') {
|
|
74
79
|
return (
|
|
75
|
-
<a
|
|
80
|
+
<a
|
|
81
|
+
ref={ref}
|
|
82
|
+
href={href}
|
|
83
|
+
className={clsx(className, 'rp-link')}
|
|
84
|
+
onClick={onClick}
|
|
85
|
+
onMouseEnter={onMouseEnter}
|
|
86
|
+
{...otherProps}
|
|
87
|
+
>
|
|
76
88
|
{children}
|
|
77
89
|
</a>
|
|
78
90
|
);
|
|
@@ -81,7 +93,7 @@ export function Link(props: LinkProps) {
|
|
|
81
93
|
if (linkType === 'relative') {
|
|
82
94
|
return (
|
|
83
95
|
<a
|
|
84
|
-
{
|
|
96
|
+
ref={ref}
|
|
85
97
|
href={href}
|
|
86
98
|
className={clsx(className, 'rp-link')}
|
|
87
99
|
onMouseEnter={event => {
|
|
@@ -106,6 +118,7 @@ export function Link(props: LinkProps) {
|
|
|
106
118
|
e.preventDefault();
|
|
107
119
|
navigate(href);
|
|
108
120
|
}}
|
|
121
|
+
{...otherProps}
|
|
109
122
|
>
|
|
110
123
|
{children}
|
|
111
124
|
</a>
|
|
@@ -114,7 +127,7 @@ export function Link(props: LinkProps) {
|
|
|
114
127
|
|
|
115
128
|
return (
|
|
116
129
|
<a
|
|
117
|
-
{
|
|
130
|
+
ref={ref}
|
|
118
131
|
href={withBaseHref}
|
|
119
132
|
className={clsx(className, 'rp-link')}
|
|
120
133
|
onMouseEnter={event => {
|
|
@@ -139,8 +152,11 @@ export function Link(props: LinkProps) {
|
|
|
139
152
|
e.preventDefault();
|
|
140
153
|
navigate(removeBaseHref);
|
|
141
154
|
}}
|
|
155
|
+
{...otherProps}
|
|
142
156
|
>
|
|
143
157
|
{children}
|
|
144
158
|
</a>
|
|
145
159
|
);
|
|
146
|
-
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
Link.displayName = 'Link';
|
|
@@ -6,8 +6,7 @@ import type {
|
|
|
6
6
|
} from '@rspress/core';
|
|
7
7
|
import { matchNavbar, useLocation } from '@rspress/core/runtime';
|
|
8
8
|
import type { HoverGroupProps } from '@theme';
|
|
9
|
-
import { Link, SvgWrapper, Tag, useHoverGroup } from '@theme';
|
|
10
|
-
import ArrowDown from '@theme-assets/arrow-down';
|
|
9
|
+
import { IconArrowDown, Link, SvgWrapper, Tag, useHoverGroup } from '@theme';
|
|
11
10
|
import cls from 'clsx';
|
|
12
11
|
import { useMemo } from 'react';
|
|
13
12
|
import { useLangsMenu, useVersionsMenu } from './hooks';
|
|
@@ -15,7 +14,7 @@ import './NavMenu.scss';
|
|
|
15
14
|
import clsx from 'clsx';
|
|
16
15
|
|
|
17
16
|
export const SvgDown = (props: React.SVGProps<SVGSVGElement>) => {
|
|
18
|
-
return <SvgWrapper icon={
|
|
17
|
+
return <SvgWrapper icon={IconArrowDown} {...props} />;
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
export function NavMenuItemWithChildren({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { SocialLinks, SvgWrapper, useHoverGroup } from '@theme';
|
|
2
|
-
import SmallMenu from '@theme-assets/small-menu';
|
|
1
|
+
import { IconSmallMenu, SocialLinks, SvgWrapper, useHoverGroup } from '@theme';
|
|
3
2
|
import clsx from 'clsx';
|
|
4
3
|
import { createPortal } from 'react-dom';
|
|
5
4
|
import { NavVersions } from '../Nav/NavMenu';
|
|
@@ -43,7 +42,7 @@ export function NavHamburger() {
|
|
|
43
42
|
'rp-nav-hamburger--active': isScreenOpen,
|
|
44
43
|
})}
|
|
45
44
|
>
|
|
46
|
-
<SvgWrapper icon={
|
|
45
|
+
<SvgWrapper icon={IconSmallMenu} />
|
|
47
46
|
</button>
|
|
48
47
|
|
|
49
48
|
<button
|
|
@@ -55,7 +54,7 @@ export function NavHamburger() {
|
|
|
55
54
|
onMouseEnter={handleMouseEnter}
|
|
56
55
|
onMouseLeave={handleMouseLeave}
|
|
57
56
|
>
|
|
58
|
-
<SvgWrapper icon={
|
|
57
|
+
<SvgWrapper icon={IconSmallMenu} />
|
|
59
58
|
{hoverGroup}
|
|
60
59
|
</button>
|
|
61
60
|
</>
|
|
@@ -3,6 +3,7 @@ import { useLangsMenu } from '../Nav/hooks';
|
|
|
3
3
|
import './NavScreenLangs.scss';
|
|
4
4
|
import { useI18n } from '@rspress/core/runtime';
|
|
5
5
|
import { Link } from '@theme';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import { SvgDown } from './NavScreenMenuItem';
|
|
7
8
|
|
|
8
9
|
export function NavScreenLangs() {
|
|
@@ -30,15 +31,28 @@ export function NavScreenLangs() {
|
|
|
30
31
|
}}
|
|
31
32
|
>
|
|
32
33
|
<div className="rp-nav-screen-langs-group__inner">
|
|
33
|
-
{items.map(item =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
{items.map(item => {
|
|
35
|
+
const isActive = item.text === activeValue;
|
|
36
|
+
const className = clsx(
|
|
37
|
+
'rp-nav-screen-langs-group__item',
|
|
38
|
+
isActive && 'rp-nav-screen-langs-group__item--active',
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return isActive ? (
|
|
42
|
+
<span
|
|
43
|
+
key={item.text}
|
|
44
|
+
className={className}
|
|
45
|
+
aria-current="page"
|
|
46
|
+
aria-disabled={true}
|
|
47
|
+
>
|
|
48
|
+
{item.text}
|
|
49
|
+
</span>
|
|
50
|
+
) : (
|
|
51
|
+
<Link key={item.text} href={item.link} className={className}>
|
|
52
|
+
{item.text}
|
|
53
|
+
</Link>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
42
56
|
</div>
|
|
43
57
|
</div>
|
|
44
58
|
</>
|
|
@@ -5,8 +5,7 @@ import type {
|
|
|
5
5
|
NavItemWithLinkAndChildren,
|
|
6
6
|
} from '@rspress/core';
|
|
7
7
|
import { matchNavbar, useLocation } from '@rspress/core/runtime';
|
|
8
|
-
import { Link, SvgWrapper, Tag } from '@theme';
|
|
9
|
-
import ArrowDown from '@theme-assets/arrow-down';
|
|
8
|
+
import { IconArrowDown, Link, SvgWrapper, Tag } from '@theme';
|
|
10
9
|
import clsx from 'clsx';
|
|
11
10
|
import type React from 'react';
|
|
12
11
|
import { useMemo, useState } from 'react';
|
|
@@ -17,7 +16,7 @@ interface NavScreenMenuItemWithLinkProps {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export const SvgDown = (props: React.SVGProps<SVGSVGElement>) => {
|
|
20
|
-
return <SvgWrapper icon={
|
|
19
|
+
return <SvgWrapper icon={IconArrowDown} {...props} />;
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
export function NavScreenMenuItemRaw({
|
|
@@ -33,15 +33,28 @@ export function NavScreenVersions() {
|
|
|
33
33
|
isOpen && 'rp-nav-screen-versions-group--open',
|
|
34
34
|
)}
|
|
35
35
|
>
|
|
36
|
-
{items.map(item =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
{items.map(item => {
|
|
37
|
+
const isActive = item.text === activeValue;
|
|
38
|
+
const className = clsx(
|
|
39
|
+
'rp-nav-screen-versions-group__item',
|
|
40
|
+
isActive && 'rp-nav-screen-versions-group__item--active',
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return isActive ? (
|
|
44
|
+
<span
|
|
45
|
+
key={item.text}
|
|
46
|
+
className={className}
|
|
47
|
+
aria-current="page"
|
|
48
|
+
aria-disabled={true}
|
|
49
|
+
>
|
|
50
|
+
{item.text}
|
|
51
|
+
</span>
|
|
52
|
+
) : (
|
|
53
|
+
<Link key={item.text} href={item.link} className={className}>
|
|
54
|
+
{item.text}
|
|
55
|
+
</Link>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
45
58
|
</div>
|
|
46
59
|
</>
|
|
47
60
|
) : null;
|
|
@@ -10,9 +10,13 @@ import {
|
|
|
10
10
|
usePageData,
|
|
11
11
|
useSidebar,
|
|
12
12
|
} from '@rspress/core/runtime';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
FallbackHeading,
|
|
15
|
+
type Group,
|
|
16
|
+
type GroupItem,
|
|
17
|
+
OverviewGroup,
|
|
18
|
+
} from '@theme';
|
|
14
19
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
15
|
-
import { FallbackHeading } from '../DocContent/FallbackHeading';
|
|
16
20
|
import {
|
|
17
21
|
isSidebarDivider,
|
|
18
22
|
isSidebarSectionHeader,
|
|
@@ -62,18 +66,13 @@ const OverviewSearchInput = ({
|
|
|
62
66
|
export function Overview(props: {
|
|
63
67
|
content?: React.ReactNode;
|
|
64
68
|
groups?: Group[];
|
|
65
|
-
defaultGroupTitle?: string;
|
|
66
69
|
overviewHeaders?: number[];
|
|
67
70
|
}) {
|
|
68
71
|
const {
|
|
69
72
|
siteData,
|
|
70
73
|
page: { routePath, title, frontmatter },
|
|
71
74
|
} = usePageData();
|
|
72
|
-
const {
|
|
73
|
-
content,
|
|
74
|
-
groups: customGroups,
|
|
75
|
-
defaultGroupTitle: _ = 'Others',
|
|
76
|
-
} = props;
|
|
75
|
+
const { content, groups: customGroups } = props;
|
|
77
76
|
const t = useI18n();
|
|
78
77
|
|
|
79
78
|
// Added state for search query
|