@xyd-js/core 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.
@@ -0,0 +1,1337 @@
1
+ import * as React from "react";
2
+
3
+ import type { Theme as SyntaxHighlight } from "@code-hike/lighter";
4
+
5
+ /**
6
+ * Main settings interface for the application
7
+ */
8
+ export interface Settings {
9
+ /** Theme configuration for the application */
10
+ theme?: Theme
11
+
12
+ /** Navigation configuration */
13
+ navigation?: Navigation
14
+
15
+ /** API Docs configuration */
16
+ api?: API
17
+
18
+ /** Integrations configuration */
19
+ integrations?: Integrations
20
+
21
+ /** Plugins configuration */
22
+ plugins?: Plugins
23
+
24
+ /**
25
+ * SEO configuration
26
+ */
27
+ seo?: SEO
28
+
29
+ /**
30
+ * @internal
31
+ *
32
+ * WebEditor configuration - building blocks for UI editing
33
+ */
34
+ webeditor?: WebEditor
35
+
36
+ /**
37
+ *
38
+ * Components configuration
39
+ */
40
+ components?: Components
41
+
42
+ /** Engine configuration - advanced engine-like configuration */
43
+ engine?: Engine
44
+
45
+ /**
46
+ * @internal
47
+ * Redirects configuration
48
+ */
49
+ redirects?: Redirects[]
50
+ }
51
+
52
+ // ------ START settings for theme START ------
53
+ // #region Theme
54
+ /**
55
+ * Theme configuration that changes the look and feel of the project
56
+ */
57
+ export interface Theme {
58
+ /**
59
+ * A theme name.
60
+ */
61
+ readonly name: ThemePresetName | (string & {})
62
+
63
+ /**
64
+ * Path to logo image or object with path to "light" and "dark" mode logo images, and where the logo links to.
65
+ */
66
+ logo?: string | Logo | React.JSX.Element
67
+
68
+ /**
69
+ * Font configuration for the theme.
70
+ */
71
+ fonts?: ThemeFont
72
+
73
+ /**
74
+ * Path to the favicon image. For example: /path/to/favicon.svg
75
+ */
76
+ favicon?: string;
77
+
78
+ /**
79
+ * The iconify library setup.
80
+ */
81
+ icons?: Icons
82
+
83
+ /**
84
+ * Appearance configuration for the theme.
85
+ */
86
+ appearance?: Appearance
87
+
88
+ /**
89
+ * Writer configuration for the theme.
90
+ */
91
+ writer?: Writer
92
+
93
+ /**
94
+ * Coder configuration for the theme, including options like syntax highlighting.
95
+ */
96
+ coder?: Coder
97
+
98
+ /**
99
+ * Head configuration
100
+ */
101
+ head?: HeadConfig[]
102
+
103
+ /**
104
+ * Custom scripts to be added to the head of the every page.
105
+ * Paths are relative to the root of the project or absolute.
106
+ */
107
+ scripts?: Script[]
108
+ }
109
+
110
+ export type ThemeFont = Font | Font[] | {
111
+ body?: Font | Font[]
112
+ coder?: Font | Font[]
113
+ }
114
+ // #endregion Theme
115
+
116
+ export interface Font {
117
+ /**
118
+ * The font family to use.
119
+ */
120
+ family?: string;
121
+
122
+ /**
123
+ * The font weight to use.
124
+ */
125
+ weight?: string;
126
+
127
+ /**
128
+ * The font src to use.
129
+ */
130
+ src?: string;
131
+
132
+ /**
133
+ * The font format to use.
134
+ */
135
+ format?: "woff2" | "woff" | "ttf"
136
+ }
137
+
138
+ /**
139
+ * Coder configuration for the theme, including options like syntax highlighting.
140
+ */
141
+ export interface Coder {
142
+ /**
143
+ * If `true` then code blocks will have line numbers by default.
144
+ */
145
+ lines?: boolean
146
+
147
+ /**
148
+ * If `true` then code blocks will have a scrollbar by default.
149
+ */
150
+ scroll?: boolean
151
+
152
+ /**
153
+ * Syntax highlighting configuration.
154
+ */
155
+ syntaxHighlight?: SyntaxHighlight
156
+ }
157
+
158
+ export interface Writer {
159
+ /**
160
+ * The maximum number of table of conten§ts levels.
161
+ */
162
+ maxTocDepth?: number
163
+
164
+ /**
165
+ * Copy page button
166
+ */
167
+ copyPage?: boolean
168
+ }
169
+
170
+ /**
171
+ * Appearance configuration for the theme.
172
+ */
173
+ export interface Appearance {
174
+ /**
175
+ * The default color scheme to use.
176
+ */
177
+ colorScheme?: "light" | "dark" | "os"
178
+
179
+ /**
180
+ * Colors configuration for the theme.
181
+ */
182
+ colors?: Colors
183
+
184
+ /**
185
+ * CSS tokens for the theme.
186
+ */
187
+ cssTokens?: { [token: string]: string }
188
+
189
+ // TODO: global and theme presets?
190
+ /**
191
+ * Presets for the theme.
192
+ */
193
+ presets?: string[]
194
+
195
+ /**
196
+ * Logo appearance for the theme.
197
+ */
198
+ logo?: AppearanceLogo
199
+
200
+ /**
201
+ * Search appearance for the theme.
202
+ */
203
+ search?: AppearanceSearch
204
+
205
+ /**
206
+ * Header appearance for the theme.
207
+ */
208
+ header?: AppearanceHeader
209
+
210
+ /**
211
+ * Tabs appearance for the theme.
212
+ */
213
+ tabs?: AppearanceTabs
214
+
215
+ /**
216
+ * Sidebar appearance for the theme.
217
+ */
218
+ sidebar?: AppearanceSidebar
219
+
220
+ /**
221
+ * Buttons appearance for the theme.
222
+ */
223
+ buttons?: AppearanceButtons
224
+
225
+ /**
226
+ * Table appearance for the theme.
227
+ */
228
+ tables?: AppearanceTables
229
+
230
+ /**
231
+ * Banner appearance for the theme.
232
+ */
233
+ banner?: AppearanceBanner
234
+
235
+ /**
236
+ * Content appearance for the theme.
237
+ */
238
+ content?: AppearanceContent
239
+
240
+ /**
241
+ * Footer appearance for the theme.
242
+ */
243
+ footer?: AppearanceFooter
244
+ }
245
+
246
+ export interface Colors {
247
+ /**
248
+ * The primary color of the theme.
249
+ */
250
+ primary: string
251
+
252
+ /**
253
+ * The light color of the theme.
254
+ */
255
+ light?: string
256
+
257
+ /**
258
+ * The dark color of the theme.
259
+ */
260
+ dark?: string
261
+ }
262
+
263
+ export interface AppearanceTabs {
264
+ /**
265
+ * The tabs to display in the header.
266
+ */
267
+ surface?: "center" | "sidebar"
268
+ }
269
+
270
+ /**
271
+ * AppearanceLogo configuration for the theme.
272
+ */
273
+ export interface AppearanceLogo {
274
+ /**
275
+ * If `true` then the logo will be displayed on the sidebar.
276
+ */
277
+ sidebar?: boolean | "mobile" | "desktop"
278
+
279
+ /**
280
+ * If `true` then the logo will be displayed on the header.
281
+ */
282
+ header?: boolean | "mobile" | "desktop"
283
+ }
284
+
285
+ export interface AppearanceContent {
286
+ /**
287
+ * Content decorator for the theme.
288
+ */
289
+ contentDecorator?: "secondary"
290
+
291
+ /**
292
+ * If `true` then the breadcrumbs will be displayed.
293
+ */
294
+ breadcrumbs?: boolean
295
+
296
+ /**
297
+ * If `true` then the section separator will be displayed.
298
+ */
299
+ sectionSeparator?: boolean;
300
+ }
301
+
302
+ export interface AppearanceFooter {
303
+ /**
304
+ * The footer surface.
305
+ */
306
+ surface?: "page"
307
+ }
308
+
309
+ export interface AppearanceSearch {
310
+ /**
311
+ * If `true` then the search bar will be displayed as a full width.
312
+ */
313
+ fullWidth?: boolean
314
+
315
+ /**
316
+ * If `true` then the search bar will be displayed on the sidebar.
317
+ */
318
+ sidebar?: boolean | "mobile" | "desktop"
319
+
320
+ /**
321
+ * If `true` then the search bar will be displayed in the middle of the header.
322
+ */
323
+ middle?: boolean | "mobile" | "desktop"
324
+
325
+ /**
326
+ * If `true` then the search bar will be displayed on the right side of the header.
327
+ */
328
+ right?: boolean | "mobile" | "desktop"
329
+ }
330
+
331
+ export interface AppearanceHeader {
332
+ /**
333
+ * If `true` then the header external links will display an external arrow.
334
+ */
335
+ externalArrow?: boolean
336
+
337
+ /**
338
+ * If `right` then separator will be displayed on the right side of the header.
339
+ */
340
+ separator?: "right"
341
+
342
+ /**
343
+ * The type of the header.
344
+ */
345
+ type?: "classic" | "pad"
346
+
347
+ /**
348
+ * The button size of the header.
349
+ */
350
+ buttonSize?: "sm" | "md" | "lg"
351
+ }
352
+
353
+ export interface AppearanceSidebar {
354
+ /**
355
+ * If `true` then the sidebar will display a scroll shadow.
356
+ */
357
+ externalArrow?: boolean
358
+
359
+ /**
360
+ * If `true` then the sidebar will display a scroll shadow.
361
+ */
362
+ scrollShadow?: boolean
363
+
364
+ /**
365
+ * The color of the sidebar scrollbar.
366
+ */
367
+ scrollbar?: "secondary"
368
+
369
+ /**
370
+ * The color of the sidebar scrollbar.
371
+ */
372
+ scrollbarColor?: string
373
+
374
+ /**
375
+ * The transition behaviour of the sidebar scroll when navigating to a new page.
376
+ */
377
+ scrollTransition?: "smooth" | "instant"
378
+ }
379
+
380
+ export interface AppearanceButtons {
381
+ rounded?: boolean | "lg" | "md" | "sm"
382
+ }
383
+
384
+ export interface AppearanceTables {
385
+ /**
386
+ * The kind of the table.
387
+ */
388
+ kind?: "secondary"
389
+ }
390
+
391
+ export interface AppearanceBanner {
392
+ /**
393
+ * If `true` then the banner will have fixed position (always visible).
394
+ */
395
+ fixed?: boolean
396
+ }
397
+
398
+ /**
399
+ * Configuration type for head elements that can be added to the HTML head.
400
+ * Format: [tagName, attributes]
401
+ *
402
+ * @example: ['script', { src: 'https://example.com/script.js', defer: true }]
403
+ */
404
+ export type HeadConfig =
405
+ | [string, Record<string, string | boolean>, string?]
406
+
407
+ export type Script = string
408
+
409
+ /**
410
+ * Logo configuration interface
411
+ */
412
+ export interface Logo {
413
+ /** Path to the logo in light mode. For example: `/path/to/logo.svg` */
414
+ light?: string;
415
+
416
+ /** Path to the logo in dark mode. For example: `/path/to/logo.svg` */
417
+ dark?: string;
418
+
419
+ /** External href to when clicking on the logo */
420
+ href?: string;
421
+
422
+ /** The page to link to when clicking on the logo */
423
+ page?: string
424
+ }
425
+
426
+ export interface IconLibrary {
427
+ /** The iconify library name */
428
+ name: string
429
+
430
+ /** The iconify library version */
431
+ version?: string
432
+
433
+ /** The default iconify icon name */
434
+ default?: boolean
435
+
436
+ /** Merge icons from the library into the default iconify library */
437
+ noprefix?: boolean
438
+ }
439
+
440
+ export interface Icons {
441
+ /** The iconify library */
442
+ library?: string | IconLibrary | (string | IconLibrary)[]
443
+ }
444
+
445
+ /** Available theme preset names */
446
+ export type ThemePresetName = "poetry" | "cosmo" | "opener" | "picasso"
447
+
448
+ /** Search bar location options */
449
+ export type SearchType = "side" | "top"
450
+
451
+ // ------ END settings for theme END ------
452
+
453
+
454
+ // ------ START settings for navigation START ------
455
+ /**
456
+ * Navigation configuration interface
457
+ */
458
+ export interface Navigation {
459
+ /**
460
+ * Sidebar navigation - main navigation on the left side of the page.
461
+ */
462
+ sidebar: SidebarNavigation
463
+
464
+ /**
465
+ * Tabs navigation - navigation through tabs.
466
+ */
467
+ tabs?: Tabs
468
+
469
+ /**
470
+ * Sidebar dropdown navigation - navigation through dropdown in the sidebar.
471
+ */
472
+ sidebarDropdown?: SidebarDropdown
473
+
474
+ /**
475
+ * Segments navigation - navigation elements visible only on specific routes.
476
+ */
477
+ segments?: Segment[]
478
+
479
+ /**
480
+ * Anchors navigation - fixed navigation, for anchor-like elements.
481
+ */
482
+ anchors?: Anchors
483
+
484
+ /**
485
+ * Array of version names. Only use this if you want to show different versions of docs
486
+ * with a dropdown in the navigation bar.
487
+ */
488
+ // versions?: string[]
489
+ }
490
+
491
+ export type SidebarDropdown = NavigationItem[]
492
+
493
+ /**
494
+ * Tabs configuration
495
+ */
496
+ export type Tabs = NavigationItem[]
497
+
498
+ /**
499
+ * Sidebar navigation type
500
+ */
501
+ export type SidebarNavigation = (SidebarRoute | Sidebar | string)[]
502
+
503
+ /**
504
+ * Sidebar route configuration
505
+ */
506
+ export interface SidebarRoute {
507
+ /** Route for this sidebar */
508
+ route: string
509
+
510
+ /** The group of the route */
511
+ group?: string | false
512
+
513
+ /** The id of the route */
514
+ id?: string
515
+
516
+ /** Sidebar pages within this route or sub routes */
517
+ pages: Sidebar[] | SidebarRoute[]
518
+ }
519
+
520
+ // TODO: rename to NavigationGroup ?
521
+
522
+ /**
523
+ * Sidebar configuration
524
+ */
525
+ export interface Sidebar {
526
+ /** The name of the group */
527
+ group?: string | false
528
+
529
+ /**
530
+ * The relative paths to the markdown files that will serve as pages.
531
+ * Note: groups are recursive, so to add a sub-folder add another group object in the page array.
532
+ */
533
+ pages?: PageURL[]
534
+
535
+ /**
536
+ * The icon of the group.
537
+ */
538
+ icon?: string
539
+
540
+ /**
541
+ * The order of the group.
542
+ */
543
+ order?: Order
544
+ }
545
+
546
+ type Order =
547
+ | 0
548
+ | -1
549
+ | { after: string }
550
+ | { before: string };
551
+
552
+ /**
553
+ * Page URL type
554
+ */
555
+ export type PageURL = string | VirtualPage | Sidebar
556
+
557
+ /**
558
+ * @internal
559
+ *
560
+ * Virtual page type
561
+ *
562
+ * Virtual pages are composition of pages, needed for templating e.g in uniform
563
+ *
564
+ * Example:
565
+ *
566
+ * {
567
+ * pages: [0
568
+ * ".xyd/.cache/.content/docs/rest/todo:docs/rest/todo",
569
+ * ]
570
+ * }
571
+ *
572
+ * above will be rendered as docs/rest/todo.md using composition from xyd's `.content`
573
+ */
574
+ export type VirtualPage = string | {
575
+ /** The virtual page to use for the page */
576
+ virtual: string
577
+
578
+ /** The page to use for the page */
579
+ page: string
580
+
581
+ /** The template to use for the page */
582
+ templates?: string | string[]
583
+ }
584
+
585
+ /**
586
+ * Segment configuration
587
+ */
588
+ export interface Segment {
589
+ /** Route for this segment */
590
+ route: string
591
+
592
+ /** Title of this segment */
593
+ title?: string
594
+
595
+ /** Appearance of this segment. If 'sidebarDropdown' then show this segment as a dropdown in the sidebar if match. */
596
+ appearance?: "sidebarDropdown"
597
+
598
+ /** Items within this segment */
599
+ pages: NavigationItem[]
600
+ }
601
+
602
+ /**
603
+ * Core interface for navigation items
604
+ */
605
+ export interface NavigationItem {
606
+ /**
607
+ * The navigation item title
608
+ */
609
+ title?: string
610
+
611
+ /**
612
+ * The navigation item description
613
+ */
614
+ description?: string
615
+
616
+ /**
617
+ * The navigation page, if set it redirects to the page + matches based on routing
618
+ */
619
+ page?: string
620
+
621
+ /**
622
+ * The navigation href, if set it redirects but does not match based on routing
623
+ */
624
+ href?: string
625
+
626
+ /**
627
+ * The navigation item icon
628
+ */
629
+ icon?: string | React.ReactNode
630
+ }
631
+
632
+ export type NavigationItemButton = NavigationItem & {
633
+ button: "primary" | "secondary"
634
+ }
635
+
636
+ export type NavigationItemSocial = NavigationItem & {
637
+ social: Social
638
+ }
639
+
640
+
641
+ /**
642
+ * Anchor root configuration
643
+ */
644
+ export interface Anchors {
645
+ /** Header anchors */
646
+ header?: AnchorHeader[]
647
+
648
+ /** Sidebar anchors */
649
+ sidebar?: {
650
+ top?: NavigationItem[]
651
+
652
+ bottom?: NavigationItem[]
653
+ }
654
+ }
655
+
656
+ // TODO: in the future
657
+ type AnchorHeaderGithub = {
658
+ githubUrl: string
659
+ }
660
+
661
+ export type AnchorHeader = NavigationItem | NavigationItemButton | NavigationItemSocial
662
+
663
+ // ------ END settings for navigation END ------
664
+
665
+
666
+ // ------ START settings for webeditor START ------
667
+ /**
668
+ * WebEditor navigation item configuration
669
+ */
670
+ export type WebEditorNavigationItem = NavigationItem & Partial<JSONComponent> & {
671
+ /**
672
+ * If `true` then the item will be displayed on mobile.
673
+ */
674
+ mobile?: boolean
675
+
676
+ /**
677
+ * If `true` then the item will be displayed on desktop.
678
+ */
679
+ desktop?: boolean
680
+ }
681
+
682
+ export interface Components {
683
+ /**
684
+ * WebEditor banner configuration
685
+ */
686
+ banner?: WebEditorBanner
687
+
688
+ /**
689
+ * WebEditor footer configuration
690
+ */
691
+ footer?: WebEditorFooter
692
+ }
693
+
694
+ // TODO: webeditor appearance?
695
+ /**
696
+ * WebEditor configuration
697
+ */
698
+ export interface WebEditor {
699
+ /**
700
+ * WebEditor header configuration
701
+ */
702
+ sidebarTop?: WebEditorNavigationItem[]
703
+
704
+ /**
705
+ * WebEditor header configuration
706
+ */
707
+ header?: WebEditorHeader[]
708
+
709
+ /**
710
+ * WebEditor header configuration
711
+ */
712
+ subheader?: WebEditorSubHeader
713
+ }
714
+
715
+ export type Social = "x" | "facebook" | "youtube" | "discord" | "slack" | "github" | "linkedin" | "instagram" | "hackernews" | "medium" | "telegram" | "bluesky" | "reddit"
716
+
717
+ export interface WebEditorFooter {
718
+ kind?: "minimal"
719
+
720
+ logo?: boolean | ComponentLike
721
+
722
+ /** Footer socials */
723
+ social?: {
724
+ [K in Social]?: string
725
+ }
726
+ /** Footer links */
727
+ links?: WebEditorFooterLinks
728
+
729
+ /** Footer footnote */
730
+ footnote?: ComponentLike
731
+ }
732
+
733
+ export type WebEditorFooterLinks = WebEditorFooterLink[] | WebEditorFooterLinkItem[]
734
+
735
+ export interface WebEditorFooterLink {
736
+ header: string
737
+ items: WebEditorFooterLinkItem[]
738
+ }
739
+
740
+ export type WebEditorFooterLinkItem = {
741
+ label: string
742
+ href: string
743
+ }
744
+
745
+ export interface WebEditorBanner {
746
+ /**
747
+ * Banner content.
748
+ */
749
+ content: ComponentLike
750
+
751
+ /**
752
+ * Banner label.
753
+ */
754
+ label?: string
755
+
756
+ /**
757
+ * Banner kind.
758
+ */
759
+ kind?: "secondary"
760
+
761
+ /**
762
+ * Banner href.
763
+ */
764
+ href?: string
765
+
766
+ /**
767
+ * Banner icon.
768
+ */
769
+ icon?: string
770
+
771
+ // /**
772
+ // * Banner store. TODO: in the future
773
+ // */
774
+ // store?: number
775
+ }
776
+
777
+ /**
778
+ * WebEditor header configuration
779
+ */
780
+ export type WebEditorHeader = WebEditorNavigationItem & {
781
+ /** Float the header to the right */
782
+ float?: "right" | "center"
783
+ }
784
+
785
+ /**
786
+ * WebEditorSubHeader header configuration
787
+ */
788
+ export interface WebEditorSubHeader {
789
+ /** Items of this subheader */
790
+ items: WebEditorNavigationItem[]
791
+
792
+ /** Title of this segment */
793
+ title?: string
794
+ }
795
+
796
+ // ------ END settings for webeditor END ------
797
+
798
+
799
+ // ------ START settings for API START ------
800
+ /**
801
+ * API Docs configuration interface
802
+ */
803
+ export interface API {
804
+ /**
805
+ * OpenAPI configuration
806
+ */
807
+ openapi?: APIFile
808
+
809
+ /**
810
+ * GraphQL configuration
811
+ */
812
+ graphql?: APIFile
813
+
814
+ /**
815
+ * Sources configuration
816
+ */
817
+ sources?: APIFile
818
+ }
819
+
820
+ /**
821
+ * API file configuration. Can be a path, an array of paths, a map of paths, or an advanced configuration
822
+ */
823
+ export type APIFile = string | string[] | APIFileMap | APIFileAdvanced
824
+
825
+ /**
826
+ * API file map type
827
+ */
828
+ export type APIFileMap = {
829
+ [name: string]: string | APIFileAdvanced
830
+ }
831
+
832
+ /**
833
+ * API file advanced type
834
+ */
835
+ export type APIFileAdvanced = {
836
+ /** API information configuration */
837
+ info?: APIInfo
838
+
839
+ /** Route configuration */
840
+ route: string
841
+ }
842
+
843
+ /**
844
+ * API file type - can be a string, array of strings, or a map of strings
845
+ */
846
+
847
+ /**
848
+ * API information configuration
849
+ */
850
+ export interface APIInfo {
851
+ /**
852
+ * The base url for all API endpoints. If baseUrl is an array, it will enable
853
+ * for multiple base url options that the user can toggle.
854
+ */
855
+ baseUrl?: string
856
+
857
+ /** Authentication information */
858
+ auth?: APIAuth
859
+
860
+ /**
861
+ * The name of the authentication parameter used in the API playground.
862
+ * If method is basic, the format should be [usernameName]:[passwordName]
863
+ */
864
+ name?: string
865
+
866
+ /**
867
+ * The default value that's designed to be a prefisx for the authentication input field.
868
+ * E.g. If an inputPrefix of AuthKey would inherit the default input result of the authentication field as AuthKey.
869
+ */
870
+ inputPrefix?: string
871
+
872
+ /** Request configuration */
873
+ request?: APIInfoRequest
874
+ }
875
+
876
+ /**
877
+ * API authentication configuration
878
+ */
879
+ export interface APIAuth {
880
+ /** The authentication strategy used for all API endpoints */
881
+ method: "bearer" | "basic" | "key"
882
+ }
883
+
884
+ /**
885
+ * API request configuration
886
+ */
887
+ export interface APIInfoRequest {
888
+ /** Configurations for the auto-generated API request examples */
889
+ example?: {
890
+ /**
891
+ * An array of strings that determine the order of the languages of the auto-generated request examples.
892
+ * You can either define custom languages utilizing x-codeSamples or use our default languages which include
893
+ * bash, python, javascript, php, go, java
894
+ */
895
+ languages?: string[]
896
+ }
897
+ }
898
+
899
+ // ------ END settings for API END ------
900
+
901
+
902
+ // ------ START settings for integrations START ------
903
+ /**
904
+ * Integrations configuration
905
+ */
906
+ export interface Integrations {
907
+ /**
908
+ * Configurations to add third-party analytics integrations.
909
+ * See full list of supported analytics here.
910
+ */
911
+ analytics?: IntegrationAnalytics
912
+
913
+ /**
914
+ * Configurations to add third-party support integrations.
915
+ */
916
+ support?: IntegrationSupport
917
+
918
+ /**
919
+ * Configurations to add third-party search integrations.
920
+ * See full list of supported search here.
921
+ */
922
+ search?: IntegrationSearch
923
+
924
+ /**
925
+ * A/B testing configuration
926
+ */
927
+ abtesting?: IntegrationABTesting
928
+
929
+ /**
930
+ * Diagrams configuration
931
+ */
932
+ diagrams?: boolean
933
+
934
+ /**
935
+ * Custom apps directory.
936
+ */
937
+ [".apps"]?: AppsDirectory
938
+ }
939
+
940
+ // #region IntegrationAnalytics
941
+ /**
942
+ * Analytics configuration
943
+ */
944
+ export interface IntegrationAnalytics {
945
+ /** Livesession analytics configuration */
946
+ livesession?: IntegrationAnalyticsLiveSession
947
+ }
948
+
949
+ /**
950
+ * Livesession analytics configuration
951
+ */
952
+ export interface IntegrationAnalyticsLiveSession {
953
+ /** Livesession's TrackID */
954
+ trackId: string
955
+ }
956
+ // #endregion IntegrationAnalytics
957
+
958
+ /**
959
+ * Support configuration
960
+ */
961
+ export interface IntegrationSupport {
962
+ /** Chatwoot support configuration */
963
+ chatwoot?: IntegrationSupportChatwoot
964
+
965
+ /** Intercom support configuration */
966
+ intercom?: IntegrationSupportIntercom
967
+
968
+ /** Livechat support configuration */
969
+ livechat?: IntegrationSupportLivechat
970
+ }
971
+
972
+ /**
973
+ * Chatwoot support configuration
974
+ */
975
+ export interface IntegrationSupportChatwoot {
976
+ /** Chatwoot website token */
977
+ websiteToken: string
978
+
979
+ /** Chatwoot base URL */
980
+ baseURL?: string
981
+
982
+ /** Chatwoot settings */
983
+ chatwootSettings?: JSON
984
+ }
985
+
986
+ /**
987
+ * Intercom support configuration
988
+ */
989
+ export interface IntegrationSupportIntercom {
990
+ /** Intercom app ID */
991
+ appId: string
992
+
993
+ /** Intercom API base */
994
+ apiBase?: string
995
+ }
996
+
997
+ export interface IntegrationSupportLivechat {
998
+ /** Livechat license ID */
999
+ licenseId: string
1000
+ }
1001
+
1002
+ /**
1003
+ * Search configuration
1004
+ */
1005
+ export interface IntegrationSearch {
1006
+ /** Algolia search configuration */
1007
+ algolia?: {
1008
+ /** Algolia application ID */
1009
+ appId: string
1010
+
1011
+ /** Algolia API key */
1012
+ apiKey: string
1013
+ }
1014
+
1015
+ orama?: {
1016
+ /** Orama endpoint */
1017
+ endpoint: string
1018
+
1019
+ /** Orama API key */
1020
+ apiKey: string
1021
+
1022
+ /** Orama suggestions */
1023
+ suggestions?: string[]
1024
+ } | boolean
1025
+ }
1026
+
1027
+ /**
1028
+ * A/B testing configuration
1029
+ */
1030
+ export interface IntegrationABTesting {
1031
+ /**
1032
+ * Context max age in milliseconds
1033
+ */
1034
+ contextMaxAge?: number
1035
+
1036
+ /**
1037
+ * Context storage key used to store the context in the browser storage
1038
+ */
1039
+ contextStorageKey?: string
1040
+
1041
+ /**
1042
+ * Providers configuration
1043
+ */
1044
+ providers?: IntegrationABTestingProviders
1045
+ }
1046
+
1047
+ export interface IntegrationABTestingProviders {
1048
+ /**
1049
+ * GrowthBook configuration
1050
+ */
1051
+ growthbook?: IntegrationABTestingGrowthBook
1052
+
1053
+ /**
1054
+ * LaunchDarkly configuration
1055
+ */
1056
+ launchdarkly?: IntegrationABTestingLaunchDarkly
1057
+ }
1058
+
1059
+ export interface IntegrationABTestingGrowthBook {
1060
+ /**
1061
+ * GrowthBook API host
1062
+ */
1063
+ apiHost: string
1064
+
1065
+ /**
1066
+ * GrowthBook client key
1067
+ */
1068
+ clientKey: string
1069
+ }
1070
+
1071
+ export interface IntegrationABTestingLaunchDarkly {
1072
+ /**
1073
+ * LaunchDarkly environment key
1074
+ */
1075
+ env: string
1076
+ }
1077
+
1078
+ export interface AppsDirectory {
1079
+ /**
1080
+ * Github star app configuration.
1081
+ */
1082
+ githubStar?: IntegrationAppGithubStar
1083
+
1084
+ /**
1085
+ * Supademo app configuration.
1086
+ */
1087
+ supademo?: IntegrationAppSupademo
1088
+ }
1089
+
1090
+ export interface IntegrationAppGithubStar {
1091
+ /**
1092
+ * The title of the Github button
1093
+ */
1094
+ title: string
1095
+
1096
+ /**
1097
+ * The label of the Github Button
1098
+ */
1099
+ label?: string
1100
+
1101
+ /**
1102
+ * The href of the Github project
1103
+ */
1104
+ href: string
1105
+
1106
+ /**
1107
+ * The data-show-count of the Github project
1108
+ */
1109
+ dataShowCount?: boolean
1110
+
1111
+ /**
1112
+ * The data-icon of the Github button
1113
+ */
1114
+ dataIcon?: string
1115
+
1116
+ /**
1117
+ * The data-size of the Github button
1118
+ */
1119
+ dataSize?: string
1120
+
1121
+ /**
1122
+ * The aria-label of the Github button
1123
+ */
1124
+ ariaLabel?: string
1125
+ }
1126
+
1127
+ export interface IntegrationAppSupademo {
1128
+ /**
1129
+ * The Supademo API key
1130
+ */
1131
+ apiKey: string
1132
+ }
1133
+
1134
+ // ------ END settings for integrations END ------
1135
+
1136
+ // ------ START settings for plugins START ------
1137
+
1138
+ /**
1139
+ * Plugin configuration
1140
+ *
1141
+ * @example
1142
+ * 1)
1143
+ * {
1144
+ * plugins: [
1145
+ * "livesession",
1146
+ * ]
1147
+ * }
1148
+ *
1149
+ * or 2)
1150
+ * {
1151
+ * plugins: [
1152
+ * [
1153
+ * "livesession",
1154
+ * "accountID.websiteID",
1155
+ * {
1156
+ * keystrokes: true
1157
+ * }
1158
+ * ]
1159
+ * ]
1160
+ * }
1161
+ *
1162
+ * @example [audience:dev]
1163
+ * You can also use the type to define the plugin config in your code:
1164
+ *
1165
+ * const livesessionPlugin: PluginConfig<"livesession", [string, { keystrokes: boolean }]> = [
1166
+ * "livesession",
1167
+ * "accountID.websiteID",
1168
+ * {
1169
+ * keystrokes: true
1170
+ * }
1171
+ * ]
1172
+ */
1173
+ export type Plugins = (string | PluginConfig)[]
1174
+
1175
+ export type PluginConfig<
1176
+ PluginName extends string = string,
1177
+ PluginArgs extends unknown[] = unknown[]
1178
+ > = [PluginName, ...PluginArgs]
1179
+
1180
+
1181
+ // ------ END settings for plugins END ------
1182
+
1183
+ // ------ START settings for redirecs START ------
1184
+ /**
1185
+ * Redirects configuration
1186
+ */
1187
+ export interface Redirects {
1188
+ /** Source path to redirect from */
1189
+ source: string
1190
+
1191
+ /** Destination path to redirect to */
1192
+ destination: string
1193
+ }
1194
+
1195
+ /**
1196
+ * SEO configuration
1197
+ */
1198
+ export interface SEO {
1199
+ /**
1200
+ * Domain name
1201
+ */
1202
+ domain?: string
1203
+
1204
+ /**
1205
+ * Meta tags
1206
+ */
1207
+ metatags?: { [tag: string]: string } // TODO: in the future type-safe
1208
+ }
1209
+
1210
+ // ------ END settings for redirects END ------
1211
+
1212
+ // ------ START settings for engine START ------
1213
+ /**
1214
+ * Engine configuration
1215
+ */
1216
+ export interface Engine {
1217
+ /**
1218
+ * Path aliases for imports. Avoid long relative paths by creating shortcuts.
1219
+ *
1220
+ * @example
1221
+ * ```json
1222
+ * {
1223
+ * "paths": {
1224
+ * "@my-package/*": ["../my-package/src/*"],
1225
+ * "@livesession-go/*": ["https://github.com/livesession/livesession-go/*"]
1226
+ * }
1227
+ * }
1228
+ * ```
1229
+ *
1230
+ * Usage:
1231
+ * ```typescript
1232
+ * // Instead of
1233
+ * @importCode("../../../my-package/src/components/Badge.tsx")
1234
+ *
1235
+ * // Use
1236
+ * @importCode("@my-package/src/components/Badge.tsx")
1237
+ * ```
1238
+ */
1239
+ paths?: EnginePaths
1240
+
1241
+ /**
1242
+ *
1243
+ * Uniform configuration
1244
+ *
1245
+ */
1246
+ uniform?: EngineUniform
1247
+ }
1248
+
1249
+ export type EnginePaths = { [key: string]: string[] }
1250
+
1251
+ export type EngineUniform = {
1252
+ /**
1253
+ * If `true` then virtual pages will not created and generated content will be stored on disk
1254
+ */
1255
+ store?: boolean
1256
+ }
1257
+
1258
+ // ------ END settings for config END ------
1259
+
1260
+ /**
1261
+ * JSON representation of a component.
1262
+ */
1263
+ export interface JSONComponent {
1264
+ /**
1265
+ * The component type, e.g. "Button", "Card", etc.
1266
+ */
1267
+ component: string
1268
+
1269
+ /**
1270
+ * The component's children, which can be a string, an array of strings, or an array of JSONComponent objects.
1271
+ */
1272
+ props?: Record<string, any>
1273
+ }
1274
+
1275
+ /**
1276
+ * A type that can be used to represent a component-like structure.
1277
+ */
1278
+ export type ComponentLike = React.JSX.Element | JSONComponent | string
1279
+
1280
+ export interface ThemeColors {
1281
+ colorScheme: string;
1282
+ foreground: string;
1283
+ background: string;
1284
+ lighter: {
1285
+ inlineBackground: string;
1286
+ };
1287
+ editor: {
1288
+ background: string;
1289
+ foreground: string;
1290
+ lineHighlightBackground: string;
1291
+ rangeHighlightBackground: string;
1292
+ infoForeground: string;
1293
+ selectionBackground: string;
1294
+ };
1295
+ focusBorder: string;
1296
+ tab: {
1297
+ activeBackground: string;
1298
+ activeForeground: string;
1299
+ inactiveBackground: string;
1300
+ inactiveForeground: string;
1301
+ border: string;
1302
+ activeBorder: string;
1303
+ activeBorderTop: string;
1304
+ };
1305
+ editorGroup: {
1306
+ border: string;
1307
+ };
1308
+ editorGroupHeader: {
1309
+ tabsBackground: string;
1310
+ };
1311
+ editorLineNumber: {
1312
+ foreground: string;
1313
+ };
1314
+ input: {
1315
+ background: string;
1316
+ foreground: string;
1317
+ border: string;
1318
+ };
1319
+ icon: {
1320
+ foreground: string;
1321
+ };
1322
+ sideBar: {
1323
+ background: string;
1324
+ foreground: string;
1325
+ border: string;
1326
+ };
1327
+ list: {
1328
+ activeSelectionBackground: string;
1329
+ activeSelectionForeground: string;
1330
+ hoverBackground: string;
1331
+ hoverForeground: string;
1332
+ };
1333
+ }
1334
+
1335
+ export interface UserPreferences {
1336
+ themeColors?: ThemeColors
1337
+ }