boltdocs 2.7.10 → 2.7.11

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 (137) hide show
  1. package/dist/client/index.cjs +1929 -1
  2. package/dist/client/index.js +1880 -1
  3. package/dist/client/mdx.cjs +7 -1
  4. package/dist/client/mdx.js +7 -1
  5. package/dist/client/primitives.cjs +60 -1
  6. package/dist/client/primitives.js +20 -1
  7. package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
  8. package/dist/docs-layout-DwFndmj5.js +1231 -0
  9. package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
  10. package/dist/icons-dev-Df8OQ481.js +839 -0
  11. package/dist/image-DtrI2cw3.cjs +268 -0
  12. package/dist/image-jxPb-2iV.js +214 -0
  13. package/dist/mdx-BdWkJTeB.cjs +523 -0
  14. package/dist/mdx-UTTLFWJq.js +494 -0
  15. package/dist/node/cli-entry.cjs +1 -1
  16. package/dist/node/cli-entry.mjs +1 -1
  17. package/dist/node/index.cjs +1 -1
  18. package/dist/node/index.mjs +1 -1
  19. package/dist/{node-DtEDyN1u.cjs → node-BSM4qcDK.cjs} +1 -1
  20. package/dist/{node-_1jhMGYx.mjs → node-BspZN3R2.mjs} +1 -1
  21. package/dist/{package-DrwtlXfk.cjs → package-DIIrjuWI.cjs} +1 -1
  22. package/dist/{package--0Yf0t1N.mjs → package-K0zsjGIz.mjs} +1 -1
  23. package/dist/{search-dialog-ByvGScjt.js → search-dialog-BHuIiUC6.js} +3 -1
  24. package/dist/search-dialog-BNF10tDl.js +375 -0
  25. package/dist/search-dialog-BwkDuI9R.cjs +220 -0
  26. package/dist/search-dialog-C7xuvyNk.cjs +386 -0
  27. package/dist/search-dialog-CIQg6k8c.cjs +8 -0
  28. package/dist/search-dialog-D-DDN7zJ.js +208 -0
  29. package/package.json +3 -4
  30. package/dist/docs-layout-KoWNZc8_.js +0 -6
  31. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  32. package/dist/icons-dev-B_RZIyxu.js +0 -6
  33. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  34. package/dist/image-BHhTvQzr.cjs +0 -6
  35. package/dist/image-CqKzYD8f.js +0 -6
  36. package/dist/mdx-DudBEac0.js +0 -7
  37. package/dist/mdx-r4cDQxWu.cjs +0 -7
  38. package/dist/search-dialog-B584t9ZF.js +0 -6
  39. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  40. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  41. package/dist/search-dialog-D6BNohIJ.js +0 -6
  42. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  43. package/src/client/app/config-context.tsx +0 -51
  44. package/src/client/app/doc-page.tsx +0 -38
  45. package/src/client/app/docs-layout.tsx +0 -28
  46. package/src/client/app/head.tsx +0 -122
  47. package/src/client/app/helmet-compat.tsx +0 -36
  48. package/src/client/app/mdx-component.tsx +0 -8
  49. package/src/client/app/mdx-components-context.tsx +0 -72
  50. package/src/client/app/routes-context.tsx +0 -34
  51. package/src/client/app/scroll-handler.tsx +0 -74
  52. package/src/client/app/theme-context.tsx +0 -103
  53. package/src/client/app/ui-context.tsx +0 -42
  54. package/src/client/components/docs-layout-default.tsx +0 -85
  55. package/src/client/components/icons-dev.tsx +0 -282
  56. package/src/client/components/mdx/callout.tsx +0 -97
  57. package/src/client/components/mdx/card.tsx +0 -99
  58. package/src/client/components/mdx/cards.tsx +0 -27
  59. package/src/client/components/mdx/code-block.tsx +0 -184
  60. package/src/client/components/mdx/field.tsx +0 -33
  61. package/src/client/components/mdx/image.tsx +0 -44
  62. package/src/client/components/mdx/index.ts +0 -19
  63. package/src/client/components/mdx/table.tsx +0 -54
  64. package/src/client/components/mdx/typographics.tsx +0 -120
  65. package/src/client/components/mdx/use-code-block.ts +0 -34
  66. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  67. package/src/client/components/primitives/button-group.tsx +0 -54
  68. package/src/client/components/primitives/button.tsx +0 -6
  69. package/src/client/components/primitives/code-block.tsx +0 -120
  70. package/src/client/components/primitives/docs-layout.tsx +0 -125
  71. package/src/client/components/primitives/error-boundary.tsx +0 -107
  72. package/src/client/components/primitives/heading.tsx +0 -128
  73. package/src/client/components/primitives/helpers/observer.ts +0 -141
  74. package/src/client/components/primitives/image.tsx +0 -26
  75. package/src/client/components/primitives/link.tsx +0 -102
  76. package/src/client/components/primitives/menu.tsx +0 -137
  77. package/src/client/components/primitives/navbar.tsx +0 -466
  78. package/src/client/components/primitives/on-this-page.tsx +0 -430
  79. package/src/client/components/primitives/page-nav.tsx +0 -51
  80. package/src/client/components/primitives/popover.tsx +0 -28
  81. package/src/client/components/primitives/search-dialog.tsx +0 -193
  82. package/src/client/components/primitives/sidebar.tsx +0 -423
  83. package/src/client/components/primitives/skeleton.tsx +0 -26
  84. package/src/client/components/primitives/tabs.tsx +0 -70
  85. package/src/client/components/primitives/tooltip.tsx +0 -81
  86. package/src/client/components/primitives/types.ts +0 -11
  87. package/src/client/components/ui-base/banner.tsx +0 -66
  88. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  89. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  90. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  91. package/src/client/components/ui-base/github-stars.tsx +0 -29
  92. package/src/client/components/ui-base/icons.tsx +0 -240
  93. package/src/client/components/ui-base/index.ts +0 -16
  94. package/src/client/components/ui-base/last-updated.tsx +0 -27
  95. package/src/client/components/ui-base/navbar.tsx +0 -266
  96. package/src/client/components/ui-base/not-found.tsx +0 -26
  97. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  98. package/src/client/components/ui-base/page-nav.tsx +0 -50
  99. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  100. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  101. package/src/client/components/ui-base/sidebar.tsx +0 -92
  102. package/src/client/components/ui-base/tabs.tsx +0 -83
  103. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  104. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  105. package/src/client/hooks/index.ts +0 -13
  106. package/src/client/hooks/use-analytics.ts +0 -272
  107. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  108. package/src/client/hooks/use-i18n.ts +0 -182
  109. package/src/client/hooks/use-localized-to.ts +0 -113
  110. package/src/client/hooks/use-location.ts +0 -5
  111. package/src/client/hooks/use-navbar.ts +0 -130
  112. package/src/client/hooks/use-page-nav.ts +0 -46
  113. package/src/client/hooks/use-routes.ts +0 -108
  114. package/src/client/hooks/use-search-highlight.ts +0 -185
  115. package/src/client/hooks/use-search.ts +0 -118
  116. package/src/client/hooks/use-sidebar.ts +0 -205
  117. package/src/client/hooks/use-tabs.ts +0 -46
  118. package/src/client/hooks/use-version.ts +0 -111
  119. package/src/client/index.ts +0 -31
  120. package/src/client/mdx.ts +0 -2
  121. package/src/client/primitives.ts +0 -19
  122. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  123. package/src/client/ssg/create-routes.tsx +0 -473
  124. package/src/client/ssg/index.ts +0 -4
  125. package/src/client/ssg/mdx-page.tsx +0 -38
  126. package/src/client/store/boltdocs-context.tsx +0 -137
  127. package/src/client/theme/neutral.css +0 -141
  128. package/src/client/theme/reset.css +0 -189
  129. package/src/client/types.ts +0 -116
  130. package/src/client/utils/cn.ts +0 -6
  131. package/src/client/utils/copy-clipboard.ts +0 -22
  132. package/src/client/utils/get-base-file-path.ts +0 -21
  133. package/src/client/utils/github.ts +0 -121
  134. package/src/client/utils/i18n.ts +0 -23
  135. package/src/client/utils/path.ts +0 -9
  136. package/src/client/utils/react-to-text.ts +0 -34
  137. package/src/client/virtual.d.ts +0 -24
@@ -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
- }