@rspress/core 0.0.12 → 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.
- package/dist/index.js +34 -26
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +24 -49
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.d.ts +8 -0
- package/dist/runtime/Content.d.ts +6 -0
- package/dist/runtime/NoSSR.d.ts +4 -0
- package/dist/runtime/clientEntry.d.ts +1 -0
- package/dist/runtime/hooks.d.ts +22 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/ssrEntry.d.ts +6 -0
- package/dist/runtime/tsconfig.json +9 -0
- package/dist/runtime/utils.d.ts +6 -0
- package/dist/theme/bundle.css +85 -52
- package/dist/theme/bundle.d.ts +24 -2
- package/dist/theme/bundle.js +1425 -897
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +14 -16
- package/src/runtime/global.d.ts +49 -0
- package/src/runtime/tsconfig.json +9 -0
- package/src/theme-default/components/LocalSideBar/{index.module.scss → index.scss} +6 -5
- package/src/theme-default/components/LocalSideBar/index.tsx +4 -4
- package/src/theme-default/components/PackageManagerTabs/icons/Bun.tsx +101 -0
- package/src/theme-default/components/PackageManagerTabs/icons/Npm.tsx +16 -0
- package/src/theme-default/components/PackageManagerTabs/icons/Pnpm.tsx +22 -0
- package/src/theme-default/components/PackageManagerTabs/icons/Yarn.tsx +18 -0
- package/src/theme-default/components/PackageManagerTabs/index.scss +5 -0
- package/src/theme-default/components/PackageManagerTabs/index.tsx +110 -0
- package/src/theme-default/components/Search/SearchPanel.tsx +339 -0
- package/src/theme-default/components/Search/index.tsx +6 -326
- package/src/theme-default/components/Tabs/index.module.scss +1 -0
- package/src/theme-default/components/Tabs/index.tsx +30 -41
- package/src/theme-default/components/Toc/index.css +18 -0
- package/src/theme-default/components/Toc/index.tsx +42 -0
- package/src/theme-default/index.ts +8 -7
- package/src/theme-default/layout/DocLayout/docComponents/code.tsx +1 -1
- package/src/theme-default/layout/DocLayout/index.module.scss +6 -3
- package/src/theme-default/layout/DocLayout/index.tsx +9 -7
- package/src/theme-default/logic/useAppearance.ts +0 -1
|
@@ -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 { 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 };
|
package/dist/theme/bundle.css
CHANGED
|
@@ -886,6 +886,12 @@ video {
|
|
|
886
886
|
.text-text-2 {
|
|
887
887
|
color: var(--rp-c-text-2);
|
|
888
888
|
}
|
|
889
|
+
.underline {
|
|
890
|
+
text-decoration-line: underline;
|
|
891
|
+
}
|
|
892
|
+
.underline-offset-2 {
|
|
893
|
+
text-underline-offset: 2px;
|
|
894
|
+
}
|
|
889
895
|
.opacity-80 {
|
|
890
896
|
opacity: 0.8;
|
|
891
897
|
}
|
|
@@ -1617,8 +1623,8 @@ button:focus-visible {
|
|
|
1617
1623
|
background-color: var(--rp-c-bg-mute);
|
|
1618
1624
|
}
|
|
1619
1625
|
|
|
1620
|
-
/* src/theme-default/components/LocalSideBar/index.
|
|
1621
|
-
.
|
|
1626
|
+
/* src/theme-default/components/LocalSideBar/index.scss */
|
|
1627
|
+
.rspress-sidebar-menu {
|
|
1622
1628
|
position: sticky;
|
|
1623
1629
|
top: 0;
|
|
1624
1630
|
left: 0;
|
|
@@ -1632,22 +1638,22 @@ button:focus-visible {
|
|
|
1632
1638
|
background-color: var(--rp-c-bg);
|
|
1633
1639
|
padding-left: 10px;
|
|
1634
1640
|
}
|
|
1635
|
-
.
|
|
1641
|
+
.rspress-sidebar-menu > button {
|
|
1636
1642
|
padding: 12px;
|
|
1637
1643
|
transition: color 0.5s;
|
|
1638
1644
|
}
|
|
1639
|
-
.
|
|
1645
|
+
.rspress-sidebar-menu > button:hover {
|
|
1640
1646
|
color: var(--rp-c-text-3);
|
|
1641
1647
|
}
|
|
1642
1648
|
@media (min-width: 960px) {
|
|
1643
|
-
.
|
|
1649
|
+
.rspress-sidebar-menu {
|
|
1644
1650
|
display: none;
|
|
1645
1651
|
}
|
|
1646
|
-
.
|
|
1652
|
+
.rspress-sidebar-back-drop {
|
|
1647
1653
|
display: none;
|
|
1648
1654
|
}
|
|
1649
1655
|
}
|
|
1650
|
-
.
|
|
1656
|
+
.rspress-sidebar-back-drop {
|
|
1651
1657
|
position: fixed;
|
|
1652
1658
|
top: 0;
|
|
1653
1659
|
right: 0;
|
|
@@ -1789,7 +1795,7 @@ button:focus-visible {
|
|
|
1789
1795
|
}
|
|
1790
1796
|
}
|
|
1791
1797
|
|
|
1792
|
-
/* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=
|
|
1798
|
+
/* src/theme-default/layout/DocLayout/index.module.scss?css_virtual&hash=250b13c9ea37442f400d97809303b004 */
|
|
1793
1799
|
.aside-container_feeda {
|
|
1794
1800
|
position: sticky;
|
|
1795
1801
|
display: none;
|
|
@@ -1822,7 +1828,8 @@ button:focus-visible {
|
|
|
1822
1828
|
width: calc(100% - var(--rp-sidebar-width));
|
|
1823
1829
|
padding: 48px 48px 72px 0;
|
|
1824
1830
|
}
|
|
1825
|
-
.content_feeda .rspress-doc
|
|
1831
|
+
.content_feeda .rspress-doc,
|
|
1832
|
+
.content_feeda .rspress-doc-footer {
|
|
1826
1833
|
width: 100%;
|
|
1827
1834
|
}
|
|
1828
1835
|
.aside-container_feeda {
|
|
@@ -1837,7 +1844,8 @@ button:focus-visible {
|
|
|
1837
1844
|
.content_feeda {
|
|
1838
1845
|
padding: 48px 0 72px 0;
|
|
1839
1846
|
}
|
|
1840
|
-
.content_feeda .rspress-doc
|
|
1847
|
+
.content_feeda .rspress-doc,
|
|
1848
|
+
.content_feeda .rspress-doc-footer {
|
|
1841
1849
|
padding: 0 48px;
|
|
1842
1850
|
box-sizing: content-box;
|
|
1843
1851
|
width: calc(100vw - var(--rp-aside-width) - var(--rp-sidebar-width));
|
|
@@ -1848,7 +1856,8 @@ button:focus-visible {
|
|
|
1848
1856
|
width: 100%;
|
|
1849
1857
|
margin-left: 0;
|
|
1850
1858
|
}
|
|
1851
|
-
.content_feeda .rspress-doc
|
|
1859
|
+
.content_feeda .rspress-doc,
|
|
1860
|
+
.content_feeda .rspress-doc-footer {
|
|
1852
1861
|
box-sizing: content-box;
|
|
1853
1862
|
width: calc(100vw - var(--rp-sidebar-width) - var(--rp-aside-width));
|
|
1854
1863
|
padding: 0 max(48px, (100vw - var(--rp-sidebar-width) - var(--rp-aside-width) - 960px) / 2);
|
|
@@ -2291,47 +2300,6 @@ button:focus-visible {
|
|
|
2291
2300
|
transform: translateX(4px);
|
|
2292
2301
|
}
|
|
2293
2302
|
|
|
2294
|
-
/* src/theme-default/components/Tabs/index.module.scss?css_virtual&hash=6c08afb75394e8f9690200f76b5fc031 */
|
|
2295
|
-
.container_7e0fb {
|
|
2296
|
-
background-color: var(--rp-code-block-bg);
|
|
2297
|
-
contain: content;
|
|
2298
|
-
border-radius: 16px;
|
|
2299
|
-
}
|
|
2300
|
-
.container_7e0fb div[class*=language-] {
|
|
2301
|
-
margin: 6px 0;
|
|
2302
|
-
}
|
|
2303
|
-
.container_7e0fb div[class*=language-] code {
|
|
2304
|
-
background-color: var(--rp-c-bg);
|
|
2305
|
-
}
|
|
2306
|
-
.tab-list_7e0fb {
|
|
2307
|
-
padding-left: 8px;
|
|
2308
|
-
padding-top: 4px;
|
|
2309
|
-
display: flex;
|
|
2310
|
-
min-width: 100%;
|
|
2311
|
-
background-color: var(--rp-code-title-bg);
|
|
2312
|
-
}
|
|
2313
|
-
.tab_7e0fb {
|
|
2314
|
-
color: var(--rp-c-text-2);
|
|
2315
|
-
border-bottom: 1px solid transparent;
|
|
2316
|
-
box-sizing: border-box;
|
|
2317
|
-
margin-right: 10px;
|
|
2318
|
-
padding: 6px 12px;
|
|
2319
|
-
margin-bottom: -1px;
|
|
2320
|
-
user-select: none;
|
|
2321
|
-
transition: all 0.2s ease-in-out;
|
|
2322
|
-
}
|
|
2323
|
-
.tab_7e0fb:last-child {
|
|
2324
|
-
margin-right: 0;
|
|
2325
|
-
}
|
|
2326
|
-
.not-selected_7e0fb:hover {
|
|
2327
|
-
color: var(--rp-c-text-1);
|
|
2328
|
-
border-color: var(--rp-c-gray);
|
|
2329
|
-
}
|
|
2330
|
-
.selected_7e0fb {
|
|
2331
|
-
color: var(--rp-c-brand-dark);
|
|
2332
|
-
border-color: var(--rp-c-brand-dark);
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
2303
|
/* src/theme-default/components/Search/index.module.scss?css_virtual&hash=19f728cc293dbb1f87fb5f4deca962a4 */
|
|
2336
2304
|
.mask_f619e {
|
|
2337
2305
|
position: fixed;
|
|
@@ -2544,6 +2512,71 @@ button:focus-visible {
|
|
|
2544
2512
|
}
|
|
2545
2513
|
}
|
|
2546
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
|
+
|
|
2557
|
+
/* src/theme-default/components/Toc/index.css */
|
|
2558
|
+
.toc-link {
|
|
2559
|
+
padding-bottom: 1px;
|
|
2560
|
+
}
|
|
2561
|
+
.toc-link-text {
|
|
2562
|
+
padding: 4px 12px;
|
|
2563
|
+
white-space: nowrap;
|
|
2564
|
+
overflow: hidden;
|
|
2565
|
+
text-overflow: ellipsis;
|
|
2566
|
+
transition: all 0.2s ease-in-out;
|
|
2567
|
+
border-radius: 10px 0 0 10px;
|
|
2568
|
+
font-size: 16px;
|
|
2569
|
+
line-height: 1.75rem;
|
|
2570
|
+
}
|
|
2571
|
+
.toc-link-text:hover {
|
|
2572
|
+
background-color: var(--rp-c-bg-mute);
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
/* src/theme-default/components/PackageManagerTabs/index.scss */
|
|
2576
|
+
.rspress-package-manager-tabs div[class*=language-] code {
|
|
2577
|
+
background-color: var(--rp-c-bg-mute) !important;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2547
2580
|
/* src/theme-default/layout/DocLayout/docComponents/index.module.scss?css_virtual&hash=c8929e12ddaa45bf7c7aba8314fe1e7c */
|
|
2548
2581
|
.title_f1ea0 {
|
|
2549
2582
|
position: relative;
|
package/dist/theme/bundle.d.ts
CHANGED
|
@@ -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 = {
|
|
@@ -101,9 +107,25 @@ declare function Button(props: ButtonProps): react__default.ReactElement<LinkPro
|
|
|
101
107
|
|
|
102
108
|
declare function HomeFooter(): JSX.Element;
|
|
103
109
|
|
|
110
|
+
declare function Toc(): JSX.Element;
|
|
111
|
+
|
|
112
|
+
interface PackageManagerTabProps {
|
|
113
|
+
command: string | {
|
|
114
|
+
npm: string;
|
|
115
|
+
yarn: string;
|
|
116
|
+
pnpm: string;
|
|
117
|
+
bun: string;
|
|
118
|
+
};
|
|
119
|
+
additionalTabs?: {
|
|
120
|
+
tool: string;
|
|
121
|
+
icon?: React.ReactNode;
|
|
122
|
+
}[];
|
|
123
|
+
}
|
|
124
|
+
declare function PackageManagerTabs({ command, additionalTabs, }: PackageManagerTabProps): JSX.Element;
|
|
125
|
+
|
|
104
126
|
interface CodeProps {
|
|
105
127
|
children: string;
|
|
106
|
-
className
|
|
128
|
+
className?: string;
|
|
107
129
|
meta?: string;
|
|
108
130
|
}
|
|
109
131
|
declare function Code(props: CodeProps): JSX.Element;
|
|
@@ -142,4 +164,4 @@ declare const _default: {
|
|
|
142
164
|
setup: typeof setup;
|
|
143
165
|
};
|
|
144
166
|
|
|
145
|
-
export { Button, HomeFooter, Link, Nav, Search, Tab, Tabs, 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 };
|