@rspress/shared 0.0.0-next-20230824072138 → 0.0.0-nightly-20230912055611
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 +64 -6
- package/dist/index.js +758 -675
- package/dist/index.mjs +1236 -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.
|
@@ -105,7 +151,7 @@ interface LocaleConfig {
|
|
105
151
|
nextPageText?: string;
|
106
152
|
langRoutePrefix?: string;
|
107
153
|
}
|
108
|
-
type NavItem = NavItemWithLink | NavItemWithChildren;
|
154
|
+
type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
|
109
155
|
type NavItemWithLink = {
|
110
156
|
text: string;
|
111
157
|
link: string;
|
@@ -116,7 +162,15 @@ type NavItemWithLink = {
|
|
116
162
|
interface NavItemWithChildren {
|
117
163
|
text?: string;
|
118
164
|
tag?: string;
|
119
|
-
items:
|
165
|
+
items: NavItem[];
|
166
|
+
position?: 'left' | 'right';
|
167
|
+
}
|
168
|
+
interface NavItemWithLinkAndChildren {
|
169
|
+
text: string;
|
170
|
+
link: string;
|
171
|
+
items: NavItem[];
|
172
|
+
tag?: string;
|
173
|
+
activeMatch?: string;
|
120
174
|
position?: 'left' | 'right';
|
121
175
|
}
|
122
176
|
type Image = string | {
|
@@ -230,7 +284,7 @@ interface RspressPlugin {
|
|
230
284
|
/**
|
231
285
|
* Inject global components.
|
232
286
|
*/
|
233
|
-
globalUIComponents?: string[];
|
287
|
+
globalUIComponents?: (string | [string, object])[];
|
234
288
|
/**
|
235
289
|
* Modify doc config.
|
236
290
|
*/
|
@@ -381,7 +435,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
381
435
|
/**
|
382
436
|
* Global components
|
383
437
|
*/
|
384
|
-
globalUIComponents?: string[];
|
438
|
+
globalUIComponents?: (string | [string, object])[];
|
385
439
|
/**
|
386
440
|
* Global styles, is a Absolute path
|
387
441
|
*/
|
@@ -395,6 +449,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
395
449
|
*/
|
396
450
|
mediumZoom?: boolean | {
|
397
451
|
selector?: string;
|
452
|
+
options?: ZoomOptions;
|
398
453
|
};
|
399
454
|
/**
|
400
455
|
* Add some extra builder plugins
|
@@ -546,12 +601,15 @@ type Config = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Pro
|
|
546
601
|
declare const QUERY_REGEXP: RegExp;
|
547
602
|
declare const HASH_REGEXP: RegExp;
|
548
603
|
declare const MDX_REGEXP: RegExp;
|
549
|
-
declare const APPEARANCE_KEY = "
|
604
|
+
declare const APPEARANCE_KEY = "rspress-theme-appearance";
|
550
605
|
declare const SEARCH_INDEX_NAME = "search_index";
|
606
|
+
declare const RSPRESS_TEMP_DIR = ".rspress";
|
551
607
|
declare const isSCM: () => boolean;
|
552
608
|
declare const isProduction: () => boolean;
|
553
609
|
declare const isDebugMode: () => boolean;
|
554
610
|
declare const cleanUrl: (url: string) => string;
|
611
|
+
declare function slash(str: string): string;
|
612
|
+
declare function normalizePosixPath(id: string): string;
|
555
613
|
declare const inBrowser: () => boolean;
|
556
614
|
declare function addLeadingSlash(url: string): string;
|
557
615
|
declare function removeLeadingSlash(url: string): string;
|
@@ -574,4 +632,4 @@ declare function removeBase(url: string, base: string): string;
|
|
574
632
|
declare function withoutHash(url: string): string;
|
575
633
|
declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
|
576
634
|
|
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 };
|
635
|
+
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 };
|