@rspress/core 0.0.2 → 0.0.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.
Files changed (53) hide show
  1. package/dist/index.d.ts +10 -1
  2. package/dist/index.js +63 -52
  3. package/dist/index.js.map +1 -1
  4. package/dist/loader.js +3 -2
  5. package/dist/loader.js.map +1 -1
  6. package/dist/theme/bundle.css +318 -318
  7. package/dist/theme/bundle.js +35 -35
  8. package/dist/theme/bundle.js.map +1 -1
  9. package/package.json +7 -7
  10. package/src/theme-default/assets/loading.svg +1 -1
  11. package/src/theme-default/components/BackDrop/index.module.scss +1 -1
  12. package/src/theme-default/components/Button/index.module.scss +9 -9
  13. package/src/theme-default/components/DocFooter/index.module.scss +5 -5
  14. package/src/theme-default/components/EditLink/index.module.scss +1 -1
  15. package/src/theme-default/components/HomeFeatures/index.module.scss +3 -3
  16. package/src/theme-default/components/HomeFeatures/index.tsx +4 -4
  17. package/src/theme-default/components/HomeHero/index.module.scss +3 -3
  18. package/src/theme-default/components/HomeHero/index.tsx +1 -1
  19. package/src/theme-default/components/Link/index.module.scss +1 -1
  20. package/src/theme-default/components/LocalSideBar/index.module.scss +5 -5
  21. package/src/theme-default/components/Nav/NavMenuGroup.tsx +3 -3
  22. package/src/theme-default/components/Nav/index.module.scss +8 -8
  23. package/src/theme-default/components/Nav/index.tsx +4 -4
  24. package/src/theme-default/components/NavHambmger/index.module.scss +1 -1
  25. package/src/theme-default/components/NavScreen/index.module.scss +4 -4
  26. package/src/theme-default/components/NavScreenMenuGroup/index.module.scss +1 -1
  27. package/src/theme-default/components/Overview/index.module.scss +7 -7
  28. package/src/theme-default/components/Search/assets/loading.svg +1 -1
  29. package/src/theme-default/components/Search/assets/search.svg +1 -1
  30. package/src/theme-default/components/Search/index.module.scss +21 -21
  31. package/src/theme-default/components/Search/index.tsx +1 -1
  32. package/src/theme-default/components/Sidebar/index.module.scss +14 -14
  33. package/src/theme-default/components/Sidebar/index.tsx +5 -5
  34. package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +2 -2
  35. package/src/theme-default/components/SocialLinks/LinkContent.tsx +3 -3
  36. package/src/theme-default/components/SocialLinks/index.module.scss +2 -2
  37. package/src/theme-default/components/SwitchAppearance/index.tsx +1 -1
  38. package/src/theme-default/components/Tabs/index.module.scss +5 -5
  39. package/src/theme-default/layout/DocLayout/docComponents/code.tsx +1 -1
  40. package/src/theme-default/layout/DocLayout/docComponents/index.module.scss +7 -7
  41. package/src/theme-default/layout/DocLayout/docComponents/pre.tsx +2 -2
  42. package/src/theme-default/layout/DocLayout/index.module.scss +14 -16
  43. package/src/theme-default/layout/DocLayout/index.tsx +3 -3
  44. package/src/theme-default/layout/HomeLayout/index.css +10 -10
  45. package/src/theme-default/layout/HomeLayout/index.tsx +1 -1
  46. package/src/theme-default/layout/Layout/index.tsx +1 -1
  47. package/src/theme-default/logic/sideEffects.ts +1 -1
  48. package/src/theme-default/styles/base.css +8 -8
  49. package/src/theme-default/styles/doc/code.css +57 -54
  50. package/src/theme-default/styles/doc/container.css +49 -49
  51. package/src/theme-default/styles/doc/index.css +1 -1
  52. package/src/theme-default/styles/scrollbar.css +2 -2
  53. package/src/theme-default/styles/vars.css +48 -52
@@ -3,11 +3,11 @@
3
3
  top: 0;
