@rspress/core 0.0.13 → 0.1.1

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.
@@ -0,0 +1,8 @@
1
+ import { PageData } from '@rspress/shared';
2
+ import 'virtual-global-styles';
3
+ export declare function initPageData(routePath: string): Promise<PageData>;
4
+ export declare function App({
5
+ helmetContext
6
+ }: {
7
+ helmetContext?: object;
8
+ }): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const Content: ({
3
+ fallback
4
+ }: {
5
+ fallback?: ReactNode;
6
+ }) => any;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare function NoSSR(props: {
3
+ children: React.ReactNode;
4
+ }): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function renderInBrowser(): Promise<void>;
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ import { PageData } from '@rspress/shared';
3
+ declare global {
4
+ interface Window {
5
+ __MODERN_PAGE_DATA__: any;
6
+ }
7
+ }
8
+ interface IDataContext {
9
+ data: PageData;
10
+ setData?: (data: PageData) => void;
11
+ }
12
+ interface IThemeContext {
13
+ theme: 'light' | 'dark';
14
+ setTheme?: (theme: 'light' | 'dark') => void;
15
+ }
16
+ export declare const DataContext: import("react").Context<IDataContext>;
17
+ export declare const ThemeContext: import("react").Context<IThemeContext>;
18
+ export declare function usePageData(): PageData;
19
+ export declare function useLang(): string;
20
+ export declare function useDark(): boolean;
21
+ export declare function useI18n<T = Record<string, Record<string, string>>>(): (key: keyof T) => any;
22
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './hooks';
2
+ export * from './Content';
3
+ export { normalizeHref, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from './utils';
4
+ export { useLocation, useNavigate } from 'react-router-dom';
5
+ export { Helmet } from 'react-helmet-async';
6
+ export { NoSSR } from './NoSSR';
@@ -0,0 +1,6 @@
1
+ import { PageData } from '@rspress/shared';
2
+ export declare function render(pagePath: string, helmetContext: object): Promise<{
3
+ appHtml: string;
4
+ pageData: PageData;
5
+ }>;
6
+ export { routes } from 'virtual-routes-ssr';
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "baseUrl": ".",
5
+ "skipLibCheck": true,
6
+ "jsx": "react-jsx"
7
+ },
8
+ "include": ["./**/*"]
9
+ }
@@ -0,0 +1,6 @@
1
+ import { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref } from '@rspress/shared';
2
+ export declare function normalizeRoutePath(routePath: string): string;
3
+ export declare function withBase(url?: string): string;
4
+ export declare function removeBase(url: string): string;
5
+ export declare function isEqualPath(a: string, b: string): boolean;
6
+ export { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref };
@@ -1623,8 +1623,8 @@ button:focus-visible {
1623
1623
  background-color: var(--rp-c-bg-mute);
1624
1624
  }
1625
1625
 
