@rspress/core 1.2.1 → 1.3.0

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.
Files changed (158) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +53 -40
  3. package/dist/index.js.map +1 -1
  4. package/dist/loader.d.ts +1 -1
  5. package/dist/loader.js.map +1 -1
  6. package/dist/runtime/App.js +8 -4
  7. package/dist/runtime/clientEntry.js +7 -4
  8. package/dist/runtime/ssrEntry.js +2 -2
  9. package/package.json +19 -15
  10. package/runtime.ts +1 -1
  11. package/src/runtime/App.tsx +8 -4
  12. package/src/runtime/clientEntry.tsx +7 -4
  13. package/src/runtime/ssrEntry.tsx +2 -2
  14. package/theme.ts +2 -2
  15. package/dist/runtime/Content.d.ts +0 -6
  16. package/dist/runtime/Content.js +0 -33
  17. package/dist/runtime/NoSSR.d.ts +0 -4
  18. package/dist/runtime/NoSSR.js +0 -17
  19. package/dist/runtime/hooks.d.ts +0 -39
  20. package/dist/runtime/hooks.js +0 -54
  21. package/dist/runtime/index.d.ts +0 -6
  22. package/dist/runtime/index.js +0 -34
  23. package/dist/runtime/utils.d.ts +0 -8
  24. package/dist/runtime/utils.js +0 -45
  25. package/dist/theme/bundle.css +0 -2691
  26. package/dist/theme/bundle.d.ts +0 -176
  27. package/dist/theme/bundle.js +0 -4433
  28. package/dist/theme/bundle.js.map +0 -1
  29. package/dist/theme/index.js +0 -6
  30. package/src/runtime/Content.tsx +0 -43
  31. package/src/runtime/NoSSR.tsx +0 -16
  32. package/src/runtime/hooks.ts +0 -110
  33. package/src/runtime/index.ts +0 -17
  34. package/src/runtime/utils.ts +0 -46
  35. package/src/theme-default/assets/arrow-down.svg +0 -1
  36. package/src/theme-default/assets/arrow-right.svg +0 -1
  37. package/src/theme-default/assets/copy.svg +0 -1
  38. package/src/theme-default/assets/down.svg +0 -1
  39. package/src/theme-default/assets/github.svg +0 -1
  40. package/src/theme-default/assets/loading.svg +0 -1
  41. package/src/theme-default/assets/menu.svg +0 -1
  42. package/src/theme-default/assets/moon.svg +0 -3
  43. package/src/theme-default/assets/right.svg +0 -1
  44. package/src/theme-default/assets/small-menu.svg +0 -1
  45. package/src/theme-default/assets/success.svg +0 -1
  46. package/src/theme-default/assets/sun.svg +0 -11
  47. package/src/theme-default/assets/translator.svg +0 -1
  48. package/src/theme-default/components/Aside/index.css +0 -22
  49. package/src/theme-default/components/Aside/index.tsx +0 -75
  50. package/src/theme-default/components/BackDrop/index.module.scss +0 -14
  51. package/src/theme-default/components/BackDrop/index.tsx +0 -13
  52. package/src/theme-default/components/Button/index.module.scss +0 -68
  53. package/src/theme-default/components/Button/index.tsx +0 -40
  54. package/src/theme-default/components/DocFooter/index.module.scss +0 -60
  55. package/src/theme-default/components/DocFooter/index.tsx +0 -66
  56. package/src/theme-default/components/EditLink/index.module.scss +0 -11
  57. package/src/theme-default/components/EditLink/index.tsx +0 -18
  58. package/src/theme-default/components/HomeFeatures/index.module.scss +0 -50
  59. package/src/theme-default/components/HomeFeatures/index.tsx +0 -65
  60. package/src/theme-default/components/HomeFooter/index.tsx +0 -15
  61. package/src/theme-default/components/HomeHero/index.module.scss +0 -42
  62. package/src/theme-default/components/HomeHero/index.tsx +0 -75
  63. package/src/theme-default/components/Link/index.module.scss +0 -9
  64. package/src/theme-default/components/Link/index.tsx +0 -90
  65. package/src/theme-default/components/LocalSideBar/index.scss +0 -40
  66. package/src/theme-default/components/LocalSideBar/index.tsx +0 -39
  67. package/src/theme-default/components/Nav/NavBarTitle.tsx +0 -43
  68. package/src/theme-default/components/Nav/NavMenuGroup.tsx +0 -156
  69. package/src/theme-default/components/Nav/NavMenuSingleItem.tsx +0 -40
  70. package/src/theme-default/components/Nav/NavTranslations.tsx +0 -16
  71. package/src/theme-default/components/Nav/NavVersions.tsx +0 -16
  72. package/src/theme-default/components/Nav/index.module.scss +0 -115
  73. package/src/theme-default/components/Nav/index.tsx +0 -150
  74. package/src/theme-default/components/Nav/menuDataHooks.tsx +0 -75
  75. package/src/theme-default/components/NavHambmger/index.module.scss +0 -81
  76. package/src/theme-default/components/NavHambmger/index.tsx +0 -39
  77. package/src/theme-default/components/NavScreen/NavScreenMenuGroup.tsx +0 -95
  78. package/src/theme-default/components/NavScreen/index.module.scss +0 -88
  79. package/src/theme-default/components/NavScreen/index.tsx +0 -123
  80. package/src/theme-default/components/Overview/index.module.scss +0 -154
  81. package/src/theme-default/components/Overview/index.tsx +0 -136
  82. package/src/theme-default/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  83. package/src/theme-default/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  84. package/src/theme-default/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  85. package/src/theme-default/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  86. package/src/theme-default/components/PackageManagerTabs/index.scss +0 -5
  87. package/src/theme-default/components/PackageManagerTabs/index.tsx +0 -110
  88. package/src/theme-default/components/Search/NoSearchResult.tsx +0 -13
  89. package/src/theme-default/components/Search/SearchPanel.tsx +0 -340
  90. package/src/theme-default/components/Search/SuggestItem.tsx +0 -135
  91. package/src/theme-default/components/Search/assets/close.svg +0 -1
  92. package/src/theme-default/components/Search/assets/file.svg +0 -1
  93. package/src/theme-default/components/Search/assets/header.svg +0 -1
  94. package/src/theme-default/components/Search/assets/jump.svg +0 -1
  95. package/src/theme-default/components/Search/assets/loading.svg +0 -1
  96. package/src/theme-default/components/Search/assets/search.svg +0 -1
  97. package/src/theme-default/components/Search/assets/title.svg +0 -1
  98. package/src/theme-default/components/Search/empty.svg +0 -4
  99. package/src/theme-default/components/Search/index.module.scss +0 -236
  100. package/src/theme-default/components/Search/index.tsx +0 -39
  101. package/src/theme-default/components/Search/logic/Provider.ts +0 -35
  102. package/src/theme-default/components/Search/logic/providers/LocalProvider.ts +0 -102
  103. package/src/theme-default/components/Search/logic/providers/RemoteProvider.ts +0 -40
  104. package/src/theme-default/components/Search/logic/search.ts +0 -341
  105. package/src/theme-default/components/Search/logic/util.test.ts +0 -21
  106. package/src/theme-default/components/Search/logic/util.ts +0 -127
  107. package/src/theme-default/components/Sidebar/SidebarGroup.tsx +0 -180
  108. package/src/theme-default/components/Sidebar/SidebarItem.tsx +0 -61
  109. package/src/theme-default/components/Sidebar/index.module.scss +0 -142
  110. package/src/theme-default/components/Sidebar/index.tsx +0 -156
  111. package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +0 -30
  112. package/src/theme-default/components/SocialLinks/LinkContent.tsx +0 -90
  113. package/src/theme-default/components/SocialLinks/ShownLinks.tsx +0 -32
  114. package/src/theme-default/components/SocialLinks/index.module.scss +0 -18
  115. package/src/theme-default/components/SocialLinks/index.tsx +0 -36
  116. package/src/theme-default/components/SocialLinks/presetIcons.tsx +0 -165
  117. package/src/theme-default/components/SwitchAppearance/index.module.scss +0 -15
  118. package/src/theme-default/components/SwitchAppearance/index.tsx +0 -35
  119. package/src/theme-default/components/Tabs/index.module.scss +0 -46
  120. package/src/theme-default/components/Tabs/index.tsx +0 -123
  121. package/src/theme-default/components/Tag/index.tsx +0 -18
  122. package/src/theme-default/components/Toc/index.css +0 -18
  123. package/src/theme-default/components/Toc/index.tsx +0 -42
  124. package/src/theme-default/index.ts +0 -26
  125. package/src/theme-default/layout/DocLayout/docComponents/code.tsx +0 -112
  126. package/src/theme-default/layout/DocLayout/docComponents/hr.tsx +0 -10
  127. package/src/theme-default/layout/DocLayout/docComponents/index.module.scss +0 -69
  128. package/src/theme-default/layout/DocLayout/docComponents/index.tsx +0 -33
  129. package/src/theme-default/layout/DocLayout/docComponents/link.tsx +0 -22
  130. package/src/theme-default/layout/DocLayout/docComponents/list.tsx +0 -13
  131. package/src/theme-default/layout/DocLayout/docComponents/paragraph.tsx +0 -19
  132. package/src/theme-default/layout/DocLayout/docComponents/pre.tsx +0 -37
  133. package/src/theme-default/layout/DocLayout/docComponents/prisim-theme.ts +0 -73
  134. package/src/theme-default/layout/DocLayout/docComponents/table.tsx +0 -37
  135. package/src/theme-default/layout/DocLayout/docComponents/title.tsx +0 -40
  136. package/src/theme-default/layout/DocLayout/index.module.scss +0 -138
  137. package/src/theme-default/layout/DocLayout/index.tsx +0 -125
  138. package/src/theme-default/layout/HomeLayout/index.css +0 -18
  139. package/src/theme-default/layout/HomeLayout/index.tsx +0 -39
  140. package/src/theme-default/layout/Layout/index.tsx +0 -176
  141. package/src/theme-default/layout/NotFountLayout/index.tsx +0 -40
  142. package/src/theme-default/logic/TabDataContext.ts +0 -14
  143. package/src/theme-default/logic/index.ts +0 -8
  144. package/src/theme-default/logic/sideEffects.ts +0 -174
  145. package/src/theme-default/logic/useAppearance.ts +0 -57
  146. package/src/theme-default/logic/useEditLink.ts +0 -33
  147. package/src/theme-default/logic/useHiddenNav.ts +0 -58
  148. package/src/theme-default/logic/useLocaleSiteData.ts +0 -26
  149. package/src/theme-default/logic/useNav.ts +0 -36
  150. package/src/theme-default/logic/usePathUtils.ts +0 -73
  151. package/src/theme-default/logic/usePrevNextPage.ts +0 -40
  152. package/src/theme-default/logic/useSidebarData.ts +0 -73
  153. package/src/theme-default/logic/utils.ts +0 -38
  154. package/src/theme-default/styles/base.css +0 -102
  155. package/src/theme-default/styles/code.css +0 -177
  156. package/src/theme-default/styles/index.ts +0 -7
  157. package/src/theme-default/styles/scrollbar.css +0 -28
  158. package/src/theme-default/styles/vars.css +0 -81
