boltdocs 2.7.10 → 2.8.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 (193) hide show
  1. package/README.md +2 -2
  2. package/dist/banner-3N4Jd_L9.d.ts +100 -0
  3. package/dist/banner-MynZD_Ox.d.cts +100 -0
  4. package/dist/cache-BMUyNiiA.mjs +6 -0
  5. package/dist/cache-CKm45d2w.cjs +6 -0
  6. package/dist/client/index.cjs +2268 -1
  7. package/dist/client/index.d.cts +86 -110
  8. package/dist/client/index.d.ts +87 -111
  9. package/dist/client/index.js +2214 -1
  10. package/dist/client/mdx.cjs +12 -1
  11. package/dist/client/mdx.d.cts +39 -93
  12. package/dist/client/mdx.d.ts +38 -93
  13. package/dist/client/mdx.js +7 -1
  14. package/dist/client/primitives.cjs +60 -1
  15. package/dist/client/primitives.d.cts +411 -347
  16. package/dist/client/primitives.d.ts +411 -347
  17. package/dist/client/primitives.js +20 -1
  18. package/dist/docs-layout-CwCq42Zt.cjs +1348 -0
  19. package/dist/docs-layout-Dn6S5g59.js +1167 -0
  20. package/dist/doctor-BArviV8X.cjs +28 -0
  21. package/dist/doctor-CgLA7_Uv.mjs +28 -0
  22. package/dist/{doctor-CrytFkqW.cjs → doctor-DyNUVe96.cjs} +1 -1
  23. package/dist/{routes-DP1vmWRj.cjs → doctor-aN_leTbh.mjs} +1 -1
  24. package/dist/{generator-ClVanhvi.mjs → generator-BHCrLU6h.mjs} +2 -2
  25. package/dist/{generator-CHqxiQhF.cjs → generator-CC2yHzhZ.cjs} +2 -2
  26. package/dist/icons-dev-DvJ-hh9x.cjs +1209 -0
  27. package/dist/icons-dev-Oju24Wjp.js +845 -0
  28. package/dist/image-Ch4-GxdO.cjs +268 -0
  29. package/dist/image-Do8V9PCW.js +214 -0
  30. package/dist/mdx-D3A2_l7P.js +520 -0
  31. package/dist/mdx-PLhhPJRS.cjs +531 -0
  32. package/dist/node/cli-entry.cjs +3 -1
  33. package/dist/node/cli-entry.mjs +3 -1
  34. package/dist/node/index.cjs +1 -1
  35. package/dist/node/index.d.cts +258 -152
  36. package/dist/node/index.d.mts +258 -150
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/node/routes/worker.cjs +1 -1
  39. package/dist/node/routes/worker.mjs +1 -1
  40. package/dist/node-BmlP0eBP.cjs +159 -0
  41. package/dist/node-Y8_4ayje.mjs +159 -0
  42. package/dist/package-2nFy_NsW.cjs +6 -0
  43. package/dist/{package--0Yf0t1N.mjs → package-DAbtltXX.mjs} +1 -1
  44. package/dist/parser-B7-6PyQz.cjs +6 -0
  45. package/dist/{parser-Aq8LoH-0.cjs → parser-BzB-zCkF.cjs} +1 -1
  46. package/dist/parser-WGZdWs0X.mjs +6 -0
  47. package/dist/routes-BDDSxAl0.mjs +6 -0
  48. package/dist/routes-DJNJ-rTt.cjs +6 -0
  49. package/dist/routes-DiYC4nD2.cjs +6 -0
  50. package/dist/routes-_Bb2f4eI.mjs +6 -0
  51. package/dist/search-dialog-BXVoecTx.cjs +483 -0
  52. package/dist/search-dialog-BYhOov4S.cjs +331 -0
  53. package/dist/search-dialog-C09riYmx.js +313 -0
  54. package/dist/search-dialog-CUeAfy-8.cjs +8 -0
  55. package/dist/search-dialog-D8gLkhUV.js +453 -0
  56. package/dist/search-dialog-DHc_8FFX.js +8 -0
  57. package/dist/{sidebar-CcBkrm06.d.cts → sidebar-DNq4_ZAa.d.ts} +118 -52
  58. package/dist/{sidebar-CyZS9YOm.d.ts → sidebar-Dlkgbxs6.d.cts} +118 -52
  59. package/dist/utils-BYITg7T5.mjs +7 -0
  60. package/dist/utils-Cjmx1hhk.cjs +7 -0
  61. package/dist/worker-pool-CtqklOXq.cjs +6 -0
  62. package/dist/worker-pool-k0DY6k8T.mjs +6 -0
  63. package/package.json +5 -6
  64. package/src/shared/config-utils.ts +4 -0
  65. package/src/shared/types.ts +52 -6
  66. package/dist/cache-Ba-DZQNH.cjs +0 -6
  67. package/dist/cache-BuMZ58L5.mjs +0 -6
  68. package/dist/cards-BakZPTz9.d.ts +0 -30
  69. package/dist/cards-CQn9mXZS.d.cts +0 -30
  70. package/dist/docs-layout-KoWNZc8_.js +0 -6
  71. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  72. package/dist/doctor-Be7Ly1oM.mjs +0 -21
  73. package/dist/doctor-jMxWZyLJ.cjs +0 -21
  74. package/dist/icons-dev-B_RZIyxu.js +0 -6
  75. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  76. package/dist/image-BHhTvQzr.cjs +0 -6
  77. package/dist/image-CqKzYD8f.js +0 -6
  78. package/dist/mdx-DudBEac0.js +0 -7
  79. package/dist/mdx-r4cDQxWu.cjs +0 -7
  80. package/dist/node-DtEDyN1u.cjs +0 -111
  81. package/dist/node-_1jhMGYx.mjs +0 -111
  82. package/dist/package-DrwtlXfk.cjs +0 -6
  83. package/dist/parser-CdNbqN5y.cjs +0 -6
  84. package/dist/parser-nE792MLO.mjs +0 -6
  85. package/dist/rolldown-runtime-fkIsjY3S.mjs +0 -6
  86. package/dist/routes-2k3tbUmC.cjs +0 -6
  87. package/dist/routes-CpxZIsMM.mjs +0 -6
  88. package/dist/search-dialog-B584t9ZF.js +0 -6
  89. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  90. package/dist/search-dialog-ByvGScjt.js +0 -6
  91. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  92. package/dist/search-dialog-D6BNohIJ.js +0 -6
  93. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  94. package/dist/utils-CG65J0Sc.mjs +0 -7
  95. package/dist/utils-CKunkU96.cjs +0 -7
  96. package/dist/worker-pool-CGn7DrLb.mjs +0 -6
  97. package/dist/worker-pool-Crbqgw5R.cjs +0 -6
  98. package/src/client/app/config-context.tsx +0 -51
  99. package/src/client/app/doc-page.tsx +0 -38
  100. package/src/client/app/docs-layout.tsx +0 -28
  101. package/src/client/app/head.tsx +0 -122
  102. package/src/client/app/helmet-compat.tsx +0 -36
  103. package/src/client/app/mdx-component.tsx +0 -8
  104. package/src/client/app/mdx-components-context.tsx +0 -72
  105. package/src/client/app/routes-context.tsx +0 -34
  106. package/src/client/app/scroll-handler.tsx +0 -74
  107. package/src/client/app/theme-context.tsx +0 -103
  108. package/src/client/app/ui-context.tsx +0 -42
  109. package/src/client/components/docs-layout-default.tsx +0 -85
  110. package/src/client/components/icons-dev.tsx +0 -282
  111. package/src/client/components/mdx/callout.tsx +0 -97
  112. package/src/client/components/mdx/card.tsx +0 -99
  113. package/src/client/components/mdx/cards.tsx +0 -27
  114. package/src/client/components/mdx/code-block.tsx +0 -184
  115. package/src/client/components/mdx/field.tsx +0 -33
  116. package/src/client/components/mdx/image.tsx +0 -44
  117. package/src/client/components/mdx/index.ts +0 -19
  118. package/src/client/components/mdx/table.tsx +0 -54
  119. package/src/client/components/mdx/typographics.tsx +0 -120
  120. package/src/client/components/mdx/use-code-block.ts +0 -34
  121. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  122. package/src/client/components/primitives/button-group.tsx +0 -54
  123. package/src/client/components/primitives/button.tsx +0 -6
  124. package/src/client/components/primitives/code-block.tsx +0 -120
  125. package/src/client/components/primitives/docs-layout.tsx +0 -125
  126. package/src/client/components/primitives/error-boundary.tsx +0 -107
  127. package/src/client/components/primitives/heading.tsx +0 -128
  128. package/src/client/components/primitives/helpers/observer.ts +0 -141
  129. package/src/client/components/primitives/image.tsx +0 -26
  130. package/src/client/components/primitives/link.tsx +0 -102
  131. package/src/client/components/primitives/menu.tsx +0 -137
  132. package/src/client/components/primitives/navbar.tsx +0 -466
  133. package/src/client/components/primitives/on-this-page.tsx +0 -430
  134. package/src/client/components/primitives/page-nav.tsx +0 -51
  135. package/src/client/components/primitives/popover.tsx +0 -28
  136. package/src/client/components/primitives/search-dialog.tsx +0 -193
  137. package/src/client/components/primitives/sidebar.tsx +0 -423
  138. package/src/client/components/primitives/skeleton.tsx +0 -26
  139. package/src/client/components/primitives/tabs.tsx +0 -70
  140. package/src/client/components/primitives/tooltip.tsx +0 -81
  141. package/src/client/components/primitives/types.ts +0 -11
  142. package/src/client/components/ui-base/banner.tsx +0 -66
  143. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  144. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  145. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  146. package/src/client/components/ui-base/github-stars.tsx +0 -29
  147. package/src/client/components/ui-base/icons.tsx +0 -240
  148. package/src/client/components/ui-base/index.ts +0 -16
  149. package/src/client/components/ui-base/last-updated.tsx +0 -27
  150. package/src/client/components/ui-base/navbar.tsx +0 -266
  151. package/src/client/components/ui-base/not-found.tsx +0 -26
  152. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  153. package/src/client/components/ui-base/page-nav.tsx +0 -50
  154. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  155. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  156. package/src/client/components/ui-base/sidebar.tsx +0 -92
  157. package/src/client/components/ui-base/tabs.tsx +0 -83
  158. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  159. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  160. package/src/client/hooks/index.ts +0 -13
  161. package/src/client/hooks/use-analytics.ts +0 -272
  162. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  163. package/src/client/hooks/use-i18n.ts +0 -182
  164. package/src/client/hooks/use-localized-to.ts +0 -113
  165. package/src/client/hooks/use-location.ts +0 -5
  166. package/src/client/hooks/use-navbar.ts +0 -130
  167. package/src/client/hooks/use-page-nav.ts +0 -46
  168. package/src/client/hooks/use-routes.ts +0 -108
  169. package/src/client/hooks/use-search-highlight.ts +0 -185
  170. package/src/client/hooks/use-search.ts +0 -118
  171. package/src/client/hooks/use-sidebar.ts +0 -205
  172. package/src/client/hooks/use-tabs.ts +0 -46
  173. package/src/client/hooks/use-version.ts +0 -111
  174. package/src/client/index.ts +0 -31
  175. package/src/client/mdx.ts +0 -2
  176. package/src/client/primitives.ts +0 -19
  177. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  178. package/src/client/ssg/create-routes.tsx +0 -473
  179. package/src/client/ssg/index.ts +0 -4
  180. package/src/client/ssg/mdx-page.tsx +0 -38
  181. package/src/client/store/boltdocs-context.tsx +0 -137
  182. package/src/client/theme/neutral.css +0 -141
  183. package/src/client/theme/reset.css +0 -189
  184. package/src/client/types.ts +0 -116
  185. package/src/client/utils/cn.ts +0 -6
  186. package/src/client/utils/copy-clipboard.ts +0 -22
  187. package/src/client/utils/get-base-file-path.ts +0 -21
  188. package/src/client/utils/github.ts +0 -121
  189. package/src/client/utils/i18n.ts +0 -23
  190. package/src/client/utils/path.ts +0 -9
  191. package/src/client/utils/react-to-text.ts +0 -34
  192. package/src/client/virtual.d.ts +0 -24
  193. /package/dist/{meta-loader-CWg2gnbY.mjs → meta-loader-DzwDFtdT.mjs} +0 -0
