@rspress/core 1.0.0-beta.3 → 1.0.0-beta.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 (33) hide show
  1. package/dist/runtime/index.d.ts +2 -2
  2. package/dist/runtime/index.js +2 -2
  3. package/dist/runtime/utils.d.ts +1 -0
  4. package/dist/runtime/utils.js +7 -1
  5. package/dist/theme/bundle.css +132 -125
  6. package/dist/theme/bundle.d.ts +5 -2
  7. package/dist/theme/bundle.js +898 -893
  8. package/dist/theme/bundle.js.map +1 -1
  9. package/package.json +6 -6
  10. package/src/runtime/index.ts +2 -1
  11. package/src/runtime/utils.ts +9 -0
  12. package/src/theme-default/components/Aside/index.css +0 -1
  13. package/src/theme-default/components/Aside/index.tsx +7 -8
  14. package/src/theme-default/components/DocFooter/index.tsx +4 -1
  15. package/src/theme-default/components/HomeHero/index.module.scss +6 -0
  16. package/src/theme-default/components/HomeHero/index.tsx +8 -2
  17. package/src/theme-default/components/LocalSideBar/index.tsx +5 -15
  18. package/src/theme-default/components/Nav/NavBarTitle.tsx +42 -0
  19. package/src/theme-default/components/Nav/index.module.scss +18 -4
  20. package/src/theme-default/components/Nav/index.tsx +14 -54
  21. package/src/theme-default/components/NavHambmger/index.tsx +1 -3
  22. package/src/theme-default/components/NavScreen/index.tsx +31 -18
  23. package/src/theme-default/components/Sidebar/SidebarGroup.tsx +1 -1
  24. package/src/theme-default/components/Sidebar/index.module.scss +20 -11
  25. package/src/theme-default/components/Sidebar/index.tsx +25 -38
  26. package/src/theme-default/layout/DocLayout/index.module.scss +7 -3
  27. package/src/theme-default/layout/DocLayout/index.tsx +6 -19
  28. package/src/theme-default/layout/HomeLayout/index.tsx +1 -1
  29. package/src/theme-default/layout/Layout/index.tsx +3 -5
  30. package/src/theme-default/logic/index.ts +1 -0
  31. package/src/theme-default/logic/sideEffects.ts +8 -7
  32. package/src/theme-default/logic/useHiddenNav.ts +55 -0
  33. package/src/theme-default/styles/code.css +0 -1
@@ -1,6 +1,6 @@
1
1
  export * from './hooks';
2
2
  export * from './Content';
