@rspress/shared 0.0.0-nightly-20231106160339 → 0.0.0-nightly-20231108160202
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 +19 -10
- package/dist/index.js +5 -0
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -65,9 +65,11 @@ interface Config$1 {
|
|
65
65
|
*/
|
66
66
|
outline?: boolean;
|
67
67
|
/**
|
68
|
-
* The nav items.
|
68
|
+
* The nav items. When it's an object, the key is the version of current doc.
|
69
69
|
*/
|
70
|
-
nav?: NavItem[]
|
70
|
+
nav?: NavItem[] | {
|
71
|
+
[key: string]: NavItem[];
|
72
|
+
};
|
71
73
|
/**
|
72
74
|
* The sidebar items.
|
73
75
|
*/
|
@@ -141,7 +143,7 @@ interface LocaleConfig {
|
|
141
143
|
/**
|
142
144
|
* Theme i18n config
|
143
145
|
*/
|
144
|
-
nav?:
|
146
|
+
nav?: Nav;
|
145
147
|
sidebar?: Sidebar;
|
146
148
|
outlineTitle?: string;
|
147
149
|
lastUpdatedText?: string;
|
@@ -151,6 +153,9 @@ interface LocaleConfig {
|
|
151
153
|
nextPageText?: string;
|
152
154
|
langRoutePrefix?: string;
|
153
155
|
}
|
156
|
+
type Nav = NavItem[] | {
|
157
|
+
[key: string]: NavItem[];
|
158
|
+
};
|
154
159
|
type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
|
155
160
|
type NavItemWithLink = {
|
156
161
|
text: string;
|
@@ -162,13 +167,13 @@ type NavItemWithLink = {
|
|
162
167
|
interface NavItemWithChildren {
|
163
168
|
text?: string;
|
164
169
|
tag?: string;
|
165
|
-
items:
|
170
|
+
items: NavItemWithLink[];
|
166
171
|
position?: 'left' | 'right';
|
167
172
|
}
|
168
173
|
interface NavItemWithLinkAndChildren {
|
169
174
|
text: string;
|
170
175
|
link: string;
|
171
|
-
items:
|
176
|
+
items: NavItemWithLink[];
|
172
177
|
tag?: string;
|
173
178
|
activeMatch?: string;
|
174
179
|
position?: 'left' | 'right';
|
@@ -178,13 +183,13 @@ type Image = string | {
|
|
178
183
|
alt?: string;
|
179
184
|
};
|
180
185
|
interface Sidebar {
|
181
|
-
[path: string]: (SidebarGroup | SidebarItem)[];
|
186
|
+
[path: string]: (SidebarGroup | SidebarItem | SidebarDivider)[];
|
182
187
|
}
|
183
188
|
interface SidebarGroup {
|
184
189
|
text: string;
|
185
190
|
link?: string;
|
186
191
|
tag?: string;
|
187
|
-
items: (SidebarItem | SidebarGroup | string)[];
|
192
|
+
items: (SidebarItem | SidebarDivider | SidebarGroup | string)[];
|
188
193
|
collapsible?: boolean;
|
189
194
|
collapsed?: boolean;
|
190
195
|
}
|
@@ -193,6 +198,9 @@ type SidebarItem = {
|
|
193
198
|
link: string;
|
194
199
|
tag?: string;
|
195
200
|
};
|
201
|
+
type SidebarDivider = {
|
202
|
+
dividerType: 'dashed' | 'solid';
|
203
|
+
};
|
196
204
|
interface EditLink {
|
197
205
|
/**
|
198
206
|
* Custom repository url for edit link.
|
@@ -235,12 +243,12 @@ interface LocaleLink {
|
|
235
243
|
link: string;
|
236
244
|
}
|
237
245
|
interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'items'> {
|
238
|
-
items: (SidebarItem | NormalizedSidebarGroup)[];
|
246
|
+
items: (SidebarDivider | SidebarItem | NormalizedSidebarGroup)[];
|
239
247
|
collapsible: boolean;
|
240
248
|
collapsed: boolean;
|
241
249
|
}
|
242
250
|
interface NormalizedSidebar {
|
243
|
-
[path: string]: (NormalizedSidebarGroup | SidebarItem)[];
|
251
|
+
[path: string]: (NormalizedSidebarGroup | SidebarItem | SidebarDivider)[];
|
244
252
|
}
|
245
253
|
interface NormalizedLocales extends Omit<LocaleConfig, 'sidebar'> {
|
246
254
|
sidebar: NormalizedSidebar;
|
@@ -668,6 +676,7 @@ declare function normalizePosixPath(id: string): string;
|
|
668
676
|
declare const inBrowser: () => boolean;
|
669
677
|
declare function addLeadingSlash(url: string): string;
|
670
678
|
declare function removeLeadingSlash(url: string): string;
|
679
|
+
declare function addTrailingSlash(url: string): string;
|
671
680
|
declare function removeTrailingSlash(url: string): string;
|
672
681
|
declare function normalizeSlash(url: string): string;
|
673
682
|
declare function isExternalUrl(url: string): boolean;
|
@@ -699,4 +708,4 @@ declare function removeBase(url: string, base: string): string;
|
|
699
708
|
declare function withoutHash(url: string): string;
|
700
709
|
declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
|
701
710
|
|
702
|
-
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, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
|
711
|
+
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, Nav, 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, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
|
package/dist/index.js
CHANGED
@@ -27,6 +27,7 @@ __export(src_exports, {
|
|
27
27
|
RSPRESS_TEMP_DIR: () => RSPRESS_TEMP_DIR,
|
28
28
|
SEARCH_INDEX_NAME: () => SEARCH_INDEX_NAME,
|
29
29
|
addLeadingSlash: () => addLeadingSlash,
|
30
|
+
addTrailingSlash: () => addTrailingSlash,
|
30
31
|
cleanUrl: () => cleanUrl,
|
31
32
|
inBrowser: () => inBrowser,
|
32
33
|
isDebugMode: () => isDebugMode,
|
@@ -1152,6 +1153,9 @@ function addLeadingSlash(url) {
|
|
1152
1153
|
function removeLeadingSlash(url) {
|
1153
1154
|
return url.charAt(0) === "/" ? url.slice(1) : url;
|
1154
1155
|
}
|
1156
|
+
function addTrailingSlash(url) {
|
1157
|
+
return url.charAt(url.length - 1) === "/" ? url : `${url}/`;
|
1158
|
+
}
|
1155
1159
|
function removeTrailingSlash(url) {
|
1156
1160
|
return url.charAt(url.length - 1) === "/" ? url.slice(0, -1) : url;
|
1157
1161
|
}
|
@@ -1290,6 +1294,7 @@ var mergeDocConfig = (...configs) => mergeWith_default({}, ...configs, (target,
|
|
1290
1294
|
RSPRESS_TEMP_DIR,
|
1291
1295
|
SEARCH_INDEX_NAME,
|
1292
1296
|
addLeadingSlash,
|
1297
|
+
addTrailingSlash,
|
1293
1298
|
cleanUrl,
|
1294
1299
|
inBrowser,
|
1295
1300
|
isDebugMode,
|
package/dist/index.mjs
CHANGED
@@ -1098,6 +1098,9 @@ function addLeadingSlash(url) {
|
|
1098
1098
|
function removeLeadingSlash(url) {
|
1099
1099
|
return url.charAt(0) === "/" ? url.slice(1) : url;
|
1100
1100
|
}
|
1101
|
+
function addTrailingSlash(url) {
|
1102
|
+
return url.charAt(url.length - 1) === "/" ? url : `${url}/`;
|
1103
|
+
}
|
1101
1104
|
function removeTrailingSlash(url) {
|
1102
1105
|
return url.charAt(url.length - 1) === "/" ? url.slice(0, -1) : url;
|
1103
1106
|
}
|
@@ -1235,6 +1238,7 @@ export {
|
|
1235
1238
|
RSPRESS_TEMP_DIR,
|
1236
1239
|
SEARCH_INDEX_NAME,
|
1237
1240
|
addLeadingSlash,
|
1241
|
+
addTrailingSlash,
|
1238
1242
|
cleanUrl,
|
1239
1243
|
inBrowser,
|
1240
1244
|
isDebugMode,
|