dumi 2.4.29 → 2.4.31
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/compiled/crates/swc_plugin_react_demo.wasm +0 -0
- package/dist/assetParsers/BaseParser.d.ts +55 -0
- package/dist/assetParsers/atom.d.ts +21 -0
- package/dist/assetParsers/block.d.ts +25 -0
- package/dist/assetParsers/utils.d.ts +79 -0
- package/dist/cli.d.ts +1 -0
- package/dist/client/misc/reactDemoCompiler.d.ts +3 -0
- package/dist/client/pages/404.d.ts +1 -0
- package/dist/client/pages/Demo/index.d.ts +4 -0
- package/dist/client/pages/Loading.d.ts +1 -0
- package/dist/client/theme-api/AtomRenderer.d.ts +13 -0
- package/dist/client/theme-api/DumiDemo/DemoErrorBoundary.d.ts +5 -0
- package/dist/client/theme-api/DumiDemo/index.d.ts +10 -0
- package/dist/client/theme-api/DumiDemoGrid.d.ts +7 -0
- package/dist/client/theme-api/DumiPage.d.ts +4 -0
- package/dist/client/theme-api/context.d.ts +21 -0
- package/dist/client/theme-api/index.d.ts +18 -0
- package/dist/client/theme-api/openCodeSandbox.d.ts +10 -0
- package/dist/client/theme-api/openStackBlitz.d.ts +2 -0
- package/dist/client/theme-api/types.d.ts +258 -0
- package/dist/client/theme-api/useAtomAssets.d.ts +4 -0
- package/dist/client/theme-api/useLiveDemo.d.ts +10 -0
- package/dist/client/theme-api/useLocale.d.ts +2 -0
- package/dist/client/theme-api/useNavData.d.ts +5 -0
- package/dist/client/theme-api/usePrefersColor.d.ts +7 -0
- package/dist/client/theme-api/useRenderer.d.ts +11 -0
- package/dist/client/theme-api/useRouteMeta.d.ts +17 -0
- package/dist/client/theme-api/useSidebarData.d.ts +29 -0
- package/dist/client/theme-api/useSiteSearch/index.d.ts +24 -0
- package/dist/client/theme-api/useSiteSearch/useSearchData.d.ts +12 -0
- package/dist/client/theme-api/useTabMeta.d.ts +4 -0
- package/dist/client/theme-api/utils.d.ts +31 -0
- package/dist/constants.d.ts +23 -0
- package/dist/features/assets.d.ts +20 -0
- package/dist/features/assets.js +2 -1
- package/dist/features/autoAlias.d.ts +3 -0
- package/dist/features/compile/babelLoaderCustomize.d.ts +4 -0
- package/dist/features/compile/index.d.ts +4 -0
- package/dist/features/compile/makoHooks.d.ts +8 -0
- package/dist/features/compile/utils.d.ts +2 -0
- package/dist/features/compile/utoopackLoaders.d.ts +8 -0
- package/dist/features/configPlugins/index.d.ts +3 -0
- package/dist/features/configPlugins/schema.d.ts +4 -0
- package/dist/features/derivative.d.ts +11 -0
- package/dist/features/exportStatic.d.ts +3 -0
- package/dist/features/exports.d.ts +3 -0
- package/dist/features/html2sketch.d.ts +3 -0
- package/dist/features/locales.d.ts +3 -0
- package/dist/features/meta.d.ts +5 -0
- package/dist/features/parser.d.ts +3 -0
- package/dist/features/routes.d.ts +3 -0
- package/dist/features/sideEffects/docSideEffectsWebpackPlugin.d.ts +14 -0
- package/dist/features/sideEffects/index.d.ts +7 -0
- package/dist/features/sitemap.d.ts +3 -0
- package/dist/features/sitemap.js +5 -2
- package/dist/features/tabs.d.ts +17 -0
- package/dist/features/tabs.js +7 -4
- package/dist/features/theme/index.d.ts +3 -0
- package/dist/features/theme/index.js +6 -4
- package/dist/features/theme/loader.d.ts +55 -0
- package/dist/index.d.ts +6 -0
- package/dist/loaders/demo/index.d.ts +6 -0
- package/dist/loaders/markdown/index.d.ts +27 -0
- package/dist/loaders/markdown/transformer/index.d.ts +69 -0
- package/dist/loaders/markdown/transformer/rehypeDemo.d.ts +15 -0
- package/dist/loaders/markdown/transformer/rehypeDesc.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeEnhancedTag.d.ts +3 -0
- package/dist/loaders/markdown/transformer/rehypeHighlightLine.d.ts +4 -0
- package/dist/loaders/markdown/transformer/rehypeImg.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeIsolation.d.ts +7 -0
- package/dist/loaders/markdown/transformer/rehypeJsxify.d.ts +2 -0
- package/dist/loaders/markdown/transformer/rehypeLink.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeRaw.d.ts +6 -0
- package/dist/loaders/markdown/transformer/rehypeSlug.d.ts +4 -0
- package/dist/loaders/markdown/transformer/rehypeStrip.d.ts +3 -0
- package/dist/loaders/markdown/transformer/rehypeText.d.ts +4 -0
- package/dist/loaders/markdown/transformer/remarkBreaks.d.ts +3 -0
- package/dist/loaders/markdown/transformer/remarkContainer.d.ts +3 -0
- package/dist/loaders/markdown/transformer/remarkEmbed.d.ts +4 -0
- package/dist/loaders/markdown/transformer/remarkMeta.d.ts +8 -0
- package/dist/loaders/null/index.d.ts +2 -0
- package/dist/loaders/page/index.d.ts +1 -0
- package/dist/loaders/post-raw/index.d.ts +4 -0
- package/dist/loaders/pre-raw/index.d.ts +4 -0
- package/dist/preset.d.ts +5 -0
- package/dist/registerMethods.d.ts +3 -0
- package/dist/service/cli.d.ts +5 -0
- package/dist/service/constants.d.ts +4 -0
- package/dist/service/dev.d.ts +1 -0
- package/dist/service/forkedDev.d.ts +1 -0
- package/dist/service/printHelp.d.ts +1 -0
- package/dist/service/service.d.ts +13 -0
- package/dist/techStacks/react.d.ts +7 -0
- package/dist/techStacks/utils.d.ts +40 -0
- package/dist/types.d.ts +159 -0
- package/dist/utils.d.ts +66 -0
- package/dumi-types.d.ts +115 -0
- package/index.d.ts +64 -5
- package/package.json +12 -8
- package/theme-api.d.ts +319 -0
- package/theme-default/builtins/API/index.d.ts +7 -0
- package/theme-default/builtins/Badge/index.d.ts +7 -0
- package/theme-default/builtins/CodeGroup/index.d.ts +3 -0
- package/theme-default/builtins/Container/index.d.ts +8 -0
- package/theme-default/builtins/Previewer/index.d.ts +5 -0
- package/theme-default/builtins/SourceCode/index.d.ts +14 -0
- package/theme-default/builtins/Table/index.d.ts +6 -0
- package/theme-default/builtins/Tree/index.d.ts +5 -0
- package/theme-default/builtins/Tree/index.js +11 -11
- package/theme-default/layouts/DocLayout/index.d.ts +4 -0
- package/theme-default/slots/ColorSwitch/index.d.ts +4 -0
- package/theme-default/slots/Content/index.d.ts +7 -0
- package/theme-default/slots/ContentFooter/index.d.ts +4 -0
- package/theme-default/slots/ContentTabs/index.d.ts +11 -0
- package/theme-default/slots/Features/index.d.ts +4 -0
- package/theme-default/slots/Footer/index.d.ts +4 -0
- package/theme-default/slots/Header/index.d.ts +4 -0
- package/theme-default/slots/Header/index.js +5 -2
- package/theme-default/slots/HeaderExtra/index.d.ts +3 -0
- package/theme-default/slots/Hero/index.d.ts +4 -0
- package/theme-default/slots/HeroTitle/index.d.ts +6 -0
- package/theme-default/slots/LangSwitch/index.d.ts +4 -0
- package/theme-default/slots/Loading/index.d.ts +5 -0
- package/theme-default/slots/Logo/index.d.ts +4 -0
- package/theme-default/slots/Navbar/index.d.ts +4 -0
- package/theme-default/slots/NavbarExtra/index.d.ts +3 -0
- package/theme-default/slots/NotFound/index.d.ts +4 -0
- package/theme-default/slots/PreviewerActions/index.d.ts +27 -0
- package/theme-default/slots/PreviewerActionsExtra/index.d.ts +4 -0
- package/theme-default/slots/RtlSwitch/index.d.ts +4 -0
- package/theme-default/slots/SearchBar/Input.d.ts +6 -0
- package/theme-default/slots/SearchBar/Mask.d.ts +9 -0
- package/theme-default/slots/SearchBar/index.d.ts +6 -0
- package/theme-default/slots/SearchResult/index.d.ts +10 -0
- package/theme-default/slots/Sidebar/index.d.ts +4 -0
- package/theme-default/slots/SocialIcon/index.d.ts +15 -0
- package/theme-default/slots/SourceCodeEditor/index.d.ts +19 -0
- package/theme-default/slots/Tabs/index.d.ts +6 -0
- package/theme-default/slots/Toc/index.d.ts +4 -0
- package/theme-modules.d.ts +62 -0
package/theme-api.d.ts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AtomAsset,
|
|
3
|
+
AtomComponentAsset,
|
|
4
|
+
ExampleBlockAsset,
|
|
5
|
+
ExamplePresetAsset,
|
|
6
|
+
} from 'dumi-assets-types';
|
|
7
|
+
import type { TypeMap } from 'dumi-assets-types/typings/atom/props/types';
|
|
8
|
+
import type {
|
|
9
|
+
FC,
|
|
10
|
+
ComponentType as ReactComponentType,
|
|
11
|
+
ReactNode,
|
|
12
|
+
RefObject,
|
|
13
|
+
} from 'react';
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
FormattedDate,
|
|
17
|
+
FormattedDateParts,
|
|
18
|
+
FormattedDisplayName,
|
|
19
|
+
FormattedList,
|
|
20
|
+
FormattedMessage,
|
|
21
|
+
FormattedNumber,
|
|
22
|
+
FormattedNumberParts,
|
|
23
|
+
FormattedPlural,
|
|
24
|
+
FormattedRelativeTime,
|
|
25
|
+
FormattedTime,
|
|
26
|
+
FormattedTimeParts,
|
|
27
|
+
IntlContext,
|
|
28
|
+
IntlProvider,
|
|
29
|
+
RawIntlProvider,
|
|
30
|
+
createIntlCache,
|
|
31
|
+
defineMessages,
|
|
32
|
+
injectIntl,
|
|
33
|
+
useIntl,
|
|
34
|
+
} from 'react-intl';
|
|
35
|
+
|
|
36
|
+
export interface IPreviewerProps {
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
filename?: string;
|
|
40
|
+
iframe?: boolean | number;
|
|
41
|
+
debug?: boolean;
|
|
42
|
+
defaultShowCode?: boolean;
|
|
43
|
+
demoUrl: string;
|
|
44
|
+
compact?: boolean;
|
|
45
|
+
transform?: boolean;
|
|
46
|
+
background?: string;
|
|
47
|
+
asset: ExampleBlockAsset;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
_live_in_iframe?: boolean;
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IRouteMeta {
|
|
54
|
+
frontmatter: {
|
|
55
|
+
title: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
keywords?: string[];
|
|
58
|
+
nav?:
|
|
59
|
+
| string
|
|
60
|
+
| {
|
|
61
|
+
title?: string;
|
|
62
|
+
order?: number;
|
|
63
|
+
second?: Omit<IRouteMeta['frontmatter']['nav'], 'second'>;
|
|
64
|
+
};
|
|
65
|
+
group?: string | { title?: string; order?: number };
|
|
66
|
+
order?: number;
|
|
67
|
+
hero?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
background?: string;
|
|
71
|
+
actions?: { text: string; link: string }[];
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
features?: {
|
|
75
|
+
emoji?: string;
|
|
76
|
+
title?: string;
|
|
77
|
+
link?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}[];
|
|
81
|
+
toc?: boolean | 'content' | 'menu';
|
|
82
|
+
demo?: {
|
|
83
|
+
cols?: number;
|
|
84
|
+
tocDepth?: number;
|
|
85
|
+
};
|
|
86
|
+
atomId?: string;
|
|
87
|
+
filename?: string;
|
|
88
|
+
lastUpdated?: number;
|
|
89
|
+
debug?: boolean;
|
|
90
|
+
sidebar?: boolean;
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
};
|
|
93
|
+
toc: { id: string; depth: number; title: string; _debug_demo?: boolean }[];
|
|
94
|
+
texts: {
|
|
95
|
+
type?: 'content';
|
|
96
|
+
value: string;
|
|
97
|
+
paraId: number;
|
|
98
|
+
tocIndex?: number;
|
|
99
|
+
}[];
|
|
100
|
+
tabs?: {
|
|
101
|
+
key: string;
|
|
102
|
+
title?: string;
|
|
103
|
+
titleIntlId?: string;
|
|
104
|
+
components: {
|
|
105
|
+
default: ReactComponentType;
|
|
106
|
+
Extra: ReactComponentType;
|
|
107
|
+
Action: ReactComponentType;
|
|
108
|
+
};
|
|
109
|
+
meta: {
|
|
110
|
+
frontmatter: Omit<
|
|
111
|
+
IRouteMeta['frontmatter'],
|
|
112
|
+
'description' | 'keywords' | 'nav' | 'group' | 'hero' | 'features'
|
|
113
|
+
>;
|
|
114
|
+
toc: IRouteMeta['toc'];
|
|
115
|
+
texts: IRouteMeta['texts'];
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
};
|
|
118
|
+
}[];
|
|
119
|
+
_atom_route?: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type IBasicLocale = { id: string; name: string };
|
|
123
|
+
export type ILocale =
|
|
124
|
+
| (IBasicLocale & { base: string })
|
|
125
|
+
| (IBasicLocale & { suffix: string });
|
|
126
|
+
export type ILocalesConfig = ILocale[];
|
|
127
|
+
export interface INavItem {
|
|
128
|
+
title: string;
|
|
129
|
+
link?: string;
|
|
130
|
+
order?: number;
|
|
131
|
+
activePath?: string;
|
|
132
|
+
[key: string]: any;
|
|
133
|
+
}
|
|
134
|
+
export interface ISidebarItem {
|
|
135
|
+
title: string;
|
|
136
|
+
link: string;
|
|
137
|
+
order?: number;
|
|
138
|
+
frontmatter?: IRouteMeta['frontmatter'];
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
}
|
|
141
|
+
export interface ISidebarGroup {
|
|
142
|
+
title?: string;
|
|
143
|
+
children: ISidebarItem[];
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
}
|
|
146
|
+
export type SocialTypes =
|
|
147
|
+
| 'github'
|
|
148
|
+
| 'weibo'
|
|
149
|
+
| 'twitter'
|
|
150
|
+
| 'x'
|
|
151
|
+
| 'gitlab'
|
|
152
|
+
| 'facebook'
|
|
153
|
+
| 'zhihu'
|
|
154
|
+
| 'yuque'
|
|
155
|
+
| 'linkedin';
|
|
156
|
+
export type INavItems = (INavItem & { children?: INavItem[] })[];
|
|
157
|
+
export type IUserNavItem = Pick<INavItem, 'title' | 'link' | 'activePath'>;
|
|
158
|
+
export type IUserNavMode = 'override' | 'append' | 'prepend';
|
|
159
|
+
export type IUserNavItems = (IUserNavItem & { children?: IUserNavItem[] })[];
|
|
160
|
+
export type IUserNavValue = IUserNavItems | Record<string, IUserNavItems>;
|
|
161
|
+
export type NavWithMode<T extends IUserNavValue> = {
|
|
162
|
+
mode: IUserNavMode;
|
|
163
|
+
value: T;
|
|
164
|
+
};
|
|
165
|
+
export interface IThemeConfig {
|
|
166
|
+
name?: string;
|
|
167
|
+
logo?: string | false;
|
|
168
|
+
nav?: IUserNavValue | NavWithMode<IUserNavValue>;
|
|
169
|
+
sidebar?: Record<string, ISidebarGroup[]>;
|
|
170
|
+
footer?: string | false;
|
|
171
|
+
showLineNum?: boolean;
|
|
172
|
+
prefersColor: {
|
|
173
|
+
default: 'light' | 'dark' | 'auto';
|
|
174
|
+
switch: boolean;
|
|
175
|
+
};
|
|
176
|
+
nprogress?: boolean;
|
|
177
|
+
socialLinks?: { [key in SocialTypes]?: string };
|
|
178
|
+
editLink?: boolean | string;
|
|
179
|
+
sourceLink?: boolean | string;
|
|
180
|
+
lastUpdated?: boolean;
|
|
181
|
+
[key: string]: any;
|
|
182
|
+
}
|
|
183
|
+
export type IRoutesById = Record<
|
|
184
|
+
string,
|
|
185
|
+
{
|
|
186
|
+
path?: string;
|
|
187
|
+
parentId?: string;
|
|
188
|
+
meta?: IRouteMeta;
|
|
189
|
+
id: string;
|
|
190
|
+
redirect?: string;
|
|
191
|
+
[key: string]: any;
|
|
192
|
+
}
|
|
193
|
+
>;
|
|
194
|
+
export type AgnosticComponentModule = { default?: any; [key: string]: any };
|
|
195
|
+
export type AgnosticComponentType =
|
|
196
|
+
| Promise<AgnosticComponentModule>
|
|
197
|
+
| AgnosticComponentModule;
|
|
198
|
+
export type IDemoCompileFn = (
|
|
199
|
+
code: string,
|
|
200
|
+
opts: { filename: string },
|
|
201
|
+
) => Promise<string>;
|
|
202
|
+
export type IDemoCancelableFn = (
|
|
203
|
+
canvas: HTMLElement,
|
|
204
|
+
component: AgnosticComponentModule,
|
|
205
|
+
) => (() => void) | Promise<() => void>;
|
|
206
|
+
export type IDemoPreflightFn = (
|
|
207
|
+
component: AgnosticComponentModule,
|
|
208
|
+
) => Promise<void>;
|
|
209
|
+
export type IDemoData = {
|
|
210
|
+
component: ReactComponentType | AgnosticComponentType;
|
|
211
|
+
asset: IPreviewerProps['asset'];
|
|
212
|
+
routeId: string;
|
|
213
|
+
context?: Record<string, unknown>;
|
|
214
|
+
renderOpts?: {
|
|
215
|
+
compile?: IDemoCompileFn;
|
|
216
|
+
renderer?: IDemoCancelableFn;
|
|
217
|
+
preflight?: IDemoPreflightFn;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export interface ISiteContext {
|
|
221
|
+
pkg: Record<string, any>;
|
|
222
|
+
historyType: 'browser' | 'hash' | 'memory';
|
|
223
|
+
entryExports: Record<string, any>;
|
|
224
|
+
demos: Record<string, IDemoData>;
|
|
225
|
+
components: Record<string, AtomComponentAsset>;
|
|
226
|
+
locales: ILocalesConfig;
|
|
227
|
+
themeConfig: IThemeConfig;
|
|
228
|
+
hostname?: string;
|
|
229
|
+
loading: boolean;
|
|
230
|
+
setLoading: (status: boolean) => void;
|
|
231
|
+
_2_level_nav_available: boolean;
|
|
232
|
+
[key: string]: any;
|
|
233
|
+
}
|
|
234
|
+
export interface IDumiDemoProps {
|
|
235
|
+
demo: { id: string; inline?: boolean };
|
|
236
|
+
previewerProps: Omit<IPreviewerProps, 'asset' | 'children'>;
|
|
237
|
+
}
|
|
238
|
+
export interface IDumiDemoGridProps {
|
|
239
|
+
items: IDumiDemoProps[];
|
|
240
|
+
demoRender?: (item: IDumiDemoProps) => ReactNode;
|
|
241
|
+
}
|
|
242
|
+
export type IColorValue = 'light' | 'dark';
|
|
243
|
+
export type IPrefersColorValue = IColorValue | 'auto';
|
|
244
|
+
export interface IHighlightText {
|
|
245
|
+
highlighted?: boolean;
|
|
246
|
+
text: string;
|
|
247
|
+
}
|
|
248
|
+
export interface ISearchNavResult {
|
|
249
|
+
title?: string;
|
|
250
|
+
priority: number;
|
|
251
|
+
hints: {
|
|
252
|
+
type: 'page' | 'title' | 'demo' | 'content';
|
|
253
|
+
link: string;
|
|
254
|
+
priority: number;
|
|
255
|
+
pageTitle: string;
|
|
256
|
+
highlightTitleTexts: IHighlightText[];
|
|
257
|
+
highlightTexts: IHighlightText[];
|
|
258
|
+
}[];
|
|
259
|
+
}
|
|
260
|
+
export type ISearchResult = ISearchNavResult[];
|
|
261
|
+
export interface IAtomRendererProps {
|
|
262
|
+
type: AtomAsset['type'];
|
|
263
|
+
value: ExamplePresetAsset['value'];
|
|
264
|
+
processor?: (
|
|
265
|
+
entity: TypeMap['element'] | TypeMap['function'] | TypeMap['dom'],
|
|
266
|
+
entryExports: Record<string, any>,
|
|
267
|
+
) => any;
|
|
268
|
+
}
|
|
269
|
+
export declare const AtomRenderer: FC<IAtomRendererProps>;
|
|
270
|
+
export declare const DumiDemo: FC<IDumiDemoProps>;
|
|
271
|
+
export declare const DumiDemoGrid: FC<IDumiDemoGridProps>;
|
|
272
|
+
export declare const DumiPage: FC<{ children: ReactNode }>;
|
|
273
|
+
export declare const useSiteData: () => ISiteContext;
|
|
274
|
+
export declare const useAtomAssets: () => {
|
|
275
|
+
components: Record<string, AtomComponentAsset>;
|
|
276
|
+
};
|
|
277
|
+
export declare const useLiveDemo: (
|
|
278
|
+
id: string,
|
|
279
|
+
opts?: { containerRef?: RefObject<HTMLElement>; iframe?: boolean },
|
|
280
|
+
) => {
|
|
281
|
+
node: ReactNode;
|
|
282
|
+
loading: boolean;
|
|
283
|
+
error: Error | null;
|
|
284
|
+
setSource: (source: Record<string, string>) => void;
|
|
285
|
+
};
|
|
286
|
+
export declare const useLocale: () => ILocale;
|
|
287
|
+
export declare const useNavData: () => INavItems;
|
|
288
|
+
export declare const usePrefersColor: () => [
|
|
289
|
+
IColorValue,
|
|
290
|
+
IPrefersColorValue,
|
|
291
|
+
(value: IPrefersColorValue) => void,
|
|
292
|
+
];
|
|
293
|
+
export declare const useMatchedRoute: () => IRoutesById[string];
|
|
294
|
+
export declare const useRouteMeta: () => IRouteMeta;
|
|
295
|
+
export declare const useFullSidebarData: () => NonNullable<
|
|
296
|
+
IThemeConfig['sidebar']
|
|
297
|
+
>;
|
|
298
|
+
export declare const useSidebarData: () => ISidebarGroup[];
|
|
299
|
+
export declare const useSiteSearch: () => {
|
|
300
|
+
keywords: string;
|
|
301
|
+
setKeywords: (keywords: string) => void;
|
|
302
|
+
result: ISearchResult;
|
|
303
|
+
loading: boolean;
|
|
304
|
+
load: () => Promise<void>;
|
|
305
|
+
};
|
|
306
|
+
export declare const useTabMeta: () =>
|
|
307
|
+
| NonNullable<IRouteMeta['tabs']>[number]['meta']
|
|
308
|
+
| undefined;
|
|
309
|
+
export declare const openCodeSandbox: (data: IPreviewerProps) => void;
|
|
310
|
+
export declare const openStackBlitz: (data: IPreviewerProps) => void;
|
|
311
|
+
export declare function useDemo(id: string): IDemoData | undefined;
|
|
312
|
+
export declare function getFullDemos(): Promise<Record<string, IDemoData>>;
|
|
313
|
+
export declare function getRouteMetaById<T extends { syncOnly?: boolean }>(
|
|
314
|
+
id: string,
|
|
315
|
+
opts?: T,
|
|
316
|
+
): T extends { syncOnly: true } ? IRouteMeta | undefined : Promise<IRouteMeta>;
|
|
317
|
+
export declare function getFullRoutesMeta(): Promise<
|
|
318
|
+
Record<string, IRouteMeta>
|
|
319
|
+
>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Language } from 'prism-react-renderer';
|
|
2
|
+
import 'prism-themes/themes/prism-one-light.css';
|
|
3
|
+
import { type FC, type ReactNode } from 'react';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface ISourceCodeProps {
|
|
6
|
+
children: string;
|
|
7
|
+
lang: Language;
|
|
8
|
+
highlightLines?: number[];
|
|
9
|
+
extra?: ReactNode;
|
|
10
|
+
textarea?: ReactNode;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const SourceCode: FC<ISourceCodeProps>;
|
|
14
|
+
export default SourceCode;
|
|
@@ -25,33 +25,33 @@ import "./index.less";
|
|
|
25
25
|
function getTreeFromList(nodes) {
|
|
26
26
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
27
27
|
var data = [];
|
|
28
|
-
|
|
28
|
+
React.Children.toArray(nodes).forEach(function (node, i) {
|
|
29
|
+
if (! /*#__PURE__*/React.isValidElement(node)) return;
|
|
29
30
|
var key = "".concat(prefix ? "".concat(prefix, "-") : '').concat(i);
|
|
31
|
+
var children = node.props.children;
|
|
30
32
|
switch (node === null || node === void 0 ? void 0 : node.type) {
|
|
31
33
|
case 'ul':
|
|
32
34
|
{
|
|
33
35
|
var _data;
|
|
34
36
|
var parent = ((_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data.children) || data;
|
|
35
|
-
var ulLeafs = getTreeFromList(
|
|
37
|
+
var ulLeafs = getTreeFromList(children || [], key);
|
|
36
38
|
parent.push.apply(parent, _toConsumableArray(ulLeafs));
|
|
37
39
|
break;
|
|
38
40
|
}
|
|
39
41
|
case 'li':
|
|
40
42
|
{
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
var _child$props$children;
|
|
44
|
-
return child.type === 'ul' && !((_child$props$children = child.props.children) !== null && _child$props$children !== void 0 && _child$props$children.length);
|
|
43
|
+
var hasEmptyUl = React.Children.toArray(children).some(function (child) {
|
|
44
|
+
return /*#__PURE__*/React.isValidElement(child) && child.type === 'ul' && !React.Children.count(child.props.children);
|
|
45
45
|
});
|
|
46
|
-
var title =
|
|
47
|
-
return child.type !== 'ul';
|
|
46
|
+
var title = React.Children.toArray(children).filter(function (child) {
|
|
47
|
+
return ! /*#__PURE__*/React.isValidElement(child) || child.type !== 'ul';
|
|
48
48
|
});
|
|
49
|
-
var
|
|
49
|
+
var treeChildren = hasEmptyUl ? [] : getTreeFromList(children, key);
|
|
50
50
|
data.push({
|
|
51
51
|
title: title,
|
|
52
52
|
key: key,
|
|
53
|
-
children:
|
|
54
|
-
isLeaf: !hasEmptyUl && !
|
|
53
|
+
children: treeChildren,
|
|
54
|
+
isLeaf: !hasEmptyUl && !treeChildren.length,
|
|
55
55
|
switcherIcon: hasEmptyUl ? /*#__PURE__*/React.createElement("span", {
|
|
56
56
|
className: "tree-switcher-leaf-line"
|
|
57
57
|
}) : undefined
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useRouteMeta } from 'dumi';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type IContentTabs = ReturnType<typeof useRouteMeta>['tabs'];
|
|
5
|
+
export interface IContentTabsProps {
|
|
6
|
+
tabs: IContentTabs;
|
|
7
|
+
tabKey: string | null;
|
|
8
|
+
onChange: (tab?: NonNullable<IContentTabs>[0]) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const ContentTabs: FC<IContentTabsProps>;
|
|
11
|
+
export default ContentTabs;
|
|
@@ -27,11 +27,14 @@ var Header = function Header() {
|
|
|
27
27
|
var _useSiteData = useSiteData(),
|
|
28
28
|
themeConfig = _useSiteData.themeConfig;
|
|
29
29
|
var socialIcons = useMemo(function () {
|
|
30
|
-
|
|
30
|
+
var socialLinks = themeConfig.socialLinks;
|
|
31
|
+
return socialLinks ? Object.keys(socialLinks).slice(0, 5).map(function (key) {
|
|
31
32
|
return {
|
|
32
33
|
icon: key,
|
|
33
|
-
link:
|
|
34
|
+
link: socialLinks[key]
|
|
34
35
|
};
|
|
36
|
+
}).filter(function (item) {
|
|
37
|
+
return Boolean(item.link);
|
|
35
38
|
}) : [];
|
|
36
39
|
}, [themeConfig.socialLinks]);
|
|
37
40
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type IPreviewerProps } from 'dumi';
|
|
2
|
+
import type { TooltipProps as RcTooltipProps } from 'rc-tooltip/lib/Tooltip';
|
|
3
|
+
import React, { type FC, type ReactNode } from 'react';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface TooltipProps extends Omit<RcTooltipProps, 'overlay'> {
|
|
6
|
+
placement?: 'top' | 'bottom';
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface IPreviewerActionsProps extends IPreviewerProps {
|
|
10
|
+
/**
|
|
11
|
+
* disabled actions
|
|
12
|
+
*/
|
|
13
|
+
disabledActions?: ('CSB' | 'STACKBLITZ' | 'EXTERNAL' | 'HTML2SKETCH')[];
|
|
14
|
+
extra?: ReactNode;
|
|
15
|
+
forceShowCode?: boolean;
|
|
16
|
+
demoContainer: HTMLDivElement | HTMLIFrameElement;
|
|
17
|
+
onSourceTranspile?: (args: {
|
|
18
|
+
err: Error;
|
|
19
|
+
source?: null;
|
|
20
|
+
} | {
|
|
21
|
+
err?: null;
|
|
22
|
+
source: Record<string, string>;
|
|
23
|
+
}) => void;
|
|
24
|
+
onSourceChange?: (source: Record<string, string>) => void;
|
|
25
|
+
}
|
|
26
|
+
declare const PreviewerActions: FC<IPreviewerActionsProps>;
|
|
27
|
+
export default PreviewerActions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
|
+
export declare const Input: React.ForwardRefExoticComponent<{
|
|
4
|
+
onChange: (keywords: string) => void;
|
|
5
|
+
} & Pick<NativeInputProps, "onBlur" | "onFocus" | "onMouseEnter"> & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type useSiteSearch } from 'dumi';
|
|
2
|
+
import { type FC } from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type ISearchResult = ReturnType<typeof useSiteSearch>['result'];
|
|
5
|
+
declare const SearchResult: FC<{
|
|
6
|
+
data: ISearchResult;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
onItemSelect?: (item: ISearchResult[0]['hints'][0]) => void;
|
|
9
|
+
}>;
|
|
10
|
+
export default SearchResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SocialTypes } from '../../../dist/client/theme-api/types';
|
|
2
|
+
import { FunctionComponent, SVGProps, type FC } from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export type SocialIconProps = {
|
|
5
|
+
icon: SocialTypes;
|
|
6
|
+
link: string;
|
|
7
|
+
};
|
|
8
|
+
export type PresetSocialIcon = {
|
|
9
|
+
Icon: FunctionComponent<SVGProps<SVGSVGElement> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
}>;
|
|
12
|
+
titleIntlId: string;
|
|
13
|
+
};
|
|
14
|
+
declare const SocialIcon: FC<SocialIconProps>;
|
|
15
|
+
export default SocialIcon;
|