@@ -1,6 +0,0 @@
1
- // Since the js bundle won't import css code after module tools build, we need to generate a entry file to import the css code.
2
- import './bundle.css';
3
- // @ts-expect-error
4
- export * from './bundle';
5
- // @ts-expect-error
6
- export { default } from './bundle';
@@ -1,43 +0,0 @@
1
- import { ReactNode, Suspense, memo, ReactElement } from 'react';
2
- import { matchRoutes, useLocation } from 'react-router-dom';
3
- import siteData from 'virtual-site-data';
4
- import { normalizeRoutePath } from './utils';
5
- import { useViewTransition } from './hooks';
6
-
7
- const { routes } = process.env.__SSR__
8
- ? (require('virtual-routes-ssr') as typeof import('virtual-routes-ssr'))
9
- : (require('virtual-routes') as typeof import('virtual-routes'));
10
-
11
- function TransitionContentImpl(props: { el: ReactElement }) {
12
- let element = props.el;
13
- if (siteData?.themeConfig?.enableContentAnimation) {
14
- // eslint-disable-next-line react-hooks/rules-of-hooks
15
- element = useViewTransition(props.el);
16
- }
17
- return element;
18
- }
19
-
20
- const TransitionContent = memo(
21
- TransitionContentImpl,
22
- (prevProps, nextProps) => prevProps.el === nextProps.el,
23
- );
24
-
25
- export const Content = ({ fallback = <></> }: { fallback?: ReactNode }) => {
26
- const { pathname } = useLocation();
27
- const matched = matchRoutes(routes, normalizeRoutePath(pathname));
28
- if (!matched) {
29
- return <div></div>;
30
- }
31
- const routesElement = matched[0].route.element;
32
-
33
- // React 17 Suspense SSR is not supported
34
- if (!process.env.__IS_REACT_18__ && process.env.__SSR__) {
35
- return routesElement;
36
- }
37
-
38
- return (
39
- <Suspense fallback={fallback}>
40
- <TransitionContent el={routesElement} />
41
- </Suspense>
42
- );
43
- };
@@ -1,16 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- export function NoSSR(props: { children: React.ReactNode }) {
4
- const { children } = props;
5
- const [isMounted, setIsMounted] = useState(false);
6
-
7
- useEffect(() => {
8
- setIsMounted(true);
9
- }, []);
10
-
11
- if (!isMounted) {
12
- return null;
13
- } else {
14
- return <>{children}</>;
15
- }
16
- }
@@ -1,110 +0,0 @@
1
- import { createContext, useContext, useLayoutEffect, useState } from 'react';
2
- import { PageData } from '@rspress/shared';
3
- import i18nTextData from 'virtual-i18n-text';
4
- import { flushSync } from 'react-dom';
5
-
6
- // Type shim for window.__EDEN_PAGE_DATA__
7
- declare global {
8
- interface Window {
9
- __MODERN_PAGE_DATA__: any;
10
- }
11
- }
12
- interface IDataContext {
13
- data: PageData;
14
- setData?: (data: PageData) => void;
15
- }
16
-
17
- interface IThemeContext {
18
- theme: 'light' | 'dark';
19
- setTheme?: (theme: 'light' | 'dark') => void;
20
- }
21
-
22
- export const DataContext = createContext({} as IDataContext);
23
-
24
- export const ThemeContext = createContext({} as IThemeContext);
25
-
26
- export function usePageData() {
27
- const ctx = useContext(DataContext);
28
- return ctx.data;
29
- }
30
-
31
- export function useLang(): string {
32
- const ctx = useContext(DataContext);
33
- return ctx.data.page.lang || '';
34
- }
35
-
36
- export function useVersion(): string {
37
- const ctx = useContext(DataContext);
38
- return ctx.data.page.version || '';
39
- }
40
-
41
- export function useDark() {
42
- const ctx = useContext(ThemeContext);
43
- return ctx.theme === 'dark';
44
- }
45
-
46
- export function useI18n<T = Record<string, Record<string, string>>>() {
47
- const lang = useLang();
48
-
49
- return (key: keyof T) => i18nTextData[key][lang];
50
- }
51
-
52
- declare global {
53
- interface Document {
54
- startViewTransition: (callback: () => void) => void;
55
- }
56
- }
57
-
58
- /**
59
- * There is a pitfall.
60
- * I was working on the navigation between pages with hash. eg. from `guide/start` -> `config/repress#nav`
61
- * I need a time to dispatch an event so that the sideEffect.ts would know that
62
- * the dom is attached to the browser. Otherwise the scroll position and the
63
- * animation would be incorrect. You can search for `RspressReloadContent` in this codebase
64
- * to findout the logic that are consuming the event.
65
- * The reason I didn't write it here is that I hope the logic of handling scroll and position
66
- * could be in one place so that people wouldn't be confused.
67
- */
68
- export function useViewTransition(dom) {
69
- /**
70
- * use a pesudo element to hold the actual JSX element so we can schedule the
71
- * update later in sync
72
- */
73
- const [element, setElement] = useState(dom);
74
-
75
- useLayoutEffect(() => {
76
- if (document.startViewTransition && element !== dom) {
77
- /**
78
- * the browser will take a screenshot here
79
- */
80
- document.startViewTransition(() => {
81
- /**
82
- * react will batch all the updates in callback and flush it sync
83
- */
84
- flushSync(() => {
85
- setElement(dom);
86
- });
87
- /**
88
- * react flushed the dom to browser
89
- * and the browser will start the animation
90
- */
91
- /**
92
- * dispatchEvent for several logic
93
- */
94
- window.dispatchEvent(new Event('RspressReloadContent'));
95
- });
96
- } else {
97
- flushSync(() => {
98
- setElement(dom);
99
- });
100
- /**
101
- * dispatchEvent for several logic
102
- */
103
- window.dispatchEvent(new Event('RspressReloadContent'));
104
- }
105
- }, [dom]);
106
- /**
107
- * take this element to the actual VDOM tree
108
- */
109
- return element;
110
- }
@@ -1,17 +0,0 @@
1
- export * from './hooks';
2
- export * from './Content';
3
- export {
4
- normalizeHrefInRuntime,
5
- normalizeImagePath,
6
- withBase,
7
- removeBase,
8
- addLeadingSlash,
9
- removeTrailingSlash,
10
- normalizeSlash,
11
- isProduction,
12
- normalizeRoutePath,
13
- isEqualPath,
14
- } from './utils';
15
- export { useLocation, useNavigate, matchRoutes } from 'react-router-dom';
16
- export { Helmet } from 'react-helmet-async';
17
- export { NoSSR } from './NoSSR';
@@ -1,46 +0,0 @@
1
- import siteData from 'virtual-site-data';
2
- import {
3
- addLeadingSlash,
4
- removeTrailingSlash,
5
- normalizeSlash,
6
- isProduction,
7
- normalizeHref,
8
- withBase as rawWithBase,
9
- removeBase as rawRemoveBase,
10
- isExternalUrl,
11
- } from '@rspress/shared';
12
-
13
- export function normalizeRoutePath(routePath: string) {
14
- return decodeURIComponent(routePath)
15
- .replace(/\.html$/, '')
16
- .replace(/\/index$/, '/');
17
- }
18
-
19
- export function withBase(url = '/'): string {
20
- return rawWithBase(url, siteData.base);
21
- }
22
-
23
- export function removeBase(url: string): string {
24
- return rawRemoveBase(url, siteData.base);
25
- }
26
-
27
- export function isEqualPath(a: string, b: string) {
28
- return (
29
- withBase(normalizeHrefInRuntime(a)) === withBase(normalizeHrefInRuntime(b))
30
- );
31
- }
32
-
33
- export function normalizeHrefInRuntime(a: string) {
34
- const cleanUrls = Boolean(siteData?.route?.cleanUrls);
35
- return normalizeHref(a, cleanUrls);
36
- }
37
-
38
- export function normalizeImagePath(imagePath: string) {
39
- if (isExternalUrl(imagePath)) {
40
- return imagePath;
41
- }
42
-
43
- return withBase(imagePath);
44
- }
45
-
46
- export { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction };
@@ -1 +0,0 @@
1
- <svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"/></svg>
@@ -1 +0,0 @@
1
- <svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z"/></svg>
@@ -1 +0,0 @@
1
- <svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"/><path fill="currentColor" d="M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"/></svg>
@@ -1 +0,0 @@
1
- <svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"></path></svg>
@@ -1 +0,0 @@
1
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
@@ -1 +0,0 @@
1
- <svg width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="var(--rp-c-brand)" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>
@@ -1 +0,0 @@
1
- <svg width="1em" height="1em" viewBox="0 0 32 32"><path fill="currentColor" d="M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"/></svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
2
- <path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z" />
3
- </svg>
@@ -1 +0,0 @@
1
- <svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6H10z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="8" cy="16" r="2" fill="currentColor"/><circle cx="16" cy="16" r="2" fill="currentColor"/><circle cx="24" cy="16" r="2" fill="currentColor"/></svg>
@@ -1 +0,0 @@
1
- <svg width="32" height="32" viewBox="0 0 32 32"><path fill="#49cd37" d="m13 24l-9-9l1.414-1.414L13 21.171L26.586 7.586L28 9L13 24z"/></svg>
@@ -1,11 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
2
- <path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z" />
3
- <path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z" />
4
- <path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z" />
5
- <path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z" />
6
- <path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z" />
7
- <path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z" />
8
- <path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z" />
9
- <path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z" />
10
- <path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z" />
11
- </svg>
@@ -1 +0,0 @@
1
- <svg width="18" height="18" viewBox="0 0 32 32"><path fill="currentColor" d="M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6l2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z"/></svg>
@@ -1,22 +0,0 @@
1
- .aside-link {
2
- padding-bottom: 1px;
3
- }
4
- .aside-link-text {
5
- padding: 0px 12px;
6
- white-space: nowrap;
7
- overflow: hidden;
8
- text-overflow: ellipsis;
9
- border-radius: 10px 0 0 10px;
10
- font-size: 13px;
11
- line-height: 1.75rem;
12
- }
13
-
14
- .aside-link-text:hover {
15
- background-color: var(--rp-c-bg-mute);
16
- }
17
-
18
- .aside-active,
19
- .aside-active:hover {
20
- color: var(--rp-c-brand-dark) !important;
21
- background-color: var(--rp-c-brand-tint);
22
- }
@@ -1,75 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { Header } from '@rspress/shared';
3
- import { bindingAsideScroll, scrollToTarget, useHiddenNav } from '../../logic';
4
- import { DEFAULT_NAV_HEIGHT } from '@/theme-default/logic/sideEffects';
5
- import './index.css';
6
-
7
- export function Aside(props: { headers: Header[]; outlineTitle: string }) {
8
- const { headers } = props;
9
- const hasOutline = headers.length > 0;
10
- // For outline text highlight
11
- const baseHeaderLevel = headers[0]?.depth || 2;
12
- const hiddenNav = useHiddenNav();
13
-
14
- useEffect(() => {
15
- let unbinding: (() => void) | undefined;
16
-
17
- setTimeout(() => {
18
- unbinding = bindingAsideScroll();
19
- }, 100);
20
- const hash = decodeURIComponent(window.location.hash);
21
- if (!hash) {
22
- window.scrollTo(0, 0);
23
- } else {
24
- const target = document.getElementById(hash.slice(1));
25
- if (target) {
26
- scrollToTarget(target, false, hiddenNav ? 0 : DEFAULT_NAV_HEIGHT);
27
- }
28
- }
29
- return () => {
30
- if (unbinding) {
31
- unbinding();
32
- }
33
- };
34
- }, [headers]);
35
-
36
- const renderHeader = (header: Header) => {
37
- return (
38
- <li key={header.id}>
39
- <a
40
- href={`#${header.id}`}
41
- className="aside-link transition-all duration-300 hover:text-text-1 text-text-2 block"
42
- style={{
43
- paddingLeft: (header.depth - baseHeaderLevel) * 12,
44
- fontWeight: 'semibold',
45
- }}
46
- onClick={e => {
47
- e.preventDefault();
48
- window.location.hash = header.id;
49
- const target = document.getElementById(header.id);
50
- if (target) {
51
- scrollToTarget(target, false, hiddenNav ? 0 : DEFAULT_NAV_HEIGHT);
52
- }
53
- }}
54
- >
55
- <span className="aside-link-text block">{header.text}</span>
56
- </a>
57
- </li>
58
- );
59
- };
60
-
61
- return (
62
- <div className="flex flex-col">
63
- <div className={hasOutline ? `<lg:hidden` : 'hidden'}>
64
- <div id="aside-container" className="relative text-sm font-medium">
65
- <div className="leading-7 block text-sm font-semibold pl-3">
66
- {props.outlineTitle}
67
- </div>
68
- <nav className="mt-1">
69
- <ul className="relative">{headers.map(renderHeader)}</ul>
70
- </nav>
71
- </div>
72
- </div>
73
- </div>
74
- );
75
- }
@@ -1,14 +0,0 @@
1
- .backDrop {
2
- position: fixed;
3
- top: 0;
4
- right: 0;
5
- bottom: 0;
6
- left: 0;
7
- z-index: var(--rp-z-index-backdrop);
8
- background: rgba(0, 0, 0, 0.6);
9
- }
10
- @media (min-width: 960px) {
11
- .backDrop {
12
- display: none;
13
- }
14
- }
@@ -1,13 +0,0 @@
1
- import styles from './index.module.scss';
2
-
3
- interface Props {
4
- closeSidebar: () => void;
5
- isOpen: boolean;
6
- }
7
-
8
- export function BackDrop(props: Props) {
9
- const { closeSidebar, isOpen } = props;
10
- return isOpen ? (
11
- <div onClick={closeSidebar} className={styles.backDrop} />
12
- ) : null;
13
- }
@@ -1,68 +0,0 @@
1
- .button {
2
- display: inline-block;
3
- border: 1px solid transparent;
4
- text-align: center;
5
- font-weight: 500;
6
- white-space: nowrap;
7
- transition: color 0.25s, border-color 0.25s, background-color 0.25s;
8
- }
9
-
10
- .button:active {
11
- transition: color 0.1s, border-color 0.1s, background-color 0.1s;
12
- }
13
-
14
- .button.medium {
15
- border-radius: 20px;
16
- padding: 0 20px;
17
- line-height: 38px;
18
- font-size: 14px;
19
- }
20
-
21
- .button.big {
22
- border-radius: 24px;
23
- padding: 0 24px;
24
- line-height: 46px;
25
- font-size: 16px;
26
- }
27
-
28
- .button.brand,
29
- .button.brand:hover,
30
- .button.brand:active {
31
- opacity: 1;
32
- border-color: var(--rp-c-brand-light);
33
- color: rgba(255, 255, 255, 0.87);
34
- background-color: var(--rp-c-brand);
35
- }
36
-
37
- .button.brand:hover {
38
- background-color: var(--rp-c-brand-light);
39
- }
40
-
41
- .button.alt,
42
- .button.alt:hover,
43
- .button.alt:active {
44
- border-color: var(--rp-c-gray-light-3);
45
- color: var(--rp-c-text-1);
46
- background-color: var(--rp-c-gray-light-5);
47
- }
48
-
49
- :global(.dark) .button.alt {
50
- background-color: var(--rp-c-bg-mute);
51
- border-color: #484848;
52
- color: var(--rp-c-text-1);
53
- }
54
-
55
- .button.alt:hover {
56
- background-color: var(--rp-c-gray-light-4);
57
- }
58
-
59
- :global(.dark) .button.alt:hover {
60
- background-color: #484848;
61
- }
62
-
63
- @media (max-width: 768px) {
64
- .button.big {
65
- font-size: 14px;
66
- line-height: 40px;
67
- }
68
- }
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import { Link } from '../Link';
3
- import styles from './index.module.scss';
4
-
5
- interface ButtonProps {
6
- type?: string;
7
- size?: 'medium' | 'big';
8
- theme?: 'brand' | 'alt';
9
- text: string;
10
- href?: string;
11
- external?: boolean;
12
- className?: string;
13
- }
14
-
15
- export function Button(props: ButtonProps) {
16
- const {
17
- theme = 'brand',
18
- size = 'big',
19
- href = '/',
20
- external = false,
21
- className = '',
22
- } = props;
23
- let type: string | typeof Link | null = null;
24
-
25
- if (props.type === 'button') {
26
- type = 'button';
27
- } else if (props.type === 'a') {
28
- // Will be tree shaking in production in modern mode.
29
- type = external ? 'a' : Link;
30
- }
31
-
32
- return React.createElement(
33
- type ?? 'a',
34
- {
35
- className: `${styles.button} ${styles[theme]} ${styles[size]} ${className}`,
36
- href,
37
- },
38
- props.text,
39
- );
40
- }
@@ -1,60 +0,0 @@
1
- @media (min-width: 640px) {
2
- .pager {
3
- display: flex;
4
- flex-direction: column;
5
- width: 50%;
6
- }
7
-
8
- .pager.has-next {
9
- padding-top: 0;
10
- padding-left: 16px;
11
- }
12
- }
13
-
14
- .prev {
15
- width: 100%;
16
- }
17
-
18
- .next {
19
- width: 100%;
20
- }
21
-
22
- .pager-link {
23
- display: block;
24
- border: 1px solid var(--rp-c-divider-light) !important;
25
- border-radius: 24px;
26
- padding: 16px 20px;
27
- width: 100%;
28
- height: 100%;
29
- transition: border-color 0.25s;
30
- }
31
-
32
- .pager-link:hover {
33
- border-color: var(--rp-c-brand) !important;
34
- }
35
-
36
- .pager-link:hover .title {
37
- color: var(--rp-c-brand-dark);
38
- }
39
-
40
- .pager-link.next {
41
- margin-left: auto;
42
- text-align: right;
43
- }
44
-
45
- .desc {
46
- display: block;
47
- line-height: 20px;
48
- font-size: 12px;
49
- font-weight: 500;
50
- color: var(--rp-c-text-2);
51
- }
52
-
53
- .title {
54
- display: block;
55
- line-height: 24px;
56
- font-size: 14px;
57
- font-weight: 500;
58
- color: var(--rp-c-brand);
59
- transition: color 0.25s;
60
- }
@@ -1,66 +0,0 @@
1
- import { useLocaleSiteData, usePrevNextPage } from '../../logic';
2
- import EditLink from '../EditLink';
3
- import { Link } from '../Link';
4
- import styles from './index.module.scss';
5
- import {
6
- normalizeHrefInRuntime as normalizeHref,
7
- usePageData,
8
- } from '@/runtime';
9
-
10
- export function DocFooter() {
11
- const { prevPage, nextPage } = usePrevNextPage();
12
- const {
13
- prevPageText = 'Previous Page',
14
- nextPageText = 'Next page',
15
- lastUpdatedText: localesLastUpdatedText = 'Last Updated',
16
- lastUpdated: localesLastUpdated = false,
17
- } = useLocaleSiteData();
18
- const {
19
- page: { lastUpdatedTime },
20
- siteData,
21
- } = usePageData();
22
- const { themeConfig } = siteData;
23
- const lastUpdatedText =
24
- themeConfig?.lastUpdatedText || localesLastUpdatedText;
25
- const showLastUpdated = themeConfig.lastUpdated || localesLastUpdated;
26
-
27
- return (
28
- <footer className="mt-8">
29
- <div className="xs:flex pb-5 px-2 justify-end items-center">
30
- {showLastUpdated && (
31
- <div className="flex text-sm text-text-2 leading-6 sm:leading-8 font-medium">
32
- <p>{lastUpdatedText}: </p>
33
- <span>{lastUpdatedTime}</span>
34
- </div>
35
- )}
36
- </div>
37
- <div className="flex flex-col">
38
- <EditLink />
39
- </div>
40
- <div className="flex flex-col sm:flex-row sm:justify-around gap-4 pt-6">
41
- <div className={`${styles.prev} flex flex-col`}>
42
- {prevPage ? (
43
- <Link
44
- href={normalizeHref(prevPage.link)}
45
- className={styles.pagerLink}
46
- >
47
- <span className={styles.desc}>{prevPageText}</span>
48
- <span className={styles.title}>{prevPage.text}</span>
49
- </Link>
50
- ) : null}
51
- </div>
52
- <div className={`${styles.next} flex flex-col`}>
53
- {nextPage ? (
54
- <Link
55
- href={normalizeHref(nextPage.link)}
56
- className={`${styles.pagerLink} ${styles.next}`}
57
- >
58
- <span className={styles.desc}>{nextPageText}</span>
59
- <span className={styles.title}>{nextPage.text}</span>
60
- </Link>
61
- ) : null}
62
- </div>
63
- </div>
64
- </footer>
65
- );
66
- }