@rspress/core 0.0.1 → 0.0.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.
Files changed (54) 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 +4 -3
  5. package/dist/loader.js.map +1 -1
  6. package/dist/theme/bundle.css +318 -318
  7. package/dist/theme/bundle.js +37 -37
  8. package/dist/theme/bundle.js.map +1 -1
  9. package/package.json +5 -5
  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/link.tsx +2 -2
  42. package/src/theme-default/layout/DocLayout/docComponents/pre.tsx +2 -2
  43. package/src/theme-default/layout/DocLayout/index.module.scss +14 -16
  44. package/src/theme-default/layout/DocLayout/index.tsx +3 -3
  45. package/src/theme-default/layout/HomeLayout/index.css +10 -10
  46. package/src/theme-default/layout/HomeLayout/index.tsx +1 -1
  47. package/src/theme-default/layout/Layout/index.tsx +1 -1
  48. package/src/theme-default/logic/sideEffects.ts +1 -1
  49. package/src/theme-default/styles/base.css +8 -8
  50. package/src/theme-default/styles/doc/code.css +57 -54
  51. package/src/theme-default/styles/doc/container.css +49 -49
  52. package/src/theme-default/styles/doc/index.css +1 -1
  53. package/src/theme-default/styles/scrollbar.css +2 -2
  54. package/src/theme-default/styles/vars.css +48 -52
@@ -331,7 +331,7 @@ function bindingAsideScroll() {
331
331
  }
332
332
  const marker = document.getElementById("aside-marker");
333
333
  const aside = document.getElementById("aside-container");