@@ -1,121 +0,0 @@
1
- const BASE_URL = 'https://api.github.com'
2
-
3
- /**
4
- * Get the number of stars for a GitHub repository.
5
- * @param repo - owner/repo
6
- * @param token - The GitHub token.
7
- * @param baseUrl - The GitHub API base URL.
8
- * @returns The number of stars for the repository.
9
- * @example
10
- * getStarsRepo('owner/repo') // 100k
11
- */
12
- export async function getStarsRepo(
13
- repo: string,
14
- token?: string,
15
- baseUrl: string = BASE_URL,
16
- ) {
17
- const headers = new Headers()
18
- if (token) {
19
- headers.append('authorization', token)
20
- }
21
- const response = await fetch(`${baseUrl}/repos/${repo}`, {
22
- headers,
23
- })
24
- const data = await response.json()
25
- if (data.stargazers_count !== undefined) {
26
- return formatStars(data.stargazers_count)
27
- } else {
28
- return '0' // Fallback
29
- }
30
- }
31
-
32
- /**
33
- * Format a number of stars in a compact form.
34
- * @param count - The number of stars to format.
35
- * @returns The formatted number of stars.
36
- */
37
- const formatStars = (count: number): string => {
38
- return Intl.NumberFormat('en', {
39
- notation: 'compact',
40
- compactDisplay: 'short',
41
- }).format(count)
42
- }
43
-
44
- interface GetGithubLastCommitOptions {
45
- repo: string
46
- token?: string
47
- owner: string
48
- path: string
49
- sha?: string
50
- baseUrl?: string
51
- options?: RequestInit
52
- params?: Record<string, string>
53
- parser?: (data: ResponseLastCommit[0]) => string
54
- }
55
-
56
- type ResponseLastCommit = {
57
- sha: string
58
- commit: {
59
- committer: {
60
- date: string
61
- }
62
- }
63
- }[]
64
-
65
- const parserDefault = (data: ResponseLastCommit[0]) => {
66
- return new Intl.DateTimeFormat('en-US', {
67
- year: 'numeric',
68
- month: 'long',
69
- day: 'numeric',
70
- }).format(new Date(data.commit.committer.date))
71
- }
72
-
73
- export async function getGithubLastEdit({
74
- repo,
75
- token,
76
- owner,
77
- path,
78
- sha,
79
- baseUrl = BASE_URL,
80
- options = {},
81
- params: customParams = {},
82
- parser = parserDefault,
83
- }: GetGithubLastCommitOptions): Promise<string | null> {
84
- const headers = new Headers(options.headers)
85
- const params = new URLSearchParams()
86
- params.set('path', path)
87
- params.set('page', '1')
88
- params.set('per_page', '1')
89
-
90
- if (sha) params.set('sha', sha)
91
-
92
- for (const [key, value] of Object.entries(customParams)) {
93
- params.set(key, value)
94
- }
95
-
96
- if (token) {
97
- headers.append('authorization', token)
98
- }
99
-
100
- const res = await fetch(
101
- `${baseUrl}/repos/${owner}/${repo}/commits?${params.toString()}`,
102
- {
103
- ...options,
104
- headers,
105
- },
106
- )
107
-
108
- if (!res.ok) throw new Error(`Github API error ${await res.text()}`)
109
- const data = (await res.json()) as ResponseLastCommit
110
-
111
- const lastCommit = data[0]
112
-
113
- // Validation Internal
114
- if (!lastCommit.commit.committer.date) {
115
- console.warn('Commit found but no date available')
116
- return null
117
- }
118
-
119
- if (data.length === 0) return null
120
- return parser(lastCommit)
121
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Retrieves the correct translation from a value that can be either
3
- * a simple string or a map of locale-specific strings.
4
- *
5
- * @param value - The text to translate
6
- * @param locale - The current active locale (e.g., 'en', 'es')
7
- * @returns The translated string
8
- */
9
- export function getTranslated(
10
- value: string | Record<string, string> | undefined,
11
- locale?: string,
12
- ): string {
13
- if (!value) return ''
14
- if (typeof value === 'string') return value
15
-
16
- if (locale && value[locale]) {
17
- return value[locale]
18
- }
19
-
20
- // Fallback: Use the first available translation or an empty string
21
- const firstValue = Object.values(value)[0]
22
- return firstValue || ''
23
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Normalizes a URL path by stripping any trailing slash unless it's the root path.
3
- *
4
- * @param p - The path to normalize.
5
- * @returns The normalized path.
6
- */
7
- export function normalizePath(p: string): string {
8
- return p.endsWith('/') && p.length > 1 ? p.slice(0, -1) : p
9
- }
@@ -1,34 +0,0 @@
1
- import {
2
- isValidElement,
3
- type ReactNode,
4
- type JSXElementConstructor,
5
- } from 'react'
6
-
7
- type ResolverMap = Map<
8
- string | JSXElementConstructor<object>,
9
- (props: object) => string
10
- >
11
-
12
- const reactToText = (node: ReactNode, resolvers?: ResolverMap): string => {
13
- if (node == null || typeof node === 'boolean') return ''
14
-
15
- if (typeof node === 'string' || typeof node === 'number') return String(node)
16
-
17
- if (Array.isArray(node))
18
- return node.map((n) => reactToText(n, resolvers)).join('')
19
-
20
- if (isValidElement(node)) {
21
- const resolver = resolvers?.get(
22
- node.type as string | JSXElementConstructor<object>,
23
- )
24
- if (resolver) return resolver(node.props as object)
25
- return reactToText(
26
- (node.props as { children?: ReactNode }).children,
27
- resolvers,
28
- )
29
- }
30
-
31
- return ''
32
- }
33
-
34
- export { reactToText }
@@ -1,24 +0,0 @@
1
- declare module 'virtual:boltdocs-routes' {
2
- const routes: any[]
3
- export default routes
4
- }
5
-
6
- declare module 'virtual:boltdocs-config' {
7
- const config: any
8
- export default config
9
- }
10
-
11
- declare module 'virtual:boltdocs-layout' {
12
- const Layout: React.ComponentType<{ children: React.ReactNode; route?: any }>
13
- export default Layout
14
- }
15
-
16
- declare module 'virtual:boltdocs-mdx-components' {
17
- const components: any
18
- export default components
19
- }
20
-
21
- declare module 'virtual:boltdocs-entry' {
22
- const code: string
23
- export default code
24
- }