3
- export { normalizeHrefInRuntime, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from './utils';
4
- export { useLocation, useNavigate } from 'react-router-dom';
3
+ export { normalizeHrefInRuntime, normalizeImagePath, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from './utils';
4
+ export { useLocation, useNavigate, matchRoutes } from 'react-router-dom';
5
5
  export { Helmet } from 'react-helmet-async';
6
6
  export { NoSSR } from './NoSSR';
@@ -1,6 +1,6 @@
1
1
  export * from "./hooks";
2
2
  export * from "./Content";
3
- export { normalizeHrefInRuntime, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from "./utils";
4
- export { useLocation, useNavigate } from "react-router-dom";
3
+ export { normalizeHrefInRuntime, normalizeImagePath, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from "./utils";
4
+ export { useLocation, useNavigate, matchRoutes } from "react-router-dom";
5
5
  export { Helmet } from "react-helmet-async";
6
6
  export { NoSSR } from "./NoSSR";
@@ -4,4 +4,5 @@ export declare function withBase(url?: string): string;
4
4
  export declare function removeBase(url: string): string;
5
5
  export declare function isEqualPath(a: string, b: string): boolean;
6
6
  export declare function normalizeHrefInRuntime(a: string): string;
7
+ export declare function normalizeImagePath(imagePath: string): string;
7
8
  export { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction };
@@ -1,5 +1,5 @@
1
1
  import siteData from "virtual-site-data";
2
- import { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref, withBase as rawWithBase, removeBase as rawRemoveBase } from "@rspress/shared";
2
+ import { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref, withBase as rawWithBase, removeBase as rawRemoveBase, isExternalUrl } from "@rspress/shared";
3
3
  export function normalizeRoutePath(routePath) {
4
4
  return decodeURIComponent(routePath).replace(/\.html$/, "").replace(/\/index$/, "/");
5
5
  }
@@ -16,4 +16,10 @@ export function normalizeHrefInRuntime(a) {
16
16
  const cleanUrls = Boolean(siteData?.route?.cleanUrls);
17
17
  return normalizeHref(a, cleanUrls);
18
18
  }
19
+ export function normalizeImagePath(imagePath) {
20
+ if (isExternalUrl(imagePath)) {
21
+ return imagePath;
22
+ }
23
+ return withBase(imagePath);
24
+ }
19
25
  export { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction };
@@ -409,18 +409,15 @@ video {
409
409
  .relative {
410
410
  position: relative;
411
411
  }
412
+ .sticky {
413
+ position: sticky;
414
+ }
412
415
  .bottom-0 {
413
416
  bottom: 0px;
414
417
  }
415
- .left-0 {
416
- left: 0px;
417
- }
418
418
  .right-0 {
419
419
  right: 0px;
420
420
  }
421
- .top-0 {
422
- top: 0px;
423
- }
424
421
  .z-10 {
425
422
  z-index: 10;
426
423
  }
@@ -696,10 +693,6 @@ video {
696
693
  .border-divider-light {
697
694
  border-color: var(--rp-c-divider-light);
698
695
  }
699
- .border-gray-200 {
700
- --tw-border-opacity: 1;
701
- border-color: rgb(229 231 235 / var(--tw-border-opacity));
702
- }
703
696
  .border-gray-300 {
704
697
  --tw-border-opacity: 1;
705
698
  border-color: rgb(209 213 219 / var(--tw-border-opacity));
@@ -759,10 +752,6 @@ video {
759
752
  padding-top: 0.5rem;
760
753
  padding-bottom: 0.5rem;
761
754
  }
762
- .py-2\.5 {
763
- padding-top: 0.625rem;
764
- padding-bottom: 0.625rem;
765
- }
766
755
  .py-8 {
767
756
  padding-top: 2rem;
768
757
  padding-bottom: 2rem;
@@ -1099,10 +1088,6 @@ button:focus-visible {
1099
1088
  .hover\:opacity-60:hover {
1100
1089
  opacity: 0.6;
1101
1090
  }
1102
- .dark .dark\:border-gray-500 {
1103
- --tw-border-opacity: 1;
1104
- border-color: rgb(107 114 128 / var(--tw-border-opacity));
1105
- }
1106
1091
  .dark .dark\:hover\:border-gray-200:hover {
1107
1092
  --tw-border-opacity: 1;
1108
1093
  border-color: rgb(229 231 235 / var(--tw-border-opacity));
@@ -1171,9 +1156,6 @@ button:focus-visible {
1171
1156
  }
1172
1157
  }
1173
1158
  @media (min-width: 768px) {
1174
- .md\:fixed {
1175
- position: fixed;
1176
- }
1177
1159
  .md\:order-1 {
1178
1160
  order: 1;
1179
1161
  }
@@ -1355,7 +1337,6 @@ button:focus-visible {
1355
1337
  background-position: 50%;
1356
1338
  background-size: 20px;
1357
1339
  background-repeat: no-repeat;
1358
- transition: all 0.16s;
1359
1340
  background-color: var(--rp-code-copy-code-hover-bg);
1360
1341
  }
1361
1342
  .rspress-doc [class*=language-]:hover .rspress-code-content button.copy,
@@ -1417,7 +1398,6 @@ button:focus-visible {
1417
1398
  white-space: nowrap;
1418
1399
  overflow: hidden;
1419
1400
  text-overflow: ellipsis;
1420
- transition: all 0.2s ease-in-out;
1421
1401
  border-radius: 10px 0 0 10px;
1422
1402
  font-size: 13px;
1423
1403
  line-height: 1.75rem;
@@ -1507,27 +1487,130 @@ button:focus-visible {
1507
1487
  transition: color 0.25s;
1508
1488
  }
1509
1489
 
1510
- /* src/theme-default/components/Sidebar/index.module.scss?css_virtual&hash=4d362cac0d7d2e27cfb35a9c734cb685 */
1490
+ /* src/theme-default/components/Nav/index.module.scss?css_virtual&hash=130985f1ec864b6a3b88c9468d7d3d66 */
1491
+ .hidden_47ac2 {
1492
+ transform: translate3d(0, -100%, 0);
1493
+ background: transparent;
1494
+ opacity: 0;
1495
+ }
1496
+ .container_47ac2 {
1497
+ margin: auto;
1498
+ }
1499
+ .navContainer_47ac2 {
1500
+ top: 0;
1501
+ left: 0;
1502
+ transition: all 0.3s ease;
1503
+ transition-property: transform, opacity;
1504
+ background: var(--rp-c-bg);
1505
+ height: var(--rp-nav-height);
1506
+ z-index: var(--rp-z-index-nav);
1507
+ }
1508
+ .leftNav_47ac2 {
1509
+ display: none;
1510
+ }
1511
+ .rightNav_47ac2 {
1512
+ display: none;
1513
+ }
1514
+ .activeItem_47ac2,
1515
+ .singleItem_47ac2:hover {
1516
+ background-color: var(--rp-c-bg-soft);
1517
+ cursor: pointer;
1518
+ color: var(--rp-c-brand-dark);
1519
+ border-radius: 12px;
1520
+ }
1521
+ .navContainer_47ac2 :deep(*) {
1522
+ pointer-events: all;
1523
+ }
1524
+ .social-links-icon_47ac2 {
1525
+ width: 20px;
1526
+ height: 100%;
1527
+ display: flex;
1528
+ fill: currentColor;
1529
+ color: var(--rp-c-text-2);
1530
+ }
1531
+ .social-links-icon_47ac2:hover {
1532
+ color: var(--rp-c-text-1);
1533
+ }
1534
+ .menu-item_47ac2 {
1535
+ display: none;
1536
+ margin: 0 8px;
1537
+ }
1538
+ @media (max-width: 768px) {
1539
+ :root {
1540
+ --rp-nav-height: 56px;
1541
+ }
1542
+ .menu-item_47ac2:before {
1543
+ display: none;
1544
+ }
1545
+ .mobileNavMenu_47ac2 {
1546
+ display: flex;
1547
+ }
1548
+ }
1549
+ @media (min-width: 768px) {
1550
+ .menu-item_47ac2 {
1551
+ display: flex;
1552
+ }
1553
+ .leftNav_47ac2 {
1554
+ display: flex;
1555
+ align-items: center;
1556
+ flex-grow: 1;
1557
+ margin: 0 0.5rem;
1558
+ }
1559
+ .rightNav_47ac2 {
1560
+ display: flex;
1561
+ align-items: center;
1562
+ }
1563
+ .mobileNavMenu_47ac2 {
1564
+ display: none;
1565
+ }
1566
+ }
1567
+ @media (min-width: 960px) {
1568
+ .mask_47ac2 {
1569
+ position: absolute;
1570
+ right: 0;
1571
+ bottom: -30px;
1572
+ width: 100vw;
1573
+ height: 30px;
1574
+ }
1575
+ .mask_47ac2.docPage_47ac2 {
1576
+ width: calc(100vw - var(--rp-sidebar-width) - 48px);
1577
+ }
1578
+ .mask_47ac2::before {
1579
+ display: block;
1580
+ width: 100%;
1581
+ height: 30px;
1582
+ background: linear-gradient(var(--rp-c-bg), transparent 60%);
1583
+ content: "";
1584
+ }
1585
+ .leftNav_47ac2 {
1586
+ margin: 0 2rem;
1587
+ }
1588
+ }
1589
+
1590
+ /* src/theme-default/components/Sidebar/index.module.scss?css_virtual&hash=8ec4e7bbdad8698bcb3d0207cb2b2f91 */
1591
+ .navTitleMask_74484 {
1592
+ padding-left: 1.5rem;
1593
+ height: var(--rp-nav-height);
1594
+ display: flex;
1595
+ align-items: center;
1596
+ }
1511
1597
  .sidebar_74484 {
1512
1598
  position: fixed;
1513
1599
  top: 0;
1514
1600
  bottom: 0;
1515
1601
  left: 0;
1516
1602
  z-index: var(--rp-z-index-sidebar);
1517
- padding: 12px 12px 96px 0;
1603
+ padding: 0 12px 96px 0;
1518
1604
  width: calc(100vw - 64px);
1519
1605
  max-width: 320px;
1520
- background-color: var(--rp-c-bg);
1521
1606
  opacity: 0;
1522
1607
  transform: translateX(-100%);
1523
1608
  transition: opacity 0.5s, transform 0.25s ease;
1609
+ background: var(--rp-c-bg);
1524
1610
  }
1525
1611
  .sidebarContent_74484 {
1526
1612
  overflow-x: hidden;
1527
1613
  }
1528
- .dark .sidebar_74484 {
1529
- box-shadow: var(--rp-shadow-1);
1530
- }
1531
1614
  .sidebar_74484.open_74484 {
1532
1615
  opacity: 1;
1533
1616
  visibility: visible;
@@ -1536,11 +1619,12 @@ button:focus-visible {
1536
1619
  }
1537
1620
  @media (min-width: 960px) {
1538
1621
  .sidebar_74484 {
1539
- z-index: 0;
1540
- margin-top: calc(var(--rp-nav-height));
1541
- padding-bottom: 128px;
1622
+ z-index: 5;
1542
1623
  opacity: 1;
1543
1624
  visibility: visible;
1625
+ position: sticky;
1626
+ margin-top: calc(var(--rp-nav-height) * -1);
1627
+ height: 100vh;
1544
1628
  width: var(--rp-sidebar-width);
1545
1629
  transform: translateX(0);
1546
1630
  box-shadow: var(--rp-c-shadow-3);
@@ -1621,6 +1705,9 @@ button:focus-visible {
1621
1705
  .dark .rspress-sidebar-group::before {
1622
1706
  background-color: var(--rp-c-bg-mute);
1623
1707
  }
1708
+ .dark .sidebar_74484 {
1709
+ box-shadow: var(--rp-shadow-1);
1710
+ }
1624
1711
 
1625
1712
  /* src/theme-default/components/LocalSideBar/index.scss */
1626
1713
  .rspress-sidebar-menu {
@@ -1794,7 +1881,7 @@ button:focus-visible {
1794
1881
  }
1795
1882
  }
1796
1883
 
1797
- /* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=25669c7207a2c741ceb395341c44f545 */
1884
+ /* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=343ce784468989830a4fa978537bcd1f */
1798
1885
  .aside-container_feeda {
1799
1886
  position: sticky;
1800
1887
  display: none;
@@ -1805,6 +1892,8 @@ button:focus-visible {
1805
1892
  overflow-y: auto;
1806
1893
  scrollbar-width: none;
1807
1894
  width: 0;
1895
+ max-height: calc(100vh - (var(--rp-nav-height) + 32px));
1896
+ overflow: "scroll";
1808
1897
  }
1809
1898
  .aside-container_feeda::-webkit-scrollbar {
1810
1899
  display: none;
@@ -1854,14 +1943,16 @@ button:focus-visible {
1854
1943
  .content_feeda {
1855
1944
  padding: 36px 24px 72px 24px;
1856
1945
  }
1946
+ .rspress-doc {
1947
+ view-transition-name: none;
1948
+ }
1857
1949
  }
1858
1950
  @media (min-width: 960px) {
1859
1951
  .docLayout_feeda {
1860
1952
  width: 100%;
1861
- margin-top: var(--rp-nav-height);
1953
+ display: flex;
1862
1954
  }
1863
1955
  .content_feeda {
1864
- margin-left: var(--rp-sidebar-width);
1865
1956
  width: calc(100% - var(--rp-sidebar-width));
1866
1957
  padding: 48px 48px 72px 0;
1867
1958
  }
@@ -1968,7 +2059,7 @@ button:focus-visible {
1968
2059
  }
1969
2060
  }
1970
2061
 
1971
- /* src/theme-default/components/HomeHero/index.module.scss?css_virtual&hash=77a7602a25e973f2aa9f385208bcf498 */
2062
+ /* src/theme-default/components/HomeHero/index.module.scss?css_virtual&hash=0d02de400b7853c45840f406a03fbd95 */
1972
2063
  .clip_1e4a0 {
1973
2064
  background: var(--rp-home-hero-name-background);
1974
2065
  -webkit-background-clip: text;
@@ -1997,6 +2088,11 @@ button:focus-visible {
1997
2088
  width: 375px;
1998
2089
  }
1999
2090
  }
2091
+ @media (max-width: 768px) {
2092
+ .mask_1e4a0 {
2093
+ display: none;
2094
+ }
2095
+ }
2000
2096
 
2001
2097
  /* src/theme-default/components/HomeFeatures/index.module.scss?css_virtual&hash=284b5aa191fe3f1ddb09180064e8904d */
2002
2098
  @media (max-width: 640px) {
@@ -2100,95 +2196,6 @@ button:focus-visible {
2100
2196
  transform: rotate(180deg);
2101
2197
  }
2102
2198
 
2103
- /* src/theme-default/components/Nav/index.module.scss?css_virtual&hash=89d0c9f901fcc34554a4be53e920346c */
2104
- .container_47ac2 {
2105
- margin: auto;
2106
- }
2107
- .leftNav_47ac2 {
2108
- display: none;
2109
- }
2110
- .rightNav_47ac2 {
2111
- display: none;
2112
- }
2113
- .activeItem_47ac2,
2114
- .singleItem_47ac2:hover {
2115
- background-color: var(--rp-c-bg-soft);
2116
- cursor: pointer;
2117
- color: var(--rp-c-brand-dark);
2118
- border-radius: 12px;
2119
- }
2120
- .navContainer_47ac2 {
2121
- height: var(--rp-nav-height);
2122
- }
2123
- .navContainer_47ac2 :deep(*) {
2124
- pointer-events: all;
2125
- }
2126
- .social-links-icon_47ac2 {
2127
- width: 20px;
2128
- height: 100%;
2129
- display: flex;
2130
- fill: currentColor;
2131
- color: var(--rp-c-text-2);
2132
- }
2133
- .social-links-icon_47ac2:hover {
2134
- color: var(--rp-c-text-1);
2135
- }
2136
- .menu-item_47ac2 {
2137
- display: none;
2138
- margin: 0 8px;
2139
- }
2140
- @media (max-width: 768px) {
2141
- :root {
2142
- --rp-nav-height: 56px;
2143
- }
2144
- .menu-item_47ac2:before {
2145
- display: none;
2146
- }
2147
- .mobileNavMenu_47ac2 {
2148
- display: flex;
2149
- }
2150
- }
2151
- @media (min-width: 768px) {
2152
- .menu-item_47ac2 {
2153
- display: flex;
2154
- }
2155
- .leftNav_47ac2 {
2156
- display: flex;
2157
- align-items: center;
2158
- flex-grow: 1;
2159
- margin: 0 0.5rem;
2160
- }
2161
- .rightNav_47ac2 {
2162
- display: flex;
2163
- align-items: center;
2164
- }
2165
- .mobileNavMenu_47ac2 {
2166
- display: none;
2167
- }
2168
- }
2169
- @media (min-width: 960px) {
2170
- .mask_47ac2 {
2171
- position: absolute;
2172
- right: 0;
2173
- bottom: -30px;
2174
- width: 100vw;
2175
- height: 30px;
2176
- }
2177
- .mask_47ac2.docPage_47ac2 {
2178
- width: calc(100vw - var(--rp-sidebar-width) - 48px);
2179
- }
2180
- .mask_47ac2::before {
2181
- display: block;
2182
- width: 100%;
2183
- height: 30px;
2184
- background: linear-gradient(var(--rp-c-bg), transparent 60%);
2185
- content: "";
2186
- }
2187
- .leftNav_47ac2 {
2188
- margin: 0 2rem;
2189
- }
2190
- }
2191
-
2192
2199
  /* src/theme-default/components/SocialLinks/index.module.scss?css_virtual&hash=d7ec4e32e63751859b13484e57133cde */
2193
2200
  .social-links-icon_8cbd0 {
2194
2201
  width: 24px;
@@ -49,9 +49,12 @@ interface SidebarData {
49
49
  }
50
50
  declare function useSidebarData(): SidebarData;
51
51
 
52
+ declare function useDisableNav(): boolean;
53
+ declare function useHiddenNav(): boolean;
54
+
52
55
  declare function useLocaleSiteData(): NormalizedLocales;
53
56
 
54
- declare function scrollToTarget(target: HTMLElement, isSmooth: boolean): void;
57
+ declare function scrollToTarget(target: HTMLElement, isSmooth: boolean, fallbackHeight?: number): void;
55
58
  declare function bindingAsideScroll(): () => void;
56
59
  declare function setup(): void;
57
60
 
@@ -170,4 +173,4 @@ declare const _default: {
170
173
  setup: typeof setup;
171
174
  };
172
175
 
173
- export { Button, HomeFooter, HomeLayout, Layout, Link, Nav, NotFoundLayout, PackageManagerTabs, Search, SearchPanel, Tab, Tabs, Toc, bindingAsideScroll, _default as default, getCustomMDXComponent, getLogoUrl, isActive, isExternalHref, isMobileDevice, scrollToTarget, setup, useEditLink, useLocaleSiteData, usePathUtils, usePrevNextPage, useSidebarData };
176
+ export { Button, HomeFooter, HomeLayout, Layout, Link, Nav, NotFoundLayout, PackageManagerTabs, Search, SearchPanel, Tab, Tabs, Toc, bindingAsideScroll, _default as default, getCustomMDXComponent, getLogoUrl, isActive, isExternalHref, isMobileDevice, scrollToTarget, setup, useDisableNav, useEditLink, useHiddenNav, useLocaleSiteData, usePathUtils, usePrevNextPage, useSidebarData };