@xyd-js/plugins 0.0.0-build
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/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +1080 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
- package/src/index.ts +62 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +33 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 xyd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1080 @@
|
|
|
1
|
+
import { Plugin as Plugin$1 } from 'vite';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { UniformPlugin } from '@xyd-js/uniform';
|
|
5
|
+
|
|
6
|
+
type RawTheme = {
|
|
7
|
+
name?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
tokenColors?: ThemeSetting[];
|
|
10
|
+
colors?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
type ThemeSetting = {
|
|
16
|
+
name?: string;
|
|
17
|
+
scope?: string | string[];
|
|
18
|
+
settings: {
|
|
19
|
+
fontStyle?: string;
|
|
20
|
+
foreground?: string;
|
|
21
|
+
background?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
declare const THEME_NAMES: readonly ["dark-plus", "dracula-soft", "dracula", "github-dark", "github-dark-dimmed", "github-from-css", "github-light", "light-plus", "material-darker", "material-default", "material-from-css", "material-lighter", "material-ocean", "material-palenight", "min-dark", "min-light", "monokai", "nord", "one-dark-pro", "poimandres", "slack-dark", "slack-ochin", "solarized-dark", "solarized-light"];
|
|
25
|
+
type NamesTuple$1 = typeof THEME_NAMES;
|
|
26
|
+
type StringTheme = NamesTuple$1[number];
|
|
27
|
+
type Theme$1 = StringTheme | RawTheme;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Main settings interface for the application
|
|
31
|
+
*/
|
|
32
|
+
interface Settings {
|
|
33
|
+
/** Theme configuration for the application */
|
|
34
|
+
theme?: Theme;
|
|
35
|
+
/** Navigation configuration */
|
|
36
|
+
navigation?: Navigation;
|
|
37
|
+
/** API Docs configuration */
|
|
38
|
+
api?: API;
|
|
39
|
+
/** Integrations configuration */
|
|
40
|
+
integrations?: Integrations;
|
|
41
|
+
/** Plugins configuration */
|
|
42
|
+
plugins?: Plugins;
|
|
43
|
+
/**
|
|
44
|
+
* SEO configuration
|
|
45
|
+
*/
|
|
46
|
+
seo?: SEO;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*
|
|
50
|
+
* WebEditor configuration - building blocks for UI editing
|
|
51
|
+
*/
|
|
52
|
+
webeditor?: WebEditor;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* Components configuration
|
|
56
|
+
*/
|
|
57
|
+
components?: Components;
|
|
58
|
+
/** Engine configuration - advanced engine-like configuration */
|
|
59
|
+
engine?: Engine;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* Redirects configuration
|
|
63
|
+
*/
|
|
64
|
+
redirects?: Redirects[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Theme configuration that changes the look and feel of the project
|
|
68
|
+
*/
|
|
69
|
+
interface Theme {
|
|
70
|
+
/**
|
|
71
|
+
* A theme name.
|
|
72
|
+
*/
|
|
73
|
+
readonly name: ThemePresetName | (string & {});
|
|
74
|
+
/**
|
|
75
|
+
* Path to logo image or object with path to "light" and "dark" mode logo images, and where the logo links to.
|
|
76
|
+
*/
|
|
77
|
+
logo?: string | Logo | React.JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* Font configuration for the theme.
|
|
80
|
+
*/
|
|
81
|
+
fonts?: ThemeFont;
|
|
82
|
+
/**
|
|
83
|
+
* Path to the favicon image. For example: /path/to/favicon.svg
|
|
84
|
+
*/
|
|
85
|
+
favicon?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The iconify library setup.
|
|
88
|
+
*/
|
|
89
|
+
icons?: Icons;
|
|
90
|
+
/**
|
|
91
|
+
* Appearance configuration for the theme.
|
|
92
|
+
*/
|
|
93
|
+
appearance?: Appearance;
|
|
94
|
+
/**
|
|
95
|
+
* Writer configuration for the theme.
|
|
96
|
+
*/
|
|
97
|
+
writer?: Writer;
|
|
98
|
+
/**
|
|
99
|
+
* Coder configuration for the theme, including options like syntax highlighting.
|
|
100
|
+
*/
|
|
101
|
+
coder?: Coder;
|
|
102
|
+
/**
|
|
103
|
+
* Head configuration
|
|
104
|
+
*/
|
|
105
|
+
head?: HeadConfig[];
|
|
106
|
+
/**
|
|
107
|
+
* Custom scripts to be added to the head of the every page.
|
|
108
|
+
* Paths are relative to the root of the project or absolute.
|
|
109
|
+
*/
|
|
110
|
+
scripts?: Script[];
|
|
111
|
+
}
|
|
112
|
+
type ThemeFont = Font | Font[] | {
|
|
113
|
+
body?: Font | Font[];
|
|
114
|
+
coder?: Font | Font[];
|
|
115
|
+
};
|
|
116
|
+
interface Font {
|
|
117
|
+
/**
|
|
118
|
+
* The font family to use.
|
|
119
|
+
*/
|
|
120
|
+
family?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The font weight to use.
|
|
123
|
+
*/
|
|
124
|
+
weight?: string;
|
|
125
|
+
/**
|
|
126
|
+
* The font src to use.
|
|
127
|
+
*/
|
|
128
|
+
src?: string;
|
|
129
|
+
/**
|
|
130
|
+
* The font format to use.
|
|
131
|
+
*/
|
|
132
|
+
format?: "woff2" | "woff" | "ttf";
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Coder configuration for the theme, including options like syntax highlighting.
|
|
136
|
+
*/
|
|
137
|
+
interface Coder {
|
|
138
|
+
/**
|
|
139
|
+
* If `true` then code blocks will have line numbers by default.
|
|
140
|
+
*/
|
|
141
|
+
lines?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* If `true` then code blocks will have a scrollbar by default.
|
|
144
|
+
*/
|
|
145
|
+
scroll?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Syntax highlighting configuration.
|
|
148
|
+
*/
|
|
149
|
+
syntaxHighlight?: Theme$1;
|
|
150
|
+
}
|
|
151
|
+
interface Writer {
|
|
152
|
+
/**
|
|
153
|
+
* The maximum number of table of conten§ts levels.
|
|
154
|
+
*/
|
|
155
|
+
maxTocDepth?: number;
|
|
156
|
+
/**
|
|
157
|
+
* Copy page button
|
|
158
|
+
*/
|
|
159
|
+
copyPage?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Appearance configuration for the theme.
|
|
163
|
+
*/
|
|
164
|
+
interface Appearance {
|
|
165
|
+
/**
|
|
166
|
+
* The default color scheme to use.
|
|
167
|
+
*/
|
|
168
|
+
colorScheme?: "light" | "dark" | "os";
|
|
169
|
+
/**
|
|
170
|
+
* Colors configuration for the theme.
|
|
171
|
+
*/
|
|
172
|
+
colors?: Colors;
|
|
173
|
+
/**
|
|
174
|
+
* CSS tokens for the theme.
|
|
175
|
+
*/
|
|
176
|
+
cssTokens?: {
|
|
177
|
+
[token: string]: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Presets for the theme.
|
|
181
|
+
*/
|
|
182
|
+
presets?: string[];
|
|
183
|
+
/**
|
|
184
|
+
* Logo appearance for the theme.
|
|
185
|
+
*/
|
|
186
|
+
logo?: AppearanceLogo;
|
|
187
|
+
/**
|
|
188
|
+
* Search appearance for the theme.
|
|
189
|
+
*/
|
|
190
|
+
search?: AppearanceSearch;
|
|
191
|
+
/**
|
|
192
|
+
* Header appearance for the theme.
|
|
193
|
+
*/
|
|
194
|
+
header?: AppearanceHeader;
|
|
195
|
+
/**
|
|
196
|
+
* Tabs appearance for the theme.
|
|
197
|
+
*/
|
|
198
|
+
tabs?: AppearanceTabs;
|
|
199
|
+
/**
|
|
200
|
+
* Sidebar appearance for the theme.
|
|
201
|
+
*/
|
|
202
|
+
sidebar?: AppearanceSidebar;
|
|
203
|
+
/**
|
|
204
|
+
* Buttons appearance for the theme.
|
|
205
|
+
*/
|
|
206
|
+
buttons?: AppearanceButtons;
|
|
207
|
+
/**
|
|
208
|
+
* Table appearance for the theme.
|
|
209
|
+
*/
|
|
210
|
+
tables?: AppearanceTables;
|
|
211
|
+
/**
|
|
212
|
+
* Banner appearance for the theme.
|
|
213
|
+
*/
|
|
214
|
+
banner?: AppearanceBanner;
|
|
215
|
+
/**
|
|
216
|
+
* Content appearance for the theme.
|
|
217
|
+
*/
|
|
218
|
+
content?: AppearanceContent;
|
|
219
|
+
/**
|
|
220
|
+
* Footer appearance for the theme.
|
|
221
|
+
*/
|
|
222
|
+
footer?: AppearanceFooter;
|
|
223
|
+
}
|
|
224
|
+
interface Colors {
|
|
225
|
+
/**
|
|
226
|
+
* The primary color of the theme.
|
|
227
|
+
*/
|
|
228
|
+
primary: string;
|
|
229
|
+
/**
|
|
230
|
+
* The light color of the theme.
|
|
231
|
+
*/
|
|
232
|
+
light?: string;
|
|
233
|
+
/**
|
|
234
|
+
* The dark color of the theme.
|
|
235
|
+
*/
|
|
236
|
+
dark?: string;
|
|
237
|
+
}
|
|
238
|
+
interface AppearanceTabs {
|
|
239
|
+
/**
|
|
240
|
+
* The tabs to display in the header.
|
|
241
|
+
*/
|
|
242
|
+
surface?: "center" | "sidebar";
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* AppearanceLogo configuration for the theme.
|
|
246
|
+
*/
|
|
247
|
+
interface AppearanceLogo {
|
|
248
|
+
/**
|
|
249
|
+
* If `true` then the logo will be displayed on the sidebar.
|
|
250
|
+
*/
|
|
251
|
+
sidebar?: boolean | "mobile" | "desktop";
|
|
252
|
+
/**
|
|
253
|
+
* If `true` then the logo will be displayed on the header.
|
|
254
|
+
*/
|
|
255
|
+
header?: boolean | "mobile" | "desktop";
|
|
256
|
+
}
|
|
257
|
+
interface AppearanceContent {
|
|
258
|
+
/**
|
|
259
|
+
* Content decorator for the theme.
|
|
260
|
+
*/
|
|
261
|
+
contentDecorator?: "secondary";
|
|
262
|
+
/**
|
|
263
|
+
* If `true` then the breadcrumbs will be displayed.
|
|
264
|
+
*/
|
|
265
|
+
breadcrumbs?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* If `true` then the section separator will be displayed.
|
|
268
|
+
*/
|
|
269
|
+
sectionSeparator?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface AppearanceFooter {
|
|
272
|
+
/**
|
|
273
|
+
* The footer surface.
|
|
274
|
+
*/
|
|
275
|
+
surface?: "page";
|
|
276
|
+
}
|
|
277
|
+
interface AppearanceSearch {
|
|
278
|
+
/**
|
|
279
|
+
* If `true` then the search bar will be displayed as a full width.
|
|
280
|
+
*/
|
|
281
|
+
fullWidth?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* If `true` then the search bar will be displayed on the sidebar.
|
|
284
|
+
*/
|
|
285
|
+
sidebar?: boolean | "mobile" | "desktop";
|
|
286
|
+
/**
|
|
287
|
+
* If `true` then the search bar will be displayed in the middle of the header.
|
|
288
|
+
*/
|
|
289
|
+
middle?: boolean | "mobile" | "desktop";
|
|
290
|
+
/**
|
|
291
|
+
* If `true` then the search bar will be displayed on the right side of the header.
|
|
292
|
+
*/
|
|
293
|
+
right?: boolean | "mobile" | "desktop";
|
|
294
|
+
}
|
|
295
|
+
interface AppearanceHeader {
|
|
296
|
+
/**
|
|
297
|
+
* If `true` then the header external links will display an external arrow.
|
|
298
|
+
*/
|
|
299
|
+
externalArrow?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* If `right` then separator will be displayed on the right side of the header.
|
|
302
|
+
*/
|
|
303
|
+
separator?: "right";
|
|
304
|
+
/**
|
|
305
|
+
* The type of the header.
|
|
306
|
+
*/
|
|
307
|
+
type?: "classic" | "pad";
|
|
308
|
+
/**
|
|
309
|
+
* The button size of the header.
|
|
310
|
+
*/
|
|
311
|
+
buttonSize?: "sm" | "md" | "lg";
|
|
312
|
+
}
|
|
313
|
+
interface AppearanceSidebar {
|
|
314
|
+
/**
|
|
315
|
+
* If `true` then the sidebar will display a scroll shadow.
|
|
316
|
+
*/
|
|
317
|
+
externalArrow?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* If `true` then the sidebar will display a scroll shadow.
|
|
320
|
+
*/
|
|
321
|
+
scrollShadow?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* The color of the sidebar scrollbar.
|
|
324
|
+
*/
|
|
325
|
+
scrollbar?: "secondary";
|
|
326
|
+
/**
|
|
327
|
+
* The color of the sidebar scrollbar.
|
|
328
|
+
*/
|
|
329
|
+
scrollbarColor?: string;
|
|
330
|
+
/**
|
|
331
|
+
* The transition behaviour of the sidebar scroll when navigating to a new page.
|
|
332
|
+
*/
|
|
333
|
+
scrollTransition?: "smooth" | "instant";
|
|
334
|
+
}
|
|
335
|
+
interface AppearanceButtons {
|
|
336
|
+
rounded?: boolean | "lg" | "md" | "sm";
|
|
337
|
+
}
|
|
338
|
+
interface AppearanceTables {
|
|
339
|
+
/**
|
|
340
|
+
* The kind of the table.
|
|
341
|
+
*/
|
|
342
|
+
kind?: "secondary";
|
|
343
|
+
}
|
|
344
|
+
interface AppearanceBanner {
|
|
345
|
+
/**
|
|
346
|
+
* If `true` then the banner will have fixed position (always visible).
|
|
347
|
+
*/
|
|
348
|
+
fixed?: boolean;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Configuration type for head elements that can be added to the HTML head.
|
|
352
|
+
* Format: [tagName, attributes]
|
|
353
|
+
*
|
|
354
|
+
* @example: ['script', { src: 'https://example.com/script.js', defer: true }]
|
|
355
|
+
*/
|
|
356
|
+
type HeadConfig = [string, Record<string, string | boolean>, string?];
|
|
357
|
+
type Script = string;
|
|
358
|
+
/**
|
|
359
|
+
* Logo configuration interface
|
|
360
|
+
*/
|
|
361
|
+
interface Logo {
|
|
362
|
+
/** Path to the logo in light mode. For example: `/path/to/logo.svg` */
|
|
363
|
+
light?: string;
|
|
364
|
+
/** Path to the logo in dark mode. For example: `/path/to/logo.svg` */
|
|
365
|
+
dark?: string;
|
|
366
|
+
/** External href to when clicking on the logo */
|
|
367
|
+
href?: string;
|
|
368
|
+
/** The page to link to when clicking on the logo */
|
|
369
|
+
page?: string;
|
|
370
|
+
}
|
|
371
|
+
interface IconLibrary {
|
|
372
|
+
/** The iconify library name */
|
|
373
|
+
name: string;
|
|
374
|
+
/** The iconify library version */
|
|
375
|
+
version?: string;
|
|
376
|
+
/** The default iconify icon name */
|
|
377
|
+
default?: boolean;
|
|
378
|
+
/** Merge icons from the library into the default iconify library */
|
|
379
|
+
noprefix?: boolean;
|
|
380
|
+
}
|
|
381
|
+
interface Icons {
|
|
382
|
+
/** The iconify library */
|
|
383
|
+
library?: string | IconLibrary | (string | IconLibrary)[];
|
|
384
|
+
}
|
|
385
|
+
/** Available theme preset names */
|
|
386
|
+
type ThemePresetName = "poetry" | "cosmo" | "opener" | "picasso";
|
|
387
|
+
/**
|
|
388
|
+
* Navigation configuration interface
|
|
389
|
+
*/
|
|
390
|
+
interface Navigation {
|
|
391
|
+
/**
|
|
392
|
+
* Sidebar navigation - main navigation on the left side of the page.
|
|
393
|
+
*/
|
|
394
|
+
sidebar: SidebarNavigation;
|
|
395
|
+
/**
|
|
396
|
+
* Tabs navigation - navigation through tabs.
|
|
397
|
+
*/
|
|
398
|
+
tabs?: Tabs;
|
|
399
|
+
/**
|
|
400
|
+
* Sidebar dropdown navigation - navigation through dropdown in the sidebar.
|
|
401
|
+
*/
|
|
402
|
+
sidebarDropdown?: SidebarDropdown;
|
|
403
|
+
/**
|
|
404
|
+
* Segments navigation - navigation elements visible only on specific routes.
|
|
405
|
+
*/
|
|
406
|
+
segments?: Segment[];
|
|
407
|
+
/**
|
|
408
|
+
* Anchors navigation - fixed navigation, for anchor-like elements.
|
|
409
|
+
*/
|
|
410
|
+
anchors?: Anchors;
|
|
411
|
+
}
|
|
412
|
+
type SidebarDropdown = NavigationItem[];
|
|
413
|
+
/**
|
|
414
|
+
* Tabs configuration
|
|
415
|
+
*/
|
|
416
|
+
type Tabs = NavigationItem[];
|
|
417
|
+
/**
|
|
418
|
+
* Sidebar navigation type
|
|
419
|
+
*/
|
|
420
|
+
type SidebarNavigation = (SidebarRoute | Sidebar | string)[];
|
|
421
|
+
/**
|
|
422
|
+
* Sidebar route configuration
|
|
423
|
+
*/
|
|
424
|
+
interface SidebarRoute {
|
|
425
|
+
/** Route for this sidebar */
|
|
426
|
+
route: string;
|
|
427
|
+
/** The group of the route */
|
|
428
|
+
group?: string | false;
|
|
429
|
+
/** The id of the route */
|
|
430
|
+
id?: string;
|
|
431
|
+
/** Sidebar pages within this route or sub routes */
|
|
432
|
+
pages: Sidebar[] | SidebarRoute[];
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Sidebar configuration
|
|
436
|
+
*/
|
|
437
|
+
interface Sidebar {
|
|
438
|
+
/** The name of the group */
|
|
439
|
+
group?: string | false;
|
|
440
|
+
/**
|
|
441
|
+
* The relative paths to the markdown files that will serve as pages.
|
|
442
|
+
* Note: groups are recursive, so to add a sub-folder add another group object in the page array.
|
|
443
|
+
*/
|
|
444
|
+
pages?: PageURL[];
|
|
445
|
+
/**
|
|
446
|
+
* The icon of the group.
|
|
447
|
+
*/
|
|
448
|
+
icon?: string;
|
|
449
|
+
/**
|
|
450
|
+
* The order of the group.
|
|
451
|
+
*/
|
|
452
|
+
order?: Order;
|
|
453
|
+
}
|
|
454
|
+
type Order = 0 | -1 | {
|
|
455
|
+
after: string;
|
|
456
|
+
} | {
|
|
457
|
+
before: string;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Page URL type
|
|
461
|
+
*/
|
|
462
|
+
type PageURL = string | VirtualPage | Sidebar;
|
|
463
|
+
/**
|
|
464
|
+
* @internal
|
|
465
|
+
*
|
|
466
|
+
* Virtual page type
|
|
467
|
+
*
|
|
468
|
+
* Virtual pages are composition of pages, needed for templating e.g in uniform
|
|
469
|
+
*
|
|
470
|
+
* Example:
|
|
471
|
+
*
|
|
472
|
+
* {
|
|
473
|
+
* pages: [0
|
|
474
|
+
* ".xyd/.cache/.content/docs/rest/todo:docs/rest/todo",
|
|
475
|
+
* ]
|
|
476
|
+
* }
|
|
477
|
+
*
|
|
478
|
+
* above will be rendered as docs/rest/todo.md using composition from xyd's `.content`
|
|
479
|
+
*/
|
|
480
|
+
type VirtualPage = string | {
|
|
481
|
+
/** The virtual page to use for the page */
|
|
482
|
+
virtual: string;
|
|
483
|
+
/** The page to use for the page */
|
|
484
|
+
page: string;
|
|
485
|
+
/** The template to use for the page */
|
|
486
|
+
templates?: string | string[];
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* Segment configuration
|
|
490
|
+
*/
|
|
491
|
+
interface Segment {
|
|
492
|
+
/** Route for this segment */
|
|
493
|
+
route: string;
|
|
494
|
+
/** Title of this segment */
|
|
495
|
+
title?: string;
|
|
496
|
+
/** Appearance of this segment. If 'sidebarDropdown' then show this segment as a dropdown in the sidebar if match. */
|
|
497
|
+
appearance?: "sidebarDropdown";
|
|
498
|
+
/** Items within this segment */
|
|
499
|
+
pages: NavigationItem[];
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Core interface for navigation items
|
|
503
|
+
*/
|
|
504
|
+
interface NavigationItem {
|
|
505
|
+
/**
|
|
506
|
+
* The navigation item title
|
|
507
|
+
*/
|
|
508
|
+
title?: string;
|
|
509
|
+
/**
|
|
510
|
+
* The navigation item description
|
|
511
|
+
*/
|
|
512
|
+
description?: string;
|
|
513
|
+
/**
|
|
514
|
+
* The navigation page, if set it redirects to the page + matches based on routing
|
|
515
|
+
*/
|
|
516
|
+
page?: string;
|
|
517
|
+
/**
|
|
518
|
+
* The navigation href, if set it redirects but does not match based on routing
|
|
519
|
+
*/
|
|
520
|
+
href?: string;
|
|
521
|
+
/**
|
|
522
|
+
* The navigation item icon
|
|
523
|
+
*/
|
|
524
|
+
icon?: string | React.ReactNode;
|
|
525
|
+
}
|
|
526
|
+
type NavigationItemButton = NavigationItem & {
|
|
527
|
+
button: "primary" | "secondary";
|
|
528
|
+
};
|
|
529
|
+
type NavigationItemSocial = NavigationItem & {
|
|
530
|
+
social: Social;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* Anchor root configuration
|
|
534
|
+
*/
|
|
535
|
+
interface Anchors {
|
|
536
|
+
/** Header anchors */
|
|
537
|
+
header?: AnchorHeader[];
|
|
538
|
+
/** Sidebar anchors */
|
|
539
|
+
sidebar?: {
|
|
540
|
+
top?: NavigationItem[];
|
|
541
|
+
bottom?: NavigationItem[];
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
type AnchorHeader = NavigationItem | NavigationItemButton | NavigationItemSocial;
|
|
545
|
+
/**
|
|
546
|
+
* WebEditor navigation item configuration
|
|
547
|
+
*/
|
|
548
|
+
type WebEditorNavigationItem = NavigationItem & Partial<JSONComponent> & {
|
|
549
|
+
/**
|
|
550
|
+
* If `true` then the item will be displayed on mobile.
|
|
551
|
+
*/
|
|
552
|
+
mobile?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* If `true` then the item will be displayed on desktop.
|
|
555
|
+
*/
|
|
556
|
+
desktop?: boolean;
|
|
557
|
+
};
|
|
558
|
+
interface Components {
|
|
559
|
+
/**
|
|
560
|
+
* WebEditor banner configuration
|
|
561
|
+
*/
|
|
562
|
+
banner?: WebEditorBanner;
|
|
563
|
+
/**
|
|
564
|
+
* WebEditor footer configuration
|
|
565
|
+
*/
|
|
566
|
+
footer?: WebEditorFooter;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* WebEditor configuration
|
|
570
|
+
*/
|
|
571
|
+
interface WebEditor {
|
|
572
|
+
/**
|
|
573
|
+
* WebEditor header configuration
|
|
574
|
+
*/
|
|
575
|
+
sidebarTop?: WebEditorNavigationItem[];
|
|
576
|
+
/**
|
|
577
|
+
* WebEditor header configuration
|
|
578
|
+
*/
|
|
579
|
+
header?: WebEditorHeader[];
|
|
580
|
+
/**
|
|
581
|
+
* WebEditor header configuration
|
|
582
|
+
*/
|
|
583
|
+
subheader?: WebEditorSubHeader;
|
|
584
|
+
}
|
|
585
|
+
type Social = "x" | "facebook" | "youtube" | "discord" | "slack" | "github" | "linkedin" | "instagram" | "hackernews" | "medium" | "telegram" | "bluesky" | "reddit";
|
|
586
|
+
interface WebEditorFooter {
|
|
587
|
+
kind?: "minimal";
|
|
588
|
+
logo?: boolean | ComponentLike;
|
|
589
|
+
/** Footer socials */
|
|
590
|
+
social?: {
|
|
591
|
+
[K in Social]?: string;
|
|
592
|
+
};
|
|
593
|
+
/** Footer links */
|
|
594
|
+
links?: WebEditorFooterLinks;
|
|
595
|
+
/** Footer footnote */
|
|
596
|
+
footnote?: ComponentLike;
|
|
597
|
+
}
|
|
598
|
+
type WebEditorFooterLinks = WebEditorFooterLink[] | WebEditorFooterLinkItem[];
|
|
599
|
+
interface WebEditorFooterLink {
|
|
600
|
+
header: string;
|
|
601
|
+
items: WebEditorFooterLinkItem[];
|
|
602
|
+
}
|
|
603
|
+
type WebEditorFooterLinkItem = {
|
|
604
|
+
label: string;
|
|
605
|
+
href: string;
|
|
606
|
+
};
|
|
607
|
+
interface WebEditorBanner {
|
|
608
|
+
/**
|
|
609
|
+
* Banner content.
|
|
610
|
+
*/
|
|
611
|
+
content: ComponentLike;
|
|
612
|
+
/**
|
|
613
|
+
* Banner label.
|
|
614
|
+
*/
|
|
615
|
+
label?: string;
|
|
616
|
+
/**
|
|
617
|
+
* Banner kind.
|
|
618
|
+
*/
|
|
619
|
+
kind?: "secondary";
|
|
620
|
+
/**
|
|
621
|
+
* Banner href.
|
|
622
|
+
*/
|
|
623
|
+
href?: string;
|
|
624
|
+
/**
|
|
625
|
+
* Banner icon.
|
|
626
|
+
*/
|
|
627
|
+
icon?: string;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* WebEditor header configuration
|
|
631
|
+
*/
|
|
632
|
+
type WebEditorHeader = WebEditorNavigationItem & {
|
|
633
|
+
/** Float the header to the right */
|
|
634
|
+
float?: "right" | "center";
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* WebEditorSubHeader header configuration
|
|
638
|
+
*/
|
|
639
|
+
interface WebEditorSubHeader {
|
|
640
|
+
/** Items of this subheader */
|
|
641
|
+
items: WebEditorNavigationItem[];
|
|
642
|
+
/** Title of this segment */
|
|
643
|
+
title?: string;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* API Docs configuration interface
|
|
647
|
+
*/
|
|
648
|
+
interface API {
|
|
649
|
+
/**
|
|
650
|
+
* OpenAPI configuration
|
|
651
|
+
*/
|
|
652
|
+
openapi?: APIFile;
|
|
653
|
+
/**
|
|
654
|
+
* GraphQL configuration
|
|
655
|
+
*/
|
|
656
|
+
graphql?: APIFile;
|
|
657
|
+
/**
|
|
658
|
+
* Sources configuration
|
|
659
|
+
*/
|
|
660
|
+
sources?: APIFile;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* API file configuration. Can be a path, an array of paths, a map of paths, or an advanced configuration
|
|
664
|
+
*/
|
|
665
|
+
type APIFile = string | string[] | APIFileMap | APIFileAdvanced;
|
|
666
|
+
/**
|
|
667
|
+
* API file map type
|
|
668
|
+
*/
|
|
669
|
+
type APIFileMap = {
|
|
670
|
+
[name: string]: string | APIFileAdvanced;
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* API file advanced type
|
|
674
|
+
*/
|
|
675
|
+
type APIFileAdvanced = {
|
|
676
|
+
/** API information configuration */
|
|
677
|
+
info?: APIInfo;
|
|
678
|
+
/** Route configuration */
|
|
679
|
+
route: string;
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* API file type - can be a string, array of strings, or a map of strings
|
|
683
|
+
*/
|
|
684
|
+
/**
|
|
685
|
+
* API information configuration
|
|
686
|
+
*/
|
|
687
|
+
interface APIInfo {
|
|
688
|
+
/**
|
|
689
|
+
* The base url for all API endpoints. If baseUrl is an array, it will enable
|
|
690
|
+
* for multiple base url options that the user can toggle.
|
|
691
|
+
*/
|
|
692
|
+
baseUrl?: string;
|
|
693
|
+
/** Authentication information */
|
|
694
|
+
auth?: APIAuth;
|
|
695
|
+
/**
|
|
696
|
+
* The name of the authentication parameter used in the API playground.
|
|
697
|
+
* If method is basic, the format should be [usernameName]:[passwordName]
|
|
698
|
+
*/
|
|
699
|
+
name?: string;
|
|
700
|
+
/**
|
|
701
|
+
* The default value that's designed to be a prefisx for the authentication input field.
|
|
702
|
+
* E.g. If an inputPrefix of AuthKey would inherit the default input result of the authentication field as AuthKey.
|
|
703
|
+
*/
|
|
704
|
+
inputPrefix?: string;
|
|
705
|
+
/** Request configuration */
|
|
706
|
+
request?: APIInfoRequest;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* API authentication configuration
|
|
710
|
+
*/
|
|
711
|
+
interface APIAuth {
|
|
712
|
+
/** The authentication strategy used for all API endpoints */
|
|
713
|
+
method: "bearer" | "basic" | "key";
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* API request configuration
|
|
717
|
+
*/
|
|
718
|
+
interface APIInfoRequest {
|
|
719
|
+
/** Configurations for the auto-generated API request examples */
|
|
720
|
+
example?: {
|
|
721
|
+
/**
|
|
722
|
+
* An array of strings that determine the order of the languages of the auto-generated request examples.
|
|
723
|
+
* You can either define custom languages utilizing x-codeSamples or use our default languages which include
|
|
724
|
+
* bash, python, javascript, php, go, java
|
|
725
|
+
*/
|
|
726
|
+
languages?: string[];
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Integrations configuration
|
|
731
|
+
*/
|
|
732
|
+
interface Integrations {
|
|
733
|
+
/**
|
|
734
|
+
* Configurations to add third-party analytics integrations.
|
|
735
|
+
* See full list of supported analytics here.
|
|
736
|
+
*/
|
|
737
|
+
analytics?: IntegrationAnalytics;
|
|
738
|
+
/**
|
|
739
|
+
* Configurations to add third-party support integrations.
|
|
740
|
+
*/
|
|
741
|
+
support?: IntegrationSupport;
|
|
742
|
+
/**
|
|
743
|
+
* Configurations to add third-party search integrations.
|
|
744
|
+
* See full list of supported search here.
|
|
745
|
+
*/
|
|
746
|
+
search?: IntegrationSearch;
|
|
747
|
+
/**
|
|
748
|
+
* A/B testing configuration
|
|
749
|
+
*/
|
|
750
|
+
abtesting?: IntegrationABTesting;
|
|
751
|
+
/**
|
|
752
|
+
* Diagrams configuration
|
|
753
|
+
*/
|
|
754
|
+
diagrams?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* Custom apps directory.
|
|
757
|
+
*/
|
|
758
|
+
[".apps"]?: AppsDirectory;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Analytics configuration
|
|
762
|
+
*/
|
|
763
|
+
interface IntegrationAnalytics {
|
|
764
|
+
/** Livesession analytics configuration */
|
|
765
|
+
livesession?: IntegrationAnalyticsLiveSession;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Livesession analytics configuration
|
|
769
|
+
*/
|
|
770
|
+
interface IntegrationAnalyticsLiveSession {
|
|
771
|
+
/** Livesession's TrackID */
|
|
772
|
+
trackId: string;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Support configuration
|
|
776
|
+
*/
|
|
777
|
+
interface IntegrationSupport {
|
|
778
|
+
/** Chatwoot support configuration */
|
|
779
|
+
chatwoot?: IntegrationSupportChatwoot;
|
|
780
|
+
/** Intercom support configuration */
|
|
781
|
+
intercom?: IntegrationSupportIntercom;
|
|
782
|
+
/** Livechat support configuration */
|
|
783
|
+
livechat?: IntegrationSupportLivechat;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Chatwoot support configuration
|
|
787
|
+
*/
|
|
788
|
+
interface IntegrationSupportChatwoot {
|
|
789
|
+
/** Chatwoot website token */
|
|
790
|
+
websiteToken: string;
|
|
791
|
+
/** Chatwoot base URL */
|
|
792
|
+
baseURL?: string;
|
|
793
|
+
/** Chatwoot settings */
|
|
794
|
+
chatwootSettings?: JSON;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Intercom support configuration
|
|
798
|
+
*/
|
|
799
|
+
interface IntegrationSupportIntercom {
|
|
800
|
+
/** Intercom app ID */
|
|
801
|
+
appId: string;
|
|
802
|
+
/** Intercom API base */
|
|
803
|
+
apiBase?: string;
|
|
804
|
+
}
|
|
805
|
+
interface IntegrationSupportLivechat {
|
|
806
|
+
/** Livechat license ID */
|
|
807
|
+
licenseId: string;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Search configuration
|
|
811
|
+
*/
|
|
812
|
+
interface IntegrationSearch {
|
|
813
|
+
/** Algolia search configuration */
|
|
814
|
+
algolia?: {
|
|
815
|
+
/** Algolia application ID */
|
|
816
|
+
appId: string;
|
|
817
|
+
/** Algolia API key */
|
|
818
|
+
apiKey: string;
|
|
819
|
+
};
|
|
820
|
+
orama?: {
|
|
821
|
+
/** Orama endpoint */
|
|
822
|
+
endpoint: string;
|
|
823
|
+
/** Orama API key */
|
|
824
|
+
apiKey: string;
|
|
825
|
+
/** Orama suggestions */
|
|
826
|
+
suggestions?: string[];
|
|
827
|
+
} | boolean;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* A/B testing configuration
|
|
831
|
+
*/
|
|
832
|
+
interface IntegrationABTesting {
|
|
833
|
+
/**
|
|
834
|
+
* Context max age in milliseconds
|
|
835
|
+
*/
|
|
836
|
+
contextMaxAge?: number;
|
|
837
|
+
/**
|
|
838
|
+
* Context storage key used to store the context in the browser storage
|
|
839
|
+
*/
|
|
840
|
+
contextStorageKey?: string;
|
|
841
|
+
/**
|
|
842
|
+
* Providers configuration
|
|
843
|
+
*/
|
|
844
|
+
providers?: IntegrationABTestingProviders;
|
|
845
|
+
}
|
|
846
|
+
interface IntegrationABTestingProviders {
|
|
847
|
+
/**
|
|
848
|
+
* GrowthBook configuration
|
|
849
|
+
*/
|
|
850
|
+
growthbook?: IntegrationABTestingGrowthBook;
|
|
851
|
+
/**
|
|
852
|
+
* LaunchDarkly configuration
|
|
853
|
+
*/
|
|
854
|
+
launchdarkly?: IntegrationABTestingLaunchDarkly;
|
|
855
|
+
}
|
|
856
|
+
interface IntegrationABTestingGrowthBook {
|
|
857
|
+
/**
|
|
858
|
+
* GrowthBook API host
|
|
859
|
+
*/
|
|
860
|
+
apiHost: string;
|
|
861
|
+
/**
|
|
862
|
+
* GrowthBook client key
|
|
863
|
+
*/
|
|
864
|
+
clientKey: string;
|
|
865
|
+
}
|
|
866
|
+
interface IntegrationABTestingLaunchDarkly {
|
|
867
|
+
/**
|
|
868
|
+
* LaunchDarkly environment key
|
|
869
|
+
*/
|
|
870
|
+
env: string;
|
|
871
|
+
}
|
|
872
|
+
interface AppsDirectory {
|
|
873
|
+
/**
|
|
874
|
+
* Github star app configuration.
|
|
875
|
+
*/
|
|
876
|
+
githubStar?: IntegrationAppGithubStar;
|
|
877
|
+
/**
|
|
878
|
+
* Supademo app configuration.
|
|
879
|
+
*/
|
|
880
|
+
supademo?: IntegrationAppSupademo;
|
|
881
|
+
}
|
|
882
|
+
interface IntegrationAppGithubStar {
|
|
883
|
+
/**
|
|
884
|
+
* The title of the Github button
|
|
885
|
+
*/
|
|
886
|
+
title: string;
|
|
887
|
+
/**
|
|
888
|
+
* The label of the Github Button
|
|
889
|
+
*/
|
|
890
|
+
label?: string;
|
|
891
|
+
/**
|
|
892
|
+
* The href of the Github project
|
|
893
|
+
*/
|
|
894
|
+
href: string;
|
|
895
|
+
/**
|
|
896
|
+
* The data-show-count of the Github project
|
|
897
|
+
*/
|
|
898
|
+
dataShowCount?: boolean;
|
|
899
|
+
/**
|
|
900
|
+
* The data-icon of the Github button
|
|
901
|
+
*/
|
|
902
|
+
dataIcon?: string;
|
|
903
|
+
/**
|
|
904
|
+
* The data-size of the Github button
|
|
905
|
+
*/
|
|
906
|
+
dataSize?: string;
|
|
907
|
+
/**
|
|
908
|
+
* The aria-label of the Github button
|
|
909
|
+
*/
|
|
910
|
+
ariaLabel?: string;
|
|
911
|
+
}
|
|
912
|
+
interface IntegrationAppSupademo {
|
|
913
|
+
/**
|
|
914
|
+
* The Supademo API key
|
|
915
|
+
*/
|
|
916
|
+
apiKey: string;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Plugin configuration
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* 1)
|
|
923
|
+
* {
|
|
924
|
+
* plugins: [
|
|
925
|
+
* "livesession",
|
|
926
|
+
* ]
|
|
927
|
+
* }
|
|
928
|
+
*
|
|
929
|
+
* or 2)
|
|
930
|
+
* {
|
|
931
|
+
* plugins: [
|
|
932
|
+
* [
|
|
933
|
+
* "livesession",
|
|
934
|
+
* "accountID.websiteID",
|
|
935
|
+
* {
|
|
936
|
+
* keystrokes: true
|
|
937
|
+
* }
|
|
938
|
+
* ]
|
|
939
|
+
* ]
|
|
940
|
+
* }
|
|
941
|
+
*
|
|
942
|
+
* @example [audience:dev]
|
|
943
|
+
* You can also use the type to define the plugin config in your code:
|
|
944
|
+
*
|
|
945
|
+
* const livesessionPlugin: PluginConfig<"livesession", [string, { keystrokes: boolean }]> = [
|
|
946
|
+
* "livesession",
|
|
947
|
+
* "accountID.websiteID",
|
|
948
|
+
* {
|
|
949
|
+
* keystrokes: true
|
|
950
|
+
* }
|
|
951
|
+
* ]
|
|
952
|
+
*/
|
|
953
|
+
type Plugins = (string | PluginConfig$1)[];
|
|
954
|
+
type PluginConfig$1<PluginName extends string = string, PluginArgs extends unknown[] = unknown[]> = [PluginName, ...PluginArgs];
|
|
955
|
+
/**
|
|
956
|
+
* Redirects configuration
|
|
957
|
+
*/
|
|
958
|
+
interface Redirects {
|
|
959
|
+
/** Source path to redirect from */
|
|
960
|
+
source: string;
|
|
961
|
+
/** Destination path to redirect to */
|
|
962
|
+
destination: string;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* SEO configuration
|
|
966
|
+
*/
|
|
967
|
+
interface SEO {
|
|
968
|
+
/**
|
|
969
|
+
* Domain name
|
|
970
|
+
*/
|
|
971
|
+
domain?: string;
|
|
972
|
+
/**
|
|
973
|
+
* Meta tags
|
|
974
|
+
*/
|
|
975
|
+
metatags?: {
|
|
976
|
+
[tag: string]: string;
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Engine configuration
|
|
981
|
+
*/
|
|
982
|
+
interface Engine {
|
|
983
|
+
/**
|
|
984
|
+
* Path aliases for imports. Avoid long relative paths by creating shortcuts.
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```json
|
|
988
|
+
* {
|
|
989
|
+
* "paths": {
|
|
990
|
+
* "@my-package/*": ["../my-package/src/*"],
|
|
991
|
+
* "@livesession-go/*": ["https://github.com/livesession/livesession-go/*"]
|
|
992
|
+
* }
|
|
993
|
+
* }
|
|
994
|
+
* ```
|
|
995
|
+
*
|
|
996
|
+
* Usage:
|
|
997
|
+
* ```typescript
|
|
998
|
+
* // Instead of
|
|
999
|
+
* @importCode("../../../my-package/src/components/Badge.tsx")
|
|
1000
|
+
*
|
|
1001
|
+
* // Use
|
|
1002
|
+
* @importCode("@my-package/src/components/Badge.tsx")
|
|
1003
|
+
* ```
|
|
1004
|
+
*/
|
|
1005
|
+
paths?: EnginePaths;
|
|
1006
|
+
/**
|
|
1007
|
+
*
|
|
1008
|
+
* Uniform configuration
|
|
1009
|
+
*
|
|
1010
|
+
*/
|
|
1011
|
+
uniform?: EngineUniform;
|
|
1012
|
+
}
|
|
1013
|
+
type EnginePaths = {
|
|
1014
|
+
[key: string]: string[];
|
|
1015
|
+
};
|
|
1016
|
+
type EngineUniform = {
|
|
1017
|
+
/**
|
|
1018
|
+
* If `true` then virtual pages will not created and generated content will be stored on disk
|
|
1019
|
+
*/
|
|
1020
|
+
store?: boolean;
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* JSON representation of a component.
|
|
1024
|
+
*/
|
|
1025
|
+
interface JSONComponent {
|
|
1026
|
+
/**
|
|
1027
|
+
* The component type, e.g. "Button", "Card", etc.
|
|
1028
|
+
*/
|
|
1029
|
+
component: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* The component's children, which can be a string, an array of strings, or an array of JSONComponent objects.
|
|
1032
|
+
*/
|
|
1033
|
+
props?: Record<string, any>;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* A type that can be used to represent a component-like structure.
|
|
1037
|
+
*/
|
|
1038
|
+
type ComponentLike = React.JSX.Element | JSONComponent | string;
|
|
1039
|
+
|
|
1040
|
+
type PluginComponents = {
|
|
1041
|
+
component: React__default.ComponentType<any>;
|
|
1042
|
+
name?: string;
|
|
1043
|
+
dist?: string;
|
|
1044
|
+
}[] | {
|
|
1045
|
+
[component: string]: React__default.ComponentType<any>;
|
|
1046
|
+
};
|
|
1047
|
+
/**
|
|
1048
|
+
* Plugin interface
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```ts
|
|
1052
|
+
* function myPlugin(): Plugin {
|
|
1053
|
+
* return {
|
|
1054
|
+
* name: "my-plugin",
|
|
1055
|
+
* vite: [
|
|
1056
|
+
* {
|
|
1057
|
+
* name: "my-vite-plugin",
|
|
1058
|
+
* }
|
|
1059
|
+
* ],
|
|
1060
|
+
* uniform: [
|
|
1061
|
+
* pluginOpenAIMeta,
|
|
1062
|
+
* ],
|
|
1063
|
+
* atlas: {
|
|
1064
|
+
* components: {
|
|
1065
|
+
* }
|
|
1066
|
+
* }
|
|
1067
|
+
* }
|
|
1068
|
+
* }
|
|
1069
|
+
* ```
|
|
1070
|
+
*/
|
|
1071
|
+
interface PluginConfig {
|
|
1072
|
+
name: string;
|
|
1073
|
+
vite?: Plugin$1[];
|
|
1074
|
+
uniform?: UniformPlugin<any>[];
|
|
1075
|
+
components?: PluginComponents;
|
|
1076
|
+
head?: HeadConfig[];
|
|
1077
|
+
}
|
|
1078
|
+
type Plugin = (settings: Readonly<Settings>) => PluginConfig;
|
|
1079
|
+
|
|
1080
|
+
export type { Plugin, PluginComponents, PluginConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xyd-js/plugins",
|
|
3
|
+
"version": "0.0.0-build+6952c2c-20250813013245",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./package.json": "./package.json",
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@xyd-js/uniform": "0.0.0-build+6952c2c-20250813013245"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@xyd-js/framework": "0.0.0-build+6952c2c-20250813013245"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
21
|
+
"vite": "^7.0.0",
|
|
22
|
+
"vitest": "^1.3.1",
|
|
23
|
+
"rimraf": "^3.0.2",
|
|
24
|
+
"tsup": "^8.3.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf build",
|
|
28
|
+
"prebuild": "pnpm clean",
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"test": "vitest",
|
|
31
|
+
"test:coverage": "vitest run --coverage"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type {Plugin as Vite} from "vite"
|
|
2
|
+
import React from "react"
|
|
3
|
+
|
|
4
|
+
import {type UniformPlugin as Uniform} from "@xyd-js/uniform"
|
|
5
|
+
import {HeadConfig, Settings} from "@xyd-js/core"
|
|
6
|
+
import type {SurfaceTarget} from "@xyd-js/framework"
|
|
7
|
+
|
|
8
|
+
// // TODO: share with theme-api ?
|
|
9
|
+
// export interface PluginCustomComponents {
|
|
10
|
+
// component: React.ComponentType<any>
|
|
11
|
+
// surface: SurfaceTarget
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
export type PluginComponents = {
|
|
15
|
+
component: React.ComponentType<any>,
|
|
16
|
+
name?: string,
|
|
17
|
+
dist?: string // TODO: fix in the future
|
|
18
|
+
}[] | {
|
|
19
|
+
[component: string]: React.ComponentType<any>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Plugin interface
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* function myPlugin(): Plugin {
|
|
28
|
+
* return {
|
|
29
|
+
* name: "my-plugin",
|
|
30
|
+
* vite: [
|
|
31
|
+
* {
|
|
32
|
+
* name: "my-vite-plugin",
|
|
33
|
+
* }
|
|
34
|
+
* ],
|
|
35
|
+
* uniform: [
|
|
36
|
+
* pluginOpenAIMeta,
|
|
37
|
+
* ],
|
|
38
|
+
* atlas: {
|
|
39
|
+
* components: {
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export interface PluginConfig {
|
|
47
|
+
name: string
|
|
48
|
+
|
|
49
|
+
vite?: Vite[]
|
|
50
|
+
uniform?: Uniform<any>[] // TODO: fix any
|
|
51
|
+
components?: PluginComponents
|
|
52
|
+
head?: HeadConfig[]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type Plugin = (settings: Readonly<Settings>) => PluginConfig
|
|
56
|
+
|
|
57
|
+
// atlas?: { // TODO: in the future
|
|
58
|
+
// components?: any
|
|
59
|
+
// }
|
|
60
|
+
// customComponents?: {
|
|
61
|
+
// [name: string]: PluginCustomComponents
|
|
62
|
+
// },
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"incremental": false,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "preserve",
|
|
17
|
+
"plugins": [],
|
|
18
|
+
"strictNullChecks": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
21
|
+
"exclude": ["node_modules"]
|
|
22
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {copyFile} from 'node:fs/promises';
|
|
2
|
+
import {join} from 'node:path';
|
|
3
|
+
|
|
4
|
+
import {defineConfig, Options} from 'tsup';
|
|
5
|
+
|
|
6
|
+
import pkg from './package.json';
|
|
7
|
+
|
|
8
|
+
const deps = [
|
|
9
|
+
// ...Object.keys(pkg.dependencies || {}),
|
|
10
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
11
|
+
]
|
|
12
|
+
const config: Options = {
|
|
13
|
+
entry: {
|
|
14
|
+
index: 'src/index.ts',
|
|
15
|
+
},
|
|
16
|
+
dts: {
|
|
17
|
+
entry: {
|
|
18
|
+
index: 'src/index.ts',
|
|
19
|
+
},
|
|
20
|
+
resolve: true, // Resolve external types
|
|
21
|
+
},
|
|
22
|
+
format: ['esm'],
|
|
23
|
+
platform: 'node',
|
|
24
|
+
shims: false,
|
|
25
|
+
splitting: false,
|
|
26
|
+
sourcemap: true,
|
|
27
|
+
clean: true,
|
|
28
|
+
external: [
|
|
29
|
+
...deps,
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default defineConfig(config);
|