themekit-js 1.1.0

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.
Files changed (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/themekit.js +2 -0
  4. package/client.d.ts +5 -0
  5. package/dist/client/app/components/ClientOnly.js +10 -0
  6. package/dist/client/app/components/Content.js +23 -0
  7. package/dist/client/app/composables/codeGroups.js +40 -0
  8. package/dist/client/app/composables/copyCode.js +73 -0
  9. package/dist/client/app/composables/head.js +81 -0
  10. package/dist/client/app/composables/preFetch.js +99 -0
  11. package/dist/client/app/data.js +59 -0
  12. package/dist/client/app/devtools.js +29 -0
  13. package/dist/client/app/index.js +140 -0
  14. package/dist/client/app/router.js +233 -0
  15. package/dist/client/app/ssr.js +10 -0
  16. package/dist/client/app/theme.js +1 -0
  17. package/dist/client/app/utils.js +119 -0
  18. package/dist/client/index.d.ts +1446 -0
  19. package/dist/client/index.js +9 -0
  20. package/dist/client/shared.js +139 -0
  21. package/dist/client/theme-default/Layout.vue +94 -0
  22. package/dist/client/theme-default/NotFound.vue +109 -0
  23. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +99 -0
  24. package/dist/client/theme-default/components/VPBackdrop.vue +41 -0
  25. package/dist/client/theme-default/components/VPBadge.vue +86 -0
  26. package/dist/client/theme-default/components/VPButton.vue +123 -0
  27. package/dist/client/theme-default/components/VPCarbonAds.vue +109 -0
  28. package/dist/client/theme-default/components/VPContent.vue +98 -0
  29. package/dist/client/theme-default/components/VPDoc.vue +193 -0
  30. package/dist/client/theme-default/components/VPDocAside.vue +46 -0
  31. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +18 -0
  32. package/dist/client/theme-default/components/VPDocAsideOutline.vue +87 -0
  33. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -0
  34. package/dist/client/theme-default/components/VPDocFooter.vue +145 -0
  35. package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +50 -0
  36. package/dist/client/theme-default/components/VPDocOutlineItem.vue +59 -0
  37. package/dist/client/theme-default/components/VPFeature.vue +123 -0
  38. package/dist/client/theme-default/components/VPFeatures.vue +121 -0
  39. package/dist/client/theme-default/components/VPFlyout.vue +136 -0
  40. package/dist/client/theme-default/components/VPFooter.vue +60 -0
  41. package/dist/client/theme-default/components/VPHero.vue +336 -0
  42. package/dist/client/theme-default/components/VPHome.vue +43 -0
  43. package/dist/client/theme-default/components/VPHomeContent.vue +52 -0
  44. package/dist/client/theme-default/components/VPHomeFeatures.vue +14 -0
  45. package/dist/client/theme-default/components/VPHomeHero.vue +24 -0
  46. package/dist/client/theme-default/components/VPHomeSponsors.vue +116 -0
  47. package/dist/client/theme-default/components/VPImage.vue +46 -0
  48. package/dist/client/theme-default/components/VPLink.vue +33 -0
  49. package/dist/client/theme-default/components/VPLocalNav.vue +171 -0
  50. package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +190 -0
  51. package/dist/client/theme-default/components/VPLocalSearchBox.vue +856 -0
  52. package/dist/client/theme-default/components/VPMenu.vue +72 -0
  53. package/dist/client/theme-default/components/VPMenuGroup.vue +47 -0
  54. package/dist/client/theme-default/components/VPMenuLink.vue +54 -0
  55. package/dist/client/theme-default/components/VPNav.vue +57 -0
  56. package/dist/client/theme-default/components/VPNavBar.vue +267 -0
  57. package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
  58. package/dist/client/theme-default/components/VPNavBarExtra.vue +94 -0
  59. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  60. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  61. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +42 -0
  62. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +53 -0
  63. package/dist/client/theme-default/components/VPNavBarSearch.vue +194 -0
  64. package/dist/client/theme-default/components/VPNavBarSearchButton.vue +208 -0
  65. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  66. package/dist/client/theme-default/components/VPNavBarTitle.vue +76 -0
  67. package/dist/client/theme-default/components/VPNavBarTranslations.vue +47 -0
  68. package/dist/client/theme-default/components/VPNavScreen.vue +99 -0
  69. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
  70. package/dist/client/theme-default/components/VPNavScreenMenu.vue +23 -0
  71. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +111 -0
  72. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +39 -0
  73. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +34 -0
  74. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +39 -0
  75. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  76. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  77. package/dist/client/theme-default/components/VPPage.vue +7 -0
  78. package/dist/client/theme-default/components/VPSidebar.vue +137 -0
  79. package/dist/client/theme-default/components/VPSidebarItem.vue +250 -0
  80. package/dist/client/theme-default/components/VPSkipLink.vue +68 -0
  81. package/dist/client/theme-default/components/VPSocialLink.vue +50 -0
  82. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  83. package/dist/client/theme-default/components/VPSponsors.vue +48 -0
  84. package/dist/client/theme-default/components/VPSponsorsGrid.vue +48 -0
  85. package/dist/client/theme-default/components/VPSwitch.vue +63 -0
  86. package/dist/client/theme-default/components/VPSwitchAppearance.vue +52 -0
  87. package/dist/client/theme-default/components/VPTeamMembers.vue +66 -0
  88. package/dist/client/theme-default/components/VPTeamMembersItem.vue +225 -0
  89. package/dist/client/theme-default/components/VPTeamPage.vue +58 -0
  90. package/dist/client/theme-default/components/VPTeamPageSection.vue +77 -0
  91. package/dist/client/theme-default/components/VPTeamPageTitle.vue +63 -0
  92. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  93. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  94. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  95. package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +7 -0
  96. package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +7 -0
  97. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  98. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  99. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  100. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  101. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  102. package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
  103. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  104. package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
  105. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
  106. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  107. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  108. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  109. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
  110. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  111. package/dist/client/theme-default/composables/aside.js +17 -0
  112. package/dist/client/theme-default/composables/data.js +2 -0
  113. package/dist/client/theme-default/composables/edit-link.js +16 -0
  114. package/dist/client/theme-default/composables/flyout.js +41 -0
  115. package/dist/client/theme-default/composables/langs.js +26 -0
  116. package/dist/client/theme-default/composables/local-nav.js +18 -0
  117. package/dist/client/theme-default/composables/nav.js +30 -0
  118. package/dist/client/theme-default/composables/outline.js +178 -0
  119. package/dist/client/theme-default/composables/prev-next.js +57 -0
  120. package/dist/client/theme-default/composables/sidebar.js +136 -0
  121. package/dist/client/theme-default/composables/sponsor-grid.js +94 -0
  122. package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
  123. package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
  124. package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
  125. package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
  126. package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
  127. package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
  128. package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
  129. package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
  130. package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
  131. package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
  132. package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
  133. package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
  134. package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
  135. package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
  136. package/dist/client/theme-default/index.js +3 -0
  137. package/dist/client/theme-default/styles/base.css +252 -0
  138. package/dist/client/theme-default/styles/components/custom-block.css +208 -0
  139. package/dist/client/theme-default/styles/components/vp-code-group.css +85 -0
  140. package/dist/client/theme-default/styles/components/vp-code.css +7 -0
  141. package/dist/client/theme-default/styles/components/vp-doc.css +570 -0
  142. package/dist/client/theme-default/styles/components/vp-sponsor.css +155 -0
  143. package/dist/client/theme-default/styles/fonts.css +157 -0
  144. package/dist/client/theme-default/styles/icons.css +123 -0
  145. package/dist/client/theme-default/styles/utils.css +9 -0
  146. package/dist/client/theme-default/styles/vars.css +563 -0
  147. package/dist/client/theme-default/support/lru.js +33 -0
  148. package/dist/client/theme-default/support/sidebar.js +89 -0
  149. package/dist/client/theme-default/support/translation.js +49 -0
  150. package/dist/client/theme-default/support/utils.js +33 -0
  151. package/dist/client/theme-default/without-fonts.js +32 -0
  152. package/dist/node/cli.js +444 -0
  153. package/dist/node/index.d.ts +4588 -0
  154. package/dist/node/index.js +198 -0
  155. package/dist/node/serve-BjvG349_.js +50301 -0
  156. package/lib/vue-demi.mjs +34 -0
  157. package/package.json +223 -0
  158. package/template/.vitepress/config.js +28 -0
  159. package/template/.vitepress/theme/Layout.vue +21 -0
  160. package/template/.vitepress/theme/index.js +29 -0
  161. package/template/.vitepress/theme/style.css +143 -0
  162. package/template/api-examples.md +49 -0
  163. package/template/index.md +28 -0
  164. package/template/markdown-examples.md +85 -0
  165. package/theme-without-fonts.d.ts +2 -0
  166. package/theme.d.ts +30 -0
  167. package/types/default-theme.d.ts +533 -0
  168. package/types/docsearch.d.ts +144 -0
  169. package/types/index.d.ts +3 -0
  170. package/types/local-search.d.ts +33 -0
  171. package/types/shared.d.ts +199 -0
@@ -0,0 +1,533 @@
1
+ import type MarkdownIt from 'markdown-it'
2
+ import type { Options as MiniSearchOptions } from 'minisearch'
3
+ import type { ComputedRef, Ref } from 'vue'
4
+ import type { DocSearchProps } from './docsearch.js'
5
+ import type {
6
+ LocalSearchTranslations,
7
+ PageSplitSection
8
+ } from './local-search.js'
9
+ import type { Awaitable, MarkdownEnv, PageData } from './shared.js'
10
+
11
+ export namespace DefaultTheme {
12
+ export interface Config {
13
+ /**
14
+ * The logo file of the site.
15
+ *
16
+ * @example '/logo.svg'
17
+ */
18
+ logo?: ThemeableImage
19
+
20
+ /**
21
+ * Overrides the link of the site logo.
22
+ */
23
+ logoLink?: string | { link?: string; rel?: string; target?: string }
24
+
25
+ /**
26
+ * Custom site title in navbar. If the value is undefined,
27
+ * `config.title` will be used.
28
+ */
29
+ siteTitle?: string | false
30
+
31
+ /**
32
+ * Custom header levels of outline in the aside component.
33
+ *
34
+ * @default 2
35
+ */
36
+ outline?: Outline | Outline['level'] | false
37
+
38
+ /**
39
+ * @deprecated Use `outline.label` instead.
40
+ *
41
+ * @default 'On this page'
42
+ */
43
+ outlineTitle?: string
44
+
45
+ /**
46
+ * The nav items.
47
+ */
48
+ nav?: NavItem[]
49
+
50
+ /**
51
+ * The sidebar items.
52
+ */
53
+ sidebar?: Sidebar
54
+
55
+ /**
56
+ * Set to `false` to prevent rendering of aside container.
57
+ * Set to `true` to render the aside to the right.
58
+ * Set to `left` to render the aside to the left.
59
+ *
60
+ * @default true
61
+ */
62
+ aside?: boolean | 'left'
63
+
64
+ /**
65
+ * Info for the edit link. If it's undefined, the edit link feature will
66
+ * be disabled.
67
+ */
68
+ editLink?: EditLink
69
+
70
+ /**
71
+ * @deprecated Use `lastUpdated.text` instead.
72
+ *
73
+ * Set custom last updated text.
74
+ *
75
+ * @default 'Last updated'
76
+ */
77
+ lastUpdatedText?: string
78
+
79
+ lastUpdated?: LastUpdatedOptions
80
+
81
+ /**
82
+ * Set custom prev/next labels.
83
+ */
84
+ docFooter?: DocFooter
85
+
86
+ /**
87
+ * The social links to be displayed at the end of the nav bar. Perfect for
88
+ * placing links to social services such as GitHub, Twitter, Facebook, etc.
89
+ */
90
+ socialLinks?: SocialLink[]
91
+
92
+ /**
93
+ * The footer configuration.
94
+ */
95
+ footer?: Footer
96
+
97
+ /**
98
+ * @default 'Appearance'
99
+ */
100
+ darkModeSwitchLabel?: string
101
+
102
+ /**
103
+ * @default 'Switch to light theme'
104
+ */
105
+ lightModeSwitchTitle?: string
106
+
107
+ /**
108
+ * @default 'Switch to dark theme'
109
+ */
110
+ darkModeSwitchTitle?: string
111
+
112
+ /**
113
+ * @default 'Menu'
114
+ */
115
+ sidebarMenuLabel?: string
116
+
117
+ /**
118
+ * @default 'Return to top'
119
+ */
120
+ returnToTopLabel?: string
121
+
122
+ /**
123
+ * Set custom `aria-label` for language menu button.
124
+ *
125
+ * @default 'Change language'
126
+ */
127
+ langMenuLabel?: string
128
+
129
+ search?:
130
+ | { provider: 'local'; options?: LocalSearchOptions }
131
+ | { provider: 'algolia'; options: AlgoliaSearchOptions }
132
+
133
+ /**
134
+ * @deprecated Use `search` instead.
135
+ */
136
+ algolia?: AlgoliaSearchOptions
137
+
138
+ /**
139
+ * The carbon ads options. Leave it undefined to disable the ads feature.
140
+ */
141
+ carbonAds?: CarbonAdsOptions
142
+
143
+ /**
144
+ * Changing locale when current url is `/foo` will redirect to `/locale/foo`.
145
+ *
146
+ * @default true
147
+ */
148
+ i18nRouting?: boolean
149
+
150
+ /**
151
+ * Show external link icon in Markdown links.
152
+ *
153
+ * @default false
154
+ */
155
+ externalLinkIcon?: boolean
156
+
157
+ /**
158
+ * Customize text of 404 page.
159
+ */
160
+ notFound?: NotFoundOptions
161
+ }
162
+
163
+ // nav -----------------------------------------------------------------------
164
+
165
+ export type NavItem = NavItemWithLink | NavItemWithChildren
166
+
167
+ export interface NavItemWithLink {
168
+ text: string
169
+ link: string
170
+ items?: never
171
+
172
+ /**
173
+ * `activeMatch` is expected to be a regex string. We can't use actual
174
+ * RegExp object here because it isn't serializable
175
+ */
176
+ activeMatch?: string
177
+ rel?: string
178
+ target?: string
179
+ noIcon?: boolean
180
+ }
181
+
182
+ export interface NavItemChildren {
183
+ text?: string
184
+ items: NavItemWithLink[]
185
+ }
186
+
187
+ export interface NavItemWithChildren {
188
+ text?: string
189
+ items: (NavItemChildren | NavItemWithLink)[]
190
+
191
+ /**
192
+ * `activeMatch` is expected to be a regex string. We can't use actual
193
+ * RegExp object here because it isn't serializable
194
+ */
195
+ activeMatch?: string
196
+ }
197
+
198
+ // image ---------------------------------------------------------------------
199
+
200
+ export type ThemeableImage =
201
+ | string
202
+ | { src: string; alt?: string; [prop: string]: any }
203
+ | { light: string; dark: string; alt?: string; [prop: string]: any }
204
+
205
+ export type FeatureIcon =
206
+ | string
207
+ | {
208
+ src: string
209
+ alt?: string
210
+ width?: string
211
+ height?: string
212
+ wrap?: boolean
213
+ }
214
+ | {
215
+ light: string
216
+ dark: string
217
+ alt?: string
218
+ width?: string
219
+ height?: string
220
+ wrap?: boolean
221
+ }
222
+
223
+ // sidebar -------------------------------------------------------------------
224
+
225
+ export type Sidebar = SidebarItem[] | SidebarMulti
226
+
227
+ export interface SidebarMulti {
228
+ [path: string]: SidebarItem[] | { items: SidebarItem[]; base: string }
229
+ }
230
+
231
+ export type SidebarItem = {
232
+ /**
233
+ * The text label of the item.
234
+ */
235
+ text?: string
236
+
237
+ /**
238
+ * The link of the item.
239
+ */
240
+ link?: string
241
+
242
+ /**
243
+ * The children of the item.
244
+ */
245
+ items?: SidebarItem[]
246
+
247
+ /**
248
+ * If not specified, group is not collapsible.
249
+ *
250
+ * If `true`, group is collapsible and collapsed by default
251
+ *
252
+ * If `false`, group is collapsible but expanded by default
253
+ */
254
+ collapsed?: boolean
255
+
256
+ /**
257
+ * Base path for the children items.
258
+ */
259
+ base?: string
260
+
261
+ /**
262
+ * Customize text that appears on the footer of previous/next page.
263
+ */
264
+ docFooterText?: string
265
+
266
+ rel?: string
267
+ target?: string
268
+ }
269
+
270
+ /**
271
+ * ReturnType of `useSidebar`
272
+ */
273
+ export interface DocSidebar {
274
+ isOpen: Ref<boolean>
275
+ sidebar: ComputedRef<SidebarItem[]>
276
+ sidebarGroups: ComputedRef<SidebarItem[]>
277
+ hasSidebar: ComputedRef<boolean>
278
+ hasAside: ComputedRef<boolean>
279
+ leftAside: ComputedRef<boolean>
280
+ isSidebarEnabled: ComputedRef<boolean>
281
+ open: () => void
282
+ close: () => void
283
+ toggle: () => void
284
+ }
285
+
286
+ // edit link -----------------------------------------------------------------
287
+
288
+ export interface EditLink {
289
+ /**
290
+ * Pattern for edit link.
291
+ *
292
+ * @example 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
293
+ * @example ({ filePath }) => { ... }
294
+ */
295
+ pattern: string | ((payload: PageData) => string)
296
+
297
+ /**
298
+ * Custom text for edit link.
299
+ *
300
+ * @default 'Edit this page'
301
+ */
302
+ text?: string
303
+ }
304
+
305
+ // prev-next -----------------------------------------------------------------
306
+
307
+ export interface DocFooter {
308
+ /**
309
+ * Custom label for previous page button. Can be set to `false` to disable.
310
+ *
311
+ * @default 'Previous page'
312
+ */
313
+ prev?: string | boolean
314
+
315
+ /**
316
+ * Custom label for next page button. Can be set to `false` to disable.
317
+ *
318
+ * @default 'Next page'
319
+ */
320
+ next?: string | boolean
321
+ }
322
+
323
+ // social link ---------------------------------------------------------------
324
+
325
+ export interface SocialLink {
326
+ icon: SocialLinkIcon
327
+ link: string
328
+ ariaLabel?: string
329
+ }
330
+
331
+ export type SocialLinkIcon =
332
+ | 'discord'
333
+ | 'facebook'
334
+ | 'github'
335
+ | 'instagram'
336
+ | 'linkedin'
337
+ | 'mastodon'
338
+ | 'npm'
339
+ | 'slack'
340
+ | 'twitter'
341
+ | 'x'
342
+ | 'youtube'
343
+ | { svg: string }
344
+
345
+ // footer --------------------------------------------------------------------
346
+
347
+ export interface Footer {
348
+ message?: string
349
+ copyright?: string
350
+ }
351
+
352
+ // team ----------------------------------------------------------------------
353
+
354
+ export interface TeamMember {
355
+ avatar: string
356
+ name: string
357
+ title?: string
358
+ org?: string
359
+ orgLink?: string
360
+ desc?: string
361
+ links?: SocialLink[]
362
+ sponsor?: string
363
+ actionText?: string
364
+ }
365
+
366
+ // local nav -----------------------------------------------------------------
367
+
368
+ /**
369
+ * ReturnType of `useLocalNav`.
370
+ */
371
+ export interface DocLocalNav {
372
+ /**
373
+ * The outline headers of the current page.
374
+ */
375
+ headers: ShallowRef<MenuItem[]>
376
+
377
+ /**
378
+ * Whether the current page has a local nav. Local nav is shown when the
379
+ * "outline" is present in the page. However, note that the actual
380
+ * local nav visibility depends on the screen width as well.
381
+ */
382
+ hasLocalNav: ComputedRef<boolean>
383
+ }
384
+
385
+ // outline -------------------------------------------------------------------
386
+
387
+ export interface Outline {
388
+ level?: number | [number, number] | 'deep'
389
+ label?: string
390
+ }
391
+
392
+ // local search --------------------------------------------------------------
393
+
394
+ export interface LocalSearchOptions {
395
+ /**
396
+ * @default false
397
+ * @deprecated Use `detailedView: false` instead.
398
+ */
399
+ disableDetailedView?: boolean
400
+
401
+ /**
402
+ * If `true`, the detailed view will be enabled by default.
403
+ * If `false`, the detailed view will be disabled.
404
+ * If `'auto'`, the detailed view will be disabled by default, but can be enabled by the user.
405
+ *
406
+ * @default 'auto'
407
+ */
408
+ detailedView?: boolean | 'auto'
409
+
410
+ /**
411
+ * @default false
412
+ */
413
+ disableQueryPersistence?: boolean
414
+
415
+ translations?: LocalSearchTranslations
416
+ locales?: Record<string, Partial<Omit<LocalSearchOptions, 'locales'>>>
417
+
418
+ miniSearch?: {
419
+ /**
420
+ * @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
421
+ */
422
+ options?: Pick<
423
+ MiniSearchOptions,
424
+ 'extractField' | 'tokenize' | 'processTerm'
425
+ >
426
+ /**
427
+ * @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchoptions-1
428
+ */
429
+ searchOptions?: MiniSearchOptions['searchOptions']
430
+
431
+ /**
432
+ * Overrides the default regex based page splitter.
433
+ * Supports async generator, making it possible to run in true parallel
434
+ * (when used along with `node:child_process` or `worker_threads`)
435
+ * ---
436
+ * This should be especially useful for scalability reasons.
437
+ * ---
438
+ * @param {string} path - absolute path to the markdown source file
439
+ * @param {string} html - document page rendered as html
440
+ */
441
+ _splitIntoSections?: (
442
+ path: string,
443
+ html: string
444
+ ) =>
445
+ | AsyncGenerator<PageSplitSection>
446
+ | Generator<PageSplitSection>
447
+ | Awaitable<PageSplitSection[]>
448
+ }
449
+ /**
450
+ * Allows transformation of content before indexing (node only)
451
+ * Return empty string to skip indexing
452
+ */
453
+ _render?: (
454
+ src: string,
455
+ env: MarkdownEnv,
456
+ md: MarkdownIt
457
+ ) => Awaitable<string>
458
+ }
459
+
460
+ // algolia -------------------------------------------------------------------
461
+
462
+ /**
463
+ * Algolia search options. Partially copied from
464
+ * `@docsearch/react/dist/esm/DocSearch.d.ts`
465
+ */
466
+ export interface AlgoliaSearchOptions extends DocSearchProps {
467
+ locales?: Record<string, Partial<DocSearchProps>>
468
+ }
469
+
470
+ // carbon ads ----------------------------------------------------------------
471
+
472
+ export interface CarbonAdsOptions {
473
+ code: string
474
+ placement: string
475
+ }
476
+
477
+ // last updated --------------------------------------------------------------
478
+
479
+ export interface LastUpdatedOptions {
480
+ /**
481
+ * Set custom last updated text.
482
+ *
483
+ * @default 'Last updated'
484
+ */
485
+ text?: string
486
+
487
+ /**
488
+ * Set options for last updated time formatting.
489
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options
490
+ *
491
+ * @default
492
+ * { dateStyle: 'short', timeStyle: 'short' }
493
+ */
494
+ formatOptions?: Intl.DateTimeFormatOptions & { forceLocale?: boolean }
495
+ }
496
+
497
+ // not found -----------------------------------------------------------------
498
+
499
+ export interface NotFoundOptions {
500
+ /**
501
+ * Set custom not found message.
502
+ *
503
+ * @default 'PAGE NOT FOUND'
504
+ */
505
+ title?: string
506
+
507
+ /**
508
+ * Set custom not found description.
509
+ *
510
+ * @default "But if you don't change your direction, and if you keep looking, you may end up where you are heading."
511
+ */
512
+ quote?: string
513
+
514
+ /**
515
+ * Set aria label for home link.
516
+ *
517
+ * @default 'go to home'
518
+ */
519
+ linkLabel?: string
520
+
521
+ /**
522
+ * Set custom home link text.
523
+ *
524
+ * @default 'Take me home'
525
+ */
526
+ linkText?: string
527
+
528
+ /**
529
+ * @default '404'
530
+ */
531
+ code?: string
532
+ }
533
+ }
@@ -0,0 +1,144 @@
1
+ export interface DocSearchProps {
2
+ appId: string
3
+ apiKey: string
4
+ indexName: string
5
+ placeholder?: string
6
+ searchParameters?: SearchOptions
7
+ disableUserPersonalization?: boolean
8
+ initialQuery?: string
9
+ insights?: boolean
10
+ translations?: DocSearchTranslations
11
+ }
12
+
13
+ export interface SearchOptions {
14
+ query?: string
15
+ similarQuery?: string
16
+ facetFilters?: string | string[]
17
+ optionalFilters?: string | string[]
18
+ numericFilters?: string | string[]
19
+ tagFilters?: string | string[]
20
+ sumOrFiltersScores?: boolean
21
+ filters?: string
22
+ page?: number
23
+ hitsPerPage?: number
24
+ offset?: number
25
+ length?: number
26
+ attributesToHighlight?: string[]
27
+ attributesToSnippet?: string[]
28
+ attributesToRetrieve?: string[]
29
+ highlightPreTag?: string
30
+ highlightPostTag?: string
31
+ snippetEllipsisText?: string
32
+ restrictHighlightAndSnippetArrays?: boolean
33
+ facets?: string[]
34
+ maxValuesPerFacet?: number
35
+ facetingAfterDistinct?: boolean
36
+ minWordSizefor1Typo?: number
37
+ minWordSizefor2Typos?: number
38
+ allowTyposOnNumericTokens?: boolean
39
+ disableTypoToleranceOnAttributes?: string[]
40
+ queryType?: 'prefixLast' | 'prefixAll' | 'prefixNone'
41
+ removeWordsIfNoResults?: 'none' | 'lastWords' | 'firstWords' | 'allOptional'
42
+ advancedSyntax?: boolean
43
+ advancedSyntaxFeatures?: ('exactPhrase' | 'excludeWords')[]
44
+ optionalWords?: string | string[]
45
+ disableExactOnAttributes?: string[]
46
+ exactOnSingleWordQuery?: 'attribute' | 'none' | 'word'
47
+ alternativesAsExact?: (
48
+ | 'ignorePlurals'
49
+ | 'singleWordSynonym'
50
+ | 'multiWordsSynonym'
51
+ )[]
52
+ enableRules?: boolean
53
+ ruleContexts?: string[]
54
+ distinct?: boolean | number
55
+ analytics?: boolean
56
+ analyticsTags?: string[]
57
+ synonyms?: boolean
58
+ replaceSynonymsInHighlight?: boolean
59
+ minProximity?: number
60
+ responseFields?: string[]
61
+ maxFacetHits?: number
62
+ percentileComputation?: boolean
63
+ clickAnalytics?: boolean
64
+ personalizationImpact?: number
65
+ enablePersonalization?: boolean
66
+ restrictSearchableAttributes?: string[]
67
+ sortFacetValuesBy?: 'count' | 'alpha'
68
+ typoTolerance?: boolean | 'min' | 'strict'
69
+ aroundLatLng?: string
70
+ aroundLatLngViaIP?: boolean
71
+ aroundRadius?: number | 'all'
72
+ aroundPrecision?: number | { from: number; value: number }[]
73
+ minimumAroundRadius?: number
74
+ insideBoundingBox?: number[][]
75
+ insidePolygon?: number[][]
76
+ ignorePlurals?: boolean | string[]
77
+ removeStopWords?: boolean | string[]
78
+ naturalLanguages?: string[]
79
+ getRankingInfo?: boolean
80
+ userToken?: string
81
+ enableABTest?: boolean
82
+ decompoundQuery?: boolean
83
+ relevancyStrictness?: number
84
+ }
85
+
86
+ export interface DocSearchTranslations {
87
+ button?: ButtonTranslations
88
+ modal?: ModalTranslations
89
+ }
90
+
91
+ export interface ButtonTranslations {
92
+ buttonText?: string
93
+ buttonAriaLabel?: string
94
+ }
95
+
96
+ export interface ModalTranslations extends ScreenStateTranslations {
97
+ searchBox?: SearchBoxTranslations
98
+ footer?: FooterTranslations
99
+ }
100
+
101
+ export interface ScreenStateTranslations {
102
+ errorScreen?: ErrorScreenTranslations
103
+ startScreen?: StartScreenTranslations
104
+ noResultsScreen?: NoResultsScreenTranslations
105
+ }
106
+
107
+ export interface SearchBoxTranslations {
108
+ resetButtonTitle?: string
109
+ resetButtonAriaLabel?: string
110
+ cancelButtonText?: string
111
+ cancelButtonAriaLabel?: string
112
+ }
113
+
114
+ export interface FooterTranslations {
115
+ selectText?: string
116
+ selectKeyAriaLabel?: string
117
+ navigateText?: string
118
+ navigateUpKeyAriaLabel?: string
119
+ navigateDownKeyAriaLabel?: string
120
+ closeText?: string
121
+ closeKeyAriaLabel?: string
122
+ searchByText?: string
123
+ }
124
+
125
+ export interface ErrorScreenTranslations {
126
+ titleText?: string
127
+ helpText?: string
128
+ }
129
+
130
+ export interface StartScreenTranslations {
131
+ recentSearchesTitle?: string
132
+ noRecentSearchesText?: string
133
+ saveRecentSearchButtonTitle?: string
134
+ removeRecentSearchButtonTitle?: string
135
+ favoriteSearchesTitle?: string
136
+ removeFavoriteSearchButtonTitle?: string
137
+ }
138
+
139
+ export interface NoResultsScreenTranslations {
140
+ noResultsText?: string
141
+ suggestedQueryText?: string
142
+ reportMissingResultsText?: string
143
+ reportMissingResultsLinkText?: string
144
+ }
@@ -0,0 +1,3 @@
1
+ export * from './shared.js'
2
+ export * from '../dist/client/index.js'
3
+ export * from '../dist/node/index.js'
@@ -0,0 +1,33 @@
1
+ export interface LocalSearchTranslations {
2
+ button?: ButtonTranslations
3
+ modal?: ModalTranslations
4
+ }
5
+
6
+ export interface ButtonTranslations {
7
+ buttonText?: string
8
+ buttonAriaLabel?: string
9
+ }
10
+
11
+ export interface ModalTranslations {
12
+ displayDetails?: string
13
+ resetButtonTitle?: string
14
+ backButtonTitle?: string
15
+ noResultsText?: string
16
+ footer?: FooterTranslations
17
+ }
18
+
19
+ export interface FooterTranslations {
20
+ selectText?: string
21
+ selectKeyAriaLabel?: string
22
+ navigateText?: string
23
+ navigateUpKeyAriaLabel?: string
24
+ navigateDownKeyAriaLabel?: string
25
+ closeText?: string
26
+ closeKeyAriaLabel?: string
27
+ }
28
+
29
+ export interface PageSplitSection {
30
+ anchor?: string
31
+ titles: string[]
32
+ text: string
33
+ }