4
4
  bottom: 0;
5
5
  left: 0;
6
- z-index: var(--modern-z-index-sidebar);
6
+ z-index: var(--rp-z-index-sidebar);
7
7
  padding: 12px 12px 96px 16px;
8
8
  width: calc(100vw - 64px);
9
9
  max-width: 320px;
10
- background-color: var(--modern-c-bg);
10
+ background-color: var(--rp-c-bg);
11
11
  opacity: 0;
12
12
  transform: translateX(-100%);
13
13
  transition: opacity 0.5s, transform 0.25s ease;
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  :global(.dark) .sidebar {
21
- box-shadow: var(--modern-shadow-1);
21
+ box-shadow: var(--rp-shadow-1);
22
22
  }
23
23
 
24
24
  .sidebar.open {
@@ -31,13 +31,13 @@
31
31
  @media (min-width: 960px) {
32
32
  .sidebar {
33
33
  z-index: 0;
34
- margin-top: calc(var(--modern-nav-height));
34
+ margin-top: calc(var(--rp-nav-height));
35
35
  padding-bottom: 128px;
36
36
  opacity: 1;
37
37
  visibility: visible;
38
- width: var(--modern-sidebar-width);
38
+ width: var(--rp-sidebar-width);
39
39
  transform: translateX(0);
40
- box-shadow: var(--modern-c-shadow-3);
40
+ box-shadow: var(--rp-c-shadow-3);
41
41
  mask-image: linear-gradient(transparent, #000 20px),
42
42
  linear-gradient(270deg, #000 10px, transparent 0);
43
43
  --webkit-mask-image: linear-gradient(270deg, #000 10px, transparent 0);
@@ -47,7 +47,7 @@
47
47
  @media (min-width: 1440px) {
48
48
  .sidebar {
49
49
  padding-left: 16px;
50
- width: var(--modern-sidebar-width);
50
+ width: var(--rp-sidebar-width);
51
51
  margin-left: calc((100vw - 1440px) / 2);
52
52
  }
53
53
  }
@@ -62,7 +62,7 @@
62
62
  }
63
63
 
64
64
  .menuItem:hover {
65
- background-color: var(--modern-c-bg-mute);
65
+ background-color: var(--rp-c-bg-mute);
66
66
  transition: all 0.2s;
67
67
  }
68
68
 
@@ -73,7 +73,7 @@
73
73
 
74
74
  :global(.dark) .menuItem:hover,
75
75
  :global(.dark) .collapseContainer:hover {
76
- background-color: var(--modern-c-bg-mute);
76
+ background-color: var(--rp-c-bg-mute);
77
77
  transition: all 0.2s;
78
78
  }
79
79
 
@@ -86,17 +86,17 @@
86
86
 
87
87
  .menuItem,
88
88
  .menuItemStatic {
89
- color: var(--modern-c-text-2);
89
+ color: var(--rp-c-text-2);
90
90
  transition: all 0.2s;
91
91
  }
92
92
 
93
93
  .menuItemActive {
94
- background-color: var(--modern-c-brand-tint);
95
- color: var(--modern-c-brand);
94
+ background-color: var(--rp-c-brand-tint);
95
+ color: var(--rp-c-brand);
96
96
  font-weight: bolder;
97
97
  }
98
98
 
99
- :global(.modern-sidebar-group) {
99
+ :global(.rspress-sidebar-group) {
100
100
  position: relative;
101
101
  &::before {
102
102
  content: '';
@@ -105,6 +105,6 @@
105
105
  left: 12px;
106
106
  width: 1px;
107
107
  height: 100%;
108
- background-color: var(--modern-c-gray-light-4);
108
+ background-color: var(--rp-c-gray-light-4);
109
109
  }
110
110
  }
@@ -17,7 +17,7 @@ interface Props {
17
17
  }
18
18
 
19
19
  const highlightTitleStyle = {
20
- color: 'var(--modern-c-text-1)',
20
+ color: 'var(--rp-c-text-1)',
21
21
  fontSize: '14px',
22
22
  };
23
23
 
@@ -228,7 +228,7 @@ export function SidebarGroupComp(props: SidebarItemProps) {
228
228
  >
229
229
  <div
230
230
  ref={innerRef}
231
- className="modern-sidebar-group transition-opacity duration-500 ease-in-out"
231
+ className="rspress-sidebar-group transition-opacity duration-500 ease-in-out"
232
232
  style={{
233
233
  opacity: initialState.current ? 0 : 1,
234
234
  }}
@@ -324,7 +324,7 @@ export function SideBar(props: Props) {
324
324
  };
325
325
  return (
326
326
  <aside
327
- className={`${styles.sidebar} modern-sidebar ${
327
+ className={`${styles.sidebar} rspress-sidebar ${
328
328
  isSidebarOpen ? styles.open : ''
329
329
  }`}
330
330
  style={{
@@ -333,9 +333,9 @@ export function SideBar(props: Props) {
333
333
  >
334
334
  <div className={`mt-1 ${styles.sidebarContent}`}>
335
335
  <div
336
- className="modern-scrollbar"
336
+ className="rspress-scrollbar"
337
337
  style={{
338
- maxHeight: 'calc(100vh - var(--modern-nav-height) - 8px)',
338
+ maxHeight: 'calc(100vh - var(--rp-nav-height) - 8px)',
339
339
  overflow: 'scroll',
340
340
  }}
341
341
  >
@@ -11,9 +11,9 @@ export const HiddenLinks = (props: IHiddenLinksProps) => {
11
11
  return (
12
12
  <div
13
13
  style={{
14
- boxShadow: 'var(--modern-shadow-3)',
14
+ boxShadow: 'var(--rp-shadow-3)',
15
15
  marginRight: '-2px',
16
- border: '1px solid var(--modern-c-divider-light)',
16
+ border: '1px solid var(--rp-c-divider-light)',
17
17
  }}
18
18
  className="absolute top-13 right-0 z-1 p-3 w-32 rounded-xl bg-white flex flex-wrap gap-4"
19
19
  >
@@ -51,8 +51,8 @@ export const LinkContent = (props: ILinkContentComp) => {
51
51
  {contentVisible ? (
52
52
  <div
53
53
  style={{
54
- boxShadow: 'var(--modern-shadow-3)',
55
- border: '1px solid var(--modern-c-divider-light)',
54
+ boxShadow: 'var(--rp-shadow-3)',
55
+ border: '1px solid var(--rp-c-divider-light)',
56
56
  ...popperStyle,
57
57
  }}
58
58
  className="z-1 p-3 w-50 absolute right-0 bg-white dark:bg-dark"
@@ -75,7 +75,7 @@ export const LinkContent = (props: ILinkContentComp) => {
75
75
  <div
76
76
  className="break-all z-1 p-3 w-50 absolute right-0 rounded-xl"
77
77
  style={{
78
- boxShadow: 'var(--modern-shadow-3)',
78
+ boxShadow: 'var(--rp-shadow-3)',
79
79
  ...popperStyle,
80
80
  }}
81
81
  >
@@ -4,10 +4,10 @@
4
4
  display: flex;
5
5
  fill: currentColor;
6
6
  margin-left: 0.5rem;
7
- color: var(--modern-c-text-2);
7
+ color: var(--rp-c-text-2);
8
8
 
9
9
  &:hover {
10
- color: var(--modern-c-text-1);
10
+ color: var(--rp-c-text-1);
11
11
  }
12
12
  }
13
13
 
@@ -21,7 +21,7 @@ export function SwitchAppearance({ onClick }: { onClick?: () => void }) {
21
21
  toggleAppearance();
22
22
  onClick?.();
23
23
  }}
24
- className="md:mr-2 modern-nav-appearance"
24
+ className="md:mr-2 rspress-nav-appearance"
25
25
  >
26
26
  <div className="p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300">
27
27
  {theme === 'light' ? (
@@ -1,5 +1,5 @@
1
1
  .tab {
2
- color: var(--modern-c-text-2);
2
+ color: var(--rp-c-text-2);
3
3
  border-bottom: 2px solid transparent;
4
4
  box-sizing: border-box;
5
5
  margin-right: 10px;
@@ -15,12 +15,12 @@
15
15
  }
16
16
 
17
17
  .not-selected:hover {
18
- color: var(--modern-c-text-1);
19
- border-color: var(--modern-c-gray-light-2);
18
+ color: var(--rp-c-text-1);
19
+ border-color: var(--rp-c-gray-light-2);
20
20
  border-radius: 2px;
21
21
  }
22
22
 
23
23
  .selected {
24
- color: var(--modern-c-brand-dark);
25
- border-color: var(--modern-c-brand-dark);
24
+ color: var(--rp-c-brand-dark);
25
+ border-color: var(--rp-c-brand-dark);
26
26
  }
@@ -119,7 +119,7 @@ export function Code(props: CodeProps) {
119
119
  className: isHighlighted ? 'line highlighted' : '',
120
120
  style: {
121
121
  backgroundColor: isHighlighted
122
- ? 'var(--modern-code-line-highlight-color)'
122
+ ? 'var(--rp-code-line-highlight-color)'
123
123
  : '',
124
124
  display: 'block',
125
125
  padding: '0 1.25rem',
@@ -26,7 +26,7 @@
26
26
  :global(p) {
27
27
  margin: 0;
28
28
  font-size: 16px;
29
- color: var(--modern-c-text-2);
29
+ color: var(--rp-c-text-2);
30
30
  }
31
31
  }
32
32
 
@@ -35,21 +35,21 @@
35
35
  :global(summary a) {
36
36
  &:not(:global(.header-anchor)) {
37
37
  font-weight: 500;
38
- border-bottom: 1px dashed var(--modern-c-brand);
38
+ border-bottom: 1px dashed var(--rp-c-brand);
39
39
  transition: color 0.25s;
40
40
  }
41
41
 
42
42
  &:global(.header-anchor) {
43
- color: var(--modern-c-brand);
43
+ color: var(--rp-c-brand);
44
44
  }
45
45
 
46
46
  &:hover {
47
- color: var(--modern-c-brand-dark);
47
+ color: var(--rp-c-brand-dark);
48
48
  border-style: solid;
49
49
  }
50
50
  }
51
51
 
52
- :global(.modern-doc details) {
52
+ :global(.rspress-doc details) {
53
53
  margin: 16px 0;
54
54
  padding: 8px;
55
55
  font-size: normal;
@@ -60,6 +60,6 @@
60
60
  }
61
61
  }
62
62
 
63
- :global(.modern-doc details:hover) {
64
- background-color: var(--modern-c-bg-mute);
63
+ :global(.rspress-doc details:hover) {
64
+ background-color: var(--rp-c-bg-mute);
65
65
  }
@@ -30,8 +30,8 @@ export function Pre({
30
30
  const codeTitle = parseTitleFromMeta(meta);
31
31
  return (
32
32
  <div className={className || DEFAULT_LANGUAGE_CLASS}>
33
- {codeTitle && <div className="modern-code-title">{codeTitle}</div>}
34
- <div className="modern-code-content">{children}</div>
33
+ {codeTitle && <div className="rspress-code-title">{codeTitle}</div>}
34
+ <div className="rspress-code-content">{children}</div>
35
35
  </div>
36
36
  );
37
37
  }
@@ -2,8 +2,8 @@
2
2
  position: sticky;
3
3
  display: none;
4
4
  top: 0;
5
- margin-top: calc(var(--modern-nav-height) * -1 - 32px);
6
- padding-top: calc(var(--modern-nav-height) + 32px);
5
+ margin-top: calc(var(--rp-nav-height) * -1 - 32px);
6
+ padding-top: calc(var(--rp-nav-height) + 32px);
7
7
  overflow-x: hidden;
8
8
  overflow-y: auto;
9
9
  scrollbar-width: none;
@@ -26,21 +26,21 @@
26
26
  @media (min-width: 960px) {
27
27
  .docLayout {
28
28
  width: 100%;
29
- margin-top: var(--modern-nav-height);
29
+ margin-top: var(--rp-nav-height);
30
30
  }
31
31
 
32
32
  .content {
33
- margin-left: var(--modern-sidebar-width);
34
- width: calc(100% - var(--modern-sidebar-width));
33
+ margin-left: var(--rp-sidebar-width);
34
+ width: calc(100% - var(--rp-sidebar-width));
35
35
  padding: 48px 48px 72px 48px;
36
36
 
37
- :global(.modern-doc) {
37
+ :global(.rspress-doc) {
38
38
  width: 100%;
39
39
  }
40
40
  }
41
41
 
42
42
  .aside-container {
43
- width: var(--modern-aside-width);
43
+ width: var(--rp-aside-width);
44
44
  }
45
45
  }
46
46
 
@@ -52,18 +52,16 @@
52
52
 
53
53
  .aside-container {
54
54
  display: block;
55
- width: var(--modern-aside-width);
55
+ width: var(--rp-aside-width);
56
56
  }
57
57
 
58
58
  .content {
59
- margin-left: var(--modern-sidebar-width);
60
- width: calc(100% - var(--modern-sidebar-width));
59
+ margin-left: var(--rp-sidebar-width);
60
+ width: calc(100% - var(--rp-sidebar-width));
61
61
  padding: 48px 0 72px 0;
62
62
 
63
- :global(.modern-doc) {
64
- width: calc(
65
- 1280px - var(--modern-sidebar-width) - var(--modern-aside-width)
66
- );
63
+ :global(.rspress-doc) {
64
+ width: calc(1280px - var(--rp-sidebar-width) - var(--rp-aside-width));
67
65
  }
68
66
  }
69
67
  }
@@ -77,10 +75,10 @@
77
75
  .content {
78
76
  padding: 48px 0 72px 64px;
79
77
 
80
- :global(.modern-doc) {
78
+ :global(.rspress-doc) {
81
79
  padding-right: 64px;
82
80
  width: calc(
83
- 1440px - var(--modern-sidebar-width) - var(--modern-aside-width) - 64px
81
+ 1440px - var(--rp-sidebar-width) - var(--rp-aside-width) - 64px
84
82
  );
85
83
  }
86
84
  }
@@ -77,13 +77,13 @@ export function DocLayout(props: DocLayoutProps) {
77
77
  />
78
78
  ) : null}
79
79
  <div
80
- className={`${styles.content} modern-doc-container flex flex-shrink-0`}
80
+ className={`${styles.content} rspress-doc-container flex flex-shrink-0`}
81
81
  >
82
82
  <div className="w-full">
83
83
  {isOverviewPage ? (
84
84
  <Overview />
85
85
  ) : (
86
- <div className="modern-doc">
86
+ <div className="rspress-doc">
87
87
  <TabDataContext.Provider value={{ tabData, setTabData }}>
88
88
  <MDXProvider components={getCustomMDXComponent()}>
89
89
  <Content />
@@ -101,7 +101,7 @@ export function DocLayout(props: DocLayoutProps) {
101
101
  <div
102
102
  className={styles.asideContainer}
103
103
  style={{
104
- maxHeight: 'calc(100vh - (var(--modern-nav-height) + 32px))',
104
+ maxHeight: 'calc(100vh - (var(--rp-nav-height) + 32px))',
105
105
  overflow: 'scroll',
106
106
  ...(hideNavbar
107
107
  ? {
@@ -1,18 +1,18 @@
1
1
  :root {
2
- --modern-home-hero-name-color: transparent;
3
- --modern-home-hero-name-background: -webkit-linear-gradient(
2
+ --rp-home-hero-name-color: transparent;
3
+ --rp-home-hero-name-background: -webkit-linear-gradient(
4
4
  120deg,
5
- var(--modern-c-brand) 30%,
5
+ var(--rp-c-brand) 30%,
6
6
  #42d392
7
7
  );
8
- --modern-home-hero-image-background-image: none;
9
- --modern-home-hero-image-filter: none;
10
- --modern-home-feature-bg: #f9f9f9;
11
- --modern-home-feature-hover-bg: linear-gradient(to bottom, #ededed, #f9f9f9);
8
+ --rp-home-hero-image-background-image: none;
9
+ --rp-home-hero-image-filter: none;
10
+ --rp-home-feature-bg: #f9f9f9;
11
+ --rp-home-feature-hover-bg: linear-gradient(to bottom, #ededed, #f9f9f9);
12
12
  }
13
13
 
14
14
  .dark {
15
- --modern-home-bg: #000;
16
- --modern-home-feature-bg: #242424;
17
- --modern-home-feature-hover-bg: #2f2f2f;
15
+ --rp-home-bg: #000;
16
+ --rp-home-feature-bg: #242424;
17
+ --rp-home-feature-hover-bg: #2f2f2f;
18
18
  }
@@ -20,7 +20,7 @@ export function HomeLayout(props: HomeLayoutProps) {
20
20
  <div
21
21
  className="relative"
22
22
  style={{
23
- minHeight: 'calc(100vh - var(--modern-nav-height))',
23
+ minHeight: 'calc(100vh - var(--rp-nav-height))',
24
24
  paddingBottom: '80px',
25
25
  }}
26
26
  >
@@ -96,7 +96,7 @@ export const Layout: React.FC<LayoutProps> = props => {
96
96
  const { pathname } = window.location;
97
97
  const cleanPathname = removeBase(pathname);
98
98
  // Check if the user is visiting the site for the first time
99
- const FIRST_VISIT_KEY = 'modern-doc-visited';
99
+ const FIRST_VISIT_KEY = 'rspress-visited';
100
100
  const visited = localStorage.getItem(FIRST_VISIT_KEY);
101
101
  if (visited) {
102
102
  return;
@@ -85,7 +85,7 @@ export function bindingAsideScroll() {
85
85
  const marker = document.getElementById('aside-marker');
86
86
  const aside = document.getElementById('aside-container');
87
87
  const links = Array.from(
88
- document.querySelectorAll<HTMLAnchorElement>('.modern-doc .header-anchor'),
88
+ document.querySelectorAll<HTMLAnchorElement>('.rspress-doc .header-anchor'),
89
89
  ).filter(item => item.parentElement?.tagName !== 'H1');
90
90
 
91
91
  if (!aside || !links.length) {
@@ -22,11 +22,11 @@ body {
22
22
  margin: 0;
23
23
  width: 100%;
24
24
  min-width: 320px;
25
- font-family: var(--modern-font-family-base);
25
+ font-family: var(--rp-font-family-base);
26
26
  font-size: 16px;
27
27
  font-weight: 400;
28
- color: var(--modern-c-text-1);
29
- background-color: var(--modern-c-bg);
28
+ color: var(--rp-c-text-1);
29
+ background-color: var(--rp-c-bg);
30
30
  direction: ltr;
31
31
  font-synthesis: none;
32
32
  text-rendering: optimizeLegibility;
@@ -52,7 +52,7 @@ button:focus-visible {
52
52
  }
53
53
 
54
54
  #nprogress .bar {
55
- background: var(--modern-c-brand);
55
+ background: var(--rp-c-brand);
56
56
  position: fixed;
57
57
  top: 0;
58
58
  left: 0;
@@ -95,8 +95,8 @@ button:focus-visible {
95
95
  * Custom font family
96
96
  */
97
97
  :root {
98
- --modern-font-family-base: 'Inter var experimental', 'Inter var',
99
- -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
100
- Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
101
- --modern-font-family-mono: Menlo, Monaco, Consolas, 'Courier New', monospace;
98
+ --rp-font-family-base: 'Inter var experimental', 'Inter var', -apple-system,
99
+ BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
100
+ 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
101
+ --rp-font-family-mono: Menlo, Monaco, Consolas, 'Courier New', monospace;
102
102
  }