334
- const links = Array.from(document.querySelectorAll(".modern-doc .header-anchor")).filter((item) => {
334
+ const links = Array.from(document.querySelectorAll(".rspress-doc .header-anchor")).filter((item) => {
335
335
  var _item_parentElement;
336
336
  return ((_item_parentElement = item.parentElement) === null || _item_parentElement === void 0 ? void 0 : _item_parentElement.tagName) !== "H1";
337
337
  });
@@ -937,7 +937,7 @@ function _object_spread_props4(target, source) {
937
937
  return target;
938
938
  }
939
939
  var highlightTitleStyle = {
940
- color: "var(--modern-c-text-1)",
940
+ color: "var(--rp-c-text-1)",
941
941
  fontSize: "14px"
942
942
  };
943
943
  function SidebarItemComp(props) {
@@ -1110,7 +1110,7 @@ function SidebarGroupComp(props) {
1110
1110
  },
1111
1111
  children: /* @__PURE__ */ _jsx9("div", {
1112
1112
  ref: innerRef,
1113
- className: "modern-sidebar-group transition-opacity duration-500 ease-in-out",
1113
+ className: "rspress-sidebar-group transition-opacity duration-500 ease-in-out",
1114
1114
  style: {
1115
1115
  opacity: initialState.current ? 0 : 1
1116
1116
  },
@@ -1186,16 +1186,16 @@ function SideBar(props) {
1186
1186
  };
1187
1187
  var _item_collapsed;
1188
1188
  return /* @__PURE__ */ _jsx9("aside", {
1189
- className: `${index_module_default4.sidebar} modern-sidebar ${isSidebarOpen ? index_module_default4.open : ""}`,
1189
+ className: `${index_module_default4.sidebar} rspress-sidebar ${isSidebarOpen ? index_module_default4.open : ""}`,
1190
1190
  style: _object_spread5({}, hideNavbar ? {
1191
1191
  marginTop: 0
1192
1192
  } : {}),
1193
1193
  children: /* @__PURE__ */ _jsx9("div", {
1194
1194
  className: `mt-1 ${index_module_default4.sidebarContent}`,
1195
1195
  children: /* @__PURE__ */ _jsx9("div", {
1196
- className: "modern-scrollbar",
1196
+ className: "rspress-scrollbar",
1197
1197
  style: {
1198
- maxHeight: "calc(100vh - var(--modern-nav-height) - 8px)",
1198
+ maxHeight: "calc(100vh - var(--rp-nav-height) - 8px)",
1199
1199
  overflow: "scroll"
1200
1200
  },
1201
1201
  children: /* @__PURE__ */ _jsx9("nav", {
@@ -1578,12 +1578,12 @@ function DocLayout(props) {
1578
1578
  sidebarData
1579
1579
  }) : null,
1580
1580
  /* @__PURE__ */ _jsxs8("div", {
1581
- className: `${index_module_default7.content} modern-doc-container flex flex-shrink-0`,
1581
+ className: `${index_module_default7.content} rspress-doc-container flex flex-shrink-0`,
1582
1582
  children: [
1583
1583
  /* @__PURE__ */ _jsx13("div", {
1584
1584
  className: "w-full",
1585
1585
  children: isOverviewPage ? /* @__PURE__ */ _jsx13(Overview, {}) : /* @__PURE__ */ _jsxs8("div", {
1586
- className: "modern-doc",
1586
+ className: "rspress-doc",
1587
1587
  children: [
1588
1588
  /* @__PURE__ */ _jsx13(TabDataContext.Provider, {
1589
1589
  value: {
@@ -1607,7 +1607,7 @@ function DocLayout(props) {
1607
1607
  hasAside ? /* @__PURE__ */ _jsx13("div", {
1608
1608
  className: index_module_default7.asideContainer,
1609
1609
  style: _object_spread8({
1610
- maxHeight: "calc(100vh - (var(--modern-nav-height) + 32px))",
1610
+ maxHeight: "calc(100vh - (var(--rp-nav-height) + 32px))",
1611
1611
  overflow: "scroll"
1612
1612
  }, hideNavbar ? {
1613
1613
  marginTop: 0,
@@ -1716,7 +1716,7 @@ var Layout = (props) => {
1716
1716
  }
1717
1717
  const { pathname } = window.location;
1718
1718
  const cleanPathname = removeBase2(pathname);
1719
- const FIRST_VISIT_KEY = "modern-doc-visited";
1719
+ const FIRST_VISIT_KEY = "rspress-visited";
1720
1720
  const visited = localStorage.getItem(FIRST_VISIT_KEY);
1721
1721
  if (visited) {
1722
1722
  return;
@@ -1865,7 +1865,7 @@ function HomeHero({ frontmatter }) {
1865
1865
  ]
1866
1866
  }),
1867
1867
  hasImage ? /* @__PURE__ */ _jsx15("div", {
1868
- className: "modern-doc-home-hero-image sm:max-w-60 sm:max-h-60 md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",
1868
+ className: "rspress-home-hero-image sm:max-w-60 sm:max-h-60 md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",
1869
1869
  children: /* @__PURE__ */ _jsx15("img", {
1870
1870
  src: (_hero_image = hero.image) === null || _hero_image === void 0 ? void 0 : _hero_image.src,
1871
1871
  alt: (_hero_image1 = hero.image) === null || _hero_image1 === void 0 ? void 0 : _hero_image1.alt
@@ -1910,7 +1910,7 @@ function HomeFeature({ frontmatter }) {
1910
1910
  children: (_features1 = features) === null || _features1 === void 0 ? void 0 : _features1.map((feature) => {
1911
1911
  const { icon, title, details, link } = feature;
1912
1912
  return /* @__PURE__ */ _jsx16("div", {
1913
- className: `${gridClass ? index_module_default10[gridClass] : "w-full"} rounded hover:var(--modern-c-brand)`,
1913
+ className: `${gridClass ? index_module_default10[gridClass] : "w-full"} rounded hover:var(--rp-c-brand)`,
1914
1914
  children: /* @__PURE__ */ _jsx16("div", {
1915
1915
  className: "h-full p-2",
1916
1916
  children: /* @__PURE__ */ _jsxs11("article", {
@@ -1927,16 +1927,16 @@ function HomeFeature({ frontmatter }) {
1927
1927
  /* @__PURE__ */ _jsx16("div", {
1928
1928
  className: "flex-center",
1929
1929
  children: /* @__PURE__ */ _jsx16("div", {
1930
- className: "modern-doc-home-feature-icon w-12 h-12 text-3xl text-center",
1930
+ className: "rspress-home-feature-icon w-12 h-12 text-3xl text-center",
1931
1931
  children: icon
1932
1932
  })
1933
1933
  }),
1934
1934
  /* @__PURE__ */ _jsx16("h2", {
1935
- className: "modern-doc-home-feature-title font-bold text-center",
1935
+ className: "rspress-home-feature-title font-bold text-center",
1936
1936
  children: title
1937
1937
  }),
1938
1938
  /* @__PURE__ */ _jsx16("p", {
1939
- className: "modern-doc-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",
1939
+ className: "rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",
1940
1940
  children: details
1941
1941
  })
1942
1942
  ]
@@ -1955,7 +1955,7 @@ function HomeLayout(props) {
1955
1955
  return /* @__PURE__ */ _jsxs12("div", {
1956
1956
  className: "relative",
1957
1957
  style: {
1958
- minHeight: "calc(100vh - var(--modern-nav-height))",
1958
+ minHeight: "calc(100vh - var(--rp-nav-height))",
1959
1959
  paddingBottom: "80px"
1960
1960
  },
1961
1961
  children: [
@@ -2376,7 +2376,7 @@ function SwitchAppearance({ onClick }) {
2376
2376
  toggleAppearance();
2377
2377
  (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick();
2378
2378
  },
2379
- className: "md:mr-2 modern-nav-appearance",
2379
+ className: "md:mr-2 rspress-nav-appearance",
2380
2380
  children: /* @__PURE__ */ _jsx23("div", {
2381
2381
  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",
2382
2382
  children: theme === "light" ? /* @__PURE__ */ _jsx23(sun_default, {
@@ -2826,8 +2826,8 @@ var LinkContent = (props) => {
2826
2826
  IconComp,
2827
2827
  contentVisible ? /* @__PURE__ */ _jsx27("div", {
2828
2828
  style: _object_spread15({
2829
- boxShadow: "var(--modern-shadow-3)",
2830
- border: "1px solid var(--modern-c-divider-light)"
2829
+ boxShadow: "var(--rp-shadow-3)",
2830
+ border: "1px solid var(--rp-c-divider-light)"
2831
2831
  }, popperStyle),
2832
2832
  className: "z-1 p-3 w-50 absolute right-0 bg-white dark:bg-dark",
2833
2833
  children: /* @__PURE__ */ _jsx27("div", {
@@ -2848,7 +2848,7 @@ var LinkContent = (props) => {
2848
2848
  contentVisible ? /* @__PURE__ */ _jsx27("div", {
2849
2849
  className: "break-all z-1 p-3 w-50 absolute right-0 rounded-xl",
2850
2850
  style: _object_spread15({
2851
- boxShadow: "var(--modern-shadow-3)"
2851
+ boxShadow: "var(--rp-shadow-3)"
2852
2852
  }, popperStyle),
2853
2853
  children: /* @__PURE__ */ _jsx27("img", {
2854
2854
  src: content,
@@ -2890,9 +2890,9 @@ var HiddenLinks = (props) => {
2890
2890
  const { links } = props;
2891
2891
  return /* @__PURE__ */ _jsx29("div", {
2892
2892
  style: {
2893
- boxShadow: "var(--modern-shadow-3)",
2893
+ boxShadow: "var(--rp-shadow-3)",
2894
2894
  marginRight: "-2px",
2895
- border: "1px solid var(--modern-c-divider-light)"
2895
+ border: "1px solid var(--rp-c-divider-light)"
2896
2896
  },
2897
2897
  className: "absolute top-13 right-0 z-1 p-3 w-32 rounded-xl bg-white flex flex-wrap gap-4",
2898
2898
  children: links.map((item) => /* @__PURE__ */ _jsx29(LinkContent, {
@@ -3347,11 +3347,11 @@ function NavMenuGroup(item) {
3347
3347
  children: /* @__PURE__ */ _jsx34("div", {
3348
3348
  className: "p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",
3349
3349
  style: {
3350
- boxShadow: "var(--modern-shadow-3)",
3350
+ boxShadow: "var(--rp-shadow-3)",
3351
3351
  zIndex: 100,
3352
- border: "1px solid var(--modern-c-divider-light)",
3352
+ border: "1px solid var(--rp-c-divider-light)",
3353
3353
  borderRadius: "2rem",
3354
- background: "var(--modern-c-bg)"
3354
+ background: "var(--rp-c-bg)"
3355
3355
  },
3356
3356
  children: groupItems.map((item2) => {
3357
3357
  return /* @__PURE__ */ _jsx34("div", {
@@ -3429,7 +3429,7 @@ var NavBarTitle = ({ title, langRoutePrefix, logo }) => {
3429
3429
  src: logo,
3430
3430
  alt: "logo",
3431
3431
  id: "logo",
3432
- className: "w-24 mr-4 modern-doc-logo"
3432
+ className: "w-24 mr-4 rspress-logo"
3433
3433
  }) : /* @__PURE__ */ _jsx35("span", {
3434
3434
  children: title
3435
3435
  })
@@ -3549,13 +3549,13 @@ function Nav2(props) {
3549
3549
  return /* @__PURE__ */ _jsxs23("header", {
3550
3550
  className: `top-0 left-0 md:fixed w-full`,
3551
3551
  style: {
3552
- zIndex: "var(--modern-z-index-nav)",
3553
- background: "var(--modern-c-bg)"
3552
+ zIndex: "var(--rp-z-index-nav)",
3553
+ background: "var(--rp-c-bg)"
3554
3554
  },
3555
3555
  children: [
3556
3556
  beforeNav,
3557
3557
  /* @__PURE__ */ _jsx35("div", {
3558
- className: `${index_module_default12.navContainer} modern-doc-nav px-6`,
3558
+ className: `${index_module_default12.navContainer} rspress-nav px-6`,
3559
3559
  children: /* @__PURE__ */ _jsxs23("div", {
3560
3560
  className: `${index_module_default12.container} flex justify-between items-center h-full`,
3561
3561
  children: [
@@ -3842,7 +3842,7 @@ var SvgSearch = (props) => /* @__PURE__ */ _jsx37("svg", _object_spread_props16(
3842
3842
  viewBox: "0 0 32 32"
3843
3843
  }, props), {
3844
3844
  children: /* @__PURE__ */ _jsx37("path", {
3845
- fill: "var(--modern-c-gray)",
3845
+ fill: "var(--rp-c-gray)",
3846
3846
  d: "m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z"
3847
3847
  })
3848
3848
  }));
@@ -3910,7 +3910,7 @@ var SvgLoading = (props) => /* @__PURE__ */ _jsx38("svg", _object_spread_props17
3910
3910
  }, props), {
3911
3911
  children: /* @__PURE__ */ _jsxs25("g", {
3912
3912
  fill: "none",
3913
- stroke: "var(--modern-c-brand)",
3913
+ stroke: "var(--rp-c-brand)",
3914
3914
  strokeLinecap: "round",
3915
3915
  strokeWidth: 2,
3916
3916
  children: [
@@ -5671,7 +5671,7 @@ function Search2() {
5671
5671
  ]
5672
5672
  }),
5673
5673
  query2 ? /* @__PURE__ */ _jsx47("div", {
5674
- className: `${index_module_default17.searchHits} modern-scrollbar`,
5674
+ className: `${index_module_default17.searchHits} rspress-scrollbar`,
5675
5675
  children: renderSearchResult(searchResult, search)
5676
5676
  }) : null,
5677
5677
  initing && /* @__PURE__ */ _jsx47("div", {
@@ -6003,7 +6003,7 @@ var Hr = (props) => {
6003
6003
 
6004
6004
  // src/theme-default/layout/DocLayout/docComponents/link.tsx
6005
6005
  import { jsx as _jsx53 } from "react/jsx-runtime";
6006
- import { isExternalUrl, normalizeSlash as normalizeSlash2 } from "@rspress/shared";
6006
+ import { isExternalUrl, normalizeHref as normalizeHref8, normalizeSlash as normalizeSlash2 } from "@rspress/shared";
6007
6007
  import { withBase as withBase8, useLang, usePageData as usePageData13, removeBase as removeBase3 } from "@/runtime";
6008
6008
  function _define_property34(obj, key, value) {
6009
6009
  if (key in obj) {
@@ -6071,7 +6071,7 @@ var A = (props) => {
6071
6071
  if (lang === defaultLang && startWithLang) {
6072
6072
  href = removeBase3(href).replace(`/${lang}`, "");
6073
6073
  }
6074
- href = withBase8(href || "");
6074
+ href = normalizeHref8(withBase8(href || ""));
6075
6075
  }
6076
6076
  return /* @__PURE__ */ _jsx53("a", _object_spread_props30(_object_spread34({}, props), {
6077
6077
  className: `${index_module_default18.link} ${props.className}`,
@@ -6362,7 +6362,7 @@ function Code(props) {
6362
6362
  return {
6363
6363
  className: isHighlighted ? "line highlighted" : "",
6364
6364
  style: {
6365
- backgroundColor: isHighlighted ? "var(--modern-code-line-highlight-color)" : "",
6365
+ backgroundColor: isHighlighted ? "var(--rp-code-line-highlight-color)" : "",
6366
6366
  display: "block",
6367
6367
  padding: "0 1.25rem"
6368
6368
  }
@@ -6409,11 +6409,11 @@ function Pre({ children }) {
6409
6409
  className: className || DEFAULT_LANGUAGE_CLASS,
6410
6410
  children: [
6411
6411
  codeTitle && /* @__PURE__ */ _jsx56("div", {
6412
- className: "modern-code-title",
6412
+ className: "rspress-code-title",
6413
6413
  children: codeTitle
6414
6414
  }),
6415
6415
  /* @__PURE__ */ _jsx56("div", {
6416
- className: "modern-code-content",
6416
+ className: "rspress-code-content",
6417
6417
  children
6418
6418
  })
6419
6419
  ]