1626
- /* src/theme-default/components/LocalSideBar/index.module.scss?css_virtual&hash=8ee65aa6fc817c893cd6d70fa6feed70 */
1627
- .localNav_dce60 {
1626
+ /* src/theme-default/components/LocalSideBar/index.scss */
1627
+ .rspress-sidebar-menu {
1628
1628
  position: sticky;
1629
1629
  top: 0;
1630
1630
  left: 0;
@@ -1638,22 +1638,22 @@ button:focus-visible {
1638
1638
  background-color: var(--rp-c-bg);
1639
1639
  padding-left: 10px;
1640
1640
  }
1641
- .localNav_dce60 .menu_dce60 {
1641
+ .rspress-sidebar-menu > button {
1642
1642
  padding: 12px;
1643
1643
  transition: color 0.5s;
1644
1644
  }
1645
- .localNav_dce60 .menu_dce60:hover {
1645
+ .rspress-sidebar-menu > button:hover {
1646
1646
  color: var(--rp-c-text-3);
1647
1647
  }
1648
1648
  @media (min-width: 960px) {
1649
- .localNav_dce60 {
1649
+ .rspress-sidebar-menu {
1650
1650
  display: none;
1651
1651
  }
1652
- .backDrop_dce60 {
1652
+ .rspress-sidebar-back-drop {
1653
1653
  display: none;
1654
1654
  }
1655
1655
  }
1656
- .backDrop_dce60 {
1656
+ .rspress-sidebar-back-drop {
1657
1657
  position: fixed;
1658
1658
  top: 0;
1659
1659
  right: 0;
@@ -1795,7 +1795,7 @@ button:focus-visible {
1795
1795
  }
1796
1796
  }
1797
1797
 
1798
- /* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=fc1722758dddfc71c5344b874e8f6553 */
1798
+ /* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=250b13c9ea37442f400d97809303b004 */
1799
1799
  .aside-container_feeda {
1800
1800
  position: sticky;
1801
1801
  display: none;
@@ -1828,7 +1828,8 @@ button:focus-visible {
1828
1828
  width: calc(100% - var(--rp-sidebar-width));
1829
1829
  padding: 48px 48px 72px 0;
1830
1830
  }
1831
- .content_feeda .rspress-doc {
1831
+ .content_feeda .rspress-doc,
1832
+ .content_feeda .rspress-doc-footer {
1832
1833
  width: 100%;
1833
1834
  }
1834
1835
  .aside-container_feeda {
@@ -1843,7 +1844,8 @@ button:focus-visible {
1843
1844
  .content_feeda {
1844
1845
  padding: 48px 0 72px 0;
1845
1846
  }
1846
- .content_feeda .rspress-doc {
1847
+ .content_feeda .rspress-doc,
1848
+ .content_feeda .rspress-doc-footer {
1847
1849
  padding: 0 48px;
1848
1850
  box-sizing: content-box;
1849
1851
  width: calc(100vw - var(--rp-aside-width) - var(--rp-sidebar-width));
@@ -1854,7 +1856,8 @@ button:focus-visible {
1854
1856
  width: 100%;
1855
1857
  margin-left: 0;
1856
1858
  }
1857
- .content_feeda .rspress-doc {
1859
+ .content_feeda .rspress-doc,
1860
+ .content_feeda .rspress-doc-footer {
1858
1861
  box-sizing: content-box;
1859
1862
  width: calc(100vw - var(--rp-sidebar-width) - var(--rp-aside-width));
1860
1863
  padding: 0 max(48px, (100vw - var(--rp-sidebar-width) - var(--rp-aside-width) - 960px) / 2);
@@ -2297,48 +2300,6 @@ button:focus-visible {
2297
2300
  transform: translateX(4px);
2298
2301
  }
2299
2302
 
2300
- /* src/theme-default/components/Tabs/index.module.scss?css_virtual&hash=8fca224caa73cde9adc275a3199ef4ac */
2301
- .container_7e0fb {
2302
- background-color: var(--rp-code-block-bg);
2303
- contain: content;
2304
- border-radius: 16px;
2305
- }
2306
- .container_7e0fb div[class*=language-] {
2307
- margin: 6px 0;
2308
- }
2309
- .container_7e0fb div[class*=language-] code {
2310
- background-color: var(--rp-c-bg);
2311
- }
2312
- .tab-list_7e0fb {
2313
- padding-left: 8px;
2314
- padding-top: 4px;
2315
- display: flex;
2316
- min-width: 100%;
2317
- background-color: var(--rp-code-title-bg);
2318
- }
2319
- .tab_7e0fb {
2320
- color: var(--rp-c-text-2);
2321
- border-bottom: 1px solid transparent;
2322
- box-sizing: border-box;
2323
- margin-right: 10px;
2324
- padding: 6px 12px;
2325
- margin-bottom: -1px;
2326
- user-select: none;
2327
- transition: all 0.2s ease-in-out;
2328
- cursor: pointer;
2329
- }
2330
- .tab_7e0fb:last-child {
2331
- margin-right: 0;
2332
- }
2333
- .not-selected_7e0fb:hover {
2334
- color: var(--rp-c-text-1);
2335
- border-color: var(--rp-c-gray);
2336
- }
2337
- .selected_7e0fb {
2338
- color: var(--rp-c-brand-dark);
2339
- border-color: var(--rp-c-brand-dark);
2340
- }
2341
-
2342
2303
  /* src/theme-default/components/Search/index.module.scss?css_virtual&hash=19f728cc293dbb1f87fb5f4deca962a4 */
2343
2304
  .mask_f619e {
2344
2305
  position: fixed;
@@ -2551,6 +2512,48 @@ button:focus-visible {
2551
2512
  }
2552
2513
  }
2553
2514
 
2515
+ /* src/theme-default/components/Tabs/index.module.scss?css_virtual&hash=8fca224caa73cde9adc275a3199ef4ac */
2516
+ .container_7e0fb {
2517
+ background-color: var(--rp-code-block-bg);
2518
+ contain: content;
2519
+ border-radius: 16px;
2520
+ }
2521
+ .container_7e0fb div[class*=language-] {
2522
+ margin: 6px 0;
2523
+ }
2524
+ .container_7e0fb div[class*=language-] code {
2525
+ background-color: var(--rp-c-bg);
2526
+ }
2527
+ .tab-list_7e0fb {
2528
+ padding-left: 8px;
2529
+ padding-top: 4px;
2530
+ display: flex;
2531
+ min-width: 100%;
2532
+ background-color: var(--rp-code-title-bg);
2533
+ }
2534
+ .tab_7e0fb {
2535
+ color: var(--rp-c-text-2);
2536
+ border-bottom: 1px solid transparent;
2537
+ box-sizing: border-box;
2538
+ margin-right: 10px;
2539
+ padding: 6px 12px;
2540
+ margin-bottom: -1px;
2541
+ user-select: none;
2542
+ transition: all 0.2s ease-in-out;
2543
+ cursor: pointer;
2544
+ }
2545
+ .tab_7e0fb:last-child {
2546
+ margin-right: 0;
2547
+ }
2548
+ .not-selected_7e0fb:hover {
2549
+ color: var(--rp-c-text-1);
2550
+ border-color: var(--rp-c-gray);
2551
+ }
2552
+ .selected_7e0fb {
2553
+ color: var(--rp-c-brand-dark);
2554
+ border-color: var(--rp-c-brand-dark);
2555
+ }
2556
+
2554
2557
  /* src/theme-default/components/Toc/index.css */
2555
2558
  .toc-link {
2556
2559
  padding-bottom: 1px;
@@ -62,6 +62,12 @@ declare function getLogoUrl(rawLogo: string | {
62
62
  }, theme: 'dark' | 'light'): string;
63
63
  declare function isMobileDevice(): boolean;
64
64
 
65
+ interface SearchPanelProps {
66
+ focused: boolean;
67
+ setFocused: (focused: boolean) => void;
68
+ }
69
+ declare function SearchPanel({ focused, setFocused }: SearchPanelProps): JSX.Element;
70
+
65
71
  declare function Search(): JSX.Element;
66
72
 
67
73
  type TabItem = {
@@ -158,4 +164,4 @@ declare const _default: {
158
164
  setup: typeof setup;
159
165
  };
160
166
 
161
- export { Button, HomeFooter, Link, Nav, PackageManagerTabs, Search, Tab, Tabs, Toc, bindingAsideScroll, _default as default, getCustomMDXComponent, getLogoUrl, isActive, isExternalHref, isMobileDevice, scrollToTarget, setup, useEditLink, useLocaleSiteData, usePrevNextPage, useSidebarData };
167
+ export { Button, HomeFooter, Link, Nav, PackageManagerTabs, Search, SearchPanel, Tab, Tabs, Toc, bindingAsideScroll, _default as default, getCustomMDXComponent, getLogoUrl, isActive, isExternalHref, isMobileDevice, scrollToTarget, setup, useEditLink, useLocaleSiteData, usePrevNextPage, useSidebarData };