@rspress/shared 0.0.0-next-20230824072138 → 0.0.0-next-20230925114748
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.d.ts +99 -7
- package/dist/index.js +781 -688
- package/dist/index.mjs +1245 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +64 -0
- package/dist/logger.mjs +29 -0
- package/package.json +20 -7
package/dist/index.d.ts
CHANGED
@@ -2,6 +2,52 @@ import { BuilderConfig } from '@modern-js/builder-rspack-provider';
|
|
2
2
|
import { PluggableList } from 'unified';
|
3
3
|
import { BuilderPlugin } from '@modern-js/builder';
|
4
4
|
|
5
|
+
interface ZoomOptions {
|
6
|
+
/**
|
7
|
+
* The space outside the zoomed image.
|
8
|
+
*
|
9
|
+
* @default 0
|
10
|
+
*/
|
11
|
+
margin?: number
|
12
|
+
|
13
|
+
/**
|
14
|
+
* The background of the overlay.
|
15
|
+
*
|
16
|
+
* @default '#fff'
|
17
|
+
*/
|
18
|
+
background?: string
|
19
|
+
|
20
|
+
/**
|
21
|
+
* The number of pixels to scroll to close the zoom.
|
22
|
+
*
|
23
|
+
* @default 40
|
24
|
+
*/
|
25
|
+
scrollOffset?: number
|
26
|
+
|
27
|
+
/**
|
28
|
+
* The viewport to render the zoom in.
|
29
|
+
*
|
30
|
+
* @default null
|
31
|
+
*/
|
32
|
+
container?: string | HTMLElement | ZoomContainer
|
33
|
+
|
34
|
+
/**
|
35
|
+
* The template element to display on zoom.
|
36
|
+
*
|
37
|
+
* @default null
|
38
|
+
*/
|
39
|
+
template?: string | HTMLTemplateElement
|
40
|
+
}
|
41
|
+
|
42
|
+
interface ZoomContainer {
|
43
|
+
width?: number
|
44
|
+
height?: number
|
45
|
+
top?: number
|
46
|
+
bottom?: number
|
47
|
+
right?: number
|
48
|
+
left?: number
|
49
|
+
}
|
50
|
+
|
5
51
|
interface Config$1 {
|
6
52
|
/**
|
7
53
|
* Whether to enable dark mode.
|
@@ -80,6 +126,10 @@ interface Config$1 {
|
|
80
126
|
* Whether to hide the navbar
|
81
127
|
*/
|
82
128
|
hideNavbar?: boolean;
|
129
|
+
/**
|
130
|
+
* Whether to enable the animation for translation pages
|
131
|
+
*/
|
132
|
+
enableContentAnimation?: boolean;
|
83
133
|
}
|
84
134
|
/**
|
85
135
|
* locale config
|
@@ -105,7 +155,7 @@ interface LocaleConfig {
|
|
105
155
|
nextPageText?: string;
|
106
156
|
langRoutePrefix?: string;
|
107
157
|
}
|
108
|
-
type NavItem = NavItemWithLink | NavItemWithChildren;
|
158
|
+
type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
|
109
159
|
type NavItemWithLink = {
|
110
160
|
text: string;
|
111
161
|
link: string;
|
@@ -116,7 +166,15 @@ type NavItemWithLink = {
|
|
116
166
|
interface NavItemWithChildren {
|
117
167
|
text?: string;
|
118
168
|
tag?: string;
|
119
|
-
items:
|
169
|
+
items: NavItem[];
|
170
|
+
position?: 'left' | 'right';
|
171
|
+
}
|
172
|
+
interface NavItemWithLinkAndChildren {
|
173
|
+
text: string;
|
174
|
+
link: string;
|
175
|
+
items: NavItem[];
|
176
|
+
tag?: string;
|
177
|
+
activeMatch?: string;
|
120
178
|
position?: 'left' | 'right';
|
121
179
|
}
|
122
180
|
type Image = string | {
|
@@ -230,7 +288,7 @@ interface RspressPlugin {
|
|
230
288
|
/**
|
231
289
|
* Inject global components.
|
232
290
|
*/
|
233
|
-
globalUIComponents?: string[];
|
291
|
+
globalUIComponents?: (string | [string, object])[];
|
234
292
|
/**
|
235
293
|
* Modify doc config.
|
236
294
|
*/
|
@@ -285,6 +343,7 @@ interface RouteMeta {
|
|
285
343
|
relativePath: string;
|
286
344
|
pageName: string;
|
287
345
|
lang: string;
|
346
|
+
version: string;
|
288
347
|
}
|
289
348
|
interface ReplaceRule {
|
290
349
|
search: string | RegExp;
|
@@ -381,7 +440,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
381
440
|
/**
|
382
441
|
* Global components
|
383
442
|
*/
|
384
|
-
globalUIComponents?: string[];
|
443
|
+
globalUIComponents?: (string | [string, object])[];
|
385
444
|
/**
|
386
445
|
* Global styles, is a Absolute path
|
387
446
|
*/
|
@@ -395,17 +454,35 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
395
454
|
*/
|
396
455
|
mediumZoom?: boolean | {
|
397
456
|
selector?: string;
|
457
|
+
options?: ZoomOptions;
|
398
458
|
};
|
399
459
|
/**
|
400
460
|
* Add some extra builder plugins
|
401
461
|
*/
|
402
462
|
builderPlugins?: BuilderPlugin[];
|
463
|
+
/**
|
464
|
+
* Multi version config
|
465
|
+
*/
|
466
|
+
multiVersion?: {
|
467
|
+
/**
|
468
|
+
* The default version
|
469
|
+
*/
|
470
|
+
default?: string;
|
471
|
+
/**
|
472
|
+
* The version list, such as ['v1', 'v2']
|
473
|
+
*/
|
474
|
+
versions: string[];
|
475
|
+
};
|
403
476
|
}
|
404
477
|
type BaseRuntimePageInfo = Omit<PageIndexInfo, 'id' | 'content' | 'domain'>;
|
405
478
|
interface SiteData<ThemeConfig = NormalizedConfig> {
|
406
479
|
root: string;
|
407
480
|
base: string;
|
408
481
|
lang: string;
|
482
|
+
locales: {
|
483
|
+
lang: string;
|
484
|
+
label: string;
|
485
|
+
}[];
|
409
486
|
title: string;
|
410
487
|
description: string;
|
411
488
|
icon: string;
|
@@ -419,6 +496,10 @@ interface SiteData<ThemeConfig = NormalizedConfig> {
|
|
419
496
|
markdown: {
|
420
497
|
showLineNumbers: boolean;
|
421
498
|
};
|
499
|
+
multiVersion: {
|
500
|
+
default: string;
|
501
|
+
versions: string[];
|
502
|
+
};
|
422
503
|
}
|
423
504
|
type PageIndexInfo = {
|
424
505
|
id: number;
|
@@ -428,6 +509,7 @@ type PageIndexInfo = {
|
|
428
509
|
content: string;
|
429
510
|
frontmatter: Record<string, unknown>;
|
430
511
|
lang: string;
|
512
|
+
version: string;
|
431
513
|
domain: string;
|
432
514
|
_filepath: string;
|
433
515
|
_relativePath: string;
|
@@ -546,19 +628,29 @@ type Config = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Pro
|
|
546
628
|
declare const QUERY_REGEXP: RegExp;
|
547
629
|
declare const HASH_REGEXP: RegExp;
|
548
630
|
declare const MDX_REGEXP: RegExp;
|
549
|
-
declare const APPEARANCE_KEY = "
|
631
|
+
declare const APPEARANCE_KEY = "rspress-theme-appearance";
|
550
632
|
declare const SEARCH_INDEX_NAME = "search_index";
|
633
|
+
declare const RSPRESS_TEMP_DIR = ".rspress";
|
551
634
|
declare const isSCM: () => boolean;
|
552
635
|
declare const isProduction: () => boolean;
|
553
636
|
declare const isDebugMode: () => boolean;
|
554
637
|
declare const cleanUrl: (url: string) => string;
|
638
|
+
declare function slash(str: string): string;
|
639
|
+
declare function normalizePosixPath(id: string): string;
|
555
640
|
declare const inBrowser: () => boolean;
|
556
641
|
declare function addLeadingSlash(url: string): string;
|
557
642
|
declare function removeLeadingSlash(url: string): string;
|
558
643
|
declare function removeTrailingSlash(url: string): string;
|
559
644
|
declare function normalizeSlash(url: string): string;
|
560
645
|
declare function isExternalUrl(url: string): boolean;
|
561
|
-
declare function replaceLang(rawUrl: string,
|
646
|
+
declare function replaceLang(rawUrl: string, lang: {
|
647
|
+
current: string;
|
648
|
+
target: string;
|
649
|
+
default: string;
|
650
|
+
}, version: {
|
651
|
+
current: string;
|
652
|
+
default: string;
|
653
|
+
}, base?: string): string;
|
562
654
|
declare const omit: (obj: Record<string, unknown>, keys: string[]) => {
|
563
655
|
[x: string]: unknown;
|
564
656
|
};
|
@@ -574,4 +666,4 @@ declare function removeBase(url: string, base: string): string;
|
|
574
666
|
declare function withoutHash(url: string): string;
|
575
667
|
declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
|
576
668
|
|
577
|
-
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, QUERY_REGEXP, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, withBase, withoutBase, withoutHash, withoutLang };
|
669
|
+
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, slash, withBase, withoutBase, withoutHash, withoutLang };
|