1 | import type { ExampleBlockAsset } from 'dumi-assets-types';
|
2 | import type { ComponentType, ReactNode } from 'react';
|
3 | export interface IPreviewerProps {
|
4 | |
5 |
|
6 |
|
7 | title?: string;
|
8 | |
9 |
|
10 |
|
11 | description?: string;
|
12 | |
13 |
|
14 |
|
15 | filename?: string;
|
16 | |
17 |
|
18 |
|
19 | iframe?: boolean | number;
|
20 | |
21 |
|
22 |
|
23 | debug?: boolean;
|
24 | |
25 |
|
26 |
|
27 | defaultShowCode?: boolean;
|
28 | |
29 |
|
30 |
|
31 | demoUrl: string;
|
32 | |
33 |
|
34 |
|
35 | compact?: boolean;
|
36 | |
37 |
|
38 |
|
39 | transform?: boolean;
|
40 | |
41 |
|
42 |
|
43 | background?: string;
|
44 | |
45 |
|
46 |
|
47 | asset: ExampleBlockAsset;
|
48 | |
49 |
|
50 |
|
51 | children: ReactNode;
|
52 | [key: string]: any;
|
53 | }
|
54 | export interface IRouteMeta {
|
55 | frontmatter: {
|
56 | title: string;
|
57 | description?: string;
|
58 | keywords?: string[];
|
59 | nav?: string | {
|
60 | title?: string;
|
61 | order?: number;
|
62 | second?: Omit<IRouteMeta['frontmatter']['nav'], 'second'>;
|
63 | };
|
64 | group?: string | {
|
65 | title?: string;
|
66 | order?: number;
|
67 | };
|
68 | order?: number;
|
69 | hero?: {
|
70 | title?: string;
|
71 | description?: string;
|
72 | background?: string;
|
73 | actions?: {
|
74 | text: string;
|
75 | link: string;
|
76 | }[];
|
77 | [key: string]: any;
|
78 | };
|
79 | features?: {
|
80 | emoji?: string;
|
81 | title?: string;
|
82 | link?: string;
|
83 | description?: string;
|
84 | [key: string]: any;
|
85 | }[];
|
86 | toc?: boolean | 'content' | 'menu';
|
87 | demo?: {
|
88 | cols?: number;
|
89 | tocDepth?: number;
|
90 | };
|
91 | atomId?: string;
|
92 | filename?: string;
|
93 | lastUpdated?: number;
|
94 | debug?: boolean;
|
95 | |
96 |
|
97 |
|
98 |
|
99 | sidebar?: boolean;
|
100 | [key: string]: any;
|
101 | };
|
102 | toc: {
|
103 | id: string;
|
104 | depth: number;
|
105 | title: string;
|
106 | |
107 |
|
108 |
|
109 | _debug_demo?: boolean;
|
110 | }[];
|
111 | texts: {
|
112 | type?: 'content';
|
113 | value: string;
|
114 | |
115 |
|
116 |
|
117 | paraId: number;
|
118 | |
119 |
|
120 |
|
121 | tocIndex?: number;
|
122 | }[];
|
123 | tabs?: {
|
124 | key: string;
|
125 | title?: string;
|
126 | titleIntlId?: string;
|
127 | components: {
|
128 | default: ComponentType;
|
129 | Extra: ComponentType;
|
130 | Action: ComponentType;
|
131 | };
|
132 | meta: {
|
133 | frontmatter: Omit<IRouteMeta['frontmatter'], 'description' | 'keywords' | 'nav' | 'group' | 'hero' | 'features'>;
|
134 | toc: IRouteMeta['toc'];
|
135 | texts: IRouteMeta['texts'];
|
136 | [key: string]: any;
|
137 | };
|
138 | }[];
|
139 | |
140 |
|
141 |
|
142 | _atom_route?: boolean;
|
143 | }
|
144 | type IBasicLocale = {
|
145 | id: string;
|
146 | name: string;
|
147 | };
|
148 | export type ILocale = (IBasicLocale & {
|
149 | base: string;
|
150 | }) | (IBasicLocale & {
|
151 | suffix: string;
|
152 | });
|
153 | export type ILocalesConfig = ILocale[];
|
154 | export interface INavItem {
|
155 | title: string;
|
156 | link?: string;
|
157 | order?: number;
|
158 | activePath?: string;
|
159 | [key: string]: any;
|
160 | }
|
161 | export interface ISidebarItem {
|
162 | title: string;
|
163 | link: string;
|
164 | order?: number;
|
165 | frontmatter?: IRouteMeta['frontmatter'];
|
166 | [key: string]: any;
|
167 | }
|
168 | export interface ISidebarGroup {
|
169 | title?: string;
|
170 | children: ISidebarItem[];
|
171 | [key: string]: any;
|
172 | }
|
173 | export type SocialTypes = 'github' | 'weibo' | 'twitter' | 'gitlab' | 'facebook' | 'zhihu' | 'yuque' | 'linkedin';
|
174 | export type INavItems = (INavItem & {
|
175 | children?: INavItem[];
|
176 | })[];
|
177 | export type INav = INavItems | Record<string, INavItems>;
|
178 | type IUserNavItem = Pick<INavItem, 'title' | 'link' | 'activePath'>;
|
179 | export type IUserNavMode = 'override' | 'append' | 'prepend';
|
180 | export type IUserNavItems = (IUserNavItem & {
|
181 | children?: IUserNavItem[];
|
182 | })[];
|
183 | export type IUserNavValue = IUserNavItems | Record<string, IUserNavItems>;
|
184 | export type NavWithMode<T extends IUserNavValue> = {
|
185 | |
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | mode: IUserNavMode;
|
193 | value: T;
|
194 | };
|
195 | export interface IThemeConfig {
|
196 | name?: string;
|
197 | logo?: string | false;
|
198 | nav?: IUserNavValue | NavWithMode<IUserNavValue>;
|
199 | sidebar?: Record<string, ISidebarGroup[]>;
|
200 | footer?: string | false;
|
201 | showLineNum?: boolean;
|
202 | prefersColor: {
|
203 | default: 'light' | 'dark' | 'auto';
|
204 | switch: boolean;
|
205 | };
|
206 | nprogress?: boolean;
|
207 | socialLinks?: {
|
208 | [key in SocialTypes]?: string;
|
209 | };
|
210 | editLink?: boolean | string;
|
211 | lastUpdated?: boolean;
|
212 | [key: string]: any;
|
213 | }
|
214 | export type IRoutesById = Record<string, {
|
215 | path?: string;
|
216 | parentId?: string;
|
217 | meta?: IRouteMeta;
|
218 | id: string;
|
219 | redirect?: string;
|
220 | [key: string]: any;
|
221 | }>;
|
222 | export {};
|